11 lines
351 KiB
JavaScript
11 lines
351 KiB
JavaScript
/**
|
|
* 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.4 (2019-04-23)
|
|
*/
|
|
|
|
!function(x){"use strict";var Q=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]},t=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e()}},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))}},Z=function(t){return function(){return t}},d=function(t){return t};function v(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,w=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=Z(!1),c=Z(!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:Z("none()")},Object.freeze&&Object.freeze(r),r),g=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 g(t(e))},ap:function(t){return t.fold(l,function(t){return g(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},tt={some:g,none:l,from:function(t){return null===t||t===undefined?m:g(t)}},h=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}},S=h("string"),k=h("object"),A=h("array"),C=(h("null"),h("boolean")),b=(h("undefined"),h("function")),D=h("number"),y=(i=Array.prototype.indexOf)===undefined?function(t,n){return P(t,n)}:function(t,n){return i.call(t,n)},O=function(t,n){var e=y(t,n);return-1===e?tt.none():tt.some(e)},T=function(t,n){return-1<y(t,n)},E=function(t,n){return N(t,n).isSome()},B=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=t.slice(o,o+n);e.push(r)}return e},_=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},M=function(t,n){for(var e=0,o=t.length;e<o;e++)n(t[e],e,t)},F=function(t,n){for(var e=t.length-1;0<=e;e--)n(t[e],e,t)},I=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}},V=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},R=function(t,n,e){return F(t,function(t){e=n(e,t)}),e},U=function(t,n,e){return M(t,function(t){e=n(e,t)}),e},H=function(t,n){for(var e=0,o=t.length;e<o;e++){var r=t[e];if(n(r,e,t))return tt.some(r)}return tt.none()},N=function(t,n){for(var e=0,o=t.length;e<o;e++)if(n(t[e],e,t))return tt.some(e);return tt.none()},P=function(t,n){for(var e=0,o=t.length;e<o;++e)if(t[e]===n)return e;return-1},z=Array.prototype.push,L=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);z.apply(n,t[e])}return n},j=function(t,n){var e=_(t,n);return L(e)},W=function(t,n){for(var e=0,o=t.length;e<o;++e)if(!0!==n(t[e],e,t))return!1;return!0},G=Array.prototype.slice,X=function(t){var n=G.call(t,0);return n.reverse(),n},Y=function(t,n){return V(t,function(t){return!T(n,t)})},q=function(t){return[t]},K=function(t,n){var e=G.call(t,0);return e.sort(n),e},J=function(t){return 0===t.length?tt.none():tt.some(t[0])},$=function(t){return 0===t.length?tt.none():tt.some(t[t.length-1])},nt=b(Array.from)?Array.from:function(t){return G.call(t)},et=Object.keys,ot=Object.hasOwnProperty,rt=function(t,n){for(var e=et(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i,t)}},it=function(t,o){return ut(t,function(t,n,e){return{k:n,v:o(t,n,e)}})},ut=function(o,r){var i={};return rt(o,function(t,n){var e=r(t,n,o);i[e.k]=e.v}),i},at=function(t,e){var o=[];return rt(t,function(t,n){o.push(e(t,n))}),o},ct=function(t,n){for(var e=et(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return tt.some(u)}return tt.none()},st=function(t){return at(t,function(t){return t})},ft=function(t,n){return lt(t,n)?tt.from(t[n]):tt.none()},lt=function(t,n){return ot.call(t,n)},dt=function(n){return function(t){return lt(t,n)?tt.from(t[n]):tt.none()}},mt=function(t,n){return dt(n)(t)},gt=function(t,n){var e={};return e[t]=n,e},pt=function(e){return{is:function(t){return e===t},isValue:c,isError:a,getOr:Z(e),getOrThunk:Z(e),getOrDie:Z(e),or:function(t){return pt(e)},orThunk:function(t){return pt(e)},fold:function(t,n){return n(e)},map:function(t){return pt(t(e))},mapError:function(t){return pt(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 tt.some(e)}}},ht=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 ht(e)},mapError:function(t){return ht(t(e))},each:Q,bind:function(t){return ht(e)},exists:a,forall:c,toOption:tt.none}},vt={value:pt,error:ht},bt=function(u){if(!A(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 M(u,function(t,o){var n=et(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(!A(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=et(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!W(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){x.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},yt=(bt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),Object.prototype.hasOwnProperty),xt=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)yt.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},wt=xt(function(t,n){return k(t)&&k(n)?wt(t,n):n}),St=xt(function(t,n){return n}),kt=function(t,n){return e=n,o={},rt(t,function(t,n){T(e,n)||(o[n]=t)}),o;var e,o},Ct=function(t){return dt(t)},Ot=function(t,n){return e=t,o=n,function(t){return lt(t,e)?t[e]:o};var e,o},Tt=function(t,n){return mt(t,n)},Et=function(t,n){return gt(t,n)},Bt=function(t){return n={},M(t,function(t){n[t.key]=t.value}),n;var n},At=function(t,n){var e,o,r,i,u,a=(e=[],o=[],M(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(vt.error,L)(u)):(i=n,0===(r=a.values).length?vt.value(i):vt.value(wt(i,St.apply(undefined,r))))},Dt=function(t,n){return lt(e=t,o=n)&&e[o]!==undefined&&null!==e[o];var e,o},_t=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return _t(e())}}},Mt=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},Ft=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return tt.none()},It=function(t,n){for(var e=[],o=0;o<t.length;o++){var r=t[o];if(!r.isSome())return tt.none();e.push(r.getOrDie())}return tt.some(n.apply(null,e))};(function RD(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=t.pop();return It(t,e)});var Vt,Rt,Ht=Z("touchstart"),Nt=Z("touchmove"),Pt=Z("touchend"),zt=Z("mousedown"),Lt=Z("mousemove"),jt=Z("mouseout"),Ut=Z("mouseup"),Wt=Z("mouseover"),Gt=Z("focusin"),Xt=Z("focusout"),Yt=Z("keydown"),qt=Z("keyup"),Kt=Z("input"),Jt=Z("change"),$t=Z("click"),Qt=Z("transitionend"),Zt=Z("selectstart"),tn=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}},nn=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 on(o(1),o(2))},en=function(){return on(0,0)},on=function(t,n){return{major:t,minor:n}},rn={nu:on,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?en():nn(t,e)},unknown:en},un="Firefox",an=function(t,n){return function(){return n===t}},cn=function(t){var n=t.current;return{current:n,version:t.version,isEdge:an("Edge",n),isChrome:an("Chrome",n),isIE:an("IE",n),isOpera:an("Opera",n),isFirefox:an(un,n),isSafari:an("Safari",n)}},sn={unknown:function(){return cn({current:undefined,version:rn.unknown()})},nu:cn,edge:Z("Edge"),chrome:Z("Chrome"),ie:Z("IE"),opera:Z("Opera"),firefox:Z(un),safari:Z("Safari")},fn="Windows",ln="Android",dn="Solaris",mn="FreeBSD",gn=function(t,n){return function(){return n===t}},pn=function(t){var n=t.current;return{current:n,version:t.version,isWindows:gn(fn,n),isiOS:gn("iOS",n),isAndroid:gn(ln,n),isOSX:gn("OSX",n),isLinux:gn("Linux",n),isSolaris:gn(dn,n),isFreeBSD:gn(mn,n)}},hn={unknown:function(){return pn({current:undefined,version:rn.unknown()})},nu:pn,windows:Z(fn),ios:Z("iOS"),android:Z(ln),linux:Z("Linux"),osx:Z("OSX"),solaris:Z(dn),freebsd:Z(mn)},vn=function(t,n){var e=String(n).toLowerCase();return H(t,function(t){return t.search(e)})},bn=function(t,e){return vn(t,e).map(function(t){var n=rn.detect(t.versionRegexes,e);return{current:t.name,version:n}})},yn=function(t,e){return vn(t,e).map(function(t){var n=rn.detect(t.versionRegexes,e);return{current:t.name,version:n}})},xn=function(t,n){return-1!==t.indexOf(n)},wn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Sn=function(n){return function(t){return xn(t,n)}},kn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return xn(t,"edge/")&&xn(t,"chrome")&&xn(t,"safari")&&xn(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,wn],search:function(t){return xn(t,"chrome")&&!xn(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return xn(t,"msie")||xn(t,"trident")}},{name:"Opera",versionRegexes:[wn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Sn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Sn("firefox")},{name:"Safari",versionRegexes:[wn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(xn(t,"safari")||xn(t,"mobile/"))&&xn(t,"applewebkit")}}],Cn=[{name:"Windows",search:Sn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return xn(t,"iphone")||xn(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Sn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Sn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Sn("linux"),versionRegexes:[]},{name:"Solaris",search:Sn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Sn("freebsd"),versionRegexes:[]}],On={browsers:Z(kn),oses:Z(Cn)},Tn=function(t){var n,e,o,r,i,u,a,c,s,f,l,d=On.browsers(),m=On.oses(),g=bn(d,t).fold(sn.unknown,sn.nu),p=yn(m,t).fold(hn.unknown,hn.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:Z(r),isiPhone:Z(i),isTablet:Z(c),isPhone:Z(f),isTouch:Z(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:Z(l)})}},En={detect:tn(function(){var t=x.navigator.userAgent;return Tn(t)})},Bn={tap:Z("alloy.tap")},An=Z("alloy.focus"),Dn=Z("alloy.blur.post"),_n=Z("alloy.paste.post"),Mn=Z("alloy.receive"),Fn=Z("alloy.execute"),In=Z("alloy.focus.item"),Vn=Bn.tap,Rn=En.detect().deviceType.isTouch()?Bn.tap:$t,Hn=Z("alloy.longpress"),Nn=Z("alloy.sandbox.close"),Pn=Z("alloy.typeahead.cancel"),zn=Z("alloy.system.init"),Ln=Z("alloy.system.scroll"),jn=Z("alloy.system.resize"),Un=Z("alloy.system.attached"),Wn=Z("alloy.system.detached"),Gn=Z("alloy.system.dismissRequested"),Xn=Z("alloy.focusmanager.shifted"),Yn=Z("alloy.slotcontainer.visibility"),qn=Z("alloy.change.tab"),Kn=Z("alloy.dismiss.tab"),Jn=Z("alloy.highlight"),$n=Z("alloy.dehighlight"),Qn=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:Z(t)}},Zn={fromHtml:function(t,n){var e=(n||x.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw x.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return Qn(e.childNodes[0])},fromTag:function(t,n){var e=(n||x.document).createElement(t);return Qn(e)},fromText:function(t,n){var e=(n||x.document).createTextNode(t);return Qn(e)},fromDom:Qn,fromPoint:function(t,n,e){var o=t.dom();return tt.from(o.elementFromPoint(n,e)).map(Qn)}},te=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 M(n,function(t,n){o[t]=Z(e[n])}),o}},ne=function(t){return t.slice(0).sort()},ee=function(n,t){if(!A(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");M(t,function(t){if(!S(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},oe=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 ee("required",r),ee("optional",i),e=ne(u),H(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=et(n);W(r,function(t){return T(e,t)})||function(t,n){throw new Error("All required keys ("+ne(t).join(", ")+") were not specified. Specified keys were: "+ne(n).join(", ")+".")}(r,e);var t=V(e,function(t){return!T(u,t)});0<t.length&&function(t){throw new Error("Unsupported keys for object: "+ne(t).join(", "))}(t);var o={};return M(r,function(t){o[t]=Z(n[t])}),M(i,function(t){o[t]=Z(Object.prototype.hasOwnProperty.call(n,t)?tt.some(n[t]):tt.none())}),o}},re="undefined"!=typeof x.window?x.window:Function("return this;")(),ie=function(t,n){return function(t,n){for(var e=n!==undefined&&null!==n?n:re,o=0;o<t.length&&e!==undefined&&null!==e;++o)e=e[t[o]];return e}(t.split("."),n)},ue={getOrDie:function(t,n){var e=ie(t,n);if(e===undefined||null===e)throw t+" not available on this browser";return e}},ae=(x.Node.ATTRIBUTE_NODE,x.Node.CDATA_SECTION_NODE,x.Node.COMMENT_NODE,x.Node.DOCUMENT_NODE),ce=(x.Node.DOCUMENT_TYPE_NODE,x.Node.DOCUMENT_FRAGMENT_NODE,x.Node.ELEMENT_NODE),se=x.Node.TEXT_NODE,fe=(x.Node.PROCESSING_INSTRUCTION_NODE,x.Node.ENTITY_REFERENCE_NODE,x.Node.ENTITY_NODE,x.Node.NOTATION_NODE,ce),le=ae,de=function(t,n){var e=t.dom();if(e.nodeType!==fe)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")},me=function(t){return t.nodeType!==fe&&t.nodeType!==le||0===t.childElementCount},ge=function(t,n){var e=n===undefined?x.document:n.dom();return me(e)?[]:_(e.querySelectorAll(t),Zn.fromDom)},pe=function(t,n){var e=n===undefined?x.document:n.dom();return me(e)?tt.none():tt.from(e.querySelector(t)).map(Zn.fromDom)},he=function(t,n){return t.dom()===n.dom()},ve=(En.detect().browser.isIE(),function(t){return Zn.fromDom(t.dom().ownerDocument)}),be=function(t){var n=t.dom().ownerDocument.defaultView;return Zn.fromDom(n)},ye=function(t){var n=t.dom();return tt.from(n.parentNode).map(Zn.fromDom)},xe=function(t){var n=t.dom();return tt.from(n.offsetParent).map(Zn.fromDom)},we=function(t){var n=t.dom();return _(n.childNodes,Zn.fromDom)},Se=function(t,n){var e=t.dom().childNodes;return tt.from(e[n]).map(Zn.fromDom)},ke=(te("element","offset"),function(n,e){ye(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})}),Ce=function(t,n){var e;(e=t.dom(),tt.from(e.nextSibling).map(Zn.fromDom)).fold(function(){ye(t).each(function(t){Te(t,n)})},function(t){ke(t,n)})},Oe=function(n,e){Se(n,0).fold(function(){Te(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},Te=function(t,n){t.dom().appendChild(n.dom())},Ee=function(n,t){M(t,function(t){Te(n,t)})},Be=function(t){t.dom().textContent="",M(we(t),function(t){Ae(t)})},Ae=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},De=function(t){return t.dom().innerHTML},Me=function(t,n){var e,o,r=ve(t).dom(),i=Zn.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||x.document).createElement("div")).innerHTML=e,we(Zn.fromDom(o)));Ee(i,u),Be(t),Te(t,i)},Fe=function(t){return t.dom().nodeName.toLowerCase()},Ie=function(t){return t.dom().nodeType},Ve=function(n){return function(t){return Ie(t)===n}},He=Ve(ce),Ne=Ve(se),Pe=Ve(ae),ze=function(t,n,e){if(!(S(e)||C(e)||D(e)))throw x.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},Le=function(t,n,e){ze(t.dom(),n,e)},je=function(t,n){var e=t.dom();rt(n,function(t,n){ze(e,n,t)})},Ue=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},We=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},Ge=function(t,n){t.dom().removeAttribute(n)},Xe=function(t){return n=t,e=!1,Zn.fromDom(n.dom().cloneNode(e));var n,e},Ye=function(t){var n,e,o,r=Xe(t);return n=r,e=Zn.fromTag("div"),o=Zn.fromDom(n.dom().cloneNode(!0)),Te(e,o),De(e)},qe=function(t){return Ye(t)},Ke="unknown",Je="__CHROME_INSPECTOR_CONNECTION_TO_ALLOY__";(Rt=Vt||(Vt={}))[Rt.STOP=0]="STOP",Rt[Rt.NORMAL=1]="NORMAL",Rt[Rt.LOGGING=2]="LOGGING";var $e=_t({}),Qe=function(n,t,e){var o,r,i,u;switch(Tt($e.get(),n).orThunk(function(){var t=et($e.get());return Ft(t,function(t){return-1<n.indexOf(t)?tt.some($e.get()[t]):tt.none()})}).getOr(Vt.NORMAL)){case Vt.NORMAL:return e(oo());case Vt.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",zn()],o)||x.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:_(i,function(t){return T(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+qe(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Vt.STOP:return!0}},Ze=["alloy/data/Fields","alloy/debugging/Debugging"],to=function(t,n,e){return Qe(t,n,e)},no=function(){if(x.window[Je]!==undefined)return x.window[Je];var n=function(t,n){var e=$e.get();e[t]=n,$e.set(e)};return x.window[Je]={systems:{},lookup:function(n){var e=x.window[Je].systems,t=et(e);return Ft(t,function(t){return e[t].getByUid(n).toOption().map(function(t){return Et(qe(t.element()),(n=function(e){var t=e.spec();return{"(original.spec)":t,"(dom.ref)":e.element().dom(),"(element)":qe(e.element()),"(initComponents)":_(t.components!==undefined?t.components:[],n),"(components)":_(e.components(),n),"(bound.events)":at(e.events(),function(t,n){return[n]}).join(", "),"(behaviours)":t.behaviours!==undefined?it(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 tt.some({error:"Systems ("+t.join(", ")+") did not contain uid: "+n})})},events:{setToNormal:function(t){n(t,Vt.NORMAL)},setToLogging:function(t){n(t,Vt.LOGGING)},setToStop:function(t){n(t,Vt.STOP)}}},x.window[Je]},eo=function(t,n){no().systems[t]=n},oo=Z({logEventCut:Q,logEventStopped:Q,logNoParent:Q,logEventNoHandlers:Q,logEventResponse:Q,write:Q}),ro=0,io=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++ro+String(n)},uo=tinymce.util.Tools.resolve("tinymce.ThemeManager"),ao=function(){return(ao=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 co(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 HD(t,n){function e(){this.constructor=t}Re(t,n),t.prototype=null===n?Object.create(n):(n.prototype,new e)}),function ND(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));return 3<i&&u&&Object.defineProperty(n,e,u),u},function PD(e,o){return function(t,n){o(t,n,e)}},function zD(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},function LD(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 jD(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 n(0),n(1),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(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(a&&(t[0],a.value),t[0]){case 0:case 1:break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,t[1];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]))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];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){}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([n,t])}}},function UD(t,n){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])},function WD(){for(var t=[],n=0;n<arguments.length;n++)t.concat(af(arguments[n]));return t},function GD(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 cf?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 XD(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?e?e(t):t:{value:cf(o[n](t)),done:"return"===n}}:e}},function YD(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=i[Symbol.asyncIterator];return n?n.call(i):(_e(),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 qD(t,n){return Object.defineProperty?Object.defineProperty(t,"raw",{value:n}):t.raw=n,t},function KD(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 JD(t){return t&&t.__esModule?t:{"default":t}};var so,fo,lo=bt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),mo=function(t){return lo.defaultedThunk(Z(t))},go=lo.strict,po=lo.asOption,ho=lo.defaultedThunk,vo=lo.mergeWithThunk;(fo=so||(so={}))[fo.Error=0]="Error",fo[fo.Value=1]="Value";var bo=function(t,n,e){return t.stype===so.Error?n(t.serror):e(t.svalue)},yo=function(t){return{stype:so.Value,svalue:t}},xo=function(t){return{stype:so.Error,serror:t}},wo=function(t){return t.fold(xo,yo)},So=function(t){return bo(t,vt.error,vt.value)},ko=yo,Co=function(t){var n=[],e=[];return M(t,function(t){bo(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Oo=xo,To=function(t,n){return t.stype===so.Value?n(t.svalue):t},Eo=function(t,n){return t.stype===so.Error?n(t.serror):t},Bo=function(t,n){return t.stype===so.Value?{stype:so.Value,svalue:n(t.svalue)}:t},Ao=function(t,n){return t.stype===so.Error?{stype:so.Error,serror:n(t.serror)}:t},Do=function(t){return p(Oo,L)(t)},_o=function(t,n){var e,o,r=Co(t);return 0<r.errors.length?Do(r.errors):(e=r.values,o=n,0<e.length?ko(wt(o,St.apply(undefined,e))):ko(o))},Mo=function(t){var n=Co(t);return 0<n.errors.length?Do(n.errors):ko(n.values)},Fo=bt([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),Io=bt([{field:["name","presence","type"]},{state:["name"]}]),Vo=function(){return ue.getOrDie("JSON")},Ro=function(t,n,e){return Vo().stringify(t,n,e)},Ho=function(t){return k(t)&&100<et(t).length?" removed due to size":Ro(t,null,2)},No=function(t,n){return Oo([{path:t,getErrorInfo:n}])},Po=bt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),zo=function(e,o,r){return mt(o,r).fold(function(){return t=r,n=o,No(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+Ho(n)});var t,n},ko)},Lo=function(t,n,e){var o=mt(t,n).fold(function(){return e(t)},d);return ko(o)},jo=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 Bo(n,function(t){return gt(e,s(t))})},u=function(t){return t.fold(function(){var t=gt(e,s(tt.none()));return ko(t)},function(t){var n=o.extract(a.concat([r]),s,t);return Bo(n,function(t){return gt(e,s(tt.some(t)))})})};return t.fold(function(){return To(zo(a,c,r),i)},function(t){return To(Lo(c,r,t),i)},function(){return To(ko(mt(c,r)),u)},function(t){return To((e=t,o=mt(n=c,r).map(function(t){return!0===t?e(n):t}),ko(o)),u);var n,e,o},function(t){var n=t(c),e=Bo(Lo(c,r,Z({})),function(t){return wt(n,t)});return To(e,i)})},function(t,n){var e=n(c);return ko(gt(t,s(e)))})},Uo=function(o){return{extract:function(e,t,n){return Eo(o(n,t),function(t){return n=t,No(e,function(){return n});var n})},toString:function(){return"val"},toDsl:function(){return Fo.itemOf(o)}}},Wo=function(t){var c=Go(t),s=R(t,function(n,t){return t.fold(function(t){return wt(n,Et(t,!0))},Z(n))},{});return{extract:function(t,n,e){var o,r,i,u=C(e)?[]:(r=et(o=e),V(r,function(t){return Dt(o,t)})),a=V(u,function(t){return!Dt(s,t)});return 0===a.length?c.extract(t,n,e):(i=a,No(t,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},Go=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=_(a,function(t){return jo(o,r,t,i)}),_o(u,{});var o,r,i,u},toString:function(){return"obj{\n"+_(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 Fo.objOf(_(a,function(t){return t.fold(function(t,n,e,o){return Io.field(t,e,o)},function(t,n){return Io.state(t)})}))}}},Xo=function(r){return{extract:function(e,o,t){var n=_(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return Mo(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return Fo.arrOf(r)}}},Yo=function(a,c){return{extract:function(e,o,r){var t,n,i=et(r),u=(t=e,n=i,Xo(Uo(a)).extract(t,d,n));return To(u,function(t){var n=_(t,function(t){return Po.field(t,t,go(),c)});return Go(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return Fo.setOf(a,c)}}},qo=Z(Uo(ko)),Ko=p(Xo,Go),Jo=Po.state,$o=Po.field,Qo=function(e,n,o,r,i){return Tt(r,i).fold(function(){return t=r,n=i,No(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+Ho(t)});var t,n},function(t){return Go(t).extract(e.concat(["branch: "+i]),n,o)})},Zo=function(r,i){return{extract:function(n,e,o){return Tt(o,r).fold(function(){return t=r,No(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return Qo(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+et(i)},toDsl:function(){return Fo.choiceOf(r,i)}}},tr=Uo(ko),nr=function(t){return Ko(t)},er=function(){return Xo(tr)},or=function(n){return Uo(function(t){return n(t).fold(Oo,ko)})},rr=function(n,t){return Yo(function(t){return wo(n(t))},t)},ir=function(t,n,e,o){var r=n.extract([t],e,o);return Ao(r,function(t){return{input:o,errors:t}})},ur=function(t,n,e){return So(ir(t,n,d,e))},ar=function(t){return t.fold(function(t){throw new Error(sr(t))},d)},cr=function(t,n,e){return ar(ur(t,n,e))},sr=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,_(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+Ho(t.input);var n,e},fr=function(t,n){return Zo(t,n)},lr=Z(tr),dr=function(e,o){return Uo(function(t){var n=typeof t;return e(t)?ko(t):Oo("Expected type: "+o+" but got: "+n)})},mr=dr(D,"number"),gr=dr(S,"string"),pr=dr(C,"boolean"),hr=dr(b,"function"),vr=function(n){return or(function(t){return T(n,t)?vt.value(t):vt.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},br=function(t){return $o(t,t,go(),qo())},yr=function(t,n){return $o(t,t,go(),n)},xr=function(t){return yr(t,gr)},wr=function(t,n){return $o(t,t,go(),vr(n))},Sr=function(t){return yr(t,hr)},kr=function(t,n){return $o(t,t,go(),Go(n))},Cr=function(t,n){return $o(t,t,go(),Ko(n))},Or=function(t,n){return $o(t,t,go(),Xo(n))},Tr=function(t){return $o(t,t,po(),qo())},Er=function(t,n){return $o(t,t,po(),n)},Br=function(t){return Er(t,mr)},Ar=function(t){return Er(t,gr)},Dr=function(t){return Er(t,hr)},_r=function(t,n){return Er(t,Go(n))},Mr=function(t,n){return $o(t,t,mo(n),qo())},Fr=function(t,n,e){return $o(t,t,mo(n),e)},Ir=function(t,n){return Fr(t,n,mr)},Vr=function(t,n){return Fr(t,n,gr)},Rr=function(t,n,e){return Fr(t,n,vr(e))},Hr=function(t,n){return Fr(t,n,pr)},Nr=function(t,n){return Fr(t,n,hr)},Pr=function(t,n,e){return Fr(t,n,Go(e))},zr=function(t,n){return Jo(t,n)},Lr=function(t,n){return he(t.element(),n.event().target())},jr=function(t){if(!Dt(t,"can")&&!Dt(t,"abort")&&!Dt(t,"run"))throw new Error("EventHandler defined by: "+Ro(t,null,2)+" does not have can, abort, or run!");return cr("Extracting event.handler",Wo([Mr("can",Z(!0)),Mr("abort",Z(!1)),Mr("run",Q)]),t)},Ur=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 U(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 U(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return jr({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];M(e,function(t){t.run.apply(undefined,n)})}})},Wr=function(t,n){qr(t,t.element(),n,{})},Gr=function(t,n,e){qr(t,t.element(),n,e)},Xr=function(t){Wr(t,Fn())},Yr=function(t,n,e){qr(t,n,e,{})},qr=function(t,n,e,o){var r=ao({target:n},o);t.getSystem().triggerEvent(e,n,it(r,Z))},Kr=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())};function Jr(t,n,e,o,r){return t(e,o)?tt.some(e):b(r)&&r(e)?tt.none():n(e,o,r)}var $r,Qr=function(t){var n=Ne(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},Zr=tn(function(){return ti(Zn.fromDom(x.document))}),ti=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return Zn.fromDom(n)},ni=function(t,n,e){for(var o=t.dom(),r=b(e)?e:Z(!1);o.parentNode;){o=o.parentNode;var i=Zn.fromDom(o);if(n(i))return tt.some(i);if(r(i))break}return tt.none()},ei=function(t,n,e){return Jr(function(t){return n(t)},ni,t,n,e)},oi=function(t,o){var r=function(t){for(var n=0;n<t.childNodes.length;n++){if(o(Zn.fromDom(t.childNodes[n])))return tt.some(Zn.fromDom(t.childNodes[n]));var e=r(t.childNodes[n]);if(e.isSome())return e}return tt.none()};return r(t.dom())},ri=function(t,n,e){return ei(t,function(t){return n(t).isSome()},e).bind(n)},ii=function(t){return Bt(t)},ui=function(t,n){return{key:t,value:jr({abort:n})}},ai=function(t,n){return{key:t,value:jr({can:n})}},ci=function(t){return{key:t,value:jr({run:function(t,n){n.event().prevent()}})}},si=function(t,n){return{key:t,value:jr({run:n})}},fi=function(t,n,e){return{key:t,value:jr({run:function(t){n.apply(undefined,[t].concat(e))}})}},li=function(t){return function(e){return{key:t,value:jr({run:function(t,n){Lr(t,n)&&e(t,n)}})}}},di=function(e,o){return si(e,function(t,n){t.getSystem().getByUid(o).each(function(t){Kr(t,t.element(),e,n)})})},mi=function(t,n,e){var o=n.partUids[e];return di(t,o)},gi=function(t,r){return si(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return ri(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},Z(!1)).getOr(n)},function(t){return t});r(n,o,t)})},pi=function(t){return si(t,function(t,n){n.cut()})},hi=function(t){return si(t,function(t,n){n.stop()})},vi=function(t,n){return li(t)(n)},bi=li(Un()),yi=li(Wn()),xi=li(zn()),wi=($r=Fn(),function(t){return si($r,t)}),Si=ii([ai(An(),function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(he(e=r,t.element())&&!he(e,o)&&(x.console.warn(An()+" did not get interpreted by the desired target. \nOriginator: "+qe(r)+"\nTarget: "+qe(i)+"\nCheck the "+An()+" event handlers"),1))})]),ki=/* */Object.freeze({events:Si}),Ci=Z("alloy-id-"),Oi=Z("data-alloy-id"),Ti=Ci(),Ei=Oi(),Bi=function(t,n){Object.defineProperty(t.dom(),Ei,{value:n,writable:!0})},Ai=function(t){var n=He(t)?t.dom()[Ei]:null;return tt.from(n)},Di=function(t){return io(t)},_i=d,Mi=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+qe(n().element())+" is not in context.")}};return{debugInfo:Z("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:Z(!1)}},Fi=Mi(),Ii=function(t){return _(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})},Vi=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:Ii(i)}},t},Ri=io("alloy-premade"),Hi=function(t){return Et(Ri,t)},Ni=function(t){return Tt(t,Ri)},Pi=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:Ii(i.slice(1))}},t;var t,n,e,r,i},zi={init:function(){return Li({readState:function(){return"No State required"}})}},Li=function(t){return t},ji=function(t,r){var i={};return rt(t,function(t,o){rt(t,function(t,n){var e=Ot(n,[])(i);i[n]=e.concat([r(o,t)])})}),i},Ui=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},Wi=function(t,n){return e=v.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:Z(o)};var e,o},Gi=function(t){return t.cHandler},Xi=function(t,n){return{name:Z(t),handler:Z(n)}},Yi=function(t,n,e){var o,r,i=ao({},e,(o=t,r={},M(n,function(t){r[t.name()]=t.handlers(o)}),r));return ji(i,Xi)},qi=function(t){var n,i=b(n=t)?{can:Z(!0),abort:Z(!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)}},Ki=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: "+Ro(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+Ro(c,null,2));return r<i?-1:i<r?1:0});return vt.value(e)}catch(o){return vt.error([o])}}("Event: "+e,"name",t,i).map(function(t){var n=_(t,function(t){return t.handler()});return Ur(n)}):(o=e,r=t,vt.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: '+Ro(_(r,function(t){return t.name()}),null,2)]))},Ji=function(t,i){var n=at(t,function(o,r){return(1===o.length?vt.value(o[0].handler()):Ki(o,i,r)).map(function(t){var n=qi(t),e=1<o.length?V(i,function(n){return T(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return Et(r,{handler:n,purpose:Z(e)})})});return At(n,{})},$i=function(t){return ur("custom.definition",Go([$o("dom","dom",go(),Go([br("tag"),Mr("styles",{}),Mr("classes",[]),Mr("attributes",{}),Tr("value"),Tr("innerHtml")])),br("components"),br("uid"),Mr("events",{}),Mr("apis",{}),$o("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"]},lo.mergeWithThunk(Z(n))),lr()),Tr("domModification")]),t);var n},Qi=function(t,n){var e=Ue(t,n);return e===undefined||""===e?[]:e.split(" ")},Zi=function(t){return t.dom().classList!==undefined},tu=function(t){return Qi(t,"class")},nu=function(t,n){return r=n,i=Qi(e=t,o="class").concat([r]),Le(e,o,i.join(" ")),!0;var e,o,r,i},eu=function(t,n){return r=n,0<(i=V(Qi(e=t,o="class"),function(t){return t!==r})).length?Le(e,o,i.join(" ")):Ge(e,o),!1;var e,o,r,i},ou=function(t,n){Zi(t)?t.dom().classList.add(n):nu(t,n)},ru=function(t,n){var e;Zi(t)?t.dom().classList.remove(n):eu(t,n),0===(Zi(e=t)?e.dom().classList:tu(e)).length&&Ge(e,"class")},iu=function(t,n){return Zi(t)&&t.dom().classList.contains(n)},uu=function(n,t){M(t,function(t){ou(n,t)})},au=function(n,t){M(t,function(t){ru(n,t)})},cu=function(t){return t.style!==undefined},su=function(t,n,e){if(!S(e))throw x.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);cu(t)&&t.style.setProperty(n,e)},fu=function(t,n){cu(t)&&t.style.removeProperty(n)},lu=function(t,n,e){var o=t.dom();su(o,n,e)},du=function(t,n){var e=t.dom();rt(n,function(t,n){su(e,n,t)})},mu=function(t,n){var e=t.dom();rt(n,function(t,n){t.fold(function(){fu(e,n)},function(t){su(e,n,t)})})},gu=function(t,n){var e=t.dom(),o=x.window.getComputedStyle(e).getPropertyValue(n),r=""!==o||Qr(t)?o:pu(e,n);return null===r?undefined:r},pu=function(t,n){return cu(t)?t.style.getPropertyValue(n):""},hu=function(t,n){var e=t.dom(),o=pu(e,n);return tt.from(o).filter(function(t){return 0<t.length})},vu=function(t,n,e){var o=Zn.fromTag(t);return lu(o,n,e),hu(o,n).isSome()},bu=function(t,n){var e=t.dom();fu(e,n),We(t,"style")&&""===Ue(t,"style").replace(/^\s+|\s+$/g,"")&&Ge(t,"style")},yu=function(t){return t.dom().offsetWidth},xu=function(t){return t.dom().value},wu=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},Su=function(t,n){return e=t,r=_(o=n,function(t){return _r(t.name(),[br("config"),Mr("state",zi)])}),i=ur("component.behaviours",Go(r),e.behaviours).fold(function(t){throw new Error(sr(t)+"\nComplete spec:\n"+Ro(e,null,2))},function(t){return t}),{list:o,data:it(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},ku=function(t){var n,e,o,r=(n=t,e=Ot("behaviours",{})(n),o=V(et(e),function(t){return e[t]!==undefined}),_(o,function(t){return e[t].me}));return Su(t,r)},Cu=function(t,n,e){var o,r,i,u=ao({},(o=t).dom,{uid:o.uid,domChildren:_(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return Ui({})},Ui),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=ao({},t);M(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=ji(r,function(t,n){return{name:t,modification:n}}),u=function(t){return R(t,function(t,n){return ao({},n.modification,t)},{})},a=R(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return Ui({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,ao({},r=u,{attributes:ao({},r.attributes,i.attributes),styles:ao({},r.styles,i.styles),classes:r.classes.concat(i.classes)})},Ou=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=Yi(r,u,a),Ji(c,i)).getOrDie()},Tu=function(e){var t=function(){return f},o=_t(Fi),n=ar($i(e)),r=ku(e),i=r.list,u=r.data,a=function(t){var n=Zn.fromTag(t.tag);je(n,t.attributes),uu(n,t.classes),du(n,t.styles),t.innerHtml.each(function(t){return Me(n,t)});var e=t.domChildren;return Ee(n,e),t.value.each(function(t){wu(n,t)}),t.uid,Bi(n,t.uid),n}(Cu(n,i,u)),c=Ou(n,i,u),s=_t(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 "+Ro(e,null,2))})()},hasConfigured:function(t){return b(u[t.name()])},spec:Z(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(Mi(t))},element:Z(a),syncComponents:function(){var t=we(a),n=j(t,function(t){return o.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});s.set(n)},components:s.get,events:Z(c)};return f},Eu=function(t){var n,e,o=_i(t),r=o.events,i=co(o,["events"]),u=(n=i,e=Ot("components",[])(n),_(e,_u)),a=ao({},i,{events:ao({},ki,r),components:u});return vt.value(Tu(a))},Bu=function(t){var n=Zn.fromText(t);return Au({element:n})},Au=function(t){var n=cr("external.component",Wo([br("element"),Tr("uid")]),t),e=_t(Mi());n.uid.each(function(t){Bi(n.element,t)});var o={getSystem:e.get,config:tt.none,hasConfigured:Z(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(Mi(function(){return o}))},getApis:function(){return{}},element:Z(n.element),spec:Z(t),readState:Z("No state"),syncComponents:Q,components:Z([]),events:Z({})};return Hi(o)},Du=Di,_u=function(n){return Ni(n).fold(function(){var t=n.hasOwnProperty("uid")?n:ao({uid:Du("")},n);return Eu(t).getOrDie()},function(t){return t})},Mu=Hi,Fu=function(t,n,e){return ei(t,n,e).isSome()},Iu=function(t,n,e){return ni(t,function(t){return de(t,n)},e)},Vu=function(t,n){return pe(n,t)},Ru=function(t,n,e){return Jr(de,Iu,t,n,e)},Hu=function(n,t){return(e=t,ei(e,function(t){if(!He(t))return!1;var n=Ue(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=Ue(t,"id"),e=ve(t);return Vu(e,'[aria-owns="'+n+'"]')})).exists(function(t){return Nu(n,t)});var e},Nu=function(n,t){return Fu(t,function(t){return he(t,n.element())},Z(!1))||Hu(n,t)},Pu=Z([br("menu"),br("selectedMenu")]),zu=Z([br("item"),br("selectedItem")]),Lu=(Z(Go(zu().concat(Pu()))),Z(Go(zu()))),ju=kr("initSize",[br("numColumns"),br("numRows")]),Uu=function(){return kr("markers",[br("backgroundMenu")].concat(Pu()).concat(zu()))},Wu=function(t){return kr("markers",_(t,br))},Gu=function(t,n,e){return function(){var t=new Error;if(t.stack!==undefined){var n=t.stack.split("\n");H(n,function(n){return 0<n.indexOf("alloy")&&!E(Ze,function(t){return-1<n.indexOf(t)})}).getOr(Ke)}}(),$o(n,n,e,or(function(e){return vt.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},Xu=function(t){return Gu(0,t,mo(Q))},Yu=function(t){return Gu(0,t,mo(tt.none))},qu=function(t){return Gu(0,t,go())},Ku=function(t){return Gu(0,t,go())},Ju=function(t,n){return zr(t,Z(n))},$u=function(t){return zr(t,d)},Qu=Z(ju),Zu=function(e,o,r){return xi(function(t,n){r(t,e,o)})},ta=function(t,n,e,o,r,i){var u,a,c=Wo(t),s=_r(n,[(u="config",a=t,Er(u,Wo(a)))]);return oa(c,s,n,e,o,r,i)},na=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:Z(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:Ii(c.slice(0,1).concat(c.slice(3)))}},t},ea=function(t){return{key:t,value:undefined}},oa=function(e,t,o,r,n,i,u){var a=function(t){return Dt(t,o)?t[o]():tt.none()},c=it(n,function(t,n){return na(o,t,n)}),s=it(i,function(t,n){return Vi(t,n)}),f=ao({},s,c,{revoke:v(ea,o),config:function(t){var n=cr(o+"-config",e,t);return{key:o,value:{config:n,me:f,configAsRaw:tn(function(){return cr(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Tt(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(Ui({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Ot("events",function(t,n){return{}})(r)(t.config,t.state)}).getOr({})}});return f},ra=function(t){return Bt(t)},ia=Wo([br("fields"),br("name"),Mr("active",{}),Mr("apis",{}),Mr("state",zi),Mr("extra",{})]),ua=function(t){var n=cr("Creating behaviour: "+t.name,ia,t);return ta(n.fields,n.name,n.active,n.apis,n.extra,n.state)},aa=Wo([br("branchKey"),br("branches"),br("name"),Mr("active",{}),Mr("apis",{}),Mr("state",zi),Mr("extra",{})]),ca=function(t){var n,e,o,r,i,u,a,c,s=cr("Creating behaviour: "+t.name,aa,t);return n=fr(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=_r(e,[Er("config",a=n)]),oa(a,c,e,o,r,i,u)},sa=Z(undefined),fa=/* */Object.freeze({events:function(a){return ii([si(Mn(),function(r,i){var t,n,u=a.channels,e=et(u),o=(t=e,(n=i).universal()?t:V(t,function(t){return T(n.channels(),t)}));M(o,function(t){var n=u[t],e=n.schema,o=cr("channel["+t+"] data\nReceiver: "+qe(r.element()),e,i.data());n.onReceive(r,o)})})])}}),la=[yr("channels",rr(vt.value,Wo([qu("onReceive"),Mr("schema",lr())])))],da=ua({fields:la,name:"receiving",active:fa}),ma=/* */Object.freeze({exhibit:function(t,n){return Ui({classes:[],styles:n.useFixed?{}:{position:"relative"}})}}),ga=function(e,o){return{left:Z(e),top:Z(o),translate:function(t,n){return ga(e+t,o+n)}}},pa=ga,ha=function(t,n){return t!==undefined?t:n!==undefined?n:0},va=function(t){var n,e,o=t.dom().ownerDocument,r=o.body,i=(n=Zn.fromDom(o),(e=n.dom())===e.window&&n instanceof x.Window?n:Pe(n)?e.defaultView||e.parentWindow:null),u=o.documentElement,a=ha(i.pageYOffset,u.scrollTop),c=ha(i.pageXOffset,u.scrollLeft),s=ha(u.clientTop,r.clientTop),f=ha(u.clientLeft,r.clientLeft);return ba(t).translate(c-f,a-s)},ba=function(t){var n,e,o,r=t.dom(),i=r.ownerDocument,u=i.body,a=Zn.fromDom(i.documentElement);return u===r?pa(u.offsetLeft,u.offsetTop):(n=t,e=a||Zn.fromDom(x.document.documentElement),ni(n,v(he,e)).isSome()?(o=r.getBoundingClientRect(),pa(o.left,o.top)):pa(0,0))},ya=(En.detect().browser.isSafari(),function(t){var n=t!==undefined?t.dom():x.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return pa(e,o)});function xa(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=gu(t,o);return parseFloat(e)||0}return n},i=function(r,t){return U(t,function(t,n){var e=gu(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!D(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();cu(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 wa=xa("width",function(t){return t.dom().offsetWidth}),Sa=function(t){return wa.get(t)},ka=function(t){return wa.getOuter(t)},Ca=xa("height",function(t){var n=t.dom();return Qr(t)?n.getBoundingClientRect().height:n.offsetHeight}),Oa=function(t){return Ca.get(t)},Ta=function(t){return Ca.getOuter(t)},Ea=oe(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),Ba=te("position","left","top","right","bottom"),Aa=bt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Da=Aa.southeast,_a=Aa.southwest,Ma=Aa.northeast,Fa=Aa.northwest,Ia=Aa.south,Va=Aa.north,Ra=Aa.east,Ha=Aa.west,Na=te("point","width","height"),Pa=te("x","y","width","height"),za=function(t,n,e,o){return{x:Z(t),y:Z(n),width:Z(e),height:Z(o),right:Z(t+e),bottom:Z(n+o)}},La=function(t){var n=va(t),e=ka(t),o=Ta(t);return za(n.left(),n.top(),e,o)},ja=function(o,t){return o.view(t).fold(Z([]),function(t){var n=o.owner(t),e=ja(o,n);return[t].concat(e)})},Ua=/* */Object.freeze({view:function(t){return(t.dom()===x.document?tt.none():tt.from(t.dom().defaultView.frameElement)).map(Zn.fromDom)},owner:function(t){return ve(t)}}),Wa=function(o){var t,n,e,r,i=Zn.fromDom(x.document),u=ya(i);return(t=o,e=(n=Ua).owner(t),r=ja(n,e),tt.some(r)).fold(v(va,o),function(t){var n=ba(o),e=R(t,function(t,n){var e=ba(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return pa(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},Ga=function(){var t=x.window.innerWidth,n=x.window.innerHeight,e=Zn.fromDom(x.document),o=ya(e);return za(o.left(),o.top(),t,n)},Xa=bt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Ya=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=tt.some(p),x=tt.some(h),w=tt.some(v),S=tt.some(b),k=tt.none();return u=n.direction(),a=function(){return Ba(t,y,x,k,k)},c=function(){return Ba(t,k,x,w,k)},s=function(){return Ba(t,y,k,k,S)},f=function(){return Ba(t,k,k,w,S)},l=function(){return Ba(t,y,x,k,k)},d=function(){return Ba(t,y,k,k,S)},m=function(){return Ba(t,y,x,k,k)},g=function(){return Ba(t,k,x,w,k)},u.fold(a,c,s,f,l,d,m,g)},qa=function(t,n){var e=v(Wa,n),o=t.fold(e,e,function(){var t=ya();return Wa(n).translate(-t.left(),-t.top())}),r=ka(n),i=Ta(n);return za(o.left(),o.top(),r,i)},Ka=Xa.relative,Ja=Xa.fixed,$a=te("anchorBox","origin"),Qa=bt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),Za=function(t,H,N,P,z){var L=N.width(),j=N.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,V,R=t(H,N,P);return(e=L,u=j,a=z,d=(n=R).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=Z((_=k?w:w+(u-E))+E-v),F=Z(v+y-_),c=n.direction(),f=s=F,l=M,I=c.fold(s,s,l,l,s,l,f,f),V=Ea({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?Qa.fit(V):Qa.nofit(V,T,E)).fold(Qa.fit,function(t,n,e){return i<e||r<n?Qa.nofit(t,n,e):Qa.nofit(o,r,i)})};return U(t,function(t,n){var e=v(o,n);return t.fold(Qa.fit,e)},Qa.nofit(Ea({x:H.x(),y:H.y(),width:N.width(),height:N.height(),maxHeight:N.height(),direction:Da(),classes:[],label:"none",candidateYforTest:H.y()}),-1,-1)).fold(d,d)},tc=function(t,n,e,o){bu(n,"max-height");var r,i={width:Z(ka(r=n)),height:Z(Ta(r))};return Za(o.preference(),t,i,e,o.bounds())},nc=function(t,n,e){var o,r,i=function(t){return t+"px"},u=(o=e.origin(),r=n,o.fold(function(){return Ba("absolute",tt.some(r.x()),tt.some(r.y()),tt.none(),tt.none())},function(t,n,e,o){return Ya("absolute",r,t,n,e,o)},function(t,n,e,o){return Ya("fixed",r,t,n,e,o)}));mu(t,{position:tt.some(u.position()),left:u.left().map(i),top:u.top().map(i),right:u.right().map(i),bottom:u.bottom().map(i)})},ec=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=Ca.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),lu(e,"max-height",r+"px")},oc=Z(function(t,n){ec(t,n),du(t,{"overflow-x":"hidden","overflow-y":"auto"})}),rc=Z(function(t,n){ec(t,n)}),ic=oe(["bounds","origin","preference","maxHeightFunction"],[]),uc=function(t,n,e,o,r,i){var u,a,c,s,f,l=(u=i,a="maxHeightFunction",c=oc(),u[a]===undefined?c:u[a]),d=t.anchorBox(),m=t.origin(),g=ic({bounds:(s=m,f=r,f.fold(function(){return s.fold(Ga,Ga,za)},function(t){return s.fold(t,t,za)})),origin:m,preference:o,maxHeightFunction:l});ac(d,n,e,g)},ac=function(t,n,e,o){var r,i,u,a,c=tc(t,n,e,o);nc(n,c,o),r=n,i=c.classes(),au(r,i.off),uu(r,i.on),u=n,a=c,o.maxHeightFunction()(u,a.maxHeight())},cc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],sc=function(t,n,e){var r=function(t){return Tt(e,t).getOr([])},o=function(t,n,e){var o=Y(cc,e);return{offset:function(){return pa(t,n)},classesOn:function(){return j(e,r)},classesOff:function(){return j(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"])}}},fc=function(){return sc(0,0,{})},lc=te("x","y","bubble","direction","label"),dc=function(t){return t.x()},mc=function(t,n){return t.x()+t.width()/2-n.width()/2},gc=function(t,n){return t.x()+t.width()-n.width()},pc=function(t,n){return t.y()-n.height()},hc=function(t){return t.y()+t.height()},vc=function(t,n){return t.y()+t.height()/2-n.height()/2},bc=function(t,n,e){return lc(dc(t),hc(t),e.southeast(),Da(),"layout-se")},yc=function(t,n,e){return lc(gc(t,n),hc(t),e.southwest(),_a(),"layout-sw")},xc=function(t,n,e){return lc(dc(t),pc(t,n),e.northeast(),Ma(),"layout-ne")},wc=function(t,n,e){return lc(gc(t,n),pc(t,n),e.northwest(),Fa(),"layout-nw")},Sc=function(t,n,e){return lc(mc(t,n),pc(t,n),e.north(),Va(),"layout-n")},kc=function(t,n,e){return lc(mc(t,n),hc(t),e.south(),Ia(),"layout-s")},Cc=function(t,n,e){return lc((o=t).x()+o.width(),vc(t,n),e.east(),Ra(),"layout-e");var o},Oc=function(t,n,e){return lc((o=n,t.x()-o.width()),vc(t,n),e.west(),Ha(),"layout-w");var o},Tc=function(){return[bc,yc,xc,wc,kc,Sc,Cc,Oc]},Ec=function(){return[yc,bc,wc,xc,kc,Sc,Cc,Oc]},Bc=function(t){return t},Ac=function(n,e){return function(t){return"rtl"===Dc(t)?e:n}},Dc=function(t){return"rtl"===gu(t,"direction")?"rtl":"ltr"},_c=function(){return _r("layouts",[br("onLtr"),br("onRtl")])},Mc=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 Ac(r,i)(n)},Fc=[br("hotspot"),Tr("bubble"),_c(),Ju("placement",function(t,n,e){var o=n.hotspot,r=qa(e,o.element()),i=Mc(t.element(),n,Tc(),Ec());return tt.some(Bc({anchorBox:r,bubble:n.bubble.getOr(fc()),overrides:{},layouts:i,placer:tt.none()}))})],Ic=[br("x"),br("y"),Mr("height",0),Mr("width",0),Mr("bubble",fc()),_c(),Ju("placement",function(t,n,e){var o=za(n.x,n.y,n.width,n.height),r=Mc(t.element(),n,Tc(),Ec());return tt.some(Bc({anchorBox:o,bubble:n.bubble,overrides:{},layouts:r,placer:tt.none()}))})],Vc=(bt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),bt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}])),Rc=te("start","soffset","finish","foffset"),Hc=Vc.exact,Nc=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=ve(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),f=he(t,e)&&n===o;return s.collapsed&&!f},Pc=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},zc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},Lc=function(t){return{left:Z(t.left),top:Z(t.top),right:Z(t.right),bottom:Z(t.bottom),width:Z(t.width),height:Z(t.height)}},jc=bt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Uc=function(t,n,e){return n(Zn.fromDom(e.startContainer),e.startOffset,Zn.fromDom(e.endContainer),e.endOffset)},Wc=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:Z(t),rtl:tt.none}},relative:function(t,n){return{ltr:tn(function(){return Pc(r,t,n)}),rtl:tn(function(){return tt.some(Pc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:tn(function(){return zc(r,t,n,e,o)}),rtl:tn(function(){return tt.some(zc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return jc.rtl(Zn.fromDom(t.endContainer),t.endOffset,Zn.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return Uc(0,jc.ltr,o)}):Uc(0,jc.ltr,o)},Gc=function $D(e,o){var r=function(t){return e(t)?tt.from(t.dom().nodeValue):tt.none()},t=En.detect().browser,n=t.isIE()&&10===t.version.major?function(t){try{return r(t)}catch(n){return tt.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}}}(Ne,"text"),Xc=function(t){return Gc.get(t)},Yc=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(t,n){return ge(n,t)}),qc=function(t){var n=Zn.fromDom(t.anchorNode),e=Zn.fromDom(t.focusNode);return Nc(n,t.anchorOffset,e,t.focusOffset)?tt.some(Rc(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return tt.some(Rc(Zn.fromDom(n.startContainer),n.startOffset,Zn.fromDom(e.endContainer),e.endOffset))}return tt.none()}(t)},Kc=function(t,n){var i,e,o,r,u=Wc(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?tt.some(r).map(Lc):tt.none()},Jc=te("element","offset"),$c=bt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Qc=function(t){return t.fold(function(t){return t},function(t,n,e){return t.translate(-n,-e)})},Zc=function(t){return t.fold(function(t){return t},function(t,n,e){return t})},ts=function(t){return U(t,function(t,n){return t.translate(n.left(),n.top())},pa(0,0))},ns=function(t){var n=_(t,Zc);return ts(n)},es=$c.screen,os=$c.absolute,rs=function(t,n,e){var o,r,i,u=ve(t.element()),a=ya(u),c=(o=t,r=e,i=be(r.root).dom(),tt.from(i.frameElement).map(Zn.fromDom).filter(function(t){var n=ve(t),e=ve(o.element());return he(n,e)}).map(va)).getOr(a);return os(c,a.left(),a.top())},is=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=es(pa(r,i));return tt.some(Na(c,u,a))},us=function(t,c,s,f,l){return t.map(function(t){var n,e,o,r=[c,t.point()],i=(n=function(){return ns(r)},e=function(){return ns(r)},o=function(){return t=_(r,Qc),ts(t);var t},f.fold(n,e,o)),u=Pa(i.left(),i.top(),t.width(),t.height()),a=Mc(l,s,s.showAbove?[xc,wc,bc,yc,Sc,kc]:[bc,yc,xc,wc,kc,kc],s.showAbove?[wc,xc,yc,bc,Sc,kc]:[yc,bc,wc,xc,kc,Sc]);return Bc({anchorBox:u,bubble:s.bubble.getOr(fc()),overrides:s.overrides,layouts:a,placer:tt.none()})})},as=te("element","offset"),cs=function(t,n){return Ne(t)?as(t,n):function(t,n){var e=we(t);if(0===e.length)return Jc(t,n);if(n<e.length)return Jc(e[n],0);var o=e[e.length-1],r=Ne(o)?Xc(o).length:we(o).length;return Jc(o,r)}(t,n)},ss=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,tt.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(qc);var t}})().map(function(t){var n=cs(t.start(),t.soffset()),e=cs(t.finish(),t.foffset());return Rc(n.element(),n.offset(),e.element(),e.offset())})},fs=[Tr("getSelection"),br("root"),Tr("bubble"),_c(),Mr("overrides",{}),Mr("showAbove",!1),Ju("placement",function(t,n,e){var o=be(n.root).dom(),r=rs(t,0,n),i=ss(o,n).bind(function(t){var n;return Kc(o,(n=t,Vc.exact(n.start(),n.soffset(),n.finish(),n.foffset()))).orThunk(function(){var n=Zn.fromText("\ufeff");return ke(t.start(),n),Kc(o,Hc(n,0,n,1)).map(function(t){return Ae(n),t})}).bind(function(t){return is(t.left(),t.top(),t.width(),t.height())})}),u=ss(o,n).bind(function(t){return He(t.start())?tt.some(t.start()):ye(t.start())}).getOr(t.element());return us(i,r,n,e,u)})],ls=[br("node"),br("root"),Tr("bubble"),_c(),Mr("overrides",{}),Mr("showAbove",!1),Ju("placement",function(r,i,u){var a=rs(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=is(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return us(e,a,i,u,o)})})],ds=function(t){return t.x()+t.width()},ms=function(t,n){return t.x()-n.width()},gs=function(t,n){return t.y()-n.height()+t.height()},ps=function(t){return t.y()},hs=function(t,n,e){return lc(ds(t),ps(t),e.southeast(),Da(),"link-layout-se")},vs=function(t,n,e){return lc(ms(t,n),ps(t),e.southwest(),_a(),"link-layout-sw")},bs=function(t,n,e){return lc(ds(t),gs(t,n),e.northeast(),Ma(),"link-layout-ne")},ys=function(t,n,e){return lc(ms(t,n),gs(t,n),e.northwest(),Fa(),"link-layout-nw")},xs=[br("item"),_c(),Ju("placement",function(t,n,e){var o=qa(e,n.item.element()),r=Mc(t.element(),n,[hs,vs,bs,ys],[vs,hs,ys,bs]);return tt.some(Bc({anchorBox:o,bubble:fc(),overrides:{},layouts:r,placer:tt.none()}))})],ws=fr("anchor",{selection:fs,node:ls,hotspot:Fc,submenu:xs,makeshift:Ic}),Ss=function(t,n,e,o,r){var i,u=(i=e.anchorBox,$a(i,n));uc(u,r.element(),e.bubble,e.layouts,o,e.overrides)},ks=function(n,t,e,o,r,i){var u=cr("positioning anchor.info",ws,o);lu(r.element(),"position","fixed");var a=hu(r.element(),"visibility");lu(r.element(),"visibility","hidden");var c,s,f,l=t.useFixed?Ja(0,0,x.window.innerWidth,x.window.innerHeight):(s=va((c=n).element()),f=c.element().dom().getBoundingClientRect(),Ka(s.left(),s.top(),f.width,f.height)),d=u.placement,m=i.map(function(t){return function(){return La(t)}}).or(t.getBounds);d(n,u,l).each(function(t){t.placer.getOr(Ss)(n,l,t,m,r)}),a.fold(function(){bu(r.element(),"visibility")},function(t){lu(r.element(),"visibility",t)}),hu(r.element(),"left").isNone()&&hu(r.element(),"top").isNone()&&hu(r.element(),"right").isNone()&&hu(r.element(),"bottom").isNone()&&hu(r.element(),"position").is("fixed")&&bu(r.element(),"position")},Cs=/* */Object.freeze({position:function(t,n,e,o,r){var i=tt.none();ks(t,n,e,o,r,i)},positionWithin:ks,getMode:function(t,n,e){return n.useFixed?"fixed":"absolute"}}),Os=[Mr("useFixed",!1),Tr("getBounds")],Ts=ua({fields:Os,name:"positioning",active:ma,apis:Cs}),Es=function(t){Wr(t,Wn());var n=t.components();M(n,Es)},Bs=function(t){var n=t.components();M(n,Bs),Wr(t,Un())},As=function(t,n){Ds(t,n,Te)},Ds=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),Qr(t.element())&&Bs(n),t.syncComponents()},_s=function(t){Es(t),Ae(t.element()),t.getSystem().removeFromWorld(t)},Ms=function(n){var t=ye(n.element()).bind(function(t){return n.getSystem().getByDom(t).fold(tt.none,tt.some)});_s(n),t.each(function(t){t.syncComponents()})},Fs=function(t){var n=t.components();M(n,_s),Be(t.element()),t.syncComponents()},Is=function(t,n){Vs(t,n,Te)},Vs=function(t,n,e){e(t,n.element());var o=we(n.element());M(o,function(t){n.getByDom(t).each(Bs)})},Rs=function(n){var t=we(n.element());M(t,function(t){n.getByDom(t).each(Es)}),Ae(n.element())},Hs=function(t,n,e,o){var r=function(n,t,e,o){e.get().each(function(t){Fs(n)});var r=t.getAttachPoint(n);As(r,n);var i=n.getSystem().build(o);return As(n,i),e.set(i),i}(t,n,e,o);return n.onOpen(t,r),r},Ns=function(n,e,o){o.get().each(function(t){Fs(n),Ms(n),e.onClose(n,t),o.clear()})},Ps=function(t,n,e){return e.isOpen()},zs=function(t,n,e){var o,r,i,u,a=n.getAttachPoint(t);lu(t.element(),"position",Ts.getMode(a)),o=t,r="visibility",i=n.cloakVisibilityAttr,u="hidden",hu(o.element(),r).fold(function(){Ge(o.element(),i)},function(t){Le(o.element(),i,t)}),lu(o.element(),r,u)},Ls=function(t,n,e){var o;o=t.element(),E(["top","left","right","bottom"],function(t){return hu(o,t).isSome()})||bu(t.element(),"position"),function(t,n,e){if(We(t.element(),e)){var o=Ue(t.element(),e);lu(t.element(),n,o)}else bu(t.element(),n)}(t,"visibility",n.cloakVisibilityAttr)},js=/* */Object.freeze({cloak:zs,decloak:Ls,open:Hs,openWhileCloaked:function(t,n,e,o,r){zs(t,n,e),Hs(t,n,e,o),r(),Ls(t,n,e)},close:Ns,isOpen:Ps,isPartOf:function(n,e,t,o){return Ps(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()}}),Us=/* */Object.freeze({events:function(e,o){return ii([si(Nn(),function(t,n){Ns(t,e,o)})])}}),Ws=[Xu("onOpen"),Xu("onClose"),br("isPartOf"),br("getAttachPoint"),Mr("cloakVisibilityAttr","data-precloak-visibility")],Gs=ua({fields:Ws,name:"sandboxing",active:Us,apis:js,state:/* */Object.freeze({init:function(){var n=_t(tt.none()),t=Z("not-implemented");return Li({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(tt.none())},set:function(t){n.set(tt.some(t))},get:function(t){return n.get()}})}})}),Xs=Z("dismiss.popups"),Ys=Z("mouse.released"),qs=Wo([Mr("isExtraPart",Z(!1)),_r("fireEventInstead",[Mr("event",Gn())])]),Ks=function(t){var n=Js(t);return da.config(n)},Js=function(t){var e=cr("Dismissal",qs,t);return{channels:Et(Xs(),{schema:Wo([br("target")]),onReceive:function(n,t){Gs.isOpen(n)&&(Gs.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return Gs.close(n)},function(t){return Wr(n,t.event)}))}})}},$s=function(o,t){return Pr(o,{},_(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,$o(n,n,po(),Uo(function(t){return Oo("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([zr("dump",d)]))},Qs=function(t){return t.dump},Zs=function(t,n){return ao({},t.dump,ra(n))},tf={field:$s,augment:Zs,get:Qs},nf="placeholder",ef=bt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),of=function(t,n,e,o){return e.uiType===nf?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?ef.single(!0,Z(i)):Tt(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+et(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+Ro(i,null,2))},function(t){return t.replace()})):ef.single(!1,Z(e));var r,i,u},rf=function(i,u,a,c){return of(i,0,a,c).fold(function(t,n){var e=n(u,a.config,a.validated),o=Tt(e,"components").getOr([]),r=j(o,function(t){return rf(i,u,t,c)});return[ao({},e,{components:r})]},function(t,n){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(d)(e)})},uf=function(n,e,t,o){return j(t,function(t){return rf(n,e,t,o)})},sf=function(n,e,t,o){var r=it(o,function(t,n){return o=t,r=!1,{name:Z(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=uf(n,e,t,r);return rt(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: "+Ro(e.components,null,2))}),i},ff=ef.single,lf=ef.multiple,df=Z(nf),mf=bt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),gf=Mr("factory",{sketch:d}),pf=Mr("schema",[]),hf=br("name"),vf=$o("pname","pname",ho(function(t){return"<alloy."+io(t.name)+">"}),lr()),bf=zr("schema",function(){return[Tr("preprocess")]}),yf=Mr("defaults",Z({})),xf=Mr("overrides",Z({})),wf=Go([gf,pf,hf,vf,yf,xf]),Sf=Go([gf,pf,hf,yf,xf]),kf=Go([gf,pf,hf,vf,yf,xf]),Cf=Go([gf,bf,hf,br("unit"),vf,yf,xf]),Of=function(t){return t.fold(tt.some,tt.none,tt.some,tt.some)},Tf=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},Ef=function(e,o){return function(t){var n=cr("Converting part type",o,t);return e(n)}},Bf=Ef(mf.required,wf),Af=Ef(mf.external,Sf),Df=Ef(mf.optional,kf),_f=Ef(mf.group,Cf),Mf=Z("entirety"),Ff=/* */Object.freeze({required:Bf,external:Af,optional:Df,group:_f,asNamedPart:Of,name:Tf,asCommon:function(t){return t.fold(d,d,d,d)},original:Mf}),If=function(t,n,e,o){return wt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},Vf=function(r,t){var n={};return M(t,function(t){Of(t).each(function(e){var o=Rf(r,e.pname);n[e.name]=function(t){var n=cr("Part: "+e.name+" in "+r,Go(e.schema),t);return ao({},o,{config:t,validated:n})}})}),n},Rf=function(t,n){return{uiType:df(),owner:t,name:n}},Hf=function(t,n,e){return{uiType:df(),owner:t,name:n,config:e,validated:{}}},Nf=function(t){return j(t,function(t){return t.fold(tt.none,tt.some,tt.none,tt.none).map(function(t){return kr(t.name,t.schema.concat([$u(Mf())]))}).toArray()})},Pf=function(t){return _(t,Tf)},zf=function(t,n,e){return o=n,i={},r={},M(e,function(t){t.fold(function(o){i[o.pname]=ff(!0,function(t,n,e){return o.factory.sketch(If(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=Z(t.factory.sketch(If(o,t,n[Mf()]),n))},function(o){i[o.pname]=ff(!1,function(t,n,e){return o.factory.sketch(If(t,o,n,e))})},function(r){i[r.pname]=lf(!0,function(n,t,e){var o=n[r.name];return _(o,function(t){return r.factory.sketch(wt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:Z(i),externals:Z(r)};var o,i,r},Lf=function(t,n,e){return sf(tt.some(t),n,n.components,e)},jf=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},Uf=function(t,n,e){return jf(t,n,e).getOrDie("Could not find part: "+e)},Wf=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return M(e,function(t){o[t]=i.getByUid(r[t])}),it(o,Z)},Gf=function(t,n){var e=t.getSystem();return it(n.partUids,function(t,n){return Z(e.getByUid(t))})},Xf=function(t){return et(t.partUids)},Yf=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return M(e,function(t){o[t]=i.getByUid(r[t]).getOrDie()}),it(o,Z)},qf=function(n,t){var e=Pf(t);return Bt(_(e,function(t){return{key:t,value:n+"-"+t}}))},Kf=function(n){return $o("partUids","partUids",vo(function(t){return qf(t.uid,n)}),lr())},Jf=/* */Object.freeze({generate:Vf,generateOne:Hf,schemas:Nf,names:Pf,substitutes:zf,components:Lf,defaultUids:qf,defaultUidsSchema:Kf,getAllParts:Gf,getAllPartNames:Xf,getPart:jf,getPartOrDie:Uf,getParts:Wf,getPartsOrDie:Yf}),$f=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[kr("parts",i)]:[]).concat([br("uid"),Mr("dom",{}),Mr("components",[]),$u("originalSpec"),Mr("debug.sketcher",{})]).concat(u));return cr(t+" [SpecSchema]",Wo(a.concat(n)),e)},Qf=function(t,n,e,o,r){var i=Zf(r),u=Nf(e),a=Kf(e),c=$f(t,n,i,u,[a]),s=zf(0,c,e);return o(c,Lf(t,c,s.internals()),i,s.externals())},Zf=function(t){return t.hasOwnProperty("uid")?t:ao({},t,{uid:Di("uid")})};function tl(t){return t.uid!==undefined}var nl,el,ol=Wo([br("name"),br("factory"),br("configFields"),Mr("apis",{}),Mr("extraApis",{})]),rl=Wo([br("name"),br("factory"),br("configFields"),br("partFields"),Mr("apis",{}),Mr("extraApis",{})]),il=function(t){var i=cr("Sketcher for "+t.name,ol,t),n=it(i.apis,Pi),e=it(i.extraApis,function(t,n){return Vi(t,n)});return ao({name:Z(i.name),partFields:Z([]),configFields:Z(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=Zf(t),o($f(n,e,r,[],[]),r);var n,e,o,r}},n,e)},ul=function(t){var n=cr("Sketcher for "+t.name,rl,t),e=Vf(n.name,n.partFields),o=it(n.apis,Pi),r=it(n.extraApis,function(t,n){return Vi(t,n)});return ao({name:Z(n.name),partFields:Z(n.partFields),configFields:Z(n.configFields),sketch:function(t){return Qf(n.name,n.configFields,n.partFields,n.factory,t)},parts:Z(e)},o,r)},al=function(t){return"input"===Fe(t)&&"radio"!==Ue(t,"type")||"textarea"===Fe(t)},cl=/* */Object.freeze({getCurrent:function(t,n,e){return n.find(t)}}),sl=[br("find")],fl=ua({fields:sl,name:"composing",apis:cl}),ll=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},dl=function(t,n,e){return t<=n?n:e<=t?e:t},ml=function(e,o,t,r){var n=Yc(e.element(),"."+o.highlightClass);M(n,function(n){E(r,function(t){return t.element()===n})||(ru(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),Wr(t,$n())}))})},gl=function(t,n,e,o){ml(t,n,0,[o]),pl(t,n,e,o)||(ou(o.element(),n.highlightClass),n.onHighlight(t,o),Wr(o,Jn()))},pl=function(t,n,e,o){return iu(o.element(),n.highlightClass)},hl=function(t,n,e,o){var r=Yc(t.element(),"."+n.itemClass);return tt.from(r[o]).fold(function(){return vt.error("No element found with index "+o)},t.getSystem().getByDom)},vl=function(n,t,e){return Vu(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},bl=function(n,t,e){var o=Yc(n.element(),"."+t.itemClass);return(0<o.length?tt.some(o[o.length-1]):tt.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},yl=function(e,n,t,o){var r=Yc(e.element(),"."+n.itemClass);return N(r,function(t){return iu(t,n.highlightClass)}).bind(function(t){var n=ll(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},xl=function(n,t,e){var o=Yc(n.element(),"."+t.itemClass);return Mt(_(o,function(t){return n.getSystem().getByDom(t).toOption()}))},wl=/* */Object.freeze({dehighlightAll:function(t,n,e){return ml(t,n,0,[])},dehighlight:function(t,n,e,o){pl(t,n,e,o)&&(ru(o.element(),n.highlightClass),n.onDehighlight(t,o),Wr(o,$n()))},highlight:gl,highlightFirst:function(n,e,o){vl(n,e,o).each(function(t){gl(n,e,o,t)})},highlightLast:function(n,e,o){bl(n,e,o).each(function(t){gl(n,e,o,t)})},highlightAt:function(n,e,o,t){hl(n,e,o,t).fold(function(t){throw new Error(t)},function(t){gl(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=xl(n,e,o);H(r,t).each(function(t){gl(n,e,o,t)})},isHighlighted:pl,getHighlighted:function(n,t,e){return Vu(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:vl,getLast:bl,getPrevious:function(t,n,e){return yl(t,n,0,-1)},getNext:function(t,n,e){return yl(t,n,0,1)},getCandidates:xl}),Sl=[br("highlightClass"),br("itemClass"),Xu("onHighlight"),Xu("onDehighlight")],kl=ua({fields:Sl,name:"highlighting",apis:wl}),Cl=function(t,n,e){var o=X(t.slice(0,n)),r=X(t.slice(n+1));return H(o.concat(r),e)},Ol=function(t,n,e){var o=X(t.slice(0,n));return H(o,e)},Tl=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return H(r.concat(o),e)},El=function(t,n,e){var o=t.slice(n+1);return H(o,e)},Bl=function(e){return function(t){var n=t.raw();return T(e,n.which)}},Al=function(t){return function(n){return W(t,function(t){return t(n)})}},Dl=function(t){return!0===t.raw().shiftKey},_l=function(t){return!0===t.raw().ctrlKey},Ml=w(Dl),Fl=function(t,n){return{matches:t,classification:n}},Il=function(t,n){return H(t,function(t){return t.matches(n)}).map(function(t){return t.classification})},Vl=function(t){t.dom().focus()},Rl=function(t){var n=t!==undefined?t.dom():x.document;return tt.from(n.activeElement).map(Zn.fromDom)},Hl=function(n){return Rl(ve(n)).filter(function(t){return n.dom().contains(t.dom())})},Nl=function(t,n,e){n.exists(function(n){return e.exists(function(t){return he(t,n)})})||Gr(t,Xn(),{prevFocus:n,newFocus:e})},Pl=function(){var r=function(t){return Hl(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);Nl(t,e,o)}}},zl=function(){var r=function(t){return kl.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(Q,function(t){kl.highlight(n,t)});var o=r(n);Nl(n,e,o)}}};(el=nl||(nl={})).OnFocusMode="onFocus",el.OnEnterOrSpaceMode="onEnterOrSpace",el.OnApiMode="onApi";var Ll,jl=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i=t(n,e,o,r);return Il(i,e.event()).bind(function(t){return t(n,e,o,r)})},r={schema:function(){return t.concat([Mr("focusManager",Pl()),Fr("focusInside","onFocus",or(function(t){return T(["onFocus","onEnterOrSpace","onApi"],t)?vt.value(t):vt.error("Invalid value for focusInside")})),Ju("handler",r),Ju("state",n),Ju("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==nl.OnFocusMode?tt.none():a(i).map(function(e){return si(An(),function(t,n){e(t,i,u),n.stop()})});return ii(t.toArray().concat([si(Yt(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=Bl([32].concat([13]))(e.event()),i.focusInside===nl.OnEnterOrSpaceMode&&t&&Lr(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(t){r.stop()})}),si(qt(),function(t,n){c(t,n,o,i,u).each(function(t){n.stop()})})]))}};return r},Ul=function(t){var n=[Tr("onEscape"),Tr("onEnter"),Mr("selector",'[data-alloy-tabstop="true"]'),Mr("firstTabstop",0),Mr("useTabstopAt",Z(!0)),Tr("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return Ru(n,t)}).getOr(n);return 0<Oa(e)},e=function(n,e){var t,o,r,i;(t=n,o=e,r=Yc(t.element(),o.selector),i=V(r,function(t){return u(o,t)}),tt.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?tt.some(!0):tt.none()},function(t){return o.focusManager.set(n,t),tt.some(!0)})},i=function(n,t,e,o){var r,i,u=Yc(n.element(),e.selector);return(r=n,i=e,i.focusManager.get(r).bind(function(t){return Ru(t,i.selector)})).bind(function(t){return N(u,v(he,t)).bind(function(t){return a(n,u,t,e,o)})})},o=Z([Fl(Al([Dl,Bl([9])]),function(t,n,e,o){var r=e.cyclic?Cl:Ol;return i(t,0,e,r)}),Fl(Bl([9]),function(t,n,e,o){var r=e.cyclic?Tl:El;return i(t,0,e,r)}),Fl(Bl([27]),function(n,e,t,o){return t.onEscape.bind(function(t){return t(n,e)})}),Fl(Al([Ml,Bl([13])]),function(n,e,t,o){return t.onEnter.bind(function(t){return t(n,e)})})]),r=Z([]);return jl(n,zi.init,o,r,function(){return tt.some(e)})},Wl=Ul(zr("cyclic",Z(!1))),Gl=Ul(zr("cyclic",Z(!0))),Xl=function(t,n,e){return al(e)&&Bl([32])(n.event())?tt.none():(Yr(t,e,Fn()),tt.some(!0))},Yl=function(t,n){return tt.some(!0)},ql=[Mr("execute",Xl),Mr("useSpace",!1),Mr("useEnter",!0),Mr("useControlEnter",!1),Mr("useDown",!1)],Kl=function(t,n,e){return e.execute(t,n,t.element())},Jl=jl(ql,zi.init,function(t,n,e,o){var r=e.useSpace&&!al(t.element())?[32]:[],i=e.useEnter?[13]:[],u=e.useDown?[40]:[],a=r.concat(i).concat(u);return[Fl(Bl(a),Kl)].concat(e.useControlEnter?[Fl(Al([_l,Bl([13])]),Kl)]:[])},function(t,n,e,o){return e.useSpace&&!al(t.element())?[Fl(Bl([32]),Yl)]:[]},function(){return tt.none()}),$l=function(t){var e=_t(tt.none());return Li({readState:function(){return e.get().map(function(t){return{numRows:t.numRows(),numColumns:t.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(tt.some({numRows:Z(t),numColumns:Z(n)}))},getNumRows:function(){return e.get().map(function(t){return t.numRows()})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns()})}})},Ql=/* */Object.freeze({flatgrid:$l,init:function(t){return t.state(t)}}),Zl=function(i){return function(t,n,e,o){var r=i(t.element());return od(r,t,n,e,o)}},td=function(t,n){var e=Ac(t,n);return Zl(e)},nd=function(t,n){var e=Ac(n,t);return Zl(e)},ed=function(r){return function(t,n,e,o){return od(r,t,n,e,o)}},od=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})},rd=ed,id=ed,ud=ed,ad=function(t){var n,e=t.dom();return!((n=e).offsetWidth<=0&&n.offsetHeight<=0)},cd=oe(["index","candidates"],[]),sd=function(t,n,e){return fd(t,n,e,ad)},fd=function(t,n,e,o){var r,i=v(he,n),u=Yc(t,e),a=V(u,ad);return N(r=a,i).map(function(t){return cd({index:t,candidates:r})})},ld=function(t,n){return N(t,function(t){return he(n,t)})},dd=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?tt.some(e[n]):tt.none()})},md=function(r,t,i,u,a){return dd(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=ll(n,a,0,e-1);return tt.some({row:Z(t),column:Z(o)})})},gd=function(i,t,u,a,c){return dd(i,t,a,function(t,n){var e=ll(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=dl(n,0,o-1);return tt.some({row:Z(e),column:Z(r)})})},pd=[br("selector"),Mr("execute",Xl),Yu("onEscape"),Mr("captureTab",!1),Qu()],hd=function(n,e,t){Vu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},vd=function(r){return function(t,n,e,o){return sd(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))})}},bd=function(t,n,e,o){return e.captureTab?tt.some(!0):tt.none()},yd=vd(function(t,n,e,o){return md(t,n,e,o,-1)}),xd=vd(function(t,n,e,o){return md(t,n,e,o,1)}),wd=vd(function(t,n,e,o){return gd(t,n,e,o,-1)}),Sd=vd(function(t,n,e,o){return gd(t,n,e,o,1)}),kd=Z([Fl(Bl([37]),td(yd,xd)),Fl(Bl([39]),nd(yd,xd)),Fl(Bl([38]),rd(wd)),Fl(Bl([40]),id(Sd)),Fl(Al([Dl,Bl([9])]),bd),Fl(Al([Ml,Bl([9])]),bd),Fl(Bl([27]),function(t,n,e,o){return e.onEscape(t,n)}),Fl(Bl([32].concat([13])),function(n,e,o,t){return(r=n,i=o,i.focusManager.get(r).bind(function(t){return Ru(t,i.selector)})).bind(function(t){return o.execute(n,e,t)});var r,i})]),Cd=Z([Fl(Bl([32]),Yl)]),Od=jl(pd,$l,kd,Cd,function(){return tt.some(hd)}),Td=function(t,n,e,i){var u=function(t,n,e){var o,r=ll(n,i,0,e.length-1);return r===t?tt.none():(o=e[r],"button"===Fe(o)&&"disabled"===Ue(o,"disabled")?u(t,r,e):tt.from(e[r]))};return sd(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},Ed=[br("selector"),Mr("getInitial",tt.none),Mr("execute",Xl),Yu("onEscape"),Mr("executeOnMove",!1),Mr("allowVertical",!0)],Bd=function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return Ru(t,r.selector)})).bind(function(t){return o.execute(n,e,t)});var t,r},Ad=function(n,e){e.getInitial(n).orThunk(function(){return Vu(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},Dd=function(t,n,e){return Td(t,e.selector,n,-1)},_d=function(t,n,e){return Td(t,e.selector,n,1)},Md=function(o){return function(t,n,e){return o(t,n,e).bind(function(){return e.executeOnMove?Bd(t,n,e):tt.some(!0)})}},Fd=function(t,n,e,o){return e.onEscape(t,n)},Id=Z([Fl(Bl([32]),Yl)]),Vd=jl(Ed,zi.init,function(t,n,e,o){var r=[37].concat(e.allowVertical?[38]:[]),i=[39].concat(e.allowVertical?[40]:[]);return[Fl(Bl(r),Md(td(Dd,_d))),Fl(Bl(i),Md(nd(Dd,_d))),Fl(Bl([13]),Bd),Fl(Bl([32]),Bd),Fl(Bl([27]),Fd)]},Id,function(){return tt.some(Ad)}),Rd=oe(["rowIndex","columnIndex","cell"],[]),Hd=function(t,n,e){return tt.from(t[n]).bind(function(t){return tt.from(t[e]).map(function(t){return Rd({rowIndex:n,columnIndex:e,cell:t})})})},Nd=function(t,n,e,o){var r=t[n].length,i=ll(e,o,0,r-1);return Hd(t,n,i)},Pd=function(t,n,e,o){var r=ll(e,o,0,t.length-1),i=t[r].length,u=dl(n,0,i-1);return Hd(t,r,u)},zd=function(t,n,e,o){var r=t[n].length,i=dl(e+o,0,r-1);return Hd(t,n,i)},Ld=function(t,n,e,o){var r=dl(e+o,0,t.length-1),i=t[r].length,u=dl(n,0,i-1);return Hd(t,r,u)},jd=[kr("selectors",[br("row"),br("cell")]),Mr("cycles",!0),Mr("previousSelector",tt.none),Mr("execute",Xl)],Ud=function(n,e){e.previousSelector(n).orThunk(function(){var t=e.selectors;return Vu(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},Wd=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return Ru(o,i.selectors.row).bind(function(t){var n=Yc(t,i.selectors.cell);return ld(n,o).bind(function(o){var r=Yc(e,i.selectors.row);return ld(r,t).bind(function(t){var n,e=(n=i,_(r,function(t){return Yc(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell()})})})})}},Gd=Wd(function(t,n,e){return Nd(t,n,e,-1)},function(t,n,e){return zd(t,n,e,-1)}),Xd=Wd(function(t,n,e){return Nd(t,n,e,1)},function(t,n,e){return zd(t,n,e,1)}),Yd=Wd(function(t,n,e){return Pd(t,e,n,-1)},function(t,n,e){return Ld(t,e,n,-1)}),qd=Wd(function(t,n,e){return Pd(t,e,n,1)},function(t,n,e){return Ld(t,e,n,1)}),Kd=Z([Fl(Bl([37]),td(Gd,Xd)),Fl(Bl([39]),nd(Gd,Xd)),Fl(Bl([38]),rd(Yd)),Fl(Bl([40]),id(qd)),Fl(Bl([32].concat([13])),function(n,e,o){return Hl(n.element()).bind(function(t){return o.execute(n,e,t)})})]),Jd=Z([Fl(Bl([32]),Yl)]),$d=jl(jd,zi.init,Kd,Jd,function(){return tt.some(Ud)}),Qd=[br("selector"),Mr("execute",Xl),Mr("moveOnTab",!1)],Zd=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},tm=function(n,e){Vu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},nm=function(t,n,e){return Td(t,e.selector,n,-1)},em=function(t,n,e){return Td(t,e.selector,n,1)},om=Z([Fl(Bl([38]),ud(nm)),Fl(Bl([40]),ud(em)),Fl(Al([Dl,Bl([9])]),function(t,n,e){return e.moveOnTab?ud(nm)(t,n,e):tt.none()}),Fl(Al([Ml,Bl([9])]),function(t,n,e){return e.moveOnTab?ud(em)(t,n,e):tt.none()}),Fl(Bl([13]),Zd),Fl(Bl([32]),Zd)]),rm=Z([Fl(Bl([32]),Yl)]),im=jl(Qd,zi.init,om,rm,function(){return tt.some(tm)}),um=[Yu("onSpace"),Yu("onEnter"),Yu("onShiftEnter"),Yu("onLeft"),Yu("onRight"),Yu("onTab"),Yu("onShiftTab"),Yu("onUp"),Yu("onDown"),Yu("onEscape"),Mr("stopSpaceKeyup",!1),Tr("focusIn")],am=jl(um,zi.init,function(t,n,e){return[Fl(Bl([32]),e.onSpace),Fl(Al([Ml,Bl([13])]),e.onEnter),Fl(Al([Dl,Bl([13])]),e.onShiftEnter),Fl(Al([Dl,Bl([9])]),e.onShiftTab),Fl(Al([Ml,Bl([9])]),e.onTab),Fl(Bl([38]),e.onUp),Fl(Bl([40]),e.onDown),Fl(Bl([37]),e.onLeft),Fl(Bl([39]),e.onRight),Fl(Bl([32]),e.onSpace),Fl(Bl([27]),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[Fl(Bl([32]),Yl)]:[]},function(t){return t.focusIn}),cm=Wl.schema(),sm=Gl.schema(),fm=Vd.schema(),lm=Od.schema(),dm=$d.schema(),mm=Jl.schema(),gm=im.schema(),pm=am.schema(),hm=ca({branchKey:"mode",branches:/* */Object.freeze({acyclic:cm,cyclic:sm,flow:fm,flatgrid:lm,matrix:dm,execution:mm,menu:gm,special:pm}),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){Dt(e,"setGridSize")?e.setGridSize(o,r):x.console.error("Layout does not support setGridSize")}},state:Ql}),vm=function(t,n,e,o){var r=t.getSystem().build(o);Ds(t,r,e)},bm=function(t,n,e,o){var r=ym(t,n);H(r,function(t){return he(o.element(),t.element())}).each(Ms)},ym=function(t,n){return t.components()},xm=function(n,e,t,r,o){var i=ym(n,e);return tt.from(i[r]).map(function(t){return bm(n,e,0,t),o.each(function(t){vm(n,0,function(t,n){var e,o;o=n,Se(e=t,r).fold(function(){Te(e,o)},function(t){ke(t,o)})},t)}),t})},wm=ua({fields:[],name:"replacing",apis:/* */Object.freeze({append:function(t,n,e,o){vm(t,0,Te,o)},prepend:function(t,n,e,o){vm(t,0,Oe,o)},remove:bm,replaceAt:xm,replaceBy:function(n,e,t,o,r){var i=ym(n,e);return N(i,o).bind(function(t){return xm(n,e,0,t,r)})},set:function(n,t,e,o){var r,i,u,a;Fs(n),r=function(){var t=_(o,n.getSystem().build);M(t,function(t){As(n,t)})},i=n.element(),u=ve(i),a=Rl(u).bind(function(n){var t=function(t){return he(n,t)};return t(i)?tt.some(i):oi(i,t)}),r(i),a.each(function(n){Rl(u).filter(function(t){return he(t,n)}).fold(function(){Vl(n)},Q)})},contents:ym})}),Sm=function(t,n,e){n.store.manager.onLoad(t,n,e)},km=function(t,n,e){n.store.manager.onUnload(t,n,e)},Cm=/* */Object.freeze({onLoad:Sm,onUnload:km,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}}),Om=/* */Object.freeze({events:function(e,o){var t=e.resetOnDom?[bi(function(t,n){Sm(t,e,o)}),yi(function(t,n){km(t,e,o)})]:[Zu(e,o,Sm)];return ii(t)}}),Tm=function(){var t=_t(null);return Li({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()}}})},Em=function(){var i=_t({}),u=_t({});return Li({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Tt(i.get(),t).orThunk(function(){return Tt(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};M(t,function(n){o[n.value]=n,Tt(n,"meta").each(function(t){Tt(t,"text").each(function(t){r[t]=n})})}),i.set(ao({},n,o)),u.set(ao({},e,r))},clear:function(){i.set({}),u.set({})}})},Bm=/* */Object.freeze({memory:Tm,dataset:Em,manual:function(){return Li({readState:function(){}})},init:function(t){return t.store.manager.state(t)}}),Am=function(t,n,e,o){var r=n.store;e.update([o]),r.setValue(t,o),n.onSetValue(t,o)},Dm=[Tr("initialValue"),br("getFallbackEntry"),br("getDataKey"),br("setValue"),Ju("manager",{setValue:Am,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){Am(n,e,o,t)})},onUnload:function(t,n,e){e.clear()},state:Em})],_m=[br("getValue"),Mr("setValue",Q),Tr("initialValue"),Ju("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:Q,state:zi.init})],Mm=[Tr("initialValue"),Ju("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:Tm})],Fm=[Fr("store",{mode:"memory"},fr("mode",{memory:Mm,manual:_m,dataset:Dm})),Xu("onSetValue"),Mr("resetOnDom",!1)],Im=ua({fields:Fm,name:"representing",active:Om,apis:Cm,extra:{setValueFrom:function(t,n){var e=Im.getValue(n);Im.setValue(t,e)}},state:Bm}),Vm=function(t,n){n.ignore||(Vl(t.element()),n.onFocus(t))},Rm=/* */Object.freeze({focus:Vm,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=ve(n).dom(),n.dom()===e.activeElement;var n,e}}),Hm=/* */Object.freeze({exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return Ui(e)},events:function(e){return ii([si(An(),function(t,n){Vm(t,e),n.stop()})].concat(e.stopMousedown?[si(zt(),function(t,n){n.event().prevent()})]:[]))}}),Nm=[Xu("onFocus"),Mr("stopMousedown",!1),Mr("ignore",!1)],Pm=ua({fields:Nm,name:"focusing",active:Hm,apis:Rm}),zm=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},Lm=function(n,t,e){t.toggleClass.each(function(t){e.get()?ou(n.element(),t):ru(n.element(),t)})},jm=function(t,n,e){Gm(t,n,e,!e.get())},Um=function(t,n,e){e.set(!0),Lm(t,n,e),zm(t,n,e)},Wm=function(t,n,e){e.set(!1),Lm(t,n,e),zm(t,n,e)},Gm=function(t,n,e,o){(o?Um:Wm)(t,n,e)},Xm=function(t,n,e){Gm(t,n,e,n.selected)},Ym=/* */Object.freeze({onLoad:Xm,toggle:jm,isOn:function(t,n,e){return e.get()},on:Um,off:Wm,set:Gm}),qm=/* */Object.freeze({exhibit:function(t,n,e){return Ui({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=jm,wi(function(t){r(t,e,o)})),u=Zu(t,n,Xm);return ii(L([t.toggleOnExecute?[i]:[],[u]]))}}),Km=function(t,n,e){Le(t.element(),"aria-expanded",e)},Jm=[Mr("selected",!1),Tr("toggleClass"),Mr("toggleOnExecute",!0),Fr("aria",{mode:"none"},fr("mode",{pressed:[Mr("syncWithExpanded",!1),Ju("update",function(t,n,e){Le(t.element(),"aria-pressed",e),n.syncWithExpanded&&Km(t,n,e)})],checked:[Ju("update",function(t,n,e){Le(t.element(),"aria-checked",e)})],expanded:[Ju("update",Km)],selected:[Ju("update",function(t,n,e){Le(t.element(),"aria-selected",e)})],none:[Ju("update",Q)]}))],$m=ua({fields:Jm,name:"toggling",active:qm,apis:Ym,state:(Ll=!1,{init:function(){var n=_t(Ll);return{get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(Ll)},readState:function(){return n.get()}}}})}),Qm="alloy.item-hover",Zm="alloy.item-focus",tg=function(t){(Hl(t.element()).isNone()||Pm.isFocused(t))&&(Pm.isFocused(t)||Pm.focus(t),Gr(t,Qm,{item:t}))},ng=function(t){Gr(t,Zm,{item:t})},eg=Z(Qm),og=Z(Zm),rg=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=ii(n),ua({fields:[br("enabled")],name:e,active:{events:Z(o)}})),configAsRaw:Z({}),initialConfig:{},state:zi}}},ig=[br("data"),br("components"),br("dom"),Mr("hasSubmenu",!1),Tr("toggling"),tf.field("itemBehaviours",[$m,Pm,hm,Im]),Mr("ignoreFocus",!1),Mr("domModification",{}),Ju("builder",function(t){return{dom:t.dom,domModification:ao({},t.domModification,{attributes:ao({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes,{"aria-haspopup":t.hasSubmenu},t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:tf.augment(t.itemBehaviours,[t.toggling.fold($m.revoke,function(t){return $m.config(ao({aria:{mode:"checked"}},t))}),Pm.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){ng(t)}}),hm.config({mode:"execution"}),Im.config({store:{mode:"memory",initialValue:t.data}}),rg("item-type-events",[si(Rn(),Xr),pi(zt()),si(Wt(),tg),si(In(),Pm.focus)])]),components:t.components,eventOrder:t.eventOrder}}),Mr("eventOrder",{})],ug=[br("dom"),br("components"),Ju("builder",function(t){return{dom:t.dom,components:t.components,events:ii([hi(In())])}})],ag=Z([Bf({name:"widget",overrides:function(n){return{behaviours:ra([Im.config({store:{mode:"manual",getValue:function(t){return n.data},setValue:function(){}}})])}}})]),cg=[br("uid"),br("data"),br("components"),br("dom"),Mr("autofocus",!1),Mr("ignoreFocus",!1),tf.field("widgetBehaviours",[Im,Pm,hm]),Mr("domModification",{}),Kf(ag()),Ju("builder",function(e){var t=zf(0,e,ag()),n=Lf("item-widget",e,t.internals()),o=function(t){return jf(t,e,"widget").map(function(t){return hm.focusIn(t),t})},r=function(t,n){return al(n.event().target())||e.autofocus&&n.setSource(t.element()),tt.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:ii([wi(function(t,n){o(t).each(function(t){n.stop()})}),si(Wt(),tg),si(In(),function(t,n){e.autofocus?o(t):Pm.focus(t)})]),behaviours:tf.augment(e.widgetBehaviours,[Im.config({store:{mode:"memory",initialValue:e.data}}),Pm.config({ignore:e.ignoreFocus,onFocus:function(t){ng(t)}}),hm.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:sa(),onLeft:r,onRight:r,onEscape:function(t,n){return Pm.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),tt.none()):(Pm.focus(t),tt.some(!0))}})])}})],sg=fr("type",{widget:cg,item:ig,separator:ug}),fg=Z([_f({factory:{sketch:function(t){var n=cr("menu.spec item",sg,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:ao({},n,{uid:Di("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),lg=Z([br("value"),br("items"),br("dom"),br("components"),Mr("eventOrder",{}),$s("menuBehaviours",[kl,Im,fl,hm]),Fr("movement",{mode:"menu",moveOnTab:!0},fr("mode",{grid:[Qu(),Ju("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[Ju("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),br("rowSelector")],menu:[Mr("moveOnTab",!0),Ju("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),yr("markers",Lu()),Mr("fakeFocus",!1),Mr("focusManager",Pl()),Xu("onHighlight")]),dg=Z("alloy.menu-focus"),mg=ul({name:"Menu",configFields:lg(),partFields:fg(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:Zs(t.menuBehaviours,[kl.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),Im.config({store:{mode:"memory",initialValue:t.value}}),fl.config({find:tt.some}),hm.config(t.movement.config(t,t.movement))]),events:ii([si(og(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){kl.highlight(n,t),e.stop(),Gr(n,dg(),{menu:n,item:t})})}),si(eg(),function(t,n){var e=n.event().item();kl.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),gg=function(e,o,r,t){return Tt(r,t).bind(function(t){return Tt(e,t).bind(function(t){var n=gg(e,o,r,t);return tt.some([t].concat(n))})}).getOr([])},pg=function(t,n){var e={};rt(t,function(t,n){M(t,function(t){e[t]=n})});var o=n,r=ut(n,function(t,n){return{k:t,v:n}}),i=it(r,function(t,n){return[n].concat(gg(e,o,r,n))});return it(e,function(t){return Tt(i,t).getOr([t])})},hg=function(){var i=_t({}),u=_t({}),a=_t({}),c=_t(tt.none()),s=_t({}),n=function(t){return Tt(u.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(ao({},u.get(),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(tt.some(t)),i.set(e),u.set(n),s.set(o);var r=pg(o,e);a.set(r)},expand:function(e){return Tt(i.get(),e).map(function(t){var n=Tt(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Tt(a.get(),t)},collapse:function(t){return Tt(a.get(),t).bind(function(t){return 1<t.length?tt.some(t.slice(1)):tt.none()})},lookupMenu:n,otherMenus:function(t){var n=s.get();return Y(et(n),t)},getPrimary:function(){return c.get().bind(function(t){return n(t).bind(function(t){return"prepared"===t.type?tt.some(t.menu):tt.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(tt.none())},isClear:function(){return c.get().isNone()}}},vg=Z("collapse-item"),bg=il({name:"TieredMenu",configFields:[Ku("onExecute"),Ku("onEscape"),qu("onOpenMenu"),qu("onOpenSubmenu"),Xu("onCollapseMenu"),Mr("highlightImmediately",!0),kr("data",[br("primary"),br("menus"),br("expansions")]),Mr("fakeFocus",!1),Xu("onHighlight"),Xu("onHover"),Uu(),br("dom"),Mr("navigateOnHover",!0),Mr("stayInDom",!1),$s("tmenuBehaviours",[hm,kl,fl,wm]),Mr("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)}},factory:function(a,t){var c,n,i=_t(tt.none()),s=hg(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,it(n,function(t,n){var e=function(){return mg.sketch(ao({dom:t.dom},t,{value:n,items:t.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?zl():Pl()}))};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 Im.getValue(t).value},u=function(t){return it(a.data.menus,function(t,n){return j(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},l=function(n,t){kl.highlight(n,t),kl.getHighlighted(t).orThunk(function(){return kl.getFirst(t)}).each(function(t){Yr(n,t.element(),In())})},d=function(n,t){return Mt(_(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?tt.some(t.menu):tt.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));M(o,function(t){au(t.element(),[a.markers.backgroundMenu]),a.stayInDom||wm.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=Yc(r.element(),"."+a.markers.item),n=V(t,function(t){return"true"===Ue(t,"aria-haspopup")});return M(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=f(t);e[n]=t})}),i.set(tt.some(e)),e}));rt(n,function(t,n){var e=T(o,n);Le(t.element(),"aria-expanded",e)})},p=function(o,r,i){return tt.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return tt.none();var n=t.menu,e=d(r,i.slice(1));return M(e,function(t){ou(t.element(),a.markers.backgroundMenu)}),Qr(n.element())||wm.append(o,Mu(n)),au(n.element(),[a.markers.backgroundMenu]),l(o,n),m(o,r,i),tt.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),tt.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 Qr(n.element())||wm.append(r,Mu(n)),a.onOpenSubmenu(r,i,n),u===c.HighlightSubmenu?(kl.highlightFirst(n),p(r,s,o)):(kl.dehighlightAll(n),tt.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 Ru(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=ii([si(dg(),function(n,t){var e=t.event().menu();kl.highlight(n,e);var o=f(t.event().item());s.refresh(o).each(function(t){return m(n,s,t)})}),wi(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(){})})}),bi(function(n,t){e(n).each(function(t){wm.append(n,Mu(t)),a.onOpenMenu(n,t),a.highlightImmediately&&l(n,t)})})].concat(a.navigateOnHover?[si(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){kl.getHighlighted(n).each(function(t){kl.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:Zs(a.tmenuBehaviours,[hm.config({mode:"special",onRight:r(function(t,n){return al(n.element())?tt.none():h(t,n,c.HighlightSubmenu)}),onLeft:r(function(t,n){return al(n.element())?tt.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){Yr(n,t.element(),In())})}}),kl.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),fl.config({find:function(t){return kl.getHighlighted(t)}}),wm.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:Et(t,n),expansions:{}}},collapseItem:function(t){return{value:io(vg()),meta:{text:t}}}}}),yg=il({name:"InlineView",configFields:[br("lazySink"),Xu("onShow"),Xu("onHide"),Dr("onEscape"),$s("inlineBehaviours",[Gs,da]),_r("fireDismissalEventInstead",[Mr("event",Gn())]),Mr("getRelated",tt.none),Mr("eventOrder",tt.none)],factory:function(s,t){var r=function(t,n,e,o){var r=s.lazySink(t).getOrDie();Gs.openWhileCloaked(t,e,function(){return Ts.positionWithin(r,n,t,o)}),s.onShow(t)},n={setContent:function(t,n){Gs.open(t,n)},showAt:function(t,n,e){var o=tt.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)},bg.sketch({dom:{tag:"div"},data:u.data,markers:u.menu.markers,onEscape:function(){return Gs.close(r),o.onEscape.map(function(t){return t(r)}),tt.some(!0)},onExecute:function(){return tt.some(!0)},onOpenMenu:function(t,n){Ts.position(a().getOrDie(),i,n)},onOpenSubmenu:function(t,n,e){var o=a().getOrDie();Ts.position(o,{anchor:"submenu",item:n},e)}}));Gs.open(t,c),s.onShow(t)},hide:function(t){Gs.close(t),s.onHide(t)},getContent:function(t){return Gs.getState(t)},isOpen:Gs.isOpen};return{uid:s.uid,dom:s.dom,behaviours:Zs(s.inlineBehaviours,[Gs.config({isPartOf:function(t,n,e){return Nu(n,e)||(o=t,r=e,s.getRelated(o).exists(function(t){return Nu(t,r)}));var o,r},getAttachPoint:function(t){return s.lazySink(t).getOrDie()}}),Ks(ao({isExtraPart:Z(!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)}}}),xg=function(t){var n=function(t,n){n.stop(),Xr(t)},e=En.detect().deviceType.isTouch()?[si(Vn(),n)]:[si($t(),n),si(zt(),function(t,n){n.cut()})];return ii(L([t.map(function(e){return si(Fn(),function(t,n){e(t),n.stop()})}).toArray(),e]))},wg=il({name:"Button",factory:function(t){var n=xg(t.action),e=t.dom.tag,o=function(n){return Tt(t.dom,"attributes").bind(function(t){return Tt(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:tf.augment(t.buttonBehaviours,[Pm.config({}),hm.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 ao({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[Mr("uid",undefined),br("dom"),Mr("components",[]),tf.field("buttonBehaviours",[Pm,hm]),Tr("action"),Tr("role"),Mr("eventOrder",{})]}),Sg=function(t){var n=tl(t)&&Dt(t,"uid")?t.uid:Di("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).fold(tt.none,tt.some)},asSpec:function(){return ao({},t,{uid:n})}}},kg=function(t){return tt.from(t()["temporary-placeholder"]).getOr("!not found!")},Cg=function(t,n){return tt.from(n()[t]).getOrThunk(function(){return kg(n)})},Og={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Tg=il({name:"Notification",factory:function(n){var t,e,o=Sg({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:ra([wm.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=Sg({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:ra([wm.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){wm.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);wm.set(e,[Bu(n)])}}},c=L([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return tt.from(Og[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,Ft(t,function(t){return tt.from(e()[t])}).getOrThunk(function(){return kg(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:ra([wm.config({})])}].concat(n.progress?[u.asSpec()]:[]).concat(wg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:Cg("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},configFields:[Tr("level"),br("progress"),br("icon"),br("onAction"),br("text"),br("iconProvider"),br("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}}),Eg=tinymce.util.Tools.resolve("tinymce.util.Delay");function Bg(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),yg.hide(r)},o=_u(Tg.sketch({text:t.text,level:T(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:tt.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=_u(yg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),t.timeout&&Eg.setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){yg.showAt(r,{anchor:"makeshift",x:t,y:n},Mu(o))},moveRel:function(t,n){yg.showAt(r,i.backstage.shared.anchors.banner(),Mu(o))},text:function(t){Tg.updateText(o,t)},settings:t,getEl:function(){},progressBar:{value:function(t){Tg.updateProgress(o,t)}}}},close:function(t){t.close()},reposition:function(t){M(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"),M(e,function(t,n){0<n&&t.moveRel(e[n-1].getEl(),"bc-tc")})}var o}(t)},getArgs:function(t){return t.settings}}}var Ag,Dg,_g=function(e,o){var r=null;return{cancel:function(){null!==r&&(x.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&x.clearTimeout(r),r=x.setTimeout(function(){e.apply(null,t),r=null},o)}}},Mg=/[\u00a0 \t\r\n]/,Fg=function(e,t,n,o,r){return void 0===r&&(r=0),(i=e).collapsed&&3===i.startContainer.nodeType?function(t,n,e,o){var r;for(r=n-1;0<=r;r--){if(Mg.test(t.charAt(r)))return tt.none();if(t.charAt(r)===e)break}return-1===r||n-r<o?tt.none():tt.some(t.substring(r+1,n))}(n,o,t,r).map(function(t){var n=e.cloneRange();return n.setStart(e.startContainer,e.startOffset-t.length-1),n.setEnd(e.startContainer,e.startOffset),{text:t,rng:n}}):tt.none();var i},Ig=function(e,t){t.on("keypress",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){Gr(t,Yt(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(kl.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which?e.closeIfNecessary():32===n.which?e.closeIfNecessary():13===n.which?(t().each(Xr),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(kl.highlightFirst)},function(t){o(t,n)}),n.preventDefault()):37!==n.which&&38!==n.which&&39!==n.which||t().each(function(t){o(t,n),n.preventDefault()}))})},Vg=tinymce.util.Tools.resolve("tinymce.util.Promise"),Rg=function(t,n){return 0===t.startOffset||/\s/.test(n.charAt(t.startOffset-1))},Hg=function(t,n){var e,o,r,i=n(),u=t.selection.getRng(),a=u.startContainer.nodeValue;return(e=u,o=a,r=i,Ft(r.triggerChars,function(n){return Fg(e,n,o,e.startOffset).map(function(t){return{range:t.rng,text:t.text,triggerChar:n}})})).map(function(e){var t=V(i.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOr(Rg)(e.range,a,e.text)});return{lookupData:Vg.all(_(t,function(n){return n.fetch(e.text,n.maxResults).then(function(t){return{items:t,columns:n.columns,onAction:n.onAction}})})),triggerChar:e.triggerChar,range:e.range}})},Ng=Go([zr("type",function(){return"autocompleteitem"}),zr("active",function(){return!1}),zr("disabled",function(){return!1}),Mr("meta",{}),xr("value"),Ar("text"),Ar("icon")]),Pg=Go([xr("type"),xr("ch"),Ir("minChars",1),Mr("columns",1),Ir("maxResults",10),Dr("matches"),Sr("fetch"),Sr("onAction")]),zg=function(t){var n,e,o=t.ui.registry.getAll().popups,r=it(o,function(t){return(n=t,ur("Autocompleter",Pg,n)).fold(function(t){throw new Error(sr(t))},function(t){return t});var n}),i=(n=at(r,function(t){return t.ch}),e={},M(n,function(t){e[t]={}}),et(e)),u=st(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return V(u,function(t){return t.ch===n})}}},Lg=[Hr("disabled",!1),Ar("text"),Ar("shortcut"),$o("value","value",ho(function(){return io("menuitem-value")}),lr()),Mr("meta",{})],jg=Go([xr("type"),Nr("onSetup",function(){return Q}),Nr("onAction",Q),Ar("icon")].concat(Lg)),Ug=Go([xr("type"),Sr("getSubmenuItems"),Nr("onSetup",function(){return Q}),Ar("icon")].concat(Lg)),Wg=Go([xr("type"),Hr("active",!1),Nr("onSetup",function(){return Q}),Sr("onAction")].concat(Lg)),Gg=Go([xr("type"),Hr("active",!1),Ar("icon")].concat(Lg)),Xg=Go([xr("type"),Ar("text")]),Yg=Go([xr("type"),wr("fancytype",["inserttable"]),Nr("onAction",Q)]),qg=function(t,o,n){var r=Yc(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 tt.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return tt.none()},Kg=function(t,n){return ra([rg(t,n)])},Jg=function(t){return Kg(io("unnamed-events"),t)},$g=[br("lazySink"),br("tooltipDom"),Mr("exclusive",!0),Mr("tooltipComponents",[]),Mr("delay",300),Rr("mode","normal",["normal","follow-highlight"]),Mr("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:Z([kc,Sc,bc,xc,yc,wc]),onRtl:Z([kc,Sc,bc,xc,yc,wc])}}}),Xu("onHide"),Xu("onShow")],Qg=/* */Object.freeze({init:function(){var e=_t(tt.none()),n=_t(tt.none()),o=function(){e.get().each(function(t){x.clearTimeout(t)})},t=Z("not-implemented");return Li({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(tt.some(t))},clearTooltip:function(){n.set(tt.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(tt.some(x.setTimeout(function(){t()},n)))},readState:t})}}),Zg=io("tooltip.exclusive"),tp=io("tooltip.show"),np=io("tooltip.hide"),ep=function(t,n,e){t.getSystem().broadcastOn([Zg],{})},op=/* */Object.freeze({hideAllExclusive:ep,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&wm.set(t,o)})}}),rp=ua({fields:$g,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){Ms(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return ii(L([[si(tp,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){ep(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:ii("normal"===o.mode?[si(Wt(),function(t){Wr(n,tp)}),si(jt(),function(t){Wr(n,np)})]:[]),behaviours:ra([wm.config({})])});r.setTooltip(e),As(t,e),o.onShow(n,e),Ts.position(t,o.anchor(n),e)}}(t)},o.delay)}),si(np,function(t){r.resetTimer(function(){e(t)},o.delay)}),si(Mn(),function(t,n){T(n.channels(),Zg)&&e(t)}),yi(function(t){e(t)})],"normal"===o.mode?[si(Gt(),function(t){Wr(t,tp)}),si(Dn(),function(t){Wr(t,np)}),si(Wt(),function(t){Wr(t,tp)}),si(jt(),function(t){Wr(t,np)})]:[si(Jn(),function(t,n){Wr(t,tp)}),si($n(),function(t){Wr(t,np)})]]))}}),state:Qg,apis:op}),ip=function(t){var n,e,o,r=Zn.fromHtml(t),i=we(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],U(e,function(t,n){var e;return"class"===n.name?t:ao({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:De(r)};return ao({tag:Fe(r),classes:a,attributes:u},c)},up=tinymce.util.Tools.resolve("tinymce.util.I18n"),ap="tox-menu-nav__js",cp="tox-collection__item",sp="tox-swatch",fp={normal:ap,color:sp},lp="tox-collection__item--enabled",dp="tox-collection__item-icon",mp="tox-collection__item-label",gp="tox-collection__item--active",pp=function(t){return Tt(fp,t).getOr(ap)},hp=tinymce.util.Tools.resolve("tinymce.Env"),vp=function(t){var e=hp.mac?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},n=t.split("+"),o=_(n,function(t){var n=t.toLowerCase().trim();return lt(e,n)?e[n]:t});return hp.mac?o.join(""):o.join("+")},bp=function(t){return{dom:{tag:"div",classes:[dp],innerHtml:t}}},yp=function(t){return{dom:{tag:"div",classes:[mp]},components:[Bu(up.translate(t))]}},xp=function(t,n){return{dom:{tag:"div",classes:[mp]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[Bu(up.translate(n))]}]}},wp=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:vp(t)}}},Sp=function(t){return{dom:{tag:"div",classes:[dp,"tox-collection__item-checkmark"],innerHtml:Cg("checkmark",t)}}},kp=function(t,r,n,i){void 0===i&&(i=tt.none());var e,o,u,a,c,s,f,l,d,m,g,p=t.iconContent.map(function(t){return n=t,e=r.icons,o=i,tt.from(e()[n]).or(o).getOrThunk(function(){return kg(e)});var n,e,o}),h=tt.from(t.meta).fold(function(){return yp},function(t){return lt(t,"style")?v(xp,t.style):yp});return"color"===t.presets?(s=t.ariaLabel,f=t.value,l=r,{dom:(d=sp,m=p.getOr(""),g=s.map(function(t){return' title="'+l.translate(t)+'"'}).getOr(""),ip("custom"===f?'<button class="'+d+' tox-swatches__picker-btn"'+g+">"+m+"</button>":"remove"===f?'<div class="'+d+' tox-swatch--remove"'+g+">"+m+"</div>":'<div class="'+d+'" style="background-color: '+f+'" data-mce-color="'+f+'"'+g+"></div>")),optComponents:[]}):(e=t,o=p,u=h,a=n?e.checkMark.orThunk(function(){return o.or(tt.some("")).map(bp)}):tt.none(),c=e.ariaLabel.map(function(t){return{attributes:{title:up.translate(t)}}}).getOr({}),{dom:St({tag:"div",classes:[ap,cp]},c),optComponents:[a,e.textContent.map(u),e.shortcutContent.map(wp),e.caret]})},Cp=["input","button","textarea"],Op=function(t,n,e){n.disabled&&_p(t,n,e)},Tp=function(t){return T(Cp,Fe(t.element()))},Ep=function(t){Le(t.element(),"disabled","disabled")},Bp=function(t){Ge(t.element(),"disabled")},Ap=function(t){Le(t.element(),"aria-disabled","true")},Dp=function(t){Le(t.element(),"aria-disabled","false")},_p=function(n,t,e){t.disableClass.each(function(t){ou(n.element(),t)}),(Tp(n)?Ep:Ap)(n)},Mp=function(n,t,e){t.disableClass.each(function(t){ru(n.element(),t)}),(Tp(n)?Bp:Dp)(n)},Fp=function(t){return Tp(t)?We(t.element(),"disabled"):"true"===Ue(t.element(),"aria-disabled")},Ip=/* */Object.freeze({enable:Mp,disable:_p,isDisabled:Fp,onLoad:Op,set:function(t,n,e,o){(o?_p:Mp)(t,n,e)}}),Vp=/* */Object.freeze({exhibit:function(t,n,e){return Ui({classes:n.disabled?n.disableClass.map(q).getOr([]):[]})},events:function(t,n){return ii([ui(Fn(),function(t,n){return Fp(t)}),Zu(t,n,Op)])}}),Rp=[Mr("disabled",!1),Tr("disableClass")],Hp=ua({fields:Rp,name:"disabling",active:Vp,apis:Ip}),Np=function(t){return Hp.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},Pp=function(t){return Hp.config({disabled:t})},zp=function(t){return Hp.config({disabled:t,disableClass:"tox-tbtn--disabled"})},Lp=function(t,n){var e=t.getApi(n);return function(t){t(e)}},jp=function(e,o){return bi(function(t){Lp(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},Up=function(n,e){return yi(function(t){return Lp(n,t)(e.get())})};(Dg=Ag||(Ag={}))[Dg.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",Dg[Dg.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var Wp,Gp,Xp=Ag,Yp={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},qp=function(t){return j(t,function(t){return t.toArray()})},Kp=function(t,n,e){var o,r,i=_t(Q);return{type:"item",dom:n.dom,components:qp(n.optComponents),data:t.data,eventOrder:Yp,hasSubmenu:t.triggersSubmenu,itemBehaviours:ra([rg("item-events",[(o=t,r=e,wi(function(t,n){Lp(o,t)(o.onAction),o.triggersSubmenu||r!==Xp.CLOSE_ON_EXECUTE||(Wr(t,Nn()),n.stop())})),jp(t,i),Up(t,i)]),Np(t.disabled),wm.config({})].concat(t.itemBehaviours))}},Jp=function(t){return{value:t.value,meta:St({text:t.text.getOr("")},t.meta)}},$p=Z(Vf("item-widget",ag())),Qp=io("cell-over"),Zp=io("cell-execute"),th=function(n,e,t){var o,r=function(t){return Gr(t,Zp,{row:n,col:e})};return _u({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:ra([rg("insert-table-picker-cell",[si(Wt(),Pm.focus),si(Fn(),r),si(Rn(),r)]),$m.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Pm.config({onFocus:function(t){return Gr(t,Qp,{row:n,col:e})}})])})},nh={inserttable:function QD(o){var t,n=io("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(th(r,u,t));o.push(i)}return o}(n,10,10),c=Sg({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[Bu("0x0")],behaviours:ra([wm.config({})])});return{type:"widget",data:{value:io("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[$p().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:(t=a,j(t,function(t){return _(t,Mu)})).concat(c.asSpec()),behaviours:ra([rg("insert-table-picker",[gi(Qp,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++)$m.set(t[i][u],i<=n&&u<=e)}(a,i,u,10,10),wm.set(c.get(t),[(o=i,r=u,Bu(r+1+"x"+(o+1)))])}),gi(Zp,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),Wr(t,Nn())})]),hm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}}},eh=function(n,t,e,o,r,i,u){var a=kp({presets:e,textContent:t?n.text:tt.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:t?n.shortcut:tt.none(),checkMark:t?tt.some(Sp(u.icons)):tt.none(),caret:tt.none(),value:n.value},u,!0);return wt(Kp({data:Jp(n),disabled:n.disabled,getApi:function(n){return{setActive:function(t){$m.set(n,t)},isActive:function(){return $m.isOn(n)},isDisabled:function(){return Hp.isDisabled(n)},setDisabled:function(t){return Hp.set(n,t)}}},onAction:function(t){return o(n.value)},onSetup:function(t){return t.setActive(r),function(){}},triggersSubmenu:!1,itemBehaviours:[]},a,i),{toggling:{toggleClass:lp,toggleOnExecute:!1,selected:n.active}})},oh=function(n,t,e,o,r,i,u){void 0===u&&(u=!0);var a,c,s=kp({presets:e,textContent:t?n.text:tt.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:tt.none(),checkMark:tt.none(),caret:tt.none(),value:n.value},i.providers,u,n.icon);return Kp({data:Jp(n),disabled:n.disabled,getApi:function(){return{}},onAction:function(t){return o(n.value,n.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:(a=n.meta,c=i,ft(a,"tooltipWorker").map(function(e){return[rp.config({lazySink:c.getSink,tooltipDom:{tag:"div"},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t}},mode:"follow-highlight",onShow:function(n,t){e(function(t){rp.setComponents(n,[Au({element:Zn.fromDom(t)})])})}})]}).getOr([]))},s,r)},rh=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:ao({tag:"div",classes:[cp,"tox-collection__group-heading"]},n),components:[]}},ih=function(t,n,e,o){void 0===o&&(o=!0);var r=kp({presets:"normal",iconContent:t.icon,textContent:t.text,ariaLabel:t.text,caret:tt.none(),checkMark:tt.none(),shortcutContent:t.shortcut},e,o);return Kp({data:Jp(t),getApi:function(n){return{isDisabled:function(){return Hp.isDisabled(n)},setDisabled:function(t){return Hp.set(n,t)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n)},uh=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:Cg("chevron-right",r)}}),u=kp({presets:"normal",iconContent:t.icon,textContent:t.text,ariaLabel:t.text,caret:tt.some(i),checkMark:tt.none(),shortcutContent:t.shortcut},e,o);return Kp({data:Jp(t),getApi:function(n){return{isDisabled:function(){return Hp.isDisabled(n)},setDisabled:function(t){return Hp.set(n,t)}}},disabled:t.disabled,onAction:Q,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},u,n)},ah=function(t,n,e){var o=kp({iconContent:tt.none(),textContent:t.text,ariaLabel:t.text,checkMark:tt.some(Sp(e.icons)),caret:tt.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,!0);return wt(Kp({data:Jp(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){$m.set(n,t)},isActive:function(){return $m.isOn(n)},isDisabled:function(){return Hp.isDisabled(n)},setDisabled:function(t){return Hp.set(n,t)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,n),{toggling:{toggleClass:lp,toggleOnExecute:!1,selected:t.active}})},ch=function(n){return(t=nh,e=n.fancytype,Object.prototype.hasOwnProperty.call(t,e)?tt.some(t[e]):tt.none()).map(function(t){return t(n)});var t,e},sh=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},fh=function(t){var n=sh(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:pp(t)}},lh=[mg.parts().items({})],dh=function(t,n,e){var o=sh(e);return{dom:{tag:"div",classes:L([[o.tieredMenu]])},markers:fh(e)}},mh=function(t,n){var e=fh(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")}},gh=function(e,o){return function(t){var n=B(t,o);return _(n,function(t){return{dom:e,components:t}})}},ph=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:[mg.parts().items({preprocess:function(t){return"auto"!==n&&1<n?gh({tag:"div",classes:["tox-collection__group"]},n)(t):(e=function(t,n){return"separator"===i[n].type},o=[],r=[],M(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],lt(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),_(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}));var e,o,r}})]}};(Gp=Wp||(Wp={}))[Gp.ContentFocus=0]="ContentFocus",Gp[Gp.UiFocus=1]="UiFocus";var hh=function(t){return x.console.error(sr(t)),x.console.log(t),tt.none()},vh=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},bh=function(t){return E(t,vh)},yh=function(t,n,e,o){switch(void 0===o&&(o=!0),t.type){case"menuitem":return(c=t,ur("menuitem",jg,c)).fold(hh,function(t){return tt.some(ih(t,n,e,o))});case"nestedmenuitem":return(a=t,ur("nestedmenuitem",Ug,a)).fold(hh,function(t){return tt.some(uh(t,n,e,o))});case"togglemenuitem":return(u=t,ur("togglemenuitem",Wg,u)).fold(hh,function(t){return tt.some(ah(t,n,e))});case"separator":return(i=t,ur("separatormenuitem",Xg,i)).fold(hh,function(t){return tt.some(rh(t))});case"fancymenuitem":return(r=t,ur("fancymenuitem",Yg,r)).fold(hh,function(t){return ch(t)});default:return x.console.error("Unknown item in general menu",t),tt.none()}var r,i,u,a,c},xh=function(t,n,e,o,r){var i,u,a,c,s,f,l;return"color"===r?{value:t,dom:(i=o,l={dom:{tag:"div",classes:["tox-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[mg.parts().items({preprocess:"auto"!==i?gh({tag:"div",classes:["tox-swatches__row"]},i):d})]}]}).dom,components:l.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(l=ph(o,e)).dom,components:l.components,items:e}:"normal"===r&&1===o?{value:t,dom:(l=ph(1,e)).dom,components:l.components,items:e}:"normal"===r?{value:t,dom:(l=ph(o,e)).dom,components:l.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=r,f=sh(s),{tag:"div",classes:L([[f.menu,"tox-menu-"+c+"-column"],a?[f.hasIcons]:[]])}),components:lh,items:e}:{value:t,dom:(u=o,l={dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[mg.parts().items({preprocess:gh({tag:"div",classes:["tox-collection__group"]},u)})]}).dom,components:l.components,items:e}},wh=function(t,e,o,r,i,u,a){return Mt(_(t,function(n){return"choiceitem"===n.type?(t=n,ur("choicemenuitem",Gg,t)).fold(hh,function(t){return tt.some(eh(t,1===o,r,e,u(n.value),i,a))}):tt.none();var t}))},Sh=function(t,e,n,o,r){var i=1===n,u=!i||bh(t);return Mt(_(t,function(t){return(n=t,ur("Autocompleter.Item",Ng,n)).fold(hh,function(t){return tt.some(oh(t,i,"normal",e,o,r,u))});var n}))},kh=function(t,n,e,o,r,i,u,a){var c=bh(n),s=wh(n,e,o,"color"!==r?"normal":"color",i,u,a);return xh(t,c,s,o,r)},Ch=function(t,n,e,o){var r=bh(n),i=Mt(_(n,function(t){var n=function(t){return yh(t,e,o,r)};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(St(t,{disabled:!0})):n(t)}));return xh(t,r,i,1,"normal")},Oh=function(t){return bg.singleData(t.value,t)},Th=function(g,p){var h=_u(yg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],lazySink:p.getSink})),t=function(){return yg.isOpen(h)},v=function(){t()&&yg.hide(h)},n=tn(function(){return zg(g)}),e=_g(function(t){(" "===t.key?tt.none():Hg(g,n)).fold(v,function(m){m.lookupData.then(function(t){var e,n,o,r,i,u,a,c,s,f,l=(e=m.triggerChar,o=Ft(n=t,function(t){return tt.from(t.columns)}).getOr(1),j(n,function(i){var t=i.items;return Sh(t,function(o,r){var t=g.selection.getRng(),n=t.startContainer;Fg(t,e,n.data,t.startOffset).fold(function(){return x.console.error("Lost context. Cursor probably moved")},function(t){var n=t.rng,e={hide:v};i.onAction(e,n,o,r)})},o,Xp.BUBBLE_TO_SANDBOX,p)}));if(0<l.length){var d=Ft(t,function(t){return tt.from(t.columns)}).getOr(1);yg.showAt(h,{anchor:"selection",root:Zn.fromDom(g.getBody()),getSelection:function(){return tt.some({start:function(){return Zn.fromDom(m.range.startContainer)},soffset:function(){return m.range.startOffset},finish:function(){return Zn.fromDom(m.range.endContainer)},foffset:function(){return m.range.endOffset}})}},mg.sketch((r=xh("autocompleter-value",!0,l,d,"normal"),i=d,u=Wp.ContentFocus,a="normal",c=u===Wp.ContentFocus?zl():Pl(),s=mh(i,a),f=fh(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:f.selectedItem,item:f.item},movement:s,fakeFocus:u===Wp.ContentFocus,focusManager:c,menuBehaviours:Jg("auto"!==i?[]:[bi(function(o,t){qg(o,4,f.item).each(function(t){var n=t.numColumns,e=t.numRows;hm.setGridSize(o,e,n)})})])}))),yg.getContent(h).each(kl.highlightFirst)}else v()})})},50);Ig({onKeypress:e,closeIfNecessary:v,isActive:t,getView:function(){return yg.getContent(h)}},g)},Eh=function(m,g){return function(t){if(m(t)){var n,e,o,r,i,u,a,c=Zn.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:Z(n),x:Z(e),y:Z(o),stop:r,prevent:i,kill:u,raw:Z(a)});g(d)}}},Bh=function(t,n,e,o,r){var i=Eh(e,o);return t.dom().addEventListener(n,i,r),{unbind:v(Ah,t,n,i,r)}},Ah=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},Dh=Z(!0),_h=function(t,n,e){return Bh(t,n,Dh,e,!1)},Mh=function(t,n,e){return Bh(t,n,Dh,e,!0)},Fh=function(t,n,e){return Ru(t,n,e).isSome()};function Ih(e,o){var r=null;return{cancel:function(){null!==r&&(x.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=x.setTimeout(function(){e.apply(null,t),r=null},o)}}}var Vh=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?tt.none():tt.some(n.touches[0])},Rh=function(e){var u=_t(tt.none()),o=Ih(function(t){u.set(tt.none()),e.triggerEvent(Hn(),t)},400),r=Bt([{key:Ht(),value:function(e){return Vh(e).each(function(t){o.cancel();var n={x:Z(t.clientX),y:Z(t.clientY),target:e.target};o.schedule(e),u.set(tt.some(n))}),tt.none()}},{key:Nt(),value:function(t){return o.cancel(),Vh(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(tt.none())})}),tt.none()}},{key:Pt(),value:function(n){return o.cancel(),u.get().filter(function(t){return he(t.target(),n.target())}).map(function(t){return e.triggerEvent(Vn(),n)})}}]);return{fireIfReady:function(n,t){return Tt(r,t).bind(function(t){return t(n)})}}},Hh=En.detect().browser.isFirefox(),Nh=Wo([Sr("triggerEvent"),Mr("stopBackspace",!0)]),Ph=function(n,t){var e,o,r,i,u=cr("Getting GUI events settings",Nh,t),a=En.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=Rh(u),s=_(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return _h(n,t,function(n){c.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),f=_t(tt.none()),l=_h(n,"paste",function(n){c.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),f.set(tt.some(x.setTimeout(function(){u.triggerEvent(_n(),n)},0)))}),d=_h(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||8!==(n=t).raw().which||T(["input","textarea"],Fe(n.target()))||Fh(n.target(),'[contenteditable="true"]')||t.prevent()}),m=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},Hh?Mh(e,"focus",o):_h(e,"focusin",o)),g=_t(tt.none()),p=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),g.set(tt.some(x.setTimeout(function(){u.triggerEvent(Dn(),t)},0)))},Hh?Mh(r,"blur",i):_h(r,"focusout",i));return{unbind:function(){M(s,function(t){t.unbind()}),d.unbind(),m.unbind(),p.unbind(),l.unbind(),f.get().each(x.clearTimeout),g.get().each(x.clearTimeout)}}},zh=function(t,n){var e=Tt(t,"target").map(function(t){return t()}).getOr(n);return _t(e)},Lh=bt([{stopped:[]},{resume:["element"]},{complete:[]}]),jh=function(t,o,n,e,r,i){var u,a,c,s,f=t(o,e),l=(u=n,a=r,c=_t(!1),s=_t(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:Z(u),setSource:a.set,getSource:a.get});return f.fold(function(){return i.logEventNoHandlers(o,e),Lh.complete()},function(n){var e=n.descHandler();return Gi(e)(l),l.isStopped()?(i.logEventStopped(o,n.element(),e.purpose()),Lh.stopped()):l.isCut()?(i.logEventCut(o,n.element(),e.purpose()),Lh.complete()):ye(n.element()).fold(function(){return i.logNoParent(o,n.element(),e.purpose()),Lh.complete()},function(t){return i.logEventResponse(o,n.element(),e.purpose()),Lh.resume(t)})})},Uh=function(n,e,o,t,r,i){return jh(n,e,o,t,r,i).fold(function(){return!0},function(t){return Uh(n,e,o,t,r,i)},function(){return!1})},Wh=function(t,n,e){var o,r,i=(o=n,r=_t(!1),{stop:function(){r.set(!0)},cut:Q,isStopped:r.get,isCut:Z(!1),event:Z(o),setSource:u("Cannot set source of a broadcasted event"),getSource:u("Cannot get source of a broadcasted event")});return M(t,function(t){var n=t.descHandler();Gi(n)(i)}),i.isStopped()},Gh=function(t,n,e,o,r){var i=zh(e,o);return Uh(t,n,e,o,i,r)},Xh=te("element","descHandler"),Yh=function(t,n){return{id:Z(t),descHandler:Z(n)}};function qh(){var i={};return{registerId:function(o,r,t){rt(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=Wi(t,o),i[n]=e})},unregisterId:function(e){rt(i,function(t,n){t.hasOwnProperty(e)&&delete t[e]})},filterByType:function(t){return Tt(i,t).map(function(t){return at(t,function(t,n){return Yh(n,t)})}).getOr([])},find:function(t,n,e){var r=Ct(n)(i);return ri(e,function(t){return e=r,Ai(o=t).fold(function(){return tt.none()},function(t){var n=Ct(t);return e.bind(n).map(function(t){return Xh(o,t)})});var e,o},t)}}}function Kh(){var o=qh(),r={},i=function(o){var t=o.element();return Ai(t).fold(function(){return t="uid-",n=o.element(),e=io(Ti+t),Bi(n,e),e;var t,n,e},function(t){return t})},u=function(t){Ai(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);Dt(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+qe(e.element())+"\nCannot use it for: "+qe(t.element())+"\nThe conflicting element is"+(Qr(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 Ct(t)(r)}}}var Jh,$h,Qh=il({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=co(n,["attributes"]);return{uid:t.uid,dom:ao({tag:"div",attributes:ao({role:"presentation"},e)},o),components:t.components,behaviours:Qs(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[Mr("components",[]),$s("containerBehaviours",[]),Mr("events",{}),Mr("domModification",{}),Mr("eventOrder",{})]}),Zh=function(e){var o=function(n){return ye(e.element()).fold(function(){return!0},function(t){return he(n,t)})},r=Kh(),s=function(t,n){return r.find(o,t,n)},t=Ph(e.element(),{triggerEvent:function(u,a){return to(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),Gh(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:Z("real"),triggerEvent:function(n,e,o){to(n,e,function(t){Gh(s,n,o,e,t)})},triggerFocus:function(a,c){Ai(a).fold(function(){Vl(a)},function(t){to(An(),a,function(t){var n,e,o,r,i,u;n=s,e=An(),o={originator:Z(c),kill:Q,prevent:Q,target:Z(a)},i=t,u=zh(o,r=a),jh(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:_u,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:Z(!0)},n=function(t){t.connect(i),Ne(t.element())||(r.register(t),M(t.components(),n),i.triggerEvent(zn(),t.element(),{target:Z(t.element())}))},u=function(t){Ne(t.element())||(M(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){As(e,t)},c=function(t){Ms(t)},f=function(e){var t=r.filter(Mn());M(t,function(t){var n=t.descHandler();Gi(n)(e)})},l=function(t){f({universal:Z(!0),data:Z(t)})},d=function(t,n){f({universal:Z(!1),channels:Z(t),data:Z(n)})},m=function(t,n){var e=r.filter(t);return Wh(e,n)},g=function(t){return r.getById(t).fold(function(){return vt.error(new Error('Could not find component with uid: "'+t+'" in system.'))},vt.value)},p=function(t){var n=Ai(t).getOr("not found");return g(n)};return n(e),{root:Z(e),element:e.element,destroy:function(){t.unbind(),Ae(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},tv=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),nv=tinymce.util.Tools.resolve("tinymce.EditorManager"),ev=function(t){return tt.from(t.settings.min_width).filter(D)},ov=function(t){return tt.from(t.settings.min_height).filter(D)},rv=function(n){var t=et(n.settings),e=V(t,function(t){return/^toolbar([1-9])$/.test(t)}),o=_(e,function(t){return n.getParam(t,!1,"string")}),r=V(o,function(t){return"string"==typeof t});return 0<r.length?tt.some(r):tt.none()};($h=Jh||(Jh={}))["default"]="",$h.floating="floating",$h.sliding="sliding";var iv,uv,av=function(t){return t.getParam("toolbar_drawer","","string")},cv=function(t){var n=t.getParam("fixed_toolbar_container","","string"),e=t.getParam("inline",!1,"boolean");return 0<n.length&&e?Vu(Zr(),n):tt.none()},sv=function(t){return t.getParam("inline",!1,"boolean")&&cv(t).isSome()},fv=io("form-component-change"),lv=io("form-close"),dv=io("form-cancel"),mv=io("form-action"),gv=io("form-submit"),pv=io("form-block"),hv=io("form-unblock"),vv=io("form-tabchange"),bv=io("form-resize"),yv=Z([Mr("prefix","form-field"),$s("fieldBehaviours",[fl,Im])]),xv=Z([Df({schema:[br("dom")],name:"label"}),Df({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[br("text")],name:"aria-descriptor"}),Bf({factory:{sketch:function(t){var n=kt(t,["factory"]);return t.factory.sketch(n)}},schema:[br("factory")],name:"field"})]),wv=ul({name:"FormField",configFields:yv(),partFields:xv(),factory:function(r,t,n,e){var o=Zs(r.fieldBehaviours,[fl.config({find:function(t){return jf(t,r,"field")}}),Im.config({store:{mode:"manual",getValue:function(t){return fl.getCurrent(t).bind(Im.getValue)},setValue:function(t,n){fl.getCurrent(t).each(function(t){Im.setValue(t,n)})}}})]),i=ii([bi(function(t,n){var o=Wf(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=io(r.prefix);o.label().each(function(t){Le(t.element(),"for",n),Le(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=io(r.prefix);Le(t.element(),"id",n),Le(e.element(),"aria-describedby",n)})})})]),u={getField:function(t){return jf(t,r,"field")},getLabel:function(t){return jf(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)}}}),Sv=/* */Object.freeze({getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),kv=[yr("others",rr(vt.value,lr()))],Cv=ua({fields:kv,name:"coupling",apis:Sv,state:/* */Object.freeze({init:function(t){var i={},n=Z({});return Li({readState:n,getOrCreate:function(e,o,r){var t=et(o.others);if(t)return Tt(i,r).getOrThunk(function(){var t=Tt(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: "+Ro(t,null,2))}})}})}),Ov=/* */Object.freeze({events:function(t,n){var e=t.stream.streams.setup(t,n);return ii([si(t.event,e),yi(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[si(t,function(){return n.cancel()})]}).getOr([])))}}),Tv=function(t){var n=_t(null);return Li({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()}})},Ev=/* */Object.freeze({throttle:Tv,init:function(t){return t.stream.streams.state(t)}}),Bv=[yr("stream",fr("mode",{throttle:[br("delay"),Mr("stopEvent",!0),Ju("streams",{setup:function(t,n){var e=t.stream,o=_g(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:Tv})]})),Mr("event","input"),Tr("cancelEvent"),qu("onStream")],Av=ua({fields:Bv,name:"streaming",active:Ov,state:Ev}),Dv=function(t){var e=tt.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){M(t,u)},u=function(n){e.each(function(t){x.setTimeout(function(){n(t)},0)})};return t(function(t){e=tt.some(t),i(n),n=[]}),{get:o,map:function(e){return Dv(function(n){o(function(t){n(e(t))})})},isReady:r}},_v={nu:Dv,pure:function(n){return Dv(function(t){t(n)})}},Mv=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;x.setTimeout(function(){o.apply(e,t)},0)}))},e=function(){return _v.nu(t)};return{map:function(o){return Mv(function(e){t(function(t){var n=o(t);e(n)})})},bind:function(e){return Mv(function(n){t(function(t){e(t).get(n)})})},anonBind:function(e){return Mv(function(n){t(function(t){e.get(n)})})},toLazy:e,toCached:function(){var n=null;return Mv(function(t){null===n&&(n=e()),n.get(t)})},get:t}},Fv={nu:Mv,pure:function(n){return Mv(function(t){t(n)})}},Iv=Z("sink"),Vv=Z(Df({name:Iv(),overrides:Z({dom:{tag:"div"},behaviours:ra([Ts.config({useFixed:!0})]),events:ii([pi(Yt()),pi(zt()),pi($t())])})}));(uv=iv||(iv={}))[uv.HighlightFirst=0]="HighlightFirst",uv[uv.HighlightNone=1]="HighlightNone";var Rv=function(t,n){var e=t.getHotspot(n).getOr(n);return t.layouts.fold(function(){return{anchor:"hotspot",hotspot:e}},function(t){return{anchor:"hotspot",hotspot:e,layouts:t}})},Hv=function(t,n,e,o,r,i,u){var a,c,s,f,l,d,m,g,p,h,v=Rv(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=Lv(s,a),p.map(function(t){return t.bind(function(t){return tt.from(bg.sketch(ao({},l.menu(),{uid:Di(""),data:t,highlightImmediately:d===iv.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();Ts.position(e,c,n),Gs.decloak(f)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();Ts.position(o,{anchor:"submenu",item:n},e),Gs.decloak(f)},onEscape:function(){return Pm.focus(s),Gs.close(f),tt.some(!0)}})))})})).map(function(t){return t.fold(function(){Gs.isOpen(o)&&Gs.close(o)},function(t){Gs.cloak(o),Gs.open(o,t),i(o)}),o})},Nv=function(t,n,e,o,r,i,u){return Gs.close(o),Fv.pure(o)},Pv=function(t,n,e,o,r,i){var u=Cv.getCoupled(e,"sandbox");return(Gs.isOpen(u)?Nv:Hv)(t,n,e,u,o,r,i)},zv=function(t,n,e){var o,r,i=fl.getCurrent(n).getOr(n),u=Sa(t.element());e?lu(i.element(),"min-width",u+"px"):(o=i.element(),r=u,wa.set(o,r))},Lv=function(n,t){return n.getSystem().getByUid(t.uid+"-"+Iv()).map(function(t){return function(){return vt.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return vt.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},jv=function(o,r,i){var n,u=(n=io("aria-owns"),{id:Z(n),link:function(t){Le(t,"aria-owns",n)},unlink:function(t){Ge(t,"aria-owns")}}),t=Lv(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id()}},behaviours:tf.augment(o.sandboxBehaviours,[Im.config({store:{mode:"memory",initialValue:r}}),Gs.config({onOpen:function(t,n){var e=Rv(o,r);u.link(r.element()),o.matchWidth&&zv(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 Nu(n,e)||Nu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),fl.config({find:function(t){return Gs.getState(t).bind(function(t){return fl.getCurrent(t)})}}),Ks({isExtraPart:Z(!1)})])}},Uv=function(t,n,e){var o=Im.getValue(e);Im.setValue(n,o),Gv(n)},Wv=function(t,n){var e=t.element(),o=xu(e),r=e.dom();"number"!==Ue(e,"type")&&n(r,o)},Gv=function(t){Wv(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},Xv=function(t,n,o){if(t.selectsOver){var e=Im.getValue(n),r=t.getDisplayText(e),i=Im.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?tt.some(function(){var t,e;Uv(0,n,o),t=n,e=r.length,Wv(t,function(t,n){return t.setSelectionRange(e,n.length)})}):tt.none()}return tt.none()},Yv=Z([Tr("data"),Mr("inputAttributes",{}),Mr("inputStyles",{}),Mr("tag","input"),Mr("inputClasses",[]),Xu("onSetValue"),Mr("styles",{}),Mr("eventOrder",{}),$s("inputBehaviours",[Im,Pm]),Mr("selectOnFocus",!0)]),qv=function(t){return ra([Pm.config({onFocus:!1===t.selectOnFocus?Q:function(t){var n=t.element(),e=xu(n);n.dom().setSelectionRange(0,e.length)}})])},Kv=function(t){return{tag:t.tag,attributes:ao({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},Jv=Z("alloy.typeahead.itemexecute"),$v=function(){return[Mr("sandboxClasses",[]),tf.field("sandboxBehaviours",[fl,da,Gs,Im])]},Qv=Z([Tr("lazySink"),br("fetch"),Mr("minChars",5),Mr("responseTime",1e3),Xu("onOpen"),Mr("getHotspot",tt.some),Mr("layouts",tt.none()),Mr("eventOrder",{}),Pr("model",{},[Mr("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),Mr("selectsOver",!0),Mr("populateFromBrowse",!0)]),Xu("onSetValue"),Yu("onExecute"),Xu("onItemExecute"),Mr("inputClasses",[]),Mr("inputAttributes",{}),Mr("inputStyles",{}),Mr("matchWidth",!0),Mr("useMinWidth",!1),Mr("dismissOnBlur",!0),Wu(["openClass"]),Tr("initialData"),$s("typeaheadBehaviours",[Pm,Im,Av,hm,$m,Cv]),zr("previewing",function(){return _t(!0)})].concat(Yv()).concat($v())),Zv=Z([Af({schema:[Uu()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){Xv(o.model,t,e).fold(function(){return kl.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&Uv(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return Gr(t,Jv(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&Uv(o.model,t,n)})}}}})]),tb=ul({name:"Typeahead",configFields:Qv(),partFields:Zv(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=Cv.getCoupled(t,"sandbox");Gs.isOpen(o)?fl.getCurrent(o).each(function(t){kl.getHighlighted(t).fold(function(){e(t)},function(){Kr(o,t.element(),"keydown",n)})}):Hv(r,u(t),t,o,i,function(t){fl.getCurrent(t).each(e)},iv.HighlightFirst).get(Q)},o=qv(r),u=function(o){return function(t){return t.map(function(t){var n=st(t.menus),e=j(n,function(t){return V(t.items,function(t){return"item"===t.type})});return Im.getState(o).update(_(e,function(t){return t.data})),t})}},a=[Pm.config({}),Im.config({onSetValue:r.onSetValue,store:ao({mode:"dataset",getDataKey:function(t){return xu(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){wu(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return Et("initialValue",t)}).getOr({}))}),Av.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t,n){var e=Cv.getCoupled(t,"sandbox");if(Pm.isFocused(t)&&xu(t.element()).length>=r.minChars){var o=fl.getCurrent(e).bind(function(t){return kl.getHighlighted(t).map(Im.getValue)});r.previewing.set(!0),Hv(r,u(t),t,e,i,function(t){fl.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&kl.highlightFirst(t)},function(n){kl.highlightBy(t,function(t){return Im.getValue(t).value===n.value}),kl.getHighlighted(t).orThunk(function(){return kl.highlightFirst(t),tt.none()})})})},iv.HighlightFirst).get(Q)}},cancelEvent:Pn()}),hm.config({mode:"special",onDown:function(t,n){return e(t,n,kl.highlightFirst),tt.some(!0)},onEscape:function(t){var n=Cv.getCoupled(t,"sandbox");return Gs.isOpen(n)?(Gs.close(n),tt.some(!0)):tt.none()},onUp:function(t,n){return e(t,n,kl.highlightLast),tt.some(!0)},onEnter:function(n){var t=Cv.getCoupled(n,"sandbox"),e=Gs.isOpen(t);if(e&&!r.previewing.get())return fl.getCurrent(t).bind(function(t){return kl.getHighlighted(t)}).map(function(t){return Gr(n,Jv(),{item:t}),!0});var o=Im.getValue(n);return Wr(n,Pn()),r.onExecute(t,n,o),e&&Gs.close(t),tt.some(!0)}}),$m.config({toggleClass:r.markers.openClass,aria:{mode:"pressed",syncWithExpanded:!0}}),Cv.config({others:{sandbox:function(t){return jv(r,t,{onOpen:d,onClose:d})}}}),rg("typeaheadevents",[wi(function(t){var n=Q;Pv(r,u(t),t,i,n,iv.HighlightFirst).get(Q)}),si(Jv(),function(t,n){var e=Cv.getCoupled(t,"sandbox");Uv(r.model,t,n.event().item()),Wr(t,Pn()),r.onItemExecute(t,e,n.event().item(),Im.getValue(t)),Gs.close(e),Gv(t)})].concat(r.dismissOnBlur?[si(Dn(),function(t){var n=Cv.getCoupled(t,"sandbox");Hl(n.element()).isNone()&&Gs.close(n)})]:[]))];return{uid:r.uid,dom:Kv(r),behaviours:ao({},o,Zs(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),nb=function(t,n,e){var o=ob(t,n,e);return wv.sketch(o)},eb=function(t,n){return nb(t,n,[])},ob=function(t,n,e){return{dom:rb(e),components:t.toArray().concat([n])}},rb=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},ib=function(t,n){return wv.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},ub=function(t){return"separator"===t.type},ab={type:"separator"},cb=function(t,e){var n=U(t,function(t,n){return S(n)?""===n?t:"|"===n?0<t.length&&!ub(t[t.length-1])?t.concat([ab]):t:lt(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&ub(n[n.length-1])&&n.pop(),n},sb=function(t,n){return lt(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=fb(r,o),{item:e,menus:wt(i.menus,Et(e.value,i.items)),expansions:wt(i.expansions,Et(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},fb=function(t,r){var n=cb(S(t)?t.split(" "):t,r);return R(n,function(t,n){var e=function(t){if(ub(t))return t;var n=Tt(t,"value").getOrThunk(function(){return io("generated-menu-item")});return wt({value:n},t)}(n),o=sb(e,r);return{menus:wt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:wt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},lb=function(t,e,o){var n=io("primary-menu"),r=fb(t,o.menuItems());if(0===r.items.length)return tt.none();var i=Ch(n,r.items,e,o),u=it(r.menus,function(t,n){return Ch(n,t,e,o)}),a=wt(u,Et(n,i));return tt.from(bg.tieredData(n,a,r.expansions))},db=il({name:"Input",configFields:Yv(),factory:function(t,n){return{uid:t.uid,dom:Kv(t),components:[],behaviours:(e=t,ao({},qv(e),Zs(e.inputBehaviours,[Im.config({store:{mode:"manual",initialValue:e.data.getOr(undefined),getValue:function(t){return xu(t.element())},setValue:function(t,n){xu(t.element())!==n&&wu(t.element(),n)}},onSetValue:e.onSetValue})]))),eventOrder:t.eventOrder};var e}}),mb=En.detect().browser.isFirefox(),gb={position:"absolute",left:"-9999px"},pb=function(t,n,e){var o,r,i,u=function(t,n){var e=Zn.fromTag("span",t.dom());Le(e,"role","presentation");var o=Zn.fromText(n,t.dom());return Te(e,o),e}(ve(n),e);mb&&(o=n,r=u,i=io("ephox-alloy-aria-voice"),Le(r,"id",i),Le(o,"aria-describedby",i)),je(u,t(e)),du(u,gb),Te(n,u),x.setTimeout(function(){Ge(u,"aria-live"),Ae(u)},1e3)},hb=function(t){return{"aria-live":"assertive","aria-atomic":"true",role:"alert"}},vb=["input","textarea"],bb=function(t){var n=Fe(t);return T(vb,n)},yb=function(t,n){var e=n.getRoot(t).getOr(t.element());ru(e,n.invalidClass),n.notify.each(function(n){bb(t.element())&&Ge(e,"title"),n.getContainer(t).each(function(t){Me(t,n.validHtml)}),n.onValid(t)})},xb=function(e,t,n,o){var r=t.getRoot(e).getOr(e.element());ou(r,t.invalidClass),t.notify.each(function(t){var n;bb(e.element())&&Le(e.element(),"title",o),n=Zr(),pb(hb,n,o),t.getContainer(e).each(function(t){Me(t,o)}),t.onInvalid(e,o)})},wb=function(n,t,e){return t.validator.fold(function(){return Fv.pure(vt.value(!0))},function(t){return t.validate(n)})},Sb=function(n,e,t){return e.notify.each(function(t){t.onValidate(n)}),wb(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return xb(n,e,0,t),vt.error(t)},function(t){return yb(n,e),vt.value(t)}):vt.error("No longer in system")})},kb=/* */Object.freeze({markValid:yb,markInvalid:xb,query:wb,run:Sb,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return iu(e,n.invalidClass)}}),Cb=/* */Object.freeze({events:function(n,t){return n.validator.map(function(t){return ii([si(t.onEvent,function(t){Sb(t,n).get(d)})].concat(t.validateOnLoad?[bi(function(t){Sb(t,n).get(Q)})]:[]))}).getOr({})}}),Ob=[br("invalidClass"),Mr("getRoot",tt.none),_r("notify",[Mr("aria","alert"),Mr("getContainer",tt.none),Mr("validHtml",""),Xu("onValid"),Xu("onInvalid"),Xu("onValidate")]),_r("validator",[br("validate"),Mr("onEvent","input"),Mr("validateOnLoad",!0)])],Tb=ua({fields:Ob,name:"invalidating",active:Cb,apis:kb,extra:{validation:function(e){return function(t){var n=Im.getValue(t);return Fv.pure(e(n))}}}}),Eb=/* */Object.freeze({exhibit:function(t,n){return Ui({attributes:Bt([{key:n.tabAttr,value:"true"}])})}}),Bb=[Mr("tabAttr","data-alloy-tabstop")],Ab=ua({fields:Bb,name:"tabstopping",active:Eb}),Db=function(t){return{value:Z(t)}},_b=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Mb=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Fb=function(t){return _b.test(t)||Mb.test(t)},Ib=function(t){var n,e=(n=t.value().replace(_b,function(t,n,e,o){return n+n+e+e+o+o}),{value:Z(n)}),o=Mb.exec(e.value());return null===o?["FFFFFF","FF","FF","FF"]:o},Vb=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},Rb=function(t){var n=Vb(t.red())+Vb(t.green())+Vb(t.blue());return Db(n)},Hb=Math.min,Nb=Math.max,Pb=Math.round,zb=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,Lb=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,jb=function(t,n,e,o){return{red:Z(t),green:Z(n),blue:Z(e),alpha:Z(o)}},Ub=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},Wb=function(t){var n,e,o,r=(t.hue()||0)%360,i=t.saturation()/100,u=t.value()/100;if(i=Nb(0,Hb(i,1)),u=Nb(0,Hb(u,1)),0===i)return n=e=o=Pb(255*u),jb(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=Pb(255*(n+f)),e=Pb(255*(e+f)),o=Pb(255*(o+f)),jb(n,e,o,1)},Gb=function(t){var n=Ib(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return jb(e,o,r,1)},Xb=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return jb(r,i,u,a)},Yb=function(t){return"rgba("+t.red()+","+t.green()+","+t.blue()+","+t.alpha()+")"},qb=Z(jb(255,0,0,1)),Kb=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Jb="tinymce-custom-colors",$b="choiceitem",Qb=[{type:$b,text:"Turquoise",value:"#18BC9B"},{type:$b,text:"Green",value:"#2FCC71"},{type:$b,text:"Blue",value:"#3598DB"},{type:$b,text:"Purple",value:"#9B59B6"},{type:$b,text:"Navy Blue",value:"#34495E"},{type:$b,text:"Dark Turquoise",value:"#18A085"},{type:$b,text:"Dark Green",value:"#27AE60"},{type:$b,text:"Medium Blue",value:"#2880B9"},{type:$b,text:"Medium Purple",value:"#8E44AD"},{type:$b,text:"Midnight Blue",value:"#2B3E50"},{type:$b,text:"Yellow",value:"#F1C40F"},{type:$b,text:"Orange",value:"#E67E23"},{type:$b,text:"Red",value:"#E74C3C"},{type:$b,text:"Light Gray",value:"#ECF0F1"},{type:$b,text:"Gray",value:"#95A5A6"},{type:$b,text:"Dark Yellow",value:"#F29D12"},{type:$b,text:"Dark Orange",value:"#D35400"},{type:$b,text:"Dark Red",value:"#E74C3C"},{type:$b,text:"Medium Gray",value:"#BDC3C7"},{type:$b,text:"Dark Gray",value:"#7E8C8D"},{type:$b,text:"Black",value:"#000000"},{type:$b,text:"White",value:"#ffffff"}],Zb=function ZD(n){void 0===n&&(n=10);var t,e=Kb.getItem(Jb),o=S(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(),Kb.setItem(Jb,JSON.stringify(r))},state:function(){return r.slice(0)}}}(10),ty=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},ny=function(t){return t.getParam("color_map")},ey=function(t,n){return t.getParam("color_cols",n,"number")},oy=function(t){return!1!==t.getParam("custom_colors")},ry=function(t){var n=ny(t);return n!==undefined?ty(n):Qb},iy=function(){return _(Zb.state(),function(t){return{type:$b,text:t,value:t}})},uy=function(t){Zb.add(t)},ay=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},cy=function(t){return Math.max(5,Math.ceil(Math.sqrt(t)))},sy=function(t){var n=ry(t),e=cy(n.length);return ey(t,e)},fy=function(n,e,t,o){"custom"===t?gy(n)(function(t){t.each(function(t){uy(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},ly=function(o,r){return function(t){var n,e;t(o.concat(iy().concat((e={type:n="choiceitem",text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},r?[e,{type:n,text:"Custom color",icon:"color-picker",value:"custom"}]:[e]))))}},dy=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)},my=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 tt.from(ay(o,r)).bind(function(t){return function(t){if("transparent"===t)return tt.some(jb(0,0,0,0));var n=zb.exec(t);if(null!==n)return tt.some(Xb(n[1],n[2],n[3],"1"));var e=Lb.exec(t);return null!==e?tt.some(Xb(e[1],e[2],e[3],e[4])):tt.none()}(t).map(function(t){var n=Rb(t).value();return xn(e.toLowerCase(),n)})}).getOr(!1)},columns:sy(o),fetch:ly(ry(o),oy(o)),onAction:function(t){null!==i.get()&&fy(o,r,i.get(),function(){})},onItemAction:function(n,t){fy(o,r,t,function(t){i.set(t),dy(n,e,t)})},onSetup:function(t){return null!==i.get()&&dy(t,e,i.get()),function(){}}})},gy=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(tt.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(tt.none())}})}},py={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=_t(null),e=_t(null);my(t,"forecolor","forecolor","Text color",n),my(t,"backcolor","hilitecolor","Background color",e)},getFetch:ly,colorPickerDialog:gy,getCurrentColor:ay,getColorCols:sy,calcCols:cy},hy=Z([br("dom"),br("fetch"),Xu("onOpen"),Yu("onExecute"),Mr("getHotspot",tt.some),Mr("layouts",tt.none()),$s("dropdownBehaviours",[$m,Cv,hm,Pm]),br("toggleClass"),Mr("eventOrder",{}),Tr("lazySink"),Mr("matchWidth",!1),Mr("useMinWidth",!1),Tr("role")].concat($v())),vy=Z([Af({schema:[Uu()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),Vv()]),by=ul({name:"Dropdown",configFields:hy(),partFields:vy(),factory:function(n,t,e,o){var r,i,u=function(t){Gs.getState(t).each(function(t){bg.highlightPrimary(t)})},a={expand:function(t){$m.isOn(t)||Pv(n,function(t){return t},t,o,Q,iv.HighlightNone).get(Q)},open:function(t){$m.isOn(t)||Pv(n,function(t){return t},t,o,Q,iv.HighlightFirst).get(Q)},isOpen:$m.isOn,close:function(t){$m.isOn(t)&&Pv(n,function(t){return t},t,o,Q,iv.HighlightFirst).get(Q)}},c=function(t,n){return Xr(t),tt.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:Zs(n.dropdownBehaviours,[$m.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),Cv.config({others:{sandbox:function(t){return jv(n,t,{onOpen:function(){$m.on(t)},onClose:function(){$m.off(t)}})}}}),hm.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t,n){if(by.isOpen(t)){var e=Cv.getCoupled(t,"sandbox");u(e)}else by.open(t);return tt.some(!0)},onEscape:function(t,n){return by.isOpen(t)?(by.close(t),tt.some(!0)):tt.none()}}),Pm.config({})]),events:xg(tt.some(function(t){Pv(n,function(t){return t},t,o,u,iv.HighlightFirst).get(Q)})),eventOrder:ao({},n.eventOrder,(r={},r[Fn()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:ao({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}}),"button"===n.dom.tag?{type:(i="type",Tt(n.dom,"attributes").bind(function(t){return Tt(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)}}}),yy=ua({fields:[],name:"unselecting",active:/* */Object.freeze({events:function(t){return ii([ui(Zt(),Z(!0))])},exhibit:function(t,n){return Ui({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),xy=io("color-input-change"),wy=io("color-swatch-change"),Sy=io("color-picker-cancel"),ky=function(t,n,o){var e,r,i=wv.parts().field({factory:db,inputClasses:["tox-textfield"],onSetValue:function(t){return Tb.run(t).get(function(){})},inputBehaviours:ra([Ab.config({}),Tb.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return ye(t.element())},notify:{onValid:function(t){var n=Im.getValue(t);Gr(t,xy,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=Im.getValue(t);if(0===n.length)return Fv.pure(vt.value(!0));var e=Zn.fromTag("span");lu(e,"background-color",n);var o=hu(e,"background-color").fold(function(){return vt.error("blah")},function(t){return vt.value(n)});return Fv.pure(o)}}})]),selectOnFocus:!1}),u=t.label.map(function(t){return ib(t,n.providers)}),a=function(t,n){Gr(t,wy,{value:n})},c=Sg((e={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:tt.some({onRtl:function(){return[bc]},onLtr:function(){return[yc]}}),components:[],fetch:py.getFetch(o.getColors(),o.hasCustomColors()),onItemAction:function(e){n.getSink().each(function(t){c.getOpt(t).each(function(n){"custom"===e?o.colorPicker(function(t){t.fold(function(){return Wr(n,Sy)},function(t){a(n,t),uy(t)})},"#ffffff"):a(n,"remove"===e?"":e)})})}},r=n,by.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ra([yy.config({}),Ab.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:r.getSink,fetch:function(){return Fv.nu(function(t){return e.fetch(t)}).map(function(t){return tt.from(Oh(wt(kh(io("menu-value"),t,function(t){e.onItemAction(t)},5,"color",Xp.CLOSE_ON_EXECUTE,function(){return!1},r.providers),{movement:mh(5,"color")})))})},parts:{menu:dh(0,0,"color")}})));return wv.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[i,c.asSpec()]}]),fieldBehaviours:ra([rg("form-field-events",[si(xy,function(t,n){c.getOpt(t).each(function(t){lu(t.element(),"background-color",n.event().color())})}),si(wy,function(n,e){wv.getField(n).each(function(t){Im.setValue(t,e.event().value()),fl.getCurrent(n).each(Pm.focus)})}),si(Sy,function(n,t){wv.getField(n).each(function(t){fl.getCurrent(n).each(Pm.focus)})})])])})},Cy=function(t,n,e){return{hue:Z(t),saturation:Z(n),value:Z(e)}},Oy=Z(io("rgb-hex-update")),Ty=Z(io("slider-update")),Ey=Z(io("palette-update")),By=En.detect().deviceType.isTouch(),Ay=Df({schema:[br("dom")],name:"label"}),Dy=function(t){return Df({name:t+"-edge",overrides:function(o){return o.model.manager.edgeActions[t].fold(function(){return{}},function(e){var t=ii([fi(Ht(),e,[o])]),n=ii([fi(zt(),e,[o]),fi(Lt(),function(t,n){n.mouseIsDown.get()&&e(t,n)},[o])]);return{events:By?t:n}})}})},_y=Dy("top-left"),My=Dy("top"),Fy=Dy("top-right"),Iy=Dy("right"),Vy=Dy("bottom-right"),Ry=Dy("bottom"),Hy=Dy("bottom-left"),Ny=[Ay,Dy("left"),Iy,My,Ry,_y,Fy,Hy,Vy,Bf({name:"thumb",defaults:Z({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:ii([mi(Ht(),t,"spectrum"),mi(Nt(),t,"spectrum"),mi(Pt(),t,"spectrum"),mi(zt(),t,"spectrum"),mi(Lt(),t,"spectrum"),mi(Ut(),t,"spectrum")])}}}),Bf({schema:[zr("mouseIsDown",function(){return _t(!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=ii([si(Ht(),r),si(Nt(),r)]),n=ii([si(zt(),r),si(Lt(),function(t,n){e.mouseIsDown.get()&&r(t,n)})]);return{behaviours:ra(By?[]:[hm.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)}}),Pm.config({})]),events:By?t:n}}})],Py=En.detect().deviceType.isTouch(),zy=Z("slider.change.value"),Ly=function(t){var n=t.event().raw();if(Py){var e=n;return e.touches!==undefined&&1===e.touches.length?tt.some(e.touches[0]).map(function(t){return pa(t.clientX,t.clientY)}):tt.none()}var o=n;return o.clientX!==undefined?tt.some(o).map(function(t){return pa(t.clientX,t.clientY)}):tt.none()},jy=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},Uy=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},Wy=function(t,n,e){return Math.max(n,Math.min(e,t))},Gy=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=Wy(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 Wy(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},Xy=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},Yy=function(t){return t.model.minX},qy=function(t){return t.model.minY},Ky=function(t){return t.model.minX-1},Jy=function(t){return t.model.minY-1},$y=function(t){return t.model.maxX},Qy=function(t){return t.model.maxY},Zy=function(t){return t.model.maxX+1},tx=function(t){return t.model.maxY+1},nx=function(t,n,e){return n(t)-e(t)},ex=function(t){return nx(t,$y,Yy)},ox=function(t){return nx(t,Qy,qy)},rx=function(t){return ex(t)/2},ix=function(t){return ox(t)/2},ux=function(t){return t.stepSize},ax=function(t){return t.snapToGrid},cx=function(t){return t.snapStart},sx=function(t){return t.rounded},fx=function(t,n){return t[n+"-edge"]!==undefined},lx=function(t){return fx(t,"left")},dx=function(t){return fx(t,"right")},mx=function(t){return fx(t,"top")},gx=function(t){return fx(t,"bottom")},px=function(t){return t.model.value.get()},hx=function(t){return{x:Z(t)}},vx=function(t){return{y:Z(t)}},bx=function(t,n){return{x:Z(t),y:Z(n)}},yx=function(t,n){Gr(t,zy(),{value:n})},xx="left",wx=function(t){return t.element().dom().getBoundingClientRect()},Sx=function(t,n){return t[n]},kx=function(t){var n=wx(t);return Sx(n,xx)},Cx=function(t){var n=wx(t);return Sx(n,"right")},Ox=function(t){var n=wx(t);return Sx(n,"top")},Tx=function(t){var n=wx(t);return Sx(n,"bottom")},Ex=function(t){var n=wx(t);return Sx(n,"width")},Bx=function(t){var n=wx(t);return Sx(n,"height")},Ax=function(t,n,e){return(t+n)/2-e},Dx=function(t,n){var e=wx(t),o=wx(n),r=Sx(e,xx),i=Sx(e,"right"),u=Sx(o,xx);return Ax(r,i,u)},_x=function(t,n){var e=wx(t),o=wx(n),r=Sx(e,"top"),i=Sx(e,"bottom"),u=Sx(o,"top");return Ax(r,i,u)},Mx=function(t,n){Gr(t,zy(),{value:n})},Fx=function(t){return{x:Z(t)}},Ix=function(t,n,e){var o={min:Yy(n),max:$y(n),range:ex(n),value:e,step:ux(n),snap:ax(n),snapStart:cx(n),rounded:sx(n),hasMinEdge:lx(n),hasMaxEdge:dx(n),minBound:kx(t),maxBound:Cx(t),screenRange:Ex(t)};return Gy(o)},Vx=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Uy:jy)(px(r).x(),Yy(r),$y(r),ux(r)),Mx(o,Fx(i)),tt.some(i)).map(function(){return!0});var e,o,r,i}},Rx=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=Ex(u=n),d=s.bind(function(t){return tt.some(Dx(t,u))}).getOr(0),m=f.bind(function(t){return tt.some(Dx(t,u))}).getOr(l),g={min:Yy(a),max:$y(a),range:ex(a),value:c,hasMinEdge:lx(a),hasMaxEdge:dx(a),minBound:kx(u),minOffset:0,maxBound:Cx(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Xy(g));return kx(n)-kx(t)+p},Hx=Vx(-1),Nx=Vx(1),Px=tt.none,zx=tt.none,Lx={"top-left":tt.none(),top:tt.none(),"top-right":tt.none(),right:tt.some(function(t,n){yx(t,hx(Zy(n)))}),"bottom-right":tt.none(),bottom:tt.none(),"bottom-left":tt.none(),left:tt.some(function(t,n){yx(t,hx(Ky(n)))})},jx=/* */Object.freeze({setValueFrom:function(t,n,e){var o=Ix(t,n,e),r=Fx(o);return Mx(t,r),o},setToMin:function(t,n){var e=Yy(n);Mx(t,Fx(e))},setToMax:function(t,n){var e=$y(n);Mx(t,Fx(e))},findValueOfOffset:Ix,getValueFromEvent:function(t){return Ly(t).map(function(t){return t.left()})},findPositionOfValue:Rx,setPositionFromValue:function(t,n,e,o){var r=px(e),i=Rx(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=Sa(n.element())/2;lu(n.element(),"left",i-u+"px")},onLeft:Hx,onRight:Nx,onUp:Px,onDown:zx,edgeActions:Lx}),Ux=function(t,n){Gr(t,zy(),{value:n})},Wx=function(t){return{y:Z(t)}},Gx=function(t,n,e){var o={min:qy(n),max:Qy(n),range:ox(n),value:e,step:ux(n),snap:ax(n),snapStart:cx(n),rounded:sx(n),hasMinEdge:mx(n),hasMaxEdge:gx(n),minBound:Ox(t),maxBound:Tx(t),screenRange:Bx(t)};return Gy(o)},Xx=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Uy:jy)(px(r).y(),qy(r),Qy(r),ux(r)),Ux(o,Wx(i)),tt.some(i)).map(function(){return!0});var e,o,r,i}},Yx=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=Bx(u=n),d=s.bind(function(t){return tt.some(_x(t,u))}).getOr(0),m=f.bind(function(t){return tt.some(_x(t,u))}).getOr(l),g={min:qy(a),max:Qy(a),range:ox(a),value:c,hasMinEdge:mx(a),hasMaxEdge:gx(a),minBound:Ox(u),minOffset:0,maxBound:Tx(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Xy(g));return Ox(n)-Ox(t)+p},qx=tt.none,Kx=tt.none,Jx=Xx(-1),$x=Xx(1),Qx={"top-left":tt.none(),top:tt.some(function(t,n){yx(t,vx(Jy(n)))}),"top-right":tt.none(),right:tt.none(),"bottom-right":tt.none(),bottom:tt.some(function(t,n){yx(t,vx(tx(n)))}),"bottom-left":tt.none(),left:tt.none()},Zx=/* */Object.freeze({setValueFrom:function(t,n,e){var o=Gx(t,n,e),r=Wx(o);return Ux(t,r),o},setToMin:function(t,n){var e=qy(n);Ux(t,Wx(e))},setToMax:function(t,n){var e=Qy(n);Ux(t,Wx(e))},findValueOfOffset:Gx,getValueFromEvent:function(t){return Ly(t).map(function(t){return t.top()})},findPositionOfValue:Yx,setPositionFromValue:function(t,n,e,o){var r=px(e),i=Yx(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=Oa(n.element())/2;lu(n.element(),"top",i-u+"px")},onLeft:qx,onRight:Kx,onUp:Jx,onDown:$x,edgeActions:Qx}),tw=function(t,n){Gr(t,zy(),{value:n})},nw=function(t,n){return{x:Z(t),y:Z(n)}},ew=function(s,f){return function(t,n){return(e=s,o=f,r=t,i=n,u=0<e?Uy:jy,a=o?px(i).x():u(px(i).x(),Yy(i),$y(i),ux(i)),c=o?u(px(i).y(),qy(i),Qy(i),ux(i)):px(i).y(),tw(r,nw(a,c)),tt.some(a)).map(function(){return!0});var e,o,r,i,u,a,c}},ow=ew(-1,!1),rw=ew(1,!1),iw=ew(-1,!0),uw=ew(1,!0),aw={"top-left":tt.some(function(t,n){yx(t,bx(Ky(n),Jy(n)))}),top:tt.some(function(t,n){yx(t,bx(rx(n),Jy(n)))}),"top-right":tt.some(function(t,n){yx(t,bx(Zy(n),Jy(n)))}),right:tt.some(function(t,n){yx(t,bx(Zy(n),ix(n)))}),"bottom-right":tt.some(function(t,n){yx(t,bx(Zy(n),tx(n)))}),bottom:tt.some(function(t,n){yx(t,bx(rx(n),tx(n)))}),"bottom-left":tt.some(function(t,n){yx(t,bx(Ky(n),tx(n)))}),left:tt.some(function(t,n){yx(t,bx(Ky(n),ix(n)))})},cw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=Ix(t,n,e.left()),r=Gx(t,n,e.top()),i=nw(o,r);return tw(t,i),i},setToMin:function(t,n){var e=Yy(n),o=qy(n);tw(t,nw(e,o))},setToMax:function(t,n){var e=$y(n),o=Qy(n);tw(t,nw(e,o))},getValueFromEvent:function(t){return Ly(t)},setPositionFromValue:function(t,n,e,o){var r=px(e),i=Rx(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=Yx(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=Sa(n.element())/2,c=Oa(n.element())/2;lu(n.element(),"left",i-a+"px"),lu(n.element(),"top",u-c+"px")},onLeft:ow,onRight:rw,onUp:iw,onDown:uw,edgeActions:aw}),sw=En.detect().deviceType.isTouch(),fw=[Mr("stepSize",1),Mr("onChange",Q),Mr("onChoose",Q),Mr("onInit",Q),Mr("onDragStart",Q),Mr("onDragEnd",Q),Mr("snapToGrid",!1),Mr("rounded",!0),Tr("snapStart"),yr("model",fr("mode",{x:[Mr("minX",0),Mr("maxX",100),zr("value",function(t){return _t(t.mode.minX)}),br("getInitialValue"),Ju("manager",jx)],y:[Mr("minY",0),Mr("maxY",100),zr("value",function(t){return _t(t.mode.minY)}),br("getInitialValue"),Ju("manager",Zx)],xy:[Mr("minX",0),Mr("maxX",100),Mr("minY",0),Mr("maxY",100),zr("value",function(t){return _t({x:Z(t.mode.minX),y:Z(t.mode.minY)})}),br("getInitialValue"),Ju("manager",cw)]})),$s("sliderBehaviours",[hm,Im])].concat(sw?[]:[zr("mouseIsDown",function(){return _t(!1)})]),lw=En.detect().deviceType.isTouch(),dw=ul({name:"Slider",configFields:fw,partFields:Ny,factory:function(i,t,n,e){var u=function(t){return Uf(t,i,"thumb")},a=function(t){return Uf(t,i,"spectrum")},o=function(t){return jf(t,i,"left-edge")},r=function(t){return jf(t,i,"right-edge")},c=function(t){return jf(t,i,"top-edge")},s=function(t){return jf(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),tt.some(!0)},g=[si(Ht(),function(t,n){i.onDragStart(t,u(t))}),si(Pt(),function(t,n){i.onDragEnd(t,u(t))})],p=[si(zt(),function(t,n){n.stop(),i.onDragStart(t,u(t)),i.mouseIsDown.set(!0)}),si(Ut(),function(t,n){i.onDragEnd(t,u(t))})],h=lw?g:p;return{uid:i.uid,dom:i.dom,components:t,behaviours:Zs(i.sliderBehaviours,L([lw?[]:[hm.config({mode:"special",focusIn:function(t){return jf(t,i,"spectrum").map(hm.focusIn).map(Z(!0))}})],[Im.config({store:{mode:"manual",getValue:function(t){return f.value.get()}}}),da.config({channels:{"mouse.released":{onReceive:function(e,t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&jf(e,i,"thumb").each(function(t){var n=f.value.get();i.onChoose(e,t,n)})}}}})]])),events:ii([si(zy(),function(t,n){m(t,n.event().value())}),bi(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)}}}),mw=function(t,n){var e=dw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=dw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return dw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:Z({y:Z(0)})},components:[e,o],sliderBehaviours:ra([Pm.config({})]),onChange:function(t,n,e){Gr(t,Ty(),{value:e})}})},gw=[$s("formBehaviours",[Im])],pw=function(t){return"<alloy.field."+t+">"},hw=function(o,t,n){return{uid:o.uid,dom:o.dom,components:t,behaviours:Zs(o.formBehaviours,[Im.config({store:{mode:"manual",getValue:function(t){var n=Gf(t,o);return it(n,function(t,n){return t().bind(function(t){var n,e=fl.getCurrent(t);return n="missing current",e.fold(function(){return vt.error(n)},vt.value)}).map(Im.getValue)})},setValue:function(e,t){rt(t,function(n,t){jf(e,o,t).each(function(t){fl.getCurrent(t).each(function(t){Im.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return jf(t,o,n).bind(fl.getCurrent)}}}},vw={getField:Pi(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),Hf("form",pw(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=_(r,function(t){return Bf({name:t,pname:pw(t)})});return Qf("form",gw,i,hw,o)}},bw=io("valid-input"),yw=io("invalid-input"),xw=io("validating-input"),ww="colorcustom.rgb.",Sw=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(ww+"range"),c=[wv.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),wv.parts().field({data:r,factory:db,inputAttributes:ao({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:ra([(i=n,u=t,Tb.config({invalidClass:m("invalid"),notify:{onValidate:function(t){Gr(t,xw,{type:i})},onValid:function(t){Gr(t,bw,{type:i,value:Im.getValue(t)})},onInvalid:function(t){Gr(t,yw,{type:i,value:Im.getValue(t)})}},validator:{validate:function(t){var n=Im.getValue(t),e=u(n)?vt.value(!0):vt.error(d("aria.input.invalid"));return Fv.pure(e)},validateOnLoad:!1}})),Ab.config({})]),onSetValue:function(t){Tb.isInvalid(t)&&Tb.run(t).get(Q)}})],s="hex"!==n?[wv.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();Im.setValue(t,{red:e,green:o,blue:r})},b=Sg({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){lu(t.element(),"background-color","#"+n.value())})};return il({factory:function(){var e={red:Z(_t(tt.some(255))),green:Z(_t(tt.some(255))),blue:Z(_t(tt.some(255))),hex:Z(_t(tt.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",tt.some(n)),i("green",tt.some(e)),i("blue",tt.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),tt.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,tt.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return jb(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=Rb(t),vw.getField(n,"hex").each(function(t){Pm.isFocused(t)||Im.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=Db(n);i("hex",tt.some(n));var o=Gb(e);v(t,o),r(o),Gr(t,Oy(),{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(ww+t+".label"),description:d(ww+t+".description")}},c=t("red"),s=t("green"),f=t("blue"),l=t("hex");return wt(vw.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",wv.sketch(h(Ub,"red",c.label,c.description,255))),t.field("green",wv.sketch(h(Ub,"green",s.label,s.description,255))),t.field("blue",wv.sketch(h(Ub,"blue",f.label,f.description,255))),t.field("hex",wv.sketch(h(Fb,"hex",l.label,l.description,"ffffff"))),b.asSpec()],formBehaviours:ra([Tb.config({invalidClass:m("form-invalid")}),rg("rgb-form-events",[si(bw,a),si(yw,n),si(xw,n)])])}}),{apis:{updateHex:function(t,n){var e,o;Im.setValue(t,{hex:n.value()}),e=t,o=Gb(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},kw=function(t,o){var r=dw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=dw.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 il({factory:function(t){var n=Z({x:Z(0),y:Z(0)}),e=ra([fl.config({find:tt.some}),Pm.config({})]);return dw.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){Gr(t,Ey(),{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),Yb(qb()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,Yb(o))}},extraApis:{}})},Cw=function(c,s){return il({name:"ColourPicker",configFields:[br("dom"),Mr("onValidHex",Q),Mr("onInvalidHex",Q)],factory:function(t){var a,v,e=Sw(c,s,t.onValidHex,t.onInvalidHex),o=kw(c,s),b={paletteRgba:Z(_t(qb()))},n=Sg(o.sketch({})),r=Sg(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=Gb(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){M(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),mw(c,s),r.asSpec()],behaviours:ra([rg("colour-picker-events",[si(Ey(),(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?Cy(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,Cy(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=Cy(m.hue(),l.x(),100-l.y()),p=Wb(g),h=Rb(p);y(t,h,v)})),si(Ty(),(a=[i,u],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=Cy((100-e)/100*360,100,100),r=Wb(o),Rb(r));y(t,u,a)}))]),fl.config({find:function(t){return r.getOpt(t)}}),hm.config({mode:"acyclic"})])}}})},Ow=function(){return fl.config({find:tt.some})},Tw=function(t){return fl.config({find:t.getOpt})},Ew=function(t){return fl.config({find:function(n){return Se(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},Bw={"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"},Aw=function(t){return Bw[t]},Dw=Go([Mr("preprocess",d),Mr("postprocess",d)]),_w=function(t,n,e){return Im.config(wt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},Mw=function(t,n,e){return _w(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},Fw=function(r,t){var i=cr("RepresentingConfigs.memento processors",Dw,t);return Im.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=Im.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);Im.setValue(o,e)}}})},Iw=_w,Vw=function(t){return Mw(t,De,Me)},Rw=function(t){return Im.config({store:{mode:"memory",initialValue:t}})},Hw=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){M(t,function(t){t(n,e)})}},i=function(t,n){if(!Hp.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;Im.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),V(nt(e),function(t){return o.test(t.name)}))),Gr(t,fv,{name:r.name})},c=Sg({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ra([rg("input-file-events",[pi(Rn())])])}),t=r.label.map(function(t){return ib(t,n)}),s=wv.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ra([Rw([]),Ow(),Hp.config({}),$m.config({toggleClass:"dragenter",toggleOnExecute:!1}),rg("dropzone-events",[si("dragenter",o([e,$m.toggle])),si("dragleave",o([e,$m.toggle])),si("dragover",e),si("drop",o([e,i])),si(Jt(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},wg.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:ra([Ab.config({})])})]}]}}}});return nb(t,s,["tox-form__group--stretched"])},Nw=io("alloy-fake-before-tabstop"),Pw=io("alloy-fake-after-tabstop"),zw=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:ra([Pm.config({ignore:!0}),Ab.config({})])}},Lw=function(t,n){Gr(t,Yt(),{raw:{which:9,shiftKey:n}})},jw=function(t){return Fh(t,["."+Nw,"."+Pw].join(","),Z(!1))},Uw=function(t,n){var e=n.element();iu(e,Nw)?Lw(t,!0):iu(e,Pw)&&Lw(t,!1)},Ww=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[zw([Nw]),t,zw([Pw])],behaviours:ra([Ew(1)])}},Gw=!(En.detect().browser.isIE()||En.detect().browser.isEdge()),Xw=function(t,n){var o,r,e=Gw&&t.sandboxed,i=ao({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=_t(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Le(t.element(),"src","data:text/html;charset=utf-8,"+encodeURIComponent(n));else{Le(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 ib(t,n)}),c=wv.parts().field({factory:{sketch:function(t){return Ww({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:ra([Ab.config({}),Pm.config({}),Iw(tt.none(),u.getValue,u.setValue)])})}}});return nb(a,c,["tox-form__group--stretched"])};function Yw(t,n){return Kw(x.document.createElement("canvas"),t,n)}function qw(t){return t.getContext("2d")}function Kw(t,n,e){return t.width=n,t.height=e,t}var Jw={create:Yw,clone:function t_(t){var n;return qw(n=Yw(t.width,t.height)).drawImage(t,0,0),n},resize:Kw,get2dContext:qw,get3dContext:function n_(t){var n=null;try{n=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(e){}return n||(n=null),n}},$w={getWidth:function e_(t){return t.naturalWidth||t.width},getHeight:function o_(t){return t.naturalHeight||t.height}},Qw=window.Promise?window.Promise:function(){var t=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=[],s(t,o(r,this),o(u,this))},n=t.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){x.setTimeout(t,1)};function o(t,n){return function(){t.apply(n,arguments)}}var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(o){var r=this;null!==this._state?n(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 s(o(n,t),o(r,this),o(u,this))}this._state=!0,this._value=t,a.call(this)}catch(e){u.call(this,e)}}function u(t){this._state=!1,this._value=t,a.call(this)}function a(){for(var t=0,n=this._deferreds.length;t<n;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function c(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 s(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 t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype.then=function(e,o){var r=this;return new t(function(t,n){i.call(r,new c(e,o,t,n))})},t.all=function(){var c=Array.prototype.slice.call(1===arguments.length&&e(arguments[0])?arguments[0]:arguments);return new t(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])})},t.resolve=function(n){return n&&"object"==typeof n&&n.constructor===t?n:new t(function(t){t(n)})},t.reject=function(e){return new t(function(t,n){n(e)})},t.race=function(r){return new t(function(t,n){for(var e=0,o=r.length;e<o;e++)r[e].then(t,n)})},t}();function Zw(){return new(ue.getOrDie("FileReader"))}var tS={atob:function(t){return ue.getOrDie("atob")(t)},requestAnimationFrame:function(t){ue.getOrDie("requestAnimationFrame")(t)}};function nS(a){return new Qw(function(t,n){var e=x.URL.createObjectURL(a),o=new x.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()})}function eS(o){return new Qw(function(t,e){var n=new x.XMLHttpRequest;n.open("GET",o,!0),n.responseType="blob",n.onload=function(){200==this.status&&t(this.response)},n.onerror=function(){var t,n=this;e(0===this.status?((t=new Error("No access to download image")).code=18,t.name="SecurityError",t):new Error("Error "+n.status+" downloading image"))},n.send()})}function oS(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return tt.none();for(var o,r=e[1],i=n[1],u=tS.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(ue.getOrDie("Uint8Array"))(o))}return tt.some(function h(t,n){return new(ue.getOrDie("Blob"))(t,n)}(s,{type:r}))}function rS(e){return new Qw(function(t,n){oS(e).fold(function(){n("uri is not base64: "+e)},t)})}function iS(e){return new Qw(function(t){var n=Zw();n.onloadend=function(){t(n.result)},n.readAsDataURL(e)})}var uS={blobToImage:nS,imageToBlob:function r_(t){var n=t.src;return 0===n.indexOf("data:")?rS(n):eS(n)},blobToArrayBuffer:function i_(e){return new Qw(function(t){var n=Zw();n.onloadend=function(){t(n.result)},n.readAsArrayBuffer(e)})},blobToDataUri:iS,blobToBase64:function u_(t){return iS(t).then(function(t){return t.split(",")[1]})},dataUriToBlobSync:oS,canvasToBlob:function a_(t,e,o){return e=e||"image/png",x.HTMLCanvasElement.prototype.toBlob?new Qw(function(n){t.toBlob(function(t){n(t)},e,o)}):rS(t.toDataURL(e,o))},canvasToDataURL:function c_(t,n,e){return n=n||"image/png",t.then(function(t){return t.toDataURL(n,e)})},blobToCanvas:function s_(t){return nS(t).then(function(t){var n;return function e(t){x.URL.revokeObjectURL(t.src)}(t),n=Jw.create($w.getWidth(t),$w.getHeight(t)),Jw.get2dContext(n).drawImage(t,0,0),n})},uriToBlob:function f_(t){return 0===t.indexOf("blob:")?eS(t):0===t.indexOf("data:")?rS(t):null}};function aS(t,n,e){var o=n.type;function r(n,e){return t.then(function(t){return uS.canvasToDataURL(t,n,e)})}return{getType:Z(o),toBlob:function i(){return Qw.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 uS.canvasToBlob(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(Jw.clone)}}}function cS(n){return uS.blobToDataUri(n).then(function(t){return aS(uS.blobToCanvas(n),n,t)})}var sS={fromBlob:cS,fromCanvas:function l_(n,t){return uS.canvasToBlob(n,t).then(function(t){return aS(Qw.resolve(n),t,n.toDataURL())})},fromImage:function d_(t){return uS.imageToBlob(t).then(function(t){return cS(t)})},fromBlobAndUrlSync:function(t,n){return aS(uS.blobToCanvas(t),t,n)}},fS=function(t){return sS.fromBlob(t)};function lS(t,n,e){return e<(t=parseFloat(t))?t=e:t<n&&(t=n),t}var dS=[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 mS(t,n){var e,o,r,i,u=[],a=new Array(10);for(e=0;e<5;e++){for(o=0;o<5;o++)u[o]=n[o+5*e];for(o=0;o<5;o++){for(r=i=0;r<5;r++)i+=t[o+5*r]*u[r];a[o+5*e]=i}}return a}function gS(t,e){return e=lS(e,0,1),t.map(function(t,n){return n%6==0?t=1-(1-t)*e:t*=e,lS(t,0,1)})}var pS={identity:function m_(){return[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]},adjust:gS,multiply:mS,adjustContrast:function g_(t,n){var e;return n=lS(n,-1,1),mS(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0==(e=n%1)?dS[n]:dS[Math.floor(n)]*(1-e)+dS[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])},adjustBrightness:function p_(t,n){return mS(t,[1,0,0,0,n=lS(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])},adjustSaturation:function h_(t,n){var e;return mS(t,[.3086*(1-(e=1+(0<(n=lS(n,-1,1))?3*n:n)))+e,.6094*(1-e),.082*(1-e),0,0,.3086*(1-e),.6094*(1-e)+e,.082*(1-e),0,0,.3086*(1-e),.6094*(1-e),.082*(1-e)+e,0,0,0,0,0,1,0,0,0,0,0,1])},adjustHue:function v_(t,n){var e,o;return n=lS(n,-180,180)/180*Math.PI,mS(t,[.213+.787*(e=Math.cos(n))+-.213*(o=Math.sin(n)),.715+-.715*e+-.715*o,.072+-.072*e+.928*o,0,0,.213+-.213*e+.143*o,.715+e*(1-.715)+.14*o,.072+-.072*e+-.283*o,0,0,.213+-.213*e+-.787*o,.715+-.715*e+.715*o,.072+.928*e+.072*o,0,0,0,0,0,1,0,0,0,0,0,1])},adjustColors:function b_(t,n,e,o){return mS(t,[n=lS(n,0,2),0,0,0,0,0,e=lS(e,0,2),0,0,0,0,0,o=lS(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])},adjustSepia:function y_(t,n){return mS(t,gS([.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0,0,0,0,0,1],n=lS(n,0,1)))},adjustGrayscale:function x_(t,n){return mS(t,gS([.33,.34,.33,0,0,.33,.34,.33,0,0,.33,.34,.33,0,0,0,0,0,1,0,0,0,0,0,1],n=lS(n,0,1)))}};function hS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o,r=Jw.get2dContext(t);return o=function B(t,n){var e,o,r,i,u,a=t.data,c=n[0],s=n[1],f=n[2],l=n[3],d=n[4],m=n[5],g=n[6],p=n[7],h=n[8],v=n[9],b=n[10],y=n[11],x=n[12],w=n[13],S=n[14],k=n[15],C=n[16],O=n[17],T=n[18],E=n[19];for(u=0;u<a.length;u+=4)e=a[u],o=a[u+1],r=a[u+2],i=a[u+3],a[u]=e*c+o*s+r*f+i*l+d,a[u+1]=e*m+o*g+r*p+i*h+v,a[u+2]=e*b+o*y+r*x+i*w+S,a[u+3]=e*k+o*C+r*O+i*T+E;return t}(r.getImageData(0,0,t.width,t.height),e),r.putImageData(o,0,0),sS.fromCanvas(t,n)}(t,n.getType(),e)})}function vS(n,e){return n.toCanvas().then(function(t){return function u(t,n,e){var o,r,i=Jw.get2dContext(t);return o=i.getImageData(0,0,t.width,t.height),r=i.getImageData(0,0,t.width,t.height),r=function w(t,n,e){var o,r,i,u,a,c,s,f,l,d,m,g,p,h,v,b,y;function x(t,n,e){return e<t?t=e:t<n&&(t=n),t}for(i=Math.round(Math.sqrt(e.length)),u=Math.floor(i/2),o=t.data,r=n.data,b=t.width,y=t.height,c=0;c<y;c++)for(a=0;a<b;a++){for(s=f=l=0,m=0;m<i;m++)for(d=0;d<i;d++)g=x(a+d-u,0,b-1),p=x(c+m-u,0,y-1),h=4*(p*b+g),v=e[m*i+d],s+=o[h]*v,f+=o[h+1]*v,l+=o[h+2]*v;r[h=4*(c*b+a)]=x(s,0,255),r[h+1]=x(f,0,255),r[h+2]=x(l,0,255)}return n}(o,r,e),i.putImageData(r,0,0),sS.fromCanvas(t,n)}(t,n.getType(),e)})}function bS(c){return function(n,e){return n.toCanvas().then(function(t){return function(t,n,e){var o,r,i=Jw.get2dContext(t),u=new Array(256);for(r=0;r<u.length;r++)u[r]=c(r,e);return o=function a(t,n){var e,o=t.data;for(e=0;e<o.length;e+=4)o[e]=n[o[e]],o[e+1]=n[o[e+1]],o[e+2]=n[o[e+2]];return t}(i.getImageData(0,0,t.width,t.height),u),i.putImageData(o,0,0),sS.fromCanvas(t,n)}(t,n.getType(),e)})}}function yS(e){return function(t,n){return hS(t,e(pS.identity(),n))}}function xS(n){return function(t){return vS(t,n)}}var wS={invert:function w_(n){return function(t){return hS(t,n)}}([-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0]),brightness:yS(pS.adjustBrightness),hue:yS(pS.adjustHue),saturate:yS(pS.adjustSaturation),contrast:yS(pS.adjustContrast),grayscale:yS(pS.adjustGrayscale),sepia:yS(pS.adjustSepia),colorize:function(t,n,e,o){return hS(t,pS.adjustColors(pS.identity(),n,e,o))},sharpen:xS([0,-1,0,-1,5,-1,0,-1,0]),emboss:xS([-2,-1,0,-1,1,1,0,1,2]),gamma:bS(function(t,n){return 255*Math.pow(t/255,1-n)}),exposure:bS(function(t,n){return 255*(1-Math.exp(-t/255*n))}),colorFilter:hS,convoluteFilter:vS},SS={scale:function S_(t,n,e){var o=$w.getWidth(t),r=$w.getHeight(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 Qw(function(t){var n=$w.getWidth(a),e=$w.getHeight(a),o=Math.floor(n*c),r=Math.floor(e*s),i=Jw.create(o,r),u=Jw.get2dContext(i);u.drawImage(a,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return S_(t,n,e)}):c}},kS={rotate:function k_(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=Jw.create(t.width,t.height),r=Jw.get2dContext(o),i=0,u=0;return 90!=(e=e<0?360+e:e)&&270!=e||Jw.resize(o,o.height,o.width),90!=e&&180!=e||(i=o.width),270!=e&&180!=e||(u=o.height),r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),sS.fromCanvas(o,n)}(t,n.getType(),e)})},flip:function C_(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=Jw.create(t.width,t.height),r=Jw.get2dContext(o);return"v"==e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0)),sS.fromCanvas(o,n)}(t,n.getType(),e)})},crop:function O_(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=Jw.create(r,i);return Jw.get2dContext(u).drawImage(t,-e,-o),sS.fromCanvas(u,n)}(t,n.getType(),e,o,r,i)})},resize:function T_(n,e,o){return n.toCanvas().then(function(t){return SS.scale(t,e,o).then(function(t){return sS.fromCanvas(t,n.getType())})})}},CS=(function(){function t(t){this.littleEndian=!1,this._dv=new DataView(t)}t.prototype.readByteAt=function(t){return this._dv.getUint8(t)},t.prototype.read=function(t,n){if(t+n>this.length())return null;for(var e=this.littleEndian?0:-8*(n-1),o=0,r=0;o<n;o++)r|=this.readByteAt(t+o)<<Math.abs(e+8*o);return r},t.prototype.BYTE=function(t){return this.read(t,1)},t.prototype.SHORT=function(t){return this.read(t,2)},t.prototype.LONG=function(t){return this.read(t,4)},t.prototype.SLONG=function(t){var n=this.read(t,4);return 2147483647<n?n-4294967296:n},t.prototype.CHAR=function(t){return String.fromCharCode(this.read(t,1))},t.prototype.STRING=function(t,n){return this.asArray("CHAR",t,n).join("")},t.prototype.SEGMENT=function(t,n){var e=this._dv.buffer;switch(arguments.length){case 2:return e.slice(t,t+n);case 1:return e.slice(t);default:return e}},t.prototype.asArray=function(t,n,e){for(var o=[],r=0;r<e;r++)o[r]=this[t](n+r);return o},t.prototype.length=function(){return this._dv?this._dv.byteLength:0}}(),function(t,n){return kS.rotate(t,n)}),OS=function(t){return wS.invert(t)},TS=function(t){return wS.sharpen(t)},ES=function(t,n){return wS.brightness(t,n)},BS=function(t,n){return wS.contrast(t,n)},AS=function(t,n,e,o){return wS.colorize(t,n,e,o)},DS=function(t,n){return wS.gamma(t,n)},_S=function(t,n){return kS.flip(t,n)},MS=function(t,n,e,o,r){return kS.crop(t,n,e,o,r)},FS=function(t,n,e){return kS.resize(t,n,e)},IS=CS,VS=function(t,n){return ao({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},RS=function(t,n){return VS(Cg(t,n),{})},HS=function(t,n){return VS(Cg(t,n),{behaviours:ra([wm.config({})])})},NS=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:ra([wm.config({})])}},PS=function(t,n,e,o,r){void 0===e&&(e=[]);var i=n.fold(function(){return{}},function(t){return{action:t}}),u=ao({buttonBehaviours:ra([Pp(t.disabled),Ab.config({}),rg("button press",[ci("click"),ci("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=wt(u,{dom:o});return wt(a,{components:r})},zS=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 RS(t,e.icons)}),u=qp([i]);return PS(t,n,o,r,u)},LS=function(t,n,e,o){void 0===o&&(o=[]);var r=zS(t,tt.some(n),e,o);return wg.sketch(r)},jS=function(t,n,e,o){void 0===o&&(o=[]);var r=e.translate(t.text),i=t.icon?t.icon.map(function(t){return RS(t,e.icons)}):tt.none(),u=i.isSome()?qp([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=PS(t,tt.some(n),e,o,r);return wg.sketch(i)}(t,n,o,ao({tag:"button",classes:c},a,{attributes:{title:r}}),u)},US=function(n,e){return function(t){"custom"===e?Gr(t,mv,{name:n,value:{}}):"submit"===e?Wr(t,gv):"cancel"===e?Wr(t,dv):x.console.error("Unknown button type: ",e)}},WS=function(t,n,e){var o=US(t.name,n);return jS(t,o,e,[])},GS=Z([Mr("field1Name","field1"),Mr("field2Name","field2"),qu("onLockedChange"),Wu(["lockClass"]),Mr("locked",!1),tf.field("coupledFieldBehaviours",[fl,Im])]),XS=function(t,i){return Bf({factory:wv,name:t,overrides:function(r){return{fieldBehaviours:ra([rg("coupled-input-behaviour",[si(Kt(),function(e){var t,n,o;(t=e,n=r,o=i,jf(t,n,o).bind(fl.getCurrent)).each(function(n){jf(e,r,"lock").each(function(t){$m.isOn(t)&&r.onLockedChange(e,n,t)})})})])])}}})},YS=Z([XS("field1","field2"),XS("field2","field1"),Bf({factory:wg,schema:[br("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:ra([$m.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),qS=ul({name:"FormCoupledInputs",configFields:GS(),partFields:YS(),factory:function(o,t,n,e){return{uid:o.uid,dom:o.dom,components:t,behaviours:tf.augment(o.coupledFieldBehaviours,[fl.config({find:tt.some}),Im.config({store:{mode:"manual",getValue:function(t){var n,e=Yf(t,o,["field1","field2"]);return(n={})[o.field1Name]=Im.getValue(e.field1()),n[o.field2Name]=Im.getValue(e.field2()),n},setValue:function(t,n){var e=Yf(t,o,["field1","field2"]);Dt(n,o.field1Name)&&Im.setValue(e.field1(),n[o.field1Name]),Dt(n,o.field2Name)&&Im.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return jf(t,o,"field1")},getField2:function(t){return jf(t,o,"field2")},getLock:function(t){return jf(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)}}}),KS=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 vt.error(t);var e=parseFloat(n[1]),o=n[2];return vt.value({value:e,unit:o})},JS=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?tt.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?tt.some(t.value):tt.some(t.value/e[t.unit]*e[n]):tt.none()},$S=function(t){return tt.none()},QS=function(t,n){var e=KS(t).toOption(),o=KS(n).toOption();return It([e,o],function(t,o){return JS(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return JS(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr($S)}).getOr($S)},ZS=function(o,n){var a=$S,r=io("ratio-event"),t=qS.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:Cg("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:Cg("unlock",n.icons)}}],buttonBehaviours:ra([Ab.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(e){return wv.parts().field({factory:db,inputClasses:["tox-textfield"],inputBehaviours:ra([Ab.config({}),rg("size-input-events",[si(Gt(),function(t,n){Gr(t,r,{isField1:e})}),si(Jt(),function(t,n){Gr(t,fv,{name:o.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=qS.parts().field1(e([wv.parts().label(u("Width")),i(!0)])),s=qS.parts().field2(e([wv.parts().label(u("Height")),i(!1)]));return qS.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,e([u(" "),t])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(t,i,n){KS(Im.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;Im.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:ra([Hp.config({}),rg("size-input-events2",[si(r,function(t,n){var e=n.event().isField1(),o=e?qS.getField1(t):qS.getField2(t),r=e?qS.getField2(t):qS.getField1(t),i=o.map(Im.getValue).getOr(""),u=r.map(Im.getValue).getOr("");a=QS(i,u)})])])})},tk={undo:Z(io("undo")),redo:Z(io("redo")),zoom:Z(io("zoom")),back:Z(io("back")),apply:Z(io("apply")),swap:Z(io("swap")),transform:Z(io("transform")),tempTransform:Z(io("temp-transform")),transformApply:Z(io("transform-apply"))},nk=Z("save-state"),ek=Z("disable"),ok=Z("enable"),rk={formActionEvent:mv,saveState:nk,disable:ek,enable:ok},ik=function(r,c){var t=function(t,n,e,o){return Sg(jS({name:t,text:t,disabled:e,primary:o},n,c))},n=function(t,n,e,o){return Sg(LS({name:t,icon:tt.some(t),tooltip:tt.some(n),disabled:o},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Hp)&&Hp.disable(n)})},a=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Hp)&&Hp.enable(n)})},s={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=tt.none(),o=Q,i=function(t,n,e){Gr(t,n,e)},f=function(t){return Wr(t,rk.disable())},l=function(t){return Wr(t,rk.enable())},d=function(t,n){f(t),i(t,tk.transform(),{transform:n}),l(t)},m=function(t){return function(){$.getOpt(t).each(function(t){wm.set(t,[K])})}},g=function(t,n){f(t),i(t,tk.transformApply(),{transform:n,swap:m(t)}),l(t)},p=function(){return t("Back",function(t){return i(t,tk.back(),{swap:m(t)})},!1,!1)},h=function(){return Sg({dom:{tag:"div",classes:["tox-spacer"]},behaviours:ra([Hp.config({})])})},v=function(){return t("Apply",function(t){return i(t,tk.apply(),{swap:m(t)})},!0,!0)},b=[p(),h(),t("Apply",function(t){g(t,function(t){var n=r.getRect();return MS(t,n.x,n.y,n.w,n.h)}),r.hideCrop()},!1,!0)],y=Qh.sketch({dom:s,components:b.map(function(t){return t.asSpec()}),containerBehaviours:ra([rg("image-tools-crop-buttons-events",[si(rk.disable(),function(t,n){u(b,t)}),si(rk.enable(),function(t,n){a(b,t)})])])}),x=Sg(ZS({name:"size",label:e,type:"sizeinput",constrain:!0},c)),w=[p(),h(),x,h(),t("Apply",function(a){x.getOpt(a).each(function(t){var n,e,o=Im.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return FS(t,n,e)});g(a,u)})},!1,!0)],S=Qh.sketch({dom:s,components:w.map(function(t){return t.asSpec()}),containerBehaviours:ra([rg("image-tools-resize-buttons-events",[si(rk.disable(),function(t,n){u(w,t)}),si(rk.enable(),function(t,n){a(w,t)})])])}),k=function(n,e){return function(t){return n(t,e)}},C=k(_S,"h"),O=k(_S,"v"),T=k(IS,-90),E=k(IS,90),B=function(t,n){var e,o;o=n,f(e=t),i(e,tk.tempTransform(),{transform:o}),l(e)},A=[p(),h(),n("flip-horizontally","Flip horizontally",function(t){B(t,C)},!1),n("flip-vertically","Flip vertically",function(t){B(t,O)},!1),n("rotate-left","Rotate counterclockwise",function(t){B(t,T)},!1),n("rotate-right","Rotate clockwise",function(t){B(t,E)},!1),h(),v()],D=Qh.sketch({dom:s,components:A.map(function(t){return t.asSpec()}),containerBehaviours:ra([rg("image-tools-fliprotate-buttons-events",[si(rk.disable(),function(t,n){u(A,t)}),si(rk.enable(),function(t,n){a(A,t)})])])}),_=function(t,n,e,o,r){var i=dw.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=dw.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=dw.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Sg(dw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:Z({x:Z(o)})},components:[i,u,a],sliderBehaviours:ra([Pm.config({})]),onChoose:n}))},M=function(t,n,e,o,r){return[p(),(i=t,u=n,a=e,c=o,s=r,_(i,function(t,n,e){var o=k(u,e.x()/100);d(t,o)},a,c,s)),v()];var i,u,a,c,s},F=function(t,n,e,o,r){var i=M(t,n,e,o,r);return Qh.sketch({dom:s,components:i.map(function(t){return t.asSpec()}),containerBehaviours:ra([rg("image-tools-filter-panel-buttons-events",[si(rk.disable(),function(t,n){u(i,t)}),si(rk.enable(),function(t,n){a(i,t)})])])})},I=[p(),h(),v()],V=Qh.sketch({dom:s,components:I.map(function(t){return t.asSpec()})}),R=F("Brightness",ES,-100,0,100),H=F("Contrast",BS,-100,0,100),N=F("Gamma",DS,-100,0,100),P=function(t){return _(t,function(f,t,n){var e=z.getOpt(f),o=j.getOpt(f),r=L.getOpt(f);e.each(function(s){o.each(function(c){r.each(function(t){var n,e,o,r=Im.getValue(s).x()/100,i=Im.getValue(t).x()/100,u=Im.getValue(c).x()/100,a=(n=r,e=i,o=u,function(t){return AS(t,n,e,o)});d(f,a)})})})},0,100,200)},z=P("R"),L=P("G"),j=P("B"),U=[p(),z,L,j,v()],W=Qh.sketch({dom:s,components:U.map(function(t){return t.asSpec()})}),G=function(n,e,o){return function(t){i(t,tk.swap(),{transform:e,swap:function(){$.getOpt(t).each(function(t){wm.set(t,[n]),o(t)})}})}},X=tt.some(TS),Y=tt.some(OS),q=[n("crop","Crop",G(y,e,function(t){r.showCrop()}),!1),n("resize","Resize",G(S,e,function(t){x.getOpt(t).each(function(t){var n=r.getMeasurements(),e=n.width,o=n.height;Im.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",G(D,e,o),!1),n("brightness","Brightness",G(R,e,o),!1),n("sharpen","Sharpen",G(V,X,o),!1),n("contrast","Contrast",G(H,e,o),!1),n("color-levels","Color levels",G(W,e,o),!1),n("gamma","Gamma",G(N,e,o),!1),n("invert","Invert",G(V,Y,o),!1)],K=Qh.sketch({dom:s,components:q.map(function(t){return t.asSpec()})}),J=Qh.sketch({dom:{tag:"div"},components:[K],containerBehaviours:ra([wm.config({})])}),$=Sg(J);return{memContainer:$,getApplyButton:function(t){return $.getOpt(t).map(function(t){var n=t.components()[0];return n.components()[n.components().length-1]})}}},uk=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),ak=tinymce.util.Tools.resolve("tinymce.geom.Rect"),ck=tinymce.util.Tools.resolve("tinymce.util.Observable"),sk=tinymce.util.Tools.resolve("tinymce.util.Tools"),fk=tinymce.util.Tools.resolve("tinymce.util.VK");function lk(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 dk(t,r){var i,u,n,a,c,f,l,d=r.document||x.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);lk(t),t.preventDefault(),u=t.button,n=m,f=t.screenX,l=t.screenY,e=x.window.getComputedStyle?x.window.getComputedStyle(n,null).getPropertyValue("cursor"):n.runtimeStyle.cursor,i=uk("<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),uk(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(lk(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){lk(t),uk(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){uk(m).off()},uk(m).on("mousedown touchstart",n)}var mk,gk,pk,hk=0,vk=function(n){var f=Sg({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),l=_t(1),d=_t(tt.none()),m=_t({x:0,y:0,w:1,h:1}),c=_t({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=l.get(),o=Sa(t.element()),r=Oa(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"};du(s,n),f.getOpt(t).each(function(t){du(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=Zn.fromTag("img");return Le(a,"src",n),(e=a.dom(),new Vg(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=Au({element:a});wm.replaceAt(t,1,tt.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=ak.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=Sa(t.element()),e=Oa(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=Qh.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[f.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:ra([rg("image-panel-crop-events",[bi(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-"+hk++;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=ak.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),uk("#"+c+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}sk.each(u,function(t){uk("#"+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(){uk('<div id="'+c+'" class="'+a+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),sk.each(i,function(t){uk("#"+c,o).append('<div id="'+c+"-"+t+'"class="'+a+'croprect-block" style="display: none" data-mce-bogus="all">')}),sk.each(u,function(t){uk("#"+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=sk.map(u,function t(n){var e;return new dk(c,{document:o.ownerDocument,handle:c+"-"+n.name,start:function(){e=s},drag:function(t){m(n,e,t.deltaX,t.deltaY)}})}),g(s),uk(o).on("focusin focusout",function(t){uk(t.target).attr("aria-grabbed","focus"===t.type?"true":"false")}),uk(o).on("keydown",function(n){var i;function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),m(i,e,o,r)}switch(sk.each(u,function(t){if(n.target.id===c+"-"+t.name)return i=t,!1}),n.keyCode){case fk.LEFT:t(n,0,s,-10,0);break;case fk.RIGHT:t(n,0,s,10,0);break;case fk.UP:t(n,0,s,0,-10);break;case fk.DOWN:t(n,0,s,0,10);break;case fk.ENTER:case fk.SPACEBAR:n.preventDefault(),r()}})}(),l=sk.extend({toggleVisibility:function b(t){var n;n=sk.map(u,function(t){return"#"+c+"-"+t.name}).concat(sk.map(i,function(t){return"#"+c+"-"+t})).join(","),t?uk(n,o).show():uk(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(){sk.each(n,function(t){t.destroy()}),n=[]}},ck)}({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(tt.some(n))})})])])}],containerBehaviours:ra([wm.config({}),rg("image-panel-events",[bi(function(t){e(t,n)})])])}),g=Sg(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}}}},bk=function(t,n,e,o,r){return LS({name:t,icon:tt.some(n),disabled:e,tooltip:tt.some(t)},o,r)},yk=function(t,n){n?Hp.enable(t):Hp.disable(t)},xk=function(t){var o=Sg(bk("Undo","undo",!0,function(t){Gr(t,tk.undo(),{direction:1})},t)),r=Sg(bk("Redo","redo",!0,function(t){Gr(t,tk.redo(),{direction:1})},t));return{container:Qh.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),bk("Zoom in","zoom-in",!1,function(t){Gr(t,tk.zoom(),{direction:1})},t),bk("Zoom out","zoom-out",!1,function(t){Gr(t,tk.zoom(),{direction:-1})},t)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){yk(t,n)}),r.getOpt(t).each(function(t){yk(t,e)})}}},wk=function(){return ue.getOrDie("URL")},Sk=function(t){return wk().createObjectURL(t)},kk=function(t){wk().revokeObjectURL(t)},Ck=function(t){var n=_t(t),e=_t(tt.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:Sk(t)}},a=function(t){kk(t.url)},o=function(){e.get().each(a),e.set(tt.none())},c=function(t){var n=u(t);i(n);var e,o=r.add(n).removed;return e=o,sk.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(tt.some(n)),n.url},addTempState:function(t){var n=u(t);return e.set(tt.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()}}}},Ok=function(t,n){var u=Ck(t.currentState),i=function(t){var n=u.getHistoryStates();g.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),Gr(t,rk.formActionEvent,{name:rk.saveState(),value:n.undoEnabled})},a=function(t){return t.toBlob()},c=function(t){Gr(t,rk.formActionEvent,{name:rk.disable(),value:{}})},s=function(t){e.getApplyButton(t).each(function(t){Hp.enable(t)}),Gr(t,rk.formActionEvent,{name:rk.enable(),value:{}})},f=function(t,n){return c(t),r.updateSrc(t,n)},l=function(n,t,e,o,r){return c(n),fS(t).then(e).then(a).then(o).then(function(t){return f(n,t).then(function(t){return i(n),r(),s(n),t})})["catch"](function(t){x.console.log(t),s(n)})},d=function(t,n,e){var o=u.getBlobState().blob;l(t,o,n,function(t){return u.updateTempState(t)},e)},m=function(t){var n=u.getBlobState().url;return u.destroyTempState(),i(t),n},r=vk(t.currentState.url),g=xk(n),e=ik(r,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[e.memContainer.asSpec(),r.memContainer.asSpec(),g.container],behaviours:ra([Im.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),rg("image-tools-events",[si(tk.undo(),function(n,t){var e=u.undo();f(n,e).then(function(t){s(n),i(n)})}),si(tk.redo(),function(n,t){var e=u.redo();f(n,e).then(function(t){s(n),i(n)})}),si(tk.zoom(),function(t,n){var e=n.event().direction();r.zoom(t,e)}),si(tk.back(),function(t,n){var e,o;o=m(e=t),f(e,o).then(function(t){s(e)}),n.event().swap()(),r.hideCrop()}),si(tk.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),si(tk.transform(),function(t,n){return d(t,n.event().transform(),Q)}),si(tk.tempTransform(),function(t,n){return e=t,o=n.event().transform(),r=u.getTempState().blob,void l(e,r,o,function(t){return u.addTempState(t)},Q);var e,o,r}),si(tk.transformApply(),function(t,n){return e=t,o=n.event().transform(),r=n.event().swap(),i=u.getBlobState().blob,void l(e,i,o,function(t){var n=u.addBlobState(t);return m(e),n},r);var e,o,r,i}),si(tk.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){d(n,t,r)})})]),Ow()])}},Tk=il({name:"HtmlSelect",configFields:[br("options"),$s("selectBehaviours",[Pm,Im]),Mr("selectClasses",[]),Mr("selectAttributes",{}),Tr("data")],factory:function(e,t){var n=_(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),o=e.data.map(function(t){return Et("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:n,behaviours:Zs(e.selectBehaviours,[Pm.config({}),Im.config({store:ao({mode:"manual",getValue:function(t){return xu(t.element())},setValue:function(t,n){H(e.options,function(t){return t.value===n}).isSome()&&wu(t.element(),n)}},o)})])}}}),Ek=function(e,n){var t=e.label.map(function(t){return ib(t,n)}),o=[hm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(t){return Wr(t,gv),tt.some(!0)}}),rg("textfield-change",[si(Kt(),function(t,n){Gr(t,fv,{name:e.name})}),si(_n(),function(t,n){Gr(t,fv,{name:e.name})})]),Ab.config({})],r=e.validation.map(function(o){return Tb.config({getRoot:function(t){return ye(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=Im.getValue(t),e=o.validator(n);return Fv.pure(!0===e?vt.value(n):vt.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=wv.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:e.placeholder.fold(function(){},function(t){return{placeholder:n.translate(t)}}),inputClasses:[e.classname],inputBehaviours:ra(L([o,r])),selectOnFocus:!1,factory:db}),u=e.flex?["tox-form__group--stretched"]:[];return nb(t,i,u)},Bk=function(i){return ao({},i,{toCached:function(){return Bk(i.toCached())},bindFuture:function(n){return Bk(i.bind(function(t){return t.fold(function(t){return Fv.pure(vt.error(t))},function(t){return n(t)})}))},bindResult:function(n){return Bk(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return Bk(i.map(function(t){return t.map(n)}))},mapError:function(n){return Bk(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 Bk(Fv.nu(function(n){var e=!1,o=x.setTimeout(function(){e=!0,n(vt.error(r()))},t);i.get(function(t){e||(x.clearTimeout(o),n(t))})}))}})},Ak=function(t){return Bk(Fv.nu(t))},Dk=Ak,_k={type:"separator"},Mk=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},Fk=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},Ik=function(t,n){return o=t,e=V(n,function(t){return t.type===o}),_(e,Mk);var e,o},Vk=function(t,n){var e=t.toLowerCase();return V(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return xn(n.toLowerCase(),e)||xn(t.value.toLowerCase(),e)})},Rk=function(c,t,s){var n=Im.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=Vk(f,(n=s.getHistory(c),_(n,function(t){return Fk(t,t)})));return"file"===c?(e=[a,Vk(f,(u=t,Ik("header",u.targets))),Vk(f,L([(i=t,tt.from(i.anchorTop).map(function(t){return Fk("<top>",t)}).toArray()),(r=t,Ik("anchor",r.targets)),(o=t,tt.from(o.anchorBottom).map(function(t){return Fk("<bottom>",t)}).toArray())]))],U(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat(_k,n)},[])):a})},Hk=function(i,u,o){var t,r=function(t){var n=Im.getValue(t);o.addToHistory(n.value,i.filetype)},n=wv.parts().field({factory:tb,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],minChars:0,responseTime:0,fetch:function(t){var n=Rk(i.filetype,t,o),e=lb(n,Xp.BUBBLE_TO_SANDBOX,u.providers);return Fv.pure(e)},getHotspot:function(t){return l.getOpt(t)},onSetValue:function(t,n){t.hasConfigured(Tb)&&Tb.run(t).get(Q)},typeaheadBehaviours:ra(L([o.getValidationHandler().map(function(o){return Tb.config({getRoot:function(t){return ye(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{},validator:{validate:function(n){var e=Im.getValue(n);return Dk(function(t){o({type:i.filetype,url:e.value},function(e){l.getOpt(n).each(function(t){var n=function(t,n,e){(e?ou:ru)(t.element(),n)};n(t,"tox-control-wrap--status-valid","valid"===e.status),n(t,"tox-control-wrap--status-unknown","unknown"===e.status)}),t(("invalid"===e.status?vt.error:vt.value)(e.message))})})},validateOnLoad:!1}})}).toArray(),[Ab.config({}),rg("urlinput-events",L(["file"===i.filetype?[si(Kt(),function(t){Gr(t,fv,{name:i.name})})]:[],[si(Jt(),function(t){Gr(t,fv,{name:i.name}),r(t)}),si(_n(),function(t){Gr(t,fv,{name:i.name}),r(t)})]]))]])),eventOrder:(t={},t[Kt()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:u.getSink,parts:{menu:dh(0,0,"normal")},onExecute:function(t,n,e){Gr(n,gv,{})},onItemExecute:function(t,n,e,o){r(t),Gr(t,fv,{name:i.name})}}),e=i.label.map(function(t){return ib(t,u.providers)}),a=function(t,n,e){return void 0===n&&(n=t),void 0===e&&(e=t),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+t],innerHtml:Cg(n,u.providers.icons),attributes:{title:u.providers.translate(e)}}}},c=Sg({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[a("valid","checkmark","valid"),a("unknown","warning"),a("invalid","warning")]}),s=o.getUrlPicker(i.filetype),f=io("browser.url.event"),l=Sg({dom:{tag:"div",classes:["tox-control-wrap"]},components:[n,c.asSpec()]});return wv.sketch({dom:rb([]),components:e.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:L([[l.asSpec()],s.map(function(){return t=i.label,n=f,e="tox-browse-url",o="browse",r=u.providers,wg.sketch({dom:{tag:"button",classes:["tox-tbtn",e],innerHtml:Cg(o,r.icons),attributes:{title:r.translate(t.getOr(""))}},buttonBehaviours:ra([Ab.config({})]),action:function(t){Wr(t,n)}});var t,n,e,o,r}).toArray()])}]),fieldBehaviours:ra([rg("url-input-events",[si(f,function(o){fl.getCurrent(o).each(function(n){var e=Im.getValue(n);s.each(function(t){t(e).get(function(t){Im.setValue(n,t),Gr(o,fv,{name:i.name})})})})})])])})},Nk=function(u,n){var t,e,o=u.label.map(function(t){return ib(t,n)}),r=function(e){return function(n,t){Ru(t.event().target(),"[data-collection-item-value]").each(function(t){e(n,t,Ue(t,"data-collection-item-value"))})}},i=[si(Wt(),r(function(t,n){Vl(n)})),si(Rn(),r(function(t,n,e){Gr(t,mv,{name:u.name,value:e})})),si(Gt(),r(function(t,n,e){Vu(t.element(),"."+gp).each(function(t){ru(t,gp)}),ou(n,gp)})),si(Xt(),r(function(t,n,e){Vu(t.element(),"."+gp).each(function(t){ru(t,gp)})})),wi(r(function(t,n,e){Gr(t,mv,{name:u.name,value:e})}))],a=wv.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==u.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:d},behaviours:ra([wm.config({}),Im.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){var n,e,r,i;n=o,e=_(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)?""":n)+'" title="'+i+'" aria-label="'+i+'">'+o+e+"</div>"}),r=1<u.columns&&"auto"!==u.columns?B(e,u.columns):[e],i=_(r,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"}),Me(n.element(),i.join("")),"auto"===u.columns&&qg(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;hm.setGridSize(o,n,e)}),Wr(o,bv)}}),Ab.config({}),hm.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?"."+sp:"."+cp}})),rg("collection-events",i)])});return nb(o,a,["tox-form__group--collection"])},Pk=function(r){return function(n,e,o){return Tt(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},zk={bar:Pk(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar"]},components:_(e.items,o.interpreter)};var e,o}),collection:Pk(function(t,n){return Nk(t,n.shared.providers)}),alloy:Pk(d),alertbanner:Pk(function(t,n){return e=t,o=n.shared.providers,Qh.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:[wg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:Cg(e.icon,o.icons),attributes:{title:o.translate(e.actionLabel)}},action:function(t){Gr(t,mv,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:Pk(function(t,n){return e=t,o=n.shared.providers,Ek({name:e.name,multiline:!1,label:e.label,placeholder:e.placeholder,flex:!1,classname:"tox-textfield",validation:tt.none()},o);var e,o}),textarea:Pk(function(t,n){return e=t,o=n.shared.providers,Ek({name:e.name,multiline:!0,label:e.label,placeholder:e.placeholder,flex:!0,classname:"tox-textarea",validation:tt.none()},o);var e,o}),listbox:Pk(function(t,n){return e=t,o=n.shared.providers,r=ib(e.label,o),i=wv.parts().field({factory:Tk,dom:{classes:["mce-select-field"]},selectBehaviours:ra([Ab.config({})]),options:e.values,data:e.initialValue.getOr(undefined)}),eb(tt.some(r),i);var e,o,r,i}),label:Pk(function(t,n){return e=t,o=n.shared,r={dom:{tag:"label",innerHtml:o.providers.translate(e.label),classes:["tox-label"]}},i=_(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:ra([Ow(),wm.config({}),Vw(tt.none()),hm.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(mk=function(t,n){return Xw(t,n.shared.providers)},function(t,n,e){var o=wt(n,{source:"dynamic"});return Pk(mk)(t,o,e)}),autocomplete:Pk(function(t,n){return r=t,i=n.shared,e=ib(r.label.getOr("?"),i.providers),o=wv.parts().field({factory:tb,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(t){var n=Im.getValue(t),e=r.getItems(n),o=lb(e,Xp.BUBBLE_TO_SANDBOX,i.providers);return Fv.pure(o)},markers:{openClass:"dog"},lazySink:i.getSink,parts:{menu:dh(0,0,"normal")}}),eb(tt.some(e),o);var r,i,e,o}),button:Pk(function(t,n){return e=t,o=n.shared.providers,r=US(e.name,"custom"),jS(e,r,o,[Rw(""),Ow()]);var e,o,r}),checkbox:Pk(function(t,n){return e=t,o=n.shared.providers,r=Im.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(),tt.some(!0)},u=wv.parts().field({factory:{sketch:d},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ra([Ow(),Ab.config({}),Pm.config({}),r,hm.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),rg("checkbox-events",[si(Jt(),function(t,n){Gr(t,fv,{name:e.name})})])])}),a=wv.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:ra([yy.config({})])}),s=Sg({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:Cg("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),wv.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a]});var e,o,r,i,u,a,c,s}),colorinput:Pk(function(t,n){return ky(t,n.shared,n.colorinput)}),colorpicker:Pk(function(t){var n=function(t){return"tox-"+t},e=Cw(Aw,n),r=Sg(e.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(t){Gr(t,mv,{name:"hex-valid",value:!0})},onInvalidHex:function(t){Gr(t,mv,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:ra([Im.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return fl.getCurrent(n).bind(function(t){return Im.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);fl.getCurrent(o).fold(function(){x.console.log("Can not find form")},function(t){Im.setValue(t,{hex:tt.from(e[1]).getOr("")}),vw.getField(t,"hex").each(function(t){Wr(t,Kt())})})}}}),Ow()])}}),dropzone:Pk(function(t,n){return Hw(t,n.shared.providers)}),grid:Pk(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:_(e.items,o.interpreter)};var e,o}),selectbox:Pk(function(t,n){return e=t,o=n.shared.providers,r=_(e.items,function(t){return{text:o.translate(t.text),value:t.value}}),i=e.label.map(function(t){return ib(t,o)}),u=wv.parts().field({dom:{},selectAttributes:{size:e.size},options:r,factory:Tk,selectBehaviours:ra([Ab.config({}),rg("selectbox-change",[si(Jt(),function(t,n){Gr(t,fv,{name:e.name})})])])}),a=1<e.size?tt.none():tt.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:Cg("chevron-down",o.icons)}}),c={dom:{tag:"div",classes:["tox-selectfield"]},components:L([[u],a.toArray()])},wv.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:L([i.toArray(),[c]])});var e,o,r,i,u,a,c}),sizeinput:Pk(function(t,n){return ZS(t,n.shared.providers)}),urlinput:Pk(function(t,n){return Hk(t,n.shared,n.urlinput)}),customeditor:Pk(function(n){var e=_t(tt.none()),o=Sg({dom:{tag:n.tag}}),r=_t(tt.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ra([rg("editor-foo-events",[bi(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(tt.none()),e.set(tt.some(n))})})})]),Im.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(tt.some(n))},function(t){return t.setValue(n)})}}}),Ow()]),components:[o.asSpec()]}}),htmlpanel:Pk(function(t){return"presentation"===t.presets?Qh.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):Qh.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:ra([Ab.config({}),Pm.config({})])})}),imagetools:Pk(function(t,n){return Ok(t,n.shared.providers)}),table:Pk(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:_(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:_(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:_(r,c)})],behaviours:ra([Ab.config({}),Pm.config({})])};var e,o,r,i,u,a,c})},Lk={field:function(t,n){return n}},jk=function(n,t,e){var o=wt(e,{shared:{interpreter:function(t){return Uk(n,t,o)}}});return Uk(n,t,o)},Uk=function(n,e,o){return Tt(zk,e.type).fold(function(){return x.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},Wk=function(t){return t.y()},Gk=function(t,n,e){return lc(t.x(),Wk(t),e.northeast(),Ma(),"layout-ne")},Xk=function(t,n,e){return lc((r=n,(o=t).x()+o.width()-r.width()),Wk(t),e.northwest(),Fa(),"layout-nw");var o,r},Yk=function(t,n,e){return lc((r=n,(o=t).x()+o.width()/2-r.width()/2),Wk(t),e.north(),Va(),"layout-n");var o,r},qk={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},Kk=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m=sv(t),g=function(){return Zn.fromDom(t.getBody())};return{toolbar:(f=g,l=n,d=m,d?function(){return{anchor:"node",root:f(),node:tt.from(f()),bubble:sc(-12,-12,qk),layouts:{onRtl:function(){return[Gk]},onLtr:function(){return[Xk]}}}}:function(){return{anchor:"hotspot",hotspot:l(),bubble:sc(-12,12,qk),layouts:{onRtl:function(){return[bc]},onLtr:function(){return[yc]}}}}),toolbarOverflow:(s=e,function(){return{anchor:"hotspot",hotspot:s(),layouts:{onRtl:function(){return[bc]},onLtr:function(){return[yc]}}}}),banner:(u=g,a=n,c=e,c?function(){return{anchor:"node",root:u(),node:tt.from(u()),layouts:{onRtl:function(){return[Yk]},onLtr:function(){return[Yk]}}}}:function(){return{anchor:"hotspot",hotspot:a(),layouts:{onRtl:function(){return[kc]},onLtr:function(){return[kc]}}}}),cursor:(r=t,i=g,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return tt.some(Rc(Zn.fromDom(t.startContainer),t.startOffset,Zn.fromDom(t.endContainer),t.endOffset))}}}),node:(o=g,function(t){return{anchor:"node",root:o(),node:t}})}},Jk=function(t){return{colorPicker:(o=t,function(t,n){py.colorPickerDialog(o)(t,n)}),hasCustomColors:(e=t,function(){return oy(e)}),getColors:(n=t,function(){return ry(n)})};var n,e,o},$k=[{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"}]}],Qk=function(t){return U(t,function(t,n){if(lt(n,"items")){var e=Qk(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(lt(n,"inline")||lt(n,"block")||lt(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 ao({},t,{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},Zk=function(i){return(t=i,tt.from(t.getParam("style_formats")).filter(A)).map(function(t){var n,e,o,r=(n=i,e=Qk(t),o=function(t){M(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")?$k.concat(r):r}).getOr($k);var t},tC=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return wt(t,o)},nC=function(s,t,f,l){var d=function(t){return _(t,function(t){var n,e,o,r,i,u,a=et(t);if(Dt(t,"items")){var c=d(t.items);return wt((i=t,u={type:"submenu",isSelected:Z(!1),getStylePreview:function(){return tt.none()}},wt(i,u)),{getStyleItems:function(){return c}})}return Dt(t,"format")?tC(t,f,l):1===a.length&&T(a,"title")?wt(t,{type:"separator"}):(e=io((n=t).title),o={type:"formatter",format:e,isSelected:f(e),getStylePreview:l(e)},r=wt(n,o),s.formatter.register(e,r),r)})};return d(t)},eC=sk.trim,oC=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}},rC=oC("true"),iC=oC("false"),uC=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},aC=function(t){return t.innerText||t.textContent},cC=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&fC(t);var n},sC=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},fC=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return rC(t)}return!1}(t)&&!iC(t)},lC=function(t){return sC(t)&&fC(t)},dC=function(t){var n,e,o=(n=t).id?n.id:io("h");return uC("header",aC(t),"#"+o,sC(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},mC=function(t){var n=t.id||t.name,e=aC(t);return uC("anchor",e||"#"+n,"#"+n,0,Q)},gC=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,_(Yc(Zn.fromDom(e),n),function(t){return t.dom()})},pC=function(t){return 0<eC(t.title).length},hC=function(t){var n,e=gC(t);return V((n=e,_(V(n,lC),dC)).concat(_(V(e,cC),mC)),pC)},vC="tinymce-url-history",bC=function(t){return S(t)&&/^https?/.test(t)},yC=function(t){return k(t)&&ct(t,function(t){return!(A(n=t)&&n.length<=5&&W(n,bC));var n}).isNone()},xC=function(){var t,n=x.localStorage.getItem(vC);if(null===n)return{};try{t=JSON.parse(n)}catch(e){if(e instanceof SyntaxError)return x.console.log("Local storage "+vC+" was not valid JSON",e),{};throw e}return yC(t)?t:(x.console.log("Local storage "+vC+" was not valid format",t),{})},wC=function(t){var n=xC();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},SC=function(n,t){if(bC(n)){var e=xC(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=V(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!yC(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));x.localStorage.setItem(vC,JSON.stringify(t))}(e)}},kC=Object.prototype.hasOwnProperty,CC=function(t){return!!t},OC=function(t){return it(sk.makeMap(t,/[, ]/),CC)},TC=function(t,n,e){var o,r,i=(o=t,r=n,kC.call(o,r)?tt.some(o[r]):tt.none()).getOr(e);return S(i)?tt.some(i):tt.none()},EC=function(t){return tt.some(t.file_picker_callback).filter(b)},BC=function(t,n){var e,o,r,i,u=(e=t,o=tt.some(e.file_picker_types).filter(CC),r=tt.some(e.file_browser_callback_types).filter(CC),i=o.or(r).map(OC),EC(e).fold(function(){return!1},function(t){return i.fold(function(){return!0},function(t){return 0<et(t).length&&t})}));return C(u)?u?EC(t):tt.none():u[n]?EC(t):tt.none()},AC=function(n){return{getHistory:wC,addToHistory:SC,getLinkInformation:function(){return!1===(t=n).settings.typeahead_urls?tt.none():tt.some({targets:hC(t.getBody()),anchorTop:TC(t.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:TC(t.settings,"anchor_bottom","#bottom").getOrUndefined()});var t},getValidationHandler:function(){return t=n.settings.filepicker_validator_handler,b(t)?tt.some(t):tt.none();var t},getUrlPicker:function(t){return i=t,BC((r=n).settings,i).map(function(o){return function(n){return Fv.nu(function(e){var t=sk.extend({filetype:i},tt.from(n.meta).getOr({}));o.call(r,function(t,n){if(!S(t))throw new Error("Expected value to be string");if(n!==undefined&&!k(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},DC=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m={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 Uk(Lk,t,m)},anchors:Kk(n,e,o),getSink:function(){return vt.value(t)}},urlinput:AC(n),styleselect:(r=n,i=function(t){return function(){return r.formatter.match(t)}},u=function(n){return function(){var t=r.formatter.get(n);return t!==undefined?tt.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:r.formatter.getCssText(n)}):tt.none()}},a=function(t){var n=t.items;return n!==undefined&&0<n.length?j(n,a):[t.format]},c=_t([]),s=_t([]),f=_t([]),l=_t([]),d=_t(!1),r.on("init",function(){var t=Zk(r),n=nC(r,t,i,u);c.set(n),s.set(j(n,a))}),r.on("addStyleModifications",function(t){var n=nC(r,t.items,i,u);f.set(n),d.set(t.replace),l.set(j(n,a))}),{getData:function(){var t=d.get()?[]:c.get(),n=f.get();return t.concat(n)},getFlattenedKeys:function(){var t=d.get()?[]:s.get(),n=l.get();return t.concat(n)}}),colorinput:Jk(n)};return m},_C=te("within","extra","withinWidth"),MC=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return tt.some({element:Z(t),start:Z(n),finish:Z(n+e),width:Z(e)})},U(t,function(n,t){return e(t,n.len).fold(Z(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=V(r,function(t){return t.finish()<=n}),u=R(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:Z(i),extra:Z(a),withinWidth:Z(u)}},FC=function(t){return _(t,function(t){return t.element()})},IC=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=MC(i,r,u),0===a.extra().length?tt.some(a):tt.none()).getOrThunk(function(){return MC(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=FC(v.concat(m)),_C(p,[],g)):1<=b.length?(s=b,f=o,l=y,d=FC(v).concat([f]),_C(d,FC(s),l)):(c=y,_C(FC(v),[],c))},VC=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},RC=function(t){return t.dimension.property},HC=function(t,n){return t.dimension.getDimension(n)},NC=function(t,n){var e=VC(t,n);au(e,[n.shrinkingClass,n.growingClass])},PC=function(t,n){ru(t.element(),n.openClass),ou(t.element(),n.closedClass),lu(t.element(),RC(n),"0px"),yu(t.element())},zC=function(t,n){ru(t.element(),n.closedClass),ou(t.element(),n.openClass),bu(t.element(),RC(n))},LC=function(t,n,e,o){e.setCollapsed(),lu(t.element(),RC(n),HC(n,t.element())),yu(t.element()),NC(t,n),PC(t,n),n.onStartShrink(t),n.onShrunk(t)},jC=function(t,n,e,o){var r=o.getOrThunk(function(){return HC(n,t.element())});e.setCollapsed(),lu(t.element(),RC(n),r),yu(t.element());var i=VC(t,n);ru(i,n.growingClass),ou(i,n.shrinkingClass),PC(t,n),n.onStartShrink(t)},UC=function(t,n,e){var o=HC(n,t.element());("0px"===o?LC:jC)(t,n,e,tt.some(o))},WC=function(t,n,e){var o=VC(t,n),r=iu(o,n.shrinkingClass),i=HC(n,t.element());zC(t,n);var u=HC(n,t.element());(r?function(){lu(t.element(),RC(n),i),yu(t.element())}:function(){PC(t,n)})(),ru(o,n.shrinkingClass),ou(o,n.growingClass),zC(t,n),lu(t.element(),RC(n),u),e.setExpanded(),n.onStartGrow(t)},GC=function(t,n,e){var o=VC(t,n);return!0===iu(o,n.growingClass)},XC=function(t,n,e){var o=VC(t,n);return!0===iu(o,n.shrinkingClass)},YC=/* */Object.freeze({refresh:function(t,n,e){if(e.isExpanded()){bu(t.element(),RC(n));var o=HC(n,t.element());lu(t.element(),RC(n),o)}},grow:function(t,n,e){e.isExpanded()||WC(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&UC(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&LC(t,n,e,tt.none())},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:GC,isShrinking:XC,isTransitioning:function(t,n,e){return!0===GC(t,n)||!0===XC(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?UC:WC)(t,n,e)},disableTransitions:NC}),qC=/* */Object.freeze({exhibit:function(t,n){var e=n.expanded;return Ui(e?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:Et(n.dimension.property,"0px")})},events:function(e,o){return ii([vi(Qt(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(NC(t,e),o.isExpanded()&&bu(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),KC=[br("closedClass"),br("openClass"),br("shrinkingClass"),br("growingClass"),Tr("getAnimationRoot"),Xu("onShrunk"),Xu("onStartShrink"),Xu("onGrown"),Xu("onStartGrow"),Mr("expanded",!1),yr("dimension",fr("property",{width:[Ju("property","width"),Ju("getDimension",function(t){return Sa(t)+"px"})],height:[Ju("property","height"),Ju("getDimension",function(t){return Oa(t)+"px"})]}))],JC=ua({fields:KC,name:"sliding",active:qC,apis:YC,state:/* */Object.freeze({init:function(t){var n=_t(t.expanded);return Li({isExpanded:function(){return!0===n.get()},isCollapsed:function(){return!1===n.get()},setCollapsed:v(n.set,!1),setExpanded:v(n.set,!0),readState:function(){return"expanded: "+n.get()}})}})}),$C=Z([Mr("shell",!0),$s("toolbarBehaviours",[wm])]),QC=Z([Df({name:"groups",overrides:function(t){return{behaviours:ra([wm.config({})])}}})]),ZC=ul({name:"Toolbar",configFields:$C(),partFields:QC(),factory:function(n,t,e,o){var r=function(t){return n.shell?tt.some(t):jf(t,n,"groups")},i=n.shell?{behaviours:[wm.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:i.components,behaviours:Zs(n.toolbarBehaviours,i.behaviours),apis:{setGroups:function(t,n){r(t).fold(function(){throw x.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){wm.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),tO=Z([Wu(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),$s("splitToolbarBehaviours",[]),zr("builtGroups",function(){return _t([])}),Mr("overflow",function(t){return tt.none()}),Hr("floating",!1)]),nO=[br("dom"),Mr("overflow",function(t){return tt.none()}),Hr("floating",!1)],eO=Z([Bf({factory:ZC,schema:nO,name:"primary"}),Df({factory:ZC,schema:nO,name:"overflow",overrides:function(n){return{toolbarBehaviours:ra([JC.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass}),hm.config({mode:"acyclic",onEscape:function(t){return jf(t,n,"overflow-button").each(hm.focusIn),tt.some(!0)}})])}}}),Af({name:"overflow-button",overrides:function(t){return{buttonBehaviours:ra([$m.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"}})])}}}),Af({name:"overflow-group"})]),oO=Z([br("items"),Wu(["itemSelector"]),$s("tgroupBehaviours",[hm])]),rO=Z([_f({name:"items",unit:"item"})]),iO=ul({name:"ToolbarGroup",configFields:oO(),partFields:rO(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,behaviours:Zs(t.tgroupBehaviours,[hm.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),uO=function(t,n){var e=_(n,function(t){return Mu(t)});ZC.setGroups(t,e)},aO=function(e,o,t,n){var r=Uf(e,o,"primary"),i=jf(e,o,"overflow").orThunk(function(){return o.overflow(e)});lu(r.element(),"visibility","hidden"),i.each(function(t){ZC.setGroups(t,[])});var u=o.builtGroups.get(),a=iO.sketch(ao({},t["overflow-group"](),{items:[wg.sketch(ao({},t["overflow-button"](),{action:function(t){!0===o.floating?Wr(e,n):i.each(function(t){JC.toggleGrow(t)})}}))]})),c=e.getSystem().build(a);uO(r,u.concat([c]));var s=Sa(r.element()),f=IC(s,u,function(t){return Sa(t.element())},c);0===f.extra().length?(wm.remove(r,c),i.each(function(t){ZC.setGroups(t,[])})):(uO(r,f.within()),i.each(function(t){uO(t,f.extra())})),bu(r.element(),"visibility"),yu(r.element()),i.each(function(n){o.floating||JC.refresh(n),jf(e,o,"overflow-button").each(function(t){o.floating?$m.set(t,n.getSystem().isConnected()):($m.set(t,JC.hasGrown(n)),hm.focusIn(n))})})},cO=ul({name:"SplitToolbar",configFields:tO(),partFields:eO(),factory:function(o,t,n,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:Zs(o.splitToolbarBehaviours,[]),apis:{setGroups:function(t,n){var e;e=_(n,t.getSystem().build),o.builtGroups.set(e),aO(t,o,r,i)},refresh:function(t){aO(t,o,r,i)},getMoreButton:function(t){return jf(t,o,"overflow-button")},getOverflow:function(t){return jf(n=t,o,"overflow").orThunk(function(){return o.overflow(n)});var n}},domModification:{attributes:{role:"group"}}}},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)}}}),sO=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:ao({tag:"div",classes:["tox-toolbar__group"]},n),components:[iO.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:ra([Ab.config({}),Pm.config({})])}},fO=function(t){return iO.sketch(sO(t))},lO=function(r,t,n){var e=bi(function(t){var n=_(r.initGroups,fO);ZC.setGroups(t,n)}),o=n.fold(function(){return[e]},function(o){return[e,si("alloy.toolbar.toggle",function(e,t){r.getSink().toOption().each(function(n){o.getOpt(n).fold(function(){var t=_u(o.asSpec());As(n,t),Ts.position(n,r.backstage.shared.anchors.toolbarOverflow(),t),cO.refresh(e),cO.getMoreButton(e).each(Pm.focus),hm.focusIn(t)},function(t){Ms(t)})})})]});return ra([hm.config({mode:t,onEscape:r.onEscape,selector:".tox-toolbar__group"}),rg("toolbar-events",o)])},dO=function(o){var t=o.cyclicKeying?"cyclic":"acyclic",n=Sg(ZC.sketch({dom:{tag:"div",classes:["tox-toolbar__overflow"]},toolbarBehaviours:ra([hm.config({mode:"cyclic",onEscape:function(){return Wr(o.moreDrawerData.lazyToolbar(),"alloy.toolbar.toggle"),hm.focusIn(o.moreDrawerData.lazyMoreButton()),tt.some(!0)}})])})),e=cO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),r=o.moreDrawerData.floating?[e]:[e,cO.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}})];return cO.sketch({uid:o.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},floating:o.moreDrawerData.floating,overflow:function(t){return o.getSink().toOption().bind(function(e){return n.getOpt(e).bind(function(n){return cO.getMoreButton(t).bind(function(t){return n.getSystem().isConnected()?(Ts.position(e,o.backstage.shared.anchors.toolbarOverflow(),n),tt.some(n)):tt.none()})})})},parts:{"overflow-group":sO({title:tt.none(),items:[]}),"overflow-button":zS({name:"more",icon:tt.some("more-drawer"),disabled:!1,tooltip:tt.some("More...")},tt.none(),o.backstage.shared.providers)},components:r,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"},splitToolbarBehaviours:lO(o,t,tt.some(n))})},mO=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return ZC.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[ZC.parts().groups({})],toolbarBehaviours:lO(t,n,tt.none())})},gO=[Hr("disabled",!1),Ar("tooltip"),Ar("icon"),Ar("text"),Nr("onSetup",function(){return Q})],pO=Go([xr("type"),Sr("onAction")].concat(gO)),hO=function(t){return ur("toolbarbutton",pO,t)},vO=Go([xr("type"),Ar("tooltip"),Ar("icon"),Ar("text"),Sr("fetch"),Nr("onSetup",function(){return Q})]),bO=function(t){return ur("menubutton",vO,t)},yO=Go([xr("type"),Ar("tooltip"),Ar("icon"),Ar("text"),Dr("select"),Sr("fetch"),Nr("onSetup",function(){return Q}),Rr("presets","normal",["normal","color","listpreview"]),Mr("columns",1),Sr("onAction"),Sr("onItemAction")]),xO=[Hr("active",!1)].concat(gO),wO=Go(xO.concat([xr("type"),Sr("onAction")])),SO=function(t){return ur("ToggleButton",wO,t)},kO=[Nr("predicate",function(){return!1}),Rr("scope","node",["node","editor"]),Rr("position","selection",["node","selection","line"])],CO=gO.concat([Mr("type","contextformbutton"),Mr("primary",!1),Sr("onAction"),zr("original",d)]),OO=xO.concat([Mr("type","contextformbutton"),Mr("primary",!1),Sr("onAction"),zr("original",d)]),TO=gO.concat([Mr("type","contextformbutton")]),EO=xO.concat([Mr("type","contextformtogglebutton")]),BO=fr("type",{contextformbutton:CO,contextformtogglebutton:OO}),AO=Go([Mr("type","contextform"),Nr("initValue",function(){return""}),Ar("label"),Or("commands",BO),Er("launch",fr("type",{contextformbutton:TO,contextformtogglebutton:EO}))].concat(kO)),DO=Go([Mr("type","contexttoolbar"),xr("items")].concat(kO)),_O=io("toolbar.button.execute"),MO={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},FO=/* */Object.freeze({getState:function(t,n,e){return e}}),IO=/* */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());Fs(e),M(n,function(t){As(e,e.getSystem().build(t))})})};return ii([si(Mn(),function(t,n){var e=r.channel;T(n.channels(),e)&&o(t,n.data())}),bi(function(n,t){r.initialData.each(function(t){o(n,t)})})])}}),VO=/* */Object.freeze({init:function(t){var n=_t(tt.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(tt.none())}}}}),RO=[br("channel"),Tr("renderComponents"),Tr("updateState"),Tr("initialData")],HO=ua({fields:RO,name:"reflecting",active:IO,apis:FO,state:VO}),NO=Z([br("toggleClass"),br("fetch"),qu("onExecute"),Mr("getHotspot",tt.some),Mr("layouts",tt.none()),qu("onItemExecute"),Tr("lazySink"),br("dom"),Xu("onOpen"),$s("splitDropdownBehaviours",[Cv,hm,Pm]),Mr("matchWidth",!1),Mr("useMinWidth",!1),Mr("eventOrder",{}),Tr("role")].concat($v())),PO=Bf({factory:wg,schema:[br("dom")],name:"arrow",defaults:function(t){return{buttonBehaviours:ra([Pm.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(Xr)},buttonBehaviours:ra([$m.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),zO=Bf({factory:wg,schema:[br("dom")],name:"button",defaults:function(t){return{buttonBehaviours:ra([Pm.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)})}}}}),LO=Z([PO,zO,Df({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[br("text")],name:"aria-descriptor"}),Af({schema:[Uu()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),Vv()]),jO=ul({name:"SplitDropdown",configFields:NO(),partFields:LO(),factory:function(o,t,n,e){var r=function(t){fl.getCurrent(t).each(function(t){kl.highlightFirst(t),hm.focusIn(t)})},i=function(t){Pv(o,function(t){return t},t,e,r,iv.HighlightFirst).get(Q)},u=function(t){var n=Uf(t,o,"button");return Xr(n),tt.some(!0)},a=St(ii([bi(function(e,t){jf(e,o,"aria-descriptor").each(function(t){var n=io("aria");Le(t.element(),"id",n),Le(e.element(),"aria-describedby",n)})})]),xg(tt.some(i)));return{uid:o.uid,dom:o.dom,components:t,eventOrder:ao({},o.eventOrder,{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:Zs(o.splitDropdownBehaviours,[Cv.config({others:{sandbox:function(t){var n=Uf(t,o,"arrow");return jv(o,t,{onOpen:function(){$m.on(n),$m.on(t)},onClose:function(){$m.off(n),$m.off(t)}})}}}),hm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),tt.some(!0)}}),Pm.config({}),$m.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),UO=io("update-menu-text"),WO=io("update-menu-icon"),GO=function(t,n,o){var e=_t(Q),r=t.text.map(function(t){return Sg(NS(t,n,o.providers))}),i=t.icon.map(function(t){return Sg(HS(t,o.providers.icons))}),u=function(t,n){var e=Im.getValue(t);return Pm.focus(e),Gr(e,"keydown",{raw:n.event().raw()}),by.close(e),tt.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 Sg(by.sketch(ao({},a,{dom:{tag:"button",classes:[n,n+"--select"].concat(_(t.classes,function(t){return n+"--"+t})),attributes:ao({},c)},components:qp([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),tt.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:Cg("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:ra(t.dropdownBehaviours.concat([Pp(t.disabled),yy.config({}),wm.config({}),rg("dropdown-events",[jp(t,e),Up(t,e)]),rg("menubutton-update-display-text",[si(UO,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){wm.set(t,[Bu(o.providers.translate(e.event().text()))])})}),si(WO,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){wm.set(t,[HS(e.event().icon(),o.providers.icons)])})})])])),eventOrder:wt(MO,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:ra([hm.config({mode:"special",onLeft:u,onRight:u})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:dh(0,t.columns,t.presets)},fetch:function(){return Fv.nu(t.fetch)}}))).asSpec()},XO=function(n){return{isDisabled:function(){return Hp.isDisabled(n)},setDisabled:function(t){return Hp.set(n,t)}}},YO=function(n){return{setActive:function(t){$m.set(n,t)},isActive:function(){return $m.isOn(n)},isDisabled:function(){return Hp.isDisabled(n)},setDisabled:function(t){return Hp.set(n,t)}}},qO=function(e){return{isDisabled:function(){return Hp.isDisabled(e)},setDisabled:function(t){return Hp.set(e,t)},setActive:function(t){var n=e.element();t?(ou(n,"tox-tbtn--enabled"),Le(n,"aria-pressed",!0)):(ru(n,"tox-tbtn--enabled"),Ge(n,"aria-pressed"))},isActive:function(){return iu(e.element(),"tox-tbtn--enabled")}}},KO=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},JO=io("focus-button"),$O=function(n,e,t,o,r,i){var u;return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]),attributes:KO(t,i)},components:qp([n.map(function(t){return RS(t,i.icons)}),e.map(function(t){return NS(t,"tox-tbtn",i)})]),eventOrder:(u={},u[zt()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:ra([rg("common-button-display-events",[si(zt(),function(t,n){n.event().prevent(),Wr(t,JO)})])].concat(o.map(function(t){return HO.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t,n){return qp([t.icon.map(function(t){return RS(t,i.icons)}),t.text.map(function(t){return NS(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},QO=function(t,n,e){var o,r=_t(Q),i=$O(t.icon,t.text,t.tooltip,tt.none(),tt.none(),e);return wg.sketch({dom:i.dom,components:i.components,eventOrder:MO,buttonBehaviours:ra([rg("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},wi(function(n,t){Lp(o,n)(function(t){Gr(n,_O,{buttonApi:t}),o.onAction(t)})})),jp(n,r),Up(n,r)]),Pp(t.disabled)].concat(n.toolbarButtonBehaviours))})},ZO=function(t,n,e){return QO(t,{toolbarButtonBehaviours:[].concat(0<e.length?[rg("toolbarButtonWith",e)]:[]),getApi:XO,onSetup:t.onSetup},n)},tT=function(t,n,e){return wt(QO(t,{toolbarButtonBehaviours:[wm.config({}),$m.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[rg("toolbarToggleButtonWith",e)]:[]),getApi:YO,onSetup:t.onSetup},n))},nT=function(n,t){var e,o,r,i,u=io("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return Hp.isDisabled(e)},setDisabled:function(t){return Hp.set(e,t)},setIconFill:function(t,n){Vu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Le(t,"fill",n)})},setIconStroke:function(t,n){Vu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Le(t,"stroke",n)})},setActive:function(n){Le(e.element(),"aria-pressed",n),Vu(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return $m.set(t,n)})})},isActive:function(){return Vu(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists($m.isOn)})}}},c=_t(Q),s={getApi:a,onSetup:n.onSetup};return jO.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:St({"aria-pressed":!1},KO(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(t,n,e){},splitDropdownBehaviours:ra([zp(!1),rg("split-dropdown-events",[si(JO,Pm.focus),jp(s,c),Up(s,c)])]),eventOrder:(e={},e[Un()]=["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 Fv.nu(function(t){return r.fetch(t)}).map(function(t){return tt.from(Oh(wt(kh(io("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,Xp.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:mh(r.columns,r.presets),menuBehaviours:Jg("auto"!==r.columns?[]:[bi(function(o,t){qg(o,4,pp(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;hm.setGridSize(o,n,e)})})])})))})}),parts:{menu:dh(0,n.columns,n.presets)},components:[jO.parts().button($O(n.icon,n.text,tt.none(),tt.some(u),tt.some([$m.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),jO.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:Cg("chevron-down",t.providers.icons)}}),jO.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},eT=function(t,n,e,o){return GO({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(lb(t,Xp.CLOSE_ON_EXECUTE,e.providers))})},onSetup:t.onSetup,getApi:qO,columns:1,presets:"normal",classes:[],dropdownBehaviours:[]},n,e)},oT=function(i,u){return si(_O,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return Wr(e,Nn())},getValue:function(){return Im.getValue(e)}});u.onAction(r,n.event().buttonApi())})},rT=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=co(d,["primary"]),g=ar(SO(ao({},m,{type:"togglebutton",onAction:function(){}}))),tT(g,l.backstage.shared.providers,[oT(s,f)])):(o=t,i=p,(u=(r=n).original).primary,a=co(u,["primary"]),c=ar(hO(ao({},a,{type:"button",onAction:function(){}}))),ZO(c,i.backstage.shared.providers,[oT(o,r)]))},iT=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=Sg(db.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:ra([hm.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return Xr(t),!0})},onLeft:function(t,n){return n.cut(),tt.none()},onRight:function(t,n){return n.cut(),tt.none()}})])})),c=(e=a,o=t.commands,r=n.shared.providers,i=_(o,function(t){return Sg(rT(e,t,r))}),{asSpecs:function(){return _(i,function(t){return t.asSpec()})},findPrimary:function(e){return Ft(o,function(t,n){return t.primary?tt.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(w(Hp.isDisabled)):tt.none()})}});return mO({uid:io("context-toolbar"),initGroups:[{title:tt.none(),items:[a.asSpec()]},{title:tt.none(),items:c.asSpecs()}],onEscape:tt.none,cyclicKeying:!0,backstage:n,getSink:function(){return vt.error("")}})},uT=io("forward-slide"),aT=io("backward-slide"),cT=io("change-slide-event"),sT="tox-pop--resizing",fT=function(n,t){return Ft(t,function(t){return t.predicate(n.dom())?tt.some({toolbarApi:t,elem:n}):tt.none()})},lT=function(n,e){var t=function(t){return t.dom()===e.getBody()},o=Zn.fromDom(e.selection.getNode());return fT(o,n.inNodeScope).orThunk(function(){return fT(o,n.inEditorScope).orThunk(function(){return function(t,n,e){for(var o=t.dom(),r=b(e)?e:Z(!1);o.parentNode;){o=o.parentNode;var i=Zn.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return tt.none()}(o,function(t){return fT(t,n.inNodeScope)},t)})})},dT=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=ar(ur("ContextForm",AO,e));(t[n]=o).launch.map(function(t){a["form:"+n]=ao({},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,ur("ContextToolbar",DO,t)).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=et(e);return M(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}},mT=function(o,r){return function(n){var e=_t(tt.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(tt.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},gT=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},pT=function(t,n,e,o){var i,u,r,a,c,s="basic"===e.type?function(){return _(e.data,function(t){return tC(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 tt.some({type:"separator",text:o});if("submenu"!==t.type)return tt.some(ao({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=j(t.getStyleItems(),function(t){return a(t,n)});return 0===n&&r.length<=0?tt.none():tt.some({type:"nestedmenuitem",text:o,disabled:r.length<=0,getSubmenuItems:function(){return j(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 j(t,function(t){return a(t,n)})},{validateItems:c,getFetch:function(o,r){return function(t){var n=r(),e=c(n);t(lb(e,Xp.CLOSE_ON_EXECUTE,o.shared.providers))}}}),getStyleItems:s}},hT=function(o,t,n,r){var e=pT(0,t,n,r),i=e.items,u=e.getStyleItems;return GO({text:r.icon.isSome()?tt.none():tt.some(""),icon:r.icon,tooltip:tt.from(r.tooltip),role:tt.none(),fetch:i.getFetch(t,u),onSetup:function(e){return r.nodeChangeHandler.map(function(t){var n=t(e.getComponent());return o.on("NodeChange",n),function(){o.off("NodeChange",n)}}).getOr(Q)},getApi:function(t){return{getComponent:function(){return t}}},columns:1,presets:"normal",classes:r.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};(pk=gk||(gk={}))[pk.SemiColon=0]="SemiColon",pk[pk.Space=1]="Space";var vT,bT,yT=function(t,n,e,o){var r,i,u=Tt(t.settings,n).getOr(e);return{type:"basic",data:(i=u,r=o===gk.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),_(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}}))}},xT=[{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"}],wT=function(e){var t=tt.some(function(n){return function(){var t=H(xT,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});Gr(n,WO,{icon:"align-"+t})}}),n={type:"basic",data:xT};return{tooltip:"Align",icon:tt.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getPreviewFor:function(t){return function(){return tt.none()}},onAction:gT(e),nodeChangeHandler:t,dataset:n,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},ST=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],kT=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 H(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*['"]?/),W(ST,function(t){return-1<n.indexOf(t.toLowerCase())}))?tt.from({title:"System Font",format:o}):tt.none();var t,n})},t=tt.some(function(e){return function(){var t=r.queryCommandValue("FontName"),n=o().fold(function(){return t},function(t){return t.title});Gr(e,UO,{text:n})}}),i=yT(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",gk.SemiColon);return{tooltip:"Fonts",icon:tt.none(),isSelectedFor:function(n){return function(){return o().exists(function(t){return t.format===n})}},getPreviewFor:function(t){return function(){return tt.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)})}},nodeChangeHandler:t,dataset:i,shouldHide:!1,isInvalid:function(){return!1}}},CT=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},OT=function(i){var u=function(){var e=tt.none(),o=a.data,r=i.queryCommandValue("FontSize");if(r)for(var t=function(t){var n=CT(r,t);e=H(o,function(t){return t.format===r||t.format===n})},n=3;e.isNone()&&0<=n;n--)t(n);return{matchOpt:e,px:r}},t=tt.some(function(r){return function(){var t=u(),n=t.matchOpt,e=t.px,o=n.fold(function(){return e},function(t){return t.title});Gr(r,UO,{text:o})}}),a=yT(i,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",gk.Space);return{tooltip:"Font sizes",icon:tt.none(),isSelectedFor:function(n){return function(){return u().matchOpt.exists(function(t){return t.format===n})}},getPreviewFor:function(){return function(){return tt.none()}},onAction:function(t){return function(){i.undoManager.transact(function(){i.focus(),i.execCommand("FontSize",!1,t.format)})}},nodeChangeHandler:t,dataset:a,shouldHide:!1,isInvalid:function(){return!1}}},TT=function(e,t,n){var o=n.parents,r=t();return Ft(o,function(n){return H(r,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?tt.some({title:"Paragraph",format:"p"}):tt.none()})},ET=function(o){var t=tt.some(function(e){return function(t){var n=TT(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});Gr(e,UO,{text:n})}}),r=yT(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",gk.SemiColon);return{tooltip:"Blocks",icon:tt.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return tt.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:o.formatter.getCssText(n)})}},onAction:gT(o),nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},BT=function(i){var t=tt.some(function(e){var o=function(t){var n=t.items;return n!==undefined&&0<n.length?j(n,o):[{title:t.title,format:t.format}]},r=j(Zk(i),o);return function(t){var n=TT(i,function(){return r},t).fold(function(){return"Paragraph"},function(t){return t.title});Gr(e,UO,{text:n})}});return{tooltip:"Formats",icon:tt.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?tt.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:i.formatter.getCssText(n)}):tt.none()}},onAction:gT(i),nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)}}},AT=[{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"]}],DT=function(o,r){return function(t,n){var e=o(t).mapError(function(t){return sr(t)}).getOrDie();return r(e,n)}},_T={button:DT(hO,function(t,n){return e=t,o=n.backstage.shared.providers,ZO(e,o,[]);var e,o}),togglebutton:DT(SO,function(t,n){return e=t,o=n.backstage.shared.providers,tT(e,o,[]);var e,o}),menubutton:DT(bO,function(t,n){return eT(t,"tox-tbtn",n.backstage.shared,tt.none())}),splitbutton:DT(function(t){return ur("SplitButton",yO,t)},function(t,n){return nT(t,n.backstage.shared)}),styleSelectButton:function(t,n){return e=t,o=n.backstage,r=o.styleselect,hT(e,o,r,BT(e));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,r=OT(e),hT(e,o,r.dataset,r);var e,o,r},fontSelectButton:function(t,n){return e=t,o=n.backstage,r=kT(e),hT(e,o,r.dataset,r);var e,o,r},formatButton:function(t,n){return e=t,o=n.backstage,r=ET(e),hT(e,o,r.dataset,r);var e,o,r},alignMenuButton:function(t,n){return e=t,o=n.backstage,r=wT(e),hT(e,o,r.dataset,r);var e,o,r}},MT={styleselect:_T.styleSelectButton,fontsizeselect:_T.fontsizeSelectButton,fontselect:_T.fontSelectButton,formatselect:_T.formatButton,align:_T.alignMenuButton},FT=function(t){var n=t.split("|");return _(n,function(t){return{items:t.trim().split(" ")}})},IT=function(t){return!1===t.toolbar?[]:t.toolbar===undefined||!0===t.toolbar?(e=t.buttons,n=_(AT,function(t){var n=V(t.items,function(t){return lt(e,t)||lt(MT,t)});return{name:t.name,items:n}}),V(n,function(t){return 0<t.items.length})):S(t.toolbar)?FT(t.toolbar):A(t.toolbar)&&S(t.toolbar[0])?FT(t.toolbar.join(" | ")):t.toolbar;var e,n},VT=function(n,e,o,r,t){return ft(e,o.toLowerCase()).orThunk(function(){return t.bind(function(t){return Ft(t,function(t){return ft(e,t+o.toLowerCase())})})}).fold(function(){return ft(MT,o.toLowerCase()).map(function(t){return t(n,r)}).orThunk(function(){return tt.none()})},function(t){return e=r,ft(_T,(n=t).type).fold(function(){return x.console.error("skipping button defined by",n),tt.none()},function(t){return tt.some(t(n,e))});var n,e})},RT=function(e,o,r,i){var t=IT(o),n=_(t,function(t){var n=j(t.items,function(t){return 0===t.trim().length?[]:VT(e,o.buttons,t,r,i).toArray()});return{title:tt.from(e.translate(t.name)),items:n}});return V(n,function(t){return 0<t.items.length})},HT=function(i,t,u,c){var e,o,s=_u((e={sink:u,onEscape:function(){return i.focus(),tt.some(!0)}},o=_t([]),yg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){o.set([]),yg.getContent(t).each(function(t){bu(t.element(),"visibility")}),ru(t.element(),sT),bu(t.element(),"width")},inlineBehaviours:ra([rg("context-toolbar-events",[vi(Qt(),function(t,n){yg.getContent(t).each(function(t){}),ru(t.element(),sT),bu(t.element(),"width")}),si(cT,function(n,e){bu(n.element(),"width");var t=Sa(n.element());yg.setContent(n,e.event().contents()),ou(n.element(),sT);var o=Sa(n.element());lu(n.element(),"width",t+"px"),yg.getContent(n).each(function(t){e.event().focus().bind(function(t){return Vl(t),Hl(n.element())}).orThunk(function(){return hm.focusIn(t),Rl()})}),Eg.setTimeout(function(){lu(n.element(),"width",o+"px")},0)}),si(uT,function(t,n){yg.getContent(t).each(function(t){o.set(o.get().concat([{bar:t,focus:Rl()}]))}),Gr(t,cT,{contents:n.event().forwardContents(),focus:tt.none()})}),si(aT,function(n,t){$(o.get()).each(function(t){o.set(o.get().slice(0,o.get().length-1)),Gr(n,cT,{contents:Mu(t.bar),focus:t.focus})})})]),hm.config({mode:"special",onEscape:function(n){return $(o.get()).fold(function(){return e.onEscape()},function(t){return Wr(n,aT),tt.some(!0)})}})]),lazySink:function(){return vt.value(e.sink)}}))),f=function(){return tt.some(Zn.fromDom(i.contentAreaContainer))};i.on("init",function(){var t=i.getBody().ownerDocument.defaultView,n=_h(Zn.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?lu(s.element(),"display","none"):(bu(s.element(),"display"),Ts.positionWithin(u,t,s,f()))})});i.on("remove",function(){n.unbind()})});var l=_t(tt.none()),d=_t(tt.none()),n=_t(null),m=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:ra([hm.config({mode:"acyclic"}),rg("pop-dialog-wrap-events",[bi(function(t){i.shortcuts.add("ctrl+F9","focus statusbar",function(){return hm.focusIn(t)})}),yi(function(t){i.shortcuts.remove("ctrl+F9")})])])}},a=tn(function(){return dT(t,function(t){var n=g(t);Gr(s,uT,{forwardContents:m(n)})})}),g=function(t){var n,e,o=i.ui.registry.getAll().buttons,r=a();return"contexttoolbar"===t.type?(n=St(o,r.formNavigators),e=RT(i,{buttons:n,toolbar:t.items},c,tt.some(["form:"])),mO({uid:io("context-toolbar"),initGroups:e,onEscape:tt.none,cyclicKeying:!0,backstage:c.backstage,getSink:function(){return vt.error("")}})):iT(t,c.backstage)};i.on("contexttoolbar-show",function(n){var t=a();Tt(t.lookupTable,n.toolbarKey).each(function(t){b(t,n.target===i?tt.none():tt.some(n)),yg.getContent(s).each(hm.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:rc()},h={bubble:sc(12,0,r),layouts:{onLtr:function(){return[Cc]},onRtl:function(){return[Oc]}},overrides:p},v={bubble:sc(0,12,r),layouts:{onLtr:function(){return[Sc,kc,xc,bc,wc,yc]},onRtl:function(){return[Sc,kc,wc,yc,xc,bc]}},overrides:p},b=function(t,n){x();var e,o,r,i=g(t),u=n.map(Zn.fromDom),a=(e=t.position,o=u,r="node"===e?c.backstage.shared.anchors.node(o):c.backstage.shared.anchors.cursor(),wt(r,"line"===e?h:v));l.set(tt.some(a)),d.set(n),yg.showWithin(s,a,m(i),f()),bu(s.element(),"display")},y=function(){var t=a();lT(t,i).fold(function(){l.set(tt.none()),yg.hide(s)},function(t){b(t.toolbarApi,tt.some(t.elem.dom()))})},x=function(){var t=n.get();null!==t&&(Eg.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(Eg.setEditorTimeout(i,y,0))}),i.on("focusout",function(t){Eg.setEditorTimeout(i,function(){Hl(u.element()).isNone()&&Hl(s.element()).isNone()&&(l.set(tt.none()),yg.hide(s))},0)}),i.on("NodeChange",function(t){Hl(s.element()).fold(function(){w(Eg.setEditorTimeout(i,y,0))},function(t){})})})},NT=function(t,e,o){var n=_h(Zn.fromDom(x.document),"mousedown",function(n){M([e,o],function(t){t.broadcastOn([Xs()],{target:n.target()})})}),r=_h(Zn.fromDom(x.document),"touchstart",function(n){M([e,o],function(t){t.broadcastOn([Xs()],{target:n.target()})})}),i=_h(Zn.fromDom(x.document),"mouseup",function(n){0===n.raw().button&&M([e,o],function(t){t.broadcastOn([Ys()],{target:n.target()})})}),u=function(n){M([e,o],function(t){t.broadcastOn([Xs()],{target:Zn.fromDom(n.target)})})};t.on("mousedown",u),t.on("touchstart",u);var a=function(n){0===n.button&&M([e,o],function(t){t.broadcastOn([Ys()],{target:Zn.fromDom(n.target)})})};t.on("mouseup",a);var c=function(n){M([e,o],function(t){t.broadcastEvent(Ln(),n)})};t.on("ScrollWindow",c);var s=function(n){M([e,o],function(t){t.broadcastEvent(jn(),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(){Rs(e),Rs(o),e.destroy(),o.destroy()})},PT=Jf,zT=Ff,LT=il({factory:function(o,t){var n={focus:hm.focusIn,setMenus:function(t,n){var e=_(n,function(n){var t={type:"menubutton",text:n.text,fetch:function(t){t(n.getItems())}},e=bO(t).mapError(function(t){return sr(t)}).getOrDie();return eT(e,"tox-mbtn",{getSink:o.getSink,providers:o.providers},tt.some("menuitem"))});wm.set(t,e)}};return{uid:o.uid,dom:o.dom,components:[],behaviours:ra([wm.config({}),rg("menubar-events",[bi(function(t){o.onSetup(t)}),si(Wt(),function(e,t){Vu(e.element(),".tox-mbtn--active").each(function(n){Ru(t.event().target(),".tox-mbtn").each(function(t){he(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){by.expand(t),by.close(n),Pm.focus(t)})})})})}),si(Xn(),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){by.isOpen(n)&&(by.expand(t),by.close(n))})})})]),hm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return o.onEscape(t),tt.some(!0)}}),Ab.config({})]),apis:n,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[br("dom"),br("uid"),br("onEscape"),br("getSink"),br("providers"),Mr("onSetup",Q)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),jT="container",UT=[$s("slotBehaviours",[])],WT=function(t){return"<alloy.field."+t+">"},GT=function(r,t,n){var e,o=function(t){return Xf(r)},i=function(e,o){return void 0===o&&(o=undefined),function(t,n){return jf(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},u=function(t,n){return"true"!==Ue(t.element(),"aria-hidden")},a=i(u,!1),c=i(function(t,n){if(u(t)){var e=t.element();lu(e,"display","none"),Le(e,"aria-hidden","true"),Gr(t,Yn(),{name:n,visible:!1})}}),s=(e=c,function(n,t){M(t,function(t){return e(n,t)})}),f=i(function(t,n){if(!u(t)){var e=t.element();bu(e,"display"),Ge(e,"aria-hidden"),Gr(t,Yn(),{name:n,visible:!0})}}),l={getSlotNames:o,getSlot:function(t,n){return jf(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:Qs(r.slotBehaviours),apis:l}},XT=it({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)}},Pi),YT=ao({},XT,{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),Hf(jT,WT(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=_(r,function(t){return Bf({name:t,pname:WT(t)})});return Qf(jT,UT,i,GT,o)}}),qT=Go([Ar("icon"),Ar("tooltip"),Nr("onShow",Q),Nr("onHide",Q),Nr("onSetup",function(){return Q})]),KT=function(t){return{element:function(){return t.element().dom()}}},JT=function(e,o){var r=_(et(o),function(t){var n=o[t],e=ar(ur("sidebar",qT,n));return{name:t,getApi:KT,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return _(r,function(t){var n=_t(Q);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Jg([jp(t,n),Up(t,n),si(Yn(),function(n,t){var e=t.event();H(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},$T=function(t,e){fl.getCurrent(t).each(function(t){return wm.set(t,[(n=e,YT.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:JT(t,n),slotBehaviours:Jg([bi(function(t){return YT.hideAllSlots(t)})])}}))]);var n})},QT=function(t){return fl.getCurrent(t).bind(function(t){return JC.isGrowing(t)||JC.hasGrown(t)?fl.getCurrent(t).bind(function(n){return H(YT.getSlotNames(n),function(t){return YT.isShowing(n,t)})}):tt.none()})},ZT=io("FixSizeEvent"),tE=io("AutoSizeEvent"),nE=function(t,n,e){var o,r=t.element();!0===n?(wm.set(t,[(o=e,{dom:{tag:"div",attributes:{"aria-label":o.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:ip('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:ra([hm.config({mode:"special",onTab:function(){return tt.some(!0)},onShiftTab:function(){return tt.some(!0)}}),Pm.config({})])})]),bu(r,"display"),Ge(r,"aria-hidden")):(wm.set(t,[]),lu(r,"display","none"),Le(r,"aria-hidden","true"))},eE=zT.optional({factory:LT,name:"menubar",schema:[br("dom"),br("getSink")]}),oE=zT.optional({factory:{sketch:function(t){return(t.split===Jh.sliding||t.split===Jh.floating?dO:mO)({uid:t.uid,onEscape:function(){return t.onEscape(),tt.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,backstage:t.backstage,moreDrawerData:{floating:t.split===Jh.floating,lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton}})}},name:"toolbar",schema:[br("dom"),br("onEscape"),br("getSink")]}),rE=zT.optional({name:"socket",schema:[br("dom")]}),iE=zT.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:ra([Ab.config({}),Pm.config({}),JC.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){fl.getCurrent(t).each(YT.hideAllSlots),Wr(t,tE)},onGrown:function(t){Wr(t,tE)},onStartGrow:function(t){Gr(t,ZT,{width:hu(t.element(),"width").getOr("")})},onStartShrink:function(t){Gr(t,ZT,{width:Sa(t.element())+"px"})}}),wm.config({}),fl.config({find:function(t){var n=wm.contents(t);return J(n)}})])}],behaviours:ra([Ew(0),rg("sidebar-sliding-events",[si(ZT,function(t,n){lu(t.element(),"width",n.event().width())}),si(tE,function(t,n){bu(t.element(),"width")})])])}}},name:"sidebar",schema:[br("dom")]}),uE=zT.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:ra([wm.config({})]),components:[]}}},name:"throbber",schema:[br("dom")]}),aE=ul({name:"OuterContainer",factory:function(e,t,n){var o={getSocket:function(t){return PT.getPart(t,e,"socket")},setSidebar:function(t,n){PT.getPart(t,e,"sidebar").each(function(t){return $T(t,n)})},toggleSidebar:function(t,o){PT.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void fl.getCurrent(n).each(function(n){fl.getCurrent(n).each(function(t){JC.hasGrown(n)?YT.isShowing(t,e)?JC.shrink(n):(YT.hideAllSlots(t),YT.showSlot(t,e)):(YT.hideAllSlots(t),YT.showSlot(t,e),JC.grow(n))})});var n,e})},whichSidebar:function(t){return PT.getPart(t,e,"sidebar").bind(QT).getOrNull()},getToolbar:function(t){return PT.getPart(t,e,"toolbar")},setToolbar:function(t,n){PT.getPart(t,e,"toolbar").each(function(t){ZC.setGroups(t,n)})},getMoreButton:function(t){return PT.getPart(t,e,"toolbar").bind(function(t){return cO.getMoreButton(t)})},getThrobber:function(t){return PT.getPart(t,e,"throbber")},focusToolbar:function(t){PT.getPart(t,e,"toolbar").each(function(t){hm.focusIn(t)})},setMenubar:function(t,n){PT.getPart(t,e,"menubar").each(function(t){LT.setMenus(t,n)})},focusMenubar:function(t){PT.getPart(t,e,"menubar").each(function(t){LT.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:o,behaviours:e.behaviours}},configFields:[br("dom"),br("behaviours")],partFields:[eE,oE,rE,iE,uE],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=_(e,function(t){return fO(t)});t.setToolbar(n,o)},getMoreButton:function(t,n){return t.getMoreButton(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)}}}),cE={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 | 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"}},sE=function(t){return"string"==typeof t?t.split(" "):t},fE=function(u,a){var c=St(cE,a.menus),n=0<et(a.menus).length,t=a.menubar===undefined||!0===a.menubar?sE("file edit view insert format tools table help"):sE(!1===a.menubar?"":a.menubar),e=V(t,function(t){return n&&a.menus.hasOwnProperty(t)&&a.menus[t].hasOwnProperty("items")||cE.hasOwnProperty(t)}),o=_(e,function(t){var n,e,o,r,i=c[t];return n={title:i.title,items:sE(i.items)},e=a,r=(o=u,o.getParam("removed_menuitems","")).split(/[ ,]/),{text:n.title,getItems:function(){return j(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 V(o,function(t){return 0<t.getItems().length&&E(t.getItems(),function(t){return"separator"!==t.type})})},lE=function(t){return t.fire("SkinLoaded")},dE=function(t){return t.fire("ResizeEditor")},mE=function(t){return t.fire("ResizeContent")},gE=function(t){var n=function(){t._skinLoaded=!0,lE(t)};return function(){t.initialized?n():t.on("init",n)}},pE=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):nv.baseURL+"/skins/ui/"+r}return o}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),0==(!1===n.getParam("skin"))&&e?tv.DOM.styleSheetLoader.load(e,gE(n)):gE(n)()},hE=v(pE,!1),vE=v(pE,!0),bE=tv.DOM,yE=function(t){return function(n){var e=t.outerContainer;ge("*",e.element()).forEach(function(t){e.getSystem().getByDom(t).each(function(t){t.hasConfigured(Hp)&&("readonly"===n.mode?Hp.disable(t):Hp.enable(t))})})}},xE={render:function(r,i,n,u,t){var e,o;hE(r),e=Zn.fromDom(t.targetNode),o=i.mothership,Vs(e,o,Ce),Is(Zr(),i.uiMothership),r.on("init",function(){aE.setToolbar(i.outerContainer,RT(r,n,{backstage:u},tt.none())),aE.setMenubar(i.outerContainer,fE(r,n)),aE.setSidebar(i.outerContainer,n.sidebar),r.readonly&&yE(i)({mode:"readonly"});var e=_t(pa(0,0)),o=r.contentWindow,t=function(){var t=e.get();if(t.left()!==o.innerWidth||t.top()!==o.innerHeight){var n=pa(o.innerWidth,o.innerHeight);e.set(n),mE(r)}};bE.bind(o,"resize",t),r.on("remove",function(){bE.unbind(o,"resize",t)})});var a=aE.getSocket(i.outerContainer).getOrDie("Could not find expected socket element");r.on("SwitchMode",yE(i)),r.getParam("readonly",!1,"boolean")&&r.setMode("readonly"),r.addCommand("ToggleSidebar",function(t,n){aE.toggleSidebar(i.outerContainer,n),r.fire("ToggleSidebar")}),r.addQueryValueHandler("ToggleSidebar",function(){return aE.whichSidebar(i.outerContainer)});var c=av(r);return c!==Jh.sliding&&c!==Jh.floating||r.on("ResizeContent",function(){aE.getToolbar(i.outerContainer).each(cO.refresh)}),{iframeContainer:a.element().dom(),editorContainer:i.outerContainer.element().dom()}},getBehaviours:function(t){return[]}},wE=function(e,n){return xe(e).orThunk(function(){var t=Zn.fromTag("span");ke(e,t);var n=xe(t);return Ae(t),n}).map(function(t){return va(t).translate(-n.left(),-n.top())}).getOrThunk(function(){return pa(0,0)})},SE=bt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),kE=function(n){return function(t){return t.translate(-n.left(),-n.top())}},CE=function(n){return function(t){return t.translate(n.left(),n.top())}},OE=function(e){return function(t,n){return U(e,function(t,n){return n(t)},pa(t,n))}},TE=function(t,n,e){return t.fold(OE([CE(e),kE(n)]),OE([kE(n)]),OE([]))},EE=function(t,n,e){return t.fold(OE([CE(e)]),OE([]),OE([CE(n)]))},BE=function(t,n,e){return t.fold(OE([]),OE([kE(e)]),OE([CE(n),kE(e)]))},AE=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"}})},DE=SE.offset,_E=SE.absolute,ME=SE.fixed,FE=function(t,n){ou(t.element(),n.transitionClass),ru(t.element(),n.fadeOutClass),ou(t.element(),n.fadeInClass)},IE=function(t,n){ou(t.element(),n.transitionClass),ru(t.element(),n.fadeInClass),ou(t.element(),n.fadeOutClass)},VE=function(t,n){return t.y()>=n.y()&&t.bottom()<=n.bottom()},RE=function(t,n){return We(t,n)?tt.some(parseInt(Ue(t,n),10)):tt.none()},HE=function(o,r,i){return(u=o,t=r,n=u.element(),RE(n,t.leftAttr).bind(function(o){return RE(n,t.topAttr).map(function(t){var n=Sa(u.element()),e=Oa(u.element());return za(o,t,n,e)})})).bind(function(t){return VE(t,i)?(n=r,e=o.element(),Ge(e,n.leftAttr),Ge(e,n.topAttr),tt.some(_E(t.x(),t.y()))):tt.none();var n,e});var u,t,n},NE=function(t,n,e,o,r){var i=va(t.element()),u=za(i.left(),i.top(),Sa(t.element()),Oa(t.element()));if(VE(u,e))return tt.none();a=t,c=n,s=i.left(),f=i.top(),l=a.element(),Le(l,c.leftAttr,s),Le(l,c.topAttr,f);var a,c,s,f,l,d=_E(i.left(),i.top()),m=TE(d,o,r),g=_E(e.x(),e.y()),p=TE(g,o,r),h=u.y()<=e.y()?p.top():p.top()+e.height()-u.height();return tt.some(ME(m.left(),h))},PE=function(i,t,n){var u=t.lazyViewport(i);t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=La(t);e=u,((n=o).y()<e.bottom()&&n.bottom()>e.y()?FE:IE)(i,r)})});var e,o,r,a,c,s=ve(i.element()),f=ya(s),l=wE(i.element(),f);(e=i,o=t,r=u,a=f,c=l,hu(e.element(),"position").is("fixed")?HE(e,o,r):NE(e,o,r,a,c)).each(function(t){var n=AE(t,0,l);du(i.element(),n)})},zE=/* */Object.freeze({refresh:PE}),LE=/* */Object.freeze({events:function(o,t){return ii([si(Qt(),function(n,e){o.contextual.each(function(t){he(n.element(),e.event().target())&&(ru(n.element(),t.transitionClass),e.stop())})}),si(Ln(),function(t,n){PE(t,o)})])}}),jE=[_r("contextual",[br("fadeInClass"),br("fadeOutClass"),br("transitionClass"),br("lazyContext")]),Mr("lazyViewport",function(t){var n=ya();return za(n.left(),n.top(),x.window.innerWidth,x.window.innerHeight)}),br("leftAttr"),br("topAttr")],UE=ua({fields:jE,name:"docking",active:LE,apis:zE}),WE={render:function(e,n,o,r,t){var i,u=tv.DOM,a=sv(e),c=av(e),s=c===Jh.sliding||c===Jh.floating,f=c===Jh.floating;vE(e);var l=function(t){var n=s?t.fold(function(){return 0},function(t){return 1<t.components().length?Oa(t.components()[1].element()):0}):0;du(i.element(),function(t){void 0===t&&(t=0);var n=va(Zn.fromDom(e.getBody()));return{top:Math.round(n.top()-Oa(i.element()))+t+"px",left:Math.round(n.left())+"px"}}(n)),UE.refresh(i)},d=function(){var t=aE.getToolbar(n.outerContainer);s&&t.each(cO.refresh),a||l(t)},m=function(){lu(n.outerContainer.element(),"display","flex"),u.addClass(e.getBody(),"mce-edit-focus"),d(),f&&aE.getToolbar(n.outerContainer).each(function(t){cO.getOverflow(t).each(function(t){ru(t.element(),"tox-toolbar__overflow--closed")})})},g=function(){n.outerContainer&&(lu(n.outerContainer.element(),"display","none"),u.removeClass(e.getBody(),"mce-edit-focus"),f&&aE.getToolbar(n.outerContainer).each(function(t){cO.getOverflow(t).each(function(t){ou(t.element(),"tox-toolbar__overflow--closed")})}))},p=function(){if(i)m();else{i=n.outerContainer;var t=cv(e).getOr(Zr());Is(t,n.mothership),Is(t,n.uiMothership),aE.setToolbar(n.outerContainer,RT(e,o,{backstage:r},tt.none())),aE.setMenubar(n.outerContainer,fE(e,o)),a||lu(i.element(),"position","absolute"),d(),m(),e.on("NodeChange ResizeWindow",d),e.on("activate",m),e.on("deactivate",g),e.nodeChanged()}};return e.on("focus",p),e.on("blur hide",g),e.on("init",function(){e.hasFocus()&&p()}),{editorContainer:n.outerContainer.element().dom()}},getBehaviours:function(n){return sv(n)?[]:[UE.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(t){return tt.from(n).map(function(t){return Zn.fromDom(t.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),Pm.config({})]}},GE=function(t,n){return{anchor:"makeshift",x:t,y:n}},XE=function(t,n){var e,o,r,i=tv.DOM.getPos(t);return e=n,o=i.x,r=i.y,GE(e.x+o,e.y+r)},YE=function(t,n){return"contextmenu"===n.type?t.inline?GE((o=n).pageX,o.pageY):XE(t.getContentAreaContainer(),GE((e=n).clientX,e.clientY)):qE(t);var e,o},qE=function(t){return{anchor:"selection",root:Zn.fromDom(t.selection.getNode())}},KE=function(t){return"string"==typeof t?t.split(/[ ,]/):t},JE=function(t){return t.settings.contextmenu_never_use_native||!1},$E=function(t){return e="contextmenu",o="link linkchecker image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,ft(n.settings,e).map(KE).getOrThunk(function(){return V(KE(o),function(t){return lt(r,t)})});var n,e,o,r},QE=function(t){return S(t)?"|"===t:"separator"===t.type},ZE={type:"separator"},tB=function(n){if(S(n))return n;switch(n.type){case"separator":return ZE;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return S(t)?t:_(t,tB)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:t(n.onAction)}}},nB=function(t,n){if(0===n.length)return t;var e=$(t).filter(function(t){return!QE(t)}).fold(function(){return[]},function(t){return[ZE]});return t.concat(e).concat(n).concat([ZE])},eB=function(d,t,m){var g=_u(yg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return d.focus()},fireDismissalEventInstead:{},inlineBehaviours:ra([rg("dismissContextMenu",[si(Gn(),function(t,n){Gs.close(t),d.focus()})])])}));d.on("init",function(){d.on("contextmenu",function(n){if(t=d,!n.ctrlKey||JE(t)){var t,e,r,i,o,u=2!==n.button||n.target===d.getBody(),a=u?(e=d,{anchor:"node",node:tt.some(Zn.fromDom(e.selection.getNode())),root:Zn.fromDom(e.getBody())}):YE(d,n),c=d.ui.registry.getAll(),s=$E(d),f=u?d.selection.getStart(!0):n.target,l=(r=c.contextMenus,i=f,0<(o=U(s,function(t,n){if(lt(r,n)){var e=r[n].update(i);if(S(e))return nB(t,e.split(" "));if(0<e.length){var o=_(e,tB);return nB(t,o)}return t}return t.concat([n])},[])).length&&QE(o[o.length-1])&&o.pop(),o);lb(l,Xp.CLOSE_ON_EXECUTE,m.providers).map(function(t){n.preventDefault(),yg.showMenuAt(g,a,{menu:{markers:fh("normal")},data:t})})}})})},oB=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?tt.some(parseInt(t,10)):tt.none()},rB=function(t){return D(t)?t+"px":t},iB="data-initial-z-index",uB=function(t,n){var e;t.getSystem().addToGui(n),ye((e=n).element()).each(function(n){hu(n,"z-index").each(function(t){Le(n,iB,t)}),lu(n,"z-index",gu(e.element(),"z-index"))})},aB=function(t){ye(t.element()).each(function(t){var n=Ue(t,iB);We(t,iB)?lu(t,"z-index",n):bu(t,"z-index"),Ge(t,iB)}),t.getSystem().removeFromGui(t)},cB=function(t,n,e,o){return(r=t,i=n,u=r.element(),a=parseInt(Ue(u,i.leftAttr),10),c=parseInt(Ue(u,i.topAttr),10),isNaN(a)||isNaN(c)?tt.none():tt.some(pa(a,c))).fold(function(){return e},function(t){return ME(t.left()+o.left(),t.top()+o.top())});var r,i,u,a,c},sB=function(t,n,e,o,r,i){var u,a,c,s=cB(t,n,e,o),f=lB(t,n,s,r,i),l=TE(s,r,i);return u=n,a=l,c=t.element(),Le(c,u.leftAttr,a.left()+"px"),Le(c,u.topAttr,a.top()+"px"),f.fold(function(){return{coord:ME(l.left(),l.top()),extra:tt.none()}},function(t){return{coord:t.output(),extra:t.extra()}})},fB=function(t,n){var e,o;e=n,o=t.element(),Ge(o,e.leftAttr),Ge(o,e.topAttr)},lB=function(t,n,p,h,v){var e=n.getSnapPoints(t);return Ft(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=EE(n,i=h,u=v),c=EE(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r?tt.some({output:Z((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(BE,SE.offset),m(EE,SE.absolute),m(TE,SE.fixed)))),extra:t.extra}):tt.none()})},dB=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 SE.offset(t+e,n+o)},function(t,n){return SE.absolute(t+e,n+o)},function(t,n){return SE.fixed(t+e,n+o)})),r=TE(n,u,a);return ME(r.left(),r.top())},function(n){var t=sB(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord})},mB=function(t,n,e){var o,r=n.getTarget(t.element());if(n.repositionTarget){var i=ve(t.element()),u=ya(i),a=wE(r,u),c=hu(o=r,"left").bind(function(e){return hu(o,"top").bind(function(n){return hu(o,"position").map(function(t){return("fixed"===t?ME:DE)(parseInt(e,10),parseInt(n,10))})})}).getOrThunk(function(){var t=va(o);return _E(t.left(),t.top())}),s=dB(t,n.snaps,c,u,a,e),f=AE(s,0,a);du(r,f)}n.onDrag(t,r,e)},gB=_r("snaps",[br("getSnapPoints"),Xu("onSensor"),br("leftAttr"),br("topAttr"),Mr("lazyViewport",function(){var t=ya();return{x:t.left,y:t.top,width:Z(x.window.innerWidth),height:Z(x.window.innerHeight),bottom:Z(t.top()+x.window.innerHeight),right:Z(t.left()+x.window.innerWidth)}})]),pB=/* */Object.freeze({getData:function(t){return tt.from(pa(t.x(),t.y()))},getDelta:function(t,n){return pa(n.left()-t.left(),n.top()-t.top())}}),hB=[Mr("useFixed",!1),br("blockerClass"),Mr("getTarget",d),Mr("onDrag",Q),Mr("repositionTarget",!0),Xu("onDrop"),gB,Ju("dragger",{handlers:function(a,c){return ii([si(zt(),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(pB,t).each(function(t){mB(n,a,t)})}},r=n.getSystem().build(Qh.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[a.blockerClass]},events:(e=o,ii([si(zt(),e.forceDrop),si(Ut(),e.drop),si(Lt(),function(t,n){e.move(n.event())}),si(jt(),e.delayDrop)]))})),i=function(){aB(r),a.snaps.each(function(t){fB(n,t)});var t=a.getTarget(n.element());a.onDrop(n,t)},u=Ih(i,200);c.reset(),uB(n,r)}})])}})],vB=/* */Object.freeze({getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],tt.some(pa(n.clientX,n.clientY))):tt.none()},getDelta:function(t,n){return pa(n.left()-t.left(),n.top()-t.top())}}),bB=hB,yB=[Mr("useFixed",!1),Mr("getTarget",d),Mr("onDrag",Q),Mr("repositionTarget",!0),Mr("onDrop",Q),gB,Ju("dragger",{handlers:function(o,r){return ii([hi(Ht()),si(Nt(),function(n,t){t.stop(),r.update(vB,t.event()).each(function(t){mB(n,o,t)})}),si(Pt(),function(n,t){o.snaps.each(function(t){fB(n,t)});var e=o.getTarget(n.element());r.reset(),o.onDrop(n,e)})])}})],xB=/* */Object.freeze({mouse:bB,touch:yB}),wB=/* */Object.freeze({init:function(){var i=tt.none(),t=Z({});return Li({readState:t,reset:function(){i=tt.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=tt.some(e),o;var n,e,o})}})}}),SB=ca({branchKey:"mode",branches:xB,name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:oe(["sensor","range","output"],["extra"])},state:wB});(bT=vT||(vT={}))[bT.None=0]="None",bT[bT.Both=1]="Both",bT[bT.Vertical=2]="Vertical";var kB,CB,OB,TB,EB,BB,AB=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)},DB=function(t,n,e,o,r){var i,u,a={};return a.height=AB(o,n.top(),ov(t),(i=t,tt.from(i.getParam("max_height")).filter(D))),e===vT.Both&&(a.width=AB(r,n.left(),ev(t),(u=t,tt.from(u.getParam("max_width")).filter(D)))),a},_B=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},MB=function(i,u){return u.delimiter||(u.delimiter="\xbb"),{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:ra([hm.config({mode:"flow",selector:"div[role=button]"}),Ab.config({}),wm.config({}),rg("elementPathEvents",[bi(function(r,t){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return hm.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&&!_B(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&&wm.set(r,(n=_(e||[],function(n,t){return wg.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+" "}},U(n.slice(1),function(t,n){var e=t;return e.push(o),e.push(n),e},[n[0]])))})})])]),components:[]}},FB=function(s,t){var n,e,o,r,i,u,a,c,f,l,d,m=function(c){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize")},innerHtml:Cg("resize-handle",t.icons)},behaviours:ra([SB.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){var o,r,i,u,a;o=s,r=e,i=c,u=Zn.fromDom(o.getContainer()),a=DB(o,r,i,Oa(u),Sa(u)),rt(a,function(t,n){return lu(u,n,rB(t))}),dE(o)},blockerClass:"tox-blocker"})])}};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(d=[],s.getParam("elementpath",!0,"boolean")&&d.push(MB(s,{})),xn(s.settings.plugins,"wordcount")&&d.push((u=s,a=t,f=function(t,n,e){return wm.set(t,[Bu(a.translate(["{0} "+e,n[e]]))])},wg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:ra([Ab.config({}),wm.config({}),Im.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),rg("wordcount-events",[si(Rn(),function(t){var n=Im.getValue(t),e="words"===n.mode?"characters":"words";Im.setValue(t,{mode:e,count:n.count}),f(t,n.count,e)}),bi(function(e){u.on("wordCountUpdate",function(t){var n=Im.getValue(e).mode;Im.setValue(e,{mode:n,count:t.wordCount}),f(e,t.wordCount,n)})})])]),eventOrder:(c={},c[Rn()]=["wordcount-events","alloy.base.behaviour"],c)}))),s.getParam("branding",!0,"boolean")&&d.push({dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:'<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&utm_medium=poweredby&utm_source=tinymce&utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="'+(l=up.translate(["Powered by {0}","Tiny"]))+'">'+l+"</a>"}}),r=0<d.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:d}]:[],e=!xn((n=s).settings.plugins,"autoresize"),i=!1===(o=n.getParam("resize",e))?vT.None:"both"===o?vT.Both:vT.Vertical,i!==vT.None&&r.push(m(i)),r)}},IB=function(b){var t,n,e=b.getParam("inline",!1,"boolean"),y=e?WE:xE,o=tt.none(),r=up.isRtl()?{attributes:{dir:"rtl"}}:{},x=_u({dom:ao({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"]},r),behaviours:ra([Ts.config({useFixed:!1})])}),i=Sg({dom:{tag:"div",classes:["tox-anchorbar"]}}),u=function(){return o.bind(function(t){return aE.getMoreButton(t)}).getOrDie("Could not find more button element")},w=function(){return o.bind(function(t){return aE.getThrobber(t)}).getOrDie("Could not find throbber element")},S=DC(x,b,function(){return o.bind(function(t){return i.getOpt(t)}).getOrDie("Could not find a anchor bar element")},u),k=function(){return vt.value(x)},a=aE.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},getSink:k,providers:S.shared.providers,onEscape:function(){b.focus()}}),c=aE.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:k,backstage:S,onEscape:function(){b.focus()},split:av(b),lazyToolbar:function(){return o.bind(function(t){return aE.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:u}),s=aE.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),f=aE.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),l=aE.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:S}),d=b.getParam("statusbar",!0,"boolean")&&!e?tt.some(FB(b,S.shared.providers)):tt.none(),m={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[s,f]},g=(n=(t=b).getParam("toolbar"),(A(n)?0<n.length:!1!==t.getParam("toolbar",!0,"boolean"))||rv(b).isSome()),p=!1!==b.getParam("menubar",!0,"boolean"),h=L([p?[a]:[],g?[c]:[],sv(b)?[]:[i.asSpec()],e?[]:[m]]),v=L([[{dom:{tag:"div",classes:["tox-editor-container"]},components:h}],e?[]:d.toArray(),[l]]),C=ao({role:"application"},up.isRtl()?{dir:"rtl"}:{}),O=_u(aE.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(e?["tox-tinymce-inline"]:[]),styles:{visibility:"hidden"},attributes:C},components:v,behaviours:ra(y.getBehaviours(b).concat([hm.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"})]))}));o=tt.some(O),b.shortcuts.add("alt+F9","focus menubar",function(){aE.focusMenubar(O)}),b.shortcuts.add("alt+F10","focus toolbar",function(){aE.focusToolbar(O)});var T=Zh(O),E=Zh(x);NT(b,T,E);var B=function(t){var n,e=tv.DOM,o=b.getParam("width",e.getStyle(t,"width")),r=(n=b).getParam("height",Math.max(n.getElement().offsetHeight,200)),i=ev(b),u=ov(b),a=oB(o).bind(function(n){return rB(i.map(function(t){return Math.max(n,t)}))}).getOr(rB(o)),c=oB(r).bind(function(n){return u.map(function(t){return Math.max(n,t)})}).getOr(r),s=rB(a);if(vu("div","width",s)&&lu(O.element(),"width",s),!b.inline){var f=rB(c);vu("div","height",f)?lu(O.element(),"height",f):lu(O.element(),"height","200px")}return c};return{mothership:T,uiMothership:E,backstage:S,renderUI:function(){var o,r,e,n,i,u,a,c;eB(b,k,S.shared),r=(o=b).ui.registry.getAll().sidebars,M(et(r),function(n){var t=r[n],e=function(){return tt.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=b,n=w,i=S.shared,u=_t(!1),a=_t(tt.none()),c=function(t){t!==u.get()&&(nE(n(),t,i.providers),u.set(t))},e.on("ProgressState",function(t){if(a.get().each(Eg.clearTimeout),D(t.time)){var n=Eg.setEditorTimeout(e,function(){return c(t.state)},t.time);a.set(tt.some(n))}else c(t.state),a.set(tt.none())});var t=b.ui.registry.getAll(),s=t.buttons,f=t.menuItems,l=t.contextToolbars,d=t.sidebars,m={menuItems:f,buttons:s,menus:b.settings.menu?it(b.settings.menu,function(t){return St(t,{items:t.items})}):{},menubar:b.settings.menubar,toolbar:rv(b).getOr(b.getParam("toolbar",!0)),sidebar:d};HT(b,l,x,{backstage:S});var g=b.getElement(),p=B(g),h={mothership:T,uiMothership:E,outerContainer:O},v={targetNode:g,height:p};return y.render(b,h,m,S,v)},getUi:function(){return{channels:{broadcastAll:E.broadcast,broadcastOn:E.broadcastOn,register:function(){}}}}}},VB=function(n){sk.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:mT(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})},RB=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},HB=function(t){var n,e;!function(e){sk.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:mT(e,t.name),onAction:RB(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:mT(e,n),onAction:RB(e,n)})}}(t),n=t,sk.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,sk.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:mT(e,t.name)})})},NB=function(t){var n;HB(t),n=t,sk.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:RB(n,"code")})},PB=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)}},zB=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return PB(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 PB(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return PB(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return PB(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},LB=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")}})},jB=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")}})},UB=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=wT(e=t),i=pT(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=kT(u=t),s=pT(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=pT(0,l,d,BT(f)),f.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=n,h=ET(g=t),v=pT(0,p,h.dataset,h),g.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return v.items.validateItems(v.getStyleItems())}}),y=n,x=OT(b=t),w=pT(0,y,x.dataset,x),b.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return w.items.validateItems(w.getStyleItems())}})},WB=function(t,n){VB(t),NB(t),UB(t,n),zB(t),py.register(t),LB(t),jB(t)},GB=function(t,n){var e=tt.from(Ue(t,"id")).fold(function(){var t=io("dialog-label");return Le(n,"id",t),t},d);Le(t,"aria-labelledby",e)},XB=Z([br("lazySink"),Tr("dragBlockClass"),Mr("useTabstopAt",Z(!0)),Mr("eventOrder",{}),$s("modalBehaviours",[hm]),Yu("onExecute"),Ku("onEscape")]),YB={sketch:d},qB=Z([Df({name:"draghandle",overrides:function(t,n){return{behaviours:ra([SB.config({mode:"mouse",getTarget:function(t){return Iu(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"+Ro(n,null,2)).message)})])}}}),Bf({schema:[br("dom")],name:"title"}),Bf({factory:YB,schema:[br("dom")],name:"close"}),Bf({factory:YB,schema:[br("dom")],name:"body"}),Df({factory:YB,schema:[br("dom")],name:"footer"}),Af({factory:{sketch:function(t,n){return ao({},t,{dom:n.dom,components:n.components})}},schema:[Mr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Mr("components",[])],name:"blocker"})]),KB=ul({name:"ModalDialog",configFields:XB(),partFields:qB(),factory:function(r,t,n,o){var a=io("alloy.dialog.busy"),c=io("alloy.dialog.idle"),s=ra([hm.config({mode:"special",onTab:function(){return tt.some(!0)},onShiftTab:function(){return tt.some(!0)}}),Pm.config({})]),e=io("modal-events"),i=ao({},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=_t(tt.none()),n=o.blocker(),e=t.getSystem().build(ao({},n,{components:n.components.concat([Mu(i)]),behaviours:ra([rg("dialog-blocker-events",[si(c,function(t,n){We(i.element(),"aria-busy")&&(Ge(i.element(),"aria-busy"),u.get().each(function(t){return wm.remove(i,t)}))}),si(a,function(t,n){Le(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){wm.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(tt.some(r)),wm.append(i,Mu(r)),r.hasConfigured(hm)&&hm.focusIn(r)})])])}));As(t,e),hm.focusIn(i)},hide:function(n){ye(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){Ms(t)})})},getBody:function(t){return Uf(t,r,"body")},getFooter:function(t){return Uf(t,r,"footer")},setIdle:function(t){Wr(t,c)},setBusy:function(t,n){Gr(t,a,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Zs(r.modalBehaviours,[wm.config({}),hm.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt}),rg(e,[bi(function(t){var n,e,o;GB(t.element(),Uf(t,r,"title").element()),n=t.element(),e=Uf(t,r,"body").element(),o=tt.from(Ue(n,"id")).fold(function(){var t=io("dialog-describe");return Le(e,"id",t),t},d),Le(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)}}}),JB=[xr("type"),xr("text"),wr("level",["info","warn","error","success"]),xr("icon"),Mr("url","")],$B=[xr("type"),xr("text"),Hr("primary",!1),$o("name","name",ho(function(){return io("button-name")}),gr),Ar("icon")],QB=[xr("type"),xr("name"),xr("label")],ZB=pr,tA=[xr("type"),xr("name"),Ar("label")],nA=tA,eA=gr,oA=tA,rA=gr,iA=tA,uA=er(),aA=tA.concat([Hr("sandboxed",!0)]),cA=gr,sA=tA.concat([Ar("placeholder")]),fA=gr,lA=tA.concat([Cr("items",[xr("text"),xr("value")]),Ir("size",1)]),dA=gr,mA=tA.concat([Hr("constrain",!0)]),gA=Go([xr("width"),xr("height")]),pA=tA.concat([Ar("placeholder")]),hA=gr,vA=tA.concat([Rr("filetype","file",["image","media","file"])]),bA=Go([xr("value"),Mr("meta",{})]),yA=tA.concat([xr("type"),Vr("tag","textarea"),Sr("init")]),xA=gr,wA=[xr("type"),xr("html"),Rr("presets","presentation",["presentation","document"])],SA=tA.concat([yr("currentState",Go([br("blob"),xr("url")]))]),kA=tA.concat([Mr("columns","auto")]),CA=nr([xr("value"),xr("text"),xr("icon")]),OA=[xr("type"),Or("header",gr),Or("cells",Xo(gr))],TA=function(n){return $o("items","items",go(),Xo(or(function(t){return ur("Checking item of "+n,EA,t).fold(function(t){return vt.error(sr(t))},function(t){return vt.value(t)})})))},EA=fr("type",{alertbanner:JB,bar:(TB=TA("bar"),[xr("type"),TB]),button:$B,checkbox:QB,colorinput:nA,colorpicker:oA,dropzone:iA,grid:(CB=TA("grid"),[xr("type"),(OB="columns",yr(OB,mr)),CB]),iframe:aA,input:sA,selectbox:lA,sizeinput:mA,textarea:pA,urlinput:vA,customeditor:yA,htmlpanel:wA,imagetools:SA,collection:kA,label:(kB=TA("label"),[xr("type"),xr("label"),kB]),table:OA}),BA=[xr("type"),Or("items",EA)],AA=[xr("title"),Or("items",EA)],DA=[xr("type"),Cr("tabs",AA)],_A=[$o("name","name",ho(function(){return io("button-name")}),gr),xr("text"),Ar("icon"),Rr("align","end",["start","end"]),Hr("primary",!1),Hr("disabled",!1)],MA=Go([wr("type",["submit","cancel","custom"])].concat(_A)),FA=Go([xr("title"),yr("body",fr("type",{panel:BA,tabpanel:DA})),Vr("size","normal"),Or("buttons",MA),Mr("initialData",{}),Nr("onAction",Q),Nr("onChange",Q),Nr("onSubmit",Q),Nr("onClose",Q),Nr("onCancel",Q),Mr("onTabChange",Q)]),IA=function(t){return k(t)?[t].concat(j(st(t),IA)):A(t)?j(t,IA):[]},VA=function(t){return S(t.type)&&S(t.name)},RA={checkbox:ZB,colorinput:eA,colorpicker:rA,dropzone:uA,input:fA,iframe:cA,sizeinput:gA,selectbox:dA,size:gA,textarea:hA,urlinput:bA,customeditor:xA,collection:CA},HA=function(t){var n=j(V(IA(t),VA),function(n){return(t=n,tt.from(RA[t.type])).fold(function(){return[]},function(t){return[yr(n.name,t)]});var t});return Go(n)},NA=Go([wr("type",["cancel","custom"])].concat(_A)),PA=Go([xr("title"),xr("url"),Br("height"),Br("width"),(EB="buttons",BB=NA,Er(EB,Xo(BB))),Nr("onAction",Q),Nr("onCancel",Q),Nr("onClose",Q),Nr("onMessage",Q)]),zA=function(t){return{internalDialog:ar(ur("dialog",FA,t)),dataValidator:HA(t),initialData:t.initialData}},LA={open:function(t,n){var e=zA(n);return t(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(t,n){return t(ar(ur("dialog",PA,n)))},redial:function(t){return zA(t)}},jA=function(t){var e=[],o={};return rt(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?vt.error(e):vt.value(o)},UA=il({name:"TabButton",configFields:[Mr("uid",undefined),br("value"),$o("dom","dom",vo(function(t){return{attributes:{role:"tab",id:io("aria"),"aria-selected":"false"}}}),lr()),Tr("action"),Mr("domModification",{}),$s("tabButtonBehaviours",[Pm,hm,Im]),br("view")],factory:function(t,n){return{uid:t.uid,dom:t.dom,components:t.components,events:xg(t.action),behaviours:Zs(t.tabButtonBehaviours,[Pm.config({}),hm.config({mode:"execution",useSpace:!0,useEnter:!0}),Im.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),WA=Z([br("tabs"),br("dom"),Mr("clickToDismiss",!1),$s("tabbarBehaviours",[kl,hm]),Wu(["tabClass","selectedClass"])]),GA=_f({factory:UA,name:"tabs",unit:"tab",overrides:function(o,t){var r=function(t,n){kl.dehighlight(t,n),Gr(t,Kn(),{tabbar:t,button:n})},i=function(t,n){kl.highlight(t,n),Gr(t,qn(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=kl.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?Q:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),XA=Z([GA]),YA=ul({name:"Tabbar",configFields:WA(),partFields:XA(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Zs(t.tabbarBehaviours,[kl.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){Le(n.element(),"aria-selected","true")},onDehighlight:function(t,n){Le(n.element(),"aria-selected","false")}}),hm.config({mode:"flow",getInitial:function(t){return kl.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),qA=il({name:"Tabview",configFields:[$s("tabviewBehaviours",[wm])],factory:function(t,n){return{uid:t.uid,dom:t.dom,behaviours:Zs(t.tabviewBehaviours,[wm.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),KA=Z([Mr("selectFirst",!0),Xu("onChangeTab"),Xu("onDismissTab"),Mr("tabs",[]),$s("tabSectionBehaviours",[])]),JA=Bf({factory:YA,schema:[br("dom"),kr("markers",[br("tabClass"),br("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),$A=Bf({factory:qA,name:"tabview"}),QA=Z([JA,$A]),ZA=ul({name:"TabSection",configFields:KA(),partFields:QA(),factory:function(i,t,n,e){var o=function(t,n){jf(t,i,"tabbar").each(function(t){n(t).each(Xr)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:Qs(i.tabSectionBehaviours),events:ii(L([i.selectFirst?[bi(function(t,n){o(t,kl.getFirst)})]:[],[si(qn(),function(t,n){var o,r,e=n.event().button();o=e,r=Im.getValue(o),jf(o,i,"tabview").each(function(e){H(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();Le(e.element(),"aria-labelledby",Ue(o.element(),"id")),wm.set(e,n),i.onChangeTab(e,o,n)})})}),si(Kn(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return jf(t,i,"tabview").map(function(t){return wm.contents(t)}).getOr([])},showTab:function(t,e){o(t,function(n){var t=kl.getCandidates(n);return H(t,function(t){return Im.getValue(t)===e}).filter(function(t){return!kl.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),tD=function(i,u,t){Iu(i,'[role="dialog"]').each(function(r){t.get().map(function(t){return lu(u,"height","0"),Math.min(t,(e=i,o=Iu(n=r,".tox-dialog-wrap").getOr(n),("fixed"===gu(o,"position")?Math.max(x.document.documentElement.clientHeight,x.window.innerHeight):Math.max(x.document.documentElement.offsetHeight,x.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-e.dom().getBoundingClientRect().height)));var n,e,o}).each(function(t){lu(u,"height",t+"px")})})},nD=function(a){var c;return{smartTabHeight:(c=_t(tt.none()),{extraEvents:[bi(function(t){Vu(t.element(),'[role="tabpanel"]').each(function(u){var n;lu(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,_(o=a,function(t,n){wm.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return wm.set(i,[]),e.height})),e=J(K(n,function(t,n){return n<t?-1:t<n?1:0}));c.set(e)}),tD(t.element(),u,c),bu(u,"visibility"),n=t,J(a).each(function(t){return ZA.showTab(n,t.value)}),Eg.requestAnimationFrame(function(){tD(t.element(),u,c)})})}),si(jn(),function(n){Vu(n.element(),'[role="tabpanel"]').each(function(t){tD(n.element(),t,c)})}),si(bv,function(r,t){Vu(r.element(),'[role="tabpanel"]').each(function(n){var t=Rl();lu(n,"visibility","hidden");var e=hu(n,"height").map(function(t){return parseInt(t,10)});bu(n,"height");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(tt.from(o)),tD(r.element(),n,c)):e.each(function(t){lu(n,"height",t+"px")}),bu(n,"visibility"),t.each(Vl)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},eD="send-data-to-section",oD="send-data-to-view",rD=io("update-dialog"),iD=io("update-title"),uD=io("update-body"),aD=io("update-footer"),cD=io("body-send-message"),sD=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:ao({},n.map(function(t){return{id:t}}).getOr({}),e?{"aria-live":"polite"}:{})},components:[],behaviours:ra([Ew(0),HO.config({channel:uD,updateState:function(t,n){return tt.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=_t({}),a=function(t){var n=Im.getValue(t),e=jA(n).getOr({}),o=u.get(),r=wt(o,e);u.set(r)},c=function(t){var n=u.get();Im.setValue(t,n)},s=_t(null),f=_(r.tabs,function(t){return{value:t.title,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:i.shared.providers.translate(t.title)},view:function(){return[vw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:_(t.items,function(t){return jk(n,t,i)}),formBehaviours:ra([hm.config({mode:"acyclic",useTabstopAt:w(jw)}),rg("TabView.form.events",[bi(c),yi(a)]),da.config({channels:Bt([{key:eD,value:{onReceive:a}},{key:oD,value:{onReceive:c}}])})])}})]}}}),l=nD(f).smartTabHeight,ZA.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n,e){var o=Im.getValue(n);Gr(t,vv,{title:o,oldTitle:s.get()}),s.set(o)},tabs:f,components:[ZA.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[YA.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:ra([Ab.config({})])}),ZA.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:ra([rg("tabpanel",l.extraEvents),hm.config({mode:"acyclic"}),fl.config({find:function(t){return J(ZA.getViewItems(t))}}),Im.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([eD],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([oD],{})}}})])}))];default:return[(e={items:t.body.items},o=d,n=Sg(vw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:_(e.items,function(t){return jk(n,t,o)})}})),{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:ra([hm.config({mode:"acyclic",useTabstopAt:w(jw)}),Tw(n),Fw(n,{postprocess:function(t){return jA(t).fold(function(t){return x.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,f,l},initialData:t})])}},fD=function(t,e){return[gi(Gt(),Uw),t(lv,function(t,n){e.onClose(),n.onClose()}),t(dv,function(t,n,e,o){n.onCancel(t),Wr(o,lv)}),si(hv,function(t,n){return e.onUnblock()}),si(pv,function(t,n){return e.onBlock(n.event())})]},lD=function(i,t){var n=function(t,r){return si(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){HO.getState(n).get().each(function(t){e(t,n)})};return fD(n,t).concat([n(mv,function(t,n,e){n.onAction(t,{name:e.name()})})])},dD=function(i,t){var n=function(t,r){return si(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){HO.getState(n).get().each(function(t){e(t.internalDialog,n)})};return fD(n,t).concat([n(gv,function(t,n){return n.onSubmit(t)}),n(fv,function(t,n,e){n.onChange(t,{name:e.name()})}),n(mv,function(t,n,e){n.onAction(t,{name:e.name(),value:e.value()})}),n(vv,function(t,n,e){n.onTabChange(t,e.title())}),yi(function(t){var n=i();Im.setValue(t,n.getData())})])},mD=function(t,n){var e=n.map(function(t){return t.footerButtons}).getOr([]),o=I(e,function(t){return"start"===t.align}),r=function(t,n){return Qh.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:_(n,function(t){return t.memento.asSpec()})})};return[r("start",o.pass),r("end",o.fail)]},gD=function(t,i){return{dom:ip('<div class="tox-dialog__footer"></div>'),components:[],behaviours:ra([HO.config({channel:aD,initialData:t,updateState:function(t,n){var r=_(n.buttons,function(t){var n,e,o=Sg((e=i,WS(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return tt.some({lookupByName:function(t,n){return e=t,o=n,H(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:mD})])}},pD=function(t,n){return KB.parts().footer(gD(t,n))},hD=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=fl.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return vw.getField(o,e).fold(function(){var t=n.getFooter();return HO.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return tt.some(t)})}return tt.none()},vD=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 Im.getValue(n)},setData:function(a){t(function(t){var n,e,o=s.getData(),r=St(o,a),i=(n=r,e=c.getRoot(),HO.getState(e).get().map(function(t){return ar(ur("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();Im.setValue(u,i)})},disable:function(t){hD(c,t).each(Hp.disable)},enable:function(t){hD(c,t).each(Hp.enable)},focus:function(t){hD(c,t).each(Pm.focus)},block:function(n){if(!S(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){Gr(t,pv,{message:n})})},unblock:function(){t(function(t){Wr(t,hv)})},showTab:function(e){t(function(t){var n=c.getBody();HO.getState(n).get().exists(function(t){return t.isTabPanel()})&&fl.getCurrent(n).each(function(t){ZA.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([rD],n),t.getSystem().broadcastOn([iD],n.internalDialog),t.getSystem().broadcastOn([uD],n.internalDialog),t.getSystem().broadcastOn([aD],n.internalDialog),s.setData(n.initialData)})},close:function(){t(function(t){Wr(t,lv)})}};return s},bD=function(t){return wg.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){Wr(t,dv)}})},yD=function(t,n,e){var o=function(t){return[Bu(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:ao({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:ra([HO.config({channel:iD,renderComponents:o})])}},xD=function(t,n){return e={title:n.shared.providers.translate(t),draggable:!0},o=n.shared.providers,r=KB.parts().title(yD(e,tt.none(),o)),i=KB.parts().draghandle({dom:ip('<div class="tox-dialog__draghandle"></div>')}),u=KB.parts().close(bD(o)),a=[r].concat(e.draggable?[i]:[]).concat([u]),Qh.sketch({dom:ip('<div class="tox-dialog__header"></div>'),components:a});var e,o,r,i,u,a},wD=function(t,n){return{onClose:function(){return n.closeWindow()},onBlock:function(e){KB.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:ip('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){KB.setIdle(t())}}},SD=function(t,n,e,o){var r;return _u(KB.sketch({lazySink:o.shared.getSink,onEscape:function(t){return Wr(t,dv),tt.some(!0)},useTabstopAt:function(t){return!jw(t)&&("button"!==Fe(t)||"disabled"!==Ue(t,"disabled"))},modalBehaviours:ra([HO.config({channel:rD,updateState:function(t,n){return tt.some(n)},initialData:n}),Rw({}),Pm.config({}),rg("execute-on-form",e.concat([vi(Gt(),function(t,n){hm.focusIn(t)})])),rg("scroll-lock",[bi(function(){ou(Zr(),"tox-dialog__disable-scroll")}),yi(function(){ru(Zr(),"tox-dialog__disable-scroll")})])].concat(t.extraBehaviours)),eventOrder:(r={},r[Fn()]=["execute-on-form"],r[Mn()]=["reflecting","receiving"],r[Un()]=["scroll-lock","reflecting","messages","execute-on-form","alloy.base.behaviour"],r[Wn()]=["alloy.base.behaviour","execute-on-form","messages","reflecting","scroll-lock"],r),dom:{tag:"div",classes:["tox-dialog"].concat(t.extraClasses),styles:ao({position:"relative"},t.extraStyles)},components:[t.header,t.body].concat(t.footer.toArray()),dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:ip('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}}))},kD=function(t,n,e){var o,r,i,u=xD(t.internalDialog.title,e),a=(o={body:t.internalDialog.body},r=e,i=sD(o,tt.none(),r,!1),KB.parts().body(i)),c=pD({buttons:t.internalDialog.buttons},e.shared.providers),s=dD(function(){return m},wD(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:tt.some(c),extraClasses:f,extraBehaviours:[],extraStyles:{}},d=SD(l,t,s,e),m=vD({getRoot:function(){return d},getBody:function(){return KB.getBody(d)},getFooter:function(){return KB.getFooter(d)},getFormWrapper:function(){var t=KB.getBody(d);return fl.getCurrent(t).getOr(t)}},n.redial);return{dialog:d,instanceApi:m}},CD=tinymce.util.Tools.resolve("tinymce.util.URI"),OD=["insertContent","setContent","execCommand","close","block","unblock"],TD=function(t){return k(t)&&-1!==OD.indexOf(t.mceAction)},ED=function(o,t,r,n){var e,i,u,a,c=xD(o.title,n),s=(i={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[Ww({dom:{tag:"iframe",attributes:{src:o.url}},behaviours:ra([Ab.config({}),Pm.config({})])})]}],behaviours:ra([hm.config({mode:"acyclic",useTabstopAt:w(jw)})])},KB.parts().body(i)),f=o.buttons.bind(function(t){return 0===t.length?tt.none():tt.some(pD({buttons:t},n.shared.providers))}),l=lD(function(){return y},wD(function(){return b},t)),d=ao({},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 CD(o.url,{base_uri:new CD(x.window.location.href)}),p=g.protocol+"://"+g.host+(g.port?":"+g.port:""),h=_t(tt.none()),v=[rg("messages",[bi(function(){var t=_h(Zn.fromDom(x.window),"message",function(t){if(g.isSameOrigin(new CD(t.raw().origin))){var n=t.raw().data;TD(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=!!C(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):!TD(e=n)&&k(e)&<(e,"mceAction")&&o.onMessage(y,n)}var e});h.set(tt.some(t))}),yi(function(){h.get().each(function(t){return t.unbind()})})]),da.config({channels:(e={},e[cD]={onReceive:function(t,n){Vu(t.element(),"iframe").each(function(t){t.dom().contentWindow.postMessage(n,p)})}},e)})],b=SD({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(!S(n))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");a(function(t){Gr(t,pv,{message:n})})},unblock:function(){a(function(t){Wr(t,hv)})},close:function(){a(function(t){Wr(t,lv)})},sendMessage:function(n){a(function(t){t.getSystem().broadcastOn([cD],n)})}});return{dialog:b,instanceApi:y}},BD=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p=io("dialog-label"),h=io("dialog-content"),v=Sg((u={title:t.internalDialog.title,draggable:!0},a=p,c=e.shared.providers,Qh.sketch({dom:ip('<div class="tox-dialog__header"></div>'),components:[yD(u,tt.some(a),c),bD(c)],containerBehaviours:ra([SB.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return Ru(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),b=Sg((s={body:t.internalDialog.body},f=h,l=e,d=o,sD(s,tt.some(f),l,d))),y=Sg((m={buttons:t.internalDialog.buttons},g=e.shared.providers,gD(m,g))),x=dD(function(){return S},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),w=_u({dom:{tag:"div",classes:["tox-dialog"],attributes:(r={role:"dialog"},r["aria-labelledby"]=p,r["aria-describedby"]=""+h,r)},eventOrder:(i={},i[Mn()]=[HO.name(),da.name()],i[Fn()]=["execute-on-form"],i[Un()]=["reflecting","execute-on-form"],i),behaviours:ra([hm.config({mode:"cyclic",onEscape:function(t){return Wr(t,lv),tt.some(!0)},useTabstopAt:function(t){return!jw(t)&&("button"!==Fe(t)||"disabled"!==Ue(t,"disabled"))}}),HO.config({channel:rD,updateState:function(t,n){return tt.some(n)},initialData:t}),rg("execute-on-form",x),Rw({})]),components:[v.asSpec(),b.asSpec(),y.asSpec()]}),S=vD({getRoot:function(){return w},getFooter:function(){return y.get(w)},getBody:function(){return b.get(w)},getFormWrapper:function(){var t=b.get(w);return fl.getCurrent(t).getOr(t)}},n.redial);return{dialog:w,instanceApi:S}},AD=function(t,n){return KB.parts().close(wg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:ra([Ab.config({})])}))},DD=function(){return KB.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},_D=function(t,n){return KB.parts().body({dom:{tag:"div",classes:["tox-dialog__body","todo-tox-fit"]},components:[{dom:ip("<p>"+n.translate(t)+"</p>")}]})},MD=function(t){return KB.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},FD=function(t,n){return[Qh.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),Qh.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},ID=function(e){return KB.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),tt.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:ip('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:ra([rg("basic-dialog-events",[si(dv,function(t,n){e.onCancel()}),si(gv,function(t,n){e.onSubmit()})])])})},VD=function(s){var u,a,e=(u=s.backstage.shared,{open:function(t,n){var e=function(){KB.hide(r),n()},o=Sg(WS({name:"close-alert",text:"OK",primary:!0,icon:tt.none()},"cancel",u.providers)),r=_u(ID({lazySink:function(){return u.getSink()},partSpecs:{title:DD(),close:AD(function(){e()},u.providers),body:_D(t,u.providers),footer:MD(FD([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:Q,extraClasses:["tox-alert-dialog"]}));KB.show(r);var i=o.get(r);Pm.focus(i)}}),o=(a=s.backstage.shared,{open:function(t,n){var e=function(t){KB.hide(i),n(t)},o=Sg(WS({name:"yes",text:"Yes",primary:!0,icon:tt.none()},"submit",a.providers)),r=WS({name:"no",text:"No",primary:!0,icon:tt.none()},"cancel",a.providers),i=_u(ID({lazySink:function(){return a.getSink()},partSpecs:{title:DD(),close:AD(function(){e(!1)},a.providers),body:_D(t,a.providers),footer:MD(FD([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));KB.show(i);var u=o.get(i);Pm.focus(u)}}),r=function(t,e){return LA.openUrl(function(t){var n=ED(t,{closeWindow:function(){KB.hide(n.dialog),e(n.instanceApi)}},s.editor,s.backstage);return KB.show(n.dialog),n.instanceApi},t)},i=function(t,i){return LA.open(function(t,n,e){var o=n,r=kD({dataValidator:e,initialData:o,internalDialog:t},{redial:LA.redial,closeWindow:function(){KB.hide(r.dialog),i(r.instanceApi)}},s.backstage);return KB.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},c=function(t,u,a,c){return LA.open(function(t,n,e){var o=ar(ur("data",e,n)),r=BD({dataValidator:e,initialData:o,internalDialog:t},{redial:LA.redial,closeWindow:function(){yg.hide(i),a(r.instanceApi)}},s.backstage,c),i=_u(yg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:ra([rg("window-manager-inline-events",[si(Gn(),function(t,n){Wr(r.dialog,dv)})])])}));return yg.showAt(i,u,Mu(r.dialog)),r.instanceApi.setData(o),hm.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)})}}};uo.add("silver",function(t){var n=IB(t),e=n.mothership,o=n.uiMothership,r=n.backstage,i=n.renderUI,u=n.getUi;WB(t,r),eo(io("silver-demo"),e),eo(io("silver-ui-demo"),o),Th(t,r.shared);var a=VD({editor:t,backstage:r});return{renderUI:i,getWindowManagerImpl:Z(a),getNotificationManagerImpl:function(){return Bg(t,{backstage:r},o)},ui:u()}}),function E_(){}}(window);
|