text: !function(i){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=i,o.c=n,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(i,n,function(e){return t[e]}.bind(null,n));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/asset//",o(o.s=299)}({12:function(e,t,o){"use strict";var i,n,r=(n={},function(e){if(void 0===n[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}n[e]=t}return n[e]}),d=[];function c(e){for(var t=-1,i=0;i<d.length;i++)if(d[i].identifier===e){t=i;break}return t}function s(e,t){for(var i={},n=[],o=0;o<e.length;o++){var r=e[o],a=t.base?r[0]+t.base:r[0],s=i[a]||0,l="".concat(a," ").concat(s);i[a]=s+1;s=c(l),r={css:r[1],media:r[2],sourceMap:r[3]};-1!==s?(d[s].references++,d[s].updater(r)):d.push({identifier:l,updater:function(t,e){var i,n,o;{var r;o=e.singleton?(r=h++,i=f=f||u(e),n=m.bind(null,i,r,!1),m.bind(null,i,r,!0)):(i=u(e),n=function(e,t,i){var n=i.css,o=i.media,i=i.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,i,e),function(){var e;null!==(e=i).parentNode&&e.parentNode.removeChild(e)})}return n(t),function(e){e?e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap||n(t=e):o()}}(r,t),references:1}),n.push(l)}return n}function u(e){var t,i=document.createElement("style"),n=e.attributes||{};if(void 0!==n.nonce||(t=o.nc)&&(n.nonce=t),Object.keys(n).forEach(function(e){i.setAttribute(e,n[e])}),"function"==typeof e.insert)e.insert(i);else{e=r(e.insert||"head");if(!e)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");e.appendChild(i)}return i}var a,l=(a=[],function(e,t){return a[e]=t,a.filter(Boolean).join("\n")});function m(e,t,i,n){i=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;e.styleSheet?e.styleSheet.cssText=l(t,i):(n=document.createTextNode(i),(i=e.childNodes)[t]&&e.removeChild(i[t]),i.length?e.insertBefore(n,i[t]):e.appendChild(n))}var f=null,h=0;e.exports=function(e,r){(r=r||{}).singleton||"boolean"==typeof r.singleton||(r.singleton=i=void 0===i?Boolean(window&&document&&document.all&&!window.atob):i);var a=s(e=e||[],r);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var t=0;t<a.length;t++){var i=c(a[t]);d[i].references--}for(var e=s(e,r),n=0;n<a.length;n++){var o=c(a[n]);0===d[o].references&&(d[o].updater(),d.splice(o,1))}a=e}}}},13:function(e,t,i){"use strict";e.exports=function(i){var l=[];return l.toString=function(){return this.map(function(e){var t=i(e);return e[2]?"@media ".concat(e[2]," {").concat(t,"}"):t}).join("")},l.i=function(e,t,i){"string"==typeof e&&(e=[[null,e,""]]);var n={};if(i)for(var o=0;o<this.length;o++){var r=this[o][0];null!=r&&(n[r]=!0)}for(var a=0;a<e.length;a++){var s=[].concat(e[a]);i&&n[s[0]]||(t&&(s[2]?s[2]="".concat(t," and ").concat(s[2]):s[2]=t),l.push(s))}},l}},262:function(e,t,i){"use strict";var n=i(13),n=i.n(n)()(function(e){return e[1]});n.push([e.i,'.edui-default .edui-for-wechatcustomemotion .edui-icon:before {\n  content: "\\e60e";\n}\n.editor-wechatcustomemotion {\n  width: 408px;\n  padding: 10px;\n}\n.editor-wechatcustomemotion a.item {\n  display: inline-block;\n  width: 32px;\n  height: 32px;\n  border: 1px solid #EEE;\n  text-align: center;\n  cursor: pointer;\n}\n.editor-wechatcustomemotion a.item:hover {\n  background: #F8F8F8;\n}\n.editor-wechatcustomemotion a.item img {\n  width: 24px;\n  height: 24px;\n  margin-top: 4px;\n}\n',""]),t.a=n},299:function(e,t,i){!function(o){i(300),i(301),i(302),i(305);var r={toolbarCallback:function(e,t){if("insertimage"===e)return window.__selectorDialogServer?window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/image",callback:function(e){t.execCommand("insertHtml",e.map(e=>'<p><img src="'+e.path+'" /></p>').join("\n"))}}).show():alert("Missing Config : window.__selectorDialogServer"),!0},imageConfig:{disableUpload:!0,disableOnline:!0,selectCallback:function(e,t){window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/image",callback:function(e){e.length&&t({path:e[0].path,name:e[0].filename})}}).show()}},videoConfig:{disableUpload:!0,selectCallback:function(e,t){window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/video",callback:function(e){e.length&&t({path:e[0].path,name:e[0].filename})}}).show()}}},e={basic:function(e,t,i){var n=o.extend({server:"",width:null,height:100,ready:function(){}},t),t=["source","autotypeset","removeformat","paragraph","fontsize","forecolor","insertimage","uploadimage","insertvideo","bold","italic","underline","strikethrough","indent","justifyleft","justifycenter","justifyright","link","unlink","insertcode"];"__editorBasicToolBars"in window&&(t=window.__editorBasicToolBars);i=o.extend({toolbars:[t],serverUrl:n.server,wordCount:!1,elementPathEnabled:!1,initialFrameHeight:n.height,initialFrameWidth:n.width,enableAutoSave:!1,pasteplain:!1,autoHeightEnabled:!0,focus:!1},r,i),i=UE.getEditor(e,i);return i.ready(function(){n.ready()}),i},simple:function(e,t,i){var n=o.extend({server:"",width:null,height:100,ready:function(){}},t),t=["fontsize","forecolor","insertimage","uploadimage","bold","italic","underline","strikethrough","insertcode"];"__editorSimpleToolBars"in window&&(t=window.__editorSimpleToolBars);i=o.extend({toolbars:[t],serverUrl:n.server,wordCount:!1,elementPathEnabled:!1,initialFrameHeight:n.height,initialFrameWidth:n.width,enableAutoSave:!1,pasteplain:!1,retainOnlyLabelPasted:!0,autoHeightEnabled:!0,focus:!1},r,i),i=UE.getEditor(e,i);return i.ready(function(){n.ready()}),i},raw:UE};window.api.editor=e,"MS"in window||(window.MS={}),window.MS.editor=e,window.MS.editorUploadConfig=r}.call(this,i(6))},300:function(e,t){function i(e,t){return e=e||self.document.URL||self.location.href,t=t||(i=document.getElementsByTagName("script"))[i.length-1].src,/^(\/|\\\\)/.test(i=t)?i=/^.+?\w(\/|\\\\)/.exec(e)[0]+t.replace(/^(\/|\\\\)/,""):/^[a-z]+:/i.test(t)||(i=(e=e.split("#")[0].split("?")[0].replace(/[^\\\/]+$/,""))+""+t),function(e){var t,i=/^[a-z]+:\/\//.exec(e)[0],n=[];for((e=(e=e.replace(i,"").split("?")[0].split("#")[0]).replace(/\\/g,"/").split(/\//))[e.length-1]="";e.length;)".."===(t=e.shift())?n.pop():"."!==t&&n.push(t);return i+n.join("/")}(i);var i}var n,o;n=window.UEDITOR_HOME_URL||(window.__msCDN?window.__msCDN+"asset/vendor/ueditor/":window.__msRoot?window.__msRoot+"asset/vendor/ueditor/":i()),o=window.__msRoot?window.__msRoot+"asset/vendor/ueditor/":i(),window.UEDITOR_CONFIG={UEDITOR_HOME_URL:n,UEDITOR_CORS_URL:o,serverUrl:"/ueditor-plus/_demo_server/handle.php",toolbars:[["fullscreen","source","|","undo","redo","|","bold","italic","underline","fontborder","strikethrough","superscript","subscript","removeformat","formatmatch","autotypeset","blockquote","pasteplain","|","forecolor","backcolor","insertorderedlist","insertunorderedlist","selectall","cleardoc","|","rowspacingtop","rowspacingbottom","lineheight","|","customstyle","paragraph","fontfamily","fontsize","|","directionalityltr","directionalityrtl","indent","|","justifyleft","justifycenter","justifyright","justifyjustify","|","touppercase","tolowercase","|","link","unlink","anchor","|","imagenone","imageleft","imageright","imagecenter","|","simpleupload","insertimage","emotion","scrawl","insertvideo","attachment","map","insertframe","insertcode","pagebreak","template","background","|","horizontal","date","time","spechars","wordimage","|","inserttable","deletetable","insertparagraphbeforetable","insertrow","deleterow","insertcol","deletecol","mergecells","mergeright","mergedown","splittocells","splittorows","splittocols","|","print","preview","searchreplace","help"]],toolbarCallback:function(e,t){},imageConfig:{disableUpload:!1,disableOnline:!1,selectCallback:null},videoConfig:{disableUpload:!1,selectCallback:null},shortcutMenu:["fontfamily","fontsize","bold","italic","underline","strikethrough","fontborder","forecolor","justifyleft","justifycenter","justifyright","justifyjustify","lineheight","insertorderedlist","insertunorderedlist","superscript","subscript","link","unlink","touppercase","tolowercase"]},window.UE={getUEBasePath:i}},301:function(module,exports){!function(){UEDITOR_CONFIG=window.UEDITOR_CONFIG||{};var baidu=window.baidu||{};window.baidu=baidu,window.UE=baidu.editor={plugins:{},commands:{},instants:{},I18N:{},_customizeUI:{},version:"2.1.0"};var dom=UE.dom={},browser=UE.browser=function(){var e=navigator.userAgent.toLowerCase(),t=window.opera,i={ie:/(msie\s|trident.*rv:)([\w.]+)/i.test(e),opera:!!t&&t.version,webkit:-1<e.indexOf(" applewebkit/"),mac:-1<e.indexOf("macintosh"),quirks:"BackCompat"==document.compatMode};i.gecko="Gecko"==navigator.product&&!i.webkit&&!i.opera&&!i.ie;var n,o,r=0;return i.ie&&(n=e.match(/(?:msie\s([\w.]+))/),o=e.match(/(?:trident.*rv:([\w.]+))/),r=n&&o&&n[1]&&o[1]?Math.max(+n[1],+o[1]):n&&n[1]?+n[1]:o&&o[1]?+o[1]:0,i.ie11Compat=11==document.documentMode,i.ie9Compat=9==document.documentMode,i.ie8=!!document.documentMode,i.ie8Compat=8==document.documentMode,i.ie7Compat=7==r&&!document.documentMode||7==document.documentMode,i.ie6Compat=r<7||i.quirks,i.ie9above=8<r,i.ie9below=r<9,i.ie11above=10<r,i.ie11below=r<11),!i.gecko||(o=e.match(/rv:([\d\.]+)/))&&(r=1e4*(o=o[1].split("."))[0]+100*(o[1]||0)+ +(o[2]||0)),/chrome\/(\d+\.\d)/i.test(e)&&(i.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e)&&!/chrome/i.test(e)&&(i.safari=+(RegExp.$1||RegExp.$2)),i.opera&&(r=parseFloat(t.version())),i.webkit&&(r=parseFloat(e.match(/ applewebkit\/(\d+)/)[1])),i.version=r,i.isCompatible=!i.mobile&&(i.ie&&6<=r||i.gecko&&10801<=r||i.opera&&9.5<=r||i.air&&1<=r||i.webkit&&522<=r||!1),i}(),ie=browser.ie,webkit=browser.webkit,gecko=browser.gecko,opera=browser.opera,utils=UE.utils={each:function(e,t,i){if(null!=e)if(e.length===+e.length){for(var n=0,o=e.length;n<o;n++)if(!1===t.call(i,e[n],n,e))return!1}else for(var r in e)if(e.hasOwnProperty(r)&&!1===t.call(i,e[r],r,e))return!1},makeInstance:function(e){var t=new Function;return t.prototype=e,e=new t,t.prototype=null,e},extend:function(e,t,i){if(t)for(var n in t)i&&e.hasOwnProperty(n)||(e[n]=t[n]);return e},extend2:function(e){for(var t=arguments,i=1;i<t.length;i++){var n,o=t[i];for(n in o)e.hasOwnProperty(n)||(e[n]=o[n])}return e},inherits:function(e,t){var i=e.prototype,t=utils.makeInstance(t.prototype);return utils.extend(t,i,!0),(e.prototype=t).constructor=e},bind:function(e,t){return function(){return e.apply(t,arguments)}},defer:function(e,t,i){var n;return function(){i&&clearTimeout(n),n=setTimeout(e,t)}},indexOf:function(e,i,n){var o=-1;return n=this.isNumber(n)?n:0,this.each(e,function(e,t){if(n<=t&&e===i)return o=t,!1}),o},removeItem:function(e,t){for(var i=0,n=e.length;i<n;i++)e[i]===t&&(e.splice(i,1),i--)},trim:function(e){return e.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},listToMap:function(e){if(!e)return{};e=utils.isArray(e)?e:e.split(",");for(var t,i=0,n={};t=e[i++];)n[t.toUpperCase()]=n[t]=1;return n},unhtml:function(e,t){return e?e.replace(t||/[&<">'](?:(amp|lt|ldquo|rdquo|quot|gt|#39|nbsp|#\d+);)?/g,function(e,t){return t?e:{"<":"&lt;","&":"&amp;",'"':"&quot;","“":"&ldquo;","”":"&rdquo;",">":"&gt;","'":"&#39;"}[e]}):""},html:function(e){return e?e.replace(/&((g|l|quo|ldquo|rdquo)t|amp|#39|nbsp);/g,function(e){return{"&lt;":"<","&amp;":"&","&quot;":'"',"&ldquo;":"“","&rdquo;":"”","&gt;":">","&#39;":"'","&nbsp;":" "}[e]}):""},cssStyleToDomStyle:(test=document.createElement("div").style,cache={float:null!=test.cssFloat?"cssFloat":null!=test.styleFloat?"styleFloat":"float"},function(e){return cache[e]||(cache[e]=e.toLowerCase().replace(/-./g,function(e){return e.charAt(1).toUpperCase()}))}),loadFile:(e1=[],function(t,i,e){var n=f1(t,i);if(n)n.ready?e&&e():n.funs.push(e);else if(e1.push({doc:t,url:i.src||i.href,funs:[e]}),t.body){if(!i.id||!t.getElementById(i.id)){var o=t.createElement(i.tag);for(r in delete i.tag,i)o.setAttribute(r,i[r]);o.onload=o.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(0<(n=f1(t,i)).funs.length){n.ready=1;for(var e;e=n.funs.pop();)e()}o.onload=o.onreadystatechange=null}},o.onerror=function(){throw Error("The load "+(i.href||i.src)+" fails,check the url settings of file ueditor.config.js ")},t.getElementsByTagName("head")[0].appendChild(o)}}else{var r,a=[];for(r in i)"tag"!=r&&a.push(r+'="'+i[r]+'"');t.write("<"+i.tag+" "+a.join(" ")+" ></"+i.tag+">")}}),isEmptyObject:function(e){if(null==e)return!0;if(this.isArray(e)||this.isString(e))return 0===e.length;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},fixColor:function(e,t){if(/color/i.test(e)&&/rgba?/.test(t)){var i=t.split(",");if(3<i.length)return"";t="#";for(var n,o=0;n=i[o++];)t+=1==(n=parseInt(n.replace(/[^\d]/gi,""),10).toString(16)).length?"0"+n:n;t=t.toUpperCase()}return t},optCss:function(e){var o,r;function t(e,t){if(!e)return"";var i=e.top,n=e.bottom,o=e.left,r=e.right,a="";if(i&&o&&n&&r)a+=";"+t+":"+(i==n&&n==o&&o==r?i:i==n&&o==r?i+" "+o:o==r?i+" "+o+" "+n:i+" "+r+" "+n+" "+o)+";";else for(var s in e)a+=";"+t+"-"+s+":"+e[s]+";";return a}return e=e.replace(/(padding|margin|border)\-([^:]+):([^;]+);?/gi,function(e,t,i,n){if(1==n.split(" ").length)switch(t){case"padding":return(o=!o?{}:o)[i]=n,"";case"margin":return(r=!r?{}:r)[i]=n,"";case"border":return"initial"==n?"":e}return e}),(e+=t(o,"padding")+t(r,"margin")).replace(/^[ \n\r\t;]*|[ \n\r\t]*$/,"").replace(/;([ \n\r\t]+)|\1;/g,";").replace(/(&((l|g)t|quot|#39))?;{2,}/g,function(e,t){return t?t+";;":";"})},clone:function(e,t){var i,n;for(n in t=t||{},e)e.hasOwnProperty(n)&&("object"==typeof(i=e[n])?(t[n]=utils.isArray(i)?[]:{},utils.clone(e[n],t[n])):t[n]=i);return t},transUnitToPx:function(n){if(!/(pt|cm)/.test(n))return n;var o;switch(n.replace(/([\d.]+)(\w+)/,function(e,t,i){n=t,o=i}),o){case"cm":n=25*parseFloat(n);break;case"pt":n=Math.round(96*parseFloat(n)/72)}return n+(n?"px":"")},domReady:(_1=[],function(e,t){var i=(t=t||window).document;e&&_1.push(e),"complete"===i.readyState?ac(i):(i.isReady&&ac(i),browser.ie&&11!=browser.version?(function(){if(!i.isReady){try{i.documentElement.doScroll("left")}catch(e){return setTimeout(arguments.callee,0)}ac(i)}}(),t.attachEvent("onload",function(){ac(i)})):(i.addEventListener("DOMContentLoaded",function(){i.removeEventListener("DOMContentLoaded",arguments.callee,!1),ac(i)},!1),t.addEventListener("load",function(){ac(i)},!1)))}),cssRule:browser.ie&&11!=browser.version?function(e,t,i){var n,o;return void 0===t||t&&t.nodeType&&9==t.nodeType?void 0!==(o=(n=(i=t&&t.nodeType&&9==t.nodeType?t:i||document).indexList||(i.indexList={}))[e])?i.styleSheets[o].cssText:void 0:(o=(n=(i=i||document).indexList||(i.indexList={}))[e],""===t?void 0!==o&&(i.styleSheets[o].cssText="",delete n[e],!0):(void 0!==o?sheetStyle=i.styleSheets[o]:(sheetStyle=i.createStyleSheet("",o=i.styleSheets.length),n[e]=o),void(sheetStyle.cssText=t)))}:function(e,t,i){var n;return void 0===t||t&&t.nodeType&&9==t.nodeType?(n=(i=t&&t.nodeType&&9==t.nodeType?t:i||document).getElementById(e))?n.innerHTML:void 0:(n=(i=i||document).getElementById(e),""===t?!!n&&(n.parentNode.removeChild(n),!0):void(n?n.innerHTML=t:((n=i.createElement("style")).id=e,n.innerHTML=t,i.getElementsByTagName("head")[0].appendChild(n))))},sort:function(e,t){t=t||function(e,t){return e.localeCompare(t)};for(var i,n=0,o=e.length;n<o;n++)for(var r=n,a=e.length;r<a;r++)0<t(e[n],e[r])&&(i=e[n],e[n]=e[r],e[r]=i);return e},serializeParam:function(e){var t,i=[];for(t in e)if("method"!=t&&"timeout"!=t&&"async"!=t)if("function"!=(typeof e[t]).toLowerCase()&&"object"!=(typeof e[t]).toLowerCase())i.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));else if(utils.isArray(e[t]))for(var n=0;n<e[t].length;n++)i.push(encodeURIComponent(t)+"[]="+encodeURIComponent(e[t][n]));return i.join("&")},formatUrl:function(e){e=e.replace(/&&/g,"&");return(e=(e=(e=e.replace(/\?&/g,"?")).replace(/&$/g,"")).replace(/&#/g,"#")).replace(/&+/g,"&")},addStyleContent:function(e){var t=document.createElement("style");t.innerHTML=e,document.head.appendChild(t)},isCrossDomainUrl:function(e){var t=document.createElement("a");return t.href=e,browser.ie&&(t.href=t.href),!(t.protocol==location.protocol&&t.hostname==location.hostname&&(t.port==location.port||"80"==t.port&&""==location.port||""==t.port&&"80"==location.port))},clearEmptyAttrs:function(e){for(var t in e)""===e[t]&&delete e[t];return e},str2json:function(e){return utils.isString(e)?window.JSON?JSON.parse(e):new Function("return "+utils.trim(e||""))():null},json2str:function(){if(window.JSON)return JSON.stringify;var s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function l(e){return e<10?"0"+e:e}return function(e){switch(typeof e){case"undefined":return"undefined";case"number":return isFinite(e)?String(e):"null";case"string":return'"'+(a=/["\\\x00-\x1f]/.test(a=e)?a.replace(/["\\\x00-\x1f]/g,function(e){var t;return(t=s[e])||(t=e.charCodeAt(),"\\u00"+Math.floor(t/16).toString(16)+(t%16).toString(16))}):a)+'"';case"boolean":return String(e);default:if(null===e)return"null";if(utils.isArray(e))return function(e){for(var t,i,n=["["],o=e.length,r=0;r<o;r++)switch(typeof(i=e[r])){case"undefined":case"function":case"unknown":break;default:t&&n.push(","),n.push(utils.json2str(i)),t=1}return n.push("]"),n.join("")}(e);if(utils.isDate(e))return'"'+(a=e).getFullYear()+"-"+l(a.getMonth()+1)+"-"+l(a.getDate())+"T"+l(a.getHours())+":"+l(a.getMinutes())+":"+l(a.getSeconds())+'"';var t,i,n,o=["{"],r=utils.json2str;for(n in e)if(Object.prototype.hasOwnProperty.call(e,n))switch(typeof(i=e[n])){case"undefined":case"unknown":case"function":break;default:t&&o.push(","),t=1,o.push(r(n)+":"+r(i))}return o.push("}"),o.join("")}var a}}()},test,cache,_1,e1;function ac(e){e.isReady=!0;for(var t;t=_1.pop();t());}function f1(e,t){try{for(var i,n=0;i=e1[n++];)if(i.doc===e&&i.url==(t.src||t.href))return i}catch(e){return null}}utils.each(["String","Function","Array","Number","RegExp","Object","Date"],function(t){UE.utils["is"+t]=function(e){return Object.prototype.toString.apply(e)=="[object "+t+"]"}});var EventBase=UE.EventBase=function(){};function getListener(e,t,i){return t=t.toLowerCase(),(e=e.__allListeners||i&&(e.__allListeners={}))&&(e[t]||i&&(e[t]=[]))}EventBase.prototype={addListener:function(e,t){e=utils.trim(e).split(/\s+/);for(var i,n=0;i=e[n++];)getListener(this,i,!0).push(t)},on:function(e,t){return this.addListener(e,t)},off:function(e,t){return this.removeListener(e,t)},trigger:function(){return this.fireEvent.apply(this,arguments)},removeListener:function(e,t){e=utils.trim(e).split(/\s+/);for(var i,n=0;i=e[n++];)utils.removeItem(getListener(this,i)||[],t)},fireEvent:function(){for(var e,t=utils.trim(t=arguments[0]).split(" "),i=0;e=t[i++];){var n,o,r,a=getListener(this,e);if(a)for(r=a.length;r--;)if(a[r]){if(!0===(o=a[r].apply(this,arguments)))return o;void 0!==o&&(n=o)}(o=this["on"+e.toLowerCase()])&&(n=o.apply(this,arguments))}return n}};var dtd=dom.dtd=(D2=utils.extend2,E2=C2({isindex:1,fieldset:1}),$2=C2({input:1,button:1,select:1,textarea:1,label:1}),G2=D2(C2({a:1}),$2),H2=D2({iframe:1},G2),I2=C2({hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1}),J2=C2({ins:1,del:1,script:1,style:1}),K2=D2(C2({mark:1,b:1,acronym:1,bdo:1,var:1,"#":1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1}),J2),Z2=D2(C2({sub:1,img:1,embed:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1}),K2),M2=D2(C2({p:1}),Z2),N2=D2(C2({iframe:1}),Z2,$2),O2=C2({img:1,embed:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,"#":1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,var:1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1}),P2=D2(C2({a:0}),N2),Q2=C2({tr:1}),R2=C2({"#":1}),S2=D2(C2({param:1}),O2),T2=D2(C2({form:1}),E2,H2,I2,M2),U2=C2({li:1,ol:1,ul:1}),_2=C2({style:1,script:1}),W2=C2({base:1,link:1,meta:1,title:1}),X2=D2(W2,_2),Y2=C2({head:1,body:1}),Z2=C2({html:1}),$2=C2({address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1}),_2=C2({area:1,base:1,basefont:1,br:1,col:1,command:1,dialog:1,embed:1,hr:1,img:1,input:1,isindex:1,keygen:1,link:1,meta:1,param:1,source:1,track:1,wbr:1}),C2({$nonBodyContent:D2(Z2,Y2,W2),$block:$2,$inline:P2,$inlineWithA:D2(C2({a:1}),P2),$body:D2(C2({script:1,style:1}),$2),$cdata:C2({script:1,style:1}),$empty:_2,$nonChild:C2({iframe:1,textarea:1}),$listItem:C2({dd:1,dt:1,li:1}),$list:C2({ul:1,ol:1,dl:1}),$isNotEmpty:C2({table:1,ul:1,ol:1,dl:1,iframe:1,area:1,base:1,col:1,hr:1,img:1,embed:1,input:1,textarea:1,link:1,meta:1,param:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1}),$removeEmpty:C2({a:1,abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,var:1}),$removeEmptyBlock:C2({p:1,div:1}),$tableContent:C2({caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1,table:1}),$notTransContent:C2({pre:1,script:1,style:1,textarea:1}),html:Y2,head:X2,style:R2,script:R2,body:T2,base:{},link:{},meta:{},title:R2,col:{},tr:C2({td:1,th:1}),img:{},embed:{},colgroup:C2({thead:1,col:1,tbody:1,tr:1,tfoot:1}),noscript:T2,td:T2,br:{},th:T2,center:T2,kbd:P2,button:D2(M2,I2),basefont:{},h5:P2,h4:P2,samp:P2,h6:P2,ol:U2,h1:P2,h3:P2,option:R2,h2:P2,form:D2(E2,H2,I2,M2),select:C2({optgroup:1,option:1}),font:P2,ins:P2,menu:U2,abbr:P2,label:P2,table:C2({thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1}),code:P2,tfoot:Q2,cite:P2,li:T2,input:{},iframe:T2,strong:P2,textarea:R2,noframes:T2,big:P2,small:P2,span:C2({"#":1,br:1,b:1,strong:1,u:1,i:1,em:1,sub:1,sup:1,strike:1,span:1}),hr:P2,dt:P2,sub:P2,optgroup:C2({option:1}),param:{},bdo:P2,var:P2,div:T2,object:S2,sup:P2,dd:T2,strike:P2,area:{},dir:U2,map:D2(C2({area:1,form:1,p:1}),E2,J2,I2),applet:S2,dl:C2({dt:1,dd:1}),del:P2,isindex:{},fieldset:D2(C2({legend:1}),O2),thead:Q2,ul:U2,acronym:P2,b:P2,a:D2(C2({a:1}),N2),blockquote:D2(C2({td:1,tr:1,tbody:1,li:1}),T2),caption:P2,i:P2,u:P2,tbody:Q2,s:P2,address:D2(H2,M2),tt:P2,legend:P2,q:P2,pre:D2(K2,G2),p:D2(C2({a:1}),P2),em:P2,dfn:P2,mark:P2})),D2,E2,$2,G2,H2,I2,J2,K2,Z2,M2,N2,O2,P2,Q2,R2,S2,T2,U2,_2,W2,X2,Y2;function C2(e){for(var t in e)e[t.toUpperCase()]=e[t];return e}function getDomNode(e,t,i,n,o,r){var a,s=n&&e[t];for(s||(s=e[i]);!s&&(a=(a||e).parentNode);){if("BODY"==a.tagName||r&&!r(a))return null;s=a[i]}return s&&o&&!o(s)?getDomNode(s,t,i,!1,o):s}var attrFix=ie&&browser.version<9?{tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}:{tabindex:"tabIndex",readonly:"readOnly"},styleBlock=utils.listToMap(["-webkit-box","-moz-box","block","list-item","table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption"]),domUtils=dom.domUtils={NODE_ELEMENT:1,NODE_DOCUMENT:9,NODE_TEXT:3,NODE_COMMENT:8,NODE_DOCUMENT_FRAGMENT:11,POSITION_IDENTICAL:0,POSITION_DISCONNECTED:1,POSITION_FOLLOWING:2,POSITION_PRECEDING:4,POSITION_IS_CONTAINED:8,POSITION_CONTAINS:16,fillChar:ie&&"6"==browser.version?"\ufeff":"​",keys:{8:1,46:1,16:1,17:1,18:1,37:1,38:1,39:1,40:1,13:1},getPosition:function(e,t){if(e===t)return 0;for(var i=[e],n=[t],o=e;o=o.parentNode;){if(o===t)return 10;i.push(o)}for(o=t;o=o.parentNode;){if(o===e)return 20;n.push(o)}if(i.reverse(),n.reverse(),i[0]!==n[0])return 1;for(var r=-1;i[++r]===n[r];);for(e=i[r],t=n[r];e=e.nextSibling;)if(e===t)return 4;return 2},getNodeIndex:function(e,t){for(var i=e,n=0;i=i.previousSibling;)t&&3==i.nodeType&&i.nodeType==i.nextSibling.nodeType||n++;return n},inDoc:function(e,t){return 10==domUtils.getPosition(e,t)},findParent:function(e,t,i){if(e&&!domUtils.isBody(e))for(e=i?e:e.parentNode;e;){if(!t||t(e)||domUtils.isBody(e))return t&&!t(e)&&domUtils.isBody(e)?null:e;e=e.parentNode}return null},findParentByTagName:function(e,t,i,n){return t=utils.listToMap(utils.isArray(t)?t:[t]),domUtils.findParent(e,function(e){return t[e.tagName]&&!(n&&n(e))},i)},findParents:function(e,t,i,n){for(var o=t&&(i&&i(e)||!i)?[e]:[];e=domUtils.findParent(e,i);)o.push(e);return n?o:o.reverse()},insertAfter:function(e,t){return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t)},remove:function(e,t){var i,n=e.parentNode;if(n){if(t&&e.hasChildNodes())for(;i=e.firstChild;)n.insertBefore(i,e);n.removeChild(e)}return e},getNextDomNode:function(e,t,i,n){return getDomNode(e,"firstChild","nextSibling",t,i,n)},getPreDomNode:function(e,t,i,n){return getDomNode(e,"lastChild","previousSibling",t,i,n)},isBookmarkNode:function(e){return 1==e.nodeType&&e.id&&/^_baidu_bookmark_/i.test(e.id)},getWindow:function(e){e=e.ownerDocument||e;return e.defaultView||e.parentWindow},getCommonAncestor:function(e,t){if(e===t)return e;for(var i=[e],n=[t],o=e,r=-1;o=o.parentNode;){if(o===t)return o;i.push(o)}for(o=t;o=o.parentNode;){if(o===e)return o;n.push(o)}for(i.reverse(),n.reverse();i[++r]===n[r];);return 0==r?null:i[r-1]},clearEmptySibling:function(e,t,i){function n(e,t){for(var i;e&&!domUtils.isBookmarkNode(e)&&(domUtils.isEmptyInlineElement(e)||!new RegExp("[^\t\n\r"+domUtils.fillChar+"]").test(e.nodeValue));)i=e[t],domUtils.remove(e),e=i}t||n(e.nextSibling,"nextSibling"),i||n(e.previousSibling,"previousSibling")},split:function(e,t){var i=e.ownerDocument;if(browser.ie&&t==e.nodeValue.length){var n=i.createTextNode("");return domUtils.insertAfter(e,n)}t=e.splitText(t);return browser.ie8&&(i=i.createTextNode(""),domUtils.insertAfter(t,i),domUtils.remove(i)),t},isWhitespace:function(e){return!new RegExp("[^ \t\n\r"+domUtils.fillChar+"]").test(e.nodeValue)},getXY:function(e){for(var t=0,i=0;e.offsetParent;)i+=e.offsetTop,t+=e.offsetLeft,e=e.offsetParent;return{x:t,y:i}},on:function(e,t,i){var n,o,r=utils.isArray(t)?t:utils.trim(t).split(/\s+/),a=r.length;if(a)for(;a--;)t=r[a],e.addEventListener?e.addEventListener(t,i,!1):(i._d||(i._d={els:[]}),n=t+i.toString(),o=utils.indexOf(i._d.els,e),i._d[n]&&-1!=o||(-1==o&&i._d.els.push(e),i._d[n]||(i._d[n]=function(e){return i.call(e.srcElement,e||window.event)}),e.attachEvent("on"+t,i._d[n])))},un:function(e,t,i){var n=utils.isArray(t)?t:utils.trim(t).split(/\s+/),o=n.length;if(o)for(;o--;)if(t=n[o],e.removeEventListener)e.removeEventListener(t,i,!1);else{var r,a=t+i.toString();try{e.detachEvent("on"+t,i._d?i._d[a]:i)}catch(e){}i._d&&i._d[a]&&(-1!=(r=utils.indexOf(i._d.els,e))&&i._d.els.splice(r,1),0==i._d.els.length&&delete i._d[a])}},isSameElement:function(e,t){if(e.tagName!=t.tagName)return!1;var i=e.attributes,n=t.attributes;if(!ie&&i.length!=n.length)return!1;for(var o,r,a=0,s=0,l=0;o=i[l++];){if("style"==o.nodeName){if(o.specified&&a++,domUtils.isSameStyle(e,t))continue;return!1}if(ie){if(!o.specified)continue;a++,r=n.getNamedItem(o.nodeName)}else r=t.attributes[o.nodeName];if(!r.specified||o.nodeValue!=r.nodeValue)return!1}if(ie){for(l=0;r=n[l++];)r.specified&&s++;if(a!=s)return!1}return!0},isSameStyle:function(e,t){var i=e.style.cssText.replace(/( ?; ?)/g,";").replace(/( ?: ?)/g,":"),n=t.style.cssText.replace(/( ?; ?)/g,";").replace(/( ?: ?)/g,":");if(browser.opera){if(i=e.style,n=t.style,i.length!=n.length)return!1;for(var o in i)if(!/^(\d+|csstext)$/i.test(o)&&i[o]!=n[o])return!1;return!0}if(!i||!n)return i==n;if(i=i.split(";"),n=n.split(";"),i.length!=n.length)return!1;for(var r,a=0;r=i[a++];)if(-1==utils.indexOf(n,r))return!1;return!0},isBlockElm:function(e){return 1==e.nodeType&&(dtd.$block[e.tagName]||styleBlock[domUtils.getComputedStyle(e,"display")])&&!dtd.$nonChild[e.tagName]},isBody:function(e){return e&&1==e.nodeType&&"body"==e.tagName.toLowerCase()},breakParent:function(e,t){var i,n,o,r=e,a=e;do{for(r=r.parentNode,o=n?((i=r.cloneNode(!1)).appendChild(n),n=i,(i=r.cloneNode(!1)).appendChild(o),i):(n=r.cloneNode(!1)).cloneNode(!1);i=a.previousSibling;)n.insertBefore(i,n.firstChild);for(;i=a.nextSibling;)o.appendChild(i)}while(t!==(a=r));return(i=t.parentNode).insertBefore(n,t),i.insertBefore(o,t),i.insertBefore(e,o),domUtils.remove(t),e},isEmptyInlineElement:function(e){if(1!=e.nodeType||!dtd.$removeEmpty[e.tagName])return 0;for(e=e.firstChild;e;){if(domUtils.isBookmarkNode(e))return 0;if(1==e.nodeType&&!domUtils.isEmptyInlineElement(e)||3==e.nodeType&&!domUtils.isWhitespace(e))return 0;e=e.nextSibling}return 1},trimWhiteTextNode:function(i){function e(e){for(var t;(t=i[e])&&3==t.nodeType&&domUtils.isWhitespace(t);)i.removeChild(t)}e("firstChild"),e("lastChild")},mergeChild:function(e,t,i){for(var n,o=domUtils.getElementsByTagName(e,e.tagName.toLowerCase()),r=0;n=o[r++];)if(n.parentNode&&!domUtils.isBookmarkNode(n))if("span"!=n.tagName.toLowerCase())domUtils.isSameElement(e,n)&&domUtils.remove(n,!0);else{if(e===n.parentNode&&(domUtils.trimWhiteTextNode(e),1==e.childNodes.length)){e.style.cssText=n.style.cssText+";"+e.style.cssText,domUtils.remove(n,!0);continue}if(n.style.cssText=e.style.cssText+";"+n.style.cssText,i)if(s=i.style)for(var a,s=s.split(";"),l=0;a=s[l++];)n.style[utils.cssStyleToDomStyle(a.split(":")[0])]=a.split(":")[1];domUtils.isSameStyle(n,e)&&domUtils.remove(n,!0)}},getElementsByTagName:function(e,t,i){var n;i&&utils.isString(i)&&(n=i,i=function(e){return domUtils.hasClass(e,n)}),t=utils.trim(t).replace(/[ ]{2,}/g," ").split(" ");for(var o,r=[],a=0;o=t[a++];)for(var s,l=e.getElementsByTagName(o),d=0;s=l[d++];)i&&!i(s)||r.push(s);return r},mergeToParent:function(e){for(var t=e.parentNode;t&&dtd.$removeEmpty[t.tagName];){if(t.tagName==e.tagName||"A"==t.tagName){if(domUtils.trimWhiteTextNode(t),"SPAN"==t.tagName&&!domUtils.isSameStyle(t,e)||"A"==t.tagName&&"SPAN"==e.tagName){if(1<t.childNodes.length||t!==e.parentNode){e.style.cssText=t.style.cssText+";"+e.style.cssText,t=t.parentNode;continue}t.style.cssText+=";"+e.style.cssText,"A"==t.tagName&&(t.style.textDecoration="underline")}if("A"!=t.tagName){t===e.parentNode&&domUtils.remove(e,!0);break}}t=t.parentNode}},mergeSibling:function(e,t,i){function n(e,t,i){var n;if((n=i[e])&&!domUtils.isBookmarkNode(n)&&1==n.nodeType&&domUtils.isSameElement(i,n)){for(;n.firstChild;)"firstChild"==t?i.insertBefore(n.lastChild,i.firstChild):i.appendChild(n.firstChild);domUtils.remove(n)}}t||n("previousSibling","firstChild",e),i||n("nextSibling","lastChild",e)},unSelectable:ie&&browser.ie9below||browser.opera?function(e){e.onselectstart=function(){return!1},e.onclick=e.onkeyup=e.onkeydown=function(){return!1},e.unselectable="on",e.setAttribute("unselectable","on");for(var t,i=0;t=e.all[i++];)switch(t.tagName.toLowerCase()){case"iframe":case"textarea":case"input":case"select":break;default:t.unselectable="on",e.setAttribute("unselectable","on")}}:function(e){e.style.MozUserSelect=e.style.webkitUserSelect=e.style.msUserSelect=e.style.KhtmlUserSelect="none"},removeAttributes:function(e,t){t=utils.isArray(t)?t:utils.trim(t).replace(/[ ]{2,}/g," ").split(" ");for(var i,n=0;i=t[n++];){switch(i=attrFix[i]||i){case"className":e[i]="";break;case"style":e.style.cssText="";var o=e.getAttributeNode("style");!browser.ie&&o&&e.removeAttributeNode(o)}e.removeAttribute(i)}},createElement:function(e,t,i){return domUtils.setAttributes(e.createElement(t),i)},setAttributes:function(e,t){for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];switch(i){case"class":e.className=n;break;case"style":e.style.cssText=e.style.cssText+";"+n;break;case"innerHTML":e[i]=n;break;case"value":e.value=n;break;default:e.setAttribute(attrFix[i]||i,n)}}return e},getComputedStyle:function(e,t){if(-1<"width height top left".indexOf(t))return e["offset"+t.replace(/^\w/,function(e){return e.toUpperCase()})]+"px";if(3==e.nodeType&&(e=e.parentNode),browser.ie&&browser.version<9&&"font-size"==t&&!e.style.fontSize&&!dtd.$empty[e.tagName]&&!dtd.$nonChild[e.tagName]){var i=e.ownerDocument.createElement("span");i.style.cssText="padding:0;border:0;font-family:simsun;",i.innerHTML=".",e.appendChild(i);var n=i.offsetHeight;return e.removeChild(i),i=null,n+"px"}try{var o=domUtils.getStyle(e,t)||(window.getComputedStyle?domUtils.getWindow(e).getComputedStyle(e,"").getPropertyValue(t):(e.currentStyle||e.style)[utils.cssStyleToDomStyle(t)])}catch(e){return""}return utils.transUnitToPx(utils.fixColor(t,o))},removeClasses:function(e,t){t=utils.isArray(t)?t:utils.trim(t).replace(/[ ]{2,}/g," ").split(" ");for(var i,n=0,o=e.className;i=t[n++];)o=o.replace(new RegExp("\\b"+i+"\\b"),"");(o=utils.trim(o).replace(/[ ]{2,}/g," "))?e.className=o:domUtils.removeAttributes(e,["class"])},addClass:function(e,t){if(e){t=utils.trim(t).replace(/[ ]{2,}/g," ").split(" ");for(var i,n=0,o=e.className;i=t[n++];)new RegExp("\\b"+i+"\\b").test(o)||(o+=" "+i);e.className=utils.trim(o)}},hasClass:function(e,t){if(utils.isRegExp(t))return t.test(e.className);t=utils.trim(t).replace(/[ ]{2,}/g," ").split(" ");for(var i,n=0,o=e.className;i=t[n++];)if(!new RegExp("\\b"+i+"\\b","i").test(o))return!1;return n-1==t.length},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},removeStyle:function(e,t){browser.ie?("color"==t&&(t="(^|;)"+t),e.style.cssText=e.style.cssText.replace(new RegExp(t+"[^:]*:[^;]+;?","ig"),"")):e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(utils.cssStyleToDomStyle(t)),e.style.cssText||domUtils.removeAttributes(e,["style"])},getStyle:function(e,t){e=e.style[utils.cssStyleToDomStyle(t)];return utils.fixColor(t,e)},setStyle:function(e,t,i){e.style[utils.cssStyleToDomStyle(t)]=i,utils.trim(e.style.cssText)||this.removeAttributes(e,"style")},setStyles:function(e,t){for(var i in t)t.hasOwnProperty(i)&&domUtils.setStyle(e,i,t[i])},removeDirtyAttr:function(e){for(var t,i=0,n=e.getElementsByTagName("*");t=n[i++];)t.removeAttribute("_moz_dirty");e.removeAttribute("_moz_dirty")},getChildCount:function(e,t){var i=0,n=e.firstChild;for(t=t||function(){return 1};n;)t(n)&&i++,n=n.nextSibling;return i},isEmptyNode:function(e){return!e.firstChild||0==domUtils.getChildCount(e,function(e){return!domUtils.isBr(e)&&!domUtils.isBookmarkNode(e)&&!domUtils.isWhitespace(e)})},clearSelectedArr:function(e){for(var t;t=e.pop();)domUtils.removeAttributes(t,["class"])},scrollToView:function(e,t,i){var n,o=(((n="CSS1Compat"==(o=t.document).compatMode)?o.documentElement:o.body).clientWidth,(n?o.documentElement:o.body).clientHeight||0),i=-1*o+i;i+=e.offsetHeight||0,i+=domUtils.getXY(e).y;e=function(e){if("pageXOffset"in e)return{x:e.pageXOffset||0,y:e.pageYOffset||0};e=e.document;return{x:e.documentElement.scrollLeft||e.body.scrollLeft||0,y:e.documentElement.scrollTop||e.body.scrollTop||0}}(t).y;(e<i||i<e-o)&&t.scrollTo(0,i+(i<0?-20:20))},isBr:function(e){return 1==e.nodeType&&"BR"==e.tagName},isFillChar:function(e,t){if(3!=e.nodeType)return!1;e=e.nodeValue;return t?new RegExp("^"+domUtils.fillChar).test(e):!e.replace(new RegExp(domUtils.fillChar,"g"),"").length},isStartInblock:function(e){var t,i,n=e.cloneRange(),o=0,r=n.startContainer;if(1==r.nodeType&&r.childNodes[n.startOffset])for(var a=(r=r.childNodes[n.startOffset]).previousSibling;a&&domUtils.isFillChar(a);)a=(r=a).previousSibling;for(this.isFillChar(r,!0)&&1==n.startOffset&&(n.setStartBefore(r),r=n.startContainer);r&&domUtils.isFillChar(r);)r=(t=r).previousSibling;for(t&&(n.setStartBefore(t),r=n.startContainer),1==r.nodeType&&domUtils.isEmptyNode(r)&&1==n.startOffset&&n.setStart(r,0).collapse(!0);!n.startOffset;){if(r=n.startContainer,domUtils.isBlockElm(r)||domUtils.isBody(r)){o=1;break}if(a=n.startContainer.previousSibling){for(;a&&domUtils.isFillChar(a);)a=(i=a).previousSibling;i?n.setStartBefore(i):n.setStartBefore(n.startContainer)}else n.setStartBefore(n.startContainer)}return o&&!domUtils.isBody(n.startContainer)?1:0},isEmptyBlock:function(e,t){if(1!=e.nodeType)return 0;if(t=t||new RegExp("[  \t\r\n"+domUtils.fillChar+"]","g"),0<e[browser.ie?"innerText":"textContent"].replace(t,"").length)return 0;for(var i in dtd.$isNotEmpty)if(e.getElementsByTagName(i).length)return 0;return 1},setViewportOffset:function(e,t){var i=0|parseInt(e.style.left),n=0|parseInt(e.style.top),o=e.getBoundingClientRect(),r=t.left-o.left,o=t.top-o.top;r&&(e.style.left=i+r+"px"),o&&(e.style.top=n+o+"px")},fillNode:function(e,t){e=browser.ie?e.createTextNode(domUtils.fillChar):e.createElement("br");t.innerHTML="",t.appendChild(e)},moveChild:function(e,t,i){for(;e.firstChild;)i&&t.firstChild?t.insertBefore(e.lastChild,t.firstChild):t.appendChild(e.firstChild)},hasNoAttributes:function(e){return browser.ie?/^<\w+\s*?>/.test(e.outerHTML):0==e.attributes.length},isCustomeNode:function(e){return 1==e.nodeType&&e.getAttribute("_ue_custom_node_")},isTagNode:function(e,t){return 1==e.nodeType&&new RegExp("\\b"+e.tagName+"\\b","i").test(t)},filterNodeList:function(e,t,i){var n,o=[];return utils.isFunction(t)||(n=t,t=function(e){return-1!=utils.indexOf(utils.isArray(n)?n:n.split(" "),e.tagName.toLowerCase())}),utils.each(e,function(e){t(e)&&o.push(e)}),0==o.length?null:1!=o.length&&i?o:o[0]},isInNodeEndBoundary:function(e,t){var i=e.startContainer;if(3==i.nodeType&&e.startOffset!=i.nodeValue.length)return 0;if(1==i.nodeType&&e.startOffset!=i.childNodes.length)return 0;for(;i!==t;){if(i.nextSibling)return 0;i=i.parentNode}return 1},isBoundaryNode:function(e,t){for(;!domUtils.isBody(e);)if(e!==(e=e.parentNode)[t])return!1;return!0},fillHtml:browser.ie11below?"&nbsp;":"<br/>"},fillCharReg=new RegExp(domUtils.fillChar,"g"),K7,L7,O7,Zf,$f,_f,d5;function M7(e,t){var i;if(t.options.textarea)if(utils.isString(t.options.textarea)){for(var n,o=0,r=domUtils.getElementsByTagName(e,"textarea");n=r[o++];)if(n.id=="ueditor_textarea_"+t.options.textarea){i=n;break}}else i=t.textarea;i||(e.appendChild(i=domUtils.createElement(document,"textarea",{name:t.options.textarea,id:"ueditor_textarea_"+t.options.textarea,style:"display:none"})),t.textarea=i),i.getAttribute("name")||i.setAttribute("name",t.options.textarea),i.value=t.hasContents()?t.options.allHtmlEnabled?t.getAllHtml():t.getContent(null,null,!0):""}function N7(e){e.langIsReady=!0,e.fireEvent("langReady")}function jj(){var e=this;e.document.getElementById("initContent")&&(e.body.innerHTML="<p>"+(ie?"":"<br/>")+"</p>",e.removeListener("firstBeforeExecCommand focus",jj),setTimeout(function(){e.focus(),e._selectionChange()},0))}function Nh(e,t){var i=domUtils.getNodeIndex;(e=e.duplicate()).collapse(t);var n=e.parentElement();if(!n.hasChildNodes())return{container:n,offset:0};for(var o,r,a=n.children,s=e.duplicate(),l=0,d=a.length-1,c=-1;l<=d;){o=a[c=Math.floor((l+d)/2)],s.moveToElementText(o);var u=s.compareEndPoints("StartToStart",e);if(0<u)d=c-1;else{if(!(u<0))return{container:n,offset:i(o)};l=c+1}}if(-1==c){if(s.moveToElementText(n),s.setEndPoint("StartToStart",e),r=s.text.replace(/(\r\n|\r)/g,"\n").length,a=n.childNodes,!r)return{container:o=a[a.length-1],offset:o.nodeValue.length};for(var m=a.length;0<r;)r-=a[--m].nodeValue.length;return{container:a[m],offset:-r}}if(s.collapse(0<u),s.setEndPoint(0<u?"StartToStart":"EndToStart",e),!(r=s.text.replace(/(\r\n|\r)/g,"\n").length))return dtd.$empty[o.tagName]||dtd.$nonChild[o.tagName]?{container:n,offset:i(o)+(0<u?0:1)}:{container:o,offset:0<u?0:o.childNodes.length};for(;0<r;)try{var f=o;r-=(o=o[0<u?"previousSibling":"nextSibling"]).nodeValue.length}catch(e){return{container:n,offset:i(f)}}return{container:o,offset:0<u?-r:o.nodeValue.length+r}}function Oh(e){var t;try{t=e.getNative().createRange()}catch(e){return null}var i=t.item?t.item(0):t.parentElement();return(i.ownerDocument||i)===e.document?t:null}function a5(e){return!e.collapsed&&1==e.startContainer.nodeType&&e.startContainer===e.endContainer&&e.endOffset-e.startOffset==1}function b5(e,t,i,n){return 1==t.nodeType&&(dtd.$empty[t.tagName]||dtd.$nonChild[t.tagName])&&(i=domUtils.getNodeIndex(t)+(e?0:1),t=t.parentNode),e?(n.startContainer=t,n.startOffset=i,n.endContainer||n.collapse(!0)):(n.endContainer=t,n.endOffset=i,n.startContainer||n.collapse(!1)),(i=n).collapsed=i.startContainer&&i.endContainer&&i.startContainer===i.endContainer&&i.startOffset==i.endOffset,n}function c5(e,t){var i,n,o=e.startContainer,r=e.endContainer,a=e.startOffset,s=e.endOffset,l=e.document,d=l.createDocumentFragment();if((o=1==o.nodeType?o.childNodes[a]||(i=o.appendChild(l.createTextNode(""))):o)===(r=1==r.nodeType?r.childNodes[s]||(n=r.appendChild(l.createTextNode(""))):r)&&3==o.nodeType)return d.appendChild(l.createTextNode(o.substringData(a,s-a))),t&&(o.deleteData(a,s-a),e.collapse(!0)),d;for(var c,u,m=d,f=domUtils.findParents(o,!0),h=domUtils.findParents(r,!0),p=0;f[p]==h[p];)p++;for(var g,b,v=p;g=f[v];v++){for(c=g.nextSibling,g==o?i||(3==e.startContainer.nodeType?(m.appendChild(l.createTextNode(o.nodeValue.slice(a))),t&&o.deleteData(a,o.nodeValue.length-a)):m.appendChild(t?o:o.cloneNode(!0))):(u=g.cloneNode(!1),m.appendChild(u));c&&c!==r&&c!==h[v];)g=c.nextSibling,m.appendChild(t?c:c.cloneNode(!0)),c=g;m=u}for(m=d,f[p]||(m.appendChild(f[p-1].cloneNode(!1)),m=m.firstChild),v=p;b=h[v];v++){if(c=b.previousSibling,b==r?n||3!=e.endContainer.nodeType||(m.appendChild(l.createTextNode(r.substringData(0,s))),t&&r.deleteData(0,s)):(u=b.cloneNode(!1),m.appendChild(u)),v!=p||!f[p])for(;c&&c!==o;)b=c.previousSibling,m.insertBefore(t?c:c.cloneNode(!0),m.firstChild),c=b;m=u}return t&&e.setStartBefore(h[p]?f[p]?h[p]:f[p-1]:h[p-1]).collapse(!0),i&&domUtils.remove(i),n&&domUtils.remove(n),d}function e5(e,t){try{if(Zf&&domUtils.inDoc(Zf,e))if(Zf.nodeValue.replace(fillCharReg,"").length)Zf.nodeValue=Zf.nodeValue.replace(fillCharReg,"");else{var i=Zf.parentNode;for(domUtils.remove(Zf);i&&domUtils.isEmptyInlineElement(i)&&(browser.safari?!(domUtils.getPosition(i,t)&domUtils.POSITION_CONTAINS):!i.contains(t));)Zf=i.parentNode,domUtils.remove(i),i=Zf}}catch(e){}}function f5(e,t){var i;for(e=e[t];e&&domUtils.isFillChar(e);)i=e[t],domUtils.remove(e),e=i}$f=0,_f=domUtils.fillChar,d5=dom.Range=function(e){var t=this;t.startContainer=t.startOffset=t.endContainer=t.endOffset=null,t.document=e,t.collapsed=!0},d5.prototype={cloneContents:function(){return this.collapsed?null:c5(this,0)},deleteContents:function(){var e;return this.collapsed||c5(this,1),browser.webkit&&(3!=(e=this.startContainer).nodeType||e.nodeValue.length||(this.setStartBefore(e).collapse(!0),domUtils.remove(e))),this},extractContents:function(){return this.collapsed?null:c5(this,2)},setStart:function(e,t){return b5(!0,e,t,this)},setEnd:function(e,t){return b5(!1,e,t,this)},setStartAfter:function(e){return this.setStart(e.parentNode,domUtils.getNodeIndex(e)+1)},setStartBefore:function(e){return this.setStart(e.parentNode,domUtils.getNodeIndex(e))},setEndAfter:function(e){return this.setEnd(e.parentNode,domUtils.getNodeIndex(e)+1)},setEndBefore:function(e){return this.setEnd(e.parentNode,domUtils.getNodeIndex(e))},setStartAtFirst:function(e){return this.setStart(e,0)},setStartAtLast:function(e){return this.setStart(e,(3==e.nodeType?e.nodeValue:e.childNodes).length)},setEndAtFirst:function(e){return this.setEnd(e,0)},setEndAtLast:function(e){return this.setEnd(e,(3==e.nodeType?e.nodeValue:e.childNodes).length)},selectNode:function(e){return this.setStartBefore(e).setEndAfter(e)},selectNodeContents:function(e){return this.setStart(e,0).setEndAtLast(e)},cloneRange:function(){var e=this;return new d5(e.document).setStart(e.startContainer,e.startOffset).setEnd(e.endContainer,e.endOffset)},collapse:function(e){var t=this;return e?(t.endContainer=t.startContainer,t.endOffset=t.startOffset):(t.startContainer=t.endContainer,t.startOffset=t.endOffset),t.collapsed=!0,t},shrinkBoundary:function(e){var t,i=this,n=i.collapsed;function o(e){return 1==e.nodeType&&!domUtils.isBookmarkNode(e)&&!dtd.$empty[e.tagName]&&!dtd.$nonChild[e.tagName]}for(;1==i.startContainer.nodeType&&(t=i.startContainer.childNodes[i.startOffset])&&o(t);)i.setStart(t,0);if(n)return i.collapse(!0);if(!e)for(;1==i.endContainer.nodeType&&0<i.endOffset&&(t=i.endContainer.childNodes[i.endOffset-1])&&o(t);)i.setEnd(t,t.childNodes.length);return i},getCommonAncestor:function(e,t){var i=this.startContainer,n=this.endContainer;return i===n?(!e||!a5(this)||1!=(i=i.childNodes[this.startOffset]).nodeType)&&t&&3==i.nodeType?i.parentNode:i:domUtils.getCommonAncestor(i,n)},trimBoundary:function(e){this.txtToElmBoundary();var t,i=this.startContainer,n=this.startOffset,o=this.collapsed,r=this.endContainer;if(3==i.nodeType&&(0==n?this.setStartBefore(i):n>=i.nodeValue.length?this.setStartAfter(i):(t=domUtils.split(i,n),i===r?this.setEnd(t,this.endOffset-n):i.parentNode===r&&(this.endOffset+=1),this.setStartBefore(t)),o))return this.collapse(!0);return e||(n=this.endOffset,3==(r=this.endContainer).nodeType&&(0==n?this.setEndBefore(r):(n<r.nodeValue.length&&domUtils.split(r,n),this.setEndAfter(r)))),this},txtToElmBoundary:function(e){function t(e,t){var i=e[t+"Container"],n=e[t+"Offset"];3==i.nodeType&&(n?n>=i.nodeValue.length&&e["set"+t.replace(/(\w)/,function(e){return e.toUpperCase()})+"After"](i):e["set"+t.replace(/(\w)/,function(e){return e.toUpperCase()})+"Before"](i))}return!e&&this.collapsed||(t(this,"start"),t(this,"end")),this},insertNode:function(e){var t=e,i=1;11==e.nodeType&&(t=e.firstChild,i=e.childNodes.length),this.trimBoundary(!0);var n=this.startContainer,o=this.startOffset,o=n.childNodes[o];return o?n.insertBefore(e,o):n.appendChild(e),t.parentNode===this.endContainer&&(this.endOffset=this.endOffset+i),this.setStartBefore(t)},setCursor:function(e,t){return this.collapse(!e).select(t)},createBookmark:function(e,t){var i,n=this.document.createElement("span");return n.style.cssText="display:none;line-height:0px;",n.appendChild(this.document.createTextNode("‍")),n.id="_baidu_bookmark_start_"+(t?"":$f++),this.collapsed||((i=n.cloneNode(!0)).id="_baidu_bookmark_end_"+(t?"":$f++)),this.insertNode(n),i&&this.collapse().insertNode(i).setEndBefore(i),this.setStartAfter(n),{start:e?n.id:n,end:i?e?i.id:i:null,id:e}},moveToBookmark:function(e){var t=e.id?this.document.getElementById(e.start):e.start,e=e.end&&e.id?this.document.getElementById(e.end):e.end;return this.setStartBefore(t),domUtils.remove(t),e?(this.setEndBefore(e),domUtils.remove(e)):this.collapse(!0),this},enlarge:function(e,t){var i,n,o=domUtils.isBody,r=this.document.createTextNode("");if(e){for(i=1==(n=this.startContainer).nodeType?n=n.childNodes[this.startOffset]||(n.appendChild(r),r):n;;){if(domUtils.isBlockElm(n)){for(n=i;(i=n.previousSibling)&&!domUtils.isBlockElm(i);)n=i;this.setStartBefore(n);break}n=(i=n).parentNode}for(i=1==(n=this.endContainer).nodeType?((i=n.childNodes[this.endOffset])?n.insertBefore(r,i):n.appendChild(r),n=r):n;;){if(domUtils.isBlockElm(n)){for(n=i;(i=n.nextSibling)&&!domUtils.isBlockElm(i);)n=i;this.setEndAfter(n);break}n=(i=n).parentNode}r.parentNode===this.endContainer&&this.endOffset--,domUtils.remove(r)}if(!this.collapsed){for(;!(0!=this.startOffset||t&&t(this.startContainer)||o(this.startContainer));)this.setStartBefore(this.startContainer);for(;!(this.endOffset!=(1==this.endContainer.nodeType?this.endContainer.childNodes:this.endContainer.nodeValue).length||t&&t(this.endContainer)||o(this.endContainer));)this.setEndAfter(this.endContainer)}return this},enlargeToBlockElm:function(e){for(;!domUtils.isBlockElm(this.startContainer);)this.setStartBefore(this.startContainer);if(!e)for(;!domUtils.isBlockElm(this.endContainer);)this.setEndAfter(this.endContainer);return this},adjustmentBoundary:function(){if(!this.collapsed){for(;!domUtils.isBody(this.startContainer)&&this.startOffset==this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length&&this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length;)this.setStartAfter(this.startContainer);for(;!domUtils.isBody(this.endContainer)&&!this.endOffset&&this.endContainer[3==this.endContainer.nodeType?"nodeValue":"childNodes"].length;)this.setEndBefore(this.endContainer)}return this},applyInlineStyle:function(t,i,e){if(this.collapsed)return this;this.trimBoundary().enlarge(!1,function(e){return 1==e.nodeType&&domUtils.isBlockElm(e)}).adjustmentBoundary();function n(e){return 1==e.nodeType?"br"!=e.tagName.toLowerCase():!domUtils.isWhitespace(e)}for(var o,r,a=this.createBookmark(),s=a.end,l=domUtils.getNextDomNode(a.start,!1,n),d=this.cloneRange();l&&domUtils.getPosition(l,s)&domUtils.POSITION_PRECEDING;)if(3==l.nodeType||dtd[t][l.tagName]){for(d.setStartBefore(l),o=l;o&&(3==o.nodeType||dtd[t][o.tagName])&&o!==s;)r=o,o=domUtils.getNextDomNode(o,1==o.nodeType,null,function(e){return dtd[t][e.tagName]});var c,u,m=d.setEndAfter(r).extractContents();if(e&&0<e.length){for(var f,h,p=f=e[0].cloneNode(!1),g=1;h=e[g++];)f.appendChild(h.cloneNode(!1)),f=f.firstChild;c=f}else c=d.document.createElement(t);if(i&&domUtils.setAttributes(c,i),c.appendChild(m),"SPAN"==c.tagName&&i&&i.style&&utils.each(c.getElementsByTagName("span"),function(e){e.style.cssText=e.style.cssText+";"+i.style}),d.insertNode(e?p:c),"span"==t&&i.style&&/text\-decoration/.test(i.style)&&(u=domUtils.findParentByTagName(c,"a",!0))?(domUtils.setAttributes(u,i),domUtils.remove(c,!0),c=u):(domUtils.mergeSibling(c),domUtils.clearEmptySibling(c)),domUtils.mergeChild(c,i),l=domUtils.getNextDomNode(c,!1,n),domUtils.mergeToParent(c),o===s)break}else l=domUtils.getNextDomNode(l,!0,n);return this.moveToBookmark(a)},removeInlineStyle:function(e){if(this.collapsed)return this;e=utils.isArray(e)?e:[e],this.shrinkBoundary().adjustmentBoundary();for(var t=this.startContainer,i=this.endContainer;;){if(1==t.nodeType){if(-1<utils.indexOf(e,t.tagName.toLowerCase()))break;if("body"==t.tagName.toLowerCase()){t=null;break}}t=t.parentNode}for(;;){if(1==i.nodeType){if(-1<utils.indexOf(e,i.tagName.toLowerCase()))break;if("body"==i.tagName.toLowerCase()){i=null;break}}i=i.parentNode}var n,o,r=this.createBookmark();t&&(n=(o=this.cloneRange().setEndBefore(r.start).setStartBefore(t)).extractContents(),o.insertNode(n),domUtils.clearEmptySibling(t,!0),t.parentNode.insertBefore(r.start,t)),i&&(n=(o=this.cloneRange().setStartAfter(r.end).setEndAfter(i)).extractContents(),o.insertNode(n),domUtils.clearEmptySibling(i,!1,!0),i.parentNode.insertBefore(r.end,i.nextSibling));for(var a,s=domUtils.getNextDomNode(r.start,!1,function(e){return 1==e.nodeType});s&&s!==r.end;)a=domUtils.getNextDomNode(s,!0,function(e){return 1==e.nodeType}),-1<utils.indexOf(e,s.tagName.toLowerCase())&&domUtils.remove(s,!0),s=a;return this.moveToBookmark(r)},getClosedNode:function(){var e,t;return this.collapsed||(!a5(t=this.cloneRange().adjustmentBoundary().shrinkBoundary())||(t=t.startContainer.childNodes[t.startOffset])&&1==t.nodeType&&(dtd.$empty[t.tagName]||dtd.$nonChild[t.tagName])&&(e=t)),e},select:browser.ie?function(e,t){var i;this.collapsed||this.shrinkBoundary();var n=this.getClosedNode();if(n&&!t){try{(i=this.document.body.createControlRange()).addElement(n),i.select()}catch(e){}return this}var o,r,t=this.createBookmark(),n=t.start;(i=this.document.body.createTextRange()).moveToElementText(n),i.moveStart("character",1),this.collapsed?e||3==this.startContainer.nodeType||(r=this.document.createTextNode(_f),(o=this.document.createElement("span")).appendChild(this.document.createTextNode(_f)),n.parentNode.insertBefore(o,n),n.parentNode.insertBefore(r,n),e5(this.document,r),Zf=r,f5(o,"previousSibling"),f5(n,"nextSibling"),i.moveStart("character",-1),i.collapse(!0)):(r=this.document.body.createTextRange(),n=t.end,r.moveToElementText(n),i.setEndPoint("EndToEnd",r)),this.moveToBookmark(t),o&&domUtils.remove(o);try{i.select()}catch(e){}return this}:function(e){var t,n,i=domUtils.getWindow(this.document),o=i.getSelection();if((browser.gecko?this.document.body:i).focus(),o){o.removeAllRanges(),this.collapsed&&!e&&(1==(t=e=this.startContainer).nodeType&&(t=e.childNodes[this.startOffset]),3==e.nodeType&&this.startOffset||(t?t.previousSibling&&3==t.previousSibling.nodeType:e.lastChild&&3==e.lastChild.nodeType)||(r=this.document.createTextNode(_f),this.insertNode(r),e5(this.document,r),f5(r,"previousSibling"),f5(r,"nextSibling"),Zf=r,this.setStart(r,browser.webkit?1:0).collapse(!0)));var r=this.document.createRange();if(this.collapsed&&browser.opera&&1==this.startContainer.nodeType)if(t=this.startContainer.childNodes[this.startOffset]){for(;t&&domUtils.isBlockElm(t)&&1==t.nodeType&&t.childNodes[0];)t=t.childNodes[0];t&&this.setStartBefore(t).collapse(!0)}else(t=this.startContainer.lastChild)&&domUtils.isBr(t)&&this.setStartBefore(t).collapse(!0);a((n=this).startContainer,n.startOffset,"start"),a(n.endContainer,n.endOffset,"end"),r.setStart(this.startContainer,this.startOffset),r.setEnd(this.endContainer,this.endOffset),o.addRange(r)}function a(e,t,i){3==e.nodeType&&e.nodeValue.length<t&&(n[i+"Offset"]=e.nodeValue.length)}return this},scrollToView:function(e,t){e=e?window:domUtils.getWindow(this.document);var i=this.document.createElement("span");return i.innerHTML="&nbsp;",this.cloneRange().insertNode(i),domUtils.scrollToView(i,e,t),domUtils.remove(i),this},inFillChar:function(){var e=this.startContainer;return!(!this.collapsed||3!=e.nodeType||e.nodeValue.replace(new RegExp("^"+domUtils.fillChar),"").length+1!=e.nodeValue.length)},createAddress:function(e,d){var t={},c=this;function i(e){for(var t,i=e?c.startContainer:c.endContainer,n=domUtils.findParents(i,!0,function(e){return!domUtils.isBody(e)}),o=[],r=0;t=n[r++];)o.push(domUtils.getNodeIndex(t,d));var a=0;if(d)if(3==i.nodeType){for(var s=i.previousSibling;s&&3==s.nodeType;)a+=s.nodeValue.replace(fillCharReg,"").length,s=s.previousSibling;a+=e?c.startOffset:c.endOffset}else if(i=i.childNodes[e?c.startOffset:c.endOffset])a=domUtils.getNodeIndex(i,d);else for(var l=(i=e?c.startContainer:c.endContainer).firstChild;l;)if(domUtils.isFillChar(l))l=l.nextSibling;else if(a++,3==l.nodeType)for(;l&&3==l.nodeType;)l=l.nextSibling;else l=l.nextSibling;else a=e?domUtils.isFillChar(i)?0:c.startOffset:c.endOffset;return o.push(a=a<0?0:a),o}return t.startAddress=i(!0),e||(t.endAddress=c.collapsed?[].concat(t.startAddress):i()),t},moveToAddress:function(e,t){var l=this;function i(e,t){for(var i,n,o,r=l.document.body,a=0,s=e.length;a<s;a++)if(o=e[a],!(r=(i=r).childNodes[o])){n=o;break}t?r?l.setStartBefore(r):l.setStart(i,n):r?l.setEndBefore(r):l.setEnd(i,n)}return i(e.startAddress,!0),!t&&e.endAddress&&i(e.endAddress),l},equals:function(e){for(var t in this)if(this.hasOwnProperty(t)&&this[t]!==e[t])return!1;return!0},traversal:function(e,t){if(this.collapsed)return this;for(var i=this.createBookmark(),n=i.end,o=domUtils.getNextDomNode(i.start,!1,t);o&&o!==n&&domUtils.getPosition(o,n)&domUtils.POSITION_PRECEDING;){var r=domUtils.getNextDomNode(o,!1,t);e(o),o=r}return this.moveToBookmark(i)}},(dom.Selection=function(e){var t=this;t.document=e,browser.ie9below&&(e=domUtils.getWindow(e).frameElement,domUtils.on(e,"beforedeactivate",function(){t._bakIERange=t.getIERange()}),domUtils.on(e,"activate",function(){try{!Oh(t)&&t._bakIERange&&t._bakIERange.select()}catch(e){}t._bakIERange=null}))}).prototype={rangeInBody:function(e,t){e=browser.ie9below||t?e.item?e.item():e.parentElement():e.startContainer;return e===this.document.body||domUtils.inDoc(e,this.document)},getNative:function(){var e=this.document;try{return e?browser.ie9below?e.selection:domUtils.getWindow(e).getSelection():null}catch(e){return null}},getIERange:function(){var e=Oh(this);return!e&&this._bakIERange?this._bakIERange:e},cache:function(){this.clear(),this._cachedRange=this.getRange(),this._cachedStartElement=this.getStart(),this._cachedStartElementPath=this.getStartElementPath()},getStartElementPath:function(){if(this._cachedStartElementPath)return this._cachedStartElementPath;var e=this.getStart();return e?domUtils.findParents(e,!0,null,!0):[]},clear:function(){this._cachedStartElementPath=this._cachedRange=this._cachedStartElement=null},isFocus:function(){try{if(browser.ie9below){var e=Oh(this);return!(!e||!this.rangeInBody(e))}return!!this.getNative().rangeCount}catch(e){return!1}},getRange:function(){var n=this;function t(e){for(var t=n.document.body.firstChild,i=e.collapsed;t&&t.firstChild;)e.setStart(t,0),t=t.firstChild;e.startContainer||e.setStart(n.document.body,0),i&&e.collapse(!0)}if(null!=n._cachedRange)return this._cachedRange;var e,i=new baidu.editor.dom.Range(n.document);if(browser.ie9below){var o=n.getIERange();if(o)try{r=i,(e=o).item?r.selectNode(e.item(0)):(a=Nh(e,!0),r.setStart(a.container,a.offset),0!=e.compareEndPoints("StartToEnd",e)&&(a=Nh(e,!1),r.setEnd(a.container,a.offset)))}catch(e){t(i)}else t(i)}else{var r=n.getNative();if(r&&r.rangeCount){var a=r.getRangeAt(0),r=r.getRangeAt(r.rangeCount-1);i.setStart(a.startContainer,a.startOffset).setEnd(r.endContainer,r.endOffset),i.collapsed&&domUtils.isBody(i.startContainer)&&!i.startOffset&&t(i)}else{if(this._bakRange&&domUtils.inDoc(this._bakRange.startContainer,this.document))return this._bakRange;t(i)}}return this._bakRange=i},getStart:function(){if(this._cachedStartElement)return this._cachedStartElement;var e,t,i,n,o=browser.ie9below?this.getIERange():this.getRange();if(browser.ie9below){if(!o)return this.document.body.firstChild;if(o.item)return o.item(0);for(0<(e=o.duplicate()).text.length&&e.moveStart("character",1),e.collapse(1),t=e.parentElement(),n=i=o.parentElement();i=i.parentNode;)if(i==t){t=n;break}}else if(o.shrinkBoundary(),3==(t=1==(t=o.startContainer).nodeType&&t.hasChildNodes()?t.childNodes[Math.min(t.childNodes.length-1,o.startOffset)]:t).nodeType)return t.parentNode;return t},getText:function(){var e;return this.isFocus()&&(e=this.getNative())?(e=browser.ie9below?e.createRange():e.getRangeAt(0),browser.ie9below?e.text:e.toString()):""},clearRange:function(){this.getNative()[browser.ie9below?"empty":"removeAllRanges"]()}},L7=0,O7=UE.Editor=function(e){var t=this;t.uid=L7++,EventBase.call(t),t.commands={},t.options=utils.extend(utils.clone(e||{}),UEDITOR_CONFIG,!0),t.shortcutkeys={},t.inputRules=[],t.outputRules=[],t.setOpt(O7.defaultOptions(t)),t.loadServerConfig(),utils.isEmptyObject(UE.I18N)?utils.loadFile(document,{src:t.options.langPath+t.options.lang+"/"+t.options.lang+".js",tag:"script",type:"text/javascript",defer:"defer"},function(){UE.plugin.load(t),N7(t)}):(t.options.lang=function(){for(var e in UE.I18N)return e}(),UE.plugin.load(t),N7(t)),UE.instants["ueditorInstant"+t.uid]=t},O7.prototype={registerCommand:function(e,t){this.commands[e]=t},ready:function(e){e&&(this.isReady?e.apply(this):this.addListener("ready",e))},setOpt:function(e,t){var i={};utils.isString(e)?i[e]=t:i=e,utils.extend(this.options,i,!0)},getOpt:function(e){return this.options[e]},destroy:function(){var e=this;e.fireEvent("destroy");var t=e.container.parentNode,i=e.textarea;i?i.style.display="":(i=document.createElement("textarea"),t.parentNode.insertBefore(i,t)),i.style.width=e.iframe.offsetWidth+"px",i.style.height=e.iframe.offsetHeight+"px",i.value=e.getContent(),i.id=e.key,t.innerHTML="",domUtils.remove(t);var n,t=e.key;for(n in e)e.hasOwnProperty(n)&&delete this[n];UE.delEditor(t)},render:function(t){var e=this.options,i=function(e){return parseInt(domUtils.getComputedStyle(t,e))};if(t=utils.isString(t)?document.getElementById(t):t){e.initialFrameWidth?e.minFrameWidth=e.initialFrameWidth:e.minFrameWidth=e.initialFrameWidth=t.offsetWidth,e.initialFrameHeight?e.minFrameHeight=e.initialFrameHeight:e.initialFrameHeight=e.minFrameHeight=t.offsetHeight,t.style.width=/%$/.test(e.initialFrameWidth)?"100%":e.initialFrameWidth-i("padding-left")-i("padding-right")+"px",t.style.height=/%$/.test(e.initialFrameHeight)?"100%":e.initialFrameHeight-i("padding-top")-i("padding-bottom")+"px",t.style.zIndex=e.zIndex;var n,o=[];for(n in e.iframeCssUrlsAddition)o.push("<link rel='stylesheet' type='text/css' href='"+utils.unhtml(e.iframeCssUrlsAddition[n])+"'/>");i=(ie&&browser.version<9?"":"<!DOCTYPE html>")+"<html xmlns='http://www.w3.org/1999/xhtml' class='view' ><head><style type='text/css'>.view{padding:0;word-wrap:break-word;cursor:text;height:90%;}\nbody{margin:8px;font-family:sans-serif;font-size:16px;}p{margin:5px 0;}</style>"+(e.iframeCssUrl?"<link rel='stylesheet' type='text/css' href='"+utils.unhtml(e.iframeCssUrl)+"'/>":"")+(e.initialStyle?"<style>"+e.initialStyle+"</style>":"")+o.join("")+"</head><body class='view' ></body><script type='text/javascript' "+(ie?"defer='defer'":"")+" id='_initialScript'>setTimeout(function(){editor = window.parent.UE.instants['ueditorInstant"+this.uid+"'];editor._setup(document);},0);var _tmpScript = document.getElementById('_initialScript');_tmpScript.parentNode.removeChild(_tmpScript);<\/script>"+(e.iframeJsUrl?"<script type='text/javascript' src='"+utils.unhtml(e.iframeJsUrl)+"'><\/script>":"")+"</html>";t.appendChild(domUtils.createElement(document,"iframe",{id:"ueditor_"+this.uid,width:"100%",height:"100%",frameborder:"0",src:"javascript:void(function(){document.open();"+(e.customDomain&&document.domain!=location.hostname?'document.domain="'+document.domain+'";':"")+'document.write("'+i+'");document.close();}())'})),t.style.overflow="hidden",setTimeout(function(){/%$/.test(e.initialFrameWidth)&&(e.minFrameWidth=e.initialFrameWidth=t.offsetWidth),/%$/.test(e.initialFrameHeight)&&(e.minFrameHeight=e.initialFrameHeight=t.offsetHeight,t.style.height=e.initialFrameHeight+"px")})}},_setup:function(e){var t,i=this,n=i.options;ie?(e.body.disabled=!0,e.body.contentEditable=!0,e.body.disabled=!1):e.body.contentEditable=!0,e.body.spellcheck=!1,i.document=e,i.window=e.defaultView||e.parentWindow,i.iframe=i.window.frameElement,i.body=e.body,i.selection=new dom.Selection(e),browser.gecko&&(t=this.selection.getNative())&&t.removeAllRanges(),this._initEvents();for(var o,r=this.iframe.parentNode;!domUtils.isBody(r);r=r.parentNode)if("FORM"==r.tagName){i.form=r,i.options.autoSyncData?domUtils.on(i.window,"blur",function(){M7(r,i)}):domUtils.on(r,"submit",function(){M7(this,i)});break}n.initialContent&&(n.autoClearinitialContent?(o=i.execCommand,i.execCommand=function(){return i.fireEvent("firstBeforeExecCommand"),o.apply(i,arguments)},this._setDefaultContent(n.initialContent)):this.setContent(n.initialContent,!1,!0)),domUtils.isEmptyNode(i.body)&&(i.body.innerHTML="<p>"+(browser.ie?"":"<br/>")+"</p>"),n.focus&&setTimeout(function(){i.focus(i.options.focusInEnd),i.options.autoClearinitialContent||i._selectionChange()},0),i.container||(i.container=this.iframe.parentNode),n.fullscreen&&i.ui&&i.ui.setFullScreen(!0);try{i.document.execCommand("2D-position",!1,!1)}catch(e){}try{i.document.execCommand("enableInlineTableEditing",!1,!1)}catch(e){}try{i.document.execCommand("enableObjectResizing",!1,!1)}catch(e){}i._bindshortcutKeys(),i.isReady=1,i.fireEvent("ready"),n.onready&&n.onready.call(i),browser.ie9below||domUtils.on(i.window,["blur","focus"],function(e){if("blur"==e.type){i._bakRange=i.selection.getRange();try{i._bakNativeRange=i.selection.getNative().getRangeAt(0),i.selection.getNative().removeAllRanges()}catch(e){i._bakNativeRange=null}}else try{i._bakRange&&i._bakRange.select()}catch(e){}}),browser.gecko&&browser.version<=10902&&(i.body.contentEditable=!1,setTimeout(function(){i.body.contentEditable=!0},100),setInterval(function(){i.body.style.height=i.iframe.offsetHeight-20+"px"},100)),n.isShow||i.setHide(),n.readonly&&i.setDisabled()},sync:function(e){e=e?document.getElementById(e):domUtils.findParent(this.iframe.parentNode,function(e){return"FORM"==e.tagName},!0);e&&M7(e,this)},syncCommandState:function(){this.fireEvent("selectionchange")},setWidth:function(e){e!==parseInt(this.iframe.parentNode.parentNode.style.width)&&(this.iframe.parentNode.parentNode.style.width=e+"px")},setHeight:function(e,t){e!==parseInt(this.iframe.parentNode.style.height)&&(this.iframe.parentNode.style.height=e+"px"),t||(this.options.minFrameHeight=this.options.initialFrameHeight=e),this.body.style.height=e+"px",t||this.trigger("setHeight")},addshortcutkey:function(e,t){var i={};t?i[e]=t:i=e,utils.extend(this.shortcutkeys,i)},_bindshortcutKeys:function(){var l=this,d=this.shortcutkeys;l.addListener("keydown",function(e,t){var i,n=t.keyCode||t.which;for(i in d)for(var o=d[i].split(","),r=0;s=o[r++];){var a=(s=s.split(":"))[0],s=s[1];!/^(ctrl)(\+shift)?\+(\d+)$/.test(a.toLowerCase())&&!/^(\d+)$/.test(a)||("ctrl"!=RegExp.$1||!t.ctrlKey&&!t.metaKey||""!=RegExp.$2&&!t[RegExp.$2.slice(1)+"Key"]||n!=RegExp.$3)&&n!=RegExp.$1||(-1!=l.queryCommandState(i,s)&&l.execCommand(i,s),domUtils.preventDefault(t))}})},getContent:function(e,t,i,n,o){if(e&&utils.isFunction(e)&&(t=e,e=""),t?!t():!this.hasContents())return"";this.fireEvent("beforegetcontent");n=UE.htmlparser(this.body.innerHTML,n);return this.filterOutputRule(n),this.fireEvent("aftergetcontent",e,n),n.toHtml(o)},getAllHtml:function(){var t,e=this,i=[];return e.fireEvent("getAllHtml",i),browser.ie&&8<browser.version&&(t="",utils.each(e.document.styleSheets,function(e){t+=e.href?'<link rel="stylesheet" type="text/css" href="'+e.href+'" />':"<style>"+e.cssText+"</style>"}),utils.each(e.document.getElementsByTagName("script"),function(e){t+=e.outerHTML})),"<html><head>"+(e.options.charset?'<meta http-equiv="Content-Type" content="text/html; charset='+e.options.charset+'"/>':"")+(t||e.document.getElementsByTagName("head")[0].innerHTML)+i.join("\n")+"</head><body "+(ie&&browser.version<9?'class="view"':"")+">"+e.getContent(null,null,!0)+"</body></html>"},getPlainTxt:function(){var e=new RegExp(domUtils.fillChar,"g");return this.body.innerHTML.replace(/[\n\r]/g,"").replace(/<(p|div)[^>]*>(<br\/?>|&nbsp;)<\/\1>/gi,"\n").replace(/<br\/?>/gi,"\n").replace(/<[^>/]+>/g,"").replace(/(\n)?<\/([^>]+)>/g,function(e,t,i){return dtd.$block[i]?"\n":t||""}).replace(e,"").replace(/\u00a0/g," ").replace(/&nbsp;/g," ")},getContentTxt:function(){var e=new RegExp(domUtils.fillChar,"g");return this.body[browser.ie?"innerText":"textContent"].replace(e,"").replace(/\u00a0/g," ")},setContent:function(e,t,i){var n=this;n.fireEvent("beforesetcontent",e);var o,r=UE.htmlparser(e);if(n.filterInputRule(r),e=r.toHtml(),n.body.innerHTML=(t?n.body.innerHTML:"")+e,"p"==n.options.enterTag){var a,s=this.body.firstChild;if(!s||1==s.nodeType&&(dtd.$cdata[s.tagName]||"DIV"==s.tagName&&s.getAttribute("cdata_tag")||domUtils.isCustomeNode(s))&&s===this.body.lastChild)this.body.innerHTML="<p>"+(browser.ie?"&nbsp;":"<br/>")+"</p>"+this.body.innerHTML;else for(var l=n.document.createElement("p");s;){for(;s&&(3==s.nodeType||1==s.nodeType&&dtd.p[s.tagName]&&!dtd.$cdata[s.tagName]);)a=s.nextSibling,l.appendChild(s),s=a;if(l.firstChild){if(!s){n.body.appendChild(l);break}s.parentNode.insertBefore(l,s),l=n.document.createElement("p")}s=s.nextSibling}}n.fireEvent("aftersetcontent"),n.fireEvent("contentchange"),i||n._selectionChange(),n._bakRange=n._bakIERange=n._bakNativeRange=null,browser.gecko&&(o=this.selection.getNative())&&o.removeAllRanges(),n.options.autoSyncData&&n.form&&M7(n.form,n)},focus:function(e){try{var t,i=this.selection.getRange();e?((t=this.body.lastChild)&&1==t.nodeType&&!dtd.$empty[t.tagName]&&(domUtils.isEmptyBlock(t)?i.setStartAtFirst(t):i.setStartAtLast(t),i.collapse(!0)),i.setCursor(!0)):(!i.collapsed&&domUtils.isBody(i.startContainer)&&0==i.startOffset&&(t=this.body.firstChild)&&1==t.nodeType&&!dtd.$empty[t.tagName]&&i.setStartAtFirst(t).collapse(!0),i.select(!0)),this.fireEvent("focus selectionchange")}catch(e){}},isFocus:function(){return this.selection.isFocus()},blur:function(){var e,t=this.selection.getNative();t.empty&&browser.ie?((e=document.body.createTextRange()).moveToElementText(document.body),e.collapse(!0),e.select(),t.empty()):t.removeAllRanges()},_initEvents:function(){var t=this,e=t.document,i=t.window;t._proxyDomEvent=utils.bind(t._proxyDomEvent,t),domUtils.on(e,["click","contextmenu","mousedown","keydown","keyup","keypress","mouseup","mouseover","mouseout","selectstart"],t._proxyDomEvent),domUtils.on(i,["focus","blur"],t._proxyDomEvent),domUtils.on(t.body,"drop",function(e){browser.gecko&&e.stopPropagation&&e.stopPropagation(),t.fireEvent("contentchange")}),domUtils.on(e,["mouseup","keydown"],function(e){"keydown"==e.type&&(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)||2!=e.button&&t._selectionChange(250,e)})},_proxyDomEvent:function(e){return!1!==this.fireEvent("before"+e.type.replace(/^on/,"").toLowerCase())&&!1!==this.fireEvent(e.type.replace(/^on/,""),e)&&this.fireEvent("after"+e.type.replace(/^on/,"").toLowerCase())},_selectionChange:function(e,i){var n,o,r=this,a=!1;browser.ie&&browser.version<9&&i&&"mouseup"==i.type&&(this.selection.getRange().collapsed||(a=!0,n=i.clientX,o=i.clientY)),clearTimeout(K7),K7=setTimeout(function(){if(r.selection&&r.selection.getNative()){var e,t;if(a&&"None"==r.selection.getNative().type){e=r.document.body.createTextRange();try{e.moveToPoint(n,o)}catch(t){e=null}}e&&(t=r.selection.getIERange,r.selection.getIERange=function(){return e}),r.selection.cache(),t&&(r.selection.getIERange=t),r.selection._cachedRange&&r.selection._cachedStartElement&&(r.fireEvent("beforeselectionchange"),r.fireEvent("selectionchange",!!i),r.fireEvent("afterselectionchange"),r.selection.clear())}},e||50)},_callCmdFn:function(e,t){var i,n=t[0].toLowerCase(),n=(i=this.commands[n]||UE.commands[n])&&i[e];return i&&n||"queryCommandState"!=e?n?n.apply(this,t):void 0:0},execCommand:function(e){e=e.toLowerCase();var t,i=this,n=i.commands[e]||UE.commands[e];return n&&n.execCommand?(n.notNeedUndo||i.__hasEnterExecCommand?(t=this._callCmdFn("execCommand",arguments),i.__hasEnterExecCommand||n.ignoreContentChange||i._ignoreContentChange||i.fireEvent("contentchange")):(i.__hasEnterExecCommand=!0,-1!=i.queryCommandState.apply(i,arguments)&&(i.fireEvent("saveScene"),i.fireEvent.apply(i,["beforeexeccommand",e].concat(arguments)),t=this._callCmdFn("execCommand",arguments),i.fireEvent.apply(i,["afterexeccommand",e].concat(arguments)),i.fireEvent("saveScene")),i.__hasEnterExecCommand=!1),i.__hasEnterExecCommand||n.ignoreContentChange||i._ignoreContentChange||i._selectionChange(),t):null},queryCommandState:function(e){return this._callCmdFn("queryCommandState",arguments)},queryCommandValue:function(e){return this._callCmdFn("queryCommandValue",arguments)},hasContents:function(e){if(e)for(var t,i=0;t=e[i++];)if(0<this.document.getElementsByTagName(t).length)return!0;if(!domUtils.isEmptyBlock(this.body))return!0;for(e=["div"],i=0;t=e[i++];)for(var n,o=domUtils.getElementsByTagName(this.document,t),r=0;n=o[r++];)if(domUtils.isCustomeNode(n))return!0;return!1},reset:function(){this.fireEvent("reset")},setEnabled:function(){var t,i=this;if("false"==i.body.contentEditable){i.body.contentEditable=!0,t=i.selection.getRange();try{t.moveToBookmark(i.lastBk),delete i.lastBk}catch(e){t.setStartAtFirst(i.body).collapse(!0)}t.select(!0),i.bkqueryCommandState&&(i.queryCommandState=i.bkqueryCommandState,delete i.bkqueryCommandState),i.bkqueryCommandValue&&(i.queryCommandValue=i.bkqueryCommandValue,delete i.bkqueryCommandValue),i.fireEvent("selectionchange")}},enable:function(){return this.setEnabled()},setDisabled:function(t){var i=this;t=t?utils.isArray(t)?t:[t]:[],"true"==i.body.contentEditable&&(i.lastBk||(i.lastBk=i.selection.getRange().createBookmark(!0)),i.body.contentEditable=!1,i.bkqueryCommandState=i.queryCommandState,i.bkqueryCommandValue=i.queryCommandValue,i.queryCommandState=function(e){return-1!=utils.indexOf(t,e)?i.bkqueryCommandState.apply(i,arguments):-1},i.queryCommandValue=function(e){return-1!=utils.indexOf(t,e)?i.bkqueryCommandValue.apply(i,arguments):null},i.fireEvent("selectionchange"))},disable:function(e){return this.setDisabled(e)},_setDefaultContent:function(e){this.body.innerHTML='<p id="initContent">'+e+"</p>",this.addListener("firstBeforeExecCommand focus",jj)},setShow:function(){var t=this,i=t.selection.getRange();if("none"==t.container.style.display){try{i.moveToBookmark(t.lastBk),delete t.lastBk}catch(e){i.setStartAtFirst(t.body).collapse(!0)}setTimeout(function(){i.select(!0)},100),t.container.style.display=""}},show:function(){return this.setShow()},setHide:function(){this.lastBk||(this.lastBk=this.selection.getRange().createBookmark(!0)),this.container.style.display="none"},hide:function(){return this.setHide()},getLang:function(e){var t=UE.I18N[this.options.lang];if(!t)throw Error("not import language file");e=(e||"").split(".");for(var i,n=0;(i=e[n++])&&(t=t[i]););return t},getContentLength:function(e,t){var i=this.getContent(!1,!1,!0).length;if(e){t=(t||[]).concat(["hr","img","iframe"]);for(var n,i=this.getContentTxt().replace(/[\t\r\n]+/g,"").length,o=0;n=t[o++];)i+=this.document.getElementsByTagName(n).length}return i},addInputRule:function(e){this.inputRules.push(e)},filterInputRule:function(e){for(var t,i=0;t=this.inputRules[i++];)t.call(this,e)},addOutputRule:function(e){this.outputRules.push(e)},filterOutputRule:function(e){for(var t,i=0;t=this.outputRules[i++];)t.call(this,e)},getActionUrl:function(e){var t=this.getOpt(e)||e,i=this.getOpt("imageUrl"),e=this.getOpt("serverUrl");return(e=!e&&i?i.replace(/^(.*[\/]).+([\.].+)$/,"$1controller$2"):e)?(e=e+(-1==e.indexOf("?")?"?":"&")+"action="+(t||""),utils.formatUrl(e)):""}},utils.inherits(O7,EventBase),UE.Editor.defaultOptions=function(e){e=e.options.UEDITOR_HOME_URL;return{isShow:!0,initialContent:"",initialStyle:"",autoClearinitialContent:!1,iframeCssUrl:e+"themes/iframe.css?20220503",iframeCssUrlsAddition:[],textarea:"editorValue",focus:!1,focusInEnd:!0,autoClearEmptyNode:!0,fullscreen:!1,readonly:!1,zIndex:999,imagePopup:!0,enterTag:"p",customDomain:!1,lang:"zh-cn",langPath:e+"lang/",theme:"default",themePath:e+"themes/",allHtmlEnabled:!1,scaleEnabled:!1,tableNativeEditInFF:!1,autoSyncData:!0,fileNameFormat:"{time}{rand:6}"}},function(){UE.Editor.prototype.loadServerConfig=function(){var me=this;function showErrorMsg(e){console&&console.error(e)}setTimeout(function(){try{me.options.imageUrl&&me.setOpt("serverUrl",me.options.imageUrl.replace(/^(.*[\/]).+([\.].+)$/,"$1controller$2"));var configUrl=me.getActionUrl("config"),isJsonp=utils.isCrossDomainUrl(configUrl);me._serverConfigLoaded=!1,configUrl&&UE.ajax.request(configUrl,{method:"GET",dataType:isJsonp?"jsonp":"",onsuccess:function(r){try{var config=isJsonp?r:eval("("+r.responseText+")");utils.extend(me.options,config),me.fireEvent("serverConfigLoaded"),me._serverConfigLoaded=!0}catch(e){showErrorMsg(me.getLang("loadconfigFormatError"))}},onerror:function(){showErrorMsg(me.getLang("loadconfigHttpError"))}})}catch(e){showErrorMsg(me.getLang("loadconfigError"))}})},UE.Editor.prototype.isServerConfigLoaded=function(){return this._serverConfigLoaded||!1},UE.Editor.prototype.afterConfigReady=function(e){var t,i;e&&utils.isFunction(e)&&(i=function(){e.apply(t,arguments),t.removeListener("serverConfigLoaded",i)},(t=this).isServerConfigLoaded()?e.call(t,"serverConfigLoaded"):t.addListener("serverConfigLoaded",i))}}(),UE.ajax=function(){var e="XMLHttpRequest()";try{new ActiveXObject("Msxml2.XMLHTTP"),e="ActiveXObject('Msxml2.XMLHTTP')"}catch(s){try{new ActiveXObject("Microsoft.XMLHTTP"),e="ActiveXObject('Microsoft.XMLHTTP')"}catch(e){}}var s=new Function("return new "+e);function f(e){var t,i=[];for(t in e)if("method"!=t&&"timeout"!=t&&"async"!=t&&"dataType"!=t&&"callback"!=t&&null!=e[t]&&null!=e[t])if("function"!=(typeof e[t]).toLowerCase()&&"object"!=(typeof e[t]).toLowerCase())i.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));else if(utils.isArray(e[t]))for(var n=0;n<e[t].length;n++)i.push(encodeURIComponent(t)+"[]="+encodeURIComponent(e[t][n]));return i.join("&")}function l(e,t){var i,n,o,r=t.onsuccess||function(){},a=document.createElement("SCRIPT"),s=t||{},l=s.charset,d=s.jsonp||"callback",c=s.timeOut||0,u=new RegExp("(\\?|&)"+d+"=([^&]*)");utils.isFunction(r)?(i="bd__editor__"+Math.floor(2147483648*Math.random()).toString(36),window[i]=m(0)):utils.isString(r)?i=r:(o=u.exec(e))&&(i=o[2]),(e=e.replace(u,"$1"+d+"="+i)).search(u)<0&&(e+=(e.indexOf("?")<0?"?":"&")+d+"="+i);d=f(t);function m(e){return function(){try{if(e)s.onerror&&s.onerror();else try{clearTimeout(n),r.apply(window,arguments)}catch(e){}}catch(e){s.onerror&&s.onerror.call(window,e)}finally{s.oncomplete&&s.oncomplete.apply(window,arguments),a.parentNode&&a.parentNode.removeChild(a),window[i]=null;try{delete window[i]}catch(e){}}}}utils.isEmptyObject(t.data)||(d+=(d?"&":"")+f(t.data)),d&&(e=e.replace(/\?/,"?"+d+"&")),a.onerror=m(1),c&&(n=setTimeout(m(1),c)),c=e,e=l,(l=a).setAttribute("type","text/javascript"),l.setAttribute("defer","defer"),e&&l.setAttribute("charset",e),l.setAttribute("src",c),document.getElementsByTagName("head")[0].appendChild(l)}return{request:function(e,t){var i,n,o,r,a;t&&"jsonp"==t.dataType?l(e,t):(i=e,e=t,r=s(),t={method:"POST",timeout:5e3,async:!(a=!1),data:{},onsuccess:function(){},onerror:function(){}},"object"==typeof i&&(i=(e=i).url),r&&i&&(e=f(n=e?utils.extend(t,e):t),utils.isEmptyObject(n.data)||(e+=(e?"&":"")+f(n.data)),o=setTimeout(function(){4!=r.readyState&&(a=!0,r.abort(),clearTimeout(o))},n.timeout),t=n.method.toUpperCase(),i=i+(-1==i.indexOf("?")?"?":"&")+("POST"==t?"":e+"&noCache="+ +new Date),r.open(t,i,n.async),r.onreadystatechange=function(){4==r.readyState&&(a||200!=r.status?n.onerror(r):n.onsuccess(r))},"POST"==t?(r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(e)):r.send(null)))},getJSONP:function(e,t,i){l(e,{data:t,oncomplete:i})}}}();var filterWord=UE.filterWord=function(e){return/(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|<(v|o):|lang=)/gi.test(e)?e.replace(/[\t\r\n]+/g," ").replace(/<!--[\s\S]*?-->/gi,"").replace(/<v:shape [^>]*>[\s\S]*?.<\/v:shape>/gi,function(e){if(browser.opera)return"";try{if(/Bitmap/i.test(e))return"";var t=e.match(/width:([ \d.]*p[tx])/i)[1],i=e.match(/height:([ \d.]*p[tx])/i)[1],n=e.match(/src=\s*"([^"]*)"/i)[1];return'<img width="'+G9(t)+'" height="'+G9(i)+'" src="'+n+'" />'}catch(e){return""}}).replace(/<\/?div[^>]*>/g,"").replace(/v:\w+=(["']?)[^'"]+\1/g,"").replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi,"").replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>").replace(/\s+(class|lang|align)\s*=\s*(['"]?)([\w-]+)\2/gi,function(e,t,i,n){return"class"==t&&"MsoListParagraph"==n?e:""}).replace(/<(font|span)[^>]*>(\s*)<\/\1>/gi,function(e,t,i){return i.replace(/[\t\r\n ]+/g," ")}).replace(/(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi,function(e,t,i,n){for(var o=[],r=n.replace(/^\s+|\s+$/,"").replace(/&#39;/g,"'").replace(/&quot;/gi,"'").replace(/[\d.]+(cm|pt)/g,function(e){return utils.transUnitToPx(e)}).split(/;\s*/g),a=0;d=r[a];a++){var s,l,d=d.split(":");if(2==d.length&&(s=d[0].toLowerCase(),l=d[1].toLowerCase(),!(/^(background)\w*/.test(s)&&0==l.replace(/(initial|\s)/g,"").length||/^(margin)\w*/.test(s)&&/^0\w+$/.test(l)))){switch(s){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":/<table/.test(t)||(o[a]=s.replace(/^mso-|-alt$/g,"")+":"+G9(l));continue;case"horiz-align":o[a]="text-align:"+l;continue;case"vert-align":o[a]="vertical-align:"+l;continue;case"font-color":case"mso-foreground":o[a]="color:"+l;continue;case"mso-background":case"mso-highlight":o[a]="background:"+l;continue;case"mso-default-height":o[a]="min-height:"+G9(l);continue;case"mso-default-width":o[a]="min-width:"+G9(l);continue;case"mso-padding-between-alt":o[a]="border-collapse:separate;border-spacing:"+G9(l);continue;case"text-line-through":"single"!=l&&"double"!=l||(o[a]="text-decoration:line-through");continue;case"mso-zero-height":"yes"==l&&(o[a]="display:none");continue;case"margin":if(!/[1-9]/.test(l))continue}/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?:decor|trans)|top-bar|version|vnd|word-break)/.test(s)||/text\-indent|padding|margin/.test(s)&&/\-[\d.]+/.test(l)||(o[a]=s+":"+d[1])}}return t+(o.length?' style="'+o.join(";").replace(/;{2,}/g,";")+'"':"")}):e},hk,ik,jk;function G9(e){return e.replace(/[\d.]+\w+/g,function(e){return utils.transUnitToPx(e)})}function kk(e,t,i){return e.push("\n"),t+(i?1:-1)}function lk(e,t){for(var i=0;i<t;i++)e.push("    ")}function mk(e,t,i,n){switch(e.type){case"root":for(var o,r=0;o=e.children[r++];)i&&"element"==o.type&&!dtd.$inlineWithA[o.tagName]&&1<r&&(kk(t,n,!0),lk(t,n)),mk(o,t,i,n);break;case"text":s=t,"pre"==(a=e).parentNode.tagName?s.push(a.data):s.push(jk[a.parentNode.tagName]?utils.html(a.data):a.data.replace(/[ ]{2}/g," &nbsp;"));break;case"element":!function(e,t,i,n){var o="";if(e.attrs){var r,o=[],a=e.attrs;for(r in a)o.push(r+(void 0!==a[r]?'="'+(ik[r]?utils.html(a[r]).replace(/["]/g,function(e){return"&quot;"}):utils.unhtml(a[r]))+'"':""));o=o.join(" ")}if(t.push("<"+e.tagName+(o?" "+o:"")+(dtd.$empty[e.tagName]?"/":"")+">"),i&&!dtd.$inlineWithA[e.tagName]&&"pre"!=e.tagName&&e.children&&e.children.length&&lk(t,n=kk(t,n,!0)),e.children&&e.children.length)for(var s,l=0;s=e.children[l++];)i&&"element"==s.type&&!dtd.$inlineWithA[s.tagName]&&1<l&&(kk(t,n),lk(t,n)),mk(s,t,i,n);dtd.$empty[e.tagName]||(i&&!dtd.$inlineWithA[e.tagName]&&"pre"!=e.tagName&&e.children&&e.children.length&&lk(t,n=kk(t,n)),t.push("</"+e.tagName+">"))}(e,t,i,n);break;case"comment":t.push("\x3c!--"+e.data+"--\x3e")}var a,s;return t}hk=UE.uNode=function(e){this.type=e.type,this.data=e.data,this.tagName=e.tagName,this.parentNode=e.parentNode,this.attrs=e.attrs||{},this.children=e.children},ik={href:1,src:1,_src:1,_href:1,cdata_data:1},jk={style:1,script:1},hk.createElement=function(e){return/[<>]/.test(e)?UE.htmlparser(e).children[0]:new hk({type:"element",children:[],tagName:e})},hk.createText=function(e,t){return new UE.uNode({type:"text",data:t?e:utils.unhtml(e||"")})},hk.prototype={toHtml:function(e){var t=[];return mk(this,t,e,0),t.join("")},innerHTML:function(e){if("element"!=this.type||dtd.$empty[this.tagName])return this;if(utils.isString(e)){if(this.children)for(var t=0;i=this.children[t++];)i.parentNode=null;this.children=[];for(var i,n=UE.htmlparser(e),t=0;i=n.children[t++];)this.children.push(i),i.parentNode=this;return this}return(n=new UE.uNode({type:"root",children:this.children})).toHtml()},innerText:function(e,t){if("element"!=this.type||dtd.$empty[this.tagName])return this;if(e){if(this.children)for(var i,n=0;i=this.children[n++];)i.parentNode=null;return this.children=[],this.appendChild(hk.createText(e,t)),this}return this.toHtml().replace(/<[^>]+>/g,"")},getData:function(){return"element"==this.type?"":this.data},firstChild:function(){return this.children?this.children[0]:null},lastChild:function(){return this.children?this.children[this.children.length-1]:null},previousSibling:function(){for(var e,t=this.parentNode,i=0;e=t.children[i];i++)if(e===this)return 0==i?null:t.children[i-1]},nextSibling:function(){for(var e,t=this.parentNode,i=0;e=t.children[i++];)if(e===this)return t.children[i]},replaceChild:function(e,t){if(this.children){e.parentNode&&e.parentNode.removeChild(e);for(var i,n=0;i=this.children[n];n++)if(i===t)return this.children.splice(n,1,e),t.parentNode=null,e.parentNode=this,e}},appendChild:function(e){if("root"==this.type||"element"==this.type&&!dtd.$empty[this.tagName]){this.children||(this.children=[]),e.parentNode&&e.parentNode.removeChild(e);for(var t,i=0;t=this.children[i];i++)if(t===e){this.children.splice(i,1);break}return this.children.push(e),e.parentNode=this,e}},insertBefore:function(e,t){if(this.children){e.parentNode&&e.parentNode.removeChild(e);for(var i,n=0;i=this.children[n];n++)if(i===t)return this.children.splice(n,0,e),e.parentNode=this,e}},insertAfter:function(e,t){if(this.children){e.parentNode&&e.parentNode.removeChild(e);for(var i,n=0;i=this.children[n];n++)if(i===t)return this.children.splice(n+1,0,e),e.parentNode=this,e}},removeChild:function(e,t){if(this.children)for(var i,n=0;i=this.children[n];n++)if(i===e){if(this.children.splice(n,1),i.parentNode=null,t&&i.children&&i.children.length)for(var o,r=0;o=i.children[r];r++)this.children.splice(n+r,0,o),o.parentNode=this;return i}},getAttr:function(e){return this.attrs&&this.attrs[e.toLowerCase()]},setAttr:function(e,t){if(e)if(this.attrs||(this.attrs={}),utils.isObject(e))for(var i in e)e[i]?this.attrs[i.toLowerCase()]=e[i]:delete this.attrs[i];else t?this.attrs[e.toLowerCase()]=t:delete this.attrs[e];else delete this.attrs},getIndex:function(){for(var e,t=this.parentNode,i=0;e=t.children[i];i++)if(e===this)return i;return-1},getNodeById:function(e){if(this.children&&this.children.length)for(var t,i=0;t=this.children[i++];)if(t=function e(t,i){if("element"==t.type&&t.getAttr("id")==i)return t;if(t.children&&t.children.length)for(var n,o=0;n=t.children[o++];)if(n=e(n,i))return n}(t,e))return t},getNodesByTagName:function(e){e=utils.trim(e).replace(/[ ]{2,}/g," ").split(" ");var n=[],o=this;return utils.each(e,function(e){if(o.children&&o.children.length)for(var t,i=0;t=o.children[i++];)!function e(t,i,n){if("element"==t.type&&t.tagName==i&&n.push(t),t.children&&t.children.length)for(var o,r=0;o=t.children[r++];)e(o,i,n)}(t,e,n)}),n},getStyle:function(e){var t=this.getAttr("style");if(!t)return"";e=new RegExp("(^|;)\\s*"+e+":([^;]+)","i"),e=t.match(e);return e&&e[0]?e[2]:""},setStyle:function(e,t){function i(e,t){var i=new RegExp("(^|;)\\s*"+e+":([^;]+;?)","gi");n=n.replace(i,"$1"),t&&(n=e+":"+utils.unhtml(t)+";"+n)}var n=(n=this.getAttr("style"))||"";if(utils.isObject(e))for(var o in e)i(o,e[o]);else i(e,t);this.setAttr("style",utils.trim(n))},traversal:function(e){return this.children&&this.children.length&&function e(t,i){if(t.children&&t.children.length)for(var n,o=0;n=t.children[o];)e(n,i),n.parentNode&&(n.children&&n.children.length&&i(n),n.parentNode&&o++);else i(t)}(this,e),this}};var htmlparser=UE.htmlparser=function(e,i){var t=/<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)-->)|(?:([^\/\s>]+)((?:\s+[\w\-:.]+(?:\s*=\s*?(?:(?:"[^"]*")|(?:'[^']*')|[^\s"'\/>]+))?)*)[\S\s]*?(\/?)>))/g,c=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,n={b:1,code:1,i:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,span:1,sub:1,img:1,sup:1,font:1,big:1,small:1,iframe:1,a:1,br:1,pre:1};e=e.replace(new RegExp(domUtils.fillChar,"g"),""),i||(e=e.replace(new RegExp("[\\r\\t\\n"+(i?"":" ")+"]*</?(\\w+)\\s*(?:[^>]*)>[\\r\\t\\n"+(i?"":" ")+"]*","g"),function(e,t){return t&&n[t.toLowerCase()]?e.replace(/(^[\n\r]+)|([\n\r]+$)/g,""):e.replace(new RegExp("^[\\r\\n"+(i?"":" ")+"]+"),"").replace(new RegExp("[\\r\\n"+(i?"":" ")+"]+$"),"")}));var u={href:1,src:1},m=UE.uNode,f={td:"tr",tr:["tbody","thead","tfoot"],tbody:"table",th:"tr",thead:"table",tfoot:"table",caption:"table",li:["ul","ol"],dt:"dl",dd:"dl",option:"select"},o={ol:"li",ul:"li"};function r(e,t){var i;o[e.tagName]?(i=m.createElement(o[e.tagName]),e.appendChild(i),i.appendChild(m.createText(t))):e.appendChild(m.createText(t))}for(var a,s,l,d,h=0,p=new m({type:"root",children:[]}),g=p;a=t.exec(e);){d=a.index;try{if(h<d&&r(g,e.slice(h,d)),a[3])dtd.$cdata[g.tagName]?r(g,a[0]):g=function e(t,i,n){var o;if(o=f[i]){for(var r,a=t;"root"!=a.type;){if(utils.isArray(o)?-1!=utils.indexOf(o,a.tagName):o==a.tagName){t=a,r=!0;break}a=a.parentNode}r||(t=e(t,utils.isArray(o)?o[0]:o))}var s=new m({parentNode:t,type:"element",tagName:i.toLowerCase(),children:dtd.$empty[i]?null:[]});if(n){for(var l,d={};l=c.exec(n);)d[l[1].toLowerCase()]=u[l[1].toLowerCase()]?l[2]||l[3]||l[4]:utils.unhtml(l[2]||l[3]||l[4]);s.attrs=d}return t.children.push(s),dtd.$empty[i]?t:s}(g,a[3].toLowerCase(),a[4]);else if(a[1]){if("root"!=g.type)if(dtd.$cdata[g.tagName]&&!dtd.$cdata[a[1]])r(g,a[0]);else{for(var b=g;"element"==g.type&&g.tagName!=a[1].toLowerCase();)if("root"==(g=g.parentNode).type)throw g=b,"break";g=g.parentNode}}else a[2]&&(s=g,l=a[2],s.children.push(new m({type:"comment",data:l,parentNode:s})))}catch(e){}h=t.lastIndex}return h<e.length&&r(g,e.slice(h)),p},filterNode=UE.filterNode=function(e,t){if(utils.isEmptyObject(t))return e;var i;(i=t["-"])&&utils.each(i.split(" "),function(e){t[e]="-"});for(var n,o=0;n=e.children[o];)(function e(i,t){switch(i.type){case"text":break;case"element":var n;if(n=t[i.tagName])if("-"===n)i.parentNode.removeChild(i);else if(utils.isFunction(n)){var o=i.parentNode,r=i.getIndex();if(n(i),i.parentNode){if(i.children)for(var a=0;m=i.children[a];)e(m,t),m.parentNode&&a++}else for(a=r;m=o.children[a];)e(m,t),m.parentNode&&a++}else{var s=n.$;if(s&&i.attrs){var l,d={};for(l in s){var c,u=i.getAttr(l);"style"==l&&utils.isArray(s[l])&&(c=[],utils.each(s[l],function(e){var t;(t=i.getStyle(e))&&c.push(e+":"+t)}),u=c.join(";")),u&&(d[l]=u)}i.attrs=d}if(i.children)for(a=0;m=i.children[a];)e(m,t),m.parentNode&&a++}else if(dtd.$cdata[i.tagName])i.parentNode.removeChild(i);else{var m,o=i.parentNode,r=i.getIndex();for(i.parentNode.removeChild(i,!0),a=r;m=o.children[a];)e(m,t),m.parentNode&&a++}break;case"comment":i.parentNode.removeChild(i)}})(n,t),n.parentNode&&o++;return e},_plugins;UE.plugin=(_plugins={},{register:function(e,t,i,n){i&&utils.isFunction(i)&&(n=i,i=null),_plugins[e]={optionName:i||e,execFn:t,afterDisabled:n}},load:function(i){utils.each(_plugins,function(e){var t=e.execFn.call(i);!1!==i.options[e.optionName]?t&&utils.each(t,function(e,t){switch(t.toLowerCase()){case"shortcutkey":i.addshortcutkey(e);break;case"bindevents":utils.each(e,function(e,t){i.addListener(t,e)});break;case"bindmultievents":utils.each(utils.isArray(e)?e:[e],function(t){var e=utils.trim(t.type).split(/\s+/);utils.each(e,function(e){i.addListener(e,t.handler)})});break;case"commands":utils.each(e,function(e,t){i.commands[t]=e});break;case"outputrule":i.addOutputRule(e);break;case"inputrule":i.addInputRule(e);break;case"defaultoptions":i.setOpt(e)}}):e.afterDisabled&&e.afterDisabled.call(i)}),utils.each(UE.plugins,function(e){e.call(i)})},run:function(e,t){e=_plugins[e];e&&e.exeFn.call(t)}});var keymap=UE.keymap={Backspace:8,Tab:9,Enter:13,Shift:16,Control:17,Alt:18,CapsLock:20,Esc:27,Spacebar:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Del:46,NumLock:144,Cmd:91,"=":187,"-":189,b:66,i:73,z:90,y:89,v:86,x:88,s:83,n:78},LocalStorage=UE.LocalStorage=(storage=window.localStorage||(container=document.createElement("div"),container.style.display="none",container.addBehavior?(container.addBehavior("#default#userdata"),{getItem:function(e){var t=null;try{document.body.appendChild(container),container.load("localStorage"),t=container.getAttribute(e),document.body.removeChild(container)}catch(e){}return t},setItem:function(e,t){document.body.appendChild(container),container.setAttribute(e,t),container.save("localStorage"),document.body.removeChild(container)},removeItem:function(e){document.body.appendChild(container),container.removeAttribute(e),container.save("localStorage"),document.body.removeChild(container)}}):null)||null,{saveLocalData:function(e,t){return!(!storage||!t||(storage.setItem(e,t),0))},getLocalData:function(e){return storage?storage.getItem(e):null},removeItem:function(e){storage&&storage.removeItem(e)}}),container,storage,ROOTKEY,block,getObj,sourceEditors,UETable,lO,cF,dF;function mO(e){return lO.getTableItemsByRange(e)}function nO(e){return lO.getUETableBySelected(e)}function oO(e,t){return lO.getDefaultValue(e,t)}function pO(e){return lO.getUETable(e)}function qO(e,t){var i,n=domUtils.getElementsByTagName(e,"td th");utils.each(n,function(e){e.removeAttribute("width")}),e.setAttribute("width",(t=oO(i=t,e),(e=i.body).offsetWidth-2*parseInt(domUtils.getComputedStyle(e,"margin-left"),10)-2*t.tableBorder-(i.options.offsetWidth||0)));var o=[];setTimeout(function(){utils.each(n,function(e){1==e.colSpan&&o.push(e.offsetWidth)}),utils.each(n,function(e,t){1==e.colSpan&&e.setAttribute("width",o[t]+"")})},0)}function rO(e){var t=mO(e).cell;if(t){e=pO(t);return e.selectedTds.length?e.selectedTds:[t]}return[]}function eF(){this.editor=null,this.resizer=null,this.cover=null,this.doc=document,this.prePos={x:0,y:0},this.startPos={x:0,y:0}}ROOTKEY="ueditor_preference",UE.Editor.prototype.setPreferences=function(e,t){var i={};utils.isString(e)?i[e]=t:i=e;e=LocalStorage.getLocalData(ROOTKEY);(e=e&&utils.str2json(e))?utils.extend(e,i):e=i,e&&LocalStorage.saveLocalData(ROOTKEY,utils.json2str(e))},UE.Editor.prototype.getPreferences=function(e){var t=LocalStorage.getLocalData(ROOTKEY);return(t=t&&utils.str2json(t))?e?t[e]:t:null},UE.Editor.prototype.removePreferences=function(e){var t=LocalStorage.getLocalData(ROOTKEY);(t=t&&utils.str2json(t))&&(t[e]=void 0,delete t[e]),t&&LocalStorage.saveLocalData(ROOTKEY,utils.json2str(t))},UE.plugins.defaultfilter=function(){var a=this;a.setOpt({allowDivTransToP:!0,disabledTableInTable:!0,rgb2Hex:!0}),a.addInputRule(function(e){var n,r=this.options.allowDivTransToP;e.traversal(function(o){if("element"==o.type)if(dtd.$cdata[o.tagName]||!a.options.autoClearEmptyNode||!dtd.$inline[o.tagName]||dtd.$empty[o.tagName]||o.attrs&&!utils.isEmptyObject(o.attrs))switch(o.tagName){case"style":case"script":o.setAttr({cdata_tag:o.tagName,cdata_data:o.innerHTML()||"",_ue_custom_node_:"true"}),o.tagName="div",o.innerHTML("");break;case"a":(n=o.getAttr("href"))&&o.setAttr("_href",n);break;case"img":if((n=o.getAttr("src"))&&/^data:/.test(n)){o.parentNode.removeChild(o);break}o.setAttr("_src",o.getAttr("src"));break;case"span":browser.webkit&&(n=o.getStyle("white-space"))&&/nowrap|normal/.test(n)&&(o.setStyle("white-space",""),a.options.autoClearEmptyNode&&utils.isEmptyObject(o.attrs)&&o.parentNode.removeChild(o,!0)),(n=o.getAttr("id"))&&/^_baidu_bookmark_/i.test(n)&&o.parentNode.removeChild(o);break;case"p":(n=o.getAttr("align"))&&(o.setAttr("align"),o.setStyle("text-align",n)),utils.each(o.children,function(e){if("element"==e.type&&"p"==e.tagName){var t=e.nextSibling();o.parentNode.insertAfter(e,o);for(var i=e;t;){var n=t.nextSibling();o.parentNode.insertAfter(t,i),i=t,t=n}return!1}}),o.firstChild()||o.innerHTML(browser.ie?"&nbsp;":"<br/>");break;case"div":if(o.getAttr("cdata_tag"))break;if((n=o.getAttr("class"))&&/^line number\d+/.test(n))break;if(!r)break;for(var e,t=UE.uNode.createElement("p");e=o.firstChild();)"text"!=e.type&&UE.dom.dtd.$block[e.tagName]?t.firstChild()?(o.parentNode.insertBefore(t,o),t=UE.uNode.createElement("p")):o.parentNode.insertBefore(e,o):t.appendChild(e);t.firstChild()&&o.parentNode.insertBefore(t,o),o.parentNode.removeChild(o);break;case"dl":o.tagName="ul";break;case"dt":case"dd":o.tagName="li";break;case"li":var i=o.getAttr("class");i&&/list\-/.test(i)||o.setAttr();i=o.getNodesByTagName("ol ul");UE.utils.each(i,function(e){o.parentNode.insertAfter(e,o)});break;case"td":case"th":case"caption":o.children&&o.children.length||o.appendChild(browser.ie11below?UE.uNode.createText(" "):UE.uNode.createElement("br"));break;case"table":a.options.disabledTableInTable&&function(e){for(;e&&"element"==e.type;){if("td"==e.tagName)return 1;e=e.parentNode}}(o)&&(o.parentNode.insertBefore(UE.uNode.createText(o.innerText()),o),o.parentNode.removeChild(o))}else o.firstChild()?"span"!=o.tagName||o.attrs&&!utils.isEmptyObject(o.attrs)||o.parentNode.removeChild(o,!0):o.parentNode.removeChild(o)})}),a.addOutputRule(function(e){var i;e.traversal(function(e){if("element"==e.type)if(!a.options.autoClearEmptyNode||!dtd.$inline[e.tagName]||dtd.$empty[e.tagName]||e.attrs&&!utils.isEmptyObject(e.attrs))switch(e.tagName){case"div":(i=e.getAttr("cdata_tag"))&&(e.tagName=i,e.appendChild(UE.uNode.createText(e.getAttr("cdata_data"))),e.setAttr({cdata_tag:"",cdata_data:"",_ue_custom_node_:""}));break;case"a":(i=e.getAttr("_href"))&&e.setAttr({href:utils.html(i),_href:""});break;case"span":var t;(i=e.getAttr("id"))&&/^_baidu_bookmark_/i.test(i)&&e.parentNode.removeChild(e),a.getOpt("rgb2Hex")&&(t=e.getAttr("style"))&&e.setAttr("style",t.replace(/rgba?\(([\d,\s]+)\)/g,function(e,t){var i=t.split(",");if(3<i.length)return"";t="#";for(var n,o=0;n=i[o++];)t+=1==(n=parseInt(n.replace(/[^\d]/gi,""),10).toString(16)).length?"0"+n:n;return t.toUpperCase()}));break;case"img":(i=e.getAttr("_src"))&&e.setAttr({src:e.getAttr("_src"),_src:""})}else e.firstChild()?"span"!=e.tagName||e.attrs&&!utils.isEmptyObject(e.attrs)||e.parentNode.removeChild(e,!0):e.parentNode.removeChild(e)})})},UE.commands.inserthtml={execCommand:function(e,t,i){var n,o,r=this;if(t&&!0!==r.fireEvent("beforeinserthtml",t)){if((o=(n=r.selection.getRange()).document.createElement("div")).style.display="inline",i||(a=UE.htmlparser(t),r.options.filterRules&&UE.filterNode(a,r.options.filterRules),r.filterInputRule(a),t=a.toHtml()),o.innerHTML=utils.trim(t),!n.collapsed){var a=n.startContainer;if(domUtils.isFillChar(a)&&n.setStartBefore(a),a=n.endContainer,domUtils.isFillChar(a)&&n.setEndAfter(a),n.txtToElmBoundary(),n.endContainer&&1==n.endContainer.nodeType&&(a=n.endContainer.childNodes[n.endOffset])&&domUtils.isBr(a)&&n.setEndAfter(a),0==n.startOffset&&(a=n.startContainer,domUtils.isBoundaryNode(a,"firstChild")&&(a=n.endContainer,n.endOffset==(3==a.nodeType?a.nodeValue:a.childNodes).length&&domUtils.isBoundaryNode(a,"lastChild")&&(r.body.innerHTML="<p>"+(browser.ie?"":"<br/>")+"</p>",n.setStart(r.body.firstChild,0).collapse(!0)))),n.collapsed||n.deleteContents(),1==n.startContainer.nodeType&&(s=n.startContainer.childNodes[n.startOffset])&&domUtils.isBlockElm(s)&&(b=s.previousSibling)&&domUtils.isBlockElm(b)){for(n.setEnd(b,b.childNodes.length).collapse();s.firstChild;)b.appendChild(s.firstChild);domUtils.remove(s)}}var s,l,d,c,u=0;n.inFillChar()&&(s=n.startContainer,domUtils.isFillChar(s)?(n.setStartBefore(s).collapse(!0),domUtils.remove(s)):domUtils.isFillChar(s,!0)&&(s.nodeValue=s.nodeValue.replace(fillCharReg,""),n.startOffset--,n.collapsed&&n.collapse(!0)));var m,f=domUtils.findParentByTagName(n.startContainer,"li",!0);if(f){for(;s=o.firstChild;){for(;s&&(3==s.nodeType||!domUtils.isBlockElm(s)||"HR"==s.tagName);)h=s.nextSibling,n.insertNode(s).collapse(),m=s,s=h;if(s)if(/^(ol|ul)$/i.test(s.tagName)){for(;s.firstChild;)m=s.firstChild,domUtils.insertAfter(f,s.firstChild),f=f.nextSibling;domUtils.remove(s)}else{var h=s.nextSibling,p=r.document.createElement("li");domUtils.insertAfter(f,p),p.appendChild(s),m=s,s=h,f=p}}f=domUtils.findParentByTagName(n.startContainer,"li",!0),domUtils.isEmptyBlock(f)&&domUtils.remove(f),m&&n.setStartAfter(m).collapse(!0).select(!0)}else{for(;s=o.firstChild;){if(u){for(var g=r.document.createElement("p");s&&(3==s.nodeType||!dtd.$block[s.tagName]);)c=s.nextSibling,g.appendChild(s),s=c;g.firstChild&&(s=g)}if(n.insertNode(s),c=s.nextSibling,!u&&s.nodeType==domUtils.NODE_ELEMENT&&domUtils.isBlockElm(s)&&(l=domUtils.findParent(s,function(e){return domUtils.isBlockElm(e)}))&&"body"!=l.tagName.toLowerCase()&&(!dtd[l.tagName][s.nodeName]||s.parentNode!==l)){if(dtd[l.tagName][s.nodeName])for(d=s.parentNode;d!==l;)d=(b=d).parentNode;else b=l;domUtils.breakParent(s,b||d);var b=s.previousSibling;domUtils.trimWhiteTextNode(b),b.childNodes.length||domUtils.remove(b),!browser.ie&&(h=s.nextSibling)&&domUtils.isBlockElm(h)&&h.lastChild&&!domUtils.isBr(h.lastChild)&&h.appendChild(r.document.createElement("br")),u=1}var h=s.nextSibling;if(!o.firstChild&&h&&domUtils.isBlockElm(h)){n.setStart(h,0).collapse(!0);break}n.setEndAfter(s).collapse()}if(s=n.startContainer,c&&domUtils.isBr(c)&&domUtils.remove(c),domUtils.isBlockElm(s)&&domUtils.isEmptyNode(s))if(c=s.nextSibling)domUtils.remove(s),1==c.nodeType&&dtd.$block[c.tagName]&&n.setStart(c,0).collapse(!0).shrinkBoundary();else try{s.innerHTML=browser.ie?domUtils.fillChar:"<br/>"}catch(e){n.setStartBefore(s),domUtils.remove(s)}try{n.select(!0)}catch(e){}}setTimeout(function(){(n=r.selection.getRange()).scrollToView(r.autoHeightEnabled,r.autoHeightEnabled?domUtils.getXY(r.iframe).y:0),r.fireEvent("afterinserthtml",t)},200)}}},UE.plugins.autotypeset=function(){this.setOpt({autotypeset:{mergeEmptyline:!0,removeClass:!0,removeEmptyline:!1,textAlign:"left",imageBlockLine:"center",pasteFilter:!1,clearFontSize:!1,clearFontFamily:!1,removeEmptyNode:!1,removeTagNames:utils.extend({div:1},dtd.$removeEmpty),indent:!1,indentValue:"2em",bdc2sb:!1,tobdc:!1}});var e,t=this,p=t.options.autotypeset,g={selectTdClass:1,pagebreak:1,anchorclass:1},b={li:1},i={div:1,p:1,blockquote:1,center:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,span:1};function v(e,t){return e&&3!=e.nodeType&&(domUtils.isBr(e)||e&&e.parentNode&&i[e.tagName.toLowerCase()]&&(!e.getAttribute("pagebreak")&&(t?!domUtils.isEmptyBlock(e):domUtils.isEmptyBlock(e,new RegExp("[\\s"+domUtils.fillChar+"]","g")))))}function y(e){e.style.cssText||(domUtils.removeAttributes(e,["style"]),"span"==e.tagName.toLowerCase()&&domUtils.hasNoAttributes(e)&&domUtils.remove(e,!0))}function n(e,t){var i,n=this;if(t){if(!p.pasteFilter)return;(i=n.document.createElement("div")).innerHTML=t.html}else i=n.document.body;for(var o,r,a=domUtils.getElementsByTagName(i,"*"),s=0;o=a[s++];)if(!0!==n.fireEvent("excludeNodeinautotype",o)){if(p.clearFontSize&&o.style.fontSize&&(domUtils.removeStyle(o,"font-size"),y(o)),p.clearFontFamily&&o.style.fontFamily&&(domUtils.removeStyle(o,"font-family"),y(o)),v(o)){if(p.mergeEmptyline)for(var l=o.nextSibling,d=domUtils.isBr(o);v(l)&&(l=(u=l).nextSibling,!d||l&&(!l||domUtils.isBr(l)));)domUtils.remove(u);if(p.removeEmptyline&&domUtils.inDoc(o,i)&&!b[o.parentNode.tagName.toLowerCase()]){if(domUtils.isBr(o)&&(l=o.nextSibling)&&!domUtils.isBr(l))continue;domUtils.remove(o);continue}}if(v(o,!0)&&"SPAN"!=o.tagName&&(p.indent&&(o.style.textIndent=p.indentValue),p.textAlign&&(o.style.textAlign=p.textAlign)),p.removeClass&&o.className&&!g[o.className.toLowerCase()]&&domUtils.removeAttributes(o,["class"]),p.imageBlockLine&&"img"==o.tagName.toLowerCase()&&!o.getAttribute("emotion"))if(t){var c=o;switch(p.imageBlockLine){case"left":case"right":case"none":for(var u,m,f=c.parentNode;dtd.$inline[f.tagName]||"A"==f.tagName;)f=f.parentNode;if("P"==(u=f).tagName&&"center"==domUtils.getStyle(u,"text-align")&&!domUtils.isBody(u)&&1==domUtils.getChildCount(u,function(e){return!domUtils.isBr(e)&&!domUtils.isWhitespace(e)}))if(m=u.previousSibling,l=u.nextSibling,m&&l&&1==m.nodeType&&1==l.nodeType&&m.tagName==l.tagName&&domUtils.isBlockElm(m)){for(m.appendChild(u.firstChild);l.firstChild;)m.appendChild(l.firstChild);domUtils.remove(u),domUtils.remove(l)}else domUtils.setStyle(u,"text-align","");domUtils.setStyle(c,"float",p.imageBlockLine);break;case"center":if("center"!=n.queryCommandValue("imagefloat")){for(f=c.parentNode,domUtils.setStyle(c,"float","none"),u=c;f&&1==domUtils.getChildCount(f,function(e){return!domUtils.isBr(e)&&!domUtils.isWhitespace(e)})&&(dtd.$inline[f.tagName]||"A"==f.tagName);)f=(u=f).parentNode;var h=n.document.createElement("p");domUtils.setAttributes(h,{style:"text-align:center"}),u.parentNode.insertBefore(h,u),h.appendChild(u),domUtils.setStyle(u,"float","")}}}else n.selection.getRange().selectNode(o).select(),n.execCommand("imagefloat",p.imageBlockLine);p.removeEmptyNode&&p.removeTagNames[o.tagName.toLowerCase()]&&domUtils.hasNoAttributes(o)&&domUtils.isEmptyBlock(o)&&domUtils.remove(o)}p.tobdc&&((r=UE.htmlparser(i.innerHTML)).traversal(function(e){"text"==e.type&&(e.data=function(e){e=utils.html(e);for(var t="",i=0;i<e.length;i++)32==e.charCodeAt(i)?t+=String.fromCharCode(12288):e.charCodeAt(i)<127?t+=String.fromCharCode(e.charCodeAt(i)+65248):t+=e.charAt(i);return t}(e.data))}),i.innerHTML=r.toHtml()),p.bdc2sb&&((r=UE.htmlparser(i.innerHTML)).traversal(function(e){"text"==e.type&&(e.data=function(e){for(var t="",i=0;i<e.length;i++){var n=e.charCodeAt(i);t+=65281<=n&&n<=65373?String.fromCharCode(e.charCodeAt(i)-65248):12288==n?String.fromCharCode(e.charCodeAt(i)-12288+32):e.charAt(i)}return t}(e.data))}),i.innerHTML=r.toHtml()),t&&(t.html=i.innerHTML)}p&&(e=t.getPreferences("autotypeset"),utils.extend(t.options.autotypeset,e),p.pasteFilter&&t.addListener("beforepaste",n),t.commands.autotypeset={execCommand:function(){t.removeListener("beforepaste",n),p.pasteFilter&&t.addListener("beforepaste",n),n.call(t)}})},UE.plugin.register("autosubmit",function(){return{shortcutkey:{autosubmit:"ctrl+13"},commands:{autosubmit:{execCommand:function(){var e=domUtils.findParentByTagName(this.iframe,"form",!1);e&&!1!==this.fireEvent("beforesubmit")&&(this.sync(),e.submit())}}}}}),UE.plugin.register("background",function(){var i,l=this,n="editor_background",o=new RegExp("body[\\s]*\\{(.+)\\}","i");function r(e){var n={},e=e.split(";");return utils.each(e,function(e){var t=e.indexOf(":"),i=utils.trim(e.substr(0,t)).toLowerCase();i&&(n[i]=utils.trim(e.substr(t+1)||""))}),n}function a(e){if(e){var t,i=[];for(t in e)e.hasOwnProperty(t)&&i.push(t+":"+e[t]+"; ");utils.cssRule(n,i.length?"body{"+i.join("")+"}":"",l.document)}else utils.cssRule(n,"",l.document)}var e=l.hasContents;return l.hasContents=function(){return!!l.queryCommandValue("background")||e.apply(l,arguments)},{bindEvents:{getAllHtml:function(e,t){var i,n=this.body,o=domUtils.getComputedStyle(n,"background-image"),r=0<o.indexOf(l.options.imagePath)?o.substring(o.indexOf(l.options.imagePath),o.length-1).replace(/"|\(|\)/gi,""):"none"!=o?o.replace(/url\("?|"?\)/gi,""):"",a='<style type="text/css">body{',s={"background-color":domUtils.getComputedStyle(n,"background-color")||"#ffffff","background-image":r?"url("+r+")":"","background-repeat":domUtils.getComputedStyle(n,"background-repeat")||"","background-position":browser.ie?domUtils.getComputedStyle(n,"background-position-x")+" "+domUtils.getComputedStyle(n,"background-position-y"):domUtils.getComputedStyle(n,"background-position"),height:domUtils.getComputedStyle(n,"height")};for(i in s)s.hasOwnProperty(i)&&(a+=i+":"+s[i]+"; ");t.push(a+="}</style> ")},aftersetcontent:function(){0==i&&a()}},inputRule:function(e){i=!1,utils.each(e.getNodesByTagName("p"),function(e){var t=e.getAttr("data-background");t&&(i=!0,a(r(t)),e.parentNode.removeChild(e))})},outputRule:function(e){var t=(utils.cssRule(n,this.document)||"").replace(/[\n\r]+/g,"").match(o);t&&e.appendChild(UE.uNode.createElement('<p style="display:none;" data-background="'+utils.trim(t[1].replace(/"/g,"").replace(/[\s]+/g," "))+'"><br/></p>'))},commands:{background:{execCommand:function(e,t){a(t)},queryCommandValue:function(){var e=(utils.cssRule(n,this.document)||"").replace(/[\n\r]+/g,"").match(o);return e?r(e[1]):null},notNeedUndo:!0}}}}),UE.commands.imagefloat={execCommand:function(e,t){var i=this,n=i.selection.getRange();if(!n.collapsed){var o=n.getClosedNode();if(o&&"IMG"==o.tagName)switch(t){case"left":case"right":case"none":for(var r,a,s,l=o.parentNode;dtd.$inline[l.tagName]||"A"==l.tagName;)l=l.parentNode;if("P"==(r=l).tagName&&"center"==domUtils.getStyle(r,"text-align")){if(!domUtils.isBody(r)&&1==domUtils.getChildCount(r,function(e){return!domUtils.isBr(e)&&!domUtils.isWhitespace(e)}))if(a=r.previousSibling,s=r.nextSibling,a&&s&&1==a.nodeType&&1==s.nodeType&&a.tagName==s.tagName&&domUtils.isBlockElm(a)){for(a.appendChild(r.firstChild);s.firstChild;)a.appendChild(s.firstChild);domUtils.remove(r),domUtils.remove(s)}else domUtils.setStyle(r,"text-align","");n.selectNode(o).select()}domUtils.setStyle(o,"float","none"==t?"":t),"none"==t&&domUtils.removeAttributes(o,"align");break;case"center":if("center"!=i.queryCommandValue("imagefloat")){for(l=o.parentNode,domUtils.setStyle(o,"float",""),domUtils.removeAttributes(o,"align"),r=o;l&&1==domUtils.getChildCount(l,function(e){return!domUtils.isBr(e)&&!domUtils.isWhitespace(e)})&&(dtd.$inline[l.tagName]||"A"==l.tagName);)l=(r=l).parentNode;n.setStartBefore(r).setCursor(!1),(l=i.document.createElement("div")).appendChild(r),domUtils.setStyle(r,"float",""),i.execCommand("insertHtml",'<p id="_img_parent_tmp" style="text-align:center">'+l.innerHTML+"</p>"),(r=i.document.getElementById("_img_parent_tmp")).removeAttribute("id"),r=r.firstChild,n.selectNode(r).select(),(s=r.parentNode.nextSibling)&&domUtils.isEmptyNode(s)&&domUtils.remove(s)}}}},queryCommandValue:function(){var e,t=this.selection.getRange();return!t.collapsed&&(e=t.getClosedNode())&&1==e.nodeType&&"IMG"==e.tagName?{left:1,right:1,center:1}[t="none"==(t=domUtils.getComputedStyle(e,"float")||e.getAttribute("align"))?"center"==domUtils.getComputedStyle(e.parentNode,"text-align")?"center":t:t]?t:"none":"none"},queryCommandState:function(){var e,t=this.selection.getRange();return!t.collapsed&&(e=t.getClosedNode())&&1==e.nodeType&&"IMG"==e.tagName?0:-1}},UE.commands.insertimage={execCommand:function(e,t){if((t=utils.isArray(t)?t:[t]).length){var i=this,n=i.selection.getRange(),o=n.getClosedNode();if(!0!==i.fireEvent("beforeinsertimage",t)){if(!o||!/img/i.test(o.tagName)||"edui-faked-video"==o.className&&-1==o.className.indexOf("edui-upload-video")||o.getAttribute("word_img")){var r=[],a="",s=t[0];if(1==t.length)a='<img src="'+s.src+'" '+(s._src?' _src="'+s._src+'" ':"")+(s.width?'width="'+s.width+'" ':"")+(s.height?' height="'+s.height+'" ':"")+("left"==s.floatStyle||"right"==s.floatStyle?' style="float:'+s.floatStyle+';"':"")+(s.title&&""!=s.title?' title="'+s.title+'"':"")+(s.border&&"0"!=s.border?' border="'+s.border+'"':"")+(s.alt&&""!=s.alt?' alt="'+s.alt+'"':"")+(s.hspace&&"0"!=s.hspace?' hspace = "'+s.hspace+'"':"")+(s.vspace&&"0"!=s.vspace?' vspace = "'+s.vspace+'"':"")+"/>","center"==s.floatStyle&&(a='<p style="text-align: center">'+a+"</p>"),r.push(a);else for(var l=0;s=t[l++];)a="<p "+("center"==s.floatStyle?'style="text-align: center" ':"")+'><img src="'+s.src+'" '+(s.width?'width="'+s.width+'" ':"")+(s._src?' _src="'+s._src+'" ':"")+(s.height?' height="'+s.height+'" ':"")+' style="'+(s.floatStyle&&"center"!=s.floatStyle?"float:"+s.floatStyle+";":"")+(s.border||"")+'" '+(s.title?' title="'+s.title+'"':"")+" /></p>",r.push(a);i.execCommand("insertHtml",r.join(""))}else{var d=t.shift(),c=d.floatStyle;delete d.floatStyle,domUtils.setAttributes(o,d),i.execCommand("imagefloat",c),0<t.length&&(n.setStartAfter(o).setCursor(!1,!0),i.execCommand("insertimage",t))}i.fireEvent("afterinsertimage",t)}}}},UE.plugins.justify=function(){var c=domUtils.isBlockElm,t={left:1,right:1,center:1,justify:1};UE.commands.justify={execCommand:function(e,t){var i,n=this.selection.getRange();return n.collapsed&&(i=this.document.createTextNode("p"),n.insertNode(i)),function(e,t){function i(e){return 1==e.nodeType?"br"!=e.tagName.toLowerCase()&&!domUtils.isBookmarkNode(e):!domUtils.isWhitespace(e)}var n=e.createBookmark();e.enlarge(!0);for(var o,r=e.createBookmark(),a=domUtils.getNextDomNode(r.start,!1,i),s=e.cloneRange();a&&!(domUtils.getPosition(a,r.end)&domUtils.POSITION_FOLLOWING);)if(3!=a.nodeType&&c(a))a=domUtils.getNextDomNode(a,!0,i);else{for(s.setStartBefore(a);a&&a!==r.end&&!c(a);)o=a,a=domUtils.getNextDomNode(a,!1,null,function(e){return!c(e)});s.setEndAfter(o);var l,d=s.getCommonAncestor(),a=!domUtils.isBody(d)&&c(d)?(domUtils.setStyles(d,utils.isString(t)?{"text-align":t}:t),d):(l=e.document.createElement("p"),domUtils.setStyles(l,utils.isString(t)?{"text-align":t}:t),d=s.extractContents(),l.appendChild(d),s.insertNode(l),l);a=domUtils.getNextDomNode(a,!1,i)}e.moveToBookmark(r).moveToBookmark(n)}(n,t),i&&(n.setStartBefore(i).collapse(!0),domUtils.remove(i)),n.select(),!0},queryCommandValue:function(){var e=this.selection.getStart(),e=domUtils.getComputedStyle(e,"text-align");return t[e]?e:"left"},queryCommandState:function(){var e=this.selection.getStart();return e&&domUtils.findParentByTagName(e,["td","th","caption"],!0)?-1:0}}},UE.plugins.font=function(){var e,t={forecolor:"color",backcolor:"background-color",fontsize:"font-size",fontfamily:"font-family",underline:"text-decoration",strikethrough:"text-decoration",fontborder:"border"},d={underline:1,strikethrough:1,fontborder:1},l={forecolor:"color",backcolor:"background-color",fontsize:"font-size",fontfamily:"font-family"};function c(e,n,o){var t,i,r,a=e.collapsed,s=e.createBookmark();if(a)for(t=s.start.parentNode;dtd.$inline[t.tagName];)t=t.parentNode;else t=domUtils.getCommonAncestor(s.start,s.end);utils.each(domUtils.getElementsByTagName(t,"span"),function(e){if(e.parentNode&&!domUtils.isBookmarkNode(e))if(/\s*border\s*:\s*none;?\s*/i.test(e.style.cssText))/^\s*border\s*:\s*none;?\s*$/.test(e.style.cssText)?domUtils.remove(e,!0):domUtils.removeStyle(e,"border");else{if(/border/i.test(e.style.cssText)&&"SPAN"==e.parentNode.tagName&&/border/i.test(e.parentNode.style.cssText)&&(e.style.cssText=e.style.cssText.replace(/border[^:]*:[^;]+;?/gi,"")),"fontborder"!=n||"none"!=o)for(var t=e.nextSibling;t&&1==t.nodeType&&"SPAN"==t.tagName;)if(domUtils.isBookmarkNode(t)&&"fontborder"==n)e.appendChild(t),t=e.nextSibling;else{if(t.style.cssText==e.style.cssText&&(domUtils.moveChild(t,e),domUtils.remove(t)),e.nextSibling===t)break;t=e.nextSibling}var i;(function(e){for(var t;(t=e.parentNode)&&"SPAN"==t.tagName&&1==domUtils.getChildCount(t,function(e){return!domUtils.isBookmarkNode(e)&&!domUtils.isBr(e)});)t.style.cssText+=e.style.cssText,domUtils.remove(e,!0),e=t})(e),browser.ie&&8<browser.version&&(i=domUtils.findParent(e,function(e){return"SPAN"==e.tagName&&/background-color/.test(e.style.cssText)}))&&!/background-color/.test(e.style.cssText)&&(e.style.backgroundColor=i.style.backgroundColor)}}),e.moveToBookmark(s),a=e,r=o,!l[i=n]||(a.adjustmentBoundary(),a.collapsed||1!=a.startContainer.nodeType)||(s=a.startContainer.childNodes[a.startOffset])&&domUtils.isTagNode(s,"span")&&(e=a.createBookmark(),utils.each(domUtils.getElementsByTagName(s,"span"),function(e){e.parentNode&&!domUtils.isBookmarkNode(e)&&("backcolor"==i&&domUtils.getComputedStyle(e,"background-color").toLowerCase()===r||(domUtils.removeStyle(e,l[i]),0==e.style.cssText.replace(/^\s+$/,"").length&&domUtils.remove(e,!0)))}),a.moveToBookmark(e))}for(e in this.setOpt({fontfamily:[{name:"songti",val:"宋体,SimSun"},{name:"yahei",val:"微软雅黑,Microsoft YaHei"},{name:"kaiti",val:"楷体,楷体_GB2312, SimKai"},{name:"heiti",val:"黑体, SimHei"},{name:"lishu",val:"隶书, SimLi"},{name:"andaleMono",val:"andale mono"},{name:"arial",val:"arial, helvetica,sans-serif"},{name:"arialBlack",val:"arial black,avant garde"},{name:"comicSansMs",val:"comic sans ms"},{name:"impact",val:"impact,chicago"},{name:"timesNewRoman",val:"times new roman"}],fontsize:[10,11,12,14,16,18,20,24,36]}),this.addInputRule(function(e){utils.each(e.getNodesByTagName("u s del font strike"),function(e){if("font"==e.tagName){var t,i=[];for(t in e.attrs)switch(t){case"size":i.push("font-size:"+({1:"10",2:"12",3:"16",4:"18",5:"24",6:"32",7:"48"}[e.attrs[t]]||e.attrs[t])+"px");break;case"color":i.push("color:"+e.attrs[t]);break;case"face":i.push("font-family:"+e.attrs[t]);break;case"style":i.push(e.attrs[t])}e.attrs={style:i.join(";")}}else{var n="u"==e.tagName?"underline":"line-through";e.attrs={style:(e.getAttr("style")||"")+"text-decoration:"+n+";"}}e.tagName="span"})}),t)!function(s,l){UE.commands[s]={execCommand:function(e,t){t=t||(this.queryCommandState(e)?"none":"underline"==e?"underline":"fontborder"==e?"1px solid #000":"line-through");var i=this,n=this.selection.getRange();if("default"==t)n.collapsed&&(r=i.document.createTextNode("font"),n.insertNode(r).select()),i.execCommand("removeFormat","span,a",l),r&&(n.setStartBefore(r).collapse(!0),domUtils.remove(r)),c(n,e,t),n.select();else if(n.collapsed){var o=domUtils.findParentByTagName(n.startContainer,"span",!0),r=i.document.createTextNode("font");if(!o||o.children.length||o[browser.ie?"innerText":"textContent"].replace(fillCharReg,"").length){if(n.insertNode(r),n.selectNode(r).select(),o=n.document.createElement("span"),d[s]){if(domUtils.findParentByTagName(r,"a",!0))return n.setStartBefore(r).setCursor(),void domUtils.remove(r);i.execCommand("removeFormat","span,a",l)}if(o.style.cssText=l+":"+t,r.parentNode.insertBefore(o,r),!browser.ie||browser.ie&&9==browser.version)for(var a=o.parentNode;!domUtils.isBlockElm(a);)"SPAN"==a.tagName&&(o.style.cssText=a.style.cssText+";"+o.style.cssText),a=a.parentNode;opera?setTimeout(function(){n.setStart(o,0).collapse(!0),c(n,e,t),n.select()}):(n.setStart(o,0).collapse(!0),c(n,e,t),n.select())}else n.insertNode(r),d[s]&&(n.selectNode(r).select(),i.execCommand("removeFormat","span,a",l,null),o=domUtils.findParentByTagName(r,"span",!0),n.setStartBefore(r)),o&&(o.style.cssText+=";"+l+":"+t),n.collapse(!0).select();domUtils.remove(r)}else d[s]&&i.queryCommandValue(s)&&i.execCommand("removeFormat","span,a",l),(n=i.selection.getRange()).applyInlineStyle("span",{style:l+":"+t}),c(n,e,t),n.select();return!0},queryCommandValue:function(e){var t=this.selection.getStart();if("underline"==e||"strikethrough"==e){for(var i,n=t;n&&!domUtils.isBlockElm(n)&&!domUtils.isBody(n);){if(1==n.nodeType&&"none"!=(i=domUtils.getComputedStyle(n,l)))return i;n=n.parentNode}return"none"}if("fontborder"==e){for(var o,r=t;r&&dtd.$inline[r.tagName];){if((o=domUtils.getComputedStyle(r,"border"))&&/1px/.test(o)&&/solid/.test(o))return o;r=r.parentNode}return""}if("FontSize"!=e)return domUtils.getComputedStyle(t,l);t=domUtils.getComputedStyle(t,l);return(r=/^([\d\.]+)(\w+)$/.exec(t))?Math.floor(r[1])+r[2]:t},queryCommandState:function(e){if(!d[e])return 0;var t=this.queryCommandValue(e);return"fontborder"==e?/1px/.test(t)&&/solid/.test(t):("underline"==e?/underline/:/line\-through/).test(t)}}}(e,t[e])},UE.plugins.link=function(){function a(e){var t=e.startContainer,i=e.endContainer;(t=domUtils.findParentByTagName(t,"a",!0))&&e.setStartBefore(t),(i=domUtils.findParentByTagName(i,"a",!0))&&e.setEndAfter(i)}UE.commands.unlink={execCommand:function(){var e,t=this.selection.getRange();t.collapsed&&!domUtils.findParentByTagName(t.startContainer,"a",!0)||(e=t.createBookmark(),a(t),t.removeInlineStyle("a").moveToBookmark(e).select())},queryCommandState:function(){return!this.highlight&&this.queryCommandValue("link")?0:-1}},UE.commands.link={execCommand:function(e,t){var i;t._href&&(t._href=utils.unhtml(t._href,/[<">]/g)),t.href&&(t.href=utils.unhtml(t.href,/[<">]/g)),t.textValue&&(t.textValue=utils.unhtml(t.textValue,/[<">]/g)),function(e,t,i){var n=e.cloneRange(),o=i.queryCommandValue("link");a(e=e.adjustmentBoundary());var r=e.startContainer;1==r.nodeType&&o&&(r=r.childNodes[e.startOffset])&&1==r.nodeType&&"A"==r.tagName&&/^(?:https?|ftp|file)\s*:\s*\/\//.test(r[browser.ie?"innerText":"textContent"])&&(r[browser.ie?"innerText":"textContent"]=utils.html(t.textValue||t.href)),n.collapsed&&!o||(e.removeInlineStyle("a"),n=e.cloneRange()),n.collapsed?(i=e.document.createElement("a"),o="",t.textValue?(o=utils.html(t.textValue),delete t.textValue):o=utils.html(t.href),domUtils.setAttributes(i,t),(r=domUtils.findParentByTagName(n.startContainer,"a",!0))&&domUtils.isInNodeEndBoundary(n,r)&&e.setStartAfter(r).collapse(!0),i[browser.ie?"innerText":"textContent"]=o,e.insertNode(i).selectNode(i)):e.applyInlineStyle("a",t)}(i=this.selection.getRange(),t,this),i.collapse().select(!0)},queryCommandValue:function(){var e,t=this.selection.getRange();if(!t.collapsed){t.shrinkBoundary();var i=3!=t.startContainer.nodeType&&t.startContainer.childNodes[t.startOffset]?t.startContainer.childNodes[t.startOffset]:t.startContainer,n=3==t.endContainer.nodeType||0==t.endOffset?t.endContainer:t.endContainer.childNodes[t.endOffset-1],o=t.getCommonAncestor();if(!(e=domUtils.findParentByTagName(o,"a",!0))&&1==o.nodeType)for(var r,a,s,l=o.getElementsByTagName("a"),d=0;s=l[d++];)if(r=domUtils.getPosition(s,i),a=domUtils.getPosition(s,n),(r&domUtils.POSITION_FOLLOWING||r&domUtils.POSITION_CONTAINS)&&(a&domUtils.POSITION_PRECEDING||a&domUtils.POSITION_CONTAINS)){e=s;break}return e}if((e=1==(e=t.startContainer).nodeType?e:e.parentNode)&&(e=domUtils.findParentByTagName(e,"a",!0))&&!domUtils.isInNodeEndBoundary(t,e))return e},queryCommandState:function(){var e=this.selection.getRange().getClosedNode();return!e||"edui-faked-video"!=e.className&&-1==e.className.indexOf("edui-upload-video")?0:-1}}},UE.plugins.insertframe=function(){var e=this;e.addListener("selectionchange",function(){e._iframe&&delete e._iframe})},UE.commands.scrawl={queryCommandState:function(){return browser.ie&&browser.version<=8?-1:0}},UE.plugins.removeformat=function(){this.setOpt({removeFormatTags:"b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var",removeFormatAttributes:"class,style,lang,width,height,align,hspace,valign"}),this.commands.removeformat={execCommand:function(e,t,s,i,l){function d(e){return 1==e.nodeType}var c,u,m=new RegExp("^(?:"+(t||this.options.removeFormatTags).replace(/,/g,"|")+")$","i"),f=s?[]:(i||this.options.removeFormatAttributes).split(","),i=new dom.Range(this.document);function h(e){if(3!=e.nodeType&&"span"==e.tagName.toLowerCase()){if(browser.ie){var t=e.attributes;if(t.length){for(var i=0,n=t.length;i<n;i++)if(t[i].specified)return;return 1}}return!e.attributes.length}}(function(e){var t=e.createBookmark();for(e.collapsed&&e.enlarge(!0),l||((o=domUtils.findParentByTagName(e.startContainer,"a",!0))&&e.setStartBefore(o),(o=domUtils.findParentByTagName(e.endContainer,"a",!0))&&e.setEndAfter(o)),a=(c=e.createBookmark()).start;(u=a.parentNode)&&!domUtils.isBlockElm(u);)domUtils.breakParent(a,u),domUtils.clearEmptySibling(a);if(c.end){for(a=c.end;(u=a.parentNode)&&!domUtils.isBlockElm(u);)domUtils.breakParent(a,u),domUtils.clearEmptySibling(a);for(var i,n=domUtils.getNextDomNode(c.start,!1,d);n&&n!=c.end;)i=domUtils.getNextDomNode(n,!0,d),dtd.$empty[n.tagName.toLowerCase()]||domUtils.isBookmarkNode(n)||(m.test(n.tagName)?s?(domUtils.removeStyle(n,s),h(n)&&"text-decoration"!=s&&domUtils.remove(n,!0)):domUtils.remove(n,!0):dtd.$tableContent[n.tagName]||dtd.$list[n.tagName]||(domUtils.removeAttributes(n,f),h(n)&&domUtils.remove(n,!0))),n=i}var o=c.start.parentNode;!domUtils.isBlockElm(o)||dtd.$tableContent[o.tagName]||dtd.$list[o.tagName]||domUtils.removeAttributes(o,f),o=c.end.parentNode,c.end&&domUtils.isBlockElm(o)&&!dtd.$tableContent[o.tagName]&&!dtd.$list[o.tagName]&&domUtils.removeAttributes(o,f),e.moveToBookmark(c).moveToBookmark(t);for(var r,a=e.startContainer,t=e.collapsed;1==a.nodeType&&domUtils.isEmptyNode(a)&&dtd.$removeEmpty[a.tagName];)r=a.parentNode,e.setStartBefore(a),e.startContainer===e.endContainer&&e.endOffset--,domUtils.remove(a),a=r;if(!t)for(a=e.endContainer;1==a.nodeType&&domUtils.isEmptyNode(a)&&dtd.$removeEmpty[a.tagName];)r=a.parentNode,e.setEndBefore(a),domUtils.remove(a),a=r})(i=this.selection.getRange()),i.select()}}},UE.plugins.blockquote=function(){function v(e){return domUtils.filterNodeList(e.selection.getStartElementPath(),"blockquote")}this.commands.blockquote={execCommand:function(e,t){var i=this.selection.getRange(),n=v(this),o=dtd.blockquote,r=i.createBookmark();if(n){var a=i.startContainer,s=domUtils.isBlockElm(a)?a:domUtils.findParent(a,function(e){return domUtils.isBlockElm(e)}),a=i.endContainer,l=domUtils.isBlockElm(a)?a:domUtils.findParent(a,function(e){return domUtils.isBlockElm(e)}),s=domUtils.findParentByTagName(s,"li",!0)||s,l=domUtils.findParentByTagName(l,"li",!0)||l;"LI"==s.tagName||"TD"==s.tagName||s===n||domUtils.isBody(s)?domUtils.remove(n,!0):domUtils.breakParent(s,n),s!==l&&(n=domUtils.findParentByTagName(l,"blockquote"))&&("LI"==l.tagName||"TD"==l.tagName||domUtils.isBody(l)?n.parentNode&&domUtils.remove(n,!0):domUtils.breakParent(l,n));for(var d,c=domUtils.getElementsByTagName(this.document,"blockquote"),u=0;d=c[u++];)d.childNodes.length?domUtils.getPosition(d,s)&domUtils.POSITION_FOLLOWING&&domUtils.getPosition(d,l)&domUtils.POSITION_PRECEDING&&domUtils.remove(d,!0):domUtils.remove(d)}else{for(var m=i.cloneRange(),f=1==m.startContainer.nodeType?m.startContainer:m.startContainer.parentNode,h=f,p=1;;){if(domUtils.isBody(f)){h!==f?i.collapsed?(m.selectNode(h),p=0):m.setStartBefore(h):m.setStart(f,0);break}if(!o[f.tagName]){i.collapsed?m.selectNode(h):m.setStartBefore(h);break}f=(h=f).parentNode}if(p)for(h=f=1==m.endContainer.nodeType?m.endContainer:m.endContainer.parentNode;;){if(domUtils.isBody(f)){h!==f?m.setEndAfter(h):m.setEnd(f,f.childNodes.length);break}if(!o[f.tagName]){m.setEndAfter(h);break}f=(h=f).parentNode}f=i.document.createElement("blockquote"),domUtils.setAttributes(f,t),f.appendChild(m.extractContents()),m.insertNode(f);for(var g,b=domUtils.getElementsByTagName(f,"blockquote"),u=0;g=b[u++];)g.parentNode&&domUtils.remove(g,!0)}i.moveToBookmark(r).select()},queryCommandState:function(){return v(this)?1:0}}},UE.commands.touppercase=UE.commands.tolowercase={execCommand:function(e){var t=this.selection.getRange();if(t.collapsed)return t;function i(e){return!domUtils.isBr(e)&&!domUtils.isWhitespace(e)}for(var n=t.createBookmark(),o=n.end,r=domUtils.getNextDomNode(n.start,!1,i);r&&domUtils.getPosition(r,o)&domUtils.POSITION_PRECEDING&&(3==r.nodeType&&(r.nodeValue=r.nodeValue["touppercase"==e?"toUpperCase":"toLowerCase"]()),(r=domUtils.getNextDomNode(r,!0,i))!==o););t.moveToBookmark(n).select()}},UE.commands.indent={execCommand:function(){var e=this.queryCommandState("indent")?"0em":this.options.indentValue||"2em";this.execCommand("Paragraph","p",{style:"text-indent:"+e})},queryCommandState:function(){var e=domUtils.filterNodeList(this.selection.getStartElementPath(),"p h1 h2 h3 h4 h5 h6");return e&&e.style.textIndent&&parseInt(e.style.textIndent)?1:0}},UE.commands.print={execCommand:function(){this.window.print()},notNeedUndo:1},UE.commands.preview={execCommand:function(){var e=window.open("","_blank","").document;e.open(),e.write('<!DOCTYPE html><html><head><meta charset="utf-8"/><script src="'+this.options.UEDITOR_HOME_URL+"ueditor.parse.js\"><\/script><script>setTimeout(function(){uParse('div',{rootPath: '"+this.options.UEDITOR_HOME_URL+"'})},300)<\/script></head><body><div>"+this.getContent(null,null,!0)+"</div></body></html>"),e.close()},notNeedUndo:1},UE.plugins.selectall=function(){this.commands.selectall={execCommand:function(){var e=this.body,t=this.selection.getRange();t.selectNodeContents(e),domUtils.isEmptyBlock(e)&&(browser.opera&&e.firstChild&&1==e.firstChild.nodeType&&t.setStartAtFirst(e.firstChild),t.collapse(!0)),t.select(!0)},notNeedUndo:1},this.addshortcutkey({selectAll:"ctrl+65"})},UE.plugins.paragraph=function(){var m=domUtils.isBlockElm,f=["TD","LI","PRE"];this.setOpt("paragraph",{p:"",h1:"",h2:"",h3:"",h4:"",h5:"",h6:""}),this.commands.paragraph={execCommand:function(e,t,i,n){var o,r;(s=this.selection.getRange()).collapsed&&(o=this.document.createTextNode("p"),s.insertNode(o),browser.ie&&((r=o.previousSibling)&&domUtils.isWhitespace(r)&&domUtils.remove(r),(r=o.nextSibling)&&domUtils.isWhitespace(r)&&domUtils.remove(r)));var a,s=function(e,t,i,n){function o(e){return 1==e.nodeType?"br"!=e.tagName.toLowerCase()&&!domUtils.isBookmarkNode(e):!domUtils.isWhitespace(e)}var r,a=e.createBookmark();e.enlarge(!0);for(var s,l=e.createBookmark(),d=domUtils.getNextDomNode(l.start,!1,o),c=e.cloneRange();d&&!(domUtils.getPosition(d,l.end)&domUtils.POSITION_FOLLOWING);)if(3!=d.nodeType&&m(d))d=domUtils.getNextDomNode(d,!0,o);else{for(c.setStartBefore(d);d&&d!==l.end&&!m(d);)s=d,d=domUtils.getNextDomNode(d,!1,null,function(e){return!m(e)});c.setEndAfter(s),r=e.document.createElement(t),i&&(domUtils.setAttributes(r,i),n&&"customstyle"==n&&i.style&&(r.style.cssText=i.style)),r.appendChild(c.extractContents()),domUtils.isEmptyNode(r)&&domUtils.fillChar(e.document,r),c.insertNode(r);var u=r.parentNode;m(u)&&!domUtils.isBody(r.parentNode)&&-1==utils.indexOf(f,u.tagName)&&(n&&"customstyle"==n||(u.getAttribute("dir")&&r.setAttribute("dir",u.getAttribute("dir")),u.style.cssText&&(r.style.cssText=u.style.cssText+";"+r.style.cssText),u.style.textAlign&&!r.style.textAlign&&(r.style.textAlign=u.style.textAlign),u.style.textIndent&&!r.style.textIndent&&(r.style.textIndent=u.style.textIndent),u.style.padding&&!r.style.padding&&(r.style.padding=u.style.padding)),i&&/h\d/i.test(u.tagName)&&!/h\d/i.test(r.tagName)?(domUtils.setAttributes(u,i),n&&"customstyle"==n&&i.style&&(u.style.cssText=i.style),domUtils.remove(r.parentNode,!0),r=u):domUtils.remove(r.parentNode,!0)),d=-1!=utils.indexOf(f,u.tagName)?u:r,d=domUtils.getNextDomNode(d,!1,o)}return e.moveToBookmark(l).moveToBookmark(a)}(s,t,i,n);return o&&(s.setStartBefore(o).collapse(!0),pN=o.parentNode,domUtils.remove(o),domUtils.isBlockElm(pN)&&domUtils.isEmptyNode(pN)&&domUtils.fillNode(this.document,pN)),browser.gecko&&s.collapsed&&1==s.startContainer.nodeType&&(a=s.startContainer.childNodes[s.startOffset])&&1==a.nodeType&&a.tagName.toLowerCase()==t&&s.setStart(a,0).collapse(!0),s.select(),!0},queryCommandValue:function(){var e=domUtils.filterNodeList(this.selection.getStartElementPath(),"p h1 h2 h3 h4 h5 h6");return e?e.tagName.toLowerCase():""}}},block=domUtils.isBlockElm,getObj=function(e){return domUtils.filterNodeList(e.selection.getStartElementPath(),function(e){return e&&1==e.nodeType&&e.getAttribute("dir")})},UE.commands.directionality={execCommand:function(e,t){var i,n=this.selection.getRange();return n.collapsed&&(i=this.document.createTextNode("d"),n.insertNode(i)),function(e,t,i){function n(e){return 1==e.nodeType?!domUtils.isBookmarkNode(e):!domUtils.isWhitespace(e)}var t=getObj(t);if(t&&e.collapsed)return t.setAttribute("dir",i);t=e.createBookmark(),e.enlarge(!0);for(var o,r=e.createBookmark(),a=domUtils.getNextDomNode(r.start,!1,n),s=e.cloneRange();a&&!(domUtils.getPosition(a,r.end)&domUtils.POSITION_FOLLOWING);)if(3!=a.nodeType&&block(a))a=domUtils.getNextDomNode(a,!0,n);else{for(s.setStartBefore(a);a&&a!==r.end&&!block(a);)o=a,a=domUtils.getNextDomNode(a,!1,null,function(e){return!block(e)});s.setEndAfter(o);var l,d=s.getCommonAncestor(),a=!domUtils.isBody(d)&&block(d)?(d.setAttribute("dir",i),d):((l=e.document.createElement("p")).setAttribute("dir",i),d=s.extractContents(),l.appendChild(d),s.insertNode(l),l);a=domUtils.getNextDomNode(a,!1,n)}e.moveToBookmark(r).moveToBookmark(t)}(n,this,t),i&&(n.setStartBefore(i).collapse(!0),domUtils.remove(i)),n.select(),!0},queryCommandValue:function(){var e=getObj(this);return e?e.getAttribute("dir"):"ltr"}},UE.plugins.horizontal=function(){this.commands.horizontal={execCommand:function(e){var t=this;if(-1!==t.queryCommandState(e)){t.execCommand("insertHtml","<hr>");var i=t.selection.getRange(),e=i.startContainer;return 1!=e.nodeType||e.childNodes[i.startOffset]||(e=e.childNodes[i.startOffset-1])&&1==e.nodeType&&"HR"==e.tagName&&("p"==t.options.enterTag?(e=t.document.createElement("p"),i.insertNode(e),i.setStart(e,0).setCursor()):(e=t.document.createElement("br"),i.insertNode(e),i.setStartBefore(e).setCursor())),!0}},queryCommandState:function(){return domUtils.filterNodeList(this.selection.getStartElementPath(),"table")?-1:0}},this.addListener("delkeydown",function(e,t){var i=this.selection.getRange();if(i.txtToElmBoundary(!0),domUtils.isStartInblock(i)){var n=i.startContainer.previousSibling;if(n&&domUtils.isTagNode(n,"hr"))return domUtils.remove(n),i.select(),domUtils.preventDefault(t),!0}})},UE.commands.time=UE.commands.date={execCommand:function(e,t){var i,n,o,r=new Date;this.execCommand("insertHtml","time"==e?(e=t,n=("0"+(i=r).getHours()).slice(-2),o=("0"+i.getMinutes()).slice(-2),i=("0"+i.getSeconds()).slice(-2),(e=e||"hh:ii:ss").replace(/hh/gi,n).replace(/ii/gi,o).replace(/ss/gi,i)):(n=t,i=("000"+(o=r).getFullYear()).slice(-4),t=i.slice(-2),r=("0"+(o.getMonth()+1)).slice(-2),o=("0"+o.getDate()).slice(-2),(n=n||"yyyy-mm-dd").replace(/yyyy/gi,i).replace(/yy/gi,t).replace(/mm/gi,r).replace(/dd/gi,o)))}},UE.plugins.rowspacing=function(){this.setOpt({rowspacingtop:["5","10","15","20","25"],rowspacingbottom:["5","10","15","20","25"]}),this.commands.rowspacing={execCommand:function(e,t,i){return this.execCommand("paragraph","p",{style:"margin-"+i+":"+t+"px"}),!0},queryCommandValue:function(e,t){var i=domUtils.filterNodeList(this.selection.getStartElementPath(),function(e){return domUtils.isBlockElm(e)});return i&&domUtils.getComputedStyle(i,"margin-"+t).replace(/[^\d]/g,"")||0}}},UE.plugins.lineheight=function(){this.setOpt({lineheight:["1","1.5","1.75","2","3","4","5"]}),this.commands.lineheight={execCommand:function(e,t){return this.execCommand("paragraph","p",{style:"line-height:"+("1"==t?"normal":t+"em")}),!0},queryCommandValue:function(){var e=domUtils.filterNodeList(this.selection.getStartElementPath(),function(e){return domUtils.isBlockElm(e)});if(e){e=domUtils.getComputedStyle(e,"line-height");return"normal"==e?1:e.replace(/[^\d.]*/gi,"")}}}},UE.plugins.insertcode=function(){var d=this;d.ready(function(){utils.cssRule("pre","pre{margin:.5em 0;padding:.4em .6em;border-radius:8px;background:#f8f8f8;}",d.document)}),d.setOpt("insertcode",{as3:"ActionScript3",bash:"Bash/Shell",cpp:"C/C++",css:"Css",cf:"CodeFunction","c#":"C#",delphi:"Delphi",diff:"Diff",erlang:"Erlang",groovy:"Groovy",html:"Html",java:"Java",jfx:"JavaFx",js:"Javascript",pl:"Perl",php:"Php",plain:"Plain Text",ps:"PowerShell",python:"Python",ruby:"Ruby",scala:"Scala",sql:"Sql",vb:"Vb",xml:"Xml"}),d.commands.insertcode={execCommand:function(e,t){var i,n,o,r=this,a=r.selection.getRange(),s=domUtils.findParentByTagName(a.startContainer,"pre",!0);s?s.className="brush:"+t+";toolbar:false;":(i="",a.collapsed?i=browser.ie&&browser.ie11below?browser.version<=8?"&nbsp;":"":"<br/>":(n=a.extractContents(),(o=r.document.createElement("div")).appendChild(n),utils.each(UE.filterNode(UE.htmlparser(o.innerHTML.replace(/[\r\t]/g,"")),r.options.filterTxtRules).children,function(t){browser.ie&&browser.ie11below&&8<browser.version?("element"==t.type?"br"==t.tagName?i+="\n":dtd.$empty[t.tagName]||(utils.each(t.children,function(e){"element"==e.type?"br"==e.tagName?i+="\n":dtd.$empty[t.tagName]||(i+=e.innerText()):i+=e.data}),/\n$/.test(i)||(i+="\n")):i+=t.data+"\n",!t.nextSibling()&&/\n$/.test(i)&&(i=i.replace(/\n$/,""))):browser.ie&&browser.ie11below?("element"==t.type?"br"==t.tagName?i+="<br>":dtd.$empty[t.tagName]||(utils.each(t.children,function(e){"element"==e.type?"br"==e.tagName?i+="<br>":dtd.$empty[t.tagName]||(i+=e.innerText()):i+=e.data}),/br>$/.test(i)||(i+="<br>")):i+=t.data+"<br>",!t.nextSibling()&&/<br>$/.test(i)&&(i=i.replace(/<br>$/,""))):(i+="element"==t.type?dtd.$empty[t.tagName]?"":t.innerText():t.data,/br\/?\s*>$/.test(i)||t.nextSibling()&&(i+="<br>"))})),r.execCommand("inserthtml",'<pre id="coder"class="brush:'+t+';toolbar:false">'+i+"</pre>",!0),s=r.document.getElementById("coder"),domUtils.removeAttributes(s,"id"),(t=s.previousSibling)&&(3==t.nodeType&&1==t.nodeValue.length&&browser.ie&&6==browser.version||domUtils.isEmptyBlock(t))&&domUtils.remove(t),a=r.selection.getRange(),domUtils.isEmptyBlock(s)?a.setStart(s,0).setCursor(!1,!0):a.selectNodeContents(s).select())},queryCommandValue:function(){var e=this.selection.getStartElementPath(),t="";return utils.each(e,function(e){if("PRE"==e.nodeName){e=e.className.match(/brush:([^;]+)/);return t=e&&e[1]?e[1]:"",!1}}),t}},d.addInputRule(function(e){utils.each(e.getNodesByTagName("pre"),function(t){var e=t.getNodesByTagName("br");e.length?browser.ie&&browser.ie11below&&8<browser.version&&utils.each(e,function(e){var t=UE.uNode.createText("\n");e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e)}):browser.ie&&browser.ie11below&&8<browser.version||(e=t.innerText().split(/\n/),t.innerHTML(""),utils.each(e,function(e){e.length&&t.appendChild(UE.uNode.createText(e)),t.appendChild(UE.uNode.createElement("br"))}))})}),d.addOutputRule(function(e){utils.each(e.getNodesByTagName("pre"),function(e){var t="";utils.each(e.children,function(e){"text"==e.type?t+=e.data.replace(/[ ]/g,"&nbsp;").replace(/\n$/,""):"br"==e.tagName?t+="\n":t+=dtd.$empty[e.tagName]?e.innerText():""}),e.innerText(t.replace(/(&nbsp;|\n)+$/,""))})}),d.notNeedCodeQuery={help:1,undo:1,redo:1,source:1,print:1,searchreplace:1,fullscreen:1,preview:1,insertparagraph:1,elementpath:1,insertcode:1,inserthtml:1,selectall:1},d.queryCommandState,d.queryCommandState=function(e){return!this.notNeedCodeQuery[e.toLowerCase()]&&this.selection&&this.queryCommandValue("insertcode")?-1:UE.Editor.prototype.queryCommandState.apply(this,arguments)},d.addListener("beforeenterkeydown",function(){var e=d.selection.getRange();if(t=domUtils.findParentByTagName(e.startContainer,"pre",!0)){if(d.fireEvent("saveScene"),e.collapsed||e.deleteContents(),!browser.ie||browser.ie9above){var t,i=d.document.createElement("br");for(e.insertNode(i).setStartAfter(i).collapse(!0),i.nextSibling||browser.ie&&!(10<browser.version)?e.setStartAfter(i):e.insertNode(i.cloneNode(!1)),t=i.previousSibling;t;)if(!(t=(s=t).previousSibling)||"BR"==t.nodeName){t=s;break}if(t){for(var n="";t&&"BR"!=t.nodeName&&new RegExp("^[\\s"+domUtils.fillChar+"]*$").test(t.nodeValue);)n+=t.nodeValue,t=t.nextSibling;"BR"!=t.nodeName&&(l=t.nodeValue.match(new RegExp("^([\\s"+domUtils.fillChar+"]+)")))&&l[1]&&(n+=l[1]),n&&(n=d.document.createTextNode(n),e.insertNode(n).setStartAfter(n))}e.collapse(!0).select(!0)}else if(8<browser.version){var o,r=d.document.createTextNode("\n"),a=e.startContainer;0==e.startOffset?a.previousSibling&&(e.insertNode(r),o=d.document.createTextNode(" "),e.setStartAfter(r).insertNode(o).setStart(o,0).collapse(!0).select(!0)):(e.insertNode(r).setStartAfter(r),o=d.document.createTextNode(" "),(a=e.startContainer.childNodes[e.startOffset])&&!/^\n/.test(a.nodeValue)&&e.setStartBefore(r),e.insertNode(o).setStart(o,0).collapse(!0).select(!0))}else{var s,i=d.document.createElement("br");for(e.insertNode(i),e.insertNode(d.document.createTextNode(domUtils.fillChar)),e.setStartAfter(i),t=i.previousSibling;t;)if(!(t=(s=t).previousSibling)||"BR"==t.nodeName){t=s;break}if(t){for(var l,n="";t&&"BR"!=t.nodeName&&new RegExp("^[ "+domUtils.fillChar+"]*$").test(t.nodeValue);)n+=t.nodeValue,t=t.nextSibling;"BR"!=t.nodeName&&(l=t.nodeValue.match(new RegExp("^([ "+domUtils.fillChar+"]+)")))&&l[1]&&(n+=l[1]),n=d.document.createTextNode(n),e.insertNode(n).setStartAfter(n)}e.collapse(!0).select()}return d.fireEvent("saveScene"),!0}}),d.addListener("tabkeydown",function(e,t){var i=d.selection.getRange(),n=domUtils.findParentByTagName(i.startContainer,"pre",!0);if(n){if(d.fireEvent("saveScene"),!t.shiftKey)if(i.collapsed){var o=d.document.createTextNode("    ");i.insertNode(o).setStartAfter(o).collapse(!0).select(!0)}else{for(var o=i.createBookmark(),r=o.start.previousSibling;r;){if(n.firstChild===r&&!domUtils.isBr(r)){n.insertBefore(d.document.createTextNode("    "),r);break}if(domUtils.isBr(r)){n.insertBefore(d.document.createTextNode("    "),r.nextSibling);break}r=r.previousSibling}var a=o.end,r=o.start.nextSibling;for(n.firstChild===o.start&&n.insertBefore(d.document.createTextNode("    "),r.nextSibling);r&&r!==a;){if(domUtils.isBr(r)&&r.nextSibling){if(r.nextSibling===a)break;n.insertBefore(d.document.createTextNode("    "),r.nextSibling)}r=r.nextSibling}i.moveToBookmark(o).select()}return d.fireEvent("saveScene"),!0}}),d.addListener("beforeinserthtml",function(e,t){var i=this,n=i.selection.getRange();if(domUtils.findParentByTagName(n.startContainer,"pre",!0)){n.collapsed||n.deleteContents();var o,r,a="";return browser.ie&&8<browser.version?(utils.each(UE.filterNode(UE.htmlparser(t),i.options.filterTxtRules).children,function(t){"element"==t.type?"br"==t.tagName?a+="\n":dtd.$empty[t.tagName]||(utils.each(t.children,function(e){"element"==e.type?"br"==e.tagName?a+="\n":dtd.$empty[t.tagName]||(a+=e.innerText()):a+=e.data}),/\n$/.test(a)||(a+="\n")):a+=t.data+"\n",!t.nextSibling()&&/\n$/.test(a)&&(a=a.replace(/\n$/,""))}),o=i.document.createTextNode(utils.html(a.replace(/&nbsp;/g," "))),n.insertNode(o).selectNode(o).select()):(r=i.document.createDocumentFragment(),utils.each(UE.filterNode(UE.htmlparser(t),i.options.filterTxtRules).children,function(t){"element"==t.type?"br"==t.tagName?r.appendChild(i.document.createElement("br")):dtd.$empty[t.tagName]||(utils.each(t.children,function(e){"element"==e.type?"br"==e.tagName?r.appendChild(i.document.createElement("br")):dtd.$empty[t.tagName]||r.appendChild(i.document.createTextNode(utils.html(e.innerText().replace(/&nbsp;/g," ")))):r.appendChild(i.document.createTextNode(utils.html(e.data.replace(/&nbsp;/g," "))))}),"BR"!=r.lastChild.nodeName&&r.appendChild(i.document.createElement("br"))):r.appendChild(i.document.createTextNode(utils.html(t.data.replace(/&nbsp;/g," ")))),t.nextSibling()||"BR"!=r.lastChild.nodeName||r.removeChild(r.lastChild)}),n.insertNode(r).select()),!0}}),d.addListener("keydown",function(e,t){if(40==(t.keyCode||t.which)){var i,n=this.selection.getRange(),o=n.startContainer;if(n.collapsed&&(i=domUtils.findParentByTagName(n.startContainer,"pre",!0))&&!i.nextSibling){for(var r=i.lastChild;r&&"BR"==r.nodeName;)r=r.previousSibling;(r===o||n.startContainer===i&&n.startOffset==i.childNodes.length)&&(this.execCommand("insertparagraph"),domUtils.preventDefault(t))}}}),d.addListener("delkeydown",function(e,t){var i=this.selection.getRange();i.txtToElmBoundary(!0);var n=i.startContainer;if(domUtils.isTagNode(n,"pre")&&i.collapsed&&domUtils.isStartInblock(i)){var o=d.document.createElement("p");return domUtils.fillNode(d.document,o),n.parentNode.insertBefore(o,n),domUtils.remove(n),i.setStart(o,0).setCursor(!1,!0),domUtils.preventDefault(t),!0}})},UE.commands.cleardoc={execCommand:function(e){var t=this,i=t.options.enterTag,n=t.selection.getRange();"br"==i?(t.body.innerHTML="<br/>",n.setStart(t.body,0).setCursor()):(t.body.innerHTML="<p>"+(ie?"":"<br/>")+"</p>",n.setStart(t.body.firstChild,0).setCursor(!1,!0)),setTimeout(function(){t.fireEvent("clearDoc")},0)}},UE.plugin.register("anchor",function(){return{bindEvents:{ready:function(){utils.cssRule("anchor",".anchorclass{background: url('"+this.options.themePath+this.options.theme+"/images/anchor.gif') no-repeat scroll left center transparent;cursor: auto;display: inline-block;height: 16px;width: 15px;}",this.document)}},outputRule:function(e){utils.each(e.getNodesByTagName("img"),function(e){var t;(t=e.getAttr("anchorname"))&&(e.tagName="a",e.setAttr({anchorname:"",name:t,class:""}))})},inputRule:function(e){utils.each(e.getNodesByTagName("a"),function(e){var t;(t=e.getAttr("name"))&&!e.getAttr("href")&&(/^\_Toc\d+$/.test(t)?e.parentNode.removeChild(e):(e.tagName="img",e.setAttr({anchorname:e.getAttr("name"),class:"anchorclass"}),e.setAttr("name")))})},commands:{anchor:{execCommand:function(e,t){var i=this.selection.getRange(),n=i.getClosedNode();n&&n.getAttribute("anchorname")?t?n.setAttribute("anchorname",t):(i.setStartBefore(n).setCursor(),domUtils.remove(n)):t&&(n=this.document.createElement("img"),i.collapse(!0),domUtils.setAttributes(n,{anchorname:t,class:"anchorclass"}),i.insertNode(n).setStartAfter(n).setCursor(!1,!0))}}}}}),UE.plugins.wordcount=function(){var i,e=this;e.setOpt("wordCount",!0),e.addListener("contentchange",function(){e.fireEvent("wordcount")}),e.addListener("ready",function(){var t=this;domUtils.on(t.body,"keyup",function(e){(e.keyCode||e.which)in{16:1,18:1,20:1,37:1,38:1,39:1,40:1}||(clearTimeout(i),i=setTimeout(function(){t.fireEvent("wordcount")},200))})})},UE.plugins.pagebreak=function(){var s=this,l=["td"];function d(e){if(domUtils.isEmptyBlock(e)){for(var t,i=e.firstChild;i&&1==i.nodeType&&domUtils.isEmptyBlock(i);)i=(t=i).firstChild;domUtils.fillNode(s.document,t=!t?e:t)}}function c(e){return e&&1==e.nodeType&&"HR"==e.tagName&&"pagebreak"==e.className}s.setOpt("pageBreakTag","_ueditor_page_break_tag_"),s.ready(function(){utils.cssRule("pagebreak",".pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}",s.document)}),s.addInputRule(function(e){e.traversal(function(e){var t;"text"==e.type&&e.data==s.options.pageBreakTag&&(t=UE.uNode.createElement('<hr class="pagebreak" noshade="noshade" size="5" style="-webkit-user-select: none;">'),e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e))})}),s.addOutputRule(function(e){utils.each(e.getNodesByTagName("hr"),function(e){var t;"pagebreak"==e.getAttr("class")&&(t=UE.uNode.createText(s.options.pageBreakTag),e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e))})}),s.commands.pagebreak={execCommand:function(){var e=s.selection.getRange(),t=s.document.createElement("hr");domUtils.setAttributes(t,{class:"pagebreak",noshade:"noshade",size:"5"}),domUtils.unSelectable(t);var i=domUtils.findParentByTagName(e.startContainer,l,!0);if(i)"TD"===i.tagName&&(t!==(o=((o=i.parentNode).previousSibling?(o.parentNode.insertBefore(t,o),domUtils.findParents(t)):((a=domUtils.findParentByTagName(o,"table")).parentNode.insertBefore(t,a),domUtils.findParents(t,!0)))[1])&&domUtils.breakParent(t,o),s.fireEvent("afteradjusttable",s.document));else{if(!e.collapsed){e.deleteContents();for(var n=e.startContainer;!domUtils.isBody(n)&&domUtils.isBlockElm(n)&&domUtils.isEmptyNode(n);)e.setStartBefore(n).collapse(!0),domUtils.remove(n),n=e.startContainer}e.insertNode(t);for(var o=t.parentNode;!domUtils.isBody(o);)domUtils.breakParent(t,o),(r=t.nextSibling)&&domUtils.isEmptyBlock(r)&&domUtils.remove(r),o=t.parentNode;var r=t.nextSibling,a=t.previousSibling;c(a)?domUtils.remove(a):a&&d(a),r?(c(r)?domUtils.remove(r):d(r),e.setEndAfter(t).collapse(!1)):(a=s.document.createElement("p"),t.parentNode.appendChild(a),domUtils.fillNode(s.document,a),e.setStart(a,0).collapse(!0)),e.select(!0)}}}},UE.plugin.register("wordimage",function(){var i,r=this;return{commands:{wordimage:{execCommand:function(){for(var e=domUtils.getElementsByTagName(r.body,"img"),t=[],i=0;n=e[i++];){var n=n.getAttribute("word_img");n&&t.push(n)}return t},queryCommandState:function(){i=domUtils.getElementsByTagName(r.body,"img");for(var e,t=0;e=i[t++];)if(e.getAttribute("word_img"))return 1;return-1},notNeedUndo:!0}},inputRule:function(e){utils.each(e.getNodesByTagName("img"),function(e){var t=e.attrs,i=parseInt(t.width)<128||parseInt(t.height)<43,n=r.options,o=n.UEDITOR_HOME_URL+"themes/default/images/spacer.gif";t.src&&/^(?:(file:\/+))/.test(t.src)&&e.setAttr({width:t.width,height:t.height,alt:t.alt,word_img:t.src,src:o,style:"background:url("+(i?n.themePath+n.theme+"/images/word.gif":n.langPath+n.lang+"/images/localimage.png")+") no-repeat center center;border:1px solid #ddd"})})}}}),UE.plugins.dragdrop=function(){var o=this;o.ready(function(){domUtils.on(this.body,"dragend",function(){var e=o.selection.getRange(),t=e.getClosedNode()||o.selection.getStart();if(t&&"IMG"==t.tagName){for(var i,n=t.previousSibling;(i=t.nextSibling)&&1==i.nodeType&&"SPAN"==i.tagName&&!i.firstChild;)domUtils.remove(i);(!n||1!=n.nodeType||domUtils.isEmptyBlock(n))&&n||i&&(!i||domUtils.isEmptyBlock(i))||(n&&"P"==n.tagName&&!domUtils.isEmptyBlock(n)?(n.appendChild(t),domUtils.moveChild(i,n),domUtils.remove(i)):i&&"P"==i.tagName&&!domUtils.isEmptyBlock(i)&&i.insertBefore(t,i.firstChild),n&&"P"==n.tagName&&domUtils.isEmptyBlock(n)&&domUtils.remove(n),i&&"P"==i.tagName&&domUtils.isEmptyBlock(i)&&domUtils.remove(i),e.selectNode(t).select(),o.fireEvent("saveScene"))}})}),o.addListener("keyup",function(e,t){13==(t.keyCode||t.which)&&(t=o.selection.getRange(),(t=domUtils.findParentByTagName(t.startContainer,"p",!0))&&"center"==domUtils.getComputedStyle(t,"text-align")&&domUtils.removeStyle(t,"text-align"))})},UE.plugins.undo=function(){var r,n=this,o=n.options.maxUndoCount||20,a=n.options.maxInputCount||20,s=new RegExp(domUtils.fillChar+"|</hr>","gi"),l={ol:1,ul:1,table:1,tbody:1,tr:1,body:1},d=n.options.autoClearEmptyNode;function c(e,t){if(e.length==t.length){for(var i=0,n=e.length;i<n;i++)if(e[i]!=t[i])return;return 1}}n.undoManger=new function(){this.list=[],this.index=0,this.hasUndo=!1,this.hasRedo=!1,this.undo=function(){if(this.hasUndo)if(this.list[this.index-1]||1!=this.list.length){for(;this.list[this.index].content==this.list[this.index-1].content;)if(this.index--,0==this.index)return this.restore(0);this.restore(--this.index)}else this.reset()},this.redo=function(){if(this.hasRedo){for(;this.list[this.index].content==this.list[this.index+1].content;)if(this.index++,this.index==this.list.length-1)return this.restore(this.index);this.restore(++this.index)}},this.restore=function(){var t=this.editor,e=this.list[this.index],i=UE.htmlparser(e.content.replace(s,""));t.options.autoClearEmptyNode=!1,t.filterInputRule(i),t.options.autoClearEmptyNode=d,t.document.body.innerHTML=i.toHtml(),t.fireEvent("afterscencerestore"),browser.ie&&utils.each(domUtils.getElementsByTagName(t.document,"td th caption p"),function(e){domUtils.isEmptyNode(e)&&domUtils.fillNode(t.document,e)});try{var n=new dom.Range(t.document).moveToAddress(e.address);n.select(l[n.startContainer.nodeName.toLowerCase()])}catch(t){}this.update(),this.clearKey(),t.fireEvent("reset",!0)},this.getScene=function(){var e=this.editor,t=e.selection.getRange().createAddress(!1,!0);e.fireEvent("beforegetscene");var i=UE.htmlparser(e.body.innerHTML);e.options.autoClearEmptyNode=!1,e.filterOutputRule(i),e.options.autoClearEmptyNode=d;i=i.toHtml();return e.fireEvent("aftergetscene"),{address:t,content:i}},this.save=function(e,t){clearTimeout(r);var i=this.getScene(t),t=this.list[this.index];t&&t.content!=i.content&&n.trigger("contentchange"),t&&t.content==i.content&&(e||(e=t.address,t=i.address,e.collapsed==t.collapsed&&c(e.startAddress,t.startAddress)&&c(e.endAddress,t.endAddress)))||(this.list=this.list.slice(0,this.index+1),this.list.push(i),this.list.length>o&&this.list.shift(),this.index=this.list.length-1,this.clearKey(),this.update())},this.update=function(){this.hasRedo=!!this.list[this.index+1],this.hasUndo=!!this.list[this.index-1]},this.reset=function(){this.list=[],this.index=0,this.hasUndo=!1,this.hasRedo=!1,this.clearKey()},this.clearKey=function(){m=0}},(n.undoManger.editor=n).addListener("saveScene",function(){var e=Array.prototype.splice.call(arguments,1);this.undoManger.save.apply(this.undoManger,e)}),n.addListener("reset",function(e,t){t||this.undoManger.reset()}),n.commands.redo=n.commands.undo={execCommand:function(e){this.undoManger[e]()},queryCommandState:function(e){return this.undoManger["has"+("undo"==e.toLowerCase()?"Undo":"Redo")]?0:-1},notNeedUndo:1};var u={16:1,17:1,18:1,37:1,38:1,39:1,40:1},m=0,f=!1;n.addListener("ready",function(){domUtils.on(this.body,"compositionstart",function(){f=!0}),domUtils.on(this.body,"compositionend",function(){f=!1})}),n.addshortcutkey({Undo:"ctrl+90",Redo:"ctrl+89"});var h=!0;n.addListener("keydown",function(e,t){var i=this,n=t.keyCode||t.which;if(!(u[n]||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)){if(!f)return i.selection.getRange().collapsed?(0==i.undoManger.list.length&&i.undoManger.save(!0),clearTimeout(r),r=setTimeout(function(){var e;f?e=setInterval(function(){f||(o(i),clearInterval(e))},300):o(i)},200),void(++m>=a&&o(i))):(i.undoManger.save(!1,!0),void(h=!1));function o(e){e.undoManger.save(!1,!0),e.fireEvent("selectionchange")}}}),n.addListener("keyup",function(e,t){var i=t.keyCode||t.which;u[i]||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||f||h||(this.undoManger.save(!1,!0),h=!0)}),n.stopCmdUndo=function(){n.__hasEnterExecCommand=!0},n.startCmdUndo=function(){n.__hasEnterExecCommand=!1}},UE.plugin.register("copy",function(){var n=this;function e(){ZeroClipboard.config({debug:!1,swfPath:n.options.UEDITOR_HOME_URL+"third-party/zeroclipboard/ZeroClipboard.swf"});var e=n.zeroclipboard=new ZeroClipboard;e.on("copy",function(e){var t=e.client,i=n.selection.getRange(),e=document.createElement("div");e.appendChild(i.cloneContents()),t.setText(e.innerText||e.textContent),t.setHtml(e.innerHTML),i.select()}),e.on("mouseover mouseout",function(e){var t=e.target;t&&("mouseover"==e.type?domUtils.addClass(t,"edui-state-hover"):"mouseout"==e.type&&domUtils.removeClasses(t,"edui-state-hover"))}),e.on("wrongflash noflash",function(){ZeroClipboard.destroy()}),n.fireEvent("zeroclipboardready",e)}return{bindEvents:{ready:function(){browser.ie||(window.ZeroClipboard?e():utils.loadFile(document,{src:n.options.UEDITOR_HOME_URL+"third-party/zeroclipboard/ZeroClipboard.js",tag:"script",type:"text/javascript",defer:"defer"},function(){e()}))}},commands:{copy:{execCommand:function(e){n.document.execCommand("copy")||alert(n.getLang("copymsg"))}}}}}),UE.plugins.paste=function(){function t(n){var o,r,a,s=this.document;s.getElementById("baidu_pastebin")||(o=this.selection.getRange(),r=o.createBookmark(),(a=s.createElement("div")).id="baidu_pastebin",browser.webkit&&a.appendChild(s.createTextNode(domUtils.fillChar+domUtils.fillChar)),s.body.appendChild(a),r.start.style.display="",a.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;left:-1000px;white-space:nowrap;top:"+domUtils.getXY(r.start).y+"px",o.selectNodeContents(a).select(!0),setTimeout(function(){if(browser.webkit)for(var e,t=0,i=s.querySelectorAll("#baidu_pastebin");e=i[t++];){if(!domUtils.isEmptyNode(e)){a=e;break}domUtils.remove(e)}try{a.parentNode.removeChild(a)}catch(e){}o.moveToBookmark(r).select(!0),n(a)},0))}var p,g,b,v=this;function y(e){return e.replace(/<(\/?)([\w\-]+)([^>]*)>/gi,function(e,t,i,n){return{img:1}[i=i.toLowerCase()]?e:(n=n.replace(/([\w\-]*?)\s*=\s*(("([^"]*)")|('([^']*)')|([^\s>]+))/gi,function(e,t,i){return{src:1,href:1,name:1}[t.toLowerCase()]?t+"="+i+" ":""}),{span:1,div:1}[i]?"":"<"+t+i+" "+utils.trim(n)+">")})}function i(e){if(e.firstChild){for(var t,i=domUtils.getElementsByTagName(e,"span"),n=0;t=i[n++];)"_baidu_cut_start"!=t.id&&"_baidu_cut_end"!=t.id||domUtils.remove(t);if(browser.webkit){for(var o=e.querySelectorAll("div br"),n=0;r=o[n++];){var r=r.parentNode;"DIV"==r.tagName&&1==r.childNodes.length&&(r.innerHTML="<p><br/></p>",domUtils.remove(r))}var a,s=e.querySelectorAll("#baidu_pastebin");for(n=0;a=s[n++];){var l=v.document.createElement("p");for(a.parentNode.insertBefore(l,a);a.firstChild;)l.appendChild(a.firstChild);domUtils.remove(a)}var d=e.querySelectorAll("meta");for(n=0;u=d[n++];)domUtils.remove(u);for(o=e.querySelectorAll("br"),n=0;u=o[n++];)/^apple-/i.test(u.className)&&domUtils.remove(u)}if(browser.gecko){var c=e.querySelectorAll("[_moz_dirty]");for(n=0;u=c[n++];)u.removeAttribute("_moz_dirty")}if(!browser.ie){var u,m=e.querySelectorAll("span.Apple-style-span");for(n=0;u=m[n++];)domUtils.remove(u,!0)}f=e.innerHTML;var f=UE.filterWord(f),h=UE.htmlparser(f);v.options.filterRules&&UE.filterNode(h,v.options.filterRules),v.filterInputRule(h),browser.webkit&&((e=h.lastChild())&&"element"==e.type&&"br"==e.tagName&&h.removeChild(e),utils.each(v.body.querySelectorAll("div"),function(e){domUtils.isEmptyBlock(e)&&domUtils.remove(e,!0)})),f={html:h.toHtml()},v.fireEvent("beforepaste",f,h),f.html&&(h=UE.htmlparser(f.html,!0),1===v.queryCommandState("pasteplain")?v.execCommand("insertHtml",UE.filterNode(h,v.options.filterTxtRules).toHtml(),!0):(UE.filterNode(h,v.options.filterTxtRules),p=h.toHtml(),g=f.html,b=v.selection.getRange().createAddress(!0),v.execCommand("insertHtml",!0===v.getOpt("retainOnlyLabelPasted")?y(g):g,!0)),v.fireEvent("afterpaste",f))}}v.setOpt({retainOnlyLabelPasted:!1}),v.addListener("pasteTransfer",function(e,t){if(b&&p&&g&&p!=g){var i=v.selection.getRange();if(i.moveToAddress(b,!0),!i.collapsed){for(;!domUtils.isBody(i.startContainer);){var n=i.startContainer;if(1==n.nodeType){if(!(n=n.childNodes[i.startOffset])){i.setStartBefore(i.startContainer);continue}n=n.previousSibling;n&&3==n.nodeType&&new RegExp("^[\n\r\t "+domUtils.fillChar+"]*$").test(n.nodeValue)&&i.setStartBefore(n)}if(0!=i.startOffset)break;i.setStartBefore(i.startContainer)}for(;!domUtils.isBody(i.endContainer);){var o=i.endContainer;if(1==o.nodeType){if(!(o=o.childNodes[i.endOffset])){i.setEndAfter(i.endContainer);continue}o=o.nextSibling;o&&3==o.nodeType&&new RegExp("^[\n\r\t"+domUtils.fillChar+"]*$").test(o.nodeValue)&&i.setEndAfter(o)}if(i.endOffset!=i.endContainer[3==i.endContainer.nodeType?"nodeValue":"childNodes"].length)break;i.setEndAfter(i.endContainer)}}i.deleteContents(),i.select(!0),v.__hasEnterExecCommand=!0;var r=g;2===t?r=y(g):t&&(r=p),v.execCommand("inserthtml",r,!0),v.__hasEnterExecCommand=!1;for(var a=v.selection.getRange();!domUtils.isBody(a.startContainer)&&!a.startOffset&&a.startContainer[3==a.startContainer.nodeType?"nodeValue":"childNodes"].length;)a.setStartBefore(a.startContainer);r=a.createAddress(!0);b.endAddress=r.startAddress}}),v.addListener("ready",function(){domUtils.on(v.body,"cut",function(){!v.selection.getRange().collapsed&&v.undoManger&&v.undoManger.save()}),domUtils.on(v.body,browser.ie||browser.opera?"keydown":"paste",function(e){(!browser.ie&&!browser.opera||(e.ctrlKey||e.metaKey)&&"86"==e.keyCode)&&t.call(v,function(e){i(e)})})}),v.commands.paste={execCommand:function(e){browser.ie?(t.call(v,function(e){i(e)}),v.document.execCommand("paste")):alert(v.getLang("pastemsg"))}}},UE.plugins.pasteplain=function(){function e(e){e.tagName="p",e.setStyle()}function t(e){e.parentNode.removeChild(e,!0)}this.setOpt({pasteplain:!1,filterTxtRules:{"-":"script style object iframe embed input select",p:{$:{}},br:{$:{}},div:function(e){for(var t,i=UE.uNode.createElement("p");t=e.firstChild();)"text"!=t.type&&UE.dom.dtd.$block[t.tagName]?i.firstChild()?(e.parentNode.insertBefore(i,e),i=UE.uNode.createElement("p")):e.parentNode.insertBefore(t,e):i.appendChild(t);i.firstChild()&&e.parentNode.insertBefore(i,e),e.parentNode.removeChild(e)},ol:t,ul:t,dl:t,dt:t,dd:t,li:t,caption:e,th:e,tr:e,h1:e,h2:e,h3:e,h4:e,h5:e,h6:e,td:function(e){e.innerText()&&e.parentNode.insertAfter(UE.uNode.createText(" &nbsp; &nbsp;"),e),e.parentNode.removeChild(e,e.innerText())}}});var i=this.options.pasteplain;this.commands.pasteplain={queryCommandState:function(){return i?1:0},execCommand:function(){i=0|!i},notNeedUndo:1}},UE.plugins.list=function(){var g=this,_={TD:1,PRE:1,BLOCKQUOTE:1},s={cn:"cn-1-",cn1:"cn-2-",cn2:"cn-3-",num:"num-1-",num1:"num-2-",num2:"num-3-",dash:"dash",dot:"dot"};function e(e){var t,i=[];for(t in e)i.push(t);return i}g.setOpt({autoTransWordToList:!1,insertorderedlist:{num:"",num1:"",num2:"",cn:"",cn1:"",cn2:"",decimal:"","lower-alpha":"","lower-roman":"","upper-alpha":"","upper-roman":""},insertunorderedlist:{circle:"",disc:"",square:"",dash:"",dot:""},listDefaultPaddingLeft:"30",listiconpath:"http://bs.baidu.com/listicon/",maxListLevel:-1,disablePInList:!1});var t,h={OL:e(g.options.insertorderedlist),UL:e(g.options.insertunorderedlist)},n=g.options.listiconpath;for(t in s)g.options.insertorderedlist.hasOwnProperty(t)||g.options.insertunorderedlist.hasOwnProperty(t)||delete s[t];function I(e){var t=e.className;return domUtils.hasClass(e,/custom_/)?t.match(/custom_(\w+)/)[1]:domUtils.getStyle(e,"list-style-type")}function r(r,a){utils.each(domUtils.getElementsByTagName(r,"ol ul"),function(n){var e,o,t,i;domUtils.inDoc(n,r)&&((i=n.parentNode).tagName!=n.tagName||(e=I(n)||("OL"==n.tagName?"decimal":"disc"))==(I(i)||("OL"==i.tagName?"decimal":"disc"))&&(t=(t=utils.indexOf(h[n.tagName],e))+1==h[n.tagName].length?0:t+1,A(n,h[n.tagName][t])),o=0,t=2,domUtils.hasClass(n,/custom_/)?/[ou]l/i.test(i.tagName)&&domUtils.hasClass(i,/custom_/)||(t=1):/[ou]l/i.test(i.tagName)&&domUtils.hasClass(i,/custom_/)&&(t=3),(i=domUtils.getStyle(n,"list-style-type"))&&(n.style.cssText="list-style-type:"+i),n.className=utils.trim(n.className.replace(/list-paddingleft-\w+/,""))+" list-paddingleft-"+t,utils.each(domUtils.getElementsByTagName(n,"li"),function(e){if(e.style.cssText&&(e.style.cssText=""),e.firstChild){if(e.parentNode===n){if(o++,domUtils.hasClass(n,/custom_/)){var t=1,i=I(n);if("OL"==n.tagName){if(i)switch(i){case"cn":case"cn1":case"cn2":10<o&&(o%10==0||10<o&&o<20)?t=2:20<o&&(t=3);break;case"num2":9<o&&(t=2)}e.className="list-"+s[i]+o+" list-"+i+"-paddingleft-"+t}else e.className="list-"+s[i]+" list-"+i+"-paddingleft"}else e.className=e.className.replace(/list-[\w\-]+/gi,"");i=e.getAttribute("class");null===i||i.replace(/\s/g,"")||domUtils.removeAttributes(e,"class")}}else domUtils.remove(e)}),a||R(n,n.tagName.toLowerCase(),I(n)||domUtils.getStyle(n,"list-style-type"),!0))})}function R(e,t,i,n){var o=e.nextSibling;o&&1==o.nodeType&&o.tagName.toLowerCase()==t&&(I(o)||domUtils.getStyle(o,"list-style-type")||("ol"==t?"decimal":"disc"))==i&&(domUtils.moveChild(o,e),0==o.childNodes.length&&domUtils.remove(o)),o&&domUtils.isFillChar(o)&&domUtils.remove(o);o=e.previousSibling;o&&1==o.nodeType&&o.tagName.toLowerCase()==t&&(I(o)||domUtils.getStyle(o,"list-style-type")||("ol"==t?"decimal":"disc"))==i&&domUtils.moveChild(e,o),o&&domUtils.isFillChar(o)&&domUtils.remove(o),!n&&domUtils.isEmptyBlock(e)&&domUtils.remove(e),I(e)&&r(e.ownerDocument,!0)}function A(e,t){s[t]&&(e.className="custom_"+t);try{domUtils.setStyle(e,"list-style-type",t)}catch(e){}}function b(e){var t=e.previousSibling;t&&domUtils.isEmptyBlock(t)&&domUtils.remove(t),(t=e.nextSibling)&&domUtils.isEmptyBlock(t)&&domUtils.remove(t)}function L(e){for(;e&&!domUtils.isBody(e);){if("TABLE"==e.nodeName)return null;if("LI"==e.nodeName)return e;e=e.parentNode}}g.ready(function(){var e,t=[];for(e in s){if("dash"==e||"dot"==e)t.push("li.list-"+s[e]+"{background-image:url("+n+s[e]+".gif)}"),t.push("ul.custom_"+e+"{list-style:none;}ul.custom_"+e+" li{background-position:0 3px;background-repeat:no-repeat}");else{for(var i=0;i<99;i++)t.push("li.list-"+s[e]+i+"{background-image:url("+n+"list-"+s[e]+i+".gif)}");t.push("ol.custom_"+e+"{list-style:none;}ol.custom_"+e+" li{background-position:0 3px;background-repeat:no-repeat}")}switch(e){case"cn":t.push("li.list-"+e+"-paddingleft-1{padding-left:25px}"),t.push("li.list-"+e+"-paddingleft-2{padding-left:40px}"),t.push("li.list-"+e+"-paddingleft-3{padding-left:55px}");break;case"cn1":t.push("li.list-"+e+"-paddingleft-1{padding-left:30px}"),t.push("li.list-"+e+"-paddingleft-2{padding-left:40px}"),t.push("li.list-"+e+"-paddingleft-3{padding-left:55px}");break;case"cn2":t.push("li.list-"+e+"-paddingleft-1{padding-left:40px}"),t.push("li.list-"+e+"-paddingleft-2{padding-left:55px}"),t.push("li.list-"+e+"-paddingleft-3{padding-left:68px}");break;case"num":case"num1":t.push("li.list-"+e+"-paddingleft-1{padding-left:25px}");break;case"num2":t.push("li.list-"+e+"-paddingleft-1{padding-left:35px}"),t.push("li.list-"+e+"-paddingleft-2{padding-left:40px}");break;case"dash":t.push("li.list-"+e+"-paddingleft{padding-left:35px}");break;case"dot":t.push("li.list-"+e+"-paddingleft{padding-left:20px}")}}t.push(".list-paddingleft-1{padding-left:0}"),t.push(".list-paddingleft-2{padding-left:"+g.options.listDefaultPaddingLeft+"px}"),t.push(".list-paddingleft-3{padding-left:"+2*g.options.listDefaultPaddingLeft+"px}"),utils.cssRule("list","ol,ul{margin:0;pading:0;"+(browser.ie?"":"width:95%")+"}li{clear:both;}"+t.join("\n"),g.document)}),g.ready(function(){domUtils.on(g.body,"cut",function(){setTimeout(function(){var e,t,i=g.selection.getRange();!i.collapsed&&(t=domUtils.findParentByTagName(i.startContainer,"li",!0))&&!t.nextSibling&&domUtils.isEmptyBlock(t)&&((t=(e=t.parentNode).previousSibling)?(domUtils.remove(e),i.setStartAtLast(t).collapse(!0)):(t=e.nextSibling)?(domUtils.remove(e),i.setStartAtFirst(t).collapse(!0)):(t=g.document.createElement("p"),domUtils.fillNode(g.document,t),e.parentNode.insertBefore(t,e),domUtils.remove(e),i.setStart(t,0).collapse(!0)),i.select(!0))})})}),g.addListener("beforepaste",function(i,e){var n,t=this.selection.getRange(),o=UE.htmlparser(e.html,!0);(t=domUtils.findParentByTagName(t.startContainer,"li",!0))&&(t="OL"==(n=t.parentNode).tagName?"ul":"ol",utils.each(o.getNodesByTagName(t),function(e){e.tagName=n.tagName,e.setAttr(),e.parentNode===o?i=I(n)||("OL"==n.tagName?"decimal":"disc"):(t=e.parentNode.getAttr("class"),(i=t&&/custom_/.test(t)?t.match(/custom_(\w+)/)[1]:e.parentNode.getStyle("list-style-type"))||(i="OL"==n.tagName?"decimal":"disc"));var t=utils.indexOf(h[n.tagName],i);e.parentNode!==o&&(t=t+1==h[n.tagName].length?0:t+1);t=h[n.tagName][t];s[t]?e.setAttr("class","custom_"+t):e.setStyle("list-style-type",t)})),e.html=o.toHtml()}),!0===g.getOpt("disablePInList")&&g.addOutputRule(function(e){utils.each(e.getNodesByTagName("li"),function(n){var o=[],r=0;utils.each(n.children,function(e){if("p"==e.tagName){for(var t,i;t=e.children.pop();)o.splice(r,0,t),t.parentNode=n,lastNode=t;(t=o[o.length-1])&&"element"==t.type&&"br"==t.tagName||((i=UE.uNode.createElement("br")).parentNode=n,o.push(i)),r=o.length}}),o.length&&(n.children=o)})}),g.addInputRule(function(e){function r(e,t){var i=t.firstChild();if(i&&"element"==i.type&&"span"==i.tagName&&/Wingdings|Symbol/.test(i.getStyle("font-family"))){for(var n in o)if(o[n]==i.data)return n;return"disc"}for(n in a)if(a[n].test(e))return n}var a,o;utils.each(e.getNodesByTagName("li"),function(e){for(var t,i=UE.uNode.createElement("p"),n=0;t=e.children[n];)"text"==t.type||dtd.p[t.tagName]?i.appendChild(t):i.firstChild()?(e.insertBefore(i,t),i=UE.uNode.createElement("p"),n+=2):n++;(!i.firstChild()||i.parentNode)&&e.firstChild()||e.appendChild(i),i.firstChild()||i.innerHTML(browser.ie?"&nbsp;":"<br/>");var o=e.firstChild(),r=o.lastChild();r&&"text"==r.type&&/^\s*$/.test(r.data)&&o.removeChild(r)}),g.options.autoTransWordToList&&(a={num1:/^\d+\)/,decimal:/^\d+\./,"lower-alpha":/^[a-z]+\)/,"upper-alpha":/^[A-Z]+\./,cn:/^[\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+[\u3001]/,cn2:/^\([\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+\)/},o={square:"n"},utils.each(e.getNodesByTagName("p"),function(e){if("MsoListParagraph"==e.getAttr("class")){e.setStyle("margin",""),e.setStyle("margin-left",""),e.setAttr("class","");var t,i,n=e;if("li"!=e.parentNode.tagName&&(t=r(e.innerText(),e))){var o=UE.uNode.createElement(g.options.insertorderedlist.hasOwnProperty(t)?"ol":"ul");for(s[t]?o.setAttr("class","custom_"+t):o.setStyle("list-style-type",t);e&&"li"!=e.parentNode.tagName&&r(e.innerText(),e);)(i=e.nextSibling())||e.parentNode.insertBefore(o,e),function(e,t,i){{var n;"ol"==e.tagName?browser.ie?"element"==(n=t.firstChild()).type&&"span"==n.tagName&&a[i].test(n.innerText())&&t.removeChild(n):t.innerHTML(t.innerHTML().replace(a[i],"")):t.removeChild(t.firstChild())}i=UE.uNode.createElement("li");i.appendChild(t),e.appendChild(i)}(o,e,t),e=i;!o.parentNode&&e&&e.parentNode&&e.parentNode.insertBefore(o,e)}n=n.firstChild();n&&"element"==n.type&&"span"==n.tagName&&/^\s*(&nbsp;)+\s*$/.test(n.innerText())&&n.parentNode.removeChild(n)}}))}),g.addListener("contentchange",function(){r(g.document)}),g.addListener("keydown",function(e,t){function i(){t.preventDefault?t.preventDefault():t.returnValue=!1,g.fireEvent("contentchange"),g.undoManger&&g.undoManger.save()}function n(e,t){for(;e&&!domUtils.isBody(e);){if(t(e))return null;if(1==e.nodeType&&/[ou]l/i.test(e.tagName))return e;e=e.parentNode}return null}var o=t.keyCode||t.which;if(13==o&&!t.shiftKey){var r=g.selection.getRange(),a=domUtils.findParent(r.startContainer,function(e){return domUtils.isBlockElm(e)},!0),s=domUtils.findParentByTagName(r.startContainer,"li",!0);a&&"PRE"!=a.tagName&&!s&&(l=a.innerHTML.replace(new RegExp(domUtils.fillChar,"g"),""),/^\s*1\s*\.[^\d]/.test(l)&&(a.innerHTML=l.replace(/^\s*1\s*\./,""),r.setStartAtLast(a).collapse(!0).select(),g.__hasEnterExecCommand=!0,g.execCommand("insertorderedlist"),g.__hasEnterExecCommand=!1));var l=g.selection.getRange(),r=n(l.startContainer,function(e){return"TABLE"==e.tagName}),a=l.collapsed?r:n(l.endContainer,function(e){return"TABLE"==e.tagName});if(r&&a&&r===a){if(!l.collapsed){if(r=domUtils.findParentByTagName(l.startContainer,"li",!0),a=domUtils.findParentByTagName(l.endContainer,"li",!0),!r||!a||r!==a){var d=l.cloneRange(),c=d.collapse(!1).createBookmark();return l.deleteContents(),d.moveToBookmark(c),b(s=domUtils.findParentByTagName(d.startContainer,"li",!0)),d.select(),void i()}if(l.deleteContents(),(s=domUtils.findParentByTagName(l.startContainer,"li",!0))&&domUtils.isEmptyBlock(s))return h=s.previousSibling,next=s.nextSibling,m=g.document.createElement("p"),domUtils.fillNode(g.document,m),p=s.parentNode,h&&next?(l.setStart(next,0).collapse(!0).select(!0),domUtils.remove(s)):((h||next)&&h?s.parentNode.parentNode.insertBefore(m,p.nextSibling):p.parentNode.insertBefore(m,p),domUtils.remove(s),p.firstChild||domUtils.remove(p),l.setStart(m,0).setCursor()),void i()}if(s=domUtils.findParentByTagName(l.startContainer,"li",!0)){if(domUtils.isEmptyBlock(s)){if(c=l.createBookmark(),s!==(p=s.parentNode).lastChild?(domUtils.breakParent(s,p),b(s)):(p.parentNode.insertBefore(s,p.nextSibling),domUtils.isEmptyNode(p)&&domUtils.remove(p)),!dtd.$list[s.parentNode.tagName])if(domUtils.isBlockElm(s.firstChild))domUtils.remove(s,!0);else{for(m=g.document.createElement("p"),s.parentNode.insertBefore(m,s);s.firstChild;)m.appendChild(s.firstChild);domUtils.remove(s)}l.moveToBookmark(c).select()}else{var u=s.firstChild;if(!u||!domUtils.isBlockElm(u)){var m=g.document.createElement("p");for(s.firstChild||domUtils.fillNode(g.document,m);s.firstChild;)m.appendChild(s.firstChild);s.appendChild(m),u=m}var f=g.document.createElement("span");l.insertNode(f),domUtils.breakParent(f,s);a=f.nextSibling;(u=a.firstChild)||(m=g.document.createElement("p"),domUtils.fillNode(g.document,m),a.appendChild(m),u=m),domUtils.isEmptyNode(u)&&(u.innerHTML="",domUtils.fillNode(g.document,u)),l.setStart(u,0).collapse(!0).shrinkBoundary().select(),domUtils.remove(f);var h=a.previousSibling;h&&domUtils.isEmptyBlock(h)&&(h.innerHTML="<p></p>",domUtils.fillNode(g.document,h.firstChild))}i()}}}if(8==o&&(l=g.selection.getRange()).collapsed&&domUtils.isStartInblock(l)&&(d=l.cloneRange().trimBoundary(),(s=domUtils.findParentByTagName(l.startContainer,"li",!0))&&domUtils.isStartInblock(d))){if((r=domUtils.findParentByTagName(l.startContainer,"p",!0))&&r!==s.firstChild){var p=domUtils.findParentByTagName(r,["ol","ul"]);return domUtils.breakParent(r,p),b(r),g.fireEvent("contentchange"),l.setStart(r,0).setCursor(!1,!0),g.fireEvent("saveScene"),void domUtils.preventDefault(t)}if(s&&(h=s.previousSibling)){if(46==o&&s.childNodes.length)return;if(dtd.$list[h.tagName]&&(h=h.lastChild),g.undoManger&&g.undoManger.save(),u=s.firstChild,domUtils.isBlockElm(u))if(domUtils.isEmptyNode(u))for(h.appendChild(u),l.setStart(u,0).setCursor(!1,!0);s.firstChild;)h.appendChild(s.firstChild);else f=g.document.createElement("span"),l.insertNode(f),domUtils.isEmptyBlock(h)&&(h.innerHTML=""),domUtils.moveChild(s,h),l.setStartBefore(f).collapse(!0).select(!0),domUtils.remove(f);else if(domUtils.isEmptyNode(s))m=g.document.createElement("p"),h.appendChild(m),l.setStart(m,0).setCursor();else for(l.setEnd(h,h.childNodes.length).collapse().select(!0);s.firstChild;)h.appendChild(s.firstChild);return domUtils.remove(s),g.fireEvent("contentchange"),g.fireEvent("saveScene"),void domUtils.preventDefault(t)}if(s&&!s.previousSibling){if(p=s.parentNode,c=l.createBookmark(),domUtils.isTagNode(p.parentNode,"ol ul"))p.parentNode.insertBefore(s,p),domUtils.isEmptyNode(p)&&domUtils.remove(p);else{for(;s.firstChild;)p.parentNode.insertBefore(s.firstChild,p);domUtils.remove(s),domUtils.isEmptyNode(p)&&domUtils.remove(p)}l.moveToBookmark(c).setCursor(!1,!0),g.fireEvent("contentchange"),g.fireEvent("saveScene"),void domUtils.preventDefault(t)}}}),g.addListener("keyup",function(e,t){8==(t.keyCode||t.which)&&(t=g.selection.getRange(),(t=domUtils.findParentByTagName(t.startContainer,["ol","ul"],!0))&&R(t,t.tagName.toLowerCase(),I(t)||domUtils.getComputedStyle(t,"list-style-type"),!0))}),g.addListener("tabkeydown",function(){var e=g.selection.getRange();function t(e){if(-1!=g.options.maxListLevel){for(var t=e.parentNode,i=0;/[ou]l/i.test(t.tagName);)i++,t=t.parentNode;return i>=g.options.maxListLevel?1:void 0}}var i=domUtils.findParentByTagName(e.startContainer,"li",!0);if(i){if(!e.collapsed){g.fireEvent("saveScene");for(var n,o,r=e.createBookmark(),a=0,s=domUtils.findParents(i);o=s[a++];)if(domUtils.isTagNode(o,"ol ul")){n=o;break}var l=i;if(r.end)for(;l&&!(domUtils.getPosition(l,r.end)&domUtils.POSITION_FOLLOWING);)if(t(l))l=domUtils.getNextDomNode(l,!1,null,function(e){return e!==n});else{var d=l.parentNode,c=g.document.createElement(d.tagName),u=(m=utils.indexOf(h[c.tagName],I(d)||domUtils.getComputedStyle(d,"list-style-type")))+1==h[c.tagName].length?0:m+1;for(A(c,f=h[c.tagName][u]),d.insertBefore(c,l);l&&!(domUtils.getPosition(l,r.end)&domUtils.POSITION_FOLLOWING);){if(i=l.nextSibling,c.appendChild(l),!i||domUtils.isTagNode(i,"ol ul")){if(i)for(;(i=i.firstChild)&&"LI"!=i.tagName;);else i=domUtils.getNextDomNode(l,!1,null,function(e){return e!==n});break}l=i}R(c,c.tagName.toLowerCase(),f),l=i}return g.fireEvent("contentchange"),e.moveToBookmark(r).select(),!0}if(t(i))return!0;var m,f,d=i.parentNode,c=g.document.createElement(d.tagName);return(m=(m=utils.indexOf(h[c.tagName],I(d)||domUtils.getComputedStyle(d,"list-style-type")))+1==h[c.tagName].length?0:m+1,A(c,f=h[c.tagName][m]),domUtils.isStartInblock(e))?(g.fireEvent("saveScene"),r=e.createBookmark(),d.insertBefore(c,i),c.appendChild(i),R(c,c.tagName.toLowerCase(),f),g.fireEvent("contentchange"),e.moveToBookmark(r).select(!0),!0):void 0}}),g.commands.insertorderedlist=g.commands.insertunorderedlist={execCommand:function(e,t){t=t||("insertorderedlist"==e.toLowerCase()?"decimal":"disc");function i(e){return 1==e.nodeType?"br"!=e.tagName.toLowerCase():!domUtils.isWhitespace(e)}var n=this,o=this.selection.getRange(),r="insertorderedlist"==e.toLowerCase()?"ol":"ul",a=n.document.createDocumentFragment();o.adjustmentBoundary().shrinkBoundary();var s,l,d,c=o.createBookmark(!0),u=L(n.document.getElementById(c.start)),m=0,f=L(n.document.getElementById(c.end)),h=0;if(u||f){if((x=u?u.parentNode:x)===(s=(f=!c.end?u:f)?f.parentNode:s)){for(;u!==f;){if(u=(d=u).nextSibling,!domUtils.isBlockElm(d.firstChild)){for(var p=n.document.createElement("p");d.firstChild;)p.appendChild(d.firstChild);d.appendChild(p)}a.appendChild(d)}if(d=n.document.createElement("span"),x.insertBefore(d,f),!domUtils.isBlockElm(f.firstChild)){for(p=n.document.createElement("p");f.firstChild;)p.appendChild(f.firstChild);f.appendChild(p)}a.appendChild(f),domUtils.breakParent(d,x),domUtils.isEmptyNode(d.previousSibling)&&domUtils.remove(d.previousSibling),domUtils.isEmptyNode(d.nextSibling)&&domUtils.remove(d.nextSibling);e=I(x)||domUtils.getComputedStyle(x,"list-style-type")||("insertorderedlist"==e.toLowerCase()?"decimal":"disc");if(x.tagName.toLowerCase()==r&&e==t){for(var g=0,b=n.document.createDocumentFragment();S=a.firstChild;)if(domUtils.isTagNode(S,"ol ul"))b.appendChild(S);else for(;S.firstChild;)b.appendChild(S.firstChild),domUtils.remove(S);d.parentNode.insertBefore(b,d)}else A(l=n.document.createElement(r),t),l.appendChild(a),d.parentNode.insertBefore(l,d);return domUtils.remove(d),l&&R(l,r,t),void o.moveToBookmark(c).select()}if(u){for(;u;){if(d=u.nextSibling,domUtils.isTagNode(u,"ol ul"))a.appendChild(u);else{for(var v,y=n.document.createDocumentFragment(),C=0;u.firstChild;)domUtils.isBlockElm(u.firstChild)&&(C=1),y.appendChild(u.firstChild);C?a.appendChild(y):((v=n.document.createElement("p")).appendChild(y),a.appendChild(v)),domUtils.remove(u)}u=d}x.parentNode.insertBefore(a,x.nextSibling),domUtils.isEmptyNode(x)?(o.setStartBefore(x),domUtils.remove(x)):o.setStartAfter(x),m=1}if(f&&domUtils.inDoc(s,n.document)){for(u=s.firstChild;u&&u!==f;){if(d=u.nextSibling,domUtils.isTagNode(u,"ol ul"))a.appendChild(u);else{for(y=n.document.createDocumentFragment(),C=0;u.firstChild;)domUtils.isBlockElm(u.firstChild)&&(C=1),y.appendChild(u.firstChild);C?a.appendChild(y):((v=n.document.createElement("p")).appendChild(y),a.appendChild(v)),domUtils.remove(u)}u=d}var x=domUtils.createElement(n.document,"div",{tmpDiv:1});domUtils.moveChild(f,x),a.appendChild(x),domUtils.remove(f),s.parentNode.insertBefore(a,s),o.setEndBefore(s),domUtils.isEmptyNode(s)&&domUtils.remove(s),h=1}}m||o.setStartBefore(n.document.getElementById(c.start)),c.end&&!h&&o.setEndAfter(n.document.getElementById(c.end)),o.enlarge(!0,function(e){return _[e.tagName]});for(var a=n.document.createDocumentFragment(),N=o.createBookmark(),w=domUtils.getNextDomNode(N.start,!1,i),U=o.cloneRange(),E=domUtils.isBlockElm;w&&w!==N.end&&domUtils.getPosition(w,N.end)&domUtils.POSITION_PRECEDING;)if(3==w.nodeType||dtd.li[w.tagName]){if(1==w.nodeType&&dtd.$list[w.tagName]){for(;w.firstChild;)a.appendChild(w.firstChild);k=domUtils.getNextDomNode(w,!1,i),domUtils.remove(w),w=k;continue}for(k=w,U.setStartBefore(w);w&&w!==N.end&&(!E(w)||domUtils.isBookmarkNode(w));)k=w,w=domUtils.getNextDomNode(w,!1,null,function(e){return!_[e.tagName]});w&&E(w)&&(d=domUtils.getNextDomNode(k,!1,i))&&domUtils.isBookmarkNode(d)&&(w=domUtils.getNextDomNode(d,!1,i),k=d),U.setEndAfter(k);var w=domUtils.getNextDomNode(k,!1,i),T=o.document.createElement("li");if(T.appendChild(U.extractContents()),domUtils.isEmptyNode(T)){for(var k=o.document.createElement("p");T.firstChild;)k.appendChild(T.firstChild);T.appendChild(k)}a.appendChild(T)}else w=domUtils.getNextDomNode(w,!0,i);o.moveToBookmark(N).collapse(!0),A(l=n.document.createElement(r),t),l.appendChild(a),o.insertNode(l),R(l,r,t);for(var S,g=0,B=domUtils.getElementsByTagName(l,"div");S=B[g++];)S.getAttribute("tmpDiv")&&domUtils.remove(S,!0);o.moveToBookmark(c).select()},queryCommandState:function(e){for(var t,i="insertorderedlist"==e.toLowerCase()?"ol":"ul",n=this.selection.getStartElementPath(),o=0;t=n[o++];){if("TABLE"==t.nodeName)return 0;if(i==t.nodeName.toLowerCase())return 1}return 0},queryCommandValue:function(e){for(var t,i,n="insertorderedlist"==e.toLowerCase()?"ol":"ul",o=this.selection.getStartElementPath(),r=0;i=o[r++];){if("TABLE"==i.nodeName){t=null;break}if(n==i.nodeName.toLowerCase()){t=i;break}}return t?I(t)||domUtils.getComputedStyle(t,"list-style-type"):null}}},sourceEditors={textarea:function(e,t){var i=t.ownerDocument.createElement("textarea");return i.style.cssText="position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;",browser.ie&&browser.version<8&&(i.style.width=t.offsetWidth+"px",i.style.height=t.offsetHeight+"px",t.onresize=function(){i.style.width=t.offsetWidth+"px",i.style.height=t.offsetHeight+"px"}),t.appendChild(i),{setContent:function(e){i.value=e},getContent:function(){return i.value},select:function(){var e;browser.ie?((e=i.createTextRange()).collapse(!0),e.select()):(i.setSelectionRange(0,0),i.focus())},dispose:function(){t.removeChild(i),t.onresize=null,t=i=null},focus:function(){i.focus()},blur:function(){i.blur()}}},codemirror:function(e,t){var i=window.CodeMirror(t,{mode:"text/html",tabMode:"indent",lineNumbers:!0,lineWrapping:!0}),n=i.getWrapperElement();return n.style.cssText='position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;',i.getScrollerElement().style.cssText="position:absolute;left:0;top:0;width:100%;height:100%;",i.refresh(),{getCodeMirror:function(){return i},setContent:function(e){i.setValue(e)},getContent:function(){return i.getValue()},select:function(){i.focus()},dispose:function(){t.removeChild(n),i=n=null},focus:function(){i.focus()},blur:function(){i.setOption("readOnly",!0),i.setOption("readOnly",!1)}}}},UE.plugins.source=function(){var n,o,r,a,s,l,d,c=this,u=this.options,m=!1;u.sourceEditor=browser.ie?"textarea":u.sourceEditor||"codemirror",c.setOpt({sourceEditorFirst:!1}),c.commands.source={execCommand:function(){if(m=!m){d=c.selection.getRange().createAddress(!1,!0),c.undoManger&&c.undoManger.save(!0),browser.gecko&&(c.body.contentEditable=!1),s=c.iframe.style.cssText,c.iframe.style.cssText+="position:absolute;left:-32768px;top:-32768px;",c.fireEvent("beforegetcontent");var e=UE.htmlparser(c.body.innerHTML);c.filterOutputRule(e),e.traversal(function(e){if("element"==e.type)switch(e.tagName){case"td":case"th":case"caption":e.children&&1==e.children.length&&"br"==e.firstChild().tagName&&e.removeChild(e.firstChild());break;case"pre":e.innerText(e.innerText().replace(/&nbsp;/g," "))}}),c.fireEvent("aftergetcontent");var t=e.toHtml(!0),e=c.iframe.parentNode;(n=sourceEditors["codemirror"==u.sourceEditor&&window.CodeMirror?"codemirror":"textarea"](c,e)).setContent(t),o=c.setContent,c.setContent=function(e){var t=UE.htmlparser(e);c.filterInputRule(t),e=t.toHtml(),n.setContent(e)},setTimeout(function(){n.select(),c.addListener("fullscreenchanged",function(){try{n.getCodeMirror().refresh()}catch(e){}})}),l=c.getContent,c.getContent=function(){return n.getContent()||"<p>"+(browser.ie?"":"<br/>")+"</p>"},r=c.focus,a=c.blur,c.focus=function(){n.focus()},c.blur=function(){a.call(c),n.blur()}}else{c.iframe.style.cssText=s;t=(t=n.getContent()||"<p>"+(browser.ie?"":"<br/>")+"</p>").replace(new RegExp("[\\r\\t\\n ]*</?(\\w+)\\s*(?:[^>]*)>","g"),function(e,t){return t&&!dtd.$inlineWithA[t.toLowerCase()]?e.replace(/(^[\n\r\t ]*)|([\n\r\t ]*$)/g,""):e.replace(/(^[\n\r\t]*)|([\n\r\t]*$)/g,"")});if(c.setContent=o,c.setContent(t),n.dispose(),n=null,c.getContent=l,c.focus=r,c.blur=a,c.body.firstChild||(c.body.innerHTML="<p>"+(browser.ie?"":"<br/>")+"</p>",c.body.firstChild),c.undoManger&&c.undoManger.save(!0),browser.gecko){var i=document.createElement("input");i.style.cssText="position:absolute;left:0;top:-32768px",document.body.appendChild(i),c.body.contentEditable=!1,setTimeout(function(){domUtils.setViewportOffset(i,{left:-32768,top:0}),i.focus(),setTimeout(function(){c.body.contentEditable=!0,c.selection.getRange().moveToAddress(d).select(!0),domUtils.remove(i)})})}else try{c.selection.getRange().moveToAddress(d).select(!0)}catch(e){}}this.fireEvent("sourcemodechanged",m)},queryCommandState:function(){return 0|m},notNeedUndo:1};var t=c.queryCommandState;c.queryCommandState=function(e){return e=e.toLowerCase(),m?e in{source:1,fullscreen:1}?1:-1:t.apply(this,arguments)},"codemirror"==u.sourceEditor&&c.addListener("ready",function(){utils.loadFile(document,{src:u.codeMirrorJsUrl||u.UEDITOR_HOME_URL+"third-party/codemirror/codemirror.js",tag:"script",type:"text/javascript",defer:"defer"},function(){u.sourceEditorFirst&&setTimeout(function(){c.execCommand("source")},0)}),utils.loadFile(document,{tag:"link",rel:"stylesheet",type:"text/css",href:u.codeMirrorCssUrl||u.UEDITOR_HOME_URL+"third-party/codemirror/codemirror.css"})})},UE.plugins.enterkey=function(){var s,l=this,d=l.options.enterTag;l.addListener("keyup",function(e,t){if(13==(t.keyCode||t.which)){var i,n=l.selection.getRange(),t=n.startContainer;if(browser.ie)l.fireEvent("saveScene",!0,!0);else{if(/h\d/i.test(s)){if(browser.gecko)domUtils.findParentByTagName(t,["h1","h2","h3","h4","h5","h6","blockquote","caption","table"],!0)||(l.document.execCommand("formatBlock",!1,"<p>"),i=1);else if(1==t.nodeType){var o,t=l.document.createTextNode("");if(n.insertNode(t),o=domUtils.findParentByTagName(t,"div",!0)){for(var r=l.document.createElement("p");o.firstChild;)r.appendChild(o.firstChild);o.parentNode.insertBefore(r,o),domUtils.remove(o),n.setStartBefore(t).setCursor(),i=1}domUtils.remove(t)}l.undoManger&&i&&l.undoManger.save()}browser.opera&&n.select()}}}),l.addListener("keydown",function(e,t){if(13==(t.keyCode||t.which))if(l.fireEvent("beforeenterkeydown"))domUtils.preventDefault(t);else{l.fireEvent("saveScene",!0,!0),s="";var i=l.selection.getRange();if(!i.collapsed){var n=i.startContainer,o=i.endContainer,r=domUtils.findParentByTagName(n,"td",!0),o=domUtils.findParentByTagName(o,"td",!0);if(r&&o&&r!==o||!r&&o||r&&!o)return void(t.preventDefault?t.preventDefault():t.returnValue=!1)}if("p"==d)browser.ie||((n=domUtils.findParentByTagName(i.startContainer,["ol","ul","p","h1","h2","h3","h4","h5","h6","blockquote","caption"],!0))||browser.opera?(s=n.tagName,"p"==n.tagName.toLowerCase()&&browser.gecko&&domUtils.removeDirtyAttr(n)):(l.document.execCommand("formatBlock",!1,"<p>"),browser.gecko&&(i=l.selection.getRange(),(n=domUtils.findParentByTagName(i.startContainer,"p",!0))&&domUtils.removeDirtyAttr(n))));else if(t.preventDefault?t.preventDefault():t.returnValue=!1,i.collapsed)a=i.document.createElement("br"),i.insertNode(a),a.parentNode.lastChild===a?(a.parentNode.insertBefore(a.cloneNode(!0),a),i.setStartBefore(a)):i.setStartAfter(a),i.setCursor();else if(i.deleteContents(),1==(n=i.startContainer).nodeType&&(n=n.childNodes[i.startOffset])){for(;1==n.nodeType;){if(dtd.$empty[n.tagName])return i.setStartBefore(n).setCursor(),l.undoManger&&l.undoManger.save(),!1;if(!n.firstChild){var a=i.document.createElement("br");return n.appendChild(a),i.setStart(n,0).setCursor(),l.undoManger&&l.undoManger.save(),!1}n=n.firstChild}n===i.startContainer.childNodes[i.startOffset]?(a=i.document.createElement("br"),i.insertNode(a).setCursor()):i.setStart(n,0).setCursor()}else a=i.document.createElement("br"),i.insertNode(a).setStartAfter(a).setCursor()}})},UE.plugins.keystrokes=function(){var v=this,y=!0;v.addListener("keydown",function(e,t){var i=t.keyCode||t.which,n=v.selection.getRange();if(!n.collapsed&&!(t.ctrlKey||t.shiftKey||t.altKey||t.metaKey)&&(65<=i&&i<=90||48<=i&&i<=57||96<=i&&i<=111||{13:1,8:1,46:1}[i])){var o=n.startContainer;if(domUtils.isFillChar(o)&&n.setStartBefore(o),o=n.endContainer,domUtils.isFillChar(o)&&n.setEndAfter(o),n.txtToElmBoundary(),n.endContainer&&1==n.endContainer.nodeType&&(o=n.endContainer.childNodes[n.endOffset])&&domUtils.isBr(o)&&n.setEndAfter(o),0==n.startOffset&&(o=n.startContainer,domUtils.isBoundaryNode(o,"firstChild")&&(o=n.endContainer,n.endOffset==(3==o.nodeType?o.nodeValue:o.childNodes).length&&domUtils.isBoundaryNode(o,"lastChild"))))return v.fireEvent("saveScene"),v.body.innerHTML="<p>"+(browser.ie?"":"<br/>")+"</p>",n.setStart(v.body.firstChild,0).setCursor(!1,!0),void v._selectionChange()}if(i==keymap.Backspace){if(n=v.selection.getRange(),y=n.collapsed,v.fireEvent("delkeydown",t))return;if(n.collapsed&&n.inFillChar()&&(f=n.startContainer,domUtils.isFillChar(f)?(n.setStartBefore(f).shrinkBoundary(!0).collapse(!0),domUtils.remove(f)):(f.nodeValue=f.nodeValue.replace(new RegExp("^"+domUtils.fillChar),""),n.startOffset--,n.collapse(!0).select(!0))),f=n.getClosedNode())return v.fireEvent("saveScene"),n.setStartBefore(f),domUtils.remove(f),n.setCursor(),v.fireEvent("saveScene"),void domUtils.preventDefault(t);if(!browser.ie&&(f=domUtils.findParentByTagName(n.startContainer,"table",!0),h=domUtils.findParentByTagName(n.endContainer,"table",!0),f&&!h||!f&&h||f!==h))return void t.preventDefault()}if(i==keymap.Tab){var r={ol:1,ul:1,table:1};if(v.fireEvent("tabkeydown",t))return void domUtils.preventDefault(t);var a=v.selection.getRange();v.fireEvent("saveScene");for(var s=0,l="",d=v.options.tabSize||4,c=v.options.tabNode||"&nbsp;";s<d;s++)l+=c;var u=v.document.createElement("span");if(u.innerHTML=l+domUtils.fillChar,a.collapsed)a.insertNode(u.cloneNode(!0).firstChild).setCursor(!0);else{function m(e){return domUtils.isBlockElm(e)&&!r[e.tagName.toLowerCase()]}var f=domUtils.findParent(a.startContainer,m,!0),h=domUtils.findParent(a.endContainer,m,!0);if(f&&h&&f===h)a.deleteContents(),a.insertNode(u.cloneNode(!0).firstChild).setCursor(!0);else{h=a.createBookmark();a.enlarge(!0);for(var p=a.createBookmark(),g=domUtils.getNextDomNode(p.start,!1,m);g&&!(domUtils.getPosition(g,p.end)&domUtils.POSITION_FOLLOWING);)g.insertBefore(u.cloneNode(!0).firstChild,g.firstChild),g=domUtils.getNextDomNode(g,!1,m);a.moveToBookmark(p).moveToBookmark(h).select()}}domUtils.preventDefault(t)}if(browser.gecko&&46==i&&(a=v.selection.getRange()).collapsed&&(f=a.startContainer,domUtils.isEmptyBlock(f))){for(var b=f.parentNode;1==domUtils.getChildCount(b)&&!domUtils.isBody(b);)b=(f=b).parentNode;f===b.lastChild&&t.preventDefault()}else browser.chrome&&v.on("keydown",function(e,t){var i=t.keyCode||t.which;if((t.metaKey&&t.altKey||t.ctrlKey&&t.shiftKey)&&73==i)return!0})}),v.addListener("keyup",function(e,t){var i,n;if((t.keyCode||t.which)==keymap.Backspace&&!this.fireEvent("delkeyup")){if((i=this.selection.getRange()).collapsed){if((n=domUtils.findParentByTagName(i.startContainer,["h1","h2","h3","h4","h5","h6"],!0))&&domUtils.isEmptyBlock(n)){t=n.previousSibling;if(t&&"TABLE"!=t.nodeName)return domUtils.remove(n),void i.setStartAtLast(t).setCursor(!1,!0);t=n.nextSibling;if(t&&"TABLE"!=t.nodeName)return domUtils.remove(n),void i.setStartAtFirst(t).setCursor(!1,!0)}domUtils.isBody(i.startContainer)&&(n=domUtils.createElement(this.document,"p",{innerHTML:browser.ie?domUtils.fillChar:"<br/>"}),i.insertNode(n).setStart(n,0).setCursor(!1,!0))}!y&&(3==i.startContainer.nodeType||1==i.startContainer.nodeType&&domUtils.isEmptyBlock(i.startContainer))&&(browser.ie?(n=i.document.createElement("span"),i.insertNode(n).setStartBefore(n).collapse(!0),i.select(),domUtils.remove(n)):i.select())}})},UE.plugins.fiximgclick=(dF=!1,cF=[[0,0,-1,-1],[0,0,0,-1],[0,0,1,-1],[0,0,-1,0],[0,0,1,0],[0,0,-1,1],[0,0,0,1],[0,0,1,1]],eF.prototype={init:function(e){var t=this;t.editor=e,t.startPos=this.prePos={x:0,y:0},t.dragId=-1;var n=[],o=t.cover=document.createElement("div"),e=t.resizer=document.createElement("div");for(o.id=t.editor.ui.id+"_imagescale_cover",o.style.cssText="position:absolute;display:none;z-index:"+t.editor.options.zIndex+";filter:alpha(opacity=0); opacity:0;background:#CCC;",domUtils.on(o,"mousedown click",function(){t.hide()}),i=0;i<8;i++)n.push('<span class="edui-editor-imagescale-hand'+i+'"></span>');e.id=t.editor.ui.id+"_imagescale",e.className="edui-editor-imagescale",e.innerHTML=n.join(""),e.style.cssText+=";display:none;border:1px solid #3b77ff;z-index:"+t.editor.options.zIndex+";",t.editor.ui.getDom().appendChild(o),t.editor.ui.getDom().appendChild(e),t.initStyle(),t.initEvents()},initStyle:function(){utils.cssRule("imagescale",".edui-editor-imagescale{display:none;position:absolute;border:1px solid #38B2CE;cursor:hand;-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;}.edui-editor-imagescale span{position:absolute;width:6px;height:6px;overflow:hidden;font-size:0px;display:block;background-color:#3C9DD0;}.edui-editor-imagescale .edui-editor-imagescale-hand0{cursor:nw-resize;top:0;margin-top:-4px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand1{cursor:n-resize;top:0;margin-top:-4px;left:50%;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand2{cursor:ne-resize;top:0;margin-top:-4px;left:100%;margin-left:-3px;}.edui-editor-imagescale .edui-editor-imagescale-hand3{cursor:w-resize;top:50%;margin-top:-4px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand4{cursor:e-resize;top:50%;margin-top:-4px;left:100%;margin-left:-3px;}.edui-editor-imagescale .edui-editor-imagescale-hand5{cursor:sw-resize;top:100%;margin-top:-3px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand6{cursor:s-resize;top:100%;margin-top:-3px;left:50%;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand7{cursor:se-resize;top:100%;margin-top:-3px;left:100%;margin-left:-3px;}")},initEvents:function(){this.startPos.x=this.startPos.y=0,this.isDraging=!1},_eventHandler:function(e){var t,i=this;switch(e.type){case"mousedown":-1!=(t=e.target||e.srcElement).className.indexOf("edui-editor-imagescale-hand")&&-1==i.dragId&&(i.dragId=t.className.slice(-1),i.startPos.x=i.prePos.x=e.clientX,i.startPos.y=i.prePos.y=e.clientY,domUtils.on(i.doc,"mousemove",i.proxy(i._eventHandler,i)));break;case"mousemove":-1!=i.dragId&&(i.updateContainerStyle(i.dragId,{x:e.clientX-i.prePos.x,y:e.clientY-i.prePos.y}),i.prePos.x=e.clientX,i.prePos.y=e.clientY,dF=!0,i.updateTargetElement());break;case"mouseup":-1!=i.dragId&&(i.updateContainerStyle(i.dragId,{x:e.clientX-i.prePos.x,y:e.clientY-i.prePos.y}),i.updateTargetElement(),i.target.parentNode&&i.attachTo(i.target),i.dragId=-1),domUtils.un(i.doc,"mousemove",i.proxy(i._eventHandler,i)),dF&&(dF=!1,i.editor.fireEvent("contentchange"))}},updateTargetElement:function(){var e=this;domUtils.setStyles(e.target,{width:e.resizer.style.width,height:e.resizer.style.height}),e.target.width=parseInt(e.resizer.style.width),e.target.height=parseInt(e.resizer.style.height),e.attachTo(e.target)},updateContainerStyle:function(e,t){var i,n=this,o=n.resizer;0!=cF[e][0]&&(i=parseInt(o.style.left)+t.x,o.style.left=n._validScaledProp("left",i)+"px"),0!=cF[e][1]&&(i=parseInt(o.style.top)+t.y,o.style.top=n._validScaledProp("top",i)+"px"),0!=cF[e][2]&&(i=o.clientWidth+cF[e][2]*t.x,o.style.width=n._validScaledProp("width",i)+"px"),0!=cF[e][3]&&(i=o.clientHeight+cF[e][3]*t.y,o.style.height=n._validScaledProp("height",i)+"px")},_validScaledProp:function(e,t){var i=this.resizer,n=document;switch(t=isNaN(t)?0:t,e){case"left":return t<0?0:t+i.clientWidth>n.clientWidth?n.clientWidth-i.clientWidth:t;case"top":return t<0?0:t+i.clientHeight>n.clientHeight?n.clientHeight-i.clientHeight:t;case"width":return t<=0?1:t+i.offsetLeft>n.clientWidth?n.clientWidth-i.offsetLeft:t;case"height":return t<=0?1:t+i.offsetTop>n.clientHeight?n.clientHeight-i.offsetTop:t}},hideCover:function(){this.cover.style.display="none"},showCover:function(){var e=this,t=domUtils.getXY(e.editor.ui.getDom()),i=domUtils.getXY(e.editor.iframe);domUtils.setStyles(e.cover,{width:e.editor.iframe.offsetWidth+"px",height:e.editor.iframe.offsetHeight+"px",top:i.y-t.y+"px",left:i.x-t.x+"px",position:"absolute",display:""})},show:function(e){var t=this;t.resizer.style.display="block",e&&t.attachTo(e),domUtils.on(this.resizer,"mousedown",t.proxy(t._eventHandler,t)),domUtils.on(t.doc,"mouseup",t.proxy(t._eventHandler,t)),t.showCover(),t.editor.fireEvent("afterscaleshow",t),t.editor.fireEvent("saveScene")},hide:function(){var e=this;e.hideCover(),e.resizer.style.display="none",domUtils.un(e.resizer,"mousedown",e.proxy(e._eventHandler,e)),domUtils.un(e.doc,"mouseup",e.proxy(e._eventHandler,e)),e.editor.fireEvent("afterscalehide",e)},proxy:function(t,i){return function(e){return t.apply(i||this,arguments)}},attachTo:function(e){var t=this.target=e,i=this.resizer,n=domUtils.getXY(t),o=domUtils.getXY(this.editor.iframe),e=domUtils.getXY(i.parentNode);domUtils.setStyles(i,{width:t.width+"px",height:t.height+"px",left:o.x+n.x-this.editor.document.body.scrollLeft-e.x-parseInt(i.style.borderLeftWidth)+"px",top:o.y+n.y-this.editor.document.body.scrollTop-e.y-parseInt(i.style.borderTopWidth)+"px"})}},function(){var a,s=this;s.setOpt("imageScaleEnabled",!0),!browser.ie&&s.options.imageScaleEnabled&&s.addListener("click",function(e,t){var i,n,o,r=s.selection.getRange().getClosedNode();r&&"IMG"==r.tagName&&"false"!=s.body.contentEditable?r.getAttribute("anchorname")||domUtils.hasClass(r,"loadingclass")||domUtils.hasClass(r,"loaderrorclass")||(a||((a=new eF).init(s),s.ui.getDom().appendChild(a.resizer),n=function(e){a.hide(),a.target&&s.selection.getRange().selectNode(a.target).select()},o=function(e){e=e.target||e.srcElement;!e||void 0!==e.className&&-1!=e.className.indexOf("edui-editor-imagescale")||n()},s.addListener("afterscaleshow",function(e){s.addListener("beforekeydown",n),s.addListener("beforemousedown",o),domUtils.on(document,"keydown",n),domUtils.on(document,"mousedown",o),s.selection.getNative().removeAllRanges()}),s.addListener("afterscalehide",function(e){s.removeListener("beforekeydown",n),s.removeListener("beforemousedown",o),domUtils.un(document,"keydown",n),domUtils.un(document,"mousedown",o);var t=a.target;t.parentNode&&s.selection.getRange().selectNode(t).select()}),domUtils.on(a.resizer,"mousedown",function(e){s.selection.getNative().removeAllRanges();var t=e.target||e.srcElement;t&&-1==t.className.indexOf("edui-editor-imagescale-hand")&&(i=setTimeout(function(){a.hide(),a.target&&s.selection.getRange().selectNode(t).select()},200))}),domUtils.on(a.resizer,"mouseup",function(e){e=e.target||e.srcElement;e&&-1==e.className.indexOf("edui-editor-imagescale-hand")&&clearTimeout(i)})),a.show(r)):a&&"none"!=a.resizer.style.display&&a.hide()}),browser.webkit&&s.addListener("click",function(e,t){"IMG"==t.target.tagName&&"false"!=s.body.contentEditable&&new dom.Range(s.document).selectNode(t.target).select()})}),UE.plugin.register("autolink",function(){return browser.ie?{}:{bindEvents:{reset:function(){},keydown:function(e,t){var i=this,n=t.keyCode||t.which;if(32==n||13==n){for(var o,r,a,s=i.selection.getNative(),l=s.getRangeAt(0).cloneRange(),d=l.startContainer;1==d.nodeType&&0<l.startOffset&&(d=l.startContainer.childNodes[l.startOffset-1]);)l.setStart(d,(1==d.nodeType?d.childNodes:d.nodeValue).length),l.collapse(!0),d=l.startContainer;do{if(0==l.startOffset){for(d=l.startContainer.previousSibling;d&&1==d.nodeType;)d=d.lastChild;if(!d||domUtils.isFillChar(d))break;o=d.nodeValue.length}else d=l.startContainer,o=l.startOffset}while(l.setStart(d,o-1),160!=(r=l.toString().charCodeAt(0))&&32!=r);if(l.toString().replace(new RegExp(domUtils.fillChar,"g"),"").match(/(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i)){for(;l.toString().length&&!/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(l.toString());)try{l.setStart(l.startContainer,l.startOffset+1)}catch(e){for(d=l.startContainer;!(next=d.nextSibling);){if(domUtils.isBody(d))return;d=d.parentNode}l.setStart(next,0)}domUtils.findParentByTagName(l.startContainer,"a",!0)||(a=i.document.createElement("a"),t=i.document.createTextNode(" "),i.undoManger&&i.undoManger.save(),a.appendChild(l.extractContents()),a.href=a.innerHTML=a.innerHTML.replace(/<[^>]+>/g,""),n=a.getAttribute("href").replace(new RegExp(domUtils.fillChar,"g"),""),n=/^(?:https?:\/\/)/gi.test(n)?n:"http://"+n,a.setAttribute("_src",utils.html(n)),a.href=utils.html(n),l.insertNode(a),a.parentNode.insertBefore(t,a.nextSibling),l.setStart(t,0),l.collapse(!0),s.removeAllRanges(),s.addRange(l),i.undoManger&&i.undoManger.save())}}}}}},function(){var r={37:1,38:1,39:1,40:1,13:1,32:1};browser.ie&&this.addListener("keyup",function(e,t){var i=t.keyCode;if(r[i]){var n,t=this.selection.getRange(),o=t.startContainer;if(13==i){for(;o&&!domUtils.isBody(o)&&!domUtils.isBlockElm(o);)o=o.parentNode;o&&!domUtils.isBody(o)&&"P"==o.nodeName&&(n=o.previousSibling)&&1==n.nodeType&&(n=function(e){if(3==e.nodeType)return null;if("A"==e.nodeName)return e;for(var t=e.lastChild;t;){if("A"==t.nodeName)return t;if(3==t.nodeType){if(domUtils.isWhitespace(t)){t=t.previousSibling;continue}return null}t=t.lastChild}}(n))&&!n.getAttribute("_href")&&domUtils.remove(n,!0)}else 32==i?3==o.nodeType&&/^\s$/.test(o.nodeValue)&&(o=o.previousSibling)&&"A"==o.nodeName&&!o.getAttribute("_href")&&domUtils.remove(o,!0):(o=domUtils.findParentByTagName(o,"a",!0))&&!o.getAttribute("_href")&&(i=t.createBookmark(),domUtils.remove(o,!0),t.moveToBookmark(i).select(!0))}})}),UE.plugins.autoheight=function(){var i,n,e,o,t,r,a,s=this;function l(){var t=this;clearTimeout(e),o||(!t.queryCommandState||t.queryCommandState&&1!=t.queryCommandState("source"))&&(e=setTimeout(function(){for(var e=t.body.lastChild;e&&1!=e.nodeType;)e=e.previousSibling;e&&1==e.nodeType&&(e.style.clear="both",(n=Math.max(domUtils.getXY(e).y+e.offsetHeight+25,Math.max(a.minFrameHeight,a.initialFrameHeight)))!=r&&(n!==parseInt(t.iframe.parentNode.style.height)&&(t.iframe.parentNode.style.height=n+"px"),t.body.style.height=n+"px",r=n),domUtils.removeStyle(e,"clear"))},50))}function d(){s.window&&(null===t?t=s.window.scrollY:0==s.window.scrollY&&0!=t&&(s.window.scrollTo(0,0),t=null))}s.autoHeightEnabled=!1!==s.options.autoHeightEnabled,s.autoHeightEnabled&&(r=0,a=s.options,s.addListener("fullscreenchanged",function(e,t){o=t}),s.addListener("destroy",function(){domUtils.un(s.window,"scroll",d),s.removeListener("contentchange afterinserthtml keyup mouseup",l)}),s.enableAutoHeight=function(){var e,t=this;t.autoHeightEnabled&&(e=t.document,t.autoHeightEnabled=!0,i=e.body.style.overflowY,e.body.style.overflowY="hidden",t.addListener("contentchange afterinserthtml keyup mouseup",l),setTimeout(function(){l.call(t)},browser.gecko?100:0),t.fireEvent("autoheightchanged",t.autoHeightEnabled))},s.disableAutoHeight=function(){s.body.style.overflowY=i||"",s.removeListener("contentchange",l),s.removeListener("keyup",l),s.removeListener("mouseup",l),s.autoHeightEnabled=!1,s.fireEvent("autoheightchanged",s.autoHeightEnabled)},s.on("setHeight",function(){s.disableAutoHeight()}),s.addListener("ready",function(){var e;s.enableAutoHeight(),domUtils.on(browser.ie?s.body:s.document,browser.webkit?"dragover":"drop",function(){clearTimeout(e),e=setTimeout(function(){l.call(s)},100)}),domUtils.on(s.window,"scroll",d)}))},UE.plugins.autofloat=function(){var n=this,t=n.getLang();n.setOpt({topOffset:0});var i,o,r,a,s,l,d,c,u,m,e=!1!==n.options.autoFloatEnabled,f=n.options.topOffset;function h(){u=!0,c.parentNode&&c.parentNode.removeChild(c),o.style.cssText=i}function p(){var e,t=a(n.container),i=n.options.toolbarTopOffset||0;t.top<0&&t.bottom-o.offsetHeight>i?(e=domUtils.getXY(o),t=domUtils.getComputedStyle(o,"position"),i=domUtils.getComputedStyle(o,"left"),o.style.width=o.offsetWidth+"px",o.style.zIndex=+n.options.zIndex+1,o.parentNode.insertBefore(c,o),l||d&&browser.ie?("absolute"!=o.style.position&&(o.style.position="absolute"),o.style.top=(document.body.scrollTop||document.documentElement.scrollTop)-r+f+"px"):(browser.ie7Compat&&u&&(u=!1,o.style.left=domUtils.getXY(o).x-document.documentElement.getBoundingClientRect().left+2+"px"),"fixed"!=o.style.position&&(o.style.position="fixed",o.style.top=f+"px","absolute"!=t&&"relative"!=t||!parseFloat(i)||(o.style.left=e.x+"px")))):h()}e&&(s=UE.ui.uiUtils,l=browser.ie&&browser.version<=6,d=browser.quirks,c=document.createElement("div"),u=!0,n.unsetFloating=h,m=utils.defer(function(){p()},browser.ie?200:100,!0),n.addListener("destroy",function(){domUtils.un(window,["scroll","resize"],p),n.removeListener("keydown",m)}),n.addListener("ready",function(){var e;(UE.ui?n.ui:(alert(t.autofloatMsg),0))&&(a=s.getClientRect,o=n.ui.getDom("toolbarbox"),r=a(o).top,i=o.style.cssText,c.style.height=o.offsetHeight+"px",l&&((e=document.body.style).backgroundImage='url("about:blank")',e.backgroundAttachment="fixed"),domUtils.on(window,["scroll","resize"],p),n.addListener("keydown",m),n.addListener("beforefullscreenchange",function(e,t){t&&h()}),n.addListener("fullscreenchanged",function(e,t){t||p()}),n.addListener("sourcemodechanged",function(e,t){setTimeout(function(){p()},0)}),n.addListener("clearDoc",function(){setTimeout(function(){p()},0)}))}))},UE.plugins.video=function(){var d=this;function l(e,t,i,n,o,r,a){switch(a){case"iframe":l='<iframe class="'+r+'"  src="'+utils.html(e)+'" width="'+t+'" height="'+i+'" frameborder=0 allowfullscreen>';break;case"image":l="<img "+(n?'id="'+n+'"':"")+' width="'+t+'" height="'+i+'" _url="'+e+'" class="" src="'+d.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" style="background:url('+d.options.UEDITOR_HOME_URL+"themes/default/images/videologo.gif) no-repeat center center; border:1px solid gray;"+(o?"float:"+o+";":"")+'" />';break;case"embed":l='<embed type="application/x-shockwave-flash" class="'+r+'" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+utils.html(e)+'" width="'+t+'" height="'+i+'"'+(o?' style="float:'+o+'"':"")+' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >';break;case"video":var s=e.substr(e.lastIndexOf(".")+1),l="<video"+(n?' id="'+n+'"':"")+' class="'+r+'" '+(o?' style="float:'+o+'"':"")+' controls preload="none" width="'+t+'" height="'+i+'" src="'+e+'" data-setup="{}"><source src="'+e+'" type="video/'+(s="ogv"==s?"ogg":s)+'" /></video>'}return l}function t(e,n){utils.each(e.getNodesByTagName(n?"img":"embed video"),function(e){var t,i=e.getAttr("class");i&&-1!=i.indexOf("edui-faked-video")&&(t=l(n?e.getAttr("_url"):e.getAttr("src"),e.getAttr("width"),e.getAttr("height"),null,e.getStyle("float")||"",i,n?"embed":"image"),e.parentNode.replaceChild(UE.uNode.createElement(t),e)),i&&-1!=i.indexOf("edui-upload-video")&&(t=l(n?e.getAttr("_url"):e.getAttr("src"),e.getAttr("width"),e.getAttr("height"),null,e.getStyle("float")||"",i,n?"video":"image"),e.parentNode.replaceChild(UE.uNode.createElement(t),e))})}d.addOutputRule(function(e){t(e,!0)}),d.addInputRule(function(e){t(e)}),d.commands.insertvideo={execCommand:function(e,t,i){if(t=utils.isArray(t)?t:[t],!0!==d.fireEvent("beforeinsertvideo",t)){for(var n,o=[],r=0,a=t.length;r<a;r++){var s="iframe";(n=t[r]).url.match(/.mp4$/)&&(s="video"),o.push(l(n.url,n.width||420,n.height||280,"tmpVideo"+r,null,"iframe"==s?"edui-video-iframe":"edui-video-video",s))}d.execCommand("inserthtml",o.join(""),!0),this.selection.getRange(),d.fireEvent("afterinsertvideo",t)}},queryCommandState:function(){var e=d.selection.getRange().getClosedNode();return!e||"edui-video-iframe"!=e.className&&-1==e.className.indexOf("edui-video-iframe")&&"edui-video-video"!=e.className&&-1==e.className.indexOf("edui-video-video")?0:1}}},UETable=UE.UETable=function(e){this.table=e,this.indexTable=[],this.selectedTds=[],this.cellsRange={},this.update(e)},UETable.removeSelectedClass=function(e){utils.each(e,function(e){domUtils.removeClasses(e,"selectTdClass")})},UETable.addSelectedClass=function(e){utils.each(e,function(e){domUtils.addClass(e,"selectTdClass")})},UETable.isEmptyBlock=function(e){var t,i=new RegExp(domUtils.fillChar,"g");if(0<e[browser.ie?"innerText":"textContent"].replace(/^\s*$/,"").replace(i,"").length)return 0;for(t in dtd.$isNotEmpty)if(dtd.$isNotEmpty.hasOwnProperty(t)&&e.getElementsByTagName(t).length)return 0;return 1},UETable.getWidth=function(e){return e?parseInt(domUtils.getComputedStyle(e,"width"),10):0},UETable.getTableCellAlignState=function(e){utils.isArray(e)||(e=[e]);var i,n={},o=["align","valign"],r=!0;return utils.each(e,function(t){return utils.each(o,function(e){if(i=t.getAttribute(e),!n[e]&&i)n[e]=i;else if(!n[e]||i!==n[e])return r=!1}),r}),r?n:null},UETable.getTableItemsByRange=function(e){var t=e.selection.getStart(),i=(t=t&&t.id&&0===t.id.indexOf("_baidu_bookmark_start_")&&t.nextSibling?t.nextSibling:t)&&domUtils.findParentByTagName(t,["td","th"],!0),n=i&&i.parentNode,e=n&&domUtils.findParentByTagName(n,["table"]),t=e&&e.getElementsByTagName("caption")[0];return{cell:i,tr:n,table:e,caption:t}},UETable.getUETableBySelected=function(e){e=UETable.getTableItemsByRange(e).table;return e&&e.ueTable&&e.ueTable.selectedTds.length?e.ueTable:null},UETable.getDefaultValue=function(e,t){var i,n,o={thin:"0px",medium:"1px",thick:"2px"};if(t)return r=t.getElementsByTagName("td")[0],a=domUtils.getComputedStyle(t,"border-left-width"),s=parseInt(o[a]||a,10),a=domUtils.getComputedStyle(r,"padding-left"),i=parseInt(o[a]||a,10),a=domUtils.getComputedStyle(r,"border-left-width"),{tableBorder:s,tdPadding:i,tdBorder:n=parseInt(o[a]||a,10)};(t=e.document.createElement("table")).insertRow(0).insertCell(0).innerHTML="xxx",e.body.appendChild(t);var r=t.getElementsByTagName("td")[0],a=domUtils.getComputedStyle(t,"border-left-width"),s=parseInt(o[a]||a,10);return a=domUtils.getComputedStyle(r,"padding-left"),i=parseInt(o[a]||a,10),a=domUtils.getComputedStyle(r,"border-left-width"),n=parseInt(o[a]||a,10),domUtils.remove(t),{tableBorder:s,tdPadding:i,tdBorder:n}},UETable.getUETable=function(e){var t=e.tagName.toLowerCase();return(e="td"==t||"th"==t||"caption"==t?domUtils.findParentByTagName(e,"table",!0):e).ueTable||(e.ueTable=new UETable(e)),e.ueTable},UETable.cloneCell=function(e,t,i){if(!e||utils.isString(e))return this.table.ownerDocument.createElement(e||"td");var n=domUtils.hasClass(e,"selectTdClass");n&&domUtils.removeClasses(e,"selectTdClass");var o=e.cloneNode(!0);return t&&(o.rowSpan=o.colSpan=1),i||domUtils.removeAttributes(o,"width height"),i||domUtils.removeAttributes(o,"style"),o.style.borderLeftStyle="",o.style.borderTopStyle="",o.style.borderLeftColor=e.style.borderRightColor,o.style.borderLeftWidth=e.style.borderRightWidth,o.style.borderTopColor=e.style.borderBottomColor,o.style.borderTopWidth=e.style.borderBottomWidth,n&&domUtils.addClass(e,"selectTdClass"),o},UETable.prototype={getMaxRows:function(){for(var e,t=this.table.rows,i=1,n=0;e=t[n];n++){for(var o,r=1,a=0;o=e.cells[a++];)r=Math.max(o.rowSpan||1,r);i=Math.max(r+n,i)}return i},getMaxCols:function(){for(var e,t=this.table.rows,i=0,n={},o=0;e=t[o];o++){for(var r,a=0,s=0;r=e.cells[s++];)if(a+=r.colSpan||1,r.rowSpan&&1<r.rowSpan)for(var l=1;l<r.rowSpan;l++)n["row_"+(o+l)]?n["row_"+(o+l)]++:n["row_"+(o+l)]=r.colSpan||1;a+=n["row_"+o]||0,i=Math.max(a,i)}return i},getCellColIndex:function(e){},getHSideCell:function(e,t){try{var i,n,o=this.getCellInfo(e),r=this.selectedTds.length,a=this.cellsRange;return!t&&(r?!a.beginColIndex:!o.colIndex)||t&&(r?a.endColIndex==this.colsNum-1:o.colIndex==this.colsNum-1)?null:(i=r?a.beginRowIndex:o.rowIndex,n=t?r?a.endColIndex+1:o.colIndex+1:r?a.beginColIndex-1:o.colIndex<1?0:o.colIndex-1,this.getCell(this.indexTable[i][n].rowIndex,this.indexTable[i][n].cellIndex))}catch(e){}},getTabNextCell:function(e,t){var i,n=this.getCellInfo(e),t=t||n.rowIndex,n=n.colIndex+1+(n.colSpan-1);try{i=this.getCell(this.indexTable[t][n].rowIndex,this.indexTable[t][n].cellIndex)}catch(e){try{t=+t+1,n=0,i=this.getCell(this.indexTable[t][n].rowIndex,this.indexTable[t][n].cellIndex)}catch(e){}}return i},getVSideCell:function(e,t,i){try{var n,o,r=this.getCellInfo(e),a=this.selectedTds.length&&!i,s=this.cellsRange;return!t&&0==r.rowIndex||t&&(a?s.endRowIndex==this.rowsNum-1:r.rowIndex+r.rowSpan>this.rowsNum-1)?null:(n=t?a?s.endRowIndex+1:r.rowIndex+r.rowSpan:a?s.beginRowIndex-1:r.rowIndex-1,o=a?s.beginColIndex:r.colIndex,this.getCell(this.indexTable[n][o].rowIndex,this.indexTable[n][o].cellIndex))}catch(e){}},getSameEndPosCells:function(e,t){try{for(var i="x"===t.toLowerCase(),n=domUtils.getXY(e)[i?"x":"y"]+e["offset"+(i?"Width":"Height")],o=this.table.rows,r=[],a=0;a<this.rowsNum;a++)for(var s,l=o[a].cells,d=0;s=l[d++];){var c=domUtils.getXY(s)[i?"x":"y"]+s["offset"+(i?"Width":"Height")];if(n<c&&i)break;if((e==s||n==c)&&(1==s[i?"colSpan":"rowSpan"]&&r.push(s),i))break}return r}catch(e){}},setCellContent:function(e,t){e.innerHTML=t||(browser.ie?domUtils.fillChar:"<br />")},cloneCell:UETable.cloneCell,getSameStartPosXCells:function(e){try{for(var t=domUtils.getXY(e).x+e.offsetWidth,i=this.table.rows,n=[],o=0;o<this.rowsNum;o++)for(var r,a=i[o].cells,s=0;r=a[s++];){var l=domUtils.getXY(r).x;if(t<l)break;if(l==t&&1==r.colSpan){n.push(r);break}}return n}catch(e){}},update:function(e){this.table=e||this.table,this.selectedTds=[],this.cellsRange={},this.indexTable=[];for(var t=this.table.rows,i=this.getMaxRows(),n=i-t.length,o=this.getMaxCols();n--;)this.table.insertRow(t.length);this.rowsNum=i,this.colsNum=o;for(var r=0,a=t.length;r<a;r++)this.indexTable[r]=new Array(o);for(var s,l=0;s=t[l];l++)for(var d,c=0,u=s.cells;d=u[c];c++){d.rowSpan>i&&(d.rowSpan=i);for(var m=c,f=d.rowSpan||1,h=d.colSpan||1;this.indexTable[l][m];)m++;for(var p=0;p<f;p++)for(var g=0;g<h;g++)this.indexTable[l+p][m+g]={rowIndex:l,cellIndex:c,colIndex:m,rowSpan:f,colSpan:h}}for(p=0;p<i;p++)for(g=0;g<o;g++)void 0===this.indexTable[p][g]&&(d=(d=(s=t[p]).cells[s.cells.length-1])?d.cloneNode(!0):this.table.ownerDocument.createElement("td"),this.setCellContent(d),1!==d.colSpan&&(d.colSpan=1),1!==d.rowSpan&&(d.rowSpan=1),s.appendChild(d),this.indexTable[p][g]={rowIndex:p,cellIndex:d.cellIndex,colIndex:g,rowSpan:1,colSpan:1});var b=domUtils.getElementsByTagName(this.table,"td"),v=[];if(utils.each(b,function(e){domUtils.hasClass(e,"selectTdClass")&&v.push(e)}),v.length&&(e=v[0],b=v[v.length-1],e=this.getCellInfo(e),b=this.getCellInfo(b),this.selectedTds=v,this.cellsRange={beginRowIndex:e.rowIndex,beginColIndex:e.colIndex,endRowIndex:b.rowIndex+b.rowSpan-1,endColIndex:b.colIndex+b.colSpan-1}),!domUtils.hasClass(this.table.rows[0],"firstRow"))for(domUtils.addClass(this.table.rows[0],"firstRow"),r=1;r<this.table.rows.length;r++)domUtils.removeClasses(this.table.rows[r],"firstRow")},getCellInfo:function(e){if(e)for(var t=e.cellIndex,i=e.parentNode.rowIndex,n=this.indexTable[i],o=this.colsNum,r=t;r<o;r++){var a=n[r];if(a.rowIndex===i&&a.cellIndex===t)return a}},getCell:function(e,t){return e<this.rowsNum&&this.table.rows[e].cells[t]||null},deleteCell:function(e,t){t="number"==typeof t?t:e.parentNode.rowIndex,this.table.rows[t].deleteCell(e.cellIndex)},getCellsRange:function(e,t){try{var m=this,i=m.getCellInfo(e);if(e===t)return{beginRowIndex:i.rowIndex,beginColIndex:i.colIndex,endRowIndex:i.rowIndex+i.rowSpan-1,endColIndex:i.colIndex+i.colSpan-1};var n=m.getCellInfo(t);return function e(t,i,n,o){var r,a,s,l=t,d=i,c=n,u=o;if(0<t)for(a=i;a<o;a++)(s=(r=m.indexTable[t][a]).rowIndex)<t&&(l=Math.min(s,l));if(o<m.colsNum)for(s=t;s<n;s++)(a=(r=m.indexTable[s][o]).colIndex+r.colSpan-1)>o&&(u=Math.max(a,u));if(n<m.rowsNum)for(a=i;a<o;a++)(s=(r=m.indexTable[n][a]).rowIndex+r.rowSpan-1)>n&&(c=Math.max(s,c));if(0<i)for(s=t;s<n;s++)(a=(r=m.indexTable[s][i]).colIndex)<i&&(d=Math.min(r.colIndex,d));return l!=t||d!=i||c!=n||u!=o?e(l,d,c,u):{beginRowIndex:t,beginColIndex:i,endRowIndex:n,endColIndex:o}}(Math.min(i.rowIndex,n.rowIndex),Math.min(i.colIndex,n.colIndex),Math.max(i.rowIndex+i.rowSpan-1,n.rowIndex+n.rowSpan-1),Math.max(i.colIndex+i.colSpan-1,n.colIndex+n.colSpan-1))}catch(e){}},getCells:function(e){this.clearSelected();for(var t,i,n,o=e.beginRowIndex,r=e.beginColIndex,a=e.endRowIndex,s=e.endColIndex,l={},d=[],c=o;c<=a;c++)for(var u=r;u<=s;u++){var m=(i=(t=this.indexTable[c][u]).rowIndex)+"|"+(n=t.colIndex);if(!l[m]){if(l[m]=1,i<c||n<u||i+t.rowSpan-1>a||n+t.colSpan-1>s)return null;d.push(this.getCell(i,t.cellIndex))}}return d},clearSelected:function(){UETable.removeSelectedClass(this.selectedTds),this.selectedTds=[],this.cellsRange={}},setSelected:function(e){var t=this.getCells(e);UETable.addSelectedClass(t),this.selectedTds=t,this.cellsRange=e},isFullRow:function(){var e=this.cellsRange;return e.endColIndex-e.beginColIndex+1==this.colsNum},isFullCol:function(){var e=this.cellsRange,t=this.table.getElementsByTagName("th"),e=e.endRowIndex-e.beginRowIndex+1;return t.length?e==this.rowsNum||e==this.rowsNum-1:e==this.rowsNum},getNextCell:function(e,t,i){try{var n,o,r=this.getCellInfo(e),a=this.selectedTds.length&&!i,s=this.cellsRange;return!t&&0==r.rowIndex||t&&(a?s.endRowIndex==this.rowsNum-1:r.rowIndex+r.rowSpan>this.rowsNum-1)?null:(n=t?a?s.endRowIndex+1:r.rowIndex+r.rowSpan:a?s.beginRowIndex-1:r.rowIndex-1,o=a?s.beginColIndex:r.colIndex,this.getCell(this.indexTable[n][o].rowIndex,this.indexTable[n][o].cellIndex))}catch(e){}},getPreviewCell:function(e,t){try{var i,n,o=this.getCellInfo(e),r=this.selectedTds.length,a=this.cellsRange;return!t&&(r?!a.beginColIndex:!o.colIndex)||t&&(r?a.endColIndex==this.colsNum-1:o.rowIndex>this.colsNum-1)?null:(i=t?r?a.beginRowIndex:o.rowIndex<1?0:o.rowIndex-1:r?a.beginRowIndex:o.rowIndex,n=t?r?a.endColIndex+1:o.colIndex:r?a.beginColIndex-1:o.colIndex<1?0:o.colIndex-1,this.getCell(this.indexTable[i][n].rowIndex,this.indexTable[i][n].cellIndex))}catch(e){}},moveContent:function(e,t){if(!UETable.isEmptyBlock(t))if(UETable.isEmptyBlock(e))e.innerHTML=t.innerHTML;else{var i=e.lastChild;for(3!=i.nodeType&&dtd.$block[i.tagName]||e.appendChild(e.ownerDocument.createElement("br"));i=t.firstChild;)e.appendChild(i)}},mergeRight:function(e){var t=this.getCellInfo(e),i=t.colIndex+t.colSpan,n=this.indexTable[t.rowIndex][i],i=this.getCell(n.rowIndex,n.cellIndex);e.colSpan=t.colSpan+n.colSpan,e.removeAttribute("width"),this.moveContent(e,i),this.deleteCell(i,n.rowIndex),this.update()},mergeDown:function(e){var t=this.getCellInfo(e),i=t.rowIndex+t.rowSpan,n=this.indexTable[i][t.colIndex],i=this.getCell(n.rowIndex,n.cellIndex);e.rowSpan=t.rowSpan+n.rowSpan,e.removeAttribute("height"),this.moveContent(e,i),this.deleteCell(i,n.rowIndex),this.update()},mergeRange:function(){for(var e,t=this.cellsRange,i=this.getCell(t.beginRowIndex,this.indexTable[t.beginRowIndex][t.beginColIndex].cellIndex),n=this.getCells(t),o=0;e=n[o++];)e!==i&&(this.moveContent(i,e),this.deleteCell(e));if(i.rowSpan=t.endRowIndex-t.beginRowIndex+1,1<i.rowSpan&&i.removeAttribute("height"),i.colSpan=t.endColIndex-t.beginColIndex+1,1<i.colSpan&&i.removeAttribute("width"),i.rowSpan==this.rowsNum&&1!=i.colSpan&&(i.colSpan=1),i.colSpan==this.colsNum&&1!=i.rowSpan){var r=i.parentNode.rowIndex;if(this.table.deleteRow)for(var o=r+1,a=r+1,s=i.rowSpan;o<s;o++)this.table.deleteRow(a);else for(o=0,s=i.rowSpan-1;o<s;o++){var l=this.table.rows[r+1];l.parentNode.removeChild(l)}i.rowSpan=1}this.update()},insertRow:function(e,t){var i,n=this.colsNum,o=this.table,r=o.insertRow(e),a=null,s="string"==typeof t&&"TH"==t.toUpperCase();function l(e,t,i){var n;0==e?"TH"==(n=(i.nextSibling||i.previousSibling).cells[e]).tagName&&((n=t.ownerDocument.createElement("th")).appendChild(t.firstChild),i.insertBefore(n,t),domUtils.remove(t)):"TH"==t.tagName&&((n=t.ownerDocument.createElement("td")).appendChild(t.firstChild),i.insertBefore(n,t),domUtils.remove(t))}if(0==e||e==this.rowsNum){for(var d=0;d<n;d++)i=this.cloneCell(t,!0),this.setCellContent(i),i.getAttribute("vAlign")&&i.setAttribute("vAlign",i.getAttribute("vAlign")),r.appendChild(i),s||l(d,i,r);s&&(a=o.createTHead()).insertBefore(r,a.firstChild)}else for(var c=this.indexTable[e],d=0;d<n;d++){var u=c[d];u.rowIndex<e?(i=this.getCell(u.rowIndex,u.cellIndex)).rowSpan=u.rowSpan+1:(i=this.cloneCell(t,!0),this.setCellContent(i),r.appendChild(i)),s||l(d,i,r)}return this.update(),r},deleteRow:function(e){for(var t=this.table.rows[e],i=this.indexTable[e],n=this.colsNum,o=0,r=0;r<n;){var a,s,l=i[r],d=this.getCell(l.rowIndex,l.cellIndex);1<d.rowSpan&&l.rowIndex==e&&((a=d.cloneNode(!0)).rowSpan=d.rowSpan-1,a.innerHTML="",s=e+(d.rowSpan=1),l=this.table.rows[s],(s=this.getPreviewMergedCellsNum(s,r)-o)<r?domUtils.insertAfter(l.cells[r-s-1],a):l.cells.length&&l.insertBefore(a,l.cells[0]),o+=1),r+=d.colSpan||1}for(var c=[],u={},r=0;r<n;r++){var m=i[r].rowIndex,f=i[r].cellIndex,h=m+"_"+f;u[h]||(u[h]=1,d=this.getCell(m,f),c.push(d))}var p=[];utils.each(c,function(e){1==e.rowSpan?e.parentNode.removeChild(e):p.push(e)}),utils.each(p,function(e){e.rowSpan--}),t.parentNode.removeChild(t),this.update()},insertCol:function(e,t,i){var n,o,r,a=this.rowsNum,s=0,l=parseInt((this.table.offsetWidth-20*(this.colsNum+1)-(this.colsNum+1))/(this.colsNum+1),10),d="string"==typeof t&&"TH"==t.toUpperCase();function c(e,t,i){var n;0==e?"TH"==(n=t.nextSibling||t.previousSibling).tagName&&((n=t.ownerDocument.createElement("th")).appendChild(t.firstChild),i.insertBefore(n,t),domUtils.remove(t)):"TH"==t.tagName&&((n=t.ownerDocument.createElement("td")).appendChild(t.firstChild),i.insertBefore(n,t),domUtils.remove(t))}if(0==e||e==this.colsNum)for(;s<a;s++)r=(n=this.table.rows[s]).cells[0==e?e:n.cells.length],o=this.cloneCell(t,!0),this.setCellContent(o),o.setAttribute("vAlign",o.getAttribute("vAlign")),r&&o.setAttribute("width",r.getAttribute("width")),e?domUtils.insertAfter(n.cells[n.cells.length-1],o):n.insertBefore(o,n.cells[0]),d||c(s,o,n);else for(;s<a;s++){var u=this.indexTable[s][e];u.colIndex<e?(o=this.getCell(u.rowIndex,u.cellIndex)).colSpan=u.colSpan+1:(r=(n=this.table.rows[s]).cells[u.cellIndex],o=this.cloneCell(t,!0),this.setCellContent(o),o.setAttribute("vAlign",o.getAttribute("vAlign")),r&&o.setAttribute("width",r.getAttribute("width")),r?n.insertBefore(o,r):n.appendChild(o)),d||c(s,o,n)}this.update(),this.updateWidth(l,i||{tdPadding:10,tdBorder:1})},updateWidth:function(t,e){var i=this.table,e=UETable.getWidth(i)-2*e.tdPadding-e.tdBorder+t;e<i.ownerDocument.body.offsetWidth?i.setAttribute("width",e):(e=domUtils.getElementsByTagName(this.table,"td th"),utils.each(e,function(e){e.setAttribute("width",t)}))},deleteCol:function(e){for(var t=this.indexTable,i=this.table.rows,n=this.table.getAttribute("width"),o=0,r=this.rowsNum,a={},s=0;s<r;){var l=t[s][e],d=l.rowIndex+"_"+l.colIndex;a[d]||(a[d]=1,d=this.getCell(l.rowIndex,l.cellIndex),o=o||d&&parseInt(d.offsetWidth/d.colSpan,10).toFixed(0),1<d.colSpan?d.colSpan--:i[s].deleteCell(l.cellIndex),s+=l.rowSpan||1)}this.table.setAttribute("width",n-o),this.update()},splitToCells:function(e){var t=this,e=this.splitToRows(e);utils.each(e,function(e){t.splitToCols(e)})},splitToRows:function(e){var t=this.getCellInfo(e),i=t.rowIndex,n=t.colIndex,o=[];e.rowSpan=1,o.push(e);for(var r,a=i,s=i+t.rowSpan;a<s;a++)a!=i&&((r=this.table.rows[a].insertCell(n-this.getPreviewMergedCellsNum(a,n))).colSpan=t.colSpan,this.setCellContent(r),r.setAttribute("vAlign",e.getAttribute("vAlign")),r.setAttribute("align",e.getAttribute("align")),e.style.cssText&&(r.style.cssText=e.style.cssText),o.push(r));return this.update(),o},getPreviewMergedCellsNum:function(e,t){for(var i=this.indexTable[e],n=0,o=0;o<t;){var r=i[o].colSpan;n+=r-(i[o].rowIndex==e?1:0),o+=r}return n},splitToCols:function(e){var t=(e.offsetWidth/e.colSpan-22).toFixed(0),i=this.getCellInfo(e),n=i.rowIndex,o=i.colIndex,r=[];e.colSpan=1,e.setAttribute("width",t),r.push(e);for(var a,s,l,d=o,c=o+i.colSpan;d<c;d++)d!=o&&((s=(a=this.table.rows[n]).insertCell(this.indexTable[n][d].cellIndex+1)).rowSpan=i.rowSpan,this.setCellContent(s),s.setAttribute("vAlign",e.getAttribute("vAlign")),s.setAttribute("align",e.getAttribute("align")),s.setAttribute("width",t),e.style.cssText&&(s.style.cssText=e.style.cssText),"TH"==e.tagName&&((l=e.ownerDocument.createElement("th")).appendChild(s.firstChild),l.setAttribute("vAlign",e.getAttribute("vAlign")),l.rowSpan=s.rowSpan,a.insertBefore(l,s),domUtils.remove(s)),r.push(s));return this.update(),r},isLastCell:function(e,t,i){t=t||this.rowsNum,i=i||this.colsNum;e=this.getCellInfo(e);return e.rowIndex+e.rowSpan==t&&e.colIndex+e.colSpan==i},getLastCell:function(e){e=e||this.table.getElementsByTagName("td"),this.getCellInfo(e[0]);var t,i=this,n=e[0],o=n.parentNode,r=0,a=0;return utils.each(e,function(e){e.parentNode==o&&(a+=e.colSpan||1),r+=e.rowSpan*e.colSpan||1}),t=r/a,utils.each(e,function(e){if(i.isLastCell(e,t,a))return n=e,!1}),n},selectRow:function(e){var t=this.indexTable[e],e=this.getCell(t[0].rowIndex,t[0].cellIndex),t=this.getCell(t[this.colsNum-1].rowIndex,t[this.colsNum-1].cellIndex),t=this.getCellsRange(e,t);this.setSelected(t)},selectTable:function(){var e=this.table.getElementsByTagName("td"),e=this.getCellsRange(e[0],e[e.length-1]);this.setSelected(e)},setBackground:function(e,t){if("string"==typeof t)utils.each(e,function(e){e.style.backgroundColor=t});else if("object"==typeof t){t=utils.extend({repeat:!0,colorList:["#ddd","#fff"]},t);for(var i=this.getCellInfo(e[0]).rowIndex,n=0,o=t.colorList,r=0;l=e[r++];){var a=this.getCellInfo(l);l.style.backgroundColor=(s=i+n==a.rowIndex?n:++n,l=t.repeat,(a=o)[s]||(l?a[s%a.length]:""))}}var s,l},removeBackground:function(e){utils.each(e,function(e){e.style.backgroundColor=""})}},lO=UE.UETable,UE.commands.inserttable={queryCommandState:function(){return mO(this).table?-1:0},execCommand:function(e,t){t=t||utils.extend({},{numCols:this.options.defaultCols,numRows:this.options.defaultRows,tdvalign:this.options.tdvalign});var i=this.selection.getRange().startContainer,n=domUtils.findParent(i,function(e){return domUtils.isBlockElm(e)},!0)||this.body,i=oO(this),n=n.offsetWidth,i=Math.floor(n/t.numCols-2*i.tdPadding-i.tdBorder);t.tdvalign||(t.tdvalign=this.options.tdvalign),this.execCommand("inserthtml",function(e,t){for(var i=[],n=e.numRows,o=e.numCols,r=0;r<n;r++){i.push("<tr"+(0==r?' class="firstRow"':"")+">");for(var a=0;a<o;a++)i.push('<td width="'+t+'"  vAlign="'+e.tdvalign+'" >'+(browser.ie&&browser.version<11?domUtils.fillChar:"<br/>")+"</td>");i.push("</tr>")}return"<table><tbody>"+i.join("")+"</tbody></table>"}(t,i))}},UE.commands.insertparagraphbeforetable={queryCommandState:function(){return mO(this).cell?0:-1},execCommand:function(){var e,t=mO(this).table;t&&((e=this.document.createElement("p")).innerHTML=browser.ie?"&nbsp;":"<br />",t.parentNode.insertBefore(e,t),this.selection.getRange().setStart(e,0).setCursor())}},UE.commands.deletetable={queryCommandState:function(){var e=this.selection.getRange();return domUtils.findParentByTagName(e.startContainer,"table",!0)?0:-1},execCommand:function(e,t){var i,n=this.selection.getRange();(t=t||domUtils.findParentByTagName(n.startContainer,"table",!0))&&((i=t.nextSibling)||(i=domUtils.createElement(this.document,"p",{innerHTML:browser.ie?domUtils.fillChar:"<br/>"}),t.parentNode.insertBefore(i,t)),domUtils.remove(t),n=this.selection.getRange(),3==i.nodeType?n.setStartBefore(i):n.setStart(i,0),n.setCursor(!1,!0),this.fireEvent("tablehasdeleted"))}},UE.commands.cellalign={queryCommandState:function(){return rO(this).length?0:-1},execCommand:function(e,t){var i=rO(this);if(i.length)for(var n,o=0;n=i[o++];)n.setAttribute("align",t)}},UE.commands.cellvalign={queryCommandState:function(){return rO(this).length?0:-1},execCommand:function(e,t){var i=rO(this);if(i.length)for(var n,o=0;n=i[o++];)n.setAttribute("vAlign",t)}},UE.commands.insertcaption={queryCommandState:function(){var e=mO(this).table;return e&&0==e.getElementsByTagName("caption").length?1:-1},execCommand:function(){var e,t=mO(this).table;t&&((e=this.document.createElement("caption")).innerHTML=browser.ie?domUtils.fillChar:"<br/>",t.insertBefore(e,t.firstChild),this.selection.getRange().setStart(e,0).setCursor())}},UE.commands.deletecaption={queryCommandState:function(){var e=this.selection.getRange(),e=domUtils.findParentByTagName(e.startContainer,"table");return!e||0==e.getElementsByTagName("caption").length?-1:1},execCommand:function(){var e=this.selection.getRange(),e=domUtils.findParentByTagName(e.startContainer,"table");e&&(domUtils.remove(e.getElementsByTagName("caption")[0]),this.selection.getRange().setStart(e.rows[0].cells[0],0).setCursor())}},UE.commands.inserttitle={queryCommandState:function(){var e=mO(this).table;if(e){e=e.rows[0];return"th"!=e.cells[e.cells.length-1].tagName.toLowerCase()?0:-1}return-1},execCommand:function(){var e=mO(this).table;e&&pO(e).insertRow(0,"th");e=e.getElementsByTagName("th")[0];this.selection.getRange().setStart(e,0).setCursor(!1,!0)}},UE.commands.deletetitle={queryCommandState:function(){var e=mO(this).table;if(e){e=e.rows[0];return"th"==e.cells[e.cells.length-1].tagName.toLowerCase()?0:-1}return-1},execCommand:function(){var e=mO(this).table;e&&domUtils.remove(e.rows[0]);e=e.getElementsByTagName("td")[0];this.selection.getRange().setStart(e,0).setCursor(!1,!0)}},UE.commands.inserttitlecol={queryCommandState:function(){var e=mO(this).table;return!e||e.rows[e.rows.length-1].getElementsByTagName("th").length?-1:0},execCommand:function(e){var t=mO(this).table;t&&pO(t).insertCol(0,"th"),qO(t,this);t=t.getElementsByTagName("th")[0];this.selection.getRange().setStart(t,0).setCursor(!1,!0)}},UE.commands.deletetitlecol={queryCommandState:function(){var e=mO(this).table;return e&&e.rows[e.rows.length-1].getElementsByTagName("th").length?0:-1},execCommand:function(){var e=mO(this).table;if(e)for(var t=0;t<e.rows.length;t++)domUtils.remove(e.rows[t].children[0]);qO(e,this);var i=e.getElementsByTagName("td")[0];this.selection.getRange().setStart(i,0).setCursor(!1,!0)}},UE.commands.mergeright={queryCommandState:function(e){var t=mO(this),i=t.table,n=t.cell;if(!i||!n)return-1;var o=pO(i);if(o.selectedTds.length)return-1;var r=o.getCellInfo(n),t=r.colIndex+r.colSpan;if(t>=o.colsNum)return-1;t=o.indexTable[r.rowIndex][t],i=i.rows[t.rowIndex].cells[t.cellIndex];return i&&n.tagName==i.tagName&&t.rowIndex==r.rowIndex&&t.rowSpan==r.rowSpan?0:-1},execCommand:function(e){var t=this.selection.getRange(),i=t.createBookmark(!0),n=mO(this).cell;pO(n).mergeRight(n),t.moveToBookmark(i).select()}},UE.commands.mergedown={queryCommandState:function(e){var t=mO(this),i=t.table,n=t.cell;if(!i||!n)return-1;var o=pO(i);if(o.selectedTds.length)return-1;var r=o.getCellInfo(n),t=r.rowIndex+r.rowSpan;if(t>=o.rowsNum)return-1;t=o.indexTable[t][r.colIndex],i=i.rows[t.rowIndex].cells[t.cellIndex];return i&&n.tagName==i.tagName&&t.colIndex==r.colIndex&&t.colSpan==r.colSpan?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this).cell;pO(i).mergeDown(i),e.moveToBookmark(t).select()}},UE.commands.mergecells={queryCommandState:function(){return nO(this)?0:-1},execCommand:function(){var e,t=nO(this);t&&t.selectedTds.length&&(e=t.selectedTds[0],t.mergeRange(),t=this.selection.getRange(),domUtils.isEmptyBlock(e)?t.setStart(e,0).collapse(!0):t.selectNodeContents(e),t.select())}},UE.commands.insertrow={queryCommandState:function(){var e=mO(this),t=e.cell;return t&&("TD"==t.tagName||"TH"==t.tagName&&e.tr!==e.table.rows[0])&&pO(e.table).rowsNum<this.options.maxRowNum?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this),n=i.cell,o=i.table,r=pO(o),i=r.getCellInfo(n);if(r.selectedTds.length)for(var a=r.cellsRange,s=0,l=a.endRowIndex-a.beginRowIndex+1;s<l;s++)r.insertRow(a.beginRowIndex,n);else r.insertRow(i.rowIndex,n);e.moveToBookmark(t).select(),"enabled"===o.getAttribute("interlaced")&&this.fireEvent("interlacetable",o)}},UE.commands.insertrownext={queryCommandState:function(){var e=mO(this),t=e.cell;return t&&"TD"==t.tagName&&pO(e.table).rowsNum<this.options.maxRowNum?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this),n=i.cell,o=i.table,r=pO(o),i=r.getCellInfo(n);if(r.selectedTds.length)for(var a=r.cellsRange,s=0,l=a.endRowIndex-a.beginRowIndex+1;s<l;s++)r.insertRow(a.endRowIndex+1,n);else r.insertRow(i.rowIndex+i.rowSpan,n);e.moveToBookmark(t).select(),"enabled"===o.getAttribute("interlaced")&&this.fireEvent("interlacetable",o)}},UE.commands.deleterow={queryCommandState:function(){return mO(this).cell?0:-1},execCommand:function(){var e=mO(this).cell,t=pO(e),i=t.cellsRange,n=t.getCellInfo(e),o=t.getVSideCell(e),r=t.getVSideCell(e,!0),a=this.selection.getRange();if(utils.isEmptyObject(i))t.deleteRow(n.rowIndex);else for(var s=i.beginRowIndex;s<i.endRowIndex+1;s++)t.deleteRow(i.beginRowIndex);var l,e=t.table;e.getElementsByTagName("td").length?1==n.rowSpan||n.rowSpan==i.endRowIndex-i.beginRowIndex+1?(r||o)&&a.selectNodeContents(r||o).setCursor(!1,!0):(l=t.getCell(n.rowIndex,t.indexTable[n.rowIndex][n.colIndex].cellIndex))&&a.selectNodeContents(l).setCursor(!1,!0):(l=e.nextSibling,domUtils.remove(e),l&&a.setStart(l,0).setCursor(!1,!0)),"enabled"===e.getAttribute("interlaced")&&this.fireEvent("interlacetable",e)}},UE.commands.insertcol={queryCommandState:function(e){var t=mO(this),i=t.cell;return i&&("TD"==i.tagName||"TH"==i.tagName&&i!==t.tr.cells[0])&&pO(t.table).colsNum<this.options.maxColNum?0:-1},execCommand:function(e){var t=this.selection.getRange(),i=t.createBookmark(!0);if(-1!=this.queryCommandState(e)){var n=mO(this).cell,o=pO(n),e=o.getCellInfo(n);if(o.selectedTds.length)for(var r=o.cellsRange,a=0,s=r.endColIndex-r.beginColIndex+1;a<s;a++)o.insertCol(r.beginColIndex,n);else o.insertCol(e.colIndex,n);t.moveToBookmark(i).select(!0)}}},UE.commands.insertcolnext={queryCommandState:function(){var e=mO(this);return e.cell&&pO(e.table).colsNum<this.options.maxColNum?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this).cell,n=pO(i),o=n.getCellInfo(i);if(n.selectedTds.length)for(var r=n.cellsRange,a=0,s=r.endColIndex-r.beginColIndex+1;a<s;a++)n.insertCol(r.endColIndex+1,i);else n.insertCol(o.colIndex+o.colSpan,i);e.moveToBookmark(t).select()}},UE.commands.deletecol={queryCommandState:function(){return mO(this).cell?0:-1},execCommand:function(){var e=mO(this).cell,t=pO(e),i=t.cellsRange,n=t.getCellInfo(e),o=t.getHSideCell(e),r=t.getHSideCell(e,!0);if(utils.isEmptyObject(i))t.deleteCol(n.colIndex);else for(var a=i.beginColIndex;a<i.endColIndex+1;a++)t.deleteCol(i.beginColIndex);var s=t.table,n=this.selection.getRange();s.getElementsByTagName("td").length?domUtils.inDoc(e,this.document)?n.setStart(e,0).setCursor(!1,!0):r&&domUtils.inDoc(r,this.document)?n.selectNodeContents(r).setCursor(!1,!0):o&&domUtils.inDoc(o,this.document)&&n.selectNodeContents(o).setCursor(!0,!0):(o=s.nextSibling,domUtils.remove(s),o&&n.setStart(o,0).setCursor(!1,!0))}},UE.commands.splittocells={queryCommandState:function(){var e=mO(this),t=e.cell;return t&&!(0<pO(e.table).selectedTds.length)&&t&&(1<t.colSpan||1<t.rowSpan)?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this).cell;pO(i).splitToCells(i),e.moveToBookmark(t).select()}},UE.commands.splittorows={queryCommandState:function(){var e=mO(this),t=e.cell;return t&&!(0<pO(e.table).selectedTds.length)&&t&&1<t.rowSpan?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this).cell;pO(i).splitToRows(i),e.moveToBookmark(t).select()}},UE.commands.splittocols={queryCommandState:function(){var e=mO(this),t=e.cell;return t&&!(0<pO(e.table).selectedTds.length)&&t&&1<t.colSpan?0:-1},execCommand:function(){var e=this.selection.getRange(),t=e.createBookmark(!0),i=mO(this).cell;pO(i).splitToCols(i),e.moveToBookmark(t).select()}},UE.commands.adaptbytext=UE.commands.adaptbywindow={queryCommandState:function(){return mO(this).table?0:-1},execCommand:function(e){var t=mO(this).table;t&&("adaptbywindow"==e?qO(t,this):(e=domUtils.getElementsByTagName(t,"td th"),utils.each(e,function(e){e.removeAttribute("width")}),t.removeAttribute("width")))}},UE.commands.averagedistributecol={queryCommandState:function(){var e=nO(this);return e&&(e.isFullRow()||e.isFullCol())?0:-1},execCommand:function(e){var s=this,l=nO(s);l&&l.selectedTds.length&&function(t){utils.each(domUtils.getElementsByTagName(l.table,"th"),function(e){e.setAttribute("width","")});var e=l.isFullRow()?domUtils.getElementsByTagName(l.table,"td"):l.selectedTds;utils.each(e,function(e){1==e.colSpan&&e.setAttribute("width",t)})}(function(){var e=l.table,t=0,i=0,n=oO(s,e);if(l.isFullRow())t=e.offsetWidth,i=l.colsNum;else for(var o,e=l.cellsRange.beginColIndex,r=l.cellsRange.endColIndex,a=e;a<=r;)t+=(o=l.selectedTds[a]).offsetWidth,a+=o.colSpan,i+=1;return Math.ceil(t/i)-2*n.tdBorder-2*n.tdPadding}())}},UE.commands.averagedistributerow={queryCommandState:function(){var e=nO(this);return e&&(!e.selectedTds||!/th/gi.test(e.selectedTds[0].tagName))&&(e.isFullRow()||e.isFullCol())?0:-1},execCommand:function(e){var t,i,m=this,f=nO(m);f&&f.selectedTds.length&&(t=function(){var e=0,t=f.table,i=oO(m,t),n=parseInt(domUtils.getComputedStyle(t.getElementsByTagName("td")[0],"padding-top"));if(f.isFullCol()){var o,r,a=domUtils.getElementsByTagName(t,"caption"),s=domUtils.getElementsByTagName(t,"th");0<a.length&&(o=a[0].offsetHeight),0<s.length&&(r=s[0].offsetHeight),e=t.offsetHeight-(o||0)-(r||0),r=0==s.length?f.rowsNum:f.rowsNum-1}else{for(var s=f.cellsRange.beginRowIndex,l=f.cellsRange.endRowIndex,d=0,c=domUtils.getElementsByTagName(t,"tr"),u=s;u<=l;u++)e+=c[u].offsetHeight,d+=1;r=d}return browser.ie&&browser.version<9?Math.ceil(e/r):Math.ceil(e/r)-2*i.tdBorder-2*n}(),i=f.isFullCol()?domUtils.getElementsByTagName(f.table,"td"):f.selectedTds,utils.each(i,function(e){1==e.rowSpan&&e.setAttribute("height",t)}))}},UE.commands.cellalignment={queryCommandState:function(){return mO(this).table?0:-1},execCommand:function(e,t){var i=nO(this);i?utils.each(i.selectedTds,function(e){domUtils.setAttributes(e,t)}):(i=(i=this.selection.getStart())&&domUtils.findParentByTagName(i,["td","th","caption"],!0),/caption/gi.test(i.tagName)?(i.style.textAlign=t.align,i.style.verticalAlign=t.vAlign):domUtils.setAttributes(i,t),this.selection.getRange().setCursor(!0))},queryCommandValue:function(e){var t=mO(this).cell;if(t=t||rO(this)[0]){var i=UE.UETable.getUETable(t).selectedTds;return i.length||(i=t),UE.UETable.getTableCellAlignState(i)}return null}},UE.commands.tablealignment={queryCommandState:function(){return!(browser.ie&&browser.version<8)&&mO(this).table?0:-1},execCommand:function(e,t){var i=this.selection.getStart(),i=i&&domUtils.findParentByTagName(i,["table"],!0);i&&i.setAttribute("align",t)}},UE.commands.edittable={queryCommandState:function(){return mO(this).table?0:-1},execCommand:function(e,t){var i=this.selection.getRange(),i=domUtils.findParentByTagName(i.startContainer,"table");i&&(i=domUtils.getElementsByTagName(i,"td").concat(domUtils.getElementsByTagName(i,"th"),domUtils.getElementsByTagName(i,"caption")),utils.each(i,function(e){e.style.borderColor=t}))}},UE.commands.edittd={queryCommandState:function(){return mO(this).table?0:-1},execCommand:function(e,t){var i=nO(this);i?utils.each(i.selectedTds,function(e){e.style.backgroundColor=t}):(i=(i=this.selection.getStart())&&domUtils.findParentByTagName(i,["td","th","caption"],!0))&&(i.style.backgroundColor=t)}},UE.commands.settablebackground={queryCommandState:function(){return 1<rO(this).length?0:-1},execCommand:function(e,t){var i=rO(this);pO(i[0]).setBackground(i,t)}},UE.commands.cleartablebackground={queryCommandState:function(){var e=rO(this);if(!e.length)return-1;for(var t,i=0;t=e[i++];)if(""!==t.style.backgroundColor)return 0;return-1},execCommand:function(){var e=rO(this);pO(e[0]).removeBackground(e)}},UE.commands.interlacetable=UE.commands.uninterlacetable={queryCommandState:function(e){var t=mO(this).table;if(!t)return-1;t=t.getAttribute("interlaced");return"interlacetable"==e?"enabled"===t?-1:0:t&&"disabled"!==t?0:-1},execCommand:function(e,t){var i=mO(this).table;"interlacetable"==e?(i.setAttribute("interlaced","enabled"),this.fireEvent("interlacetable",i,t)):(i.setAttribute("interlaced","disabled"),this.fireEvent("uninterlacetable",i))}},UE.commands.setbordervisible={queryCommandState:function(e){return mO(this).table?0:-1},execCommand:function(){var e=mO(this).table;utils.each(domUtils.getElementsByTagName(e,"td"),function(e){e.style.borderWidth="1px",e.style.borderStyle="solid"})}},UE.plugins.table=function(){function U(e,t){return E.getDefaultValue(e,t)}var f=this,r=null,h=!1,p=0,g=null,E=UE.UETable,T=function(e){return E.getUETable(e)},k=function(e){return E.getUETableBySelected(e)},a=function(e){return E.removeSelectedClass(e)};f.ready(function(){var i=this,n=i.selection.getText;i.selection.getText=function(){var e=k(i);if(e){var t="";return utils.each(e.selectedTds,function(e){t+=e[browser.ie?"innerText":"textContent"]}),t}return n.call(i.selection)}});var b=null,o=null,v="",y=!1,s=null,l=!1,C=null,x=null,N=!1;f.setOpt({maxColNum:20,maxRowNum:100,defaultCols:5,defaultRows:5,tdvalign:"top",cursorpath:f.options.UEDITOR_HOME_URL+"themes/default/images/cursor_",tableDragable:!1,classList:["ue-table-interlace-color-single","ue-table-interlace-color-double"]}),f.getUETable=T;var S={deletetable:1,inserttable:1,cellvalign:1,insertcaption:1,deletecaption:1,inserttitle:1,deletetitle:1,mergeright:1,mergedown:1,mergecells:1,insertrow:1,insertrownext:1,deleterow:1,insertcol:1,insertcolnext:1,deletecol:1,splittocells:1,splittorows:1,splittocols:1,adaptbytext:1,adaptbywindow:1,adaptbycustomer:1,insertparagraph:1,insertparagraphbeforetable:1,averagedistributecol:1,averagedistributerow:1};function B(e){t(e,"width",!0),t(e,"height",!0)}function t(e,t,i){e.style[t]&&(i&&e.setAttribute(t,parseInt(e.style[t],10)),e.style[t]="")}function _(e){return"TD"==e.tagName||"TH"==e.tagName?e:(e=domUtils.findParentByTagName(e,"td",!0)||domUtils.findParentByTagName(e,"th",!0))?e:null}function I(e){var t=new RegExp(domUtils.fillChar,"g");if(!(0<e[browser.ie?"innerText":"textContent"].replace(/^\s*$/,"").replace(t,"").length)){for(var i in dtd.$isNotEmpty)if(e.getElementsByTagName(i).length)return;return 1}}function w(e){return e.pageX||e.pageY?{x:e.pageX,y:e.pageY}:{x:e.clientX+f.document.body.scrollLeft-f.document.body.clientLeft,y:e.clientY+f.document.body.scrollTop-f.document.body.clientTop}}function i(e){if(!D())try{var t,i=_(e.target||e.srcElement);if(h&&(f.body.style.webkitUserSelect="none",(10<Math.abs(g.x-e.clientX)||10<Math.abs(g.y-e.clientY))&&(L(),h=!1,p=0,u(e))),v&&x)return p=0,f.body.style.webkitUserSelect="none",f.selection.getNative()[browser.ie9below?"empty":"removeAllRanges"](),t=w(e),c(f,!0,v,0,i),void("h"==v?C.style.left=function(e,t){var i=T(e);if(i){var n=i.getSameEndPosCells(e,"x")[0],e=i.getSameStartPosXCells(e)[0],t=w(t).x,i=(n?domUtils.getXY(n):domUtils.getXY(i.table)).x+20,e=e?domUtils.getXY(e).x+e.offsetWidth-20:f.body.offsetWidth+5||parseInt(domUtils.getComputedStyle(f.body,"width"),10);return e-=5,t<(i+=5)?i:e<t?e:t}}(x,e)+"px":"v"==v&&(C.style.top=function(e,t){try{var i=domUtils.getXY(e).y,n=w(t).y;return n<i?i:n}catch(e){}}(x,e)+"px"));if(i){if(!0===f.fireEvent("excludetable",i))return;var n=A(i,t=w(e)),o=domUtils.findParentByTagName(i,"table",!0);if(R(o,i,e,!0)){if(!0===f.fireEvent("excludetable",o))return;f.body.style.cursor="url("+f.options.cursorpath+"h.png),pointer"}else if(R(o,i,e)){if(!0===f.fireEvent("excludetable",o))return;f.body.style.cursor="url("+f.options.cursorpath+"v.png),pointer"}else f.body.style.cursor="text",/\d/.test(n)&&(n=n.replace(/\d/,""),i=T(i).getPreviewCell(i,"v"==n)),c(f,!!i&&!!n,i?n:"",0,i)}else d(!1,o,f)}catch(e){}}function d(e,t,i){e?function(n,o){var r,e=domUtils.getXY(n),t=n.ownerDocument;if(s&&s.parentNode)return;(s=t.createElement("div")).contentEditable=!1,s.innerHTML="",s.style.cssText="width:15px;height:15px;background-image:url("+o.options.UEDITOR_HOME_URL+"dialogs/table/dragicon.png);position: absolute;cursor:move;top:"+(e.y-15)+"px;left:"+e.x+"px;",domUtils.unSelectable(s),s.onmouseover=function(e){l=!0},s.onmouseout=function(e){l=!1},domUtils.on(s,"click",function(e,t){var i=this;clearTimeout(r),r=setTimeout(function(){o.fireEvent("tableClicked",n,i)},300)}),domUtils.on(s,"dblclick",function(e,t){!function(){clearTimeout(r);var e=T(n),t=n.rows[0].cells[0],i=e.getLastCell(),i=e.getCellsRange(t,i);o.selection.getRange().setStart(t,0).setCursor(!1,!0),e.setSelected(i)}()}),domUtils.on(s,"dragstart",function(e,t){domUtils.preventDefault(t)}),t.body.appendChild(s)}(t,i):l||setTimeout(function(){!l&&s&&s.parentNode&&s.parentNode.removeChild(s)},2e3)}function R(e,t,i,n){i=w(i),t=A(t,i);if(n){n=e.getElementsByTagName("caption")[0],n=n?n.offsetHeight:0;return"v1"==t&&i.y-domUtils.getXY(e).y-n<8}return"h1"==t&&i.x-domUtils.getXY(e).x<8}function c(e,t,i,n,o){try{e.body.style.cursor="h"==i?"col-resize":"v"==i?"row-resize":"text",browser.ie&&(!i||N||k(e)?$(e):(F(e,e.document),q(i,o))),y=t}catch(e){}}function A(e,t){var i=domUtils.getXY(e);return i?i.x+e.offsetWidth-t.x<5?"h":t.x-i.x<5?"h1":i.y+e.offsetHeight-t.y<5?"v":t.y-i.y<5?"v1":"":""}function n(e,t){var i,n,o;D()||(g={x:t.clientX,y:t.clientY},2==t.button?(i=k(f),n=!1,i&&(o=j(f,t),utils.each(i.selectedTds,function(e){e===o&&(n=!0)}),n?(o=i.selectedTds[0],setTimeout(function(){f.selection.getRange().setStart(o,0).setCursor(!1,!0)},0)):(a(domUtils.getElementsByTagName(f.body,"th td")),i.clearSelected()))):function(e){{var t;a(domUtils.getElementsByTagName(f.body,"td th")),utils.each(f.document.getElementsByTagName("table"),function(e){e.ueTable=null}),(b=j(f,e))&&(t=domUtils.findParentByTagName(b,"table",!0),ut=T(t),ut&&ut.clearSelected(),y?function(e){browser.ie&&(e=function(e){var t=["pageX","pageY","clientX","clientY","srcElement","target"],i={};if(e)for(var n,o,r=0;n=t[r];r++)(o=e[n])&&(i[n]=o);return i}(e)),L(),h=!0,r=setTimeout(function(){u(e)},200)}(e):(f.document.body.style.webkitUserSelect="",N=!0,f.addListener("mouseover",O)))}}(t))}function L(){r&&clearTimeout(r),r=null}function u(e){h=!1,(b=e.target||e.srcElement)&&(e=A(b,w(e)),/\d/.test(e)&&(e=e.replace(/\d/,""),b=T(b).getPreviewCell(b,"v"==e)),$(f),F(f,f.document),f.fireEvent("saveScene"),q(e,b),N=!0,v=e,x=b)}function m(e,t){if(!D()){if(L(),h=!1,y&&(p=++p%3,g={x:t.clientX,y:t.clientY},setTimeout(function(){0<p&&p--},200),2===p))return p=0,void function(e){p=0;var t,o,r,a,i=_((e=e||f.window.event).target||e.srcElement);i&&(t=A(i,w(e)))&&($(f),"h1"==t&&(t="h",R(domUtils.findParentByTagName(i,"table"),i,e)?f.execCommand("adaptbywindow"):(i=T(i).getPreviewCell(i))&&f.selection.getRange().selectNodeContents(i).setCursor(!0,!0)),"h"==t&&(t=T(i),o=function(e){for(var t,i=[],n=0,o=e.length;n<o;n++)(t=e[n].left)&&i.push(t);return i}(o=P(i,t.table,!0)),t.width=t.offsetWidth,r=[],a=[],utils.each(o,function(e){r.push(e.offsetWidth)}),utils.each(o,function(e){e.removeAttribute("width")}),window.setTimeout(function(){var i=!0;utils.each(o,function(e,t){e=e.offsetWidth;if(e>r[t])return i=!1;a.push(e)});var n=i?a:r;utils.each(o,function(e,t){e.width=n[t]-H()})},0)))}(t);if(2!=t.button){var i=this,n=i.selection.getRange(),o=domUtils.findParentByTagName(n.startContainer,"table",!0),r=domUtils.findParentByTagName(n.endContainer,"table",!0);if(!o&&!r||o===r&&(o=domUtils.findParentByTagName(n.startContainer,["td","th","caption"],!0))===(r=domUtils.findParentByTagName(n.endContainer,["td","th","caption"],!0))||i.selection.clearRange(),N=!1,i.document.body.style.webkitUserSelect="",v&&x&&(i.selection.getNative()[browser.ie9below?"empty":"removeAllRanges"](),p=0,C=i.document.getElementById("ue_tableDragLine"))){var a=domUtils.getXY(x),s=domUtils.getXY(C);switch(v){case"h":d=x,c=s.x-a.x,(m=T(d))&&(m=P(d,u=m.table),u.style.width="",u.removeAttribute("width"),c=function(t,e,i){if((t-=H())<0)return 0;var n=(t-=M(e))<0?"left":"right";return t=Math.abs(t),utils.each(i,function(e){e=e[n];e&&(t=Math.min(t,M(e)-5))}),t=t<0?0:t,"left"==n?-t:t}(c,d,m),d.nextSibling?utils.each(m,function(e){e.left.width=+e.left.width+c,e.right&&(e.right.width=+e.right.width-c)}):utils.each(m,function(e){e.left.width-=-c}));break;case"v":!function(e,t){if(!(Math.abs(t)<10)){var i,n,o,r=T(e);if(r)for(var a,s=r.getSameEndPosCells(e,"y"),l=s[0]?s[0].offsetHeight:0,d=0;a=s[d++];)i=a,n=t,o=l,a=void 0,a=parseInt(domUtils.getComputedStyle(i,"line-height"),10),n=(o+=n)<a?a:o,i.style.height&&(i.style.height=""),1==i.rowSpan?i.setAttribute("height",n):i.removeAttribute&&i.removeAttribute("height")}}(x,s.y-a.y-x.offsetHeight)}return v="",x=null,$(i),void i.fireEvent("saveScene")}if(b){var l=T(b),l=l?l.selectedTds[0]:null;l?(n=new dom.Range(i.document),(domUtils.isEmptyBlock(l)?n.setStart(l,0):n.selectNodeContents(l).shrinkBoundary()).setCursor(!1,!0)):(n=i.selection.getRange().shrinkBoundary()).collapsed||(o=domUtils.findParentByTagName(n.startContainer,["td","th"],!0),r=domUtils.findParentByTagName(n.endContainer,["td","th"],!0),(o&&!r||!o&&r||o&&r&&o!==r)&&n.setCursor(!1,!0)),b=null,i.removeListener("mouseover",O)}else{r=domUtils.findParentByTagName(t.target||t.srcElement,"td",!0);if((r=r||domUtils.findParentByTagName(t.target||t.srcElement,"th",!0))&&("TD"==r.tagName||"TH"==r.tagName)){if(!0===i.fireEvent("excludetable",r))return;(n=new dom.Range(i.document)).setStart(r,0).setCursor(!1,!0)}}i._selectionChange(250,t)}}var d,c,u,m}function O(e,t){var i,n;D()||(n=t.target||t.srcElement,o=domUtils.findParentByTagName(n,"td",!0)||domUtils.findParentByTagName(n,"th",!0),b&&o&&("TD"==b.tagName&&"TD"==o.tagName||"TH"==b.tagName&&"TH"==o.tagName)&&domUtils.findParentByTagName(b,"table")==domUtils.findParentByTagName(o,"table")&&(i=T(o),b!=o?(this.document.body.style.webkitUserSelect="none",this.selection.getNative()[browser.ie9below?"empty":"removeAllRanges"](),n=i.getCellsRange(b,o),i.setSelected(n)):(this.document.body.style.webkitUserSelect="",i.clearSelected())),t.preventDefault?t.preventDefault():t.returnValue=!1)}function D(){return"false"===f.body.contentEditable}function P(e,t,i){if(!(t=t||domUtils.findParentByTagName(e,"table")))return null;domUtils.getNodeIndex(e);for(var n=e,t=t.rows,o=0;n;)1===n.nodeType&&(o+=n.colSpan||1),n=n.previousSibling;var n=null,r=[];return utils.each(t,function(e){var e=e.cells,t=0;utils.each(e,function(e){return(t+=e.colSpan||1)===o?(r.push({left:e,right:e.nextSibling||null}),!1):o<t?(i&&r.push({left:e}),!1):void 0})}),r}function M(e){var t,i,n=0,n=e.offsetWidth-H();e.nextSibling||(n-=(t=e,tab=domUtils.findParentByTagName(t,"table",!1),void 0===tab.offsetVal&&(i=t.previousSibling,tab.offsetVal=i&&t.offsetWidth-i.offsetWidth===E.borderWidth?E.borderWidth:0),tab.offsetVal)),n=n<0?0:n;try{e.width=n}catch(e){}return n}function H(){var e,t,i,n,o;return void 0===E.tabcellSpace&&(e=f.document.createElement("table"),o=f.document.createElement("tbody"),t=f.document.createElement("tr"),n=null,(i=f.document.createElement("td")).style.cssText="border: 0;",i.width=1,t.appendChild(i),t.appendChild(n=i.cloneNode(!1)),o.appendChild(t),e.appendChild(o),e.style.cssText="visibility: hidden;",f.body.appendChild(e),E.paddingSpace=i.offsetWidth-1,o=e.offsetWidth,i.style.cssText="",n.style.cssText="",E.borderWidth=(e.offsetWidth-o)/3,E.tabcellSpace=E.paddingSpace+E.borderWidth,f.body.removeChild(e)),H=function(){return E.tabcellSpace},E.tabcellSpace}function F(e){N||(C=e.document.createElement("div"),domUtils.setAttributes(C,{id:"ue_tableDragLine",unselectable:"on",contenteditable:!1,onresizestart:"return false",ondragstart:"return false",onselectstart:"return false",style:"background-color:blue;position:absolute;padding:0;margin:0;background-image:none;border:0px none;opacity:0;filter:alpha(opacity=0)"}),e.body.appendChild(C))}function $(e){if(!N)for(var t;t=e.document.getElementById("ue_tableDragLine");)domUtils.remove(t)}function q(e,t){if(t){var i,n=domUtils.findParentByTagName(t,"table"),o=n.getElementsByTagName("caption"),r=n.offsetWidth,a=n.offsetHeight-(0<o.length?o[0].offsetHeight:0),s=domUtils.getXY(n),l=domUtils.getXY(t);switch(e){case"h":i="height:"+a+"px;top:"+(s.y+(0<o.length?o[0].offsetHeight:0))+"px;left:"+(l.x+t.offsetWidth),C.style.cssText=i+"px;position: absolute;display:block;background-color:blue;width:1px;border:0; color:blue;opacity:.3;filter:alpha(opacity=30)";break;case"v":i="width:"+r+"px;left:"+s.x+"px;top:"+(l.y+t.offsetHeight),C.style.cssText=i+"px;overflow:hidden;position: absolute;display:block;background-color:blue;height:1px;border:0;color:blue;opacity:.2;filter:alpha(opacity=20)"}}}function V(e,t){for(var i,n=domUtils.getElementsByTagName(e.body,"table"),o=0;i=n[o++];){var r=domUtils.getElementsByTagName(i,"td");r[0]&&(t?(r=r[0].style.borderColor.replace(/\s/g,""),/(#ffffff)|(rgb\(255,255,255\))/gi.test(r)&&domUtils.addClass(i,"noBorderTable")):domUtils.removeClasses(i,"noBorderTable"))}}function j(e,t){var i,n,o,r=domUtils.findParentByTagName(t.target||t.srcElement,["td","th"],!0);return r?(o=A(r,w(t)),r?("h1"===o&&r.previousSibling?(n=domUtils.getXY(r),i=r.offsetWidth,Math.abs(n.x+i-t.clientX)>i/3&&(r=r.previousSibling)):"v1"===o&&r.parentNode.previousSibling&&(n=domUtils.getXY(r),o=r.offsetHeight,Math.abs(n.y+o-t.clientY)>o/3&&(r=r.parentNode.previousSibling.firstChild)),r&&!0!==e.fireEvent("excludetable",r)?r:null):null):null}f.ready(function(){var x,N,w,e;utils.cssRule("table",".selectTdClass{background-color:#edf5fa !important}table.noBorderTable td,table.noBorderTable th,table.noBorderTable caption{border:1px dashed #ddd !important}table{margin-bottom:10px;border-collapse:collapse;display:table;}td,th{padding: 5px 10px;border: 1px solid #DDD;}caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}th{border-top:1px solid #BBB;background-color:#F7F7F7;}table tr.firstRow th{border-top-width:2px;}.ue-table-interlace-color-single{ background-color: #fcfcfc; } .ue-table-interlace-color-double{ background-color: #f7faff; }td p{margin:0;padding:0;}",f.document),f.addListener("keydown",function(e,t){var i,n=this,o=t.keyCode||t.which;if(8==o&&((i=k(n))&&i.selectedTds.length&&(i.isFullCol()?n.execCommand("deletecol"):i.isFullRow()?n.execCommand("deleterow"):n.fireEvent("delcells"),domUtils.preventDefault(t)),a=domUtils.findParentByTagName(n.selection.getStart(),"caption",!0),(s=n.selection.getRange()).collapsed&&a&&I(a)&&(n.fireEvent("saveScene"),l=a.parentNode,domUtils.remove(a),l&&s.setStart(l.rows[0].cells[0],0).setCursor(!1,!0),n.fireEvent("saveScene"))),46==o&&(i=k(n))){n.fireEvent("saveScene");for(var r=0;d=i.selectedTds[r++];)domUtils.fillNode(n.document,d);n.fireEvent("saveScene"),domUtils.preventDefault(t)}if(13==o){var a,s=n.selection.getRange();if(a=domUtils.findParentByTagName(s.startContainer,"caption",!0)){var l=domUtils.findParentByTagName(a,"table");return s.collapsed?a&&s.setStart(l.rows[0].cells[0],0).setCursor(!1,!0):(s.deleteContents(),n.fireEvent("saveScene")),void domUtils.preventDefault(t)}s.collapsed&&(l=domUtils.findParentByTagName(s.startContainer,"table"))&&(o=l.rows[0].cells[0],a=domUtils.findParentByTagName(n.selection.getStart(),["td","th"],!0),l=l.previousSibling,o!==a||l&&(1!=l.nodeType||"TABLE"!=l.tagName)||!domUtils.isStartInblock(s)||(s=domUtils.findParent(n.selection.getStart(),function(e){return domUtils.isBlockElm(e)},!0))&&(/t(h|d)/i.test(s.tagName)||s===a.firstChild)&&(n.execCommand("insertparagraphbeforetable"),domUtils.preventDefault(t)))}if((t.ctrlKey||t.metaKey)&&"67"==t.keyCode&&(x=null,i=k(n))){var d,c=i.selectedTds;for(N=i.isFullCol(),w=i.isFullRow(),x=[[i.cloneCell(c[0],null,!0)]],r=1;d=c[r];r++)d.parentNode!==c[r-1].parentNode?x.push([i.cloneCell(d,null,!0)]):x[x.length-1].push(i.cloneCell(d,null,!0))}}),f.addListener("tablehasdeleted",function(){c(this,!1,""),s&&domUtils.remove(s)}),f.addListener("beforepaste",function(e,t){var i=this,n=i.selection.getRange();if(domUtils.findParentByTagName(n.startContainer,"caption",!0))return(o=i.document.createElement("div")).innerHTML=t.html,void(t.html=o[browser.ie9below?"innerText":"textContent"]);var o,r=k(i);if(x){i.fireEvent("saveScene");var a,s,n=i.selection.getRange(),l=domUtils.findParentByTagName(n.startContainer,["td","th"],!0);if(l){var d,c=T(l);if(w){var u=c.getCellInfo(l).rowIndex;"TH"==l.tagName&&u++;for(var m=0;v=x[m++];){for(var f=c.insertRow(u++,"td"),h=0;y=v[h];h++){var p=f.cells[h];(p=p||f.insertCell(h)).innerHTML=y.innerHTML,y.getAttribute("width")&&p.setAttribute("width",y.getAttribute("width")),y.getAttribute("vAlign")&&p.setAttribute("vAlign",y.getAttribute("vAlign")),y.getAttribute("align")&&p.setAttribute("align",y.getAttribute("align")),y.style.cssText&&(p.style.cssText=y.style.cssText)}for(h=0;(y=f.cells[h])&&v[h];h++)y.innerHTML=v[h].innerHTML,v[h].getAttribute("width")&&y.setAttribute("width",v[h].getAttribute("width")),v[h].getAttribute("vAlign")&&y.setAttribute("vAlign",v[h].getAttribute("vAlign")),v[h].getAttribute("align")&&y.setAttribute("align",v[h].getAttribute("align")),v[h].style.cssText&&(y.style.cssText=v[h].style.cssText)}}else{if(N){for(var g=c.getCellInfo(l),b=0,v=x[h=0];y=v[h++];)b+=y.colSpan||1;for(i.__hasEnterExecCommand=!0,m=0;m<b;m++)i.execCommand("insertcol");i.__hasEnterExecCommand=!1,"TH"==(l=c.table.rows[0].cells[g.cellIndex]).tagName&&(l=c.table.rows[1].cells[g.cellIndex])}for(m=0;v=x[m++];){for(a=l,h=0;y=v[h++];)l?(l.innerHTML=y.innerHTML,y.getAttribute("width")&&l.setAttribute("width",y.getAttribute("width")),y.getAttribute("vAlign")&&l.setAttribute("vAlign",y.getAttribute("vAlign")),y.getAttribute("align")&&l.setAttribute("align",y.getAttribute("align")),y.style.cssText&&(l.style.cssText=y.style.cssText),l=(s=l).nextSibling):(d=y.cloneNode(!0),domUtils.removeAttributes(d,["class","rowSpan","colSpan"]),s.parentNode.appendChild(d));if(l=c.getNextCell(a,!0,!0),!x[m])break;l||(g=c.getCellInfo(a),c.table.insertRow(c.table.rows.length),c.update(),l=c.getVSideCell(a,!0))}}c.update()}else{for(r=i.document.createElement("table"),m=0;v=x[m++];){for(var y,f=r.insertRow(r.rows.length),h=0;y=v[h++];)d=E.cloneCell(y,null,!0),domUtils.removeAttributes(d,["class"]),f.appendChild(d);2==h&&1<d.rowSpan&&(d.rowSpan=1)}var C=U(i),C=i.body.offsetWidth-2*parseInt(domUtils.getComputedStyle(i.body,"margin-left"),10)-2*C.tableBorder-(i.options.offsetWidth||0);i.execCommand("insertHTML","<table  "+(N&&w?'width="'+C+'"':"")+">"+r.innerHTML.replace(/>\s*</g,"><").replace(/\bth\b/gi,"td")+"</table>")}return i.fireEvent("contentchange"),i.fireEvent("saveScene"),!(t.html="")}(o=i.document.createElement("div")).innerHTML=t.html,C=o.getElementsByTagName("table"),domUtils.findParentByTagName(i.selection.getStart(),"table")?(utils.each(C,function(e){domUtils.remove(e)}),domUtils.findParentByTagName(i.selection.getStart(),"caption",!0)&&(o.innerHTML=o[browser.ie?"innerText":"textContent"])):utils.each(C,function(e){B(e),domUtils.removeAttributes(e,["style","border"]),utils.each(domUtils.getElementsByTagName(e,"td"),function(e){I(e)&&domUtils.fillNode(i.document,e),B(e)})}),t.html=o.innerHTML}),f.addListener("afterpaste",function(){utils.each(domUtils.getElementsByTagName(f.body,"table"),function(e){var t;e.offsetWidth>f.body.offsetWidth&&(t=U(f,e),e.style.width=f.body.offsetWidth-2*parseInt(domUtils.getComputedStyle(f.body,"margin-left"),10)-2*t.tableBorder-(f.options.offsetWidth||0)+"px")})}),f.addListener("blur",function(){x=null}),f.addListener("keydown",function(){clearTimeout(e),e=setTimeout(function(){var e=f.selection.getRange(),t=domUtils.findParentByTagName(e.startContainer,["th","td"],!0);!t||(e=t.parentNode.parentNode.parentNode).offsetWidth>e.getAttribute("width")&&(t.style.wordBreak="break-all")},100)}),f.addListener("selectionchange",function(){c(f,!1,"")}),f.addListener("contentchange",function(){var e,l=this;$(l),k(l)||(e=l.selection.getRange().startContainer,e=domUtils.findParentByTagName(e,["td","th"],!0),utils.each(domUtils.getElementsByTagName(l.document,"table"),function(e){!0!==l.fireEvent("excludetable",e)&&(e.ueTable=new E(e),e.onmouseover=function(){l.fireEvent("tablemouseover",e)},e.onmousemove=function(){l.fireEvent("tablemousemove",e),l.options.tableDragable&&d(!0,this,l),utils.defer(function(){l.fireEvent("contentchange",50)},!0)},e.onmouseout=function(){l.fireEvent("tablemouseout",e),c(l,!1,""),$(l)},e.onclick=function(e){var t,i,n,o,r,a,s=_((e=l.window.event||e).target||e.srcElement);s&&(n=(i=T(s)).table,a=i.getCellInfo(s),o=l.selection.getRange(),R(n,s,e,!0)?(r=i.getCell(i.indexTable[i.rowsNum-1][a.colIndex].rowIndex,i.indexTable[i.rowsNum-1][a.colIndex].cellIndex),e.shiftKey&&i.selectedTds.length?i.selectedTds[0]!==r?(t=i.getCellsRange(i.selectedTds[0],r),i.setSelected(t)):o&&o.selectNodeContents(r).select():s!==r?(t=i.getCellsRange(s,r),i.setSelected(t)):o&&o.selectNodeContents(r).select()):R(n,s,e)&&(a=i.getCell(i.indexTable[a.rowIndex][i.colsNum-1].rowIndex,i.indexTable[a.rowIndex][i.colsNum-1].cellIndex),e.shiftKey&&i.selectedTds.length?i.selectedTds[0]!==a?(t=i.getCellsRange(i.selectedTds[0],a),i.setSelected(t)):o&&o.selectNodeContents(a).select():s!==a?(t=i.getCellsRange(s,a),i.setSelected(t)):o&&o.selectNodeContents(a).select()))})}),V(l,!0))}),domUtils.on(f.document,"mousemove",i),domUtils.on(f.document,"mouseout",function(e){"TABLE"==(e.target||e.srcElement).tagName&&c(f,!1,"")}),f.addListener("interlacetable",function(e,t,i){if(t)for(var n,o,r=t.rows,a=r.length,s=0;s<a;s++)r[s].className=(n=i||this.options.classList)[o=s]?n[o]:n[o%n.length]}),f.addListener("uninterlacetable",function(e,t){if(t)for(var i=t.rows,n=this.options.classList,o=i.length,r=0;r<o;r++)domUtils.removeClasses(i[r],n)}),f.addListener("mousedown",n),f.addListener("mouseup",m),domUtils.on(f.body,"dragstart",function(e){m.call(f,"dragstart",e)}),f.addOutputRule(function(e){utils.each(e.getNodesByTagName("div"),function(e){"ue_tableDragLine"==e.getAttr("id")&&e.parentNode.removeChild(e)})});var o=0;f.addListener("mousedown",function(){o=0}),f.addListener("tabkeydown",function(){var e,t=this.selection.getRange(),i=t.getCommonAncestor(!0,!0),n=domUtils.findParentByTagName(i,"table");if(n)return domUtils.findParentByTagName(i,"caption",!0)?(e=domUtils.getElementsByTagName(n,"th td"))&&e.length&&t.setStart(e[0],0).setCursor(!1,!0):(e=domUtils.findParentByTagName(i,["td","th"],!0),i=T(e),o=1<e.rowSpan?o:i.getCellInfo(e).rowIndex,(e=i.getTabNextCell(e,o))?I(e)?t.setStart(e,0).setCursor(!1,!0):t.selectNodeContents(e).select():(f.fireEvent("saveScene"),f.__hasEnterExecCommand=!0,this.execCommand("insertrownext"),f.__hasEnterExecCommand=!1,(t=this.selection.getRange()).setStart(n.rows[n.rows.length-1].cells[0],0).setCursor(),f.fireEvent("saveScene"))),!0}),browser.ie&&f.addListener("selectionchange",function(){c(this,!1,"")}),f.addListener("keydown",function(e,t){var i=t.keyCode||t.which;8!=i&&46!=i&&((i=!(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey))&&a(domUtils.getElementsByTagName(this.body,"td")),(t=k(this))&&i&&t.clearSelected())}),f.addListener("beforegetcontent",function(){V(this,!1),browser.ie&&utils.each(this.document.getElementsByTagName("caption"),function(e){domUtils.isEmptyNode(e)&&(e.innerHTML="&nbsp;")})}),f.addListener("aftergetcontent",function(){V(this,!0)}),f.addListener("getAllHtml",function(){a(f.document.getElementsByTagName("td"))}),f.addListener("fullscreenchanged",function(e,t){var s;t||(s=this.body.offsetWidth/document.body.offsetWidth,t=domUtils.getElementsByTagName(this.body,"table"),utils.each(t,function(e){if(e.offsetWidth<f.body.offsetWidth)return!1;var t=domUtils.getElementsByTagName(e,"td"),i=[];utils.each(t,function(e){i.push(e.offsetWidth)});for(var n,o,r,a=0;n=t[a];a++)n.setAttribute("width",Math.floor(i[a]*s));e.setAttribute("width",Math.floor((r=U(o=f),(e=o.body).offsetWidth-2*parseInt(domUtils.getComputedStyle(e,"margin-left"),10)-2*r.tableBorder-(o.options.offsetWidth||0))))}))});var h=f.execCommand;f.execCommand=function(e,t){var i=this;e=e.toLowerCase();var n,o=k(i),r=new dom.Range(i.document),a=i.commands[e]||UE.commands[e];if(a){if(!o||S[e]||a.notNeedUndo||i.__hasEnterExecCommand)n=h.apply(i,arguments);else{i.__hasEnterExecCommand=!0,i.fireEvent("beforeexeccommand",e);for(var s,l,d,c=o.selectedTds,u=-2,m=-2,f=0;d=c[f];f++)I(d)?r.setStart(d,0).setCursor(!1,!0):r.selectNode(d).select(!0),l=i.queryCommandState(e),s=i.queryCommandValue(e),-1!=l&&(u===l&&m===s||(i._ignoreContentChange=!0,n=h.apply(i,arguments),i._ignoreContentChange=!1),u=i.queryCommandState(e),m=i.queryCommandValue(e),domUtils.isEmptyBlock(d)&&domUtils.fillNode(i.document,d));r.setStart(c[0],0).shrinkBoundary(!0).setCursor(!1,!0),i.fireEvent("contentchange"),i.fireEvent("afterexeccommand",e),i.__hasEnterExecCommand=!1,i._selectionChange()}return n}}})},UE.UETable.prototype.sortTable=function(i,n){var e=this.table,t=e.rows,o=[],r="TH"===t[0].cells[0].tagName,a=0;if(this.selectedTds.length){for(var s=this.cellsRange,l=s.endRowIndex+1,d=s.beginRowIndex;d<l;d++)o[d]=t[d];o.splice(0,s.beginRowIndex),a=s.endRowIndex+1===this.rowsNum?0:s.endRowIndex+1}else for(d=0,l=t.length;d<l;d++)o[d]=t[d];var c={reversecurrent:function(e,t){return 1},orderbyasc:function(e,t){e=e.innerText||e.textContent,t=t.innerText||t.textContent;return e.localeCompare(t)},reversebyasc:function(e,t){e=e.innerHTML;return t.innerHTML.localeCompare(e)},orderbynum:function(e,t){e=e[browser.ie?"innerText":"textContent"].match(/\d+/),t=t[browser.ie?"innerText":"textContent"].match(/\d+/);return((e=e&&+e[0])||0)-((t=t&&+t[0])||0)},reversebynum:function(e,t){e=e[browser.ie?"innerText":"textContent"].match(/\d+/),t=t[browser.ie?"innerText":"textContent"].match(/\d+/),e=e&&+e[0];return((t=t&&+t[0])||0)-(e||0)}};e.setAttribute("data-sort-type",n&&"string"==typeof n&&c[n]?n:""),r&&o.splice(0,1);for(var o=utils.sort(o,function(e,t){return n&&"function"==typeof n?n.call(this,e.cells[i],t.cells[i]):n&&"number"==typeof n?1:(n&&"string"==typeof n&&c[n]?c[n]:c.orderbyasc).call(this,e.cells[i],t.cells[i])}),u=e.ownerDocument.createDocumentFragment(),m=0,l=o.length;m<l;m++)u.appendChild(o[m]);e=e.getElementsByTagName("tbody")[0];a?e.insertBefore(u,t[a-s.endRowIndex+s.beginRowIndex-1]):e.appendChild(u)},UE.plugins.tablesort=function(){function a(e){return s.getTableItemsByRange(e)}var e=this,s=UE.UETable;e.ready(function(){utils.cssRule("tablesort","table.sortEnabled tr.firstRow th,table.sortEnabled tr.firstRow td{padding-right:20px;background-repeat: no-repeat;background-position: center right;   background-image:url("+e.options.themePath+e.options.theme+"/images/sortable.png);}",e.document),e.addListener("afterexeccommand",function(e,t){"mergeright"!=t&&"mergedown"!=t&&"mergecells"!=t||this.execCommand("disablesort")})}),UE.commands.sorttable={queryCommandState:function(){var e=a(this);if(!e.cell)return-1;for(var t,i=e.table.getElementsByTagName("td"),n=0;t=i[n++];)if(1!=t.rowSpan||1!=t.colSpan)return-1;return 0},execCommand:function(e,t){var i=this.selection.getRange(),n=i.createBookmark(!0),o=a(this),r=o.cell,o=(o=o.table,s.getUETable(o)),r=o.getCellInfo(r);o.sortTable(r.cellIndex,t),i.moveToBookmark(n);try{i.select()}catch(e){}}},UE.commands.enablesort=UE.commands.disablesort={queryCommandState:function(e){var t=a(this).table;if(t&&"enablesort"==e)for(var i=domUtils.getElementsByTagName(t,"th td"),n=0;n<i.length;n++)if(1<i[n].getAttribute("colspan")||1<i[n].getAttribute("rowspan"))return-1;return!t||"enablesort"==e^"sortEnabled"!=t.getAttribute("data-sort")?-1:0},execCommand:function(e){var t=a(this).table;t.setAttribute("data-sort","enablesort"==e?"sortEnabled":"sortDisabled"),"enablesort"==e?domUtils.addClass(t,"sortEnabled"):domUtils.removeClasses(t,"sortEnabled")}}},UE.plugins.contextmenu=function(){var l,d,c,u,m=this;m.setOpt("enableContextMenu",m.getOpt("enableContextMenu")||!0),!1!==m.getOpt("enableContextMenu")&&(d=m.getLang("contextMenu"),(c=m.options.contextMenu||[{label:d.selectall,cmdName:"selectall"},{label:d.cleardoc,cmdName:"cleardoc",exec:function(){confirm(d.confirmclear)&&this.execCommand("cleardoc")}},"-",{label:d.unlink,cmdName:"unlink"},"-",{group:d.paragraph,icon:"justifyjustify",subMenu:[{label:d.justifyleft,cmdName:"justify",value:"left"},{label:d.justifyright,cmdName:"justify",value:"right"},{label:d.justifycenter,cmdName:"justify",value:"center"},{label:d.justifyjustify,cmdName:"justify",value:"justify"}]},"-",{group:d.table,icon:"table",subMenu:[{label:d.inserttable,cmdName:"inserttable"},{label:d.deletetable,cmdName:"deletetable"},"-",{label:d.deleterow,cmdName:"deleterow"},{label:d.deletecol,cmdName:"deletecol"},{label:d.insertcol,cmdName:"insertcol"},{label:d.insertcolnext,cmdName:"insertcolnext"},{label:d.insertrow,cmdName:"insertrow"},{label:d.insertrownext,cmdName:"insertrownext"},"-",{label:d.insertcaption,cmdName:"insertcaption"},{label:d.deletecaption,cmdName:"deletecaption"},{label:d.inserttitle,cmdName:"inserttitle"},{label:d.deletetitle,cmdName:"deletetitle"},{label:d.inserttitlecol,cmdName:"inserttitlecol"},{label:d.deletetitlecol,cmdName:"deletetitlecol"},"-",{label:d.mergecells,cmdName:"mergecells"},{label:d.mergeright,cmdName:"mergeright"},{label:d.mergedown,cmdName:"mergedown"},"-",{label:d.splittorows,cmdName:"splittorows"},{label:d.splittocols,cmdName:"splittocols"},{label:d.splittocells,cmdName:"splittocells"},"-",{label:d.averageDiseRow,cmdName:"averagedistributerow"},{label:d.averageDisCol,cmdName:"averagedistributecol"},"-",{label:d.edittd,cmdName:"edittd",exec:function(){UE.ui.edittd&&new UE.ui.edittd(this),this.getDialog("edittd").open()}},{label:d.edittable,cmdName:"edittable",exec:function(){UE.ui.edittable&&new UE.ui.edittable(this),this.getDialog("edittable").open()}},{label:d.setbordervisible,cmdName:"setbordervisible"}]},{group:d.tablesort,icon:"tablesort",subMenu:[{label:d.enablesort,cmdName:"enablesort"},{label:d.disablesort,cmdName:"disablesort"},"-",{label:d.reversecurrent,cmdName:"sorttable",value:"reversecurrent"},{label:d.orderbyasc,cmdName:"sorttable",value:"orderbyasc"},{label:d.reversebyasc,cmdName:"sorttable",value:"reversebyasc"},{label:d.orderbynum,cmdName:"sorttable",value:"orderbynum"},{label:d.reversebynum,cmdName:"sorttable",value:"reversebynum"}]},{group:d.borderbk,icon:"borderBack",subMenu:[{label:d.setcolor,cmdName:"interlacetable",exec:function(){this.execCommand("interlacetable")}},{label:d.unsetcolor,cmdName:"uninterlacetable",exec:function(){this.execCommand("uninterlacetable")}},{label:d.setbackground,cmdName:"settablebackground",exec:function(){this.execCommand("settablebackground",{repeat:!0,colorList:["#bbb","#ccc"]})}},{label:d.unsetbackground,cmdName:"cleartablebackground",exec:function(){this.execCommand("cleartablebackground")}},{label:d.redandblue,cmdName:"settablebackground",exec:function(){this.execCommand("settablebackground",{repeat:!0,colorList:["red","blue"]})}},{label:d.threecolorgradient,cmdName:"settablebackground",exec:function(){this.execCommand("settablebackground",{repeat:!0,colorList:["#aaa","#bbb","#ccc"]})}}]},{group:d.aligntd,icon:"aligntd",subMenu:[{cmdName:"cellalignment",value:{align:"left",vAlign:"top"}},{cmdName:"cellalignment",value:{align:"center",vAlign:"top"}},{cmdName:"cellalignment",value:{align:"right",vAlign:"top"}},{cmdName:"cellalignment",value:{align:"left",vAlign:"middle"}},{cmdName:"cellalignment",value:{align:"center",vAlign:"middle"}},{cmdName:"cellalignment",value:{align:"right",vAlign:"middle"}},{cmdName:"cellalignment",value:{align:"left",vAlign:"bottom"}},{cmdName:"cellalignment",value:{align:"center",vAlign:"bottom"}},{cmdName:"cellalignment",value:{align:"right",vAlign:"bottom"}}]},{group:d.aligntable,icon:"aligntable",subMenu:[{cmdName:"tablealignment",className:"left",label:d.tableleft,value:"left"},{cmdName:"tablealignment",className:"center",label:d.tablecenter,value:"center"},{cmdName:"tablealignment",className:"right",label:d.tableright,value:"right"}]},"-",{label:d.insertparagraphbefore,cmdName:"insertparagraph",value:!0},{label:d.insertparagraphafter,cmdName:"insertparagraph"},{label:d.copy,cmdName:"copy"},{label:d.paste,cmdName:"paste"}]).length&&(u=UE.ui.uiUtils,m.addListener("contextmenu",function(e,t){var i=u.getViewportOffsetByEvent(t);m.fireEvent("beforeselectionchange"),l&&l.destroy();for(var n,o,r,a=0,s=[];n=c[a];a++)!function(e){if("-"==e)(o=s[s.length-1])&&"-"!==o&&s.push("-");else if(e.hasOwnProperty("group")){for(var t,i=0,n=[];t=e.subMenu[i];i++)!function(e){"-"==e?(o=n[n.length-1])&&"-"!==o?n.push("-"):n.splice(n.length-1):(m.commands[e.cmdName]||UE.commands[e.cmdName]||e.query)&&-1<(e.query?e.query():m.queryCommandState(e.cmdName))&&n.push({label:e.label||m.getLang("contextMenu."+e.cmdName+(e.value||""))||"",className:"edui-for-"+e.cmdName+(e.className?" edui-for-"+e.cmdName+"-"+e.className:""),onclick:e.exec?function(){e.exec.call(m)}:function(){m.execCommand(e.cmdName,e.value)}})}(t);n.length&&s.push({label:function(){switch(e.icon){case"table":return m.getLang("contextMenu.table");case"justifyjustify":return m.getLang("contextMenu.paragraph");case"aligntd":return m.getLang("contextMenu.aligntd");case"aligntable":return m.getLang("contextMenu.aligntable");case"tablesort":return d.tablesort;case"borderBack":return d.borderbk;default:return""}}(),className:"edui-for-"+e.icon,subMenu:{items:n,editor:m}})}else(m.commands[e.cmdName]||UE.commands[e.cmdName]||e.query)&&-1<(e.query?e.query.call(m):m.queryCommandState(e.cmdName))&&s.push({label:e.label||m.getLang("contextMenu."+e.cmdName),className:"edui-for-"+(e.icon||e.cmdName+(e.value||"")),onclick:e.exec?function(){e.exec.call(m)}:function(){m.execCommand(e.cmdName,e.value)}})}(n);if("-"==s[s.length-1]&&s.pop(),(l=new UE.ui.Menu({items:s,className:"edui-contextmenu",editor:m})).render(),l.showAt(i),m.fireEvent("aftershowcontextmenu",l),domUtils.preventDefault(t),browser.ie){try{r=m.selection.getNative().createRange()}catch(e){return}r.item&&new dom.Range(m.document).selectNode(r.item(0)).select(!0,!0)}}),m.addListener("aftershowcontextmenu",function(e,t){if(m.zeroclipboard){var i,n=t.items;for(i in n)"edui-for-copy"==n[i].className&&m.zeroclipboard.clip(n[i].getDom())}})))},UE.plugins.shortcutmenu=function(){var r,a=this.options.shortcutMenu||[];a.length&&(this.addListener("contextmenu mouseup",function(e,t){var i,n=this,o={type:e,target:t.target||t.srcElement,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY};if(setTimeout(function(){!1!==n.selection.getRange().collapsed&&"contextmenu"!=e||n.selection.getText()&&(r||((r=new baidu.editor.ui.ShortCutMenu({editor:n,items:a,theme:n.options.theme,className:"edui-shortcutmenu"})).render(),n.fireEvent("afterrendershortcutmenu",r)),r.show(o,!!UE.plugins.contextmenu))}),"contextmenu"==e&&(domUtils.preventDefault(t),browser.ie9below)){try{i=n.selection.getNative().createRange()}catch(t){return}i.item&&new dom.Range(n.document).selectNode(i.item(0)).select(!0,!0)}}),this.addListener("keydown",function(e){"keydown"==e&&r&&!r.isHidden&&r.hide()}))},UE.plugins.basestyle=function(){function a(e,t){return domUtils.filterNodeList(e.selection.getStartElementPath(),t)}var e,t={bold:["strong","b"],italic:["em","i"],subscript:["sub"],superscript:["sup"]},s=this;for(e in s.addshortcutkey({Bold:"ctrl+66",Italic:"ctrl+73",Underline:"ctrl+85"}),s.addInputRule(function(e){utils.each(e.getNodesByTagName("b i"),function(e){switch(e.tagName){case"b":e.tagName="strong";break;case"i":e.tagName="em"}})}),t)!function(e,r){s.commands[e]={execCommand:function(e){var t,i,n=s.selection.getRange(),o=a(this,r);n.collapsed?(o?(t=s.document.createTextNode(""),n.insertNode(t).removeInlineStyle(r),n.setStartBefore(t),domUtils.remove(t)):(i=n.document.createElement(r[0]),"superscript"!=e&&"subscript"!=e||(t=s.document.createTextNode(""),n.insertNode(t).removeInlineStyle(["sub","sup"]).setStartBefore(t).collapse(!0)),n.insertNode(i).setStart(i,0)),n.collapse(!0)):("superscript"!=e&&"subscript"!=e||o&&o.tagName.toLowerCase()==e||n.removeInlineStyle(["sub","sup"]),o?n.removeInlineStyle(r):n.applyInlineStyle(r[0])),n.select()},queryCommandState:function(){return a(this,r)?1:0}}}(e,t[e])},UE.plugins.elementpath=function(){var r,a,o=this;o.setOpt("elementPathEnabled",!0),o.options.elementPathEnabled&&(o.commands.elementpath={execCommand:function(e,t){var i=a[t],n=o.selection.getRange();r=+t,n.selectNode(i).select()},queryCommandValue:function(){var e=[].concat(this.selection.getStartElementPath()).reverse(),t=[];a=e;for(var i,n=0;i=e[n];n++)if(3!=i.nodeType){var o=i.tagName.toLowerCase();if("img"==o&&i.getAttribute("anchorname")&&(o="anchor"),t[n]=o,r==n){r=-1;break}}return t}})},UE.plugins.formatmatch=function(){var r,a=this,s=[],l=0;function d(e,t){var i;browser.webkit&&(i="IMG"==t.target.tagName?t.target:null),a.undoManger&&a.undoManger.save();var n,o=a.selection.getRange(),t=i||o.getClosedNode();r&&t&&"IMG"==t.tagName?(t.style.cssText+=";float:"+(r.style.cssFloat||r.style.styleFloat||"none")+";display:"+(r.style.display||"inline"),r=null):r||(o.collapsed&&(n=a.document.createTextNode("match"),o.insertNode(n).select()),a.__hasEnterExecCommand=!0,t=a.options.removeFormatAttributes,a.options.removeFormatAttributes="",a.execCommand("removeformat"),a.options.removeFormatAttributes=t,a.__hasEnterExecCommand=!1,o=a.selection.getRange(),s.length&&(t=o,n&&t.selectNode(n),t.applyInlineStyle(s[s.length-1].tagName,null,s)),n&&o.setStartBefore(n).collapse(!0),o.select(),n&&domUtils.remove(n)),a.undoManger&&a.undoManger.save(),a.removeListener("mouseup",d),l=0}a.addListener("reset",function(){s=[],l=0}),a.commands.formatmatch={execCommand:function(e){if(l)return l=0,s=[],void a.removeListener("mouseup",d);var t=a.selection.getRange();if(!(r=t.getClosedNode())||"IMG"!=r.tagName){t.collapse(!0).shrinkBoundary();t=t.startContainer;s=domUtils.findParents(t,!0,function(e){return!domUtils.isBlockElm(e)&&1==e.nodeType});for(var i,n=0;i=s[n];n++)if("A"==i.tagName){s.splice(n,1);break}}a.addListener("mouseup",d),l=1},queryCommandState:function(){return l},notNeedUndo:1}},UE.plugin.register("searchreplace",function(){var r=this,a={table:1,tbody:1,tr:1,ol:1,ul:1},s=null;function l(e){return(3==e.nodeType?e.nodeValue:e[browser.ie?"innerText":"textContent"]).replace(domUtils.fillChar,"")}function d(e,t,i){for(var n,o=0,r=e.firstChild,a=0;r;){if(3==r.nodeType){if((o+=a=l(r).replace(/(^[\t\r\n]+)|([\t\r\n]+$)/,"").length)>=t)return{node:r,index:a-(o-t)}}else if(!dtd.$empty[r.tagName]&&(o+=a=l(r).replace(/(^[\t\r\n]+)|([\t\r\n]+$)/,"").length)>=t&&(n=d(r,a-(o-t),i)))return n;r=domUtils.getNextDomNode(r)}}function c(e,t){var i=s||e.selection.getRange(),n=t.searchStr,o=e.document.createElement("span");if(o.innerHTML="$$ueditor_searchreplace_key$$",i.shrinkBoundary(!0),!i.collapsed){i.select();var r=e.selection.getText();if(new RegExp("^"+t.searchStr+"$",t.casesensitive?"":"i").test(r)){if(null!=t.replaceStr)return u(i,t.replaceStr),i.select(),1;i.collapse(-1==t.dir)}}i.insertNode(o),i.enlargeToBlockElm(!0);r=l(e=i.startContainer).indexOf("$$ueditor_searchreplace_key$$");i.setStartBefore(o),domUtils.remove(o);e=function(e,t,i){var n,o=i.all||1==i.dir?"getNextDomNode":"getPreDomNode";for(domUtils.isBody(e)&&(e=e.firstChild);e;){if(-1!=(n=function(e,t,i){var n,o=t.searchStr,r=new RegExp(o,"g"+(t.casesensitive?"":"i"));if(-1==t.dir){if(e=(e=e.substr(0,i)).split("").reverse().join(""),o=o.split("").reverse().join(""),n=r.exec(e))return i-n.index-o.length}else if(e=e.substr(i),n=r.exec(e))return n.index+i;return-1}(l(e),i,t)))return{node:e,index:n};for(e=domUtils[o](e);e&&a[e.nodeName.toLowerCase()];)e=domUtils[o](e,!0);e&&(t=-1==i.dir?l(e).length:0)}}(e,r,t);if(e){r=d(e.node,e.index,n),n=d(e.node,e.index+n.length,n);return i.setStart(r.node,r.index).setEnd(n.node,n.index),void 0!==t.replaceStr&&u(i,t.replaceStr),i.select(),1}i.setCursor()}function u(e,t){t=r.document.createTextNode(t),e.deleteContents().insertNode(t)}return{commands:{searchreplace:{execCommand:function(e,t){utils.extend(t,{all:!1,casesensitive:!1,dir:1},!0);var i=0;if(t.all){s=null;var n=r.selection.getRange(),o=r.body.firstChild;for(o&&1==o.nodeType?(n.setStart(o,0),n.shrinkBoundary(!0)):3==o.nodeType&&n.setStartBefore(o),n.collapse(!0).select(!0),void 0!==t.replaceStr&&r.fireEvent("saveScene");c(this,t);)i++,(s=r.selection.getRange()).collapse(-1==t.dir);i&&r.fireEvent("saveScene")}else void 0!==t.replaceStr&&r.fireEvent("saveScene"),c(this,t)&&(i++,(s=r.selection.getRange()).collapse(-1==t.dir)),i&&r.fireEvent("saveScene");return i},notNeedUndo:1}},bindEvents:{clearlastSearchResult:function(){s=null}}}}),UE.plugins.customstyle=function(){var o=this;o.setOpt({customstyle:[{tag:"h1",name:"tc",style:"font-size:32px;font-weight:bold;border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;"},{tag:"h1",name:"tl",style:"font-size:32px;font-weight:bold;border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:left;margin:0 0 10px 0;"},{tag:"span",name:"im",style:"font-size:16px;font-style:italic;font-weight:bold;line-height:18px;"},{tag:"span",name:"hi",style:"font-size:16px;font-style:italic;font-weight:bold;color:rgb(51, 153, 204);line-height:18px;"}]}),o.commands.customstyle={execCommand:function(e,t){var i,n,o,r,a=t.tag,s=domUtils.findParent(this.selection.getStart(),function(e){return e.getAttribute("label")},!0),l={};for(o in t)void 0!==t[o]&&(l[o]=t[o]);if(delete l.tag,s&&s.getAttribute("label")==t.label){if(n=(i=this.selection.getRange()).createBookmark(),i.collapsed)dtd.$block[s.tagName]?(r=this.document.createElement("p"),domUtils.moveChild(s,r),s.parentNode.insertBefore(r,s),domUtils.remove(s)):domUtils.remove(s,!0);else{var d=domUtils.getCommonAncestor(n.start,n.end),c=domUtils.getElementsByTagName(d,a);new RegExp(a,"i").test(d.tagName)&&c.push(d);for(var u,m,f,h=0;u=c[h++];)u.getAttribute("label")==t.label&&(m=domUtils.getPosition(u,n.start),f=domUtils.getPosition(u,n.end),(m&domUtils.POSITION_FOLLOWING||m&domUtils.POSITION_CONTAINS)&&(f&domUtils.POSITION_PRECEDING||f&domUtils.POSITION_CONTAINS)&&dtd.$block[a]&&(r=this.document.createElement("p"),domUtils.moveChild(u,r),u.parentNode.insertBefore(r,u)),domUtils.remove(u,!0));(s=domUtils.findParent(d,function(e){return e.getAttribute("label")==t.label},!0))&&domUtils.remove(s,!0)}i.moveToBookmark(n).select()}else if(dtd.$block[a])this.execCommand("paragraph",a,l,"customstyle"),(i=this.selection.getRange()).collapsed||(i.collapse(),s=domUtils.findParent(this.selection.getStart(),function(e){return e.getAttribute("label")==t.label},!0),d=this.document.createElement("p"),domUtils.insertAfter(s,d),domUtils.fillNode(this.document,d),i.setStart(d,0).setCursor());else{if((i=this.selection.getRange()).collapsed)return s=this.document.createElement(a),domUtils.setAttributes(s,l),void i.insertNode(s).setStart(s,0).setCursor();n=i.createBookmark(),i.applyInlineStyle(a,l).moveToBookmark(n).select()}},queryCommandValue:function(){var e=domUtils.filterNodeList(this.selection.getStartElementPath(),function(e){return e.getAttribute("label")});return e?e.getAttribute("label"):""}},o.addListener("keyup",function(e,t){var i,n=t.keyCode||t.which;32!=n&&13!=n||(!(i=o.selection.getRange()).collapsed||(t=domUtils.findParent(o.selection.getStart(),function(e){return e.getAttribute("label")},!0))&&dtd.$block[t.tagName]&&domUtils.isEmptyNode(t)&&(n=o.document.createElement("p"),domUtils.insertAfter(t,n),domUtils.fillNode(o.document,n),domUtils.remove(t),i.setStart(n,0).setCursor()))})},UE.plugins.catchremoteimage=function(){var me=this,ajax=UE.ajax;!1!==me.options.catchRemoteImageEnable&&(me.setOpt({catchRemoteImageEnable:!1}),me.addListener("afterpaste",function(){me.fireEvent("catchRemoteImage")}),me.addListener("catchRemoteImage",function(){for(var catcherLocalDomain=me.getOpt("catcherLocalDomain"),catcherActionUrl=me.getActionUrl(me.getOpt("catcherActionName")),catcherUrlPrefix=me.getOpt("catcherUrlPrefix"),catcherFieldName=me.getOpt("catcherFieldName"),remoteImages=[],loadingIMG=me.options.themePath+me.options.theme+"/images/spacer.gif",imgs=me.document.querySelectorAll('[style*="url"],img'),test=function(e,t){if(-1!=e.indexOf(location.host)||/(^\.)|(^\/)/.test(e))return!0;if(t)for(var i,n=0;i=t[n++];)if(-1!==e.indexOf(i))return!0;return!1},i=0,ci,src,backgroundImageurl;ci=imgs[i++];){ci.getAttribute("word_img")||("IMG"==ci.nodeName?(src=ci.getAttribute("_src")||ci.src||"",/^(https?|ftp):/i.test(src)&&!test(src,catcherLocalDomain)&&(remoteImages.push(src),domUtils.setAttributes(ci,{class:"loadingclass",_src:src,src:loadingIMG}))):(backgroundImageurl=ci.style.cssText.replace(/.*\s?url\([\'\"]?/,"").replace(/[\'\"]?\).*/,""),/^(https?|ftp):/i.test(backgroundImageurl)&&!test(backgroundImageurl,catcherLocalDomain)&&(remoteImages.push(backgroundImageurl),ci.style.cssText=ci.style.cssText.replace(backgroundImageurl,loadingIMG),domUtils.setAttributes(ci,{"data-background":backgroundImageurl}))))}function catchremoteimage(e,t){var i=utils.serializeParam(me.queryCommandValue("serverparam"))||"",i=utils.formatUrl(catcherActionUrl+(-1==catcherActionUrl.indexOf("?")?"?":"&")+i),t={method:"POST",dataType:utils.isCrossDomainUrl(i)?"jsonp":"",timeout:6e4,onsuccess:t.success,onerror:t.error};t[catcherFieldName]=e,ajax.request(i,t)}remoteImages.length&&catchremoteimage(remoteImages,{success:function(r){try{var info=void 0!==r.state?r:eval("("+r.responseText+")")}catch(e){return}for(var i,j,ci,cj,oldSrc,newSrc,list=info.list,catchFailList=[],catchSuccessList=[],failIMG=me.options.themePath+me.options.theme+"/images/img-cracked.png",i=0;ci=imgs[i++];)for(oldSrc=ci.getAttribute("_src")||ci.src||"",oldBgIMG=ci.getAttribute("data-background")||"",j=0;cj=list[j++];){if(oldSrc==cj.source&&"SUCCESS"==cj.state){newSrc=catcherUrlPrefix+cj.url,domUtils.removeClasses(ci,"loadingclass"),domUtils.setAttributes(ci,{src:newSrc,_src:newSrc,"data-catchResult":"img_catchSuccess"}),catchSuccessList.push(ci);break}if(oldSrc==cj.source&&"FAIL"==cj.state){domUtils.removeClasses(ci,"loadingclass"),domUtils.setAttributes(ci,{src:failIMG,_src:failIMG,"data-catchResult":"img_catchFail"}),catchFailList.push(ci);break}if(oldBgIMG==cj.source&&"SUCCESS"==cj.state){newBgIMG=catcherUrlPrefix+cj.url,ci.style.cssText=ci.style.cssText.replace(loadingIMG,newBgIMG),domUtils.removeAttributes(ci,"data-background"),domUtils.setAttributes(ci,{"data-catchResult":"img_catchSuccess"}),catchSuccessList.push(ci);break}if(oldBgIMG==cj.source&&"FAIL"==cj.state){ci.style.cssText=ci.style.cssText.replace(loadingIMG,failIMG),domUtils.removeAttributes(ci,"data-background"),domUtils.setAttributes(ci,{"data-catchResult":"img_catchFail"}),catchFailList.push(ci);break}}me.fireEvent("catchremotesuccess",catchSuccessList,catchFailList)},error:function(){me.fireEvent("catchremoteerror")}})}))},UE.commands.insertparagraph={execCommand:function(e,t){for(var i,n,o=this.selection.getRange(),r=o.startContainer;r&&!domUtils.isBody(r);)r=(i=r).parentNode;i&&(n=this.document.createElement("p"),t?i.parentNode.insertBefore(n,i):i.parentNode.insertBefore(n,i.nextSibling),domUtils.fillNode(this.document,n),o.setStart(n,0).setCursor(!1,!0))}},UE.plugins.template=function(){UE.commands.template={execCommand:function(e,t){t.html&&this.execCommand("inserthtml",t.html)}},this.addListener("click",function(e,t){var i=t.target||t.srcElement,t=this.selection.getRange(),i=domUtils.findParent(i,function(e){if(e.className&&domUtils.hasClass(e,"ue_t"))return e},!0);i&&t.selectNode(i).shrinkBoundary().select()}),this.addListener("keydown",function(e,t){var i=this.selection.getRange();i.collapsed||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(i=domUtils.findParent(i.startContainer,function(e){if(e.className&&domUtils.hasClass(e,"ue_t"))return e},!0))&&domUtils.removeClasses(i,["ue_t"])})},UE.plugin.register("autoupload",function(){function s(e){return e.dataTransfer&&e.dataTransfer.files?e.dataTransfer.files:null}return{outputRule:function(e){utils.each(e.getNodesByTagName("img"),function(e){/\b(loaderrorclass)|(bloaderrorclass)\b/.test(e.getAttr("class"))&&e.parentNode.removeChild(e)}),utils.each(e.getNodesByTagName("p"),function(e){/\bloadpara\b/.test(e.getAttr("class"))&&e.parentNode.removeChild(e)})},bindEvents:{defaultOptions:{enableDragUpload:!0,enablePasteUpload:!0},ready:function(e){var t,a=this;window.FormData&&window.FileReader&&(!(t=function(e){var t,i,n=!1;if(t="paste"==e.type?(i=e).clipboardData&&i.clipboardData.items&&1==i.clipboardData.items.length&&/^image\//.test(i.clipboardData.items[0].type)?i.clipboardData.items:null:s(e)){for(var o,r=t.length;r--;)(o=(o=t[r]).getAsFile?o.getAsFile():o)&&0<o.size&&(function(e,t){var i,o=t,n=/image\/\w+/i.test(e.type)?"image":"file",r="loading_"+(+new Date).toString(36),a=o.getOpt(n+"FieldName"),s=o.getOpt(n+"UrlPrefix"),l=o.getOpt(n+"MaxSize"),d=o.getOpt(n+"AllowFiles"),t=o.getActionUrl(o.getOpt(n+"ActionName")),c=function(e){var t=o.document.getElementById(r);t&&domUtils.remove(t),o.fireEvent("showmessage",{id:r,content:e,type:"error",timeout:4e3})},u="image"==n?(i='<img class="loadingclass" id="'+r+'" src="'+o.options.themePath+o.options.theme+'/images/spacer.gif">',function(e){var t=s+e.url,i=o.document.getElementById(r);i&&(domUtils.removeClasses(i,"loadingclass"),i.setAttribute("src",t),i.setAttribute("_src",t),i.setAttribute("alt",e.original||""),i.removeAttribute("id"),o.trigger("contentchange",i))}):(i='<p><img class="loadingclass" id="'+r+'" src="'+o.options.themePath+o.options.theme+'/images/spacer.gif"></p>',function(e){var t=s+e.url,i=o.document.getElementById(r),n=o.selection.getRange(),e=n.createBookmark();n.selectNode(i).select(),o.execCommand("insertfile",{url:t}),n.moveToBookmark(e).select()});o.execCommand("inserthtml",i),o.getOpt(n+"ActionName")?e.size>l?c(o.getLang("autoupload.exceedSizeError")):(l=e.name?e.name.substr(e.name.lastIndexOf(".")):"")&&"image"!=n||d&&-1==(d.join("")+".").indexOf(l.toLowerCase()+".")?c(o.getLang("autoupload.exceedTypeError")):(n=new XMLHttpRequest,d=new FormData,l=utils.serializeParam(o.queryCommandValue("serverparam"))||"",l=utils.formatUrl(t+(-1==t.indexOf("?")?"?":"&")+l),d.append(a,e,e.name||"blob."+e.type.substr("image/".length)),d.append("type","ajax"),n.open("post",l,!0),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.addEventListener("load",function(e){try{var t=new Function("return "+utils.trim(e.target.response))();"SUCCESS"==t.state&&t.url?u(t):c(t.state)}catch(e){c(o.getLang("autoupload.loadError"))}}),n.send(d)):c(o.getLang("autoupload.errorLoadConfig"))}(o,a),n=!0);n&&e.preventDefault()}})!==a.getOpt("enablePasteUpload")&&domUtils.on(a.body,"paste ",t),!1!==a.getOpt("enableDragUpload")?(domUtils.on(a.body,"drop",t),domUtils.on(a.body,"dragover",function(e){"Files"==e.dataTransfer.types[0]&&e.preventDefault()})):browser.gecko&&domUtils.on(a.body,"drop",function(e){s(e)&&e.preventDefault()}),utils.cssRule("loading",".loadingclass{display:inline-block;cursor:default;background: url('"+this.options.themePath+this.options.theme+"/images/loading.gif') no-repeat center center transparent;border:1px solid #cccccc;margin-left:1px;height: 22px;width: 22px;}\n.loaderrorclass{display:inline-block;cursor:default;background: url('"+this.options.themePath+this.options.theme+"/images/loaderror.png') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}",this.document))}}}}),UE.plugin.register("section",function(){function i(e){this.tag="",this.level=-1,this.dom=null,this.nextSection=null,this.previousSection=null,this.parentSection=null,this.startAddress=[],this.endAddress=[],this.children=[]}function h(e){var t=new i;return utils.extend(t,e)}function d(e,t){for(var i=t,n=0;n<e.length;n++){if(!i.childNodes)return null;i=i.childNodes[e[n]]}return i}var n=this;return{bindMultiEvents:{type:"aftersetcontent afterscencerestore",handler:function(){n.fireEvent("updateSections")}},bindEvents:{ready:function(){n.fireEvent("updateSections"),domUtils.on(n.body,"drop paste",function(){n.fireEvent("updateSections")})},afterexeccommand:function(e,t){"paragraph"==t&&n.fireEvent("updateSections")},keyup:function(e,t){var i;1==this.selection.getRange().collapsed&&13!=(i=t.keyCode||t.which)&&8!=i&&46!=i||this.fireEvent("updateSections")}},commands:{getsections:{execCommand:function(e,t){for(var u=t||["h1","h2","h3","h4","h5","h6"],i=0;i<u.length;i++)"string"==typeof u[i]?u[i]=function(t){return function(e){return e.tagName==t.toUpperCase()}}(u[i]):"function"!=typeof u[i]&&(u[i]=function(e){return null});var m=this,t=h({level:-1,title:"root"}),f=t;return function e(t,i){for(var n,o,r=null,a=t.childNodes,s=0,l=a.length;s<l;s++)if(0<=(n=function(e){for(var t=0;t<u.length;t++)if(u[t](e))return t;return-1}(o=a[s]))){for(var d=m.selection.getRange().selectNode(o).createAddress(!0).startAddress,d=h({tag:o.tagName,title:o.innerText||o.textContent||"",level:n,dom:o,startAddress:utils.clone(d,[]),endAddress:utils.clone(d,[]),children:[]}),c=(f.nextSection=d).previousSection=f;n<=c.level;)c=c.parentSection;(d.parentSection=c).children.push(d),r=f=d}else 1===o.nodeType&&e(o,i),r&&r.endAddress[r.endAddress.length-1]++}(m.body,t),t},notNeedUndo:!0},movesection:{execCommand:function(e,t,i,n){var o;if(t&&i&&-1!=i.level&&(o=d(i=n?i.endAddress:i.startAddress,this.body),i&&o&&!function(e,t,i){for(var n=!1,o=!1,r=0;r<e.length&&!(r>=i.length);r++){if(i[r]>e[r]){n=!0;break}if(i[r]<e[r])break}for(r=0;r<t.length&&!(r>=i.length);r++){if(i[r]<e[r]){o=!0;break}if(i[r]>e[r])break}return n&&o}(t.startAddress,t.endAddress,i))){var r,a,s=d(t.startAddress,this.body),l=d(t.endAddress,this.body);if(n)for(r=l;r&&!(domUtils.getPosition(s,r)&domUtils.POSITION_FOLLOWING)&&(a=r.previousSibling,domUtils.insertAfter(o,r),r!=s);)r=a;else for(r=s;r&&!(domUtils.getPosition(r,l)&domUtils.POSITION_FOLLOWING)&&(a=r.nextSibling,o.parentNode.insertBefore(r,o),r!=l);)r=a;this.fireEvent("updateSections")}}},deletesection:{execCommand:function(e,t,i){var n=this;if(t){var o,r=l(t.startAddress),a=l(t.endAddress),s=r;if(i)domUtils.remove(s);else for(;s&&domUtils.inDoc(a,n.document)&&!(domUtils.getPosition(s,a)&domUtils.POSITION_FOLLOWING);)o=s.nextSibling,domUtils.remove(s),s=o;n.fireEvent("updateSections")}function l(e){for(var t=n.body,i=0;i<e.length;i++){if(!t.childNodes)return null;t=t.childNodes[e[i]]}return t}}},selectsection:{execCommand:function(e,t){if(!t&&!t.dom)return!1;var i=this.selection.getRange(),t={startAddress:utils.clone(t.startAddress,[]),endAddress:utils.clone(t.endAddress,[])};return t.endAddress[t.endAddress.length-1]++,i.moveToAddress(t).select().scrollToView(),!0},notNeedUndo:!0},scrolltosection:{execCommand:function(e,t){if(!t&&!t.dom)return!1;var i=this.selection.getRange(),t={startAddress:t.startAddress,endAddress:t.endAddress};return t.endAddress[t.endAddress.length-1]++,i.moveToAddress(t).scrollToView(),!0},notNeedUndo:!0}}}}),UE.plugin.register("simpleupload",function(){var i,m=this,f=!1;function n(){var a=i.offsetWidth||20,s=i.offsetHeight||20,c=document.createElement("iframe"),u="display:block;width:"+a+"px;height:"+s+"px;overflow:hidden;border:0;margin:0;padding:0;position:absolute;top:0;left:0;filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity: 0;opacity: 0;cursor:pointer;";domUtils.on(c,"load",function(){var e,t,i=(+new Date).toString(36),n=(t=c.contentDocument||c.contentWindow.document).body;(e=t.createElement("div")).innerHTML='<form id="edui_form_'+i+'" target="edui_iframe_'+i+'" method="POST" enctype="multipart/form-data" action="'+m.getOpt("serverUrl")+'" style="'+u+'"><input id="edui_input_'+i+'" type="file" accept="image/*" name="'+m.options.imageFieldName+'" style="'+u+'"></form><iframe id="edui_iframe_'+i+'" name="edui_iframe_'+i+'" style="display:none;width:0;height:0;border:0;margin:0;padding:0;position:absolute;"></iframe>',e.className="edui-"+m.options.theme,e.id=m.ui.id+"_iframeupload",n.style.cssText=u,n.style.width=a+"px",n.style.height=s+"px",n.appendChild(e),n.parentNode&&(n.parentNode.style.width=a+"px",n.parentNode.style.height=a+"px");var o,l=t.getElementById("edui_form_"+i),r=t.getElementById("edui_input_"+i),d=t.getElementById("edui_iframe_"+i);domUtils.on(r,"change",function(){var a,e,t,i,n;function s(e){var t;a&&((t=m.document.getElementById(a))&&domUtils.remove(t),m.fireEvent("showmessage",{id:a,content:e,type:"error",timeout:4e3}))}r.value&&(a="loading_"+(+new Date).toString(36),e=utils.serializeParam(m.queryCommandValue("serverparam"))||"",t=m.getActionUrl(m.getOpt("imageActionName")),i=m.getOpt("imageAllowFiles"),m.focus(),m.execCommand("inserthtml",'<img class="loadingclass" id="'+a+'" src="'+m.options.themePath+m.options.theme+'/images/spacer.gif">'),m.getOpt("imageActionName")?!(n=(n=r.value)?n.substr(n.lastIndexOf(".")):"")||i&&-1==(i.join("")+".").indexOf(n.toLowerCase()+".")?s(m.getLang("simpleupload.exceedTypeError")):(domUtils.on(d,"load",function e(){try{var t,i=(d.contentDocument||d.contentWindow.document).body,n=i.innerText||i.textContent||"",o=new Function("return "+n)(),r=m.options.imageUrlPrefix+o.url;"SUCCESS"==o.state&&o.url?(t=m.document.getElementById(a),domUtils.removeClasses(t,"loadingclass"),t.setAttribute("src",r),t.setAttribute("_src",r),t.setAttribute("alt",o.original||""),t.removeAttribute("id"),m.fireEvent("contentchange")):s(o.state)}catch(e){s(m.getLang("simpleupload.loadError"))}l.reset(),domUtils.un(d,"load",e)}),l.action=utils.formatUrl(t+(-1==t.indexOf("?")?"?":"&")+e),l.submit()):errorHandler(m.getLang("autoupload.errorLoadConfig")))}),m.addListener("selectionchange",function(){clearTimeout(o),o=setTimeout(function(){var e=m.queryCommandState("simpleupload");r.disabled=-1==e&&"disabled"},400)}),f=!0}),c.style.cssText=u,i.appendChild(c)}return{bindEvents:{ready:function(){utils.cssRule("loading",".loadingclass{display:inline-block;cursor:default;background: url('"+this.options.themePath+this.options.theme+"/images/loading.gif') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}\n.loaderrorclass{display:inline-block;cursor:default;background: url('"+this.options.themePath+this.options.theme+"/images/loaderror.png') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}",this.document)},simpleuploadbtnready:function(e,t){i=t,m.afterConfigReady(n)}},outputRule:function(e){utils.each(e.getNodesByTagName("img"),function(e){/\b(loaderrorclass)|(bloaderrorclass)\b/.test(e.getAttr("class"))&&e.parentNode.removeChild(e)})},commands:{simpleupload:{queryCommandState:function(){return f?0:-1}}}}}),UE.plugin.register("serverparam",function(){var n={};return{commands:{serverparam:{execCommand:function(e,t,i){null==t?n={}:utils.isString(t)?null==i?delete n[t]:n[t]=i:utils.isObject(t)?utils.extend(n,t,!1):utils.isFunction(t)&&utils.extend(n,t(),!1)},queryCommandValue:function(){return n||{}}}}}}),UE.plugin.register("insertfile",function(){var c=this;return{commands:{insertfile:{execCommand:function(e,t){if(t=utils.isArray(t)?t:[t],!0!==c.fireEvent("beforeinsertfile",t)){for(var i,n,o,r,a="",s=c.getOpt("UEDITOR_HOME_URL"),l=s+("/"==s.substr(s.length-1)?"":"/")+"dialogs/attachment/fileTypeImages/",d=0;d<t.length;d++)o=l+(0,(r={rar:"icon_rar.gif",zip:"icon_rar.gif",tar:"icon_rar.gif",gz:"icon_rar.gif",bz2:"icon_rar.gif",doc:"icon_doc.gif",docx:"icon_doc.gif",pdf:"icon_pdf.gif",mp3:"icon_mp3.gif",xls:"icon_xls.gif",chm:"icon_chm.gif",ppt:"icon_ppt.gif",pptx:"icon_ppt.gif",avi:"icon_mv.gif",rmvb:"icon_mv.gif",wmv:"icon_mv.gif",flv:"icon_mv.gif",swf:"icon_mv.gif",rm:"icon_mv.gif",exe:"icon_exe.gif",psd:"icon_psd.gif",txt:"icon_txt.gif",jpg:"icon_jpg.gif",png:"icon_jpg.gif",jpeg:"icon_jpg.gif",gif:"icon_jpg.gif",ico:"icon_jpg.gif",bmp:"icon_jpg.gif"})[o=(n=(i=t[d]).url).substr(n.lastIndexOf(".")+1).toLowerCase()]?r[o]:r.txt),r=i.title||i.url.substr(i.url.lastIndexOf("/")+1),a+='<p style="line-height: 16px;"><img style="vertical-align: middle; margin-right: 2px;" src="'+o+'" _src="'+o+'" /><a style="font-size:12px; color:#0066cc;" href="'+i.url+'" title="'+r+'">'+r+"</a></p>";c.execCommand("insertHtml",a),c.fireEvent("afterinsertfile",t)}}}}}});var baidu=baidu||{},T7a,U7a,V7a,W7a,P7a,Q7a,R7a,Yha,Zha,$ha,_ha,a7a,b7a,c7a,d7a,Sha,Tha,Uha,Vha,Kha,Lha,Mha,Nha,o6a,p6a,q6a,r6a,s6a,t6a,u6a,v6a,w6a,x6a,Yga,Zga,$ga,_ga,a6a,Z5a,$5a,_5a,aga,O5a,P5a,Q5a,R5a,S5a,y5a,z5a,A5a,B5a,C5a,Sfa,Tfa,Ufa,Vfa,Wfa,Ifa,Jfa,Kfa,wfa,xfa,yfa,zfa,Afa,hfa,ifa,jfa,kfa,lfa,mfa,Y4a,Z4a,$4a,_4a,afa,N4a,O4a,P4a,Q4a,q4a,r4a,s4a,t4a,Wea,Xea,Yea,Zea,F3a,G3a,H3a,I3a,J3a,B3a,C3a,D3a,i3a,j3a,k3a,l3a,$2a,_2a,ada,bda,cda;function e7a(e){e=e.target||e.srcElement;if(!a7a.findParent(e,function(e){return a7a.hasClass(e,"edui-shortcutmenu")||a7a.hasClass(e,"edui-popup")},!0))for(var t,i=0;t=b7a[i++];)t.hide()}function Xfa(e){for(var t,i,n={},o=e.getDom(),r=e.editor.uid,a=domUtils.getElementsByTagName(o,"input"),s=a.length-1;t=a[s--];)if("checkbox"==t.getAttribute("type"))if(n[i=t.getAttribute("name")]&&delete n[i],t.checked){var l=document.getElementById(i+"Value"+r);if(l){if(/input/gi.test(l.tagName))n[i]=l.value;else for(var d,c=l.getElementsByTagName("input"),u=c.length-1;d=c[u--];)if(d.checked){n[i]=d.value;break}}else n[i]=!0}else n[i]=!1;else n[t.getAttribute("value")]=t.checked;for(var m,f=domUtils.getElementsByTagName(o,"select"),s=0;m=f[s++];){var h=m.getAttribute("name");n[h]=n[h]?m.value:""}Sfa.extend(e.editor.options.autotypeset,n),e.editor.setPreferences("autotypeset",n)}function dda(){var e=document.getElementById("edui_fixedlayer");cda.setViewportOffset(e,{left:0,top:0})}baidu.editor=baidu.editor||{},UE.ui=baidu.editor.ui={},$2a=baidu.editor.browser,_2a=baidu.editor.dom.domUtils,ada=window.$EDITORUI={},bda=0,cda=baidu.editor.ui.uiUtils={uid:function(e){return e?e.ID$EDITORUI||(e.ID$EDITORUI=++bda):++bda},hook:function(o,e){var r;return o&&o._callbacks?r=o:(r=function(){var e;o&&(e=o.apply(this,arguments));for(var t=r._callbacks,i=t.length;i--;){var n=t[i].apply(this,arguments);void 0===e&&(e=n)}return e})._callbacks=[],r._callbacks.push(e),r},createElementByHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,(t=t.firstChild).parentNode.removeChild(t),t},getViewportElement:function(){return $2a.ie&&$2a.quirks?document.body:document.documentElement},getClientRect:function(e){var t;try{t=e.getBoundingClientRect()}catch(e){t={left:0,top:0,height:0,width:0}}for(var i,n={left:Math.round(t.left),top:Math.round(t.top),height:Math.round(t.bottom-t.top),width:Math.round(t.right-t.left)};(i=e.ownerDocument)!==document&&(e=_2a.getWindow(i).frameElement);)t=e.getBoundingClientRect(),n.left+=t.left,n.top+=t.top;return n.bottom=n.top+n.height,n.right=n.left+n.width,n},getViewportRect:function(){var e=cda.getViewportElement(),t=0|(window.innerWidth||e.clientWidth),e=0|(window.innerHeight||e.clientHeight);return{left:0,top:0,height:e,width:t,bottom:e,right:t}},setViewportOffset:function(e,t){var i=cda.getFixedLayer();e.parentNode===i?(e.style.left=t.left+"px",e.style.top=t.top+"px"):_2a.setViewportOffset(e,t)},getEventOffset:function(e){var t=e.target||e.srcElement,t=cda.getClientRect(t),e=cda.getViewportOffsetByEvent(e);return{left:e.left-t.left,top:e.top-t.top}},getViewportOffsetByEvent:function(e){var t=e.target||e.srcElement,i=_2a.getWindow(t).frameElement,e={left:e.clientX,top:e.clientY};return i&&t.ownerDocument!==document&&(i=cda.getClientRect(i),e.left+=i.left,e.top+=i.top),e},setGlobal:function(e,t){return ada[e]=t,'$EDITORUI["'+e+'"]'},unsetGlobal:function(e){delete ada[e]},copyAttributes:function(e,t){for(var i=t.attributes,n=i.length;n--;){var o=i[n];"style"==o.nodeName||"class"==o.nodeName||$2a.ie&&!o.specified||e.setAttribute(o.nodeName,o.nodeValue)}t.className&&_2a.addClass(e,t.className),t.style.cssText&&(e.style.cssText+=";"+t.style.cssText)},removeStyle:function(e,t){if(e.style.removeProperty)e.style.removeProperty(t);else{if(!e.style.removeAttribute)throw"";e.style.removeAttribute(t)}},contains:function(e,t){return e&&t&&e!==t&&(e.contains?e.contains(t):16&e.compareDocumentPosition(t))},startDrag:function(e,n,t){t=t||document;var i,o=e.clientX,r=e.clientY;function a(e){var t=e.clientX-o,i=e.clientY-r;n.ondragmove(t,i,e),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function s(e){t.removeEventListener("mousemove",a,!0),t.removeEventListener("mouseup",s,!0),window.removeEventListener("mouseup",s,!0),n.ondragstop()}function l(){i.releaseCapture(),i.detachEvent("onmousemove",a),i.detachEvent("onmouseup",l),i.detachEvent("onlosecaptrue",l),n.ondragstop()}t.addEventListener?(t.addEventListener("mousemove",a,!0),t.addEventListener("mouseup",s,!0),window.addEventListener("mouseup",s,!0),e.preventDefault()):((i=e.srcElement).setCapture(),i.attachEvent("onmousemove",a),i.attachEvent("onmouseup",l),i.attachEvent("onlosecaptrue",l),e.returnValue=!1),n.ondragstart()},getFixedLayer:function(){var e=document.getElementById("edui_fixedlayer");return null==e&&((e=document.createElement("div")).id="edui_fixedlayer",document.body.appendChild(e),$2a.ie&&$2a.version<=8?(e.style.position="absolute",_2a.on(window,"scroll",dda),_2a.on(window,"resize",baidu.editor.utils.defer(dda,0,!0)),setTimeout(dda)):e.style.position="fixed",e.style.left="0",e.style.top="0",e.style.width="0",e.style.height="0"),e},makeUnselectable:function(e){if($2a.opera||$2a.ie&&$2a.version<9){if(e.unselectable="on",e.hasChildNodes())for(var t=0;t<e.childNodes.length;t++)1==e.childNodes[t].nodeType&&cda.makeUnselectable(e.childNodes[t])}else void 0!==e.style.MozUserSelect?e.style.MozUserSelect="none":void 0!==e.style.WebkitUserSelect?e.style.WebkitUserSelect="none":void 0!==e.style.KhtmlUserSelect&&(e.style.KhtmlUserSelect="none")}},i3a=baidu.editor.utils,j3a=baidu.editor.ui.uiUtils,k3a=baidu.editor.EventBase,l3a=baidu.editor.ui.UIBase=function(){},l3a.prototype={className:"",uiName:"",initOptions:function(e){for(var t in e)this[t]=e[t];this.id=this.id||"edui"+j3a.uid()},initUIBase:function(){this._globalKey=i3a.unhtml(j3a.setGlobal(this.id,this))},render:function(e){for(var t,i=this.renderHtml(),n=j3a.createElementByHtml(i),o=domUtils.getElementsByTagName(n,"*"),r="edui-"+(this.theme||this.editor.options.theme),i=document.getElementById("edui_fixedlayer"),a=0;t=o[a++];)domUtils.addClass(t,r);domUtils.addClass(n,r),i&&(i.className="",domUtils.addClass(i,r));i=this.getDom();null!=i?(i.parentNode.replaceChild(n,i),j3a.copyAttributes(n,i)):(e=(e="string"==typeof e?document.getElementById(e):e)||j3a.getFixedLayer(),domUtils.addClass(e,r),e.appendChild(n)),this.postRender()},getDom:function(e){return e?document.getElementById(this.id+"_"+e):document.getElementById(this.id)},postRender:function(){this.fireEvent("postrender")},getHtmlTpl:function(){return""},formatHtml:function(e){var t="edui-"+this.uiName;return e.replace(/##/g,this.id).replace(/%%-/g,this.uiName?t+"-":"").replace(/%%/g,(this.uiName?t:"")+" "+this.className).replace(/\$\$/g,this._globalKey)},renderHtml:function(){return this.formatHtml(this.getHtmlTpl())},dispose:function(){var e=this.getDom();e&&baidu.editor.dom.domUtils.remove(e),j3a.unsetGlobal(this.id)}},i3a.inherits(l3a,k3a),B3a=baidu.editor.utils,C3a=baidu.editor.ui.UIBase,D3a=baidu.editor.ui.Separator=function(e){this.initOptions(e),this.initSeparator()},D3a.prototype={uiName:"separator",initSeparator:function(){this.initUIBase()},getHtmlTpl:function(){return'<div id="##" class="edui-box %%"></div>'}},B3a.inherits(D3a,C3a),F3a=baidu.editor.utils,G3a=baidu.editor.dom.domUtils,H3a=baidu.editor.ui.UIBase,I3a=baidu.editor.ui.uiUtils,J3a=baidu.editor.ui.Mask=function(e){this.initOptions(e),this.initUIBase()},J3a.prototype={getHtmlTpl:function(){return'<div id="##" class="edui-mask %%" onclick="return $$._onClick(event, this);" onmousedown="return $$._onMouseDown(event, this);"></div>'},postRender:function(){var e=this;G3a.on(window,"resize",function(){setTimeout(function(){e.isHidden()||e._fill()})})},show:function(e){this._fill(),this.getDom().style.display="",this.getDom().style.zIndex=e},hide:function(){this.getDom().style.display="none",this.getDom().style.zIndex=""},isHidden:function(){return"none"==this.getDom().style.display},_onMouseDown:function(){return!1},_onClick:function(e,t){this.fireEvent("click",e,t)},_fill:function(){var e=this.getDom(),t=I3a.getViewportRect();e.style.width=t.width+"px",e.style.height=t.height+"px"}},F3a.inherits(J3a,H3a),function(){var e=baidu.editor.utils,l=baidu.editor.ui.uiUtils,d=baidu.editor.dom.domUtils,a=baidu.editor.ui.UIBase,t=baidu.editor.ui.Popup=function(e){this.initOptions(e),this.initPopup()},o=[];function i(e,t){for(var i=0;i<o.length;i++){var n=o[i];if(!n.isHidden()&&!1!==n.queryAutoHide(t)){if(e&&/scroll/gi.test(e.type)&&"edui-wordpastepop"==n.className)return;n.hide()}}o.length&&n.editor.fireEvent("afterhidepop")}t.postHide=i;var c=["edui-anchor-topleft","edui-anchor-topright","edui-anchor-bottomleft","edui-anchor-bottomright"];t.prototype={SHADOW_RADIUS:5,content:null,_hidden:!1,autoRender:!0,canSideLeft:!0,canSideUp:!0,initPopup:function(){this.initUIBase(),o.push(this)},getHtmlTpl:function(){return'<div id="##" class="edui-popup %%" onmousedown="return false;"> <div id="##_body" class="edui-popup-body"> <iframe style="position:absolute;z-index:-1;left:0;top:0;background-color: transparent;" frameborder="0" width="100%" height="100%" src="about:blank"></iframe> <div class="edui-shadow"></div> <div id="##_content" class="edui-popup-content">'+this.getContentHtmlTpl()+"  </div> </div></div>"},getContentHtmlTpl:function(){return this.content?"string"==typeof this.content?this.content:this.content.renderHtml():""},_UIBase_postRender:a.prototype.postRender,postRender:function(){if(this.content instanceof a&&this.content.postRender(),this.captureWheel&&!this.captured){this.captured=!0;var e=(document.documentElement.clientHeight||document.body.clientHeight)-80,t=this.getDom().offsetHeight,i=l.getClientRect(this.combox.getDom()).top,n=this.getDom("content"),o=this.getDom("body").getElementsByTagName("iframe"),r=this;for(o.length&&(o=o[0]);e<i+t;)t-=30;n.style.height=t+"px",o&&(o.style.height=t+"px"),window.XMLHttpRequest?d.on(n,"onmousewheel"in document.body?"mousewheel":"DOMMouseScroll",function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,e.wheelDelta?n.scrollTop-=e.wheelDelta/120*60:n.scrollTop-=e.detail/-3*60}):d.on(this.getDom(),"mousewheel",function(e){e.returnValue=!1,r.getDom("content").scrollTop-=e.wheelDelta/120*60})}this.fireEvent("postRenderAfter"),this.hide(!0),this._UIBase_postRender()},_doAutoRender:function(){!this.getDom()&&this.autoRender&&this.render()},mesureSize:function(){var e=this.getDom("content");return l.getClientRect(e)},fitSize:function(){if(this.captureWheel&&this.sized)return this.__size;this.sized=!0;var e=this.getDom("body");e.style.width="",e.style.height="";var t,i=this.mesureSize();return this.captureWheel?(e.style.width=-(-20-i.width)+"px",t=parseInt(this.getDom("content").style.height,10),window.isNaN(t)||(i.height=t)):e.style.width=i.width+"px",e.style.height=i.height+"px",this.__size=i,this.captureWheel&&(this.getDom("content").style.overflow="auto"),i},showAnchor:function(e,t){this.showAnchorRect(l.getClientRect(e),t)},showAnchorRect:function(e,t,i){this._doAutoRender();var n=l.getViewportRect();this.getDom().style.visibility="hidden",this._show();var o,r,a,s=this.fitSize(),s=t?(o=this.canSideLeft&&e.right+s.width>n.right&&e.left>s.width,r=this.canSideUp&&e.top+s.height>n.bottom&&e.bottom>s.height,a=o?e.left-s.width:e.right,r?e.bottom-s.height:e.top):(o=this.canSideLeft&&e.right+s.width>n.right&&e.left>s.width,r=this.canSideUp&&e.top+s.height>n.bottom&&e.bottom>s.height,a=o?e.right-s.width:e.left,r?e.top-s.height:e.bottom),e=this.getDom();l.setViewportOffset(e,{left:a,top:s}),d.removeClasses(e,c),e.className+=" "+c[2*(r?1:0)+(o?1:0)],this.editor&&(e.style.zIndex=+this.editor.container.style.zIndex+10,baidu.editor.ui.uiUtils.getFixedLayer().style.zIndex=e.style.zIndex-1),this.getDom().style.visibility="visible"},showAt:function(e){var t=e.left,e=e.top;this.showAnchorRect({left:t,top:e,right:t,bottom:e,height:0,width:0},!1,!0)},_show:function(){this._hidden&&(this.getDom().style.display="",this._hidden=!1,this.fireEvent("show"))},isHidden:function(){return this._hidden},show:function(){this._doAutoRender(),this._show()},hide:function(e){!this._hidden&&this.getDom()&&(this.getDom().style.display="none",this._hidden=!0,e||this.fireEvent("hide"))},queryAutoHide:function(e){return!e||!l.contains(this.getDom(),e)}},e.inherits(t,a),d.on(document,"mousedown",function(e){i(e,e.target||e.srcElement)}),d.on(window,"scroll",function(e,t){i(e,t)})}(),function(){var e=baidu.editor.utils,t=baidu.editor.ui.UIBase,i=baidu.editor.ui.ColorPicker=function(e){this.initOptions(e),this.noColorText=this.noColorText||this.editor.getLang("clearColor"),this.initUIBase()};i.prototype={getHtmlTpl:function(){return function(e,t){for(var i='<div id="##" class="edui-colorpicker %%"><div class="edui-colorpicker-topbar edui-clearfix"><div unselectable="on" id="##_preview" class="edui-colorpicker-preview"></div><div unselectable="on" class="edui-colorpicker-nocolor" onclick="$$._onPickNoColor(event, this);">'+e+'</div></div><table  class="edui-box" style="border-collapse: collapse;" onmouseover="$$._onTableOver(event, this);" onmouseout="$$._onTableOut(event, this);" onclick="return $$._onTableClick(event, this);" cellspacing="0" cellpadding="0"><tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#39C;padding-top: 2px"><td colspan="10">'+t.getLang("themeColor")+'</td> </tr><tr class="edui-colorpicker-tablefirstrow" >',n=0;n<o.length;n++)n&&n%10==0&&(i+="</tr>"+(60==n?'<tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#39C;"><td colspan="10">'+t.getLang("standardColor")+"</td></tr>":"")+"<tr"+(60==n?' class="edui-colorpicker-tablefirstrow"':"")+">"),i+=n<70?'<td style="padding: 0 2px;"><a hidefocus title="'+o[n]+'" onclick="return false;" href="javascript:" unselectable="on" class="edui-box edui-colorpicker-colorcell" data-color="#'+o[n]+'" style="background-color:#'+o[n]+";border:solid #ccc;"+(n<10||60<=n?"border-width:1px;":10<=n&&n<20?"border-width:1px 1px 0 1px;":"border-width:0 1px 0 1px;")+'"></a></td>':"";return i+"</tr></table></div>"}(this.noColorText,this.editor)},_onTableClick:function(e){e=(e.target||e.srcElement).getAttribute("data-color");e&&this.fireEvent("pickcolor",e)},_onTableOver:function(e){e=(e.target||e.srcElement).getAttribute("data-color");e&&(this.getDom("preview").style.backgroundColor=e)},_onTableOut:function(){this.getDom("preview").style.backgroundColor=""},_onPickNoColor:function(){this.fireEvent("picknocolor")}},e.inherits(i,t);var o="ffffff,000000,eeece1,1f497d,4f81bd,c0504d,9bbb59,8064a2,4bacc6,f79646,f2f2f2,7f7f7f,ddd9c3,c6d9f0,dbe5f1,f2dcdb,ebf1dd,e5e0ec,dbeef3,fdeada,d8d8d8,595959,c4bd97,8db3e2,b8cce4,e5b9b7,d7e3bc,ccc1d9,b7dde8,fbd5b5,bfbfbf,3f3f3f,938953,548dd4,95b3d7,d99694,c3d69b,b2a2c7,92cddc,fac08f,a5a5a5,262626,494429,17365d,366092,953734,76923c,5f497a,31859b,e36c09,7f7f7f,0c0c0c,1d1b10,0f243e,244061,632423,4f6128,3f3151,205867,974806,c00000,ff0000,ffc000,ffff00,92d050,00b050,00b0f0,0070c0,002060,7030a0,".split(",")}(),Wea=baidu.editor.utils,Xea=baidu.editor.ui.uiUtils,Yea=baidu.editor.ui.UIBase,Zea=baidu.editor.ui.TablePicker=function(e){this.initOptions(e),this.initTablePicker()},Zea.prototype={defaultNumRows:10,defaultNumCols:10,maxNumRows:20,maxNumCols:20,numRows:10,numCols:10,lengthOfCellSide:22,initTablePicker:function(){this.initUIBase()},getHtmlTpl:function(){return'<div id="##" class="edui-tablepicker %%"><div class="edui-tablepicker-body"><div class="edui-infoarea"><span id="##_label" class="edui-label"></span></div><div class="edui-pickarea" onmousemove="$$._onMouseMove(event, this);" onmouseover="$$._onMouseOver(event, this);" onmouseout="$$._onMouseOut(event, this);" onclick="$$._onClick(event, this);"><div id="##_overlay" class="edui-overlay"></div></div></div></div>'},_UIBase_render:Yea.prototype.render,render:function(e){this._UIBase_render(e),this.getDom("label").innerHTML="0"+this.editor.getLang("t_row")+" x 0"+this.editor.getLang("t_col")},_track:function(e,t){var i=this.getDom("overlay").style,n=this.lengthOfCellSide;i.width=e*n+"px",i.height=t*n+"px",this.getDom("label").innerHTML=e+this.editor.getLang("t_col")+" x "+t+this.editor.getLang("t_row"),this.numCols=e,this.numRows=t},_onMouseOver:function(e,t){e=e.relatedTarget||e.fromElement;Xea.contains(t,e)||t===e||(this.getDom("label").innerHTML="0"+this.editor.getLang("t_col")+" x 0"+this.editor.getLang("t_row"),this.getDom("overlay").style.visibility="")},_onMouseOut:function(e,t){e=e.relatedTarget||e.toElement;Xea.contains(t,e)||t===e||(this.getDom("label").innerHTML="0"+this.editor.getLang("t_col")+" x 0"+this.editor.getLang("t_row"),this.getDom("overlay").style.visibility="hidden")},_onMouseMove:function(e,t){this.getDom("overlay").style;var i=Xea.getEventOffset(e),n=this.lengthOfCellSide,e=Math.ceil(i.left/n),n=Math.ceil(i.top/n);this._track(e,n)},_onClick:function(){this.fireEvent("picktable",this.numCols,this.numRows)}},Wea.inherits(Zea,Yea),q4a=baidu.editor.browser,r4a=baidu.editor.dom.domUtils,s4a=baidu.editor.ui.uiUtils,t4a='onmousedown="$$.Stateful_onMouseDown(event, this);" onmouseup="$$.Stateful_onMouseUp(event, this);"'+(q4a.ie?' onmouseenter="$$.Stateful_onMouseEnter(event, this);" onmouseleave="$$.Stateful_onMouseLeave(event, this);"':' onmouseover="$$.Stateful_onMouseOver(event, this);" onmouseout="$$.Stateful_onMouseOut(event, this);"'),baidu.editor.ui.Stateful={alwalysHoverable:!1,target:null,Stateful_init:function(){this._Stateful_dGetHtmlTpl=this.getHtmlTpl,this.getHtmlTpl=this.Stateful_getHtmlTpl},Stateful_getHtmlTpl:function(){return this._Stateful_dGetHtmlTpl().replace(/stateful/g,function(){return t4a})},Stateful_onMouseEnter:function(e,t){this.target=t,this.isDisabled()&&!this.alwalysHoverable||(this.addState("hover"),this.fireEvent("over"))},Stateful_onMouseLeave:function(e,t){this.isDisabled()&&!this.alwalysHoverable||(this.removeState("hover"),this.removeState("active"),this.fireEvent("out"))},Stateful_onMouseOver:function(e,t){var i=e.relatedTarget;s4a.contains(t,i)||t===i||this.Stateful_onMouseEnter(e,t)},Stateful_onMouseOut:function(e,t){var i=e.relatedTarget;s4a.contains(t,i)||t===i||this.Stateful_onMouseLeave(e,t)},Stateful_onMouseDown:function(e,t){this.isDisabled()||this.addState("active")},Stateful_onMouseUp:function(e,t){this.isDisabled()||this.removeState("active")},Stateful_postRender:function(){this.disabled&&!this.hasState("disabled")&&this.addState("disabled")},hasState:function(e){return r4a.hasClass(this.getStateDom(),"edui-state-"+e)},addState:function(e){this.hasState(e)||(this.getStateDom().className+=" edui-state-"+e)},removeState:function(e){this.hasState(e)&&r4a.removeClasses(this.getStateDom(),["edui-state-"+e])},getStateDom:function(){return this.getDom("state")},isChecked:function(){return this.hasState("checked")},setChecked:function(e){!this.isDisabled()&&e?this.addState("checked"):this.removeState("checked")},isDisabled:function(){return this.hasState("disabled")},setDisabled:function(e){e?(this.removeState("hover"),this.removeState("checked"),this.removeState("active"),this.addState("disabled")):this.removeState("disabled")}},N4a=baidu.editor.utils,O4a=baidu.editor.ui.UIBase,P4a=baidu.editor.ui.Stateful,Q4a=baidu.editor.ui.Button=function(e){var t,i;e.name&&(t=e.name,i=e.cssRules,e.className||(e.className="edui-for-"+t),e.cssRules=".edui-"+(e.theme||"default")+" .edui-toolbar .edui-button.edui-for-"+t+" .edui-icon {"+i+"}"),this.initOptions(e),this.initButton()},Q4a.prototype={uiName:"button",label:"",title:"",showIcon:!0,showText:!0,cssRules:"",initButton:function(){this.initUIBase(),this.Stateful_init(),this.cssRules&&N4a.cssRule("edui-customize-"+this.name+"-style",this.cssRules)},getHtmlTpl:function(){return'<div id="##" class="edui-box %%"><div id="##_state" stateful><div class="%%-wrap"><div id="##_body" unselectable="on" '+(this.title?'title="'+this.title+'"':"")+' class="%%-body" onmousedown="return $$._onMouseDown(event, this);" onclick="return $$._onClick(event, this);">'+(this.showIcon?'<div class="edui-box edui-icon"></div>':"")+(this.showText?'<div class="edui-box edui-label">'+this.label+"</div>":"")+"</div></div></div></div>"},postRender:function(){this.Stateful_postRender(),this.setDisabled(this.disabled)},_onMouseDown:function(e){e=e.target||e.srcElement,e=e&&e.tagName&&e.tagName.toLowerCase();if("input"==e||"object"==e||"object"==e)return!1},_onClick:function(){this.isDisabled()||this.fireEvent("click")},setTitle:function(e){this.getDom("label").innerHTML=e}},N4a.inherits(Q4a,O4a),N4a.extend(Q4a.prototype,P4a),Y4a=baidu.editor.utils,Z4a=baidu.editor.ui.uiUtils,baidu.editor.dom.domUtils,$4a=baidu.editor.ui.UIBase,_4a=baidu.editor.ui.Stateful,afa=baidu.editor.ui.SplitButton=function(e){this.initOptions(e),this.initSplitButton()},afa.prototype={popup:null,uiName:"splitbutton",title:"",initSplitButton:function(){var e;this.initUIBase(),this.Stateful_init(),null!=this.popup&&(e=this.popup,this.popup=null,this.setPopup(e))},_UIBase_postRender:$4a.prototype.postRender,postRender:function(){this.Stateful_postRender(),this._UIBase_postRender()},setPopup:function(e){this.popup!==e&&(null!=this.popup&&this.popup.dispose(),e.addListener("show",Y4a.bind(this._onPopupShow,this)),e.addListener("hide",Y4a.bind(this._onPopupHide,this)),e.addListener("postrender",Y4a.bind(function(){e.getDom("body").appendChild(Z4a.createElementByHtml('<div id="'+this.popup.id+'_bordereraser" class="edui-bordereraser edui-background" style="width:'+(Z4a.getClientRect(this.getDom()).width+20)+'px"></div>')),e.getDom().className+=" "+this.className},this)),this.popup=e)},_onPopupShow:function(){this.addState("opened")},_onPopupHide:function(){this.removeState("opened")},getHtmlTpl:function(){return'<div id="##" class="edui-box %%"><div '+(this.title?'title="'+this.title+'"':"")+' id="##_state" stateful><div class="%%-body"><div id="##_button_body" class="edui-box edui-button-body" onclick="$$._onButtonClick(event, this);"><div class="edui-box edui-icon"></div></div><div class="edui-box edui-splitborder"></div><div class="edui-box edui-arrow" onclick="$$._onArrowClick();"></div></div></div></div>'},showPopup:function(){var e=Z4a.getClientRect(this.getDom());e.top-=this.popup.SHADOW_RADIUS,e.height+=this.popup.SHADOW_RADIUS,this.popup.showAnchorRect(e)},_onArrowClick:function(e,t){this.isDisabled()||this.showPopup()},_onButtonClick:function(){this.isDisabled()||this.fireEvent("buttonclick")}},Y4a.inherits(afa,$4a),Y4a.extend(afa.prototype,_4a,!0),hfa=baidu.editor.utils,ifa=baidu.editor.ui.uiUtils,jfa=baidu.editor.ui.ColorPicker,kfa=baidu.editor.ui.Popup,lfa=baidu.editor.ui.SplitButton,mfa=baidu.editor.ui.ColorButton=function(e){this.initOptions(e),this.initColorButton()},mfa.prototype={initColorButton:function(){var i=this;this.popup=new kfa({content:new jfa({noColorText:i.editor.getLang("clearColor"),editor:i.editor,onpickcolor:function(e,t){i._onPickColor(t)},onpicknocolor:function(e,t){i._onPickNoColor(t)}}),editor:i.editor}),this.initSplitButton()},_SplitButton_postRender:lfa.prototype.postRender,postRender:function(){this._SplitButton_postRender(),this.getDom("button_body").appendChild(ifa.createElementByHtml('<div id="'+this.id+'_colorlump" class="edui-colorlump"></div>')),this.getDom().className+=" edui-colorbutton"},setColor:function(e){this.getDom("colorlump").style.backgroundColor=e,this.color=e},_onPickColor:function(e){!1!==this.fireEvent("pickcolor",e)&&(this.setColor(e),this.popup.hide())},_onPickNoColor:function(e){!1!==this.fireEvent("picknocolor")&&this.popup.hide()}},hfa.inherits(mfa,lfa),wfa=baidu.editor.utils,xfa=baidu.editor.ui.Popup,yfa=baidu.editor.ui.TablePicker,zfa=baidu.editor.ui.SplitButton,Afa=baidu.editor.ui.TableButton=function(e){this.initOptions(e),this.initTableButton()},Afa.prototype={initTableButton:function(){var n=this;this.popup=new xfa({content:new yfa({editor:n.editor,onpicktable:function(e,t,i){n._onPickTable(t,i)}}),editor:n.editor}),this.initSplitButton()},_onPickTable:function(e,t){!1!==this.fireEvent("picktable",e,t)&&this.popup.hide()}},wfa.inherits(Afa,zfa),Ifa=baidu.editor.utils,Jfa=baidu.editor.ui.UIBase,Kfa=baidu.editor.ui.AutoTypeSetPicker=function(e){this.initOptions(e),this.initAutoTypeSetPicker()},Kfa.prototype={initAutoTypeSetPicker:function(){this.initUIBase()},getHtmlTpl:function(){var e=this.editor,t=e.options.autotypeset,i=e.getLang("autoTypeSet"),n="textAlignValue"+e.uid,o="imageBlockLineValue"+e.uid,r="symbolConverValue"+e.uid;return'<div id="##" class="edui-autotypesetpicker %%"><div class="edui-autotypesetpicker-body"><table ><tr><td nowrap><input type="checkbox" name="mergeEmptyline" '+(t.mergeEmptyline?"checked":"")+">"+i.mergeLine+'</td><td colspan="2"><input type="checkbox" name="removeEmptyline" '+(t.removeEmptyline?"checked":"")+">"+i.delLine+'</td></tr><tr><td nowrap><input type="checkbox" name="removeClass" '+(t.removeClass?"checked":"")+">"+i.removeFormat+'</td><td colspan="2"><input type="checkbox" name="indent" '+(t.indent?"checked":"")+">"+i.indent+'</td></tr><tr><td nowrap><input type="checkbox" name="textAlign" '+(t.textAlign?"checked":"")+">"+i.alignment+'</td><td colspan="2" id="'+n+'"><input type="radio" name="'+n+'" value="left" '+(t.textAlign&&"left"==t.textAlign?"checked":"")+">"+e.getLang("justifyleft")+'<input type="radio" name="'+n+'" value="center" '+(t.textAlign&&"center"==t.textAlign?"checked":"")+">"+e.getLang("justifycenter")+'<input type="radio" name="'+n+'" value="right" '+(t.textAlign&&"right"==t.textAlign?"checked":"")+">"+e.getLang("justifyright")+'</td></tr><tr><td nowrap><input type="checkbox" name="imageBlockLine" '+(t.imageBlockLine?"checked":"")+">"+i.imageFloat+'</td><td nowrap id="'+o+'"><input type="radio" name="'+o+'" value="none" '+(t.imageBlockLine&&"none"==t.imageBlockLine?"checked":"")+">"+e.getLang("default")+'<input type="radio" name="'+o+'" value="left" '+(t.imageBlockLine&&"left"==t.imageBlockLine?"checked":"")+">"+e.getLang("justifyleft")+'<input type="radio" name="'+o+'" value="center" '+(t.imageBlockLine&&"center"==t.imageBlockLine?"checked":"")+">"+e.getLang("justifycenter")+'<input type="radio" name="'+o+'" value="right" '+(t.imageBlockLine&&"right"==t.imageBlockLine?"checked":"")+">"+e.getLang("justifyright")+'</td></tr><tr><td nowrap><input type="checkbox" name="clearFontSize" '+(t.clearFontSize?"checked":"")+">"+i.removeFontsize+'</td><td colspan="2"><input type="checkbox" name="clearFontFamily" '+(t.clearFontFamily?"checked":"")+">"+i.removeFontFamily+'</td></tr><tr><td nowrap colspan="3"><input type="checkbox" name="removeEmptyNode" '+(t.removeEmptyNode?"checked":"")+">"+i.removeHtml+'</td></tr><tr><td nowrap colspan="3"><input type="checkbox" name="pasteFilter" '+(t.pasteFilter?"checked":"")+">"+i.pasteFilter+'</td></tr><tr><td nowrap><input type="checkbox" name="symbolConver" '+(t.bdc2sb||t.tobdc?"checked":"")+">"+i.symbol+'</td><td id="'+r+'"><input type="radio" name="bdc" value="bdc2sb" '+(t.bdc2sb?"checked":"")+">"+i.bdc2sb+'<input type="radio" name="bdc" value="tobdc" '+(t.tobdc?"checked":"")+">"+i.tobdc+'</td><td nowrap align="right"><button >'+i.run+"</button></td></tr></table></div></div>"},_UIBase_render:Jfa.prototype.render},Ifa.inherits(Kfa,Jfa),Sfa=baidu.editor.utils,Tfa=baidu.editor.ui.Popup,Ufa=baidu.editor.ui.AutoTypeSetPicker,Vfa=baidu.editor.ui.SplitButton,Wfa=baidu.editor.ui.AutoTypeSetButton=function(e){this.initOptions(e),this.initAutoTypeSetButton()},Wfa.prototype={initAutoTypeSetButton:function(){var s=this;this.popup=new Tfa({content:new Ufa({editor:s.editor}),editor:s.editor,hide:function(){!this._hidden&&this.getDom()&&(Xfa(this),this.getDom().style.display="none",this._hidden=!0,this.fireEvent("hide"))}});var t=0;this.popup.addListener("postRenderAfter",function(){var e,a=this;t||((e=this.getDom()).getElementsByTagName("button")[0].onclick=function(){Xfa(a),s.editor.execCommand("autotypeset"),a.hide()},domUtils.on(e,"click",function(e){var t=e.target||e.srcElement,e=s.editor.uid;if(t&&"INPUT"==t.tagName){if("imageBlockLine"==t.name||"textAlign"==t.name||"symbolConver"==t.name)for(var i=t.checked,n=document.getElementById(t.name+"Value"+e).getElementsByTagName("input"),o={imageBlockLine:"none",textAlign:"left",symbolConver:"tobdc"},r=0;r<n.length;r++)i?n[r].value==o[t.name]&&(n[r].checked="checked"):n[r].checked=!1;t.name!="imageBlockLineValue"+e&&t.name!="textAlignValue"+e&&"bdc"!=t.name||(e=t.parentNode.previousSibling.getElementsByTagName("input"))&&(e[0].checked=!0),Xfa(a)}}),t=1)}),this.initSplitButton()}},Sfa.inherits(Wfa,Vfa),y5a=baidu.editor.utils,z5a=baidu.editor.ui.Popup,A5a=baidu.editor.ui.Stateful,B5a=baidu.editor.ui.UIBase,C5a=baidu.editor.ui.CellAlignPicker=function(e){this.initOptions(e),this.initSelected(),this.initCellAlignPicker()},C5a.prototype={initSelected:function(){this.selected&&(this.selectedIndex=3*{top:0,middle:1,bottom:2}[this.selected.valign]+{left:0,center:1,right:2}[this.selected.align])},initCellAlignPicker:function(){this.initUIBase(),this.Stateful_init()},getHtmlTpl:function(){for(var e,t,i=["left","center","right"],n=[],o=0;o<9;o++)e=this.selectedIndex===o?' class="edui-cellalign-selected" ':"",0==(t=o%3)&&n.push("<tr>"),n.push('<td index="'+o+'" '+e+' stateful><div class="edui-icon edui-'+i[t]+'"></div></td>'),2==t&&n.push("</tr>");return'<div id="##" class="edui-cellalignpicker %%"><div class="edui-cellalignpicker-body"><table onclick="$$._onClick(event);">'+n.join("")+"</table></div></div>"},getStateDom:function(){return this.target},_onClick:function(e){var t=e.target||e.srcElement;/icon/.test(t.className)&&(this.items[t.parentNode.getAttribute("index")].onclick(),z5a.postHide(e))},_UIBase_render:B5a.prototype.render},y5a.inherits(C5a,B5a),y5a.extend(C5a.prototype,A5a,!0),O5a=baidu.editor.utils,P5a=baidu.editor.ui.Stateful,Q5a=baidu.editor.ui.uiUtils,R5a=baidu.editor.ui.UIBase,S5a=baidu.editor.ui.PastePicker=function(e){this.initOptions(e),this.initPastePicker()},S5a.prototype={initPastePicker:function(){this.initUIBase(),this.Stateful_init()},getHtmlTpl:function(){return'<div class="edui-pasteicon" onclick="$$._onClick(this)"></div><div class="edui-pastecontainer"><div class="edui-title">'+this.editor.getLang("pasteOpt")+'</div><div class="edui-button"><div title="'+this.editor.getLang("pasteSourceFormat")+'" onclick="$$.format(false)" stateful><div class="edui-richtxticon"></div></div><div title="'+this.editor.getLang("tagFormat")+'" onclick="$$.format(2)" stateful><div class="edui-tagicon"></div></div><div title="'+this.editor.getLang("pasteTextFormat")+'" onclick="$$.format(true)" stateful><div class="edui-plaintxticon"></div></div></div></div></div>'},getStateDom:function(){return this.target},format:function(e){this.editor.ui._isTransfer=!0,this.editor.fireEvent("pasteTransfer",e)},_onClick:function(e){var t=domUtils.getNextDomNode(e),i=Q5a.getViewportRect().height,n=Q5a.getClientRect(t);n.top+n.height>i?t.style.top=-n.height-e.offsetHeight+"px":t.style.top="",/hidden/gi.test(domUtils.getComputedStyle(t,"visibility"))?(t.style.visibility="visible",domUtils.addClass(e,"edui-state-opened")):(t.style.visibility="hidden",domUtils.removeClasses(e,"edui-state-opened"))},_UIBase_render:R5a.prototype.render},O5a.inherits(S5a,R5a),O5a.extend(S5a.prototype,P5a,!0),Z5a=baidu.editor.utils,$5a=baidu.editor.ui.uiUtils,_5a=baidu.editor.ui.UIBase,aga=baidu.editor.ui.Toolbar=function(e){this.initOptions(e),this.initToolbar()},aga.prototype={items:null,initToolbar:function(){this.items=this.items||[],this.initUIBase()},add:function(e,t){void 0===t?this.items.push(e):this.items.splice(t,0,e)},getHtmlTpl:function(){for(var e=[],t=0;t<this.items.length;t++)e[t]=this.items[t].renderHtml();return'<div id="##" class="edui-toolbar %%" onselectstart="return false;" onmousedown="return $$._onMouseDown(event, this);">'+e.join("")+"</div>"},postRender:function(){for(var e=this.getDom(),t=0;t<this.items.length;t++)this.items[t].postRender();$5a.makeUnselectable(e)},_onMouseDown:function(e){e=e.target||e.srcElement,e=e&&e.tagName&&e.tagName.toLowerCase();if("input"==e||"object"==e||"object"==e)return!1}},Z5a.inherits(aga,_5a),function(){var e=baidu.editor.utils,n=baidu.editor.dom.domUtils,o=baidu.editor.ui.uiUtils,t=baidu.editor.ui.UIBase,i=baidu.editor.ui.Popup,r=baidu.editor.ui.Stateful,a=baidu.editor.ui.CellAlignPicker,s=baidu.editor.ui.Menu=function(e){this.initOptions(e),this.initMenu()},l={renderHtml:function(){return'<div class="edui-menuitem edui-menuseparator"><div class="edui-menuseparator-inner"></div></div>'},postRender:function(){},queryAutoHide:function(){return!0}};s.prototype={items:null,uiName:"menu",initMenu:function(){this.items=this.items||[],this.initPopup(),this.initItems()},initItems:function(){for(var e=0;e<this.items.length;e++){var t=this.items[e];"-"==t?this.items[e]=this.getSeparator():t instanceof d||(t.editor=this.editor,t.theme=this.editor.options.theme,this.items[e]=this.createItem(t))}},getSeparator:function(){return l},createItem:function(e){return e.menu=this,new d(e)},_Popup_getContentHtmlTpl:i.prototype.getContentHtmlTpl,getContentHtmlTpl:function(){if(0==this.items.length)return this._Popup_getContentHtmlTpl();for(var e=[],t=0;t<this.items.length;t++){var i=this.items[t];e[t]=i.renderHtml()}return'<div class="%%-body">'+e.join("")+"</div>"},_Popup_postRender:i.prototype.postRender,postRender:function(){for(var i=this,e=0;e<this.items.length;e++){var t=this.items[e];t.ownerMenu=this,t.postRender()}n.on(this.getDom(),"mouseover",function(e){var t=(e=e||event).relatedTarget||e.fromElement,e=i.getDom();o.contains(e,t)||e===t||i.fireEvent("over")}),this._Popup_postRender()},queryAutoHide:function(e){if(e){if(o.contains(this.getDom(),e))return!1;for(var t=0;t<this.items.length;t++)if(!1===this.items[t].queryAutoHide(e))return!1}},clearItems:function(){for(var e=0;e<this.items.length;e++){var t=this.items[e];clearTimeout(t._showingTimer),clearTimeout(t._closingTimer),t.subMenu&&t.subMenu.destroy()}this.items=[]},destroy:function(){this.getDom()&&n.remove(this.getDom()),this.clearItems()},dispose:function(){this.destroy()}},e.inherits(s,i);var d=baidu.editor.ui.MenuItem=function(e){var t;this.initOptions(e),this.initUIBase(),this.Stateful_init(),!this.subMenu||this.subMenu instanceof s||(e.className&&-1!=e.className.indexOf("aligntd")?((t=this).subMenu.selected=this.editor.queryCommandValue("cellalignment"),this.subMenu=new i({content:new a(this.subMenu),parentMenu:t,editor:t.editor,destroy:function(){this.getDom()&&n.remove(this.getDom())}}),this.subMenu.addListener("postRenderAfter",function(){n.on(this.getDom(),"mouseover",function(){t.addState("opened")})})):this.subMenu=new s(this.subMenu))};d.prototype={label:"",subMenu:null,ownerMenu:null,uiName:"menuitem",alwalysHoverable:!0,getHtmlTpl:function(){return'<div id="##" class="%%" stateful onclick="$$._onClick(event, this);"><div class="%%-body">'+this.renderLabelHtml()+"</div></div>"},postRender:function(){var i=this;this.addListener("over",function(){i.ownerMenu.fireEvent("submenuover",i),i.subMenu&&i.delayShowSubMenu()}),this.subMenu&&(this.getDom().className+=" edui-hassubmenu",this.subMenu.render(),this.addListener("out",function(){i.delayHideSubMenu()}),this.subMenu.addListener("over",function(){clearTimeout(i._closingTimer),i._closingTimer=null,i.addState("opened")}),this.ownerMenu.addListener("hide",function(){i.hideSubMenu()}),this.ownerMenu.addListener("submenuover",function(e,t){t!==i&&i.delayHideSubMenu()}),this.subMenu._bakQueryAutoHide=this.subMenu.queryAutoHide,this.subMenu.queryAutoHide=function(e){return(!e||!o.contains(i.getDom(),e))&&this._bakQueryAutoHide(e)}),this.getDom().style.tabIndex="-1",o.makeUnselectable(this.getDom()),this.Stateful_postRender()},delayShowSubMenu:function(){var e=this;e.isDisabled()||(e.addState("opened"),clearTimeout(e._showingTimer),clearTimeout(e._closingTimer),e._closingTimer=null,e._showingTimer=setTimeout(function(){e.showSubMenu()},250))},delayHideSubMenu:function(){var e=this;e.isDisabled()||(e.removeState("opened"),clearTimeout(e._showingTimer),e._closingTimer||(e._closingTimer=setTimeout(function(){e.hasState("opened")||e.hideSubMenu(),e._closingTimer=null},400)))},renderLabelHtml:function(){return'<div class="edui-arrow"></div><div class="edui-box edui-icon"></div><div class="edui-box edui-label %%-label">'+(this.label||"")+"</div>"},getStateDom:function(){return this.getDom()},queryAutoHide:function(e){if(this.subMenu&&this.hasState("opened"))return this.subMenu.queryAutoHide(e)},_onClick:function(e,t){this.hasState("disabled")||!1!==this.fireEvent("click",e,t)&&(this.subMenu?this.showSubMenu():i.postHide(e))},showSubMenu:function(){var e=o.getClientRect(this.getDom());e.right-=5,e.left+=2,e.width-=7,e.top-=4,e.bottom+=4,e.height+=8,this.subMenu.showAnchorRect(e,!0,!0)},hideSubMenu:function(){this.subMenu.hide()}},e.inherits(d,t),e.extend(d.prototype,r,!0)}(),Yga=baidu.editor.utils,Zga=baidu.editor.ui.uiUtils,$ga=baidu.editor.ui.Menu,_ga=baidu.editor.ui.SplitButton,a6a=baidu.editor.ui.Combox=function(e){this.initOptions(e),this.initCombox()},a6a.prototype={uiName:"combox",onbuttonclick:function(){this.showPopup()},initCombox:function(){var e=this;this.items=this.items||[];for(var t=0;t<this.items.length;t++){var i=this.items[t];i.uiName="listitem",i.index=t,i.onclick=function(){e.selectByIndex(this.index)}}this.popup=new $ga({items:this.items,uiName:"list",editor:this.editor,captureWheel:!0,combox:this}),this.initSplitButton()},_SplitButton_postRender:_ga.prototype.postRender,postRender:function(){this._SplitButton_postRender(),this.setLabel(this.label||""),this.setValue(this.initValue||"")},showPopup:function(){var e=Zga.getClientRect(this.getDom());e.top+=1,--e.bottom,e.height-=2,this.popup.showAnchorRect(e)},getValue:function(){return this.value},setValue:function(e){var t=this.indexByValue(e);-1!=t?(this.selectedIndex=t,this.setLabel(this.items[t].label),this.value=this.items[t].value):(this.selectedIndex=-1,this.setLabel(this.getLabelForUnknowValue(e)),this.value=e)},setLabel:function(e){this.getDom("button_body").innerHTML=e,this.label=e},getLabelForUnknowValue:function(e){return e},indexByValue:function(e){for(var t=0;t<this.items.length;t++)if(e==this.items[t].value)return t;return-1},getItem:function(e){return this.items[e]},selectByIndex:function(e){e<this.items.length&&!1!==this.fireEvent("select",e)&&(this.selectedIndex=e,this.value=this.items[e].value,this.setLabel(this.items[e].label))}},Yga.inherits(a6a,_ga),r6a=baidu.editor.utils,s6a=baidu.editor.dom.domUtils,t6a=baidu.editor.ui.uiUtils,u6a=baidu.editor.ui.Mask,v6a=baidu.editor.ui.UIBase,w6a=baidu.editor.ui.Button,x6a=baidu.editor.ui.Dialog=function(e){var t,i;e.name&&(t=e.name,i=e.cssRules,e.className||(e.className="edui-for-"+t),i&&(e.cssRules=".edui-for-"+t+" .edui-dialog-content  {"+i+"}")),this.initOptions(r6a.extend({autoReset:!0,draggable:!0,onok:function(){},oncancel:function(){},onclose:function(e,t){return t?this.onok():this.oncancel()},holdScroll:!1},e)),this.initDialog()},x6a.prototype={draggable:!1,uiName:"dialog",initDialog:function(){var e=this,t=this.editor.options.theme;if(this.cssRules&&(this.cssRules=".edui-"+t+" "+this.cssRules,r6a.cssRule("edui-customize-"+this.name+"-style",this.cssRules)),this.initUIBase(),this.modalMask=o6a=o6a||new u6a({className:"edui-dialog-modalmask",theme:t,onclick:function(){q6a&&q6a.close(!1)}}),this.dragMask=p6a=p6a||new u6a({className:"edui-dialog-dragmask",theme:t}),this.closeButton=new w6a({className:"edui-dialog-closebutton",title:e.closeDialog,theme:t,onclick:function(){e.close(!1)}}),this.fullscreen&&this.initResizeEvent(),this.buttons)for(var i=0;i<this.buttons.length;i++)this.buttons[i]instanceof w6a||(this.buttons[i]=new w6a(r6a.extend(this.buttons[i],{editor:this.editor},!0)))},initResizeEvent:function(){var r=this;s6a.on(window,"resize",function(){r._hidden||void 0===r._hidden||(r.__resizeTimer&&window.clearTimeout(r.__resizeTimer),r.__resizeTimer=window.setTimeout(function(){r.__resizeTimer=null;var e=r.getDom(),t=r.getDom("content"),i=UE.ui.uiUtils.getClientRect(e),n=UE.ui.uiUtils.getClientRect(t),o=t6a.getViewportRect();t.style.width=o.width-i.width+n.width+"px",t.style.height=o.height-i.height+n.height+"px",e.style.width=o.width+"px",e.style.height=o.height+"px",r.fireEvent("resize")},100))})},fitSize:function(){var e=this.getDom("body"),t=70;e.querySelector(".edui-dialog-foot")||(t=30);var i=this.mesureSize(),n=t6a.getViewportRect(),o=i.width,r=i.height-t,a=n.width-2,n=n.height-t-2;a<o&&(r=r*a/o,o=a),n<r&&(o=o*n/r,r=n);a=o/i.width,n=e.querySelector(".edui-dialog-content");return n.dataset.dialogScaled||(n.dataset.dialogScaled=!0,n.style.width=o+"px",n.style.height=r+"px",(n=e.querySelector(".edui-dialog-content iframe")).style.width=i.width+"px",n.style.height=i.height+"px",n.style.transformOrigin="0 0",n.style.transform="scale("+a+")",i.width=o,i.height=r+t),e.style.width=i.width+"px",e.style.height=i.height+"px",i},safeSetOffset:function(e){var t=this.getDom(),i=t6a.getViewportRect(),n=t6a.getClientRect(t),o=e.left;o+n.width>i.right&&(o=i.right-n.width);e=e.top;e+n.height>i.bottom&&(e=i.bottom-n.height),t.style.left=Math.max(o,0)+"px",t.style.top=Math.max(e,0)+"px"},showAtCenter:function(){var e,t,i,n,o=t6a.getViewportRect();this.fullscreen?(t=this.getDom(),e=this.getDom("content"),t.style.display="block",i=UE.ui.uiUtils.getClientRect(t),n=UE.ui.uiUtils.getClientRect(e),t.style.left="-100000px",e.style.width=o.width-i.width+n.width+"px",e.style.height=o.height-i.height+n.height+"px",t.style.width=o.width+"px",t.style.height=o.height+"px",t.style.left=0,this._originalContext={html:{overflowX:document.documentElement.style.overflowX,overflowY:document.documentElement.style.overflowY},body:{overflowX:document.body.style.overflowX,overflowY:document.body.style.overflowY}},document.documentElement.style.overflowX="hidden",document.documentElement.style.overflowY="hidden",document.body.style.overflowX="hidden",document.body.style.overflowY="hidden"):(this.getDom().style.display="",i=this.fitSize(),n=0|this.getDom("titlebar").offsetHeight,t=o.width/2-i.width/2,i=o.height/2-(i.height-n)/2-n,n=this.getDom(),this.safeSetOffset({left:Math.max(0|t,0),top:Math.max(0|i,0)}),s6a.hasClass(n,"edui-state-centered")||(n.className+=" edui-state-centered")),this._show()},getContentHtml:function(){var e="";return"string"==typeof this.content?e=this.content:this.iframeUrl&&(e='<span id="'+this.id+'_contmask" class="dialogcontmask"></span><iframe id="'+this.id+'_iframe" class="%%-iframe" height="100%" width="100%" frameborder="0" src="'+this.iframeUrl+'"></iframe>'),e},getHtmlTpl:function(){var e="";if(this.buttons){for(var t=[],i=0;i<this.buttons.length;i++)t[i]=this.buttons[i].renderHtml();e='<div class="%%-foot"><div id="##_buttons" class="%%-buttons">'+t.join("")+"</div></div>"}return'<div id="##" class="%%"><div '+(this.fullscreen?'class="%%-wrap edui-dialog-fullscreen-flag"':'class="%%"')+'><div id="##_body" class="%%-body"><div class="%%-shadow"></div><div id="##_titlebar" class="%%-titlebar"><div class="%%-draghandle" onmousedown="$$._onTitlebarMouseDown(event, this);"><span class="%%-caption">'+(this.title||"")+"</span></div>"+this.closeButton.renderHtml()+'</div><div id="##_content" class="%%-content">'+(this.autoReset?"":this.getContentHtml())+"</div>"+e+"</div></div></div>"},postRender:function(){this.modalMask.getDom()||(this.modalMask.render(),this.modalMask.hide()),this.dragMask.getDom()||(this.dragMask.render(),this.dragMask.hide());var e=this;if(this.addListener("show",function(){e.modalMask.show(this.getDom().style.zIndex-2)}),this.addListener("hide",function(){e.modalMask.hide()}),this.buttons)for(var t=0;t<this.buttons.length;t++)this.buttons[t].postRender();s6a.on(window,"resize",function(){setTimeout(function(){e.isHidden()||e.safeSetOffset(t6a.getClientRect(e.getDom()))})}),this._hide()},mesureSize:function(){var e=this.getDom("body"),t=t6a.getClientRect(this.getDom("content")).width;return e.style.width=t,t6a.getClientRect(e)},_onTitlebarMouseDown:function(e,t){var i,n;this.draggable&&(t6a.getViewportRect(),n=this,t6a.startDrag(e,{ondragstart:function(){i=t6a.getClientRect(n.getDom()),n.getDom("contmask").style.visibility="visible",n.dragMask.show(n.getDom().style.zIndex-1)},ondragmove:function(e,t){e=i.left+e,t=i.top+t;n.safeSetOffset({left:e,top:t})},ondragstop:function(){n.getDom("contmask").style.visibility="hidden",s6a.removeClasses(n.getDom(),["edui-state-centered"]),n.dragMask.hide()}}))},reset:function(){this.getDom("content").innerHTML=this.getContentHtml(),this.fireEvent("dialogafterreset")},_show:function(){this._hidden&&(this.getDom().style.display="",this.editor.container.style.zIndex&&(this.getDom().style.zIndex=+this.editor.container.style.zIndex+10),this._hidden=!1,this.fireEvent("show"),baidu.editor.ui.uiUtils.getFixedLayer().style.zIndex=this.getDom().style.zIndex-4)},isHidden:function(){return this._hidden},_hide:function(){var e;this._hidden||((e=this.getDom()).style.display="none",e.style.zIndex="",e.style.width="",e.style.height="",this._hidden=!0,this.fireEvent("hide"))},open:function(){if(this.autoReset)try{this.reset()}catch(e){this.render(),this.open()}if(this.showAtCenter(),this.iframeUrl)try{this.getDom("iframe").focus()}catch(e){}q6a=this},_onCloseButtonClick:function(e,t){this.close(!1)},close:function(e){var t;!1!==this.fireEvent("close",e)&&(this.fullscreen&&(document.documentElement.style.overflowX=this._originalContext.html.overflowX,document.documentElement.style.overflowY=this._originalContext.html.overflowY,document.body.style.overflowX=this._originalContext.body.overflowX,document.body.style.overflowY=this._originalContext.body.overflowY,delete this._originalContext),this._hide(),t=this.getDom("content"),e=this.getDom("iframe"),t&&e&&((e=e.contentDocument||e.contentWindow.document)&&(e.body.innerHTML=""),s6a.remove(t)))}},r6a.inherits(x6a,v6a),Kha=baidu.editor.utils,Lha=baidu.editor.ui.Menu,Mha=baidu.editor.ui.SplitButton,Nha=baidu.editor.ui.MenuButton=function(e){this.initOptions(e),this.initMenuButton()},Nha.prototype={initMenuButton:function(){var t=this;this.uiName="menubutton",this.popup=new Lha({items:t.items,className:t.className,editor:t.editor}),this.popup.addListener("show",function(){for(var e=0;e<this.items.length;e++)this.items[e].removeState("checked"),this.items[e].value==t._value&&(this.items[e].addState("checked"),this.value=t._value)}),this.initSplitButton()},setValue:function(e){this._value=e}},Kha.inherits(Nha,Mha),Sha=baidu.editor.utils,Tha=baidu.editor.ui.Popup,Uha=baidu.editor.ui.SplitButton,Vha=baidu.editor.ui.MultiMenuPop=function(e){this.initOptions(e),this.initMultiMenu()},Vha.prototype={initMultiMenu:function(){var e=this;this.popup=new Tha({content:"",editor:e.editor,iframe_rendered:!1,onshow:function(){this.iframe_rendered||(this.iframe_rendered=!0,this.getDom("content").innerHTML='<iframe id="'+e.id+'_iframe" src="'+e.iframeUrl+'" frameborder="0"></iframe>',e.editor.container.style.zIndex&&(this.getDom().style.zIndex=+e.editor.container.style.zIndex+1))}}),this.onbuttonclick=function(){this.showPopup()},this.initSplitButton()}},Sha.inherits(Vha,Uha),Yha=baidu.editor.ui,Zha=Yha.UIBase,$ha=Yha.uiUtils,_ha=baidu.editor.utils,a7a=baidu.editor.dom.domUtils,b7a=[],c7a=!1,d7a=Yha.ShortCutMenu=function(e){this.initOptions(e),this.initShortCutMenu()},d7a.postHide=e7a,d7a.prototype={isHidden:!0,SPACE:5,initShortCutMenu:function(){this.items=this.items||[],this.initUIBase(),this.initItems(),this.initEvent(),b7a.push(this)},initEvent:function(){var e=this;e.editor.document,e.editor.addListener("afterhidepop",function(){e.isHidden||(c7a=!0)})},initItems:function(){if(_ha.isArray(this.items))for(var e=0,t=this.items.length;e<t;e++){var i=this.items[e].toLowerCase();Yha[i]&&(this.items[e]=new Yha[i](this.editor),this.items[e].className+=" edui-shortcutsubmenu ")}},setOpacity:function(e,t){browser.ie&&browser.version<9?e.style.filter="alpha(opacity = "+100*parseFloat(t)+");":e.style.opacity=t},getSubMenuMark:function(){c7a=!1;for(var e,t=$ha.getFixedLayer(),i=a7a.getElementsByTagName(t,"div",function(e){return a7a.hasClass(e,"edui-shortcutsubmenu edui-popup")}),n=0;e=i[n++];)"none"!=e.style.display&&(c7a=!0);return c7a},show:function(e,t){var i=this,n={},o=this.getDom(),r=$ha.getFixedLayer();function a(e){e.left<0&&(e.left=0),e.top<0&&(e.top=0),o.style.cssText="position:absolute;left:"+e.left+"px;top:"+e.top+"px;"}function s(e){e.tagName||(e=e.getDom()),n.left=parseInt(e.style.left),n.top=parseInt(e.style.top),n.top-=o.offsetHeight+15,a(n)}i.eventType=e.type,o.style.cssText="display:block;left:-9999px","contextmenu"==e.type&&t?(t=a7a.getElementsByTagName(r,"div","edui-contextmenu")[0])?s(t):i.editor.addListener("aftershowcontextmenu",function(e,t){s(t)}):((n=$ha.getViewportOffsetByEvent(e)).top-=o.offsetHeight+i.SPACE,n.left+=i.SPACE+20,a(n),i.setOpacity(o,1)),i.isHidden=!1,i.left=e.screenX+o.offsetWidth/2-i.SPACE,i.top=e.screenY-o.offsetHeight/2-i.SPACE,i.editor&&(o.style.zIndex=+i.editor.container.style.zIndex+10,r.style.zIndex=o.style.zIndex-1)},hide:function(){this.getDom()&&(this.getDom().style.display="none"),this.isHidden=!0},postRender:function(){if(_ha.isArray(this.items))for(var e,t=0;e=this.items[t++];)e.postRender()},getHtmlTpl:function(){if(_ha.isArray(this.items)){for(var e=[],t=0;t<this.items.length;t++)e[t]=this.items[t].renderHtml();e=e.join("")}else e=this.items;return'<div id="##" class="%% edui-toolbar" data-src="shortcutmenu" onmousedown="return false;" onselectstart="return false;" >'+e+"</div>"}},_ha.inherits(d7a,Zha),a7a.on(document,"mousedown",function(e){e7a(e)}),a7a.on(window,"scroll",function(e){e7a(e)}),P7a=baidu.editor.utils,Q7a=baidu.editor.ui.UIBase,R7a=baidu.editor.ui.Breakline=function(e){this.initOptions(e),this.initSeparator()},R7a.prototype={uiName:"Breakline",initSeparator:function(){this.initUIBase()},getHtmlTpl:function(){return"<br/>"}},P7a.inherits(R7a,Q7a),T7a=baidu.editor.utils,U7a=baidu.editor.dom.domUtils,V7a=baidu.editor.ui.UIBase,W7a=baidu.editor.ui.Message=function(e){this.initOptions(e),this.initMessage()},W7a.prototype={initMessage:function(){this.initUIBase()},getHtmlTpl:function(){return'<div id="##" class="edui-message %%"> <div id="##_closer" class="edui-message-closer">×</div> <div id="##_body" class="edui-message-body edui-message-type-info"> <iframe style="position:absolute;z-index:-1;left:0;top:0;background-color: transparent;" frameborder="0" width="100%" height="100%" src="about:blank"></iframe> <div class="edui-shadow"></div> <div id="##_content" class="edui-message-content">  </div> </div></div>'},reset:function(e){var t=this;e.keepshow||(clearTimeout(this.timer),t.timer=setTimeout(function(){t.hide()},e.timeout||4e3)),void 0!==e.content&&t.setContent(e.content),void 0!==e.type&&t.setType(e.type),t.show()},postRender:function(){var e=this,t=this.getDom("closer");t&&U7a.on(t,"click",function(){e.hide()})},setContent:function(e){this.getDom("content").innerHTML=e},setType:function(e){e=e||"info";var t=this.getDom("body");t.className=t.className.replace(/edui-message-type-[\w-]+/,"edui-message-type-"+e)},getContent:function(){return this.getDom("content").innerHTML},getType:function(){var e=this.getDom("body").match(/edui-message-type-([\w-]+)/);return e?e[1]:""},show:function(){this.getDom().style.display="block"},hide:function(){var e=this.getDom();e&&(e.style.display="none",e.parentNode&&e.parentNode.removeChild(e))}},T7a.inherits(W7a,V7a),function(){var l=baidu.editor.utils,d=baidu.editor.ui,t=d.Dialog;d.buttons={},d.Dialog=function(e){var n=new t(e);return n.addListener("hide",function(){if(n.editor){var e,t,i=n.editor;try{browser.gecko?(e=i.window.scrollY,t=i.window.scrollX,i.body.focus(),i.window.scrollTo(t,e)):i.focus()}catch(i){}}}),n};for(var s={anchor:"~/dialogs/anchor/anchor.html?20220503",insertimage:"~/dialogs/image/image.html?20220503",link:"~/dialogs/link/link.html?20220503",spechars:"~/dialogs/spechars/spechars.html?20220503",searchreplace:"~/dialogs/searchreplace/searchreplace.html?20220503",map:"~/dialogs/map/map.html?20220503",insertvideo:"~/dialogs/video/video.html?20220503",help:"~/dialogs/help/help.html?20220503",preview:"~/dialogs/preview/preview.html?20220503",emotion:"~/dialogs/emotion/emotion.html?20220503",wordimage:"~/dialogs/wordimage/wordimage.html?20220503",attachment:"~/dialogs/attachment/attachment.html?20220503",insertframe:"~/dialogs/insertframe/insertframe.html?20220503",edittip:"~/dialogs/table/edittip.html?20220503",edittable:"~/dialogs/table/edittable.html?20220503",edittd:"~/dialogs/table/edittd.html?20220503",scrawl:"~/dialogs/scrawl/scrawl.html?20220503",template:"~/dialogs/template/template.html?20220503",background:"~/dialogs/background/background.html?20220503"},e=["undo","redo","formatmatch","bold","italic","underline","fontborder","touppercase","tolowercase","strikethrough","subscript","superscript","source","indent","outdent","blockquote","pasteplain","pagebreak","selectall","print","horizontal","removeformat","time","date","unlink","insertparagraphbeforetable","insertrow","insertcol","mergeright","mergedown","deleterow","deletecol","splittorows","splittocols","splittocells","mergecells","deletetable"],i=0;n=e[i++];)n=n.toLowerCase(),d[n]=function(a){return function(o){var r=new d.Button({className:"edui-for-"+a,title:o.options.labelMap[a]||o.getLang("labelMap."+a)||"",onclick:function(){o.execCommand(a)},theme:o.options.theme,showText:!1});return d.buttons[a]=r,o.addListener("selectionchange",function(e,t,i){var n=o.queryCommandState(a);-1==n?(r.setDisabled(!0),r.setChecked(!1)):i||(r.setDisabled(!1),r.setChecked(n))}),r}}(n);d.cleardoc=function(e){var t=new d.Button({className:"edui-for-cleardoc",title:e.options.labelMap.cleardoc||e.getLang("labelMap.cleardoc")||"",theme:e.options.theme,onclick:function(){confirm(e.getLang("confirmClear"))&&e.execCommand("cleardoc")}});return d.buttons.cleardoc=t,e.addListener("selectionchange",function(){t.setDisabled(-1==e.queryCommandState("cleardoc"))}),t};var n,o={justify:["left","right","center","justify"],imagefloat:["none","left","center","right"],directionality:["ltr","rtl"]};for(r in o)!function(a,e){for(var t,i=0;t=e[i++];)!function(r){d[a.replace("float","")+r]=function(n){var o=new d.Button({className:"edui-for-"+a.replace("float","")+r,title:n.options.labelMap[a.replace("float","")+r]||n.getLang("labelMap."+a.replace("float","")+r)||"",theme:n.options.theme,onclick:function(){n.execCommand(a,r)}});return d.buttons[a]=o,n.addListener("selectionchange",function(e,t,i){o.setDisabled(-1==n.queryCommandState(a)),o.setChecked(n.queryCommandValue(a)==r&&!i)}),o}}(t)}(r,o[r]);for(i=0;n=["backcolor","forecolor"][i++];)d[n]=function(n){return function(i){var e=new d.ColorButton({className:"edui-for-"+n,color:"default",title:i.options.labelMap[n]||i.getLang("labelMap."+n)||"",editor:i,onpickcolor:function(e,t){i.execCommand(n,t)},onpicknocolor:function(){i.execCommand(n,"default"),this.setColor("transparent"),this.color="default"},onbuttonclick:function(){i.execCommand(n,this.color)}});return d.buttons[n]=e,i.addListener("selectionchange",function(){e.setDisabled(-1==i.queryCommandState(n))}),e}}(n);var r,a={noOk:["searchreplace","help","spechars","preview"],ok:["attachment","anchor","link","insertimage","map","insertframe","wordimage","insertvideo","insertframe","edittip","edittable","edittd","scrawl","template","background"]};for(r in a)!function(a,e){for(var t,i=0;t=e[i++];)browser.opera&&"searchreplace"===t||function(r){d[r]=function(t,e,i){var n;e=e||(t.options.iframeUrlMap||{})[r]||s[r],i=t.options.labelMap[r]||t.getLang("labelMap."+r)||"",e&&(n=new d.Dialog(l.extend({iframeUrl:t.ui.mapUrl(e),editor:t,className:"edui-for-"+r,title:i,holdScroll:"insertimage"===r,fullscreen:/preview/.test(r),closeDialog:t.getLang("closeDialog")},"ok"==a?{buttons:[{className:"edui-okbutton",label:t.getLang("ok"),editor:t,onclick:function(){n.close(!0)}},{className:"edui-cancelbutton",label:t.getLang("cancel"),editor:t,onclick:function(){n.close(!1)}}]}:{})),t.ui._dialogs[r+"Dialog"]=n);var o=new d.Button({className:"edui-for-"+r,title:i,onclick:function(){if((!t.options.toolbarCallback||!0!==t.options.toolbarCallback(r,t))&&n)switch(r){case"wordimage":var e=t.execCommand("wordimage");e&&e.length&&(n.render(),n.open());break;case"scrawl":-1!=t.queryCommandState("scrawl")&&(n.render(),n.open());break;default:n.render(),n.open()}},theme:t.options.theme,disabled:"scrawl"==r&&-1==t.queryCommandState("scrawl")});return d.buttons[r]=o,t.addListener("selectionchange",function(){var e;r in{edittable:1}||(e=t.queryCommandState(r),o.getDom()&&(o.setDisabled(-1==e),o.setChecked(e)))}),o}}(t.toLowerCase())}(r,a[r]);d.insertcode=function(n,e,o){e=n.options.insertcode||[],o=n.options.labelMap.insertcode||n.getLang("labelMap.insertcode")||"";var i=[];l.each(e,function(e,t){i.push({label:e,value:t,theme:n.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label" >'+(this.label||"")+"</div>"}})});var r=new d.Combox({editor:n,items:i,onselect:function(e,t){n.execCommand("insertcode",this.items[t].value)},onbuttonclick:function(){this.showPopup()},title:o,initValue:o,className:"edui-for-insertcode",indexByValue:function(e){if(e)for(var t,i=0;t=this.items[i];i++)if(-1!=t.value.indexOf(e))return i;return-1}});return d.buttons.insertcode=r,n.addListener("selectionchange",function(e,t,i){i||(-1==n.queryCommandState("insertcode")?r.setDisabled(!0):(r.setDisabled(!1),(i=n.queryCommandValue("insertcode"))?(i=i&&i.replace(/['"]/g,"").split(",")[0],r.setValue(i)):r.setValue(o)))}),r},d.fontfamily=function(n,e,t){if(e=n.options.fontfamily||[],t=n.options.labelMap.fontfamily||n.getLang("labelMap.fontfamily")||"",e.length){for(var i=0,o=[];a=e[i];i++){var r=n.getLang("fontfamily")[a.name]||"",r=a.label||r,a=a.val;o.push({label:r,value:a,theme:n.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label" style="font-family:'+l.unhtml(this.value)+'">'+(this.label||"")+"</div>"}})}var a,s=new d.Combox({editor:n,items:o,onselect:function(e,t){n.execCommand("FontFamily",this.items[t].value)},onbuttonclick:function(){this.showPopup()},title:t,initValue:t,className:"edui-for-fontfamily",indexByValue:function(e){if(e)for(var t,i=0;t=this.items[i];i++)if(-1!=t.value.indexOf(e))return i;return-1}});return d.buttons.fontfamily=s,n.addListener("selectionchange",function(e,t,i){i||(-1==n.queryCommandState("FontFamily")?s.setDisabled(!0):(s.setDisabled(!1),i=(i=n.queryCommandValue("FontFamily"))&&i.replace(/['"]/g,"").split(",")[0],s.setValue(i)))}),s}},d.fontsize=function(n,e,t){if(t=n.options.labelMap.fontsize||n.getLang("labelMap.fontsize")||"",(e=e||n.options.fontsize||[]).length){for(var i=[],o=0;o<e.length;o++){var r=e[o]+"px";i.push({label:r,value:r,theme:n.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label" style="line-height:1;font-size:'+this.value+'">'+(this.label||"")+"</div>"}})}var a=new d.Combox({editor:n,items:i,title:t,initValue:t,onselect:function(e,t){n.execCommand("FontSize",this.items[t].value)},onbuttonclick:function(){this.showPopup()},className:"edui-for-fontsize"});return d.buttons.fontsize=a,n.addListener("selectionchange",function(e,t,i){i||(-1==n.queryCommandState("FontSize")?a.setDisabled(!0):(a.setDisabled(!1),a.setValue(n.queryCommandValue("FontSize"))))}),a}},d.paragraph=function(n,e,t){if(t=n.options.labelMap.paragraph||n.getLang("labelMap.paragraph")||"",e=n.options.paragraph||[],!l.isEmptyObject(e)){var i,o=[];for(i in e)o.push({value:i,label:e[i]||n.getLang("paragraph")[i],theme:n.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label"><span class="edui-for-'+this.value+'">'+(this.label||"")+"</span></div>"}});var r=new d.Combox({editor:n,items:o,title:t,initValue:t,className:"edui-for-paragraph",onselect:function(e,t){n.execCommand("Paragraph",this.items[t].value)},onbuttonclick:function(){this.showPopup()}});return d.buttons.paragraph=r,n.addListener("selectionchange",function(e,t,i){i||(-1==n.queryCommandState("Paragraph")?r.setDisabled(!0):(r.setDisabled(!1),i=n.queryCommandValue("Paragraph"),-1!=r.indexByValue(i)?r.setValue(i):r.setValue(r.initValue)))}),r}},d.customstyle=function(n){var e=n.options.customstyle||[],t=n.options.labelMap.customstyle||n.getLang("labelMap.customstyle")||"";if(e.length){for(var i,o=n.getLang("customstyle"),r=0,a=[];i=e[r++];)!function(e){var t={};t.label=e.label||o[e.name],t.style=e.style,t.className=e.className,t.tag=e.tag,a.push({label:t.label,value:t,theme:n.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label"><'+t.tag+" "+(t.className?' class="'+t.className+'"':"")+(t.style?' style="'+t.style+'"':"")+">"+t.label+"</"+t.tag+"></div>"}})}(i);var s=new d.Combox({editor:n,items:a,title:t,initValue:t,className:"edui-for-customstyle",onselect:function(e,t){n.execCommand("customstyle",this.items[t].value)},onbuttonclick:function(){this.showPopup()},indexByValue:function(e){for(var t,i=0;t=this.items[i++];)if(t.label==e)return i-1;return-1}});return d.buttons.customstyle=s,n.addListener("selectionchange",function(e,t,i){i||(-1==n.queryCommandState("customstyle")?s.setDisabled(!0):(s.setDisabled(!1),i=n.queryCommandValue("customstyle"),-1!=s.indexByValue(i)?s.setValue(i):s.setValue(s.initValue)))}),s}},d.inserttable=function(n,e,t){t=n.options.labelMap.inserttable||n.getLang("labelMap.inserttable")||"";var i=new d.TableButton({editor:n,title:t,className:"edui-for-inserttable",onpicktable:function(e,t,i){n.execCommand("InsertTable",{numRows:i,numCols:t,border:1})},onbuttonclick:function(){this.showPopup()}});return d.buttons.inserttable=i,n.addListener("selectionchange",function(){i.setDisabled(-1==n.queryCommandState("inserttable"))}),i},d.lineheight=function(i){var e=i.options.lineheight||[];if(e.length){for(var t,n=0,o=[];t=e[n++];)o.push({label:t,value:t,theme:i.options.theme,onclick:function(){i.execCommand("lineheight",this.value)}});var r=new d.MenuButton({editor:i,className:"edui-for-lineheight",title:i.options.labelMap.lineheight||i.getLang("labelMap.lineheight")||"",items:o,onbuttonclick:function(){var e=i.queryCommandValue("LineHeight")||this.value;i.execCommand("LineHeight",e)}});return d.buttons.lineheight=r,i.addListener("selectionchange",function(){var e,t=i.queryCommandState("LineHeight");-1==t?r.setDisabled(!0):(r.setDisabled(!1),(e=i.queryCommandValue("LineHeight"))&&r.setValue((e+"").replace(/cm/,"")),r.setChecked(t))}),r}};for(var c,u=["top","bottom"],m=0;c=u[m++];)!function(a){d["rowspacing"+a]=function(i){var e=i.options["rowspacing"+a]||[];if(!e.length)return null;for(var t,n=0,o=[];t=e[n++];)o.push({label:t,value:t,theme:i.options.theme,onclick:function(){i.execCommand("rowspacing",this.value,a)}});var r=new d.MenuButton({editor:i,className:"edui-for-rowspacing"+a,title:i.options.labelMap["rowspacing"+a]||i.getLang("labelMap.rowspacing"+a)||"",items:o,onbuttonclick:function(){var e=i.queryCommandValue("rowspacing",a)||this.value;i.execCommand("rowspacing",e,a)}});return d.buttons[a]=r,i.addListener("selectionchange",function(){var e,t=i.queryCommandState("rowspacing",a);-1==t?r.setDisabled(!0):(r.setDisabled(!1),(e=i.queryCommandValue("rowspacing",a))&&r.setValue((e+"").replace(/%/,"")),r.setChecked(t))}),r}}(c);for(var f,h=["insertorderedlist","insertunorderedlist"],p=0;f=h[p++];)!function(a){d[a]=function(i){function e(){i.execCommand(a,this.value)}var t,n=i.options[a],o=[];for(t in n)o.push({label:n[t]||i.getLang()[a][t]||"",value:t,theme:i.options.theme,onclick:e});var r=new d.MenuButton({editor:i,className:"edui-for-"+a,title:i.getLang("labelMap."+a)||"",items:o,onbuttonclick:function(){var e=i.queryCommandValue(a)||this.value;i.execCommand(a,e)}});return d.buttons[a]=r,i.addListener("selectionchange",function(){var e,t=i.queryCommandState(a);-1==t?r.setDisabled(!0):(r.setDisabled(!1),e=i.queryCommandValue(a),r.setValue(e),r.setChecked(t))}),r}}(f);d.fullscreen=function(t,e){e=t.options.labelMap.fullscreen||t.getLang("labelMap.fullscreen")||"";var i=new d.Button({className:"edui-for-fullscreen",title:e,theme:t.options.theme,onclick:function(){t.ui&&t.ui.setFullScreen(!t.ui.isFullScreen()),this.setChecked(t.ui.isFullScreen())}});return d.buttons.fullscreen=i,t.addListener("selectionchange",function(){var e=t.queryCommandState("fullscreen");i.setDisabled(-1==e),i.setChecked(t.ui.isFullScreen())}),i},d.emotion=function(e,t){var i="emotion",n=new d.MultiMenuPop({title:e.options.labelMap[i]||e.getLang("labelMap."+i)||"",editor:e,className:"edui-for-"+i,iframeUrl:e.ui.mapUrl(t||(e.options.iframeUrlMap||{})[i]||s[i])});return d.buttons[i]=n,e.addListener("selectionchange",function(){n.setDisabled(-1==e.queryCommandState(i))}),n},d.autotypeset=function(e){var t=new d.AutoTypeSetButton({editor:e,title:e.options.labelMap.autotypeset||e.getLang("labelMap.autotypeset")||"",className:"edui-for-autotypeset",onbuttonclick:function(){e.execCommand("autotypeset")}});return d.buttons.autotypeset=t,e.addListener("selectionchange",function(){t.setDisabled(-1==e.queryCommandState("autotypeset"))}),t},d.simpleupload=function(o){var r="simpleupload",a=new d.Button({className:"edui-for-"+r,title:o.options.labelMap[r]||o.getLang("labelMap."+r)||"",onclick:function(){},theme:o.options.theme,showText:!1});return d.buttons[r]=a,o.addListener("ready",function(){var e=a.getDom("body").children[0];o.fireEvent("simpleuploadbtnready",e)}),o.addListener("selectionchange",function(e,t,i){var n=o.queryCommandState(r);-1==n?(a.setDisabled(!0),a.setChecked(!1)):i||(a.setDisabled(!1),a.setChecked(n))}),a}}(),function(){var m=baidu.editor.utils,t=baidu.editor.ui.uiUtils,r=baidu.editor.ui.UIBase,x=baidu.editor.dom.domUtils,a=[];function d(e){this.initOptions(e),this.initEditorUI()}d.prototype={uiName:"editor",initEditorUI:function(){(this.editor.ui=this)._dialogs={},this.initUIBase(),this._initToolbars();var l=this.editor,t=this;l.addListener("ready",function(){l.getDialog=function(e){return l.ui._dialogs[e+"Dialog"]},x.on(l.window,"scroll",function(e){baidu.editor.ui.Popup.postHide(e)}),l.ui._actualFrameWidth=l.options.initialFrameWidth,UE.browser.ie&&6===UE.browser.version&&l.container.ownerDocument.execCommand("BackgroundImageCache",!1,!0),l.options.elementPathEnabled&&(l.ui.getDom("elementpath").innerHTML='<div class="edui-editor-breadcrumb">'+l.getLang("elementPathTip")+":</div>"),l.options.wordCount&&(x.on(l.document,"click",function(){o(l,t),x.un(l.document,"click",arguments.callee)}),l.ui.getDom("wordcount").innerHTML=l.getLang("wordCountTip")),l.ui._scale(),l.options.scaleEnabled?(l.autoHeightEnabled&&l.disableAutoHeight(),t.enableScale()):t.disableScale(),l.options.elementPathEnabled||l.options.wordCount||l.options.scaleEnabled||(l.ui.getDom("elementpath").style.display="none",l.ui.getDom("wordcount").style.display="none",l.ui.getDom("scale").style.display="none"),l.selection.isFocus()&&l.fireEvent("selectionchange",!1,!0)}),l.addListener("mousedown",function(e,t){var i=t.target||t.srcElement;baidu.editor.ui.Popup.postHide(t,i),baidu.editor.ui.ShortCutMenu.postHide(t)}),l.addListener("delcells",function(){UE.ui.edittip&&new UE.ui.edittip(l),l.getDialog("edittip").open()});var n,e,i=!1;function o(e,t){e.setOpt({wordCount:!0,maximumWords:1e4,wordCountMsg:e.options.wordCountMsg||e.getLang("wordCountMsg"),wordOverFlowMsg:e.options.wordOverFlowMsg||e.getLang("wordOverFlowMsg")});var i=e.options,n=i.maximumWords,o=i.wordCountMsg,r=i.wordOverFlowMsg,t=t.getDom("wordcount");i.wordCount&&(n<(i=e.getContentLength(!0))?(t.innerHTML=r,e.fireEvent("wordcountoverflow")):t.innerHTML=o.replace("{#leave}",n-i).replace("{#count}",i))}l.addListener("afterpaste",function(){l.queryCommandState("pasteplain")||(baidu.editor.ui.PastePicker&&(n=new baidu.editor.ui.Popup({content:new baidu.editor.ui.PastePicker({editor:l}),editor:l,className:"edui-wordpastepop"})).render(),i=!0)}),l.addListener("afterinserthtml",function(){clearTimeout(e),e=setTimeout(function(){var e,t;n&&(i||l.ui._isTransfer)&&(n.isHidden()?(e=x.createElement(l.document,"span",{style:"line-height:0px;",innerHTML:"\ufeff"}),l.selection.getRange().insertNode(e),(t=getDomNode(e,"firstChild","previousSibling"))&&n.showAnchor(3==t.nodeType?t.parentNode:t),x.remove(e)):n.show(),delete l.ui._isTransfer,i=!1)},200)}),l.addListener("contextmenu",function(e,t){baidu.editor.ui.Popup.postHide(t)}),l.addListener("keydown",function(e,t){n&&n.dispose(t);var i=t.keyCode||t.which;t.altKey&&90==i&&UE.ui.buttons.fullscreen.onclick()}),l.addListener("wordcount",function(e){o(this,t)}),l.addListener("selectionchange",function(){l.options.elementPathEnabled&&t[(-1==l.queryCommandState("elementpath")?"dis":"en")+"ableElementPath"](),l.options.scaleEnabled&&t[(-1==l.queryCommandState("scale")?"dis":"en")+"ableScale"]()});var d=new baidu.editor.ui.Popup({editor:l,content:"",className:"edui-bubble",_onEditButtonClick:function(){this.hide(),l.ui._dialogs.linkDialog.open()},_onImgEditButtonClick:function(e){this.hide(),l.ui._dialogs[e]&&l.ui._dialogs[e].open()},_onImgSetFloat:function(e){this.hide(),l.execCommand("imagefloat",e)},_setIframeAlign:function(e){var t=d.anchorEl,i=t.cloneNode(!0);switch(e){case-2:i.setAttribute("align","");break;case-1:i.setAttribute("align","left");break;case 1:i.setAttribute("align","right")}t.parentNode.insertBefore(i,t),x.remove(t),d.anchorEl=i,d.showAnchor(d.anchorEl)},_updateIframe:function(){var e=l._iframe=d.anchorEl;x.hasClass(e,"ueditor_baidumap")?(l.selection.getRange().selectNode(e).select(),l.ui._dialogs.mapDialog.open()):l.ui._dialogs.insertframeDialog.open(),d.hide()},_onRemoveButtonClick:function(e){l.execCommand(e),this.hide()},queryAutoHide:function(e){return e&&e.ownerDocument==l.document&&("img"==e.tagName.toLowerCase()||x.findParentByTagName(e,"a",!0))?e!==d.anchorEl:baidu.editor.ui.Popup.prototype.queryAutoHide.call(this,e)}});d.render(),l.options.imagePopup&&(l.addListener("mouseover",function(e,t){var i=(t=t||window.event).target||t.srcElement;l.ui._dialogs.insertframeDialog&&/iframe/gi.test(i.tagName)&&((t=d.formatHtml('<nobr><span onclick=$$._setIframeAlign(-2) class="edui-clickable">'+l.getLang("default")+'</span>&nbsp;&nbsp;<span onclick=$$._setIframeAlign(-1) class="edui-clickable">'+l.getLang("justifyleft")+'</span>&nbsp;&nbsp;<span onclick=$$._setIframeAlign(1) class="edui-clickable">'+l.getLang("justifyright")+'</span>&nbsp;&nbsp; <span onclick="$$._updateIframe( this);" class="edui-clickable">'+l.getLang("modify")+"</span></nobr>"))?(d.getDom("content").innerHTML=t,d.anchorEl=i,d.showAnchor(d.anchorEl)):d.hide())}),l.addListener("selectionchange",function(e,t){if(t){var i,n,o="",r="",a=l.selection.getRange().getClosedNode(),s=l.ui._dialogs;if(a&&"IMG"==a.tagName){t="insertimageDialog";if(-1==a.className.indexOf("edui-faked-video")&&-1==a.className.indexOf("edui-upload-video")||(t="insertvideoDialog"),-1!=a.src.indexOf("http://api.map.baidu.com")&&(t="mapDialog"),a.getAttribute("anchorname")&&(t="anchorDialog",o=d.formatHtml('<nobr><span onclick=$$._onImgEditButtonClick("anchorDialog") class="edui-clickable">'+l.getLang("modify")+"</span>&nbsp;&nbsp;<span onclick=$$._onRemoveButtonClick('anchor') class=\"edui-clickable\">"+l.getLang("delete")+"</span></nobr>")),a.getAttribute("word_img")&&(l.word_img=[a.getAttribute("word_img")],t="wordimageDialog"),!s[t=x.hasClass(a,"loadingclass")||x.hasClass(a,"loaderrorclass")?"":t])return;r='<nobr><span onclick=$$._onImgSetFloat("none") class="edui-clickable">'+l.getLang("default")+'</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("left") class="edui-clickable">'+l.getLang("justifyleft")+'</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("right") class="edui-clickable">'+l.getLang("justifyright")+'</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("center") class="edui-clickable">'+l.getLang("justifycenter")+"</span>&nbsp;&nbsp;<span onclick=\"$$._onImgEditButtonClick('"+t+'\');" class="edui-clickable">'+l.getLang("modify")+"</span></nobr>",o=o||d.formatHtml(r)}!l.ui._dialogs.linkDialog||(n=l.queryCommandValue("link"))&&(i=n.getAttribute("_href")||n.getAttribute("href",2))&&(30<(r=i).length&&(r=i.substring(0,20)+"..."),o&&(o+='<div style="height:5px;"></div>'),o+=d.formatHtml("<nobr>"+l.getLang("anchorMsg")+': <a target="_blank" href="'+i+'" title="'+i+'" >'+r+'</a> <span class="edui-clickable" onclick="$$._onEditButtonClick();">'+l.getLang("modify")+'</span> <span class="edui-clickable" onclick="$$._onRemoveButtonClick(\'unlink\');"> '+l.getLang("clear")+"</span></nobr>"),d.showAnchor(n)),o?(d.getDom("content").innerHTML=o,d.anchorEl=a||n,d.showAnchor(d.anchorEl)):d.hide()}}))},_initToolbars:function(){for(var e=this.editor,t=this.toolbars||[],i=[],n=[],o=0;o<t.length;o++){for(var r=t[o],a=new baidu.editor.ui.Toolbar({theme:e.options.theme}),s=0;s<r.length;s++){var l=r[s],d=null;if("string"==typeof l){"||"==(l="|"==(l=l.toLowerCase())?"Separator":l)&&(l="Breakline");var c=baidu.editor.ui[l];if(c)if(m.isFunction(c))d=new baidu.editor.ui[l](e);else{if(c.id&&c.id!=e.key)continue;var u=c.execFn.call(e,e,l);if(u){if(void 0===c.index){a.add(u);continue}n.push({index:c.index,itemUI:u})}}if("fullscreen"==l){i&&i[0]?i[0].items.splice(0,0,d):d&&a.items.splice(0,0,d);continue}}else d=l;d&&d.id&&a.add(d)}i[o]=a}m.each(n,function(e){a.add(e.itemUI,e.index)}),this.toolbars=i},getHtmlTpl:function(){return'<div id="##" class="%%"><div id="##_toolbarbox" class="%%-toolbarbox">'+(this.toolbars.length?'<div id="##_toolbarboxouter" class="%%-toolbarboxouter"><div class="%%-toolbarboxinner">'+this.renderToolbarBoxHtml()+"</div></div>":"")+'<div id="##_toolbarmsg" class="%%-toolbarmsg" style="display:none;"><div id = "##_upload_dialog" class="%%-toolbarmsg-upload" onclick="$$.showWordImageDialog();">'+this.editor.getLang("clickToUpload")+'</div><div class="%%-toolbarmsg-close" onclick="$$.hideToolbarMsg();">x</div><div id="##_toolbarmsg_label" class="%%-toolbarmsg-label"></div><div style="height:0;overflow:hidden;clear:both;"></div></div><div id="##_message_holder" class="%%-messageholder"></div></div><div id="##_iframeholder" class="%%-iframeholder"></div><div id="##_bottombar" class="%%-bottomContainer"><table><tr><td id="##_elementpath" class="%%-bottombar"></td><td id="##_wordcount" class="%%-wordcount"></td><td id="##_scale" class="%%-scale"><div class="%%-icon"></div></td></tr></table></div><div id="##_scalelayer"></div></div>'},showWordImageDialog:function(){this._dialogs.wordimageDialog.open()},renderToolbarBoxHtml:function(){for(var e=[],t=0;t<this.toolbars.length;t++)e.push(this.toolbars[t].renderHtml());return e.join("")},setFullScreen:function(e){var t,i,n=this.editor,o=n.container.parentNode.parentNode;if(this._fullscreen!=e){if(this._fullscreen=e,this.editor.fireEvent("beforefullscreenchange",e),baidu.editor.browser.gecko&&(t=n.selection.getRange().createBookmark()),e){for(;"BODY"!=o.tagName;){var r=baidu.editor.dom.domUtils.getComputedStyle(o,"position");a.push(r),o.style.position="static",o=o.parentNode}this._bakHtmlOverflow=document.documentElement.style.overflow,this._bakBodyOverflow=document.body.style.overflow,this._bakAutoHeight=this.editor.autoHeightEnabled,this._bakScrollTop=Math.max(document.documentElement.scrollTop,document.body.scrollTop),this._bakEditorContaninerWidth=n.iframe.parentNode.offsetWidth,this._bakAutoHeight&&(n.autoHeightEnabled=!1,this.editor.disableAutoHeight()),document.documentElement.style.overflow="hidden",window.scrollTo(0,window.scrollY),this._bakCssText=this.getDom().style.cssText,this._bakCssText1=this.getDom("iframeholder").style.cssText,n.iframe.parentNode.style.width="",this._updateFullScreen()}else{for(;"BODY"!=o.tagName;)o.style.position=a.shift(),o=o.parentNode;this.getDom().style.cssText=this._bakCssText,this.getDom("iframeholder").style.cssText=this._bakCssText1,this._bakAutoHeight&&(n.autoHeightEnabled=!0,this.editor.enableAutoHeight()),document.documentElement.style.overflow=this._bakHtmlOverflow,document.body.style.overflow=this._bakBodyOverflow,n.iframe.parentNode.style.width=this._bakEditorContaninerWidth+"px",window.scrollTo(0,this._bakScrollTop)}browser.gecko&&"true"===n.body.contentEditable&&(i=document.createElement("input"),document.body.appendChild(i),n.body.contentEditable=!1,setTimeout(function(){i.focus(),setTimeout(function(){n.body.contentEditable=!0,n.fireEvent("fullscreenchanged",e),n.selection.getRange().moveToBookmark(t).select(!0),baidu.editor.dom.domUtils.remove(i),e&&window.scroll(0,0)},0)},0)),"true"===n.body.contentEditable&&(this.editor.fireEvent("fullscreenchanged",e),this.triggerLayout())}},_updateFullScreen:function(){if(this._fullscreen){var e=t.getViewportRect();if(this.getDom().style.cssText="border:0;position:absolute;left:0;top:"+(this.editor.options.topOffset||0)+"px;width:"+e.width+"px;height:"+e.height+"px;z-index:"+(+this.getDom().style.zIndex+100),t.setViewportOffset(this.getDom(),{left:0,top:this.editor.options.topOffset||0}),this.editor.setHeight(e.height-this.getDom("toolbarbox").offsetHeight-this.getDom("bottombar").offsetHeight-(this.editor.options.topOffset||0),!0),browser.gecko)try{window.onresize()}catch(e){}}},_updateElementPath:function(){var e,t=this.getDom("elementpath");if(this.elementPathEnabled&&(e=this.editor.queryCommandValue("elementpath"))){for(var i,n=[],o=0;i=e[o];o++)n[o]=this.formatHtml('<span unselectable="on" onclick="$$.editor.execCommand(&quot;elementpath&quot;, &quot;'+o+'&quot;);">'+i+"</span>");t.innerHTML='<div class="edui-editor-breadcrumb" onmousedown="return false;">'+this.editor.getLang("elementPathTip")+": "+n.join(" &gt; ")+"</div>"}else t.style.display="none"},disableElementPath:function(){var e=this.getDom("elementpath");e.innerHTML="",e.style.display="none",this.elementPathEnabled=!1},enableElementPath:function(){this.getDom("elementpath").style.display="",this.elementPathEnabled=!0,this._updateElementPath()},_scale:function(){var t=document,e=this.editor,i=e.container,n=e.document,o=this.getDom("toolbarbox"),r=this.getDom("bottombar"),a=this.getDom("scale"),s=this.getDom("scalelayer"),l=!1,d=null,c=0,u=e.options.minFrameWidth,m=0,f=0,h=0,p=0;function g(){d=x.getXY(i),c=c||e.options.minFrameHeight+o.offsetHeight+r.offsetHeight,s.style.cssText="position:absolute;left:0;display:;top:0;background-color:#41ABFF;opacity:0.4;filter: Alpha(opacity=40);width:"+i.offsetWidth+"px;height:"+i.offsetHeight+"px;z-index:"+(e.options.zIndex+1),x.on(t,"mousemove",v),x.on(n,"mouseup",y),x.on(t,"mouseup",y)}var b=this;function v(e){C();e=e||window.event;m=e.pageX||t.documentElement.scrollLeft+e.clientX,f=e.pageY||t.documentElement.scrollTop+e.clientY,h=m-d.x,p=f-d.y,u<=h&&(l=!0,s.style.width=h+"px"),c<=p&&(l=!0,s.style.height=p+"px")}function y(){l&&(l=!1,e.ui._actualFrameWidth=s.offsetWidth-2,i.style.width=e.ui._actualFrameWidth+"px",e.setHeight(s.offsetHeight-r.offsetHeight-o.offsetHeight-2,!0)),s&&(s.style.display="none"),C(),x.un(t,"mousemove",v),x.un(n,"mouseup",y),x.un(t,"mouseup",y)}function C(){browser.ie?t.selection.clear():window.getSelection().removeAllRanges()}this.editor.addListener("fullscreenchanged",function(e,t){t?b.disableScale():b.editor.options.scaleEnabled&&(b.enableScale(),t=b.editor.document.createElement("span"),b.editor.body.appendChild(t),b.editor.body.style.height=Math.max(x.getXY(t).y,b.editor.iframe.offsetHeight-20)+"px",x.remove(t))}),this.enableScale=function(){1!=e.queryCommandState("source")&&(a.style.display="",this.scaleEnabled=!0,x.on(a,"mousedown",g))},this.disableScale=function(){a.style.display="none",this.scaleEnabled=!1,x.un(a,"mousedown",g)}},isFullScreen:function(){return this._fullscreen},postRender:function(){r.prototype.postRender.call(this);for(var e=0;e<this.toolbars.length;e++)this.toolbars[e].postRender();function t(){clearTimeout(i),i=setTimeout(function(){n._updateFullScreen()})}var i,n=this,o=baidu.editor.dom.domUtils;o.on(window,"resize",t),n.addListener("destroy",function(){o.un(window,"resize",t),clearTimeout(i)})},showToolbarMsg:function(e,t){this.getDom("toolbarmsg_label").innerHTML=e,this.getDom("toolbarmsg").style.display="",t||(this.getDom("upload_dialog").style.display="none")},hideToolbarMsg:function(){this.getDom("toolbarmsg").style.display="none"},mapUrl:function(e){return e?e.replace("~/",this.editor.options.UEDITOR_CORS_URL||""):""},triggerLayout:function(){var e=this.getDom();"1"==e.style.zoom?e.style.zoom="100%":e.style.zoom="1"}},m.inherits(d,baidu.editor.ui.UIBase);var n={};UE.ui.Editor=function(e){var s=new UE.Editor(e);s.options.editor=s,m.loadFile(document,{href:s.options.themePath+s.options.theme+"/css/ueditor.css",tag:"link",type:"text/css",rel:"stylesheet"});var l=s.render;return s.render=function(a){a.constructor===String&&(s.key=a,n[a]=s),m.domReady(function(){function e(){s.setOpt({labelMap:s.options.labelMap||s.getLang("labelMap")}),new d(s.options),a&&((a=a.constructor===String?document.getElementById(a):a)&&a.getAttribute("name")&&(s.options.textarea=a.getAttribute("name")),a&&/script|textarea/gi.test(a.tagName))&&(t=document.createElement("div"),a.parentNode.insertBefore(t,a),e=a.value||a.innerHTML,s.options.initialContent=/^[\t\r\n ]*$/.test(e)?s.options.initialContent:e.replace(/>[\n\r\t]+([ ]{4})+/g,">").replace(/[\n\r\t]+([ ]{4})+</g,"<").replace(/>[\n\r\t]+</g,"><"),a.className&&(t.className=a.className),a.style.cssText&&(t.style.cssText=a.style.cssText),/textarea/i.test(a.tagName)?(s.textarea=a,s.textarea.style.display="none"):a.parentNode.removeChild(a),a.id&&(t.id=a.id,x.removeAttributes(a,"id")),(a=t).innerHTML=""),x.addClass(a,"edui-"+s.options.theme),s.ui.render(a);var e=s.options;s.container=s.ui.getDom();for(var t,i,n=x.findParents(a,!0),o=[],r=0;i=n[r];r++)o[r]=i.style.display,i.style.display="block";for(e.initialFrameWidth?e.minFrameWidth=e.initialFrameWidth:(e.minFrameWidth=e.initialFrameWidth=a.offsetWidth,t=a.style.width,/%$/.test(t)&&(e.initialFrameWidth=t)),e.initialFrameHeight?e.minFrameHeight=e.initialFrameHeight:e.initialFrameHeight=e.minFrameHeight=a.offsetHeight,r=0;i=n[r];r++)i.style.display=o[r];a.style.height&&(a.style.height=""),s.container.style.width=e.initialFrameWidth+(/%$/.test(e.initialFrameWidth)?"":"px"),s.container.style.zIndex=e.zIndex,l.call(s,s.ui.getDom("iframeholder")),s.fireEvent("afteruiready")}s.langIsReady?e():s.addListener("langReady",e)})},s},UE.getEditor=function(e,t){var i=n[e];return i||(i=n[e]=new UE.ui.Editor(t)).render(e),i},UE.delEditor=function(e){var t;(t=n[e])&&(t.key&&t.destroy(),delete n[e])},UE.registerUI=function(e,t,i,n){m.each(e.split(/\s+/),function(e){baidu.editor.ui[e]={id:n,execFn:t,index:i}})}}(),UE.registerUI("message",function(e){var o,r=baidu.editor.ui.Message,a=[],s=e;function l(){var e;o&&s.ui&&((e=s.ui.getDom("toolbarbox"))&&(o.style.top=e.offsetHeight+3+"px"),o.style.zIndex=Math.max(s.options.zIndex,s.iframe.style.zIndex)+1)}s.setOpt("enableMessageShow",!0),!1!==s.getOpt("enableMessageShow")&&(s.addListener("ready",function(){o=document.getElementById(s.ui.id+"_message_holder"),l(),setTimeout(function(){l()},500)}),s.addListener("showmessage",function(e,t){t=utils.isString(t)?{content:t}:t;var i=new r({timeout:t.timeout,type:t.type,content:t.content,keepshow:t.keepshow,editor:s}),n=t.id||"msg_"+(+new Date).toString(36);return i.render(o),(a[n]=i).reset(t),l(),n}),s.addListener("updatemessage",function(e,t,i){i=utils.isString(i)?{content:i}:i;t=a[t];t.render(o),t&&t.reset(i)}),s.addListener("hidemessage",function(e,t){t=a[t];t&&t.hide()}))})}()},302:function(e,t,i){!function(r){var a=i(303);i(304),UE.registerUI("wechatcustomemotion",function(i,e){var n=window.__msCDN+"asset/image/emotion/",o=null;return new UE.ui.Button({name:e,title:"插入表情",cssRules:"background-position: -500px 0;",onclick:function(){if(o)return!1;var e=r('<div class="editor-wechatcustomemotion"></div>');e.attr("id","editor-wechatcustomemotion");for(var t=0;t<a.records.length;t++)e.append('<a href="javascript:;" class="item" data-key="'+a.records[t].key+'" data-val="'+a.records[t].val+'"><img src="'+n+a.records[t].val+'@2x.png" /></a>');o=window.MS.dialog.dialogContent(e.prop("outerHTML"),{shadeClose:!1,openCallback:function(){r("#editor-wechatcustomemotion").on("click","a.item",function(){var e=r(this).attr("data-key"),t=r(this).attr("data-val");i.execCommand("insertHtml",'<img data-key="'+e+'" data-val="'+t+'" src="'+n+t+'@2x.png" height="20" style="vertical-align:middle;" />'),window.MS.dialog.dialogClose(o),o=null})}})}})})}.call(this,i(6))},303:function(e,t){const n={records:[{key:"[微笑]",val:"01"},{key:"[撇嘴]",val:"02"},{key:"[色]",val:"03"},{key:"[发呆]",val:"04"},{key:"[得意]",val:"05"},{key:"[流泪]",val:"06"},{key:"[害羞]",val:"07"},{key:"[闭嘴]",val:"08"},{key:"[睡]",val:"09"},{key:"[大哭]",val:"10"},{key:"[尴尬]",val:"11"},{key:"[发怒]",val:"12"},{key:"[调皮]",val:"13"},{key:"[呲牙]",val:"14"},{key:"[惊讶]",val:"15"},{key:"[难过]",val:"16"},{key:"[酷]",val:"17"},{key:"[冷汗]",val:"18"},{key:"[抓狂]",val:"19"},{key:"[吐]",val:"20"},{key:"[偷笑]",val:"21"},{key:"[愉快]",val:"22"},{key:"[白眼]",val:"23"},{key:"[傲慢]",val:"24"},{key:"[饥饿]",val:"25"},{key:"[困]",val:"26"},{key:"[惊恐]",val:"27"},{key:"[流汗]",val:"28"},{key:"[憨笑]",val:"29"},{key:"[悠闲]",val:"30"},{key:"[奋斗]",val:"31"},{key:"[咒骂]",val:"32"},{key:"[疑问]",val:"33"},{key:"[嘘]",val:"34"},{key:"[晕]",val:"35"},{key:"[疯了]",val:"36"},{key:"[衰]",val:"37"},{key:"[骷髅]",val:"38"},{key:"[敲打]",val:"39"},{key:"[再见]",val:"40"},{key:"[擦汗]",val:"41"},{key:"[抠鼻]",val:"42"},{key:"[鼓掌]",val:"43"},{key:"[糗大了]",val:"44"},{key:"[坏笑]",val:"45"},{key:"[左哼哼]",val:"46"},{key:"[右哼哼]",val:"47"},{key:"[哈欠]",val:"48"},{key:"[鄙视]",val:"49"},{key:"[委屈]",val:"50"},{key:"[快哭了]",val:"51"},{key:"[阴险]",val:"52"},{key:"[亲亲]",val:"53"},{key:"[吓]",val:"54"},{key:"[可怜]",val:"55"},{key:"[菜刀]",val:"56"},{key:"[西瓜]",val:"57"},{key:"[啤酒]",val:"58"},{key:"[篮球]",val:"59"},{key:"[乒乓]",val:"60"},{key:"[咖啡]",val:"61"},{key:"[饭]",val:"62"},{key:"[猪头]",val:"63"},{key:"[玫瑰]",val:"64"},{key:"[凋谢]",val:"65"},{key:"[嘴唇]",val:"66"},{key:"[爱心]",val:"67"},{key:"[心碎]",val:"68"},{key:"[蛋糕]",val:"69"},{key:"[闪电]",val:"70"},{key:"[炸弹]",val:"71"},{key:"[刀]",val:"72"},{key:"[足球]",val:"73"},{key:"[瓢虫]",val:"74"},{key:"[便便]",val:"75"},{key:"[月亮]",val:"76"},{key:"[太阳]",val:"77"},{key:"[礼物]",val:"78"},{key:"[拥抱]",val:"79"},{key:"[强]",val:"80"},{key:"[弱]",val:"81"},{key:"[握手]",val:"82"},{key:"[胜利]",val:"83"},{key:"[抱拳]",val:"84"},{key:"[勾引]",val:"85"},{key:"[拳头]",val:"86"},{key:"[差劲]",val:"87"},{key:"[爱你]",val:"88"},{key:"[NO]",val:"89"},{key:"[OK]",val:"90"},{key:"[爱情]",val:"91"},{key:"[飞吻]",val:"92"},{key:"[跳跳]",val:"93"},{key:"[发抖]",val:"94"},{key:"[怄火]",val:"95"},{key:"[转圈]",val:"96"},{key:"[磕头]",val:"97"},{key:"[回头]",val:"98"},{key:"[跳绳]",val:"99"},{key:"[投降]",val:"100"},{key:"[激动]",val:"101"},{key:"[乱舞]",val:"102"},{key:"[献吻]",val:"103"},{key:"[左太极]",val:"104"},{key:"[右太极]",val:"105"}],replaceText:function(e){for(var t=0;t<n.records.length;t++){var i='<img src="'+window.__msCDN+"asset/image/emotion/"+n.records[t].val+'@2x.png" height="20" style="vertical-align:middle;" />';e=e.replaceAll(n.records[t].key,i)}return e}};e.exports=n},304:function(e,t,i){"use strict";i.r(t);var n=i(12),n=i.n(n),i=i(262);n()(i.a,{insert:"head",singleton:!1}),t.default=i.a.locals||{}},305:function(e,t,i){!function(n){UE.registerUI("formula",function(i,e){return new UE.ui.Button({name:e,title:"插入公式",onclick:function(){var e=n('<div class="ub-panel tw-w-80">\n<div class="head">\n    <div class="title">添加公式</div>\n</div>\n<div class="body">\n    <textarea class="form tw-w-full" rows="3" style="min-height:3rem;" data-formula-content>$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$</textarea>\n</div>\n<div class="body">\n    <button class="btn" data-formula-confirm>确定</button>\n    <span class="ub-text-muted">\n        请输入 <a href="https://www.mathjax.org/" target="_blank">mathjax</a> 公式\n    </span>\n</div>\n</div>');e.attr("id","editor-formula");let t=window.MS.dialog.dialogContent(e.prop("outerHTML"),{shadeClose:!1,openCallback:function(){n("#editor-formula").on("click","[data-formula-confirm]",function(){var e=n("#editor-formula").find("[data-formula-content]").val();e?(e="&nbsp;<code class='formula'>"+e.trim()+"</code>&nbsp;",i.execCommand("insertHtml",e)):window.MS.dialog.tipError("内容为空"),window.MS.dialog.dialogClose(t)})}})}})})}.call(this,i(6))},6:function(e,t){e.exports=window.$}});