AdfRichUIPeer.createPeerClass(AdfDhtmlInputBasePeer,"AdfDhtmlCodeEditorPeer",!1);AdfDhtmlCodeEditorPeer.InitSubclass=function(){AdfObject.ensureClassInitialization(AdfRichCodeEditor);AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.BLUR_EVENT_TYPE,AdfActionEvent.ACTION_EVENT_TYPE,AdfUIInputEvent.KEY_DOWN_EVENT_TYPE,AdfUIInputEvent.FOCUS_EVENT_TYPE);this.InitConstants()};
AdfDhtmlCodeEditorPeer.InitConstants=function(){this._CODEEDITOR_MARKER_PROPERTY_KEY="AdfCodeEditorMarkers";this._CODE_MIRROR_CSS_PATH_PREFIX="/afr/codemirror/";this._CODE_MIRROR_CSS=this._CODE_MIRROR_CSS_PATH_PREFIX+"codemirror.css";this._CODE_MIRROR_THEME_DEFAULT_CSS=this._CODE_MIRROR_CSS_PATH_PREFIX+"default.css";this._LANGUAGE_XML="xml";this._LANGUAGE_JAVASCRIPT="javascript";this._LANGUAGE_GROOVY="groovy";this.COMMAND_UNDO="cmd_undo";this.COMMAND_REDO="cmd_redo";this.COMMAND_SEARCH_NEXT="cmd_search_next";
this.COMMAND_SEARCH_PREVIOUS="cmd_search_previous";this.COMMAND_REPLACE_ALL="cmd_replace_all";this.COMMAND_REPLACE_NEXT="cmd_replace_next";this.COMMAND_JUMP="cmd_jump";this._CODE_EDITOR_CONTENT_INPUT_CONTAINER_ID="cc";this._CODE_EDITOR_CONTENT_INPUT_ID="ci";this._CODE_EDITOR_HIDDEN_SCROLLPOS_ID="hsp";this._CODE_EDITOR_LAZY_LOADING_IFRAME_ID="ll";this._CODE_EDITOR_LAZY_LOADING_VALUE_ID="llv";this._CODE_EDITOR_SEARCH_POPUP_ID="_afrSearchPopup";this._CODE_EDITOR_TOOLBAR_ID="tb";this._COMMAND_UNDO_BUTTON_ID=
"_afrUndo";this._COMMAND_REDO_BUTTON_ID="_afrRedo";this._COMMAND_SEARCH_NEXT_BUTTON_ID="_afrSearchNext";this._COMMAND_SEARCH_PREVIOUS_BUTTON_ID="_afrSearchPrevious";this._COMMAND_JUMP_BUTTON_ID="_afrJump";this._COMMAND_SEARCH_SHOW_BUTTON_ID="_afrSearchPopupShow";this._COMMAND_SEARCH_NEXT_POPUP_BUTTON_ID="_afrSearchNextPopup";this._COMMAND_SEARCH_PREVIOUS_POPUP_BUTTON_ID="_afrSearchPreviousPopup";this._COMMAND_REPLACE_ALL_POPUP_BUTTON_ID="_afrReplaceAllPopup";this._COMMAND_REPLACE_NEXT_POPUP_BUTTON_ID=
"_afrReplaceNextPopup";this._COMMAND_SEARCH_POPUP_FIELD_ID="_afrSearchPopupField";this._COMMAND_REPLACE_POPUP_FIELD_ID="_afrReplacePopupField";this._COMMAND_CASE_SENSITIVE_POPUP_CHECKBOX_ID="_afrCaseSensitivePopupField";this._COMMAND_WHOLE_WORDS_POPUP_CHECKBOX_ID="_afrWholeWordsPopupField";this._COMMAND_WRAP_POPUP_CHECKBOX_ID="_afrWrapPopupField";this._COMMAND_SEARCH_TOOLBAR_FIELD_ID="_afrSearchToolbarField";this._COMMAND_JUMP_FIELD_ID="_afrJumpField";this._CODEEDITOR_MESSAGE_SEPARATOR=", ";this._CODE_EDITOR_MARKERS_CONTENT_CONTAINER_CLASS=
"af|codeEditor::markers-content-container";this._CODE_EDITOR_MARKERS_CONTENT_CLASS="af|codeEditor::markers-content";this._CODE_EDITOR_MARKERS_LABEL_CLASS="af|codeEditor::markers-label";this._CODE_EDITOR_MARKERS_TEXT_CLASS="af|codeEditor::markers-text";this._CODE_EDITOR_EDITOR_LINES_CLASS="af|codeEditor::editor-lines";this._CODE_EDITOR_EDITOR_SCROLL_CLASS="af|codeEditor::editor-scroll";this._CODE_EDITOR_EDITOR_GUTTER_CLASS="af|codeEditor::editor-gutter";this._CODE_EDITOR_EDITOR_GUTTER_LINENUMBERS_CLASS=
"af|codeEditor::editor-gutter-linenumbers";this._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS="af|codeEditor::editor-search-highlight";this._CODE_EDITOR_EDITOR_MARKER_LINE_CLASS="af|codeEditor::editor-jump-highlight";this._CODE_EDITOR_EDITOR_MARKER_ERROR_CLASS="af|codeEditor::editor-marker-error";this._CODE_EDITOR_EDITOR_MARKER_FATAL_CLASS="af|codeEditor::editor-marker-fatal";this._CODE_EDITOR_EDITOR_MARKER_WARNING_CLASS="af|codeEditor::editor-marker-warning";this._CODE_EDITOR_EDITOR_MARKER_INFO_CLASS=
"af|codeEditor::editor-marker-info";this._CODE_EDITOR_EDITOR_TEXT_CLASS="af|codeEditor::editor-text";this._CODE_EDITOR_EDITOR_DISABLED_TEXT_CLASS="af|codeEditor::editor-disabled-text";this._CODE_EDITOR_SMALL_FATAL_ICON_CLASS="af|codeEditor::small-fatal-icon";this._CODE_EDITOR_SMALL_ERROR_ICON_CLASS="af|codeEditor::small-error-icon";this._CODE_EDITOR_SMALL_WARNING_ICON_CLASS="af|codeEditor::small-warning-icon";this._CODE_EDITOR_SMALL_INFO_ICON_CLASS="af|codeEditor::small-info-icon";this._CODE_EDITOR_MESSAGE_SUMMARY_TEXT_CLASS=
"af|codeEditor::message-summary-text";this._CODE_EDITOR_MESSAGE_ICON_STYLE_CLASS="af|codeEditor::message-icon-style";this._CODE_EDITOR_EDITOR_FOLD_MARKER_CLASS="af|codeEditor::editor-fold-marker";this._CODE_EDITOR_EDITOR_FOLD_GUTTER_CLASS="af|codeEditor::editor-fold-gutter";this._CODE_EDITOR_EDITOR_FOLD_GUTTER_OPEN_CLASS="af|codeEditor::editor-fold-gutter-open";this._CODE_EDITOR_EDITOR_FOLD_GUTTER_FOLDED_CLASS="af|codeEditor::editor-fold-gutter-folded";this._CODE_EDITOR_EDITOR_FOLD_GUTTER_OPEN_AFTER_CLASS=
"af|codeEditor::editor-fold-gutter-open-after";this._CODE_EDITOR_EDITOR_FOLD_GUTTER_FOLDED_AFTER_CLASS="af|codeEditor::editor-fold-gutter-folded-after";this._CODE_EDITOR_EDITOR_BREAKPOINTS_CLASS="af|codeEditor::editor-breakpoints";this._CODE_EDITOR_EDITOR_CODEMIRROR_CLASS="af|codeEditor::editor-codemirror";this._CODE_EDITOR_EDITOR_CODE_COMPLETIONS_CLASS="af|codeEditor::editor-code-completions";this._CODE_EDITOR_EDITOR_HINT_CLASS="af|codeEditor::editor-code-hint";this._CODE_EDITOR_EDITOR_HINT_ACTIVE_CLASS=
"af|codeEditor::editor-code-hint-active";this._CSS_MAP=[];this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_LINES_CLASS]=".CodeMirror-lines";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_SCROLL_CLASS]=".CodeMirror-scroll";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_GUTTER_CLASS]=".CodeMirror-gutter";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_GUTTER_LINENUMBERS_CLASS]=".CodeMirror-gutter-text";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_TEXT_CLASS]=
".CodeMirror pre";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_FOLD_MARKER_CLASS]=".CodeMirror-foldmarker";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_FOLD_GUTTER_CLASS]=".CodeMirror-foldgutter";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_FOLD_GUTTER_OPEN_CLASS]=".CodeMirror-foldgutter-open";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_FOLD_GUTTER_FOLDED_CLASS]=".CodeMirror-foldgutter-folded";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_FOLD_GUTTER_OPEN_AFTER_CLASS]=
".CodeMirror-foldgutter-open:after";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_FOLD_GUTTER_FOLDED_AFTER_CLASS]=".CodeMirror-foldgutter-folded:after";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_BREAKPOINTS_CLASS]=".breakpoints";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_CODEMIRROR_CLASS]=".CodeMirror";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_CODE_COMPLETIONS_CLASS]=".CodeMirror-hints";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_HINT_CLASS]=
".CodeMirror-hint";this._CSS_MAP[AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_HINT_ACTIVE_CLASS]="li.CodeMirror-hint-active"};AdfDhtmlCodeEditorPeer.prototype.getEditorInstance=function(a){return this._editor};
AdfDhtmlCodeEditorPeer.prototype.InitDomElement=function(a,b){AdfDhtmlCodeEditorPeer.superclass.InitDomElement.call(this,a,b);if(a){var d=a.getId();this._loaded=!1;AdfPage.PAGE.unregisterLoadingComponent(a);AdfPage.PAGE.registerLoadingComponent(a);this._addCSSResource(AdfPage.PAGE.getResourceURL(AdfDhtmlCodeEditorPeer._CODE_MIRROR_CSS),!1);this._markerInfoArray=[];"lazy"==a.getContentDelivery()&&this._createIframe(a);a.getSimple()||("auto"==b.style.height&&(b.style.height=""),"auto"==b.style.width&&
(b.style.width=""));this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_UNDO_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_UNDO,null);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_REDO_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_REDO,null);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_NEXT_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT,[d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_TOOLBAR_FIELD_ID,null,null,null]);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_PREVIOUS_BUTTON_ID,
AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_PREVIOUS,[d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_TOOLBAR_FIELD_ID,null,null,null]);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_REPLACE_ALL_POPUP_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_ALL,[d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_POPUP_FIELD_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_REPLACE_POPUP_FIELD_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_CASE_SENSITIVE_POPUP_CHECKBOX_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_WHOLE_WORDS_POPUP_CHECKBOX_ID]);this.addBinding(d+
AdfDhtmlCodeEditorPeer._COMMAND_REPLACE_NEXT_POPUP_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_NEXT,[d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_POPUP_FIELD_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_REPLACE_POPUP_FIELD_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_CASE_SENSITIVE_POPUP_CHECKBOX_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_WHOLE_WORDS_POPUP_CHECKBOX_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_WRAP_POPUP_CHECKBOX_ID]);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_NEXT_POPUP_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT,
[d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_POPUP_FIELD_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_CASE_SENSITIVE_POPUP_CHECKBOX_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_WHOLE_WORDS_POPUP_CHECKBOX_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_WRAP_POPUP_CHECKBOX_ID]);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_PREVIOUS_POPUP_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_PREVIOUS,[d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_POPUP_FIELD_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_CASE_SENSITIVE_POPUP_CHECKBOX_ID,d+
AdfDhtmlCodeEditorPeer._COMMAND_WHOLE_WORDS_POPUP_CHECKBOX_ID,d+AdfDhtmlCodeEditorPeer._COMMAND_WRAP_POPUP_CHECKBOX_ID]);this.addBinding(d+AdfDhtmlCodeEditorPeer._COMMAND_JUMP_BUTTON_ID,AdfDhtmlCodeEditorPeer.COMMAND_JUMP,d+AdfDhtmlCodeEditorPeer._COMMAND_JUMP_FIELD_ID);this._addContextChangeListeners(a);AdfDhtmlCodeEditorPeer._waitForCSSResourcesLoad(a,b)}};
AdfDhtmlCodeEditorPeer.prototype.addBinding=function(a,b,d){AdfAssert.assertString(a);AdfAssert.assertString(b);"cmd"==b.substring(0,3)?this._addCommandBinding(a,b,d):AdfLogger.LOGGER.severe("Unable to add binding [",b,"] for ",a," to ",this.getComponent().getClientId())};
AdfDhtmlCodeEditorPeer.prototype.executeBinding=function(a,b){for(var d=this._commandObservers,e=d.length,f=0;f<e;f++){var g=d[f];if(g.command==a&&(!b||b==g.componentId)){if(g.command==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_ALL||g.command==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT||g.command==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_PREVIOUS||g.command==AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_ALL||g.command==AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_NEXT||g.command==AdfDhtmlCodeEditorPeer.COMMAND_JUMP){d=
null;if(g.command==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_ALL||g.command==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT||g.command==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_PREVIOUS){var d=AdfPage.PAGE.findComponent(g.commandParameter[0]),h=AdfDhtmlEditableValuePeer.getContentNode(d,d.getPeer().getDomElement()),k=f=e=!1;if(null!=g.commandParameter[1]){var l=AdfPage.PAGE.findComponent(g.commandParameter[1]);l&&(e=l.getValue())}null!=g.commandParameter[2]&&(l=AdfPage.PAGE.findComponent(g.commandParameter[2]))&&
(f=l.getValue());null!=g.commandParameter[3]&&(l=AdfPage.PAGE.findComponent(g.commandParameter[3]))&&(k=l.getValue());l=h.value;if(null==h.value||0==h.value.length)l=d.getValue();d=[l,e,f,k]}else g.command==AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_ALL||g.command==AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_NEXT?(d=AdfPage.PAGE.findComponent(g.commandParameter[0]),h=AdfPage.PAGE.findComponent(g.commandParameter[1]),k=f=e=!1,null!=g.commandParameter[2]&&(l=AdfPage.PAGE.findComponent(g.commandParameter[2]))&&
(e=l.getValue()),null!=g.commandParameter[3]&&(l=AdfPage.PAGE.findComponent(g.commandParameter[3]))&&(f=l.getValue()),null!=g.commandParameter[4]&&(l=AdfPage.PAGE.findComponent(g.commandParameter[4]))&&(k=l.getValue()),d=[d.getValue(),h.getValue(),e,f,k]):g.command==AdfDhtmlCodeEditorPeer.COMMAND_JUMP&&(d=AdfPage.PAGE.findComponent(g.commandParameter),d=AdfDhtmlEditableValuePeer.getContentNode(d,d.getPeer().getDomElement()).value);return this._execCommand(g.command,d)}return this._execCommand(g.command,
g.commandParameter)}}return null};AdfDhtmlCodeEditorPeer.prototype.getReadyState=function(){return this._loaded?AdfUIComponent.STATE_COMPLETE:AdfUIComponent.STATE_LOADING};
AdfDhtmlCodeEditorPeer.prototype.HandleComponentBlur=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=this.getComponent();this._editorUpdated&&AdfPage.PAGE.clearMessages(b.getClientId());a={componentId:b.getClientId(),targetNode:a.getNativeEventTarget()};this._blurTimeout=page.scheduleTimer(this,this._onBlurTimeout,a,10)}else AdfDhtmlCodeEditorPeer.superclass.HandleComponentBlur.call(this,a)};
AdfDhtmlCodeEditorPeer.prototype.HandleComponentAction=function(a){if(void 0!=this._commandObservers){a.setPartial(!0);var b=a.getSource().getClientId(),d=this.getComponent().getId();b==d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_SHOW_BUTTON_ID&&(AdfDhtmlCodeEditorPeer._showPopup(this.getComponent(),d+AdfDhtmlCodeEditorPeer._CODE_EDITOR_SEARCH_POPUP_ID),a.cancel());for(var e=this._commandObservers,f=e.length,g=0;g<f;g++){var h=e[g];if(h.componentId==b){b=this.executeBinding(h.command,h.componentId);
this._handleContextChanged();h.componentId!=d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_NEXT_BUTTON_ID&&h.componentId!=d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_PREVIOUS_BUTTON_ID||b||(AdfPage.PAGE.findComponent(h.componentId).setProperty("disabled",!0,!1,!1),this._oldCommandValues=null);a.cancel();break}}}};
AdfDhtmlCodeEditorPeer.prototype.HandleComponentFocus=function(a){AdfDhtmlCodeEditorPeer.superclass.HandleComponentFocus.call(this,a);var b=this.getComponent();!b.getReadOnly()&&AdfDhtmlCodeEditorPeer._isInCodeContainer(b,a)&&(a=AdfDhtmlCodeEditorPeer._getCodeEditorContentNode(b),AdfDhtmlInputBasePeer.setLastValue(a),AdfDhtmlCodeEditorPeer._saveHiddenCursorPosition(b,this.getEditorInstance()))};
AdfDhtmlCodeEditorPeer.prototype.HandleComponentKeyDown=function(a){var b=this.getComponent(),d=a.getKeyCode(),e=a.getNativeEvent();if(AdfDhtmlCodeEditorPeer._isInCodeContainer(b,a))if(b=this.getEditorInstance(),AdfKeyStroke.F2_KEY==d&&(this._inEditngMode=!0,a.cancel()),this._inEditngMode)if(AdfKeyStroke.ESC_KEY==d)this._inEditngMode=!1;else{if(AdfKeyStroke.TAB_KEY==d)if(e.shiftKey)b.indentLine(b.getCursor(!0).line,"subtract");else CodeMirror.commands[b.getCursor(!0).line!=b.getCursor().line?"indentMore":
"insertTab"](b)}else AdfKeyStroke.TAB_KEY==a.getKeyCode()&&(this._undo(),e.shiftKey?AdfFocusUtils.focusPreviousTabStop(AdfPage.PAGE.getActiveDomElement()):AdfFocusUtils.focusNextTabStop(AdfPage.PAGE.getActiveDomElement()));else d=b.getId(),AdfKeyStroke.ENTER_KEY==a.getKeyCode()&&(a=AdfPage.PAGE.getActiveDomElement(),-1!=a.id.indexOf(d+AdfDhtmlCodeEditorPeer._COMMAND_JUMP_FIELD_ID)?this.executeBinding(AdfDhtmlCodeEditorPeer.COMMAND_JUMP,d+AdfDhtmlCodeEditorPeer._COMMAND_JUMP_BUTTON_ID):-1!=a.id.indexOf(b.getId()+
AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_TOOLBAR_FIELD_ID)&&this.executeBinding(AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT,d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_NEXT_BUTTON_ID))};
AdfDhtmlCodeEditorPeer.prototype.RunValidation=function(a,b,d){a.getClientId();this.getEditorInstance().save();if(AdfDomUtils.isAncestorOrSelf(this.getEditorInstance().getWrapperElement(),b)){b=AdfDhtmlCodeEditorPeer._getCodeEditorContentNode(a);var e=AdfDhtmlCodeEditorPeer._getHiddenCursorPosition(a);if(this.WasSubmitted(a)){var f=AdfDhtmlInputBasePeer.getLastValue(b),g=b.value;d&&g==f||(AdfDhtmlInputBasePeer.setLastValue(b,g),this.Validate(a,g))}null!=e&&(AdfDhtmlCodeEditorPeer._restoreCursorPosition(a,
e),this._editor.getScrollerElement().scrollTop=e.scrollTop,AdfDhtmlCodeEditorPeer._saveHiddenCursorPosition(a,this.getEditorInstance()))}};AdfDhtmlCodeEditorPeer.prototype.SetDisplayValue=function(a,b,d){AdfAssert.assertString(d);this.getEditorInstance().getValue()!=d&&(this.getEditorInstance().setValue(d),this.getEditorInstance().save())};
AdfDhtmlCodeEditorPeer.prototype.GetSubmittedValue=function(a,b){null!=this.getEditorInstance()&&(this.getEditorInstance().save(),this._editorUpdated=!1);var d=AdfDhtmlCodeEditorPeer._getCodeEditorContentNode(a).value;return null!=d&&0==d.length?null:d};
AdfDhtmlCodeEditorPeer.prototype.getHintsWrapper=function(a,b){var d=a.getCursor(),d=b._getHints(d.line,d.ch);AdfAssert.assert(null!=d);AdfAssert.assertArray(d.hints);AdfAssert.assertNumber(d.from.row);AdfAssert.assertNumber(d.to.row);AdfAssert.assertNumber(d.from.column);AdfAssert.assertNumber(d.to.column);return{list:d.hints,from:{line:d.from.row,ch:d.from.column},to:{line:d.to.row,ch:d.to.column}}};AdfDhtmlCodeEditorPeer.prototype.SetHintsFunction=function(a,b){a.getPeer()._getHints=b};
AdfDhtmlCodeEditorPeer.prototype.MessageNotify=function(a,b){AdfDhtmlCodeEditorPeer.superclass.MessageNotify.call(this,a,b);var d=AdfAgent.AGENT,e=AdfPage.PAGE.getLookAndFeel(),f="",g,h=this.getComponent(),k={errorCount:0,warningCount:0,infoCount:0,fatalCount:0};if(null!=b){var l=!0;g=!1;for(var m=AdfPage.PAGE.getDomDocument(),n=null,q=0;q<b.length;q++){var r=b[q].getProperty(AdfDhtmlCodeEditorPeer._CODEEDITOR_MARKER_PROPERTY_KEY);if(null!=r&&0<r.length)for(var n=m.createElement("table"),t=0;t<r.length;t++){var u=
r[t],v=u.getStartLine(),w=u.getStartColumn();null!=v&&null!=w&&(g=this._addMarker(u,l),this._addMessageIconOnGutter(u,h,g),k=this._incrementMessageCountObj(u,k),l=!1,v=this._getMessageStyleClass(u),u=m.createElement("tr"),n.appendChild(u),w=m.createElement("td"),AdfDomUtils.addCSSClassName(w,e.getStyleClass(AdfDhtmlCodeEditorPeer._CODE_EDITOR_MESSAGE_ICON_STYLE_CLASS)),d.setAttribute(w,"valign","top"),u.appendChild(w),w.appendChild(this._getMarkerImgDom(v)),v=m.createElement("td"),u.appendChild(v),
v.appendChild(this._getMarkerDom(g)),g=!0)}}g&&(q=this._getMarkersSubId(),g=this._getMarkersLabelSubId(),l=d.getElementById(q),r=d.getElementById(g),t=AdfDhtmlEditableValuePeer.getContentNode(h),r||(r=m.createElement("div"),r.id=g,AdfDomUtils.addCSSClassName(r,e.getStyleClass(AdfDhtmlCodeEditorPeer._CODE_EDITOR_MARKERS_LABEL_CLASS)),t.appendChild(r),g=AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_codeEditor.LABEL_MARKERS"),markersLabelTextNode=m.createTextNode(g),g=m.createElement("label"),
AdfDomUtils.addCSSClassName(g,e.getStyleClass(AdfDhtmlCodeEditorPeer._CODE_EDITOR_MESSAGE_SUMMARY_TEXT_CLASS)),v=u="",0<k.errorCount&&(v=AdfMessageUtils.getString(AdfFacesMessage.TYPE_ERROR,!1),f+=v+": "+k.errorCount),0<k.warningCount&&(v=AdfMessageUtils.getString(AdfFacesMessage.TYPE_WARNING,!1),0<f.length&&(u=AdfDhtmlCodeEditorPeer._CODEEDITOR_MESSAGE_SEPARATOR),f+=u+v+": "+k.warningCount),0<k.fatalCount&&(v=AdfMessageUtils.getString(AdfFacesMessage.TYPE_FATAL,!1),0<f.length&&(u=AdfDhtmlCodeEditorPeer._CODEEDITOR_MESSAGE_SEPARATOR),
f+=u+v+": "+k.fatalCount),0<k.infoCount&&(v=AdfMessageUtils.getString(AdfFacesMessage.TYPE_INFO,!1),0<f.length&&(u=AdfDhtmlCodeEditorPeer._CODEEDITOR_MESSAGE_SEPARATOR),f+=u+v+": "+k.infoCount),f=m.createTextNode(f),g.appendChild(f),r.appendChild(markersLabelTextNode),r.appendChild(g),d.elementsAdded(r)),l||(l=m.createElement("div"),l.id=q,AdfDomUtils.addCSSClassName(l,e.getStyleClass(AdfDhtmlCodeEditorPeer._CODE_EDITOR_MARKERS_CONTENT_CONTAINER_CLASS)),t.appendChild(l),f=m.createElement("div"),AdfDomUtils.addCSSClassName(f,
e.getStyleClass(AdfDhtmlCodeEditorPeer._CODE_EDITOR_MARKERS_CONTENT_CLASS)),l.appendChild(f),e=m.createElement("div"),f.appendChild(e),d.elementsAdded(l)),f=l.children[0],f.appendChild(n),this._resizeEditor(h))}};AdfDhtmlCodeEditorPeer.prototype.needsResizeNotify=function(a){return!0};AdfDhtmlCodeEditorPeer.prototype.resizeNotify=function(a,b,d,e,f){this._resizeEditor(a,f)};
AdfDhtmlCodeEditorPeer.prototype.VetoShowNoteWindow=function(a){if(this._editorUpdated)return!0;a=a.getClientId();if(AdfMessageUtils.hasMessagePopupContent(a)){a=AdfPage.PAGE.getMessages(a);for(var b=0;b<a.length;b++){var d=a[b];if(null!=d.getProperty&&"function"==typeof d.getProperty){var e=d.getProperty(AdfDhtmlCodeEditorPeer._CODEEDITOR_MARKER_PROPERTY_KEY);if(null!=e&&0<e.length&&null==d.getSummary()&&null==d.getDetail())return!0}}}return AdfDhtmlCodeEditorPeer.superclass.VetoShowNoteWindow.call(this)};
AdfDhtmlCodeEditorPeer.prototype._createIframe=function(a){var b=AdfAgent.AGENT,d=AdfPage.PAGE,e=a.getClientId(),e=AdfRichUIPeer.CreateSubId(e,AdfDhtmlCodeEditorPeer._CODE_EDITOR_LAZY_LOADING_IFRAME_ID),e=b.getElementById(e),f=this.getDomDocument().createElement("IFRAME");b.setAttribute(f,"frameBorder","0");b.setAttribute(f,"id",e.id);b.setAttribute(f,"src",d.getLazyFetchURI(a.getClientId()));b.setAttribute(f,"style","width: 0px; height: 0px; visibility:hidden;");a=this.createCallback(this._handleLoad);
b.addBubbleEventListener(f,"load",a);e.parentNode.replaceChild(f,e);b.elementsRemoved(e);b.elementsAdded(f)};AdfDhtmlCodeEditorPeer.prototype._handleLoad=function(a){a=this.getComponent();AdfDhtmlCodeEditorPeer._handleLoad(a)};AdfDhtmlCodeEditorPeer.prototype._addMarker=function(a,b){var d=a.getStartLine(),e=a.getStartColumn();null==e&&(e=1);b&&this._setCursor(d,e);d={};d.marker=a;d.id=this._markerInfoArray.push(d)-1;AdfDhtmlCodeEditorPeer._markText(this.getComponent(),a,d);return d};
AdfDhtmlCodeEditorPeer.prototype._addMessageIconOnGutter=function(a,b,d){AdfPage.PAGE.getLookAndFeel();b=a.getStartLine();a=this._getMessageStyleClass(a);a=this._getMarkerImgDom(a);d=document.createElement("div");var e=document.createElement("span");e.appendChild(a);d.appendChild(e);this.getEditorInstance().setGutterMarker(b-1,"breakpoints",d)};
AdfDhtmlCodeEditorPeer.prototype._getMessageStyleClass=function(a){var b="";a=AdfFacesMessage.getType(a.getSeverity());a==AdfFacesMessage.TYPE_ERROR?b=AdfDhtmlCodeEditorPeer._CODE_EDITOR_SMALL_ERROR_ICON_CLASS:a==AdfFacesMessage.TYPE_FATAL?b=AdfDhtmlCodeEditorPeer._CODE_EDITOR_SMALL_FATAL_ICON_CLASS:a==AdfFacesMessage.TYPE_WARNING?b=AdfDhtmlCodeEditorPeer._CODE_EDITOR_SMALL_WARNING_ICON_CLASS:a==AdfFacesMessage.TYPE_INFO&&(b=AdfDhtmlCodeEditorPeer._CODE_EDITOR_SMALL_INFO_ICON_CLASS);return b};
AdfDhtmlCodeEditorPeer.prototype._incrementMessageCountObj=function(a,b){var d=AdfFacesMessage.getType(a.getSeverity());d==AdfFacesMessage.TYPE_ERROR?b.errorCount++:d==AdfFacesMessage.TYPE_FATAL?b.fatalCount++:d==AdfFacesMessage.TYPE_WARNING?b.warningCount++:d==AdfFacesMessage.TYPE_INFO&&b.infoCount++;return b};AdfDhtmlCodeEditorPeer.prototype._editorBlur=function(a){a&&a.save()};
AdfDhtmlCodeEditorPeer.prototype._editorChange=function(a){a&&(this._editorUpdated=!0,AdfDhtmlCodeEditorPeer._saveHiddenCursorPosition(this.getComponent(),a))};AdfDhtmlCodeEditorPeer.prototype.Focus=function(){if(null!=this.getEditorInstance())this.getEditorInstance().focus();else{var a=this.getComponent();AdfPage.PAGE.scheduleTimer(a,a.focus,null,300)}};
AdfDhtmlCodeEditorPeer.prototype._onBlurTimeout=function(a){var b=AdfPage.PAGE;delete this._blurTimeout;var d=a.componentId,e=document.activeElement;!AdfDomUtils.isAncestorOrSelf(this.getDomElement(),e)&&(b=b.findComponent(d))&&(this.bind(b),this.RunValidation(b,a.targetNode,!0))};
AdfDhtmlCodeEditorPeer.prototype._resizeEditor=function(a,b){var d=a.getClientId(),e=AdfAgent.AGENT,f=e.getElementById(AdfRichUIPeer.CreateSubId(d,AdfDhtmlCodeEditorPeer._CODE_EDITOR_CONTENT_INPUT_CONTAINER_ID)),g=this._getMarkersSubId(),g=e.getElementById(g),h=e.getElementById(this._getMarkersLabelSubId());AdfDhtmlEditableValuePeer.getContentNode(a,this.getDomElement());d=e.getElementById(AdfRichUIPeer.CreateSubId(d,AdfDhtmlCodeEditorPeer._CODE_EDITOR_TOOLBAR_ID)).offsetHeight;if(g||h){var k=g.children[0],
l=this._getMaxMsgHeight(a);null!=k.children&&(h=h.offsetHeight,k=g.offsetHeight,k>l&&(k=l),e.setAttribute(f,"style","width:auto;height:"+(b-d-h-k)+"px;"),e.setAttribute(g,"style","width:auto;height:"+k+"px;"))}else e.setAttribute(f,"style","width:auto;height:"+(b-d)+"px")};
AdfDhtmlCodeEditorPeer.prototype._getMaxMsgHeight=function(a){var b=AdfAgent.AGENT,d=a.getClientId(),e=AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|codeEditor-tr-markers-max-height");a=AdfDhtmlEditableValuePeer.getContentNode(a,this.getDomElement()).clientHeight;d=b.getElementById(AdfRichUIPeer.CreateSubId(d,AdfDhtmlCodeEditorPeer._CODE_EDITOR_TOOLBAR_ID)).offsetHeight;b=b.getElementById(this._getMarkersLabelSubId()).offsetHeight;b=a-d-b;a=null;if(-1!==e.indexOf("%",e.length-1))a=b*e.substr(0,
e.length-1)/100;else if(-1!==e.indexOf("px",e.length-1)||NaN!=parseInt(e))a=NaN!=parseInt(e)?parseInt(e):parseInt(e.substr(0,e.length-2)),a=Math.min(b,a);return a};AdfDhtmlCodeEditorPeer.prototype._getMarkersSubId=function(){return AdfRichUIPeer.createSubId(this.getComponent().getClientId(),"markers")};AdfDhtmlCodeEditorPeer.prototype._getMarkersLabelSubId=function(){return AdfRichUIPeer.createSubId(this.getComponent().getClientId(),"markersLabel")};
AdfDhtmlCodeEditorPeer.prototype._getMarkerDom=function(a){var b=AdfAgent.AGENT,d=AdfPage.PAGE,e=d.getLookAndFeel(),d=d.getDomDocument(),f=a.marker,g=d.createElement("a");AdfDomUtils.addCSSClassName(g,e.getStyleClass(AdfDhtmlCodeEditorPeer._CODE_EDITOR_MARKERS_TEXT_CLASS));e=this._getMarkerString(f);g.title=e;g.href="javascript:;";b.setAttribute(g,"_markerInfoId",a.id);a=this.createCallback(this._jumpToMarker);AdfAgent.AGENT.addBubbleEventListener(g,"click",a);g.appendChild(d.createTextNode(e));return g};
AdfDhtmlCodeEditorPeer.prototype._getMarkerImgDom=function(a){return AdfPage.PAGE.getLookAndFeel().getIcon(a)};AdfDhtmlCodeEditorPeer.prototype._jumpToMarker=function(a){var b=AdfAgent.AGENT;b.preventDefault(a);if(a=b.getEventTarget(a).getAttribute("_markerInfoId")){var d=this._markerInfoArray[a];a=d.markText.find();b=d.marker.getStartLine();d=d.marker.getStartColumn();null!=a.from&&(b=a.from.line+1,d=a.from.ch+1);this._setCursor(b,d)}this.getComponent().focus()};
AdfDhtmlCodeEditorPeer.prototype._getMarkerString=function(a){var b="("+a.getStartLine()+","+a.getStartColumn()+") ",d=AdfFacesMessage.getType(a.getSeverity()),d=AdfMessageUtils.getString(d,!1),e=null;return e=null!=a.getMessage()?d+b+": "+a.getMessage():d+b+": "};
AdfDhtmlCodeEditorPeer.prototype._addCommandBinding=function(a,b,d){AdfAssert.assertString(a);AdfAssert.assertString(b);this._commandObservers||(this._commandObservers=[]);for(var e=this._commandObservers.length,f=null,g=0;g<e;g++){var h=this._commandObservers[g];if(h.componentId==a&&h.command==b){h.commandParameter=d;f=h;break}}null==f&&(f={componentId:a,command:b,commandParameter:d},this._commandObservers.push(f));(a=AdfPage.PAGE.findComponent(a))&&(a.isDescendant(this.getComponent())||a.addEventListener(AdfActionEvent.ACTION_EVENT_TYPE,
this._commandBindingActionListener,this))};AdfDhtmlCodeEditorPeer.prototype._removeCommandBindings=function(a){var b=this._commandObservers;if(void 0!=b)for(var d=b.length,e=this._commandBindingActionListener,f=0;f<d;f++){var g=AdfPage.PAGE.findComponent(b[f].componentId);void 0!=g&&(g.isDescendant(a)||g.removeEventListener(AdfActionEvent.ACTION_EVENT_TYPE,e,this))}};
AdfDhtmlCodeEditorPeer.prototype._execCommand=function(a,b){AdfAssert.assertString(a);if(a==AdfDhtmlCodeEditorPeer.COMMAND_UNDO)return this._undo();if(a==AdfDhtmlCodeEditorPeer.COMMAND_REDO)return this._redo();if(a==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT){if(null!=b[0])return this._searchNext(b)}else if(a==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_PREVIOUS){if(null!=b[0])return this._searchPrevious(b)}else if(a==AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_ALL){if(null!=b[0]&&null!=b[1])return this._replaceAll(b)}else if(a==
AdfDhtmlCodeEditorPeer.COMMAND_REPLACE_NEXT){if(null!=b[0]&&null!=b[1])return this._replaceNext(b)}else if(a==AdfDhtmlCodeEditorPeer.COMMAND_JUMP&&null!=b)return this._jump(b);return null};
AdfDhtmlCodeEditorPeer.prototype._addContextChangeListeners=function(a){var b=AdfAgent.AGENT,d=a.getId();a=AdfDhtmlCodeEditorPeer._getCodeEditorContentNode(a).parentNode;var e=b.getElementById(d+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_TOOLBAR_FIELD_ID),d=b.getElementById(d+AdfDhtmlCodeEditorPeer._COMMAND_JUMP_FIELD_ID);this._contextChangeCallback=this.createCallback(this._handleContextChanged);b.addBubbleEventListener(a,"mouseup",this._contextChangeCallback);b.addBubbleEventListener(a,"keyup",this._contextChangeCallback);
e&&b.addBubbleEventListener(e,"keyup",this._contextChangeCallback);d&&b.addBubbleEventListener(d,"keyup",this._contextChangeCallback)};
AdfDhtmlCodeEditorPeer.prototype._handleContextChanged=function(){var a=this.getComponent();if(a&&a&&!a.getDisabled())if(this._loaded){var a=this._commandObservers,b=a.length,d=this._oldCommandValues,e=this.getEditorInstance().historySize(),f=this.getComponent().getId();if(void 0==d||null==d)d={};for(var g={},h=0;h<b;h++){var k=a[h],l=k.command,m=AdfPage.PAGE.findComponent(k.componentId);if(m){var n=!1;void 0===g[l]&&(l==AdfDhtmlCodeEditorPeer.COMMAND_UNDO?(g[l]=e.undo&&0<e.undo?!0:!1,n=!0):l==AdfDhtmlCodeEditorPeer.COMMAND_REDO?
(g[l]=e.redo&&0<e.redo?!0:!1,n=!0):l==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_NEXT?k.componentId==f+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_NEXT_BUTTON_ID&&(k=AdfPage.PAGE.findComponent(k.commandParameter[0]),k=k.getSubmittedValue(),g[l]=null!=k&&0<k.length?!0:!1,n=!0):l==AdfDhtmlCodeEditorPeer.COMMAND_SEARCH_PREVIOUS?k.componentId==f+AdfDhtmlCodeEditorPeer._COMMAND_SEARCH_PREVIOUS_BUTTON_ID&&(k=AdfPage.PAGE.findComponent(k.commandParameter[0]),k=k.getSubmittedValue(),g[l]=null!=k&&0<k.length?!0:!1,
n=!0):l==AdfDhtmlCodeEditorPeer.COMMAND_JUMP&&k.componentId==f+AdfDhtmlCodeEditorPeer._COMMAND_JUMP_FIELD_ID&&(k=AdfPage.PAGE.findComponent(k.commandParameter).getSubmittedValue(),g[l]=null!=k&&0<k.length?!0:!1,n=!0));d[l]!==g[l]&&n&&m.setProperty("disabled",!g[l],!1,!1)}}this._oldCommandValues=g}else{var q=a.getPeer();setTimeout(function(){q._handleContextChanged()},500)}};AdfDhtmlCodeEditorPeer.prototype._undo=function(){var a=this.getEditorInstance();a.undo();a.save();return a.historySize().undo};
AdfDhtmlCodeEditorPeer.prototype._redo=function(){var a=this.getEditorInstance();a.redo();a.save();return a.historySize().redo};AdfDhtmlCodeEditorPeer.prototype._jump=function(a){this._unmarkLine();this._markLine(a);this._setCursor(a,1)};
AdfDhtmlCodeEditorPeer.prototype._getSearchCursor=function(a,b,d){var e=this.getEditorInstance(),f=!1;if(!this._searchText)f=!0;else if(this._searchText.text!=a||this._searchText.caseSensitive!=b||this._searchText.wholeWords!=d)f=!0;if(f){f=1!=b;this._searchText={text:a,caseSensitive:b,wholeWords:d};b=!1;var g=null;if(d){d="g";f&&(d+="i");if(a)for(g=0;g<a.length;g++)if(128<a.charCodeAt(g)){b=!0;break}g=b?new RegExp("(^|\\s)[!-//:-@[-`{-~]?"+a+"[!-//:-@[-`{-~]?(?\x3d\\s|$)",d):new RegExp("\\b"+a+"\\b",
d);this._searchCursor=e.getSearchCursor(g,{line:0,ch:0},f)}else this._searchCursor=e.getSearchCursor(a,{line:0,ch:0},f);this._isInitSearchCursor=!0}else this._isInitSearchCursor=!1;return this._searchCursor};
AdfDhtmlCodeEditorPeer.prototype._searchNext=function(a){var b=a[0],d=a[1],e=a[2];a=a[3];var f=AdfPage.PAGE.getLookAndFeel();this._unmark();if(!b)return!1;var g=this.getEditorInstance(),b=this._getSearchCursor(b,d,e);if(b.findNext())return this._getMarked().push({markerClass:AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS,marker:g.markText(b.from(),b.to(),{className:f.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS)})}),this._setCursor(b.from().line,b.from().ch),
!0;if(!this._isInitSearchCursor&&a){for(;b.findPrevious(););if(b.findNext())return this._getMarked().push({markerClass:AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS,marker:g.markText(b.from(),b.to(),{className:f.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS)})}),this._setCursor(b.from().line,b.from().ch),!0}return!1};
AdfDhtmlCodeEditorPeer.prototype._searchPrevious=function(a){var b=a[0],d=a[1],e=a[2];a=a[3];var f=AdfPage.PAGE.getLookAndFeel();this._unmark();if(!b)return!1;var g=this.getEditorInstance(),b=this._getSearchCursor(b,d,e);if(b.findPrevious())return this._getMarked().push({markerClass:AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS,marker:g.markText(b.from(),b.to(),{className:f.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS)})}),this._setCursor(b.from().line,
b.from().ch),!0;if(!this._isInitSearchCursor&&a){for(;b.findNext(););if(b.findPrevious())return this._getMarked().push({markerClass:AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS,marker:g.markText(b.from(),b.to(),{className:f.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS)})}),this._setCursor(b.from().line,b.from().ch),!0}return!1};
AdfDhtmlCodeEditorPeer.prototype._replaceAll=function(a){var b=a[0],d=a[1],e=a[2],f=a[3];AdfPage.PAGE.getLookAndFeel();a=this.getEditorInstance();this._unmark();if(!b)return!1;this._getSearchCursor(null,e,f);f=this._getSearchCursor(b,e);b=[];for(e=!1;f.findNext();)b.push({from:f.from(),to:f.to()}),e=!0;for(f=0;f<b.length;f++)a.replaceRange(d,b[f].from,b[f].to);a.save();return e};
AdfDhtmlCodeEditorPeer.prototype._replaceNext=function(a){var b=a[0],d=a[1],e=a[2],f=a[3];a=a[4];var g=AdfPage.PAGE.getLookAndFeel(),h=!1,k=!1;if(!b)return!1;for(var l=this.getEditorInstance(),b=this._getSearchCursor(b,e,f),e=0;e<this._getMarked().length;e++)if(this._getMarked()[e].markerClass==AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS&&(f=this._getMarked()[e].marker.find(),f.from.ch==b.pos.from.ch&&f.from.line==b.pos.from.line&&f.to.ch==b.pos.to.ch&&f.to.line==b.pos.to.line)){k=
!0;break}k||b.findNext()&&(k=!0);if(k)l.replaceRange(d,b.from(),b.to()),this._unmark(),b.findNext()&&(this._getMarked().push({markerClass:AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS,marker:l.markText(b.from(),b.to(),{className:g.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS)})}),this._setCursor(b.from().line,b.from().ch)),h=!0;else if(this._isInitSearchCursor)h=!1;else if(a){for(;b.findPrevious(););b.findNext()?(l.replaceRange(d,b.from(),b.to()),
this._unmark(),b.findNext()&&(this._getMarked().push({markerClass:AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS,marker:l.markText(b.from(),b.to(),{className:g.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_SEARCH_CLASS)})}),this._setCursor(b.from().line,b.from().ch)),h=!0):h=!1}l.save();return h};AdfDhtmlCodeEditorPeer.prototype._setCursor=function(a,b){AdfDhtmlCodeEditorPeer._setCursor(this.getComponent(),a,b)};
AdfDhtmlCodeEditorPeer.prototype._unmark=function(){for(var a=0;a<this._getMarked().length;a++)this._getMarked()[a].marker.clear();this._getMarked().length=0};AdfDhtmlCodeEditorPeer.prototype._unmarkLine=function(){this._markedLine&&this._markedLine.clear()};AdfDhtmlCodeEditorPeer.prototype._getMarked=function(){null==this._marked&&(this._marked=[]);return this._marked};
AdfDhtmlCodeEditorPeer.prototype._markLine=function(a){this._markedLine=this.getEditorInstance().markText({line:a-1,ch:0},{line:a-1,ch:9999},{className:AdfPage.PAGE.getLookAndFeel().getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_LINE_CLASS)})};
AdfDhtmlCodeEditorPeer.prototype._addCSSResource=function(a,b){var d=AdfAgent.AGENT,e=d.getDomDocument();this._loadedCss||(this._loadedCss=[]);if(1!=this._loadedCss[a]){this._loadedCss[a]=!1;for(var f=AdfDomUtils.getFirstDescendentElement(e.documentElement,"HEAD"),g=f.getElementsByTagName("LINK"),h=null,k=0;k<g.length;k++){var l=g[k];if(l.getAttribute("href")!=a){h=l;break}}for(k=0;k<g.length;k++)if(l=g[k],l.getAttribute("href")==a)if(b){l.parentNode.removeChild(l);break}else return;d.getPlatform()==
AdfAgent.IE_PLATFORM&&11>d.getVersion()?e.createStyleSheet(a):(l=e.createElement("link"),l.setAttribute("type","text/css"),l.setAttribute("rel","stylesheet"),l.setAttribute("href",a),h?f.insertBefore(l,h):f.appendChild(l))}};AdfDhtmlCodeEditorPeer._retrieveCssContent=function(a,b){if(!a||0===a.length)return"";for(var d=null,e=AdfRichUIPeer.DISABLED_STYLECLASS,f=0,g=a.length;f<g;f++){var h=a[f].indexOf(e);if(b&&-1<h){d=a[f];break}else if(!b&&-1===h){d=a[f];break}}return null===d?"":AdfDhtmlCodeEditorPeer._getCSSText(d)};
AdfDhtmlCodeEditorPeer._initCodeMirror=function(a,b){var d=AdfAgent.AGENT,e=a.getClientId(),f=a.getPeer(),g=AdfPage.PAGE.getLookAndFeel(),h=a.getDisabled(),k;for(k in AdfDhtmlCodeEditorPeer._CSS_MAP){var l="."+g.getSkinProperty(k),m=AdfDhtmlCodeEditorPeer._CSS_MAP[k],l=AdfDhtmlCodeEditorPeer._getCSS("(^|\\s|,)\\"+l+"([{|,|\\.|\\s]|$)",!0);null!=l&&AdfDhtmlCodeEditorPeer._addCSSStyle(a,m,AdfDhtmlCodeEditorPeer._retrieveCssContent(l,h))}h&&(g="."+g.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_DISABLED_TEXT_CLASS),
g=AdfDhtmlCodeEditorPeer._getCSS("(^|\\s|,)\\"+g+"([{|,|\\.|\\s]|$)",!0),AdfDhtmlCodeEditorPeer._replaceCSS(a,"^\\.cm-s-default span\\.cm",AdfDhtmlCodeEditorPeer._retrieveCssContent(g,h)));k=a.getLanguage();h=!1;if(a.getDisabled()||a.getReadOnly())h=!0;(g={java:"text/x-java",text:"text/plain"}[k])||(g=k);k=!0;"no"==a.getLineNumbers()&&(k=!1);var m=AdfDhtmlCodeEditorPeer._getCodeEditorContentNode(a),l=!1,n;"enabled"==a.getCodeFold()&&(n=function(a){a.foldCode(a.getCursor())},l=!0);f._editor=CodeMirror.fromTextArea(m,
{gutter:!0,lineNumbers:k,matchBrackets:!0,mode:g,readOnly:h,theme:"default",inputStyle:"contenteditable",leaveSubmitMethodAlone:!0,foldGutter:l,gutters:["CodeMirror-linenumbers","breakpoints","CodeMirror-foldgutter"],extraKeys:{"Ctrl-Q":n,"Ctrl-Space":function(a){CodeMirror.showHint(a,function(a){return f.getHintsWrapper(a,f)})}}});f._editor&&(f._editor.on("blur",f.createCallback(f._editorBlur)),f._editor.on("change",f.createCallback(f._editorChange)));n=AdfDhtmlCodeEditorPeer._getHiddenCursorPosition(a);
null==n||a.getDisabled()||AdfDhtmlCodeEditorPeer._restoreCursorPosition(a,n);d.getElementById(AdfRichUIPeer.CreateSubId(e,AdfDhtmlCodeEditorPeer._CODE_EDITOR_TOOLBAR_ID)).style.visibility="visible";d=d.getElementById(AdfRichUIPeer.CreateSubId(e,AdfDhtmlCodeEditorPeer._CODE_EDITOR_CONTENT_INPUT_CONTAINER_ID));if(e=AdfDhtmlCodeEditorPeer._getCodeMirrorCodeNode(d))(n=a.getLabel())?e.setAttribute("aria-label",n):e.setAttribute("aria-label",""),e.setAttribute("aria-multiline","true"),e.setAttribute("role",
"textbox");d.style.visibility="visible";AdfDhtmlCodeEditorPeer._setLoaded(a)};
AdfDhtmlCodeEditorPeer._addCSSStyle=function(a,b,d){var e=a.getPeer();a=AdfAgent.AGENT;var f=AdfPage.PAGE.getDomDocument();null==e._styleElement&&(e._styleElement=f.createElement("style"),e._styleElement.type="text/css",f.getElementsByTagName("head")[0].appendChild(e._styleElement));e=e._styleElement;e.styleSheet?a.getPlatform()==AdfAgent.IE_PLATFORM?""!=d&&e.styleSheet.addRule(b,d):e.styleSheet.addRule(b,d):e.appendChild(f.createTextNode(b+" {"+d+"}"))};
AdfDhtmlCodeEditorPeer._checkCSSResourceLoaded=function(a,b){for(var d=AdfAgent.AGENT,e=a.getPeer(),f=AdfPage.PAGE.getDomDocument(),g=0;g<f.styleSheets.length;g++){var h=f.styleSheets[g];if(AdfDhtmlCodeEditorPeer._isCodeMirrorStyleSheet(h,b))try{if(d.getPlatform()==AdfAgent.IE_PLATFORM){if(h.rules){e._loadedCss[b]=!0;break}}else if(h.cssRules){e._loadedCss[b]=!0;break}}catch(k){}}};
AdfDhtmlCodeEditorPeer._getCodeEditorContentNode=function(a){var b=AdfAgent.AGENT;a=a.getClientId();a=AdfRichUIPeer.CreateSubId(a,AdfDhtmlCodeEditorPeer._CODE_EDITOR_CONTENT_INPUT_ID);return b.getElementById(a)};
AdfDhtmlCodeEditorPeer._getCSS=function(a,b){for(var d=AdfAgent.AGENT,e=AdfPage.PAGE.getDomDocument(),f=new RegExp(a),g=[],h=0;h<e.styleSheets.length;h++){var k=e.styleSheets[h];if(AdfDhtmlCodeEditorPeer._isRelevantStyleSheet(k,b))if(d.getPlatform()==AdfAgent.IE_PLATFORM){if(k=k.rules,null!=k)for(var l=0;l<k.length;l++){var m=k.item(l);f.test(m.selectorText)&&g.push(m.selectorText+" {"+m.style.cssText+"}")}}else if(k=k.cssRules,null!=k)for(l=0;l<k.length;l++){var m=k[l],n=AdfDhtmlCodeEditorPeer._getCSSSelector(m.cssText);
null!=n&&f.test(n)&&g.push(m.cssText)}}return g};AdfDhtmlCodeEditorPeer._getCSSSelector=function(a){var b=null;null!=a&&(b=a.substring(0,a.indexOf("{")-1),b=b.replace(/^\s+|\s+$/g,""));return b};AdfDhtmlCodeEditorPeer._getCSSText=function(a){a=a.substring(a.indexOf("{")+1,a.indexOf("}"));return a=a.replace(/^\s+|\s+$/g,"")};
AdfDhtmlCodeEditorPeer._getHiddenCursorPosition=function(a){var b=AdfAgent.AGENT;a=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlCodeEditorPeer._CODE_EDITOR_HIDDEN_SCROLLPOS_ID);a=b.getElementById(a);b=b.getAttribute(a,"value");return null!=b&&(b=b.split(","),null!=b&&5==b.length)?{start:{line:Number(b[0]),ch:Number(b[1])},end:{line:Number(b[2]),ch:Number(b[3])},scrollTop:Number(b[4])}:null};
AdfDhtmlCodeEditorPeer._isCodeMirrorStyleSheet=function(a,b){return b?a.href&&a.href.match(b+"$")==b:a.href&&-1!=a.href.indexOf(AdfDhtmlCodeEditorPeer._CODE_MIRROR_CSS_PATH_PREFIX)};AdfDhtmlCodeEditorPeer._isAdfStyleSheet=function(a){a=a.ownerNode;return a.hasAttribute("data-afr-stylesheet")&&!a.hasAttribute("afrres")};AdfDhtmlCodeEditorPeer._isRelevantStyleSheet=function(a,b){return b?AdfDhtmlCodeEditorPeer._isAdfStyleSheet(a):AdfDhtmlCodeEditorPeer._isCodeMirrorStyleSheet(a)};
AdfDhtmlCodeEditorPeer._restoreCursorPosition=function(a,b){var d=a.getPeer();b.start.line==b.end.line&&b.start.ch==b.end.ch?d._editor.setCursor(Number(b.start.line),Number(b.start.ch)):d._editor.setSelection(b.start,b.end)};
AdfDhtmlCodeEditorPeer._handleLoad=function(a){var b=AdfAgent.AGENT,d=a.getClientId(),e=a.getPeer(),f=AdfRichUIPeer.CreateSubId(d,AdfDhtmlCodeEditorPeer._CODE_EDITOR_LAZY_LOADING_IFRAME_ID),d=AdfRichUIPeer.CreateSubId(d,AdfDhtmlCodeEditorPeer._CODE_EDITOR_LAZY_LOADING_VALUE_ID),b=b.getElementById(f),b=b.contentWindow||b.contentDocument;b.document&&(b=b.document);d=b.getElementById(d).value;null!=d&&(e=e.getEditorInstance(),null!=e?(b=AdfDhtmlCodeEditorPeer._getHiddenCursorPosition(a),e.setValue(d),
e.save(),null!=b&&AdfDhtmlCodeEditorPeer._restoreCursorPosition(a,b)):setTimeout(function(){AdfDhtmlCodeEditorPeer._handleLoad(a)},1E3))};
AdfDhtmlCodeEditorPeer._isInCodeContainer=function(a,b){var d=AdfAgent.AGENT,e=a.getClientId(),e=AdfRichUIPeer.CreateSubId(e,AdfDhtmlCodeEditorPeer._CODE_EDITOR_CONTENT_INPUT_CONTAINER_ID),f=b.getNativeEventTarget(),g=!1;d.getAttribute(f,"id")==e&&(g=!0);if(!g)for(f=f.parentNode;null!=f&&null!=f.parentNode;)if(d.getAttribute(f,"id")==e){g=!0;break}else f=f.parentNode;return g};
AdfDhtmlCodeEditorPeer._markText=function(a,b,d){var e=AdfPage.PAGE.getLookAndFeel(),f=a.getPeer().getEditorInstance();if(null!=f){var g=b.getStartLine(),h=b.getStartColumn(),k=b.getEndLine(),l=b.getEndColumn();null==h&&(h=1);null==l&&(l=f.lineInfo(k-1).text.length+1);var m=AdfFacesMessage.getType(b.getSeverity()),n=null;m==AdfFacesMessage.TYPE_ERROR?n=e.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_ERROR_CLASS):m==AdfFacesMessage.TYPE_FATAL?n=e.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_FATAL_CLASS):
m==AdfFacesMessage.TYPE_WARNING?n=e.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_WARNING_CLASS):m==AdfFacesMessage.TYPE_INFO&&(n=e.getSkinProperty(AdfDhtmlCodeEditorPeer._CODE_EDITOR_EDITOR_MARKER_INFO_CLASS));d.markText=f.markText({line:g-1,ch:h-1},{line:k-1,ch:l-1},{className:n})}else setTimeout(function(){AdfDhtmlCodeEditorPeer._markText(a,b,d)},1E3)};
AdfDhtmlCodeEditorPeer._removeCSSStyle=function(a){for(var b=AdfAgent.AGENT,d=AdfPage.PAGE.getDomDocument(),e=0;e<d.styleSheets.length;e++){var f=d.styleSheets[e];if(!AdfDhtmlCodeEditorPeer._isCodeMirrorStyleSheet(f))break;if(b.getPlatform()==AdfAgent.IE_PLATFORM)for(var g=f.rules,h=0;h<g.length;h++){if(g[h].selectorText==a){f.removeRule[h];break}}else for(g=f.cssRules,h=0;h<g.length;h++)if(AdfDhtmlCodeEditorPeer._getCSSSelector(g[h].cssText)==a){f.deleteRule[h];break}}};
AdfDhtmlCodeEditorPeer._replaceCSS=function(a,b,d){b=AdfDhtmlCodeEditorPeer._getCSS(b,!1);for(var e=0;e<b.length;e++){var f=AdfDhtmlCodeEditorPeer._getCSSSelector(b[e]);AdfDhtmlCodeEditorPeer._removeCSSStyle(f);AdfDhtmlCodeEditorPeer._addCSSStyle(a,f,d)}};
AdfDhtmlCodeEditorPeer._setCursor=function(a,b,d){var e=a.getPeer().getEditorInstance();if(null!=e){b&&0<b&&--b;d&&0<d&&--d;var f=e.getCursor();f.line==b&&f.ch==d&&(0<b?e.setCursor({line:b-1,ch:d}):e.setCursor({line:b+1,ch:d}));e.setCursor({line:b,ch:d})}else setTimeout(function(){AdfDhtmlCodeEditorPeer._setCursor(a,b,d)},1E3)};
AdfDhtmlCodeEditorPeer._saveHiddenCursorPosition=function(a,b){var d=AdfAgent.AGENT;if(a){var e=a.getClientId(),e=AdfRichUIPeer.CreateSubId(e,AdfDhtmlCodeEditorPeer._CODE_EDITOR_HIDDEN_SCROLLPOS_ID),e=d.getElementById(e),f=b.getCursor(!0).line+","+b.getCursor(!0).ch,g=b.getCursor(!1).line+","+b.getCursor(!1).ch,h=b.getScrollerElement().scrollTop;d.setAttribute(e,"value",f+","+g+","+h)}};
AdfDhtmlCodeEditorPeer._setLoaded=function(a,b){var d=AdfAgent.AGENT,e=a.getClientId(),f=a.getPeer();0==d.getElementById(AdfRichUIPeer.CreateSubId(e,AdfDhtmlCodeEditorPeer._CODE_EDITOR_CONTENT_INPUT_CONTAINER_ID)).clientWidth?setTimeout(function(){AdfDhtmlCodeEditorPeer._setLoaded(a,!0)},500):setTimeout(function(){(d.getPlatform()==AdfAgent.IE_PLATFORM||b)&&f._editor.refresh();f._handleContextChanged();f._loaded=!0;AdfPage.PAGE.unregisterLoadingComponent(f.getComponent())},1E3)};
AdfDhtmlCodeEditorPeer._showPopup=function(a,b){AdfPage.PAGE.clearMessages(a.getClientId());var d=AdfPage.PAGE.findComponent(b),e={};e[AdfRichPopup.HINT_LAUNCH_ID]=a.getClientId();d.show(e)};
AdfDhtmlCodeEditorPeer._waitForCSSResourcesLoad=function(a,b){var d=a.getPeer();if(d){var e=!0,f;for(f in d._loadedCss)AdfDhtmlCodeEditorPeer._checkCSSResourceLoaded(a,f),0==d._loadedCss[f]&&(e=!1);e?AdfDhtmlCodeEditorPeer._initCodeMirror(a,b):setTimeout(function(){AdfDhtmlCodeEditorPeer._waitForCSSResourcesLoad(a,b)},2E3)}};AdfDhtmlCodeEditorPeer._getCodeMirrorCodeNode=function(a){return a&&(a=a.getElementsByClassName("CodeMirror-code"))?a[0]:null};