!function(){"use strict";var t,e,n,i,r,o,s,a=tinymce.util.Tools.resolve("tinymce.ThemeManager"),l=tinymce.util.Tools.resolve("tinymce.Env"),u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Delay"),d=function(t){return t.reduce(function(t,e){return Array.isArray(e)?t.concat(d(e)):t.concat(e)},[])},f={flatten:d},h=function(t,e){for(var n=0;n0})):s:W.isBoolean(r)&&!1===r?[]:o})},O=tinymce.util.Tools.resolve("tinymce.geom.Rect"),B=function(t,e){return{rect:t,position:e}},L=function(t,e){return{x:e.x,y:e.y,w:t.w,h:t.h}},I=function(t,e,n,i,r){var o,s,a,l={x:i.x,y:i.y,w:i.w+(i.w-1},ot=function(t,e){for(var n=t.length,i=new Array(n),r=0;r=0;n--)e(t[n],n,t)},lt=function(t,e){for(var n=[],i=0,r=t.length;i0&&(t+=" "),t+=this.prefix+this.cls[e];return t};var Ct,Et,Ht,St=/^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,Mt=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,Tt=/^\s*|\s*$/g,Pt=bt.extend({init:function(t){var e=this.match;function n(t,n,r){var o;function s(t){t&&n.push(t)}return s(function(t){if(t)return t=t.toLowerCase(),function(e){return"*"===t||e.type===t}}((o=St.exec(t.replace(Tt,"")))[1])),s(function(t){if(t)return function(e){return e._name===t}}(o[2])),s(function(t){if(t)return t=t.split("."),function(e){for(var n=t.length;n--;)if(!e.classes.contains(t[n]))return!1;return!0}}(o[3])),s(function(t,e,n){if(t)return function(i){var r=i[t]?i[t]():"";return e?"="===e?r===n:"*="===e?r.indexOf(n)>=0:"~="===e?(" "+r+" ").indexOf(" "+n+" ")>=0:"!="===e?r!==n:"^="===e?0===r.indexOf(n):"$="===e&&r.substr(r.length-n.length)===n:!!n}}(o[4],o[5],o[6])),s(function(t){var n;if(t)return(t=/(?:not\((.+)\))|(.+)/i.exec(t))[1]?(n=i(t[1],[]),function(t){return!e(t,n)}):(t=t[2],function(e,n,i){return"first"===t?0===n:"last"===t?n===i-1:"even"===t?n%2==0:"odd"===t?n%2==1:!!e[t]&&e[t]()})}(o[7])),n.pseudo=!!o[7],n.direct=r,n}function i(t,e){var r,o,s,a=[];do{if(Mt.exec(""),(o=Mt.exec(t))&&(t=o[3],a.push(o[1]),o[2])){r=o[3];break}}while(o);for(r&&i(r,e),t=[],s=0;s"!==a[s]&&t.push(n(a[s],[],">"===a[s-1]));return e.push(t),e}this._selectors=i(t,[])},match:function(t,e){var n,i,r,o,s,a,l,u,c,d,f,h,m;for(n=0,i=(e=e||this._selectors).length;n=0;r--)for(u=s[r];m;){if(u.pseudo)for(c=d=(f=m.parent().items()).length;c--&&f[c]!==m;);for(a=0,l=u.length;a1&&(i=function(t){for(var e,n=[],i=t.length;i--;)(e=t[i]).__checked||(n.push(e),e.__checked=1);for(i=n.length;i--;)delete n[i].__checked;return n}(i))}return Ct||(Ct=Pt.Collection),new Ct(i)}}),Wt=Array.prototype.push,Nt=Array.prototype.slice;Ht={length:0,init:function(t){t&&this.add(t)},add:function(t){return _.isArray(t)?Wt.apply(this,t):t instanceof Et?this.add(t.toArray()):Wt.call(this,t),this},set:function(t){var e,n=this,i=n.length;for(n.length=0,n.add(t),e=n.length;e0}var Lt,It,zt=bt.extend({Mixins:[Ot],init:function(t){var e,n;for(e in t=t||{})(n=t[e])instanceof At&&(t[e]=n.create(this,e));this.data=t},set:function(t,e){var n,i,r=this.data[t];if(e instanceof At&&(e=e.create(this,t)),"object"==typeof t){for(n in t)this.set(n,t[n]);return this}return function o(t,e){var n,i;if(t===e)return!0;if(null===t||null===e)return t===e;if("object"!=typeof t||"object"!=typeof e)return t===e;if(_.isArray(e)){if(t.length!==e.length)return!1;for(n=t.length;n--;)if(!o(t[n],e[n]))return!1}if(Bt(t)||Bt(e))return t===e;for(n in i={},e){if(!o(t[n],e[n]))return!1;i[n]=!0}for(n in t)if(!i[n]&&!o(t[n],e[n]))return!1;return!0}(r,e)||(this.data[t]=e,i={target:this,name:t,value:e,oldValue:r},this.fire("change:"+t,i),this.fire("change",i)),this},get:function(t){return this.data[t]},has:function(t){return t in this.data},bind:function(t){return At.create(this,t)},destroy:function(){this.fire("destroy")}}),Ft={},Vt={add:function(t){var e=t.parent();if(e){if(!e._layout||e._layout.isNative())return;Ft[e._id]||(Ft[e._id]=e),Lt||(Lt=!0,c.requestAnimationFrame(function(){var t,e;for(t in Lt=!1,Ft)(e=Ft[t]).state.get("rendered")&&e.reflow();Ft={}},document.body))}},remove:function(t){Ft[t._id]&&delete Ft[t._id]}},qt="onmousewheel"in document,Ut=!1,jt=0,$t={Statics:{classPrefix:"mce-"},isRtl:function(){return It.rtl},classPrefix:"mce-",init:function(t){var e,n,i=this;function r(t){var e;for(t=t.split(" "),e=0;ea.maxW?a.maxW:n,a.w=n,a.innerW=n-i),(n=t.h)!==undefined&&(n=(n=na.maxH?a.maxH:n,a.h=n,a.innerH=n-r),(n=t.innerW)!==undefined&&(n=(n=na.maxW-i?a.maxW-i:n,a.innerW=n,a.w=n+i),(n=t.innerH)!==undefined&&(n=(n=na.maxH-r?a.maxH-r:n,a.innerH=n,a.h=n+r),t.contentW!==undefined&&(a.contentW=t.contentW),t.contentH!==undefined&&(a.contentH=t.contentH),(e=s._lastLayoutRect).x===a.x&&e.y===a.y&&e.w===a.w&&e.h===a.h||((o=It.repaintControls)&&o.map&&!o.map[s._id]&&(o.push(s),o.map[s._id]=!0),e.x=a.x,e.y=a.y,e.w=a.w,e.h=a.h),s):a},repaint:function(){var t,e,n,i,r,o,s,a,l,u,c=this;l=document.createRange?function(t){return t}:Math.round,t=c.getEl().style,i=c._layoutRect,a=c._lastRepaintRect||{},o=(r=c.borderBox).left+r.right,s=r.top+r.bottom,i.x!==a.x&&(t.left=l(i.x)+"px",a.x=i.x),i.y!==a.y&&(t.top=l(i.y)+"px",a.y=i.y),i.w!==a.w&&(u=l(i.w-o),t.width=(u>=0?u:0)+"px",a.w=i.w),i.h!==a.h&&(u=l(i.h-s),t.height=(u>=0?u:0)+"px",a.h=i.h),c._hasBody&&i.innerW!==a.innerW&&(u=l(i.innerW),(n=c.getEl("body"))&&((e=n.style).width=(u>=0?u:0)+"px"),a.innerW=i.innerW),c._hasBody&&i.innerH!==a.innerH&&(u=l(i.innerH),(n=n||c.getEl("body"))&&((e=e||n.style).height=(u>=0?u:0)+"px"),a.innerH=i.innerH),c._lastRepaintRect=a,c.fire("repaint",{},!1)},updateLayoutRect:function(){var t=this;t.parent()._lastRect=null,vt.css(t.getEl(),{width:"",height:""}),t._layoutRect=t._lastRepaintRect=t._lastLayoutRect=null,t.initLayoutRect()},on:function(t,e){var n,i,r,o=this;return Yt(o).on(t,"string"!=typeof(n=e)?n:function(t){return i||o.parentsAndSelf().each(function(t){var e=t.settings.callbacks;if(e&&(i=e[n]))return r=t,!1}),i?i.call(r,t):(t.action=n,void this.fire("execute",t))}),o},off:function(t,e){return Yt(this).off(t,e),this},fire:function(t,e,n){if((e=e||{}).control||(e.control=this),e=Yt(this).fire(t,e),!1!==n&&this.parent)for(var i=this.parent();i&&!e.isPropagationStopped();)i.fire(t,e,!1),i=i.parent();return e},hasEventListeners:function(t){return Yt(this).has(t)},parents:function(t){var e,n=new Dt;for(e=this.parent();e;e=e.parent())n.add(e);return t&&(n=n.filter(t)),n},parentsAndSelf:function(t){return new Dt(this).add(this.parents(t))},next:function(){var t=this.parent().items();return t[t.indexOf(this)+1]},prev:function(){var t=this.parent().items();return t[t.indexOf(this)-1]},innerHtml:function(t){return this.$el.html(t),this},getEl:function(t){var e=t?this._id+"-"+t:this._id;return this._elmCache[e]||(this._elmCache[e]=yt("#"+e)[0]),this._elmCache[e]},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(t){}return this},blur:function(){return this.getEl().blur(),this},aria:function(t,e){var n=this,i=n.getEl(n.ariaTarget);return void 0===e?n._aria[t]:(n._aria[t]=e,n.state.get("rendered")&&i.setAttribute("role"===t?t:"aria-"+t,e),n)},encode:function(t,e){return!1!==e&&(t=this.translate(t)),(t||"").replace(/[&<>"]/g,function(t){return"&#"+t.charCodeAt(0)+";"})},translate:function(t){return It.translate?It.translate(t):t},before:function(t){var e=this.parent();return e&&e.insert(t,e.items().indexOf(this),!0),this},after:function(t){var e=this.parent();return e&&e.insert(t,e.items().indexOf(this)),this},remove:function(){var t,e,n=this,i=n.getEl(),r=n.parent();if(n.items){var o=n.items().toArray();for(e=o.length;e--;)o[e].remove()}r&&r.items&&(t=[],r.items().each(function(e){e!==n&&t.push(e)}),r.items().set(t),r._lastRect=null),n._eventsRoot&&n._eventsRoot===n&&yt(i).off();var s=n.getRoot().controlIdLookup;return s&&delete s[n._id],i&&i.parentNode&&i.parentNode.removeChild(i),n.state.set("rendered",!1),n.state.destroy(),n.fire("remove"),n},renderBefore:function(t){return yt(t).before(this.renderHtml()),this.postRender(),this},renderTo:function(t){return yt(t||this.getContainerElm()).append(this.renderHtml()),this.postRender(),this},preRender:function(){},render:function(){},renderHtml:function(){return'
'},postRender:function(){var t,e,n,i,r,o=this,s=o.settings;for(i in o.$el=yt(o.getEl()),o.state.set("rendered",!0),s)0===i.indexOf("on")&&o.on(i.substr(2),s[i]);if(o._eventsRoot){for(n=o.parent();!r&&n;n=n.parent())r=n._eventsRoot;if(r)for(i in r._nativeEvents)o._nativeEvents[i]=!0}Xt(o),s.style&&(t=o.getEl())&&(t.setAttribute("style",s.style),t.style.cssText=s.style),o.settings.border&&(e=o.borderBox,o.$el.css({"border-top-width":e.top,"border-right-width":e.right,"border-bottom-width":e.bottom,"border-left-width":e.left}));var a=o.getRoot();for(var l in a.controlIdLookup||(a.controlIdLookup={}),a.controlIdLookup[o._id]=o,o._aria)o.aria(l,o._aria[l]);!1===o.state.get("visible")&&(o.getEl().style.display="none"),o.bindStates(),o.state.on("change:visible",function(t){var e,n=t.value;o.state.get("rendered")&&(o.getEl().style.display=!1===n?"none":"",o.getEl().getBoundingClientRect()),(e=o.parent())&&(e._lastRect=null),o.fire(n?"show":"hide"),Vt.add(o)}),o.fire("postrender",{},!1)},bindStates:function(){},scrollIntoView:function(t){var e,n,i,r,o,s,a=this.getEl(),l=a.parentNode,u=function(t,e){var n,i,r=t;for(n=i=0;r&&r!==e&&r.nodeType;)n+=r.offsetLeft||0,i+=r.offsetTop||0,r=r.offsetParent;return{x:n,y:i}}(a,l);return e=u.x,n=u.y,i=a.offsetWidth,r=a.offsetHeight,o=l.clientWidth,s=l.clientHeight,"end"===t?(e-=o-i,n-=s-r):"center"===t&&(e-=o/2-i/2,n-=s/2-r/2),l.scrollLeft=e,l.scrollTop=n,this},getRoot:function(){for(var t,e=this,n=[];e;){if(e.rootControl){t=e.rootControl;break}n.push(e),t=e,e=e.parent()}t||(t=this);for(var i=n.length;i--;)n[i].rootControl=t;return t},reflow:function(){Vt.remove(this);var t=this.parent();return t&&t._layout&&!t._layout.isNative()&&t.reflow(),this}};function Yt(t){return t._eventDispatcher||(t._eventDispatcher=new xt({scope:t,toggleEvent:function(e,n){n&&xt.isNative(e)&&(t._nativeEvents||(t._nativeEvents={}),t._nativeEvents[e]=!0,t.state.get("rendered")&&Xt(t))}})),t._eventDispatcher}function Xt(t){var e,n,i,r,o,s;function a(e){var n=t.getParentCtrl(e.target);n&&n.fire(e.type,e)}function l(){var t=r._lastHoverCtrl;t&&(t.fire("mouseleave",{target:t.getEl()}),t.parents().each(function(t){t.fire("mouseleave",{target:t.getEl()})}),r._lastHoverCtrl=null)}function u(e){var n,i,o,s=t.getParentCtrl(e.target),a=r._lastHoverCtrl,l=0;if(s!==a){if(r._lastHoverCtrl=s,(i=s.parents().toArray().reverse()).push(s),a){for((o=a.parents().toArray().reverse()).push(a),l=0;l=l;n--)(a=o[n]).fire("mouseleave",{target:a.getEl()})}for(n=l;n0&&r.x+r.w0&&r.y+r.hn.x&&r.x+r.wn.y&&r.y+r.he&&(t=e-n)<0?0:t}if(n.settings.constrainToViewport){var r=vt.getViewPort(window),o=n.layoutRect();t=i(t,r.w+r.x,o.w),e=i(e,r.h+r.y,o.h)}return n.state.get("rendered")?n.layoutRect({x:t,y:e}).repaint():(n.settings.x=t,n.settings.y=e),n.fire("move",{x:t,y:e}),n}},Zt=Jt.extend({Mixins:[Qt],Defaults:{classes:"widget tooltip tooltip-n"},renderHtml:function(){var t=this,e=t.classPrefix;return'"},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl().lastChild.innerHTML=t.encode(e.value)}),t._super()},repaint:function(){var t,e;t=this.getEl().style,e=this._layoutRect,t.left=e.x+"px",t.top=e.y+"px",t.zIndex=131070}}),te=Jt.extend({init:function(t){var e=this;e._super(t),t=e.settings,e.canFocus=!0,t.tooltip&&!1!==te.tooltips&&(e.on("mouseenter",function(n){var i=e.tooltip().moveTo(-65535);if(n.control===e){var r=i.text(t.tooltip).show().testMoveRel(e.getEl(),["bc-tc","bc-tl","bc-tr"]);i.classes.toggle("tooltip-n","bc-tc"===r),i.classes.toggle("tooltip-nw","bc-tl"===r),i.classes.toggle("tooltip-ne","bc-tr"===r),i.moveRel(e.getEl(),r)}else i.hide()}),e.on("mouseleave mousedown click",function(){e.tooltip().hide()})),e.aria("label",t.ariaLabel||t.tooltip)},tooltip:function(){return Kt||(Kt=new Zt({type:"tooltip"})).renderTo(),Kt},postRender:function(){var t=this,e=t.settings;t._super(),t.parent()||!e.width&&!e.height||(t.initLayoutRect(),t.repaint()),e.autofocus&&t.focus()},bindStates:function(){var t=this;function e(e){t.aria("disabled",e),t.classes.toggle("disabled",e)}function n(e){t.aria("pressed",e),t.classes.toggle("active",e)}return t.state.on("change:disabled",function(t){e(t.value)}),t.state.on("change:active",function(t){n(t.value)}),t.state.get("disabled")&&e(!0),t.state.get("active")&&n(!0),t._super()},remove:function(){this._super(),Kt&&(Kt.remove(),Kt=null)}}),ee=te.extend({Defaults:{value:0},init:function(t){this._super(t),this.classes.add("progress"),this.settings.filter||(this.settings.filter=function(t){return Math.round(t)})},renderHtml:function(){var t=this._id,e=this.classPrefix;return'
0%
'},postRender:function(){return this._super(),this.value(this.settings.value),this},bindStates:function(){var t=this;function e(e){e=t.settings.filter(e),t.getEl().lastChild.innerHTML=e+"%",t.getEl().firstChild.firstChild.style.width=e+"%"}return t.state.on("change:value",function(t){e(t.value)}),e(t.state.get("value")),t._super()}}),ne=function(t,e){t.getEl().lastChild.textContent=e+(t.progressBar?" "+t.progressBar.value()+"%":"")},ie=Jt.extend({Mixins:[Qt],Defaults:{classes:"widget notification"},init:function(t){var e=this;e._super(t),e.maxWidth=t.maxWidth,t.text&&e.text(t.text),t.icon&&(e.icon=t.icon),t.color&&(e.color=t.color),t.type&&e.classes.add("notification-"+t.type),t.timeout&&(t.timeout<0||t.timeout>0)&&!t.closeButton?e.closeButton=!1:(e.classes.add("has-close"),e.closeButton=!0),t.progressBar&&(e.progressBar=new ee),e.on("click",function(t){-1!==t.target.className.indexOf(e.classPrefix+"close")&&e.close()})},renderHtml:function(){var t,e=this,n=e.classPrefix,i="",r="",o="";return e.icon&&(i=''),t=' style="max-width: '+e.maxWidth+"px;"+(e.color?"background-color: "+e.color+';"':'"'),e.closeButton&&(r=''),e.progressBar&&(o=e.progressBar.renderHtml()),''},postRender:function(){var t=this;return c.setTimeout(function(){t.$el.addClass(t.classPrefix+"in"),ne(t,t.state.get("text"))},100),t._super()},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl().firstChild.innerHTML=e.value,ne(t,e.value)}),t.progressBar&&(t.progressBar.bindStates(),t.progressBar.state.on("change:value",function(e){ne(t,t.state.get("text"))})),t._super()},close:function(){return this.fire("close").isDefaultPrevented()||this.remove(),this},repaint:function(){var t,e;t=this.getEl().style,e=this._layoutRect,t.left=e.x+"px",t.top=e.y+"px",t.zIndex=65534}});function re(t){var e=function(t){return t.inline?t.getElement():t.getContentAreaContainer()};return{open:function(n,i){var r,o=_.extend(n,{maxWidth:(r=e(t),vt.getSize(r).width)}),s=new ie(o);return s.args=o,o.timeout>0&&(s.timer=setTimeout(function(){s.close(),i()},o.timeout)),s.on("close",function(){i()}),s.renderTo(),s},close:function(t){t.close()},reposition:function(n){var i;i=n,gt.each(i,function(t){t.moveTo(0,0)}),function(n){if(n.length>0){var i=n.slice(0,1)[0],r=e(t);i.moveRel(r,"tc-tc"),gt.each(n,function(t,e){e>0&&t.moveRel(n[e-1].getEl(),"bc-tc")})}}(n)},getArgs:function(t){return t.args}}}function oe(t){var e,n;if(t.changedTouches)for(e="screenX screenY pageX pageY clientX clientY".split(" "),n=0;n").css({position:"absolute",top:0,left:0,width:_.width,height:_.height,zIndex:2147483647,opacity:1e-4,cursor:w}).appendTo(u.body),yt(u).on("mousemove touchmove",s).on("mouseup touchend",o),e.start(t)},s=function(t){if(oe(t),t.button!==i)return o(t);t.deltaX=t.screenX-a,t.deltaY=t.screenY-l,t.preventDefault(),e.drag(t)},o=function(t){oe(t),yt(u).off("mousemove touchmove",s).off("mouseup touchend",o),n.remove(),e.stop&&e.stop(t)},this.destroy=function(){yt(c()).off()},yt(c()).on("mousedown touchstart",r)}var ae=tinymce.util.Tools.resolve("tinymce.ui.Factory"),le=function(t){return!!t.getAttribute("data-mce-tabstop")};function ue(t){var e,n,i=t.root;function r(t){return t&&1===t.nodeType}try{e=document.activeElement}catch(b){e=document.body}function o(t){return r(t=t||e)?t.getAttribute("role"):null}function s(t){for(var n,i=t||e;i=i.parentNode;)if(n=o(i))return n}function a(t){var n=e;if(r(n))return n.getAttribute("aria-"+t)}function l(t){var e=t.tagName.toUpperCase();return"INPUT"===e||"TEXTAREA"===e||"SELECT"===e}function u(t){var e=[];return function n(t){if(1===t.nodeType&&"none"!==t.style.display&&!t.disabled){var i;(l(i=t)&&!i.hidden||le(i)||/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(o(i)))&&e.push(t);for(var r=0;r=e.length&&(t=0),e[t]&&e[t].focus(),t}function f(t,n){var i=-1,r=c();n=n||u(r.getEl());for(var o=0;o=0&&((n=e.getEl())&&n.parentNode.removeChild(n),(n=t.getEl())&&n.parentNode.removeChild(n)),e.parent(this)},create:function(t){var e,n=this,i=[];return _.isArray(t)||(t=[t]),_.each(t,function(t){t&&(t instanceof Jt||("string"==typeof t&&(t={type:t}),e=_.extend({},n.settings.defaults,t),t.type=e.type=e.type||t.type||n.settings.defaultType||(e.defaults?e.defaults.type:null),t=ae.create(e)),i.push(t))}),i},renderNew:function(){var t=this;return t.items().each(function(e,n){var i;e.parent(t),e.state.get("rendered")||((i=t.getEl("body")).hasChildNodes()&&n<=i.childNodes.length-1?yt(i.childNodes[n]).before(e.renderHtml()):yt(i).append(e.renderHtml()),e.postRender(),Vt.add(e))}),t._layout.applyClasses(t.items().filter(":visible")),t._lastRect=null,t},append:function(t){return this.add(t).renderNew()},prepend:function(t){return this.items().set(this.create(t).concat(this.items().toArray())),this.renderNew()},insert:function(t,e,n){var i,r,o;return t=this.create(t),i=this.items(),!n&&e=0&&e
'+(t.settings.html||"")+e.renderHtml(t)+"
"},postRender:function(){var t,e=this;return e.items().exec("postRender"),e._super(),e._layout.postRender(e),e.state.set("rendered",!0),e.settings.style&&e.$el.css(e.settings.style),e.settings.border&&(t=e.borderBox,e.$el.css({"border-top-width":t.top,"border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.left})),e.parent()||(e.keyboardNav=ue({root:e})),e},initLayoutRect:function(){var t=this._super();return this._layout.recalc(this),t},recalc:function(){var t=this,e=t._layoutRect,n=t._lastRect;if(!n||n.w!==e.w||n.h!==e.h)return t._layout.recalc(t),e=t.layoutRect(),t._lastRect={x:e.x,y:e.y,w:e.w,h:e.h},!0},reflow:function(){var t;if(Vt.remove(this),this.visible()){for(Jt.repaintControls=[],Jt.repaintControls.map={},this.recalc(),t=Jt.repaintControls.length;t--;)Jt.repaintControls[t].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),Jt.repaintControls=[]}return this}}),pe={init:function(){this.on("repaint",this.renderScroll)},renderScroll:function(){var t=this,e=2;function n(){var n,i,r;function o(r,o,s,a,l,u){var c,d,f,h,m,g,p,v;if(d=t.getEl("scroll"+r)){if(p=o.toLowerCase(),v=s.toLowerCase(),yt(t.getEl("absend")).css(p,t.layoutRect()[a]-1),!l)return void yt(d).css("display","none");yt(d).css("display","block"),c=t.getEl("body"),f=t.getEl("scroll"+r+"t"),h=c["client"+s]-2*e,m=(h-=n&&i?d["client"+u]:0)/c["scroll"+s],(g={})[p]=c["offset"+o]+e,g[v]=h,yt(d).css(g),(g={})[p]=c["scroll"+o]*m,g[v]=h*m,yt(f).css(g)}}r=t.getEl("body"),n=r.scrollWidth>r.clientWidth,i=r.scrollHeight>r.clientHeight,o("h","Left","Width","contentW",n,"Height"),o("v","Top","Height","contentH",i,"Width")}t.settings.autoScroll&&(t._hasScroll||(t._hasScroll=!0,function(){function n(n,i,r,o,s){var a,l=t._id+"-scroll"+n,u=t.classPrefix;yt(t.getEl()).append('
'),t.draghelper=new se(l+"t",{start:function(){a=t.getEl("body")["scroll"+i],yt("#"+l).addClass(u+"active")},drag:function(l){var u,c,d,f,h=t.layoutRect();c=h.contentW>h.innerW,d=h.contentH>h.innerH,f=t.getEl("body")["client"+r]-2*e,u=(f-=c&&d?t.getEl("scroll"+n)["client"+s]:0)/t.getEl("body")["scroll"+r],t.getEl("body")["scroll"+i]=a+l["delta"+o]/u},stop:function(){yt("#"+l).removeClass(u+"active")}})}t.classes.add("scroll"),n("v","Top","Height","Y","Width"),n("h","Left","Width","X","Height")}(),t.on("wheel",function(e){var i=t.getEl("body");i.scrollLeft+=10*(e.deltaX||0),i.scrollTop+=10*e.deltaY,n()}),yt(t.getEl("body")).on("scroll",n)),n())}},ve=ge.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[pe],renderHtml:function(){var t=this,e=t._layout,n=t.settings.html;return t.preRender(),e.preRender(t),void 0===n?n='
'+e.renderHtml(t)+"
":("function"==typeof n&&(n=n.call(t)),t._hasBody=!1),'
'+(t._preBodyHtml||"")+n+"
"}}),ye={resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(t,e){if(t<=1||e<=1){var n=vt.getWindowSize();t=t<=1?t*n.w:t,e=e<=1?e*n.h:e}return this._layoutRect.autoResize=!1,this.layoutRect({minW:t,minH:e,w:t,h:e}).reflow()},resizeBy:function(t,e){var n=this.layoutRect();return this.resizeTo(n.w+t,n.h+e)}},be=[],xe=[];function we(t,e){for(;t;){if(t===e)return!0;t=t.parent()}}function _e(){ce||(ce=function(t){2!==t.button&&function(t){for(var e=be.length;e--;){var n=be[e],i=n.getParentCtrl(t.target);if(n.settings.autohide){if(i&&(we(i,n)||n.parent()===i))continue;(t=n.fire("autohide",{target:t.target})).isDefaultPrevented()||n.hide()}}}(t)},yt(document).on("click touchstart",ce))}function Re(t){var e=vt.getViewPort().y;function n(e,n){for(var i,r=0;re&&(t.fixed(!1).layoutRect({y:t._autoFixY}).repaint(),n(!1,t._autoFixY-e)):(t._autoFixY=t.layoutRect().y,t._autoFixY').appendTo(e.getContainerElm())),c.setTimeout(function(){n.addClass(i+"in"),yt(e.getEl()).addClass(i+"in")}),he=!0),ke(!0,e)}}),e.on("show",function(){e.parents().each(function(t){if(t.state.get("fixed"))return e.fixed(!0),!1})}),t.popover&&(e._preBodyHtml='
',e.classes.add("popover").add("bottom").add(e.isRtl()?"end":"start")),e.aria("label",t.ariaLabel),e.aria("labelledby",e._id),e.aria("describedby",e.describedBy||e._id+"-none")},fixed:function(t){var e=this;if(e.state.get("fixed")!==t){if(e.state.get("rendered")){var n=vt.getViewPort();t?e.layoutRect().y-=n.y:e.layoutRect().y+=n.y}e.classes.toggle("fixed",t),e.state.set("fixed",t)}return e},show:function(){var t,e=this._super();for(t=be.length;t--&&be[t]!==this;);return-1===t&&be.push(this),e},hide:function(){return Ee(this),ke(!1,this),this._super()},hideAll:function(){Ce.hideAll()},close:function(){return this.fire("close").isDefaultPrevented()||(this.remove(),ke(!1,this)),this},remove:function(){Ee(this),this._super()},postRender:function(){return this.settings.bodyRole&&this.getEl("body").setAttribute("role",this.settings.bodyRole),this._super()}});function Ee(t){var e;for(e=be.length;e--;)be[e]===t&&be.splice(e,1);for(e=xe.length;e--;)xe[e]===t&&xe.splice(e,1)}Ce.hideAll=function(){for(var t=be.length;t--;){var e=be[t];e&&e.settings.autohide&&(e.hide(),be.splice(t,1))}};var He=[],Se="";function Me(t){var e,n=yt("meta[name=viewport]")[0];!1!==l.overrideViewPort&&(n||((n=document.createElement("meta")).setAttribute("name","viewport"),document.getElementsByTagName("head")[0].appendChild(n)),(e=n.getAttribute("content"))&&void 0!==Se&&(Se=e),n.setAttribute("content",t?"width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0":Se))}function Te(t,e){(function(){for(var t=0;tt.w&&(n=t.x-Math.max(0,e/2),r.layoutRect({w:e,x:n}),i=!0),o&&(o.layoutRect({w:r.layoutRect().innerW}).recalc(),(e=o.layoutRect().minW+t.deltaW)>t.w&&(n=t.x-Math.max(0,e-t.w),r.layoutRect({w:e,x:n}),i=!0)),i&&r.recalc()},initLayoutRect:function(){var t,e=this,n=e._super(),i=0;if(e.settings.title&&!e._fullscreen){t=e.getEl("head");var r=vt.getSize(t);n.headerW=r.width,n.headerH=r.height,i+=n.headerH}e.statusbar&&(i+=e.statusbar.layoutRect().h),n.deltaH+=i,n.minH+=i,n.h+=i;var o=vt.getWindowSize();return n.x=e.settings.x||Math.max(0,o.w/2-n.w/2),n.y=e.settings.y||Math.max(0,o.h/2-n.h/2),n},renderHtml:function(){var t=this,e=t._layout,n=t._id,i=t.classPrefix,r=t.settings,o="",s="",a=r.html;return t.preRender(),e.preRender(t),r.title&&(o='
'+t.encode(r.title)+'
'),r.url&&(a=''),void 0===a&&(a=e.renderHtml(t)),t.statusbar&&(s=t.statusbar.renderHtml()),'
'+o+'
'+a+"
"+s+"
"},fullscreen:function(t){var e,n,i=this,r=document.documentElement,o=i.classPrefix;if(t!==i._fullscreen)if(yt(window).on("resize",function(){var t;if(i._fullscreen)if(e)i._timer||(i._timer=c.setTimeout(function(){var t=vt.getWindowSize();i.moveTo(0,0).resizeTo(t.w,t.h),i._timer=0},50));else{t=(new Date).getTime();var n=vt.getWindowSize();i.moveTo(0,0).resizeTo(n.w,n.h),(new Date).getTime()-t>50&&(e=!0)}}),n=i.layoutRect(),i._fullscreen=t,t){i._initial={x:n.x,y:n.y,w:n.w,h:n.h},i.borderBox=wt("0"),i.getEl("head").style.display="none",n.deltaH-=n.headerH+2,yt([r,document.body]).addClass(o+"fullscreen"),i.classes.add("fullscreen");var s=vt.getWindowSize();i.moveTo(0,0).resizeTo(s.w,s.h)}else i.borderBox=wt(i.settings.border),i.getEl("head").style.display="",n.deltaH+=n.headerH,yt([r,document.body]).removeClass(o+"fullscreen"),i.classes.remove("fullscreen"),i.moveTo(i._initial.x,i._initial.y).resizeTo(i._initial.w,i._initial.h);return i.reflow()},postRender:function(){var t,e=this;setTimeout(function(){e.classes.add("in"),e.fire("open")},0),e._super(),e.statusbar&&e.statusbar.postRender(),e.focus(),this.dragHelper=new se(e._id+"-dragh",{start:function(){t={x:e.layoutRect().x,y:e.layoutRect().y}},drag:function(n){e.moveTo(t.x+n.deltaX,t.y+n.deltaY)}}),e.on("submit",function(t){t.isDefaultPrevented()||e.close()}),He.push(e),Me(!0)},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var t,e=this;for(e.dragHelper.destroy(),e._super(),e.statusbar&&this.statusbar.remove(),Te(e.classPrefix,!1),t=He.length;t--;)He[t]===e&&He.splice(t,1);Me(He.length>0)},getContentWindow:function(){var t=this.getEl().getElementsByTagName("iframe")[0];return t?t.contentWindow:null}});!function(){if(!l.desktop){var t={w:window.innerWidth,h:window.innerHeight};c.setInterval(function(){var e=window.innerWidth,n=window.innerHeight;t.w===e&&t.h===n||(t={w:e,h:n},yt(window).trigger("resize"))},100)}yt(window).on("resize",function(){var t,e,n=vt.getWindowSize();for(t=0;t",n=0;n
";r+=""}return r+="",r+=""}(e,n)),(i=t.dom.select("*[data-mce-id]")[0]).removeAttribute("data-mce-id"),r=t.dom.select("td,th",i),t.selection.setCursorLocation(r[0],0)})},tn=function(t,e){t.execCommand("FormatBlock",!1,e)},en=function(t,e,n){var i,r;r=(i=t.editorUpload.blobCache).create(Ve("mceu"),n,e),i.add(r),t.insertContent(t.dom.createHTML("img",{src:r.blobUri()}))},nn=function(t,e){0===e.trim().length?Ke(t):Qe(t,e)},rn=Ke,on=function(t,e){t.addButton("quicklink",{icon:"link",tooltip:"Insert/Edit link",stateSelector:"a[href]",onclick:function(){e.showForm(t,"quicklink")}}),t.addButton("quickimage",{icon:"image",tooltip:"Insert image",onclick:function(){ze().then(function(e){var n=e[0];Ie(n).then(function(e){en(t,e,n)})})}}),t.addButton("quicktable",{icon:"table",tooltip:"Insert table",onclick:function(){e.hide(),Ze(t,2,2)}}),function(t){for(var e=function(e){return function(){tn(t,e)}},n=1;n<6;n++){var i="h"+n;t.addButton(i,{text:i.toUpperCase(),tooltip:"Heading "+n,stateSelector:i,onclick:e(i),onPostRender:function(){this.getEl().firstChild.firstChild.style.fontWeight="bold"}})}}(t)},sn={getUiContainerDelta:function(){var t=l.container;if(t&&"static"!==u.DOM.getStyle(t,"position",!0)){var e=u.DOM.getPos(t),n=e.x-t.scrollLeft,i=e.y-t.scrollTop;return nt.some({x:n,y:i})}return nt.none()}},an=function(t){return/^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(t.trim())},ln=function(t){return/^https?:\/\//.test(t.trim())},un=function(t,e){return!ln(e)&&an(e)?(n=t,i=e,new Le(function(t){n.windowManager.confirm("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(e){t(!0===e?"http://"+i:i)})})):Le.resolve(e);var n,i},cn={createQuickLinkForm:function(t,e){var n,i,r,o={};return n="quicklink",i={items:[{type:"button",name:"unlink",icon:"unlink",onclick:function(){t.focus(),rn(t),e()},tooltip:"Remove link"},{type:"filepicker",name:"linkurl",placeholder:"Paste or type a link",filetype:"file",onchange:function(t){var e=t.meta;e&&e.attach&&(o={href:this.value(),attach:e.attach})}},{type:"button",icon:"checkmark",subtype:"primary",tooltip:"Ok",onclick:"submit"}],onshow:function(e){if(e.control===this){var n,i="";(n=t.dom.getParent(t.selection.getStart(),"a[href]"))&&(i=t.dom.getAttrib(n,"href")),this.fromJSON({linkurl:i}),r=this.find("#unlink"),n?r.show():r.hide(),this.find("#linkurl")[0].focus()}var r},onsubmit:function(n){un(t,n.data.linkurl).then(function(n){t.undoManager.transact(function(){n===o.href&&(o.attach(),o={}),nn(t,n)}),e()})}},(r=ae.create(_.extend({type:"form",layout:"flex",direction:"row",padding:5,name:n,spacing:3},i))).on("show",function(){r.find("textbox").eq(0).each(function(t){t.focus()})}),r}},dn={create:function(t,e,n){var i,r,o=[];if(n)return _.each((r=n,W.isArray(r)?r:W.isString(r)?r.split(/[ ,]/):[]),function(e){var n,r,s;"|"===e?i=null:t.buttons[e]&&(i||(i={type:"buttongroup",items:[]},o.push(i)),n=e,"function"==typeof(e=t.buttons[n])&&(e=e()),e.type=e.type||"button",(e=ae.create(e)).on("postRender",(r=t,s=e,function(){var t,e,n=(e=function(t,e){return{selector:t,handler:e}},(t=s).settings.stateSelector?e(t.settings.stateSelector,function(e){t.active(e)}):t.settings.disabledStateSelector?e(t.settings.disabledStateSelector,function(e){t.disabled(e)}):null);null!==n&&r.selection.selectorChanged(n.selector,n.handler)})),i.items.push(e))}),ae.create({type:"toolbar",layout:"flow",name:e,items:o})}};function fn(){var t,e,n=function(t){return t.items().length>0},i=function(t,e){var i,r,o=(i=t,r=e,_.map(r,function(t){return dn.create(i,t.id,t.items)})).concat([dn.create(t,"text",F.getTextSelectionToolbarItems(t)),dn.create(t,"insert",F.getInsertToolbarItems(t)),cn.createQuickLinkForm(t,c)]);return ae.create({type:"floatpanel",role:"dialog",classes:"tinymce tinymce-inline arrow",ariaLabel:"Inline toolbar",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!0,border:1,items:_.grep(o,n),oncancel:function(){t.focus()}})},r=function(t){t&&t.show()},o=function(t,e){t.moveTo(e.x,e.y)},s=function(t,e){e=e?e.substr(0,2):"",_.each({t:"down",b:"up",c:"center"},function(n,i){t.classes.toggle("arrow-"+n,i===e.substr(0,1))}),"cr"===e?(t.classes.toggle("arrow-left",!0),t.classes.toggle("arrow-right",!1)):"cl"===e?(t.classes.toggle("arrow-left",!0),t.classes.toggle("arrow-right",!0)):_.each({l:"left",r:"right"},function(n,i){t.classes.toggle("arrow-"+n,i===e.substr(1,1))})},a=function(t,e){var n=t.items().filter("#"+e);return n.length>0&&(n[0].show(),t.reflow(),!0)},l=function(t,n,i,r){var a,l,c,d;if(d=F.getPositionHandler(i),a=b.getContentAreaRect(i),l=u.DOM.getRect(t.getEl()),c="insert"===n?z.calcInsert(r,a,l):z.calc(r,a,l)){var f=sn.getUiContainerDelta().getOr({x:0,y:0}),h={x:c.rect.x-f.x,y:c.rect.y-f.y,w:c.rect.w,h:c.rect.h};return e=r,o(t,z.userConstrain(d,r,a,h)),s(t,c.position),!0}return!1},c=function(){t&&t.hide()};return{show:function(e,n,o,s){var u,d,f,h;t||(H.fireBeforeRenderUI(e),(t=i(e,s)).renderTo().reflow().moveTo(o.x,o.y),e.nodeChanged()),d=n,f=e,h=o,r(u=t),u.items().hide(),a(u,d)?!1===l(u,d,f,h)&&c():c()},showForm:function(n,i){if(t){if(t.items().hide(),!a(t,i))return void c();var l,d,f,h=void 0;r(t),t.items().hide(),a(t,i),f=F.getPositionHandler(n),l=b.getContentAreaRect(n),h=u.DOM.getRect(t.getEl()),(d=z.calc(e,l,h))&&(h=d.rect,o(t,z.userConstrain(f,e,l,h)),s(t,d.position))}},reposition:function(e,n,i){t&&l(t,n,e,i)},inForm:function(){return t&&t.visible()&&t.items().filter("form:visible").length>0},hide:c,focus:function(){t&&t.find("toolbar:visible").eq(0).each(function(t){t.focus(!0)})},remove:function(){t&&(t.remove(),t=null)}}}var hn,mn=bt.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(t){this.settings=_.extend({},this.Defaults,t)},preRender:function(t){t.bodyClasses.add(this.settings.containerClass)},applyClasses:function(t){var e,n,i,r,o=this.settings;e=o.firstControlClass,n=o.lastControlClass,t.each(function(t){t.classes.remove(e).remove(n).add(o.controlClass),t.visible()&&(i||(i=t),r=t)}),i&&i.classes.add(e),r&&r.classes.add(n)},renderHtml:function(t){var e="";return this.applyClasses(t.items()),t.items().each(function(t){e+=t.renderHtml()}),e},recalc:function(){},postRender:function(){},isNative:function(){return!1}}),gn=mn.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(t){t.items().filter(":visible").each(function(t){var e=t.settings;t.layoutRect({x:e.x,y:e.y,w:e.w,h:e.h}),t.recalc&&t.recalc()})},renderHtml:function(t){return'
'+this._super(t)}}),pn=te.extend({Defaults:{classes:"widget btn",role:"button"},init:function(t){var e,n=this;n._super(t),t=n.settings,e=n.settings.size,n.on("click mousedown",function(t){t.preventDefault()}),n.on("touchstart",function(t){n.fire("click",t),t.preventDefault()}),t.subtype&&n.classes.add(t.subtype),e&&n.classes.add("btn-"+e),t.icon&&n.icon(t.icon)},icon:function(t){return arguments.length?(this.state.set("icon",t),this):this.state.get("icon")},repaint:function(){var t,e=this.getEl().firstChild;e&&((t=e.style).width=t.height="100%"),this._super()},renderHtml:function(){var t,e,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a="",l=n.settings;return(t=l.image)?(o="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",s&&(n.classes.add("btn-has-text"),a=''+n.encode(s)+""),o=o?r+"ico "+r+"i-"+o:"",e="boolean"==typeof l.active?' aria-pressed="'+l.active+'"':"",'
"},bindStates:function(){var t=this,e=t.$,n=t.classPrefix+"txt";function i(i){var r=e("span."+n,t.getEl());i?(r[0]||(e("button:first",t.getEl()).append(''),r=e("span."+n,t.getEl())),r.html(t.encode(i))):r.remove(),t.classes.toggle("btn-has-text",!!i)}return t.state.on("change:text",function(t){i(t.value)}),t.state.on("change:icon",function(e){var n=e.value,r=t.classPrefix;t.settings.icon=n,n=n?r+"ico "+r+"i-"+t.settings.icon:"";var o=t.getEl().firstChild,s=o.getElementsByTagName("i")[0];n?(s&&s===o.firstChild||(s=document.createElement("i"),o.insertBefore(s,o.firstChild)),s.className=n):s&&o.removeChild(s),i(t.state.get("text"))}),t._super()}}),vn=pn.extend({init:function(t){t=_.extend({text:"Browse...",multiple:!1,accept:null},t),this._super(t),this.classes.add("browsebutton"),t.multiple&&this.classes.add("multiple")},postRender:function(){var t=this,e=vt.create("input",{type:"file",id:t._id+"-browse",accept:t.settings.accept});t._super(),yt(e).on("change",function(e){var n=e.target.files;t.value=function(){return n.length?t.settings.multiple?n:n[0]:null},e.preventDefault(),n.length&&t.fire("change",e)}),yt(e).on("click",function(t){t.stopPropagation()}),yt(t.getEl("button")).on("click",function(t){t.stopPropagation(),e.click()}),t.getEl().appendChild(e)},remove:function(){yt(this.getEl("button")).off(),yt(this.getEl("input")).off(),this._super()}}),yn=ge.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var t=this,e=t._layout;return t.classes.add("btn-group"),t.preRender(),e.preRender(t),'
'+(t.settings.html||"")+e.renderHtml(t)+"
"}}),bn=te.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(t){var e=this;e._super(t),e.on("click mousedown",function(t){t.preventDefault()}),e.on("click",function(t){t.preventDefault(),e.disabled()||e.checked(!e.checked())}),e.checked(e.settings.checked)},checked:function(t){return arguments.length?(this.state.set("checked",t),this):this.state.get("checked")},value:function(t){return arguments.length?this.checked(t):this.checked()},renderHtml:function(){var t=this,e=t._id,n=t.classPrefix;return'
'+t.encode(t.state.get("text"))+"
"},bindStates:function(){var t=this;function e(e){t.classes.toggle("checked",e),t.aria("checked",e)}return t.state.on("change:text",function(e){t.getEl("al").firstChild.data=t.translate(e.value)}),t.state.on("change:checked change:value",function(n){t.fire("change"),e(n.value)}),t.state.on("change:icon",function(e){var n=e.value,i=t.classPrefix;if(void 0===n)return t.settings.icon;t.settings.icon=n,n=n?i+"ico "+i+"i-"+t.settings.icon:"";var r=t.getEl().firstChild,o=r.getElementsByTagName("i")[0];n?(o&&o===r.firstChild||(o=document.createElement("i"),r.insertBefore(o,r.firstChild)),o.className=n):o&&r.removeChild(o)}),t.state.get("checked")&&e(!0),t._super()}}),xn=tinymce.util.Tools.resolve("tinymce.util.VK"),wn=te.extend({init:function(t){var e=this;e._super(t),t=e.settings,e.classes.add("combobox"),e.subinput=!0,e.ariaTarget="inp",t.menu=t.menu||t.values,t.menu&&(t.icon="caret"),e.on("click",function(n){var i=n.target,r=e.getEl();if(yt.contains(r,i)||i===r)for(;i&&i!==r;)i.id&&-1!==i.id.indexOf("-open")&&(e.fire("action"),t.menu&&(e.showMenu(),n.aria&&e.menu.items()[0].focus())),i=i.parentNode}),e.on("keydown",function(t){var n;13===t.keyCode&&"INPUT"===t.target.nodeName&&(t.preventDefault(),e.parents().reverse().each(function(t){if(t.toJSON)return n=t,!1}),e.fire("submit",{data:n.toJSON()}))}),e.on("keyup",function(t){if("INPUT"===t.target.nodeName){var n=e.state.get("value"),i=t.target.value;i!==n&&(e.state.set("value",i),e.fire("autocomplete",t))}}),e.on("mouseover",function(t){var n=e.tooltip().moveTo(-65535);if(e.statusLevel()&&-1!==t.target.className.indexOf(e.classPrefix+"status")){var i=e.statusMessage()||"Ok",r=n.text(i).show().testMoveRel(t.target,["bc-tc","bc-tl","bc-tr"]);n.classes.toggle("tooltip-n","bc-tc"===r),n.classes.toggle("tooltip-nw","bc-tl"===r),n.classes.toggle("tooltip-ne","bc-tr"===r),n.moveRel(t.target,r)}})},statusLevel:function(t){return arguments.length>0&&this.state.set("statusLevel",t),this.state.get("statusLevel")},statusMessage:function(t){return arguments.length>0&&this.state.set("statusMessage",t),this.state.get("statusMessage")},showMenu:function(){var t,e=this,n=e.settings;e.menu||((t=n.menu||[]).length?t={type:"menu",items:t}:t.type=t.type||"menu",e.menu=ae.create(t).parent(e).renderTo(e.getContainerElm()),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control===e.menu&&e.focus()}),e.menu.on("show hide",function(t){t.control.items().each(function(t){t.active(t.value()===e.value())})}).fire("show"),e.menu.on("select",function(t){e.value(t.control.value())}),e.on("focusin",function(t){"INPUT"===t.target.tagName.toUpperCase()&&e.menu.hide()}),e.aria("expanded",!0)),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},focus:function(){this.getEl("inp").focus()},repaint:function(){var t,e,n=this,i=n.getEl(),r=n.getEl("open"),o=n.layoutRect(),s=0,a=i.firstChild;n.statusLevel()&&"none"!==n.statusLevel()&&(s=parseInt(vt.getRuntimeStyle(a,"padding-right"),10)-parseInt(vt.getRuntimeStyle(a,"padding-left"),10)),t=r?o.w-vt.getSize(r).width-10:o.w-10;var l=document;return l.all&&(!l.documentMode||l.documentMode<=8)&&(e=n.layoutRect().h-2+"px"),yt(a).css({width:t-s,lineHeight:e}),n._super(),n},postRender:function(){var t=this;return yt(this.getEl("inp")).on("change",function(e){t.state.set("value",e.target.value),t.fire("change",e)}),t._super()},renderHtml:function(){var t,e,n,i=this,r=i._id,o=i.settings,s=i.classPrefix,a=i.state.get("value")||"",l="",u="";return"spellcheck"in o&&(u+=' spellcheck="'+o.spellcheck+'"'),o.maxLength&&(u+=' maxlength="'+o.maxLength+'"'),o.size&&(u+=' size="'+o.size+'"'),o.subtype&&(u+=' type="'+o.subtype+'"'),n='',i.disabled()&&(u+=' disabled="disabled"'),(t=o.icon)&&"caret"!==t&&(t=s+"ico "+s+"i-"+o.icon),e=i.state.get("text"),(t||e)&&(l='
",i.classes.add("has-open")),'
'+n+l+"
"},value:function(t){return arguments.length?(this.state.set("value",t),this):(this.state.get("rendered")&&this.state.set("value",this.getEl("inp").value),this.state.get("value"))},showAutoComplete:function(t,e){var n=this;if(0!==t.length){n.menu?n.menu.items().remove():n.menu=ae.create({type:"menu",classes:"combobox-menu",layout:"flow"}).parent(n).renderTo(),_.each(t,function(t){var i,r;n.menu.add({text:t.title,url:t.previewUrl,match:e,classes:"menu-item-ellipsis",onclick:(i=t.value,r=t.title,function(){n.fire("selectitem",{title:r,value:i})})})}),n.menu.renderNew(),n.hideMenu(),n.menu.on("cancel",function(t){t.control.parent()===n.menu&&(t.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){n.focus()});var i=n.layoutRect().w;n.menu.layoutRect({w:i,minW:0,maxW:i}),n.menu.repaint(),n.menu.reflow(),n.menu.show(),n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])}else n.hideMenu()},hideMenu:function(){this.menu&&this.menu.hide()},bindStates:function(){var t=this;t.state.on("change:value",function(e){t.getEl("inp").value!==e.value&&(t.getEl("inp").value=e.value)}),t.state.on("change:disabled",function(e){t.getEl("inp").disabled=e.value}),t.state.on("change:statusLevel",function(e){var n=t.getEl("status"),i=t.classPrefix,r=e.value;vt.css(n,"display","none"===r?"none":""),vt.toggleClass(n,i+"i-checkmark","ok"===r),vt.toggleClass(n,i+"i-warning","warn"===r),vt.toggleClass(n,i+"i-error","error"===r),t.classes.toggle("has-status","none"!==r),t.repaint()}),vt.on(t.getEl("status"),"mouseleave",function(){t.tooltip().hide()}),t.on("cancel",function(e){t.menu&&t.menu.visible()&&(e.stopPropagation(),t.hideMenu())});var e=function(t,e){e&&e.items().length>0&&e.items().eq(t)[0].focus()};return t.on("keydown",function(n){var i=n.keyCode;"INPUT"===n.target.nodeName&&(i===xn.DOWN?(n.preventDefault(),t.fire("autocomplete"),e(0,t.menu)):i===xn.UP&&(n.preventDefault(),e(-1,t.menu)))}),t._super()},remove:function(){yt(this.getEl("inp")).off(),this.menu&&this.menu.remove(),this._super()}}),_n=wn.extend({init:function(t){var e=this;t.spellcheck=!1,t.onaction&&(t.icon="none"),e._super(t),e.classes.add("colorbox"),e.on("change keyup postrender",function(){e.repaintColor(e.value())})},repaintColor:function(t){var e=this.getEl("open"),n=e?e.getElementsByTagName("i")[0]:null;if(n)try{n.style.background=t}catch(i){}},bindStates:function(){var t=this;return t.state.on("change:value",function(e){t.state.get("rendered")&&t.repaintColor(e.value)}),t._super()}}),Rn=pn.extend({showPanel:function(){var t=this,e=t.settings;if(t.classes.add("opened"),t.panel)t.panel.show();else{var n=e.panel;n.type&&(n={layout:"grid",items:n}),n.role=n.role||"dialog",n.popover=!0,n.autohide=!0,n.ariaRoot=!0,t.panel=new Ce(n).on("hide",function(){t.classes.remove("opened")}).on("cancel",function(e){e.stopPropagation(),t.focus(),t.hidePanel()}).parent(t).renderTo(t.getContainerElm()),t.panel.fire("show"),t.panel.reflow()}var i=t.panel.testMoveRel(t.getEl(),e.popoverAlign||(t.isRtl()?["bc-tc","bc-tl","bc-tr"]:["bc-tc","bc-tr","bc-tl"]));t.panel.classes.toggle("start","bc-tl"===i),t.panel.classes.toggle("end","bc-tr"===i),t.panel.moveRel(t.getEl(),i)},hidePanel:function(){this.panel&&this.panel.hide()},postRender:function(){var t=this;return t.aria("haspopup",!0),t.on("click",function(e){e.control===t&&(t.panel&&t.panel.visible()?t.hidePanel():(t.showPanel(),t.panel.focus(!!e.aria)))}),t._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}}),kn=u.DOM,Cn=Rn.extend({init:function(t){this._super(t),this.classes.add("splitbtn"),this.classes.add("colorbutton")},color:function(t){return t?(this._color=t,this.getEl("preview").style.backgroundColor=t,this):this._color},resetColor:function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var t=this,e=t._id,n=t.classPrefix,i=t.state.get("text"),r=t.settings.icon?n+"ico "+n+"i-"+t.settings.icon:"",o=t.settings.image?" style=\"background-image: url('"+t.settings.image+"')\"":"",s="";return i&&(t.classes.add("btn-has-text"),s=''+t.encode(i)+""),'
'},postRender:function(){var t=this,e=t.settings.onclick;return t.on("click",function(n){n.aria&&"down"===n.aria.key||n.control!==t||kn.getParent(n.target,"."+t.classPrefix+"open")||(n.stopImmediatePropagation(),e.call(t,n))}),delete t.settings.onclick,t._super()}}),En=tinymce.util.Tools.resolve("tinymce.util.Color"),Hn=te.extend({Defaults:{classes:"widget colorpicker"},init:function(t){this._super(t)},postRender:function(){var t,e,n,i,r,o=this,s=o.color();function a(t,e){var n,i,r=vt.getPos(t);return n=e.pageX-r.x,i=e.pageY-r.y,{x:n=Math.max(0,Math.min(n/t.clientWidth,1)),y:i=Math.max(0,Math.min(i/t.clientHeight,1))}}function l(t,e){var s=(360-t.h)/360;vt.css(n,{top:100*s+"%"}),e||vt.css(r,{left:t.s+"%",top:100-t.v+"%"}),i.style.background=En({s:100,v:100,h:t.h}).toHex(),o.color().parse({s:t.s,v:t.v,h:t.h})}function u(e){var n;n=a(i,e),t.s=100*n.x,t.v=100*(1-n.y),l(t),o.fire("change")}function c(n){var i;i=a(e,n),(t=s.toHsv()).h=360*(1-i.y),l(t,!0),o.fire("change")}e=o.getEl("h"),n=o.getEl("hp"),i=o.getEl("sv"),r=o.getEl("svp"),o._repaint=function(){l(t=s.toHsv())},o._super(),o._svdraghelper=new se(o._id+"-sv",{start:u,drag:u}),o._hdraghelper=new se(o._id+"-h",{start:c,drag:c}),o._repaint()},rgb:function(){return this.color().toRgb()},value:function(t){if(!arguments.length)return this.color().toHex();this.color().parse(t),this._rendered&&this._repaint()},color:function(){return this._color||(this._color=En()),this._color},renderHtml:function(){var t,e=this._id,n=this.classPrefix,i="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000";return t='
'+function(){var t,e,r,o,s="";for(r="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",t=0,e=(o=i.split(",")).length-1;t
';return s}()+'
','
'+t+"
"}}),Sn=te.extend({init:function(t){t=_.extend({height:100,text:"Drop an image here",multiple:!1,accept:null},t),this._super(t),this.classes.add("dropzone"),t.multiple&&this.classes.add("multiple")},renderHtml:function(){var t,e,n=this.settings;return t={id:this._id,hidefocus:"1"},e=vt.create("div",t,""+this.translate(n.text)+""),n.height&&vt.css(e,"height",n.height+"px"),n.width&&vt.css(e,"width",n.width+"px"),e.className=this.classes,e.outerHTML},postRender:function(){var t=this,e=function(e){e.preventDefault(),t.classes.toggle("dragenter"),t.getEl().className=t.classes};t._super(),t.$el.on("dragover",function(t){t.preventDefault()}),t.$el.on("dragenter",e),t.$el.on("dragleave",e),t.$el.on("drop",function(e){if(e.preventDefault(),!t.state.get("disabled")){var n=function(e){var n=t.settings.accept;if("string"!=typeof n)return e;var i=new RegExp("("+n.split(/\s*,\s*/).join("|")+")$","i");return _.grep(e,function(t){return i.test(t.name)})}(e.dataTransfer.files);t.value=function(){return n.length?t.settings.multiple?n:n[0]:null},n.length&&t.fire("change",e)}})},remove:function(){this.$el.off(),this._super()}}),Mn=te.extend({init:function(t){var e=this;t.delimiter||(t.delimiter="\xbb"),e._super(t),e.classes.add("path"),e.canFocus=!0,e.on("click",function(t){var n;(n=t.target.getAttribute("data-index"))&&e.fire("select",{value:e.row()[n],index:n})}),e.row(e.settings.row)},focus:function(){return this.getEl().firstChild.focus(),this},row:function(t){return arguments.length?(this.state.set("row",t),this):this.state.get("row")},renderHtml:function(){return'
'+this._getDataPathHtml(this.state.get("row"))+"
"},bindStates:function(){var t=this;return t.state.on("change:row",function(e){t.innerHtml(t._getDataPathHtml(e.value))}),t._super()},_getDataPathHtml:function(t){var e,n,i=t||[],r="",o=this.classPrefix;for(e=0,n=i.length;e0?'":"")+'
'+i[e].name+"
";return r||(r='
\xa0
'),r}}),Tn=Mn.extend({postRender:function(){var t=this,e=t.settings.editor;function n(t){if(1===t.nodeType){if("BR"===t.nodeName||t.getAttribute("data-mce-bogus"))return!0;if("bookmark"===t.getAttribute("data-mce-type"))return!0}return!1}return!1!==e.settings.elementpath&&(t.on("select",function(t){e.focus(),e.selection.select(this.row()[t.index].element),e.nodeChanged()}),e.on("nodeChange",function(i){for(var r=[],o=i.parents,s=o.length;s--;)if(1===o[s].nodeType&&!n(o[s])){var a=e.fire("ResolveName",{name:o[s].nodeName.toLowerCase(),target:o[s]});if(a.isDefaultPrevented()||r.push({name:a.name,element:o[s]}),a.isPropagationStopped())break}t.row(r)})),t._super()}}),Pn=ge.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var t=this,e=t._layout,n=t.classPrefix;return t.classes.add("formitem"),e.preRender(t),'
'+(t.settings.title?'
'+t.settings.title+"
":"")+'
'+(t.settings.html||"")+e.renderHtml(t)+"
"}}),Wn=ge.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:15,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var t=this,e=t.items();t.settings.formItemDefaults||(t.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),e.each(function(e){var n,i=e.settings.label;i&&((n=new Pn(_.extend({items:{type:"label",id:e._id+"-l",text:i,flex:0,forId:e._id,disabled:e.disabled()}},t.settings.formItemDefaults))).type="formitem",e.aria("labelledby",e._id+"-l"),"undefined"==typeof e.settings.flex&&(e.settings.flex=1),t.replace(e,n),n.add(e))})},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){this._super(),this.fromJSON(this.settings.data)},bindStates:function(){var t=this;function e(){var e,n,i=0,r=[];if(!1!==t.settings.labelGapCalc)for(("children"===t.settings.labelGapCalc?t.find("formitem"):t.items()).filter("formitem").each(function(t){var e=t.items()[0],n=e.getEl().clientWidth;i=n>i?n:i,r.push(e)}),n=t.settings.labelGap||0,e=r.length;e--;)r[e].settings.minWidth=i+n}t._super(),t.on("show",e),e()}}),Nn=Wn.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var t=this,e=t._layout,n=t.classPrefix;return t.preRender(),e.preRender(t),'
'+(t.settings.title?''+t.settings.title+"":"")+'
'+(t.settings.html||"")+e.renderHtml(t)+"
"}}),Dn=0,An=function(t){var e=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++Dn+String(e)},On=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:G.constant(t)}},Bn={fromHtml:function(t,e){var n=(e||document).createElement("div");if(n.innerHTML=t,!n.hasChildNodes()||n.childNodes.length>1)throw console.error("HTML does not have a single root node",t),"HTML must have a single root node";return On(n.childNodes[0])},fromTag:function(t,e){var n=(e||document).createElement(t);return On(n)},fromText:function(t,e){var n=(e||document).createTextNode(t);return On(n)},fromDom:On,fromPoint:function(t,e,n){return nt.from(t.dom().elementFromPoint(e,n)).map(On)}},Ln=function(t){var e,n=!1;return function(){return n||(n=!0,e=t.apply(null,arguments)),e}},In=8,zn=9,Fn=1,Vn=3,qn=function(t){return t.dom().nodeName.toLowerCase()},Un=function(t){return t.dom().nodeType},jn=function(t){return function(e){return Un(e)===t}},$n=jn(Fn),Yn=jn(Vn),Xn=jn(zn),Jn={name:qn,type:Un,value:function(t){return t.dom().nodeValue},isElement:$n,isText:Yn,isDocument:Xn,isComment:function(t){return Un(t)===In||"#comment"===qn(t)}},Gn=(Ln(function(){return Gn(Bn.fromDom(document))}),function(t){var e=t.dom().body;if(null===e||e===undefined)throw"Body is not available yet";return Bn.fromDom(e)}),Kn=function(t){return function(e){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&Array.prototype.isPrototypeOf(t)?"array":"object"===e&&String.prototype.isPrototypeOf(t)?"string":e}(e)===t}},Qn={isString:Kn("string"),isObject:Kn("object"),isArray:Kn("array"),isNull:Kn("null"),isBoolean:Kn("boolean"),isUndefined:Kn("undefined"),isFunction:Kn("function"),isNumber:Kn("number")},Zn=(hn=Object.keys)===undefined?function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}:hn,ti=function(t,e){for(var n=Zn(t),i=0,r=n.length;i0&&si.unsuppMessage(o);var s={};return gt.each(t,function(t){s[t]=G.constant(i[t])}),gt.each(e,function(t){s[t]=G.constant(Object.prototype.hasOwnProperty.call(i,t)?nt.some(i[t]):nt.none())}),s}}},li=function(t,e){var n=function(t,e){for(var n=0;n0},Qi=function(t){var e,n,i=Gi(t);return gt.filter((n=i,gt.map(gt.filter(n,Yi),Xi)).concat((e=i,gt.map(gt.filter(e,Ui),Ji))),Ki)},Zi={},tr=function(t){return{title:t.title,value:{title:{raw:t.title},url:t.url,attach:t.attach}}},er=function(t,e){return{title:t,value:{title:t,url:e,attach:G.noop}}},nr=function(t,e,n){var i=e in t?t[e]:n;return!1===i?null:i},ir=function(t,e,n,i){var r,o,s,a,l={title:"-"},u=function(t){var i=t.hasOwnProperty(n)?t[n]:[],r=gt.filter(i,function(t){return n=t,i=e,!gt.exists(i,function(t){return t.url===n});var n,i});return _.map(r,function(t){return{title:t,value:{title:t,url:t,attach:G.noop}}})},c=function(t){var n,i=gt.filter(e,function(e){return e.type===t});return n=i,_.map(n,tr)};return!1===i.typeahead_urls?[]:"file"===n?(r=[rr(t,u(Zi)),rr(t,c("header")),rr(t,(o=c("anchor"),s=nr(i,"anchor_top","#top"),a=nr(i,"anchor_bottom","#bottom"),null!==s&&o.unshift(er("",s)),null!==a&&o.push(er("",a)),o))],gt.foldl(r,function(t,e){return 0===t.length||0===e.length?t.concat(e):t.concat(l,e)},[])):rr(t,u(Zi))},rr=function(t,e){var n=t.toLowerCase(),i=_.grep(e,function(t){return-1!==t.title.toLowerCase().indexOf(n)});return 1===i.length&&i[0].title===t?[]:i},or=function(t,e,n,i){var r=function(r){var o=Qi(n),s=ir(r,o,i,e);t.showAutoComplete(s,r)};t.on("autocomplete",function(){r(t.value())}),t.on("selectitem",function(e){var n=e.value;t.value(n.url);var r,o=(r=n.title).raw?r.raw:r;"image"===i?t.fire("change",{meta:{alt:o,attach:n.attach}}):t.fire("change",{meta:{text:o,attach:n.attach}}),t.focus()}),t.on("click",function(e){0===t.value().length&&"INPUT"===e.target.nodeName&&r("")}),t.on("PostRender",function(){t.getRoot().on("submit",function(e){var n,r,o;e.isDefaultPrevented()||(n=t.value(),o=Zi[r=i],/^https?/.test(n)&&(o?-1===gt.indexOf(o,n)&&(Zi[r]=o.slice(0,5).concat(n)):Zi[r]=[n]))})})},sr=function(t,e,n){var i=e.filepicker_validator_handler;i&&t.state.on("change:value",function(e){var r;0!==(r=e.value).length?i({url:r,type:n},function(e){var n,i,r,o=(i=(n=e).status,r=n.message,"valid"===i?{status:"ok",message:r}:"unknown"===i?{status:"warn",message:r}:"invalid"===i?{status:"warn",message:r}:{status:"none",message:""});t.statusMessage(o.message),t.statusLevel(o.status)}):t.statusLevel("none")})},ar=wn.extend({Statics:{clearHistory:function(){Zi={}}},init:function(t){var e,n,i,r=this,o=window.tinymce?window.tinymce.activeEditor:S.activeEditor,s=o.settings,a=t.filetype;t.spellcheck=!1,(i=s.file_picker_types||s.file_browser_callback_types)&&(i=_.makeMap(i,/[, ]/)),i&&!i[a]||(!(n=s.file_picker_callback)||i&&!i[a]?!(n=s.file_browser_callback)||i&&!i[a]||(e=function(){n(r.getEl("inp").id,r.value(),a,window)}):e=function(){var t=r.fire("beforecall").meta;t=_.extend({filetype:a},t),n.call(o,function(t,e){r.value(t).fire("change",{meta:e})},r.value(),t)}),e&&(t.icon="browse",t.onaction=e),r._super(t),r.classes.add("filepicker"),or(r,s,o.getBody(),a),sr(r,s,a)}}),lr=gn.extend({recalc:function(t){var e=t.layoutRect(),n=t.paddingBox;t.items().filter(":visible").each(function(t){t.layoutRect({x:n.left,y:n.top,w:e.innerW-n.right-n.left,h:e.innerH-n.top-n.bottom}),t.recalc&&t.recalc()})}}),ur=gn.extend({recalc:function(t){var e,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,y,b,x,w,_,R,k,C,E,H,S,M,T,P,W,N,D,A,O,B,L=[],I=Math.max,z=Math.min;for(i=t.items().filter(":visible"),r=t.layoutRect(),o=t.paddingBox,s=t.settings,f=t.isRtl()?s.direction||"row-reversed":s.direction,a=s.align,l=t.isRtl()?s.pack||"end":s.pack,u=s.spacing||0,"row-reversed"!==f&&"column-reverse"!==f||(i=i.set(i.toArray().reverse()),f=f.split("-")[0]),"column"===f?(k="y",_="h",R="minH",C="maxH",H="innerH",E="top",S="deltaH",M="contentH",D="left",W="w",T="x",P="innerW",N="minW",A="right",O="deltaW",B="contentW"):(k="x",_="w",R="minW",C="maxW",H="innerW",E="left",S="deltaW",M="contentW",D="top",W="h",T="y",P="innerH",N="minH",A="bottom",O="deltaH",B="contentH"),d=r[H]-o[E]-o[E],w=c=0,e=0,n=i.length;e0&&(c+=g,m[C]&&L.push(h),m.flex=g),d-=m[R],(p=o[D]+m[N]+o[A])>w&&(w=p);if((b={})[R]=d<0?r[R]-d+r[S]:r[H]-d+r[S],b[N]=w+r[O],b[M]=r[H]-d,b[B]=w,b.minW=z(b.minW,r.maxW),b.minH=z(b.minH,r.maxH),b.minW=I(b.minW,r.startMinWidth),b.minH=I(b.minH,r.startMinHeight),!r.autoResize||b.minW===r.minW&&b.minH===r.minH){for(y=d/c,e=0,n=L.length;ev?(d-=m[C]-m[R],c-=m.flex,m.flex=0,m.maxFlexSize=v):m.maxFlexSize=0;for(y=d/c,x=o[E],b={},0===c&&("end"===l?x=d+o[E]:"center"===l?(x=Math.round(r[H]/2-(r[H]-d)/2)+o[E])<0&&(x=o[E]):"justify"===l&&(x=o[E],u=Math.floor(d/(i.length-1)))),b[T]=o[D],e=0,n=i.length;e0&&(p+=m.flex*y),b[_]=p,b[k]=x,h.layoutRect(b),h.recalc&&h.recalc(),x+=p+u}else if(b.w=b.minW,b.h=b.minH,t.layoutRect(b),this.recalc(t),null===t._lastRect){var F=t.parent();F&&(F._lastRect=null,F.recalc())}}}),cr=mn.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(t){t.items().filter(":visible").each(function(t){t.recalc&&t.recalc()})},isNative:function(){return!0}}),dr=function(t,e){return Oi.one(e,t)},fr=function(t,e){return function(){t.execCommand("mceToggleFormat",!1,e)}},hr=function(t,e){return function(){var n=this;t.formatter?t.formatter.formatChanged(e,function(t){n.active(t)}):t.on("init",function(){t.formatter.formatChanged(e,function(t){n.active(t)})})}},mr=function(t){t.addMenuItem("align",{text:"Align",menu:[{text:"Left",icon:"alignleft",onclick:fr(t,"alignleft")},{text:"Center",icon:"aligncenter",onclick:fr(t,"aligncenter")},{text:"Right",icon:"alignright",onclick:fr(t,"alignright")},{text:"Justify",icon:"alignjustify",onclick:fr(t,"alignjustify")}]}),_.each({alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"],alignnone:["No alignment","JustifyNone"]},function(e,n){t.addButton(n,{active:!1,tooltip:e[0],cmd:e[1],onPostRender:hr(t,n)})})},gr=function(t){return function(e,n){return nt.from(n).map(Bn.fromDom).filter(Jn.isElement).bind(function(n){return function(t,e,n){for(;n!==e;){if(n.style[t]){var i=n.style[t];return""!==i?nt.some(i):nt.none()}n=n.parentNode}return nt.none()}(t,e,n.dom()).or((i=t,r=n.dom(),nt.from(u.DOM.getStyle(r,i,!0))));var i,r}).getOr("")}},pr={getFontSize:gr("fontSize"),getFontFamily:G.compose(function(t){return t.replace(/[\'\"]/g,"").replace(/,\s+/g,",")},gr("fontFamily")),toPt:function(t,e){return/[0-9.]+px$/.test(t)?(n=72*parseInt(t,10)/96,i=e||0,r=Math.pow(10,i),Math.round(n*r)/r+"pt"):t;var n,i,r}},vr=function(t){return t?t.split(",")[0]:""},yr=function(t,e){return function(){var n=this;t.on("init nodeChange",function(i){var r,o,s,a=pr.getFontFamily(t.getBody(),i.element),l=(r=e,o=a,_.each(r,function(t){t.value.toLowerCase()===o.toLowerCase()&&(s=t.value)}),_.each(r,function(t){s||vr(t.value).toLowerCase()!==vr(o).toLowerCase()||(s=t.value)}),s);n.value(l||null),!l&&a&&n.text(vr(a))})}},br=function(t){t.addButton("fontselect",function(){var e,n=(e=function(t){for(var e=(t=t.replace(/;$/,"").split(";")).length;e--;)t[e]=t[e].split("=");return t}(t.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"),_.map(e,function(t){return{text:{raw:t[0]},value:t[1],textStyle:-1===t[1].indexOf("dings")?"font-family:"+t[1]:""}}));return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:n,fixedWidth:!0,onPostRender:yr(t,n),onselect:function(e){e.control.settings.value&&t.execCommand("FontName",!1,e.control.settings.value)}}})},xr=function(t){br(t)},wr=function(t,e,n){var i;return _.each(t,function(t){t.value===n?i=n:t.value===e&&(i=e)}),i},_r=function(t){t.addButton("fontsizeselect",function(){var e,n,i,r=(e=t.settings.fontsize_formats||"8pt 10pt 12pt 14pt 18pt 24pt 36pt",_.map(e.split(" "),function(t){var e=t,n=t,i=t.split("=");return i.length>1&&(e=i[0],n=i[1]),{text:e,value:n}}));return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:r,fixedWidth:!0,onPostRender:(n=t,i=r,function(){var t=this;n.on("init nodeChange",function(e){var r,o,s,a;if(r=pr.getFontSize(n.getBody(),e.element))for(s=3;!a&&s>=0;s--)o=pr.toPt(r,s),a=wr(i,o,r);t.value(a||null),a||t.text(o)})}),onclick:function(e){e.control.settings.value&&t.execCommand("FontSize",!1,e.control.settings.value)}}})},Rr=function(t){_r(t)},kr=function(t,e){return function(){var n,i,r,o=[];return _.each(e,function(e){o.push({text:e[0],value:e[1],textStyle:function(){return t.formatter.getCssText(e[1])}})}),{type:"listbox",text:e[0][0],values:o,fixedWidth:!0,onselect:function(e){if(e.control){var n=e.control.value();fr(t,n)()}},onPostRender:(n=t,i=o,function(){var t=this;n.on("nodeChange",function(e){var o=n.formatter,s=null;_.each(e.parents,function(t){if(_.each(i,function(e){if(r?o.matchNode(t,r,{value:e.value})&&(s=e.value):o.matchNode(t,e.value)&&(s=e.value),s)return!1}),s)return!1}),t.value(s)})})}}},Cr=function(t){var e,n,i=function(t){for(var e=(t=t.replace(/;$/,"").split(";")).length;e--;)t[e]=t[e].split("=");return t}(t.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");t.addMenuItem("blockformats",{text:"Blocks",menu:(e=t,n=i,_.map(n,function(t){return{text:t[0],onclick:fr(e,t[1]),textStyle:function(){return e.formatter.getCssText(t[1])}}}))}),t.addButton("formatselect",kr(t,i))},Er=function(t,e){var n=e.length;return _.each(e,function(e){e.menu&&(e.hidden=0===Er(t,e.menu));var i=e.format;i&&(e.hidden=!t.formatter.canApply(i)),e.hidden&&n--}),n},Hr=function(t,e){var n=e.items().length;return e.items().each(function(e){e.menu&&e.visible(Hr(t,e.menu)>0),!e.menu&&e.settings.menu&&e.visible(Er(t,e.settings.menu)>0);var i=e.settings.format;i&&e.visible(t.formatter.canApply(i)),e.visible()||n--}),n},Sr=function(t){var e,n,i,r,o,s,a,l,u=(n=0,i=[],r=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],o=function(t){var e=[];if(t)return _.each(t,function(t){var r={text:t.title,icon:t.icon};if(t.items)r.menu=o(t.items);else{var s=t.format||"custom"+n++;t.format||(t.name=s,i.push(t)),r.format=s,r.cmd=t.cmd}e.push(r)}),e},(e=t).on("init",function(){_.each(i,function(t){e.formatter.register(t.name,t)})}),{type:"menu",items:e.settings.style_formats_merge?e.settings.style_formats?o(r.concat(e.settings.style_formats)):o(r):o(e.settings.style_formats||r),onPostRender:function(t){e.fire("renderFormatsMenu",{control:t.control})},itemDefaults:{preview:!0,textStyle:function(){if(this.settings.format)return e.formatter.getCssText(this.settings.format)},onPostRender:function(){var t=this;t.parent().on("show",function(){var n,i;(n=t.settings.format)&&(t.disabled(!e.formatter.canApply(n)),t.active(e.formatter.match(n))),(i=t.settings.cmd)&&t.active(e.queryCommandState(i))})},onclick:function(){this.settings.format&&fr(e,this.settings.format)(),this.settings.cmd&&e.execCommand(this.settings.cmd)}}});s=u,t.addMenuItem("formats",{text:"Formats",menu:s}),l=u,(a=t).addButton("styleselect",{type:"menubutton",text:"Formats",menu:l,onShowMenu:function(){a.settings.style_formats_autohide&&Hr(a,this.menu)}})},Mr=function(t,e){var n,i;if("string"==typeof e)i=e.split(" ");else if(_.isArray(e))return gt.flatten(_.map(e,function(e){return Mr(t,e)}));return n=_.grep(i,function(e){return"|"===e||e in t.menuItems}),_.map(n,function(e){return"|"===e?{text:"-"}:t.menuItems[e]})},Tr=function(t){return t&&"-"===t.text},Pr=function(t){var e=gt.filter(t,function(t,e,n){return!Tr(t)||!Tr(n[e-1])});return gt.filter(e,function(t,e,n){return!Tr(t)||e>0&&eM[d]?k:M[d],T[f]=C>T[f]?C:T[f];for(E=o.innerW-p.left-p.right,_=0,d=0;d0?y:0),E-=(d>0?y:0)+M[d];for(H=o.innerH-p.top-p.bottom,R=0,f=0;f0?b:0),H-=(f>0?b:0)+T[f];if(_+=p.left+p.right,R+=p.top+p.bottom,(l={}).minW=_+(o.w-o.innerW),l.minH=R+(o.h-o.innerH),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH,l.minW=Math.min(l.minW,o.maxW),l.minH=Math.min(l.minH,o.maxH),l.minW=Math.max(l.minW,o.startMinWidth),l.minH=Math.max(l.minH,o.startMinHeight),!o.autoResize||l.minW===o.minW&&l.minH===o.minH){var P;o.autoResize&&((l=t.layoutRect(l)).contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH),P="start"===e.packV?0:H>0?Math.floor(H/n):0;var W=0,N=e.flexWidths;if(N)for(d=0;d'},src:function(t){this.getEl().src=t},html:function(t,e){var n=this,i=this.getEl().contentWindow.document.body;return i?(i.innerHTML=t,e&&e()):c.setTimeout(function(){n.html(t)}),this}}),Vr=te.extend({init:function(t){this._super(t),this.classes.add("widget").add("infobox"),this.canFocus=!1},severity:function(t){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(t)},help:function(t){this.state.set("help",t)},renderHtml:function(){var t=this,e=t.classPrefix;return'
'+t.encode(t.state.get("text"))+'
'},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl("body").firstChild.data=t.encode(e.value),t.state.get("rendered")&&t.updateLayoutRect()}),t.state.on("change:help",function(e){t.classes.toggle("has-help",e.value),t.state.get("rendered")&&t.updateLayoutRect()}),t._super()}}),qr=te.extend({init:function(t){var e=this;e._super(t),e.classes.add("widget").add("label"),e.canFocus=!1,t.multiline&&e.classes.add("autoscroll"),t.strong&&e.classes.add("strong")},initLayoutRect:function(){var t=this,e=t._super();return t.settings.multiline&&(vt.getSize(t.getEl()).width>e.maxW&&(e.minW=e.maxW,t.classes.add("multiline")),t.getEl().style.width=e.minW+"px",e.startMinH=e.h=e.minH=Math.min(e.maxH,vt.getSize(t.getEl()).height)),e},repaint:function(){return this.settings.multiline||(this.getEl().style.lineHeight=this.layoutRect().h+"px"),this._super()},severity:function(t){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(t)},renderHtml:function(){var t,e,n=this,i=n.settings.forId,r=n.settings.html?n.settings.html:n.encode(n.state.get("text"));return!i&&(e=n.settings.forName)&&(t=n.getRoot().find("#"+e)[0])&&(i=t._id),i?'":''+r+""},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.innerHtml(t.encode(e.value)),t.state.get("rendered")&&t.updateLayoutRect()}),t._super()}}),Ur=ge.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(t){this._super(t),this.classes.add("toolbar")},postRender:function(){return this.items().each(function(t){t.classes.add("toolbar-item")}),this._super()}}),jr=Ur.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}}),$r=pn.extend({init:function(t){var e=this;e._renderOpen=!0,e._super(t),t=e.settings,e.classes.add("menubtn"),t.fixedWidth&&e.classes.add("fixed-width"),e.aria("haspopup",!0),e.state.set("menu",t.menu||e.render())},showMenu:function(t){var e,n=this;if(n.menu&&n.menu.visible()&&!1!==t)return n.hideMenu();n.menu||(e=n.state.get("menu")||[],n.classes.add("opened"),e.length?e={type:"menu",animate:!0,items:e}:(e.type=e.type||"menu",e.animate=!0),e.renderTo?n.menu=e.parent(n).show().renderTo():n.menu=ae.create(e).parent(n).renderTo(),n.fire("createmenu"),n.menu.reflow(),n.menu.on("cancel",function(t){t.control.parent()===n.menu&&(t.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){n.focus()}),n.menu.on("show hide",function(t){t.control===n.menu&&(n.activeMenu("show"===t.type),n.classes.toggle("opened","show"===t.type)),n.aria("expanded","show"===t.type)}).fire("show")),n.menu.show(),n.menu.layoutRect({w:n.layoutRect().w}),n.menu.repaint(),n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]),n.fire("showmenu")},hideMenu:function(){this.menu&&(this.menu.items().each(function(t){t.hideMenu&&t.hideMenu()}),this.menu.hide())},activeMenu:function(t){this.classes.toggle("active",t)},renderHtml:function(){var t,e=this,n=e._id,i=e.classPrefix,r=e.settings.icon,o=e.state.get("text"),s="";return(t=e.settings.image)?(r="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",o&&(e.classes.add("btn-has-text"),s=''+e.encode(o)+""),r=e.settings.icon?i+"ico "+i+"i-"+r:"",e.aria("role",e.parent()instanceof jr?"menuitem":"button"),'
'},postRender:function(){var t=this;return t.on("click",function(e){e.control===t&&function(t,e){for(;t;){if(e===t)return!0;t=t.parentNode}return!1}(e.target,t.getEl())&&(t.focus(),t.showMenu(!e.aria),e.aria&&t.menu.items().filter(":visible")[0].focus())}),t.on("mouseenter",function(e){var n,i=e.control,r=t.parent();i&&r&&i instanceof $r&&i.parent()===r&&(r.items().filter("MenuButton").each(function(t){t.hideMenu&&t!==i&&(t.menu&&t.menu.visible()&&(n=!0),t.hideMenu())}),n&&(i.focus(),i.showMenu()))}),t._super()},bindStates:function(){var t=this;return t.state.on("change:menu",function(){t.menu&&t.menu.remove(),t.menu=null}),t._super()},remove:function(){this._super(),this.menu&&this.menu.remove()}});function Yr(t,e){var n,i,r=this,o=Jt.classPrefix;r.show=function(s,a){function l(){n&&(yt(t).append('
'),a&&a())}return r.hide(),n=!0,s?i=c.setTimeout(l,s):l(),r},r.hide=function(){var e=t.lastChild;return c.clearTimeout(i),e&&-1!==e.className.indexOf("throbber")&&e.parentNode.removeChild(e),n=!1,r}}var Xr=Ce.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(t){if(t.autohide=!0,t.constrainToViewport=!0,"function"==typeof t.items&&(t.itemsFactory=t.items,t.items=[]),t.itemDefaults)for(var e=t.items,n=e.length;n--;)e[n]=_.extend({},t.itemDefaults,e[n]);this._super(t),this.classes.add("menu"),t.animate&&11!==l.ie&&this.classes.add("animate")},repaint:function(){return this.classes.toggle("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){this.hideAll(),this.fire("select")},load:function(){var t,e=this;function n(){e.throbber&&(e.throbber.hide(),e.throbber=null)}e.settings.itemsFactory&&(e.throbber||(e.throbber=new Yr(e.getEl("body"),!0),0===e.items().length?(e.throbber.show(),e.fire("loading")):e.throbber.show(100,function(){e.items().remove(),e.fire("loading")}),e.on("hide close",n)),e.requestTime=t=(new Date).getTime(),e.settings.itemsFactory(function(i){0!==i.length?e.requestTime===t&&(e.getEl().style.width="",e.getEl("body").style.width="",n(),e.items().remove(),e.getEl("body").innerHTML="",e.add(i),e.renderNew(),e.fire("loaded")):e.hide()}))},hideAll:function(){return this.find("menuitem").exec("hideMenu"),this._super()},preRender:function(){var t=this;return t.items().each(function(e){var n=e.settings;if(n.icon||n.image||n.selectable)return t._hasIcons=!0,!1}),t.settings.itemsFactory&&t.on("postrender",function(){t.settings.itemsFactory&&t.load()}),t.on("show hide",function(e){e.control===t&&("show"===e.type?c.setTimeout(function(){t.classes.add("in")},0):t.classes.remove("in"))}),t._super()}}),Jr=$r.extend({init:function(t){var e,n,i,r,o=this;o._super(t),t=o.settings,o._values=e=t.values,e&&("undefined"!=typeof t.value&&function s(e){for(var r=0;r0&&(i=e[0].text,o.state.set("value",e[0].value)),o.state.set("menu",e)),o.state.set("text",t.text||i),o.classes.add("listbox"),o.on("select",function(e){var n=e.control;r&&(e.lastControl=r),t.multiple?n.active(!n.active()):o.value(e.control.value()),r=n})},bindStates:function(){var t=this;return t.on("show",function(e){var n,i;n=e.control,i=t.value(),n instanceof Xr&&n.items().each(function(t){t.hasMenus()||t.active(t.value()===i)})}),t.state.on("change:value",function(e){var n=function i(t,e){var n;if(t)for(var r=0;r").replace(new RegExp(d("]mce~match!"),"g"),"")}return s&&e.parent().classes.add("menu-has-icons"),i.image&&(a=" style=\"background-image: url('"+i.image+"')\""),u&&(u=function(t){var e,n,i={};for(i=l.mac?{alt:"⌥",ctrl:"⌘",shift:"⇧",meta:"⌘"}:{meta:"Ctrl"},t=t.split("+"),e=0;e\xa0":"",o=h(e.encode(f(o))),c=h(e.encode(f(c))),'
'+t+("-"!==o?''+o+"":"")+(u?'
'+u+"
":"")+(i.menu?'
':"")+(c?'":"")+"
"},postRender:function(){var t=this,e=t.settings,n=e.textStyle;if("function"==typeof n&&(n=n.call(this)),n){var i=t.getEl("text");i&&(i.setAttribute("style",n),t._textStyle=n)}return t.on("mouseenter click",function(n){n.control===t&&(e.menu||"click"!==n.type?(t.showMenu(),n.aria&&t.menu.focus(!0)):(t.fire("select"),c.requestAnimationFrame(function(){t.parent().hideAll()})))}),t._super(),t},hover:function(){return this.parent().items().each(function(t){t.classes.remove("selected")}),this.classes.toggle("selected",!0),this},active:function(t){return function(t,e){var n=t._textStyle;if(n){var i=t.getEl("text");i.setAttribute("style",n),e&&(i.style.color="",i.style.backgroundColor="")}}(this,t),void 0!==t&&this.aria("checked",t),this._super(t)},remove:function(){this._super(),this.menu&&this.menu.remove()}}),Kr=bn.extend({Defaults:{classes:"radio",role:"radio"}}),Qr=te.extend({renderHtml:function(){var t=this,e=t.classPrefix;return t.classes.add("resizehandle"),"both"===t.settings.direction&&t.classes.add("resizehandle-both"),t.canFocus=!1,'
'},postRender:function(){var t=this;t._super(),t.resizeDragHelper=new se(this._id,{start:function(){t.fire("ResizeStart")},drag:function(e){"both"!==t.settings.direction&&(e.deltaX=0),t.fire("Resize",e)},stop:function(){t.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}});function Zr(t){var e="";if(t)for(var n=0;n'+t[n]+"";return e}var to=te.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(t){var e=this;e._super(t),e.settings.size&&(e.size=e.settings.size),e.settings.options&&(e._options=e.settings.options),e.on("keydown",function(t){var n;13===t.keyCode&&(t.preventDefault(),e.parents().reverse().each(function(t){if(t.toJSON)return n=t,!1}),e.fire("submit",{data:n.toJSON()}))})},options:function(t){return arguments.length?(this.state.set("options",t),this):this.state.get("options")},renderHtml:function(){var t,e=this,n="";return t=Zr(e._options),e.size&&(n=' size = "'+e.size+'"'),'"},bindStates:function(){var t=this;return t.state.on("change:options",function(e){t.getEl().innerHTML=Zr(e.value)}),t._super()}});function eo(t,e,n){return tn&&(t=n),t}function no(t,e,n){t.setAttribute("aria-"+e,n)}function io(t,e){var n,i,r,o,s;"v"===t.settings.orientation?(r="top",i="height",n="h"):(r="left",i="width",n="w"),s=t.getEl("handle"),o=((t.layoutRect()[n]||100)-vt.getSize(s)[i])*((e-t._minValue)/(t._maxValue-t._minValue))+"px",s.style[r]=o,s.style.height=t.layoutRect().h+"px",no(s,"valuenow",e),no(s,"valuetext",""+t.settings.previewFilter(e)),no(s,"valuemin",t._minValue),no(s,"valuemax",t._maxValue)}var ro=te.extend({init:function(t){var e=this;t.previewFilter||(t.previewFilter=function(t){return Math.round(100*t)/100}),e._super(t),e.classes.add("slider"),"v"===t.orientation&&e.classes.add("vertical"),e._minValue=Qn.isNumber(t.minValue)?t.minValue:0,e._maxValue=Qn.isNumber(t.maxValue)?t.maxValue:100,e._initValue=e.state.get("value")},renderHtml:function(){var t=this._id,e=this.classPrefix;return'
'},reset:function(){this.value(this._initValue).repaint()},postRender:function(){var t,e,n,i,r,o,s,a,l,u,c,d,f,h,m=this;t=m._minValue,e=m._maxValue,"v"===m.settings.orientation?(n="screenY",i="top",r="height",o="h"):(n="screenX",i="left",r="width",o="w"),m._super(),function(t,e){function n(n){var i,r,o;i=eo(i=(((i=m.value())+(o=t))/(e-o)+.05*n)*(e-(r=t))-r,t,e),m.value(i),m.fire("dragstart",{value:i}),m.fire("drag",{value:i}),m.fire("dragend",{value:i})}m.on("keydown",function(t){switch(t.keyCode){case 37:case 38:n(-1);break;case 39:case 40:n(1)}})}(t,e),s=t,a=e,l=m.getEl("handle"),m._dragHelper=new se(m._id,{handle:m._id+"-handle",start:function(t){u=t[n],c=parseInt(m.getEl("handle").style[i],10),d=(m.layoutRect()[o]||100)-vt.getSize(l)[r],m.fire("dragstart",{value:h})},drag:function(t){var e=t[n]-u;f=eo(c+e,0,d),l.style[i]=f+"px",h=s+f/d*(a-s),m.value(h),m.tooltip().text(""+m.settings.previewFilter(h)).show().moveRel(l,"bc tc"),m.fire("drag",{value:h})},stop:function(){m.tooltip().hide(),m.fire("dragend",{value:h})}})},repaint:function(){this._super(),io(this,this.value())},bindStates:function(){var t=this;return t.state.on("change:value",function(e){io(t,e.value)}),t._super()}}),oo=te.extend({renderHtml:function(){return this.classes.add("spacer"),this.canFocus=!1,'
'}}),so=$r.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var t,e,n=this.getEl(),i=this.layoutRect();return this._super(),t=n.firstChild,e=n.lastChild,yt(t).css({width:i.w-vt.getSize(e).width,height:i.h-2}),yt(e).css({height:i.h-2}),this},activeMenu:function(t){yt(this.getEl().lastChild).toggleClass(this.classPrefix+"active",t)},renderHtml:function(){var t,e,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a=n.settings,l="";return(t=a.image)?(o="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",o=a.icon?r+"ico "+r+"i-"+o:"",s&&(n.classes.add("btn-has-text"),l=''+n.encode(s)+""),e="boolean"==typeof a.active?' aria-pressed="'+a.active+'"':"",'
'},postRender:function(){var t=this.settings.onclick;return this.on("click",function(e){var n=e.target;if(e.control===this)for(;n;){if(e.aria&&"down"!==e.aria.key||"BUTTON"===n.nodeName&&-1===n.className.indexOf("open"))return e.stopImmediatePropagation(),void(t&&t.call(this,e));n=n.parentNode}}),delete this.settings.onclick,this._super()}}),ao=cr.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!0}}),lo=ve.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(t){var e;this.activeTabId&&(e=this.getEl(this.activeTabId),yt(e).removeClass(this.classPrefix+"active"),e.setAttribute("aria-selected","false")),this.activeTabId="t"+t,(e=this.getEl("t"+t)).setAttribute("aria-selected","true"),yt(e).addClass(this.classPrefix+"active"),this.items()[t].show().fire("showtab"),this.reflow(),this.items().each(function(e,n){t!==n&&e.hide()})},renderHtml:function(){var t=this,e=t._layout,n="",i=t.classPrefix;return t.preRender(),e.preRender(t),t.items().each(function(e,r){var o=t._id+"-t"+r;e.aria("role","tabpanel"),e.aria("labelledby",o),n+='"}),'
'+n+'
'+e.renderHtml(t)+"
"},postRender:function(){var t=this;t._super(),t.settings.activeTab=t.settings.activeTab||0,t.activateTab(t.settings.activeTab),this.on("click",function(e){var n=e.target.parentNode;if(n&&n.id===t._id+"-head")for(var i=n.childNodes.length;i--;)n.childNodes[i]===e.target&&t.activateTab(i)})},initLayoutRect:function(){var t,e,n,i=this;e=(e=vt.getSize(i.getEl("head")).width)<0?0:e,n=0,i.items().each(function(t){e=Math.max(e,t.layoutRect().minW),n=Math.max(n,t.layoutRect().minH)}),i.items().each(function(t){t.settings.x=0,t.settings.y=0,t.settings.w=e,t.settings.h=n,t.layoutRect({x:0,y:0,w:e,h:n})});var r=vt.getSize(i.getEl("head")).height;return i.settings.minWidth=e,i.settings.minHeight=n+r,(t=i._super()).deltaH+=r,t.innerH=t.h-t.deltaH,t}}),uo=te.extend({init:function(t){var e=this;e._super(t),e.classes.add("textbox"),t.multiline?e.classes.add("multiline"):(e.on("keydown",function(t){var n;13===t.keyCode&&(t.preventDefault(),e.parents().reverse().each(function(t){if(t.toJSON)return n=t,!1}),e.fire("submit",{data:n.toJSON()}))}),e.on("keyup",function(t){e.state.set("value",t.target.value)}))},repaint:function(){var t,e,n,i,r,o=this,s=0;t=o.getEl().style,e=o._layoutRect,r=o._lastRepaintRect||{};var a=document;return!o.settings.multiline&&a.all&&(!a.documentMode||a.documentMode<=8)&&(t.lineHeight=e.h-s+"px"),i=(n=o.borderBox).left+n.right+8,s=n.top+n.bottom+(o.settings.multiline?8:0),e.x!==r.x&&(t.left=e.x+"px",r.x=e.x),e.y!==r.y&&(t.top=e.y+"px",r.y=e.y),e.w!==r.w&&(t.width=e.w-i+"px",r.w=e.w),e.h!==r.h&&(t.height=e.h-s+"px",r.h=e.h),o._lastRepaintRect=r,o.fire("repaint",{},!1),o},renderHtml:function(){var t,e,n=this,i=n.settings;return t={id:n._id,hidefocus:"1"},_.each(["rows","spellcheck","maxLength","size","readonly","min","max","step","list","pattern","placeholder","required","multiple"],function(e){t[e]=i[e]}),n.disabled()&&(t.disabled="disabled"),i.subtype&&(t.type=i.subtype),(e=vt.create(i.multiline?"textarea":"input",t)).value=n.state.get("value"),e.className=n.classes,e.outerHTML},value:function(t){return arguments.length?(this.state.set("value",t),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var t=this;t.getEl().value=t.state.get("value"),t._super(),t.$el.on("change",function(e){t.state.set("value",e.target.value),t.fire("change",e)})},bindStates:function(){var t=this;return t.state.on("change:value",function(e){t.getEl().value!==e.value&&(t.getEl().value=e.value)}),t.state.on("change:disabled",function(e){t.getEl().disabled=e.value}),t._super()},remove:function(){this.$el.off(),this._super()}}),co=function(){return{Selector:Pt,Collection:Dt,ReflowQueue:Vt,Control:Jt,Factory:ae,KeyboardNavigation:ue,Container:ge,DragHelper:se,Scrollable:pe,Panel:ve,Movable:Qt,Resizable:ye,FloatPanel:Ce,Window:Pe,MessageBox:We,Tooltip:Zt,Widget:te,Progress:ee,Notification:ie,Layout:mn,AbsoluteLayout:gn,Button:pn,ButtonGroup:yn,Checkbox:bn,ComboBox:wn,ColorBox:_n,PanelButton:Rn,ColorButton:Cn,ColorPicker:Hn,Path:Mn,ElementPath:Tn,FormItem:Pn,Form:Wn,FieldSet:Nn,FilePicker:ar,FitLayout:lr,FlexLayout:ur,FlowLayout:cr,FormatControls:Ir,GridLayout:zr,Iframe:Fr,InfoBox:Vr,Label:qr,Toolbar:Ur,MenuBar:jr,MenuButton:$r,MenuItem:Gr,Throbber:Yr,Menu:Xr,ListBox:Jr,Radio:Kr,ResizeHandle:Qr,SelectBox:to,Slider:ro,Spacer:oo,SplitButton:so,StackLayout:ao,TabPanel:lo,TextBox:uo,DropZone:Sn,BrowseButton:vn}},fo=function(t){t.ui?_.each(co(),function(e,n){t.ui[n]=e}):t.ui=co()};_.each(co(),function(t,e){ae.add(e,t)}),fo(window.tinymce?window.tinymce:{}),a.add("inlite",function(t){var e=fn();return Ir.setup(t),on(t,e),Ne(t,e)})}();