Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 18.226.52.26
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/book24.ng/public/libs/tinymce/js/tinymce/themes/silver/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/book24.ng/public/libs/tinymce/js/tinymce/themes/silver/theme.min.js
/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 *
 * Version: 5.0.9 (2019-06-26)
 */
!function(H){"use strict";var tt=function(){},t=function(t){return function(){return t()}},p=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},nt=function(t){return function(){return t}},d=function(t){return t};function g(o){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=r.concat(t);return o.apply(null,e)}}var n,e,o,r,i,x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return!e.apply(null,t)}},u=function(t){return function(){throw new Error(t)}},a=nt(!1),c=nt(!0),s=a,f=c,l=function(){return m},m=(r={fold:function(t,n){return t()},is:s,isSome:s,isNone:f,getOr:o=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:o,orThunk:e,map:l,ap:l,each:function(){},bind:l,flatten:l,exists:s,forall:f,filter:l,equals:n=function(t){return t.isNone()},equals_:n,toArray:function(){return[]},toString:nt("none()")},Object.freeze&&Object.freeze(r),r),h=function(e){var t=function(){return e},n=function(){return r},o=function(t){return t(e)},r={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:f,isNone:s,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return h(t(e))},ap:function(t){return t.fold(l,function(t){return h(t(e))})},each:function(t){t(e)},bind:o,flatten:t,exists:o,forall:o,filter:function(t){return t(e)?r:m},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(s,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return r},et={some:h,none:l,from:function(t){return null===t||t===undefined?m:h(t)}},v=function(n){return function(t){return function(t){if(null===t)return"null";var n=typeof t;return"object"===n&&Array.prototype.isPrototypeOf(t)?"array":"object"===n&&String.prototype.isPrototypeOf(t)?"string":n}(t)===n}},P=v("string"),w=v("object"),z=v("array"),S=(v("null"),v("boolean")),b=(v("undefined"),v("function")),L=v("number"),y=function(t,n){if(z(t)){for(var e=0,o=t.length;e<o;++e)if(!0!==n(t[e]))return!1;return!0}return!1},k=Array.prototype.slice,C=(i=Array.prototype.indexOf)===undefined?function(t,n){return U(t,n)}:function(t,n){return i.call(t,n)},O=function(t,n){var e=C(t,n);return-1===e?et.none():et.some(e)},T=function(t,n){return-1<C(t,n)},E=function(t,n){return N(t,n).isSome()},B=function(t,n){for(var e=[],o=0;o<t;o++)e.push(n(o));return e},A=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=k.call(t,o,o+n);e.push(r)}return e},D=function(t,n){for(var e=t.length,o=new Array(e),r=0;r<e;r++){var i=t[r];o[r]=n(i,r,t)}return o},j=function(t,n){for(var e=0,o=t.length;e<o;e++){n(t[e],e,t)}},_=function(t,n){for(var e=t.length-1;0<=e;e--){n(t[e],e,t)}},M=function(t,n){for(var e=[],o=[],r=0,i=t.length;r<i;r++){var u=t[r];(n(u,r,t)?e:o).push(u)}return{pass:e,fail:o}},F=function(t,n){for(var e=[],o=0,r=t.length;o<r;o++){var i=t[o];n(i,o,t)&&e.push(i)}return e},I=function(t,n,e){return _(t,function(t){e=n(e,t)}),e},R=function(t,n,e){return j(t,function(t){e=n(e,t)}),e},V=function(t,n){for(var e=0,o=t.length;e<o;e++){var r=t[e];if(n(r,e,t))return et.some(r)}return et.none()},N=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e,t))return et.some(e)}return et.none()},U=function(t,n){for(var e=0,o=t.length;e<o;++e)if(t[e]===n)return e;return-1},W=Array.prototype.push,G=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!Array.prototype.isPrototypeOf(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);W.apply(n,t[e])}return n},X=function(t,n){var e=D(t,n);return G(e)},Y=function(t,n){for(var e=0,o=t.length;e<o;++e){if(!0!==n(t[e],e,t))return!1}return!0},q=function(t){var n=k.call(t,0);return n.reverse(),n},K=function(t,n){return F(t,function(t){return!T(n,t)})},$=function(t){return[t]},J=function(t,n){var e=k.call(t,0);return e.sort(n),e},Q=function(t){return 0===t.length?et.none():et.some(t[0])},Z=function(t){return 0===t.length?et.none():et.some(t[t.length-1])},ot=b(Array.from)?Array.from:function(t){return k.call(t)},rt=Object.keys,it=Object.hasOwnProperty,ut=function(t,n){for(var e=rt(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i,t)}},at=function(t,o){return ct(t,function(t,n,e){return{k:n,v:o(t,n,e)}})},ct=function(o,r){var i={};return ut(o,function(t,n){var e=r(t,n,o);i[e.k]=e.v}),i},st=function(t,e){var o=[];return ut(t,function(t,n){o.push(e(t,n))}),o},ft=function(t,n){for(var e=rt(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return et.some(u)}return et.none()},lt=function(t){return st(t,function(t){return t})},dt=function(t,n){return mt(t,n)?et.from(t[n]):et.none()},mt=function(t,n){return it.call(t,n)},gt=function(n){return function(t){return mt(t,n)?et.from(t[n]):et.none()}},pt=function(t,n){return gt(n)(t)},ht=function(t,n){var e={};return e[t]=n,e},vt=function(e){return{is:function(t){return e===t},isValue:c,isError:a,getOr:nt(e),getOrThunk:nt(e),getOrDie:nt(e),or:function(t){return vt(e)},orThunk:function(t){return vt(e)},fold:function(t,n){return n(e)},map:function(t){return vt(t(e))},mapError:function(t){return vt(e)},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return et.some(e)}}},bt=function(e){return{is:a,isValue:a,isError:c,getOr:d,getOrThunk:function(t){return t()},getOrDie:function(){return u(String(e))()},or:function(t){return t},orThunk:function(t){return t()},fold:function(t,n){return t(e)},map:function(t){return bt(e)},mapError:function(t){return bt(t(e))},each:tt,bind:function(t){return bt(e)},exists:a,forall:c,toOption:et.none}},yt={value:vt,error:bt,fromOption:function(t,n){return t.fold(function(){return bt(n)},vt)}},xt=function(u){if(!z(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],e={};return j(u,function(t,o){var n=rt(t);if(1!==n.length)throw new Error("one and only one name per case");var r=n[0],i=t[r];if(e[r]!==undefined)throw new Error("duplicate key detected:"+r);if("cata"===r)throw new Error("cannot have a case named cata (sorry)");if(!z(i))throw new Error("case arguments must be an array");a.push(r),e[r]=function(){var t=arguments.length;if(t!==i.length)throw new Error("Wrong number of arguments to case "+r+". Expected "+i.length+" ("+i+"), got "+t);for(var e=new Array(t),n=0;n<e.length;n++)e[n]=arguments[n];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[o].apply(null,e)},match:function(t){var n=rt(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!Y(a,function(t){return T(n,t)}))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+a.join(", "));return t[r].apply(null,e)},log:function(t){H.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},wt=(xt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),Object.prototype.hasOwnProperty),St=function(u){return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(0===t.length)throw new Error("Can't merge zero objects");for(var e={},o=0;o<t.length;o++){var r=t[o];for(var i in r)wt.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},kt=St(function(t,n){return w(t)&&w(n)?kt(t,n):n}),Ct=St(function(t,n){return n}),Ot=function(t,n){return e=n,o={},ut(t,function(t,n){T(e,n)||(o[n]=t)}),o;var e,o},Tt=function(t){return gt(t)},Et=function(t,n){return e=t,o=n,function(t){return mt(t,e)?t[e]:o};var e,o},Bt=function(t,n){return pt(t,n)},At=function(t,n){return ht(t,n)},Dt=function(t){return n={},j(t,function(t){n[t.key]=t.value}),n;var n},_t=function(t,n){var e,o,r,i,u,a=(e=[],o=[],j(t,function(t){t.fold(function(t){e.push(t)},function(t){o.push(t)})}),{errors:e,values:o});return 0<a.errors.length?(u=a.errors,p(yt.error,G)(u)):(i=n,0===(r=a.values).length?yt.value(i):yt.value(kt(i,Ct.apply(undefined,r))))},Mt=function(t,n){return mt(e=t,o=n)&&e[o]!==undefined&&null!==e[o];var e,o},Ft=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return Ft(e())}}},It=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},Rt=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return et.none()},Vt=function(t,n){for(var e=[],o=0;o<t.length;o++){var r=t[o];if(!r.isSome())return et.none();e.push(r.getOrDie())}return et.some(n.apply(null,e))};(function K_(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=t.pop();return Vt(t,e)});var Nt,Ht,Pt=nt("touchstart"),zt=nt("touchmove"),Lt=nt("touchend"),jt=nt("mousedown"),Ut=nt("mousemove"),Wt=nt("mouseout"),Gt=nt("mouseup"),Xt=nt("mouseover"),Yt=nt("focusin"),qt=nt("focusout"),Kt=nt("keydown"),$t=nt("keyup"),Jt=nt("input"),Qt=nt("change"),Zt=nt("click"),tn=nt("transitionend"),nn=nt("selectstart"),en=function(e){var o,r=!1;return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r||(r=!0,o=e.apply(null,t)),o}},on=function(t,n){var e=function(t,n){for(var e=0;e<t.length;e++){var o=t[e];if(o.test(n))return o}return undefined}(t,n);if(!e)return{major:0,minor:0};var o=function(t){return Number(n.replace(e,"$"+t))};return un(o(1),o(2))},rn=function(){return un(0,0)},un=function(t,n){return{major:t,minor:n}},an={nu:un,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?rn():on(t,e)},unknown:rn},cn="Firefox",sn=function(t,n){return function(){return n===t}},fn=function(t){var n=t.current;return{current:n,version:t.version,isEdge:sn("Edge",n),isChrome:sn("Chrome",n),isIE:sn("IE",n),isOpera:sn("Opera",n),isFirefox:sn(cn,n),isSafari:sn("Safari",n)}},ln={unknown:function(){return fn({current:undefined,version:an.unknown()})},nu:fn,edge:nt("Edge"),chrome:nt("Chrome"),ie:nt("IE"),opera:nt("Opera"),firefox:nt(cn),safari:nt("Safari")},dn="Windows",mn="Android",gn="Solaris",pn="FreeBSD",hn=function(t,n){return function(){return n===t}},vn=function(t){var n=t.current;return{current:n,version:t.version,isWindows:hn(dn,n),isiOS:hn("iOS",n),isAndroid:hn(mn,n),isOSX:hn("OSX",n),isLinux:hn("Linux",n),isSolaris:hn(gn,n),isFreeBSD:hn(pn,n)}},bn={unknown:function(){return vn({current:undefined,version:an.unknown()})},nu:vn,windows:nt(dn),ios:nt("iOS"),android:nt(mn),linux:nt("Linux"),osx:nt("OSX"),solaris:nt(gn),freebsd:nt(pn)},yn=function(t,n){var e=String(n).toLowerCase();return V(t,function(t){return t.search(e)})},xn=function(t,e){return yn(t,e).map(function(t){var n=an.detect(t.versionRegexes,e);return{current:t.name,version:n}})},wn=function(t,e){return yn(t,e).map(function(t){var n=an.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Sn=function(t,n){return-1!==t.indexOf(n)},kn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Cn=function(n){return function(t){return Sn(t,n)}},On=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Sn(t,"edge/")&&Sn(t,"chrome")&&Sn(t,"safari")&&Sn(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,kn],search:function(t){return Sn(t,"chrome")&&!Sn(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Sn(t,"msie")||Sn(t,"trident")}},{name:"Opera",versionRegexes:[kn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Cn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Cn("firefox")},{name:"Safari",versionRegexes:[kn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Sn(t,"safari")||Sn(t,"mobile/"))&&Sn(t,"applewebkit")}}],Tn=[{name:"Windows",search:Cn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Sn(t,"iphone")||Sn(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Cn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Cn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Cn("linux"),versionRegexes:[]},{name:"Solaris",search:Cn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Cn("freebsd"),versionRegexes:[]}],En={browsers:nt(On),oses:nt(Tn)},Bn=function(t){var n,e,o,r,i,u,a,c,s,f,l,d=En.browsers(),m=En.oses(),g=xn(d,t).fold(ln.unknown,ln.nu),p=wn(m,t).fold(bn.unknown,bn.nu);return{browser:g,os:p,deviceType:(e=g,o=t,r=(n=p).isiOS()&&!0===/ipad/i.test(o),i=n.isiOS()&&!r,u=n.isAndroid()&&3===n.version.major,a=n.isAndroid()&&4===n.version.major,c=r||u||a&&!0===/mobile/i.test(o),s=n.isiOS()||n.isAndroid(),f=s&&!c,l=e.isSafari()&&n.isiOS()&&!1===/safari/i.test(o),{isiPad:nt(r),isiPhone:nt(i),isTablet:nt(c),isPhone:nt(f),isTouch:nt(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:nt(l)})}},An={detect:en(function(){var t=H.navigator.userAgent;return Bn(t)})},Dn={tap:nt("alloy.tap")},_n=nt("alloy.focus"),Mn=nt("alloy.blur.post"),Fn=nt("alloy.paste.post"),In=nt("alloy.receive"),Rn=nt("alloy.execute"),Vn=nt("alloy.focus.item"),Nn=Dn.tap,Hn=An.detect().deviceType.isTouch()?Dn.tap:Zt,Pn=nt("alloy.longpress"),zn=nt("alloy.sandbox.close"),Ln=nt("alloy.typeahead.cancel"),jn=nt("alloy.system.init"),Un=nt("alloy.system.scroll"),Wn=nt("alloy.system.resize"),Gn=nt("alloy.system.attached"),Xn=nt("alloy.system.detached"),Yn=nt("alloy.system.dismissRequested"),qn=nt("alloy.focusmanager.shifted"),Kn=nt("alloy.slotcontainer.visibility"),$n=nt("alloy.change.tab"),Jn=nt("alloy.dismiss.tab"),Qn=nt("alloy.highlight"),Zn=nt("alloy.dehighlight"),te=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:nt(t)}},ne={fromHtml:function(t,n){var e=(n||H.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw H.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return te(e.childNodes[0])},fromTag:function(t,n){var e=(n||H.document).createElement(t);return te(e)},fromText:function(t,n){var e=(n||H.document).createTextNode(t);return te(e)},fromDom:te,fromPoint:function(t,n,e){var o=t.dom();return et.from(o.elementFromPoint(n,e)).map(te)}},ee=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(n.length!==e.length)throw new Error('Wrong number of arguments to struct. Expected "['+n.length+']", got '+e.length+" arguments");var o={};return j(n,function(t,n){o[t]=nt(e[n])}),o}},oe=function(t){return t.slice(0).sort()},re=function(n,t){if(!z(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");j(t,function(t){if(!P(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},ie=function(r,i){var e,u=r.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return re("required",r),re("optional",i),e=oe(u),V(e,function(t,n){return n<e.length-1&&t===e[n+1]}).each(function(t){throw new Error("The field: "+t+" occurs more than once in the combined fields: ["+e.join(", ")+"].")}),function(n){var e=rt(n);Y(r,function(t){return T(e,t)})||function(t,n){throw new Error("All required keys ("+oe(t).join(", ")+") were not specified. Specified keys were: "+oe(n).join(", ")+".")}(r,e);var t=F(e,function(t){return!T(u,t)});0<t.length&&function(t){throw new Error("Unsupported keys for object: "+oe(t).join(", "))}(t);var o={};return j(r,function(t){o[t]=nt(n[t])}),j(i,function(t){o[t]=nt(Object.prototype.hasOwnProperty.call(n,t)?et.some(n[t]):et.none())}),o}},ue="undefined"!=typeof H.window?H.window:Function("return this;")(),ae=function(t,n){return function(t,n){for(var e=n!==undefined&&null!==n?n:ue,o=0;o<t.length&&e!==undefined&&null!==e;++o)e=e[t[o]];return e}(t.split("."),n)},ce={getOrDie:function(t,n){var e=ae(t,n);if(e===undefined||null===e)throw t+" not available on this browser";return e}},se=function(){return ce.getOrDie("Node")},fe=function(t,n,e){return 0!=(t.compareDocumentPosition(n)&e)},le=function(t,n){return fe(t,n,se().DOCUMENT_POSITION_CONTAINED_BY)},de=(H.Node.ATTRIBUTE_NODE,H.Node.CDATA_SECTION_NODE,H.Node.COMMENT_NODE,H.Node.DOCUMENT_NODE),me=(H.Node.DOCUMENT_TYPE_NODE,H.Node.DOCUMENT_FRAGMENT_NODE,H.Node.ELEMENT_NODE),ge=H.Node.TEXT_NODE,pe=(H.Node.PROCESSING_INSTRUCTION_NODE,H.Node.ENTITY_REFERENCE_NODE,H.Node.ENTITY_NODE,H.Node.NOTATION_NODE,me),he=de,ve=function(t,n){var e=t.dom();if(e.nodeType!==pe)return!1;if(e.matches!==undefined)return e.matches(n);if(e.msMatchesSelector!==undefined)return e.msMatchesSelector(n);if(e.webkitMatchesSelector!==undefined)return e.webkitMatchesSelector(n);if(e.mozMatchesSelector!==undefined)return e.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")},be=function(t){return t.nodeType!==pe&&t.nodeType!==he||0===t.childElementCount},ye=function(t,n){var e=n===undefined?H.document:n.dom();return be(e)?[]:D(e.querySelectorAll(t),ne.fromDom)},xe=function(t,n){var e=n===undefined?H.document:n.dom();return be(e)?et.none():et.from(e.querySelector(t)).map(ne.fromDom)},we=function(t,n){return t.dom()===n.dom()},Se=(An.detect().browser.isIE(),function(t){return ne.fromDom(t.dom().ownerDocument)}),ke=function(t){var n=t.dom().ownerDocument.defaultView;return ne.fromDom(n)},Ce=function(t){var n=t.dom();return et.from(n.parentNode).map(ne.fromDom)},Oe=function(t){var n=t.dom();return et.from(n.offsetParent).map(ne.fromDom)},Te=function(t){var n=t.dom();return D(n.childNodes,ne.fromDom)},Ee=function(t,n){var e=t.dom().childNodes;return et.from(e[n]).map(ne.fromDom)},Be=(ee("element","offset"),function(n,e){Ce(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})}),Ae=function(t,n){var e;(e=t.dom(),et.from(e.nextSibling).map(ne.fromDom)).fold(function(){Ce(t).each(function(t){_e(t,n)})},function(t){Be(t,n)})},De=function(n,e){Ee(n,0).fold(function(){_e(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},_e=function(t,n){t.dom().appendChild(n.dom())},Me=function(n,t){j(t,function(t){_e(n,t)})},Fe=function(t){t.dom().textContent="",j(Te(t),function(t){Ie(t)})},Ie=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},Re=function(t){var n,e=Te(t);0<e.length&&(n=t,j(e,function(t){Be(n,t)})),Ie(t)},Ve=function(t){return t.dom().innerHTML},Ne=function(t,n){var e,o,r=Se(t).dom(),i=ne.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||H.document).createElement("div")).innerHTML=e,Te(ne.fromDom(o)));Me(i,u),Fe(t),_e(t,i)},He=function(t){return t.dom().nodeName.toLowerCase()},Pe=function(t){return t.dom().nodeType},ze=function(n){return function(t){return Pe(t)===n}},Le=ze(me),je=ze(ge),We=ze(de),Ge=function(t,n,e){if(!(P(e)||S(e)||L(e)))throw H.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},Xe=function(t,n,e){Ge(t.dom(),n,e)},Ye=function(t,n){var e=t.dom();ut(n,function(t,n){Ge(e,n,t)})},qe=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},Ke=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},$e=function(t,n){t.dom().removeAttribute(n)},Je=function(t){return n=t,e=!1,ne.fromDom(n.dom().cloneNode(e));var n,e},Qe=function(t){var n,e,o,r=Je(t);return n=r,e=ne.fromTag("div"),o=ne.fromDom(n.dom().cloneNode(!0)),_e(e,o),Ve(e)},Ze=function(t){return Qe(t)},to="unknown",no="__CHROME_INSPECTOR_CONNECTION_TO_ALLOY__";(Ht=Nt||(Nt={}))[Ht.STOP=0]="STOP",Ht[Ht.NORMAL=1]="NORMAL",Ht[Ht.LOGGING=2]="LOGGING";var eo=Ft({}),oo=function(n,t,e){var o,r,i,u;switch(Bt(eo.get(),n).orThunk(function(){var t=rt(eo.get());return Rt(t,function(t){return-1<n.indexOf(t)?et.some(eo.get()[t]):et.none()})}).getOr(Nt.NORMAL)){case Nt.NORMAL:return e(co());case Nt.LOGGING:var a=(o=n,r=t,i=[],u=(new Date).getTime(),{logEventCut:function(t,n,e){i.push({outcome:"cut",target:n,purpose:e})},logEventStopped:function(t,n,e){i.push({outcome:"stopped",target:n,purpose:e})},logNoParent:function(t,n,e){i.push({outcome:"no-parent",target:n,purpose:e})},logEventNoHandlers:function(t,n){i.push({outcome:"no-handlers-left",target:n})},logEventResponse:function(t,n,e){i.push({outcome:"response",purpose:e,target:n})},write:function(){var t=(new Date).getTime();T(["mousemove","mouseover","mouseout",jn()],o)||H.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:D(i,function(t){return T(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+Ze(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Nt.STOP:return!0}},ro=["alloy/data/Fields","alloy/debugging/Debugging"],io=function(t,n,e){return oo(t,n,e)},uo=function(){if(H.window[no]!==undefined)return H.window[no];var n=function(t,n){var e=eo.get();e[t]=n,eo.set(e)};return H.window[no]={systems:{},lookup:function(n){var e=H.window[no].systems,t=rt(e);return Rt(t,function(t){return e[t].getByUid(n).toOption().map(function(t){return At(Ze(t.element()),(n=function(e){var t=e.spec();return{"(original.spec)":t,"(dom.ref)":e.element().dom(),"(element)":Ze(e.element()),"(initComponents)":D(t.components!==undefined?t.components:[],n),"(components)":D(e.components(),n),"(bound.events)":st(e.events(),function(t,n){return[n]}).join(", "),"(behaviours)":t.behaviours!==undefined?at(t.behaviours,function(t,n){return t===undefined?"--revoked--":{config:t.configAsRaw(),"original-config":t.initialConfig,state:e.readState(n)}}):"none"}})(t));var n})}).orThunk(function(){return et.some({error:"Systems ("+t.join(", ")+") did not contain uid: "+n})})},events:{setToNormal:function(t){n(t,Nt.NORMAL)},setToLogging:function(t){n(t,Nt.LOGGING)},setToStop:function(t){n(t,Nt.STOP)}}},H.window[no]},ao=function(t,n){uo().systems[t]=n},co=nt({logEventCut:tt,logEventStopped:tt,logNoParent:tt,logEventNoHandlers:tt,logEventResponse:tt,write:tt}),so=0,fo=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++so+String(n)},lo=tinymce.util.Tools.resolve("tinymce.ThemeManager");var mo=function(){return(mo=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function go(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)n.indexOf(o[r])<0&&(e[o[r]]=t[o[r]])}return e}(function $_(t,n){function e(){this.constructor=t}Ue(t,n),t.prototype=null===n?Object.create(n):(n.prototype,new e)}),function J_(t,n,e,o){var r,i=arguments.length,u=i<3?n:null===o?Object.getOwnPropertyDescriptor(n,e):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)Reflect.decorate(t,n,e,o);else for(var a=t.length-1;0<=a;a--)t[a]&&((i<3?r(u):3<i?r(n,e,u):r(n,e))||u);return 3<i&&u&&Object.defineProperty(n,e,u),u},function Q_(e,o){return function(t,n){o(t,n,e)}},function Z_(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},function tM(n,u,a,c){return new(a||Promise)(function(t,e){function o(t){try{i(c.next(t))}catch(n){e(n)}}function r(t){try{i(c["throw"](t))}catch(n){e(n)}}function i(n){n.done?t(n.value):new a(function(t){t(n.value)}).then(o,r)}i(c.apply(n,u||[]).next())})},function nM(o,r){var i,u,a,t,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return{next:n(0),"throw":n(1),"return":n(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function e(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(1,u&&(2&t[0]?u["return"]:t[0]?u["throw"]||(u["return"]&&a.call(u),0):u.next)&&!a.call(u,t[1]).done)return a;switch(0,a&&[2&t[0],a.value],t[0]){case 0:case 1:t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,t[1],[0];continue;case 7:c.ops.pop(),c.trys.pop();continue;default:if(!(0<c.trys.length&&a[a.length-1])&&(6===t[0]||2===t[0])){0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){c.label=t[1];break}if(6===t[0]&&c.label<a[1]){c.label=a[1],t;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(t);break}a[2]&&c.ops.pop(),c.trys.pop();continue}r.call(o,c)}catch(n){[6,n],0}finally{0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([n,t])}}},function eM(t,n){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])},function oM(){for(var t=[],n=0;n<arguments.length;n++)t.concat(df(arguments[n]));return t},function rM(t,n,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=e.apply(t,n||[]),u=[];return{},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(o){i[o]&&(r[o]=function(e){return new Promise(function(t,n){1<u.push([o,e,t,n])||a(o,e)})})}function a(t,n){try{!function e(t){t.value instanceof ff?Promise.resolve(t.value.v).then(c,s):f(u[0][2],t)}(i[t](n))}catch(o){f(u[0][3],o)}}function c(t){a("next",t)}function s(t){a("throw",t)}function f(t,n){t(n),u.shift(),u.length&&a(u[0][0],u[0][1])}},function iM(o){var t,r;return{},n("next"),n("throw",function(t){throw t}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,e){t[n]=o[n]?function(t){return!r?{value:ff(o[n](t)),done:"return"===n}:e?e(t):t}:e}},function uM(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=i[Symbol.asyncIterator];return n?n.call(i):(cf(i),{},e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(o){t[o]=i[o]&&function(e){return new Promise(function(t,n){!function r(n,t,e,o){Promise.resolve(o).then(function(t){n({value:t,done:e})},t)}(t,n,i[o](e).done,e.value)})}}},function aM(t,n){return Object.defineProperty?Object.defineProperty(t,"raw",{value:n}):t.raw=n,t},function cM(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n["default"]=t,n},function sM(t){return t&&t.__esModule?t:{"default":t}};var po,ho,vo=xt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),bo=function(t){return vo.defaultedThunk(nt(t))},yo=vo.strict,xo=vo.asOption,wo=vo.defaultedThunk,So=vo.mergeWithThunk;(ho=po||(po={}))[ho.Error=0]="Error",ho[ho.Value=1]="Value";var ko=function(t,n,e){return t.stype===po.Error?n(t.serror):e(t.svalue)},Co=function(t){return{stype:po.Value,svalue:t}},Oo=function(t){return{stype:po.Error,serror:t}},To=function(t){return t.fold(Oo,Co)},Eo=function(t){return ko(t,yt.error,yt.value)},Bo=Co,Ao=function(t){var n=[],e=[];return j(t,function(t){ko(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Do=Oo,_o=function(t,n){return t.stype===po.Value?n(t.svalue):t},Mo=function(t,n){return t.stype===po.Error?n(t.serror):t},Fo=function(t,n){return t.stype===po.Value?{stype:po.Value,svalue:n(t.svalue)}:t},Io=function(t,n){return t.stype===po.Error?{stype:po.Error,serror:n(t.serror)}:t},Ro=function(t){return p(Do,G)(t)},Vo=function(t,n){var e,o,r=Ao(t);return 0<r.errors.length?Ro(r.errors):(e=r.values,o=n,0<e.length?Bo(kt(o,Ct.apply(undefined,e))):Bo(o))},No=function(t){var n=Ao(t);return 0<n.errors.length?Ro(n.errors):Bo(n.values)},Ho=xt([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),Po=xt([{field:["name","presence","type"]},{state:["name"]}]),zo=function(){return ce.getOrDie("JSON")},Lo=function(t,n,e){return zo().stringify(t,n,e)},jo=function(t){return w(t)&&100<rt(t).length?" removed due to size":Lo(t,null,2)},Uo=function(t,n){return Do([{path:t,getErrorInfo:n}])},Wo=xt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),Go=function(e,o,r){return pt(o,r).fold(function(){return t=r,n=o,Uo(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+jo(n)});var t,n},Bo)},Xo=function(t,n,e){var o=pt(t,n).fold(function(){return e(t)},d);return Bo(o)},Yo=function(a,c,t,s){return t.fold(function(r,e,t,o){var i=function(t){var n=o.extract(a.concat([r]),s,t);return Fo(n,function(t){return ht(e,s(t))})},u=function(t){return t.fold(function(){var t=ht(e,s(et.none()));return Bo(t)},function(t){var n=o.extract(a.concat([r]),s,t);return Fo(n,function(t){return ht(e,s(et.some(t)))})})};return t.fold(function(){return _o(Go(a,c,r),i)},function(t){return _o(Xo(c,r,t),i)},function(){return _o(Bo(pt(c,r)),u)},function(t){return _o((e=t,o=pt(n=c,r).map(function(t){return!0===t?e(n):t}),Bo(o)),u);var n,e,o},function(t){var n=t(c),e=Fo(Xo(c,r,nt({})),function(t){return kt(n,t)});return _o(e,i)})},function(t,n){var e=n(c);return Bo(ht(t,s(e)))})},qo=function(o){return{extract:function(e,t,n){return Mo(o(n,t),function(t){return n=t,Uo(e,function(){return n});var n})},toString:function(){return"val"},toDsl:function(){return Ho.itemOf(o)}}},Ko=function(t){var c=$o(t),s=I(t,function(n,t){return t.fold(function(t){return kt(n,At(t,!0))},nt(n))},{});return{extract:function(t,n,e){var o,r,i,u=S(e)?[]:(r=rt(o=e),F(r,function(t){return Mt(o,t)})),a=F(u,function(t){return!Mt(s,t)});return 0===a.length?c.extract(t,n,e):(i=a,Uo(t,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},$o=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=D(a,function(t){return Yo(o,r,t,i)}),Vo(u,{});var o,r,i,u},toString:function(){return"obj{\n"+D(a,function(t){return t.fold(function(t,n,e,o){return t+" -> "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"},toDsl:function(){return Ho.objOf(D(a,function(t){return t.fold(function(t,n,e,o){return Po.field(t,e,o)},function(t,n){return Po.state(t)})}))}}},Jo=function(r){return{extract:function(e,o,t){var n=D(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return No(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return Ho.arrOf(r)}}},Qo=function(a,c){return{extract:function(e,o,r){var t,n,i=rt(r),u=(t=e,n=i,Jo(qo(a)).extract(t,d,n));return _o(u,function(t){var n=D(t,function(t){return Wo.field(t,t,yo(),c)});return $o(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return Ho.setOf(a,c)}}},Zo=nt(qo(Bo)),tr=p(Jo,$o),nr=Wo.state,er=Wo.field,or=function(e,n,o,r,i){return Bt(r,i).fold(function(){return t=r,n=i,Uo(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+jo(t)});var t,n},function(t){return $o(t).extract(e.concat(["branch: "+i]),n,o)})},rr=function(r,i){return{extract:function(n,e,o){return Bt(o,r).fold(function(){return t=r,Uo(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return or(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+rt(i)},toDsl:function(){return Ho.choiceOf(r,i)}}},ir=qo(Bo),ur=function(t){return tr(t)},ar=function(){return Jo(ir)},cr=function(n){return qo(function(t){return n(t).fold(Do,Bo)})},sr=function(n,t){return Qo(function(t){return To(n(t))},t)},fr=function(t,n,e,o){var r=n.extract([t],e,o);return Io(r,function(t){return{input:o,errors:t}})},lr=function(t,n,e){return Eo(fr(t,n,d,e))},dr=function(t){return t.fold(function(t){throw new Error(gr(t))},d)},mr=function(t,n,e){return dr(lr(t,n,e))},gr=function(t){return"Errors: \n"+(n=t.errors,e=10<n.length?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n,D(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+jo(t.input);var n,e},pr=function(t,n){return rr(t,n)},hr=nt(ir),vr=function(e,o){return qo(function(t){var n=typeof t;return e(t)?Bo(t):Do("Expected type: "+o+" but got: "+n)})},br=vr(L,"number"),yr=vr(P,"string"),xr=vr(S,"boolean"),wr=vr(b,"function"),Sr=function(n){return cr(function(t){return T(n,t)?yt.value(t):yt.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},kr=function(t){return er(t,t,yo(),Zo())},Cr=function(t,n){return er(t,t,yo(),n)},Or=function(t){return Cr(t,yr)},Tr=function(t,n){return er(t,t,yo(),Sr(n))},Er=function(t){return Cr(t,wr)},Br=function(t,n){return er(t,t,yo(),$o(n))},Ar=function(t,n){return er(t,t,yo(),tr(n))},Dr=function(t,n){return er(t,t,yo(),Jo(n))},_r=function(t){return er(t,t,xo(),Zo())},Mr=function(t,n){return er(t,t,xo(),n)},Fr=function(t){return Mr(t,br)},Ir=function(t){return Mr(t,yr)},Rr=function(t){return Mr(t,wr)},Vr=function(t,n){return Mr(t,$o(n))},Nr=function(t,n){return er(t,t,bo(n),Zo())},Hr=function(t,n,e){return er(t,t,bo(n),e)},Pr=function(t,n){return Hr(t,n,br)},zr=function(t,n){return Hr(t,n,yr)},Lr=function(t,n,e){return Hr(t,n,Sr(e))},jr=function(t,n){return Hr(t,n,xr)},Ur=function(t,n){return Hr(t,n,wr)},Wr=function(t,n,e){return Hr(t,n,$o(e))},Gr=function(t,n){return nr(t,n)},Xr=function(t,n){return we(t.element(),n.event().target())},Yr=function(t){if(!Mt(t,"can")&&!Mt(t,"abort")&&!Mt(t,"run"))throw new Error("EventHandler defined by: "+Lo(t,null,2)+" does not have can, abort, or run!");return mr("Extracting event.handler",Ko([Nr("can",nt(!0)),Nr("abort",nt(!1)),Nr("run",tt)]),t)},qr=function(e){var n,o,r,i,t=(n=e,o=function(t){return t.can},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R(n,function(t,n){return t&&o(n).apply(undefined,e)},!0)}),u=(r=e,i=function(t){return t.abort},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return Yr({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];j(e,function(t){t.run.apply(undefined,n)})}})},Kr=function(t,n){Zr(t,t.element(),n,{})},$r=function(t,n,e){Zr(t,t.element(),n,e)},Jr=function(t){Kr(t,Rn())},Qr=function(t,n,e){Zr(t,n,e,{})},Zr=function(t,n,e,o){var r=mo({target:n},o);t.getSystem().triggerEvent(e,n,at(r,nt))},ti=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())};function ni(t,n,e,o,r){return t(e,o)?et.some(e):b(r)&&r(e)?et.none():n(e,o,r)}var ei,oi=function(t){var n=je(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},ri=en(function(){return ii(ne.fromDom(H.document))}),ii=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return ne.fromDom(n)},ui=function(t,n,e){for(var o=t.dom(),r=b(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=ne.fromDom(o);if(n(i))return et.some(i);if(r(i))break}return et.none()},ai=function(t,n,e){return ni(function(t){return n(t)},ui,t,n,e)},ci=function(t,o){var r=function(t){for(var n=0;n<t.childNodes.length;n++){if(o(ne.fromDom(t.childNodes[n])))return et.some(ne.fromDom(t.childNodes[n]));var e=r(t.childNodes[n]);if(e.isSome())return e}return et.none()};return r(t.dom())},si=function(t,n,e){return ai(t,function(t){return n(t).isSome()},e).bind(n)},fi=function(t){return Dt(t)},li=function(t,n){return{key:t,value:Yr({abort:n})}},di=function(t,n){return{key:t,value:Yr({can:n})}},mi=function(t){return{key:t,value:Yr({run:function(t,n){n.event().prevent()}})}},gi=function(t,n){return{key:t,value:Yr({run:n})}},pi=function(t,n,e){return{key:t,value:Yr({run:function(t){n.apply(undefined,[t].concat(e))}})}},hi=function(t){return function(e){return{key:t,value:Yr({run:function(t,n){Xr(t,n)&&e(t,n)}})}}},vi=function(e,o){return gi(e,function(t,n){t.getSystem().getByUid(o).each(function(t){ti(t,t.element(),e,n)})})},bi=function(t,n,e){var o=n.partUids[e];return vi(t,o)},yi=function(t,r){return gi(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return si(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},nt(!1)).getOr(n)},function(t){return t});r(n,o,t)})},xi=function(t){return gi(t,function(t,n){n.cut()})},wi=function(t){return gi(t,function(t,n){n.stop()})},Si=function(t,n){return hi(t)(n)},ki=hi(Gn()),Ci=hi(Xn()),Oi=hi(jn()),Ti=(ei=Rn(),function(t){return gi(ei,t)}),Ei=fi([di(_n(),function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(we(e=r,t.element())&&!we(e,o))||(H.console.warn(_n()+" did not get interpreted by the desired target. \nOriginator: "+Ze(r)+"\nTarget: "+Ze(i)+"\nCheck the "+_n()+" event handlers"),!1)})]),Bi=/* */Object.freeze({events:Ei}),Ai=nt("alloy-id-"),Di=nt("data-alloy-id"),_i=Ai(),Mi=Di(),Fi=function(t,n){Object.defineProperty(t.dom(),Mi,{value:n,writable:!0})},Ii=function(t){var n=Le(t)?t.dom()[Mi]:null;return et.from(n)},Ri=function(t){return fo(t)},Vi=d,Ni=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+Ze(n().element())+" is not in context.")}};return{debugInfo:nt("fake"),triggerEvent:t("triggerEvent"),triggerFocus:t("triggerFocus"),triggerEscape:t("triggerEscape"),build:t("build"),addToWorld:t("addToWorld"),removeFromWorld:t("removeFromWorld"),addToGui:t("addToGui"),removeFromGui:t("removeFromGui"),getByUid:t("getByUid"),getByDom:t("getByDom"),broadcast:t("broadcast"),broadcastOn:t("broadcastOn"),broadcastEvent:t("broadcastEvent"),isConnected:nt(!1)}},Hi=Ni(),Pi=function(t){return D(t,function(t){return o=n="/*",r=(e=t).length-n.length,""!==o&&(e.length<o.length||e.substr(r,r+o.length)!==o)?t:t.substring(0,t.length-"/*".length);var n,e,o,r})},zi=function(t,n){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return t.toFunctionAnnotation=function(){return{name:n,parameters:Pi(i)}},t},Li=fo("alloy-premade"),ji=function(t){return At(Li,t)},Ui=function(t){return Bt(t,Li)},Wi=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(undefined,[t.getApis()].concat([t].concat(n)))},n=o.toString(),e=n.indexOf(")")+1,r=n.indexOf("("),i=n.substring(r+1,e-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:Pi(i.slice(1))}},t;var t,n,e,r,i},Gi={init:function(){return Xi({readState:function(){return"No State required"}})}},Xi=function(t){return t},Yi=function(t,r){var i={};return ut(t,function(t,o){ut(t,function(t,n){var e=Et(n,[])(i);i[n]=e.concat([r(o,t)])})}),i},qi=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},Ki=function(t,n){return e=g.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:nt(o)};var e,o},$i=function(t){return t.cHandler},Ji=function(t,n){return{name:nt(t),handler:nt(n)}},Qi=function(t,n,e){var o,r,i=mo({},e,(o=t,r={},j(n,function(t){r[t.name()]=t.handlers(o)}),r));return Yi(i,Ji)},Zi=function(t){var n,i=b(n=t)?{can:nt(!0),abort:nt(!1),run:n}:n;return function(t,n){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=[t,n].concat(e);i.abort.apply(undefined,r)?n.stop():i.can.apply(undefined,r)&&i.run.apply(undefined,r)}},tu=function(t,n,e){var o,r,i=n[e];return i?function(u,a,t,c){var n=t.slice(0);try{var e=n.sort(function(t,n){var e=t[a](),o=n[a](),r=c.indexOf(e),i=c.indexOf(o);if(-1===r)throw new Error("The ordering for "+u+" does not have an entry for "+e+".\nOrder specified: "+Lo(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+Lo(c,null,2));return r<i?-1:i<r?1:0});return yt.value(e)}catch(o){return yt.error([o])}}("Event: "+e,"name",t,i).map(function(t){var n=D(t,function(t){return t.handler()});return qr(n)}):(o=e,r=t,yt.error(["The event ("+o+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+Lo(D(r,function(t){return t.name()}),null,2)]))},nu=function(t,i){var n=st(t,function(o,r){return(1===o.length?yt.value(o[0].handler()):tu(o,i,r)).map(function(t){var n=Zi(t),e=1<o.length?F(i,function(n){return T(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return At(r,{handler:n,purpose:nt(e)})})});return _t(n,{})},eu=function(t){return lr("custom.definition",$o([er("dom","dom",yo(),$o([kr("tag"),Nr("styles",{}),Nr("classes",[]),Nr("attributes",{}),_r("value"),_r("innerHtml")])),kr("components"),kr("uid"),Nr("events",{}),Nr("apis",{}),er("eventOrder","eventOrder",(n={"alloy.execute":["disabling","alloy.base.behaviour","toggling","typeaheadevents"],"alloy.focus":["alloy.base.behaviour","focusing","keying"],"alloy.system.init":["alloy.base.behaviour","disabling","toggling","representing"],input:["alloy.base.behaviour","representing","streaming","invalidating"],"alloy.system.detached":["alloy.base.behaviour","representing","item-events","tooltipping"],mousedown:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"]},vo.mergeWithThunk(nt(n))),hr()),_r("domModification")]),t);var n};var ou=function(t,n){var e=qe(t,n);return e===undefined||""===e?[]:e.split(" ")},ru=function(t){return t.dom().classList!==undefined},iu=function(t){return ou(t,"class")},uu=function(t,n){return r=n,i=ou(e=t,o="class").concat([r]),Xe(e,o,i.join(" ")),!0;var e,o,r,i},au=function(t,n){return r=n,0<(i=F(ou(e=t,o="class"),function(t){return t!==r})).length?Xe(e,o,i.join(" ")):$e(e,o),!1;var e,o,r,i},cu=function(t,n){ru(t)?t.dom().classList.add(n):uu(t,n)},su=function(t,n){var e;ru(t)?t.dom().classList.remove(n):au(t,n);0===(ru(e=t)?e.dom().classList:iu(e)).length&&$e(e,"class")},fu=function(t,n){return ru(t)&&t.dom().classList.contains(n)},lu=function(n,t){j(t,function(t){cu(n,t)})},du=function(n,t){j(t,function(t){su(n,t)})},mu=function(t){return t.style!==undefined},gu=function(t,n,e){if(!P(e))throw H.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);mu(t)&&t.style.setProperty(n,e)},pu=function(t,n){mu(t)&&t.style.removeProperty(n)},hu=function(t,n,e){var o=t.dom();gu(o,n,e)},vu=function(t,n){var e=t.dom();ut(n,function(t,n){gu(e,n,t)})},bu=function(t,n){var e=t.dom();ut(n,function(t,n){t.fold(function(){pu(e,n)},function(t){gu(e,n,t)})})},yu=function(t,n){var e=t.dom(),o=H.window.getComputedStyle(e).getPropertyValue(n),r=""!==o||oi(t)?o:xu(e,n);return null===r?undefined:r},xu=function(t,n){return mu(t)?t.style.getPropertyValue(n):""},wu=function(t,n){var e=t.dom(),o=xu(e,n);return et.from(o).filter(function(t){return 0<t.length})},Su=function(t,n,e){var o=ne.fromTag(t);return hu(o,n,e),wu(o,n).isSome()},ku=function(t,n){var e=t.dom();pu(e,n),Ke(t,"style")&&""===qe(t,"style").replace(/^\s+|\s+$/g,"")&&$e(t,"style")},Cu=function(t){return t.dom().offsetWidth},Ou=function(t){return t.dom().value},Tu=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},Eu=function(t,n){return e=t,r=D(o=n,function(t){return Vr(t.name(),[kr("config"),Nr("state",Gi)])}),i=lr("component.behaviours",$o(r),e.behaviours).fold(function(t){throw new Error(gr(t)+"\nComplete spec:\n"+Lo(e,null,2))},function(t){return t}),{list:o,data:at(i,function(t){var n=t.map(function(t){return{config:t.config,state:t.state.init(t.config)}});return function(){return n}})};var e,o,r,i},Bu=function(t){var n,e,o,r=(n=t,e=Et("behaviours",{})(n),o=F(rt(e),function(t){return e[t]!==undefined}),D(o,function(t){return e[t].me}));return Eu(t,r)},Au=function(t,n,e){var o,r,i,u=mo({},(o=t).dom,{uid:o.uid,domChildren:D(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return qi({})},qi),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=mo({},t);j(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=Yi(r,function(t,n){return{name:t,modification:n}}),u=function(t){return I(t,function(t,n){return mo({},n.modification,t)},{})},a=I(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return qi({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,mo({},r=u,{attributes:mo({},r.attributes,i.attributes),styles:mo({},r.styles,i.styles),classes:r.classes.concat(i.classes)})},Du=function(t,n,e){var o,r,i,u,a,c,s={"alloy.base.behaviour":(o=t,o.events)};return(r=e,i=t.eventOrder,u=n,a=s,c=Qi(r,u,a),nu(c,i)).getOrDie()},_u=function(e){var t=function(){return f},o=Ft(Hi),n=dr(eu(e)),r=Bu(e),i=r.list,u=r.data,a=function(t){var n=ne.fromTag(t.tag);Ye(n,t.attributes),lu(n,t.classes),vu(n,t.styles),t.innerHtml.each(function(t){return Ne(n,t)});var e=t.domChildren;return Me(n,e),t.value.each(function(t){Tu(n,t)}),t.uid,Fi(n,t.uid),n}(Au(n,i,u)),c=Du(n,i,u),s=Ft(n.components),f={getSystem:o.get,config:function(t){var n=u;return(b(n[t.name()])?n[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+Lo(e,null,2))})()},hasConfigured:function(t){return b(u[t.name()])},spec:nt(e),readState:function(t){return u[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return n.apis},connect:function(t){o.set(t)},disconnect:function(){o.set(Ni(t))},element:nt(a),syncComponents:function(){var t=Te(a),n=X(t,function(t){return o.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});s.set(n)},components:s.get,events:nt(c)};return f},Mu=function(t){var n,e,o=Vi(t),r=o.events,i=go(o,["events"]),u=(n=i,e=Et("components",[])(n),D(e,Vu)),a=mo({},i,{events:mo({},Bi,r),components:u});return yt.value(_u(a))},Fu=function(t){var n=ne.fromText(t);return Iu({element:n})},Iu=function(t){var n=mr("external.component",Ko([kr("element"),_r("uid")]),t),e=Ft(Ni());n.uid.each(function(t){Fi(n.element,t)});var o={getSystem:e.get,config:et.none,hasConfigured:nt(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(Ni(function(){return o}))},getApis:function(){return{}},element:nt(n.element),spec:nt(t),readState:nt("No state"),syncComponents:tt,components:nt([]),events:nt({})};return ji(o)},Ru=Ri,Vu=function(n){return Ui(n).fold(function(){var t=n.hasOwnProperty("uid")?n:mo({uid:Ru("")},n);return Mu(t).getOrDie()},function(t){return t})},Nu=ji,Hu=function(t,n,e){return ai(t,n,e).isSome()},Pu=function(t,n,e){return ui(t,function(t){return ve(t,n)},e)},zu=function(t,n){return xe(n,t)},Lu=function(t,n,e){return ni(ve,Pu,t,n,e)},ju=function(){var n=fo("aria-owns");return{id:nt(n),link:function(t){Xe(t,"aria-owns",n)},unlink:function(t){$e(t,"aria-owns")}}},Uu=function(n,t){return(e=t,ai(e,function(t){if(!Le(t))return!1;var n=qe(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=qe(t,"id"),e=Se(t);return zu(e,'[aria-owns="'+n+'"]')})).exists(function(t){return Wu(n,t)});var e},Wu=function(n,t){return Hu(t,function(t){return we(t,n.element())},nt(!1))||Uu(n,t)},Gu=nt([kr("menu"),kr("selectedMenu")]),Xu=nt([kr("item"),kr("selectedItem")]),Yu=(nt($o(Xu().concat(Gu()))),nt($o(Xu()))),qu=Br("initSize",[kr("numColumns"),kr("numRows")]),Ku=function(){return Br("markers",[kr("backgroundMenu")].concat(Gu()).concat(Xu()))},$u=function(t){return Br("markers",D(t,kr))},Ju=function(t,n,e){!function(){var t=new Error;if(t.stack===undefined)return;var n=t.stack.split("\n");V(n,function(n){return 0<n.indexOf("alloy")&&!E(ro,function(t){return-1<n.indexOf(t)})}).getOr(to)}();return er(n,n,e,cr(function(e){return yt.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},Qu=function(t){return Ju(0,t,bo(tt))},Zu=function(t){return Ju(0,t,bo(et.none))},ta=function(t){return Ju(0,t,yo())},na=function(t){return Ju(0,t,yo())},ea=function(t,n){return Gr(t,nt(n))},oa=function(t){return Gr(t,d)},ra=nt(qu),ia=function(e,o,r){return Oi(function(t,n){r(t,e,o)})},ua=function(t,n,e,o,r,i){var u,a,c=Ko(t),s=Vr(n,[(u="config",a=t,Mr(u,Ko(a)))]);return sa(c,s,n,e,o,r,i)},aa=function(r,i,u){var t,n,e,o,a,c;return t=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=[e].concat(t);return e.config({name:nt(r)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+r+". Using API: "+u)},function(t){var n=Array.prototype.slice.call(o,1);return i.apply(undefined,[e,t.config,t.state].concat(n))})},n=u,e=i.toString(),o=e.indexOf(")")+1,a=e.indexOf("("),c=e.substring(a+1,o-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:n,parameters:Pi(c.slice(0,1).concat(c.slice(3)))}},t},ca=function(t){return{key:t,value:undefined}},sa=function(e,t,o,r,n,i,u){var a=function(t){return Mt(t,o)?t[o]():et.none()},c=at(n,function(t,n){return aa(o,t,n)}),s=at(i,function(t,n){return zi(t,n)}),f=mo({},s,c,{revoke:g(ca,o),config:function(t){var n=mr(o+"-config",e,t);return{key:o,value:{config:n,me:f,configAsRaw:en(function(){return mr(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Bt(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(qi({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Et("events",function(t,n){return{}})(r)(t.config,t.state)}).getOr({})}});return f},fa=function(t){return Dt(t)},la=Ko([kr("fields"),kr("name"),Nr("active",{}),Nr("apis",{}),Nr("state",Gi),Nr("extra",{})]),da=function(t){var n=mr("Creating behaviour: "+t.name,la,t);return ua(n.fields,n.name,n.active,n.apis,n.extra,n.state)},ma=Ko([kr("branchKey"),kr("branches"),kr("name"),Nr("active",{}),Nr("apis",{}),Nr("state",Gi),Nr("extra",{})]),ga=function(t){var n,e,o,r,i,u,a,c,s=mr("Creating behaviour: "+t.name,ma,t);return n=pr(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=Vr(e,[Mr("config",a=n)]),sa(a,c,e,o,r,i,u)},pa=nt(undefined),ha=/* */Object.freeze({events:function(a){return fi([gi(In(),function(r,i){var t,n,u=a.channels,e=rt(u),o=(t=e,(n=i).universal()?t:F(t,function(t){return T(n.channels(),t)}));j(o,function(t){var n=u[t],e=n.schema,o=mr("channel["+t+"] data\nReceiver: "+Ze(r.element()),e,i.data());n.onReceive(r,o)})})])}}),va=[Cr("channels",sr(yt.value,Ko([ta("onReceive"),Nr("schema",hr())])))],ba=da({fields:va,name:"receiving",active:ha}),ya=/* */Object.freeze({exhibit:function(t,n){return qi({classes:[],styles:n.useFixed?{}:{position:"relative"}})}}),xa=function(e,o){return{left:nt(e),top:nt(o),translate:function(t,n){return xa(e+t,o+n)}}},wa=xa,Sa=function(t,n){return t!==undefined?t:n!==undefined?n:0},ka=function(t){var n,e,o=t.dom().ownerDocument,r=o.body,i=(n=ne.fromDom(o),(e=n.dom())===e.window&&n instanceof H.Window?n:We(n)?e.defaultView||e.parentWindow:null),u=o.documentElement,a=Sa(i.pageYOffset,u.scrollTop),c=Sa(i.pageXOffset,u.scrollLeft),s=Sa(u.clientTop,r.clientTop),f=Sa(u.clientLeft,r.clientLeft);return Ca(t).translate(c-f,a-s)},Ca=function(t){var n,e,o,r=t.dom(),i=r.ownerDocument,u=i.body,a=ne.fromDom(i.documentElement);return u===r?wa(u.offsetLeft,u.offsetTop):(n=t,e=a||ne.fromDom(H.document.documentElement),ui(n,g(we,e)).isSome()?(o=r.getBoundingClientRect(),wa(o.left,o.top)):wa(0,0))},Oa=(An.detect().browser.isSafari(),function(t){var n=t!==undefined?t.dom():H.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return wa(e,o)});function Ta(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=yu(t,o);return parseFloat(e)||0}return n},i=function(r,t){return R(t,function(t,n){var e=yu(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!L(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();mu(e)&&(e.style[o]=n+"px")},get:t,getOuter:t,aggregate:i,max:function(t,n,e){var o=i(t,e);return o<n?n-o:0}}}var Ea=Ta("width",function(t){return t.dom().offsetWidth}),Ba=function(t){return Ea.get(t)},Aa=function(t){return Ea.getOuter(t)},Da=Ta("height",function(t){var n=t.dom();return oi(t)?n.getBoundingClientRect().height:n.offsetHeight}),_a=function(t){return Da.get(t)},Ma=function(t){return Da.getOuter(t)},Fa=ie(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),Ia=ee("position","left","top","right","bottom"),Ra=xt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Va=Ra.southeast,Na=Ra.southwest,Ha=Ra.northeast,Pa=Ra.northwest,za=Ra.south,La=Ra.north,ja=Ra.east,Ua=Ra.west,Wa=ee("point","width","height"),Ga=ee("x","y","width","height"),Xa=function(t,n,e,o){return{x:nt(t),y:nt(n),width:nt(e),height:nt(o),right:nt(t+e),bottom:nt(n+o)}},Ya=function(t){var n=ka(t),e=Aa(t),o=Ma(t);return Xa(n.left(),n.top(),e,o)},qa=function(o,t){return o.view(t).fold(nt([]),function(t){var n=o.owner(t),e=qa(o,n);return[t].concat(e)})},Ka=/* */Object.freeze({view:function(t){return(t.dom()===H.document?et.none():et.from(t.dom().defaultView.frameElement)).map(ne.fromDom)},owner:function(t){return Se(t)}}),$a=function(o){var t,n,e,r,i=ne.fromDom(H.document),u=Oa(i);return(t=o,e=(n=Ka).owner(t),r=qa(n,e),et.some(r)).fold(g(ka,o),function(t){var n=Ca(o),e=I(t,function(t,n){var e=Ca(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return wa(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},Ja=function(){var t=H.window.innerWidth,n=H.window.innerHeight,e=ne.fromDom(H.document),o=Oa(e);return Xa(o.left(),o.top(),t,n)},Qa=xt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Za=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g,p=n.x()-e,h=n.y()-o,v=r-(p+n.width()),b=i-(h+n.height()),y=et.some(p),x=et.some(h),w=et.some(v),S=et.some(b),k=et.none();return u=n.direction(),a=function(){return Ia(t,y,x,k,k)},c=function(){return Ia(t,k,x,w,k)},s=function(){return Ia(t,y,k,k,S)},f=function(){return Ia(t,k,k,w,S)},l=function(){return Ia(t,y,x,k,k)},d=function(){return Ia(t,y,k,k,S)},m=function(){return Ia(t,y,x,k,k)},g=function(){return Ia(t,k,x,w,k)},u.fold(a,c,s,f,l,d,m,g)},tc=function(t,n){var e=g($a,n),o=t.fold(e,e,function(){var t=Oa();return $a(n).translate(-t.left(),-t.top())}),r=Aa(n),i=Ma(n);return Xa(o.left(),o.top(),r,i)},nc=Qa.relative,ec=Qa.fixed,oc=ee("anchorBox","origin"),rc=xt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),ic=function(t,N,H,P,z){var L=H.width(),j=H.height(),o=function(t,o,r,i){var n,e,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w,S,k,C,O,T,E,B,A,D,_,M,F,I,R,V=t(N,H,P);return(e=L,u=j,a=z,d=(n=V).x(),m=n.y(),g=n.bubble().offset().left(),p=n.bubble().offset().top(),h=a.x(),v=a.y(),b=a.width(),y=a.height(),k=v<=(w=m+p),C=(S=h<=(x=d+g))&&k,O=x+e<=h+b&&w+u<=v+y,T=S?Math.min(e,h+b-x):Math.abs(h-(x+e)),E=k?Math.min(u,v+y-w):Math.abs(v-(w+u)),B=a.x()+a.width(),A=Math.max(a.x(),x),D=Math.min(A,B),M=nt((_=k?w:w+(u-E))+E-v),F=nt(v+y-_),c=n.direction(),f=s=F,l=M,I=c.fold(s,s,l,l,s,l,f,f),R=Fa({x:D,y:_,width:T,height:E,maxHeight:I,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:w}),C&&O?rc.fit(R):rc.nofit(R,T,E)).fold(rc.fit,function(t,n,e){return i<e||r<n?rc.nofit(t,n,e):rc.nofit(o,r,i)})};return R(t,function(t,n){var e=g(o,n);return t.fold(rc.fit,e)},rc.nofit(Fa({x:N.x(),y:N.y(),width:H.width(),height:H.height(),maxHeight:H.height(),direction:Va(),classes:[],label:"none",candidateYforTest:N.y()}),-1,-1)).fold(d,d)},uc=function(t,n,e,o){ku(n,"max-height");var r,i={width:nt(Aa(r=n)),height:nt(Ma(r))};return ic(o.preference(),t,i,e,o.bounds())},ac=function(t,n,e){var o,r,i=function(t){return t+"px"},u=(o=e.origin(),r=n,o.fold(function(){return Ia("absolute",et.some(r.x()),et.some(r.y()),et.none(),et.none())},function(t,n,e,o){return Za("absolute",r,t,n,e,o)},function(t,n,e,o){return Za("fixed",r,t,n,e,o)}));bu(t,{position:et.some(u.position()),left:u.left().map(i),top:u.top().map(i),right:u.right().map(i),bottom:u.bottom().map(i)})},cc=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=Da.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),hu(e,"max-height",r+"px")},sc=nt(function(t,n){cc(t,n),vu(t,{"overflow-x":"hidden","overflow-y":"auto"})}),fc=nt(function(t,n){cc(t,n)}),lc=ie(["bounds","origin","preference","maxHeightFunction"],[]),dc=function(t,n,e,o,r,i){var u,a,c,s,f,l=(u=i,a="maxHeightFunction",c=sc(),u[a]===undefined?c:u[a]),d=t.anchorBox(),m=t.origin(),g=lc({bounds:(s=m,f=r,f.fold(function(){return s.fold(Ja,Ja,Xa)},function(t){return s.fold(t,t,Xa)})),origin:m,preference:o,maxHeightFunction:l});mc(d,n,e,g)},mc=function(t,n,e,o){var r,i,u,a,c=uc(t,n,e,o);ac(n,c,o),r=n,i=c.classes(),du(r,i.off),lu(r,i.on),u=n,a=c,o.maxHeightFunction()(u,a.maxHeight())},gc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],pc=function(t,n,e){var r=function(t){return Bt(e,t).getOr([])},o=function(t,n,e){var o=K(gc,e);return{offset:function(){return wa(t,n)},classesOn:function(){return X(e,r)},classesOff:function(){return X(o,r)}}};return{southeast:function(){return o(-t,n,["top","alignLeft"])},southwest:function(){return o(t,n,["top","alignRight"])},south:function(){return o(-t/2,n,["top","alignCentre"])},northeast:function(){return o(-t,-n,["bottom","alignLeft"])},northwest:function(){return o(t,-n,["bottom","alignRight"])},north:function(){return o(-t/2,-n,["bottom","alignCentre"])},east:function(){return o(t,-n/2,["valignCentre","left"])},west:function(){return o(-t,-n/2,["valignCentre","right"])}}},hc=function(){return pc(0,0,{})},vc=ee("x","y","bubble","direction","label"),bc=function(t){return t.x()},yc=function(t,n){return t.x()+t.width()/2-n.width()/2},xc=function(t,n){return t.x()+t.width()-n.width()},wc=function(t,n){return t.y()-n.height()},Sc=function(t){return t.y()+t.height()},kc=function(t,n){return t.y()+t.height()/2-n.height()/2},Cc=function(t,n,e){return vc(bc(t),Sc(t),e.southeast(),Va(),"layout-se")},Oc=function(t,n,e){return vc(xc(t,n),Sc(t),e.southwest(),Na(),"layout-sw")},Tc=function(t,n,e){return vc(bc(t),wc(t,n),e.northeast(),Ha(),"layout-ne")},Ec=function(t,n,e){return vc(xc(t,n),wc(t,n),e.northwest(),Pa(),"layout-nw")},Bc=function(t,n,e){return vc(yc(t,n),wc(t,n),e.north(),La(),"layout-n")},Ac=function(t,n,e){return vc(yc(t,n),Sc(t),e.south(),za(),"layout-s")},Dc=function(t,n,e){return vc((o=t).x()+o.width(),kc(t,n),e.east(),ja(),"layout-e");var o},_c=function(t,n,e){return vc((o=n,t.x()-o.width()),kc(t,n),e.west(),Ua(),"layout-w");var o},Mc=function(){return[Cc,Oc,Tc,Ec,Ac,Bc,Dc,_c]},Fc=function(){return[Oc,Cc,Ec,Tc,Ac,Bc,Dc,_c]},Ic=function(t){return t},Rc=function(n,e){return function(t){return"rtl"===Vc(t)?e:n}},Vc=function(t){return"rtl"===yu(t,"direction")?"rtl":"ltr"},Nc=function(){return Vr("layouts",[kr("onLtr"),kr("onRtl")])},Hc=function(n,t,e,o){var r=t.layouts.map(function(t){return t.onLtr(n)}).getOr(e),i=t.layouts.map(function(t){return t.onRtl(n)}).getOr(o);return Rc(r,i)(n)},Pc=[kr("hotspot"),_r("bubble"),Nr("overrides",{}),Nc(),ea("placement",function(t,n,e){var o=n.hotspot,r=tc(e,o.element()),i=Hc(t.element(),n,Mc(),Fc());return et.some(Ic({anchorBox:r,bubble:n.bubble.getOr(hc()),overrides:n.overrides,layouts:i,placer:et.none()}))})],zc=[kr("x"),kr("y"),Nr("height",0),Nr("width",0),Nr("bubble",hc()),Nr("overrides",{}),Nc(),ea("placement",function(t,n,e){var o=Xa(n.x,n.y,n.width,n.height),r=Hc(t.element(),n,Mc(),Fc());return et.some(Ic({anchorBox:o,bubble:n.bubble,overrides:n.overrides,layouts:r,placer:et.none()}))})],Lc={create:ee("start","soffset","finish","foffset")},jc=xt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Uc=(jc.before,jc.on,jc.after,function(t){return t.fold(d,d,d)}),Wc=xt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Gc={domRange:Wc.domRange,relative:Wc.relative,exact:Wc.exact,exactFromRange:function(t){return Wc.exact(t.start(),t.soffset(),t.finish(),t.foffset())},getWin:function(t){var n=t.match({domRange:function(t){return ne.fromDom(t.startContainer)},relative:function(t,n){return Uc(t)},exact:function(t,n,e,o){return t}});return ke(n)},range:Lc.create},Xc=function(t,n,e){var o,r,i=t.document.createRange();return o=i,n.fold(function(t){o.setStartBefore(t.dom())},function(t,n){o.setStart(t.dom(),n)},function(t){o.setStartAfter(t.dom())}),r=i,e.fold(function(t){r.setEndBefore(t.dom())},function(t,n){r.setEnd(t.dom(),n)},function(t){r.setEndAfter(t.dom())}),i},Yc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},qc=function(t){return{left:nt(t.left),top:nt(t.top),right:nt(t.right),bottom:nt(t.bottom),width:nt(t.width),height:nt(t.height)}},Kc=xt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),$c=function(t,n,e){return n(ne.fromDom(e.startContainer),e.startOffset,ne.fromDom(e.endContainer),e.endOffset)},Jc=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:nt(t),rtl:et.none}},relative:function(t,n){return{ltr:en(function(){return Xc(r,t,n)}),rtl:en(function(){return et.some(Xc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:en(function(){return Yc(r,t,n,e,o)}),rtl:en(function(){return et.some(Yc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return Kc.rtl(ne.fromDom(t.endContainer),t.endOffset,ne.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return $c(0,Kc.ltr,o)}):$c(0,Kc.ltr,o)},Qc=function(t,n,e){return n>=t.left&&n<=t.right&&e>=t.top&&e<=t.bottom};var Zc=function fM(e,o){var r=function(t){return e(t)?et.from(t.dom().nodeValue):et.none()},t=An.detect().browser,n=t.isIE()&&10===t.version.major?function(t){try{return r(t)}catch(n){return et.none()}}:r;return{get:function(t){if(!e(t))throw new Error("Can only get "+o+" value of a "+o+" node");return n(t).getOr("")},getOption:n,set:function(t,n){if(!e(t))throw new Error("Can only set raw "+o+" value of a "+o+" node");t.dom().nodeValue=n}}}(je,"text"),ts=function(t){return Zc.get(t)},ns=function(t){return Zc.getOption(t)},es=function(e,o,t,n,r){var i=function(t){var n=e.dom().createRange();return n.setStart(o.dom(),t),n.collapse(!0),n},u=ts(o).length,a=function(t,n,e,o,r){if(0===r)return 0;if(n===o)return r-1;for(var i=o,u=1;u<r;u++){var a=t(u),c=Math.abs(n-a.left);if(e<=a.bottom){if(e<a.top||i<c)return u-1;i=c}}return 0}(function(t){return i(t).getBoundingClientRect()},t,n,r.right,u);return i(a)},os=function(n,e,o,r){var t=n.dom().createRange();t.selectNode(e.dom());var i=t.getClientRects();return Rt(i,function(t){return Qc(t,o,r)?et.some(t):et.none()}).map(function(t){return es(n,e,o,r,t)})},rs=function(n,t,e,o){var r=n.dom().createRange(),i=Te(t);return Rt(i,function(t){return r.selectNode(t.dom()),Qc(r.getBoundingClientRect(),e,o)?is(n,t,e,o):et.none()})},is=function(t,n,e,o){return(je(n)?os:rs)(t,n,e,o)},us=["img","br"],as=function(t){return ns(t).filter(function(t){return 0!==t.trim().length||-1<t.indexOf("\xa0")}).isSome()||T(us,He(t))},cs=function(t){return ci(t,as)},ss=function(t){return fs(t,as)},fs=function(t,i){var u=function(t){for(var n=Te(t),e=n.length-1;0<=e;e--){var o=n[e];if(i(o))return et.some(o);var r=u(o);if(r.isSome())return r}return et.none()};return u(t)},ls=function(t,n){return n-t.left<t.right-n},ds=function(t,n,e){var o=t.dom().createRange();return o.selectNode(n.dom()),o.collapse(e),o},ms=function(n,t,e){var o=n.dom().createRange();o.selectNode(t.dom());var r=o.getBoundingClientRect(),i=ls(r,e);return(!0===i?cs:ss)(t).map(function(t){return ds(n,t,i)})},gs=function(t,n,e){var o=n.dom().getBoundingClientRect(),r=ls(o,e);return et.some(ds(t,n,r))},ps=function(t,n,e,o){var r=t.dom().createRange();r.selectNode(n.dom());var i=r.getBoundingClientRect();return function(t,n,e,o){var r=t.dom().createRange();r.selectNode(n.dom());var i=r.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,e)),a=Math.max(i.top,Math.min(i.bottom,o));return is(t,n,u,a)}(t,n,Math.max(i.left,Math.min(i.right,e)),Math.max(i.top,Math.min(i.bottom,o)))},hs=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(t,n){return ye(n,t)}),vs=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=Se(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),f=we(t,e)&&n===o;return s.collapsed&&!f},bs=function(t){var n=ne.fromDom(t.anchorNode),e=ne.fromDom(t.focusNode);return vs(n,t.anchorOffset,e,t.focusOffset)?et.some(Lc.create(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return et.some(Lc.create(ne.fromDom(n.startContainer),n.startOffset,ne.fromDom(e.endContainer),e.endOffset))}return et.none()}(t)},ys=function(t,n){var i,e,o,r,u=Jc(i=t,n).match({ltr:function(t,n,e,o){var r=i.document.createRange();return r.setStart(t.dom(),n),r.setEnd(e.dom(),o),r},rtl:function(t,n,e,o){var r=i.document.createRange();return r.setStart(e.dom(),o),r.setEnd(t.dom(),n),r}});return o=(e=u).getClientRects(),0<(r=0<o.length?o[0]:e.getBoundingClientRect()).width||0<r.height?et.some(r).map(qc):et.none()},xs=ee("element","offset"),ws=xt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Ss=function(t){return t.fold(function(t){return t},function(t,n,e){return t.translate(-n,-e)})},ks=function(t){return t.fold(function(t){return t},function(t,n,e){return t})},Cs=function(t){return R(t,function(t,n){return t.translate(n.left(),n.top())},wa(0,0))},Os=function(t){var n=D(t,ks);return Cs(n)},Ts=ws.screen,Es=ws.absolute,Bs=function(t,n,e){var o,r,i,u=Se(t.element()),a=Oa(u),c=(o=t,r=e,i=ke(r.root).dom(),et.from(i.frameElement).map(ne.fromDom).filter(function(t){var n=Se(t),e=Se(o.element());return we(n,e)}).map(ka)).getOr(a);return Es(c,a.left(),a.top())},As=function(t,n,e,o){var r=t,i=n,u=e,a=o;t<0&&(r=0,u=e+t),n<0&&(i=0,a=o+n);var c=Ts(wa(r,i));return et.some(Wa(c,u,a))},Ds=function(t,c,s,f,l){return t.map(function(t){var n,e,o,r=[c,t.point()],i=(n=function(){return Os(r)},e=function(){return Os(r)},o=function(){return t=D(r,Ss),Cs(t);var t},f.fold(n,e,o)),u=Ga(i.left(),i.top(),t.width(),t.height()),a=Hc(l,s,s.showAbove?[Tc,Ec,Cc,Oc,Bc,Ac]:[Cc,Oc,Tc,Ec,Ac,Ac],s.showAbove?[Ec,Tc,Oc,Cc,Bc,Ac]:[Oc,Cc,Ec,Tc,Ac,Bc]);return Ic({anchorBox:u,bubble:s.bubble.getOr(hc()),overrides:s.overrides,layouts:a,placer:et.none()})})},_s=ee("element","offset"),Ms=function(t,n){return je(t)?_s(t,n):function(t,n){var e=Te(t);if(0===e.length)return xs(t,n);if(n<e.length)return xs(e[n],0);var o=e[e.length-1],r=je(o)?ts(o).length:Te(o).length;return xs(o,r)}(t,n)},Fs=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,et.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(bs);var t}})().map(function(t){var n=Ms(t.start(),t.soffset()),e=Ms(t.finish(),t.foffset());return Gc.range(n.element(),n.offset(),e.element(),e.offset())})},Is=[_r("getSelection"),kr("root"),_r("bubble"),Nc(),Nr("overrides",{}),Nr("showAbove",!1),ea("placement",function(t,n,e){var o=ke(n.root).dom(),r=Bs(t,0,n),i=Fs(o,n).bind(function(t){return ys(o,Gc.exactFromRange(t)).orThunk(function(){var n=ne.fromText("\ufeff");return Be(t.start(),n),ys(o,Gc.exact(n,0,n,1)).map(function(t){return Ie(n),t})}).bind(function(t){return As(t.left(),t.top(),t.width(),t.height())})}),u=Fs(o,n).bind(function(t){return Le(t.start())?et.some(t.start()):Ce(t.start())}).getOr(t.element());return Ds(i,r,n,e,u)})],Rs=[kr("node"),kr("root"),_r("bubble"),Nc(),Nr("overrides",{}),Nr("showAbove",!1),ea("placement",function(r,i,u){var a=Bs(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=As(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return Ds(e,a,i,u,o)})})],Vs=function(t){return t.x()+t.width()},Ns=function(t,n){return t.x()-n.width()},Hs=function(t,n){return t.y()-n.height()+t.height()},Ps=function(t){return t.y()},zs=function(t,n,e){return vc(Vs(t),Ps(t),e.southeast(),Va(),"link-layout-se")},Ls=function(t,n,e){return vc(Ns(t,n),Ps(t),e.southwest(),Na(),"link-layout-sw")},js=function(t,n,e){return vc(Vs(t),Hs(t,n),e.northeast(),Ha(),"link-layout-ne")},Us=function(t,n,e){return vc(Ns(t,n),Hs(t,n),e.northwest(),Pa(),"link-layout-nw")},Ws=[kr("item"),Nc(),Nr("overrides",{}),ea("placement",function(t,n,e){var o=tc(e,n.item.element()),r=Hc(t.element(),n,[zs,Ls,js,Us],[Ls,zs,Us,js]);return et.some(Ic({anchorBox:o,bubble:hc(),overrides:n.overrides,layouts:r,placer:et.none()}))})],Gs=pr("anchor",{selection:Is,node:Rs,hotspot:Pc,submenu:Ws,makeshift:zc}),Xs=function(t,n,e,o,r){var i,u=(i=e.anchorBox,oc(i,n));dc(u,r.element(),e.bubble,e.layouts,o,e.overrides)},Ys=function(n,t,e,o,r,i){var u=mr("positioning anchor.info",Gs,o);hu(r.element(),"position","fixed");var a=wu(r.element(),"visibility");hu(r.element(),"visibility","hidden");var c,s,f,l=t.useFixed?ec(0,0,H.window.innerWidth,H.window.innerHeight):(s=ka((c=n).element()),f=c.element().dom().getBoundingClientRect(),nc(s.left(),s.top(),f.width,f.height)),d=u.placement,m=i.map(function(t){return function(){return Ya(t)}}).or(t.getBounds);d(n,u,l).each(function(t){t.placer.getOr(Xs)(n,l,t,m,r)}),a.fold(function(){ku(r.element(),"visibility")},function(t){hu(r.element(),"visibility",t)}),wu(r.element(),"left").isNone()&&wu(r.element(),"top").isNone()&&wu(r.element(),"right").isNone()&&wu(r.element(),"bottom").isNone()&&wu(r.element(),"position").is("fixed")&&ku(r.element(),"position")},qs=/* */Object.freeze({position:function(t,n,e,o,r){var i=et.none();Ys(t,n,e,o,r,i)},positionWithin:Ys,getMode:function(t,n,e){return n.useFixed?"fixed":"absolute"}}),Ks=[Nr("useFixed",!1),_r("getBounds")],$s=da({fields:Ks,name:"positioning",active:ya,apis:qs}),Js=function(t){Kr(t,Xn());var n=t.components();j(n,Js)},Qs=function(t){var n=t.components();j(n,Qs),Kr(t,Gn())},Zs=function(t,n){tf(t,n,_e)},tf=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),oi(t.element())&&Qs(n),t.syncComponents()},nf=function(t){Js(t),Ie(t.element()),t.getSystem().removeFromWorld(t)},ef=function(n){var t=Ce(n.element()).bind(function(t){return n.getSystem().getByDom(t).fold(et.none,et.some)});nf(n),t.each(function(t){t.syncComponents()})},of=function(t){var n=t.components();j(n,nf),Fe(t.element()),t.syncComponents()},rf=function(t,n){uf(t,n,_e)},uf=function(t,n,e){e(t,n.element());var o=Te(n.element());j(o,function(t){n.getByDom(t).each(Qs)})},af=function(n){var t=Te(n.element());j(t,function(t){n.getByDom(t).each(Js)}),Ie(n.element())},sf=function(t,n,e,o){var r=function(n,t,e,o){e.get().each(function(t){of(n)});var r=t.getAttachPoint(n);Zs(r,n);var i=n.getSystem().build(o);return Zs(n,i),e.set(i),i}(t,n,e,o);return n.onOpen(t,r),r},lf=function(n,e,o){o.get().each(function(t){of(n),ef(n),e.onClose(n,t),o.clear()})},mf=function(t,n,e){return e.isOpen()},gf=function(t,n,e){var o,r,i,u,a=n.getAttachPoint(t);hu(t.element(),"position",$s.getMode(a)),o=t,r="visibility",i=n.cloakVisibilityAttr,u="hidden",wu(o.element(),r).fold(function(){$e(o.element(),i)},function(t){Xe(o.element(),i,t)}),hu(o.element(),r,u)},pf=function(t,n,e){var o;o=t.element(),E(["top","left","right","bottom"],function(t){return wu(o,t).isSome()})||ku(t.element(),"position"),function(t,n,e){if(Ke(t.element(),e)){var o=qe(t.element(),e);hu(t.element(),n,o)}else ku(t.element(),n)}(t,"visibility",n.cloakVisibilityAttr)},hf=/* */Object.freeze({cloak:gf,decloak:pf,open:sf,openWhileCloaked:function(t,n,e,o,r){gf(t,n,e),sf(t,n,e,o),r(),pf(t,n,e)},close:lf,isOpen:mf,isPartOf:function(n,e,t,o){return mf(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()}}),vf=/* */Object.freeze({events:function(e,o){return fi([gi(zn(),function(t,n){lf(t,e,o)})])}}),bf=[Qu("onOpen"),Qu("onClose"),kr("isPartOf"),kr("getAttachPoint"),Nr("cloakVisibilityAttr","data-precloak-visibility")],yf=da({fields:bf,name:"sandboxing",active:vf,apis:hf,state:/* */Object.freeze({init:function(){var n=Ft(et.none()),t=nt("not-implemented");return Xi({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(et.none())},set:function(t){n.set(et.some(t))},get:function(t){return n.get()}})}})}),xf=nt("dismiss.popups"),wf=nt("mouse.released"),Sf=Ko([Nr("isExtraPart",nt(!1)),Vr("fireEventInstead",[Nr("event",Yn())])]),kf=function(t){var n=Cf(t);return ba.config(n)},Cf=function(t){var e=mr("Dismissal",Sf,t);return{channels:At(xf(),{schema:Ko([kr("target")]),onReceive:function(n,t){yf.isOpen(n)&&(yf.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return yf.close(n)},function(t){return Kr(n,t.event)}))}})}},Of=function(o,t){return Wr(o,{},D(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,er(n,n,xo(),qo(function(t){return Do("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([Gr("dump",d)]))},Tf=function(t){return t.dump},Ef=function(t,n){return mo({},t.dump,fa(n))},Bf={field:Of,augment:Ef,get:Tf},Af="placeholder",Df=xt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),_f=function(t,n,e,o){return e.uiType===Af?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?Df.single(!0,nt(i)):Bt(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+rt(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+Lo(i,null,2))},function(t){return t.replace()})):Df.single(!1,nt(e));var r,i,u},Mf=function(i,u,a,c){return _f(i,0,a,c).fold(function(t,n){var e=n(u,a.config,a.validated),o=Bt(e,"components").getOr([]),r=X(o,function(t){return Mf(i,u,t,c)});return[mo({},e,{components:r})]},function(t,n){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(d)(e)})},Ff=function(n,e,t,o){return X(t,function(t){return Mf(n,e,t,o)})},If=function(n,e,t,o){var r=at(o,function(t,n){return o=t,r=!1,{name:nt(e=n),required:function(){return o.fold(function(t,n){return t},function(t,n){return t})},used:function(){return r},replace:function(){if(!0===r)throw new Error("Trying to use the same placeholder more than once: "+e);return r=!0,o}};var e,o,r}),i=Ff(n,e,t,r);return ut(r,function(t){if(!1===t.used()&&t.required())throw new Error("Placeholder: "+t.name()+" was not found in components list\nNamespace: "+n.getOr("none")+"\nComponents: "+Lo(e.components,null,2))}),i},Rf=Df.single,Vf=Df.multiple,Nf=nt(Af),Hf=xt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Pf=Nr("factory",{sketch:d}),zf=Nr("schema",[]),Lf=kr("name"),jf=er("pname","pname",wo(function(t){return"<alloy."+fo(t.name)+">"}),hr()),Uf=Gr("schema",function(){return[_r("preprocess")]}),Wf=Nr("defaults",nt({})),Gf=Nr("overrides",nt({})),Xf=$o([Pf,zf,Lf,jf,Wf,Gf]),Yf=$o([Pf,zf,Lf,Wf,Gf]),qf=$o([Pf,zf,Lf,jf,Wf,Gf]),Kf=$o([Pf,Uf,Lf,kr("unit"),jf,Wf,Gf]),$f=function(t){return t.fold(et.some,et.none,et.some,et.some)},Jf=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},Qf=function(e,o){return function(t){var n=mr("Converting part type",o,t);return e(n)}},Zf=Qf(Hf.required,Xf),tl=Qf(Hf.external,Yf),nl=Qf(Hf.optional,qf),el=Qf(Hf.group,Kf),ol=nt("entirety"),rl=/* */Object.freeze({required:Zf,external:tl,optional:nl,group:el,asNamedPart:$f,name:Jf,asCommon:function(t){return t.fold(d,d,d,d)},original:ol}),il=function(t,n,e,o){return kt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},ul=function(r,t){var n={};return j(t,function(t){$f(t).each(function(e){var o=al(r,e.pname);n[e.name]=function(t){var n=mr("Part: "+e.name+" in "+r,$o(e.schema),t);return mo({},o,{config:t,validated:n})}})}),n},al=function(t,n){return{uiType:Nf(),owner:t,name:n}},cl=function(t,n,e){return{uiType:Nf(),owner:t,name:n,config:e,validated:{}}},sl=function(t){return X(t,function(t){return t.fold(et.none,et.some,et.none,et.none).map(function(t){return Br(t.name,t.schema.concat([oa(ol())]))}).toArray()})},fl=function(t){return D(t,Jf)},ll=function(t,n,e){return o=n,i={},r={},j(e,function(t){t.fold(function(o){i[o.pname]=Rf(!0,function(t,n,e){return o.factory.sketch(il(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=nt(t.factory.sketch(il(o,t,n[ol()]),n))},function(o){i[o.pname]=Rf(!1,function(t,n,e){return o.factory.sketch(il(t,o,n,e))})},function(r){i[r.pname]=Vf(!0,function(n,t,e){var o=n[r.name];return D(o,function(t){return r.factory.sketch(kt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:nt(i),externals:nt(r)};var o,i,r},dl=function(t,n,e){return If(et.some(t),n,n.components,e)},ml=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},gl=function(t,n,e){return ml(t,n,e).getOrDie("Could not find part: "+e)},pl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return j(e,function(t){o[t]=i.getByUid(r[t])}),at(o,nt)},hl=function(t,n){var e=t.getSystem();return at(n.partUids,function(t,n){return nt(e.getByUid(t))})},vl=function(t){return rt(t.partUids)},bl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return j(e,function(t){o[t]=i.getByUid(r[t]).getOrDie()}),at(o,nt)},yl=function(n,t){var e=fl(t);return Dt(D(e,function(t){return{key:t,value:n+"-"+t}}))},xl=function(n){return er("partUids","partUids",So(function(t){return yl(t.uid,n)}),hr())},wl=/* */Object.freeze({generate:ul,generateOne:cl,schemas:sl,names:fl,substitutes:ll,components:dl,defaultUids:yl,defaultUidsSchema:xl,getAllParts:hl,getAllPartNames:vl,getPart:ml,getPartOrDie:gl,getParts:pl,getPartsOrDie:bl}),Sl=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[Br("parts",i)]:[]).concat([kr("uid"),Nr("dom",{}),Nr("components",[]),oa("originalSpec"),Nr("debug.sketcher",{})]).concat(u));return mr(t+" [SpecSchema]",Ko(a.concat(n)),e)},kl=function(t,n,e,o,r){var i=Cl(r),u=sl(e),a=xl(e),c=Sl(t,n,i,u,[a]),s=ll(0,c,e);return o(c,dl(t,c,s.internals()),i,s.externals())},Cl=function(t){return t.hasOwnProperty("uid")?t:mo({},t,{uid:Ri("uid")})};function Ol(t){return t.uid!==undefined}var Tl,El,Bl=Ko([kr("name"),kr("factory"),kr("configFields"),Nr("apis",{}),Nr("extraApis",{})]),Al=Ko([kr("name"),kr("factory"),kr("configFields"),kr("partFields"),Nr("apis",{}),Nr("extraApis",{})]),Dl=function(t){var i=mr("Sketcher for "+t.name,Bl,t),n=at(i.apis,Wi),e=at(i.extraApis,function(t,n){return zi(t,n)});return mo({name:nt(i.name),partFields:nt([]),configFields:nt(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=Cl(t),o(Sl(n,e,r,[],[]),r);var n,e,o,r}},n,e)},_l=function(t){var n=mr("Sketcher for "+t.name,Al,t),e=ul(n.name,n.partFields),o=at(n.apis,Wi),r=at(n.extraApis,function(t,n){return zi(t,n)});return mo({name:nt(n.name),partFields:nt(n.partFields),configFields:nt(n.configFields),sketch:function(t){return kl(n.name,n.configFields,n.partFields,n.factory,t)},parts:nt(e)},o,r)},Ml=function(t){return"input"===He(t)&&"radio"!==qe(t,"type")||"textarea"===He(t)},Fl=/* */Object.freeze({getCurrent:function(t,n,e){return n.find(t)}}),Il=[kr("find")],Rl=da({fields:Il,name:"composing",apis:Fl}),Vl=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},Nl=function(t,n,e){return t<=n?n:e<=t?e:t},Hl=function(e,o,t,r){var n=hs(e.element(),"."+o.highlightClass);j(n,function(n){E(r,function(t){return t.element()===n})||(su(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),Kr(t,Zn())}))})},Pl=function(t,n,e,o){Hl(t,n,0,[o]),zl(t,n,e,o)||(cu(o.element(),n.highlightClass),n.onHighlight(t,o),Kr(o,Qn()))},zl=function(t,n,e,o){return fu(o.element(),n.highlightClass)},Ll=function(t,n,e,o){var r=hs(t.element(),"."+n.itemClass);return et.from(r[o]).fold(function(){return yt.error("No element found with index "+o)},t.getSystem().getByDom)},jl=function(n,t,e){return zu(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Ul=function(n,t,e){var o=hs(n.element(),"."+t.itemClass);return(0<o.length?et.some(o[o.length-1]):et.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Wl=function(e,n,t,o){var r=hs(e.element(),"."+n.itemClass);return N(r,function(t){return fu(t,n.highlightClass)}).bind(function(t){var n=Vl(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},Gl=function(n,t,e){var o=hs(n.element(),"."+t.itemClass);return It(D(o,function(t){return n.getSystem().getByDom(t).toOption()}))},Xl=/* */Object.freeze({dehighlightAll:function(t,n,e){return Hl(t,n,0,[])},dehighlight:function(t,n,e,o){zl(t,n,e,o)&&(su(o.element(),n.highlightClass),n.onDehighlight(t,o),Kr(o,Zn()))},highlight:Pl,highlightFirst:function(n,e,o){jl(n,e,o).each(function(t){Pl(n,e,o,t)})},highlightLast:function(n,e,o){Ul(n,e,o).each(function(t){Pl(n,e,o,t)})},highlightAt:function(n,e,o,t){Ll(n,e,o,t).fold(function(t){throw new Error(t)},function(t){Pl(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=Gl(n,e,o);V(r,t).each(function(t){Pl(n,e,o,t)})},isHighlighted:zl,getHighlighted:function(n,t,e){return zu(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:jl,getLast:Ul,getPrevious:function(t,n,e){return Wl(t,n,0,-1)},getNext:function(t,n,e){return Wl(t,n,0,1)},getCandidates:Gl}),Yl=[kr("highlightClass"),kr("itemClass"),Qu("onHighlight"),Qu("onDehighlight")],ql=da({fields:Yl,name:"highlighting",apis:Xl}),Kl=function(t,n,e){var o=q(t.slice(0,n)),r=q(t.slice(n+1));return V(o.concat(r),e)},$l=function(t,n,e){var o=q(t.slice(0,n));return V(o,e)},Jl=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return V(r.concat(o),e)},Ql=function(t,n,e){var o=t.slice(n+1);return V(o,e)},Zl=function(e){return function(t){var n=t.raw();return T(e,n.which)}},td=function(t){return function(n){return Y(t,function(t){return t(n)})}},nd=function(t){return!0===t.raw().shiftKey},ed=function(t){return!0===t.raw().ctrlKey},od=x(nd),rd=function(t,n){return{matches:t,classification:n}},id=function(t,n){return V(t,function(t){return t.matches(n)}).map(function(t){return t.classification})},ud=function(t){t.dom().focus()},ad=function(t){var n=t!==undefined?t.dom():H.document;return et.from(n.activeElement).map(ne.fromDom)},cd=function(n){return ad(Se(n)).filter(function(t){return n.dom().contains(t.dom())})},sd=function(t,n,e){n.exists(function(n){return e.exists(function(t){return we(t,n)})})||$r(t,qn(),{prevFocus:n,newFocus:e})},fd=function(){var r=function(t){return cd(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);sd(t,e,o)}}},ld=function(){var r=function(t){return ql.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(tt,function(t){ql.highlight(n,t)});var o=r(n);sd(n,e,o)}}};(El=Tl||(Tl={})).OnFocusMode="onFocus",El.OnEnterOrSpaceMode="onEnterOrSpace",El.OnApiMode="onApi";var dd,md=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i=t(n,e,o,r);return id(i,e.event()).bind(function(t){return t(n,e,o,r)})},r={schema:function(){return t.concat([Nr("focusManager",fd()),Hr("focusInside","onFocus",cr(function(t){return T(["onFocus","onEnterOrSpace","onApi"],t)?yt.value(t):yt.error("Invalid value for focusInside")})),ea("handler",r),ea("state",n),ea("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==Tl.OnFocusMode?et.none():a(i).map(function(e){return gi(_n(),function(t,n){e(t,i,u),n.stop()})});return fi(t.toArray().concat([gi(Kt(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=Zl([32].concat([13]))(e.event()),i.focusInside===Tl.OnEnterOrSpaceMode&&t&&Xr(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(t){r.stop()})}),gi($t(),function(t,n){c(t,n,o,i,u).each(function(t){n.stop()})})]))}};return r},gd=function(t){var n=[_r("onEscape"),_r("onEnter"),Nr("selector",'[data-alloy-tabstop="true"]'),Nr("firstTabstop",0),Nr("useTabstopAt",nt(!0)),_r("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return Lu(n,t)}).getOr(n);return 0<_a(e)},e=function(n,e){var t,o,r,i;(t=n,o=e,r=hs(t.element(),o.selector),i=F(r,function(t){return u(o,t)}),et.from(i[o.firstTabstop])).each(function(t){e.focusManager.set(n,t)})},a=function(n,t,e,o,r){return r(t,e,function(t){return u(n=o,e=t)&&n.useTabstopAt(e);var n,e}).fold(function(){return o.cyclic?et.some(!0):et.none()},function(t){return o.focusManager.set(n,t),et.some(!0)})},i=function(n,t,e,o){var r,i,u=hs(n.element(),e.selector);return(r=n,i=e,i.focusManager.get(r).bind(function(t){return Lu(t,i.selector)})).bind(function(t){return N(u,g(we,t)).bind(function(t){return a(n,u,t,e,o)})})},o=nt([rd(td([nd,Zl([9])]),function(t,n,e,o){var r=e.cyclic?Kl:$l;return i(t,0,e,r)}),rd(Zl([9]),function(t,n,e,o){var r=e.cyclic?Jl:Ql;return i(t,0,e,r)}),rd(Zl([27]),function(n,e,t,o){return t.onEscape.bind(function(t){return t(n,e)})}),rd(td([od,Zl([13])]),function(n,e,t,o){return t.onEnter.bind(function(t){return t(n,e)})})]),r=nt([]);return md(n,Gi.init,o,r,function(){return et.some(e)})},pd=gd(Gr("cyclic",nt(!1))),hd=gd(Gr("cyclic",nt(!0))),vd=function(t,n,e){return Ml(e)&&Zl([32])(n.event())?et.none():(Qr(t,e,Rn()),et.some(!0))},bd=function(t,n){return et.some(!0)},yd=[Nr("execute",vd),Nr("useSpace",!1),Nr("useEnter",!0),Nr("useControlEnter",!1),Nr("useDown",!1)],xd=function(t,n,e){return e.execute(t,n,t.element())},wd=md(yd,Gi.init,function(t,n,e,o){var r=e.useSpace&&!Ml(t.element())?[32]:[],i=e.useEnter?[13]:[],u=e.useDown?[40]:[],a=r.concat(i).concat(u);return[rd(Zl(a),xd)].concat(e.useControlEnter?[rd(td([ed,Zl([13])]),xd)]:[])},function(t,n,e,o){return e.useSpace&&!Ml(t.element())?[rd(Zl([32]),bd)]:[]},function(){return et.none()}),Sd=function(t){var e=Ft(et.none());return Xi({readState:function(){return e.get().map(function(t){return{numRows:t.numRows(),numColumns:t.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(et.some({numRows:nt(t),numColumns:nt(n)}))},getNumRows:function(){return e.get().map(function(t){return t.numRows()})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns()})}})},kd=/* */Object.freeze({flatgrid:Sd,init:function(t){return t.state(t)}}),Cd=function(i){return function(t,n,e,o){var r=i(t.element());return Bd(r,t,n,e,o)}},Od=function(t,n){var e=Rc(t,n);return Cd(e)},Td=function(t,n){var e=Rc(n,t);return Cd(e)},Ed=function(r){return function(t,n,e,o){return Bd(r,t,n,e,o)}},Bd=function(n,e,t,o,r){return o.focusManager.get(e).bind(function(t){return n(e.element(),t,o,r)}).map(function(t){return o.focusManager.set(e,t),!0})},Ad=Ed,Dd=Ed,_d=Ed,Md=function(t){var n,e=t.dom();return!((n=e).offsetWidth<=0&&n.offsetHeight<=0)},Fd=ie(["index","candidates"],[]),Id=function(t,n,e){return Rd(t,n,e,Md)},Rd=function(t,n,e,o){var r,i=g(we,n),u=hs(t,e),a=F(u,Md);return N(r=a,i).map(function(t){return Fd({index:t,candidates:r})})},Vd=function(t,n){return N(t,function(t){return we(n,t)})},Nd=function(e,t,o,n){return n(Math.floor(t/o),t%o).bind(function(t){var n=t.row()*o+t.column();return 0<=n&&n<e.length?et.some(e[n]):et.none()})},Hd=function(r,t,i,u,a){return Nd(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=Vl(n,a,0,e-1);return et.some({row:nt(t),column:nt(o)})})},Pd=function(i,t,u,a,c){return Nd(i,t,a,function(t,n){var e=Vl(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=Nl(n,0,o-1);return et.some({row:nt(e),column:nt(r)})})},zd=[kr("selector"),Nr("execute",vd),Zu("onEscape"),Nr("captureTab",!1),ra()],Ld=function(n,e,t){zu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},jd=function(r){return function(t,n,e,o){return Id(t,n,e.selector).bind(function(t){return r(t.candidates(),t.index(),o.getNumRows().getOr(e.initSize.numRows),o.getNumColumns().getOr(e.initSize.numColumns))})}},Ud=function(t,n,e,o){return e.captureTab?et.some(!0):et.none()},Wd=jd(function(t,n,e,o){return Hd(t,n,e,o,-1)}),Gd=jd(function(t,n,e,o){return Hd(t,n,e,o,1)}),Xd=jd(function(t,n,e,o){return Pd(t,n,e,o,-1)}),Yd=jd(function(t,n,e,o){return Pd(t,n,e,o,1)}),qd=nt([rd(Zl([37]),Od(Wd,Gd)),rd(Zl([39]),Td(Wd,Gd)),rd(Zl([38]),Ad(Xd)),rd(Zl([40]),Dd(Yd)),rd(td([nd,Zl([9])]),Ud),rd(td([od,Zl([9])]),Ud),rd(Zl([27]),function(t,n,e,o){return e.onEscape(t,n)}),rd(Zl([32].concat([13])),function(n,e,o,t){return(r=n,i=o,i.focusManager.get(r).bind(function(t){return Lu(t,i.selector)})).bind(function(t){return o.execute(n,e,t)});var r,i})]),Kd=nt([rd(Zl([32]),bd)]),$d=md(zd,Sd,qd,Kd,function(){return et.some(Ld)}),Jd=function(t,n,e,i){var u=function(t,n,e){var o,r=Vl(n,i,0,e.length-1);return r===t?et.none():(o=e[r],"button"===He(o)&&"disabled"===qe(o,"disabled")?u(t,r,e):et.from(e[r]))};return Id(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},Qd=[kr("selector"),Nr("getInitial",et.none),Nr("execute",vd),Zu("onEscape"),Nr("executeOnMove",!1),Nr("allowVertical",!0)],Zd=function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return Lu(t,r.selector)})).bind(function(t){return o.execute(n,e,t)});var t,r},tm=function(n,e){e.getInitial(n).orThunk(function(){return zu(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},nm=function(t,n,e){return Jd(t,e.selector,n,-1)},em=function(t,n,e){return Jd(t,e.selector,n,1)},om=function(o){return function(t,n,e){return o(t,n,e).bind(function(){return e.executeOnMove?Zd(t,n,e):et.some(!0)})}},rm=function(t,n,e,o){return e.onEscape(t,n)},im=nt([rd(Zl([32]),bd)]),um=md(Qd,Gi.init,function(t,n,e,o){var r=[37].concat(e.allowVertical?[38]:[]),i=[39].concat(e.allowVertical?[40]:[]);return[rd(Zl(r),om(Od(nm,em))),rd(Zl(i),om(Td(nm,em))),rd(Zl([13]),Zd),rd(Zl([32]),Zd),rd(Zl([27]),rm)]},im,function(){return et.some(tm)}),am=ie(["rowIndex","columnIndex","cell"],[]),cm=function(t,n,e){return et.from(t[n]).bind(function(t){return et.from(t[e]).map(function(t){return am({rowIndex:n,columnIndex:e,cell:t})})})},sm=function(t,n,e,o){var r=t[n].length,i=Vl(e,o,0,r-1);return cm(t,n,i)},fm=function(t,n,e,o){var r=Vl(e,o,0,t.length-1),i=t[r].length,u=Nl(n,0,i-1);return cm(t,r,u)},lm=function(t,n,e,o){var r=t[n].length,i=Nl(e+o,0,r-1);return cm(t,n,i)},dm=function(t,n,e,o){var r=Nl(e+o,0,t.length-1),i=t[r].length,u=Nl(n,0,i-1);return cm(t,r,u)},mm=[Br("selectors",[kr("row"),kr("cell")]),Nr("cycles",!0),Nr("previousSelector",et.none),Nr("execute",vd)],gm=function(n,e){e.previousSelector(n).orThunk(function(){var t=e.selectors;return zu(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},pm=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return Lu(o,i.selectors.row).bind(function(t){var n=hs(t,i.selectors.cell);return Vd(n,o).bind(function(o){var r=hs(e,i.selectors.row);return Vd(r,t).bind(function(t){var n,e=(n=i,D(r,function(t){return hs(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell()})})})})}},hm=pm(function(t,n,e){return sm(t,n,e,-1)},function(t,n,e){return lm(t,n,e,-1)}),vm=pm(function(t,n,e){return sm(t,n,e,1)},function(t,n,e){return lm(t,n,e,1)}),bm=pm(function(t,n,e){return fm(t,e,n,-1)},function(t,n,e){return dm(t,e,n,-1)}),ym=pm(function(t,n,e){return fm(t,e,n,1)},function(t,n,e){return dm(t,e,n,1)}),xm=nt([rd(Zl([37]),Od(hm,vm)),rd(Zl([39]),Td(hm,vm)),rd(Zl([38]),Ad(bm)),rd(Zl([40]),Dd(ym)),rd(Zl([32].concat([13])),function(n,e,o){return cd(n.element()).bind(function(t){return o.execute(n,e,t)})})]),wm=nt([rd(Zl([32]),bd)]),Sm=md(mm,Gi.init,xm,wm,function(){return et.some(gm)}),km=[kr("selector"),Nr("execute",vd),Nr("moveOnTab",!1)],Cm=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},Om=function(n,e){zu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},Tm=function(t,n,e){return Jd(t,e.selector,n,-1)},Em=function(t,n,e){return Jd(t,e.selector,n,1)},Bm=nt([rd(Zl([38]),_d(Tm)),rd(Zl([40]),_d(Em)),rd(td([nd,Zl([9])]),function(t,n,e){return e.moveOnTab?_d(Tm)(t,n,e):et.none()}),rd(td([od,Zl([9])]),function(t,n,e){return e.moveOnTab?_d(Em)(t,n,e):et.none()}),rd(Zl([13]),Cm),rd(Zl([32]),Cm)]),Am=nt([rd(Zl([32]),bd)]),Dm=md(km,Gi.init,Bm,Am,function(){return et.some(Om)}),_m=[Zu("onSpace"),Zu("onEnter"),Zu("onShiftEnter"),Zu("onLeft"),Zu("onRight"),Zu("onTab"),Zu("onShiftTab"),Zu("onUp"),Zu("onDown"),Zu("onEscape"),Nr("stopSpaceKeyup",!1),_r("focusIn")],Mm=md(_m,Gi.init,function(t,n,e){return[rd(Zl([32]),e.onSpace),rd(td([od,Zl([13])]),e.onEnter),rd(td([nd,Zl([13])]),e.onShiftEnter),rd(td([nd,Zl([9])]),e.onShiftTab),rd(td([od,Zl([9])]),e.onTab),rd(Zl([38]),e.onUp),rd(Zl([40]),e.onDown),rd(Zl([37]),e.onLeft),rd(Zl([39]),e.onRight),rd(Zl([32]),e.onSpace),rd(Zl([27]),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[rd(Zl([32]),bd)]:[]},function(t){return t.focusIn}),Fm=pd.schema(),Im=hd.schema(),Rm=um.schema(),Vm=$d.schema(),Nm=Sm.schema(),Hm=wd.schema(),Pm=Dm.schema(),zm=Mm.schema(),Lm=ga({branchKey:"mode",branches:/* */Object.freeze({acyclic:Fm,cyclic:Im,flow:Rm,flatgrid:Vm,matrix:Nm,execution:Hm,menu:Pm,special:zm}),name:"keying",active:{events:function(t,n){return t.handler.toEvents(t,n)}},apis:{focusIn:function(n,e,o){e.sendFocusIn(e).fold(function(){n.getSystem().triggerFocus(n.element(),n.element())},function(t){t(n,e,o)})},setGridSize:function(t,n,e,o,r){Mt(e,"setGridSize")?e.setGridSize(o,r):H.console.error("Layout does not support setGridSize")}},state:kd}),jm=function(t,n,e,o){var r=t.getSystem().build(o);tf(t,r,e)},Um=function(t,n,e,o){var r=Wm(t,n);V(r,function(t){return we(o.element(),t.element())}).each(ef)},Wm=function(t,n){return t.components()},Gm=function(n,e,t,r,o){var i=Wm(n,e);return et.from(i[r]).map(function(t){return Um(n,e,0,t),o.each(function(t){jm(n,0,function(t,n){var e,o;o=n,Ee(e=t,r).fold(function(){_e(e,o)},function(t){Be(t,o)})},t)}),t})},Xm=da({fields:[],name:"replacing",apis:/* */Object.freeze({append:function(t,n,e,o){jm(t,0,_e,o)},prepend:function(t,n,e,o){jm(t,0,De,o)},remove:Um,replaceAt:Gm,replaceBy:function(n,e,t,o,r){var i=Wm(n,e);return N(i,o).bind(function(t){return Gm(n,e,0,t,r)})},set:function(n,t,e,o){var r,i,u,a;of(n),r=function(){var t=D(o,n.getSystem().build);j(t,function(t){Zs(n,t)})},i=n.element(),u=Se(i),a=ad(u).bind(function(n){var t=function(t){return we(n,t)};return t(i)?et.some(i):ci(i,t)}),r(i),a.each(function(n){ad(u).filter(function(t){return we(t,n)}).fold(function(){ud(n)},tt)})},contents:Wm})}),Ym=function(t,n,e){n.store.manager.onLoad(t,n,e)},qm=function(t,n,e){n.store.manager.onUnload(t,n,e)},Km=/* */Object.freeze({onLoad:Ym,onUnload:qm,setValue:function(t,n,e,o){n.store.manager.setValue(t,n,e,o)},getValue:function(t,n,e){return n.store.manager.getValue(t,n,e)},getState:function(t,n,e){return e}}),$m=/* */Object.freeze({events:function(e,o){var t=e.resetOnDom?[ki(function(t,n){Ym(t,e,o)}),Ci(function(t,n){qm(t,e,o)})]:[ia(e,o,Ym)];return fi(t)}}),Jm=function(){var t=Ft(null);return Xi({set:t.set,get:t.get,isNotSet:function(){return null===t.get()},clear:function(){t.set(null)},readState:function(){return{mode:"memory",value:t.get()}}})},Qm=function(){var i=Ft({}),u=Ft({});return Xi({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Bt(i.get(),t).orThunk(function(){return Bt(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};j(t,function(n){o[n.value]=n,Bt(n,"meta").each(function(t){Bt(t,"text").each(function(t){r[t]=n})})}),i.set(mo({},n,o)),u.set(mo({},e,r))},clear:function(){i.set({}),u.set({})}})},Zm=/* */Object.freeze({memory:Jm,dataset:Qm,manual:function(){return Xi({readState:function(){}})},init:function(t){return t.store.manager.state(t)}}),tg=function(t,n,e,o){var r=n.store;e.update([o]),r.setValue(t,o),n.onSetValue(t,o)},ng=[_r("initialValue"),kr("getFallbackEntry"),kr("getDataKey"),kr("setValue"),ea("manager",{setValue:tg,getValue:function(t,n,e){var o=n.store,r=o.getDataKey(t);return e.lookup(r).fold(function(){return o.getFallbackEntry(r)},function(t){return t})},onLoad:function(n,e,o){e.store.initialValue.each(function(t){tg(n,e,o,t)})},onUnload:function(t,n,e){e.clear()},state:Qm})],eg=[kr("getValue"),Nr("setValue",tt),_r("initialValue"),ea("manager",{setValue:function(t,n,e,o){n.store.setValue(t,o),n.onSetValue(t,o)},getValue:function(t,n,e){return n.store.getValue(t)},onLoad:function(n,e,t){e.store.initialValue.each(function(t){e.store.setValue(n,t)})},onUnload:tt,state:Gi.init})],og=[_r("initialValue"),ea("manager",{setValue:function(t,n,e,o){e.set(o),n.onSetValue(t,o)},getValue:function(t,n,e){return e.get()},onLoad:function(t,n,e){n.store.initialValue.each(function(t){e.isNotSet()&&e.set(t)})},onUnload:function(t,n,e){e.clear()},state:Jm})],rg=[Hr("store",{mode:"memory"},pr("mode",{memory:og,manual:eg,dataset:ng})),Qu("onSetValue"),Nr("resetOnDom",!1)],ig=da({fields:rg,name:"representing",active:$m,apis:Km,extra:{setValueFrom:function(t,n){var e=ig.getValue(n);ig.setValue(t,e)}},state:Zm}),ug=function(t,n){n.ignore||(ud(t.element()),n.onFocus(t))},ag=/* */Object.freeze({focus:ug,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=Se(n).dom(),n.dom()===e.activeElement;var n,e}}),cg=/* */Object.freeze({exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return qi(e)},events:function(e){return fi([gi(_n(),function(t,n){ug(t,e),n.stop()})].concat(e.stopMousedown?[gi(jt(),function(t,n){n.event().prevent()})]:[]))}}),sg=[Qu("onFocus"),Nr("stopMousedown",!1),Nr("ignore",!1)],fg=da({fields:sg,name:"focusing",active:cg,apis:ag}),lg=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},dg=function(n,t,e){t.toggleClass.each(function(t){e.get()?cu(n.element(),t):su(n.element(),t)})},mg=function(t,n,e){hg(t,n,e,!e.get())},gg=function(t,n,e){e.set(!0),dg(t,n,e),lg(t,n,e)},pg=function(t,n,e){e.set(!1),dg(t,n,e),lg(t,n,e)},hg=function(t,n,e,o){(o?gg:pg)(t,n,e)},vg=function(t,n,e){hg(t,n,e,n.selected)},bg=/* */Object.freeze({onLoad:vg,toggle:mg,isOn:function(t,n,e){return e.get()},on:gg,off:pg,set:hg}),yg=/* */Object.freeze({exhibit:function(t,n,e){return qi({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=mg,Ti(function(t){r(t,e,o)})),u=ia(t,n,vg);return fi(G([t.toggleOnExecute?[i]:[],[u]]))}}),xg=function(t,n,e){Xe(t.element(),"aria-expanded",e)},wg=[Nr("selected",!1),_r("toggleClass"),Nr("toggleOnExecute",!0),Hr("aria",{mode:"none"},pr("mode",{pressed:[Nr("syncWithExpanded",!1),ea("update",function(t,n,e){Xe(t.element(),"aria-pressed",e),n.syncWithExpanded&&xg(t,n,e)})],checked:[ea("update",function(t,n,e){Xe(t.element(),"aria-checked",e)})],expanded:[ea("update",xg)],selected:[ea("update",function(t,n,e){Xe(t.element(),"aria-selected",e)})],none:[ea("update",tt)]}))],Sg=da({fields:wg,name:"toggling",active:yg,apis:bg,state:(dd=!1,{init:function(){var n=Ft(dd);return{get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(dd)},readState:function(){return n.get()}}}})}),kg="alloy.item-hover",Cg="alloy.item-focus",Og=function(t){(cd(t.element()).isNone()||fg.isFocused(t))&&(fg.isFocused(t)||fg.focus(t),$r(t,kg,{item:t}))},Tg=function(t){$r(t,Cg,{item:t})},Eg=nt(kg),Bg=nt(Cg),Ag=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=fi(n),da({fields:[kr("enabled")],name:e,active:{events:nt(o)}})),configAsRaw:nt({}),initialConfig:{},state:Gi}}},Dg=[kr("data"),kr("components"),kr("dom"),Nr("hasSubmenu",!1),_r("toggling"),Bf.field("itemBehaviours",[Sg,fg,Lm,ig]),Nr("ignoreFocus",!1),Nr("domModification",{}),ea("builder",function(t){return{dom:t.dom,domModification:mo({},t.domModification,{attributes:mo({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes,{"aria-haspopup":t.hasSubmenu},t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:Bf.augment(t.itemBehaviours,[t.toggling.fold(Sg.revoke,function(t){return Sg.config(mo({aria:{mode:"checked"}},t))}),fg.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){Tg(t)}}),Lm.config({mode:"execution"}),ig.config({store:{mode:"memory",initialValue:t.data}}),Ag("item-type-events",[gi(Hn(),Jr),xi(jt()),gi(Xt(),Og),gi(Vn(),fg.focus)])]),components:t.components,eventOrder:t.eventOrder}}),Nr("eventOrder",{})],_g=[kr("dom"),kr("components"),ea("builder",function(t){return{dom:t.dom,components:t.components,events:fi([wi(Vn())])}})],Mg=nt([Zf({name:"widget",overrides:function(n){return{behaviours:fa([ig.config({store:{mode:"manual",getValue:function(t){return n.data},setValue:function(){}}})])}}})]),Fg=[kr("uid"),kr("data"),kr("components"),kr("dom"),Nr("autofocus",!1),Nr("ignoreFocus",!1),Bf.field("widgetBehaviours",[ig,fg,Lm]),Nr("domModification",{}),xl(Mg()),ea("builder",function(e){var t=ll(0,e,Mg()),n=dl("item-widget",e,t.internals()),o=function(t){return ml(t,e,"widget").map(function(t){return Lm.focusIn(t),t})},r=function(t,n){return Ml(n.event().target())||e.autofocus&&n.setSource(t.element()),et.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:fi([Ti(function(t,n){o(t).each(function(t){n.stop()})}),gi(Xt(),Og),gi(Vn(),function(t,n){e.autofocus?o(t):fg.focus(t)})]),behaviours:Bf.augment(e.widgetBehaviours,[ig.config({store:{mode:"memory",initialValue:e.data}}),fg.config({ignore:e.ignoreFocus,onFocus:function(t){Tg(t)}}),Lm.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:pa(),onLeft:r,onRight:r,onEscape:function(t,n){return fg.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),et.none()):(fg.focus(t),et.some(!0))}})])}})],Ig=pr("type",{widget:Fg,item:Dg,separator:_g}),Rg=nt([el({factory:{sketch:function(t){var n=mr("menu.spec item",Ig,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:mo({},n,{uid:Ri("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),Vg=nt([kr("value"),kr("items"),kr("dom"),kr("components"),Nr("eventOrder",{}),Of("menuBehaviours",[ql,ig,Rl,Lm]),Hr("movement",{mode:"menu",moveOnTab:!0},pr("mode",{grid:[ra(),ea("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[ea("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),kr("rowSelector")],menu:[Nr("moveOnTab",!0),ea("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),Cr("markers",Yu()),Nr("fakeFocus",!1),Nr("focusManager",fd()),Qu("onHighlight")]),Ng=nt("alloy.menu-focus"),Hg=_l({name:"Menu",configFields:Vg(),partFields:Rg(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:Ef(t.menuBehaviours,[ql.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),ig.config({store:{mode:"memory",initialValue:t.value}}),Rl.config({find:et.some}),Lm.config(t.movement.config(t,t.movement))]),events:fi([gi(Bg(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){ql.highlight(n,t),e.stop(),$r(n,Ng(),{menu:n,item:t})})}),gi(Eg(),function(t,n){var e=n.event().item();ql.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),Pg=function(e,o,r,t){return Bt(r,t).bind(function(t){return Bt(e,t).bind(function(t){var n=Pg(e,o,r,t);return et.some([t].concat(n))})}).getOr([])},zg=function(t,n){var e={};ut(t,function(t,n){j(t,function(t){e[t]=n})});var o=n,r=ct(n,function(t,n){return{k:t,v:n}}),i=at(r,function(t,n){return[n].concat(Pg(e,o,r,n))});return at(e,function(t){return Bt(i,t).getOr([t])})},Lg=function(){var i=Ft({}),u=Ft({}),a=Ft({}),c=Ft(et.none()),s=Ft({}),n=function(t){return Bt(u.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(mo({},u.get(),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(et.some(t)),i.set(e),u.set(n),s.set(o);var r=zg(o,e);a.set(r)},expand:function(e){return Bt(i.get(),e).map(function(t){var n=Bt(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Bt(a.get(),t)},collapse:function(t){return Bt(a.get(),t).bind(function(t){return 1<t.length?et.some(t.slice(1)):et.none()})},lookupMenu:n,otherMenus:function(t){var n=s.get();return K(rt(n),t)},getPrimary:function(){return c.get().bind(function(t){return n(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(et.none())},isClear:function(){return c.get().isNone()}}},jg=nt("collapse-item"),Ug=Dl({name:"TieredMenu",configFields:[na("onExecute"),na("onEscape"),ta("onOpenMenu"),ta("onOpenSubmenu"),Qu("onCollapseMenu"),Nr("highlightImmediately",!0),Br("data",[kr("primary"),kr("menus"),kr("expansions")]),Nr("fakeFocus",!1),Qu("onHighlight"),Qu("onHover"),Ku(),kr("dom"),Nr("navigateOnHover",!0),Nr("stayInDom",!1),Of("tmenuBehaviours",[Lm,ql,Rl,Xm]),Nr("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)}},factory:function(a,t){var c,n,i=Ft(et.none()),s=Lg(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,at(n,function(t,n){var e=function(){return Hg.sketch(mo({dom:t.dom},t,{value:n,items:t.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?ld():fd()}))};return n===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})),i=u(t);return s.setContents(a.data.primary,e,a.data.expansions,i),s.getPrimary()},f=function(t){return ig.getValue(t).value},u=function(t){return at(a.data.menus,function(t,n){return X(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},l=function(n,t){ql.highlight(n,t),ql.getHighlighted(t).orThunk(function(){return ql.getFirst(t)}).each(function(t){Qr(n,t.element(),Vn())})},d=function(n,t){return It(D(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));j(o,function(t){du(t.element(),[a.markers.backgroundMenu]),a.stayInDom||Xm.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=hs(r.element(),"."+a.markers.item),n=F(t,function(t){return"true"===qe(t,"aria-haspopup")});return j(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=f(t);e[n]=t})}),i.set(et.some(e)),e}));ut(n,function(t,n){var e=T(o,n);Xe(t.element(),"aria-expanded",e)})},p=function(o,r,i){return et.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return et.none();var n=t.menu,e=d(r,i.slice(1));return j(e,function(t){cu(t.element(),a.markers.backgroundMenu)}),oi(n.element())||Xm.append(o,Nu(n)),du(n.element(),[a.markers.backgroundMenu]),l(o,n),m(o,r,i),et.some(n)})})};(n=c||(c={}))[n.HighlightSubmenu=0]="HighlightSubmenu",n[n.HighlightParent=1]="HighlightParent";var h=function(r,i,u){void 0===u&&(u=c.HighlightSubmenu);var t=f(i);return s.expand(t).bind(function(o){return g(r,o),et.from(o[0]).bind(function(e){return s.lookupMenu(e).bind(function(t){var n=function(t,n,e){if("notbuilt"!==e.type)return e.menu;var o=t.getSystem().build(e.nbMenu());return s.setMenuBuilt(n,o),o}(r,e,t);return oi(n.element())||Xm.append(r,Nu(n)),a.onOpenSubmenu(r,i,n),u===c.HighlightSubmenu?(ql.highlightFirst(n),p(r,s,o)):(ql.dehighlightAll(n),et.some(i))})})})},o=function(n,e){var t=f(e);return s.collapse(t).bind(function(t){return g(n,t),p(n,s,t).map(function(t){return a.onCollapseMenu(n,e,t),t})})},r=function(e){return function(n,t){return Lu(t.getSource(),"."+a.markers.item).bind(function(t){return n.getSystem().getByDom(t).toOption().bind(function(t){return e(n,t).map(function(){return!0})})})}},v=fi([gi(Ng(),function(n,t){var e=t.event().menu();ql.highlight(n,e);var o=f(t.event().item());s.refresh(o).each(function(t){return m(n,s,t)})}),Ti(function(n,t){var e=t.event().target();n.getSystem().getByDom(e).each(function(t){0===f(t).indexOf("collapse-item")&&o(n,t),h(n,t,c.HighlightSubmenu).fold(function(){a.onExecute(n,t)},function(){})})}),ki(function(n,t){e(n).each(function(t){Xm.append(n,Nu(t)),a.onOpenMenu(n,t),a.highlightImmediately&&l(n,t)})})].concat(a.navigateOnHover?[gi(Eg(),function(t,n){var e,o,r=n.event().item();e=t,o=f(r),s.refresh(o).bind(function(t){return g(e,t),p(e,s,t)}),h(t,r,c.HighlightParent),a.onHover(t,r)})]:[])),b={collapseMenu:function(n){ql.getHighlighted(n).each(function(t){ql.getHighlighted(t).each(function(t){o(n,t)})})},highlightPrimary:function(n){s.getPrimary().each(function(t){l(n,t)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:Ef(a.tmenuBehaviours,[Lm.config({mode:"special",onRight:r(function(t,n){return Ml(n.element())?et.none():h(t,n,c.HighlightSubmenu)}),onLeft:r(function(t,n){return Ml(n.element())?et.none():o(t,n)}),onEscape:r(function(t,n){return o(t,n).orThunk(function(){return a.onEscape(t,n).map(function(){return t})})}),focusIn:function(n,t){s.getPrimary().each(function(t){Qr(n,t.element(),Vn())})}}),ql.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),Rl.config({find:function(t){return ql.getHighlighted(t)}}),Xm.config({})]),eventOrder:a.eventOrder,apis:b,events:v}},extraApis:{tieredData:function(t,n,e){return{primary:t,menus:n,expansions:e}},singleData:function(t,n){return{primary:t,menus:At(t,n),expansions:{}}},collapseItem:function(t){return{value:fo(jg()),meta:{text:t}}}}}),Wg=Dl({name:"InlineView",configFields:[kr("lazySink"),Qu("onShow"),Qu("onHide"),Rr("onEscape"),Of("inlineBehaviours",[yf,ba]),Vr("fireDismissalEventInstead",[Nr("event",Yn())]),Nr("getRelated",et.none),Nr("eventOrder",et.none)],factory:function(s,t){var r=function(t,n,e,o){var r=s.lazySink(t).getOrDie();yf.openWhileCloaked(t,e,function(){return $s.positionWithin(r,n,t,o)}),s.onShow(t)},n={setContent:function(t,n){yf.open(t,n)},showAt:function(t,n,e){var o=et.none();r(t,n,e,o)},showWithin:r,showMenuAt:function(t,n,e){var o,r,i,u,a,c=(o=s,r=t,i=n,u=e,a=function(){return o.lazySink(r)},Ug.sketch({dom:{tag:"div"},data:u.data,markers:u.menu.markers,onEscape:function(){return yf.close(r),o.onEscape.map(function(t){return t(r)}),et.some(!0)},onExecute:function(){return et.some(!0)},onOpenMenu:function(t,n){$s.position(a().getOrDie(),i,n)},onOpenSubmenu:function(t,n,e){var o=a().getOrDie();$s.position(o,{anchor:"submenu",item:n},e)}}));yf.open(t,c),s.onShow(t)},hide:function(t){yf.close(t),s.onHide(t)},getContent:function(t){return yf.getState(t)},isOpen:yf.isOpen};return{uid:s.uid,dom:s.dom,behaviours:Ef(s.inlineBehaviours,[yf.config({isPartOf:function(t,n,e){return Wu(n,e)||(o=t,r=e,s.getRelated(o).exists(function(t){return Wu(t,r)}));var o,r},getAttachPoint:function(t){return s.lazySink(t).getOrDie()}}),kf(mo({isExtraPart:nt(!1)},s.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))]),eventOrder:s.eventOrder,apis:n}},apis:{showAt:function(t,n,e,o){t.showAt(n,e,o)},showWithin:function(t,n,e,o,r){t.showWithin(n,e,o,r)},showMenuAt:function(t,n,e,o){t.showMenuAt(n,e,o)},hide:function(t,n){t.hide(n)},isOpen:function(t,n){return t.isOpen(n)},getContent:function(t,n){return t.getContent(n)},setContent:function(t,n,e){t.setContent(n,e)}}}),Gg=function(t){var n=function(t,n){n.stop(),Jr(t)},e=An.detect().deviceType.isTouch()?[gi(Nn(),n)]:[gi(Zt(),n),gi(jt(),function(t,n){n.cut()})];return fi(G([t.map(function(e){return gi(Rn(),function(t,n){e(t),n.stop()})}).toArray(),e]))},Xg=Dl({name:"Button",factory:function(t){var n=Gg(t.action),e=t.dom.tag,o=function(n){return Bt(t.dom,"attributes").bind(function(t){return Bt(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:Bf.augment(t.buttonBehaviours,[fg.config({}),Lm.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:function(){if("button"!==e)return{role:o("role").getOr("button")};var t=o("type").getOr("button"),n=o("role").map(function(t){return{role:t}}).getOr({});return mo({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[Nr("uid",undefined),kr("dom"),Nr("components",[]),Bf.field("buttonBehaviours",[fg,Lm]),_r("action"),_r("role"),Nr("eventOrder",{})]}),Yg=function(t){var n=Ol(t)&&Mt(t,"uid")?t.uid:Ri("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).fold(et.none,et.some)},asSpec:function(){return mo({},t,{uid:n})}}},qg=function(t){return et.from(t()["temporary-placeholder"]).getOr("!not found!")},Kg=function(t,n){return et.from(n()[t]).getOrThunk(function(){return qg(n)})},$g={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Jg=Dl({name:"Notification",factory:function(n){var t,e,o=Yg({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:fa([Xm.config({})])}),r=function(t){return{dom:{tag:"div",classes:["tox-bar"],attributes:{style:"width: "+t+"%"}}}},i=function(t){return{dom:{tag:"div",classes:["tox-text"],innerHtml:t+"%"}}},u=Yg({dom:{tag:"div",classes:n.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[r(0)]},i(0)],behaviours:fa([Xm.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){Xm.set(t,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[r(n)]},i(n)])})},updateText:function(t,n){if(t.getSystem().isConnected()){var e=o.get(t);Xm.set(e,[Fu(n)])}}},c=G([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return et.from($g[t])}).toArray()]);return{uid:n.uid,dom:{tag:"div",attributes:{role:"alert"},classes:n.level.map(function(t){return["tox-notification","tox-notification--in","tox-notification--"+t]}).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:(t=c,e=n.iconProvider,Rt(t,function(t){return et.from(e()[t])}).getOrThunk(function(){return qg(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:fa([Xm.config({})])}].concat(n.progress?[u.asSpec()]:[]).concat(Xg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:Kg("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},configFields:[_r("level"),kr("progress"),kr("icon"),kr("onAction"),kr("text"),kr("iconProvider"),kr("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}}),Qg=tinymce.util.Tools.resolve("tinymce.util.Delay");function Zg(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),Wg.hide(r)},o=Vu(Jg.sketch({text:t.text,level:T(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:et.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=Vu(Wg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),t.timeout&&Qg.setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){Wg.showAt(r,{anchor:"makeshift",x:t,y:n},Nu(o))},moveRel:function(t,n){Wg.showAt(r,i.backstage.shared.anchors.banner(),Nu(o))},text:function(t){Jg.updateText(o,t)},settings:t,getEl:function(){},progressBar:{value:function(t){Jg.updateProgress(o,t)}}}},close:function(t){t.close()},reposition:function(t){j(t,function(t){t.moveTo(0,0)}),function(e){if(0<e.length){var t=e.slice(0,1)[0],n=(o=r).inline?o.getElement():o.getContentAreaContainer();t.moveRel(n,"tc-tc"),j(e,function(t,n){0<n&&t.moveRel(e[n-1].getEl(),"bc-tc")})}var o}(t)},getArgs:function(t){return t.settings}}}var tp,np,ep=function(e,o){var r=null;return{cancel:function(){null!==r&&(H.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&H.clearTimeout(r),r=H.setTimeout(function(){e.apply(null,t),r=null},o)}}},op=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),rp=xt([{aborted:[]},{edge:["element"]},{success:["info"]}]),ip=xt([{abort:[]},{kontinue:[]},{finish:["info"]}]),up=function(n,e,t,o,r,i){var u=function(){return i.fold(rp.aborted,rp.edge)},a=function(){var t=r();return t?up(n,t,et.none(),o,r,et.some(e)):u()};if(n.isBlock(e))return u();if(e.nodeType!==H.Node.TEXT_NODE)return a();var c=e.textContent;return o(ip,e,c,t).fold(rp.aborted,function(){return a()},rp.success)},ap=function(t,n,e,o,r){var i=new op(n,r||t.getRoot());return up(t,n,et.some(e),o,i.prev,et.none())},cp=function(e,n){return sp(ne.fromDom(e.selection.getNode())).getOrThunk(function(){var t=ne.fromHtml('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',e.getDoc());return _e(t,ne.fromDom(n.extractContents())),n.insertNode(t.dom()),Ce(t).each(function(t){return t.dom().normalize()}),ss(t).map(function(t){var n;e.selection.setCursorLocation(t.dom(),"img"===He(n=t)?1:ns(n).fold(function(){return Te(n).length},function(t){return t.length}))}),t})},sp=function(t){return Lu(t,"[data-mce-autocompleter]")},fp=/[\u00a0 \t\r\n]/,lp=function(t,n){return t.toString().substring(n.length).replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},dp=function(t,u,a,c){if(void 0===c&&(c=0),!(n=u).collapsed||3!==n.startContainer.nodeType)return et.none();var n;return ap(t,u.startContainer,u.startOffset,function(e,o,r,t){var i=t.getOr(r.length);return function(t,n,e,o){var r;for(r=n-1;0<=r;r--){var i=t.charAt(r);if(fp.test(i))return et.none();if(i===e)break}return-1===r||n-r<o?et.none():et.some(t.substring(r+1,n))}(r,i,a,1).fold(function(){return r.match(fp)?e.abort():e.kontinue()},function(t){var n=u.cloneRange();return n.setStart(o,i-t.length-1),n.setEnd(u.endContainer,u.endOffset),r.length<c?e.abort():e.finish({text:lp(n,a),range:n,triggerChar:a})})}).fold(et.none,et.none,et.some)},mp=function(e,t,o,n){return void 0===n&&(n=0),sp(ne.fromDom(t.startContainer)).fold(function(){return dp(e,t,o,n)},function(t){var n=e.createRng();return n.selectNode(t.dom()),et.some({range:n,text:lp(n,o),triggerChar:o})})},gp=function(e,t){t.on("keypress compositionend",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){$r(t,Kt(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(ql.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which&&e.cancelIfNecessary(),e.isMenuOpen()?13===n.which?(t().each(Jr),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(ql.highlightFirst)},function(t){o(t,n)}),n.preventDefault(),n.stopImmediatePropagation()):37!==n.which&&38!==n.which&&39!==n.which||t().each(function(t){o(t,n),n.preventDefault(),n.stopImmediatePropagation()}):13!==n.which&&38!==n.which&&40!==n.which||e.cancelIfNecessary())}),t.on("NodeChange",function(t){e.isActive()&&sp(ne.fromDom(t.element)).isNone()&&e.cancelIfNecessary()})},pp=tinymce.util.Tools.resolve("tinymce.util.Promise"),hp=function(t,n){return{element:t,offset:n}},vp=function(t){if(t.nodeType===H.Node.TEXT_NODE)return hp(t,t.data.length);var n=t.childNodes;return 0<n.length?vp(n[n.length-1]):hp(t,n.length)},bp=function(t,n){var e=t.childNodes;return 0<e.length&&n<e.length?bp(e[n],0):0<e.length&&t.nodeType===H.Node.ELEMENT_NODE&&e.length===n?vp(e[e.length-1]):hp(t,n)},yp=function(n,e){var o,r,t,i=e(),u=n.selection.getRng();return(o=n.dom,r=u,t=i,Rt(t.triggerChars,function(t){return mp(o,r,t)})).bind(function(t){return xp(n,e,t)})},xp=function(n,t,e){var o=t(),r=n.selection.getRng().startContainer.nodeValue,i=F(o.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOrThunk(function(){return e=n.dom,o=function(t,n,e,o){var r=o.getOr(e.length);return 0===r?t.kontinue():t.finish(/\s/.test(e.charAt(r-1)))},function(t){var n=bp(t.startContainer,t.startOffset);return ap(e,n.element,n.offset,o).fold(nt(!0),nt(!0),d)};var e,o})(e.range,r,e.text)});if(0===i.length)return et.none();var u=pp.all(D(i,function(n){return n.fetch(e.text,n.maxResults).then(function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}})}));return et.some({lookupData:u,context:e})},wp=$o([Gr("type",function(){return"autocompleteitem"}),Gr("active",function(){return!1}),Gr("disabled",function(){return!1}),Nr("meta",{}),Or("value"),Ir("text"),Ir("icon")]),Sp=$o([Or("type"),Or("ch"),Pr("minChars",1),Nr("columns",1),Pr("maxResults",10),Rr("matches"),Er("fetch"),Er("onAction")]),kp=function(t){var n,e,o=t.ui.registry.getAll().popups,r=at(o,function(t){return(n=t,lr("Autocompleter",Sp,n)).fold(function(t){throw new Error(gr(t))},function(t){return t});var n}),i=(n=st(r,function(t){return t.ch}),e={},j(n,function(t){e[t]={}}),rt(e)),u=lt(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return F(u,function(t){return t.ch===n})}}},Cp=[jr("disabled",!1),Ir("text"),Ir("shortcut"),er("value","value",wo(function(){return fo("menuitem-value")}),hr()),Nr("meta",{})],Op=$o([Or("type"),Ur("onSetup",function(){return tt}),Ur("onAction",tt),Ir("icon")].concat(Cp)),Tp=$o([Or("type"),Er("getSubmenuItems"),Ur("onSetup",function(){return tt}),Ir("icon")].concat(Cp)),Ep=$o([Or("type"),jr("active",!1),Ur("onSetup",function(){return tt}),Er("onAction")].concat(Cp)),Bp=$o([Or("type"),jr("active",!1),Ir("icon")].concat(Cp)),Ap=$o([Or("type"),Ir("text")]),Dp=$o([Or("type"),Tr("fancytype",["inserttable","colorswatch"]),Ur("onAction",tt)]),_p=function(t,o,n){var r=hs(t.element(),"."+n);if(0<r.length){var e=N(r,function(t){var n=t.dom().getBoundingClientRect().top,e=r[0].dom().getBoundingClientRect().top;return Math.abs(n-e)>o}).getOr(r.length);return et.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return et.none()},Mp=function(t,n){return fa([Ag(t,n)])},Fp=function(t){return Mp(fo("unnamed-events"),t)},Ip=[kr("lazySink"),kr("tooltipDom"),Nr("exclusive",!0),Nr("tooltipComponents",[]),Nr("delay",300),Lr("mode","normal",["normal","follow-highlight"]),Nr("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:nt([Ac,Bc,Cc,Tc,Oc,Ec]),onRtl:nt([Ac,Bc,Cc,Tc,Oc,Ec])}}}),Qu("onHide"),Qu("onShow")],Rp=/* */Object.freeze({init:function(){var e=Ft(et.none()),n=Ft(et.none()),o=function(){e.get().each(function(t){H.clearTimeout(t)})},t=nt("not-implemented");return Xi({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(et.some(t))},clearTooltip:function(){n.set(et.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(et.some(H.setTimeout(function(){t()},n)))},readState:t})}}),Vp=fo("tooltip.exclusive"),Np=fo("tooltip.show"),Hp=fo("tooltip.hide"),Pp=function(t,n,e){t.getSystem().broadcastOn([Vp],{})},zp=/* */Object.freeze({hideAllExclusive:Pp,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&Xm.set(t,o)})}}),Lp=da({fields:Ip,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){ef(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return fi(G([[gi(Np,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){Pp(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:fi("normal"===o.mode?[gi(Xt(),function(t){Kr(n,Np)}),gi(Wt(),function(t){Kr(n,Hp)})]:[]),behaviours:fa([Xm.config({})])});r.setTooltip(e),Zs(t,e),o.onShow(n,e),$s.position(t,o.anchor(n),e)}}(t)},o.delay)}),gi(Hp,function(t){r.resetTimer(function(){e(t)},o.delay)}),gi(In(),function(t,n){T(n.channels(),Vp)&&e(t)}),Ci(function(t){e(t)})],"normal"===o.mode?[gi(Yt(),function(t){Kr(t,Np)}),gi(Mn(),function(t){Kr(t,Hp)}),gi(Xt(),function(t){Kr(t,Np)}),gi(Wt(),function(t){Kr(t,Hp)})]:[gi(Qn(),function(t,n){Kr(t,Np)}),gi(Zn(),function(t){Kr(t,Hp)})]]))}}),state:Rp,apis:zp}),jp=function(t){var n,e,o,r=ne.fromHtml(t),i=Te(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],R(e,function(t,n){var e;return"class"===n.name?t:mo({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:Ve(r)};return mo({tag:He(r),classes:a,attributes:u},c)},Up=tinymce.util.Tools.resolve("tinymce.util.I18n"),Wp="tox-menu-nav__js",Gp="tox-collection__item",Xp="tox-swatch",Yp={normal:Wp,color:Xp},qp="tox-collection__item--enabled",Kp="tox-collection__item-icon",$p="tox-collection__item-label",Jp="tox-collection__item--active",Qp=function(t){return Bt(Yp,t).getOr(Wp)},Zp=tinymce.util.Tools.resolve("tinymce.Env"),th=function(t){var e=Zp.mac?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl",access:"Shift+Alt"},n=t.split("+"),o=D(n,function(t){var n=t.toLowerCase().trim();return mt(e,n)?e[n]:t});return Zp.mac?o.join(""):o.join("+")},nh=function(t){return{dom:{tag:"div",classes:[Kp],innerHtml:t}}},eh=function(t){return{dom:{tag:"div",classes:[$p]},components:[Fu(Up.translate(t))]}},oh=function(t,n){return{dom:{tag:"div",classes:[$p]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[Fu(Up.translate(n))]}]}},rh=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:th(t)}}},ih=function(t){return{dom:{tag:"div",classes:[Kp,"tox-collection__item-checkmark"],innerHtml:Kg("checkmark",t)}}},uh=function(t,n,e,o,r){var i=e?t.checkMark.orThunk(function(){return n.or(et.some("")).map(nh)}):et.none(),u=t.ariaLabel.map(function(t){return{attributes:{title:Up.translate(t)}}}).getOr({});return{dom:Ct({tag:"div",classes:[Wp,Gp].concat(r?["tox-collection__item-icon-rtl"]:[])},u),optComponents:[i,t.htmlContent.fold(function(){return t.textContent.map(o)},function(t){return et.some({dom:{tag:"div",classes:[$p],innerHtml:t}})}),t.shortcutContent.map(rh),t.caret]}},ah=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],ch=["list-bull-circle","list-bull-default","list-bull-square"],sh=function(t,r,n,i){void 0===i&&(i=et.none());var e,o,u,a,c,s,f,l=Up.isRtl()&&t.iconContent.exists(function(t){return T(ch,t)}),d=(e=t.iconContent,e.map(function(t){return Up.isRtl()&&T(ah,t)?t+"-rtl":t})).map(function(t){return n=t,e=r.icons,o=i,et.from(e()[n]).or(o).getOrThunk(function(){return qg(e)});var n,e,o}),m=et.from(t.meta).fold(function(){return eh},function(t){return mt(t,"style")?g(oh,t.style):eh});return"color"===t.presets?(o=t.ariaLabel,u=t.value,a=r,{dom:(c=Xp,s=d.getOr(""),f=o.map(function(t){return' title="'+a.translate(t)+'"'}).getOr(""),jp("custom"===u?'<button class="'+c+' tox-swatches__picker-btn"'+f+">"+s+"</button>":"remove"===u?'<div class="'+c+' tox-swatch--remove"'+f+">"+s+"</div>":'<div class="'+c+'" style="background-color: '+u+'" data-mce-color="'+u+'"'+f+"></div>")),optComponents:[]}):uh(t,d,n,m,l)},fh=["input","button","textarea"],lh=function(t,n,e){n.disabled&&vh(t,n,e)},dh=function(t){return T(fh,He(t.element()))},mh=function(t){Xe(t.element(),"disabled","disabled")},gh=function(t){$e(t.element(),"disabled")},ph=function(t){Xe(t.element(),"aria-disabled","true")},hh=function(t){Xe(t.element(),"aria-disabled","false")},vh=function(n,t,e){t.disableClass.each(function(t){cu(n.element(),t)}),(dh(n)?mh:ph)(n)},bh=function(n,t,e){t.disableClass.each(function(t){su(n.element(),t)}),(dh(n)?gh:hh)(n)},yh=function(t){return dh(t)?Ke(t.element(),"disabled"):"true"===qe(t.element(),"aria-disabled")},xh=/* */Object.freeze({enable:bh,disable:vh,isDisabled:yh,onLoad:lh,set:function(t,n,e,o){(o?vh:bh)(t,n,e)}}),wh=/* */Object.freeze({exhibit:function(t,n,e){return qi({classes:n.disabled?n.disableClass.map($).getOr([]):[]})},events:function(t,n){return fi([li(Rn(),function(t,n){return yh(t)}),ia(t,n,lh)])}}),Sh=[Nr("disabled",!1),_r("disableClass")],kh=da({fields:Sh,name:"disabling",active:wh,apis:xh}),Ch=function(t){return kh.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},Oh=function(t){return kh.config({disabled:t})},Th=function(t){return kh.config({disabled:t,disableClass:"tox-tbtn--disabled"})},Eh=function(t,n){var e=t.getApi(n);return function(t){t(e)}},Bh=function(e,o){return ki(function(t){Eh(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},Ah=function(n,e){return Ci(function(t){return Eh(n,t)(e.get())})};(np=tp||(tp={}))[np.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",np[np.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var Dh=tp,_h={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},Mh=function(t){return X(t,function(t){return t.toArray()})},Fh=function(t,n,e){var o,r,i=Ft(tt);return{type:"item",dom:n.dom,components:Mh(n.optComponents),data:t.data,eventOrder:_h,hasSubmenu:t.triggersSubmenu,itemBehaviours:fa([Ag("item-events",[(o=t,r=e,Ti(function(t,n){Eh(o,t)(o.onAction),o.triggersSubmenu||r!==Dh.CLOSE_ON_EXECUTE||(Kr(t,zn()),n.stop())})),Bh(t,i),Ah(t,i)]),Ch(t.disabled),Xm.config({})].concat(t.itemBehaviours))}},Ih=function(t){return{value:t.value,meta:Ct({text:t.text.getOr("")},t.meta)}},Rh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Vh=function(t,n){var e,o=Up.translate(t),r=(e=o,Rh.DOM.encode(e));if(0<n.length){var i=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");return r.replace(i,function(t){return'<span class="tox-autocompleter-highlight">'+t+"</span>"})}return r},Nh=nt(ul("item-widget",Mg())),Hh=fo("cell-over"),Ph=fo("cell-execute"),zh=function(n,e,t){var o,r=function(t){return $r(t,Ph,{row:n,col:e})};return Vu({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:fa([Ag("insert-table-picker-cell",[gi(Xt(),fg.focus),gi(Rn(),r),gi(Hn(),r)]),Sg.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),fg.config({onFocus:function(t){return $r(t,Hh,{row:n,col:e})}})])})};var Lh=function(t){return{value:nt(t)}},jh=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Uh=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Wh=function(t){return jh.test(t)||Uh.test(t)},Gh=function(t){var n,e=(n=t.value().replace(jh,function(t,n,e,o){return n+n+e+e+o+o}),{value:nt(n)}),o=Uh.exec(e.value());return null===o?["FFFFFF","FF","FF","FF"]:o},Xh=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},Yh=function(t){var n=Xh(t.red())+Xh(t.green())+Xh(t.blue());return Lh(n)},qh=Math.min,Kh=Math.max,$h=Math.round,Jh=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,Qh=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Zh=function(t,n,e,o){return{red:nt(t),green:nt(n),blue:nt(e),alpha:nt(o)}},tv=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},nv=function(t){var n,e,o,r=(t.hue()||0)%360,i=t.saturation()/100,u=t.value()/100;if(i=Kh(0,qh(i,1)),u=Kh(0,qh(u,1)),0===i)return n=e=o=$h(255*u),Zh(n,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),f=u-c;switch(Math.floor(a)){case 0:n=c,e=s,o=0;break;case 1:n=s,e=c,o=0;break;case 2:n=0,e=c,o=s;break;case 3:n=0,e=s,o=c;break;case 4:n=s,e=0,o=c;break;case 5:n=c,e=0,o=s;break;default:n=e=o=0}return n=$h(255*(n+f)),e=$h(255*(e+f)),o=$h(255*(o+f)),Zh(n,e,o,1)},ev=function(t){var n=Gh(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return Zh(e,o,r,1)},ov=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return Zh(r,i,u,a)},rv=function(t){return"rgba("+t.red()+","+t.green()+","+t.blue()+","+t.alpha()+")"},iv=nt(Zh(255,0,0,1)),uv=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),av="tinymce-custom-colors";var cv="choiceitem",sv=[{type:cv,text:"Turquoise",value:"#18BC9B"},{type:cv,text:"Green",value:"#2FCC71"},{type:cv,text:"Blue",value:"#3598DB"},{type:cv,text:"Purple",value:"#9B59B6"},{type:cv,text:"Navy Blue",value:"#34495E"},{type:cv,text:"Dark Turquoise",value:"#18A085"},{type:cv,text:"Dark Green",value:"#27AE60"},{type:cv,text:"Medium Blue",value:"#2880B9"},{type:cv,text:"Medium Purple",value:"#8E44AD"},{type:cv,text:"Midnight Blue",value:"#2B3E50"},{type:cv,text:"Yellow",value:"#F1C40F"},{type:cv,text:"Orange",value:"#E67E23"},{type:cv,text:"Red",value:"#E74C3C"},{type:cv,text:"Light Gray",value:"#ECF0F1"},{type:cv,text:"Gray",value:"#95A5A6"},{type:cv,text:"Dark Yellow",value:"#F29D12"},{type:cv,text:"Dark Orange",value:"#D35400"},{type:cv,text:"Dark Red",value:"#C0392B"},{type:cv,text:"Medium Gray",value:"#BDC3C7"},{type:cv,text:"Dark Gray",value:"#7E8C8D"},{type:cv,text:"Black",value:"#000000"},{type:cv,text:"White",value:"#ffffff"}],fv=function lM(n){void 0===n&&(n=10);var t,e=uv.getItem(av),o=P(e)?JSON.parse(e):[],r=n-(t=o).length<0?t.slice(0,n):t,i=function(t){r.splice(t,1)};return{add:function(t){O(r,t).each(i),r.unshift(t),r.length>n&&r.pop(),uv.setItem(av,JSON.stringify(r))},state:function(){return r.slice(0)}}}(10),lv=function(t){var n,e=[];for(n=0;n<t.length;n+=2)e.push({text:t[n+1],value:"#"+t[n],type:"choiceitem"});return e},dv=function(t){return t.getParam("color_map")},mv=function(t,n){return t.getParam("color_cols",n,"number")},gv=function(t){return!1!==t.getParam("custom_colors")},pv=function(t){var n=dv(t);return n!==undefined?lv(n):sv},hv=function(){return D(fv.state(),function(t){return{type:cv,text:t,value:t}})},vv=function(t){fv.add(t)},bv=function(t){return t.fire("SkinLoaded")},yv=function(t){return t.fire("ResizeEditor")},xv=function(t){return t.fire("ResizeContent")},wv=function(t,n){t.fire("TextColorChange",n)},Sv=function(t,e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var n;(n=t.style["forecolor"===e?"color":"background-color"])&&(o=o||n)}),o},kv=function(t){return Math.max(5,Math.ceil(Math.sqrt(t)))},Cv=function(t){var n=pv(t),e=kv(n.length);return mv(t,e)},Ov=function(n,e,t,o){"custom"===t?_v(n)(function(t){t.each(function(t){vv(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},Tv=function(t,n){return t.concat(hv().concat((o={type:e="choiceitem",text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},n?[o,{type:e,text:"Custom color",icon:"color-picker",value:"custom"}]:[o])));var e,o},Ev=function(n,e){return function(t){t(Tv(n,e))}},Bv=function(t,n,e){var o,r;o="forecolor"===n?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color",r=e,t.setIconFill(o,r),t.setIconStroke(o,r)},Av=function(o,e,r,t,i){o.ui.registry.addSplitButton(e,{tooltip:t,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){return et.from(Sv(o,r)).bind(function(t){return function(t){if("transparent"===t)return et.some(Zh(0,0,0,0));var n=Jh.exec(t);if(null!==n)return et.some(ov(n[1],n[2],n[3],"1"));var e=Qh.exec(t);return null!==e?et.some(ov(e[1],e[2],e[3],e[4])):et.none()}(t).map(function(t){var n=Yh(t).value();return Sn(e.toLowerCase(),n)})}).getOr(!1)},columns:Cv(o),fetch:Ev(pv(o),gv(o)),onAction:function(t){null!==i.get()&&Ov(o,r,i.get(),function(){})},onItemAction:function(t,n){Ov(o,r,n,function(t){i.set(t),wv(o,{name:e,color:t})})},onSetup:function(n){null!==i.get()&&Bv(n,e,i.get());var t=function(t){t.name===e&&Bv(n,t.name,t.color)};return o.on("TextColorChange",t),function(){o.off("TextColorChange",t)}}})},Dv=function(n,t,e,o){n.ui.registry.addNestedMenuItem(t,{text:o,icon:"forecolor"===t?"text-color":"highlight-bg-color",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"colorswatch",onAction:function(t){Ov(n,e,t.value,tt)}}]}})},_v=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(et.from(n.colorpicker)),t.close()});i.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onAction:function(t,n){"hex-valid"===n.name&&(n.value?t.enable("ok"):t.disable("ok"))},onSubmit:r,onClose:function(){},onCancel:function(){t(et.none())}})}},Mv={register:function(t){var i;(i=t).addCommand("mceApplyTextcolor",function(t,n){var e,o,r;o=t,r=n,(e=i).undoManager.transact(function(){e.focus(),e.formatter.apply(o,{value:r}),e.nodeChanged()})}),i.addCommand("mceRemoveTextcolor",function(t){var n,e;e=t,(n=i).undoManager.transact(function(){n.focus(),n.formatter.remove(e,{value:null},null,!0),n.nodeChanged()})});var n=Ft(null),e=Ft(null);Av(t,"forecolor","forecolor","Text color",n),Av(t,"backcolor","hilitecolor","Background color",e),Dv(t,"forecolor","forecolor","Text color"),Dv(t,"backcolor","hilitecolor","Background color")},getColors:Tv,getFetch:Ev,colorPickerDialog:_v,getCurrentColor:Sv,getColorCols:Cv,calcCols:kv},Fv=function(e,o){return function(t){var n=A(t,o);return D(n,function(t){return{dom:e,components:t}})}},Iv=function(n,i,t){return void 0===t&&(t=!0),{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:["tox-collection--grid"])},components:[Hg.parts().items({preprocess:function(t){return"auto"!==n&&1<n?Fv({tag:"div",classes:["tox-collection__group"]},n)(t):(e=function(t,n){return"separator"===i[n].type},o=[],r=[],j(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],mt(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),D(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}));var e,o,r}})]}},Rv=function(t){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:(n=t,"color"===n?"tox-swatches":"tox-menu"),tieredMenu:"tox-tiered-menu"};var n},Vv=function(t){var n=Rv(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:Qp(t)}},Nv=[Hg.parts().items({})],Hv=function(t,n,e){var o=Rv(e);return{dom:{tag:"div",classes:G([[o.tieredMenu]])},markers:Vv(e)}},Pv=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},zv=function(t){return H.console.error(gr(t)),H.console.log(t),et.none()},Lv=function(t,n,e,o,r){var i,u,a,c,s,f,l;return"color"===r?{value:t,dom:(l=(i=o,{dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[Hg.parts().items({preprocess:"auto"!==i?Fv({tag:"div",classes:["tox-swatches__row"]},i):d})]}]})).dom,components:l.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(l=Iv(o,e)).dom,components:l.components,items:e}:"normal"===r&&1===o?{value:t,dom:(l=Iv(1,e)).dom,components:l.components,items:e}:"normal"===r?{value:t,dom:(l=Iv(o,e)).dom,components:l.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=r,f=Rv(s),{tag:"div",classes:G([[f.menu,"tox-menu-"+c+"-column"],a?[f.hasIcons]:[]])}),components:Nv,items:e}:{value:t,dom:(l=(u=o,{dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[Hg.parts().items({preprocess:Fv({tag:"div",classes:["tox-collection__group"]},u)})]})).dom,components:l.components,items:e}},jv=function(t,n,e,o,r,i,u,a){var c=E(n,Pv),s=Uv(n,e,o,"color"!==r?"normal":"color",i,u,a);return Lv(t,c,s,o,r)},Uv=function(t,f,l,d,m,g,p){return It(D(t,function(s){return"choiceitem"===s.type?(t=s,lr("choicemenuitem",Bp,t)).fold(zv,function(t){return et.some((n=t,e=1===l,o=d,r=f,i=g(s.value),u=m,a=p,c=sh({presets:o,textContent:e?n.text:et.none(),htmlContent:et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:e?n.shortcut:et.none(),checkMark:e?et.some(ih(a.icons)):et.none(),caret:et.none(),value:n.value},a,!0),kt(Fh({data:Ih(n),disabled:n.disabled,getApi:function(n){return{setActive:function(t){Sg.set(n,t)},isActive:function(){return Sg.isOn(n)},isDisabled:function(){return kh.isDisabled(n)},setDisabled:function(t){return kh.set(n,t)}}},onAction:function(t){return r(n.value)},onSetup:function(t){return t.setActive(i),function(){}},triggersSubmenu:!1,itemBehaviours:[]},c,u),{toggling:{toggleClass:qp,toggleOnExecute:!1,selected:n.active}})));var n,e,o,r,i,u,a,c}):et.none();var t}))},Wv=function(t,n){var e=Vv(n);return 1===t?{mode:"menu",moveOnTab:!0}:"auto"===t?{mode:"grid",selector:"."+e.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===n?"tox-swatches__row":"tox-collection__group")}};var Gv,Xv,Yv={inserttable:function dM(o){var t,n=fo("size-label"),a=function(t,n,e){for(var o=[],r=0;r<n;r++){for(var i=[],u=0;u<e;u++)i.push(zh(r,u,t));o.push(i)}return o}(n,10,10),c=Yg({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[Fu("0x0")],behaviours:fa([Xm.config({})])});return{type:"widget",data:{value:fo("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Nh().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:(t=a,X(t,function(t){return D(t,Nu)})).concat(c.asSpec()),behaviours:fa([Ag("insert-table-picker",[yi(Hh,function(t,n,e){var o,r,i=e.event().row(),u=e.event().col();!function(t,n,e,o,r){for(var i=0;i<o;i++)for(var u=0;u<r;u++)Sg.set(t[i][u],i<=n&&u<=e)}(a,i,u,10,10),Xm.set(c.get(t),[(o=i,r=u,Fu(r+1+"x"+(o+1)))])}),yi(Ph,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),Kr(t,zn())})]),Lm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:function mM(n,t){var e=Mv.getColors(t.colorinput.getColors(),t.colorinput.hasCustomColors()),o=t.colorinput.getColorCols(),r=jv(fo("menu-value"),e,function(t){n.onAction({value:t})},o,"color",Dh.CLOSE_ON_EXECUTE,function(){return!1},t.shared.providers),i=kt(mo({},r,{markers:Vv("color"),movement:Wv(o,"color")}));return{type:"widget",data:{value:fo("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Nh().widget(Hg.sketch(i))]}}},qv=function(n,e,t,o,r,i,u,a){void 0===a&&(a=!0);var c,s,f=sh({presets:o,textContent:et.none(),htmlContent:t?n.text.map(function(t){return Vh(t,e)}):et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:et.none(),checkMark:et.none(),caret:et.none(),value:n.value},u.providers,a,n.icon);return Fh({data:Ih(n),disabled:n.disabled,getApi:function(){return{}},onAction:function(t){return r(n.value,n.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:(c=n.meta,s=u,dt(c,"tooltipWorker").map(function(e){return[Lp.config({lazySink:s.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t,overrides:{maxHeightFunction:fc}}},mode:"follow-highlight",onShow:function(n,t){e(function(t){Lp.setComponents(n,[Iu({element:ne.fromDom(t)})])})}})]}).getOr([]))},f,i)},Kv=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:mo({tag:"div",classes:[Gp,"tox-collection__group-heading"]},n),components:[]}},$v=function(t,n,e,o){void 0===o&&(o=!0);var r=sh({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.none(),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return Fh({data:Ih(t),getApi:function(n){return{isDisabled:function(){return kh.isDisabled(n)},setDisabled:function(t){return kh.set(n,t)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n)},Jv=function(t,n,e,o){void 0===o&&(o=!0);var r,i=(r=e.icons,{dom:{tag:"div",classes:["tox-collection__item-caret"],innerHtml:Kg("chevron-right",r)}}),u=sh({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.some(i),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return Fh({data:Ih(t),getApi:function(n){return{isDisabled:function(){return kh.isDisabled(n)},setDisabled:function(t){return kh.set(n,t)}}},disabled:t.disabled,onAction:tt,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},u,n)},Qv=function(t,n,e){var o=sh({iconContent:et.none(),textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,checkMark:et.some(ih(e.icons)),caret:et.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,!0);return kt(Fh({data:Ih(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){Sg.set(n,t)},isActive:function(){return Sg.isOn(n)},isDisabled:function(){return kh.isDisabled(n)},setDisabled:function(t){return kh.set(n,t)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,n),{toggling:{toggleClass:qp,toggleOnExecute:!1,selected:t.active}})},Zv=function(n,e){return(t=Yv,o=n.fancytype,Object.prototype.hasOwnProperty.call(t,o)?et.some(t[o]):et.none()).map(function(t){return t(n,e)});var t,o};(Xv=Gv||(Gv={}))[Xv.ContentFocus=0]="ContentFocus",Xv[Xv.UiFocus=1]="UiFocus";var tb=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},nb=function(t){return E(t,tb)},eb=function(t,n,e,o){void 0===o&&(o=!0);var r,i,u,a,c,s=e.shared.providers;switch(t.type){case"menuitem":return(c=t,lr("menuitem",Op,c)).fold(zv,function(t){return et.some($v(t,n,s,o))});case"nestedmenuitem":return(a=t,lr("nestedmenuitem",Tp,a)).fold(zv,function(t){return et.some(Jv(t,n,s,o))});case"togglemenuitem":return(u=t,lr("togglemenuitem",Ep,u)).fold(zv,function(t){return et.some(Qv(t,n,s))});case"separator":return(i=t,lr("separatormenuitem",Ap,i)).fold(zv,function(t){return et.some(Kv(t))});case"fancymenuitem":return(r=t,lr("fancymenuitem",Dp,r)).fold(zv,function(t){return Zv(t,e)});default:return H.console.error("Unknown item in general menu",t),et.none()}},ob=function(t,e,o,n,r,i){var u=1===n,a=!u||nb(t);return It(D(t,function(t){return(n=t,lr("Autocompleter.Item",wp,n)).fold(zv,function(t){return et.some(qv(t,e,u,"normal",o,r,i,a))});var n}))},rb=function(t,n,e,o){var r=nb(n),i=It(D(n,function(t){var n=function(t){return eb(t,e,o,r)};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(Ct(t,{disabled:!0})):n(t)}));return Lv(t,r,i,1,"normal")},ib=function(t){return Ug.singleData(t.value,t)},ub=function(d,c){var e=Ft(et.none()),m=Vu(Wg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:fa([Ag("dismissAutocompleter",[gi(Yn(),function(){return f()})])]),lazySink:c.getSink})),o=function(){return e.get().isSome()},s=function(){o()&&Wg.hide(m)},f=function(){if(o()){var t=e.get().map(function(t){return t.element});sp(t.getOr(ne.fromDom(d.selection.getNode()))).each(Re),s(),e.set(et.none())}},n=en(function(){return kp(d)}),l=function(t,n,e,o){t.matchLength=n.text.length;var r,i,u,a,c,s,f,l=Rt(e,function(t){return et.from(t.columns)}).getOr(1);Wg.showAt(m,{anchor:"node",root:ne.fromDom(d.getBody()),node:et.from(t.element)},Hg.sketch((r=Lv("autocompleter-value",!0,o,l,"normal"),i=l,u=Gv.ContentFocus,a="normal",c=u===Gv.ContentFocus?ld():fd(),s=Wv(i,a),f=Vv(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:f.selectedItem,item:f.item},movement:s,fakeFocus:u===Gv.ContentFocus,focusManager:c,menuBehaviours:Fp("auto"!==i?[]:[ki(function(o,t){_p(o,4,f.item).each(function(t){var n=t.numColumns,e=t.numRows;Lm.setGridSize(o,e,n)})})])}))),Wg.getContent(m).each(ql.highlightFirst)},t=ep(function(t){27!==t.which&&e.get().map(function(t){return mp(d.dom,d.selection.getRng(),t.triggerChar).bind(function(t){return xp(d,n,t)})}).getOrThunk(function(){return yp(d,n)}).fold(f,function(a){!function(t){if(!o()){var n=cp(d,t.range);e.set(et.some({triggerChar:t.triggerChar,element:n,matchLength:t.text.length}))}}(a.context),a.lookupData.then(function(u){e.get().map(function(t){var n,e,o,r=a.context;if(t.triggerChar===r.triggerChar){var i=(n=r.triggerChar,o=Rt(e=u,function(t){return et.from(t.columns)}).getOr(1),X(e,function(i){var t=i.items;return ob(t,i.matchText,function(o,r){var t=d.selection.getRng();mp(d.dom,t,n).fold(function(){return H.console.error("Lost context. Cursor probably moved")},function(t){var n=t.range,e={hide:f};i.onAction(e,n,o,r)})},o,Dh.BUBBLE_TO_SANDBOX,c)}));0<i.length?l(t,r,u,i):10<=r.text.length-t.matchLength?f():s()}})})})},50);gp({onKeypress:t,cancelIfNecessary:f,isMenuOpen:function(){return Wg.isOpen(m)},isActive:o,getView:function(){return Wg.getContent(m)}},d)},ab=function(m,g){return function(t){if(m(t)){var n,e,o,r,i,u,a,c=ne.fromDom(t.target),s=function(){t.stopPropagation()},f=function(){t.preventDefault()},l=p(f,s),d=(n=c,e=t.clientX,o=t.clientY,r=s,i=f,u=l,a=t,{target:nt(n),x:nt(e),y:nt(o),stop:r,prevent:i,kill:u,raw:nt(a)});g(d)}}},cb=function(t,n,e,o,r){var i=ab(e,o);return t.dom().addEventListener(n,i,r),{unbind:g(sb,t,n,i,r)}},sb=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},fb=nt(!0),lb=function(t,n,e){return cb(t,n,fb,e,!1)},db=function(t,n,e){return cb(t,n,fb,e,!0)},mb=function(t,n,e){return Lu(t,n,e).isSome()};function gb(e,o){var r=null;return{cancel:function(){null!==r&&(H.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=H.setTimeout(function(){e.apply(null,t),r=null},o)}}}var pb=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?et.none():et.some(n.touches[0])},hb=function(e){var u=Ft(et.none()),o=gb(function(t){u.set(et.none()),e.triggerEvent(Pn(),t)},400),r=Dt([{key:Pt(),value:function(e){return pb(e).each(function(t){o.cancel();var n={x:nt(t.clientX),y:nt(t.clientY),target:e.target};o.schedule(e),u.set(et.some(n))}),et.none()}},{key:zt(),value:function(t){return o.cancel(),pb(t).each(function(i){u.get().each(function(t){var n,e,o,r;n=i,e=t,o=Math.abs(n.clientX-e.x()),r=Math.abs(n.clientY-e.y()),(5<o||5<r)&&u.set(et.none())})}),et.none()}},{key:Lt(),value:function(n){o.cancel();return u.get().filter(function(t){return we(t.target(),n.target())}).map(function(t){return e.triggerEvent(Nn(),n)})}}]);return{fireIfReady:function(n,t){return Bt(r,t).bind(function(t){return t(n)})}}},vb=An.detect().browser.isFirefox(),bb=Ko([Er("triggerEvent"),Nr("stopBackspace",!0)]),yb=function(n,t){var e,o,r,i,u=mr("Getting GUI events settings",bb,t),a=An.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=hb(u),s=D(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return lb(n,t,function(n){c.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),f=Ft(et.none()),l=lb(n,"paste",function(n){c.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),f.set(et.some(H.setTimeout(function(){u.triggerEvent(Fn(),n)},0)))}),d=lb(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||(8!==(n=t).raw().which||T(["input","textarea"],He(n.target()))||mb(n.target(),'[contenteditable="true"]'))||t.prevent()}),m=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},vb?db(e,"focus",o):lb(e,"focusin",o)),g=Ft(et.none()),p=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),g.set(et.some(H.setTimeout(function(){u.triggerEvent(Mn(),t)},0)))},vb?db(r,"blur",i):lb(r,"focusout",i));return{unbind:function(){j(s,function(t){t.unbind()}),d.unbind(),m.unbind(),p.unbind(),l.unbind(),f.get().each(H.clearTimeout),g.get().each(H.clearTimeout)}}},xb=function(t,n){var e=Bt(t,"target").map(function(t){return t()}).getOr(n);return Ft(e)},wb=xt([{stopped:[]},{resume:["element"]},{complete:[]}]),Sb=function(t,o,n,e,r,i){var u,a,c,s,f=t(o,e),l=(u=n,a=r,c=Ft(!1),s=Ft(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:nt(u),setSource:a.set,getSource:a.get});return f.fold(function(){return i.logEventNoHandlers(o,e),wb.complete()},function(n){var e=n.descHandler();return $i(e)(l),l.isStopped()?(i.logEventStopped(o,n.element(),e.purpose()),wb.stopped()):l.isCut()?(i.logEventCut(o,n.element(),e.purpose()),wb.complete()):Ce(n.element()).fold(function(){return i.logNoParent(o,n.element(),e.purpose()),wb.complete()},function(t){return i.logEventResponse(o,n.element(),e.purpose()),wb.resume(t)})})},kb=function(n,e,o,t,r,i){return Sb(n,e,o,t,r,i).fold(function(){return!0},function(t){return kb(n,e,o,t,r,i)},function(){return!1})},Cb=function(t,n,e){var o,r,i=(o=n,r=Ft(!1),{stop:function(){r.set(!0)},cut:tt,isStopped:r.get,isCut:nt(!1),event:nt(o),setSource:u("Cannot set source of a broadcasted event"),getSource:u("Cannot get source of a broadcasted event")});return j(t,function(t){var n=t.descHandler();$i(n)(i)}),i.isStopped()},Ob=function(t,n,e,o,r){var i=xb(e,o);return kb(t,n,e,o,i,r)},Tb=ee("element","descHandler"),Eb=function(t,n){return{id:nt(t),descHandler:nt(n)}};function Bb(){var i={};return{registerId:function(o,r,t){ut(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=Ki(t,o),i[n]=e})},unregisterId:function(e){ut(i,function(t,n){t.hasOwnProperty(e)&&delete t[e]})},filterByType:function(t){return Bt(i,t).map(function(t){return st(t,function(t,n){return Eb(n,t)})}).getOr([])},find:function(t,n,e){var r=Tt(n)(i);return si(e,function(t){return e=r,Ii(o=t).fold(function(){return et.none()},function(t){var n=Tt(t);return e.bind(n).map(function(t){return Tb(o,t)})});var e,o},t)}}}function Ab(){var o=Bb(),r={},i=function(o){var t=o.element();return Ii(t).fold(function(){return t="uid-",n=o.element(),e=fo(_i+t),Fi(n,e),e;var t,n,e},function(t){return t})},u=function(t){Ii(t.element()).each(function(t){delete r[t],o.unregisterId(t)})};return{find:function(t,n,e){return o.find(t,n,e)},filter:function(t){return o.filterByType(t)},register:function(t){var n=i(t);Mt(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+Ze(e.element())+"\nCannot use it for: "+Ze(t.element())+"\nThe conflicting element is"+(oi(e.element())?" ":" not ")+"already in the DOM");u(t)}(t,n);var e=[t];o.registerId(e,n,t.events()),r[n]=t},unregister:u,getById:function(t){return Tt(t)(r)}}}var Db,_b,Mb=Dl({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=go(n,["attributes"]);return{uid:t.uid,dom:mo({tag:"div",attributes:mo({role:"presentation"},e)},o),components:t.components,behaviours:Tf(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[Nr("components",[]),Of("containerBehaviours",[]),Nr("events",{}),Nr("domModification",{}),Nr("eventOrder",{})]}),Fb=function(e){var o=function(n){return Ce(e.element()).fold(function(){return!0},function(t){return we(n,t)})},r=Ab(),s=function(t,n){return r.find(o,t,n)},t=yb(e.element(),{triggerEvent:function(u,a){return io(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),Ob(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:nt("real"),triggerEvent:function(n,e,o){io(n,e,function(t){Ob(s,n,o,e,t)})},triggerFocus:function(a,c){Ii(a).fold(function(){ud(a)},function(t){io(_n(),a,function(t){var n,e,o,r,i,u;n=s,e=_n(),o={originator:nt(c),kill:tt,prevent:tt,target:nt(a)},i=t,u=xb(o,r=a),Sb(n,e,o,r,u,i)})})},triggerEscape:function(t,n){i.triggerEvent("keydown",t.element(),n.event())},getByUid:function(t){return g(t)},getByDom:function(t){return p(t)},build:Vu,addToGui:function(t){a(t)},removeFromGui:function(t){c(t)},addToWorld:function(t){n(t)},removeFromWorld:function(t){u(t)},broadcast:function(t){l(t)},broadcastOn:function(t,n){d(t,n)},broadcastEvent:function(t,n){m(t,n)},isConnected:nt(!0)},n=function(t){t.connect(i),je(t.element())||(r.register(t),j(t.components(),n),i.triggerEvent(jn(),t.element(),{target:nt(t.element())}))},u=function(t){je(t.element())||(j(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){Zs(e,t)},c=function(t){ef(t)},f=function(e){var t=r.filter(In());j(t,function(t){var n=t.descHandler();$i(n)(e)})},l=function(t){f({universal:nt(!0),data:nt(t)})},d=function(t,n){f({universal:nt(!1),channels:nt(t),data:nt(n)})},m=function(t,n){var e=r.filter(t);return Cb(e,n)},g=function(t){return r.getById(t).fold(function(){return yt.error(new Error('Could not find component with uid: "'+t+'" in system.'))},yt.value)},p=function(t){var n=Ii(t).getOr("not found");return g(n)};return n(e),{root:nt(e),element:e.element,destroy:function(){t.unbind(),Ie(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},Ib=tinymce.util.Tools.resolve("tinymce.EditorManager"),Rb=function(t){return et.from(t.settings.min_width).filter(L)},Vb=function(t){return et.from(t.settings.min_height).filter(L)},Nb=function(n){var t=rt(n.settings),e=F(t,function(t){return/^toolbar([1-9])$/.test(t)}),o=D(e,function(t){return n.getParam(t,!1,"string")}),r=F(o,function(t){return"string"==typeof t});return 0<r.length?et.some(r):et.none()},Hb=function(t){return Nb(t).fold(function(){return 0<t.getParam("toolbar",[],"string[]").length},function(){return!0})};(_b=Db||(Db={}))["default"]="",_b.floating="floating",_b.sliding="sliding";var Pb,zb,Lb=function(t){return t.getParam("toolbar_drawer","","string")},jb=function(t){var n=t.getParam("fixed_toolbar_container","","string"),e=t.getParam("inline",!1,"boolean");return 0<n.length&&e?zu(ri(),n):et.none()},Ub=function(t){return t.getParam("inline",!1,"boolean")&&jb(t).isSome()},Wb=fo("form-component-change"),Gb=fo("form-close"),Xb=fo("form-cancel"),Yb=fo("form-action"),qb=fo("form-submit"),Kb=fo("form-block"),$b=fo("form-unblock"),Jb=fo("form-tabchange"),Qb=fo("form-resize"),Zb=nt([Nr("prefix","form-field"),Of("fieldBehaviours",[Rl,ig])]),ty=nt([nl({schema:[kr("dom")],name:"label"}),nl({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[kr("text")],name:"aria-descriptor"}),Zf({factory:{sketch:function(t){var n=Ot(t,["factory"]);return t.factory.sketch(n)}},schema:[kr("factory")],name:"field"})]),ny=_l({name:"FormField",configFields:Zb(),partFields:ty(),factory:function(r,t,n,e){var o=Ef(r.fieldBehaviours,[Rl.config({find:function(t){return ml(t,r,"field")}}),ig.config({store:{mode:"manual",getValue:function(t){return Rl.getCurrent(t).bind(ig.getValue)},setValue:function(t,n){Rl.getCurrent(t).each(function(t){ig.setValue(t,n)})}}})]),i=fi([ki(function(t,n){var o=pl(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=fo(r.prefix);o.label().each(function(t){Xe(t.element(),"for",n),Xe(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=fo(r.prefix);Xe(t.element(),"id",n),Xe(e.element(),"aria-describedby",n)})})})]),u={getField:function(t){return ml(t,r,"field")},getLabel:function(t){return ml(t,r,"label")}};return{uid:r.uid,dom:r.dom,components:t,behaviours:o,events:i,apis:u}},apis:{getField:function(t,n){return t.getField(n)},getLabel:function(t,n){return t.getLabel(n)}}}),ey=/* */Object.freeze({getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),oy=[Cr("others",sr(yt.value,hr()))],ry=da({fields:oy,name:"coupling",apis:ey,state:/* */Object.freeze({init:function(t){var i={},n=nt({});return Xi({readState:n,getOrCreate:function(e,o,r){var t=rt(o.others);if(t)return Bt(i,r).getOrThunk(function(){var t=Bt(o.others,r).getOrDie("No information found for coupled component: "+r)(e),n=e.getSystem().build(t);return i[r]=n});throw new Error("Cannot find coupled component: "+r+". Known coupled components: "+Lo(t,null,2))}})}})}),iy=/* */Object.freeze({events:function(t,n){var e=t.stream.streams.setup(t,n);return fi([gi(t.event,e),Ci(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[gi(t,function(){return n.cancel()})]}).getOr([])))}}),uy=function(t){var n=Ft(null);return Xi({readState:function(){return{timer:null!==n.get()?"set":"unset"}},setTimer:function(t){n.set(t)},cancel:function(){var t=n.get();null!==t&&t.cancel()}})},ay=/* */Object.freeze({throttle:uy,init:function(t){return t.stream.streams.state(t)}}),cy=[Cr("stream",pr("mode",{throttle:[kr("delay"),Nr("stopEvent",!0),ea("streams",{setup:function(t,n){var e=t.stream,o=ep(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:uy})]})),Nr("event","input"),_r("cancelEvent"),ta("onStream")],sy=da({fields:cy,name:"streaming",active:iy,state:ay}),fy=function(t){var e=et.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){j(t,u)},u=function(n){e.each(function(t){H.setTimeout(function(){n(t)},0)})};return t(function(t){e=et.some(t),i(n),n=[]}),{get:o,map:function(e){return fy(function(n){o(function(t){n(e(t))})})},isReady:r}},ly={nu:fy,pure:function(n){return fy(function(t){t(n)})}},dy=function(n){var t=function(t){var o;n((o=t,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=this;H.setTimeout(function(){o.apply(e,t)},0)}))},e=function(){return ly.nu(t)};return{map:function(o){return dy(function(e){t(function(t){var n=o(t);e(n)})})},bind:function(e){return dy(function(n){t(function(t){e(t).get(n)})})},anonBind:function(e){return dy(function(n){t(function(t){e.get(n)})})},toLazy:e,toCached:function(){var n=null;return dy(function(t){null===n&&(n=e()),n.get(t)})},get:t}},my={nu:dy,pure:function(n){return dy(function(t){t(n)})}},gy=nt("sink"),py=nt(nl({name:gy(),overrides:nt({dom:{tag:"div"},behaviours:fa([$s.config({useFixed:!0})]),events:fi([xi(Kt()),xi(jt()),xi(Zt())])})}));(zb=Pb||(Pb={}))[zb.HighlightFirst=0]="HighlightFirst",zb[zb.HighlightNone=1]="HighlightNone";var hy=function(t,n){var e=t.getHotspot(n).getOr(n),o=t.getAnchorOverrides();return t.layouts.fold(function(){return{anchor:"hotspot",hotspot:e,overrides:o}},function(t){return{anchor:"hotspot",hotspot:e,overrides:o,layouts:t}})},vy=function(t,n,e,o,r,i,u){var a,c,s,f,l,d,m,g,p,h,v=hy(t,e);return(c=v,f=o,l=r,d=u,m=n,g=s=e,p=(0,(a=t).fetch)(g).map(m),h=wy(s,a),p.map(function(t){return t.bind(function(t){return et.from(Ug.sketch(mo({},l.menu(),{uid:Ri(""),data:t,highlightImmediately:d===Pb.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();$s.position(e,c,n),yf.decloak(f)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();$s.position(o,{anchor:"submenu",item:n},e),yf.decloak(f)},onEscape:function(){return fg.focus(s),yf.close(f),et.some(!0)}})))})})).map(function(t){return t.fold(function(){yf.isOpen(o)&&yf.close(o)},function(t){yf.cloak(o),yf.open(o,t),i(o)}),o})},by=function(t,n,e,o,r,i,u){return yf.close(o),my.pure(o)},yy=function(t,n,e,o,r,i){var u=ry.getCoupled(e,"sandbox");return(yf.isOpen(u)?by:vy)(t,n,e,u,o,r,i)},xy=function(t,n,e){var o,r,i=Rl.getCurrent(n).getOr(n),u=Ba(t.element());e?hu(i.element(),"min-width",u+"px"):(o=i.element(),r=u,Ea.set(o,r))},wy=function(n,t){return n.getSystem().getByUid(t.uid+"-"+gy()).map(function(t){return function(){return yt.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return yt.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},Sy=function(o,r,i){var u=ju(),t=wy(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id(),role:"listbox"}},behaviours:Bf.augment(o.sandboxBehaviours,[ig.config({store:{mode:"memory",initialValue:r}}),yf.config({onOpen:function(t,n){var e=hy(o,r);u.link(r.element()),o.matchWidth&&xy(e.hotspot,n,o.useMinWidth),o.onOpen(e,t,n),i!==undefined&&i.onOpen!==undefined&&i.onOpen(t,n)},onClose:function(t,n){u.unlink(r.element()),i!==undefined&&i.onClose!==undefined&&i.onClose(t,n)},isPartOf:function(t,n,e){return Wu(n,e)||Wu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),Rl.config({find:function(t){return yf.getState(t).bind(function(t){return Rl.getCurrent(t)})}}),kf({isExtraPart:nt(!1)})])}},ky=function(t,n,e){var o=ig.getValue(e);ig.setValue(n,o),Oy(n)},Cy=function(t,n){var e=t.element(),o=Ou(e),r=e.dom();"number"!==qe(e,"type")&&n(r,o)},Oy=function(t){Cy(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},Ty=function(t,n,o){if(t.selectsOver){var e=ig.getValue(n),r=t.getDisplayText(e),i=ig.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?et.some(function(){var t,e;ky(0,n,o),t=n,e=r.length,Cy(t,function(t,n){return t.setSelectionRange(e,n.length)})}):et.none()}return et.none()},Ey=nt([_r("data"),Nr("inputAttributes",{}),Nr("inputStyles",{}),Nr("tag","input"),Nr("inputClasses",[]),Qu("onSetValue"),Nr("styles",{}),Nr("eventOrder",{}),Of("inputBehaviours",[ig,fg]),Nr("selectOnFocus",!0)]),By=function(t){return fa([fg.config({onFocus:!1===t.selectOnFocus?tt:function(t){var n=t.element(),e=Ou(n);n.dom().setSelectionRange(0,e.length)}})])},Ay=function(t){return{tag:t.tag,attributes:mo({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},Dy=nt("alloy.typeahead.itemexecute"),_y=function(){return[Nr("sandboxClasses",[]),Bf.field("sandboxBehaviours",[Rl,ba,yf,ig])]},My=nt([_r("lazySink"),kr("fetch"),Nr("minChars",5),Nr("responseTime",1e3),Qu("onOpen"),Nr("getHotspot",et.some),Nr("getAnchorOverrides",nt({})),Nr("layouts",et.none()),Nr("eventOrder",{}),Wr("model",{},[Nr("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),Nr("selectsOver",!0),Nr("populateFromBrowse",!0)]),Qu("onSetValue"),Zu("onExecute"),Qu("onItemExecute"),Nr("inputClasses",[]),Nr("inputAttributes",{}),Nr("inputStyles",{}),Nr("matchWidth",!0),Nr("useMinWidth",!1),Nr("dismissOnBlur",!0),$u(["openClass"]),_r("initialData"),Of("typeaheadBehaviours",[fg,ig,sy,Lm,Sg,ry]),Gr("previewing",function(){return Ft(!0)})].concat(Ey()).concat(_y())),Fy=nt([tl({schema:[Ku()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){Ty(o.model,t,e).fold(function(){return ql.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&ky(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return $r(t,Dy(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&ky(o.model,t,n)})}}}})]),Iy=_l({name:"Typeahead",configFields:My(),partFields:Fy(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=ry.getCoupled(t,"sandbox");yf.isOpen(o)?Rl.getCurrent(o).each(function(t){ql.getHighlighted(t).fold(function(){e(t)},function(){ti(o,t.element(),"keydown",n)})}):vy(r,u(t),t,o,i,function(t){Rl.getCurrent(t).each(e)},Pb.HighlightFirst).get(tt)},o=By(r),u=function(o){return function(t){return t.map(function(t){var n=lt(t.menus),e=X(n,function(t){return F(t.items,function(t){return"item"===t.type})});return ig.getState(o).update(D(e,function(t){return t.data})),t})}},a=[fg.config({}),ig.config({onSetValue:r.onSetValue,store:mo({mode:"dataset",getDataKey:function(t){return Ou(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){Tu(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return At("initialValue",t)}).getOr({}))}),sy.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t,n){var e=ry.getCoupled(t,"sandbox");if(fg.isFocused(t)&&Ou(t.element()).length>=r.minChars){var o=Rl.getCurrent(e).bind(function(t){return ql.getHighlighted(t).map(ig.getValue)});r.previewing.set(!0),vy(r,u(t),t,e,i,function(t){Rl.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&ql.highlightFirst(t)},function(n){ql.highlightBy(t,function(t){return ig.getValue(t).value===n.value}),ql.getHighlighted(t).orThunk(function(){return ql.highlightFirst(t),et.none()})})})},Pb.HighlightFirst).get(tt)}},cancelEvent:Ln()}),Lm.config({mode:"special",onDown:function(t,n){return e(t,n,ql.highlightFirst),et.some(!0)},onEscape:function(t){var n=ry.getCoupled(t,"sandbox");return yf.isOpen(n)?(yf.close(n),et.some(!0)):et.none()},onUp:function(t,n){return e(t,n,ql.highlightLast),et.some(!0)},onEnter:function(n){var t=ry.getCoupled(n,"sandbox"),e=yf.isOpen(t);if(e&&!r.previewing.get())return Rl.getCurrent(t).bind(function(t){return ql.getHighlighted(t)}).map(function(t){return $r(n,Dy(),{item:t}),!0});var o=ig.getValue(n);return Kr(n,Ln()),r.onExecute(t,n,o),e&&yf.close(t),et.some(!0)}}),Sg.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),ry.config({others:{sandbox:function(t){return Sy(r,t,{onOpen:function(){return Sg.on(t)},onClose:function(){return Sg.off(t)}})}}}),Ag("typeaheadevents",[Ti(function(t){var n=tt;yy(r,u(t),t,i,n,Pb.HighlightFirst).get(tt)}),gi(Dy(),function(t,n){var e=ry.getCoupled(t,"sandbox");ky(r.model,t,n.event().item()),Kr(t,Ln()),r.onItemExecute(t,e,n.event().item(),ig.getValue(t)),yf.close(e),Oy(t)})].concat(r.dismissOnBlur?[gi(Mn(),function(t){var n=ry.getCoupled(t,"sandbox");cd(n.element()).isNone()&&yf.close(n)})]:[]))];return{uid:r.uid,dom:Ay(kt(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:mo({},o,Ef(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),Ry=function(t,n,e){var o=Ny(t,n,e);return ny.sketch(o)},Vy=function(t,n){return Ry(t,n,[])},Ny=function(t,n,e){return{dom:Hy(e),components:t.toArray().concat([n])}},Hy=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},Py=function(t,n){return ny.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},zy=function(t){return"separator"===t.type},Ly={type:"separator"},jy=function(t,e){var n=R(t,function(t,n){return P(n)?""===n?t:"|"===n?0<t.length&&!zy(t[t.length-1])?t.concat([Ly]):t:mt(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&zy(n[n.length-1])&&n.pop(),n},Uy=function(t,n){return mt(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=Wy(r,o),{item:e,menus:kt(i.menus,At(e.value,i.items)),expansions:kt(i.expansions,At(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},Wy=function(t,r){var n=jy(P(t)?t.split(" "):t,r);return I(n,function(t,n){var e=function(t){if(zy(t))return t;var n=Bt(t,"value").getOrThunk(function(){return fo("generated-menu-item")});return kt({value:n},t)}(n),o=Uy(e,r);return{menus:kt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:kt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},Gy=function(t,e,o){var n=fo("primary-menu"),r=Wy(t,o.shared.providers.menuItems());if(0===r.items.length)return et.none();var i=rb(n,r.items,e,o),u=at(r.menus,function(t,n){return rb(n,t,e,o)}),a=kt(u,At(n,i));return et.from(Ug.tieredData(n,a,r.expansions))},Xy=Dl({name:"Input",configFields:Ey(),factory:function(t,n){return{uid:t.uid,dom:Ay(t),components:[],behaviours:(e=t,mo({},By(e),Ef(e.inputBehaviours,[ig.config({store:{mode:"manual",initialValue:e.data.getOr(undefined),getValue:function(t){return Ou(t.element())},setValue:function(t,n){Ou(t.element())!==n&&Tu(t.element(),n)}},onSetValue:e.onSetValue})]))),eventOrder:t.eventOrder};var e}}),Yy=["input","textarea"],qy=function(t){var n=He(t);return T(Yy,n)},Ky=function(t,n){var e=n.getRoot(t).getOr(t.element());su(e,n.invalidClass),n.notify.each(function(n){qy(t.element())&&Xe(t.element(),"aria-invalid",!1),n.getContainer(t).each(function(t){Ne(t,n.validHtml)}),n.onValid(t)})},$y=function(n,t,e,o){var r=t.getRoot(n).getOr(n.element());cu(r,t.invalidClass),t.notify.each(function(t){qy(n.element())&&Xe(n.element(),"aria-invalid",!0),t.getContainer(n).each(function(t){Ne(t,o)}),t.onInvalid(n,o)})},Jy=function(n,t,e){return t.validator.fold(function(){return my.pure(yt.value(!0))},function(t){return t.validate(n)})},Qy=function(n,e,t){return e.notify.each(function(t){t.onValidate(n)}),Jy(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return $y(n,e,0,t),yt.error(t)},function(t){return Ky(n,e),yt.value(t)}):yt.error("No longer in system")})},Zy=/* */Object.freeze({markValid:Ky,markInvalid:$y,query:Jy,run:Qy,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return fu(e,n.invalidClass)}}),tx=/* */Object.freeze({events:function(n,t){return n.validator.map(function(t){return fi([gi(t.onEvent,function(t){Qy(t,n).get(d)})].concat(t.validateOnLoad?[ki(function(t){Qy(t,n).get(tt)})]:[]))}).getOr({})}}),nx=[kr("invalidClass"),Nr("getRoot",et.none),Vr("notify",[Nr("aria","alert"),Nr("getContainer",et.none),Nr("validHtml",""),Qu("onValid"),Qu("onInvalid"),Qu("onValidate")]),Vr("validator",[kr("validate"),Nr("onEvent","input"),Nr("validateOnLoad",!0)])],ex=da({fields:nx,name:"invalidating",active:tx,apis:Zy,extra:{validation:function(e){return function(t){var n=ig.getValue(t);return my.pure(e(n))}}}}),ox=/* */Object.freeze({exhibit:function(t,n){return qi({attributes:Dt([{key:n.tabAttr,value:"true"}])})}}),rx=[Nr("tabAttr","data-alloy-tabstop")],ix=da({fields:rx,name:"tabstopping",active:ox}),ux=nt([kr("dom"),kr("fetch"),Qu("onOpen"),Zu("onExecute"),Nr("getHotspot",et.some),Nr("getAnchorOverrides",nt({})),Nr("layouts",et.none()),Of("dropdownBehaviours",[Sg,ry,Lm,fg]),kr("toggleClass"),Nr("eventOrder",{}),_r("lazySink"),Nr("matchWidth",!1),Nr("useMinWidth",!1),_r("role")].concat(_y())),ax=nt([tl({schema:[Ku()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),py()]),cx=_l({name:"Dropdown",configFields:ux(),partFields:ax(),factory:function(n,t,e,o){var r,i,u=function(t){yf.getState(t).each(function(t){Ug.highlightPrimary(t)})},a={expand:function(t){Sg.isOn(t)||yy(n,function(t){return t},t,o,tt,Pb.HighlightNone).get(tt)},open:function(t){Sg.isOn(t)||yy(n,function(t){return t},t,o,tt,Pb.HighlightFirst).get(tt)},isOpen:Sg.isOn,close:function(t){Sg.isOn(t)&&yy(n,function(t){return t},t,o,tt,Pb.HighlightFirst).get(tt)}},c=function(t,n){return Jr(t),et.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:Ef(n.dropdownBehaviours,[Sg.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),ry.config({others:{sandbox:function(t){return Sy(n,t,{onOpen:function(){Sg.on(t)},onClose:function(){Sg.off(t)}})}}}),Lm.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t,n){if(cx.isOpen(t)){var e=ry.getCoupled(t,"sandbox");u(e)}else cx.open(t);return et.some(!0)},onEscape:function(t,n){return cx.isOpen(t)?(cx.close(t),et.some(!0)):et.none()}}),fg.config({})]),events:Gg(et.some(function(t){yy(n,function(t){return t},t,o,u,Pb.HighlightFirst).get(tt)})),eventOrder:mo({},n.eventOrder,(r={},r[Rn()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:mo({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}}),"button"===n.dom.tag?{type:(i="type",Bt(n.dom,"attributes").bind(function(t){return Bt(t,i)})).getOr("button")}:{})}}},apis:{open:function(t,n){return t.open(n)},expand:function(t,n){return t.expand(n)},close:function(t,n){return t.close(n)},isOpen:function(t,n){return t.isOpen(n)}}}),sx=da({fields:[],name:"unselecting",active:/* */Object.freeze({events:function(t){return fi([li(nn(),nt(!0))])},exhibit:function(t,n){return qi({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),fx=fo("color-input-change"),lx=fo("color-swatch-change"),dx=fo("color-picker-cancel"),mx=function(t,n,o){var e,r,i=ny.parts().field({factory:Xy,inputClasses:["tox-textfield"],onSetValue:function(t){return ex.run(t).get(function(){})},inputBehaviours:fa([ix.config({}),ex.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return Ce(t.element())},notify:{onValid:function(t){var n=ig.getValue(t);$r(t,fx,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=ig.getValue(t);if(0===n.length)return my.pure(yt.value(!0));var e=ne.fromTag("span");hu(e,"background-color",n);var o=wu(e,"background-color").fold(function(){return yt.error("blah")},function(t){return yt.value(n)});return my.pure(o)}}})]),selectOnFocus:!1}),u=t.label.map(function(t){return Py(t,n.providers)}),a=function(t,n){$r(t,lx,{value:n})},c=Yg((e={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:et.some({onRtl:function(){return[Cc]},onLtr:function(){return[Oc]}}),components:[],fetch:Mv.getFetch(o.getColors(),o.hasCustomColors()),columns:o.getColorCols(),presets:"color",onItemAction:function(t,e){c.getOpt(t).each(function(n){"custom"===e?o.colorPicker(function(t){t.fold(function(){return Kr(n,dx)},function(t){a(n,t),vv(t)})},"#ffffff"):a(n,"remove"===e?"":e)})}},r=n,cx.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:fa([sx.config({}),ix.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:r.getSink,fetch:function(n){return my.nu(function(t){return e.fetch(t)}).map(function(t){return et.from(ib(kt(jv(fo("menu-value"),t,function(t){e.onItemAction(n,t)},e.columns,e.presets,Dh.CLOSE_ON_EXECUTE,function(){return!1},r.providers),{movement:Wv(e.columns,e.presets)})))})},parts:{menu:Hv(0,0,e.presets)}})));return ny.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[i,c.asSpec()]}]),fieldBehaviours:fa([Ag("form-field-events",[gi(fx,function(t,n){c.getOpt(t).each(function(t){hu(t.element(),"background-color",n.event().color())})}),gi(lx,function(n,e){ny.getField(n).each(function(t){ig.setValue(t,e.event().value()),Rl.getCurrent(n).each(fg.focus)})}),gi(dx,function(n,t){ny.getField(n).each(function(t){Rl.getCurrent(n).each(fg.focus)})})])])})},gx=function(t,n,e){return{hue:nt(t),saturation:nt(n),value:nt(e)}},px=nt(fo("rgb-hex-update")),hx=nt(fo("slider-update")),vx=nt(fo("palette-update")),bx=An.detect().deviceType.isTouch(),yx=nl({schema:[kr("dom")],name:"label"}),xx=function(t){return nl({name:t+"-edge",overrides:function(o){return o.model.manager.edgeActions[t].fold(function(){return{}},function(e){var t=fi([pi(Pt(),e,[o])]),n=fi([pi(jt(),e,[o]),pi(Ut(),function(t,n){n.mouseIsDown.get()&&e(t,n)},[o])]);return{events:bx?t:n}})}})},wx=xx("top-left"),Sx=xx("top"),kx=xx("top-right"),Cx=xx("right"),Ox=xx("bottom-right"),Tx=xx("bottom"),Ex=xx("bottom-left"),Bx=[yx,xx("left"),Cx,Sx,Tx,wx,kx,Ex,Ox,Zf({name:"thumb",defaults:nt({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:fi([bi(Pt(),t,"spectrum"),bi(zt(),t,"spectrum"),bi(Lt(),t,"spectrum"),bi(jt(),t,"spectrum"),bi(Ut(),t,"spectrum"),bi(Gt(),t,"spectrum")])}}}),Zf({schema:[Gr("mouseIsDown",function(){return Ft(!1)})],name:"spectrum",overrides:function(e){var o=e.model.manager,r=function(n,t){return o.getValueFromEvent(t).map(function(t){return o.setValueFrom(n,e,t)})},t=fi([gi(Pt(),r),gi(zt(),r)]),n=fi([gi(jt(),r),gi(Ut(),function(t,n){e.mouseIsDown.get()&&r(t,n)})]);return{behaviours:fa(bx?[]:[Lm.config({mode:"special",onLeft:function(t){return o.onLeft(t,e)},onRight:function(t){return o.onRight(t,e)},onUp:function(t){return o.onUp(t,e)},onDown:function(t){return o.onDown(t,e)}}),fg.config({})]),events:bx?t:n}}})],Ax=An.detect().deviceType.isTouch(),Dx=nt("slider.change.value"),_x=function(t){var n=t.event().raw();if(Ax){var e=n;return e.touches!==undefined&&1===e.touches.length?et.some(e.touches[0]).map(function(t){return wa(t.clientX,t.clientY)}):et.none()}var o=n;return o.clientX!==undefined?et.some(o).map(function(t){return wa(t.clientX,t.clientY)}):et.none()},Mx=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},Fx=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},Ix=function(t,n,e){return Math.max(n,Math.min(e,t))},Rx=function(t){var n=t.min,e=t.max,o=t.range,r=t.value,i=t.step,u=t.snap,a=t.snapStart,c=t.rounded,s=t.hasMinEdge,f=t.hasMaxEdge,l=t.minBound,d=t.maxBound,m=t.screenRange,g=s?n-1:n,p=f?e+1:e;if(r<l)return g;if(d<r)return p;var h,v,b,y,x,w,S,k=(x=r,w=l,S=d,Math.min(S,Math.max(x,w))-w),C=Ix(k/m*o+n,g,p);return u&&n<=C&&C<=e?(h=C,v=n,b=e,y=i,a.fold(function(){var t=h-v,n=Math.round(t/y)*y;return Ix(v+n,v-1,b+1)},function(t){var n=(h-t)%y,e=Math.round(n/y),o=Math.floor((h-t)/y),r=Math.floor((b-t)/y),i=t+Math.min(r,o+e)*y;return Math.max(t,i)})):c?Math.round(C):C},Vx=function(t){var n=t.min,e=t.max,o=t.range,r=t.value,i=t.hasMinEdge,u=t.hasMaxEdge,a=t.maxBound,c=t.maxOffset,s=t.centerMinEdge,f=t.centerMaxEdge;return r<n?i?0:s:e<r?u?a:f:(r-n)/o*c},Nx=function(t){return t.model.minX},Hx=function(t){return t.model.minY},Px=function(t){return t.model.minX-1},zx=function(t){return t.model.minY-1},Lx=function(t){return t.model.maxX},jx=function(t){return t.model.maxY},Ux=function(t){return t.model.maxX+1},Wx=function(t){return t.model.maxY+1},Gx=function(t,n,e){return n(t)-e(t)},Xx=function(t){return Gx(t,Lx,Nx)},Yx=function(t){return Gx(t,jx,Hx)},qx=function(t){return Xx(t)/2},Kx=function(t){return Yx(t)/2},$x=function(t){return t.stepSize},Jx=function(t){return t.snapToGrid},Qx=function(t){return t.snapStart},Zx=function(t){return t.rounded},tw=function(t,n){return t[n+"-edge"]!==undefined},nw=function(t){return tw(t,"left")},ew=function(t){return tw(t,"right")},ow=function(t){return tw(t,"top")},rw=function(t){return tw(t,"bottom")},iw=function(t){return t.model.value.get()},uw=function(t){return{x:nt(t)}},aw=function(t){return{y:nt(t)}},cw=function(t,n){return{x:nt(t),y:nt(n)}},sw=function(t,n){$r(t,Dx(),{value:n})},fw="left",lw=function(t){return t.element().dom().getBoundingClientRect()},dw=function(t,n){return t[n]},mw=function(t){var n=lw(t);return dw(n,fw)},gw=function(t){var n=lw(t);return dw(n,"right")},pw=function(t){var n=lw(t);return dw(n,"top")},hw=function(t){var n=lw(t);return dw(n,"bottom")},vw=function(t){var n=lw(t);return dw(n,"width")},bw=function(t){var n=lw(t);return dw(n,"height")},yw=function(t,n,e){return(t+n)/2-e},xw=function(t,n){var e=lw(t),o=lw(n),r=dw(e,fw),i=dw(e,"right"),u=dw(o,fw);return yw(r,i,u)},ww=function(t,n){var e=lw(t),o=lw(n),r=dw(e,"top"),i=dw(e,"bottom"),u=dw(o,"top");return yw(r,i,u)},Sw=function(t,n){$r(t,Dx(),{value:n})},kw=function(t){return{x:nt(t)}},Cw=function(t,n,e){var o={min:Nx(n),max:Lx(n),range:Xx(n),value:e,step:$x(n),snap:Jx(n),snapStart:Qx(n),rounded:Zx(n),hasMinEdge:nw(n),hasMaxEdge:ew(n),minBound:mw(t),maxBound:gw(t),screenRange:vw(t)};return Rx(o)},Ow=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Fx:Mx)(iw(r).x(),Nx(r),Lx(r),$x(r)),Sw(o,kw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},Tw=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g,p=(a=i,c=e,s=o,f=r,l=vw(u=n),d=s.bind(function(t){return et.some(xw(t,u))}).getOr(0),m=f.bind(function(t){return et.some(xw(t,u))}).getOr(l),g={min:Nx(a),max:Lx(a),range:Xx(a),value:c,hasMinEdge:nw(a),hasMaxEdge:ew(a),minBound:mw(u),minOffset:0,maxBound:gw(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Vx(g));return mw(n)-mw(t)+p},Ew=Ow(-1),Bw=Ow(1),Aw=et.none,Dw=et.none,_w={"top-left":et.none(),top:et.none(),"top-right":et.none(),right:et.some(function(t,n){sw(t,uw(Ux(n)))}),"bottom-right":et.none(),bottom:et.none(),"bottom-left":et.none(),left:et.some(function(t,n){sw(t,uw(Px(n)))})},Mw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=Cw(t,n,e),r=kw(o);return Sw(t,r),o},setToMin:function(t,n){var e=Nx(n);Sw(t,kw(e))},setToMax:function(t,n){var e=Lx(n);Sw(t,kw(e))},findValueOfOffset:Cw,getValueFromEvent:function(t){return _x(t).map(function(t){return t.left()})},findPositionOfValue:Tw,setPositionFromValue:function(t,n,e,o){var r=iw(e),i=Tw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=Ba(n.element())/2;hu(n.element(),"left",i-u+"px")},onLeft:Ew,onRight:Bw,onUp:Aw,onDown:Dw,edgeActions:_w}),Fw=function(t,n){$r(t,Dx(),{value:n})},Iw=function(t){return{y:nt(t)}},Rw=function(t,n,e){var o={min:Hx(n),max:jx(n),range:Yx(n),value:e,step:$x(n),snap:Jx(n),snapStart:Qx(n),rounded:Zx(n),hasMinEdge:ow(n),hasMaxEdge:rw(n),minBound:pw(t),maxBound:hw(t),screenRange:bw(t)};return Rx(o)},Vw=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Fx:Mx)(iw(r).y(),Hx(r),jx(r),$x(r)),Fw(o,Iw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},Nw=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g,p=(a=i,c=e,s=o,f=r,l=bw(u=n),d=s.bind(function(t){return et.some(ww(t,u))}).getOr(0),m=f.bind(function(t){return et.some(ww(t,u))}).getOr(l),g={min:Hx(a),max:jx(a),range:Yx(a),value:c,hasMinEdge:ow(a),hasMaxEdge:rw(a),minBound:pw(u),minOffset:0,maxBound:hw(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Vx(g));return pw(n)-pw(t)+p},Hw=et.none,Pw=et.none,zw=Vw(-1),Lw=Vw(1),jw={"top-left":et.none(),top:et.some(function(t,n){sw(t,aw(zx(n)))}),"top-right":et.none(),right:et.none(),"bottom-right":et.none(),bottom:et.some(function(t,n){sw(t,aw(Wx(n)))}),"bottom-left":et.none(),left:et.none()},Uw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=Rw(t,n,e),r=Iw(o);return Fw(t,r),o},setToMin:function(t,n){var e=Hx(n);Fw(t,Iw(e))},setToMax:function(t,n){var e=jx(n);Fw(t,Iw(e))},findValueOfOffset:Rw,getValueFromEvent:function(t){return _x(t).map(function(t){return t.top()})},findPositionOfValue:Nw,setPositionFromValue:function(t,n,e,o){var r=iw(e),i=Nw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=_a(n.element())/2;hu(n.element(),"top",i-u+"px")},onLeft:Hw,onRight:Pw,onUp:zw,onDown:Lw,edgeActions:jw}),Ww=function(t,n){$r(t,Dx(),{value:n})},Gw=function(t,n){return{x:nt(t),y:nt(n)}},Xw=function(s,f){return function(t,n){return(e=s,o=f,r=t,i=n,u=0<e?Fx:Mx,a=o?iw(i).x():u(iw(i).x(),Nx(i),Lx(i),$x(i)),c=o?u(iw(i).y(),Hx(i),jx(i),$x(i)):iw(i).y(),Ww(r,Gw(a,c)),et.some(a)).map(function(){return!0});var e,o,r,i,u,a,c}},Yw=Xw(-1,!1),qw=Xw(1,!1),Kw=Xw(-1,!0),$w=Xw(1,!0),Jw={"top-left":et.some(function(t,n){sw(t,cw(Px(n),zx(n)))}),top:et.some(function(t,n){sw(t,cw(qx(n),zx(n)))}),"top-right":et.some(function(t,n){sw(t,cw(Ux(n),zx(n)))}),right:et.some(function(t,n){sw(t,cw(Ux(n),Kx(n)))}),"bottom-right":et.some(function(t,n){sw(t,cw(Ux(n),Wx(n)))}),bottom:et.some(function(t,n){sw(t,cw(qx(n),Wx(n)))}),"bottom-left":et.some(function(t,n){sw(t,cw(Px(n),Wx(n)))}),left:et.some(function(t,n){sw(t,cw(Px(n),Kx(n)))})},Qw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=Cw(t,n,e.left()),r=Rw(t,n,e.top()),i=Gw(o,r);return Ww(t,i),i},setToMin:function(t,n){var e=Nx(n),o=Hx(n);Ww(t,Gw(e,o))},setToMax:function(t,n){var e=Lx(n),o=jx(n);Ww(t,Gw(e,o))},getValueFromEvent:function(t){return _x(t)},setPositionFromValue:function(t,n,e,o){var r=iw(e),i=Tw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=Nw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=Ba(n.element())/2,c=_a(n.element())/2;hu(n.element(),"left",i-a+"px"),hu(n.element(),"top",u-c+"px")},onLeft:Yw,onRight:qw,onUp:Kw,onDown:$w,edgeActions:Jw}),Zw=An.detect().deviceType.isTouch(),tS=[Nr("stepSize",1),Nr("onChange",tt),Nr("onChoose",tt),Nr("onInit",tt),Nr("onDragStart",tt),Nr("onDragEnd",tt),Nr("snapToGrid",!1),Nr("rounded",!0),_r("snapStart"),Cr("model",pr("mode",{x:[Nr("minX",0),Nr("maxX",100),Gr("value",function(t){return Ft(t.mode.minX)}),kr("getInitialValue"),ea("manager",Mw)],y:[Nr("minY",0),Nr("maxY",100),Gr("value",function(t){return Ft(t.mode.minY)}),kr("getInitialValue"),ea("manager",Uw)],xy:[Nr("minX",0),Nr("maxX",100),Nr("minY",0),Nr("maxY",100),Gr("value",function(t){return Ft({x:nt(t.mode.minX),y:nt(t.mode.minY)})}),kr("getInitialValue"),ea("manager",Qw)]})),Of("sliderBehaviours",[Lm,ig])].concat(Zw?[]:[Gr("mouseIsDown",function(){return Ft(!1)})]),nS=An.detect().deviceType.isTouch(),eS=_l({name:"Slider",configFields:tS,partFields:Bx,factory:function(i,t,n,e){var u=function(t){return gl(t,i,"thumb")},a=function(t){return gl(t,i,"spectrum")},o=function(t){return ml(t,i,"left-edge")},r=function(t){return ml(t,i,"right-edge")},c=function(t){return ml(t,i,"top-edge")},s=function(t){return ml(t,i,"bottom-edge")},f=i.model,l=f.manager,d=function(t,n){l.setPositionFromValue(t,n,i,{getLeftEdge:o,getRightEdge:r,getTopEdge:c,getBottomEdge:s,getSpectrum:a})},m=function(t,n){f.value.set(n);var e=u(t);return d(t,e),i.onChange(t,e,n),et.some(!0)},g=[gi(Pt(),function(t,n){i.onDragStart(t,u(t))}),gi(Lt(),function(t,n){i.onDragEnd(t,u(t))})],p=[gi(jt(),function(t,n){n.stop(),i.onDragStart(t,u(t)),i.mouseIsDown.set(!0)}),gi(Gt(),function(t,n){i.onDragEnd(t,u(t))})],h=nS?g:p;return{uid:i.uid,dom:i.dom,components:t,behaviours:Ef(i.sliderBehaviours,G([nS?[]:[Lm.config({mode:"special",focusIn:function(t){return ml(t,i,"spectrum").map(Lm.focusIn).map(nt(!0))}})],[ig.config({store:{mode:"manual",getValue:function(t){return f.value.get()}}}),ba.config({channels:{"mouse.released":{onReceive:function(e,t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&ml(e,i,"thumb").each(function(t){var n=f.value.get();i.onChoose(e,t,n)})}}}})]])),events:fi([gi(Dx(),function(t,n){m(t,n.event().value())}),ki(function(t,n){var e=f.getInitialValue();f.value.set(e);var o=u(t);d(t,o);var r=a(t);i.onInit(t,o,r,f.value.get())})].concat(h)),apis:{resetToMin:function(t){l.setToMin(t,i)},resetToMax:function(t){l.setToMax(t,i)},changeValue:m,refresh:d},domModification:{styles:{position:"relative"}}}},apis:{resetToMin:function(t,n){t.resetToMin(n)},resetToMax:function(t,n){t.resetToMax(n)},refresh:function(t,n){t.refresh(n)}}}),oS=function(t,n){var e=eS.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=eS.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return eS.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:nt({y:nt(0)})},components:[e,o],sliderBehaviours:fa([fg.config({})]),onChange:function(t,n,e){$r(t,hx(),{value:e})}})},rS=[Of("formBehaviours",[ig])],iS=function(t){return"<alloy.field."+t+">"},uS=function(o,t,n){return{uid:o.uid,dom:o.dom,components:t,behaviours:Ef(o.formBehaviours,[ig.config({store:{mode:"manual",getValue:function(t){var n=hl(t,o);return at(n,function(t,n){return t().bind(function(t){var n,e=Rl.getCurrent(t);return n="missing current",e.fold(function(){return yt.error(n)},yt.value)}).map(ig.getValue)})},setValue:function(e,t){ut(t,function(n,t){ml(e,o,t).each(function(t){Rl.getCurrent(t).each(function(t){ig.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return ml(t,o,n).bind(Rl.getCurrent)}}}},aS={getField:Wi(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),cl("form",iS(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=D(r,function(t){return Zf({name:t,pname:iS(t)})});return kl("form",rS,i,uS,o)}},cS=fo("valid-input"),sS=fo("invalid-input"),fS=fo("validating-input"),lS="colorcustom.rgb.",dS=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(lS+"range"),c=[ny.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),ny.parts().field({data:r,factory:Xy,inputAttributes:mo({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:fa([(i=n,u=t,ex.config({invalidClass:m("invalid"),notify:{onValidate:function(t){$r(t,fS,{type:i})},onValid:function(t){$r(t,cS,{type:i,value:ig.getValue(t)})},onInvalid:function(t){$r(t,sS,{type:i,value:ig.getValue(t)})}},validator:{validate:function(t){var n=ig.getValue(t),e=u(n)?yt.value(!0):yt.error(d("aria.input.invalid"));return my.pure(e)},validateOnLoad:!1}})),ix.config({})]),onSetValue:function(t){ex.isInvalid(t)&&ex.run(t).get(tt)}})],s="hex"!==n?[ny.parts()["aria-descriptor"]({text:a})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:c.concat(s)}},v=function(t,n){var e=n.red(),o=n.green(),r=n.blue();ig.setValue(t,{red:e,green:o,blue:r})},b=Yg({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){hu(t.element(),"background-color","#"+n.value())})};return Dl({factory:function(){var e={red:nt(Ft(et.some(255))),green:nt(Ft(et.some(255))),blue:nt(Ft(et.some(255))),hex:nt(Ft(et.some("ffffff")))},o=function(t){return e[t]().get()},i=function(t,n){e[t]().set(n)},r=function(t){var n=t.red(),e=t.green(),o=t.blue();i("red",et.some(n)),i("green",et.some(e)),i("blue",et.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),et.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,et.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return Zh(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=Yh(t),aS.getField(n,"hex").each(function(t){fg.isFocused(t)||ig.setValue(n,{hex:e.value()})}),e);y(r,o)})},a=function(t,n){var e=n.event();"hex"===e.type()?function(t,n){g(t);var e=Lh(n);i("hex",et.some(n));var o=ev(e);v(t,o),r(o),$r(t,px(),{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(lS+t+".label"),description:d(lS+t+".description")}},c=t("red"),s=t("green"),f=t("blue"),l=t("hex");return kt(aS.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",ny.sketch(h(tv,"red",c.label,c.description,255))),t.field("green",ny.sketch(h(tv,"green",s.label,s.description,255))),t.field("blue",ny.sketch(h(tv,"blue",f.label,f.description,255))),t.field("hex",ny.sketch(h(Wh,"hex",l.label,l.description,"ffffff"))),b.asSpec()],formBehaviours:fa([ex.config({invalidClass:m("form-invalid")}),Ag("rgb-form-events",[gi(cS,a),gi(sS,n),gi(fS,n)])])}}),{apis:{updateHex:function(t,n){var e,o;ig.setValue(t,{hex:n.value()}),e=t,o=ev(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},mS=function(t,o){var r=eS.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=eS.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette-thumb")],innerHtml:"<div class="+o("sv-palette-inner-thumb")+' role="presentation"></div>'}}),u=function(t,n){var e=t.width,o=t.height,r=t.getContext("2d");if(null!==r){r.fillStyle=n,r.fillRect(0,0,e,o);var i=r.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,e,o);var u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=u,r.fillRect(0,0,e,o)}};return Dl({factory:function(t){var n=nt({x:nt(0),y:nt(0)}),e=fa([Rl.config({find:et.some}),fg.config({})]);return eS.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette")]},model:{mode:"xy",getInitialValue:n},rounded:!1,components:[r,i],onChange:function(t,n,e){$r(t,vx(),{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),rv(iv()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,rv(o))}},extraApis:{}})},gS=function(c,s){return Dl({name:"ColourPicker",configFields:[kr("dom"),Nr("onValidHex",tt),Nr("onInvalidHex",tt)],factory:function(t){var a,v,e=dS(c,s,t.onValidHex,t.onInvalidHex),o=mS(c,s),b={paletteRgba:nt(Ft(iv()))},n=Yg(o.sketch({})),r=Yg(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=ev(e);b.paletteRgba().set(n),o.setRgba(t,n)})},u=function(t,n){r.getOpt(t).each(function(t){e.updateHex(t,n)})},y=function(n,e,t){j(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),oS(c,s),r.asSpec()],behaviours:fa([Ag("colour-picker-events",[gi(vx(),(v=[u],function(t,n){var e,o,r,i,u,a,c,s,f,l=n.event().value(),d=b.paletteRgba().get(),m=(i=r=0,u=(e=d).red()/255,a=e.green()/255,c=e.blue()/255,s=Math.min(u,Math.min(a,c)),f=Math.max(u,Math.max(a,c)),s===f?gx(0,0,100*(i=s)):(r=60*((r=u===s?3:c===s?1:5)-(u===s?a-c:c===s?u-a:c-u)/(f-s)),o=(f-s)/f,i=f,gx(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=gx(m.hue(),l.x(),100-l.y()),p=nv(g),h=Yh(p);y(t,h,v)})),gi(hx(),(a=[i,u],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=gx((100-e)/100*360,100,100),r=nv(o),Yh(r));y(t,u,a)}))]),Rl.config({find:function(t){return r.getOpt(t)}}),Lm.config({mode:"acyclic"})])}}})},pS=function(){return Rl.config({find:et.some})},hS=function(t){return Rl.config({find:t.getOpt})},vS=function(t){return Rl.config({find:function(n){return Ee(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},bS={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","colorcustom.sb.saturation":"Saturation","colorcustom.sb.brightness":"Brightness","colorcustom.sb.picker":"Saturation and Brightness Picker","colorcustom.sb.palette":"Saturation and Brightness Palette","colorcustom.sb.instructions":"Use arrow keys to select saturation and brightness, on x and y axes","colorcustom.hue.hue":"Hue","colorcustom.hue.slider":"Hue Slider","colorcustom.hue.palette":"Hue Palette","colorcustom.hue.instructions":"Use arrow keys to select a hue","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"},yS=function(t){return bS[t]},xS=$o([Nr("preprocess",d),Nr("postprocess",d)]),wS=function(t,n,e){return ig.config(kt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},SS=function(t,n,e){return wS(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},kS=function(r,t){var i=mr("RepresentingConfigs.memento processors",xS,t);return ig.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=ig.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);ig.setValue(o,e)}}})},CS=wS,OS=function(t){return SS(t,Ve,Ne)},TS=function(t){return ig.config({store:{mode:"memory",initialValue:t}})},ES=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){j(t,function(t){t(n,e)})}},i=function(t,n){if(!kh.isDisabled(t)){var e=n.event().raw();a(t,e.dataTransfer.files)}},u=function(t,n){var e=n.event().raw().target.files;a(t,e)},a=function(t,n){var e,o;ig.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),F(ot(e),function(t){return o.test(t.name)}))),$r(t,Wb,{name:r.name})},c=Yg({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:fa([Ag("input-file-events",[xi(Hn())])])}),t=r.label.map(function(t){return Py(t,n)}),s=ny.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:fa([TS([]),pS(),kh.config({}),Sg.config({toggleClass:"dragenter",toggleOnExecute:!1}),Ag("dropzone-events",[gi("dragenter",o([e,Sg.toggle])),gi("dragleave",o([e,Sg.toggle])),gi("dragover",e),gi("drop",o([e,i])),gi(Qt(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},Xg.sketch({dom:{tag:"button",innerHtml:n.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[c.asSpec()],action:function(t){c.get(t).element().dom().click()},buttonBehaviours:fa([ix.config({})])})]}]}}}});return Ry(t,s,["tox-form__group--stretched"])},BS=fo("alloy-fake-before-tabstop"),AS=fo("alloy-fake-after-tabstop"),DS=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:fa([fg.config({ignore:!0}),ix.config({})])}},_S=function(t,n){$r(t,Kt(),{raw:{which:9,shiftKey:n}})},MS=function(t){return mb(t,["."+BS,"."+AS].join(","),nt(!1))},FS=function(t,n){var e=n.element();fu(e,BS)?_S(t,!0):fu(e,AS)&&_S(t,!1)},IS=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[DS([BS]),t,DS([AS])],behaviours:fa([vS(1)])}},RS=!(An.detect().browser.isIE()||An.detect().browser.isEdge()),VS=function(t,n){var o,r,e=RS&&t.sandboxed,i=mo({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=Ft(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Xe(t.element(),"srcdoc",n);else{Xe(t.element(),"src","javascript:''");var e=t.element().dom().contentWindow.document;e.open(),e.write(n),e.close()}r.set(n)}}),a=t.label.map(function(t){return Py(t,n)}),c=ny.parts().field({factory:{sketch:function(t){return IS({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:fa([ix.config({}),fg.config({}),CS(et.none(),u.getValue,u.setValue)])})}}});return Ry(a,c,["tox-form__group--stretched"])};function NS(t,n){return zS(H.document.createElement("canvas"),t,n)}function HS(t){var n=NS(t.width,t.height);return PS(n).drawImage(t,0,0),n}function PS(t){return t.getContext("2d")}function zS(t,n,e){return t.width=n,t.height=e,t}var LS={atob:function(t){return ce.getOrDie("atob")(t)},requestAnimationFrame:function(t){ce.getOrDie("requestAnimationFrame")(t)}};function jS(t){return t.naturalWidth||t.width}function US(t){return t.naturalHeight||t.height}var WS=window.Promise?window.Promise:function(){var i=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(t,o(r,this),o(a,this))},t=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){H.setTimeout(t,1)};function o(t,n){return function(){return t.apply(n,arguments)}}var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function u(o){var r=this;null!==this._state?t(function(){var t=r._state?o.onFulfilled:o.onRejected;if(null!==t){var n;try{n=t(r._value)}catch(e){return void o.reject(e)}o.resolve(n)}else(r._state?o.resolve:o.reject)(r._value)}):this._deferreds.push(o)}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void f(o(n,t),o(r,this),o(a,this))}this._state=!0,this._value=t,c.call(this)}catch(e){a.call(this,e)}}function a(t){this._state=!1,this._value=t,c.call(this)}function c(){for(var t=0,n=this._deferreds;t<n.length;t++){var e=n[t];u.call(this,e)}this._deferreds=[]}function s(t,n,e,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.resolve=e,this.reject=o}function f(t,n,e){var o=!1;try{t(function(t){o||(o=!0,n(t))},function(t){o||(o=!0,e(t))})}catch(r){if(o)return;o=!0,e(r)}}return i.prototype["catch"]=function(t){return this.then(null,t)},i.prototype.then=function(e,o){var r=this;return new i(function(t,n){u.call(r,new s(e,o,t,n))})},i.all=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var c=Array.prototype.slice.call(1===t.length&&e(t[0])?t[0]:t);return new i(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(n,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void e.call(t,function(t){a(n,t)},i)}c[n]=t,0==--u&&r(c)}catch(o){i(o)}}for(var t=0;t<c.length;t++)a(t,c[t])})},i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(t){t(n)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(r){return new i(function(t,n){for(var e=0,o=r;e<o.length;e++)o[e].then(t,n)})},i}();function GS(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return et.none();for(var o,r=e[1],i=n[1],u=LS.atob(i),a=u.length,c=Math.ceil(a/1024),s=new Array(c),f=0;f<c;++f){for(var l=1024*f,d=Math.min(l+1024,a),m=new Array(d-l),g=l,p=0;g<d;++p,++g)m[p]=u[g].charCodeAt(0);s[f]=(o=m,new(ce.getOrDie("Uint8Array"))(o))}return et.some(function h(t,n){return new(ce.getOrDie("Blob"))(t,n)}(s,{type:r}))}function XS(e){return new WS(function(t,n){GS(e).fold(function(){n("uri is not base64: "+e)},t)})}function YS(t,o,r){return o=o||"image/png",H.HTMLCanvasElement.prototype.toBlob?new WS(function(n,e){t.toBlob(function(t){t?n(t):e()},o,r)}):XS(t.toDataURL(o,r))}function qS(t){return function n(a){return new WS(function(t,n){var e=H.URL.createObjectURL(a),o=new H.Image,r=function(){o.removeEventListener("load",i),o.removeEventListener("error",u)};function i(){r(),t(o)}function u(){r(),n("Unable to load data of type "+a.type+": "+e)}o.addEventListener("load",i),o.addEventListener("error",u),o.src=e,o.complete&&i()})}(t).then(function(t){!function e(t){H.URL.revokeObjectURL(t.src)}(t);var n=NS(jS(t),US(t));return PS(n).drawImage(t,0,0),n})}function KS(o){return new WS(function(t){var n=function e(){return new(ce.getOrDie("FileReader"))}();n.onloadend=function(){t(n.result)},n.readAsDataURL(o)})}function $S(t,n,e){var o=n.type;function r(n,e){return t.then(function(t){return function o(t,n,e){return n=n||"image/png",t.toDataURL(n,e)}(t,n,e)})}return{getType:nt(o),toBlob:function i(){return WS.resolve(n)},toDataURL:function u(){return e},toBase64:function a(){return e.split(",")[1]},toAdjustedBlob:function c(n,e){return t.then(function(t){return YS(t,n,e)})},toAdjustedDataURL:r,toAdjustedBase64:function s(t,n){return r(t,n).then(function(t){return t.split(",")[1]})},toCanvas:function f(){return t.then(HS)}}}function JS(n){return KS(n).then(function(t){return $S(qS(n),n,t)})}function QS(n,t){return YS(n,t).then(function(t){return $S(WS.resolve(n),t,n.toDataURL())})}(function gM(t){return lI(t).then(function(t){return JS(t)})});function ZS(t,n,e){var o="string"==typeof t?parseFloat(t):t;return e<o?o=e:o<n&&(o=n),o}var tk=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10];function nk(t,n){for(var e,o=[],r=new Array(25),i=0;i<5;i++){for(var u=0;u<5;u++)o[u]=n[u+5*i];for(u=0;u<5;u++){for(var a=e=0;a<5;a++)e+=t[u+5*a]*o[a];r[u+5*i]=e}}return r}function ek(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=PS(t);var r=function B(t,n){for(var e,o,r,i,u=t.data,a=n[0],c=n[1],s=n[2],f=n[3],l=n[4],d=n[5],m=n[6],g=n[7],p=n[8],h=n[9],v=n[10],b=n[11],y=n[12],x=n[13],w=n[14],S=n[15],k=n[16],C=n[17],O=n[18],T=n[19],E=0;E<u.length;E+=4)e=u[E],o=u[E+1],r=u[E+2],i=u[E+3],u[E]=e*a+o*c+r*s+i*f+l,u[E+1]=e*d+o*m+r*g+i*p+h,u[E+2]=e*v+o*b+r*y+i*x+w,u[E+3]=e*S+o*k+r*C+i*O+T;return t}(o.getImageData(0,0,t.width,t.height),e);return o.putImageData(r,0,0),QS(t,n)}(t,n.getType(),e)})}function ok(n,e){return n.toCanvas().then(function(t){return function u(t,n,e){var o=PS(t);var r=o.getImageData(0,0,t.width,t.height),i=o.getImageData(0,0,t.width,t.height);return i=function S(t,n,e){function o(t,n,e){return e<t?t=e:t<n&&(t=n),t}for(var r=Math.round(Math.sqrt(e.length)),i=Math.floor(r/2),u=t.data,a=n.data,c=t.width,s=t.height,f=0;f<s;f++)for(var l=0;l<c;l++){for(var d=0,m=0,g=0,p=0;p<r;p++)for(var h=0;h<r;h++){var v=o(l+h-i,0,c-1),b=o(f+p-i,0,s-1),y=4*(b*c+v),x=e[p*r+h];d+=u[y]*x,m+=u[y+1]*x,g+=u[y+2]*x}var w=4*(f*c+l);a[w]=o(d,0,255),a[w+1]=o(m,0,255),a[w+2]=o(g,0,255)}return n}(r,i,e),o.putImageData(i,0,0),QS(t,n)}(t,n.getType(),e)})}function rk(e){return function(t,n){return ek(t,e([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n))}}var ik=function pM(n){return function(t){return ek(t,n)}}([-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0,0,0,0,0,1]),uk=rk(function hM(t,n){return nk(t,[1,0,0,0,n=ZS(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])}),ak=rk(function vM(t,n){var e;return n=ZS(n,-1,1),nk(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0==(e=n%1)?tk[n]:tk[Math.floor(n)]*(1-e)+tk[Math.floor(n)+1]*e)+127)/127,0,0,0,.5*(127-e),0,e/127,0,0,.5*(127-e),0,0,e/127,0,.5*(127-e),0,0,0,1,0,0,0,0,0,1])}),ck=function(t,n,e,o){return ek(t,function r(t,n,e,o){return nk(t,[n=ZS(n,0,2),0,0,0,0,0,e=ZS(e,0,2),0,0,0,0,0,o=ZS(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])}([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n,e,o))},sk=function bM(n){return function(t){return ok(t,n)}}([0,-1,0,-1,5,-1,0,-1,0]),fk=function yM(c){return function(n,e){return n.toCanvas().then(function(t){return function(t,n,e){for(var o=PS(t),r=new Array(256),i=0;i<r.length;i++)r[i]=c(i,e);var u=function a(t,n){for(var e=t.data,o=0;o<e.length;o+=4)e[o]=n[e[o]],e[o+1]=n[e[o+1]],e[o+2]=n[e[o+2]];return t}(o.getImageData(0,0,t.width,t.height),r);return o.putImageData(u,0,0),QS(t,n)}(t,n.getType(),e)})}}(function(t,n){return 255*Math.pow(t/255,1-n)});function lk(t,n,e){var o=jS(t),r=US(t),i=n/o,u=e/r,a=!1;(i<.5||2<i)&&(i=i<.5?.5:2,a=!0),(u<.5||2<u)&&(u=u<.5?.5:2,a=!0);var c=function f(a,c,s){return new WS(function(t){var n=jS(a),e=US(a),o=Math.floor(n*c),r=Math.floor(e*s),i=NS(o,r),u=PS(i);u.drawImage(a,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return lk(t,n,e)}):c}function dk(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=NS(t.width,t.height),r=PS(o),i=0,u=0;90!==(e=e<0?360+e:e)&&270!==e||zS(o,o.height,o.width);90!==e&&180!==e||(i=o.width);270!==e&&180!==e||(u=o.height);return r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),QS(o,n)}(t,n.getType(),e)})}function mk(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=NS(t.width,t.height),r=PS(o);"v"===e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0));return QS(o,n)}(t,n.getType(),e)})}function gk(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=NS(r,i);return PS(u).drawImage(t,-e,-o),QS(u,n)}(t,n.getType(),e,o,r,i)})}var pk=function(t){return ik(t)},hk=function(t){return sk(t)},vk=function(t,n){return fk(t,n)},bk=function(t,n){return uk(t,n)},yk=function(t,n){return ak(t,n)},xk=function(t,n){return mk(t,n)},wk=function(t,n,e){return function r(n,e,o){return n.toCanvas().then(function(t){return lk(t,e,o).then(function(t){return QS(t,n.getType())})})}(t,n,e)},Sk=function(t,n){return dk(t,n)},kk=function(t,n){return mo({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},Ck=function(t,n){return kk(Kg(t,n),{})},Ok=function(t,n){return kk(Kg(t,n),{behaviours:fa([Xm.config({})])})},Tk=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:fa([Xm.config({})])}},Ek=function(t,n,e,o,r){void 0===e&&(e=[]);var i=n.fold(function(){return{}},function(t){return{action:t}}),u=mo({buttonBehaviours:fa([Oh(t.disabled),ix.config({}),Ag("button press",[mi("click"),mi("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=kt(u,{dom:o});return kt(a,{components:r})},Bk=function(t,n,e,o){void 0===o&&(o=[]);var r={tag:"button",classes:["tox-tbtn"],attributes:t.tooltip.map(function(t){return{"aria-label":e.translate(t),title:e.translate(t)}}).getOr({})},i=t.icon.map(function(t){return Ck(t,e.icons)}),u=Mh([i]);return Ek(t,n,o,r,u)},Ak=function(t,n,e,o){void 0===o&&(o=[]);var r=Bk(t,et.some(n),e,o);return Xg.sketch(r)},Dk=function(t,n,e,o){void 0===o&&(o=[]);var r=e.translate(t.text),i=t.icon?t.icon.map(function(t){return Ck(t,e.icons)}):et.none(),u=i.isSome()?Mh([i]):[],a=i.isSome()?{}:{innerHtml:r},c=(t.primary?["tox-button"]:["tox-button","tox-button--secondary"]).concat(i.isSome()?["tox-button--icon"]:[]);return function(t,n,e,o,r){void 0===e&&(e=[]);var i=Ek(t,et.some(n),e,o,r);return Xg.sketch(i)}(t,n,o,mo({tag:"button",classes:c},a,{attributes:{title:r}}),u)},_k=function(n,e){return function(t){"custom"===e?$r(t,Yb,{name:n,value:{}}):"submit"===e?Kr(t,qb):"cancel"===e?Kr(t,Xb):H.console.error("Unknown button type: ",e)}},Mk=function(t,n,e){var o=_k(t.name,n);return Dk(t,o,e,[])},Fk=nt([Nr("field1Name","field1"),Nr("field2Name","field2"),ta("onLockedChange"),$u(["lockClass"]),Nr("locked",!1),Bf.field("coupledFieldBehaviours",[Rl,ig])]),Ik=function(t,i){return Zf({factory:ny,name:t,overrides:function(r){return{fieldBehaviours:fa([Ag("coupled-input-behaviour",[gi(Jt(),function(e){var t,n,o;(t=e,n=r,o=i,ml(t,n,o).bind(Rl.getCurrent)).each(function(n){ml(e,r,"lock").each(function(t){Sg.isOn(t)&&r.onLockedChange(e,n,t)})})})])])}}})},Rk=nt([Ik("field1","field2"),Ik("field2","field1"),Zf({factory:Xg,schema:[kr("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:fa([Sg.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),Vk=_l({name:"FormCoupledInputs",configFields:Fk(),partFields:Rk(),factory:function(o,t,n,e){return{uid:o.uid,dom:o.dom,components:t,behaviours:Bf.augment(o.coupledFieldBehaviours,[Rl.config({find:et.some}),ig.config({store:{mode:"manual",getValue:function(t){var n,e=bl(t,o,["field1","field2"]);return(n={})[o.field1Name]=ig.getValue(e.field1()),n[o.field2Name]=ig.getValue(e.field2()),n},setValue:function(t,n){var e=bl(t,o,["field1","field2"]);Mt(n,o.field1Name)&&ig.setValue(e.field1(),n[o.field1Name]),Mt(n,o.field2Name)&&ig.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return ml(t,o,"field1")},getField2:function(t){return ml(t,o,"field2")},getLock:function(t){return ml(t,o,"lock")}}}},apis:{getField1:function(t,n){return t.getField1(n)},getField2:function(t,n){return t.getField2(n)},getLock:function(t,n){return t.getLock(n)}}}),Nk=function(t){var n=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(t);if(null===n)return yt.error(t);var e=parseFloat(n[1]),o=n[2];return yt.value({value:e,unit:o})},Hk=function(t,n){var e={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,"in":1},o=function(t){return Object.prototype.hasOwnProperty.call(e,t)};return t.unit===n?et.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?et.some(t.value):et.some(t.value/e[t.unit]*e[n]):et.none()},Pk=function(t){return et.none()},zk=function(t,n){var e=Nk(t).toOption(),o=Nk(n).toOption();return Vt([e,o],function(t,o){return Hk(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return Hk(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr(Pk)}).getOr(Pk)},Lk=function(o,n){var a=Pk,r=fo("ratio-event"),t=Vk.parts().lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:n.translate(o.label.getOr("Constrain proportions"))}},components:[{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__lock"],innerHtml:Kg("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:Kg("unlock",n.icons)}}],buttonBehaviours:fa([ix.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(e){return ny.parts().field({factory:Xy,inputClasses:["tox-textfield"],inputBehaviours:fa([ix.config({}),Ag("size-input-events",[gi(Yt(),function(t,n){$r(t,r,{isField1:e})}),gi(Qt(),function(t,n){$r(t,Wb,{name:o.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=Vk.parts().field1(e([ny.parts().label(u("Width")),i(!0)])),s=Vk.parts().field2(e([ny.parts().label(u("Height")),i(!1)]));return Vk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,e([u("&nbsp;"),t])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(t,i,n){Nk(ig.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;ig.setValue(i,(o={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,"in":4,"%":4},-1!==(r=(n=t).value.toFixed((e=n.unit)in o?o[e]:1)).indexOf(".")&&(r=r.replace(/\.?0*$/,"")),r+n.unit))})})},coupledFieldBehaviours:fa([kh.config({}),Ag("size-input-events2",[gi(r,function(t,n){var e=n.event().isField1(),o=e?Vk.getField1(t):Vk.getField2(t),r=e?Vk.getField2(t):Vk.getField1(t),i=o.map(ig.getValue).getOr(""),u=r.map(ig.getValue).getOr("");a=zk(i,u)})])])})},jk={undo:nt(fo("undo")),redo:nt(fo("redo")),zoom:nt(fo("zoom")),back:nt(fo("back")),apply:nt(fo("apply")),swap:nt(fo("swap")),transform:nt(fo("transform")),tempTransform:nt(fo("temp-transform")),transformApply:nt(fo("transform-apply"))},Uk=nt("save-state"),Wk=nt("disable"),Gk=nt("enable"),Xk={formActionEvent:Yb,saveState:Uk,disable:Wk,enable:Gk},Yk=function(a,c){var t=function(t,n,e,o){return Yg(Dk({name:t,text:t,disabled:e,primary:o},n,c))},n=function(t,n,e,o){return Yg(Ak({name:t,icon:et.some(t),tooltip:et.some(n),disabled:o},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(kh)&&kh.disable(n)})},s=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(kh)&&kh.enable(n)})},f={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=et.none(),o=tt,r=function(t,n,e){$r(t,n,e)},i=function(t){return Kr(t,Xk.disable())},l=function(t){return Kr(t,Xk.enable())},d=function(t,n){i(t),r(t,jk.transform(),{transform:n}),l(t)},m=function(t){return function(){Z.getOpt(t).each(function(t){Xm.set(t,[J])})}},g=function(t,n){i(t),r(t,jk.transformApply(),{transform:n,swap:m(t)}),l(t)},p=function(){return t("Back",function(t){return r(t,jk.back(),{swap:m(t)})},!1,!1)},h=function(){return Yg({dom:{tag:"div",classes:["tox-spacer"]},behaviours:fa([kh.config({})])})},v=function(){return t("Apply",function(t){return r(t,jk.apply(),{swap:m(t)})},!0,!0)},b=function(){return function(t){var n,e,o,r,i,u=a.getRect();return n=t,e=u.x,o=u.y,r=u.w,i=u.h,gk(n,e,o,r,i)}},y=[p(),h(),t("Apply",function(t){var n=b();g(t,n),a.hideCrop()},!1,!0)],x=Mb.sketch({dom:f,components:y.map(function(t){return t.asSpec()}),containerBehaviours:fa([Ag("image-tools-crop-buttons-events",[gi(Xk.disable(),function(t,n){u(y,t)}),gi(Xk.enable(),function(t,n){s(y,t)})])])}),w=Yg(Lk({name:"size",label:e,type:"sizeinput",constrain:!0},c)),S=[p(),h(),w,h(),t("Apply",function(a){w.getOpt(a).each(function(t){var n,e,o=ig.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return wk(t,n,e)});g(a,u)})},!1,!0)],k=Mb.sketch({dom:f,components:S.map(function(t){return t.asSpec()}),containerBehaviours:fa([Ag("image-tools-resize-buttons-events",[gi(Xk.disable(),function(t,n){u(S,t)}),gi(Xk.enable(),function(t,n){s(S,t)})])])}),C=function(n,e){return function(t){return n(t,e)}},O=C(xk,"h"),T=C(xk,"v"),E=C(Sk,-90),B=C(Sk,90),A=function(t,n){var e,o;o=n,i(e=t),r(e,jk.tempTransform(),{transform:o}),l(e)},D=[p(),h(),n("flip-horizontally","Flip horizontally",function(t){A(t,O)},!1),n("flip-vertically","Flip vertically",function(t){A(t,T)},!1),n("rotate-left","Rotate counterclockwise",function(t){A(t,E)},!1),n("rotate-right","Rotate clockwise",function(t){A(t,B)},!1),h(),v()],_=Mb.sketch({dom:f,components:D.map(function(t){return t.asSpec()}),containerBehaviours:fa([Ag("image-tools-fliprotate-buttons-events",[gi(Xk.disable(),function(t,n){u(D,t)}),gi(Xk.enable(),function(t,n){s(D,t)})])])}),M=function(t,n,e,o,r){var i=eS.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=eS.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=eS.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Yg(eS.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:nt({x:nt(o)})},components:[i,u,a],sliderBehaviours:fa([fg.config({})]),onChoose:n}))},F=function(t,n,e,o,r){return[p(),(i=t,u=n,a=e,c=o,s=r,M(i,function(t,n,e){var o=C(u,e.x()/100);d(t,o)},a,c,s)),v()];var i,u,a,c,s},I=function(t,n,e,o,r){var i=F(t,n,e,o,r);return Mb.sketch({dom:f,components:i.map(function(t){return t.asSpec()}),containerBehaviours:fa([Ag("image-tools-filter-panel-buttons-events",[gi(Xk.disable(),function(t,n){u(i,t)}),gi(Xk.enable(),function(t,n){s(i,t)})])])})},R=[p(),h(),v()],V=Mb.sketch({dom:f,components:R.map(function(t){return t.asSpec()})}),N=I("Brightness",bk,-100,0,100),H=I("Contrast",yk,-100,0,100),P=I("Gamma",vk,-100,0,100),z=function(n,e,o){return function(t){return ck(t,n,e,o)}},L=function(t){return M(t,function(a,t,n){var e=j.getOpt(a),o=W.getOpt(a),r=U.getOpt(a);e.each(function(u){o.each(function(i){r.each(function(t){var n=ig.getValue(u).x()/100,e=ig.getValue(t).x()/100,o=ig.getValue(i).x()/100,r=z(n,e,o);d(a,r)})})})},0,100,200)},j=L("R"),U=L("G"),W=L("B"),G=[p(),j,U,W,v()],X=Mb.sketch({dom:f,components:G.map(function(t){return t.asSpec()})}),Y=function(n,e,o){return function(t){r(t,jk.swap(),{transform:e,swap:function(){Z.getOpt(t).each(function(t){Xm.set(t,[n]),o(t)})}})}},q=et.some(hk),K=et.some(pk),$=[n("crop","Crop",Y(x,e,function(t){a.showCrop()}),!1),n("resize","Resize",Y(k,e,function(t){w.getOpt(t).each(function(t){var n=a.getMeasurements(),e=n.width,o=n.height;ig.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",Y(_,e,o),!1),n("brightness","Brightness",Y(N,e,o),!1),n("sharpen","Sharpen",Y(V,q,o),!1),n("contrast","Contrast",Y(H,e,o),!1),n("color-levels","Color levels",Y(X,e,o),!1),n("gamma","Gamma",Y(P,e,o),!1),n("invert","Invert",Y(V,K,o),!1)],J=Mb.sketch({dom:f,components:$.map(function(t){return t.asSpec()})}),Q=Mb.sketch({dom:{tag:"div"},components:[J],containerBehaviours:fa([Xm.config({})])}),Z=Yg(Q);return{memContainer:Z,getApplyButton:function(t){return Z.getOpt(t).map(function(t){var n=t.components()[0];return n.components()[n.components().length-1]})}}},qk=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Kk=tinymce.util.Tools.resolve("tinymce.geom.Rect"),$k=tinymce.util.Tools.resolve("tinymce.util.Observable"),Jk=tinymce.util.Tools.resolve("tinymce.util.Tools"),Qk=tinymce.util.Tools.resolve("tinymce.util.VK");function Zk(t){var n,e;if(t.changedTouches)for(n="screenX screenY pageX pageY clientX clientY".split(" "),e=0;e<n.length;e++)t[n[e]]=t.changedTouches[0][n[e]]}function tC(t,r){var i,u,n,a,c,f,l,d=r.document||H.document;r=r||{};var m=d.getElementById(r.handle||t);n=function(t){var n,e,o=function s(t){var n,e,o,r,i,u,a,c=Math.max;return n=t.documentElement,e=t.body,o=c(n.scrollWidth,e.scrollWidth),r=c(n.clientWidth,e.clientWidth),i=c(n.offsetWidth,e.offsetWidth),u=c(n.scrollHeight,e.scrollHeight),a=c(n.clientHeight,e.clientHeight),{width:o<i?r:o,height:u<c(n.offsetHeight,e.offsetHeight)?a:u}}(d);Zk(t),t.preventDefault(),u=t.button,n=m,f=t.screenX,l=t.screenY,e=H.window.getComputedStyle?H.window.getComputedStyle(n,null).getPropertyValue("cursor"):n.runtimeStyle.cursor,i=qk("<div></div>").css({position:"absolute",top:0,left:0,width:o.width,height:o.height,zIndex:2147483647,opacity:1e-4,cursor:e}).appendTo(d.body),qk(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(Zk(t),t.button!==u)return a(t);t.deltaX=t.screenX-f,t.deltaY=t.screenY-l,t.preventDefault(),r.drag(t)},a=function(t){Zk(t),qk(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){qk(m).off()},qk(m).on("mousedown touchstart",n)}var nC=0;var eC=function(n){var f=Yg({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),l=Ft(1),d=Ft(et.none()),m=Ft({x:0,y:0,w:1,h:1}),c=Ft({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=l.get(),o=Ba(t.element()),r=_a(t.element()),i=s.dom().naturalWidth*e,u=s.dom().naturalHeight*e,a=Math.max(0,o/2-i/2),c=Math.max(0,r/2-u/2),n={left:a.toString()+"px",top:c.toString()+"px",width:i.toString()+"px",height:u.toString()+"px",position:"absolute"};vu(s,n),f.getOpt(t).each(function(t){vu(t.element(),n)}),d.get().each(function(t){var n=m.get();t.setRect({x:n.x*e+a,y:n.y*e+c,w:n.w*e,h:n.h*e}),t.setClampRect({x:a,y:c,w:i,h:u}),t.setViewPortRect({x:0,y:0,w:o,h:r})})})},e=function(t,n){var e,a=ne.fromTag("img");return Xe(a,"src",n),(e=a.dom(),new pp(function(t){var n=function(){e.removeEventListener("load",n),t(e)};e.complete?t(e):e.addEventListener("load",n)})).then(function(){return g.getOpt(t).map(function(t){var n=Iu({element:a});Xm.replaceAt(t,1,et.some(n));var e=c.get(),o={x:0,y:0,w:a.dom().naturalWidth,h:a.dom().naturalHeight};c.set(o);var r,u,i=Kk.inflate(o,-20,-20);return m.set(i),e.w===o.w&&e.h===o.h||(r=t,u=a,g.getOpt(r).each(function(t){var n=Ba(t.element()),e=_a(t.element()),o=u.dom().naturalWidth,r=u.dom().naturalHeight,i=Math.min(n/o,e/r);1<=i?l.set(1):l.set(i)})),s(t,a),a})})},t=Mb.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[f.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:fa([Ag("image-panel-crop-events",[ki(function(t){g.getOpt(t).each(function(t){var n=function S(s,e,f,o,r){var l,u,n,i,a="tox-",c="tox-crid-"+nC++;function d(t,n){return{x:n.x-t.x,y:n.y-t.y,w:n.w,h:n.h}}function m(t,n,e,o){var r,i,u,a,c;r=n.x,i=n.y,u=n.w,a=n.h,r+=e*t.deltaX,i+=o*t.deltaY,(u+=e*t.deltaW)<20&&(u=20),(a+=o*t.deltaH)<20&&(a=20),c=s=Kk.clamp({x:r,y:i,w:u,h:a},f,"move"===t.name),c=d(f,c),l.fire("updateRect",{rect:c}),h(c)}function g(n){function t(t,n){n.h<0&&(n.h=0),n.w<0&&(n.w=0),qk("#"+c+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}Jk.each(u,function(t){qk("#"+c+"-"+t.name,o).css({left:n.w*t.xMul+n.x,top:n.h*t.yMul+n.y})}),t("top",{x:e.x,y:e.y,w:e.w,h:n.y-e.y}),t("right",{x:n.x+n.w,y:n.y,w:e.w-n.x-n.w+e.x,h:n.h}),t("bottom",{x:e.x,y:n.y+n.h,w:e.w,h:e.h-n.y-n.h+e.y}),t("left",{x:e.x,y:n.y,w:n.x-e.x,h:n.h}),t("move",n)}function p(t){g(s=t)}function h(t){p(function e(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}}(f,t))}return u=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}],i=["top","right","bottom","left"],function v(){qk('<div id="'+c+'" class="'+a+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),Jk.each(i,function(t){qk("#"+c,o).append('<div id="'+c+"-"+t+'"class="'+a+'croprect-block" style="display: none" data-mce-bogus="all">')}),Jk.each(u,function(t){qk("#"+c,o).append('<div id="'+c+"-"+t.name+'" class="'+a+"croprect-handle "+a+"croprect-handle-"+t.name+'"style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1" aria-label="'+t.label+'" aria-grabbed="false" title="'+t.label+'">')}),n=Jk.map(u,function t(n){var e;return new tC(c,{document:o.ownerDocument,handle:c+"-"+n.name,start:function(){e=s},drag:function(t){m(n,e,t.deltaX,t.deltaY)}})}),g(s),qk(o).on("focusin focusout",function(t){qk(t.target).attr("aria-grabbed","focus"===t.type?"true":"false")}),qk(o).on("keydown",function(n){var i;function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),m(i,e,o,r)}switch(Jk.each(u,function(t){if(n.target.id===c+"-"+t.name)return i=t,!1}),n.keyCode){case Qk.LEFT:t(n,0,s,-10,0);break;case Qk.RIGHT:t(n,0,s,10,0);break;case Qk.UP:t(n,0,s,0,-10);break;case Qk.DOWN:t(n,0,s,0,10);break;case Qk.ENTER:case Qk.SPACEBAR:n.preventDefault(),r()}})}(),l=Jk.extend({toggleVisibility:function b(t){var n;n=Jk.map(u,function(t){return"#"+c+"-"+t.name}).concat(Jk.map(i,function(t){return"#"+c+"-"+t})).join(","),t?qk(n,o).show():qk(n,o).hide()},setClampRect:function y(t){f=t,g(s)},setRect:p,getInnerRect:function t(){return d(f,s)},setInnerRect:h,setViewPortRect:function x(t){e=t,g(s)},destroy:function w(){Jk.each(n,function(t){t.destroy()}),n=[]}},$k)}({x:10,y:10,w:100,h:100},{x:0,y:0,w:200,h:200},{x:0,y:0,w:200,h:200},t.element().dom(),function(){});n.toggleVisibility(!1),n.on("updateRect",function(t){var n=t.rect,e=l.get(),o={x:Math.round(n.x/e),y:Math.round(n.y/e),w:Math.round(n.w/e),h:Math.round(n.h/e)};m.set(o)}),d.set(et.some(n))})})])])}],containerBehaviours:fa([Xm.config({}),Ag("image-panel-events",[ki(function(t){e(t,n)})])])}),g=Yg(t);return{memContainer:g,updateSrc:e,zoom:function(t,n){var e=l.get(),o=0<n?Math.min(2,e+.1):Math.max(.1,e-.1);l.set(o),g.getOpt(t).each(function(t){var n=t.components()[1].element();s(t,n)})},showCrop:function(){d.get().each(function(t){t.toggleVisibility(!0)})},hideCrop:function(){d.get().each(function(t){t.toggleVisibility(!1)})},getRect:function(){return m.get()},getMeasurements:function(){var t=c.get();return{width:t.w,height:t.h}}}},oC=function(t,n,e,o,r){return Ak({name:t,icon:et.some(n),disabled:e,tooltip:et.some(t)},o,r)},rC=function(t,n){n?kh.enable(t):kh.disable(t)},iC=function(t){var o=Yg(oC("Undo","undo",!0,function(t){$r(t,jk.undo(),{direction:1})},t)),r=Yg(oC("Redo","redo",!0,function(t){$r(t,jk.redo(),{direction:1})},t));return{container:Mb.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),oC("Zoom in","zoom-in",!1,function(t){$r(t,jk.zoom(),{direction:1})},t),oC("Zoom out","zoom-out",!1,function(t){$r(t,jk.zoom(),{direction:-1})},t)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){rC(t,n)}),r.getOpt(t).each(function(t){rC(t,e)})}}},uC=function(){return ce.getOrDie("URL")},aC=function(t){return uC().createObjectURL(t)},cC=function(t){uC().revokeObjectURL(t)};var sC,fC,lC,dC,mC=function(t){var n=Ft(t),e=Ft(et.none()),r=function s(){var e=[],o=-1;function t(){return 0<o}function n(){return-1!==o&&o<e.length-1}return{data:e,add:function r(t){var n;return n=e.splice(++o),e.push(t),{state:t,removed:n}},undo:function i(){if(t())return e[--o]},redo:function u(){if(n())return e[++o]},canUndo:t,canRedo:n}}();r.add(t);var i=function(t){n.set(t)},u=function(t){return{blob:t,url:aC(t)}},a=function(t){cC(t.url)},o=function(){e.get().each(a),e.set(et.none())},c=function(t){var n=u(t);i(n);var e,o=r.add(n).removed;return e=o,Jk.each(e,a),n.url};return{getBlobState:function(){return n.get()},setBlobState:i,addBlobState:c,getTempState:function(){return e.get().fold(function(){return n.get()},function(t){return t})},updateTempState:function(t){var n=u(t);return o(),e.set(et.some(n)),n.url},addTempState:function(t){var n=u(t);return e.set(et.some(n)),n.url},applyTempState:function(n){return e.get().fold(function(){},function(t){c(t.blob),n()})},destroyTempState:o,undo:function(){var t=r.undo();return i(t),t.url},redo:function(){var t=r.redo();return i(t),t.url},getHistoryStates:function(){return{undoEnabled:r.canUndo(),redoEnabled:r.canRedo()}}}},gC=function(t,n){var u=mC(t.currentState),a=function(t){var n=u.getHistoryStates();g.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),$r(t,Xk.formActionEvent,{name:Xk.saveState(),value:n.undoEnabled})},c=function(t){return t.toBlob()},s=function(t){$r(t,Xk.formActionEvent,{name:Xk.disable(),value:{}})},f=function(t){e.getApplyButton(t).each(function(t){kh.enable(t)}),$r(t,Xk.formActionEvent,{name:Xk.enable(),value:{}})},l=function(t,n){return s(t),r.updateSrc(t,n)},d=function(n,t,e,o,r){return s(n),(i=t,JS(i)).then(e).then(c).then(o).then(function(t){return l(n,t).then(function(t){return a(n),r(),f(n),t})})["catch"](function(t){return H.console.log(t),f(n),t});var i},i=function(t,n,e){var o=u.getBlobState().blob;d(t,o,n,function(t){return u.updateTempState(t)},e)},m=function(t){var n=u.getBlobState().url;return u.destroyTempState(),a(t),n},r=eC(t.currentState.url),g=iC(n),e=Yk(r,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[e.memContainer.asSpec(),r.memContainer.asSpec(),g.container],behaviours:fa([ig.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),Ag("image-tools-events",[gi(jk.undo(),function(n,t){var e=u.undo();l(n,e).then(function(t){f(n),a(n)})}),gi(jk.redo(),function(n,t){var e=u.redo();l(n,e).then(function(t){f(n),a(n)})}),gi(jk.zoom(),function(t,n){var e=n.event().direction();r.zoom(t,e)}),gi(jk.back(),function(t,n){var e,o;o=m(e=t),l(e,o).then(function(t){f(e)}),n.event().swap()(),r.hideCrop()}),gi(jk.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),gi(jk.transform(),function(t,n){return i(t,n.event().transform(),tt)}),gi(jk.tempTransform(),function(t,n){return e=t,o=n.event().transform(),r=u.getTempState().blob,void d(e,r,o,function(t){return u.addTempState(t)},tt);var e,o,r}),gi(jk.transformApply(),function(t,n){return e=t,o=n.event().transform(),r=n.event().swap(),i=u.getBlobState().blob,void d(e,i,o,function(t){var n=u.addBlobState(t);return m(e),n},r);var e,o,r,i}),gi(jk.swap(),function(n,t){var e;e=n,g.updateButtonUndoStates(e,!1,!1);var o=t.event().transform(),r=t.event().swap();o.fold(function(){r()},function(t){i(n,t,r)})})]),pS()])}},pC=Dl({name:"HtmlSelect",configFields:[kr("options"),Of("selectBehaviours",[fg,ig]),Nr("selectClasses",[]),Nr("selectAttributes",{}),_r("data")],factory:function(e,t){var n=D(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),o=e.data.map(function(t){return At("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:n,behaviours:Ef(e.selectBehaviours,[fg.config({}),ig.config({store:mo({mode:"manual",getValue:function(t){return Ou(t.element())},setValue:function(t,n){V(e.options,function(t){return t.value===n}).isSome()&&Tu(t.element(),n)}},o)})])}}}),hC=function(e,n){var t=e.label.map(function(t){return Py(t,n)}),o=[Lm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(t){return Kr(t,qb),et.some(!0)}}),Ag("textfield-change",[gi(Jt(),function(t,n){$r(t,Wb,{name:e.name})}),gi(Fn(),function(t,n){$r(t,Wb,{name:e.name})})]),ix.config({})],r=e.validation.map(function(o){return ex.config({getRoot:function(t){return Ce(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=ig.getValue(t),e=o.validator(n);return my.pure(!0===e?yt.value(n):yt.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=ny.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:e.placeholder.fold(function(){},function(t){return{placeholder:n.translate(t)}}),inputClasses:[e.classname],inputBehaviours:fa(G([o,r])),selectOnFocus:!1,factory:Xy}),u=e.flex?["tox-form__group--stretched"]:[];return Ry(t,i,u)},vC=function(i){return mo({},i,{toCached:function(){return vC(i.toCached())},bindFuture:function(n){return vC(i.bind(function(t){return t.fold(function(t){return my.pure(yt.error(t))},function(t){return n(t)})}))},bindResult:function(n){return vC(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return vC(i.map(function(t){return t.map(n)}))},mapError:function(n){return vC(i.map(function(t){return t.mapError(n)}))},foldResult:function(n,e){return i.map(function(t){return t.fold(n,e)})},withTimeout:function(t,r){return vC(my.nu(function(n){var e=!1,o=H.setTimeout(function(){e=!0,n(yt.error(r()))},t);i.get(function(t){e||(H.clearTimeout(o),n(t))})}))}})},bC=function(t){return vC(my.nu(t))},yC=bC,xC={type:"separator"},wC=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},SC=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},kC=function(t,n){return o=t,e=F(n,function(t){return t.type===o}),D(e,wC);var e,o},CC=function(t,n){var e=t.toLowerCase();return F(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return Sn(n.toLowerCase(),e)||Sn(t.value.toLowerCase(),e)})},OC=function(c,t,s){var n=ig.getValue(t),f=n.meta.text!==undefined?n.meta.text:n.value;return s.getLinkInformation().fold(function(){return[]},function(t){var n,e,o,r,i,u,a=CC(f,(n=s.getHistory(c),D(n,function(t){return SC(t,t)})));return"file"===c?(e=[a,CC(f,(u=t,kC("header",u.targets))),CC(f,G([(i=t,et.from(i.anchorTop).map(function(t){return SC("<top>",t)}).toArray()),(r=t,kC("anchor",r.targets)),(o=t,et.from(o.anchorBottom).map(function(t){return SC("<bottom>",t)}).toArray())]))],R(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat(xC,n)},[])):a})},TC=fo("aria-invalid"),EC=function(i,o,r){var t,n,e,u,a,c=o.shared.providers,s=function(t){var n=ig.getValue(t);r.addToHistory(n.value,i.filetype)},f=ny.parts().field({factory:Iy,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":TC},minChars:0,responseTime:0,fetch:function(t){var n=OC(i.filetype,t,r),e=Gy(n,Dh.BUBBLE_TO_SANDBOX,o);return my.pure(e)},getHotspot:function(t){return h.getOpt(t)},onSetValue:function(t,n){t.hasConfigured(ex)&&ex.run(t).get(tt)},typeaheadBehaviours:fa(G([r.getValidationHandler().map(function(o){return ex.config({getRoot:function(t){return Ce(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(t,n){d.getOpt(t).each(function(t){Xe(t.element(),"title",c.translate(n))})}},validator:{validate:function(t){var e=ig.getValue(t);return yC(function(n){o({type:i.filetype,url:e.value},function(t){n(("invalid"===t.status?yt.error:yt.value)(t.message))})})},validateOnLoad:!1}})}).toArray(),[ix.config({}),Ag("urlinput-events",G(["file"===i.filetype?[gi(Jt(),function(t){$r(t,Wb,{name:i.name})})]:[],[gi(Qt(),function(t){$r(t,Wb,{name:i.name}),s(t)}),gi(Fn(),function(t){$r(t,Wb,{name:i.name}),s(t)})]]))]])),eventOrder:(t={},t[Jt()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:o.shared.getSink,parts:{menu:Hv(0,0,"normal")},onExecute:function(t,n,e){$r(n,qb,{})},onItemExecute:function(t,n,e,o){s(t),$r(t,Wb,{name:i.name})}}),l=i.label.map(function(t){return Py(t,c)}),d=Yg((n="invalid",e=et.some(TC),void 0===(u="warning")&&(u=n),void 0===a&&(a=n),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+n],innerHtml:Kg(u,c.icons),attributes:mo({title:c.translate(a),"aria-live":"polite"},e.fold(function(){return{}},function(t){return{id:t}}))}})),m=Yg({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),g=r.getUrlPicker(i.filetype),p=fo("browser.url.event"),h=Yg({dom:{tag:"div",classes:["tox-control-wrap"]},components:[f,m.asSpec()]});return ny.sketch({dom:Hy([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:G([[h.asSpec()],g.map(function(){return t=i.label,n=p,e="tox-browse-url",o="browse",r=c,Xg.sketch({dom:{tag:"button",classes:["tox-tbtn",e],innerHtml:Kg(o,r.icons),attributes:{title:r.translate(t.getOr(""))}},buttonBehaviours:fa([ix.config({})]),action:function(t){Kr(t,n)}});var t,n,e,o,r}).toArray()])}]),fieldBehaviours:fa([Ag("url-input-events",[gi(p,function(o){Rl.getCurrent(o).each(function(n){var e=ig.getValue(n);g.each(function(t){t(e).get(function(t){ig.setValue(n,t),$r(o,Wb,{name:i.name})})})})})])])})},BC=function(u,n){var t,e,o=u.label.map(function(t){return Py(t,n)}),r=function(e){return function(n,t){Lu(t.event().target(),"[data-collection-item-value]").each(function(t){e(n,t,qe(t,"data-collection-item-value"))})}},i=[gi(Xt(),r(function(t,n){ud(n)})),gi(Hn(),r(function(t,n,e){$r(t,Yb,{name:u.name,value:e})})),gi(Yt(),r(function(t,n,e){zu(t.element(),"."+Jp).each(function(t){su(t,Jp)}),cu(n,Jp)})),gi(qt(),r(function(t,n,e){zu(t.element(),"."+Jp).each(function(t){su(t,Jp)})})),Ti(r(function(t,n,e){$r(t,Yb,{name:u.name,value:e})}))],a=ny.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==u.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:d},behaviours:fa([Xm.config({}),ig.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){var n,e,r,i;n=o,e=D(t,function(t){var n,e=1===u.columns?'<div class="tox-collection__item-label">'+t.text+"</div>":"",o='<div class="tox-collection__item-icon">'+t.icon+"</div>",r={_:" "," - ":" ","-":" "},i=t.text.replace(/\_| \- |\-/g,function(t){return r[t]});return'<div class="tox-collection__item" tabindex="-1" data-collection-item-value="'+('"'===(n=t.value)?"&quot;":n)+'" title="'+i+'" aria-label="'+i+'">'+o+e+"</div>"}),r=1<u.columns&&"auto"!==u.columns?A(e,u.columns):[e],i=D(r,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"}),Ne(n.element(),i.join("")),"auto"===u.columns&&_p(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;Lm.setGridSize(o,n,e)}),Kr(o,Qb)}}),ix.config({}),Lm.config((t=u.columns,e="normal",1===t?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===t?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===e?".tox-swatches__row":".tox-collection__group",cell:"color"===e?"."+Xp:"."+Gp}})),Ag("collection-events",i)])});return Ry(o,a,["tox-form__group--collection"])},AC=function(r){return function(n,e,o){return Bt(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},DC={bar:AC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar"]},components:D(e.items,o.interpreter)};var e,o}),collection:AC(function(t,n){return BC(t,n.shared.providers)}),alloy:AC(d),alertbanner:AC(function(t,n){return e=t,o=n.shared.providers,Mb.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in","tox-notification--"+e.level]},components:[{dom:{tag:"div",classes:["tox-notification__icon"]},components:[Xg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:Kg(e.icon,o.icons),attributes:{title:o.translate(e.actionLabel)}},action:function(t){$r(t,Yb,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:AC(function(t,n){return e=t,o=n.shared.providers,hC({name:e.name,multiline:!1,label:e.label,placeholder:e.placeholder,flex:!1,classname:"tox-textfield",validation:et.none()},o);var e,o}),textarea:AC(function(t,n){return e=t,o=n.shared.providers,hC({name:e.name,multiline:!0,label:e.label,placeholder:e.placeholder,flex:!0,classname:"tox-textarea",validation:et.none()},o);var e,o}),listbox:AC(function(t,n){return e=t,o=n.shared.providers,r=Py(e.label,o),i=ny.parts().field({factory:pC,dom:{classes:["mce-select-field"]},selectBehaviours:fa([ix.config({})]),options:e.values,data:e.initialValue.getOr(undefined)}),Vy(et.some(r),i);var e,o,r,i}),label:AC(function(t,n){return e=t,o=n.shared,r={dom:{tag:"label",innerHtml:o.providers.translate(e.label),classes:["tox-label"]}},i=D(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:fa([pS(),Xm.config({}),OS(et.none()),Lm.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(sC=function(t,n){return VS(t,n.shared.providers)},function(t,n,e){var o=kt(n,{source:"dynamic"});return AC(sC)(t,o,e)}),autocomplete:AC(function(t,n){return i=n,e=Py((r=t).label.getOr("?"),i.shared.providers),o=ny.parts().field({factory:Iy,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(t){var n=ig.getValue(t),e=r.getItems(n),o=Gy(e,Dh.BUBBLE_TO_SANDBOX,i);return my.pure(o)},markers:{openClass:"dog"},lazySink:i.shared.getSink,parts:{menu:Hv(0,0,"normal")}}),Vy(et.some(e),o);var r,i,e,o}),button:AC(function(t,n){return e=t,o=n.shared.providers,r=_k(e.name,"custom"),Dk(e,r,o,[TS(""),pS()]);var e,o,r}),checkbox:AC(function(t,n){return e=t,o=n.shared.providers,r=ig.config({store:{mode:"manual",getValue:function(t){return t.element().dom().checked},setValue:function(t,n){t.element().dom().checked=n}}}),i=function(t){return t.element().dom().click(),et.some(!0)},u=ny.parts().field({factory:{sketch:d},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:fa([pS(),ix.config({}),fg.config({}),r,Lm.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),Ag("checkbox-events",[gi(Qt(),function(t,n){$r(t,Wb,{name:e.name})})])])}),a=ny.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:fa([sx.config({})])}),s=Yg({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:Kg("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),ny.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a]});var e,o,r,i,u,a,c,s}),colorinput:AC(function(t,n){return mx(t,n.shared,n.colorinput)}),colorpicker:AC(function(t){var n=function(t){return"tox-"+t},e=gS(yS,n),r=Yg(e.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(t){$r(t,Yb,{name:"hex-valid",value:!0})},onInvalidHex:function(t){$r(t,Yb,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:fa([ig.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return Rl.getCurrent(n).bind(function(t){return ig.getValue(t).hex}).map(function(t){return"#"+t}).getOr("")},setValue:function(t,n){var e=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(n),o=r.get(t);Rl.getCurrent(o).fold(function(){H.console.log("Can not find form")},function(t){ig.setValue(t,{hex:et.from(e[1]).getOr("")}),aS.getField(t,"hex").each(function(t){Kr(t,Jt())})})}}}),pS()])}}),dropzone:AC(function(t,n){return ES(t,n.shared.providers)}),grid:AC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:D(e.items,o.interpreter)};var e,o}),selectbox:AC(function(t,n){return e=t,o=n.shared.providers,r=D(e.items,function(t){return{text:o.translate(t.text),value:t.value}}),i=e.label.map(function(t){return Py(t,o)}),u=ny.parts().field({dom:{},selectAttributes:{size:e.size},options:r,factory:pC,selectBehaviours:fa([ix.config({}),Ag("selectbox-change",[gi(Qt(),function(t,n){$r(t,Wb,{name:e.name})})])])}),a=1<e.size?et.none():et.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:Kg("chevron-down",o.icons)}}),c={dom:{tag:"div",classes:["tox-selectfield"]},components:G([[u],a.toArray()])},ny.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([i.toArray(),[c]])});var e,o,r,i,u,a,c}),sizeinput:AC(function(t,n){return Lk(t,n.shared.providers)}),urlinput:AC(function(t,n){return EC(t,n,n.urlinput)}),customeditor:AC(function(n){var e=Ft(et.none()),o=Yg({dom:{tag:n.tag}}),r=Ft(et.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:fa([Ag("editor-foo-events",[ki(function(t){o.getOpt(t).each(function(t){n.init(t.element().dom()).then(function(n){r.get().each(function(t){n.setValue(t)}),r.set(et.none()),e.set(et.some(n))})})})]),ig.config({store:{mode:"manual",getValue:function(){return e.get().fold(function(){return r.get().getOr("")},function(t){return t.getValue()})},setValue:function(t,n){e.get().fold(function(){r.set(et.some(n))},function(t){return t.setValue(n)})}}}),pS()]),components:[o.asSpec()]}}),htmlpanel:AC(function(t){return"presentation"===t.presets?Mb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):Mb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:fa([ix.config({}),fg.config({})])})}),imagetools:AC(function(t,n){return gC(t,n.shared.providers)}),table:AC(function(t,n){return e=t,o=n.shared.providers,u=function(t){return{dom:{tag:"th",innerHtml:o.translate(t)}}},a=function(t){return{dom:{tag:"td",innerHtml:o.translate(t)}}},c=function(t){return{dom:{tag:"tr"},components:D(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:D(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:D(r,c)})],behaviours:fa([ix.config({}),fg.config({})])};var e,o,r,i,u,a,c})},_C={field:function(t,n){return n}},MC=function(n,t,e){var o=kt(e,{shared:{interpreter:function(t){return FC(n,t,o)}}});return FC(n,t,o)},FC=function(n,e,o){return Bt(DC,e.type).fold(function(){return H.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},IC=function(t){return t.y()},RC=function(t,n,e){return vc(t.x(),IC(t),e.northeast(),Ha(),"layout-ne")},VC=function(t,n,e){return vc((r=n,(o=t).x()+o.width()-r.width()),IC(t),e.northwest(),Pa(),"layout-nw");var o,r},NC=function(t,n,e){return vc((r=n,(o=t).x()+o.width()/2-r.width()/2),IC(t),e.north(),La(),"layout-n");var o,r},HC={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},PC=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m=Ub(t),g=function(){return ne.fromDom(t.getBody())};return{toolbar:(f=g,l=n,d=m,d?function(){return{anchor:"node",root:f(),node:et.from(f()),bubble:pc(-12,-12,HC),layouts:{onRtl:function(){return[RC]},onLtr:function(){return[VC]}}}}:function(){return{anchor:"hotspot",hotspot:l(),bubble:pc(-12,12,HC),layouts:{onRtl:function(){return[Cc]},onLtr:function(){return[Oc]}}}}),toolbarOverflow:(s=e,function(){return{anchor:"hotspot",hotspot:s(),layouts:{onRtl:function(){return[Cc]},onLtr:function(){return[Oc]}}}}),banner:(u=g,a=n,c=e,c?function(){return{anchor:"node",root:u(),node:et.from(u()),layouts:{onRtl:function(){return[NC]},onLtr:function(){return[NC]}}}}:function(){return{anchor:"hotspot",hotspot:a(),layouts:{onRtl:function(){return[Ac]},onLtr:function(){return[Ac]}}}}),cursor:(r=t,i=g,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return et.some(Gc.range(ne.fromDom(t.startContainer),t.startOffset,ne.fromDom(t.endContainer),t.endOffset))}}}),node:(o=g,function(t){return{anchor:"node",root:o(),node:t}})}},zC=function(t){return{colorPicker:(r=t,function(t,n){Mv.colorPickerDialog(r)(t,n)}),hasCustomColors:(o=t,function(){return gv(o)}),getColors:(e=t,function(){return pv(e)}),getColorCols:(n=t,function(){return Mv.getColorCols(n)})};var n,e,o,r},LC=[{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:"strike-through",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:"Align",items:[{title:"Left",icon:"align-left",format:"alignleft"},{title:"Center",icon:"align-center",format:"aligncenter"},{title:"Right",icon:"align-right",format:"alignright"},{title:"Justify",icon:"align-justify",format:"alignjustify"}]}],jC=function(t){return R(t,function(t,n){if(mt(n,"items")){var e=jC(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(mt(n,"inline")||mt(n,"block")||mt(n,"selector")){var o="custom-"+n.title.toLowerCase();return{customFormats:t.customFormats.concat([{name:o,format:n}]),formats:t.formats.concat([{title:n.title,format:o,icon:n.icon}])}}return mo({},t,{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},UC=function(i){return(t=i,et.from(t.getParam("style_formats")).filter(z)).map(function(t){var n,e,o,r=(n=i,e=jC(t),o=function(t){j(t,function(t){n.formatter.has(t.name)||n.formatter.register(t.name,t.format)})},n.formatter?o(e.customFormats):n.on("init",function(){o(e.customFormats)}),e.formats);return i.getParam("style_formats_merge",!1,"boolean")?LC.concat(r):r}).getOr(LC);var t},WC=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return kt(t,o)},GC=function(s,t,f,l){var d=function(t){return D(t,function(t){var n,e,o,r,i,u,a=rt(t);if(Mt(t,"items")){var c=d(t.items);return kt((i=t,u={type:"submenu",isSelected:nt(!1),getStylePreview:function(){return et.none()}},kt(i,u)),{getStyleItems:function(){return c}})}return Mt(t,"format")?WC(t,f,l):1===a.length&&T(a,"title")?kt(t,{type:"separator"}):(e=fo((n=t).title),o={type:"formatter",format:e,isSelected:f(e),getStylePreview:l(e)},r=kt(n,o),s.formatter.register(e,r),r)})};return d(t)},XC=Jk.trim,YC=function(n){return function(t){if(t&&1===t.nodeType){if(t.contentEditable===n)return!0;if(t.getAttribute("data-mce-contenteditable")===n)return!0}return!1}},qC=YC("true"),KC=YC("false"),$C=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},JC=function(t){return t.innerText||t.textContent},QC=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&tO(t);var n},ZC=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},tO=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return qC(t)}return!1}(t)&&!KC(t)},nO=function(t){return ZC(t)&&tO(t)},eO=function(t){var n,e,o=(n=t).id?n.id:fo("h");return $C("header",JC(t),"#"+o,ZC(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},oO=function(t){var n=t.id||t.name,e=JC(t);return $C("anchor",e||"#"+n,"#"+n,0,tt)},rO=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,D(hs(ne.fromDom(e),n),function(t){return t.dom()})},iO=function(t){return 0<XC(t.title).length},uO=function(t){var n,e=rO(t);return F((n=e,D(F(n,nO),eO)).concat(D(F(e,QC),oO)),iO)},aO="tinymce-url-history",cO=function(t){return P(t)&&/^https?/.test(t)},sO=function(t){return w(t)&&ft(t,function(t){return!(z(n=t)&&n.length<=5&&Y(n,cO));var n}).isNone()},fO=function(){var t,n=H.localStorage.getItem(aO);if(null===n)return{};try{t=JSON.parse(n)}catch(e){if(e instanceof SyntaxError)return H.console.log("Local storage "+aO+" was not valid JSON",e),{};throw e}return sO(t)?t:(H.console.log("Local storage "+aO+" was not valid format",t),{})},lO=function(t){var n=fO();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},dO=function(n,t){if(cO(n)){var e=fO(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=F(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!sO(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));H.localStorage.setItem(aO,JSON.stringify(t))}(e)}},mO=Object.prototype.hasOwnProperty,gO=function(t){return!!t},pO=function(t){return at(Jk.makeMap(t,/[, ]/),gO)},hO=function(t,n,e){var o,r,i=(o=t,r=n,mO.call(o,r)?et.some(o[r]):et.none()).getOr(e);return P(i)?et.some(i):et.none()},vO=function(t){return et.some(t.file_picker_callback).filter(b)},bO=function(t,n){var e,o,r,i,u=(e=t,o=et.some(e.file_picker_types).filter(gO),r=et.some(e.file_browser_callback_types).filter(gO),i=o.or(r).map(pO),vO(e).fold(function(){return!1},function(t){return i.fold(function(){return!0},function(t){return 0<rt(t).length&&t})}));return S(u)?u?vO(t):et.none():u[n]?vO(t):et.none()},yO=function(n){return{getHistory:lO,addToHistory:dO,getLinkInformation:function(){return!1===(t=n).settings.typeahead_urls?et.none():et.some({targets:uO(t.getBody()),anchorTop:hO(t.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:hO(t.settings,"anchor_bottom","#bottom").getOrUndefined()});var t},getValidationHandler:function(){return t=n.settings.filepicker_validator_handler,b(t)?et.some(t):et.none();var t},getUrlPicker:function(t){return i=t,bO((r=n).settings,i).map(function(o){return function(n){return my.nu(function(e){var t=Jk.extend({filetype:i},et.from(n.meta).getOr({}));o.call(r,function(t,n){if(!P(t))throw new Error("Expected value to be string");if(n!==undefined&&!w(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},xO=function(t,n,e,o){var r={shared:{providers:{icons:function(){return n.ui.registry.getAll().icons},menuItems:function(){return n.ui.registry.getAll().menuItems},translate:Up.translate},interpreter:function(t){return FC(_C,t,r)},anchors:PC(n,e,o),getSink:function(){return yt.value(t)}},urlinput:yO(n),styleselect:function(e){var o=function(t){return function(){return e.formatter.match(t)}},r=function(n){return function(){var t=e.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:e.formatter.getCssText(n)}):et.none()}},i=function(t){var n=t.items;return n!==undefined&&0<n.length?X(n,i):[t.format]},u=Ft([]),a=Ft([]),c=Ft([]),s=Ft([]),f=Ft(!1);e.on("init",function(){var t=UC(e),n=GC(e,t,o,r);u.set(n),a.set(X(n,i))}),e.on("addStyleModifications",function(t){var n=GC(e,t.items,o,r);c.set(n),f.set(t.replace),s.set(X(n,i))});return{getData:function(){var t=f.get()?[]:u.get(),n=c.get();return t.concat(n)},getFlattenedKeys:function(){var t=f.get()?[]:a.get(),n=s.get();return t.concat(n)}}}(n),colorinput:zC(n)};return r},wO=nt([kr("dom"),Nr("shell",!0),Of("toolbarBehaviours",[Xm])]),SO=nt([nl({name:"groups",overrides:function(t){return{behaviours:fa([Xm.config({})])}}})]),kO=_l({name:"Toolbar",configFields:wO(),partFields:SO(),factory:function(n,t,e,o){var r=function(t){return n.shell?et.some(t):ml(t,n,"groups")},i=n.shell?{behaviours:[Xm.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:i.components,behaviours:Ef(n.toolbarBehaviours,i.behaviours),apis:{setGroups:function(t,n){r(t).fold(function(){throw H.console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},function(t){Xm.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),CO=ee("within","extra","withinWidth"),OO=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return et.some({element:nt(t),start:nt(n),finish:nt(n+e),width:nt(e)})},R(t,function(n,t){return e(t,n.len).fold(nt(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=F(r,function(t){return t.finish()<=n}),u=I(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:nt(i),extra:nt(a),withinWidth:nt(u)}},TO=function(t){return D(t,function(t){return t.element()})},EO=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p,h=(r=t,i=n,u=e,a=OO(i,r,u),0===a.extra().length?et.some(a):et.none()).getOrThunk(function(){return OO(n,t-e(o),e)}),v=h.within(),b=h.extra(),y=h.withinWidth();return 1===b.length&&b[0].width()<=e(o)?(m=b,g=y,p=TO(v.concat(m)),CO(p,[],g)):1<=b.length?(s=b,f=o,l=y,d=TO(v).concat([f]),CO(d,TO(s),l)):(c=y,CO(TO(v),[],c))},BO=function(t,n){var e=D(n,function(t){return Nu(t)});kO.setGroups(t,e)},AO=function(t,n,e,o){var r=gl(t,n,"primary"),i=ml(t,n,"overflow-button"),u=ry.getCoupled(t,"overflowGroup");hu(r.element(),"visibility","hidden");var a,c=(a=i,e.bind(function(n){return cd(n.element()).bind(function(t){return n.getSystem().getByDom(t).toOption()})}).orThunk(function(){return a.filter(fg.isFocused)}));e.each(function(t){kO.setGroups(t,[])});var s=n.builtGroups.get();BO(r,s.concat([u]));var f=Ba(r.element()),l=EO(f,s,function(t){return Ba(t.element())},u);0===l.extra().length?(Xm.remove(r,u),e.each(function(t){kO.setGroups(t,[])})):(BO(r,l.within()),e.each(function(t){BO(t,l.extra())})),ku(r.element(),"visibility"),Cu(r.element()),e.each(function(n){i.each(function(t){return Sg.set(t,o(n))}),c.each(fg.focus)})},DO=nt([kr("items"),$u(["itemSelector"]),Of("tgroupBehaviours",[Lm])]),_O=nt([el({name:"items",unit:"item"})]),MO=_l({name:"ToolbarGroup",configFields:DO(),partFields:_O(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,behaviours:Ef(t.tgroupBehaviours,[Lm.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),FO=nt([Of("splitToolbarBehaviours",[]),Gr("builtGroups",function(){return Ft([])})]),IO=function(o,t,n,e,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:Ef(o.splitToolbarBehaviours,[ry.config({others:mo({},r.coupling,{overflowGroup:function(n){return MO.sketch(mo({},e["overflow-group"](),{items:[Xg.sketch(mo({},e["overflow-button"](),{action:function(t){Kr(n,i)}}))]}))}})}),Ag("toolbar-toggle-events",[gi(i,function(t){r.toggleToolbar(t,o,e)})])]),apis:{setGroups:function(t,n){var e;e=D(n,t.getSystem().build),o.builtGroups.set(e),r.refresh(t,o)},refresh:function(t){r.refresh(t,o)},getMoreButton:function(t){return ml(t,o,"overflow-button")},getOverflow:function(t){return n=t,r.getOverflow(n);var n},toggle:function(t){r.toggleToolbar(t,o,e)}},domModification:{attributes:{role:"group"}}}},RO=nt([$u(["overflowToggledClass"]),kr("getAnchor"),kr("lazySink")].concat(FO())),VO=nt([Zf({factory:kO,schema:wO(),name:"primary"}),tl({factory:kO,schema:wO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:fa([Lm.config({mode:"cyclic",onEscape:function(t){return ml(t,n,"overflow-button").each(fg.focus),et.none()}})])}}}),tl({name:"overflow-button",overrides:function(t){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:fa([Sg.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),tl({name:"overflow-group"})]),NO=function(t,n,e){var o=ry.getCoupled(t,"sandbox");yf.isOpen(o)?yf.close(o):yf.open(o,e.overflow())},HO=function(t){return t.getSystem().isConnected()},PO=function(o,r){var t=yf.getState(ry.getCoupled(o,"sandbox"));AO(o,r,t,HO),t.each(function(t){var n=r.lazySink(o).getOrDie(),e=r.getAnchor(o);$s.position(n,e,t)})},zO=_l({name:"SplitFloatingToolbar",configFields:RO(),partFields:VO(),factory:function(n,t,e,o){return IO(n,t,0,o,{refresh:PO,toggleToolbar:NO,getOverflow:function(t){return yf.getState(ry.getCoupled(t,"sandbox"))},coupling:{sandbox:function(t){return o=t,e=n,{dom:{tag:"div",attributes:{id:(r=ju()).id()}},behaviours:fa([Lm.config({mode:"special",onEscape:function(t){return yf.close(t),et.some(!0)}}),yf.config({onOpen:function(t,n){PO(o,e),ml(o,e,"overflow-button").each(function(t){Sg.on(t),r.link(t.element())}),Lm.focusIn(n)},onClose:function(){ml(o,e,"overflow-button").each(function(t){Sg.off(t),fg.focus(t),r.unlink(t.element())})},isPartOf:function(t,n,e){return Wu(n,e)||Wu(o,e)},getAttachPoint:function(){return e.lazySink(o).getOrDie()}})])};var o,e,r}}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),LO=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},jO=function(t){return t.dimension.property},UO=function(t,n){return t.dimension.getDimension(n)},WO=function(t,n){var e=LO(t,n);du(e,[n.shrinkingClass,n.growingClass])},GO=function(t,n){su(t.element(),n.openClass),cu(t.element(),n.closedClass),hu(t.element(),jO(n),"0px"),Cu(t.element())},XO=function(t,n){su(t.element(),n.closedClass),cu(t.element(),n.openClass),ku(t.element(),jO(n))},YO=function(t,n,e,o){e.setCollapsed(),hu(t.element(),jO(n),UO(n,t.element())),Cu(t.element()),WO(t,n),GO(t,n),n.onStartShrink(t),n.onShrunk(t)},qO=function(t,n,e,o){var r=o.getOrThunk(function(){return UO(n,t.element())});e.setCollapsed(),hu(t.element(),jO(n),r),Cu(t.element());var i=LO(t,n);su(i,n.growingClass),cu(i,n.shrinkingClass),GO(t,n),n.onStartShrink(t)},KO=function(t,n,e){var o=UO(n,t.element());("0px"===o?YO:qO)(t,n,e,et.some(o))},$O=function(t,n,e){var o=LO(t,n),r=fu(o,n.shrinkingClass),i=UO(n,t.element());XO(t,n);var u=UO(n,t.element());(r?function(){hu(t.element(),jO(n),i),Cu(t.element())}:function(){GO(t,n)})(),su(o,n.shrinkingClass),cu(o,n.growingClass),XO(t,n),hu(t.element(),jO(n),u),e.setExpanded(),n.onStartGrow(t)},JO=function(t,n,e){var o=LO(t,n);return!0===fu(o,n.growingClass)},QO=function(t,n,e){var o=LO(t,n);return!0===fu(o,n.shrinkingClass)},ZO=/* */Object.freeze({refresh:function(t,n,e){if(e.isExpanded()){ku(t.element(),jO(n));var o=UO(n,t.element());hu(t.element(),jO(n),o)}},grow:function(t,n,e){e.isExpanded()||$O(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&KO(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&YO(t,n,e,et.none())},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:JO,isShrinking:QO,isTransitioning:function(t,n,e){return!0===JO(t,n)||!0===QO(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?KO:$O)(t,n,e)},disableTransitions:WO}),tT=/* */Object.freeze({exhibit:function(t,n){var e=n.expanded;return qi(e?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:At(n.dimension.property,"0px")})},events:function(e,o){return fi([Si(tn(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(WO(t,e),o.isExpanded()&&ku(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),nT=[kr("closedClass"),kr("openClass"),kr("shrinkingClass"),kr("growingClass"),_r("getAnimationRoot"),Qu("onShrunk"),Qu("onStartShrink"),Qu("onGrown"),Qu("onStartGrow"),Nr("expanded",!1),Cr("dimension",pr("property",{width:[ea("property","width"),ea("getDimension",function(t){return Ba(t)+"px"})],height:[ea("property","height"),ea("getDimension",function(t){return _a(t)+"px"})]}))],eT=da({fields:nT,name:"sliding",active:tT,apis:ZO,state:/* */Object.freeze({init:function(t){var n=Ft(t.expanded);return Xi({isExpanded:function(){return!0===n.get()},isCollapsed:function(){return!1===n.get()},setCollapsed:g(n.set,!1),setExpanded:g(n.set,!0),readState:function(){return"expanded: "+n.get()}})}})}),oT=nt([$u(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"])].concat(FO())),rT=nt([Zf({factory:kO,schema:wO(),name:"primary"}),Zf({factory:kO,schema:wO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:fa([eT.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass,onShrunk:function(t){ml(t,n,"overflow-button").each(function(t){Sg.off(t),fg.focus(t)})},onGrown:function(t){Lm.focusIn(t)},onStartGrow:function(t){ml(t,n,"overflow-button").each(Sg.on)}}),Lm.config({mode:"acyclic",onEscape:function(t){return ml(t,n,"overflow-button").each(fg.focus),et.some(!0)}})])}}}),tl({name:"overflow-button",overrides:function(t){return{buttonBehaviours:fa([Sg.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),tl({name:"overflow-group"})]),iT=function(n,e){ml(n,e,"overflow").each(function(t){aT(n,e),eT.toggleGrow(t)})},uT=function(t){return eT.hasGrown(t)},aT=function(t,n){var e=ml(t,n,"overflow");AO(t,n,e,uT),e.each(eT.refresh)},cT=_l({name:"SplitSlidingToolbar",configFields:oT(),partFields:rT(),factory:function(n,t,e,o){return IO(n,t,0,o,{refresh:aT,toggleToolbar:iT,getOverflow:function(t){return ml(t,n,"overflow")},coupling:{}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),sT="silver.readonly",fT=$o([(fC="readonly",Cr(fC,xr))]),lT=function(t,n){var e,o,r,i=t.outerContainer;o=n,r=(e=t).outerContainer.element(),o&&(e.mothership.broadcastOn([xf()],{target:r}),e.uiMothership.broadcastOn([xf()],{target:r})),e.mothership.broadcastOn([sT],{readonly:o}),e.uiMothership.broadcastOn([sT],{readonly:o}),ye("*",i.element()).forEach(function(t){i.getSystem().getByDom(t).each(function(t){t.hasConfigured(kh)&&kh.set(t,n)})})},dT=function(t,n){t.on("init",function(){t.readonly&&lT(n,!0)}),t.on("SwitchMode",function(){return lT(n,t.readonly)}),t.getParam("readonly",!1,"boolean")&&t.setMode("readonly")},mT=function(n){var t;return ba.config({channels:(t={},t[sT]={schema:fT,onReceive:function(t,o){n(t).each(function(t){var n,e;n=t,e=o.readonly,ye("*",n.element()).forEach(function(t){n.getSystem().getByDom(t).each(function(t){t.hasConfigured(kh)&&kh.set(t,e)})})})}},t)})},gT=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:mo({tag:"div",classes:["tox-toolbar__group"]},n),components:[MO.parts().items({})],items:t.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])"},tgroupBehaviours:fa([ix.config({}),fg.config({})])}},pT=function(t){return MO.sketch(gT(t))},hT=function(e,t,n){var o=ki(function(t){var n=D(e.initGroups,pT);kO.setGroups(t,n)});return fa([Lm.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Ag("toolbar-events",[o]),mT(n)])},vT=function(t,n){var e=t.cyclicKeying?"cyclic":"acyclic";return{uid:t.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":gT({title:et.none(),items:[]}),"overflow-button":Bk({name:"more",icon:et.some("more-drawer"),disabled:!1,tooltip:et.some("More...")},et.none(),t.backstage.shared.providers)},splitToolbarBehaviours:hT(t,e,n)}},bT=function(t){var n=vT(t,zO.getOverflow),e=zO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return zO.sketch(mo({},n,{lazySink:t.getSink,getAnchor:function(){return t.backstage.shared.anchors.toolbarOverflow()},parts:mo({},n.parts,{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"]}}}),components:[e],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))},yT=function(t){var n=cT.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=cT.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),o=vT(t,cT.getOverflow);return cT.sketch(mo({},o,{components:[n,e],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"}}))},xT=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return kO.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[kO.parts().groups({})],toolbarBehaviours:hT(t,n,nt(et.none()))})},wT=[jr("disabled",!1),Ir("tooltip"),Ir("icon"),Ir("text"),Ur("onSetup",function(){return tt})],ST=$o([Or("type"),Er("onAction")].concat(wT)),kT=function(t){return lr("toolbarbutton",ST,t)},CT=$o([Or("type"),Ir("tooltip"),Ir("icon"),Ir("text"),Er("fetch"),Ur("onSetup",function(){return tt})]),OT=function(t){return lr("menubutton",CT,t)},TT=$o([Or("type"),Ir("tooltip"),Ir("icon"),Ir("text"),Rr("select"),Er("fetch"),Ur("onSetup",function(){return tt}),Lr("presets","normal",["normal","color","listpreview"]),Nr("columns",1),Er("onAction"),Er("onItemAction")]),ET=[jr("active",!1)].concat(wT),BT=$o(ET.concat([Or("type"),Er("onAction")])),AT=function(t){return lr("ToggleButton",BT,t)},DT=[Ur("predicate",function(){return!1}),Lr("scope","node",["node","editor"]),Lr("position","selection",["node","selection","line"])],_T=wT.concat([Nr("type","contextformbutton"),Nr("primary",!1),Er("onAction"),Gr("original",d)]),MT=ET.concat([Nr("type","contextformbutton"),Nr("primary",!1),Er("onAction"),Gr("original",d)]),FT=wT.concat([Nr("type","contextformbutton")]),IT=ET.concat([Nr("type","contextformtogglebutton")]),RT=pr("type",{contextformbutton:_T,contextformtogglebutton:MT}),VT=$o([Nr("type","contextform"),Ur("initValue",function(){return""}),Ir("label"),Dr("commands",RT),Mr("launch",pr("type",{contextformbutton:FT,contextformtogglebutton:IT}))].concat(DT)),NT=$o([Nr("type","contexttoolbar"),Or("items")].concat(DT)),HT=fo("toolbar.button.execute"),PT={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},zT=/* */Object.freeze({getState:function(t,n,e){return e}}),LT=/* */Object.freeze({events:function(r,i){var o=function(e,o){r.updateState.each(function(t){var n=t(e,o);i.set(n)}),r.renderComponents.each(function(t){var n=t(o,i.get());of(e),j(n,function(t){Zs(e,e.getSystem().build(t))})})};return fi([gi(In(),function(t,n){var e=r.channel;T(n.channels(),e)&&o(t,n.data())}),ki(function(n,t){r.initialData.each(function(t){o(n,t)})})])}}),jT=/* */Object.freeze({init:function(t){var n=Ft(et.none());return{readState:function(){return n.get().getOr("none")},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(et.none())}}}}),UT=[kr("channel"),_r("renderComponents"),_r("updateState"),_r("initialData")],WT=da({fields:UT,name:"reflecting",active:LT,apis:zT,state:jT}),GT=nt([kr("toggleClass"),kr("fetch"),ta("onExecute"),Nr("getHotspot",et.some),Nr("getAnchorOverrides",nt({})),Nr("layouts",et.none()),ta("onItemExecute"),_r("lazySink"),kr("dom"),Qu("onOpen"),Of("splitDropdownBehaviours",[ry,Lm,fg]),Nr("matchWidth",!1),Nr("useMinWidth",!1),Nr("eventOrder",{}),_r("role")].concat(_y())),XT=Zf({factory:Xg,schema:[kr("dom")],name:"arrow",defaults:function(t){return{buttonBehaviours:fa([fg.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(Jr)},buttonBehaviours:fa([Sg.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),YT=Zf({factory:Xg,schema:[kr("dom")],name:"button",defaults:function(t){return{buttonBehaviours:fa([fg.revoke()])}},overrides:function(e){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(n){n.getSystem().getByUid(e.uid).each(function(t){e.onExecute(t,n)})}}}}),qT=nt([XT,YT,nl({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[kr("text")],name:"aria-descriptor"}),tl({schema:[Ku()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),py()]),KT=_l({name:"SplitDropdown",configFields:GT(),partFields:qT(),factory:function(o,t,n,e){var r=function(t){Rl.getCurrent(t).each(function(t){ql.highlightFirst(t),Lm.focusIn(t)})},i=function(t){yy(o,function(t){return t},t,e,r,Pb.HighlightFirst).get(tt)},u=function(t){var n=gl(t,o,"button");return Jr(n),et.some(!0)},a=Ct(fi([ki(function(e,t){ml(e,o,"aria-descriptor").each(function(t){var n=fo("aria");Xe(t.element(),"id",n),Xe(e.element(),"aria-describedby",n)})})]),Gg(et.some(i)));return{uid:o.uid,dom:o.dom,components:t,eventOrder:mo({},o.eventOrder,{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:Ef(o.splitDropdownBehaviours,[ry.config({others:{sandbox:function(t){var n=gl(t,o,"arrow");return Sy(o,t,{onOpen:function(){Sg.on(n),Sg.on(t)},onClose:function(){Sg.off(n),Sg.off(t)}})}}}),Lm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),et.some(!0)}}),fg.config({}),Sg.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),$T=fo("update-menu-text"),JT=fo("update-menu-icon"),QT=function(t,n,o){var e=Ft(tt),r=t.text.map(function(t){return Yg(Tk(t,n,o.providers))}),i=t.icon.map(function(t){return Yg(Ok(t,o.providers.icons))}),u=function(t,n){var e=ig.getValue(t);return fg.focus(e),$r(e,"keydown",{raw:n.event().raw()}),cx.close(e),et.some(!0)},a=t.role.fold(function(){return{}},function(t){return{role:t}}),c=t.tooltip.fold(function(){return{}},function(t){var n=o.providers.translate(t);return{title:n,"aria-label":n}});return Yg(cx.sketch(mo({},a,{dom:{tag:"button",classes:[n,n+"--select"].concat(D(t.classes,function(t){return n+"--"+t})),attributes:mo({},c)},components:Mh([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),et.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:Kg("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:fa(t.dropdownBehaviours.concat([Oh(t.disabled),sx.config({}),Xm.config({}),Ag("dropdown-events",[Bh(t,e),Ah(t,e)]),Ag("menubutton-update-display-text",[gi($T,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){Xm.set(t,[Fu(o.providers.translate(e.event().text()))])})}),gi(JT,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){Xm.set(t,[Ok(e.event().icon(),o.providers.icons)])})})])])),eventOrder:kt(PT,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:fa([Lm.config({mode:"special",onLeft:u,onRight:u})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:Hv(0,t.columns,t.presets)},fetch:function(){return my.nu(t.fetch)}}))).asSpec()},ZT=function(n){return{isDisabled:function(){return kh.isDisabled(n)},setDisabled:function(t){return kh.set(n,t)}}},tE=function(n){return{setActive:function(t){Sg.set(n,t)},isActive:function(){return Sg.isOn(n)},isDisabled:function(){return kh.isDisabled(n)},setDisabled:function(t){return kh.set(n,t)}}},nE=function(e){return{isDisabled:function(){return kh.isDisabled(e)},setDisabled:function(t){return kh.set(e,t)},setActive:function(t){var n=e.element();t?(cu(n,"tox-tbtn--enabled"),Xe(n,"aria-pressed",!0)):(su(n,"tox-tbtn--enabled"),$e(n,"aria-pressed"))},isActive:function(){return fu(e.element(),"tox-tbtn--enabled")}}},eE=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},oE=fo("focus-button"),rE=["checklist","ordered-list"],iE=["indent","outdent","table-insert-column-after","table-insert-column-before","unordered-list"],uE=function(n,e,t,o,r,i){var u,a=function(t){return Up.isRtl()&&T(rE,t)?t+"-rtl":t},c=Up.isRtl()&&n.exists(function(t){return T(iE,t)});return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]).concat(c?["tox-tbtn__icon-rtl"]:[]),attributes:eE(t,i)},components:Mh([n.map(function(t){return Ck(a(t),i.icons)}),e.map(function(t){return Tk(t,"tox-tbtn",i)})]),eventOrder:(u={},u[jt()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:fa([Ag("common-button-display-events",[gi(jt(),function(t,n){n.event().prevent(),Kr(t,oE)})])].concat(o.map(function(t){return WT.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t,n){return Mh([t.icon.map(function(t){return Ck(a(t),i.icons)}),t.text.map(function(t){return Tk(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},aE=function(t,n,e){var o,r=Ft(tt),i=uE(t.icon,t.text,t.tooltip,et.none(),et.none(),e);return Xg.sketch({dom:i.dom,components:i.components,eventOrder:PT,buttonBehaviours:fa([Ag("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},Ti(function(n,t){Eh(o,n)(function(t){$r(n,HT,{buttonApi:t}),o.onAction(t)})})),Bh(n,r),Ah(n,r)]),Oh(t.disabled)].concat(n.toolbarButtonBehaviours))})},cE=function(t,n,e){return aE(t,{toolbarButtonBehaviours:[].concat(0<e.length?[Ag("toolbarButtonWith",e)]:[]),getApi:ZT,onSetup:t.onSetup},n)},sE=function(t,n,e){return kt(aE(t,{toolbarButtonBehaviours:[Xm.config({}),Sg.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[Ag("toolbarToggleButtonWith",e)]:[]),getApi:tE,onSetup:t.onSetup},n))},fE=function(n,t){var e,o,r,i,u=fo("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return kh.isDisabled(e)},setDisabled:function(t){return kh.set(e,t)},setIconFill:function(t,n){zu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Xe(t,"fill",n)})},setIconStroke:function(t,n){zu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Xe(t,"stroke",n)})},setActive:function(n){Xe(e.element(),"aria-pressed",n),zu(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return Sg.set(t,n)})})},isActive:function(){return zu(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists(Sg.isOn)})}}},c=Ft(tt),s={getApi:a,onSetup:n.onSetup};return KT.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:Ct({"aria-pressed":!1},eE(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(t,n,e){},splitDropdownBehaviours:fa([Th(!1),Ag("split-dropdown-events",[gi(oE,fg.focus),Bh(s,c),Ah(s,c)])]),eventOrder:(e={},e[Gn()]=["alloy.base.behaviour","split-dropdown-events"],e),toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:(o=a,r=n,i=t.providers,function(n){return my.nu(function(t){return r.fetch(t)}).map(function(t){return et.from(ib(kt(jv(fo("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,Dh.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:Wv(r.columns,r.presets),menuBehaviours:Fp("auto"!==r.columns?[]:[ki(function(o,t){_p(o,4,Qp(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;Lm.setGridSize(o,n,e)})})])})))})}),parts:{menu:Hv(0,n.columns,n.presets)},components:[KT.parts().button(uE(n.icon,n.text,et.none(),et.some(u),et.some([Sg.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),KT.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:Kg("chevron-down",t.providers.icons)}}),KT.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},lE=function(t,n,e,o){return QT({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(Gy(t,Dh.CLOSE_ON_EXECUTE,e))})},onSetup:t.onSetup,getApi:nE,columns:1,presets:"normal",classes:[],dropdownBehaviours:[]},n,e.shared)},dE=function(i,u){return gi(HT,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return Kr(e,zn())},getValue:function(){return ig.getValue(e)}});u.onAction(r,n.event().buttonApi())})},mE=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m,g,p={backstage:{shared:{providers:e}}};return"contextformtogglebutton"===n.type?(s=t,l=p,(d=(f=n).original).primary,m=go(d,["primary"]),g=dr(AT(mo({},m,{type:"togglebutton",onAction:function(){}}))),sE(g,l.backstage.shared.providers,[dE(s,f)])):(o=t,i=p,(u=(r=n).original).primary,a=go(u,["primary"]),c=dr(kT(mo({},a,{type:"button",onAction:function(){}}))),cE(c,i.backstage.shared.providers,[dE(o,r)]))},gE=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=Yg(Xy.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:fa([Lm.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return Jr(t),!0})},onLeft:function(t,n){return n.cut(),et.none()},onRight:function(t,n){return n.cut(),et.none()}})])})),c=(e=a,o=t.commands,r=n.shared.providers,i=D(o,function(t){return Yg(mE(e,t,r))}),{asSpecs:function(){return D(i,function(t){return t.asSpec()})},findPrimary:function(e){return Rt(o,function(t,n){return t.primary?et.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(x(kh.isDisabled)):et.none()})}});return xT({uid:fo("context-toolbar"),initGroups:[{title:et.none(),items:[a.asSpec()]},{title:et.none(),items:c.asSpecs()}],onEscape:et.none,cyclicKeying:!0,backstage:n,getSink:function(){return yt.error("")}})},pE=fo("forward-slide"),hE=fo("backward-slide"),vE=fo("change-slide-event"),bE="tox-pop--resizing",yE=function(n,t){return Rt(t,function(t){return t.predicate(n.dom())?et.some({toolbarApi:t,elem:n}):et.none()})},xE=function(n,e){var t=function(t){return t.dom()===e.getBody()},o=ne.fromDom(e.selection.getNode());return yE(o,n.inNodeScope).orThunk(function(){return yE(o,n.inEditorScope).orThunk(function(){return function(t,n,e){for(var o=t.dom(),r=b(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=ne.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return et.none()}(o,function(t){return yE(t,n.inNodeScope)},t)})})},wE=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=dr(lr("ContextForm",VT,e));(t[n]=o).launch.map(function(t){a["form:"+n]=mo({},e.launch,{type:"contextformtogglebutton"===t.type?"togglebutton":"button",onAction:function(){r(o)}})}),"editor"===o.scope?u.push(o):i.push(o),c[n]=o},s=function(n,e){var t;(t=e,lr("ContextToolbar",NT,t)).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=rt(e);return j(n,function(t){var n=e[t];"contextform"===n.type?o(t,n):"contexttoolbar"===n.type&&s(t,n)}),{forms:t,inNodeScope:i,inEditorScope:u,lookupTable:c,formNavigators:a}},SE=function(o,r){return function(n){var e=Ft(et.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(et.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},kE=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},CE=function(t,n,e,o){var i,u,r,a,c,s="basic"===e.type?function(){return D(e.data,function(t){return WC(t,o.isSelectedFor,o.getPreviewFor)})}:e.getData;return{items:(i=n,u=o,r=function(t,n,e){var o=i.shared.providers.translate(t.title);if("separator"===t.type)return et.some({type:"separator",text:o});if("submenu"!==t.type)return et.some(mo({type:"togglemenuitem",text:o,active:t.isSelected(),disabled:e,onAction:u.onAction(t)},t.getStylePreview().fold(function(){return{}},function(t){return{meta:{style:t}}})));var r=X(t.getStyleItems(),function(t){return a(t,n)});return 0===n&&r.length<=0?et.none():et.some({type:"nestedmenuitem",text:o,disabled:r.length<=0,getSubmenuItems:function(){return X(t.getStyleItems(),function(t){return a(t,n)})}})},a=function(t,n){var e="formatter"===t.type&&u.isInvalid(t);return 0===n?e?[]:r(t,n,!1).toArray():r(t,n,e).toArray()},c=function(t){var n=u.shouldHide?0:1;return X(t,function(t){return a(t,n)})},{validateItems:c,getFetch:function(o,r){return function(t){var n=r(),e=c(n);t(Gy(e,Dh.CLOSE_ON_EXECUTE,o))}}}),getStyleItems:s}},OE=function(o,t,n,r){var e=CE(0,t,n,r),i=e.items,u=e.getStyleItems;return QT({text:r.icon.isSome()?et.none():et.some(""),icon:r.icon,tooltip:et.from(r.tooltip),role:et.none(),fetch:i.getFetch(t,u),onSetup:function(e){return r.setInitialValue.each(function(t){return t(e.getComponent())}),r.nodeChangeHandler.map(function(t){var n=t(e.getComponent());return o.on("NodeChange",n),function(){o.off("NodeChange",n)}}).getOr(tt)},getApi:function(t){return{getComponent:function(){return t}}},columns:1,presets:"normal",classes:r.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};(dC=lC||(lC={}))[dC.SemiColon=0]="SemiColon",dC[dC.Space=1]="Space";var TE,EE,BE=function(t,n,e,o){var r,i,u=Bt(t.settings,n).getOr(e);return{type:"basic",data:(i=u,r=o===lC.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),D(r,function(t){var n=t,e=t,o=t.split("=");return 1<o.length&&(n=o[0],e=o[1]),{title:n,format:e}}))}},AE=[{title:"Left",icon:"align-left",format:"alignleft"},{title:"Center",icon:"align-center",format:"aligncenter"},{title:"Right",icon:"align-right",format:"alignright"},{title:"Justify",icon:"align-justify",format:"alignjustify"}],DE=function(e){var n=function(t){var n=V(AE,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});$r(t,JT,{icon:"align-"+n})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),r={type:"basic",data:AE};return{tooltip:"Align",icon:et.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getPreviewFor:function(t){return function(){return et.none()}},onAction:kE(e),setInitialValue:o,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},_E=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],ME=function(r){var o=function(){var e=function(t){return t?t.split(",")[0]:""},t=r.queryCommandValue("FontName"),n=i.data,o=t?t.toLowerCase():"";return V(n,function(t){var n=t.format;return n.toLowerCase()===o||e(n).toLowerCase()===e(o).toLowerCase()}).orThunk(function(){return 0===(t=o).indexOf("-apple-system")&&(n=t.toLowerCase().split(/['"]?\s*,\s*['"]?/),Y(_E,function(t){return-1<n.indexOf(t.toLowerCase())}))?et.from({title:"System Font",format:o}):et.none();var t,n})},n=function(t){var n=r.queryCommandValue("FontName"),e=o().fold(function(){return n},function(t){return t.title});$r(t,$T,{text:e})},t=et.some(function(t){return function(){return n(t)}}),e=et.some(function(t){return n(t)}),i=BE(r,"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",lC.SemiColon);return{tooltip:"Fonts",icon:et.none(),isSelectedFor:function(n){return function(){return o().exists(function(t){return t.format===n})}},getPreviewFor:function(t){return function(){return et.some({tag:"div",styleAttr:-1===t.indexOf("dings")?"font-family:"+t:""})}},onAction:function(t){return function(){r.undoManager.transact(function(){r.focus(),r.execCommand("FontName",!1,t.format)})}},setInitialValue:e,nodeChangeHandler:t,dataset:i,shouldHide:!1,isInvalid:function(){return!1}}},FE={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},IE=function(t,n){return/[0-9.]+px$/.test(t)?(e=72*parseInt(t,10)/96,o=n||0,r=Math.pow(10,o),Math.round(e*r)/r+"pt"):t;var e,o,r},RE=function(e){var i=function(){var o=et.none(),r=u.data,i=e.queryCommandValue("FontSize");if(i)for(var t=function(t){var n=IE(i,t),e=dt(FE,n).getOr("");o=V(r,function(t){return t.format===i||t.format===n||t.format===e})},n=3;o.isNone()&&0<=n;n--)t(n);return{matchOpt:o,px:i}},n=function(t){var n=i(),e=n.matchOpt,o=n.px,r=e.fold(function(){return o},function(t){return t.title});$r(t,$T,{text:r})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),u=BE(e,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",lC.Space);return{tooltip:"Font sizes",icon:et.none(),isSelectedFor:function(n){return function(){return i().matchOpt.exists(function(t){return t.format===n})}},getPreviewFor:function(){return function(){return et.none()}},onAction:function(t){return function(){e.undoManager.transact(function(){e.focus(),e.execCommand("FontSize",!1,t.format)})}},setInitialValue:o,nodeChangeHandler:t,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}},VE=function(e,t,n){var o=t();return Rt(n,function(n){return V(o,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?et.some({title:"Paragraph",format:"p"}):et.none()})},NE=function(t){var n=t.selection.getStart(!0)||t.getBody();return t.dom.getParents(n,function(){return!0},t.getBody())},HE=function(o){var e=function(t,n){var e=VE(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});$r(n,$T,{text:e})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=NE(o);e(n,t)}),r=BE(o,"block_formats","Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre",lC.SemiColon);return{tooltip:"Blocks",icon:et.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:o.formatter.getCssText(n)})}},onAction:kE(o),setInitialValue:n,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},PE=function(i){var e=function(t,n){var e=function(t){var n=t.items;return n!==undefined&&0<n.length?X(n,e):[{title:t.title,format:t.format}]},o=X(UC(i),e),r=VE(i,function(){return o},t).fold(function(){return"Paragraph"},function(t){return t.title});$r(n,$T,{text:r})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=NE(i);e(n,t)});return{tooltip:"Formats",icon:et.none(),isSelectedFor:function(t){return function(){return i.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=i.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:i.formatter.getCssText(n)}):et.none()}},onAction:kE(i),setInitialValue:n,nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)}}},zE=[{name:"history",items:["undo","redo"]},{name:"styles",items:["styleselect"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],LE=function(o,r){return function(t,n){var e=o(t).mapError(function(t){return gr(t)}).getOrDie();return r(e,n)}},jE={button:LE(kT,function(t,n){return e=t,o=n.backstage.shared.providers,cE(e,o,[]);var e,o}),togglebutton:LE(AT,function(t,n){return e=t,o=n.backstage.shared.providers,sE(e,o,[]);var e,o}),menubutton:LE(OT,function(t,n){return lE(t,"tox-tbtn",n.backstage,et.none())}),splitbutton:LE(function(t){return lr("SplitButton",TT,t)},function(t,n){return fE(t,n.backstage.shared)}),styleSelectButton:function(t,n){return e=t,o=n.backstage,r=o.styleselect,OE(e,o,r,PE(e));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,r=RE(e),OE(e,o,r.dataset,r);var e,o,r},fontSelectButton:function(t,n){return e=t,o=n.backstage,r=ME(e),OE(e,o,r.dataset,r);var e,o,r},formatButton:function(t,n){return e=t,o=n.backstage,r=HE(e),OE(e,o,r.dataset,r);var e,o,r},alignMenuButton:function(t,n){return e=t,o=n.backstage,r=DE(e),OE(e,o,r.dataset,r);var e,o,r}},UE={styleselect:jE.styleSelectButton,fontsizeselect:jE.fontsizeSelectButton,fontselect:jE.fontSelectButton,formatselect:jE.formatButton,align:jE.alignMenuButton},WE=function(t){var n,e,o,r=t.toolbar,i=t.buttons;return!1===r?[]:r===undefined||!0===r?(e=i,o=D(zE,function(t){var n=F(t.items,function(t){return mt(e,t)||mt(UE,t)});return{name:t.name,items:n}}),F(o,function(t){return 0<t.items.length})):P(r)?(n=r.split("|"),D(n,function(t){return{items:t.trim().split(" ")}})):y(r,function(t){return mt(t,"name")&&mt(t,"items")})?r:(H.console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},GE=function(n,e,o,r,t){return dt(e,o.toLowerCase()).orThunk(function(){return t.bind(function(t){return Rt(t,function(t){return dt(e,t+o.toLowerCase())})})}).fold(function(){return dt(UE,o.toLowerCase()).map(function(t){return t(n,r)}).orThunk(function(){return et.none()})},function(t){return e=r,dt(jE,(n=t).type).fold(function(){return H.console.error("skipping button defined by",n),et.none()},function(t){return et.some(t(n,e))});var n,e})},XE=function(e,o,r,i){var t=WE(o),n=D(t,function(t){var n=X(t.items,function(t){return 0===t.trim().length?[]:GE(e,o.buttons,t,r,i).toArray()});return{title:et.from(e.translate(t.name)),items:n}});return F(n,function(t){return 0<t.items.length})},YE=function(i,t,u,c){var e,o,s=Vu((e={sink:u,onEscape:function(){return i.focus(),et.some(!0)}},o=Ft([]),Wg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){o.set([]),Wg.getContent(t).each(function(t){ku(t.element(),"visibility")}),su(t.element(),bE),ku(t.element(),"width")},inlineBehaviours:fa([Ag("context-toolbar-events",[Si(tn(),function(t,n){Wg.getContent(t).each(function(t){}),su(t.element(),bE),ku(t.element(),"width")}),gi(vE,function(n,e){ku(n.element(),"width");var t=Ba(n.element());Wg.setContent(n,e.event().contents()),cu(n.element(),bE);var o=Ba(n.element());hu(n.element(),"width",t+"px"),Wg.getContent(n).each(function(t){e.event().focus().bind(function(t){return ud(t),cd(n.element())}).orThunk(function(){return Lm.focusIn(t),ad()})}),Qg.setTimeout(function(){hu(n.element(),"width",o+"px")},0)}),gi(pE,function(t,n){Wg.getContent(t).each(function(t){o.set(o.get().concat([{bar:t,focus:ad()}]))}),$r(t,vE,{contents:n.event().forwardContents(),focus:et.none()})}),gi(hE,function(n,t){Z(o.get()).each(function(t){o.set(o.get().slice(0,o.get().length-1)),$r(n,vE,{contents:Nu(t.bar),focus:t.focus})})})]),Lm.config({mode:"special",onEscape:function(n){return Z(o.get()).fold(function(){return e.onEscape()},function(t){return Kr(n,hE),et.some(!0)})}})]),lazySink:function(){return yt.value(e.sink)}}))),f=function(){return et.some(ne.fromDom(i.contentAreaContainer))};i.on("init",function(){var t=i.getBody().ownerDocument.defaultView,n=lb(ne.fromDom(t),"scroll",function(){l.get().each(function(t){var n=d.get().getOr(i.selection.getNode()).getBoundingClientRect(),e=i.contentAreaContainer.getBoundingClientRect(),o=n.bottom<0,r=n.top>e.height;o||r?hu(s.element(),"display","none"):(ku(s.element(),"display"),$s.positionWithin(u,t,s,f()))})});i.on("remove",function(){n.unbind()})});var l=Ft(et.none()),d=Ft(et.none()),n=Ft(null),m=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:fa([Lm.config({mode:"acyclic"}),Ag("pop-dialog-wrap-events",[ki(function(t){i.shortcuts.add("ctrl+F9","focus statusbar",function(){return Lm.focusIn(t)})}),Ci(function(t){i.shortcuts.remove("ctrl+F9")})])])}},a=en(function(){return wE(t,function(t){var n=g(t);$r(s,pE,{forwardContents:m(n)})})}),g=function(t){var n,e,o=i.ui.registry.getAll().buttons,r=a();return"contexttoolbar"===t.type?(n=Ct(o,r.formNavigators),e=XE(i,{buttons:n,toolbar:t.items},c,et.some(["form:"])),xT({uid:fo("context-toolbar"),initGroups:e,onEscape:et.none,cyclicKeying:!0,backstage:c.backstage,getSink:function(){return yt.error("")}})):gE(t,c.backstage)};i.on("contexttoolbar-show",function(n){var t=a();Bt(t.lookupTable,n.toolbarKey).each(function(t){b(t,n.target===i?et.none():et.some(n)),Wg.getContent(s).each(Lm.focusIn)})});var r={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},p={maxHeightFunction:fc()},h={bubble:pc(12,0,r),layouts:{onLtr:function(){return[Dc]},onRtl:function(){return[_c]}},overrides:p},v={bubble:pc(0,12,r),layouts:{onLtr:function(){return[Bc,Ac,Tc,Cc,Ec,Oc]},onRtl:function(){return[Bc,Ac,Ec,Oc,Tc,Cc]}},overrides:p},b=function(t,n){x();var e,o,r,i=g(t),u=n.map(ne.fromDom),a=(e=t.position,o=u,r="node"===e?c.backstage.shared.anchors.node(o):c.backstage.shared.anchors.cursor(),kt(r,"line"===e?h:v));l.set(et.some(a)),d.set(n),Wg.showWithin(s,a,m(i),f()),ku(s.element(),"display")},y=function(){var t=a();xE(t,i).fold(function(){l.set(et.none()),Wg.hide(s)},function(t){b(t.toolbarApi,et.some(t.elem.dom()))})},x=function(){var t=n.get();null!==t&&(Qg.clearTimeout(t),n.set(null))},w=function(t){x(),n.set(t)};i.on("init",function(){i.on("click keyup SetContent ObjectResized ResizeEditor",function(t){w(Qg.setEditorTimeout(i,y,0))}),i.on("focusout",function(t){Qg.setEditorTimeout(i,function(){cd(u.element()).isNone()&&cd(s.element()).isNone()&&(l.set(et.none()),Wg.hide(s))},0)}),i.on("SwitchMode",function(){i.readonly&&(l.set(et.none()),Wg.hide(s))}),i.on("NodeChange",function(t){cd(s.element()).fold(function(){w(Qg.setEditorTimeout(i,y,0))},function(t){})})})},qE=function(t,e,o){var n=lb(ne.fromDom(H.document),"mousedown",function(n){j([e,o],function(t){t.broadcastOn([xf()],{target:n.target()})})}),r=lb(ne.fromDom(H.document),"touchstart",function(n){j([e,o],function(t){t.broadcastOn([xf()],{target:n.target()})})}),i=lb(ne.fromDom(H.document),"mouseup",function(n){0===n.raw().button&&j([e,o],function(t){t.broadcastOn([wf()],{target:n.target()})})}),u=function(n){j([e,o],function(t){t.broadcastOn([xf()],{target:ne.fromDom(n.target)})})};t.on("mousedown",u),t.on("touchstart",u);var a=function(n){0===n.button&&j([e,o],function(t){t.broadcastOn([wf()],{target:ne.fromDom(n.target)})})};t.on("mouseup",a);var c=function(n){j([e,o],function(t){t.broadcastEvent(Un(),n)})};t.on("ScrollWindow",c);var s=function(n){j([e,o],function(t){t.broadcastEvent(Wn(),n)})};t.on("ResizeWindow",s),t.on("remove",function(){t.off("mousedown",u),t.off("touchstart",u),t.off("mouseup",a),t.off("ResizeWindow",s),t.off("ScrollWindow",c),n.unbind(),r.unbind(),i.unbind()}),t.on("detach",function(){af(e),af(o),e.destroy(),o.destroy()})},KE=nt([Nr("shell",!1),kr("makeItem"),Nr("setupItem",tt),Bf.field("listBehaviours",[Xm])]),$E=nl({name:"items",overrides:function(t){return{behaviours:fa([Xm.config({})])}}}),JE=nt([$E]),QE=_l({name:nt("CustomList")(),configFields:KE(),partFields:JE(),factory:function(s,t,n,e){var o=s.shell?{behaviours:[Xm.config({})],components:[]}:{behaviours:[],components:t},r=function(t){return s.shell?et.some(t):ml(t,s,"items")};return{uid:s.uid,dom:s.dom,components:o.components,behaviours:Ef(s.listBehaviours,o.behaviours),apis:{setItems:function(a,c){r(a).fold(function(){throw H.console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},function(n){var t=Xm.contents(n),e=c.length,o=e-t.length,r=0<o?B(o,function(){return s.makeItem()}):[],i=t.slice(e);j(i,function(t){return Xm.remove(n,t)}),j(r,function(t){return Xm.append(n,t)});var u=Xm.contents(n);j(u,function(t,n){s.setupItem(a,t,c[n],n)})})}}}},apis:{setItems:function(t,n,e){t.setItems(n,e)}}}),ZE=wl,tB=rl,nB=Dl({factory:function(n,o){var t={focus:Lm.focusIn,setMenus:function(t,n){var e=D(n,function(n){var t={type:"menubutton",text:n.text,fetch:function(t){t(n.getItems())}},e=OT(t).mapError(function(t){return gr(t)}).getOrDie();return lE(e,"tox-mbtn",o.backstage,et.some("menuitem"))});Xm.set(t,e)}};return{uid:n.uid,dom:n.dom,components:[],behaviours:fa([Xm.config({}),Ag("menubar-events",[ki(function(t){n.onSetup(t)}),gi(Xt(),function(e,t){zu(e.element(),".tox-mbtn--active").each(function(n){Lu(t.event().target(),".tox-mbtn").each(function(t){we(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){cx.expand(t),cx.close(n),fg.focus(t)})})})})}),gi(qn(),function(e,t){t.event().prevFocus().bind(function(t){return e.getSystem().getByDom(t).toOption()}).each(function(n){t.event().newFocus().bind(function(t){return e.getSystem().getByDom(t).toOption()}).each(function(t){cx.isOpen(n)&&(cx.expand(t),cx.close(n))})})})]),Lm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return n.onEscape(t),et.some(!0)}}),ix.config({})]),apis:t,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[kr("dom"),kr("uid"),kr("onEscape"),kr("backstage"),Nr("onSetup",tt)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),eB="container",oB=[Of("slotBehaviours",[])],rB=function(t){return"<alloy.field."+t+">"},iB=function(r,t,n){var e,o=function(t){return vl(r)},i=function(e,o){return void 0===o&&(o=undefined),function(t,n){return ml(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},u=function(t,n){return"true"!==qe(t.element(),"aria-hidden")},a=i(u,!1),c=i(function(t,n){if(u(t)){var e=t.element();hu(e,"display","none"),Xe(e,"aria-hidden","true"),$r(t,Kn(),{name:n,visible:!1})}}),s=(e=c,function(n,t){j(t,function(t){return e(n,t)})}),f=i(function(t,n){if(!u(t)){var e=t.element();ku(e,"display"),$e(e,"aria-hidden"),$r(t,Kn(),{name:n,visible:!0})}}),l={getSlotNames:o,getSlot:function(t,n){return ml(t,r,n)},isShowing:a,hideSlot:c,hideAllSlots:function(t){return s(t,o())},showSlot:f};return{uid:r.uid,dom:r.dom,components:t,behaviours:Tf(r.slotBehaviours),apis:l}},uB=at({getSlotNames:function(t,n){return t.getSlotNames(n)},getSlot:function(t,n,e){return t.getSlot(n,e)},isShowing:function(t,n,e){return t.isShowing(n,e)},hideSlot:function(t,n,e){return t.hideSlot(n,e)},hideAllSlots:function(t,n){return t.hideAllSlots(n)},showSlot:function(t,n,e){return t.showSlot(n,e)}},Wi),aB=mo({},uB,{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),cl(eB,rB(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=D(r,function(t){return Zf({name:t,pname:rB(t)})});return kl(eB,oB,i,iB,o)}}),cB=$o([Ir("icon"),Ir("tooltip"),Ur("onShow",tt),Ur("onHide",tt),Ur("onSetup",function(){return tt})]),sB=function(t){return{element:function(){return t.element().dom()}}},fB=function(e,o){var r=D(rt(o),function(t){var n=o[t],e=dr(lr("sidebar",cB,n));return{name:t,getApi:sB,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return D(r,function(t){var n=Ft(tt);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Fp([Bh(t,n),Ah(t,n),gi(Kn(),function(n,t){var e=t.event();V(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},lB=function(t,e){Rl.getCurrent(t).each(function(t){return Xm.set(t,[(n=e,aB.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:fB(t,n),slotBehaviours:Fp([ki(function(t){return aB.hideAllSlots(t)})])}}))]);var n})},dB=function(t){return Rl.getCurrent(t).bind(function(t){return eT.isGrowing(t)||eT.hasGrown(t)?Rl.getCurrent(t).bind(function(n){return V(aB.getSlotNames(n),function(t){return aB.isShowing(n,t)})}):et.none()})},mB=fo("FixSizeEvent"),gB=fo("AutoSizeEvent"),pB=function(t,n,e){var o,r=t.element();!0===n?(Xm.set(t,[(o=e,{dom:{tag:"div",attributes:{"aria-label":o.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:jp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:fa([Lm.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),fg.config({})])})]),ku(r,"display"),$e(r,"aria-hidden")):(Xm.set(t,[]),hu(r,"display","none"),Xe(r,"aria-hidden","true"))},hB=tB.optional({factory:nB,name:"menubar",schema:[kr("backstage")]}),vB=tB.optional({factory:{sketch:function(t){return QE.sketch({uid:t.uid,dom:t.dom,listBehaviours:fa([Lm.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:function(){return xT({uid:fo("multiple-toolbar-item"),backstage:t.backstage,cyclicKeying:!1,getSink:t.getSink,initGroups:[],onEscape:function(){return et.none()}})},setupItem:function(t,n,e,o){kO.setGroups(n,e)},shell:!0})}},name:"multiple-toolbar",schema:[kr("dom"),kr("onEscape")]}),bB=tB.optional({factory:{sketch:function(t){var n;return((n=t).split===Db.sliding?yT:n.split===Db.floating?bT:xT)({uid:t.uid,onEscape:function(){return t.onEscape(),et.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,backstage:t.backstage,moreDrawerData:{lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton}})}},name:"toolbar",schema:[kr("dom"),kr("onEscape"),kr("getSink")]}),yB=tB.optional({name:"socket",schema:[kr("dom")]}),xB=tB.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"complementary"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:fa([ix.config({}),fg.config({}),eT.config({dimension:{property:"width"},closedClass:"tox-sidebar--sliding-closed",openClass:"tox-sidebar--sliding-open",shrinkingClass:"tox-sidebar--sliding-shrinking",growingClass:"tox-sidebar--sliding-growing",onShrunk:function(t){Rl.getCurrent(t).each(aB.hideAllSlots),Kr(t,gB)},onGrown:function(t){Kr(t,gB)},onStartGrow:function(t){$r(t,mB,{width:wu(t.element(),"width").getOr("")})},onStartShrink:function(t){$r(t,mB,{width:Ba(t.element())+"px"})}}),Xm.config({}),Rl.config({find:function(t){var n=Xm.contents(t);return Q(n)}})])}],behaviours:fa([vS(0),Ag("sidebar-sliding-events",[gi(mB,function(t,n){hu(t.element(),"width",n.event().width())}),gi(gB,function(t,n){ku(t.element(),"width")})])])}}},name:"sidebar",schema:[kr("dom")]}),wB=tB.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:fa([Xm.config({})]),components:[]}}},name:"throbber",schema:[kr("dom")]}),SB=_l({name:"OuterContainer",factory:function(e,t,n){var o={getSocket:function(t){return ZE.getPart(t,e,"socket")},setSidebar:function(t,n){ZE.getPart(t,e,"sidebar").each(function(t){return lB(t,n)})},toggleSidebar:function(t,o){ZE.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void Rl.getCurrent(n).each(function(n){Rl.getCurrent(n).each(function(t){eT.hasGrown(n)?aB.isShowing(t,e)?eT.shrink(n):(aB.hideAllSlots(t),aB.showSlot(t,e)):(aB.hideAllSlots(t),aB.showSlot(t,e),eT.grow(n))})});var n,e})},whichSidebar:function(t){return ZE.getPart(t,e,"sidebar").bind(dB).getOrNull()},getToolbar:function(t){return ZE.getPart(t,e,"toolbar")},setToolbar:function(t,n){ZE.getPart(t,e,"toolbar").each(function(t){t.getApis().setGroups(t,n)})},setToolbars:function(t,n){ZE.getPart(t,e,"multiple-toolbar").each(function(t){QE.setItems(t,n)})},refreshToolbar:function(t){ZE.getPart(t,e,"toolbar").each(function(t){return t.getApis().refresh(t)})},getMoreButton:function(t){return ZE.getPart(t,e,"toolbar").bind(function(t){return t.getApis().getMoreButton(t)})},getThrobber:function(t){return ZE.getPart(t,e,"throbber")},focusToolbar:function(t){ZE.getPart(t,e,"toolbar").orThunk(function(){return ZE.getPart(t,e,"multiple-toolbar")}).each(function(t){Lm.focusIn(t)})},setMenubar:function(t,n){ZE.getPart(t,e,"menubar").each(function(t){nB.setMenus(t,n)})},focusMenubar:function(t){ZE.getPart(t,e,"menubar").each(function(t){nB.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:o,behaviours:e.behaviours}},configFields:[kr("dom"),kr("behaviours")],partFields:[hB,bB,vB,yB,xB,wB],apis:{getSocket:function(t,n){return t.getSocket(n)},setSidebar:function(t,n,e){t.setSidebar(n,e)},toggleSidebar:function(t,n,e){t.toggleSidebar(n,e)},whichSidebar:function(t,n){return t.whichSidebar(n)},getToolbar:function(t,n){return t.getToolbar(n)},setToolbar:function(t,n,e){var o=D(e,function(t){return pT(t)});t.setToolbar(n,o)},setToolbars:function(t,n,e){var o=D(e,function(t){return D(t,pT)});t.setToolbars(n,o)},getMoreButton:function(t,n){return t.getMoreButton(n)},refreshToolbar:function(t,n){return t.refreshToolbar(n)},getThrobber:function(t,n){return t.getThrobber(n)},setMenubar:function(t,n,e){t.setMenubar(n,e)},focusMenubar:function(t,n){t.focusMenubar(n)},focusToolbar:function(t,n){t.focusToolbar(n)}}}),kB={file:{title:"File",items:"newdocument restoredraft | preview | print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align | forecolor backcolor | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck code wordcount"},table:{title:"Table",items:"inserttable tableprops deletetable row column cell"},help:{title:"Help",items:"help"}},CB=function(t){return"string"==typeof t?t.split(" "):t},OB=function(u,a){var c=Ct(kB,a.menus),n=0<rt(a.menus).length,t=a.menubar===undefined||!0===a.menubar?CB("file edit view insert format tools table help"):CB(!1===a.menubar?"":a.menubar),e=F(t,function(t){return n&&a.menus.hasOwnProperty(t)&&a.menus[t].hasOwnProperty("items")||kB.hasOwnProperty(t)}),o=D(e,function(t){var n,e,o,r,i=c[t];return n={title:i.title,items:CB(i.items)},e=a,r=(o=u,o.getParam("removed_menuitems","")).split(/[ ,]/),{text:n.title,getItems:function(){return X(n.items,function(t){var n=t.toLowerCase();return 0===n.trim().length?[]:E(r,function(t){return t===n})?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]})}}});return F(o,function(t){return 0<t.getItems().length&&E(t.getItems(),function(t){return"separator"!==t.type})})},TB=function(t){var n=function(){t._skinLoaded=!0,bv(t)};return function(){t.initialized?n():t.on("init",n)}},EB=function(t,n){var e,o=function(t){var n=t.settings,e=n.skin,o=n.skin_url;if(!1!==e){var r=e||"oxide";o=o?t.documentBaseURI.toAbsolute(o):Ib.baseURL+"/skins/ui/"+r}return o}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),!1==(!1===n.getParam("skin"))&&e?Rh.DOM.styleSheetLoader.load(e,TB(n)):TB(n)()},BB=g(EB,!1),AB=g(EB,!0),DB=function(n,t,e,o){var r=t.outerContainer,i=e.toolbar,u=e.buttons;if(y(i,P)){var a=i.map(function(t){return XE(n,{toolbar:t,buttons:u},{backstage:o},et.none())});SB.setToolbars(r,a)}else SB.setToolbar(r,XE(n,e,{backstage:o},et.none()))},_B=Rh.DOM,MB={render:function(e,o,t,n,r){var i,u,a=Ft(0);BB(e),i=ne.fromDom(r.targetNode),u=o.mothership,uf(i,u,Ae),rf(ri(),o.uiMothership),e.on("init",function(){DB(e,o,t,n),a.set(e.getWin().innerWidth),SB.setMenubar(o.outerContainer,OB(e,t)),SB.setSidebar(o.outerContainer,t.sidebar),function(o){var r=o.getWin(),t=o.getDoc().documentElement,i=Ft(wa(r.innerWidth,r.innerHeight)),u=Ft(wa(t.offsetWidth,t.offsetHeight)),n=function(){var t=o.getDoc().documentElement,n=i.get(),e=u.get();n.left()!==r.innerWidth||n.top()!==r.innerHeight?(i.set(wa(r.innerWidth,r.innerHeight)),xv(o)):e.left()===t.offsetWidth&&e.top()===t.offsetHeight||(u.set(wa(t.offsetWidth,t.offsetHeight)),xv(o))};_B.bind(r,"resize",n);var e=db(ne.fromDom(o.getBody()),"load",n);o.on("remove",function(){e.unbind(),_B.unbind(r,"resize",n)})}(e)});var c=SB.getSocket(o.outerContainer).getOrDie("Could not find expected socket element");dT(e,o),e.addCommand("ToggleSidebar",function(t,n){SB.toggleSidebar(o.outerContainer,n),e.fire("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",function(){return SB.whichSidebar(o.outerContainer)});var s=Lb(e);return s!==Db.sliding&&s!==Db.floating||e.on("ResizeContent",function(){var t=e.getWin().innerWidth;t!==a.get()&&SB.refreshToolbar(o.outerContainer),a.set(t)}),{iframeContainer:c.element().dom(),editorContainer:o.outerContainer.element().dom()}},getBehaviours:function(t){return[]}},FB=function(e,n){return Oe(e).orThunk(function(){var t=ne.fromTag("span");Be(e,t);var n=Oe(t);return Ie(t),n}).map(function(t){return ka(t).translate(-n.left(),-n.top())}).getOrThunk(function(){return wa(0,0)})},IB=xt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),RB=function(n){return function(t){return t.translate(-n.left(),-n.top())}},VB=function(n){return function(t){return t.translate(n.left(),n.top())}},NB=function(e){return function(t,n){return R(e,function(t,n){return n(t)},wa(t,n))}},HB=function(t,n,e){return t.fold(NB([VB(e),RB(n)]),NB([RB(n)]),NB([]))},PB=function(t,n,e){return t.fold(NB([VB(e)]),NB([]),NB([VB(n)]))},zB=function(t,n,e){return t.fold(NB([]),NB([RB(e)]),NB([VB(n),RB(e)]))},LB=function(t,n,e){return t.fold(function(t,n){return{position:"absolute",left:t+"px",top:n+"px"}},function(t,n){return{position:"absolute",left:t-e.left()+"px",top:n-e.top()+"px"}},function(t,n){return{position:"fixed",left:t+"px",top:n+"px"}})},jB=IB.offset,UB=IB.absolute,WB=IB.fixed,GB=function(t,n){cu(t.element(),n.transitionClass),su(t.element(),n.fadeOutClass),cu(t.element(),n.fadeInClass)},XB=function(t,n){cu(t.element(),n.transitionClass),su(t.element(),n.fadeInClass),cu(t.element(),n.fadeOutClass)},YB=function(t,n){return t.y()>=n.y()&&t.bottom()<=n.bottom()},qB=function(t,n){return Ke(t,n)?et.some(parseInt(qe(t,n),10)):et.none()},KB=function(o,r,i){return(u=o,t=r,n=u.element(),qB(n,t.leftAttr).bind(function(o){return qB(n,t.topAttr).map(function(t){var n=Ba(u.element()),e=_a(u.element());return Xa(o,t,n,e)})})).bind(function(t){return YB(t,i)?(n=r,e=o.element(),$e(e,n.leftAttr),$e(e,n.topAttr),et.some(UB(t.x(),t.y()))):et.none();var n,e});var u,t,n},$B=function(t,n,e,o,r){var i=ka(t.element()),u=Xa(i.left(),i.top(),Ba(t.element()),_a(t.element()));if(YB(u,e))return et.none();a=t,c=n,s=i.left(),f=i.top(),l=a.element(),Xe(l,c.leftAttr,s),Xe(l,c.topAttr,f);var a,c,s,f,l,d=UB(i.left(),i.top()),m=HB(d,o,r),g=UB(e.x(),e.y()),p=HB(g,o,r),h=u.y()<=e.y()?p.top():p.top()+e.height()-u.height();return et.some(WB(m.left(),h))},JB=function(i,t,n){var u=t.lazyViewport(i);t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=Ya(t);((e=u,(n=o).y()<e.bottom()&&n.bottom()>e.y())?GB:XB)(i,r)})});var e,o,r,a,c,s=Se(i.element()),f=Oa(s),l=FB(i.element(),f);(e=i,o=t,r=u,a=f,c=l,wu(e.element(),"position").is("fixed")?KB(e,o,r):$B(e,o,r,a,c)).each(function(t){var n=LB(t,0,l);vu(i.element(),n)})},QB=/* */Object.freeze({refresh:JB}),ZB=/* */Object.freeze({events:function(o,t){return fi([gi(tn(),function(n,e){o.contextual.each(function(t){we(n.element(),e.event().target())&&(su(n.element(),t.transitionClass),e.stop())})}),gi(Un(),function(t,n){JB(t,o)})])}}),tA=[Vr("contextual",[kr("fadeInClass"),kr("fadeOutClass"),kr("transitionClass"),kr("lazyContext")]),Nr("lazyViewport",function(t){var n=Oa();return Xa(n.left(),n.top(),H.window.innerWidth,H.window.innerHeight)}),kr("leftAttr"),kr("topAttr")],nA=da({fields:tA,name:"docking",active:ZB,apis:QB}),eA={render:function(o,n,e,r,t){var i,u=Rh.DOM,a=Ub(o),c=Lb(o),s=c===Db.sliding||c===Db.floating;AB(o);var f=function(t){var n=wu(i.element(),"position").is("fixed"),e=function(t){void 0===t&&(t=0);var n=ka(ne.fromDom(o.getBody()));return{top:Math.round(n.top()-_a(i.element()))+t,left:Math.round(n.left())}}(s?t.fold(function(){return 0},function(t){return 1<t.components().length?_a(t.components()[1].element()):0}):0);n?Ye(i.element(),ct(e,function(t,n){return{k:"data-dock-"+n,v:t}})):vu(i.element(),at(e,function(t){return t+"px"})),nA.refresh(i)},l=function(){var t=SB.getToolbar(n.outerContainer);s&&SB.refreshToolbar(n.outerContainer),a||f(t)},d=function(){hu(n.outerContainer.element(),"display","flex"),u.addClass(o.getBody(),"mce-edit-focus"),ku(n.uiMothership.element(),"display"),l()},m=function(){n.outerContainer&&(hu(n.outerContainer.element(),"display","none"),u.removeClass(o.getBody(),"mce-edit-focus")),hu(n.uiMothership.element(),"display","none")},g=function(){if(i)d();else{i=n.outerContainer;var t=jb(o).getOr(ri());rf(t,n.mothership),rf(t,n.uiMothership),DB(o,n,e,r),SB.setMenubar(n.outerContainer,OB(o,e)),a||hu(i.element(),"position","absolute"),l(),d(),o.on("NodeChange ResizeWindow",l),o.on("activate",d),o.on("deactivate",m),o.nodeChanged()}};return o.on("focus",g),o.on("blur hide",m),o.on("init",function(){o.hasFocus()&&g()}),dT(o,n),{editorContainer:n.outerContainer.element().dom()}},getBehaviours:function(n){return Ub(n)?[]:[nA.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(t){return et.from(n).map(function(t){return ne.fromDom(t.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),fg.config({})]}},oA=function(n){Jk.each([{name:"alignleft",text:"Align left",cmd:"JustifyLeft",icon:"align-left"},{name:"aligncenter",text:"Align center",cmd:"JustifyCenter",icon:"align-center"},{name:"alignright",text:"Align right",cmd:"JustifyRight",icon:"align-right"},{name:"alignjustify",text:"Justify",cmd:"JustifyFull",icon:"align-justify"}],function(t){n.ui.registry.addToggleButton(t.name,{tooltip:t.text,onAction:function(){return n.execCommand(t.cmd)},icon:t.icon,onSetup:SE(n,t.name)})});var t="alignnone",e="No alignment",o="JustifyNone",r="align-none";n.ui.registry.addButton(t,{tooltip:e,onAction:function(){return n.execCommand(o)},icon:r})},rA=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},iA=function(t){var n,e;!function(e){Jk.each([{name:"bold",text:"Bold",icon:"bold"},{name:"italic",text:"Italic",icon:"italic"},{name:"underline",text:"Underline",icon:"underline"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],function(t,n){e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:SE(e,t.name),onAction:rA(e,t.name)})});for(var t=1;t<=6;t++){var n="h"+t;e.ui.registry.addToggleButton(n,{text:n.toUpperCase(),tooltip:"Heading "+t,onSetup:SE(e,n),onAction:rA(e,n)})}}(t),n=t,Jk.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"help",text:"Help",action:"mceHelp",icon:"help"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"}],function(t){n.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:function(){return n.execCommand(t.action)}})}),e=t,Jk.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],function(t){e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:function(){return e.execCommand(t.action)},onSetup:SE(e,t.name)})})},uA=function(t){var n;iA(t),n=t,Jk.each([{name:"bold",text:"Bold",action:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",action:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",action:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",action:"Strikethrough",icon:"strike-through",shortcut:""},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript",shortcut:""},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript",shortcut:""},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting",shortcut:""},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document",shortcut:""},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"}],function(t){n.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:function(){return n.execCommand(t.action)}})}),n.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onAction:rA(n,"code")})},aA=function(t,n,e){var o=function(){return!!n.undoManager&&n.undoManager[e]()},r=function(){t.setDisabled(n.readonly||!o())};return t.setDisabled(!o()),n.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r),function(){return n.off("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r)}},cA=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return aA(t,n,"hasUndo")},onAction:function(){return n.execCommand("undo")}}),n.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:function(t){return aA(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return aA(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return aA(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},sA=function(t){var n,e;(n=t).ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:function(){return n.execCommand("mceToggleVisualAid")}}),(e=t).ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:function(t){return function(n,t){n.setActive(t.hasVisual);var e=function(t){n.setActive(t.hasVisual)};return t.on("VisualAid",e),function(){return t.off("VisualAid",e)}}(t,e)},onAction:function(){e.execCommand("mceToggleVisualAid")}})},fA=function(t){var n;(n=t).ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:function(t){return function(t,n){t.setDisabled(!n.queryCommandState("outdent"));var e=function(){t.setDisabled(!n.queryCommandState("outdent"))};return n.on("NodeChange",e),function(){return n.off("NodeChange",e)}}(t,n)},onAction:function(){return n.execCommand("outdent")}}),n.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:function(){return n.execCommand("indent")}})},lA=function(t,n){var e,o,r,i,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w;o=n,r=DE(e=t),i=CE(0,o,r.dataset,r),e.ui.registry.addNestedMenuItem("align",{text:o.shared.providers.translate("Align"),getSubmenuItems:function(){return i.items.validateItems(i.getStyleItems())}}),a=n,c=ME(u=t),s=CE(0,a,c.dataset,c),u.ui.registry.addNestedMenuItem("fontformats",{text:a.shared.providers.translate("Fonts"),getSubmenuItems:function(){return s.items.validateItems(s.getStyleItems())}}),f=t,d=(l=n).styleselect,m=CE(0,l,d,PE(f)),f.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=n,h=HE(g=t),v=CE(0,p,h.dataset,h),g.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return v.items.validateItems(v.getStyleItems())}}),y=n,x=RE(b=t),w=CE(0,y,x.dataset,x),b.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return w.items.validateItems(w.getStyleItems())}})},dA=function(t,n){oA(t),uA(t),lA(t,n),cA(t),Mv.register(t),sA(t),fA(t)},mA=function(t,n){return{anchor:"makeshift",x:t,y:n}},gA=function(t,n){var e,o,r,i=Rh.DOM.getPos(t);return e=n,o=i.x,r=i.y,mA(e.x+o,e.y+r)},pA=function(t,n){return"contextmenu"===n.type?t.inline?mA((o=n).pageX,o.pageY):gA(t.getContentAreaContainer(),mA((e=n).clientX,e.clientY)):hA(t);var e,o},hA=function(t){return{anchor:"selection",root:ne.fromDom(t.selection.getNode())}},vA=function(t){return"string"==typeof t?t.split(/[ ,]/):t},bA=function(t){return t.settings.contextmenu_never_use_native||!1},yA=function(t){return e="contextmenu",o="link linkchecker image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,dt(n.settings,e).map(vA).getOrThunk(function(){return F(vA(o),function(t){return mt(r,t)})});var n,e,o,r},xA=function(t){return!1===t.getParam("contextmenu")},wA=function(t){return P(t)?"|"===t:"separator"===t.type},SA={type:"separator"},kA=function(n){if(P(n))return n;switch(n.type){case"separator":return SA;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return P(t)?t:D(t,kA)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:t(n.onAction)}}},CA=function(t,n){if(0===n.length)return t;var e=Z(t).filter(function(t){return!wA(t)}).fold(function(){return[]},function(t){return[SA]});return t.concat(e).concat(n).concat([SA])},OA=function(d,t,m){var g=Vu(Wg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return d.focus()},fireDismissalEventInstead:{},inlineBehaviours:fa([Ag("dismissContextMenu",[gi(Yn(),function(t,n){yf.close(t),d.focus()})])])}));d.on("init",function(){d.on("contextmenu",function(n){if(bA(d)&&n.preventDefault(),t=d,!(n.ctrlKey&&!bA(t)||xA(d))){var t,e,r,i,o,u=2!==n.button||n.target===d.getBody(),a=u?(e=d,{anchor:"node",node:et.some(ne.fromDom(e.selection.getNode())),root:ne.fromDom(e.getBody())}):pA(d,n),c=d.ui.registry.getAll(),s=yA(d),f=u?d.selection.getStart(!0):n.target,l=(r=c.contextMenus,i=f,0<(o=R(s,function(t,n){if(mt(r,n)){var e=r[n].update(i);if(P(e))return CA(t,e.split(" "));if(0<e.length){var o=D(e,kA);return CA(t,o)}return t}return t.concat([n])},[])).length&&wA(o[o.length-1])&&o.pop(),o);Gy(l,Dh.CLOSE_ON_EXECUTE,m).map(function(t){n.preventDefault(),Wg.showMenuAt(g,a,{menu:{markers:Vv("normal")},data:t})})}})})},TA=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?et.some(parseInt(t,10)):et.none()},EA=function(t){return L(t)?t+"px":t},BA="data-initial-z-index",AA=function(t,n){var e;t.getSystem().addToGui(n),Ce((e=n).element()).each(function(n){wu(n,"z-index").each(function(t){Xe(n,BA,t)}),hu(n,"z-index",yu(e.element(),"z-index"))})},DA=function(t){Ce(t.element()).each(function(t){var n=qe(t,BA);Ke(t,BA)?hu(t,"z-index",n):ku(t,"z-index"),$e(t,BA)}),t.getSystem().removeFromGui(t)},_A=function(t,n,e,o){return(r=t,i=n,u=r.element(),a=parseInt(qe(u,i.leftAttr),10),c=parseInt(qe(u,i.topAttr),10),isNaN(a)||isNaN(c)?et.none():et.some(wa(a,c))).fold(function(){return e},function(t){return WB(t.left()+o.left(),t.top()+o.top())});var r,i,u,a,c},MA=function(t,n,e,o,r,i){var u,a,c,s=_A(t,n,e,o),f=IA(t,n,s,r,i),l=HB(s,r,i);return u=n,a=l,c=t.element(),Xe(c,u.leftAttr,a.left()+"px"),Xe(c,u.topAttr,a.top()+"px"),f.fold(function(){return{coord:WB(l.left(),l.top()),extra:et.none()}},function(t){return{coord:t.output(),extra:t.extra()}})},FA=function(t,n){var e,o;e=n,o=t.element(),$e(o,e.leftAttr),$e(o,e.topAttr)},IA=function(t,n,p,h,v){var e=n.getSnapPoints(t);return Rt(e,function(t){var n,e,o,r,i,u,a,c,s,f,l,d,m,g=t.sensor();return(n=p,e=g,o=t.range().left(),r=t.range().top(),a=PB(n,i=h,u=v),c=PB(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r)?et.some({output:nt((s=t.output(),f=p,l=h,d=v,m=function(o,r){return function(t,n){var e=o(f,l,d);return r(t.getOr(e.left()),n.getOr(e.top()))}},s.fold(m(zB,IB.offset),m(PB,IB.absolute),m(HB,IB.fixed)))),extra:t.extra}):et.none()})},RA=function(e,t,i,u,a,c){return t.fold(function(){var t,e,o,n=(t=i,e=c.left(),o=c.top(),t.fold(function(t,n){return IB.offset(t+e,n+o)},function(t,n){return IB.absolute(t+e,n+o)},function(t,n){return IB.fixed(t+e,n+o)})),r=HB(n,u,a);return WB(r.left(),r.top())},function(n){var t=MA(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord})},VA=function(t,n,e){var o,r=n.getTarget(t.element());if(n.repositionTarget){var i=Se(t.element()),u=Oa(i),a=FB(r,u),c=wu(o=r,"left").bind(function(e){return wu(o,"top").bind(function(n){return wu(o,"position").map(function(t){return("fixed"===t?WB:jB)(parseInt(e,10),parseInt(n,10))})})}).getOrThunk(function(){var t=ka(o);return UB(t.left(),t.top())}),s=RA(t,n.snaps,c,u,a,e),f=LB(s,0,a);vu(r,f)}n.onDrag(t,r,e)},NA=Vr("snaps",[kr("getSnapPoints"),Qu("onSensor"),kr("leftAttr"),kr("topAttr"),Nr("lazyViewport",function(){var t=Oa();return{x:t.left,y:t.top,width:nt(H.window.innerWidth),height:nt(H.window.innerHeight),bottom:nt(t.top()+H.window.innerHeight),right:nt(t.left()+H.window.innerWidth)}})]),HA=/* */Object.freeze({getData:function(t){return et.from(wa(t.x(),t.y()))},getDelta:function(t,n){return wa(n.left()-t.left(),n.top()-t.top())}}),PA=[Nr("useFixed",!1),kr("blockerClass"),Nr("getTarget",d),Nr("onDrag",tt),Nr("repositionTarget",!0),Qu("onDrop"),NA,ea("dragger",{handlers:function(a,c){return fi([gi(jt(),function(n,t){if(0===t.event().raw().button){t.stop();var e,o={drop:function(){i()},delayDrop:function(){u.schedule()},forceDrop:function(){i()},move:function(t){u.cancel(),c.update(HA,t).each(function(t){VA(n,a,t)})}},r=n.getSystem().build(Mb.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[a.blockerClass]},events:(e=o,fi([gi(jt(),e.forceDrop),gi(Gt(),e.drop),gi(Ut(),function(t,n){e.move(n.event())}),gi(Wt(),e.delayDrop)]))})),i=function(){DA(r),a.snaps.each(function(t){FA(n,t)});var t=a.getTarget(n.element());a.onDrop(n,t)},u=gb(i,200);c.reset(),AA(n,r)}})])}})],zA=/* */Object.freeze({getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],et.some(wa(n.clientX,n.clientY))):et.none()},getDelta:function(t,n){return wa(n.left()-t.left(),n.top()-t.top())}}),LA=PA,jA=[Nr("useFixed",!1),Nr("getTarget",d),Nr("onDrag",tt),Nr("repositionTarget",!0),Nr("onDrop",tt),NA,ea("dragger",{handlers:function(o,r){return fi([wi(Pt()),gi(zt(),function(n,t){t.stop(),r.update(zA,t.event()).each(function(t){VA(n,o,t)})}),gi(Lt(),function(n,t){o.snaps.each(function(t){FA(n,t)});var e=o.getTarget(n.element());r.reset(),o.onDrop(n,e)})])}})],UA=/* */Object.freeze({mouse:LA,touch:jA}),WA=/* */Object.freeze({init:function(){var i=et.none(),t=nt({});return Xi({readState:t,reset:function(){i=et.none()},update:function(r,t){return r.getData(t).bind(function(t){return n=r,e=t,o=i.map(function(t){return n.getDelta(t,e)}),i=et.some(e),o;var n,e,o})}})}}),GA=ga({branchKey:"mode",branches:UA,name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:ie(["sensor","range","output"],["extra"])},state:WA});(EE=TE||(TE={}))[EE.None=0]="None",EE[EE.Both=1]="Both",EE[EE.Vertical=2]="Vertical";var XA,YA,qA,KA,$A,JA,QA=function(t,n,e,o){var r=t+n,i=e.filter(function(t){return r<t}),u=o.filter(function(t){return t<r});return i.or(u).getOr(r)},ZA=function(t,n,e,o,r){var i,u,a={};return a.height=QA(o,n.top(),Vb(t),(i=t,et.from(i.getParam("max_height")).filter(L))),e===TE.Both&&(a.width=QA(r,n.left(),Rb(t),(u=t,et.from(u.getParam("max_width")).filter(L)))),a},tD=function(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},nD=function(i,u){u.delimiter||(u.delimiter="\xbb");return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:fa([Lm.config({mode:"flow",selector:"div[role=button]"}),ix.config({}),Xm.config({}),Ag("elementPathEvents",[ki(function(r,t){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return Lm.focusIn(r)}),i.on("NodeChange",function(t){var n,o,e=function(t){for(var n=[],e=t.length;0<e--;){var o=t[e];if(1===o.nodeType&&!tD(o)){var r=i.fire("ResolveName",{name:o.nodeName.toLowerCase(),target:o});if(r.isDefaultPrevented()||n.push({name:r.name,element:o}),r.isPropagationStopped())break}}return n}(t.parents);0<e.length&&Xm.set(r,(n=D(e||[],function(n,t){return Xg.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{role:"button","data-index":t,"tab-index":-1,"aria-level":t+1},innerHtml:n.name},action:function(t){i.focus(),i.selection.select(n.element),i.nodeChanged()}})}),o={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+u.delimiter+" "}},R(n.slice(1),function(t,n){var e=t;return e.push(o),e.push(n),e},[n[0]])))})})])]),components:[]}},eD=function(s,u){var t,n,e,o,r,i=function(c){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:u.translate("Resize")},innerHtml:Kg("resize-handle",u.icons)},behaviours:fa([GA.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){var o,r,i,u,a;o=s,r=e,i=c,u=ne.fromDom(o.getContainer()),a=ZA(o,r,i,_a(u),Ba(u)),ut(a,function(t,n){return hu(u,n,EA(t))}),yv(o)},blockerClass:"tox-blocker"})])}};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(o=function(){var t,o,n,r,e,i=[];return s.getParam("elementpath",!0,"boolean")&&i.push(nD(s,{})),Sn(s.settings.plugins,"wordcount")&&i.push((t=s,o=u,r=function(t,n,e){return Xm.set(t,[Fu(o.translate(["{0} "+e,n[e]]))])},Xg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:fa([ix.config({}),Xm.config({}),ig.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Ag("wordcount-events",[gi(Hn(),function(t){var n=ig.getValue(t),e="words"===n.mode?"characters":"words";ig.setValue(t,{mode:e,count:n.count}),r(t,n.count,e)}),ki(function(e){t.on("wordCountUpdate",function(t){var n=ig.getValue(e).mode;ig.setValue(e,{mode:n,count:t.wordCount}),r(e,t.wordCount,n)})})])]),eventOrder:(n={},n[Hn()]=["wordcount-events","alloy.base.behaviour"],n)}))),s.getParam("branding",!0,"boolean")&&i.push({dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:'<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="'+(e=Up.translate(["Powered by {0}","Tiny"]))+'">'+e+"</a>"}}),0<i.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:i}]:[]}(),n=!Sn((t=s).settings.plugins,"autoresize"),r=!1===(e=t.getParam("resize",n))?TE.None:"both"===e?TE.Both:TE.Vertical,r!==TE.None&&o.push(i(r)),o)}},oD=function(y){var t,n,e,o,r,i=y.getParam("inline",!1,"boolean"),x=i?eA:MB,u=et.none(),a=An.detect().browser.isIE()?["tox-platform-ie"]:[],c=Up.isRtl()?{attributes:{dir:"rtl"}}:{},w=Vu({dom:mo({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(a)},c),behaviours:fa([$s.config({useFixed:!1})])}),s=Yg({dom:{tag:"div",classes:["tox-anchorbar"]}}),f=function(){return u.bind(function(t){return SB.getMoreButton(t)}).getOrDie("Could not find more button element")},S=function(){return u.bind(function(t){return SB.getThrobber(t)}).getOrDie("Could not find throbber element")},k=xO(w,y,function(){return u.bind(function(t){return s.getOpt(t)}).getOrDie("Could not find a anchor bar element")},f),C=function(){return yt.value(w)},l=SB.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:k,onEscape:function(){y.focus()}}),d=function(t){return Lb(t)},m=SB.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:C,backstage:k,onEscape:function(){y.focus()},split:d(y),lazyToolbar:function(){return u.bind(function(t){return SB.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:f}),g=SB.parts()["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},onEscape:function(){}}),p=SB.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),h=SB.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),v=SB.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:k}),b=y.getParam("statusbar",!0,"boolean")&&!i?et.some(eD(y,k.shared.providers)):et.none(),O={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[p,h]},T=Hb(y),E=(n=(t=y).getParam("toolbar",!0),e=!0===n,o=P(n),r=z(n)&&0<n.length,!Hb(t)&&(r||o||e)),B=!1!==y.getParam("menubar",!0,"boolean"),A=d(y)!==Db["default"],D=G([B?[l]:[],T?(A&&H.console.warn("Toolbar drawer cannot be applied when multiple toolbars are active"),[g]):E?[m]:[],Ub(y)?[]:[s.asSpec()],i?[]:[O]]),_=G([[{dom:{tag:"div",classes:["tox-editor-container"]},components:D}],i?[]:b.toArray(),[v]]),M=i&&!B&&!E&&!T,F=mo({role:"application"},Up.isRtl()?{dir:"rtl"}:{},M?{"aria-hidden":"true"}:{}),I=Vu(SB.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(i?["tox-tinymce-inline"]:[]).concat(a),styles:mo({visibility:"hidden"},M?{opacity:"0",border:"0"}:{}),attributes:F},components:_,behaviours:fa(x.getBehaviours(y).concat([Lm.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a"})]))}));u=et.some(I),y.shortcuts.add("alt+F9","focus menubar",function(){SB.focusMenubar(I)}),y.shortcuts.add("alt+F10","focus toolbar",function(){SB.focusToolbar(I)});var R=Fb(I),V=Fb(w);qE(y,R,V);var N=function(t){var n,e=Rh.DOM,o=y.getParam("width",e.getStyle(t,"width")),r=(n=y).getParam("height",Math.max(n.getElement().offsetHeight,200)),i=Rb(y),u=Vb(y),a=TA(o).bind(function(n){return EA(i.map(function(t){return Math.max(n,t)}))}).getOr(EA(o)),c=TA(r).bind(function(n){return u.map(function(t){return Math.max(n,t)})}).getOr(r),s=EA(a);if(Su("div","width",s)&&hu(I.element(),"width",s),!y.inline){var f=EA(c);Su("div","height",f)?hu(I.element(),"height",f):hu(I.element(),"height","200px")}return c};return{mothership:R,uiMothership:V,backstage:k,renderUI:function(){var o,r,e,n,i,u,a,c;dA(y,k),OA(y,C,k),r=(o=y).ui.registry.getAll().sidebars,j(rt(r),function(n){var t=r[n],e=function(){return et.from(o.queryCommandValue("ToggleSidebar")).is(n)};o.ui.registry.addToggleButton(n,{icon:t.icon,tooltip:t.tooltip,onAction:function(t){o.execCommand("ToggleSidebar",!1,n),t.setActive(e())},onSetup:function(t){var n=function(){return t.setActive(e())};return o.on("ToggleSidebar",n),function(){o.off("ToggleSidebar",n)}}})}),e=y,n=S,i=k.shared,u=Ft(!1),a=Ft(et.none()),c=function(t){t!==u.get()&&(pB(n(),t,i.providers),u.set(t))},e.on("ProgressState",function(t){if(a.get().each(Qg.clearTimeout),L(t.time)){var n=Qg.setEditorTimeout(e,function(){return c(t.state)},t.time);a.set(et.some(n))}else c(t.state),a.set(et.none())});var t=y.ui.registry.getAll(),s=t.buttons,f=t.menuItems,l=t.contextToolbars,d=t.sidebars,m=Nb(y),g={menuItems:f,menus:y.settings.menu?at(y.settings.menu,function(t){return Ct(t,{items:t.items})}):{},menubar:y.settings.menubar,toolbar:m.getOrThunk(function(){return y.getParam("toolbar",!0)}),buttons:s,sidebar:d};YE(y,l,w,{backstage:k});var p=y.getElement(),h=N(p),v={mothership:R,uiMothership:V,outerContainer:I},b={targetNode:p,height:h};return x.render(y,v,g,k,b)},getUi:function(){return{channels:{broadcastAll:V.broadcast,broadcastOn:V.broadcastOn,register:function(){}}}}}},rD=function(t,n){var e=et.from(qe(t,"id")).fold(function(){var t=fo("dialog-label");return Xe(n,"id",t),t},d);Xe(t,"aria-labelledby",e)},iD=nt([kr("lazySink"),_r("dragBlockClass"),Nr("useTabstopAt",nt(!0)),Nr("eventOrder",{}),Of("modalBehaviours",[Lm]),Zu("onExecute"),na("onEscape")]),uD={sketch:d},aD=nt([nl({name:"draghandle",overrides:function(t,n){return{behaviours:fa([GA.config({mode:"mouse",getTarget:function(t){return Pu(t,'[role="dialog"]').getOr(t)},blockerClass:t.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+Lo(n,null,2)).message)})])}}}),Zf({schema:[kr("dom")],name:"title"}),Zf({factory:uD,schema:[kr("dom")],name:"close"}),Zf({factory:uD,schema:[kr("dom")],name:"body"}),nl({factory:uD,schema:[kr("dom")],name:"footer"}),tl({factory:{sketch:function(t,n){return mo({},t,{dom:n.dom,components:n.components})}},schema:[Nr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Nr("components",[])],name:"blocker"})]),cD=_l({name:"ModalDialog",configFields:iD(),partFields:aD(),factory:function(r,t,n,o){var a=fo("alloy.dialog.busy"),c=fo("alloy.dialog.idle"),s=fa([Lm.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),fg.config({})]),e=fo("modal-events"),i=mo({},r.eventOrder,{"alloy.system.attached":[e].concat(r.eventOrder["alloy.system.attached"]||[])});return{uid:r.uid,dom:r.dom,components:t,apis:{show:function(i){var t=r.lazySink(i).getOrDie(),u=Ft(et.none()),n=o.blocker(),e=t.getSystem().build(mo({},n,{components:n.components.concat([Nu(i)]),behaviours:fa([Ag("dialog-blocker-events",[gi(c,function(t,n){Ke(i.element(),"aria-busy")&&($e(i.element(),"aria-busy"),u.get().each(function(t){return Xm.remove(i,t)}))}),gi(a,function(t,n){Xe(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){Xm.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(et.some(r)),Xm.append(i,Nu(r)),r.hasConfigured(Lm)&&Lm.focusIn(r)})])])}));Zs(t,e),Lm.focusIn(i)},hide:function(n){Ce(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){ef(t)})})},getBody:function(t){return gl(t,r,"body")},getFooter:function(t){return gl(t,r,"footer")},setIdle:function(t){Kr(t,c)},setBusy:function(t,n){$r(t,a,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Ef(r.modalBehaviours,[Xm.config({}),Lm.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt}),Ag(e,[ki(function(t){var n,e,o;rD(t.element(),gl(t,r,"title").element()),n=t.element(),e=gl(t,r,"body").element(),o=et.from(qe(n,"id")).fold(function(){var t=fo("dialog-describe");return Xe(e,"id",t),t},d),Xe(n,"aria-describedby",o)})])])}},apis:{show:function(t,n){t.show(n)},hide:function(t,n){t.hide(n)},getBody:function(t,n){return t.getBody(n)},getFooter:function(t,n){return t.getFooter(n)},setBusy:function(t,n,e){t.setBusy(n,e)},setIdle:function(t,n){t.setIdle(n)}}}),sD=[Or("type"),Or("text"),Tr("level",["info","warn","error","success"]),Or("icon"),Nr("url","")],fD=[Or("type"),Or("text"),jr("primary",!1),er("name","name",wo(function(){return fo("button-name")}),yr),Ir("icon")],lD=[Or("type"),Or("name"),Or("label")],dD=xr,mD=[Or("type"),Or("name"),Ir("label")],gD=mD,pD=yr,hD=mD,vD=yr,bD=mD,yD=ar(),xD=mD.concat([jr("sandboxed",!0)]),wD=yr,SD=mD.concat([Ir("placeholder")]),kD=yr,CD=mD.concat([Ar("items",[Or("text"),Or("value")]),Pr("size",1)]),OD=yr,TD=mD.concat([jr("constrain",!0)]),ED=$o([Or("width"),Or("height")]),BD=mD.concat([Ir("placeholder")]),AD=yr,DD=mD.concat([Lr("filetype","file",["image","media","file"])]),_D=$o([Or("value"),Nr("meta",{})]),MD=mD.concat([Or("type"),zr("tag","textarea"),Er("init")]),FD=yr,ID=[Or("type"),Or("html"),Lr("presets","presentation",["presentation","document"])],RD=mD.concat([Cr("currentState",$o([kr("blob"),Or("url")]))]),VD=mD.concat([Nr("columns","auto")]),ND=ur([Or("value"),Or("text"),Or("icon")]),HD=[Or("type"),Dr("header",yr),Dr("cells",Jo(yr))],PD=function(n){return er("items","items",yo(),Jo(cr(function(t){return lr("Checking item of "+n,zD,t).fold(function(t){return yt.error(gr(t))},function(t){return yt.value(t)})})))},zD=pr("type",{alertbanner:sD,bar:(KA=PD("bar"),[Or("type"),KA]),button:fD,checkbox:lD,colorinput:gD,colorpicker:hD,dropzone:bD,grid:(YA=PD("grid"),[Or("type"),(qA="columns",Cr(qA,br)),YA]),iframe:xD,input:SD,selectbox:CD,sizeinput:TD,textarea:BD,urlinput:DD,customeditor:MD,htmlpanel:ID,imagetools:RD,collection:VD,label:(XA=PD("label"),[Or("type"),Or("label"),XA]),table:HD}),LD=[Or("type"),Dr("items",zD)],jD=[er("name","name",wo(function(){return fo("tab-name")}),yr),Or("title"),Dr("items",zD)],UD=[Or("type"),Ar("tabs",jD)],WD=[er("name","name",wo(function(){return fo("button-name")}),yr),Or("text"),Ir("icon"),Lr("align","end",["start","end"]),jr("primary",!1),jr("disabled",!1)],GD=$o([Tr("type",["submit","cancel","custom"])].concat(WD)),XD=$o([Or("title"),Cr("body",pr("type",{panel:LD,tabpanel:UD})),zr("size","normal"),Dr("buttons",GD),Nr("initialData",{}),Ur("onAction",tt),Ur("onChange",tt),Ur("onSubmit",tt),Ur("onClose",tt),Ur("onCancel",tt),Nr("onTabChange",tt)]),YD=function(t){return w(t)?[t].concat(X(lt(t),YD)):z(t)?X(t,YD):[]},qD=function(t){return P(t.type)&&P(t.name)},KD={checkbox:dD,colorinput:pD,colorpicker:vD,dropzone:yD,input:kD,iframe:wD,sizeinput:ED,selectbox:OD,size:ED,textarea:AD,urlinput:_D,customeditor:FD,collection:ND},$D=function(t){var n=X(F(YD(t),qD),function(n){return(t=n,et.from(KD[t.type])).fold(function(){return[]},function(t){return[Cr(n.name,t)]});var t});return $o(n)},JD=$o([Tr("type",["cancel","custom"])].concat(WD)),QD=$o([Or("title"),Or("url"),Fr("height"),Fr("width"),($A="buttons",JA=JD,Mr($A,Jo(JA))),Ur("onAction",tt),Ur("onCancel",tt),Ur("onClose",tt),Ur("onMessage",tt)]),ZD=function(t){return{internalDialog:dr(lr("dialog",XD,t)),dataValidator:$D(t),initialData:t.initialData}},t_={open:function(t,n){var e=ZD(n);return t(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(t,n){return t(dr(lr("dialog",QD,n)))},redial:function(t){return ZD(t)}},n_=function(t){var e=[],o={};return ut(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?yt.error(e):yt.value(o)},e_=Dl({name:"TabButton",configFields:[Nr("uid",undefined),kr("value"),er("dom","dom",So(function(t){return{attributes:{role:"tab",id:fo("aria"),"aria-selected":"false"}}}),hr()),_r("action"),Nr("domModification",{}),Of("tabButtonBehaviours",[fg,Lm,ig]),kr("view")],factory:function(t,n){return{uid:t.uid,dom:t.dom,components:t.components,events:Gg(t.action),behaviours:Ef(t.tabButtonBehaviours,[fg.config({}),Lm.config({mode:"execution",useSpace:!0,useEnter:!0}),ig.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),o_=nt([kr("tabs"),kr("dom"),Nr("clickToDismiss",!1),Of("tabbarBehaviours",[ql,Lm]),$u(["tabClass","selectedClass"])]),r_=el({factory:e_,name:"tabs",unit:"tab",overrides:function(o,t){var r=function(t,n){ql.dehighlight(t,n),$r(t,Jn(),{tabbar:t,button:n})},i=function(t,n){ql.highlight(t,n),$r(t,$n(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=ql.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?tt:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),i_=nt([r_]),u_=_l({name:"Tabbar",configFields:o_(),partFields:i_(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Ef(t.tabbarBehaviours,[ql.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){Xe(n.element(),"aria-selected","true")},onDehighlight:function(t,n){Xe(n.element(),"aria-selected","false")}}),Lm.config({mode:"flow",getInitial:function(t){return ql.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),a_=Dl({name:"Tabview",configFields:[Of("tabviewBehaviours",[Xm])],factory:function(t,n){return{uid:t.uid,dom:t.dom,behaviours:Ef(t.tabviewBehaviours,[Xm.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),c_=nt([Nr("selectFirst",!0),Qu("onChangeTab"),Qu("onDismissTab"),Nr("tabs",[]),Of("tabSectionBehaviours",[])]),s_=Zf({factory:u_,schema:[kr("dom"),Br("markers",[kr("tabClass"),kr("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),f_=Zf({factory:a_,name:"tabview"}),l_=nt([s_,f_]),d_=_l({name:"TabSection",configFields:c_(),partFields:l_(),factory:function(i,t,n,e){var o=function(t,n){ml(t,i,"tabbar").each(function(t){n(t).each(Jr)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:Tf(i.tabSectionBehaviours),events:fi(G([i.selectFirst?[ki(function(t,n){o(t,ql.getFirst)})]:[],[gi($n(),function(t,n){var o,r,e=n.event().button();o=e,r=ig.getValue(o),ml(o,i,"tabview").each(function(e){V(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();Xe(e.element(),"aria-labelledby",qe(o.element(),"id")),Xm.set(e,n),i.onChangeTab(e,o,n)})})}),gi(Jn(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return ml(t,i,"tabview").map(function(t){return Xm.contents(t)}).getOr([])},showTab:function(t,e){o(t,function(n){var t=ql.getCandidates(n);return V(t,function(t){return ig.getValue(t)===e}).filter(function(t){return!ql.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),m_=function(i,u,t){Pu(i,'[role="dialog"]').each(function(r){t.get().map(function(t){return hu(u,"height","0"),Math.min(t,(e=i,o=Pu(n=r,".tox-dialog-wrap").getOr(n),("fixed"===yu(o,"position")?Math.max(H.document.documentElement.clientHeight,H.window.innerHeight):Math.max(H.document.documentElement.offsetHeight,H.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-e.dom().getBoundingClientRect().height)));var n,e,o}).each(function(t){hu(u,"height",t+"px")})})},g_=function(a){var c;return{smartTabHeight:(c=Ft(et.none()),{extraEvents:[ki(function(t){zu(t.element(),'[role="tabpanel"]').each(function(u){var n;hu(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,D(o=a,function(t,n){Xm.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return Xm.set(i,[]),e.height})),e=Q(J(n,function(t,n){return n<t?-1:t<n?1:0}));c.set(e)}),m_(t.element(),u,c),ku(u,"visibility"),n=t,Q(a).each(function(t){return d_.showTab(n,t.value)}),Qg.requestAnimationFrame(function(){m_(t.element(),u,c)})})}),gi(Wn(),function(n){zu(n.element(),'[role="tabpanel"]').each(function(t){m_(n.element(),t,c)})}),gi(Qb,function(r,t){zu(r.element(),'[role="tabpanel"]').each(function(n){var t=ad();hu(n,"visibility","hidden");var e=wu(n,"height").map(function(t){return parseInt(t,10)});ku(n,"height");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(et.from(o)),m_(r.element(),n,c)):e.each(function(t){hu(n,"height",t+"px")}),ku(n,"visibility"),t.each(ud)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},p_="send-data-to-section",h_="send-data-to-view",v_=fo("update-dialog"),b_=fo("update-title"),y_=fo("update-body"),x_=fo("update-footer"),w_=fo("body-send-message"),S_=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:mo({},n.map(function(t){return{id:t}}).getOr({}),e?{"aria-live":"polite"}:{})},components:[],behaviours:fa([vS(0),WT.config({channel:y_,updateState:function(t,n){return et.some({isTabPanel:function(){return"tabpanel"===n.body.type}})},renderComponents:function(t){switch(t.body.type){case"tabpanel":return[(r={tabs:t.body.tabs},i=d,u=Ft({}),a=function(t){var n=ig.getValue(t),e=n_(n).getOr({}),o=u.get(),r=kt(o,e);u.set(r)},c=function(t){var n=u.get();ig.setValue(t,n)},s=Ft(null),f=D(r.tabs,function(t){return{value:t.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:i.shared.providers.translate(t.title)},view:function(){return[aS.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:D(t.items,function(t){return MC(n,t,i)}),formBehaviours:fa([Lm.config({mode:"acyclic",useTabstopAt:x(MS)}),Ag("TabView.form.events",[ki(c),Ci(a)]),ba.config({channels:Dt([{key:p_,value:{onReceive:a}},{key:h_,value:{onReceive:c}}])})])}})]}}}),l=g_(f).smartTabHeight,d_.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n,e){var o=ig.getValue(n);$r(t,Jb,{name:o,oldName:s.get()}),s.set(o)},tabs:f,components:[d_.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[u_.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:fa([ix.config({})])}),d_.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:fa([Ag("tabpanel",l.extraEvents),Lm.config({mode:"acyclic"}),Rl.config({find:function(t){return Q(d_.getViewItems(t))}}),ig.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([p_],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([h_],{})}}})])}))];default:return[(e={items:t.body.items},o=d,n=Yg(aS.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:D(e.items,function(t){return MC(n,t,o)})}})),{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:fa([Lm.config({mode:"acyclic",useTabstopAt:x(MS)}),hS(n),kS(n,{postprocess:function(t){return n_(t).fold(function(t){return H.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,f,l},initialData:t})])}},k_=function(t,e){return[yi(Yt(),FS),t(Gb,function(t,n){e.onClose(),n.onClose()}),t(Xb,function(t,n,e,o){n.onCancel(t),Kr(o,Gb)}),gi($b,function(t,n){return e.onUnblock()}),gi(Kb,function(t,n){return e.onBlock(n.event())})]},C_=function(i,t){var n=function(t,r){return gi(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){WT.getState(n).get().each(function(t){e(t,n)})};return k_(n,t).concat([n(Yb,function(t,n,e){n.onAction(t,{name:e.name()})})])},O_=function(i,t){var n=function(t,r){return gi(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){WT.getState(n).get().each(function(t){e(t.internalDialog,n)})};return k_(n,t).concat([n(qb,function(t,n){return n.onSubmit(t)}),n(Wb,function(t,n,e){n.onChange(t,{name:e.name()})}),n(Yb,function(t,n,e){n.onAction(t,{name:e.name(),value:e.value()})}),n(Jb,function(t,n,e){n.onTabChange(t,{newTabName:e.name(),oldTabName:e.oldName()})}),Ci(function(t){var n=i();ig.setValue(t,n.getData())})])},T_=function(t,n){var e=n.map(function(t){return t.footerButtons}).getOr([]),o=M(e,function(t){return"start"===t.align}),r=function(t,n){return Mb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:D(n,function(t){return t.memento.asSpec()})})};return[r("start",o.pass),r("end",o.fail)]},E_=function(t,i){return{dom:jp('<div class="tox-dialog__footer"></div>'),components:[],behaviours:fa([WT.config({channel:x_,initialData:t,updateState:function(t,n){var r=D(n.buttons,function(t){var n,e,o=Yg((e=i,Mk(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return et.some({lookupByName:function(t,n){return e=t,o=n,V(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:T_})])}},B_=function(t,n){return cD.parts().footer(E_(t,n))},A_=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=Rl.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return aS.getField(o,e).fold(function(){var t=n.getFooter();return WT.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return et.some(t)})}return et.none()},D_=function(c,o){var t=function(t){var n=c.getRoot();n.getSystem().isConnected()&&t(n)},s={getData:function(){var t=c.getRoot(),n=t.getSystem().isConnected()?c.getFormWrapper():t;return ig.getValue(n)},setData:function(a){t(function(t){var n,e,o=s.getData(),r=Ct(o,a),i=(n=r,e=c.getRoot(),WT.getState(e).get().map(function(t){return dr(lr("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();ig.setValue(u,i)})},disable:function(t){A_(c,t).each(kh.disable)},enable:function(t){A_(c,t).each(kh.enable)},focus:function(t){A_(c,t).each(fg.focus)},block:function(n){if(!P(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){$r(t,Kb,{message:n})})},unblock:function(){t(function(t){Kr(t,$b)})},showTab:function(e){t(function(t){var n=c.getBody();WT.getState(n).get().exists(function(t){return t.isTabPanel()})&&Rl.getCurrent(n).each(function(t){d_.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([v_],n),t.getSystem().broadcastOn([b_],n.internalDialog),t.getSystem().broadcastOn([y_],n.internalDialog),t.getSystem().broadcastOn([x_],n.internalDialog),s.setData(n.initialData)})},close:function(){t(function(t){Kr(t,Gb)})}};return s},__=function(t){return Xg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close"),title:t.translate("Close")}},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:'<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M17.953 7.453L13.422 12l4.531 4.547-1.406 1.406L12 13.422l-4.547 4.531-1.406-1.406L10.578 12 6.047 7.453l1.406-1.406L12 10.578l4.547-4.531z" fill-rule="evenodd"></path></svg>'}}],action:function(t){Kr(t,Xb)}})},M_=function(t,n,e){var o=function(t){return[Fu(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:mo({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:fa([WT.config({channel:b_,renderComponents:o})])}},F_=function(t,n){return e={title:n.shared.providers.translate(t),draggable:!0},o=n.shared.providers,r=cD.parts().title(M_(e,et.none(),o)),i=cD.parts().draghandle({dom:jp('<div class="tox-dialog__draghandle"></div>')}),u=cD.parts().close(__(o)),a=[r].concat(e.draggable?[i]:[]).concat([u]),Mb.sketch({dom:jp('<div class="tox-dialog__header"></div>'),components:a});var e,o,r,i,u,a},I_=function(t,n){return{onClose:function(){return n.closeWindow()},onBlock:function(e){cD.setBusy(t(),function(t,n){return{dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":e.message()},styles:{left:"0px",right:"0px",bottom:"0px",top:"0px",position:"absolute"}},behaviours:n,components:[{dom:jp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){cD.setIdle(t())}}},R_=function(t,n,e,o){var r;return Vu(cD.sketch({lazySink:o.shared.getSink,onEscape:function(t){return Kr(t,Xb),et.some(!0)},useTabstopAt:function(t){return!MS(t)&&("button"!==He(t)||"disabled"!==qe(t,"disabled"))},modalBehaviours:fa([WT.config({channel:v_,updateState:function(t,n){return et.some(n)},initialData:n}),TS({}),fg.config({}),Ag("execute-on-form",e.concat([Si(Yt(),function(t,n){Lm.focusIn(t)})])),Ag("scroll-lock",[ki(function(){cu(ri(),"tox-dialog__disable-scroll")}),Ci(function(){su(ri(),"tox-dialog__disable-scroll")})])].concat(t.extraBehaviours)),eventOrder:(r={},r[Rn()]=["execute-on-form"],r[In()]=["reflecting","receiving"],r[Gn()]=["scroll-lock","reflecting","messages","execute-on-form","alloy.base.behaviour"],r[Xn()]=["alloy.base.behaviour","execute-on-form","messages","reflecting","scroll-lock"],r),dom:{tag:"div",classes:["tox-dialog"].concat(t.extraClasses),styles:mo({position:"relative"},t.extraStyles)},components:[t.header,t.body].concat(t.footer.toArray()),dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:jp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}}))},V_=function(t,n,e){var o,r,i,u=F_(t.internalDialog.title,e),a=(o={body:t.internalDialog.body},r=e,i=S_(o,et.none(),r,!1),cD.parts().body(i)),c=B_({buttons:t.internalDialog.buttons},e.shared.providers),s=O_(function(){return m},I_(function(){return d},n)),f="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?["tox-dialog--width-lg"]:["tox-dialog--width-md"]:[],l={header:u,body:a,footer:et.some(c),extraClasses:f,extraBehaviours:[],extraStyles:{}},d=R_(l,t,s,e),m=D_({getRoot:function(){return d},getBody:function(){return cD.getBody(d)},getFooter:function(){return cD.getFooter(d)},getFormWrapper:function(){var t=cD.getBody(d);return Rl.getCurrent(t).getOr(t)}},n.redial);return{dialog:d,instanceApi:m}},N_=tinymce.util.Tools.resolve("tinymce.util.URI"),H_=["insertContent","setContent","execCommand","close","block","unblock"],P_=function(t){return w(t)&&-1!==H_.indexOf(t.mceAction)},z_=function(o,t,r,n){var e,i,u,a,c=F_(o.title,n),s=(i={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[IS({dom:{tag:"iframe",attributes:{src:o.url}},behaviours:fa([ix.config({}),fg.config({})])})]}],behaviours:fa([Lm.config({mode:"acyclic",useTabstopAt:x(MS)})])},cD.parts().body(i)),f=o.buttons.bind(function(t){return 0===t.length?et.none():et.some(B_({buttons:t},n.shared.providers))}),l=C_(function(){return y},I_(function(){return b},t)),d=mo({},o.height.fold(function(){return{}},function(t){return{height:t+"px","max-height":t+"px"}}),o.width.fold(function(){return{}},function(t){return{width:t+"px","max-width":t+"px"}})),m=o.width.isNone()&&o.height.isNone()?["tox-dialog--width-lg"]:[],g=new N_(o.url,{base_uri:new N_(H.window.location.href)}),p=g.protocol+"://"+g.host+(g.port?":"+g.port:""),h=Ft(et.none()),v=[Ag("messages",[ki(function(){var t=lb(ne.fromDom(H.window),"message",function(t){if(g.isSameOrigin(new N_(t.raw().origin))){var n=t.raw().data;P_(n)?function(t,n,e){switch(e.mceAction){case"insertContent":t.insertContent(e.content);break;case"setContent":t.setContent(e.content);break;case"execCommand":var o=!!S(e.ui)&&e.ui;t.execCommand(e.cmd,o,e.value);break;case"close":n.close();break;case"block":n.block(e.message);break;case"unblock":n.unblock()}}(r,y,n):!P_(e=n)&&w(e)&&mt(e,"mceAction")&&o.onMessage(y,n)}var e});h.set(et.some(t))}),Ci(function(){h.get().each(function(t){return t.unbind()})})]),ba.config({channels:(e={},e[w_]={onReceive:function(t,n){zu(t.element(),"iframe").each(function(t){t.dom().contentWindow.postMessage(n,p)})}},e)})],b=R_({header:c,body:s,footer:f,extraClasses:m,extraBehaviours:v,extraStyles:d},o,l,n),y=(u=b,a=function(t){u.getSystem().isConnected()&&t(u)},{block:function(n){if(!P(n))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");a(function(t){$r(t,Kb,{message:n})})},unblock:function(){a(function(t){Kr(t,$b)})},close:function(){a(function(t){Kr(t,Gb)})},sendMessage:function(n){a(function(t){t.getSystem().broadcastOn([w_],n)})}});return{dialog:b,instanceApi:y}},L_=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p=fo("dialog-label"),h=fo("dialog-content"),v=Yg((u={title:t.internalDialog.title,draggable:!0},a=p,c=e.shared.providers,Mb.sketch({dom:jp('<div class="tox-dialog__header"></div>'),components:[M_(u,et.some(a),c),__(c)],containerBehaviours:fa([GA.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return Lu(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),b=Yg((s={body:t.internalDialog.body},f=h,l=e,d=o,S_(s,et.some(f),l,d))),y=Yg((m={buttons:t.internalDialog.buttons},g=e.shared.providers,E_(m,g))),x=O_(function(){return S},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),w=Vu({dom:{tag:"div",classes:["tox-dialog"],attributes:(r={role:"dialog"},r["aria-labelledby"]=p,r["aria-describedby"]=""+h,r)},eventOrder:(i={},i[In()]=[WT.name(),ba.name()],i[Rn()]=["execute-on-form"],i[Gn()]=["reflecting","execute-on-form"],i),behaviours:fa([Lm.config({mode:"cyclic",onEscape:function(t){return Kr(t,Gb),et.some(!0)},useTabstopAt:function(t){return!MS(t)&&("button"!==He(t)||"disabled"!==qe(t,"disabled"))}}),WT.config({channel:v_,updateState:function(t,n){return et.some(n)},initialData:t}),Ag("execute-on-form",x),TS({})]),components:[v.asSpec(),b.asSpec(),y.asSpec()]}),S=D_({getRoot:function(){return w},getFooter:function(){return y.get(w)},getBody:function(){return b.get(w)},getFormWrapper:function(){var t=b.get(w);return Rl.getCurrent(t).getOr(t)}},n.redial);return{dialog:w,instanceApi:S}},j_=function(t,n){return cD.parts().close(Xg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:fa([ix.config({})])}))},U_=function(){return cD.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},W_=function(t,n){return cD.parts().body({dom:{tag:"div",classes:["tox-dialog__body","todo-tox-fit"]},components:[{dom:jp("<p>"+n.translate(t)+"</p>")}]})},G_=function(t){return cD.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},X_=function(t,n){return[Mb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),Mb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},Y_=function(e){return cD.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),et.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(e.extraClasses)},components:[{dom:{tag:"div",classes:["tox-dialog__header"]},components:[e.partSpecs.title,e.partSpecs.close]},e.partSpecs.body,e.partSpecs.footer],parts:{blocker:{dom:jp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:fa([Ag("basic-dialog-events",[gi(Xb,function(t,n){e.onCancel()}),gi(qb,function(t,n){e.onSubmit()})])])})},q_=function(s){var u,a,e=(u=s.backstage.shared,{open:function(t,n){var e=function(){cD.hide(r),n()},o=Yg(Mk({name:"close-alert",text:"OK",primary:!0,icon:et.none()},"cancel",u.providers)),r=Vu(Y_({lazySink:function(){return u.getSink()},partSpecs:{title:U_(),close:j_(function(){e()},u.providers),body:W_(t,u.providers),footer:G_(X_([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:tt,extraClasses:["tox-alert-dialog"]}));cD.show(r);var i=o.get(r);fg.focus(i)}}),o=(a=s.backstage.shared,{open:function(t,n){var e=function(t){cD.hide(i),n(t)},o=Yg(Mk({name:"yes",text:"Yes",primary:!0,icon:et.none()},"submit",a.providers)),r=Mk({name:"no",text:"No",primary:!0,icon:et.none()},"cancel",a.providers),i=Vu(Y_({lazySink:function(){return a.getSink()},partSpecs:{title:U_(),close:j_(function(){e(!1)},a.providers),body:W_(t,a.providers),footer:G_(X_([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));cD.show(i);var u=o.get(i);fg.focus(u)}}),r=function(t,e){return t_.openUrl(function(t){var n=z_(t,{closeWindow:function(){cD.hide(n.dialog),e(n.instanceApi)}},s.editor,s.backstage);return cD.show(n.dialog),n.instanceApi},t)},i=function(t,i){return t_.open(function(t,n,e){var o=n,r=V_({dataValidator:e,initialData:o,internalDialog:t},{redial:t_.redial,closeWindow:function(){cD.hide(r.dialog),i(r.instanceApi)}},s.backstage);return cD.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},c=function(t,u,a,c){return t_.open(function(t,n,e){var o=dr(lr("data",e,n)),r=L_({dataValidator:e,initialData:o,internalDialog:t},{redial:t_.redial,closeWindow:function(){Wg.hide(i),a(r.instanceApi)}},s.backstage,c),i=Vu(Wg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:fa([Ag("window-manager-inline-events",[gi(Yn(),function(t,n){Kr(r.dialog,Xb)})])])}));return Wg.showAt(i,u,Nu(r.dialog)),r.instanceApi.setData(o),Lm.focusIn(r.dialog),r.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?c(t,s.backstage.shared.anchors.toolbar(),e,n.ariaAttrs):n!==undefined&&"cursor"===n.inline?c(t,s.backstage.shared.anchors.cursor(),e,n.ariaAttrs):i(t,e)},openUrl:function(t,n){return r(t,n)},alert:function(t,n){e.open(t,function(){n()})},close:function(t){t.close()},confirm:function(t,n){o.open(t,function(t){n(t)})}}};!function xM(){lo.add("silver",function(t){var n=oD(t),e=n.mothership,o=n.uiMothership,r=n.backstage,i=n.renderUI,u=n.getUi;ao(fo("silver-demo"),e),ao(fo("silver-ui-demo"),o),ub(t,r.shared);var a=q_({editor:t,backstage:r});return{renderUI:i,getWindowManagerImpl:nt(a),getNotificationManagerImpl:function(){return Zg(t,{backstage:r},o)},ui:u()}})}()}(window);

Youez - 2016 - github.com/yon3zu
LinuXploit