//>>built
define("dijit/_editor/RichText","dojo/_base/array dojo/_base/config dojo/_base/declare dojo/_base/Deferred dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/_base/kernel dojo/keys dojo/_base/lang dojo/on dojo/query dojo/domReady dojo/sniff dojo/string dojo/topic dojo/_base/unload dojo/_base/url dojo/window ../_Widget ../_CssStateMixin ../selection ./range ./html ../focus ../main".split(" "),function(t,I,N,J,B,C,K,m,O,x,y,u,n,w,D,P,f,E,L,Q,F,G,R,S,T,v,z,
M,A){var q=N("dijit._editor.RichText",[R,S],{constructor:function(a){this.contentPreFilters=[];this.contentPostFilters=[];this.contentDomPreFilters=[];this.contentDomPostFilters=[];this.editingAreaStyleSheets=[];this.events=[].concat(this.events);this._keyHandlers={};a&&n.isString(a.value)&&(this.value=a.value);this.onLoadDeferred=new J},baseClass:"dijitEditor",inheritWidth:!1,focusOnLoad:!1,name:"",styleSheets:"",height:"300px",minHeight:"1em",isClosed:!0,isLoaded:!1,_SEPARATOR:"@@**%%__RICHTEXTBOUNDRY__%%**@@",
_NAME_CONTENT_SEP:"@@**%%:%%**@@",onLoadDeferred:null,isTabIndent:!1,disableSpellCheck:!1,postCreate:function(){this.domNode.tagName.toLowerCase();this.contentPreFilters=[n.trim,n.hitch(this,"_preFixUrlAttributes")].concat(this.contentPreFilters);f("mozilla")&&(this.contentPreFilters=[this._normalizeFontStyle].concat(this.contentPreFilters),this.contentPostFilters=[this._removeMozBogus].concat(this.contentPostFilters));f("webkit")&&(this.contentPreFilters=[this._removeWebkitBogus].concat(this.contentPreFilters),
this.contentPostFilters=[this._removeWebkitBogus].concat(this.contentPostFilters));if(f("ie")||f("trident"))this.contentPostFilters=[this._normalizeFontStyle].concat(this.contentPostFilters),this.contentDomPostFilters=[n.hitch(this,"_stripBreakerNodes")].concat(this.contentDomPostFilters);this.contentDomPostFilters=[n.hitch(this,"_stripTrailingEmptyNodes")].concat(this.contentDomPostFilters);this.inherited(arguments);L.publish(A._scopeName+"._editor.RichText::init",this)},startup:function(){this.inherited(arguments);
this.open();this.setupDefaultShortcuts()},setupDefaultShortcuts:function(){var a=n.hitch(this,function(e,d){return function(){return!this.execCommand(e,d)}}),b={b:a("bold"),i:a("italic"),u:a("underline"),a:a("selectall"),s:function(){this.save(!0)},m:function(){this.isTabIndent=!this.isTabIndent},1:a("formatblock","h1"),2:a("formatblock","h2"),3:a("formatblock","h3"),4:a("formatblock","h4"),"\\":a("insertunorderedlist")};f("ie")||(b.Z=a("redo"));for(var c in b)this.addKeyHandler(c,!0,!1,b[c])},events:["onKeyDown",
"onKeyUp"],captureEvents:[],_editorCommandsLocalized:!1,_localizeEditorCommands:function(){if(q._editorCommandsLocalized)this._local2NativeFormatNames=q._local2NativeFormatNames,this._native2LocalFormatNames=q._native2LocalFormatNames;else{q._editorCommandsLocalized=!0;q._local2NativeFormatNames={};q._native2LocalFormatNames={};this._local2NativeFormatNames=q._local2NativeFormatNames;this._native2LocalFormatNames=q._native2LocalFormatNames;for(var a="div p pre h1 h2 h3 h4 h5 h6 ol ul address".split(" "),
b="",c,e=0;c=a[e++];)b="l"!==c.charAt(1)?b+("\x3c"+c+"\x3e\x3cspan\x3econtent\x3c/span\x3e\x3c/"+c+"\x3e\x3cbr/\x3e"):b+("\x3c"+c+"\x3e\x3cli\x3econtent\x3c/li\x3e\x3c/"+c+"\x3e\x3cbr/\x3e");var d=m.create("div",{style:{position:"absolute",top:"0px",zIndex:10,opacity:.01},innerHTML:b});this.ownerDocumentBody.appendChild(d);a=n.hitch(this,function(){for(var l=d.firstChild;l;)try{this.selection.selectElement(l.firstChild);var g=l.tagName.toLowerCase();this._local2NativeFormatNames[g]=document.queryCommandValue("formatblock");
this._native2LocalFormatNames[this._local2NativeFormatNames[g]]=g;l=l.nextSibling.nextSibling}catch(k){}m.destroy(d)});this.defer(a)}},open:function(a){if(!this.onLoadDeferred||0<=this.onLoadDeferred.fired)this.onLoadDeferred=new J;this.isClosed||this.close();L.publish(A._scopeName+"._editor.RichText::open",this);1===arguments.length&&a.nodeName&&(this.domNode=a);var b=this.domNode;if(n.isString(this.value)){var c=this.value;b.innerHTML=""}else if(b.nodeName&&"textarea"==b.nodeName.toLowerCase()){var e=
this.textarea=b;this.name=e.name;c=e.value;b=this.domNode=this.ownerDocument.createElement("div");b.setAttribute("widgetId",this.id);e.removeAttribute("widgetId");b.cssText=e.cssText;b.className+=" "+e.className;m.place(b,e,"before");var d=n.hitch(this,function(){x.set(e,{display:"block",position:"absolute",top:"-1000px"});if(f("ie")){var h=e.style;this.__overflow=h.overflow;h.overflow="hidden"}});f("ie")?this.defer(d,10):d();if(e.form){var l=e.value;this.reset=function(){this.getValue()!==l&&this.replaceValue(l)};
w(e.form,"submit",n.hitch(this,function(){C.set(e,"disabled",this.disabled);e.value=this.getValue()}))}}else c=z.getChildrenHtml(b),b.innerHTML="";this.value=c;b.nodeName&&"LI"===b.nodeName&&(b.innerHTML=" \x3cbr\x3e");this.header=b.ownerDocument.createElement("div");b.appendChild(this.header);this.editingArea=b.ownerDocument.createElement("div");b.appendChild(this.editingArea);this.footer=b.ownerDocument.createElement("div");b.appendChild(this.footer);this.name||(this.name=this.id+"_AUTOGEN");if(""!==
this.name&&(!I.useXDomain||I.allowXdRichTextSave)){if((c=B.byId(A._scopeName+"._editor.RichText.value"))&&""!==c.value){d=c.value.split(this._SEPARATOR);for(var g=0,k;k=d[g++];)if(k=k.split(this._NAME_CONTENT_SEP),k[0]===this.name){this.value=k[1];d=d.splice(g,1);c.value=d.join(this._SEPARATOR);break}}q._globalSaveHandler||(q._globalSaveHandler={},Q.addOnUnload(function(){for(var h in q._globalSaveHandler){var r=q._globalSaveHandler[h];n.isFunction(r)&&r()}}));q._globalSaveHandler[this.id]=n.hitch(this,
"_saveContent")}this.isClosed=!1;c=this.editorObject=this.iframe=this.ownerDocument.createElement("iframe");c.id=this.id+"_iframe";c.style.border="none";c.style.width="100%";this._layoutMode?c.style.height="100%":7<=f("ie")?(this.height&&(c.style.height=this.height),this.minHeight&&(c.style.minHeight=this.minHeight)):c.style.height=this.height?this.height:this.minHeight;c.frameBorder=0;c._loadFunc=n.hitch(this,function(h){this.window=h;this.document=h.document;this.selection=new T.SelectionManager(h);
f("ie")&&this._localizeEditorCommands();this.onLoad(this.get("value"))});d=this._getIframeDocTxt().replace(/\\/g,"\\\\").replace(/'/g,"\\'");d=11>f("ie")?'javascript:document.open();try{parent.window;}catch(e){document.domain\x3d"'+document.domain+"\";}document.write('"+d+"');document.close()":"javascript: '"+d+"'";this.editingArea.appendChild(c);c.src=d;"LI"===b.nodeName&&(b.lastChild.style.marginTop="-1.2em");K.add(this.domNode,this.baseClass)},_local2NativeFormatNames:{},_native2LocalFormatNames:{},
_getIframeDocTxt:function(){var a=x.getComputedStyle(this.domNode);if(this["aria-label"])var b=this["aria-label"];else{var c=D('label[for\x3d"'+this.id+'"]',this.ownerDocument)[0]||B.byId(this["aria-labelledby"],this.ownerDocument);c&&(b=c.textContent||c.innerHTML||"")}c="\x3cdiv id\x3d'dijitEditorBody' role\x3d'textbox' aria-multiline\x3d'true' "+(b?" aria-label\x3d'"+E.escape(b)+"'":"")+"\x3e\x3c/div\x3e";var e=[a.fontWeight,a.fontSize,a.fontFamily].join(" "),d=a.lineHeight;d=0<=d.indexOf("px")?
parseFloat(d)/parseFloat(a.fontSize):0<=d.indexOf("em")?parseFloat(d):"normal";var l="",g=this;this.style.replace(/(^|;)\s*(line-|font-?)[^;]+/ig,function(k){k=k.replace(/^;/ig,"")+";";var h=k.split(":")[0];if(h){h=n.trim(h);h=h.toLowerCase();var r,p="";for(r=0;r<h.length;r++){var H=h.charAt(r);switch(H){case "-":r++,H=h.charAt(r).toUpperCase();default:p+=H}}x.set(g.domNode,p,"")}l+=k+";"});this.iframe.setAttribute("title",b);return["\x3c!DOCTYPE html\x3e","\x3chtml lang\x3d'"+(this.lang||y.locale.replace(/-.*/,
""))+"'"+(this.isLeftToRight()?"":" dir\x3d'rtl'")+"\x3e\n","\x3chead\x3e\n\x3cmeta http-equiv\x3d'Content-Type' content\x3d'text/html'\x3e\n",b?"\x3ctitle\x3e"+E.escape(b)+"\x3c/title\x3e":"","\x3cstyle\x3e\n\tbody,html {\n\t\tbackground:transparent;\n\t\tpadding: 1px 0 0 0;\n\t\tmargin: -1px 0 0 0;\n\t}\n\tbody,html,#dijitEditorBody { outline: none; }html { height: 100%; width: 100%; overflow: hidden; }\n",this.height?"\tbody,#dijitEditorBody { height: 100%; width: 100%; overflow: auto; }\n":"\tbody,#dijitEditorBody { min-height: "+
this.minHeight+"; width: 100%; overflow-x: auto; overflow-y: hidden; }\n","\tbody{\n\t\ttop:0px;\n\t\tleft:0px;\n\t\tright:0px;\n\t\tfont:",e,";\n",this.height||f("opera")?"":"\t\tposition: fixed;\n","\t\tline-height:",d,";\n\t}\n\tp{ margin: 1em 0; }\n\tli \x3e ul:-moz-first-node, li \x3e ol:-moz-first-node{ padding-top: 1.2em; }\n",f("ie")||f("trident")||f("edge")?"":"\tli{ min-height:1.2em; }\n","\x3c/style\x3e\n",this._applyEditingAreaStyleSheets(),"\n\x3c/head\x3e\n\x3cbody role\x3d'application'",
b?" aria-label\x3d'"+E.escape(b)+"'":"","onload\x3d'try{frameElement \x26\x26 frameElement._loadFunc(window,document)}catch(e){document.domain\x3d\""+document.domain+"\";frameElement._loadFunc(window,document)}' ","style\x3d'"+l+"'\x3e",c,"\x3c/body\x3e\n\x3c/html\x3e"].join("")},_applyEditingAreaStyleSheets:function(){var a=[];this.styleSheets&&(a=this.styleSheets.split(";"),this.styleSheets="");a=a.concat(this.editingAreaStyleSheets);this.editingAreaStyleSheets=[];for(var b="",c=0,e,d=G.get(this.ownerDocument);e=
a[c++];)e=(new F(d.location,e)).toString(),this.editingAreaStyleSheets.push(e),b+='\x3clink rel\x3d"stylesheet" type\x3d"text/css" href\x3d"'+e+'"/\x3e';return b},addStyleSheet:function(a){var b=a.toString(),c=G.get(this.ownerDocument);if("."===b.charAt(0)||"/"!==b.charAt(0)&&!a.host)b=(new F(c.location,b)).toString();-1<t.indexOf(this.editingAreaStyleSheets,b)||(this.editingAreaStyleSheets.push(b),this.onLoadDeferred.then(n.hitch(this,function(){if(this.document.createStyleSheet)this.document.createStyleSheet(b);
else{var e=this.document.getElementsByTagName("head")[0],d=this.document.createElement("link");d.rel="stylesheet";d.type="text/css";d.href=b;e.appendChild(d)}})))},removeStyleSheet:function(a){var b=a.toString(),c=G.get(this.ownerDocument);if("."===b.charAt(0)||"/"!==b.charAt(0)&&!a.host)b=(new F(c.location,b)).toString();a=t.indexOf(this.editingAreaStyleSheets,b);-1!==a&&(delete this.editingAreaStyleSheets[a],D('link[href\x3d"'+b+'"]',this.window.document).orphan())},disabled:!1,_mozSettingProps:{styleWithCSS:!1},
_setDisabledAttr:function(a){a=!!a;this._set("disabled",a);if(this.isLoaded){var b=f("ie")&&(this.isLoaded||!this.focusOnLoad);b&&(this.editNode.unselectable="on");this.editNode.contentEditable=!a;this.editNode.tabIndex=a?"-1":this.tabIndex;b&&this.defer(function(){this.editNode&&(this.editNode.unselectable="off")});if(f("mozilla")&&!a&&this._mozSettingProps){a=this._mozSettingProps;for(var c in a)if(a.hasOwnProperty(c))try{this.document.execCommand(c,!1,a[c])}catch(e){}}this._disabledOK=!0}},onLoad:function(a){this.window.__registeredWindow||
(this.window.__registeredWindow=!0,this._iframeRegHandle=M.registerIframe(this.iframe));this.editNode=this.document.body.firstChild;var b=this;this.beforeIframeNode=m.place("\x3cdiv tabIndex\x3d-1\x3e\x3c/div\x3e",this.iframe,"before");this.afterIframeNode=m.place("\x3cdiv tabIndex\x3d-1\x3e\x3c/div\x3e",this.iframe,"after");this.iframe.onfocus=this.document.onfocus=function(){b.editNode.focus()};this.focusNode=this.editNode;var c=this.events.concat(this.captureEvents),e=this.iframe?this.document:
this.editNode;this.own.apply(this,t.map(c,function(d){var l=d.toLowerCase().replace(/^on/,"");return w(e,l,n.hitch(this,d))},this));this.own(w(e,"mouseup",n.hitch(this,"onClick")));f("ie")&&(this.own(w(this.document,"mousedown",n.hitch(this,"_onIEMouseDown"))),this.editNode.style.zoom=1);f("webkit")&&(this._webkitListener=this.own(w(this.document,"mouseup",n.hitch(this,"onDisplayChanged")))[0],this.own(w(this.document,"mousedown",n.hitch(this,function(d){d=d.target;!d||d!==this.document.body&&d!==
this.document||this.defer("placeCursorAtEnd")}))));if(f("ie"))try{this.document.execCommand("RespectVisibilityInDesign",!0,null)}catch(d){}this.isLoaded=!0;this.set("disabled",this.disabled);c=n.hitch(this,function(){this.setValue(a);this.onLoadDeferred&&!this.onLoadDeferred.isFulfilled()&&this.onLoadDeferred.resolve(!0);this.onDisplayChanged();this.focusOnLoad&&P(n.hitch(this,"defer","focus",this.updateInterval));this.value=this.getValue(!0)});this.setValueDeferred?this.setValueDeferred.then(c):
c()},onKeyDown:function(a){if(a.keyCode===u.SHIFT||a.keyCode===u.ALT||a.keyCode===u.META||a.keyCode===u.CTRL)return!0;a.keyCode===u.TAB&&this.isTabIndent&&(a.stopPropagation(),a.preventDefault(),this.queryCommandEnabled(a.shiftKey?"outdent":"indent")&&this.execCommand(a.shiftKey?"outdent":"indent"));if(a.keyCode==u.TAB&&!this.isTabIndent&&!a.ctrlKey&&!a.altKey)return a.shiftKey?this.beforeIframeNode.focus():this.afterIframeNode.focus(),!0;9>f("ie")&&a.keyCode===u.BACKSPACE&&"Control"===this.document.selection.type&&
(a.stopPropagation(),a.preventDefault(),this.execCommand("delete"));f("ff")&&(a.keyCode===u.PAGE_UP||a.keyCode===u.PAGE_DOWN)&&this.editNode.clientHeight>=this.editNode.scrollHeight&&a.preventDefault();var b=this._keyHandlers[a.keyCode],c=arguments;b&&!a.altKey&&t.some(b,function(e){if(!(e.shift^a.shiftKey||e.ctrl^(a.ctrlKey||a.metaKey)))return e.handler.apply(this,c)||a.preventDefault(),!0},this);this.defer("onKeyPressed",1);return!0},onKeyUp:function(){},setDisabled:function(a){y.deprecated("dijit.Editor::setDisabled is deprecated",
'use dijit.Editor::attr("disabled",boolean) instead',2);this.set("disabled",a)},_setValueAttr:function(a){this.setValue(a)},_setDisableSpellCheckAttr:function(a){this.document?C.set(this.document.body,"spellcheck",!a):this.onLoadDeferred.then(n.hitch(this,function(){C.set(this.document.body,"spellcheck",!a)}));this._set("disableSpellCheck",a)},addKeyHandler:function(a,b,c,e){"string"==typeof a&&(a=a.toUpperCase().charCodeAt(0));n.isArray(this._keyHandlers[a])||(this._keyHandlers[a]=[]);this._keyHandlers[a].push({shift:c||
!1,ctrl:b||!1,handler:e})},onKeyPressed:function(){this.onDisplayChanged()},onClick:function(a){this.onDisplayChanged(a)},_onIEMouseDown:function(){this.focused||this.disabled||this.focus()},_onBlur:function(a){(f("ie")||f("trident"))&&this.defer(function(){M.curNode||this.ownerDocumentBody.focus()});this.inherited(arguments);var b=this.getValue(!0);if(b!==this.value)this.onChange(b);this._set("value",b)},_onFocus:function(a){this.disabled||(this._disabledOK||this.set("disabled",!1),this.inherited(arguments))},
blur:function(){!f("ie")&&this.window.document.documentElement&&this.window.document.documentElement.focus?this.window.document.documentElement.focus():this.ownerDocumentBody.focus&&this.ownerDocumentBody.focus()},focus:function(){this.isLoaded?9>f("ie")?this.iframe.fireEvent("onfocus",document.createEventObject()):this.editNode.focus():this.focusOnLoad=!0},updateInterval:200,_updateTimer:null,onDisplayChanged:function(){this._updateTimer&&this._updateTimer.remove();this._updateTimer=this.defer("onNormalizedDisplayChanged",
this.updateInterval)},onNormalizedDisplayChanged:function(){delete this._updateTimer},onChange:function(){},_normalizeCommand:function(a,b){var c=a.toLowerCase();"formatblock"===c?f("safari")&&void 0===b&&(c="heading"):"hilitecolor"!==c||f("mozilla")||(c="backcolor");return c},_implCommand:function(a){return"_"+this._normalizeCommand(a)+"EnabledImpl"},_qcaCache:{},queryCommandAvailable:function(a){var b=this._qcaCache[a];return void 0!==b?b:this._qcaCache[a]=this._queryCommandAvailable(a)},_queryCommandAvailable:function(a){switch(a.toLowerCase()){case "bold":case "italic":case "underline":case "subscript":case "superscript":case "fontname":case "fontsize":case "forecolor":case "hilitecolor":case "justifycenter":case "justifyfull":case "justifyleft":case "justifyright":case "delete":case "selectall":case "toggledir":case "createlink":case "unlink":case "removeformat":case "inserthorizontalrule":case "insertimage":case "insertorderedlist":case "insertunorderedlist":case "indent":case "outdent":case "formatblock":case "inserthtml":case "undo":case "redo":case "strikethrough":case "tabindent":case "cut":case "copy":case "paste":return!0;
case "blockdirltr":case "blockdirrtl":case "dirltr":case "dirrtl":case "inlinedirltr":case "inlinedirrtl":return f("ie")||f("trident")||f("edge");case "inserttable":case "insertcell":case "insertcol":case "insertrow":case "deletecells":case "deletecols":case "deleterows":case "mergecells":case "splitcell":return!f("webkit");default:return!1}},execCommand:function(a,b){this.focused&&this.focus();a=this._normalizeCommand(a,b);if(void 0!==b){if("heading"===a)throw Error("unimplemented");"formatblock"===
a&&(f("ie")||f("trident"))&&(b="\x3c"+b+"\x3e")}var c="_"+a+"Impl";if(this[c])var e=this[c](b);else if((b=1<arguments.length?b:null)||"createlink"!==a)e=this.document.execCommand(a,!1,b);this.onDisplayChanged();return e},queryCommandEnabled:function(a){if(this.disabled||!this._disabledOK)return!1;a=this._normalizeCommand(a);var b=this._implCommand(a);return this[b]?this[b](a):this._browserQueryCommandEnabled(a)},queryCommandState:function(a){if(this.disabled||!this._disabledOK)return!1;a=this._normalizeCommand(a);
try{return this.document.queryCommandState(a)}catch(b){return!1}},queryCommandValue:function(a){if(this.disabled||!this._disabledOK)return!1;a=this._normalizeCommand(a);if(f("ie")&&"formatblock"===a)a=this._native2LocalFormatNames[this.document.queryCommandValue(a)];else if(f("mozilla")&&"hilitecolor"===a){try{var b=this.document.queryCommandValue("styleWithCSS")}catch(c){b=!1}this.document.execCommand("styleWithCSS",!1,!0);a=this.document.queryCommandValue(a);this.document.execCommand("styleWithCSS",
!1,b)}else a=this.document.queryCommandValue(a);return a},_sCall:function(a,b){return this.selection[a].apply(this.selection,b)},placeCursorAtStart:function(){this.focus();var a=!1;if(f("mozilla"))for(var b=this.editNode.firstChild;b;){if(3===b.nodeType){if(0<b.nodeValue.replace(/^\s+|\s+$/g,"").length){a=!0;this.selection.selectElement(b);break}}else if(1===b.nodeType){a=!0;var c=b.tagName?b.tagName.toLowerCase():"";/br|input|img|base|meta|area|basefont|hr|link/.test(c)?this.selection.selectElement(b):
this.selection.selectElementChildren(b);break}b=b.nextSibling}else a=!0,this.selection.selectElementChildren(this.editNode);a&&this.selection.collapse(!0)},placeCursorAtEnd:function(){this.focus();var a=!1;if(f("mozilla"))for(var b=this.editNode.lastChild;b;){if(3===b.nodeType){if(0<b.nodeValue.replace(/^\s+|\s+$/g,"").length){a=!0;this.selection.selectElement(b);break}}else if(1===b.nodeType){a=!0;this.selection.selectElement(b.lastChild||b);break}b=b.previousSibling}else a=!0,this.selection.selectElementChildren(this.editNode);
a&&this.selection.collapse(!1)},getValue:function(a){return!this.textarea||!this.isClosed&&this.isLoaded?this.isLoaded?this._postFilterContent(null,a):this.value:this.textarea.value},_getValueAttr:function(){return this.getValue(!0)},setValue:function(a){if(this.isLoaded){if(!this.textarea||!this.isClosed&&this.isLoaded){a=this._preFilterContent(a);var b=this.isClosed?this.domNode:this.editNode;b.innerHTML=a;this._preDomFilterContent(b)}else this.textarea.value=a;this.onDisplayChanged();this._set("value",
this.getValue(!0))}else this.onLoadDeferred.then(n.hitch(this,function(){this.setValue(a)}))},replaceValue:function(a){this.isClosed?this.setValue(a):this.window&&this.window.getSelection&&!f("mozilla")?this.setValue(a):this.window&&this.window.getSelection?(a=this._preFilterContent(a),this.execCommand("selectall"),this.execCommand("inserthtml",a),this._preDomFilterContent(this.editNode)):this.document&&this.document.selection&&this.setValue(a);this._set("value",this.getValue(!0))},_preFilterContent:function(a){var b=
a;t.forEach(this.contentPreFilters,function(c){c&&(b=c(b))});return b},_preDomFilterContent:function(a){a=a||this.editNode;t.forEach(this.contentDomPreFilters,function(b){b&&n.isFunction(b)&&b(a)},this)},_postFilterContent:function(a,b){if(n.isString(a))var c=a;else a=a||this.editNode,this.contentDomPostFilters.length&&(b&&(a=n.clone(a)),t.forEach(this.contentDomPostFilters,function(e){a=e(a)})),c=z.getChildrenHtml(a);n.trim(c.replace(/^\xA0\xA0*/,"").replace(/\xA0\xA0*$/,"")).length||(c="");t.forEach(this.contentPostFilters,
function(e){c=e(c)});return c},_saveContent:function(){var a=B.byId(A._scopeName+"._editor.RichText.value");a&&(a.value&&(a.value+=this._SEPARATOR),a.value+=this.name+this._NAME_CONTENT_SEP+this.getValue(!0))},escapeXml:function(a,b){a=a.replace(/&/gm,"\x26amp;").replace(/</gm,"\x26lt;").replace(/>/gm,"\x26gt;").replace(/"/gm,"\x26quot;");b||(a=a.replace(/'/gm,"\x26#39;"));return a},getNodeHtml:function(a){y.deprecated("dijit.Editor::getNodeHtml is deprecated","use dijit/_editor/html::getNodeHtml instead",
2);return z.getNodeHtml(a)},getNodeChildrenHtml:function(a){y.deprecated("dijit.Editor::getNodeChildrenHtml is deprecated","use dijit/_editor/html::getChildrenHtml instead",2);return z.getChildrenHtml(a)},close:function(a){if(!this.isClosed){arguments.length||(a=!0);a&&this._set("value",this.getValue(!0));this.interval&&clearInterval(this.interval);this._webkitListener&&(this._webkitListener.remove(),delete this._webkitListener);f("ie")&&(this.iframe.onfocus=null);this.iframe._loadFunc=null;this._iframeRegHandle&&
(this._iframeRegHandle.remove(),delete this._iframeRegHandle);if(this.textarea){var b=this.textarea.style;b.position="";b.left=b.top="";f("ie")&&(b.overflow=this.__overflow,this.__overflow=null);this.textarea.value=this.value;m.destroy(this.domNode);this.domNode=this.textarea}else this.domNode.innerHTML=this.value;delete this.iframe;K.remove(this.domNode,this.baseClass);this.isClosed=!0;this.isLoaded=!1;delete this.editNode;delete this.focusNode;this.window&&this.window._frameElement&&(this.window._frameElement=
null);this.editorObject=this.editingArea=this.document=this.window=null}},destroy:function(){this.isClosed||this.close(!1);this._updateTimer&&this._updateTimer.remove();this.inherited(arguments);q._globalSaveHandler&&delete q._globalSaveHandler[this.id]},_removeMozBogus:function(a){return a.replace(/\stype="_moz"/gi,"").replace(/\s_moz_dirty=""/gi,"").replace(/_moz_resizing="(true|false)"/gi,"")},_removeWebkitBogus:function(a){a=a.replace(/\sclass="webkit-block-placeholder"/gi,"");a=a.replace(/\sclass="apple-style-span"/gi,
"");return a=a.replace(/<meta charset="utf-8" \/>/gi,"")},_normalizeFontStyle:function(a){return a.replace(/<(\/)?strong([ >])/gi,"\x3c$1b$2").replace(/<(\/)?em([ >])/gi,"\x3c$1i$2")},_preFixUrlAttributes:function(a){return a.replace(/(?:(<a(?=\s).*?\shref=)("|')(.*?)\2)|(?:(<a\s.*?href=)([^"'][^ >]+))/gi,"$1$4$2$3$5$2 _djrealurl\x3d$2$3$5$2").replace(/(?:(<img(?=\s).*?\ssrc=)("|')(.*?)\2)|(?:(<img\s.*?src=)([^"'][^ >]+))/gi,"$1$4$2$3$5$2 _djrealurl\x3d$2$3$5$2")},_browserQueryCommandEnabled:function(a){if(!a)return!1;
var b=9>f("ie")?this.document.selection.createRange():this.document;try{return b.queryCommandEnabled(a)}catch(c){return!1}},_createlinkEnabledImpl:function(){var a=!0;return a=f("opera")?this.window.getSelection().isCollapsed?!0:this.document.queryCommandEnabled("createlink"):this._browserQueryCommandEnabled("createlink")},_unlinkEnabledImpl:function(){var a=!0;return a=f("mozilla")||f("webkit")?this.selection.hasAncestorElement("a"):this._browserQueryCommandEnabled("unlink")},_inserttableEnabledImpl:function(){var a=
!0;return a=f("mozilla")||f("webkit")?!0:this._browserQueryCommandEnabled("inserttable")},_cutEnabledImpl:function(){var a=!0;f("webkit")?((a=this.window.getSelection())&&(a=a.toString()),a=!!a):a=this._browserQueryCommandEnabled("cut");return a},_copyEnabledImpl:function(){var a=!0;f("webkit")?((a=this.window.getSelection())&&(a=a.toString()),a=!!a):a=this._browserQueryCommandEnabled("copy");return a},_pasteEnabledImpl:function(){var a=!0;return f("webkit")?!0:a=this._browserQueryCommandEnabled("paste")},
_inserthorizontalruleImpl:function(a){return f("ie")?this._inserthtmlImpl("\x3chr\x3e"):this.document.execCommand("inserthorizontalrule",!1,a)},_unlinkImpl:function(a){return this.queryCommandEnabled("unlink")&&(f("mozilla")||f("webkit"))?(a=this.selection.getAncestorElement("a"),this.selection.selectElement(a),this.document.execCommand("unlink",!1,null)):this.document.execCommand("unlink",!1,a)},_hilitecolorImpl:function(a){if(!this._handleTextColorOrProperties("hilitecolor",a))if(f("mozilla")){this.document.execCommand("styleWithCSS",
!1,!0);var b=this.document.execCommand("hilitecolor",!1,a);this.document.execCommand("styleWithCSS",!1,!1)}else b=this.document.execCommand("hilitecolor",!1,a);return b},_backcolorImpl:function(a){f("ie")&&(a=a?a:null);var b=this._handleTextColorOrProperties("backcolor",a);b||(b=this.document.execCommand("backcolor",!1,a));return b},_forecolorImpl:function(a){f("ie")&&(a=a?a:null);var b=!1;(b=this._handleTextColorOrProperties("forecolor",a))||(b=this.document.execCommand("forecolor",!1,a));return b},
_inserthtmlImpl:function(a){a=this._preFilterContent(a);var b=!0;if(9>f("ie")){var c=this.document.selection.createRange();if("CONTROL"===this.document.selection.type.toUpperCase()){for(var e=c.item(0);c.length;)c.remove(c.item(0));e.outerHTML=a}else c.pasteHTML(a);c.select()}else if(8>f("trident")){var d=v.getSelection(this.window);if(d&&d.rangeCount&&d.getRangeAt){c=d.getRangeAt(0);c.deleteContents();var l=m.create("div");l.innerHTML=a;for(e=this.document.createDocumentFragment();a=l.firstChild;)var g=
e.appendChild(a);c.insertNode(e);g&&(c=c.cloneRange(),c.setStartAfter(g),c.collapse(!1),d.removeAllRanges(),d.addRange(c))}}else f("mozilla")&&!a.length?this.selection.remove():b=this.document.execCommand("inserthtml",!1,a);return b},_boldImpl:function(a){var b=!1;if(f("ie")||f("trident"))this._adaptIESelection(),b=this._adaptIEFormatAreaAndExec("bold");b||(b=this.document.execCommand("bold",!1,a));return b},_italicImpl:function(a){var b=!1;if(f("ie")||f("trident"))this._adaptIESelection(),b=this._adaptIEFormatAreaAndExec("italic");
b||(b=this.document.execCommand("italic",!1,a));return b},_underlineImpl:function(a){var b=!1;if(f("ie")||f("trident"))this._adaptIESelection(),b=this._adaptIEFormatAreaAndExec("underline");b||(b=this.document.execCommand("underline",!1,a));return b},_strikethroughImpl:function(a){var b=!1;if(f("ie")||f("trident"))this._adaptIESelection(),b=this._adaptIEFormatAreaAndExec("strikethrough");b||(b=this.document.execCommand("strikethrough",!1,a));return b},_superscriptImpl:function(a){var b=!1;if(f("ie")||
f("trident"))this._adaptIESelection(),b=this._adaptIEFormatAreaAndExec("superscript");b||(b=this.document.execCommand("superscript",!1,a));return b},_subscriptImpl:function(a){var b=!1;if(f("ie")||f("trident"))this._adaptIESelection(),b=this._adaptIEFormatAreaAndExec("subscript");b||(b=this.document.execCommand("subscript",!1,a));return b},_fontnameImpl:function(a){if(f("ie")||f("trident"))var b=this._handleTextColorOrProperties("fontname",a);b||(b=this.document.execCommand("fontname",!1,a));return b},
_fontsizeImpl:function(a){if(f("ie")||f("trident"))var b=this._handleTextColorOrProperties("fontsize",a);b||(b=this.document.execCommand("fontsize",!1,a));return b},_insertorderedlistImpl:function(a){var b=!1;if(f("ie")||f("trident")||f("edge"))b=this._adaptIEList("insertorderedlist",a);b||(b=this.document.execCommand("insertorderedlist",!1,a));return b},_insertunorderedlistImpl:function(a){var b=!1;if(f("ie")||f("trident")||f("edge"))b=this._adaptIEList("insertunorderedlist",a);b||(b=this.document.execCommand("insertunorderedlist",
!1,a));return b},getHeaderHeight:function(){return this._getNodeChildrenHeight(this.header)},getFooterHeight:function(){return this._getNodeChildrenHeight(this.footer)},_getNodeChildrenHeight:function(a){var b=0;if(a&&a.childNodes){var c;for(c=0;c<a.childNodes.length;c++){var e=O.position(a.childNodes[c]);b+=e.h}}return b},_isNodeEmpty:function(a,b){return 1===a.nodeType?0<a.childNodes.length?this._isNodeEmpty(a.childNodes[0],b):!0:3===a.nodeType?""===a.nodeValue.substring(b):!1},_removeStartingRangeFromRange:function(a,
b){if(a.nextSibling)b.setStart(a.nextSibling,0);else{for(var c=a.parentNode;c&&null==c.nextSibling;)c=c.parentNode;c&&b.setStart(c.nextSibling,0)}return b},_adaptIESelection:function(){var a=v.getSelection(this.window);if(a&&a.rangeCount&&!a.isCollapsed){for(var b=a.getRangeAt(0),c=b.startContainer,e=b.startOffset;3===c.nodeType&&e>=c.length&&c.nextSibling;)e-=c.length,c=c.nextSibling;for(var d=null;this._isNodeEmpty(c,e)&&c!==d;)d=c,b=this._removeStartingRangeFromRange(c,b),c=b.startContainer,e=
0;a.removeAllRanges();a.addRange(b)}},_adaptIEFormatAreaAndExec:function(a){var b=v.getSelection(this.window),c=this.document,e;if(a&&b&&b.isCollapsed){if(this.queryCommandValue(a)){a=this._tagNamesForCommand(a);var d=b.getRangeAt(0);var l=d.startContainer;if(3===l.nodeType){var g=d.endOffset;l.length<g&&(g=this._adjustNodeAndOffset(k,g),l=g.node,g=g.offset)}for(;l&&l!==this.editNode;){var k=l.tagName?l.tagName.toLowerCase():"";if(-1<t.indexOf(a,k)){var h=l;break}l=l.parentNode}if(h&&(k=d.startContainer,
a=c.createElement(h.tagName),m.place(a,h,"after"),k&&3===k.nodeType)){g=d.endOffset;k.length<g&&(g=this._adjustNodeAndOffset(k,g),k=g.node,g=g.offset);l=k.nodeValue;d=c.createTextNode(l.substring(0,g));var r=l.substring(g,l.length);r&&(e=c.createTextNode(r));m.place(d,k,"before");if(e){var p=c.createElement("span");p.className="ieFormatBreakerSpan";m.place(p,k,"after");m.place(e,p,"after");e=p}m.destroy(k);g=d.parentNode;for(k=[];g!==h;){l=g.tagName;d={tagName:l};k.push(d);l=c.createElement(l);g.style&&
l.style&&g.style.cssText&&(l.style.cssText=g.style.cssText,d.cssText=g.style.cssText);"FONT"===g.tagName&&(g.color&&(l.color=g.color,d.color=g.color),g.face&&(l.face=g.face,d.face=g.face),g.size&&(l.size=g.size,d.size=g.size));g.className&&(l.className=g.className,d.className=g.className);if(e)for(;e;)d=e.nextSibling,l.appendChild(e),e=d;l.tagName==g.tagName?(p=c.createElement("span"),p.className="ieFormatBreakerSpan",m.place(p,g,"after"),m.place(l,p,"after")):m.place(l,g,"after");d=g;e=l;g=g.parentNode}if(e){if(1===
e.nodeType||3===e.nodeType&&e.nodeValue)a.innerHTML="";for(;e;)d=e.nextSibling,a.appendChild(e),e=d}if(k.length){d=k.pop();e=c.createElement(d.tagName);d.cssText&&e.style&&(e.style.cssText=d.cssText);d.className&&(e.className=d.className);"FONT"===d.tagName&&(d.color&&(e.color=d.color),d.face&&(e.face=d.face),d.size&&(e.size=d.size));for(m.place(e,a,"before");k.length;)d=k.pop(),h=c.createElement(d.tagName),d.cssText&&h.style&&(h.style.cssText=d.cssText),d.className&&(h.className=d.className),"FONT"===
d.tagName&&(d.color&&(h.color=d.color),d.face&&(h.face=d.face),d.size&&(h.size=d.size)),e.appendChild(h),e=h;h=c.createTextNode(".");p.appendChild(h);e.appendChild(h)}else p=c.createElement("span"),p.className="ieFormatBreakerSpan",h=c.createTextNode("."),p.appendChild(h),m.place(p,a,"before");e=v.create(this.window);e.setStart(h,0);e.setEnd(h,h.length);b.removeAllRanges();b.addRange(e);this.selection.collapse(!1);h.parentNode.innerHTML="";a.firstChild||m.destroy(a);return!0}return!1}d=b.getRangeAt(0);
if((k=d.startContainer)&&3===k.nodeType)return g=d.startOffset,k.length<g&&(g=this._adjustNodeAndOffset(k,g),k=g.node,g=g.offset),l=k.nodeValue,d=c.createTextNode(l.substring(0,g)),r=l.substring(g),""!==r&&(e=c.createTextNode(l.substring(g))),p=c.createElement("span"),h=c.createTextNode("."),p.appendChild(h),d.length?m.place(d,k,"after"):d=k,m.place(p,d,"after"),e&&m.place(e,p,"after"),m.destroy(k),e=v.create(this.window),e.setStart(h,0),e.setEnd(h,h.length),b.removeAllRanges(),b.addRange(e),c.execCommand(a),
m.place(p.firstChild,p,"before"),m.destroy(p),e.setStart(h,0),e.setEnd(h,h.length),b.removeAllRanges(),b.addRange(e),this.selection.collapse(!1),h.parentNode.innerHTML="",!0}else return!1},_adaptIEList:function(a){var b=v.getSelection(this.window);if(b.isCollapsed&&b.rangeCount&&!this.queryCommandValue(a)){var c=b.getRangeAt(0),e=c.startContainer;if(e&&3==e.nodeType&&!c.startOffset)return c="ul","insertorderedlist"===a&&(c="ol"),a=this.document.createElement(c),c=m.create("li",null,a),m.place(a,e,
"before"),c.appendChild(e),m.create("br",null,a,"after"),a=v.create(this.window),a.setStart(e,0),a.setEnd(e,e.length),b.removeAllRanges(),b.addRange(a),this.selection.collapse(!0),!0}return!1},_handleTextColorOrProperties:function(a,b){var c=v.getSelection(this.window),e=this.document,d,l;b=b||null;if(a&&c&&c.isCollapsed&&c.rangeCount){var g=c.getRangeAt(0);if((d=g.startContainer)&&3===d.nodeType){var k=g.startOffset;d.length<k&&(g=this._adjustNodeAndOffset(d,k),d=g.node,k=g.offset);var h=d.nodeValue;
g=e.createTextNode(h.substring(0,k));""!==h.substring(k)&&(l=e.createTextNode(h.substring(k)));h=e.createElement("span");k=e.createTextNode(".");h.appendChild(k);e=e.createElement("span");h.appendChild(e);g.length?m.place(g,d,"after"):g=d;m.place(h,g,"after");l&&m.place(l,h,"after");m.destroy(d);d=v.create(this.window);d.setStart(k,0);d.setEnd(k,k.length);c.removeAllRanges();c.addRange(d);if(f("webkit")){c="color";if("hilitecolor"===a||"backcolor"===a)c="backgroundColor";x.set(h,c,b);this.selection.remove();
m.destroy(e);h.innerHTML="\x26#160;";this.selection.selectElement(h);this.focus()}else this.execCommand(a,b),m.place(h.firstChild,h,"before"),m.destroy(h),d.setStart(k,0),d.setEnd(k,k.length),c.removeAllRanges(),c.addRange(d),this.selection.collapse(!1),k.parentNode.removeChild(k);return!0}}return!1},_adjustNodeAndOffset:function(a,b){for(;a.length<b&&a.nextSibling&&3===a.nextSibling.nodeType;)b-=a.length,a=a.nextSibling;return{node:a,offset:b}},_tagNamesForCommand:function(a){return"bold"===a?["b",
"strong"]:"italic"===a?["i","em"]:"strikethrough"===a?["s","strike"]:"superscript"===a?["sup"]:"subscript"===a?["sub"]:"underline"===a?["u"]:[]},_stripBreakerNodes:function(a){if(this.isLoaded)return D(".ieFormatBreakerSpan",a).forEach(function(b){for(;b.firstChild;)m.place(b.firstChild,b,"before");m.destroy(b)}),a},_stripTrailingEmptyNodes:function(a){function b(c){return/^(p|div|br)$/i.test(c.nodeName)&&0==c.children.length&&/^[\s\xA0]*$/.test(c.textContent||c.innerText||"")||3===c.nodeType&&/^[\s\xA0]*$/.test(c.nodeValue)}
for(;a.lastChild&&b(a.lastChild);)m.destroy(a.lastChild);return a},_setTextDirAttr:function(a){this._set("textDir",a);this.onLoadDeferred.then(n.hitch(this,function(){this.editNode.dir=a}))}});return q});