11 lines
362 KiB
JavaScript
11 lines
362 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.12 (2019-07-18)
|
|
*/
|
|
|
|
!function(F){"use strict";var tt=function(){},p=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},nt=function(t){return function(){return t}},d=function(t){return t};function g(o){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=r.concat(t);return o.apply(null,e)}}var x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return!e.apply(null,t)}},u=function(t){return function(){throw new Error(t)}},t=nt(!1),n=nt(!0),e=tinymce.util.Tools.resolve("tinymce.ThemeManager"),I=function(){return(I=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 h(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&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(e[o[r]]=t[o[r]])}return e}var o,r,i,a,c,s,l,f=t,m=n,v=function(){return b},b=(a={fold:function(t,n){return t()},is:f,isSome:f,isNone:m,getOr:i=function(t){return t},getOrThunk:r=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:i,orThunk:r,map:v,ap:v,each:function(){},bind:v,flatten:v,exists:f,forall:m,filter:v,equals:o=function(t){return t.isNone()},equals_:o,toArray:function(){return[]},toString:nt("none()")},Object.freeze&&Object.freeze(a),a),y=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:m,isNone:f,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return y(t(e))},ap:function(t){return t.fold(v,function(t){return y(t(e))})},each:function(t){t(e)},bind:o,flatten:t,exists:o,forall:o,filter:function(t){return t(e)?r:b},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(f,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return r},et={some:y,none:v,from:function(t){return null===t||t===undefined?b:y(t)}},w=function(e){return{is:function(t){return e===t},isValue:n,isError:t,getOr:nt(e),getOrThunk:nt(e),getOrDie:nt(e),or:function(t){return w(e)},orThunk:function(t){return w(e)},fold:function(t,n){return n(e)},map:function(t){return w(t(e))},mapError:function(t){return w(e)},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return et.some(e)}}},S=function(e){return{is:t,isValue:t,isError:n,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 S(e)},mapError:function(t){return S(t(e))},each:tt,bind:function(t){return S(e)},exists:t,forall:n,toOption:et.none}},R={value:w,error:S,fromOption:function(t,n){return t.fold(function(){return S(n)},w)}},C=function(n){return function(t){return function(t){if(null===t)return"null";var n=typeof t;return"object"===n&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===n&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":n}(t)===n}},k=C("string"),O=C("object"),E=C("array"),T=C("boolean"),B=C("function"),V=C("number"),D=function(t,n){if(E(t)){for(var e=0,o=t.length;e<o;++e)if(!0!==n(t[e]))return!1;return!0}return!1},A=Array.prototype.slice,_=(c=Array.prototype.indexOf)===undefined?function(t,n){return X(t,n)}:function(t,n){return c.call(t,n)},M=function(t,n){return-1<_(t,n)},N=function(t,n){return G(t,n).isSome()},H=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=A.call(t,o,o+n);e.push(r)}return e},P=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},z=function(t,n){for(var e=0,o=t.length;e<o;e++){n(t[e],e,t)}},L=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},j=function(t,n,e){return function(t,n){for(var e=t.length-1;0<=e;e--)n(t[e],e,t)}(t,function(t){e=n(e,t)}),e},U=function(t,n,e){return z(t,function(t){e=n(e,t)}),e},W=function(t,n){for(var e=0,o=t.length;e<o;e++){var r=t[e];if(n(r,e,t))return et.some(r)}return et.none()},G=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e,t))return et.some(e)}return et.none()},X=function(t,n){for(var e=0,o=t.length;e<o;++e)if(t[e]===n)return e;return-1},Y=Array.prototype.push,q=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!E(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);Y.apply(n,t[e])}return n},K=function(t,n){var e=P(t,n);return q(e)},$=function(t,n){for(var e=0,o=t.length;e<o;++e){if(!0!==n(t[e],e,t))return!1}return!0},J=function(t){var n=A.call(t,0);return n.reverse(),n},Q=function(t,n){return L(t,function(t){return!M(n,t)})},Z=function(t){return[t]},ot=function(t){return 0===t.length?et.none():et.some(t[0])},rt=function(t){return 0===t.length?et.none():et.some(t[t.length-1])},it=B(Array.from)?Array.from:function(t){return A.call(t)},ut=Object.keys,at=Object.hasOwnProperty,ct=function(t,n){for(var e=ut(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i,t)}},st=function(t,o){return lt(t,function(t,n,e){return{k:n,v:o(t,n,e)}})},lt=function(o,r){var i={};return ct(o,function(t,n){var e=r(t,n,o);i[e.k]=e.v}),i},ft=function(t,e){var o=[];return ct(t,function(t,n){o.push(e(t,n))}),o},dt=function(t){return ft(t,function(t){return t})},mt=function(t,n){return gt(t,n)?et.from(t[n]):et.none()},gt=function(t,n){return at.call(t,n)},pt=function(u){if(!E(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 z(u,function(t,o){var n=ut(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(!E(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=ut(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!$(a,function(t){return M(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){F.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},ht=Object.prototype.hasOwnProperty,vt=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)ht.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},bt=vt(function(t,n){return O(t)&&O(n)?bt(t,n):n}),yt=vt(function(t,n){return n}),xt=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}},wt=pt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),St=function(t){return wt.defaultedThunk(nt(t))},Ct=wt.strict,kt=wt.asOption,Ot=wt.defaultedThunk,Et=wt.mergeWithThunk,Tt=function(n){return function(t){return gt(t,n)?et.from(t[n]):et.none()}},Bt=function(t,n){return Tt(n)(t)},Dt=function(t,n){var e={};return e[t]=n,e},At=(pt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(t,n){return e=n,o={},ct(t,function(t,n){M(e,n)||(o[n]=t)}),o;var e,o}),_t=function(t){return Tt(t)},Mt=function(t,n){return e=t,o=n,function(t){return gt(t,e)?t[e]:o};var e,o},Ft=function(t,n){return Bt(t,n)},It=function(t,n){return Dt(t,n)},Rt=function(t){return n={},z(t,function(t){n[t.key]=t.value}),n;var n},Vt=function(t,n){var e,o,r,i,u,a=(e=[],o=[],z(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(R.error,q)(u)):(i=n,0===(r=a.values).length?R.value(i):R.value(bt(i,yt.apply(undefined,r))))},Nt=function(t,n){return gt(e=t,o=n)&&e[o]!==undefined&&null!==e[o];var e,o};(l=s||(s={}))[l.Error=0]="Error",l[l.Value=1]="Value";var Ht=function(t,n,e){return t.stype===s.Error?n(t.serror):e(t.svalue)},Pt=function(t){return{stype:s.Value,svalue:t}},zt=function(t){return{stype:s.Error,serror:t}},Lt=function(t){return t.fold(zt,Pt)},jt=function(t){return Ht(t,R.error,R.value)},Ut=Pt,Wt=function(t){var n=[],e=[];return z(t,function(t){Ht(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Gt=zt,Xt=function(t,n){return t.stype===s.Value?n(t.svalue):t},Yt=function(t,n){return t.stype===s.Error?n(t.serror):t},qt=function(t,n){return t.stype===s.Value?{stype:s.Value,svalue:n(t.svalue)}:t},Kt=function(t,n){return t.stype===s.Error?{stype:s.Error,serror:n(t.serror)}:t},$t=function(t){return p(Gt,q)(t)},Jt=function(t,n){var e,o,r=Wt(t);return 0<r.errors.length?$t(r.errors):(e=r.values,o=n,0<e.length?Ut(bt(o,yt.apply(undefined,e))):Ut(o))},Qt=function(t){var n=Wt(t);return 0<n.errors.length?$t(n.errors):Ut(n.values)},Zt=pt([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),tn=pt([{field:["name","presence","type"]},{state:["name"]}]),nn="undefined"!=typeof F.window?F.window:Function("return this;")(),en=function(t,n){return function(t,n){for(var e=n!==undefined&&null!==n?n:nn,o=0;o<t.length&&e!==undefined&&null!==e;++o)e=e[t[o]];return e}(t.split("."),n)},on={getOrDie:function(t,n){var e=en(t,n);if(e===undefined||null===e)throw new Error(t+" not available on this browser");return e}},rn=function(){return on.getOrDie("JSON")},un=function(t,n,e){return rn().stringify(t,n,e)},an=function(t){return O(t)&&100<ut(t).length?" removed due to size":un(t,null,2)},cn=function(t,n){return Gt([{path:t,getErrorInfo:n}])},sn=pt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),ln=function(e,o,r){return Bt(o,r).fold(function(){return t=r,n=o,cn(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+an(n)});var t,n},Ut)},fn=function(t,n,e){var o=Bt(t,n).fold(function(){return e(t)},d);return Ut(o)},dn=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 qt(n,function(t){return Dt(e,s(t))})},u=function(t){return t.fold(function(){var t=Dt(e,s(et.none()));return Ut(t)},function(t){var n=o.extract(a.concat([r]),s,t);return qt(n,function(t){return Dt(e,s(et.some(t)))})})};return t.fold(function(){return Xt(ln(a,c,r),i)},function(t){return Xt(fn(c,r,t),i)},function(){return Xt(Ut(Bt(c,r)),u)},function(t){return Xt((e=t,o=Bt(n=c,r).map(function(t){return!0===t?e(n):t}),Ut(o)),u);var n,e,o},function(t){var n=t(c),e=qt(fn(c,r,nt({})),function(t){return bt(n,t)});return Xt(e,i)})},function(t,n){var e=n(c);return Ut(Dt(t,s(e)))})},mn=function(o){return{extract:function(e,t,n){return Yt(o(n,t),function(t){return n=t,cn(e,function(){return n});var n})},toString:function(){return"val"},toDsl:function(){return Zt.itemOf(o)}}},gn=function(t){var c=pn(t),s=j(t,function(n,t){return t.fold(function(t){return bt(n,It(t,!0))},nt(n))},{});return{extract:function(t,n,e){var o,r,i,u=T(e)?[]:(r=ut(o=e),L(r,function(t){return Nt(o,t)})),a=L(u,function(t){return!Nt(s,t)});return 0===a.length?c.extract(t,n,e):(i=a,cn(t,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},pn=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=P(a,function(t){return dn(o,r,t,i)}),Jt(u,{});var o,r,i,u},toString:function(){return"obj{\n"+P(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 Zt.objOf(P(a,function(t){return t.fold(function(t,n,e,o){return tn.field(t,e,o)},function(t,n){return tn.state(t)})}))}}},hn=function(r){return{extract:function(e,o,t){var n=P(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return Qt(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return Zt.arrOf(r)}}},vn=function(a,c){return{extract:function(e,o,r){var t,n,i=ut(r),u=(t=e,n=i,hn(mn(a)).extract(t,d,n));return Xt(u,function(t){var n=P(t,function(t){return sn.field(t,t,Ct(),c)});return pn(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return Zt.setOf(a,c)}}},bn=nt(mn(Ut)),yn=p(hn,pn),xn=sn.state,wn=sn.field,Sn=function(e,n,o,r,i){return Ft(r,i).fold(function(){return t=r,n=i,cn(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+an(t)});var t,n},function(t){return pn(t).extract(e.concat(["branch: "+i]),n,o)})},Cn=function(r,i){return{extract:function(n,e,o){return Ft(o,r).fold(function(){return t=r,cn(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return Sn(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+ut(i)},toDsl:function(){return Zt.choiceOf(r,i)}}},kn=mn(Ut),On=function(o){return{extract:function(t,n,e){return o().extract(t,n,e)},toString:function(){return o().toString()},toDsl:function(){return o().toDsl()}}},En=function(n){return mn(function(t){return n(t).fold(Gt,Ut)})},Tn=function(n,t){return vn(function(t){return Lt(n(t))},t)},Bn=function(t,n,e){return jt((o=t,r=d,i=e,u=n.extract([o],r,i),Kt(u,function(t){return{input:i,errors:t}})));var o,r,i,u},Dn=function(t){return t.fold(function(t){throw new Error(_n(t))},d)},An=function(t,n,e){return Dn(Bn(t,n,e))},_n=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,P(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+an(t.input);var n,e},Mn=function(t,n){return Cn(t,n)},Fn=nt(kn),In=function(e,o){return mn(function(t){var n=typeof t;return e(t)?Ut(t):Gt("Expected type: "+o+" but got: "+n)})},Rn=In(V,"number"),Vn=In(k,"string"),Nn=In(T,"boolean"),Hn=In(B,"function"),Pn=function(n){return En(function(t){return M(n,t)?R.value(t):R.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},zn=function(t){return wn(t,t,Ct(),bn())},Ln=function(t,n){return wn(t,t,Ct(),n)},jn=function(t){return Ln(t,Vn)},Un=function(t,n){return wn(t,t,Ct(),Pn(n))},Wn=function(t){return Ln(t,Hn)},Gn=function(t,n){return wn(t,t,Ct(),pn(n))},Xn=function(t,n){return wn(t,t,Ct(),yn(n))},Yn=function(t,n){return wn(t,t,Ct(),hn(n))},qn=function(t){return wn(t,t,kt(),bn())},Kn=function(t,n){return wn(t,t,kt(),n)},$n=function(t){return Kn(t,Rn)},Jn=function(t){return Kn(t,Vn)},Qn=function(t){return Kn(t,Hn)},Zn=function(t,n){return Kn(t,pn(n))},te=function(t,n){return wn(t,t,St(n),bn())},ne=function(t,n,e){return wn(t,t,St(n),e)},ee=function(t,n){return ne(t,n,Rn)},oe=function(t,n){return ne(t,n,Vn)},re=function(t,n,e){return ne(t,n,Pn(e))},ie=function(t,n){return ne(t,n,Nn)},ue=function(t,n){return ne(t,n,Hn)},ae=function(t,n,e){return ne(t,n,pn(e))},ce=function(t,n){return xn(t,n)},se=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return se(e())}}},le=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:nt(t)}},fe={fromHtml:function(t,n){var e=(n||F.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw F.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return le(e.childNodes[0])},fromTag:function(t,n){var e=(n||F.document).createElement(t);return le(e)},fromText:function(t,n){var e=(n||F.document).createTextNode(t);return le(e)},fromDom:le,fromPoint:function(t,n,e){var o=t.dom();return et.from(o.elementFromPoint(n,e)).map(le)}},de=function(){return on.getOrDie("Node")},me=function(t,n,e){return 0!=(t.compareDocumentPosition(n)&e)},ge=function(t,n){return me(t,n,de().DOCUMENT_POSITION_CONTAINED_BY)},pe=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 ve(o(1),o(2))},he=function(){return ve(0,0)},ve=function(t,n){return{major:t,minor:n}},be={nu:ve,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?he():pe(t,e)},unknown:he},ye="Firefox",xe=function(t,n){return function(){return n===t}},we=function(t){var n=t.current;return{current:n,version:t.version,isEdge:xe("Edge",n),isChrome:xe("Chrome",n),isIE:xe("IE",n),isOpera:xe("Opera",n),isFirefox:xe(ye,n),isSafari:xe("Safari",n)}},Se={unknown:function(){return we({current:undefined,version:be.unknown()})},nu:we,edge:nt("Edge"),chrome:nt("Chrome"),ie:nt("IE"),opera:nt("Opera"),firefox:nt(ye),safari:nt("Safari")},Ce="Windows",ke="Android",Oe="Solaris",Ee="FreeBSD",Te=function(t,n){return function(){return n===t}},Be=function(t){var n=t.current;return{current:n,version:t.version,isWindows:Te(Ce,n),isiOS:Te("iOS",n),isAndroid:Te(ke,n),isOSX:Te("OSX",n),isLinux:Te("Linux",n),isSolaris:Te(Oe,n),isFreeBSD:Te(Ee,n)}},De={unknown:function(){return Be({current:undefined,version:be.unknown()})},nu:Be,windows:nt(Ce),ios:nt("iOS"),android:nt(ke),linux:nt("Linux"),osx:nt("OSX"),solaris:nt(Oe),freebsd:nt(Ee)},Ae=function(t,n){var e=String(n).toLowerCase();return W(t,function(t){return t.search(e)})},_e=function(t,e){return Ae(t,e).map(function(t){var n=be.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Me=function(t,e){return Ae(t,e).map(function(t){var n=be.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Fe=function(t,n){return-1!==t.indexOf(n)},Ie=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Re=function(n){return function(t){return Fe(t,n)}},Ve=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Fe(t,"edge/")&&Fe(t,"chrome")&&Fe(t,"safari")&&Fe(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ie],search:function(t){return Fe(t,"chrome")&&!Fe(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Fe(t,"msie")||Fe(t,"trident")}},{name:"Opera",versionRegexes:[Ie,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Re("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Re("firefox")},{name:"Safari",versionRegexes:[Ie,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Fe(t,"safari")||Fe(t,"mobile/"))&&Fe(t,"applewebkit")}}],Ne=[{name:"Windows",search:Re("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Fe(t,"iphone")||Fe(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Re("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Re("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Re("linux"),versionRegexes:[]},{name:"Solaris",search:Re("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Re("freebsd"),versionRegexes:[]}],He={browsers:nt(Ve),oses:nt(Ne)},Pe=function(t){var n,e,o,r,i,u,a,c,s,l,f,d=He.browsers(),m=He.oses(),g=_e(d,t).fold(Se.unknown,Se.nu),p=Me(m,t).fold(De.unknown,De.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(),l=s&&!c,f=e.isSafari()&&n.isiOS()&&!1===/safari/i.test(o),{isiPad:nt(r),isiPhone:nt(i),isTablet:nt(c),isPhone:nt(l),isTouch:nt(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:nt(f)})}},ze={detect:xt(function(){var t=F.navigator.userAgent;return Pe(t)})},Le=(F.Node.ATTRIBUTE_NODE,F.Node.CDATA_SECTION_NODE,F.Node.COMMENT_NODE,F.Node.DOCUMENT_NODE),je=(F.Node.DOCUMENT_TYPE_NODE,F.Node.DOCUMENT_FRAGMENT_NODE,F.Node.ELEMENT_NODE),Ue=F.Node.TEXT_NODE,We=(F.Node.PROCESSING_INSTRUCTION_NODE,F.Node.ENTITY_REFERENCE_NODE,F.Node.ENTITY_NODE,F.Node.NOTATION_NODE,je),Ge=Le,Xe=function(t,n){var e=t.dom();if(e.nodeType!==We)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")},Ye=function(t){return t.nodeType!==We&&t.nodeType!==Ge||0===t.childElementCount},qe=function(t,n){var e=n===undefined?F.document:n.dom();return Ye(e)?[]:P(e.querySelectorAll(t),fe.fromDom)},Ke=function(t,n){return t.dom()===n.dom()},$e=(ze.detect().browser.isIE(),function(t,n){return Ke(t.element(),n.event().target())}),Je=function(t){if(!Nt(t,"can")&&!Nt(t,"abort")&&!Nt(t,"run"))throw new Error("EventHandler defined by: "+un(t,null,2)+" does not have can, abort, or run!");return An("Extracting event.handler",gn([te("can",nt(!0)),te("abort",nt(!1)),te("run",tt)]),t)},Qe=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 Je({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];z(e,function(t){t.run.apply(undefined,n)})}})},Ze=nt("touchstart"),to=nt("touchmove"),no=nt("touchend"),eo=nt("mousedown"),oo=nt("mousemove"),ro=nt("mouseout"),io=nt("mouseup"),uo=nt("mouseover"),ao=nt("focusin"),co=nt("focusout"),so=nt("keydown"),lo=nt("keyup"),fo=nt("input"),mo=nt("change"),go=nt("click"),po=nt("transitionend"),ho=nt("selectstart"),vo={tap:nt("alloy.tap")},bo=nt("alloy.focus"),yo=nt("alloy.blur.post"),xo=nt("alloy.paste.post"),wo=nt("alloy.receive"),So=nt("alloy.execute"),Co=nt("alloy.focus.item"),ko=vo.tap,Oo=ze.detect().deviceType.isTouch()?vo.tap:go,Eo=nt("alloy.longpress"),To=nt("alloy.sandbox.close"),Bo=nt("alloy.typeahead.cancel"),Do=nt("alloy.system.init"),Ao=nt("alloy.system.scroll"),_o=nt("alloy.system.resize"),Mo=nt("alloy.system.attached"),Fo=nt("alloy.system.detached"),Io=nt("alloy.system.dismissRequested"),Ro=nt("alloy.focusmanager.shifted"),Vo=nt("alloy.slotcontainer.visibility"),No=nt("alloy.change.tab"),Ho=nt("alloy.dismiss.tab"),Po=nt("alloy.highlight"),zo=nt("alloy.dehighlight"),Lo=function(t,n){Go(t,t.element(),n,{})},jo=function(t,n,e){Go(t,t.element(),n,e)},Uo=function(t){Lo(t,So())},Wo=function(t,n,e){Go(t,n,e,{})},Go=function(t,n,e,o){var r=I({target:n},o);t.getSystem().triggerEvent(e,n,st(r,nt))},Xo=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())};function Yo(t,n,e,o,r){return t(e,o)?et.some(e):B(r)&&r(e)?et.none():n(e,o,r)}var qo,Ko,$o,Jo,Qo,Zo=function(t){return t.dom().nodeName.toLowerCase()},tr=function(n){return function(t){return t.dom().nodeType===n}},nr=tr(je),er=tr(Ue),or=tr(Le),rr=function(t){var n=er(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},ir=xt(function(){return ur(fe.fromDom(F.document))}),ur=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return fe.fromDom(n)},ar=function(t,n,e){for(var o=t.dom(),r=B(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=fe.fromDom(o);if(n(i))return et.some(i);if(r(i))break}return et.none()},cr=function(t,n,e){return Yo(function(t){return n(t)},ar,t,n,e)},sr=function(t,o){var r=function(t){for(var n=0;n<t.childNodes.length;n++){if(o(fe.fromDom(t.childNodes[n])))return et.some(fe.fromDom(t.childNodes[n]));var e=r(t.childNodes[n]);if(e.isSome())return e}return et.none()};return r(t.dom())},lr=function(t,n,e){return cr(t,function(t){return n(t).isSome()},e).bind(n)},fr=function(t){return Rt(t)},dr=function(t,n){return{key:t,value:Je({abort:n})}},mr=function(t){return{key:t,value:Je({run:function(t,n){n.event().prevent()}})}},gr=function(t,n){return{key:t,value:Je({run:n})}},pr=function(t,n,e){return{key:t,value:Je({run:function(t){n.apply(undefined,[t].concat(e))}})}},hr=function(t){return function(e){return{key:t,value:Je({run:function(t,n){$e(t,n)&&e(t,n)}})}}},vr=function(t,n,e){var o,r,i=n.partUids[e];return r=i,gr(o=t,function(t,n){t.getSystem().getByUid(r).each(function(t){Xo(t,t.element(),o,n)})})},br=function(t,r){return gr(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return lr(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},nt(!1)).getOr(n)},function(t){return t});r(n,o,t)})},yr=function(t){return gr(t,function(t,n){n.cut()})},xr=function(t){return gr(t,function(t,n){n.stop()})},wr=function(t,n){return hr(t)(n)},Sr=hr(Mo()),Cr=hr(Fo()),kr=hr(Do()),Or=(qo=So(),function(t){return gr(qo,t)}),Er=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 z(n,function(t,n){o[t]=nt(e[n])}),o}},Tr=function(t){return t.slice(0).sort()},Br=function(n,t){if(!E(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");z(t,function(t){if(!k(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},Dr=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 Br("required",r),Br("optional",i),e=Tr(u),W(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=ut(n);$(r,function(t){return M(e,t)})||function(t,n){throw new Error("All required keys ("+Tr(t).join(", ")+") were not specified. Specified keys were: "+Tr(n).join(", ")+".")}(r,e);var t=L(e,function(t){return!M(u,t)});0<t.length&&function(t){throw new Error("Unsupported keys for object: "+Tr(t).join(", "))}(t);var o={};return z(r,function(t){o[t]=nt(n[t])}),z(i,function(t){o[t]=nt(Object.prototype.hasOwnProperty.call(n,t)?et.some(n[t]):et.none())}),o}},Ar=function(t){return fe.fromDom(t.dom().ownerDocument)},_r=function(t){var n=t.dom().ownerDocument.defaultView;return fe.fromDom(n)},Mr=function(t){var n=t.dom();return et.from(n.parentNode).map(fe.fromDom)},Fr=function(t){var n=t.dom();return et.from(n.offsetParent).map(fe.fromDom)},Ir=function(t){var n=t.dom();return P(n.childNodes,fe.fromDom)},Rr=function(t,n){var e=t.dom().childNodes;return et.from(e[n]).map(fe.fromDom)},Vr=(Er("element","offset"),function(n,e){Mr(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})}),Nr=function(t,n){var e;(e=t.dom(),et.from(e.nextSibling).map(fe.fromDom)).fold(function(){Mr(t).each(function(t){Pr(t,n)})},function(t){Vr(t,n)})},Hr=function(n,e){Rr(n,0).fold(function(){Pr(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},Pr=function(t,n){t.dom().appendChild(n.dom())},zr=function(n,t){z(t,function(t){Pr(n,t)})},Lr=function(t){t.dom().textContent="",z(Ir(t),function(t){jr(t)})},jr=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},Ur=function(t){var n,e=Ir(t);0<e.length&&(n=t,z(e,function(t){Vr(n,t)})),jr(t)},Wr=function(t){return t.dom().innerHTML},Gr=function(t,n){var e,o,r=Ar(t).dom(),i=fe.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||F.document).createElement("div")).innerHTML=e,Ir(fe.fromDom(o)));zr(i,u),Lr(t),Pr(t,i)},Xr=function(t,n,e){if(!(k(e)||T(e)||V(e)))throw F.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},Yr=function(t,n,e){Xr(t.dom(),n,e)},qr=function(t,n){var e=t.dom();ct(n,function(t,n){Xr(e,n,t)})},Kr=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},$r=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},Jr=function(t,n){t.dom().removeAttribute(n)},Qr=function(t){return n=t,e=!1,fe.fromDom(n.dom().cloneNode(e));var n,e},Zr=function(t){var n,e,o,r=Qr(t);return n=r,e=fe.fromTag("div"),o=fe.fromDom(n.dom().cloneNode(!0)),Pr(e,o),Wr(e)},ti=function(t){return Zr(t)},ni=fr([(Ko=bo(),$o=function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(Ke(e=r,t.element())&&!Ke(e,o))||(F.console.warn(bo()+" did not get interpreted by the desired target. \nOriginator: "+ti(r)+"\nTarget: "+ti(i)+"\nCheck the "+bo()+" event handlers"),!1)},{key:Ko,value:Je({can:$o})})]),ei=/* */Object.freeze({events:ni}),oi=0,ri=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++oi+String(n)},ii=nt("alloy-id-"),ui=nt("data-alloy-id"),ai=ii(),ci=ui(),si=function(t,n){Object.defineProperty(t.dom(),ci,{value:n,writable:!0})},li=function(t){var n=nr(t)?t.dom()[ci]:null;return et.from(n)},fi=function(t){return ri(t)},di=d,mi=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+ti(n().element())+" is not in context.")}};return{debugInfo:nt("fake"),triggerEvent:t("triggerEvent"),triggerFocus:t("triggerFocus"),triggerEscape:t("triggerEscape"),build:t("build"),addToWorld:t("addToWorld"),removeFromWorld:t("removeFromWorld"),addToGui:t("addToGui"),removeFromGui:t("removeFromGui"),getByUid:t("getByUid"),getByDom:t("getByDom"),broadcast:t("broadcast"),broadcastOn:t("broadcastOn"),broadcastEvent:t("broadcastEvent"),isConnected:nt(!1)}},gi=mi(),pi=function(t){return P(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})},hi=function(t,n){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return t.toFunctionAnnotation=function(){return{name:n,parameters:pi(i)}},t},vi=ri("alloy-premade"),bi=function(t){return It(vi,t)},yi=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(undefined,[t.getApis()].concat([t].concat(n)))},n=o.toString(),e=n.indexOf(")")+1,r=n.indexOf("("),i=n.substring(r+1,e-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:pi(i.slice(1))}},t;var t,n,e,r,i},xi={init:function(){return wi({readState:function(){return"No State required"}})}},wi=function(t){return t},Si=function(t,r){var i={};return ct(t,function(t,o){ct(t,function(t,n){var e=Mt(n,[])(i);i[n]=e.concat([r(o,t)])})}),i},Ci=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},ki=function(t,n){return e=g.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:nt(o)};var e,o},Oi=function(t){return t.cHandler},Ei=function(t,n){return{name:nt(t),handler:nt(n)}},Ti=function(t,n,e){var o,r,i=I({},e,(o=t,r={},z(n,function(t){r[t.name()]=t.handlers(o)}),r));return Si(i,Ei)},Bi=function(t){var n,i=B(n=t)?{can:nt(!0),abort:nt(!1),run:n}:n;return function(t,n){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=[t,n].concat(e);i.abort.apply(undefined,r)?n.stop():i.can.apply(undefined,r)&&i.run.apply(undefined,r)}},Di=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: "+un(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+un(c,null,2));return r<i?-1:i<r?1:0});return R.value(e)}catch(o){return R.error([o])}}("Event: "+e,"name",t,i).map(function(t){var n=P(t,function(t){return t.handler()});return Qe(n)}):(o=e,r=t,R.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: '+un(P(r,function(t){return t.name()}),null,2)]))},Ai=function(t,i){var n=ft(t,function(o,r){return(1===o.length?R.value(o[0].handler()):Di(o,i,r)).map(function(t){var n=Bi(t),e=1<o.length?L(i,function(n){return M(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return It(r,{handler:n,purpose:nt(e)})})});return Vt(n,{})},_i=function(t){return Bn("custom.definition",pn([wn("dom","dom",Ct(),pn([zn("tag"),te("styles",{}),te("classes",[]),te("attributes",{}),qn("value"),qn("innerHtml")])),zn("components"),zn("uid"),te("events",{}),te("apis",{}),wn("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"]},wt.mergeWithThunk(nt(n))),Fn()),qn("domModification")]),t);var n},Mi=function(t,n){var e=Kr(t,n);return e===undefined||""===e?[]:e.split(" ")},Fi=function(t){return t.dom().classList!==undefined},Ii=function(t,n){return r=n,i=Mi(e=t,o="class").concat([r]),Yr(e,o,i.join(" ")),!0;var e,o,r,i},Ri=function(t,n){return r=n,0<(i=L(Mi(e=t,o="class"),function(t){return t!==r})).length?Yr(e,o,i.join(" ")):Jr(e,o),!1;var e,o,r,i},Vi=function(t,n){Fi(t)?t.dom().classList.add(n):Ii(t,n)},Ni=function(t){0===(Fi(t)?t.dom().classList:Mi(t,"class")).length&&Jr(t,"class")},Hi=function(t,n){Fi(t)?t.dom().classList.remove(n):Ri(t,n);Ni(t)},Pi=function(t,n){return Fi(t)&&t.dom().classList.contains(n)},zi=function(n,t){z(t,function(t){Vi(n,t)})},Li=function(n,t){z(t,function(t){Hi(n,t)})},ji=function(t){return t.style!==undefined&&B(t.style.getPropertyValue)},Ui=function(t,n,e){if(!k(e))throw F.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);ji(t)&&t.style.setProperty(n,e)},Wi=function(t,n){ji(t)&&t.style.removeProperty(n)},Gi=function(t,n,e){var o=t.dom();Ui(o,n,e)},Xi=function(t,n){var e=t.dom();ct(n,function(t,n){Ui(e,n,t)})},Yi=function(t,n){var e=t.dom(),o=F.window.getComputedStyle(e).getPropertyValue(n),r=""!==o||rr(t)?o:qi(e,n);return null===r?undefined:r},qi=function(t,n){return ji(t)?t.style.getPropertyValue(n):""},Ki=function(t,n){var e=t.dom(),o=qi(e,n);return et.from(o).filter(function(t){return 0<t.length})},$i=function(t,n,e){var o=fe.fromTag(t);return Gi(o,n,e),Ki(o,n).isSome()},Ji=function(t,n){var e=t.dom();Wi(e,n),$r(t,"style")&&""===Kr(t,"style").replace(/^\s+|\s+$/g,"")&&Jr(t,"style")},Qi=function(t){return t.dom().offsetWidth},Zi=function(t){return t.dom().value},tu=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},nu=function(t,n){return e=t,r=P(o=n,function(t){return Zn(t.name(),[zn("config"),te("state",xi)])}),i=Bn("component.behaviours",pn(r),e.behaviours).fold(function(t){throw new Error(_n(t)+"\nComplete spec:\n"+un(e,null,2))},function(t){return t}),{list:o,data:st(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},eu=function(t){var n,e,o,r=(n=t,e=Mt("behaviours",{})(n),o=L(ut(e),function(t){return e[t]!==undefined}),P(o,function(t){return e[t].me}));return nu(t,r)},ou=function(t,n,e){var o,r,i,u=I({},(o=t).dom,{uid:o.uid,domChildren:P(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return Ci({})},Ci),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=I({},t);z(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=Si(r,function(t,n){return{name:t,modification:n}}),u=function(t){return j(t,function(t,n){return I({},n.modification,t)},{})},a=j(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return Ci({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,I({},r=u,{attributes:I({},r.attributes,i.attributes),styles:I({},r.styles,i.styles),classes:r.classes.concat(i.classes)})},ru=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=Ti(r,u,a),Ai(c,i)).getOrDie()},iu=function(e){var t=function(){return l},o=se(gi),n=Dn(_i(e)),r=eu(e),i=r.list,u=r.data,a=function(t){var n=fe.fromTag(t.tag);qr(n,t.attributes),zi(n,t.classes),Xi(n,t.styles),t.innerHtml.each(function(t){return Gr(n,t)});var e=t.domChildren;return zr(n,e),t.value.each(function(t){tu(n,t)}),t.uid,si(n,t.uid),n}(ou(n,i,u)),c=ru(n,i,u),s=se(n.components),l={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 "+un(e,null,2))})()},hasConfigured:function(t){return B(u[t.name()])},spec:nt(e),readState:function(t){return u[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return n.apis},connect:function(t){o.set(t)},disconnect:function(){o.set(mi(t))},element:nt(a),syncComponents:function(){var t=Ir(a),n=K(t,function(t){return o.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});s.set(n)},components:s.get,events:nt(c)};return l},uu=function(t){var n,e,o=di(t),r=o.events,i=h(o,["events"]),u=(n=i,e=Mt("components",[])(n),P(e,lu)),a=I({},i,{events:I({},ei,r),components:u});return R.value(iu(a))},au=function(t){var n=fe.fromText(t);return cu({element:n})},cu=function(t){var n=An("external.component",gn([zn("element"),qn("uid")]),t),e=se(mi());n.uid.each(function(t){si(n.element,t)});var o={getSystem:e.get,config:et.none,hasConfigured:nt(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(mi(function(){return o}))},getApis:function(){return{}},element:nt(n.element),spec:nt(t),readState:nt("No state"),syncComponents:tt,components:nt([]),events:nt({})};return bi(o)},su=fi,lu=function(n){return(t=n,Ft(t,vi)).fold(function(){var t=n.hasOwnProperty("uid")?n:I({uid:su("")},n);return uu(t).getOrDie()},function(t){return t});var t},fu=bi,du=function(t,n,e){return ar(t,function(t){return Xe(t,n)},e)},mu=function(t,n){return e=n,r=(o=t)===undefined?F.document:o.dom(),Ye(r)?et.none():et.from(r.querySelector(e)).map(fe.fromDom);var e,o,r},gu=function(t,n,e){return Yo(Xe,du,t,n,e)},pu=function(){var n=ri("aria-owns");return{id:nt(n),link:function(t){Yr(t,"aria-owns",n)},unlink:function(t){Jr(t,"aria-owns")}}},hu=function(n,t){return(e=t,cr(e,function(t){if(!nr(t))return!1;var n=Kr(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=Kr(t,"id"),e=Ar(t);return mu(e,'[aria-owns="'+n+'"]')})).exists(function(t){return vu(n,t)});var e},vu=function(n,t){return e=t,r=nt(!(o=function(t){return Ke(t,n.element())})),cr(e,o,r).isSome()||hu(n,t);var e,o,r},bu=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},yu=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return et.none()},xu="unknown";(Qo=Jo||(Jo={}))[Qo.STOP=0]="STOP",Qo[Qo.NORMAL=1]="NORMAL",Qo[Qo.LOGGING=2]="LOGGING";var wu=se({}),Su=function(n,t,e){var o,r,i,u;switch(Ft(wu.get(),n).orThunk(function(){var t=ut(wu.get());return yu(t,function(t){return-1<n.indexOf(t)?et.some(wu.get()[t]):et.none()})}).getOr(Jo.NORMAL)){case Jo.NORMAL:return e(Ou());case Jo.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();M(["mousemove","mouseover","mouseout",Do()],o)||F.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:P(i,function(t){return M(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+ti(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Jo.STOP:return!0}},Cu=["alloy/data/Fields","alloy/debugging/Debugging"],ku=function(t,n,e){return Su(t,n,e)},Ou=nt({logEventCut:tt,logEventStopped:tt,logNoParent:tt,logEventNoHandlers:tt,logEventResponse:tt,write:tt}),Eu=nt([zn("menu"),zn("selectedMenu")]),Tu=nt([zn("item"),zn("selectedItem")]),Bu=(nt(pn(Tu().concat(Eu()))),nt(pn(Tu()))),Du=Gn("initSize",[zn("numColumns"),zn("numRows")]),Au=function(){return Gn("markers",[zn("backgroundMenu")].concat(Eu()).concat(Tu()))},_u=function(t){return Gn("markers",P(t,zn))},Mu=function(t,n,e){!function(){var t=new Error;if(t.stack===undefined)return;var n=t.stack.split("\n");W(n,function(n){return 0<n.indexOf("alloy")&&!N(Cu,function(t){return-1<n.indexOf(t)})}).getOr(xu)}();return wn(n,n,e,En(function(e){return R.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},Fu=function(t){return Mu(0,t,St(tt))},Iu=function(t){return Mu(0,t,St(et.none))},Ru=function(t){return Mu(0,t,Ct())},Vu=function(t){return Mu(0,t,Ct())},Nu=function(t,n){return ce(t,nt(n))},Hu=function(t){return ce(t,d)},Pu=nt(Du),zu=function(e,o,r){return kr(function(t,n){r(t,e,o)})},Lu=function(t,n,e,o,r,i){var u,a,c=gn(t),s=Zn(n,[(u="config",a=t,Kn(u,gn(a)))]);return Wu(c,s,n,e,o,r,i)},ju=function(r,i,u){var t,n,e,o,a,c;return t=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=[e].concat(t);return e.config({name:nt(r)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+r+". Using API: "+u)},function(t){var n=Array.prototype.slice.call(o,1);return i.apply(undefined,[e,t.config,t.state].concat(n))})},n=u,e=i.toString(),o=e.indexOf(")")+1,a=e.indexOf("("),c=e.substring(a+1,o-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:n,parameters:pi(c.slice(0,1).concat(c.slice(3)))}},t},Uu=function(t){return{key:t,value:undefined}},Wu=function(e,t,o,r,n,i,u){var a=function(t){return Nt(t,o)?t[o]():et.none()},c=st(n,function(t,n){return ju(o,t,n)}),s=st(i,function(t,n){return hi(t,n)}),l=I({},s,c,{revoke:g(Uu,o),config:function(t){var n=An(o+"-config",e,t);return{key:o,value:{config:n,me:l,configAsRaw:xt(function(){return An(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Ft(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(Ci({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Mt("events",function(t,n){return{}})(r)(t.config,t.state)}).getOr({})}});return l},Gu=function(t){return Rt(t)},Xu=gn([zn("fields"),zn("name"),te("active",{}),te("apis",{}),te("state",xi),te("extra",{})]),Yu=function(t){var n=An("Creating behaviour: "+t.name,Xu,t);return Lu(n.fields,n.name,n.active,n.apis,n.extra,n.state)},qu=gn([zn("branchKey"),zn("branches"),zn("name"),te("active",{}),te("apis",{}),te("state",xi),te("extra",{})]),Ku=function(t){var n,e,o,r,i,u,a,c,s=An("Creating behaviour: "+t.name,qu,t);return n=Mn(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=Zn(e,[Kn("config",a=n)]),Wu(a,c,e,o,r,i,u)},$u=nt(undefined),Ju=/* */Object.freeze({events:function(a){return fr([gr(wo(),function(r,i){var t,n,u=a.channels,e=ut(u),o=(t=e,(n=i).universal()?t:L(t,function(t){return M(n.channels(),t)}));z(o,function(t){var n=u[t],e=n.schema,o=An("channel["+t+"] data\nReceiver: "+ti(r.element()),e,i.data());n.onReceive(r,o)})})])}}),Qu=[Ln("channels",Tn(R.value,gn([Ru("onReceive"),te("schema",Fn())])))],Zu=Yu({fields:Qu,name:"receiving",active:Ju}),ta=/* */Object.freeze({exhibit:function(t,n){return Ci({classes:[],styles:n.useFixed?{}:{position:"relative"}})}}),na=function(e,o){return{left:nt(e),top:nt(o),translate:function(t,n){return na(e+t,o+n)}}},ea=na,oa=function(t,n){return t!==undefined?t:n!==undefined?n:0},ra=function(t){var n,e,o=t.dom().ownerDocument,r=o.body,i=(n=fe.fromDom(o),(e=n.dom())===e.window&&n instanceof F.Window?n:or(n)?e.defaultView||e.parentWindow:null),u=o.documentElement,a=oa(i.pageYOffset,u.scrollTop),c=oa(i.pageXOffset,u.scrollLeft),s=oa(u.clientTop,r.clientTop),l=oa(u.clientLeft,r.clientLeft);return ia(t).translate(c-l,a-s)},ia=function(t){var n,e,o,r=t.dom(),i=r.ownerDocument,u=i.body,a=fe.fromDom(i.documentElement);return u===r?ea(u.offsetLeft,u.offsetTop):(n=t,e=a||fe.fromDom(F.document.documentElement),ar(n,g(Ke,e)).isSome()?(o=r.getBoundingClientRect(),ea(o.left,o.top)):ea(0,0))};function ua(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=Yi(t,o);return parseFloat(e)||0}return n},i=function(r,t){return U(t,function(t,n){var e=Yi(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!V(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();ji(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 aa=ua("height",function(t){var n=t.dom();return rr(t)?n.getBoundingClientRect().height:n.offsetHeight}),ca=function(t){return aa.get(t)},sa=function(t){return aa.getOuter(t)},la=ua("width",function(t){return t.dom().offsetWidth}),fa=function(t){return la.get(t)},da=function(t){return la.getOuter(t)},ma=Er("point","width","height"),ga=Er("x","y","width","height"),pa=function(t,n,e,o){return{x:nt(t),y:nt(n),width:nt(e),height:nt(o),right:nt(t+e),bottom:nt(n+o)}},ha=function(t){var n=ra(t),e=da(t),o=sa(t);return pa(n.left(),n.top(),e,o)},va=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],ba=function(t,n,e){var r=function(t){return Ft(e,t).getOr([])},o=function(t,n,e){var o=Q(va,e);return{offset:function(){return ea(t,n)},classesOn:function(){return K(e,r)},classesOff:function(){return K(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"])},innerNorthwest:function(){return o(-t,n,["top","alignRight"])},innerNortheast:function(){return o(t,n,["top","alignLeft"])},innerNorth:function(){return o(-t/2,n,["top","alignCentre"])},innerSouthwest:function(){return o(-t,-n,["bottom","alignRight"])},innerSoutheast:function(){return o(t,-n,["bottom","alignLeft"])},innerSouth:function(){return o(-t/2,-n,["bottom","alignCentre"])},innerWest:function(){return o(t,-n/2,["valignCentre","right"])},innerEast:function(){return o(-t,-n/2,["valignCentre","left"])}}},ya=function(){return ba(0,0,{})},xa=Er("x","y","bubble","direction","label"),wa=pt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Sa=wa.southeast,Ca=wa.southwest,ka=wa.northeast,Oa=wa.northwest,Ea=wa.south,Ta=wa.north,Ba=wa.east,Da=wa.west,Aa=function(t){return t.x()},_a=function(t,n){return t.x()+t.width()/2-n.width()/2},Ma=function(t,n){return t.x()+t.width()-n.width()},Fa=function(t,n){return t.y()-n.height()},Ia=function(t){return t.y()+t.height()},Ra=function(t,n){return t.y()+t.height()/2-n.height()/2},Va=function(t,n,e){return xa(Aa(t),Ia(t),e.southeast(),Sa(),"layout-se")},Na=function(t,n,e){return xa(Ma(t,n),Ia(t),e.southwest(),Ca(),"layout-sw")},Ha=function(t,n,e){return xa(Aa(t),Fa(t,n),e.northeast(),ka(),"layout-ne")},Pa=function(t,n,e){return xa(Ma(t,n),Fa(t,n),e.northwest(),Oa(),"layout-nw")},za=function(t,n,e){return xa(_a(t,n),Fa(t,n),e.north(),Ta(),"layout-n")},La=function(t,n,e){return xa(_a(t,n),Ia(t),e.south(),Ea(),"layout-s")},ja=function(t,n,e){return xa((o=t).x()+o.width(),Ra(t,n),e.east(),Ba(),"layout-e");var o},Ua=function(t,n,e){return xa((o=n,t.x()-o.width()),Ra(t,n),e.west(),Da(),"layout-w");var o},Wa=function(){return[Va,Na,Ha,Pa,La,za,ja,Ua]},Ga=function(){return[Na,Va,Pa,Ha,La,za,ja,Ua]},Xa=(ze.detect().browser.isSafari(),function(t){var n=t!==undefined?t.dom():F.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return ea(e,o)}),Ya=Dr(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),qa=Er("position","left","top","right","bottom"),Ka=function(o,t){return o.view(t).fold(nt([]),function(t){var n=o.owner(t),e=Ka(o,n);return[t].concat(e)})},$a=/* */Object.freeze({view:function(t){return(t.dom()===F.document?et.none():et.from(t.dom().defaultView.frameElement)).map(fe.fromDom)},owner:function(t){return Ar(t)}}),Ja=function(o){var t,n,e,r,i=fe.fromDom(F.document),u=Xa(i);return(t=o,e=(n=$a).owner(t),r=Ka(n,e),et.some(r)).fold(g(ra,o),function(t){var n=ia(o),e=j(t,function(t,n){var e=ia(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return ea(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},Qa=function(){var t=F.window.innerWidth,n=F.window.innerHeight,e=fe.fromDom(F.document),o=Xa(e);return pa(o.left(),o.top(),t,n)},Za=pt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),tc=function(t,n,e,o,r,i){var u,a,c,s,l,f,d,m,g,p=n.x()-e,h=n.y()-o,v=r-(p+n.width()),b=i-(h+n.height()),y=et.some(p),x=et.some(h),w=et.some(v),S=et.some(b),C=et.none();return u=n.direction(),a=function(){return qa(t,y,x,C,C)},c=function(){return qa(t,C,x,w,C)},s=function(){return qa(t,y,C,C,S)},l=function(){return qa(t,C,C,w,S)},f=function(){return qa(t,y,x,C,C)},d=function(){return qa(t,y,C,C,S)},m=function(){return qa(t,y,x,C,C)},g=function(){return qa(t,C,x,w,C)},u.fold(a,c,s,l,f,d,m,g)},nc=function(t,n){var e=g(Ja,n),o=t.fold(e,e,function(){var t=Xa();return Ja(n).translate(-t.left(),-t.top())}),r=da(n),i=sa(n);return pa(o.left(),o.top(),r,i)},ec=Za.relative,oc=Za.fixed,rc=function(t){return t},ic=function(n,e){return function(t){return"rtl"===uc(t)?e:n}},uc=function(t){return"rtl"===Yi(t,"direction")?"rtl":"ltr"},ac=function(){return Zn("layouts",[zn("onLtr"),zn("onRtl")])},cc=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 ic(r,i)(n)},sc=[zn("hotspot"),qn("bubble"),te("overrides",{}),ac(),Nu("placement",function(t,n,e){var o=n.hotspot,r=nc(e,o.element()),i=cc(t.element(),n,Wa(),Ga());return et.some(rc({anchorBox:r,bubble:n.bubble.getOr(ya()),overrides:n.overrides,layouts:i,placer:et.none()}))})],lc=[zn("x"),zn("y"),te("height",0),te("width",0),te("bubble",ya()),te("overrides",{}),ac(),Nu("placement",function(t,n,e){var o=pa(n.x,n.y,n.width,n.height),r=cc(t.element(),n,Wa(),Ga());return et.some(rc({anchorBox:o,bubble:n.bubble,overrides:n.overrides,layouts:r,placer:et.none()}))})],fc={create:Er("start","soffset","finish","foffset")},dc=pt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),mc=(dc.before,dc.on,dc.after,function(t){return t.fold(d,d,d)}),gc=pt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),pc={domRange:gc.domRange,relative:gc.relative,exact:gc.exact,exactFromRange:function(t){return gc.exact(t.start(),t.soffset(),t.finish(),t.foffset())},getWin:function(t){var n=t.match({domRange:function(t){return fe.fromDom(t.startContainer)},relative:function(t,n){return mc(t)},exact:function(t,n,e,o){return t}});return _r(n)},range:fc.create},hc=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},vc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},bc=function(t){return{left:nt(t.left),top:nt(t.top),right:nt(t.right),bottom:nt(t.bottom),width:nt(t.width),height:nt(t.height)}},yc=pt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),xc=function(t,n,e){return n(fe.fromDom(e.startContainer),e.startOffset,fe.fromDom(e.endContainer),e.endOffset)},wc=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:nt(t),rtl:et.none}},relative:function(t,n){return{ltr:xt(function(){return hc(r,t,n)}),rtl:xt(function(){return et.some(hc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:xt(function(){return vc(r,t,n,e,o)}),rtl:xt(function(){return et.some(vc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return yc.rtl(fe.fromDom(t.endContainer),t.endOffset,fe.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return xc(0,yc.ltr,o)}):xc(0,yc.ltr,o)},Sc=function(t,n,e){return n>=t.left&&n<=t.right&&e>=t.top&&e<=t.bottom};var Cc=function L_(e,o){var r=function(t){return e(t)?et.from(t.dom().nodeValue):et.none()},t=ze.detect().browser,n=t.isIE()&&10===t.version.major?function(t){try{return r(t)}catch(n){return et.none()}}:r;return{get:function(t){if(!e(t))throw new Error("Can only get "+o+" value of a "+o+" node");return n(t).getOr("")},getOption:n,set:function(t,n){if(!e(t))throw new Error("Can only set raw "+o+" value of a "+o+" node");t.dom().nodeValue=n}}}(er,"text"),kc=function(t){return Cc.get(t)},Oc=function(t){return Cc.getOption(t)},Ec=function(e,o,t,n,r){var i=function(t){var n=e.dom().createRange();return n.setStart(o.dom(),t),n.collapse(!0),n},u=kc(o).length,a=function(t,n,e,o,r){if(0===r)return 0;if(n===o)return r-1;for(var i=o,u=1;u<r;u++){var a=t(u),c=Math.abs(n-a.left);if(e<=a.bottom){if(e<a.top||i<c)return u-1;i=c}}return 0}(function(t){return i(t).getBoundingClientRect()},t,n,r.right,u);return i(a)},Tc=function(n,e,o,r){var t=n.dom().createRange();t.selectNode(e.dom());var i=t.getClientRects();return yu(i,function(t){return Sc(t,o,r)?et.some(t):et.none()}).map(function(t){return Ec(n,e,o,r,t)})},Bc=function(n,t,e,o){var r=n.dom().createRange(),i=Ir(t);return yu(i,function(t){return r.selectNode(t.dom()),Sc(r.getBoundingClientRect(),e,o)?Dc(n,t,e,o):et.none()})},Dc=function(t,n,e,o){return(er(n)?Tc:Bc)(t,n,e,o)},Ac=["img","br"],_c=function(t){return Oc(t).filter(function(t){return 0!==t.trim().length||-1<t.indexOf("\xa0")}).isSome()||M(Ac,Zo(t))},Mc=function(t){return sr(t,_c)},Fc=function(t){return Ic(t,_c)},Ic=function(t,i){var u=function(t){for(var n=Ir(t),e=n.length-1;0<=e;e--){var o=n[e];if(i(o))return et.some(o);var r=u(o);if(r.isSome())return r}return et.none()};return u(t)},Rc=function(t,n){return n-t.left<t.right-n},Vc=function(t,n,e){var o=t.dom().createRange();return o.selectNode(n.dom()),o.collapse(e),o},Nc=function(n,t,e){var o=n.dom().createRange();o.selectNode(t.dom());var r=o.getBoundingClientRect(),i=Rc(r,e);return(!0===i?Mc:Fc)(t).map(function(t){return Vc(n,t,i)})},Hc=function(t,n,e){var o=n.dom().getBoundingClientRect(),r=Rc(o,e);return et.some(Vc(t,n,r))},Pc=function(t,n,e,o){var r=t.dom().createRange();r.selectNode(n.dom());var i=r.getBoundingClientRect();return function(t,n,e,o){var r=t.dom().createRange();r.selectNode(n.dom());var i=r.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,e)),a=Math.max(i.top,Math.min(i.bottom,o));return Dc(t,n,u,a)}(t,n,Math.max(i.left,Math.min(i.right,e)),Math.max(i.top,Math.min(i.bottom,o)))},zc=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(t,n){return qe(n,t)}),Lc=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=Ar(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),l=Ke(t,e)&&n===o;return s.collapsed&&!l},jc=function(t){var n=fe.fromDom(t.anchorNode),e=fe.fromDom(t.focusNode);return Lc(n,t.anchorOffset,e,t.focusOffset)?et.some(fc.create(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return et.some(fc.create(fe.fromDom(n.startContainer),n.startOffset,fe.fromDom(e.endContainer),e.endOffset))}return et.none()}(t)},Uc=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?et.some(r).map(bc):et.none()},Wc=Er("element","offset"),Gc=pt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Xc=function(t){return t.fold(function(t){return t},function(t,n,e){return t.translate(-n,-e)})},Yc=function(t){return t.fold(function(t){return t},function(t,n,e){return t})},qc=function(t){return U(t,function(t,n){return t.translate(n.left(),n.top())},ea(0,0))},Kc=function(t){var n=P(t,Yc);return qc(n)},$c=Gc.screen,Jc=Gc.absolute,Qc=function(t,n,e){var o,r,i,u=Ar(t.element()),a=Xa(u),c=(o=t,r=e,i=_r(r.root).dom(),et.from(i.frameElement).map(fe.fromDom).filter(function(t){var n=Ar(t),e=Ar(o.element());return Ke(n,e)}).map(ra)).getOr(a);return Jc(c,a.left(),a.top())},Zc=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=$c(ea(r,i));return et.some(ma(c,u,a))},ts=function(t,c,s,l,f){return t.map(function(t){var n,e,o,r=[c,t.point()],i=(n=function(){return Kc(r)},e=function(){return Kc(r)},o=function(){return t=P(r,Xc),qc(t);var t},l.fold(n,e,o)),u=ga(i.left(),i.top(),t.width(),t.height()),a=cc(f,s,s.showAbove?[Ha,Pa,Va,Na,za,La]:[Va,Na,Ha,Pa,La,La],s.showAbove?[Pa,Ha,Na,Va,za,La]:[Na,Va,Pa,Ha,La,za]);return rc({anchorBox:u,bubble:s.bubble.getOr(ya()),overrides:s.overrides,layouts:a,placer:et.none()})})},ns=Er("element","offset"),es=function(t,n){return er(t)?ns(t,n):function(t,n){var e=Ir(t);if(0===e.length)return Wc(t,n);if(n<e.length)return Wc(e[n],0);var o=e[e.length-1],r=er(o)?kc(o).length:Ir(o).length;return Wc(o,r)}(t,n)},os=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,et.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(jc);var t}})().map(function(t){var n=es(t.start(),t.soffset()),e=es(t.finish(),t.foffset());return pc.range(n.element(),n.offset(),e.element(),e.offset())})},rs=[qn("getSelection"),zn("root"),qn("bubble"),ac(),te("overrides",{}),te("showAbove",!1),Nu("placement",function(t,n,e){var o=_r(n.root).dom(),r=Qc(t,0,n),i=os(o,n).bind(function(t){return Uc(o,pc.exactFromRange(t)).orThunk(function(){var n=fe.fromText("\ufeff");return Vr(t.start(),n),Uc(o,pc.exact(n,0,n,1)).map(function(t){return jr(n),t})}).bind(function(t){return Zc(t.left(),t.top(),t.width(),t.height())})}),u=os(o,n).bind(function(t){return nr(t.start())?et.some(t.start()):Mr(t.start())}).getOr(t.element());return ts(i,r,n,e,u)})],is=[zn("node"),zn("root"),qn("bubble"),ac(),te("overrides",{}),te("showAbove",!1),Nu("placement",function(r,i,u){var a=Qc(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=Zc(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return ts(e,a,i,u,o)})})],us=function(t){return t.x()+t.width()},as=function(t,n){return t.x()-n.width()},cs=function(t,n){return t.y()-n.height()+t.height()},ss=function(t){return t.y()},ls=function(t,n,e){return xa(us(t),ss(t),e.southeast(),Sa(),"link-layout-se")},fs=function(t,n,e){return xa(as(t,n),ss(t),e.southwest(),Ca(),"link-layout-sw")},ds=function(t,n,e){return xa(us(t),cs(t,n),e.northeast(),ka(),"link-layout-ne")},ms=function(t,n,e){return xa(as(t,n),cs(t,n),e.northwest(),Oa(),"link-layout-nw")},gs=[zn("item"),ac(),te("overrides",{}),Nu("placement",function(t,n,e){var o=nc(e,n.item.element()),r=cc(t.element(),n,[ls,fs,ds,ms],[fs,ls,ms,ds]);return et.some(rc({anchorBox:o,bubble:ya(),overrides:n.overrides,layouts:r,placer:et.none()}))})],ps=Mn("anchor",{selection:rs,node:is,hotspot:sc,submenu:gs,makeshift:lc}),hs=Er("anchorBox","origin"),vs=pt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),bs=function(t,N,H,P,z){var L=H.width(),j=H.height(),o=function(t,o,r,i){var n,e,u,a,c,s,l,f,d,m,g,p,h,v,b,y,x,w,S,C,k,O,E,T,B,D,A,_,M,F,I,R,V=t(N,H,P);return(e=L,u=j,a=z,d=(n=V).x(),m=n.y(),g=n.bubble().offset().left(),p=n.bubble().offset().top(),h=a.x(),v=a.y(),b=a.width(),y=a.height(),C=v<=(w=m+p),k=(S=h<=(x=d+g))&&C,O=x+e<=h+b&&w+u<=v+y,E=S?Math.min(e,h+b-x):Math.abs(h-(x+e)),T=C?Math.min(u,v+y-w):Math.abs(v-(w+u)),B=a.x()+a.width(),D=Math.max(a.x(),x),A=Math.min(D,B),M=nt((_=C?w:w+(u-T))+T-v),F=nt(v+y-_),c=n.direction(),l=s=F,f=M,I=c.fold(s,s,f,f,s,f,l,l),R=Ya({x:A,y:_,width:E,height:T,maxHeight:I,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:w}),k&&O?vs.fit(R):vs.nofit(R,E,T)).fold(vs.fit,function(t,n,e){return i<e||r<n?vs.nofit(t,n,e):vs.nofit(o,r,i)})};return U(t,function(t,n){var e=g(o,n);return t.fold(vs.fit,e)},vs.nofit(Ya({x:N.x(),y:N.y(),width:H.width(),height:H.height(),maxHeight:H.height(),direction:Sa(),classes:[],label:"none",candidateYforTest:N.y()}),-1,-1)).fold(d,d)},ys=function(t,n,e,o){Ji(n,"max-height");var r,i={width:nt(da(r=n)),height:nt(sa(r))};return bs(o.preference(),t,i,e,o.bounds())},xs=function(t,n,e){var o,r,i,u,a,c=function(t){return t+"px"},s=(o=e.origin(),r=n,o.fold(function(){return qa("absolute",et.some(r.x()),et.some(r.y()),et.none(),et.none())},function(t,n,e,o){return tc("absolute",r,t,n,e,o)},function(t,n,e,o){return tc("fixed",r,t,n,e,o)}));i=t,u={position:et.some(s.position()),left:s.left().map(c),top:s.top().map(c),right:s.right().map(c),bottom:s.bottom().map(c)},a=i.dom(),ct(u,function(t,n){t.fold(function(){Wi(a,n)},function(t){Ui(a,n,t)})})},ws=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=aa.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),Gi(e,"max-height",r+"px")},Ss=nt(function(t,n){ws(t,n),Xi(t,{"overflow-x":"hidden","overflow-y":"auto"})}),Cs=nt(function(t,n){ws(t,n)}),ks=Dr(["bounds","origin","preference","maxHeightFunction"],[]),Os=function(t,n,e,o,r,i){var u,a,c,s,l,f=(u=i,a="maxHeightFunction",c=Ss(),u[a]===undefined?c:u[a]),d=t.anchorBox(),m=t.origin(),g=ks({bounds:(s=m,l=r,l.fold(function(){return s.fold(Qa,Qa,pa)},function(t){return s.fold(t,t,pa)})),origin:m,preference:o,maxHeightFunction:f});Es(d,n,e,g)},Es=function(t,n,e,o){var r,i,u,a,c=ys(t,n,e,o);xs(n,c,o),r=n,i=c.classes(),Li(r,i.off),zi(r,i.on),u=n,a=c,o.maxHeightFunction()(u,a.maxHeight())},Ts=function(t,n,e,o,r){var i,u=(i=e.anchorBox,hs(i,n));Os(u,r.element(),e.bubble,e.layouts,o,e.overrides)},Bs=function(t,n,e,o,r,i){var u=i.map(ha);return Ds(t,n,e,o,r,u)},Ds=function(n,t,e,o,r,i){var u=An("positioning anchor.info",ps,o);Gi(r.element(),"position","fixed");var a=Ki(r.element(),"visibility");Gi(r.element(),"visibility","hidden");var c,s,l,f=t.useFixed?oc(0,0,F.window.innerWidth,F.window.innerHeight):(s=ra((c=n).element()),l=c.element().dom().getBoundingClientRect(),ec(s.left(),s.top(),l.width,l.height)),d=u.placement,m=i.map(nt).or(t.getBounds);d(n,u,f).each(function(t){t.placer.getOr(Ts)(n,f,t,m,r)}),a.fold(function(){Ji(r.element(),"visibility")},function(t){Gi(r.element(),"visibility",t)}),Ki(r.element(),"left").isNone()&&Ki(r.element(),"top").isNone()&&Ki(r.element(),"right").isNone()&&Ki(r.element(),"bottom").isNone()&&Ki(r.element(),"position").is("fixed")&&Ji(r.element(),"position")},As=/* */Object.freeze({position:function(t,n,e,o,r){var i=et.none();Bs(t,n,e,o,r,i)},positionWithin:Bs,positionWithinBounds:Ds,getMode:function(t,n,e){return n.useFixed?"fixed":"absolute"}}),_s=[te("useFixed",!1),qn("getBounds")],Ms=Yu({fields:_s,name:"positioning",active:ta,apis:As}),Fs=function(t){Lo(t,Fo());var n=t.components();z(n,Fs)},Is=function(t){var n=t.components();z(n,Is),Lo(t,Mo())},Rs=function(t,n){Vs(t,n,Pr)},Vs=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),rr(t.element())&&Is(n),t.syncComponents()},Ns=function(t){Fs(t),jr(t.element()),t.getSystem().removeFromWorld(t)},Hs=function(n){var t=Mr(n.element()).bind(function(t){return n.getSystem().getByDom(t).fold(et.none,et.some)});Ns(n),t.each(function(t){t.syncComponents()})},Ps=function(t){var n=t.components();z(n,Ns),Lr(t.element()),t.syncComponents()},zs=function(t,n){Ls(t,n,Pr)},Ls=function(t,n,e){e(t,n.element());var o=Ir(n.element());z(o,function(t){n.getByDom(t).each(Is)})},js=function(n){var t=Ir(n.element());z(t,function(t){n.getByDom(t).each(Fs)}),jr(n.element())},Us=function(t,n,e,o){var r=function(n,t,e,o){e.get().each(function(t){Ps(n)});var r=t.getAttachPoint(n);Rs(r,n);var i=n.getSystem().build(o);return Rs(n,i),e.set(i),i}(t,n,e,o);return n.onOpen(t,r),r},Ws=function(n,e,o){o.get().each(function(t){Ps(n),Hs(n),e.onClose(n,t),o.clear()})},Gs=function(t,n,e){return e.isOpen()},Xs=function(t,n,e){var o,r,i,u,a=n.getAttachPoint(t);Gi(t.element(),"position",Ms.getMode(a)),o=t,r="visibility",i=n.cloakVisibilityAttr,u="hidden",Ki(o.element(),r).fold(function(){Jr(o.element(),i)},function(t){Yr(o.element(),i,t)}),Gi(o.element(),r,u)},Ys=function(t,n,e){var o;o=t.element(),N(["top","left","right","bottom"],function(t){return Ki(o,t).isSome()})||Ji(t.element(),"position"),function(t,n,e){if($r(t.element(),e)){var o=Kr(t.element(),e);Gi(t.element(),n,o)}else Ji(t.element(),n)}(t,"visibility",n.cloakVisibilityAttr)},qs=/* */Object.freeze({cloak:Xs,decloak:Ys,open:Us,openWhileCloaked:function(t,n,e,o,r){Xs(t,n),Us(t,n,e,o),r(),Ys(t,n)},close:Ws,isOpen:Gs,isPartOf:function(n,e,t,o){return Gs(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()}}),Ks=/* */Object.freeze({events:function(e,o){return fr([gr(To(),function(t,n){Ws(t,e,o)})])}}),$s=[Fu("onOpen"),Fu("onClose"),zn("isPartOf"),zn("getAttachPoint"),te("cloakVisibilityAttr","data-precloak-visibility")],Js=Yu({fields:$s,name:"sandboxing",active:Ks,apis:qs,state:/* */Object.freeze({init:function(){var n=se(et.none()),t=nt("not-implemented");return wi({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(et.none())},set:function(t){n.set(et.some(t))},get:function(t){return n.get()}})}})}),Qs=nt("dismiss.popups"),Zs=nt("mouse.released"),tl=gn([te("isExtraPart",nt(!1)),Zn("fireEventInstead",[te("event",Io())])]),nl=function(t){var n=el(t);return Zu.config(n)},el=function(t){var e=An("Dismissal",tl,t);return{channels:It(Qs(),{schema:gn([zn("target")]),onReceive:function(n,t){Js.isOpen(n)&&(Js.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return Js.close(n)},function(t){return Lo(n,t.event)}))}})}},ol=function(o,t){return ae(o,{},P(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,wn(n,n,kt(),mn(function(t){return Gt("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([ce("dump",d)]))},rl=function(t){return t.dump},il=function(t,n){return I({},t.dump,Gu(n))},ul=ol,al=il,cl="placeholder",sl=pt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),ll=function(t,n,e,o){return e.uiType===cl?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?sl.single(!0,nt(i)):Ft(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+ut(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+un(i,null,2))},function(t){return t.replace()})):sl.single(!1,nt(e));var r,i,u},fl=function(i,u,a,c){return ll(i,0,a,c).fold(function(t,n){var e=n(u,a.config,a.validated),o=Ft(e,"components").getOr([]),r=K(o,function(t){return fl(i,u,t,c)});return[I({},e,{components:r})]},function(t,n){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(d)(e)})},dl=function(n,e,t,o){var r,i,u,a=st(o,function(t,n){return o=t,r=!1,{name:nt(e=n),required:function(){return o.fold(function(t,n){return t},function(t,n){return t})},used:function(){return r},replace:function(){if(!0===r)throw new Error("Trying to use the same placeholder more than once: "+e);return r=!0,o}};var e,o,r}),c=(r=n,i=e,u=a,K(t,function(t){return fl(r,i,t,u)}));return ct(a,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: "+un(e.components,null,2))}),c},ml=sl.single,gl=sl.multiple,pl=nt(cl),hl=pt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),vl=te("factory",{sketch:d}),bl=te("schema",[]),yl=zn("name"),xl=wn("pname","pname",Ot(function(t){return"<alloy."+ri(t.name)+">"}),Fn()),wl=ce("schema",function(){return[qn("preprocess")]}),Sl=te("defaults",nt({})),Cl=te("overrides",nt({})),kl=pn([vl,bl,yl,xl,Sl,Cl]),Ol=pn([vl,bl,yl,Sl,Cl]),El=pn([vl,bl,yl,xl,Sl,Cl]),Tl=pn([vl,wl,yl,zn("unit"),xl,Sl,Cl]),Bl=function(t){return t.fold(et.some,et.none,et.some,et.some)},Dl=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},Al=function(e,o){return function(t){var n=An("Converting part type",o,t);return e(n)}},_l=Al(hl.required,kl),Ml=Al(hl.external,Ol),Fl=Al(hl.optional,El),Il=Al(hl.group,Tl),Rl=nt("entirety"),Vl=/* */Object.freeze({required:_l,external:Ml,optional:Fl,group:Il,asNamedPart:Bl,name:Dl,asCommon:function(t){return t.fold(d,d,d,d)},original:Rl}),Nl=function(t,n,e,o){return bt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},Hl=function(r,t){var n={};return z(t,function(t){Bl(t).each(function(e){var o=Pl(r,e.pname);n[e.name]=function(t){var n=An("Part: "+e.name+" in "+r,pn(e.schema),t);return I({},o,{config:t,validated:n})}})}),n},Pl=function(t,n){return{uiType:pl(),owner:t,name:n}},zl=function(t,n,e){return{uiType:pl(),owner:t,name:n,config:e,validated:{}}},Ll=function(t){return K(t,function(t){return t.fold(et.none,et.some,et.none,et.none).map(function(t){return Gn(t.name,t.schema.concat([Hu(Rl())]))}).toArray()})},jl=function(t){return P(t,Dl)},Ul=function(t,n,e){return o=n,i={},r={},z(e,function(t){t.fold(function(o){i[o.pname]=ml(!0,function(t,n,e){return o.factory.sketch(Nl(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=nt(t.factory.sketch(Nl(o,t,n[Rl()]),n))},function(o){i[o.pname]=ml(!1,function(t,n,e){return o.factory.sketch(Nl(t,o,n,e))})},function(r){i[r.pname]=gl(!0,function(n,t,e){var o=n[r.name];return P(o,function(t){return r.factory.sketch(bt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:nt(i),externals:nt(r)};var o,i,r},Wl=function(t,n,e){return dl(et.some(t),n,n.components,e)},Gl=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},Xl=function(t,n,e){return Gl(t,n,e).getOrDie("Could not find part: "+e)},Yl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return z(e,function(t){o[t]=i.getByUid(r[t])}),st(o,nt)},ql=function(t,n){var e=t.getSystem();return st(n.partUids,function(t,n){return nt(e.getByUid(t))})},Kl=function(t){return ut(t.partUids)},$l=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return z(e,function(t){o[t]=i.getByUid(r[t]).getOrDie()}),st(o,nt)},Jl=function(n,t){var e=jl(t);return Rt(P(e,function(t){return{key:t,value:n+"-"+t}}))},Ql=function(n){return wn("partUids","partUids",Et(function(t){return Jl(t.uid,n)}),Fn())},Zl=/* */Object.freeze({generate:Hl,generateOne:zl,schemas:Ll,names:jl,substitutes:Ul,components:Wl,defaultUids:Jl,defaultUidsSchema:Ql,getAllParts:ql,getAllPartNames:Kl,getPart:Gl,getPartOrDie:Xl,getParts:Yl,getPartsOrDie:$l}),tf=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[Gn("parts",i)]:[]).concat([zn("uid"),te("dom",{}),te("components",[]),Hu("originalSpec"),te("debug.sketcher",{})]).concat(u));return An(t+" [SpecSchema]",gn(a.concat(n)),e)},nf=function(t,n,e,o,r){var i=ef(r),u=Ll(e),a=Ql(e),c=tf(t,n,i,u,[a]),s=Ul(0,c,e);return o(c,Wl(t,c,s.internals()),i,s.externals())},ef=function(t){return t.hasOwnProperty("uid")?t:I({},t,{uid:fi("uid")})};var of,rf,uf=gn([zn("name"),zn("factory"),zn("configFields"),te("apis",{}),te("extraApis",{})]),af=gn([zn("name"),zn("factory"),zn("configFields"),zn("partFields"),te("apis",{}),te("extraApis",{})]),cf=function(t){var i=An("Sketcher for "+t.name,uf,t),n=st(i.apis,yi),e=st(i.extraApis,function(t,n){return hi(t,n)});return I({name:nt(i.name),partFields:nt([]),configFields:nt(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=ef(t),o(tf(n,e,r,[],[]),r);var n,e,o,r}},n,e)},sf=function(t){var n=An("Sketcher for "+t.name,af,t),e=Hl(n.name,n.partFields),o=st(n.apis,yi),r=st(n.extraApis,function(t,n){return hi(t,n)});return I({name:nt(n.name),partFields:nt(n.partFields),configFields:nt(n.configFields),sketch:function(t){return nf(n.name,n.configFields,n.partFields,n.factory,t)},parts:nt(e)},o,r)},lf=function(t){return"input"===Zo(t)&&"radio"!==Kr(t,"type")||"textarea"===Zo(t)},ff=/* */Object.freeze({getCurrent:function(t,n,e){return n.find(t)}}),df=[zn("find")],mf=Yu({fields:df,name:"composing",apis:ff}),gf=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},pf=function(t,n,e){return t<=n?n:e<=t?e:t},hf=function(e,o,t,r){var n=zc(e.element(),"."+o.highlightClass);z(n,function(n){N(r,function(t){return t.element()===n})||(Hi(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),Lo(t,zo())}))})},vf=function(t,n,e,o){hf(t,n,0,[o]),bf(t,n,e,o)||(Vi(o.element(),n.highlightClass),n.onHighlight(t,o),Lo(o,Po()))},bf=function(t,n,e,o){return Pi(o.element(),n.highlightClass)},yf=function(t,n,e,o){var r=zc(t.element(),"."+n.itemClass);return et.from(r[o]).fold(function(){return R.error("No element found with index "+o)},t.getSystem().getByDom)},xf=function(n,t,e){return mu(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},wf=function(n,t,e){var o=zc(n.element(),"."+t.itemClass);return(0<o.length?et.some(o[o.length-1]):et.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Sf=function(e,n,t,o){var r=zc(e.element(),"."+n.itemClass);return G(r,function(t){return Pi(t,n.highlightClass)}).bind(function(t){var n=gf(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},Cf=function(n,t,e){var o=zc(n.element(),"."+t.itemClass);return bu(P(o,function(t){return n.getSystem().getByDom(t).toOption()}))},kf=/* */Object.freeze({dehighlightAll:function(t,n,e){return hf(t,n,0,[])},dehighlight:function(t,n,e,o){bf(t,n,e,o)&&(Hi(o.element(),n.highlightClass),n.onDehighlight(t,o),Lo(o,zo()))},highlight:vf,highlightFirst:function(n,e,o){xf(n,e).each(function(t){vf(n,e,o,t)})},highlightLast:function(n,e,o){wf(n,e).each(function(t){vf(n,e,o,t)})},highlightAt:function(n,e,o,t){yf(n,e,o,t).fold(function(t){throw new Error(t)},function(t){vf(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=Cf(n,e);W(r,t).each(function(t){vf(n,e,o,t)})},isHighlighted:bf,getHighlighted:function(n,t,e){return mu(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:xf,getLast:wf,getPrevious:function(t,n,e){return Sf(t,n,0,-1)},getNext:function(t,n,e){return Sf(t,n,0,1)},getCandidates:Cf}),Of=[zn("highlightClass"),zn("itemClass"),Fu("onHighlight"),Fu("onDehighlight")],Ef=Yu({fields:Of,name:"highlighting",apis:kf}),Tf=function(t,n,e){var o=J(t.slice(0,n)),r=J(t.slice(n+1));return W(o.concat(r),e)},Bf=function(t,n,e){var o=J(t.slice(0,n));return W(o,e)},Df=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return W(r.concat(o),e)},Af=function(t,n,e){var o=t.slice(n+1);return W(o,e)},_f=function(e){return function(t){var n=t.raw();return M(e,n.which)}},Mf=function(t){return function(n){return $(t,function(t){return t(n)})}},Ff=function(t){return!0===t.raw().shiftKey},If=function(t){return!0===t.raw().ctrlKey},Rf=x(Ff),Vf=function(t,n){return{matches:t,classification:n}},Nf=function(t){t.dom().focus()},Hf=function(t){var n=t!==undefined?t.dom():F.document;return et.from(n.activeElement).map(fe.fromDom)},Pf=function(n){return Hf(Ar(n)).filter(function(t){return n.dom().contains(t.dom())})},zf=function(t,n,e){n.exists(function(n){return e.exists(function(t){return Ke(t,n)})})||jo(t,Ro(),{prevFocus:n,newFocus:e})},Lf=function(){var r=function(t){return Pf(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);zf(t,e,o)}}},jf=function(){var r=function(t){return Ef.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(tt,function(t){Ef.highlight(n,t)});var o=r(n);zf(n,e,o)}}};(rf=of||(of={})).OnFocusMode="onFocus",rf.OnEnterOrSpaceMode="onEnterOrSpace",rf.OnApiMode="onApi";var Uf,Wf=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i,u,a=t(n,e,o,r);return(i=a,u=e.event(),W(i,function(t){return t.matches(u)}).map(function(t){return t.classification})).bind(function(t){return t(n,e,o,r)})},r={schema:function(){return t.concat([te("focusManager",Lf()),ne("focusInside","onFocus",En(function(t){return M(["onFocus","onEnterOrSpace","onApi"],t)?R.value(t):R.error("Invalid value for focusInside")})),Nu("handler",r),Nu("state",n),Nu("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==of.OnFocusMode?et.none():a(i).map(function(e){return gr(bo(),function(t,n){e(t,i,u),n.stop()})});return fr(t.toArray().concat([gr(so(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=_f([32].concat([13]))(e.event()),i.focusInside===of.OnEnterOrSpaceMode&&t&&$e(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(t){r.stop()})}),gr(lo(),function(t,n){c(t,n,o,i,u).each(function(t){n.stop()})})]))}};return r},Gf=function(t){var n=[qn("onEscape"),qn("onEnter"),te("selector",'[data-alloy-tabstop="true"]'),te("firstTabstop",0),te("useTabstopAt",nt(!0)),qn("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return gu(n,t)}).getOr(n);return 0<ca(e)},e=function(n,e){var t,o,r,i;(t=n,o=e,r=zc(t.element(),o.selector),i=L(r,function(t){return u(o,t)}),et.from(i[o.firstTabstop])).each(function(t){e.focusManager.set(n,t)})},a=function(n,t,e,o,r){return r(t,e,function(t){return u(n=o,e=t)&&n.useTabstopAt(e);var n,e}).fold(function(){return o.cyclic?et.some(!0):et.none()},function(t){return o.focusManager.set(n,t),et.some(!0)})},i=function(n,t,e,o){var r,i,u=zc(n.element(),e.selector);return(r=n,i=e,i.focusManager.get(r).bind(function(t){return gu(t,i.selector)})).bind(function(t){return G(u,g(Ke,t)).bind(function(t){return a(n,u,t,e,o)})})},o=nt([Vf(Mf([Ff,_f([9])]),function(t,n,e,o){var r=e.cyclic?Tf:Bf;return i(t,0,e,r)}),Vf(_f([9]),function(t,n,e,o){var r=e.cyclic?Df:Af;return i(t,0,e,r)}),Vf(_f([27]),function(n,e,t,o){return t.onEscape.bind(function(t){return t(n,e)})}),Vf(Mf([Rf,_f([13])]),function(n,e,t,o){return t.onEnter.bind(function(t){return t(n,e)})})]),r=nt([]);return Wf(n,xi.init,o,r,function(){return et.some(e)})},Xf=Gf(ce("cyclic",nt(!1))),Yf=Gf(ce("cyclic",nt(!0))),qf=function(t,n,e){return lf(e)&&_f([32])(n.event())?et.none():(Wo(t,e,So()),et.some(!0))},Kf=function(t,n){return et.some(!0)},$f=[te("execute",qf),te("useSpace",!1),te("useEnter",!0),te("useControlEnter",!1),te("useDown",!1)],Jf=function(t,n,e){return e.execute(t,n,t.element())},Qf=Wf($f,xi.init,function(t,n,e,o){var r=e.useSpace&&!lf(t.element())?[32]:[],i=e.useEnter?[13]:[],u=e.useDown?[40]:[],a=r.concat(i).concat(u);return[Vf(_f(a),Jf)].concat(e.useControlEnter?[Vf(Mf([If,_f([13])]),Jf)]:[])},function(t,n,e,o){return e.useSpace&&!lf(t.element())?[Vf(_f([32]),Kf)]:[]},function(){return et.none()}),Zf=function(t){var e=se(et.none());return wi({readState:function(){return e.get().map(function(t){return{numRows:t.numRows(),numColumns:t.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(et.some({numRows:nt(t),numColumns:nt(n)}))},getNumRows:function(){return e.get().map(function(t){return t.numRows()})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns()})}})},td=/* */Object.freeze({flatgrid:Zf,init:function(t){return t.state(t)}}),nd=function(i){return function(t,n,e,o){var r=i(t.element());return id(r,t,n,e,o)}},ed=function(t,n){var e=ic(t,n);return nd(e)},od=function(t,n){var e=ic(n,t);return nd(e)},rd=function(r){return function(t,n,e,o){return id(r,t,n,e,o)}},id=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})},ud=rd,ad=rd,cd=rd,sd=function(t){var n,e=t.dom();return!((n=e).offsetWidth<=0&&n.offsetHeight<=0)},ld=Dr(["index","candidates"],[]),fd=function(t,n,e){var o,r=g(Ke,n),i=zc(t,e),u=L(i,sd);return G(o=u,r).map(function(t){return ld({index:t,candidates:o})})},dd=function(t,n){return G(t,function(t){return Ke(n,t)})},md=function(e,t,o,n){return n(Math.floor(t/o),t%o).bind(function(t){var n=t.row()*o+t.column();return 0<=n&&n<e.length?et.some(e[n]):et.none()})},gd=function(r,t,i,u,a){return md(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=gf(n,a,0,e-1);return et.some({row:nt(t),column:nt(o)})})},pd=function(i,t,u,a,c){return md(i,t,a,function(t,n){var e=gf(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=pf(n,0,o-1);return et.some({row:nt(e),column:nt(r)})})},hd=[zn("selector"),te("execute",qf),Iu("onEscape"),te("captureTab",!1),Pu()],vd=function(n,e,t){mu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},bd=function(r){return function(t,n,e,o){return fd(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))})}},yd=function(t,n,e,o){return e.captureTab?et.some(!0):et.none()},xd=bd(function(t,n,e,o){return gd(t,n,e,o,-1)}),wd=bd(function(t,n,e,o){return gd(t,n,e,o,1)}),Sd=bd(function(t,n,e,o){return pd(t,n,e,o,-1)}),Cd=bd(function(t,n,e,o){return pd(t,n,e,o,1)}),kd=nt([Vf(_f([37]),ed(xd,wd)),Vf(_f([39]),od(xd,wd)),Vf(_f([38]),ud(Sd)),Vf(_f([40]),ad(Cd)),Vf(Mf([Ff,_f([9])]),yd),Vf(Mf([Rf,_f([9])]),yd),Vf(_f([27]),function(t,n,e,o){return e.onEscape(t,n)}),Vf(_f([32].concat([13])),function(n,e,o,t){return(r=n,i=o,i.focusManager.get(r).bind(function(t){return gu(t,i.selector)})).bind(function(t){return o.execute(n,e,t)});var r,i})]),Od=nt([Vf(_f([32]),Kf)]),Ed=Wf(hd,Zf,kd,Od,function(){return et.some(vd)}),Td=function(t,n,e,i){var u=function(t,n,e){var o,r=gf(n,i,0,e.length-1);return r===t?et.none():(o=e[r],"button"===Zo(o)&&"disabled"===Kr(o,"disabled")?u(t,r,e):et.from(e[r]))};return fd(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},Bd=[zn("selector"),te("getInitial",et.none),te("execute",qf),Iu("onEscape"),te("executeOnMove",!1),te("allowVertical",!0)],Dd=function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return gu(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 mu(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},_d=function(t,n,e){return Td(t,e.selector,n,-1)},Md=function(t,n,e){return Td(t,e.selector,n,1)},Fd=function(o){return function(t,n,e){return o(t,n,e).bind(function(){return e.executeOnMove?Dd(t,n,e):et.some(!0)})}},Id=function(t,n,e,o){return e.onEscape(t,n)},Rd=nt([Vf(_f([32]),Kf)]),Vd=Wf(Bd,xi.init,function(t,n,e,o){var r=[37].concat(e.allowVertical?[38]:[]),i=[39].concat(e.allowVertical?[40]:[]);return[Vf(_f(r),Fd(ed(_d,Md))),Vf(_f(i),Fd(od(_d,Md))),Vf(_f([13]),Dd),Vf(_f([32]),Dd),Vf(_f([27]),Id)]},Rd,function(){return et.some(Ad)}),Nd=Dr(["rowIndex","columnIndex","cell"],[]),Hd=function(t,n,e){return et.from(t[n]).bind(function(t){return et.from(t[e]).map(function(t){return Nd({rowIndex:n,columnIndex:e,cell:t})})})},Pd=function(t,n,e,o){var r=t[n].length,i=gf(e,o,0,r-1);return Hd(t,n,i)},zd=function(t,n,e,o){var r=gf(e,o,0,t.length-1),i=t[r].length,u=pf(n,0,i-1);return Hd(t,r,u)},Ld=function(t,n,e,o){var r=t[n].length,i=pf(e+o,0,r-1);return Hd(t,n,i)},jd=function(t,n,e,o){var r=pf(e+o,0,t.length-1),i=t[r].length,u=pf(n,0,i-1);return Hd(t,r,u)},Ud=[Gn("selectors",[zn("row"),zn("cell")]),te("cycles",!0),te("previousSelector",et.none),te("execute",qf)],Wd=function(n,e){e.previousSelector(n).orThunk(function(){var t=e.selectors;return mu(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},Gd=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return gu(o,i.selectors.row).bind(function(t){var n=zc(t,i.selectors.cell);return dd(n,o).bind(function(o){var r=zc(e,i.selectors.row);return dd(r,t).bind(function(t){var n,e=(n=i,P(r,function(t){return zc(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell()})})})})}},Xd=Gd(function(t,n,e){return Pd(t,n,e,-1)},function(t,n,e){return Ld(t,n,e,-1)}),Yd=Gd(function(t,n,e){return Pd(t,n,e,1)},function(t,n,e){return Ld(t,n,e,1)}),qd=Gd(function(t,n,e){return zd(t,e,n,-1)},function(t,n,e){return jd(t,e,n,-1)}),Kd=Gd(function(t,n,e){return zd(t,e,n,1)},function(t,n,e){return jd(t,e,n,1)}),$d=nt([Vf(_f([37]),ed(Xd,Yd)),Vf(_f([39]),od(Xd,Yd)),Vf(_f([38]),ud(qd)),Vf(_f([40]),ad(Kd)),Vf(_f([32].concat([13])),function(n,e,o){return Pf(n.element()).bind(function(t){return o.execute(n,e,t)})})]),Jd=nt([Vf(_f([32]),Kf)]),Qd=Wf(Ud,xi.init,$d,Jd,function(){return et.some(Wd)}),Zd=[zn("selector"),te("execute",qf),te("moveOnTab",!1)],tm=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},nm=function(n,e){mu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},em=function(t,n,e){return Td(t,e.selector,n,-1)},om=function(t,n,e){return Td(t,e.selector,n,1)},rm=nt([Vf(_f([38]),cd(em)),Vf(_f([40]),cd(om)),Vf(Mf([Ff,_f([9])]),function(t,n,e){return e.moveOnTab?cd(em)(t,n,e):et.none()}),Vf(Mf([Rf,_f([9])]),function(t,n,e){return e.moveOnTab?cd(om)(t,n,e):et.none()}),Vf(_f([13]),tm),Vf(_f([32]),tm)]),im=nt([Vf(_f([32]),Kf)]),um=Wf(Zd,xi.init,rm,im,function(){return et.some(nm)}),am=[Iu("onSpace"),Iu("onEnter"),Iu("onShiftEnter"),Iu("onLeft"),Iu("onRight"),Iu("onTab"),Iu("onShiftTab"),Iu("onUp"),Iu("onDown"),Iu("onEscape"),te("stopSpaceKeyup",!1),qn("focusIn")],cm=Wf(am,xi.init,function(t,n,e){return[Vf(_f([32]),e.onSpace),Vf(Mf([Rf,_f([13])]),e.onEnter),Vf(Mf([Ff,_f([13])]),e.onShiftEnter),Vf(Mf([Ff,_f([9])]),e.onShiftTab),Vf(Mf([Rf,_f([9])]),e.onTab),Vf(_f([38]),e.onUp),Vf(_f([40]),e.onDown),Vf(_f([37]),e.onLeft),Vf(_f([39]),e.onRight),Vf(_f([32]),e.onSpace),Vf(_f([27]),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[Vf(_f([32]),Kf)]:[]},function(t){return t.focusIn}),sm=Xf.schema(),lm=Yf.schema(),fm=Vd.schema(),dm=Ed.schema(),mm=Qd.schema(),gm=Qf.schema(),pm=um.schema(),hm=cm.schema(),vm=Ku({branchKey:"mode",branches:/* */Object.freeze({acyclic:sm,cyclic:lm,flow:fm,flatgrid:dm,matrix:mm,execution:gm,menu:pm,special:hm}),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){Nt(e,"setGridSize")?e.setGridSize(o,r):F.console.error("Layout does not support setGridSize")}},state:td}),bm=function(t,n,e,o){var r=t.getSystem().build(o);Vs(t,r,e)},ym=function(t,n,e,o){var r=xm(t);W(r,function(t){return Ke(o.element(),t.element())}).each(Hs)},xm=function(t,n){return t.components()},wm=function(n,t,e,r,o){var i=xm(n);return et.from(i[r]).map(function(t){return ym(n,0,0,t),o.each(function(t){bm(n,0,function(t,n){var e,o;o=n,Rr(e=t,r).fold(function(){Pr(e,o)},function(t){Vr(t,o)})},t)}),t})},Sm=Yu({fields:[],name:"replacing",apis:/* */Object.freeze({append:function(t,n,e,o){bm(t,0,Pr,o)},prepend:function(t,n,e,o){bm(t,0,Hr,o)},remove:ym,replaceAt:wm,replaceBy:function(n,t,e,o,r){var i=xm(n);return G(i,o).bind(function(t){return wm(n,0,0,t,r)})},set:function(n,t,e,o){var r,i,u,a;Ps(n),r=function(){var t=P(o,n.getSystem().build);z(t,function(t){Rs(n,t)})},i=n.element(),u=Ar(i),a=Hf(u).bind(function(n){var t=function(t){return Ke(n,t)};return t(i)?et.some(i):sr(i,t)}),r(i),a.each(function(n){Hf(u).filter(function(t){return Ke(t,n)}).fold(function(){Nf(n)},tt)})},contents:xm})}),Cm=function(t,n,e){n.store.manager.onLoad(t,n,e)},km=function(t,n,e){n.store.manager.onUnload(t,n,e)},Om=/* */Object.freeze({onLoad:Cm,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}}),Em=/* */Object.freeze({events:function(e,o){var t=e.resetOnDom?[Sr(function(t,n){Cm(t,e,o)}),Cr(function(t,n){km(t,e,o)})]:[zu(e,o,Cm)];return fr(t)}}),Tm=function(){var t=se(null);return wi({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()}}})},Bm=function(){var i=se({}),u=se({});return wi({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Ft(i.get(),t).orThunk(function(){return Ft(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};z(t,function(n){o[n.value]=n,Ft(n,"meta").each(function(t){Ft(t,"text").each(function(t){r[t]=n})})}),i.set(I({},n,o)),u.set(I({},e,r))},clear:function(){i.set({}),u.set({})}})},Dm=/* */Object.freeze({memory:Tm,dataset:Bm,manual:function(){return wi({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)},_m=[qn("initialValue"),zn("getFallbackEntry"),zn("getDataKey"),zn("setValue"),Nu("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:Bm})],Mm=[zn("getValue"),te("setValue",tt),qn("initialValue"),Nu("manager",{setValue:function(t,n,e,o){n.store.setValue(t,o),n.onSetValue(t,o)},getValue:function(t,n,e){return n.store.getValue(t)},onLoad:function(n,e,t){e.store.initialValue.each(function(t){e.store.setValue(n,t)})},onUnload:tt,state:xi.init})],Fm=[qn("initialValue"),Nu("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})],Im=[ne("store",{mode:"memory"},Mn("mode",{memory:Fm,manual:Mm,dataset:_m})),Fu("onSetValue"),te("resetOnDom",!1)],Rm=Yu({fields:Im,name:"representing",active:Em,apis:Om,extra:{setValueFrom:function(t,n){var e=Rm.getValue(n);Rm.setValue(t,e)}},state:Dm}),Vm=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=fr(n),Yu({fields:[zn("enabled")],name:e,active:{events:nt(o)}})),configAsRaw:nt({}),initialConfig:{},state:xi}}},Nm=function(t,n){n.ignore||(Nf(t.element()),n.onFocus(t))},Hm=/* */Object.freeze({focus:Nm,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=Ar(n).dom(),n.dom()===e.activeElement;var n,e}}),Pm=/* */Object.freeze({exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return Ci(e)},events:function(e){return fr([gr(bo(),function(t,n){Nm(t,e),n.stop()})].concat(e.stopMousedown?[gr(eo(),function(t,n){n.event().prevent()})]:[]))}}),zm=[Fu("onFocus"),te("stopMousedown",!1),te("ignore",!1)],Lm=Yu({fields:zm,name:"focusing",active:Pm,apis:Hm}),jm=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},Um=function(n,t,e){t.toggleClass.each(function(t){e.get()?Vi(n.element(),t):Hi(n.element(),t)})},Wm=function(t,n,e){Ym(t,n,e,!e.get())},Gm=function(t,n,e){e.set(!0),Um(t,n,e),jm(t,n,e)},Xm=function(t,n,e){e.set(!1),Um(t,n,e),jm(t,n,e)},Ym=function(t,n,e,o){(o?Gm:Xm)(t,n,e)},qm=function(t,n,e){Ym(t,n,e,n.selected)},Km=/* */Object.freeze({onLoad:qm,toggle:Wm,isOn:function(t,n,e){return e.get()},on:Gm,off:Xm,set:Ym}),$m=/* */Object.freeze({exhibit:function(t,n,e){return Ci({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=Wm,Or(function(t){r(t,e,o)})),u=zu(t,n,qm);return fr(q([t.toggleOnExecute?[i]:[],[u]]))}}),Jm=function(t,n,e){Yr(t.element(),"aria-expanded",e)},Qm=[te("selected",!1),qn("toggleClass"),te("toggleOnExecute",!0),ne("aria",{mode:"none"},Mn("mode",{pressed:[te("syncWithExpanded",!1),Nu("update",function(t,n,e){Yr(t.element(),"aria-pressed",e),n.syncWithExpanded&&Jm(t,n,e)})],checked:[Nu("update",function(t,n,e){Yr(t.element(),"aria-checked",e)})],expanded:[Nu("update",Jm)],selected:[Nu("update",function(t,n,e){Yr(t.element(),"aria-selected",e)})],none:[Nu("update",tt)]}))],Zm=Yu({fields:Qm,name:"toggling",active:$m,apis:Km,state:(Uf=!1,{init:function(){var n=se(Uf);return{get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(Uf)},readState:function(){return n.get()}}}})}),tg="alloy.item-hover",ng="alloy.item-focus",eg=function(t){(Pf(t.element()).isNone()||Lm.isFocused(t))&&(Lm.isFocused(t)||Lm.focus(t),jo(t,tg,{item:t}))},og=function(t){jo(t,ng,{item:t})},rg=nt(tg),ig=nt(ng),ug=[zn("data"),zn("components"),zn("dom"),te("hasSubmenu",!1),qn("toggling"),ul("itemBehaviours",[Zm,Lm,vm,Rm]),te("ignoreFocus",!1),te("domModification",{}),Nu("builder",function(t){return{dom:t.dom,domModification:I({},t.domModification,{attributes:I({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes,{"aria-haspopup":t.hasSubmenu},t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:al(t.itemBehaviours,[t.toggling.fold(Zm.revoke,function(t){return Zm.config(I({aria:{mode:"checked"}},t))}),Lm.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){og(t)}}),vm.config({mode:"execution"}),Rm.config({store:{mode:"memory",initialValue:t.data}}),Vm("item-type-events",[gr(Oo(),Uo),yr(eo()),gr(uo(),eg),gr(Co(),Lm.focus)])]),components:t.components,eventOrder:t.eventOrder}}),te("eventOrder",{})],ag=[zn("dom"),zn("components"),Nu("builder",function(t){return{dom:t.dom,components:t.components,events:fr([xr(Co())])}})],cg=nt([_l({name:"widget",overrides:function(n){return{behaviours:Gu([Rm.config({store:{mode:"manual",getValue:function(t){return n.data},setValue:function(){}}})])}}})]),sg=[zn("uid"),zn("data"),zn("components"),zn("dom"),te("autofocus",!1),te("ignoreFocus",!1),ul("widgetBehaviours",[Rm,Lm,vm]),te("domModification",{}),Ql(cg()),Nu("builder",function(e){var t=Ul(0,e,cg()),n=Wl("item-widget",e,t.internals()),o=function(t){return Gl(t,e,"widget").map(function(t){return vm.focusIn(t),t})},r=function(t,n){return lf(n.event().target())||e.autofocus&&n.setSource(t.element()),et.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:fr([Or(function(t,n){o(t).each(function(t){n.stop()})}),gr(uo(),eg),gr(Co(),function(t,n){e.autofocus?o(t):Lm.focus(t)})]),behaviours:al(e.widgetBehaviours,[Rm.config({store:{mode:"memory",initialValue:e.data}}),Lm.config({ignore:e.ignoreFocus,onFocus:function(t){og(t)}}),vm.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:$u(),onLeft:r,onRight:r,onEscape:function(t,n){return Lm.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),et.none()):(Lm.focus(t),et.some(!0))}})])}})],lg=Mn("type",{widget:sg,item:ug,separator:ag}),fg=nt([Il({factory:{sketch:function(t){var n=An("menu.spec item",lg,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:I({},n,{uid:fi("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),dg=nt([zn("value"),zn("items"),zn("dom"),zn("components"),te("eventOrder",{}),ol("menuBehaviours",[Ef,Rm,mf,vm]),ne("movement",{mode:"menu",moveOnTab:!0},Mn("mode",{grid:[Pu(),Nu("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[Nu("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),zn("rowSelector")],menu:[te("moveOnTab",!0),Nu("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),Ln("markers",Bu()),te("fakeFocus",!1),te("focusManager",Lf()),Fu("onHighlight")]),mg=nt("alloy.menu-focus"),gg=sf({name:"Menu",configFields:dg(),partFields:fg(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:il(t.menuBehaviours,[Ef.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),Rm.config({store:{mode:"memory",initialValue:t.value}}),mf.config({find:et.some}),vm.config(t.movement.config(t,t.movement))]),events:fr([gr(ig(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){Ef.highlight(n,t),e.stop(),jo(n,mg(),{menu:n,item:t})})}),gr(rg(),function(t,n){var e=n.event().item();Ef.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),pg=function(e,o,r,t){return Ft(r,t).bind(function(t){return Ft(e,t).bind(function(t){var n=pg(e,o,r,t);return et.some([t].concat(n))})}).getOr([])},hg=function(t,n){var e={};ct(t,function(t,n){z(t,function(t){e[t]=n})});var o=n,r=lt(n,function(t,n){return{k:t,v:n}}),i=st(r,function(t,n){return[n].concat(pg(e,o,r,n))});return st(e,function(t){return Ft(i,t).getOr([t])})},vg=function(){var i=se({}),u=se({}),a=se({}),c=se(et.none()),s=se({}),n=function(t){return Ft(u.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(I({},u.get(),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(et.some(t)),i.set(e),u.set(n),s.set(o);var r=hg(o,e);a.set(r)},expand:function(e){return Ft(i.get(),e).map(function(t){var n=Ft(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Ft(a.get(),t)},collapse:function(t){return Ft(a.get(),t).bind(function(t){return 1<t.length?et.some(t.slice(1)):et.none()})},lookupMenu:n,otherMenus:function(t){var n=s.get();return Q(ut(n),t)},getPrimary:function(){return c.get().bind(function(t){return n(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(et.none())},isClear:function(){return c.get().isNone()}}},bg=nt("collapse-item"),yg=cf({name:"TieredMenu",configFields:[Vu("onExecute"),Vu("onEscape"),Ru("onOpenMenu"),Ru("onOpenSubmenu"),Fu("onCollapseMenu"),te("highlightImmediately",!0),Gn("data",[zn("primary"),zn("menus"),zn("expansions")]),te("fakeFocus",!1),Fu("onHighlight"),Fu("onHover"),Au(),zn("dom"),te("navigateOnHover",!0),te("stayInDom",!1),ol("tmenuBehaviours",[vm,Ef,mf,Sm]),te("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)}},factory:function(a,t){var c,n,i=se(et.none()),s=vg(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,st(n,function(t,n){var e=function(){return gg.sketch(I({dom:t.dom},t,{value:n,items:t.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?jf():Lf()}))};return n===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})),i=u();return s.setContents(a.data.primary,e,a.data.expansions,i),s.getPrimary()},l=function(t){return Rm.getValue(t).value},u=function(t){return st(a.data.menus,function(t,n){return K(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},f=function(n,t){Ef.highlight(n,t),Ef.getHighlighted(t).orThunk(function(){return Ef.getFirst(t)}).each(function(t){Wo(n,t.element(),Co())})},d=function(n,t){return bu(P(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));z(o,function(t){Li(t.element(),[a.markers.backgroundMenu]),a.stayInDom||Sm.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=zc(r.element(),"."+a.markers.item),n=L(t,function(t){return"true"===Kr(t,"aria-haspopup")});return z(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=l(t);e[n]=t})}),i.set(et.some(e)),e}));ct(n,function(t,n){var e=M(o,n);Yr(t.element(),"aria-expanded",e)})},p=function(o,r,i){return et.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return et.none();var n=t.menu,e=d(r,i.slice(1));return z(e,function(t){Vi(t.element(),a.markers.backgroundMenu)}),rr(n.element())||Sm.append(o,fu(n)),Li(n.element(),[a.markers.backgroundMenu]),f(o,n),m(o,r,i),et.some(n)})})};(n=c||(c={}))[n.HighlightSubmenu=0]="HighlightSubmenu",n[n.HighlightParent=1]="HighlightParent";var h=function(r,i,u){void 0===u&&(u=c.HighlightSubmenu);var t=l(i);return s.expand(t).bind(function(o){return g(r,o),et.from(o[0]).bind(function(e){return s.lookupMenu(e).bind(function(t){var n=function(t,n,e){if("notbuilt"!==e.type)return e.menu;var o=t.getSystem().build(e.nbMenu());return s.setMenuBuilt(n,o),o}(r,e,t);return rr(n.element())||Sm.append(r,fu(n)),a.onOpenSubmenu(r,i,n),u===c.HighlightSubmenu?(Ef.highlightFirst(n),p(r,s,o)):(Ef.dehighlightAll(n),et.some(i))})})})},o=function(n,e){var t=l(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 gu(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=fr([gr(mg(),function(n,t){var e=t.event().menu();Ef.highlight(n,e);var o=l(t.event().item());s.refresh(o).each(function(t){return m(n,s,t)})}),Or(function(n,t){var e=t.event().target();n.getSystem().getByDom(e).each(function(t){0===l(t).indexOf("collapse-item")&&o(n,t),h(n,t,c.HighlightSubmenu).fold(function(){a.onExecute(n,t)},function(){})})}),Sr(function(n,t){e(n).each(function(t){Sm.append(n,fu(t)),a.onOpenMenu(n,t),a.highlightImmediately&&f(n,t)})})].concat(a.navigateOnHover?[gr(rg(),function(t,n){var e,o,r=n.event().item();e=t,o=l(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){Ef.getHighlighted(n).each(function(t){Ef.getHighlighted(t).each(function(t){o(n,t)})})},highlightPrimary:function(n){s.getPrimary().each(function(t){f(n,t)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:il(a.tmenuBehaviours,[vm.config({mode:"special",onRight:r(function(t,n){return lf(n.element())?et.none():h(t,n,c.HighlightSubmenu)}),onLeft:r(function(t,n){return lf(n.element())?et.none():o(t,n)}),onEscape:r(function(t,n){return o(t,n).orThunk(function(){return a.onEscape(t,n).map(function(){return t})})}),focusIn:function(n,t){s.getPrimary().each(function(t){Wo(n,t.element(),Co())})}}),Ef.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),mf.config({find:function(t){return Ef.getHighlighted(t)}}),Sm.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:It(t,n),expansions:{}}},collapseItem:function(t){return{value:ri(bg()),meta:{text:t}}}}}),xg=cf({name:"InlineView",configFields:[zn("lazySink"),Fu("onShow"),Fu("onHide"),Qn("onEscape"),ol("inlineBehaviours",[Js,Zu]),Zn("fireDismissalEventInstead",[te("event",Io())]),te("getRelated",et.none),te("eventOrder",et.none)],factory:function(s,t){var r=function(t,n,e,o){var r=s.lazySink(t).getOrDie();Js.openWhileCloaked(t,e,function(){return Ms.positionWithin(r,n,t,o)}),s.onShow(t)},n={setContent:function(t,n){Js.open(t,n)},showAt:function(t,n,e){var o=et.none();r(t,n,e,o)},showWithin:r,showWithinBounds:function(t,n,e,o){var r=s.lazySink(t).getOrDie();Js.openWhileCloaked(t,e,function(){return Ms.positionWithinBounds(r,n,t,o)}),s.onShow(t)},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)},yg.sketch({dom:{tag:"div"},data:u.data,markers:u.menu.markers,onEscape:function(){return Js.close(r),o.onEscape.map(function(t){return t(r)}),et.some(!0)},onExecute:function(){return et.some(!0)},onOpenMenu:function(t,n){Ms.position(a().getOrDie(),i,n)},onOpenSubmenu:function(t,n,e){var o=a().getOrDie();Ms.position(o,{anchor:"submenu",item:n},e)}}));Js.open(t,c),s.onShow(t)},hide:function(t){Js.close(t),s.onHide(t)},getContent:function(t){return Js.getState(t)},isOpen:Js.isOpen};return{uid:s.uid,dom:s.dom,behaviours:il(s.inlineBehaviours,[Js.config({isPartOf:function(t,n,e){return vu(n,e)||(o=t,r=e,s.getRelated(o).exists(function(t){return vu(t,r)}));var o,r},getAttachPoint:function(t){return s.lazySink(t).getOrDie()}}),nl(I({isExtraPart:nt(!1)},s.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))]),eventOrder:s.eventOrder,apis:n}},apis:{showAt:function(t,n,e,o){t.showAt(n,e,o)},showWithin:function(t,n,e,o,r){t.showWithin(n,e,o,r)},showWithinBounds:function(t,n,e,o,r){t.showWithinBounds(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)}}}),wg=function(t){var n=function(t,n){n.stop(),Uo(t)},e=ze.detect().deviceType.isTouch()?[gr(ko(),n)]:[gr(go(),n),gr(eo(),function(t,n){n.cut()})];return fr(q([t.map(function(e){return gr(So(),function(t,n){e(t),n.stop()})}).toArray(),e]))},Sg=cf({name:"Button",factory:function(t){var n=wg(t.action),e=t.dom.tag,o=function(n){return Ft(t.dom,"attributes").bind(function(t){return Ft(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:al(t.buttonBehaviours,[Lm.config({}),vm.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 I({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[te("uid",undefined),zn("dom"),te("components",[]),ul("buttonBehaviours",[Lm,vm]),qn("action"),qn("role"),te("eventOrder",{})]}),Cg=function(t){var n=function e(t){return t.uid!==undefined}(t)&&Nt(t,"uid")?t.uid:fi("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).fold(et.none,et.some)},asSpec:function(){return I({},t,{uid:n})}}},kg=function(t){return et.from(t()["temporary-placeholder"]).getOr("!not found!")},Og=function(t,n){return et.from(n()[t]).getOrThunk(function(){return kg(n)})},Eg={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Tg=cf({name:"Notification",factory:function(n){var t,e,o=Cg({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:Gu([Sm.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=Cg({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:Gu([Sm.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){Sm.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);Sm.set(e,[au(n)])}}},c=q([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return et.from(Eg[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,yu(t,function(t){return et.from(e()[t])}).getOrThunk(function(){return kg(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:Gu([Sm.config({})])}].concat(n.progress?[u.asSpec()]:[]).concat(Sg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:Og("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},configFields:[qn("level"),zn("progress"),zn("icon"),zn("onAction"),zn("text"),zn("iconProvider"),zn("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}}),Bg=tinymce.util.Tools.resolve("tinymce.util.Delay");function Dg(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),xg.hide(r)},o=lu(Tg.sketch({text:t.text,level:M(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:et.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=lu(xg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),t.timeout&&Bg.setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){xg.showAt(r,{anchor:"makeshift",x:t,y:n},fu(o))},moveRel:function(t,n){xg.showAt(r,i.backstage.shared.anchors.banner(),fu(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){z(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"),z(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,_g,Mg=function(e,o){var r=null;return{cancel:function(){null!==r&&(F.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&F.clearTimeout(r),r=F.setTimeout(function(){e.apply(null,t),r=null},o)}}},Fg=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Ig=pt([{aborted:[]},{edge:["element"]},{success:["info"]}]),Rg=pt([{abort:[]},{kontinue:[]},{finish:["info"]}]),Vg=function(n,e,t,o,r,i){var u=function(){return i.fold(Ig.aborted,Ig.edge)},a=function(){var t=r();return t?Vg(n,t,et.none(),o,r,et.some(e)):u()};if(n.isBlock(e))return u();if(e.nodeType!==F.Node.TEXT_NODE)return a();var c=e.textContent;return o(Rg,e,c,t).fold(Ig.aborted,function(){return a()},Ig.success)},Ng=function(t,n,e,o,r){var i=new Fg(n,r||t.getRoot());return Vg(t,n,et.some(e),o,i.prev,et.none())},Hg=function(e,n){return Pg(fe.fromDom(e.selection.getNode())).getOrThunk(function(){var t=fe.fromHtml('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',e.getDoc());return Pr(t,fe.fromDom(n.extractContents())),n.insertNode(t.dom()),Mr(t).each(function(t){return t.dom().normalize()}),Fc(t).map(function(t){var n;e.selection.setCursorLocation(t.dom(),"img"===Zo(n=t)?1:Oc(n).fold(function(){return Ir(n).length},function(t){return t.length}))}),t})},Pg=function(t){return gu(t,"[data-mce-autocompleter]")},zg=/[\u00a0 \t\r\n]/,Lg=function(t,n){return t.toString().substring(n.length).replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},jg=function(t,u,a,c){if(void 0===c&&(c=0),!(n=u).collapsed||3!==n.startContainer.nodeType)return et.none();var n;return Ng(t,u.startContainer,u.startOffset,function(e,o,r,t){var i=t.getOr(r.length);return function(t,n,e,o){var r;for(r=n-1;0<=r;r--){var i=t.charAt(r);if(zg.test(i))return et.none();if(i===e)break}return-1===r||n-r<o?et.none():et.some(t.substring(r+1,n))}(r,i,a,1).fold(function(){return r.match(zg)?e.abort():e.kontinue()},function(t){var n=u.cloneRange();return n.setStart(o,i-t.length-1),n.setEnd(u.endContainer,u.endOffset),r.length<c?e.abort():e.finish({text:Lg(n,a),range:n,triggerChar:a})})}).fold(et.none,et.none,et.some)},Ug=function(e,t,o,n){return void 0===n&&(n=0),Pg(fe.fromDom(t.startContainer)).fold(function(){return jg(e,t,o,n)},function(t){var n=e.createRng();return n.selectNode(t.dom()),et.some({range:n,text:Lg(n,o),triggerChar:o})})},Wg=function(e,t){t.on("keypress compositionend",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){jo(t,so(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(Ef.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which&&e.cancelIfNecessary(),e.isMenuOpen()?13===n.which?(t().each(Uo),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(Ef.highlightFirst)},function(t){o(t,n)}),n.preventDefault(),n.stopImmediatePropagation()):37!==n.which&&38!==n.which&&39!==n.which||t().each(function(t){o(t,n),n.preventDefault(),n.stopImmediatePropagation()}):13!==n.which&&38!==n.which&&40!==n.which||e.cancelIfNecessary())}),t.on("NodeChange",function(t){e.isActive()&&Pg(fe.fromDom(t.element)).isNone()&&e.cancelIfNecessary()})},Gg=tinymce.util.Tools.resolve("tinymce.util.Promise"),Xg=function(t,n){return{element:t,offset:n}},Yg=function(t){if(t.nodeType===F.Node.TEXT_NODE)return Xg(t,t.data.length);var n=t.childNodes;return 0<n.length?Yg(n[n.length-1]):Xg(t,n.length)},qg=function(t,n){var e=t.childNodes;return 0<e.length&&n<e.length?qg(e[n],0):0<e.length&&t.nodeType===F.Node.ELEMENT_NODE&&e.length===n?Yg(e[e.length-1]):Xg(t,n)},Kg=function(n,e){var o,r,t,i=e(),u=n.selection.getRng();return(o=n.dom,r=u,t=i,yu(t.triggerChars,function(t){return Ug(o,r,t)})).bind(function(t){return $g(n,e,t)})},$g=function(n,t,e){var o=t(),r=n.selection.getRng().startContainer.nodeValue,i=L(o.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOrThunk(function(){return e=n.dom,o=function(t,n,e,o){var r=o.getOr(e.length);return 0===r?t.kontinue():t.finish(/\s/.test(e.charAt(r-1)))},function(t){var n=qg(t.startContainer,t.startOffset);return Ng(e,n.element,n.offset,o).fold(nt(!0),nt(!0),d)};var e,o})(e.range,r,e.text)});if(0===i.length)return et.none();var u=Gg.all(P(i,function(n){return n.fetch(e.text,n.maxResults).then(function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}})}));return et.some({lookupData:u,context:e})},Jg=pn([ce("type",function(){return"autocompleteitem"}),ce("active",function(){return!1}),ce("disabled",function(){return!1}),te("meta",{}),jn("value"),Jn("text"),Jn("icon")]),Qg=pn([jn("type"),jn("ch"),ee("minChars",1),te("columns",1),ee("maxResults",10),Qn("matches"),Wn("fetch"),Wn("onAction")]),Zg=function(t){var n,e,o=t.ui.registry.getAll().popups,r=st(o,function(t){return(n=t,Bn("Autocompleter",Qg,n)).fold(function(t){throw new Error(_n(t))},function(t){return t});var n}),i=(n=ft(r,function(t){return t.ch}),e={},z(n,function(t){e[t]={}}),ut(e)),u=dt(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return L(u,function(t){return t.ch===n})}}},tp=[ie("disabled",!1),Jn("text"),Jn("shortcut"),wn("value","value",Ot(function(){return ri("menuitem-value")}),Fn()),te("meta",{})],np=pn([jn("type"),ue("onSetup",function(){return tt}),ue("onAction",tt),Jn("icon")].concat(tp)),ep=pn([jn("type"),Wn("getSubmenuItems"),ue("onSetup",function(){return tt}),Jn("icon")].concat(tp)),op=pn([jn("type"),ie("active",!1),ue("onSetup",function(){return tt}),Wn("onAction")].concat(tp)),rp=pn([jn("type"),ie("active",!1),Jn("icon")].concat(tp)),ip=pn([jn("type"),Jn("text")]),up=pn([jn("type"),Un("fancytype",["inserttable","colorswatch"]),ue("onAction",tt)]),ap=function(t,o,n){var r=zc(t.element(),"."+n);if(0<r.length){var e=G(r,function(t){var n=t.dom().getBoundingClientRect().top,e=r[0].dom().getBoundingClientRect().top;return Math.abs(n-e)>o}).getOr(r.length);return et.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return et.none()},cp=function(t,n){return Gu([Vm(t,n)])},sp=function(t){return cp(ri("unnamed-events"),t)},lp=[zn("lazySink"),zn("tooltipDom"),te("exclusive",!0),te("tooltipComponents",[]),te("delay",300),re("mode","normal",["normal","follow-highlight"]),te("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:nt([La,za,Va,Ha,Na,Pa]),onRtl:nt([La,za,Va,Ha,Na,Pa])}}}),Fu("onHide"),Fu("onShow")],fp=/* */Object.freeze({init:function(){var e=se(et.none()),n=se(et.none()),o=function(){e.get().each(function(t){F.clearTimeout(t)})},t=nt("not-implemented");return wi({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(et.some(t))},clearTooltip:function(){n.set(et.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(et.some(F.setTimeout(function(){t()},n)))},readState:t})}}),dp=ri("tooltip.exclusive"),mp=ri("tooltip.show"),gp=ri("tooltip.hide"),pp=function(t,n,e){t.getSystem().broadcastOn([dp],{})},hp=/* */Object.freeze({hideAllExclusive:pp,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&Sm.set(t,o)})}}),vp=Yu({fields:lp,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){Hs(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return fr(q([[gr(mp,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){pp(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:fr("normal"===o.mode?[gr(uo(),function(t){Lo(n,mp)}),gr(ro(),function(t){Lo(n,gp)})]:[]),behaviours:Gu([Sm.config({})])});r.setTooltip(e),Rs(t,e),o.onShow(n,e),Ms.position(t,o.anchor(n),e)}}(t)},o.delay)}),gr(gp,function(t){r.resetTimer(function(){e(t)},o.delay)}),gr(wo(),function(t,n){M(n.channels(),dp)&&e(t)}),Cr(function(t){e(t)})],"normal"===o.mode?[gr(ao(),function(t){Lo(t,mp)}),gr(yo(),function(t){Lo(t,gp)}),gr(uo(),function(t){Lo(t,mp)}),gr(ro(),function(t){Lo(t,gp)})]:[gr(Po(),function(t,n){Lo(t,mp)}),gr(zo(),function(t){Lo(t,gp)})]]))}}),state:fp,apis:hp}),bp=function(t){var n,e,o,r=fe.fromHtml(t),i=Ir(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],U(e,function(t,n){var e;return"class"===n.name?t:I({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:Wr(r)};return I({tag:Zo(r),classes:a,attributes:u},c)},yp=tinymce.util.Tools.resolve("tinymce.util.I18n"),xp="tox-menu-nav__js",wp="tox-collection__item",Sp="tox-swatch",Cp={normal:xp,color:Sp},kp="tox-collection__item--enabled",Op="tox-collection__item-icon",Ep="tox-collection__item-label",Tp="tox-collection__item--active",Bp=function(t){return Ft(Cp,t).getOr(xp)},Dp=tinymce.util.Tools.resolve("tinymce.Env"),Ap=function(t){var e=Dp.mac?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},n=t.split("+"),o=P(n,function(t){var n=t.toLowerCase().trim();return gt(e,n)?e[n]:t});return Dp.mac?o.join(""):o.join("+")},_p=function(t){return{dom:{tag:"div",classes:[Op],innerHtml:t}}},Mp=function(t){return{dom:{tag:"div",classes:[Ep]},components:[au(yp.translate(t))]}},Fp=function(t,n){return{dom:{tag:"div",classes:[Ep]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[au(yp.translate(n))]}]}},Ip=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:Ap(t)}}},Rp=function(t){return{dom:{tag:"div",classes:[Op,"tox-collection__item-checkmark"],innerHtml:Og("checkmark",t)}}},Vp=function(t,n,e,o,r){var i=e?t.checkMark.orThunk(function(){return n.or(et.some("")).map(_p)}):et.none(),u=t.ariaLabel.map(function(t){return{attributes:{title:yp.translate(t)}}}).getOr({});return{dom:yt({tag:"div",classes:[xp,wp].concat(r?["tox-collection__item-icon-rtl"]:[])},u),optComponents:[i,t.htmlContent.fold(function(){return t.textContent.map(o)},function(t){return et.some({dom:{tag:"div",classes:[Ep],innerHtml:t}})}),t.shortcutContent.map(Ip),t.caret]}},Np=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],Hp=["list-bull-circle","list-bull-default","list-bull-square"],Pp=function(t,r,n,i){void 0===i&&(i=et.none());var e,o,u,a,c,s,l,f=yp.isRtl()&&t.iconContent.exists(function(t){return M(Hp,t)}),d=(e=t.iconContent,e.map(function(t){return yp.isRtl()&&M(Np,t)?t+"-rtl":t})).map(function(t){return n=t,e=r.icons,o=i,et.from(e()[n]).or(o).getOrThunk(function(){return kg(e)});var n,e,o}),m=et.from(t.meta).fold(function(){return Mp},function(t){return gt(t,"style")?g(Fp,t.style):Mp});return"color"===t.presets?(o=t.ariaLabel,u=t.value,a=r,{dom:(c=Sp,s=d.getOr(""),l=o.map(function(t){return' title="'+a.translate(t)+'"'}).getOr(""),bp("custom"===u?'<button class="'+c+' tox-swatches__picker-btn"'+l+">"+s+"</button>":"remove"===u?'<div class="'+c+' tox-swatch--remove"'+l+">"+s+"</div>":'<div class="'+c+'" style="background-color: '+u+'" data-mce-color="'+u+'"'+l+"></div>")),optComponents:[]}):Vp(t,d,n,m,f)},zp=["input","button","textarea","select"],Lp=function(t,n,e){n.disabled&&Yp(t,n)},jp=function(t){return M(zp,Zo(t.element()))},Up=function(t){Yr(t.element(),"disabled","disabled")},Wp=function(t){Jr(t.element(),"disabled")},Gp=function(t){Yr(t.element(),"aria-disabled","true")},Xp=function(t){Yr(t.element(),"aria-disabled","false")},Yp=function(n,t,e){t.disableClass.each(function(t){Vi(n.element(),t)}),(jp(n)?Up:Gp)(n),t.onDisabled(n)},qp=function(n,t,e){t.disableClass.each(function(t){Hi(n.element(),t)}),(jp(n)?Wp:Xp)(n),t.onEnabled(n)},Kp=function(t){return jp(t)?$r(t.element(),"disabled"):"true"===Kr(t.element(),"aria-disabled")},$p=/* */Object.freeze({enable:qp,disable:Yp,isDisabled:Kp,onLoad:Lp,set:function(t,n,e,o){(o?Yp:qp)(t,n,e)}}),Jp=/* */Object.freeze({exhibit:function(t,n,e){return Ci({classes:n.disabled?n.disableClass.map(Z).getOr([]):[]})},events:function(t,n){return fr([dr(So(),function(t,n){return Kp(t)}),zu(t,n,Lp)])}}),Qp=[te("disabled",!1),qn("disableClass"),Fu("onDisabled"),Fu("onEnabled")],Zp=Yu({fields:Qp,name:"disabling",active:Jp,apis:$p}),th=function(t){return Zp.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},nh=function(t){return Zp.config({disabled:t})},eh=function(t){return Zp.config({disabled:t,disableClass:"tox-tbtn--disabled"})},oh=function(t,n){var e=t.getApi(n);return function(t){t(e)}},rh=function(e,o){return Sr(function(t){oh(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},ih=function(n,e){return Cr(function(t){return oh(n,t)(e.get())})};(_g=Ag||(Ag={}))[_g.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",_g[_g.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var uh=Ag,ah={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},ch=function(t){return K(t,function(t){return t.toArray()})},sh=function(t,n,e){var o,r,i=se(tt);return{type:"item",dom:n.dom,components:ch(n.optComponents),data:t.data,eventOrder:ah,hasSubmenu:t.triggersSubmenu,itemBehaviours:Gu([Vm("item-events",[(o=t,r=e,Or(function(t,n){oh(o,t)(o.onAction),o.triggersSubmenu||r!==uh.CLOSE_ON_EXECUTE||(Lo(t,To()),n.stop())})),rh(t,i),ih(t,i)]),th(t.disabled),Sm.config({})].concat(t.itemBehaviours))}},lh=function(t){return{value:t.value,meta:yt({text:t.text.getOr("")},t.meta)}},fh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),dh=function(t,n){var e,o=yp.translate(t),r=(e=o,fh.DOM.encode(e));if(0<n.length){var i=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");return r.replace(i,function(t){return'<span class="tox-autocompleter-highlight">'+t+"</span>"})}return r},mh=nt(Hl("item-widget",cg())),gh=ri("cell-over"),ph=ri("cell-execute"),hh=function(n,e,t){var o,r=function(t){return jo(t,ph,{row:n,col:e})};return lu({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:Gu([Vm("insert-table-picker-cell",[gr(uo(),Lm.focus),gr(So(),r),gr(Oo(),r)]),Zm.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Lm.config({onFocus:function(t){return jo(t,gh,{row:n,col:e})}})])})};var vh=function(t){return{value:nt(t)}},bh=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,yh=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,xh=function(t){return bh.test(t)||yh.test(t)},wh=function(t){var n,e=(n=t.value().replace(bh,function(t,n,e,o){return n+n+e+e+o+o}),{value:nt(n)}),o=yh.exec(e.value());return null===o?["FFFFFF","FF","FF","FF"]:o},Sh=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},Ch=function(t){var n=Sh(t.red())+Sh(t.green())+Sh(t.blue());return vh(n)},kh=Math.min,Oh=Math.max,Eh=Math.round,Th=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,Bh=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Dh=function(t,n,e,o){return{red:nt(t),green:nt(n),blue:nt(e),alpha:nt(o)}},Ah=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},_h=function(t){var n,e,o,r=(t.hue()||0)%360,i=t.saturation()/100,u=t.value()/100;if(i=Oh(0,kh(i,1)),u=Oh(0,kh(u,1)),0===i)return n=e=o=Eh(255*u),Dh(n,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),l=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=Eh(255*(n+l)),e=Eh(255*(e+l)),o=Eh(255*(o+l)),Dh(n,e,o,1)},Mh=function(t){var n=wh(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return Dh(e,o,r,1)},Fh=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return Dh(r,i,u,a)},Ih=function(t){return"rgba("+t.red()+","+t.green()+","+t.blue()+","+t.alpha()+")"},Rh=nt(Dh(255,0,0,1)),Vh=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Nh="tinymce-custom-colors";var Hh="choiceitem",Ph=[{type:Hh,text:"Light Green",value:"#BFEDD2"},{type:Hh,text:"Light Yellow",value:"#FBEEB8"},{type:Hh,text:"Light Red",value:"#F8CAC6"},{type:Hh,text:"Light Purple",value:"#ECCAFA"},{type:Hh,text:"Light Blue",value:"#C2E0F4"},{type:Hh,text:"Green",value:"#2DC26B"},{type:Hh,text:"Yellow",value:"#F1C40F"},{type:Hh,text:"Red",value:"#E03E2D"},{type:Hh,text:"Purple",value:"#B96AD9"},{type:Hh,text:"Blue",value:"#3598DB"},{type:Hh,text:"Dark Turquoise",value:"#169179"},{type:Hh,text:"Orange",value:"#E67E23"},{type:Hh,text:"Dark Red",value:"#BA372A"},{type:Hh,text:"Dark Purple",value:"#843FA1"},{type:Hh,text:"Dark Blue",value:"#236FA1"},{type:Hh,text:"Light Gray",value:"#ECF0F1"},{type:Hh,text:"Medium Gray",value:"#CED4D9"},{type:Hh,text:"Gray",value:"#95A5A6"},{type:Hh,text:"Dark Gray",value:"#7E8C8D"},{type:Hh,text:"Navy Blue",value:"#34495E"},{type:Hh,text:"Black",value:"#000000"},{type:Hh,text:"White",value:"#ffffff"}],zh=function j_(r){void 0===r&&(r=10);var t,n=Vh.getItem(Nh),e=k(n)?JSON.parse(n):[],i=r-(t=e).length<0?t.slice(0,r):t,u=function(t){i.splice(t,1)};return{add:function(t){var n,e,o;(n=i,e=t,o=_(n,e),-1===o?et.none():et.some(o)).each(u),i.unshift(t),i.length>r&&i.pop(),Vh.setItem(Nh,JSON.stringify(i))},state:function(){return i.slice(0)}}}(10),Lh=function(t){var n=[],u=F.document.createElement("canvas");u.height=1,u.width=1;for(var a=u.getContext("2d"),c=function(t,n){var e=n/255;return("0"+Math.round(t*e+255*(1-e)).toString(16)).slice(-2).toUpperCase()},e=function(t){if(/^[0-9A-Fa-f]{6}$/.test(t))return"#"+t.toUpperCase();a.clearRect(0,0,u.width,u.height),a.fillStyle="#FFFFFF",a.fillStyle=t,a.fillRect(0,0,1,1);var n=a.getImageData(0,0,1,1).data,e=n[0],o=n[1],r=n[2],i=n[3];return"#"+c(e,i)+c(o,i)+c(r,i)},o=0;o<t.length;o+=2)n.push({text:t[o+1],value:e(t[o]),type:"choiceitem"});return n},jh=function(t){return t.getParam("color_map")},Uh=function(t,n){return t.getParam("color_cols",n,"number")},Wh=function(t){return!1!==t.getParam("custom_colors")},Gh=function(t){var n=jh(t);return n!==undefined?Lh(n):Ph},Xh=function(){return P(zh.state(),function(t){return{type:Hh,text:t,value:t}})},Yh=function(t){zh.add(t)},qh=function(t){return t.fire("SkinLoaded")},Kh=function(t){return t.fire("ResizeEditor")},$h=function(t){return t.fire("ResizeContent")},Jh=function(t,n){t.fire("TextColorChange",n)},Qh=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},Zh=function(t){return Math.max(5,Math.ceil(Math.sqrt(t)))},tv=function(t){var n=Gh(t),e=Zh(n.length);return Uh(t,e)},nv=function(n,e,t,o){"custom"===t?av(n)(function(t){t.each(function(t){Yh(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},ev=function(t,n){return t.concat(Xh().concat((o={type:e="choiceitem",text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},n?[o,{type:e,text:"Custom color",icon:"color-picker",value:"custom"}]:[o])));var e,o},ov=function(n,e){return function(t){t(ev(n,e))}},rv=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)},iv=function(o,e,r,t,i){o.ui.registry.addSplitButton(e,{tooltip:t,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){return et.from(Qh(o,r)).bind(function(t){return function(t){if("transparent"===t)return et.some(Dh(0,0,0,0));var n=Th.exec(t);if(null!==n)return et.some(Fh(n[1],n[2],n[3],"1"));var e=Bh.exec(t);return null!==e?et.some(Fh(e[1],e[2],e[3],e[4])):et.none()}(t).map(function(t){var n=Ch(t).value();return Fe(e.toLowerCase(),n)})}).getOr(!1)},columns:tv(o),fetch:ov(Gh(o),Wh(o)),onAction:function(t){null!==i.get()&&nv(o,r,i.get(),function(){})},onItemAction:function(t,n){nv(o,r,n,function(t){i.set(t),Jh(o,{name:e,color:t})})},onSetup:function(n){null!==i.get()&&rv(n,e,i.get());var t=function(t){t.name===e&&rv(n,t.name,t.color)};return o.on("TextColorChange",t),function(){o.off("TextColorChange",t)}}})},uv=function(n,t,e,o){n.ui.registry.addNestedMenuItem(t,{text:o,icon:"forecolor"===t?"text-color":"highlight-bg-color",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"colorswatch",onAction:function(t){nv(n,e,t.value,tt)}}]}})},av=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(et.from(n.colorpicker)),t.close()});i.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onAction:function(t,n){"hex-valid"===n.name&&(n.value?t.enable("ok"):t.disable("ok"))},onSubmit:r,onClose:function(){},onCancel:function(){t(et.none())}})}},cv={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=se(null),e=se(null);iv(t,"forecolor","forecolor","Text color",n),iv(t,"backcolor","hilitecolor","Background color",e),uv(t,"forecolor","forecolor","Text color"),uv(t,"backcolor","hilitecolor","Background color")},getColors:ev,getFetch:ov,colorPickerDialog:av,getCurrentColor:Qh,getColorCols:tv,calcCols:Zh},sv=function(e,o){return function(t){var n=H(t,o);return P(n,function(t){return{dom:e,components:t}})}},lv=function(n,i,t){return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:["tox-collection--grid"])},components:[gg.parts().items({preprocess:function(t){return"auto"!==n&&1<n?sv({tag:"div",classes:["tox-collection__group"]},n)(t):(e=function(t,n){return"separator"===i[n].type},o=[],r=[],z(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],gt(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),P(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}));var e,o,r}})]}},fv=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},dv=function(t){var n=fv(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:Bp(t)}},mv=[gg.parts().items({})],gv=function(t,n,e){var o=fv(e);return{dom:{tag:"div",classes:q([[o.tieredMenu]])},markers:dv(e)}},pv=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},hv=function(t){return F.console.error(_n(t)),F.console.log(t),et.none()},vv=function(t,n,e,o,r){var i,u,a,c,s,l,f;return"color"===r?{value:t,dom:(f=(i=o,{dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[gg.parts().items({preprocess:"auto"!==i?sv({tag:"div",classes:["tox-swatches__row"]},i):d})]}]})).dom,components:f.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(f=lv(o,e)).dom,components:f.components,items:e}:"normal"===r&&1===o?{value:t,dom:(f=lv(1,e)).dom,components:f.components,items:e}:"normal"===r?{value:t,dom:(f=lv(o,e)).dom,components:f.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=r,l=fv(s),{tag:"div",classes:q([[l.menu,"tox-menu-"+c+"-column"],a?[l.hasIcons]:[]])}),components:mv,items:e}:{value:t,dom:(f=(u=o,{dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[gg.parts().items({preprocess:sv({tag:"div",classes:["tox-collection__group"]},u)})]})).dom,components:f.components,items:e}},bv=function(t,n,e,o,r,i,u,a){var c=N(n,pv),s=yv(n,e,o,"color"!==r?"normal":"color",i,u,a);return vv(t,c,s,o,r)},yv=function(t,l,f,d,m,g,p){return bu(P(t,function(s){return"choiceitem"===s.type?(t=s,Bn("choicemenuitem",rp,t)).fold(hv,function(t){return et.some((n=t,e=1===f,o=d,r=l,i=g(s.value),u=m,a=p,c=Pp({presets:o,textContent:e?n.text:et.none(),htmlContent:et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:e?n.shortcut:et.none(),checkMark:e?et.some(Rp(a.icons)):et.none(),caret:et.none(),value:n.value},a,!0),bt(sh({data:lh(n),disabled:n.disabled,getApi:function(n){return{setActive:function(t){Zm.set(n,t)},isActive:function(){return Zm.isOn(n)},isDisabled:function(){return Zp.isDisabled(n)},setDisabled:function(t){return Zp.set(n,t)}}},onAction:function(t){return r(n.value)},onSetup:function(t){return t.setActive(i),function(){}},triggersSubmenu:!1,itemBehaviours:[]},c,u),{toggling:{toggleClass:kp,toggleOnExecute:!1,selected:n.active}})));var n,e,o,r,i,u,a,c}):et.none();var t}))},xv=function(t,n){var e=dv(n);return 1===t?{mode:"menu",moveOnTab:!0}:"auto"===t?{mode:"grid",selector:"."+e.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===n?"tox-swatches__row":"tox-collection__group")}};var wv,Sv,Cv={inserttable:function U_(o){var t,n=ri("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(hh(r,u,t));o.push(i)}return o}(n,10,10),c=Cg({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[au("0x0")],behaviours:Gu([Sm.config({})])});return{type:"widget",data:{value:ri("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[mh().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:(t=a,K(t,function(t){return P(t,fu)})).concat(c.asSpec()),behaviours:Gu([Vm("insert-table-picker",[br(gh,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++)Zm.set(t[i][u],i<=n&&u<=e)}(a,i,u,10,10),Sm.set(c.get(t),[(o=i,r=u,au(r+1+"x"+(o+1)))])}),br(ph,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),Lo(t,To())})]),vm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:function W_(n,t){var e=cv.getColors(t.colorinput.getColors(),t.colorinput.hasCustomColors()),o=t.colorinput.getColorCols(),r=bv(ri("menu-value"),e,function(t){n.onAction({value:t})},o,"color",uh.CLOSE_ON_EXECUTE,function(){return!1},t.shared.providers),i=bt(I({},r,{markers:dv("color"),movement:xv(o,"color")}));return{type:"widget",data:{value:ri("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[mh().widget(gg.sketch(i))]}}},kv=function(n,e,t,o,r,i,u,a){void 0===a&&(a=!0);var c,s,l=Pp({presets:o,textContent:et.none(),htmlContent:t?n.text.map(function(t){return dh(t,e)}):et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:et.none(),checkMark:et.none(),caret:et.none(),value:n.value},u.providers,a,n.icon);return sh({data:lh(n),disabled:n.disabled,getApi:function(){return{}},onAction:function(t){return r(n.value,n.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:(c=n.meta,s=u,mt(c,"tooltipWorker").map(function(e){return[vp.config({lazySink:s.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t,overrides:{maxHeightFunction:Cs}}},mode:"follow-highlight",onShow:function(n,t){e(function(t){vp.setComponents(n,[cu({element:fe.fromDom(t)})])})}})]}).getOr([]))},l,i)},Ov=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:I({tag:"div",classes:[wp,"tox-collection__group-heading"]},n),components:[]}},Ev=function(t,n,e,o){void 0===o&&(o=!0);var r=Pp({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.none(),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return sh({data:lh(t),getApi:function(n){return{isDisabled:function(){return Zp.isDisabled(n)},setDisabled:function(t){return Zp.set(n,t)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n)},Tv=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:Og("chevron-right",r)}}),u=Pp({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.some(i),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return sh({data:lh(t),getApi:function(n){return{isDisabled:function(){return Zp.isDisabled(n)},setDisabled:function(t){return Zp.set(n,t)}}},disabled:t.disabled,onAction:tt,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},u,n)},Bv=function(t,n,e){var o=Pp({iconContent:et.none(),textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,checkMark:et.some(Rp(e.icons)),caret:et.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,!0);return bt(sh({data:lh(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){Zm.set(n,t)},isActive:function(){return Zm.isOn(n)},isDisabled:function(){return Zp.isDisabled(n)},setDisabled:function(t){return Zp.set(n,t)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,n),{toggling:{toggleClass:kp,toggleOnExecute:!1,selected:t.active}})},Dv=function(n,e){return(t=Cv,o=n.fancytype,Object.prototype.hasOwnProperty.call(t,o)?et.some(t[o]):et.none()).map(function(t){return t(n,e)});var t,o};(Sv=wv||(wv={}))[Sv.ContentFocus=0]="ContentFocus",Sv[Sv.UiFocus=1]="UiFocus";var Av=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},_v=function(t){return N(t,Av)},Mv=function(t,n,e,o){void 0===o&&(o=!0);var r,i,u,a,c,s=e.shared.providers;switch(t.type){case"menuitem":return(c=t,Bn("menuitem",np,c)).fold(hv,function(t){return et.some(Ev(t,n,s,o))});case"nestedmenuitem":return(a=t,Bn("nestedmenuitem",ep,a)).fold(hv,function(t){return et.some(Tv(t,n,s,o))});case"togglemenuitem":return(u=t,Bn("togglemenuitem",op,u)).fold(hv,function(t){return et.some(Bv(t,n,s))});case"separator":return(i=t,Bn("separatormenuitem",ip,i)).fold(hv,function(t){return et.some(Ov(t))});case"fancymenuitem":return(r=t,Bn("fancymenuitem",up,r)).fold(hv,function(t){return Dv(t,e)});default:return F.console.error("Unknown item in general menu",t),et.none()}},Fv=function(t,e,o,n,r,i){var u=1===n,a=!u||_v(t);return bu(P(t,function(t){return(n=t,Bn("Autocompleter.Item",Jg,n)).fold(hv,function(t){return et.some(kv(t,e,u,"normal",o,r,i,a))});var n}))},Iv=function(t,n,e,o){var r=_v(n),i=bu(P(n,function(t){var n=function(t){return Mv(t,e,o,r)};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(yt(t,{disabled:!0})):n(t)}));return vv(t,r,i,1,"normal")},Rv=function(t){return yg.singleData(t.value,t)},Vv=function(d,c){var e=se(et.none()),m=lu(xg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:Gu([Vm("dismissAutocompleter",[gr(Io(),function(){return l()})])]),lazySink:c.getSink})),o=function(){return e.get().isSome()},s=function(){o()&&xg.hide(m)},l=function(){if(o()){var t=e.get().map(function(t){return t.element});Pg(t.getOr(fe.fromDom(d.selection.getNode()))).each(Ur),s(),e.set(et.none())}},n=xt(function(){return Zg(d)}),f=function(t,n,e,o){t.matchLength=n.text.length;var r,i,u,a,c,s,l,f=yu(e,function(t){return et.from(t.columns)}).getOr(1);xg.showAt(m,{anchor:"node",root:fe.fromDom(d.getBody()),node:et.from(t.element)},gg.sketch((r=vv("autocompleter-value",!0,o,f,"normal"),i=f,u=wv.ContentFocus,a="normal",c=u===wv.ContentFocus?jf():Lf(),s=xv(i,a),l=dv(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:l.selectedItem,item:l.item},movement:s,fakeFocus:u===wv.ContentFocus,focusManager:c,menuBehaviours:sp("auto"!==i?[]:[Sr(function(o,t){ap(o,4,l.item).each(function(t){var n=t.numColumns,e=t.numRows;vm.setGridSize(o,e,n)})})])}))),xg.getContent(m).each(Ef.highlightFirst)},t=Mg(function(t){27!==t.which&&e.get().map(function(t){return Ug(d.dom,d.selection.getRng(),t.triggerChar).bind(function(t){return $g(d,n,t)})}).getOrThunk(function(){return Kg(d,n)}).fold(l,function(a){!function(t){if(!o()){var n=Hg(d,t.range);e.set(et.some({triggerChar:t.triggerChar,element:n,matchLength:t.text.length}))}}(a.context),a.lookupData.then(function(u){e.get().map(function(t){var n,e,o,r=a.context;if(t.triggerChar===r.triggerChar){var i=(n=r.triggerChar,o=yu(e=u,function(t){return et.from(t.columns)}).getOr(1),K(e,function(i){var t=i.items;return Fv(t,i.matchText,function(o,r){var t=d.selection.getRng();Ug(d.dom,t,n).fold(function(){return F.console.error("Lost context. Cursor probably moved")},function(t){var n=t.range,e={hide:l};i.onAction(e,n,o,r)})},o,uh.BUBBLE_TO_SANDBOX,c)}));0<i.length?f(t,r,u,i):10<=r.text.length-t.matchLength?l():s()}})})})},50);Wg({onKeypress:t,cancelIfNecessary:l,isMenuOpen:function(){return xg.isOpen(m)},isActive:o,getView:function(){return xg.getContent(m)}},d)},Nv=function(m,g){return function(t){if(m(t)){var n,e,o,r,i,u,a,c=fe.fromDom(t.target),s=function(){t.stopPropagation()},l=function(){t.preventDefault()},f=p(l,s),d=(n=c,e=t.clientX,o=t.clientY,r=s,i=l,u=f,a=t,{target:nt(n),x:nt(e),y:nt(o),stop:r,prevent:i,kill:u,raw:nt(a)});g(d)}}},Hv=function(t,n,e,o,r){var i=Nv(e,o);return t.dom().addEventListener(n,i,r),{unbind:g(Pv,t,n,i,r)}},Pv=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},zv=nt(!0),Lv=function(t,n,e){return Hv(t,n,zv,e,!1)},jv=function(t,n,e){return Hv(t,n,zv,e,!0)},Uv=function(t,n,e){return gu(t,n,e).isSome()};function Wv(e,o){var r=null;return{cancel:function(){null!==r&&(F.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=F.setTimeout(function(){e.apply(null,t),r=null},o)}}}var Gv=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?et.none():et.some(n.touches[0])},Xv=function(e){var u=se(et.none()),o=Wv(function(t){u.set(et.none()),e.triggerEvent(Eo(),t)},400),r=Rt([{key:Ze(),value:function(e){return Gv(e).each(function(t){o.cancel();var n={x:nt(t.clientX),y:nt(t.clientY),target:e.target};o.schedule(e),u.set(et.some(n))}),et.none()}},{key:to(),value:function(t){return o.cancel(),Gv(t).each(function(i){u.get().each(function(t){var n,e,o,r;n=i,e=t,o=Math.abs(n.clientX-e.x()),r=Math.abs(n.clientY-e.y()),(5<o||5<r)&&u.set(et.none())})}),et.none()}},{key:no(),value:function(n){o.cancel();return u.get().filter(function(t){return Ke(t.target(),n.target())}).map(function(t){return e.triggerEvent(ko(),n)})}}]);return{fireIfReady:function(n,t){return Ft(r,t).bind(function(t){return t(n)})}}},Yv=ze.detect().browser.isFirefox(),qv=gn([Wn("triggerEvent"),te("stopBackspace",!0)]),Kv=function(n,t){var e,o,r,i,u=An("Getting GUI events settings",qv,t),a=ze.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=Xv(u),s=P(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return Lv(n,t,function(n){c.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),l=se(et.none()),f=Lv(n,"paste",function(n){c.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),l.set(et.some(F.setTimeout(function(){u.triggerEvent(xo(),n)},0)))}),d=Lv(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||(8!==(n=t).raw().which||M(["input","textarea"],Zo(n.target()))||Uv(n.target(),'[contenteditable="true"]'))||t.prevent()}),m=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},Yv?jv(e,"focus",o):Lv(e,"focusin",o)),g=se(et.none()),p=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),g.set(et.some(F.setTimeout(function(){u.triggerEvent(yo(),t)},0)))},Yv?jv(r,"blur",i):Lv(r,"focusout",i));return{unbind:function(){z(s,function(t){t.unbind()}),d.unbind(),m.unbind(),p.unbind(),f.unbind(),l.get().each(F.clearTimeout),g.get().each(F.clearTimeout)}}},$v=function(t,n){var e=Ft(t,"target").map(function(t){return t()}).getOr(n);return se(e)},Jv=pt([{stopped:[]},{resume:["element"]},{complete:[]}]),Qv=function(t,o,n,e,r,i){var u,a,c,s,l=t(o,e),f=(u=n,a=r,c=se(!1),s=se(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:nt(u),setSource:a.set,getSource:a.get});return l.fold(function(){return i.logEventNoHandlers(o,e),Jv.complete()},function(n){var e=n.descHandler();return Oi(e)(f),f.isStopped()?(i.logEventStopped(o,n.element(),e.purpose()),Jv.stopped()):f.isCut()?(i.logEventCut(o,n.element(),e.purpose()),Jv.complete()):Mr(n.element()).fold(function(){return i.logNoParent(o,n.element(),e.purpose()),Jv.complete()},function(t){return i.logEventResponse(o,n.element(),e.purpose()),Jv.resume(t)})})},Zv=function(n,e,o,t,r,i){return Qv(n,e,o,t,r,i).fold(function(){return!0},function(t){return Zv(n,e,o,t,r,i)},function(){return!1})},tb=function(t,n,e){var o,r,i=(o=n,r=se(!1),{stop:function(){r.set(!0)},cut:tt,isStopped:r.get,isCut:nt(!1),event:nt(o),setSource:u("Cannot set source of a broadcasted event"),getSource:u("Cannot get source of a broadcasted event")});return z(t,function(t){var n=t.descHandler();Oi(n)(i)}),i.isStopped()},nb=function(t,n,e,o,r){var i=$v(e,o);return Zv(t,n,e,o,i,r)},eb=Er("element","descHandler"),ob=function(t,n){return{id:nt(t),descHandler:nt(n)}};function rb(){var i={};return{registerId:function(o,r,t){ct(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=ki(t,o),i[n]=e})},unregisterId:function(e){ct(i,function(t,n){t.hasOwnProperty(e)&&delete t[e]})},filterByType:function(t){return Ft(i,t).map(function(t){return ft(t,function(t,n){return ob(n,t)})}).getOr([])},find:function(t,n,e){var r=_t(n)(i);return lr(e,function(t){return e=r,li(o=t).fold(function(){return et.none()},function(t){var n=_t(t);return e.bind(n).map(function(t){return eb(o,t)})});var e,o},t)}}}function ib(){var o=rb(),r={},i=function(o){var t=o.element();return li(t).fold(function(){return t="uid-",n=o.element(),e=ri(ai+t),si(n,e),e;var t,n,e},function(t){return t})},u=function(t){li(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);Nt(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+ti(e.element())+"\nCannot use it for: "+ti(t.element())+"\nThe conflicting element is"+(rr(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 _t(t)(r)}}}var ub,ab,cb=cf({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=h(n,["attributes"]);return{uid:t.uid,dom:I({tag:"div",attributes:I({role:"presentation"},e)},o),components:t.components,behaviours:rl(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[te("components",[]),ol("containerBehaviours",[]),te("events",{}),te("domModification",{}),te("eventOrder",{})]}),sb=function(e){var o=function(n){return Mr(e.element()).fold(function(){return!0},function(t){return Ke(n,t)})},r=ib(),s=function(t,n){return r.find(o,t,n)},t=Kv(e.element(),{triggerEvent:function(u,a){return ku(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),nb(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:nt("real"),triggerEvent:function(n,e,o){ku(n,e,function(t){nb(s,n,o,e,t)})},triggerFocus:function(a,c){li(a).fold(function(){Nf(a)},function(t){ku(bo(),a,function(t){var n,e,o,r,i,u;n=s,e=bo(),o={originator:nt(c),kill:tt,prevent:tt,target:nt(a)},i=t,u=$v(o,r=a),Qv(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:lu,addToGui:function(t){a(t)},removeFromGui:function(t){c(t)},addToWorld:function(t){n(t)},removeFromWorld:function(t){u(t)},broadcast:function(t){f(t)},broadcastOn:function(t,n){d(t,n)},broadcastEvent:function(t,n){m(t,n)},isConnected:nt(!0)},n=function(t){t.connect(i),er(t.element())||(r.register(t),z(t.components(),n),i.triggerEvent(Do(),t.element(),{target:nt(t.element())}))},u=function(t){er(t.element())||(z(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){Rs(e,t)},c=function(t){Hs(t)},l=function(e){var t=r.filter(wo());z(t,function(t){var n=t.descHandler();Oi(n)(e)})},f=function(t){l({universal:nt(!0),data:nt(t)})},d=function(t,n){l({universal:nt(!1),channels:nt(t),data:nt(n)})},m=function(t,n){var e=r.filter(t);return tb(e,n)},g=function(t){return r.getById(t).fold(function(){return R.error(new Error('Could not find component with uid: "'+t+'" in system.'))},R.value)},p=function(t){var n=li(t).getOr("not found");return g(n)};return n(e),{root:nt(e),element:e.element,destroy:function(){t.unbind(),jr(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:f,broadcastOn:d,broadcastEvent:m}},lb=tinymce.util.Tools.resolve("tinymce.EditorManager"),fb=function(t){return et.from(t.settings.min_width).filter(V)},db=function(t){return et.from(t.settings.min_height).filter(V)},mb=function(t){return!1!==t.getParam("menubar",!0,"boolean")},gb=function(t){var n=t.getParam("toolbar",!0),e=!0===n,o=k(n),r=E(n)&&0<n.length;return!hb(t)&&(r||o||e)},pb=function(n){var t=ut(n.settings),e=L(t,function(t){return/^toolbar([1-9])$/.test(t)}),o=P(e,function(t){return n.getParam(t,!1,"string")}),r=L(o,function(t){return"string"==typeof t});return 0<r.length?et.some(r):et.none()},hb=function(t){return pb(t).fold(function(){return 0<t.getParam("toolbar",[],"string[]").length},function(){return!0})};(ab=ub||(ub={}))["default"]="",ab.floating="floating",ab.sliding="sliding";var vb,bb,yb=function(t){return t.getParam("toolbar_drawer","","string")},xb=function(t){var n=t.getParam("fixed_toolbar_container","","string"),e=t.getParam("inline",!1,"boolean");return 0<n.length&&e?mu(ir(),n):et.none()},wb=function(t){return t.getParam("inline",!1,"boolean")&&xb(t).isSome()},Sb=ri("form-component-change"),Cb=ri("form-close"),kb=ri("form-cancel"),Ob=ri("form-action"),Eb=ri("form-submit"),Tb=ri("form-block"),Bb=ri("form-unblock"),Db=ri("form-tabchange"),Ab=ri("form-resize"),_b=nt([te("prefix","form-field"),ol("fieldBehaviours",[mf,Rm])]),Mb=nt([Fl({schema:[zn("dom")],name:"label"}),Fl({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[zn("text")],name:"aria-descriptor"}),_l({factory:{sketch:function(t){var n=At(t,["factory"]);return t.factory.sketch(n)}},schema:[zn("factory")],name:"field"})]),Fb=sf({name:"FormField",configFields:_b(),partFields:Mb(),factory:function(r,t,n,e){var o=il(r.fieldBehaviours,[mf.config({find:function(t){return Gl(t,r,"field")}}),Rm.config({store:{mode:"manual",getValue:function(t){return mf.getCurrent(t).bind(Rm.getValue)},setValue:function(t,n){mf.getCurrent(t).each(function(t){Rm.setValue(t,n)})}}})]),i=fr([Sr(function(t,n){var o=Yl(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=ri(r.prefix);o.label().each(function(t){Yr(t.element(),"for",n),Yr(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=ri(r.prefix);Yr(t.element(),"id",n),Yr(e.element(),"aria-describedby",n)})})})]),u={getField:function(t){return Gl(t,r,"field")},getLabel:function(t){return Gl(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)}}}),Ib=/* */Object.freeze({getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),Rb=[Ln("others",Tn(R.value,Fn()))],Vb=Yu({fields:Rb,name:"coupling",apis:Ib,state:/* */Object.freeze({init:function(t){var i={},n=nt({});return wi({readState:n,getOrCreate:function(e,o,r){var t=ut(o.others);if(t)return Ft(i,r).getOrThunk(function(){var t=Ft(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: "+un(t,null,2))}})}})}),Nb=/* */Object.freeze({events:function(t,n){var e=t.stream.streams.setup(t,n);return fr([gr(t.event,e),Cr(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[gr(t,function(){return n.cancel()})]}).getOr([])))}}),Hb=function(t){var n=se(null);return wi({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()}})},Pb=/* */Object.freeze({throttle:Hb,init:function(t){return t.stream.streams.state(t)}}),zb=[Ln("stream",Mn("mode",{throttle:[zn("delay"),te("stopEvent",!0),Nu("streams",{setup:function(t,n){var e=t.stream,o=Mg(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:Hb})]})),te("event","input"),qn("cancelEvent"),Ru("onStream")],Lb=Yu({fields:zb,name:"streaming",active:Nb,state:Pb}),jb=function(t){var e=et.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){z(t,u)},u=function(n){e.each(function(t){F.setTimeout(function(){n(t)},0)})};return t(function(t){e=et.some(t),i(n),n=[]}),{get:o,map:function(e){return jb(function(n){o(function(t){n(e(t))})})},isReady:r}},Ub={nu:jb,pure:function(n){return jb(function(t){t(n)})}},Wb=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;F.setTimeout(function(){o.apply(e,t)},0)}))},e=function(){return Ub.nu(t)};return{map:function(o){return Wb(function(e){t(function(t){var n=o(t);e(n)})})},bind:function(e){return Wb(function(n){t(function(t){e(t).get(n)})})},anonBind:function(e){return Wb(function(n){t(function(t){e.get(n)})})},toLazy:e,toCached:function(){var n=null;return Wb(function(t){null===n&&(n=e()),n.get(t)})},get:t}},Gb={nu:Wb,pure:function(n){return Wb(function(t){t(n)})}},Xb=nt("sink"),Yb=nt(Fl({name:Xb(),overrides:nt({dom:{tag:"div"},behaviours:Gu([Ms.config({useFixed:!0})]),events:fr([yr(so()),yr(eo()),yr(go())])})}));(bb=vb||(vb={}))[bb.HighlightFirst=0]="HighlightFirst",bb[bb.HighlightNone=1]="HighlightNone";var qb=function(t,n){var e=t.getHotspot(n).getOr(n),o=t.getAnchorOverrides();return t.layouts.fold(function(){return{anchor:"hotspot",hotspot:e,overrides:o}},function(t){return{anchor:"hotspot",hotspot:e,overrides:o,layouts:t}})},Kb=function(t,n,e,o,r,i,u){var a,c,s,l,f,d,m,g,p,h,v=qb(t,e);return(c=v,l=o,f=r,d=u,m=n,g=s=e,p=(0,(a=t).fetch)(g).map(m),h=Zb(s,a),p.map(function(t){return t.bind(function(t){return et.from(yg.sketch(I({},f.menu(),{uid:fi(""),data:t,highlightImmediately:d===vb.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();Ms.position(e,c,n),Js.decloak(l)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();Ms.position(o,{anchor:"submenu",item:n},e),Js.decloak(l)},onEscape:function(){return Lm.focus(s),Js.close(l),et.some(!0)}})))})})).map(function(t){return t.fold(function(){Js.isOpen(o)&&Js.close(o)},function(t){Js.cloak(o),Js.open(o,t),i(o)}),o})},$b=function(t,n,e,o,r,i,u){return Js.close(o),Gb.pure(o)},Jb=function(t,n,e,o,r,i){var u=Vb.getCoupled(e,"sandbox");return(Js.isOpen(u)?$b:Kb)(t,n,e,u,o,r,i)},Qb=function(t,n,e){var o,r,i=mf.getCurrent(n).getOr(n),u=fa(t.element());e?Gi(i.element(),"min-width",u+"px"):(o=i.element(),r=u,la.set(o,r))},Zb=function(n,t){return n.getSystem().getByUid(t.uid+"-"+Xb()).map(function(t){return function(){return R.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return R.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},ty=function(o,r,i){var u=pu(),t=Zb(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id(),role:"listbox"}},behaviours:al(o.sandboxBehaviours,[Rm.config({store:{mode:"memory",initialValue:r}}),Js.config({onOpen:function(t,n){var e=qb(o,r);u.link(r.element()),o.matchWidth&&Qb(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 vu(n,e)||vu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),mf.config({find:function(t){return Js.getState(t).bind(function(t){return mf.getCurrent(t)})}}),nl({isExtraPart:nt(!1)})])}},ny=function(t,n,e){var o=Rm.getValue(e);Rm.setValue(n,o),oy(n)},ey=function(t,n){var e=t.element(),o=Zi(e),r=e.dom();"number"!==Kr(e,"type")&&n(r,o)},oy=function(t){ey(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},ry=function(t,n,o){if(t.selectsOver){var e=Rm.getValue(n),r=t.getDisplayText(e),i=Rm.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?et.some(function(){var t,e;ny(0,n,o),t=n,e=r.length,ey(t,function(t,n){return t.setSelectionRange(e,n.length)})}):et.none()}return et.none()},iy=nt([qn("data"),te("inputAttributes",{}),te("inputStyles",{}),te("tag","input"),te("inputClasses",[]),Fu("onSetValue"),te("styles",{}),te("eventOrder",{}),ol("inputBehaviours",[Rm,Lm]),te("selectOnFocus",!0)]),uy=function(t){return Gu([Lm.config({onFocus:!1===t.selectOnFocus?tt:function(t){var n=t.element(),e=Zi(n);n.dom().setSelectionRange(0,e.length)}})])},ay=function(t){return{tag:t.tag,attributes:I({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},cy=nt("alloy.typeahead.itemexecute"),sy=function(){return[te("sandboxClasses",[]),ul("sandboxBehaviours",[mf,Zu,Js,Rm])]},ly=nt([qn("lazySink"),zn("fetch"),te("minChars",5),te("responseTime",1e3),Fu("onOpen"),te("getHotspot",et.some),te("getAnchorOverrides",nt({})),te("layouts",et.none()),te("eventOrder",{}),ae("model",{},[te("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),te("selectsOver",!0),te("populateFromBrowse",!0)]),Fu("onSetValue"),Iu("onExecute"),Fu("onItemExecute"),te("inputClasses",[]),te("inputAttributes",{}),te("inputStyles",{}),te("matchWidth",!0),te("useMinWidth",!1),te("dismissOnBlur",!0),_u(["openClass"]),qn("initialData"),ol("typeaheadBehaviours",[Lm,Rm,Lb,vm,Zm,Vb]),ce("previewing",function(){return se(!0)})].concat(iy()).concat(sy())),fy=nt([Ml({schema:[Au()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){ry(o.model,t,e).fold(function(){return Ef.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&ny(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return jo(t,cy(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&ny(o.model,t,n)})}}}})]),dy=sf({name:"Typeahead",configFields:ly(),partFields:fy(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=Vb.getCoupled(t,"sandbox");Js.isOpen(o)?mf.getCurrent(o).each(function(t){Ef.getHighlighted(t).fold(function(){e(t)},function(){Xo(o,t.element(),"keydown",n)})}):Kb(r,u(t),t,o,i,function(t){mf.getCurrent(t).each(e)},vb.HighlightFirst).get(tt)},o=uy(r),u=function(o){return function(t){return t.map(function(t){var n=dt(t.menus),e=K(n,function(t){return L(t.items,function(t){return"item"===t.type})});return Rm.getState(o).update(P(e,function(t){return t.data})),t})}},a=[Lm.config({}),Rm.config({onSetValue:r.onSetValue,store:I({mode:"dataset",getDataKey:function(t){return Zi(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){tu(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return It("initialValue",t)}).getOr({}))}),Lb.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t,n){var e=Vb.getCoupled(t,"sandbox");if(Lm.isFocused(t)&&Zi(t.element()).length>=r.minChars){var o=mf.getCurrent(e).bind(function(t){return Ef.getHighlighted(t).map(Rm.getValue)});r.previewing.set(!0),Kb(r,u(t),t,e,i,function(t){mf.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&Ef.highlightFirst(t)},function(n){Ef.highlightBy(t,function(t){return Rm.getValue(t).value===n.value}),Ef.getHighlighted(t).orThunk(function(){return Ef.highlightFirst(t),et.none()})})})},vb.HighlightFirst).get(tt)}},cancelEvent:Bo()}),vm.config({mode:"special",onDown:function(t,n){return e(t,n,Ef.highlightFirst),et.some(!0)},onEscape:function(t){var n=Vb.getCoupled(t,"sandbox");return Js.isOpen(n)?(Js.close(n),et.some(!0)):et.none()},onUp:function(t,n){return e(t,n,Ef.highlightLast),et.some(!0)},onEnter:function(n){var t=Vb.getCoupled(n,"sandbox"),e=Js.isOpen(t);if(e&&!r.previewing.get())return mf.getCurrent(t).bind(function(t){return Ef.getHighlighted(t)}).map(function(t){return jo(n,cy(),{item:t}),!0});var o=Rm.getValue(n);return Lo(n,Bo()),r.onExecute(t,n,o),e&&Js.close(t),et.some(!0)}}),Zm.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),Vb.config({others:{sandbox:function(t){return ty(r,t,{onOpen:function(){return Zm.on(t)},onClose:function(){return Zm.off(t)}})}}}),Vm("typeaheadevents",[Or(function(t){var n=tt;Jb(r,u(t),t,i,n,vb.HighlightFirst).get(tt)}),gr(cy(),function(t,n){var e=Vb.getCoupled(t,"sandbox");ny(r.model,t,n.event().item()),Lo(t,Bo()),r.onItemExecute(t,e,n.event().item(),Rm.getValue(t)),Js.close(e),oy(t)})].concat(r.dismissOnBlur?[gr(yo(),function(t){var n=Vb.getCoupled(t,"sandbox");Pf(n.element()).isNone()&&Js.close(n)})]:[]))];return{uid:r.uid,dom:ay(bt(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:I({},o,il(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),my=function(t,n,e,o){var r=py(t,n,e,o);return Fb.sketch(r)},gy=function(t,n){return my(t,n,[],[])},py=function(t,n,e,o){return{dom:hy(e),components:t.toArray().concat([n]),fieldBehaviours:Gu(o)}},hy=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},vy=function(t,n){return Fb.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},by=function(t){return"separator"===t.type},yy={type:"separator"},xy=function(t,e){var n=U(t,function(t,n){return k(n)?""===n?t:"|"===n?0<t.length&&!by(t[t.length-1])?t.concat([yy]):t:gt(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&by(n[n.length-1])&&n.pop(),n},wy=function(t,n){return gt(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=Sy(r,o),{item:e,menus:bt(i.menus,It(e.value,i.items)),expansions:bt(i.expansions,It(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},Sy=function(t,r){var n=xy(k(t)?t.split(" "):t,r);return j(n,function(t,n){var e=function(t){if(by(t))return t;var n=Ft(t,"value").getOrThunk(function(){return ri("generated-menu-item")});return bt({value:n},t)}(n),o=wy(e,r);return{menus:bt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:bt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},Cy=function(t,e,o){var n=ri("primary-menu"),r=Sy(t,o.shared.providers.menuItems());if(0===r.items.length)return et.none();var i=Iv(n,r.items,e,o),u=st(r.menus,function(t,n){return Iv(n,t,e,o)}),a=bt(u,It(n,i));return et.from(yg.tieredData(n,a,r.expansions))},ky=cf({name:"Input",configFields:iy(),factory:function(t,n){return{uid:t.uid,dom:ay(t),components:[],behaviours:(e=t,I({},uy(e),il(e.inputBehaviours,[Rm.config({store:{mode:"manual",initialValue:e.data.getOr(undefined),getValue:function(t){return Zi(t.element())},setValue:function(t,n){Zi(t.element())!==n&&tu(t.element(),n)}},onSetValue:e.onSetValue})]))),eventOrder:t.eventOrder};var e}}),Oy=["input","textarea"],Ey=function(t){var n=Zo(t);return M(Oy,n)},Ty=function(t,n){var e=n.getRoot(t).getOr(t.element());Hi(e,n.invalidClass),n.notify.each(function(n){Ey(t.element())&&Yr(t.element(),"aria-invalid",!1),n.getContainer(t).each(function(t){Gr(t,n.validHtml)}),n.onValid(t)})},By=function(n,t,e,o){var r=t.getRoot(n).getOr(n.element());Vi(r,t.invalidClass),t.notify.each(function(t){Ey(n.element())&&Yr(n.element(),"aria-invalid",!0),t.getContainer(n).each(function(t){Gr(t,o)}),t.onInvalid(n,o)})},Dy=function(n,t,e){return t.validator.fold(function(){return Gb.pure(R.value(!0))},function(t){return t.validate(n)})},Ay=function(n,e,t){return e.notify.each(function(t){t.onValidate(n)}),Dy(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return By(n,e,0,t),R.error(t)},function(t){return Ty(n,e),R.value(t)}):R.error("No longer in system")})},_y=/* */Object.freeze({markValid:Ty,markInvalid:By,query:Dy,run:Ay,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return Pi(e,n.invalidClass)}}),My=/* */Object.freeze({events:function(n,t){return n.validator.map(function(t){return fr([gr(t.onEvent,function(t){Ay(t,n).get(d)})].concat(t.validateOnLoad?[Sr(function(t){Ay(t,n).get(tt)})]:[]))}).getOr({})}}),Fy=[zn("invalidClass"),te("getRoot",et.none),Zn("notify",[te("aria","alert"),te("getContainer",et.none),te("validHtml",""),Fu("onValid"),Fu("onInvalid"),Fu("onValidate")]),Zn("validator",[zn("validate"),te("onEvent","input"),te("validateOnLoad",!0)])],Iy=Yu({fields:Fy,name:"invalidating",active:My,apis:_y,extra:{validation:function(e){return function(t){var n=Rm.getValue(t);return Gb.pure(e(n))}}}}),Ry=/* */Object.freeze({exhibit:function(t,n){return Ci({attributes:Rt([{key:n.tabAttr,value:"true"}])})}}),Vy=[te("tabAttr","data-alloy-tabstop")],Ny=Yu({fields:Vy,name:"tabstopping",active:Ry}),Hy=nt([zn("dom"),zn("fetch"),Fu("onOpen"),Iu("onExecute"),te("getHotspot",et.some),te("getAnchorOverrides",nt({})),te("layouts",et.none()),ol("dropdownBehaviours",[Zm,Vb,vm,Lm]),zn("toggleClass"),te("eventOrder",{}),qn("lazySink"),te("matchWidth",!1),te("useMinWidth",!1),qn("role")].concat(sy())),Py=nt([Ml({schema:[Au()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),Yb()]),zy=sf({name:"Dropdown",configFields:Hy(),partFields:Py(),factory:function(n,t,e,o){var r,i,u=function(t){Js.getState(t).each(function(t){yg.highlightPrimary(t)})},a={expand:function(t){Zm.isOn(t)||Jb(n,function(t){return t},t,o,tt,vb.HighlightNone).get(tt)},open:function(t){Zm.isOn(t)||Jb(n,function(t){return t},t,o,tt,vb.HighlightFirst).get(tt)},isOpen:Zm.isOn,close:function(t){Zm.isOn(t)&&Jb(n,function(t){return t},t,o,tt,vb.HighlightFirst).get(tt)}},c=function(t,n){return Uo(t),et.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:il(n.dropdownBehaviours,[Zm.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),Vb.config({others:{sandbox:function(t){return ty(n,t,{onOpen:function(){Zm.on(t)},onClose:function(){Zm.off(t)}})}}}),vm.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t,n){if(zy.isOpen(t)){var e=Vb.getCoupled(t,"sandbox");u(e)}else zy.open(t);return et.some(!0)},onEscape:function(t,n){return zy.isOpen(t)?(zy.close(t),et.some(!0)):et.none()}}),Lm.config({})]),events:wg(et.some(function(t){Jb(n,function(t){return t},t,o,u,vb.HighlightFirst).get(tt)})),eventOrder:I({},n.eventOrder,(r={},r[So()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:I({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}}),"button"===n.dom.tag?{type:(i="type",Ft(n.dom,"attributes").bind(function(t){return Ft(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)}}}),Ly=Yu({fields:[],name:"unselecting",active:/* */Object.freeze({events:function(t){return fr([dr(ho(),nt(!0))])},exhibit:function(t,n){return Ci({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),jy=ri("color-input-change"),Uy=ri("color-swatch-change"),Wy=ri("color-picker-cancel"),Gy=function(t,n,o){var e,r,i=Fb.parts().field({factory:ky,inputClasses:["tox-textfield"],onSetValue:function(t){return Iy.run(t).get(function(){})},inputBehaviours:Gu([Ny.config({}),Iy.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return Mr(t.element())},notify:{onValid:function(t){var n=Rm.getValue(t);jo(t,jy,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=Rm.getValue(t);if(0===n.length)return Gb.pure(R.value(!0));var e=fe.fromTag("span");Gi(e,"background-color",n);var o=Ki(e,"background-color").fold(function(){return R.error("blah")},function(t){return R.value(n)});return Gb.pure(o)}}})]),selectOnFocus:!1}),u=t.label.map(function(t){return vy(t,n.providers)}),a=function(t,n){jo(t,Uy,{value:n})},c=Cg((e={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:et.some({onRtl:function(){return[Va]},onLtr:function(){return[Na]}}),components:[],fetch:cv.getFetch(o.getColors(),o.hasCustomColors()),columns:o.getColorCols(),presets:"color",onItemAction:function(t,e){c.getOpt(t).each(function(n){"custom"===e?o.colorPicker(function(t){t.fold(function(){return Lo(n,Wy)},function(t){a(n,t),Yh(t)})},"#ffffff"):a(n,"remove"===e?"":e)})}},r=n,zy.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:Gu([Ly.config({}),Ny.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:r.getSink,fetch:function(n){return Gb.nu(function(t){return e.fetch(t)}).map(function(t){return et.from(Rv(bt(bv(ri("menu-value"),t,function(t){e.onItemAction(n,t)},e.columns,e.presets,uh.CLOSE_ON_EXECUTE,function(){return!1},r.providers),{movement:xv(e.columns,e.presets)})))})},parts:{menu:gv(0,0,e.presets)}})));return Fb.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[i,c.asSpec()]}]),fieldBehaviours:Gu([Vm("form-field-events",[gr(jy,function(t,n){c.getOpt(t).each(function(t){Gi(t.element(),"background-color",n.event().color())})}),gr(Uy,function(n,e){Fb.getField(n).each(function(t){Rm.setValue(t,e.event().value()),mf.getCurrent(n).each(Lm.focus)})}),gr(Wy,function(n,t){Fb.getField(n).each(function(t){mf.getCurrent(n).each(Lm.focus)})})])])})},Xy=function(t,n,e){return{hue:nt(t),saturation:nt(n),value:nt(e)}},Yy=nt(ri("rgb-hex-update")),qy=nt(ri("slider-update")),Ky=nt(ri("palette-update")),$y=ze.detect().deviceType.isTouch(),Jy=Fl({schema:[zn("dom")],name:"label"}),Qy=function(t){return Fl({name:t+"-edge",overrides:function(o){return o.model.manager.edgeActions[t].fold(function(){return{}},function(e){var t=fr([pr(Ze(),e,[o])]),n=fr([pr(eo(),e,[o]),pr(oo(),function(t,n){n.mouseIsDown.get()&&e(t,n)},[o])]);return{events:$y?t:n}})}})},Zy=Qy("top-left"),tx=Qy("top"),nx=Qy("top-right"),ex=Qy("right"),ox=Qy("bottom-right"),rx=Qy("bottom"),ix=Qy("bottom-left"),ux=[Jy,Qy("left"),ex,tx,rx,Zy,nx,ix,ox,_l({name:"thumb",defaults:nt({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:fr([vr(Ze(),t,"spectrum"),vr(to(),t,"spectrum"),vr(no(),t,"spectrum"),vr(eo(),t,"spectrum"),vr(oo(),t,"spectrum"),vr(io(),t,"spectrum")])}}}),_l({schema:[ce("mouseIsDown",function(){return se(!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=fr([gr(Ze(),r),gr(to(),r)]),n=fr([gr(eo(),r),gr(oo(),function(t,n){e.mouseIsDown.get()&&r(t,n)})]);return{behaviours:Gu($y?[]:[vm.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)}}),Lm.config({})]),events:$y?t:n}}})],ax=ze.detect().deviceType.isTouch(),cx=nt("slider.change.value"),sx=function(t){var n=t.event().raw();if(ax){var e=n;return e.touches!==undefined&&1===e.touches.length?et.some(e.touches[0]).map(function(t){return ea(t.clientX,t.clientY)}):et.none()}var o=n;return o.clientX!==undefined?et.some(o).map(function(t){return ea(t.clientX,t.clientY)}):et.none()},lx=function(t){return t.model.minX},fx=function(t){return t.model.minY},dx=function(t){return t.model.minX-1},mx=function(t){return t.model.minY-1},gx=function(t){return t.model.maxX},px=function(t){return t.model.maxY},hx=function(t){return t.model.maxX+1},vx=function(t){return t.model.maxY+1},bx=function(t,n,e){return n(t)-e(t)},yx=function(t){return bx(t,gx,lx)},xx=function(t){return bx(t,px,fx)},wx=function(t){return yx(t)/2},Sx=function(t){return xx(t)/2},Cx=function(t){return t.stepSize},kx=function(t){return t.snapToGrid},Ox=function(t){return t.snapStart},Ex=function(t){return t.rounded},Tx=function(t,n){return t[n+"-edge"]!==undefined},Bx=function(t){return Tx(t,"left")},Dx=function(t){return Tx(t,"right")},Ax=function(t){return Tx(t,"top")},_x=function(t){return Tx(t,"bottom")},Mx=function(t){return t.model.value.get()},Fx=function(t){return{x:nt(t)}},Ix=function(t){return{y:nt(t)}},Rx=function(t,n){return{x:nt(t),y:nt(n)}},Vx=function(t,n){jo(t,cx(),{value:n})},Nx=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},Hx=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},Px=function(t,n,e){return Math.max(n,Math.min(e,t))},zx=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,l=t.hasMaxEdge,f=t.minBound,d=t.maxBound,m=t.screenRange,g=s?n-1:n,p=l?e+1:e;if(r<f)return g;if(d<r)return p;var h,v,b,y,x,w,S,C=(x=r,w=f,S=d,Math.min(S,Math.max(x,w))-w),k=Px(C/m*o+n,g,p);return u&&n<=k&&k<=e?(h=k,v=n,b=e,y=i,a.fold(function(){var t=h-v,n=Math.round(t/y)*y;return Px(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(k):k},Lx=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,l=t.centerMaxEdge;return r<n?i?0:s:e<r?u?a:l:(r-n)/o*c},jx="left",Ux=function(t){return t.element().dom().getBoundingClientRect()},Wx=function(t,n){return t[n]},Gx=function(t){var n=Ux(t);return Wx(n,jx)},Xx=function(t){var n=Ux(t);return Wx(n,"right")},Yx=function(t){var n=Ux(t);return Wx(n,"top")},qx=function(t){var n=Ux(t);return Wx(n,"bottom")},Kx=function(t){var n=Ux(t);return Wx(n,"width")},$x=function(t){var n=Ux(t);return Wx(n,"height")},Jx=function(t,n,e){return(t+n)/2-e},Qx=function(t,n){var e=Ux(t),o=Ux(n),r=Wx(e,jx),i=Wx(e,"right"),u=Wx(o,jx);return Jx(r,i,u)},Zx=function(t,n){var e=Ux(t),o=Ux(n),r=Wx(e,"top"),i=Wx(e,"bottom"),u=Wx(o,"top");return Jx(r,i,u)},tw=function(t,n){jo(t,cx(),{value:n})},nw=function(t){return{x:nt(t)}},ew=function(t,n,e){var o={min:lx(n),max:gx(n),range:yx(n),value:e,step:Cx(n),snap:kx(n),snapStart:Ox(n),rounded:Ex(n),hasMinEdge:Bx(n),hasMaxEdge:Dx(n),minBound:Gx(t),maxBound:Xx(t),screenRange:Kx(t)};return zx(o)},ow=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Hx:Nx)(Mx(r).x(),lx(r),gx(r),Cx(r)),tw(o,nw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},rw=function(t,n,e,o,r,i){var u,a,c,s,l,f,d,m,g,p=(a=i,c=e,s=o,l=r,f=Kx(u=n),d=s.bind(function(t){return et.some(Qx(t,u))}).getOr(0),m=l.bind(function(t){return et.some(Qx(t,u))}).getOr(f),g={min:lx(a),max:gx(a),range:yx(a),value:c,hasMinEdge:Bx(a),hasMaxEdge:Dx(a),minBound:Gx(u),minOffset:0,maxBound:Xx(u),maxOffset:f,centerMinEdge:d,centerMaxEdge:m},Lx(g));return Gx(n)-Gx(t)+p},iw=ow(-1),uw=ow(1),aw=et.none,cw=et.none,sw={"top-left":et.none(),top:et.none(),"top-right":et.none(),right:et.some(function(t,n){Vx(t,Fx(hx(n)))}),"bottom-right":et.none(),bottom:et.none(),"bottom-left":et.none(),left:et.some(function(t,n){Vx(t,Fx(dx(n)))})},lw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=ew(t,n,e),r=nw(o);return tw(t,r),o},setToMin:function(t,n){var e=lx(n);tw(t,nw(e))},setToMax:function(t,n){var e=gx(n);tw(t,nw(e))},findValueOfOffset:ew,getValueFromEvent:function(t){return sx(t).map(function(t){return t.left()})},findPositionOfValue:rw,setPositionFromValue:function(t,n,e,o){var r=Mx(e),i=rw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=fa(n.element())/2;Gi(n.element(),"left",i-u+"px")},onLeft:iw,onRight:uw,onUp:aw,onDown:cw,edgeActions:sw}),fw=function(t,n){jo(t,cx(),{value:n})},dw=function(t){return{y:nt(t)}},mw=function(t,n,e){var o={min:fx(n),max:px(n),range:xx(n),value:e,step:Cx(n),snap:kx(n),snapStart:Ox(n),rounded:Ex(n),hasMinEdge:Ax(n),hasMaxEdge:_x(n),minBound:Yx(t),maxBound:qx(t),screenRange:$x(t)};return zx(o)},gw=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Hx:Nx)(Mx(r).y(),fx(r),px(r),Cx(r)),fw(o,dw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},pw=function(t,n,e,o,r,i){var u,a,c,s,l,f,d,m,g,p=(a=i,c=e,s=o,l=r,f=$x(u=n),d=s.bind(function(t){return et.some(Zx(t,u))}).getOr(0),m=l.bind(function(t){return et.some(Zx(t,u))}).getOr(f),g={min:fx(a),max:px(a),range:xx(a),value:c,hasMinEdge:Ax(a),hasMaxEdge:_x(a),minBound:Yx(u),minOffset:0,maxBound:qx(u),maxOffset:f,centerMinEdge:d,centerMaxEdge:m},Lx(g));return Yx(n)-Yx(t)+p},hw=et.none,vw=et.none,bw=gw(-1),yw=gw(1),xw={"top-left":et.none(),top:et.some(function(t,n){Vx(t,Ix(mx(n)))}),"top-right":et.none(),right:et.none(),"bottom-right":et.none(),bottom:et.some(function(t,n){Vx(t,Ix(vx(n)))}),"bottom-left":et.none(),left:et.none()},ww=/* */Object.freeze({setValueFrom:function(t,n,e){var o=mw(t,n,e),r=dw(o);return fw(t,r),o},setToMin:function(t,n){var e=fx(n);fw(t,dw(e))},setToMax:function(t,n){var e=px(n);fw(t,dw(e))},findValueOfOffset:mw,getValueFromEvent:function(t){return sx(t).map(function(t){return t.top()})},findPositionOfValue:pw,setPositionFromValue:function(t,n,e,o){var r=Mx(e),i=pw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=ca(n.element())/2;Gi(n.element(),"top",i-u+"px")},onLeft:hw,onRight:vw,onUp:bw,onDown:yw,edgeActions:xw}),Sw=function(t,n){jo(t,cx(),{value:n})},Cw=function(t,n){return{x:nt(t),y:nt(n)}},kw=function(s,l){return function(t,n){return(e=s,o=l,r=t,i=n,u=0<e?Hx:Nx,a=o?Mx(i).x():u(Mx(i).x(),lx(i),gx(i),Cx(i)),c=o?u(Mx(i).y(),fx(i),px(i),Cx(i)):Mx(i).y(),Sw(r,Cw(a,c)),et.some(a)).map(function(){return!0});var e,o,r,i,u,a,c}},Ow=kw(-1,!1),Ew=kw(1,!1),Tw=kw(-1,!0),Bw=kw(1,!0),Dw={"top-left":et.some(function(t,n){Vx(t,Rx(dx(n),mx(n)))}),top:et.some(function(t,n){Vx(t,Rx(wx(n),mx(n)))}),"top-right":et.some(function(t,n){Vx(t,Rx(hx(n),mx(n)))}),right:et.some(function(t,n){Vx(t,Rx(hx(n),Sx(n)))}),"bottom-right":et.some(function(t,n){Vx(t,Rx(hx(n),vx(n)))}),bottom:et.some(function(t,n){Vx(t,Rx(wx(n),vx(n)))}),"bottom-left":et.some(function(t,n){Vx(t,Rx(dx(n),vx(n)))}),left:et.some(function(t,n){Vx(t,Rx(dx(n),Sx(n)))})},Aw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=ew(t,n,e.left()),r=mw(t,n,e.top()),i=Cw(o,r);return Sw(t,i),i},setToMin:function(t,n){var e=lx(n),o=fx(n);Sw(t,Cw(e,o))},setToMax:function(t,n){var e=gx(n),o=px(n);Sw(t,Cw(e,o))},getValueFromEvent:function(t){return sx(t)},setPositionFromValue:function(t,n,e,o){var r=Mx(e),i=rw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=pw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=fa(n.element())/2,c=ca(n.element())/2;Gi(n.element(),"left",i-a+"px"),Gi(n.element(),"top",u-c+"px")},onLeft:Ow,onRight:Ew,onUp:Tw,onDown:Bw,edgeActions:Dw}),_w=ze.detect().deviceType.isTouch(),Mw=[te("stepSize",1),te("onChange",tt),te("onChoose",tt),te("onInit",tt),te("onDragStart",tt),te("onDragEnd",tt),te("snapToGrid",!1),te("rounded",!0),qn("snapStart"),Ln("model",Mn("mode",{x:[te("minX",0),te("maxX",100),ce("value",function(t){return se(t.mode.minX)}),zn("getInitialValue"),Nu("manager",lw)],y:[te("minY",0),te("maxY",100),ce("value",function(t){return se(t.mode.minY)}),zn("getInitialValue"),Nu("manager",ww)],xy:[te("minX",0),te("maxX",100),te("minY",0),te("maxY",100),ce("value",function(t){return se({x:nt(t.mode.minX),y:nt(t.mode.minY)})}),zn("getInitialValue"),Nu("manager",Aw)]})),ol("sliderBehaviours",[vm,Rm])].concat(_w?[]:[ce("mouseIsDown",function(){return se(!1)})]),Fw=ze.detect().deviceType.isTouch(),Iw=sf({name:"Slider",configFields:Mw,partFields:ux,factory:function(i,t,n,e){var u=function(t){return Xl(t,i,"thumb")},a=function(t){return Xl(t,i,"spectrum")},o=function(t){return Gl(t,i,"left-edge")},r=function(t){return Gl(t,i,"right-edge")},c=function(t){return Gl(t,i,"top-edge")},s=function(t){return Gl(t,i,"bottom-edge")},l=i.model,f=l.manager,d=function(t,n){f.setPositionFromValue(t,n,i,{getLeftEdge:o,getRightEdge:r,getTopEdge:c,getBottomEdge:s,getSpectrum:a})},m=function(t,n){l.value.set(n);var e=u(t);return d(t,e),i.onChange(t,e,n),et.some(!0)},g=[gr(Ze(),function(t,n){i.onDragStart(t,u(t))}),gr(no(),function(t,n){i.onDragEnd(t,u(t))})],p=[gr(eo(),function(t,n){n.stop(),i.onDragStart(t,u(t)),i.mouseIsDown.set(!0)}),gr(io(),function(t,n){i.onDragEnd(t,u(t))})],h=Fw?g:p;return{uid:i.uid,dom:i.dom,components:t,behaviours:il(i.sliderBehaviours,q([Fw?[]:[vm.config({mode:"special",focusIn:function(t){return Gl(t,i,"spectrum").map(vm.focusIn).map(nt(!0))}})],[Rm.config({store:{mode:"manual",getValue:function(t){return l.value.get()}}}),Zu.config({channels:{"mouse.released":{onReceive:function(e,t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&Gl(e,i,"thumb").each(function(t){var n=l.value.get();i.onChoose(e,t,n)})}}}})]])),events:fr([gr(cx(),function(t,n){m(t,n.event().value())}),Sr(function(t,n){var e=l.getInitialValue();l.value.set(e);var o=u(t);d(t,o);var r=a(t);i.onInit(t,o,r,l.value.get())})].concat(h)),apis:{resetToMin:function(t){f.setToMin(t,i)},resetToMax:function(t){f.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)}}}),Rw=function(t,n){var e=Iw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Iw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return Iw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:nt({y:nt(0)})},components:[e,o],sliderBehaviours:Gu([Lm.config({})]),onChange:function(t,n,e){jo(t,qy(),{value:e})}})},Vw=[ol("formBehaviours",[Rm])],Nw=function(t){return"<alloy.field."+t+">"},Hw=function(o,t,n){return{uid:o.uid,dom:o.dom,components:t,behaviours:il(o.formBehaviours,[Rm.config({store:{mode:"manual",getValue:function(t){var n=ql(t,o);return st(n,function(t,n){return t().bind(function(t){var n,e=mf.getCurrent(t);return n="missing current",e.fold(function(){return R.error(n)},R.value)}).map(Rm.getValue)})},setValue:function(e,t){ct(t,function(n,t){Gl(e,o,t).each(function(t){mf.getCurrent(t).each(function(t){Rm.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return Gl(t,o,n).bind(mf.getCurrent)}}}},Pw={getField:yi(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),zl("form",Nw(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=P(r,function(t){return _l({name:t,pname:Nw(t)})});return nf("form",Vw,i,Hw,o)}},zw=ri("valid-input"),Lw=ri("invalid-input"),jw=ri("validating-input"),Uw="colorcustom.rgb.",Ww=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(Uw+"range"),c=[Fb.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),Fb.parts().field({data:r,factory:ky,inputAttributes:I({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:Gu([(i=n,u=t,Iy.config({invalidClass:m("invalid"),notify:{onValidate:function(t){jo(t,jw,{type:i})},onValid:function(t){jo(t,zw,{type:i,value:Rm.getValue(t)})},onInvalid:function(t){jo(t,Lw,{type:i,value:Rm.getValue(t)})}},validator:{validate:function(t){var n=Rm.getValue(t),e=u(n)?R.value(!0):R.error(d("aria.input.invalid"));return Gb.pure(e)},validateOnLoad:!1}})),Ny.config({})]),onSetValue:function(t){Iy.isInvalid(t)&&Iy.run(t).get(tt)}})],s="hex"!==n?[Fb.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();Rm.setValue(t,{red:e,green:o,blue:r})},b=Cg({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){Gi(t.element(),"background-color","#"+n.value())})};return cf({factory:function(){var e={red:nt(se(et.some(255))),green:nt(se(et.some(255))),blue:nt(se(et.some(255))),hex:nt(se(et.some("ffffff")))},o=function(t){return e[t]().get()},i=function(t,n){e[t]().set(n)},r=function(t){var n=t.red(),e=t.green(),o=t.blue();i("red",et.some(n)),i("green",et.some(e)),i("blue",et.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),et.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,et.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return Dh(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=Ch(t),Pw.getField(n,"hex").each(function(t){Lm.isFocused(t)||Rm.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=vh(n);i("hex",et.some(n));var o=Mh(e);v(t,o),r(o),jo(t,Yy(),{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(Uw+t+".label"),description:d(Uw+t+".description")}},c=t("red"),s=t("green"),l=t("blue"),f=t("hex");return bt(Pw.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",Fb.sketch(h(Ah,"red",c.label,c.description,255))),t.field("green",Fb.sketch(h(Ah,"green",s.label,s.description,255))),t.field("blue",Fb.sketch(h(Ah,"blue",l.label,l.description,255))),t.field("hex",Fb.sketch(h(xh,"hex",f.label,f.description,"ffffff"))),b.asSpec()],formBehaviours:Gu([Iy.config({invalidClass:m("form-invalid")}),Vm("rgb-form-events",[gr(zw,a),gr(Lw,n),gr(jw,n)])])}}),{apis:{updateHex:function(t,n){var e,o;Rm.setValue(t,{hex:n.value()}),e=t,o=Mh(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},Gw=function(t,o){var r=Iw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=Iw.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 cf({factory:function(t){var n=nt({x:nt(0),y:nt(0)}),e=Gu([mf.config({find:et.some}),Lm.config({})]);return Iw.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){jo(t,Ky(),{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),Ih(Rh()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,Ih(o))}},extraApis:{}})},Xw=function(c,s){return cf({name:"ColourPicker",configFields:[zn("dom"),te("onValidHex",tt),te("onInvalidHex",tt)],factory:function(t){var a,v,e=Ww(c,s,t.onValidHex,t.onInvalidHex),o=Gw(c,s),b={paletteRgba:nt(se(Rh()))},n=Cg(o.sketch({})),r=Cg(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=Mh(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){z(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),Rw(c,s),r.asSpec()],behaviours:Gu([Vm("colour-picker-events",[gr(Ky(),(v=[u],function(t,n){var e,o,r,i,u,a,c,s,l,f=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)),l=Math.max(u,Math.max(a,c)),s===l?Xy(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)/(l-s)),o=(l-s)/l,i=l,Xy(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=Xy(m.hue(),f.x(),100-f.y()),p=_h(g),h=Ch(p);y(t,h,v)})),gr(qy(),(a=[i,u],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=Xy((100-e)/100*360,100,100),r=_h(o),Ch(r));y(t,u,a)}))]),mf.config({find:function(t){return r.getOpt(t)}}),vm.config({mode:"acyclic"})])}}})},Yw=function(){return mf.config({find:et.some})},qw=function(t){return mf.config({find:t.getOpt})},Kw=function(t){return mf.config({find:function(n){return Rr(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},$w={"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"},Jw=function(t){return $w[t]},Qw=pn([te("preprocess",d),te("postprocess",d)]),Zw=function(t,n,e){return Rm.config(bt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},tS=function(t,n,e){return Zw(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},nS=function(r,t){var i=An("RepresentingConfigs.memento processors",Qw,t);return Rm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=Rm.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);Rm.setValue(o,e)}}})},eS=Zw,oS=function(t){return tS(t,Wr,Gr)},rS=function(t){return Rm.config({store:{mode:"memory",initialValue:t}})},iS=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){z(t,function(t){t(n,e)})}},i=function(t,n){if(!Zp.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;Rm.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),L(it(e),function(t){return o.test(t.name)}))),jo(t,Sb,{name:r.name})},c=Cg({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:Gu([Vm("input-file-events",[yr(Oo())])])}),t=r.label.map(function(t){return vy(t,n)}),s=Fb.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Gu([rS([]),Yw(),Zp.config({}),Zm.config({toggleClass:"dragenter",toggleOnExecute:!1}),Vm("dropzone-events",[gr("dragenter",o([e,Zm.toggle])),gr("dragleave",o([e,Zm.toggle])),gr("dragover",e),gr("drop",o([e,i])),gr(mo(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},Sg.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:Gu([Ny.config({})])})]}]}}}});return my(t,s,["tox-form__group--stretched"],[])},uS=ri("alloy-fake-before-tabstop"),aS=ri("alloy-fake-after-tabstop"),cS=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:Gu([Lm.config({ignore:!0}),Ny.config({})])}},sS=function(t,n){jo(t,so(),{raw:{which:9,shiftKey:n}})},lS=function(t){return Uv(t,["."+uS,"."+aS].join(","),nt(!1))},fS=function(t,n){var e=n.element();Pi(e,uS)?sS(t,!0):Pi(e,aS)&&sS(t,!1)},dS=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[cS([uS]),t,cS([aS])],behaviours:Gu([Kw(1)])}},mS=!(ze.detect().browser.isIE()||ze.detect().browser.isEdge()),gS=function(t,n){var o,r,e=mS&&t.sandboxed,i=I({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=se(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Yr(t.element(),"srcdoc",n);else{Yr(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 vy(t,n)}),c=Fb.parts().field({factory:{sketch:function(t){return dS({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:Gu([Ny.config({}),Lm.config({}),eS(et.none(),u.getValue,u.setValue)])})}}});return my(a,c,["tox-form__group--stretched"],[])};function pS(t,n){return bS(F.document.createElement("canvas"),t,n)}function hS(t){var n=pS(t.width,t.height);return vS(n).drawImage(t,0,0),n}function vS(t){return t.getContext("2d")}function bS(t,n,e){return t.width=n,t.height=e,t}var yS={atob:function(t){return on.getOrDie("atob")(t)},requestAnimationFrame:function(t){on.getOrDie("requestAnimationFrame")(t)}};function xS(t){return t.naturalWidth||t.width}function wS(t){return t.naturalHeight||t.height}var SS=window.Promise?window.Promise:function(){var i=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],l(t,o(r,this),o(a,this))},t=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){F.setTimeout(t,1)};function o(t,n){return function(){return t.apply(n,arguments)}}var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function u(o){var r=this;null!==this._state?t(function(){var t=r._state?o.onFulfilled:o.onRejected;if(null!==t){var n;try{n=t(r._value)}catch(e){return void o.reject(e)}o.resolve(n)}else(r._state?o.resolve:o.reject)(r._value)}):this._deferreds.push(o)}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void l(o(n,t),o(r,this),o(a,this))}this._state=!0,this._value=t,c.call(this)}catch(e){a.call(this,e)}}function a(t){this._state=!1,this._value=t,c.call(this)}function c(){for(var t=0,n=this._deferreds;t<n.length;t++){var e=n[t];u.call(this,e)}this._deferreds=[]}function s(t,n,e,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.resolve=e,this.reject=o}function l(t,n,e){var o=!1;try{t(function(t){o||(o=!0,n(t))},function(t){o||(o=!0,e(t))})}catch(r){if(o)return;o=!0,e(r)}}return i.prototype["catch"]=function(t){return this.then(null,t)},i.prototype.then=function(e,o){var r=this;return new i(function(t,n){u.call(r,new s(e,o,t,n))})},i.all=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var c=Array.prototype.slice.call(1===t.length&&e(t[0])?t[0]:t);return new i(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(n,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void e.call(t,function(t){a(n,t)},i)}c[n]=t,0==--u&&r(c)}catch(o){i(o)}}for(var t=0;t<c.length;t++)a(t,c[t])})},i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(t){t(n)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(r){return new i(function(t,n){for(var e=0,o=r;e<o.length;e++)o[e].then(t,n)})},i}();function CS(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return et.none();for(var o,r=e[1],i=n[1],u=yS.atob(i),a=u.length,c=Math.ceil(a/1024),s=new Array(c),l=0;l<c;++l){for(var f=1024*l,d=Math.min(f+1024,a),m=new Array(d-f),g=f,p=0;g<d;++p,++g)m[p]=u[g].charCodeAt(0);s[l]=(o=m,new(on.getOrDie("Uint8Array"))(o))}return et.some(function h(t,n){return new(on.getOrDie("Blob"))(t,n)}(s,{type:r}))}function kS(t,o,r){return o=o||"image/png",F.HTMLCanvasElement.prototype.toBlob?new SS(function(n,e){t.toBlob(function(t){t?n(t):e()},o,r)}):function n(e){return new SS(function(t,n){CS(e).fold(function(){n("uri is not base64: "+e)},t)})}(t.toDataURL(o,r))}function OS(t){return function n(a){return new SS(function(t,n){var e=F.URL.createObjectURL(a),o=new F.Image,r=function(){o.removeEventListener("load",i),o.removeEventListener("error",u)};function i(){r(),t(o)}function u(){r(),n("Unable to load data of type "+a.type+": "+e)}o.addEventListener("load",i),o.addEventListener("error",u),o.src=e,o.complete&&i()})}(t).then(function(t){!function e(t){F.URL.revokeObjectURL(t.src)}(t);var n=pS(xS(t),wS(t));return vS(n).drawImage(t,0,0),n})}function ES(o){return new SS(function(t){var n=function e(){return new(on.getOrDie("FileReader"))}();n.onloadend=function(){t(n.result)},n.readAsDataURL(o)})}function TS(t,n,e){var o=n.type;function r(n,e){return t.then(function(t){return function o(t,n,e){return n=n||"image/png",t.toDataURL(n,e)}(t,n,e)})}return{getType:nt(o),toBlob:function i(){return SS.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 kS(t,n,e)})},toAdjustedDataURL:r,toAdjustedBase64:function s(t,n){return r(t,n).then(function(t){return t.split(",")[1]})},toCanvas:function l(){return t.then(hS)}}}function BS(n,t){return kS(n,t).then(function(t){return TS(SS.resolve(n),t,n.toDataURL())})}var DS=function(t){return function e(n){return ES(n).then(function(t){return TS(OS(n),n,t)})}(t)};function AS(t,n,e){var o="string"==typeof t?parseFloat(t):t;return e<o?o=e:o<n&&(o=n),o}var _S=[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){for(var e,o=[],r=new Array(25),i=0;i<5;i++){for(var u=0;u<5;u++)o[u]=n[u+5*i];for(u=0;u<5;u++){for(var a=e=0;a<5;a++)e+=t[u+5*a]*o[a];r[u+5*i]=e}}return r}function FS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=vS(t);var r=function B(t,n){for(var e,o,r,i,u=t.data,a=n[0],c=n[1],s=n[2],l=n[3],f=n[4],d=n[5],m=n[6],g=n[7],p=n[8],h=n[9],v=n[10],b=n[11],y=n[12],x=n[13],w=n[14],S=n[15],C=n[16],k=n[17],O=n[18],E=n[19],T=0;T<u.length;T+=4)e=u[T],o=u[T+1],r=u[T+2],i=u[T+3],u[T]=e*a+o*c+r*s+i*l+f,u[T+1]=e*d+o*m+r*g+i*p+h,u[T+2]=e*v+o*b+r*y+i*x+w,u[T+3]=e*S+o*C+r*k+i*O+E;return t}(o.getImageData(0,0,t.width,t.height),e);return o.putImageData(r,0,0),BS(t,n)}(t,n.getType(),e)})}function IS(n,e){return n.toCanvas().then(function(t){return function u(t,n,e){var o=vS(t);var r=o.getImageData(0,0,t.width,t.height),i=o.getImageData(0,0,t.width,t.height);return i=function S(t,n,e){function o(t,n,e){return e<t?t=e:t<n&&(t=n),t}for(var r=Math.round(Math.sqrt(e.length)),i=Math.floor(r/2),u=t.data,a=n.data,c=t.width,s=t.height,l=0;l<s;l++)for(var f=0;f<c;f++){for(var d=0,m=0,g=0,p=0;p<r;p++)for(var h=0;h<r;h++){var v=o(f+h-i,0,c-1),b=o(l+p-i,0,s-1),y=4*(b*c+v),x=e[p*r+h];d+=u[y]*x,m+=u[y+1]*x,g+=u[y+2]*x}var w=4*(l*c+f);a[w]=o(d,0,255),a[w+1]=o(m,0,255),a[w+2]=o(g,0,255)}return n}(r,i,e),o.putImageData(i,0,0),BS(t,n)}(t,n.getType(),e)})}function RS(e){return function(t,n){return FS(t,e([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n))}}var VS=function G_(n){return function(t){return FS(t,n)}}([-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0,0,0,0,0,1]),NS=RS(function X_(t,n){return MS(t,[1,0,0,0,n=AS(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])}),HS=RS(function Y_(t,n){var e;return n=AS(n,-1,1),MS(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0==(e=n%1)?_S[n]:_S[Math.floor(n)]*(1-e)+_S[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])}),PS=function(t,n,e,o){return FS(t,function r(t,n,e,o){return MS(t,[n=AS(n,0,2),0,0,0,0,0,e=AS(e,0,2),0,0,0,0,0,o=AS(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])}([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n,e,o))},zS=function q_(n){return function(t){return IS(t,n)}}([0,-1,0,-1,5,-1,0,-1,0]),LS=function K_(c){return function(n,e){return n.toCanvas().then(function(t){return function(t,n,e){for(var o=vS(t),r=new Array(256),i=0;i<r.length;i++)r[i]=c(i,e);var u=function a(t,n){for(var e=t.data,o=0;o<e.length;o+=4)e[o]=n[e[o]],e[o+1]=n[e[o+1]],e[o+2]=n[e[o+2]];return t}(o.getImageData(0,0,t.width,t.height),r);return o.putImageData(u,0,0),BS(t,n)}(t,n.getType(),e)})}}(function(t,n){return 255*Math.pow(t/255,1-n)});function jS(t,n,e){var o=xS(t),r=wS(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 l(a,c,s){return new SS(function(t){var n=xS(a),e=wS(a),o=Math.floor(n*c),r=Math.floor(e*s),i=pS(o,r),u=vS(i);u.drawImage(a,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return jS(t,n,e)}):c}function US(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=pS(t.width,t.height),r=vS(o),i=0,u=0;90!==(e=e<0?360+e:e)&&270!==e||bS(o,o.height,o.width);90!==e&&180!==e||(i=o.width);270!==e&&180!==e||(u=o.height);return r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),BS(o,n)}(t,n.getType(),e)})}function WS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=pS(t.width,t.height),r=vS(o);"v"===e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0));return BS(o,n)}(t,n.getType(),e)})}function GS(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=pS(r,i);return vS(u).drawImage(t,-e,-o),BS(u,n)}(t,n.getType(),e,o,r,i)})}var XS=function(t){return VS(t)},YS=function(t){return zS(t)},qS=function(t,n){return LS(t,n)},KS=function(t,n){return NS(t,n)},$S=function(t,n){return HS(t,n)},JS=function(t,n){return WS(t,n)},QS=function(t,n,e){return function r(n,e,o){return n.toCanvas().then(function(t){return jS(t,e,o).then(function(t){return BS(t,n.getType())})})}(t,n,e)},ZS=function(t,n){return US(t,n)},tC=function(t,n){return I({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},nC=function(t,n){return tC(Og(t,n),{})},eC=function(t,n){return tC(Og(t,n),{behaviours:Gu([Sm.config({})])})},oC=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:Gu([Sm.config({})])}},rC=ri("toolbar.button.execute"),iC={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},uC=ri("update-menu-text"),aC=ri("update-menu-icon"),cC=function(t,n,o){var e=se(tt),r=t.text.map(function(t){return Cg(oC(t,n,o.providers))}),i=t.icon.map(function(t){return Cg(eC(t,o.providers.icons))}),u=function(t,n){var e=Rm.getValue(t);return Lm.focus(e),jo(e,"keydown",{raw:n.event().raw()}),zy.close(e),et.some(!0)},a=t.role.fold(function(){return{}},function(t){return{role:t}}),c=t.tooltip.fold(function(){return{}},function(t){var n=o.providers.translate(t);return{title:n,"aria-label":n}});return Cg(zy.sketch(I({},a,{dom:{tag:"button",classes:[n,n+"--select"].concat(P(t.classes,function(t){return n+"--"+t})),attributes:I({},c)},components:ch([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),et.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:Og("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:Gu(t.dropdownBehaviours.concat([nh(t.disabled),Ly.config({}),Sm.config({}),Vm("dropdown-events",[rh(t,e),ih(t,e)]),Vm("menubutton-update-display-text",[gr(uC,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){Sm.set(t,[au(o.providers.translate(e.event().text()))])})}),gr(aC,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){Sm.set(t,[eC(e.event().icon(),o.providers.icons)])})})])])),eventOrder:bt(iC,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:Gu([vm.config({mode:"special",onLeft:u,onRight:u})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:gv(0,t.columns,t.presets)},fetch:function(){return Gb.nu(t.fetch)}}))).asSpec()},sC=function(e){return{isDisabled:function(){return Zp.isDisabled(e)},setDisabled:function(t){return Zp.set(e,t)},setActive:function(t){var n=e.element();t?(Vi(n,"tox-tbtn--enabled"),Yr(n,"aria-pressed",!0)):(Hi(n,"tox-tbtn--enabled"),Jr(n,"aria-pressed"))},isActive:function(){return Pi(e.element(),"tox-tbtn--enabled")}}},lC=function(t,n,e,o){return cC({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(Cy(t,uh.CLOSE_ON_EXECUTE,e))})},onSetup:t.onSetup,getApi:sC,columns:1,presets:"normal",classes:[],dropdownBehaviours:[]},n,e.shared)},fC=function(t,n,e,o,r){void 0===e&&(e=[]);var i=n.fold(function(){return{}},function(t){return{action:t}}),u=I({buttonBehaviours:Gu([nh(t.disabled),Ny.config({}),Vm("button press",[mr("click"),mr("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=bt(u,{dom:o});return bt(a,{components:r})},dC=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 nC(t,e.icons)}),u=ch([i]);return fC(t,n,o,r,u)},mC=function(t,n,e,o){void 0===o&&(o=[]);var r=dC(t,et.some(n),e,o);return Sg.sketch(r)},gC=function(t,n,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=e.translate(t.text),u=t.icon?t.icon.map(function(t){return nC(t,e.icons)}):et.none(),a=u.isSome()?ch([u]):[],c=u.isSome()?{}:{innerHtml:i},s=(t.primary||t.borderless?["tox-button"]:["tox-button","tox-button--secondary"]).concat(u.isSome()?["tox-button--icon"]:[],t.borderless?["tox-button--naked"]:[],r),l=I({tag:"button",classes:s},c,{attributes:{title:i}});return fC(t,n,o,l,a)},pC=function(t,n,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=gC(t,et.some(n),e,o,r);return Sg.sketch(i)},hC=function(n,e){return function(t){"custom"===e?jo(t,Ob,{name:n,value:{}}):"submit"===e?Lo(t,Eb):"cancel"===e?Lo(t,kb):F.console.error("Unknown button type: ",e)}},vC=function(t,n,e){if("menu"===n)return lC(t,"tox-tbtn",e,et.none());if("custom"===(i=n)||"cancel"===i||"submit"===i){var o=hC(t.name,n),r=I({},t,{borderless:!1});return pC(r,o,e.shared.providers,[])}var i;F.console.error("Unknown footer button type: ",n)},bC=nt([te("field1Name","field1"),te("field2Name","field2"),Ru("onLockedChange"),_u(["lockClass"]),te("locked",!1),ul("coupledFieldBehaviours",[mf,Rm])]),yC=function(t,i){return _l({factory:Fb,name:t,overrides:function(r){return{fieldBehaviours:Gu([Vm("coupled-input-behaviour",[gr(fo(),function(e){var t,n,o;(t=e,n=r,o=i,Gl(t,n,o).bind(mf.getCurrent)).each(function(n){Gl(e,r,"lock").each(function(t){Zm.isOn(t)&&r.onLockedChange(e,n,t)})})})])])}}})},xC=nt([yC("field1","field2"),yC("field2","field1"),_l({factory:Sg,schema:[zn("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:Gu([Zm.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),wC=sf({name:"FormCoupledInputs",configFields:bC(),partFields:xC(),factory:function(o,t,n,e){return{uid:o.uid,dom:o.dom,components:t,behaviours:al(o.coupledFieldBehaviours,[mf.config({find:et.some}),Rm.config({store:{mode:"manual",getValue:function(t){var n,e=$l(t,o,["field1","field2"]);return(n={})[o.field1Name]=Rm.getValue(e.field1()),n[o.field2Name]=Rm.getValue(e.field2()),n},setValue:function(t,n){var e=$l(t,o,["field1","field2"]);Nt(n,o.field1Name)&&Rm.setValue(e.field1(),n[o.field1Name]),Nt(n,o.field2Name)&&Rm.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return Gl(t,o,"field1")},getField2:function(t){return Gl(t,o,"field2")},getLock:function(t){return Gl(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)}}}),SC=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 R.error(t);var e=parseFloat(n[1]),o=n[2];return R.value({value:e,unit:o})},CC=function(t,n){var e={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,"in":1},o=function(t){return Object.prototype.hasOwnProperty.call(e,t)};return t.unit===n?et.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?et.some(t.value):et.some(t.value/e[t.unit]*e[n]):et.none()},kC=function(t){return et.none()},OC=function(t,n){return function(t,n){for(var e=[],o=0;o<t.length;o++){var r=t[o];if(!r.isSome())return et.none();e.push(r.getOrDie())}return et.some(n.apply(null,e))}([SC(t).toOption(),SC(n).toOption()],function(t,o){return CC(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return CC(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr(kC)}).getOr(kC)},EC=function(o,n){var a=kC,r=ri("ratio-event"),t=wC.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:Og("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:Og("unlock",n.icons)}}],buttonBehaviours:Gu([nh(o.disabled),Ny.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(e){return Fb.parts().field({factory:ky,inputClasses:["tox-textfield"],inputBehaviours:Gu([Zp.config({disabled:o.disabled}),Ny.config({}),Vm("size-input-events",[gr(ao(),function(t,n){jo(t,r,{isField1:e})}),gr(mo(),function(t,n){jo(t,Sb,{name:o.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=wC.parts().field1(e([Fb.parts().label(u("Width")),i(!0)])),s=wC.parts().field2(e([Fb.parts().label(u("Height")),i(!1)]));return wC.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){SC(Rm.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;Rm.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:Gu([Zp.config({disabled:o.disabled,onDisabled:function(t){wC.getField1(t).bind(Fb.getField).each(Zp.disable),wC.getField2(t).bind(Fb.getField).each(Zp.disable),wC.getLock(t).each(Zp.disable)},onEnabled:function(t){wC.getField1(t).bind(Fb.getField).each(Zp.enable),wC.getField2(t).bind(Fb.getField).each(Zp.enable),wC.getLock(t).each(Zp.enable)}}),Vm("size-input-events2",[gr(r,function(t,n){var e=n.event().isField1(),o=e?wC.getField1(t):wC.getField2(t),r=e?wC.getField2(t):wC.getField1(t),i=o.map(Rm.getValue).getOr(""),u=r.map(Rm.getValue).getOr("");a=OC(i,u)})])])})},TC={undo:nt(ri("undo")),redo:nt(ri("redo")),zoom:nt(ri("zoom")),back:nt(ri("back")),apply:nt(ri("apply")),swap:nt(ri("swap")),transform:nt(ri("transform")),tempTransform:nt(ri("temp-transform")),transformApply:nt(ri("transform-apply"))},BC=nt("save-state"),DC=nt("disable"),AC=nt("enable"),_C={formActionEvent:Ob,saveState:BC,disable:DC,enable:AC},MC=function(a,c){var t=function(t,n,e,o){return Cg(pC({name:t,text:t,disabled:e,primary:o,icon:et.none(),borderless:!1},n,c))},n=function(t,n,e,o){return Cg(mC({name:t,icon:et.some(t),tooltip:et.some(n),disabled:o,primary:!1,borderless:!1},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Zp)&&Zp.disable(n)})},s=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Zp)&&Zp.enable(n)})},l={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=et.none(),o=tt,r=function(t,n,e){jo(t,n,e)},i=function(t){return Lo(t,_C.disable())},f=function(t){return Lo(t,_C.enable())},d=function(t,n){i(t),r(t,TC.transform(),{transform:n}),f(t)},m=function(t){return function(){Z.getOpt(t).each(function(t){Sm.set(t,[J])})}},g=function(t,n){i(t),r(t,TC.transformApply(),{transform:n,swap:m(t)}),f(t)},p=function(){return t("Back",function(t){return r(t,TC.back(),{swap:m(t)})},!1,!1)},h=function(){return Cg({dom:{tag:"div",classes:["tox-spacer"]},behaviours:Gu([Zp.config({})])})},v=function(){return t("Apply",function(t){return r(t,TC.apply(),{swap:m(t)})},!0,!0)},b=function(){return function(t){var n,e,o,r,i,u=a.getRect();return n=t,e=u.x,o=u.y,r=u.w,i=u.h,GS(n,e,o,r,i)}},y=[p(),h(),t("Apply",function(t){var n=b();g(t,n),a.hideCrop()},!1,!0)],x=cb.sketch({dom:l,components:y.map(function(t){return t.asSpec()}),containerBehaviours:Gu([Vm("image-tools-crop-buttons-events",[gr(_C.disable(),function(t,n){u(y,t)}),gr(_C.enable(),function(t,n){s(y,t)})])])}),w=Cg(EC({name:"size",label:e,constrain:!0,disabled:!1},c)),S=[p(),h(),w,h(),t("Apply",function(a){w.getOpt(a).each(function(t){var n,e,o=Rm.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return QS(t,n,e)});g(a,u)})},!1,!0)],C=cb.sketch({dom:l,components:S.map(function(t){return t.asSpec()}),containerBehaviours:Gu([Vm("image-tools-resize-buttons-events",[gr(_C.disable(),function(t,n){u(S,t)}),gr(_C.enable(),function(t,n){s(S,t)})])])}),k=function(n,e){return function(t){return n(t,e)}},O=k(JS,"h"),E=k(JS,"v"),T=k(ZS,-90),B=k(ZS,90),D=function(t,n){var e,o;o=n,i(e=t),r(e,TC.tempTransform(),{transform:o}),f(e)},A=[p(),h(),n("flip-horizontally","Flip horizontally",function(t){D(t,O)},!1),n("flip-vertically","Flip vertically",function(t){D(t,E)},!1),n("rotate-left","Rotate counterclockwise",function(t){D(t,T)},!1),n("rotate-right","Rotate clockwise",function(t){D(t,B)},!1),h(),v()],_=cb.sketch({dom:l,components:A.map(function(t){return t.asSpec()}),containerBehaviours:Gu([Vm("image-tools-fliprotate-buttons-events",[gr(_C.disable(),function(t,n){u(A,t)}),gr(_C.enable(),function(t,n){s(A,t)})])])}),M=function(t,n,e,o,r){var i=Iw.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=Iw.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=Iw.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Cg(Iw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:nt({x:nt(o)})},components:[i,u,a],sliderBehaviours:Gu([Lm.config({})]),onChoose:n}))},F=function(t,n,e,o,r){return[p(),(i=t,u=n,a=e,c=o,s=r,M(i,function(t,n,e){var o=k(u,e.x()/100);d(t,o)},a,c,s)),v()];var i,u,a,c,s},I=function(t,n,e,o,r){var i=F(t,n,e,o,r);return cb.sketch({dom:l,components:i.map(function(t){return t.asSpec()}),containerBehaviours:Gu([Vm("image-tools-filter-panel-buttons-events",[gr(_C.disable(),function(t,n){u(i,t)}),gr(_C.enable(),function(t,n){s(i,t)})])])})},R=[p(),h(),v()],V=cb.sketch({dom:l,components:R.map(function(t){return t.asSpec()})}),N=I("Brightness",KS,-100,0,100),H=I("Contrast",$S,-100,0,100),P=I("Gamma",qS,-100,0,100),z=function(n,e,o){return function(t){return PS(t,n,e,o)}},L=function(t){return M(t,function(a,t,n){var e=j.getOpt(a),o=W.getOpt(a),r=U.getOpt(a);e.each(function(u){o.each(function(i){r.each(function(t){var n=Rm.getValue(u).x()/100,e=Rm.getValue(t).x()/100,o=Rm.getValue(i).x()/100,r=z(n,e,o);d(a,r)})})})},0,100,200)},j=L("R"),U=L("G"),W=L("B"),G=[p(),j,U,W,v()],X=cb.sketch({dom:l,components:G.map(function(t){return t.asSpec()})}),Y=function(n,e,o){return function(t){r(t,TC.swap(),{transform:e,swap:function(){Z.getOpt(t).each(function(t){Sm.set(t,[n]),o(t)})}})}},q=et.some(YS),K=et.some(XS),$=[n("crop","Crop",Y(x,e,function(t){a.showCrop()}),!1),n("resize","Resize",Y(C,e,function(t){w.getOpt(t).each(function(t){var n=a.getMeasurements(),e=n.width,o=n.height;Rm.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",Y(_,e,o),!1),n("brightness","Brightness",Y(N,e,o),!1),n("sharpen","Sharpen",Y(V,q,o),!1),n("contrast","Contrast",Y(H,e,o),!1),n("color-levels","Color levels",Y(X,e,o),!1),n("gamma","Gamma",Y(P,e,o),!1),n("invert","Invert",Y(V,K,o),!1)],J=cb.sketch({dom:l,components:$.map(function(t){return t.asSpec()})}),Q=cb.sketch({dom:{tag:"div"},components:[J],containerBehaviours:Gu([Sm.config({})])}),Z=Cg(Q);return{memContainer:Z,getApplyButton:function(t){return Z.getOpt(t).map(function(t){var n=t.components()[0];return n.components()[n.components().length-1]})}}},FC=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),IC=tinymce.util.Tools.resolve("tinymce.geom.Rect"),RC=tinymce.util.Tools.resolve("tinymce.util.Observable"),VC=tinymce.util.Tools.resolve("tinymce.util.Tools"),NC=tinymce.util.Tools.resolve("tinymce.util.VK");function HC(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 PC(t,r){var i,u,n,a,c,l,f,d=r.document||F.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);HC(t),t.preventDefault(),u=t.button,n=m,l=t.screenX,f=t.screenY,e=F.window.getComputedStyle?F.window.getComputedStyle(n,null).getPropertyValue("cursor"):n.runtimeStyle.cursor,i=FC("<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),FC(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(HC(t),t.button!==u)return a(t);t.deltaX=t.screenX-l,t.deltaY=t.screenY-f,t.preventDefault(),r.drag(t)},a=function(t){HC(t),FC(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){FC(m).off()},FC(m).on("mousedown touchstart",n)}var zC=0;var LC=function(n){var l=Cg({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),f=se(1),d=se(et.none()),m=se({x:0,y:0,w:1,h:1}),c=se({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=f.get(),o=fa(t.element()),r=ca(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"};Xi(s,n),l.getOpt(t).each(function(t){Xi(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=fe.fromTag("img");return Yr(a,"src",n),(e=a.dom(),new Gg(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=cu({element:a});Sm.replaceAt(t,1,et.some(n));var e=c.get(),o={x:0,y:0,w:a.dom().naturalWidth,h:a.dom().naturalHeight};c.set(o);var r,u,i=IC.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=fa(t.element()),e=ca(t.element()),o=u.dom().naturalWidth,r=u.dom().naturalHeight,i=Math.min(n/o,e/r);1<=i?f.set(1):f.set(i)})),s(t,a),a})})},t=cb.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[l.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:Gu([Vm("image-panel-crop-events",[Sr(function(t){g.getOpt(t).each(function(t){var n=function S(s,e,l,o,r){var f,u,n,i,a="tox-",c="tox-crid-"+zC++;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=IC.clamp({x:r,y:i,w:u,h:a},l,"move"===t.name),c=d(l,c),f.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),FC("#"+c+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}VC.each(u,function(t){FC("#"+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}}(l,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(){FC('<div id="'+c+'" class="'+a+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),VC.each(i,function(t){FC("#"+c,o).append('<div id="'+c+"-"+t+'"class="'+a+'croprect-block" style="display: none" data-mce-bogus="all">')}),VC.each(u,function(t){FC("#"+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=VC.map(u,function t(n){var e;return new PC(c,{document:o.ownerDocument,handle:c+"-"+n.name,start:function(){e=s},drag:function(t){m(n,e,t.deltaX,t.deltaY)}})}),g(s),FC(o).on("focusin focusout",function(t){FC(t.target).attr("aria-grabbed","focus"===t.type?"true":"false")}),FC(o).on("keydown",function(n){var i;function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),m(i,e,o,r)}switch(VC.each(u,function(t){if(n.target.id===c+"-"+t.name)return i=t,!1}),n.keyCode){case NC.LEFT:t(n,0,s,-10,0);break;case NC.RIGHT:t(n,0,s,10,0);break;case NC.UP:t(n,0,s,0,-10);break;case NC.DOWN:t(n,0,s,0,10);break;case NC.ENTER:case NC.SPACEBAR:n.preventDefault(),r()}})}(),f=VC.extend({toggleVisibility:function b(t){var n;n=VC.map(u,function(t){return"#"+c+"-"+t.name}).concat(VC.map(i,function(t){return"#"+c+"-"+t})).join(","),t?FC(n,o).show():FC(n,o).hide()},setClampRect:function y(t){l=t,g(s)},setRect:p,getInnerRect:function t(){return d(l,s)},setInnerRect:h,setViewPortRect:function x(t){e=t,g(s)},destroy:function w(){VC.each(n,function(t){t.destroy()}),n=[]}},RC)}({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=f.get(),o={x:Math.round(n.x/e),y:Math.round(n.y/e),w:Math.round(n.w/e),h:Math.round(n.h/e)};m.set(o)}),d.set(et.some(n))})})])])}],containerBehaviours:Gu([Sm.config({}),Vm("image-panel-events",[Sr(function(t){e(t,n)})])])}),g=Cg(t);return{memContainer:g,updateSrc:e,zoom:function(t,n){var e=f.get(),o=0<n?Math.min(2,e+.1):Math.max(.1,e-.1);f.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}}}},jC=function(t,n,e,o,r){return mC({name:t,icon:et.some(n),disabled:e,tooltip:et.some(t),primary:!1,borderless:!1},o,r)},UC=function(t,n){n?Zp.enable(t):Zp.disable(t)},WC=function(){return on.getOrDie("URL")},GC=function(t){return WC().createObjectURL(t)},XC=function(t){WC().revokeObjectURL(t)};var YC,qC,KC,$C,JC=function(t){var n=se(t),e=se(et.none()),r=function s(){var e=[],o=-1;function t(){return 0<o}function n(){return-1!==o&&o<e.length-1}return{data:e,add:function r(t){var n;return n=e.splice(++o),e.push(t),{state:t,removed:n}},undo:function i(){if(t())return e[--o]},redo:function u(){if(n())return e[++o]},canUndo:t,canRedo:n}}();r.add(t);var i=function(t){n.set(t)},u=function(t){return{blob:t,url:GC(t)}},a=function(t){XC(t.url)},o=function(){e.get().each(a),e.set(et.none())},c=function(t){var n=u(t);i(n);var e,o=r.add(n).removed;return e=o,VC.each(e,a),n.url};return{getBlobState:function(){return n.get()},setBlobState:i,addBlobState:c,getTempState:function(){return e.get().fold(function(){return n.get()},function(t){return t})},updateTempState:function(t){var n=u(t);return o(),e.set(et.some(n)),n.url},addTempState:function(t){var n=u(t);return e.set(et.some(n)),n.url},applyTempState:function(n){return e.get().fold(function(){},function(t){c(t.blob),n()})},destroyTempState:o,undo:function(){var t=r.undo();return i(t),t.url},redo:function(){var t=r.redo();return i(t),t.url},getHistoryStates:function(){return{undoEnabled:r.canUndo(),redoEnabled:r.canRedo()}}}},QC=function(t,n){var e,o,r,u=JC(t.currentState),i=function(t){var n=u.getHistoryStates();p.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),jo(t,_C.formActionEvent,{name:_C.saveState(),value:n.undoEnabled})},a=function(t){return t.toBlob()},c=function(t){jo(t,_C.formActionEvent,{name:_C.disable(),value:{}})},s=function(t){h.getApplyButton(t).each(function(t){Zp.enable(t)}),jo(t,_C.formActionEvent,{name:_C.enable(),value:{}})},l=function(t,n){return c(t),g.updateSrc(t,n)},f=function(n,t,e,o,r){return c(n),DS(t).then(e).then(a).then(o).then(function(t){return l(n,t).then(function(t){return i(n),r(),s(n),t})})["catch"](function(t){return F.console.log(t),s(n),t})},d=function(t,n,e){var o=u.getBlobState().blob;f(t,o,n,function(t){return u.updateTempState(t)},e)},m=function(t){var n=u.getBlobState().url;return u.destroyTempState(),i(t),n},g=LC(t.currentState.url),p=(o=Cg(jC("Undo","undo",!0,function(t){jo(t,TC.undo(),{direction:1})},e=n)),r=Cg(jC("Redo","redo",!0,function(t){jo(t,TC.redo(),{direction:1})},e)),{container:cb.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),jC("Zoom in","zoom-in",!1,function(t){jo(t,TC.zoom(),{direction:1})},e),jC("Zoom out","zoom-out",!1,function(t){jo(t,TC.zoom(),{direction:-1})},e)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){UC(t,n)}),r.getOpt(t).each(function(t){UC(t,e)})}}),h=MC(g,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[h.memContainer.asSpec(),g.memContainer.asSpec(),p.container],behaviours:Gu([Rm.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),Vm("image-tools-events",[gr(TC.undo(),function(n,t){var e=u.undo();l(n,e).then(function(t){s(n),i(n)})}),gr(TC.redo(),function(n,t){var e=u.redo();l(n,e).then(function(t){s(n),i(n)})}),gr(TC.zoom(),function(t,n){var e=n.event().direction();g.zoom(t,e)}),gr(TC.back(),function(t,n){var e,o;o=m(e=t),l(e,o).then(function(t){s(e)}),n.event().swap()(),g.hideCrop()}),gr(TC.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),gr(TC.transform(),function(t,n){return d(t,n.event().transform(),tt)}),gr(TC.tempTransform(),function(t,n){return e=t,o=n.event().transform(),r=u.getTempState().blob,void f(e,r,o,function(t){return u.addTempState(t)},tt);var e,o,r}),gr(TC.transformApply(),function(t,n){return e=t,o=n.event().transform(),r=n.event().swap(),i=u.getBlobState().blob,void f(e,i,o,function(t){var n=u.addBlobState(t);return m(e),n},r);var e,o,r,i}),gr(TC.swap(),function(n,t){var e;e=n,p.updateButtonUndoStates(e,!1,!1);var o=t.event().transform(),r=t.event().swap();o.fold(function(){r()},function(t){d(n,t,r)})})]),Yw()])}},ZC=cf({name:"HtmlSelect",configFields:[zn("options"),ol("selectBehaviours",[Lm,Rm]),te("selectClasses",[]),te("selectAttributes",{}),qn("data")],factory:function(e,t){var n=P(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),o=e.data.map(function(t){return It("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:n,behaviours:il(e.selectBehaviours,[Lm.config({}),Rm.config({store:I({mode:"manual",getValue:function(t){return Zi(t.element())},setValue:function(t,n){W(e.options,function(t){return t.value===n}).isSome()&&tu(t.element(),n)}},o)})])}}}),tk=function(e,n){var t=e.label.map(function(t){return vy(t,n)}),o=[Zp.config({disabled:e.disabled}),vm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(t){return Lo(t,Eb),et.some(!0)}}),Vm("textfield-change",[gr(fo(),function(t,n){jo(t,Sb,{name:e.name})}),gr(xo(),function(t,n){jo(t,Sb,{name:e.name})})]),Ny.config({})],r=e.validation.map(function(o){return Iy.config({getRoot:function(t){return Mr(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=Rm.getValue(t),e=o.validator(n);return Gb.pure(!0===e?R.value(n):R.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=Fb.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:e.placeholder.fold(function(){},function(t){return{placeholder:n.translate(t)}}),inputClasses:[e.classname],inputBehaviours:Gu(q([o,r])),selectOnFocus:!1,factory:ky}),u=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),a=[Zp.config({disabled:e.disabled,onDisabled:function(t){Fb.getField(t).each(Zp.disable)},onEnabled:function(t){Fb.getField(t).each(Zp.enable)}})];return my(t,i,u,a)},nk=function(i){return I({},i,{toCached:function(){return nk(i.toCached())},bindFuture:function(n){return nk(i.bind(function(t){return t.fold(function(t){return Gb.pure(R.error(t))},function(t){return n(t)})}))},bindResult:function(n){return nk(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return nk(i.map(function(t){return t.map(n)}))},mapError:function(n){return nk(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 nk(Gb.nu(function(n){var e=!1,o=F.setTimeout(function(){e=!0,n(R.error(r()))},t);i.get(function(t){e||(F.clearTimeout(o),n(t))})}))}})},ek=function(t){return nk(Gb.nu(t))},ok=ek,rk={type:"separator"},ik=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},uk=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},ak=function(t,n){return o=t,e=L(n,function(t){return t.type===o}),P(e,ik);var e,o},ck=function(t,n){var e=t.toLowerCase();return L(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return Fe(n.toLowerCase(),e)||Fe(t.value.toLowerCase(),e)})},sk=function(c,t,s){var n=Rm.getValue(t),l=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=ck(l,(n=s.getHistory(c),P(n,function(t){return uk(t,t)})));return"file"===c?(e=[a,ck(l,(u=t,ak("header",u.targets))),ck(l,q([(i=t,et.from(i.anchorTop).map(function(t){return uk("<top>",t)}).toArray()),(r=t,ak("anchor",r.targets)),(o=t,et.from(o.anchorBottom).map(function(t){return uk("<bottom>",t)}).toArray())]))],U(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat(rk,n)},[])):a})},lk=ri("aria-invalid"),fk=function(r,o,i){var t,n,e,u,a,c=o.shared.providers,s=function(t){var n=Rm.getValue(t);i.addToHistory(n.value,r.filetype)},l=Fb.parts().field({factory:dy,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":lk},minChars:0,responseTime:0,fetch:function(t){var n=sk(r.filetype,t,i),e=Cy(n,uh.BUBBLE_TO_SANDBOX,o);return Gb.pure(e)},getHotspot:function(t){return h.getOpt(t)},onSetValue:function(t,n){t.hasConfigured(Iy)&&Iy.run(t).get(tt)},typeaheadBehaviours:Gu(q([i.getValidationHandler().map(function(o){return Iy.config({getRoot:function(t){return Mr(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(t,n){d.getOpt(t).each(function(t){Yr(t.element(),"title",c.translate(n))})}},validator:{validate:function(t){var e=Rm.getValue(t);return ok(function(n){o({type:r.filetype,url:e.value},function(t){n(("invalid"===t.status?R.error:R.value)(t.message))})})},validateOnLoad:!1}})}).toArray(),[Zp.config({disabled:r.disabled}),Ny.config({}),Vm("urlinput-events",q(["file"===r.filetype?[gr(fo(),function(t){jo(t,Sb,{name:r.name})})]:[],[gr(mo(),function(t){jo(t,Sb,{name:r.name}),s(t)}),gr(xo(),function(t){jo(t,Sb,{name:r.name}),s(t)})]]))]])),eventOrder:(t={},t[fo()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:o.shared.getSink,parts:{menu:gv(0,0,"normal")},onExecute:function(t,n,e){jo(n,Eb,{})},onItemExecute:function(t,n,e,o){s(t),jo(t,Sb,{name:r.name})}}),f=r.label.map(function(t){return vy(t,c)}),d=Cg((n="invalid",e=et.some(lk),void 0===(u="warning")&&(u=n),void 0===a&&(a=n),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+n],innerHtml:Og(u,c.icons),attributes:I({title:c.translate(a),"aria-live":"polite"},e.fold(function(){return{}},function(t){return{id:t}}))}})),m=Cg({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),g=i.getUrlPicker(r.filetype),p=ri("browser.url.event"),h=Cg({dom:{tag:"div",classes:["tox-control-wrap"]},components:[l,m.asSpec()],behaviours:Gu([Zp.config({disabled:r.disabled})])}),v=Cg(pC({name:r.name,icon:et.some("browse"),text:r.label.getOr(""),disabled:r.disabled,primary:!1,borderless:!0},function(t){return Lo(t,p)},c,[],["tox-browse-url"]));return Fb.sketch({dom:hy([]),components:f.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[h.asSpec()],g.map(function(){return v.asSpec()}).toArray()])}]),fieldBehaviours:Gu([Zp.config({disabled:r.disabled,onDisabled:function(t){Fb.getField(t).each(Zp.disable),v.getOpt(t).each(Zp.disable)},onEnabled:function(t){Fb.getField(t).each(Zp.enable),v.getOpt(t).each(Zp.enable)}}),Vm("url-input-events",[gr(p,function(o){mf.getCurrent(o).each(function(n){var e=Rm.getValue(n);g.each(function(t){t(e).get(function(t){Rm.setValue(n,t),jo(o,Sb,{name:r.name})})})})})])])})},dk=function(a,n){var t,e,o=a.label.map(function(t){return vy(t,n)}),r=function(e){return function(n,t){gu(t.event().target(),"[data-collection-item-value]").each(function(t){e(n,t,Kr(t,"data-collection-item-value"))})}},i=[gr(uo(),r(function(t,n){Nf(n)})),gr(Oo(),r(function(t,n,e){jo(t,Ob,{name:a.name,value:e})})),gr(ao(),r(function(t,n,e){mu(t.element(),"."+Tp).each(function(t){Hi(t,Tp)}),Vi(n,Tp)})),gr(co(),r(function(t,n,e){mu(t.element(),"."+Tp).each(function(t){Hi(t,Tp)})})),Or(r(function(t,n,e){jo(t,Ob,{name:a.name,value:e})}))],u=Fb.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==a.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:d},behaviours:Gu([Sm.config({}),Rm.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){var n,e,r,i;n=o,e=P(t,function(t){var n,e=yp.translate(t.text),o=1===a.columns?'<div class="tox-collection__item-label">'+e+"</div>":"",r='<div class="tox-collection__item-icon">'+t.icon+"</div>",i={_:" "," - ":" ","-":" "},u=e.replace(/\_| \- |\-/g,function(t){return i[t]});return'<div class="tox-collection__item" tabindex="-1" data-collection-item-value="'+('"'===(n=t.value)?""":n)+'" title="'+u+'" aria-label="'+u+'">'+r+o+"</div>"}),r=1<a.columns&&"auto"!==a.columns?H(e,a.columns):[e],i=P(r,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"}),Gr(n.element(),i.join("")),"auto"===a.columns&&ap(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;vm.setGridSize(o,n,e)}),Lo(o,Ab)}}),Ny.config({}),vm.config((t=a.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:"."+wp}})),Vm("collection-events",i)])});return my(o,u,["tox-form__group--collection"],[])},mk=function(r){return function(n,e,o){return Ft(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},gk={bar:mk(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:P(e.items,o.interpreter)};var e,o}),collection:mk(function(t,n){return dk(t,n.shared.providers)}),alloy:mk(d),alertbanner:mk(function(t,n){return e=t,o=n.shared.providers,cb.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:[Sg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:Og(e.icon,o.icons),attributes:{title:o.translate(e.iconTooltip)}},action:function(t){jo(t,Ob,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:mk(function(t,n){return e=t,o=n.shared.providers,tk({name:e.name,multiline:!1,label:e.label,placeholder:e.placeholder,flex:!1,disabled:e.disabled,classname:"tox-textfield",validation:et.none(),maximized:e.maximized},o);var e,o}),textarea:mk(function(t,n){return e=t,o=n.shared.providers,tk({name:e.name,multiline:!0,label:e.label,placeholder:e.placeholder,flex:!0,disabled:e.disabled,classname:"tox-textarea",validation:et.none(),maximized:e.maximized},o);var e,o}),listbox:mk(function(t,n){return e=t,o=n.shared.providers,r=vy(e.label,o),i=Fb.parts().field({factory:ZC,dom:{classes:["mce-select-field"]},selectBehaviours:Gu([Ny.config({})]),options:e.values,data:e.initialValue.getOr(undefined)}),gy(et.some(r),i);var e,o,r,i}),label:mk(function(t,n){return e=t,o=n.shared,r={dom:{tag:"label",innerHtml:o.providers.translate(e.label),classes:["tox-label"]}},i=P(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:Gu([Yw(),Sm.config({}),oS(et.none()),vm.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(YC=function(t,n){return gS(t,n.shared.providers)},function(t,n,e){var o=bt(n,{source:"dynamic"});return mk(YC)(t,o,e)}),autocomplete:mk(function(t,n){return i=n,e=vy((r=t).label.getOr("?"),i.shared.providers),o=Fb.parts().field({factory:dy,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(t){var n=Rm.getValue(t),e=r.getItems(n),o=Cy(e,uh.BUBBLE_TO_SANDBOX,i);return Gb.pure(o)},markers:{openClass:"dog"},lazySink:i.shared.getSink,parts:{menu:gv(0,0,"normal")}}),gy(et.some(e),o);var r,i,e,o}),button:mk(function(t,n){return e=t,o=n.shared.providers,r=hC(e.name,"custom"),gy(et.none(),Fb.parts().field(I({factory:Sg},gC(e,et.some(r),o,[rS(""),Yw()]))));var e,o,r}),checkbox:mk(function(t,n){return e=t,o=n.shared.providers,r=Rm.config({store:{mode:"manual",getValue:function(t){return t.element().dom().checked},setValue:function(t,n){t.element().dom().checked=n}}}),i=function(t){return t.element().dom().click(),et.some(!0)},u=Fb.parts().field({factory:{sketch:d},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:Gu([Yw(),Zp.config({disabled:e.disabled}),Ny.config({}),Lm.config({}),r,vm.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),Vm("checkbox-events",[gr(mo(),function(t,n){jo(t,Sb,{name:e.name})})])])}),a=Fb.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:Gu([Ly.config({})])}),s=Cg({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:Og("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),Fb.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a],fieldBehaviours:Gu([Zp.config({disabled:e.disabled,disableClass:"tox-checkbox--disabled",onDisabled:function(t){Fb.getField(t).each(Zp.disable)},onEnabled:function(t){Fb.getField(t).each(Zp.enable)}})])});var e,o,r,i,u,a,c,s}),colorinput:mk(function(t,n){return Gy(t,n.shared,n.colorinput)}),colorpicker:mk(function(t){var n=function(t){return"tox-"+t},e=Xw(Jw,n),r=Cg(e.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(t){jo(t,Ob,{name:"hex-valid",value:!0})},onInvalidHex:function(t){jo(t,Ob,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:Gu([Rm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return mf.getCurrent(n).bind(function(t){return Rm.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);mf.getCurrent(o).fold(function(){F.console.log("Can not find form")},function(t){Rm.setValue(t,{hex:et.from(e[1]).getOr("")}),Pw.getField(t,"hex").each(function(t){Lo(t,fo())})})}}}),Yw()])}}),dropzone:mk(function(t,n){return iS(t,n.shared.providers)}),grid:mk(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:P(e.items,o.interpreter)};var e,o}),selectbox:mk(function(t,n){return e=t,o=n.shared.providers,r=P(e.items,function(t){return{text:o.translate(t.text),value:t.value}}),i=e.label.map(function(t){return vy(t,o)}),u=Fb.parts().field({dom:{},selectAttributes:{size:e.size},options:r,factory:ZC,selectBehaviours:Gu([Zp.config({disabled:e.disabled}),Ny.config({}),Vm("selectbox-change",[gr(mo(),function(t,n){jo(t,Sb,{name:e.name})})])])}),a=1<e.size?et.none():et.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:Og("chevron-down",o.icons)}}),c={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[u],a.toArray()])},Fb.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([i.toArray(),[c]]),fieldBehaviours:Gu([Zp.config({disabled:e.disabled,onDisabled:function(t){Fb.getField(t).each(Zp.disable)},onEnabled:function(t){Fb.getField(t).each(Zp.enable)}})])});var e,o,r,i,u,a,c}),sizeinput:mk(function(t,n){return EC(t,n.shared.providers)}),urlinput:mk(function(t,n){return fk(t,n,n.urlinput)}),customeditor:mk(function(n){var e=se(et.none()),o=Cg({dom:{tag:n.tag}}),r=se(et.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:Gu([Vm("editor-foo-events",[Sr(function(t){o.getOpt(t).each(function(t){n.init(t.element().dom()).then(function(n){r.get().each(function(t){n.setValue(t)}),r.set(et.none()),e.set(et.some(n))})})})]),Rm.config({store:{mode:"manual",getValue:function(){return e.get().fold(function(){return r.get().getOr("")},function(t){return t.getValue()})},setValue:function(t,n){e.get().fold(function(){r.set(et.some(n))},function(t){return t.setValue(n)})}}}),Yw()]),components:[o.asSpec()]}}),htmlpanel:mk(function(t){return"presentation"===t.presets?cb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):cb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:Gu([Ny.config({}),Lm.config({})])})}),imagetools:mk(function(t,n){return QC(t,n.shared.providers)}),table:mk(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:P(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:P(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:P(r,c)})],behaviours:Gu([Ny.config({}),Lm.config({})])};var e,o,r,i,u,a,c}),panel:mk(function(t,n){return o=n,{dom:{tag:"div",classes:(e=t).classes},components:P(e.items,o.shared.interpreter)};var e,o})},pk={field:function(t,n){return n}},hk=function(n,t,e){var o=bt(e,{shared:{interpreter:function(t){return vk(n,t,o)}}});return vk(n,t,o)},vk=function(n,e,o){return Ft(gk,e.type).fold(function(){return F.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},bk=function(t){return t.x()},yk=function(t,n){return t.x()+t.width()/2-n.width()/2},xk=function(t,n){return t.x()+t.width()-n.width()},wk=function(t){return t.y()},Sk=function(t,n){return t.y()+t.height()-n.height()},Ck=function(t,n,e){return xa(bk(t),Sk(t,n),e.innerSoutheast(),Sa(),"layout-se")},kk=function(t,n,e){return xa(xk(t,n),Sk(t,n),e.innerSouthwest(),Ca(),"layout-sw")},Ok=function(t,n,e){return xa(bk(t),wk(t),e.innerNortheast(),ka(),"layout-ne")},Ek=function(t,n,e){return xa(xk(t,n),wk(t),e.innerNorthwest(),Oa(),"layout-nw")},Tk=function(t,n,e){return xa(yk(t,n),wk(t),e.innerNorth(),Ta(),"layout-n")},Bk=function(t,n,e){return xa(yk(t,n),Sk(t,n),e.innerSouth(),Ea(),"layout-s")},Dk={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},Ak=function(t,n,e){var o,r,i,u,a,c,s,l,f,d,m=wb(t),g=function(){return fe.fromDom(t.getBody())};return{toolbar:(l=g,f=n,d=m,d?function(){return{anchor:"node",root:l(),node:et.from(l()),bubble:ba(-12,-12,Dk),layouts:{onRtl:function(){return[Ok]},onLtr:function(){return[Ek]}}}}:function(){return{anchor:"hotspot",hotspot:f(),bubble:ba(-12,12,Dk),layouts:{onRtl:function(){return[Va]},onLtr:function(){return[Na]}}}}),toolbarOverflow:(s=e,function(){return{anchor:"hotspot",hotspot:s(),layouts:{onRtl:function(){return[Va]},onLtr:function(){return[Na]}}}}),banner:(u=g,a=n,c=e,c?function(){return{anchor:"node",root:u(),node:et.from(u()),layouts:{onRtl:function(){return[Tk]},onLtr:function(){return[Tk]}}}}:function(){return{anchor:"hotspot",hotspot:a(),layouts:{onRtl:function(){return[La]},onLtr:function(){return[La]}}}}),cursor:(r=t,i=g,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return et.some(pc.range(fe.fromDom(t.startContainer),t.startOffset,fe.fromDom(t.endContainer),t.endOffset))}}}),node:(o=g,function(t){return{anchor:"node",root:o(),node:t}})}},_k=function(t){return{colorPicker:(r=t,function(t,n){cv.colorPickerDialog(r)(t,n)}),hasCustomColors:(o=t,function(){return Wh(o)}),getColors:(e=t,function(){return Gh(e)}),getColorCols:(n=t,function(){return cv.getColorCols(n)})};var n,e,o,r},Mk=[{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"}]}],Fk=function(t){return U(t,function(t,n){if(gt(n,"items")){var e=Fk(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(gt(n,"inline")||gt(n,"block")||gt(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 I({},t,{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},Ik=function(i){return(t=i,et.from(t.getParam("style_formats")).filter(E)).map(function(t){var n,e,o,r=(n=i,e=Fk(t),o=function(t){z(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")?Mk.concat(r):r}).getOr(Mk);var t},Rk=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return bt(t,o)},Vk=function(s,t,l,f){var d=function(t){return P(t,function(t){var n,e,o,r,i,u,a=ut(t);if(Nt(t,"items")){var c=d(t.items);return bt((i=t,u={type:"submenu",isSelected:nt(!1),getStylePreview:function(){return et.none()}},bt(i,u)),{getStyleItems:function(){return c}})}return Nt(t,"format")?Rk(t,l,f):1===a.length&&M(a,"title")?bt(t,{type:"separator"}):(e=ri((n=t).title),o={type:"formatter",format:e,isSelected:l(e),getStylePreview:f(e)},r=bt(n,o),s.formatter.register(e,r),r)})};return d(t)},Nk=VC.trim,Hk=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}},Pk=Hk("true"),zk=Hk("false"),Lk=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},jk=function(t){return t.innerText||t.textContent},Uk=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&Gk(t);var n},Wk=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},Gk=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return Pk(t)}return!1}(t)&&!zk(t)},Xk=function(t){return Wk(t)&&Gk(t)},Yk=function(t){var n,e,o=(n=t).id?n.id:ri("h");return Lk("header",jk(t),"#"+o,Wk(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},qk=function(t){var n=t.id||t.name,e=jk(t);return Lk("anchor",e||"#"+n,"#"+n,0,tt)},Kk=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,P(zc(fe.fromDom(e),n),function(t){return t.dom()})},$k=function(t){return 0<Nk(t.title).length},Jk=function(t){var n,e=Kk(t);return L((n=e,P(L(n,Xk),Yk)).concat(P(L(e,Uk),qk)),$k)},Qk="tinymce-url-history",Zk=function(t){return k(t)&&/^https?/.test(t)},tO=function(t){return O(t)&&function(t,n){for(var e=ut(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return et.some(u)}return et.none()}(t,function(t){return!(E(n=t)&&n.length<=5&&$(n,Zk));var n}).isNone()},nO=function(){var t,n=F.localStorage.getItem(Qk);if(null===n)return{};try{t=JSON.parse(n)}catch(e){if(e instanceof SyntaxError)return F.console.log("Local storage "+Qk+" was not valid JSON",e),{};throw e}return tO(t)?t:(F.console.log("Local storage "+Qk+" was not valid format",t),{})},eO=function(t){var n=nO();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},oO=function(n,t){if(Zk(n)){var e=nO(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=L(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!tO(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));F.localStorage.setItem(Qk,JSON.stringify(t))}(e)}},rO=Object.prototype.hasOwnProperty,iO=function(t){return!!t},uO=function(t){return st(VC.makeMap(t,/[, ]/),iO)},aO=function(t,n,e){var o,r,i=(o=t,r=n,rO.call(o,r)?et.some(o[r]):et.none()).getOr(e);return k(i)?et.some(i):et.none()},cO=function(t){return et.some(t.file_picker_callback).filter(B)},sO=function(t,n){var e,o,r,i,u=(e=t,o=et.some(e.file_picker_types).filter(iO),r=et.some(e.file_browser_callback_types).filter(iO),i=o.or(r).map(uO),cO(e).fold(function(){return!1},function(t){return i.fold(function(){return!0},function(t){return 0<ut(t).length&&t})}));return T(u)?u?cO(t):et.none():u[n]?cO(t):et.none()},lO=function(n){return{getHistory:eO,addToHistory:oO,getLinkInformation:function(){return!1===(t=n).settings.typeahead_urls?et.none():et.some({targets:Jk(t.getBody()),anchorTop:aO(t.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:aO(t.settings,"anchor_bottom","#bottom").getOrUndefined()});var t},getValidationHandler:function(){return t=n.settings.filepicker_validator_handler,B(t)?et.some(t):et.none();var t},getUrlPicker:function(t){return i=t,sO((r=n).settings,i).map(function(o){return function(n){return Gb.nu(function(e){var t=VC.extend({filetype:i},et.from(n.meta).getOr({}));o.call(r,function(t,n){if(!k(t))throw new Error("Expected value to be string");if(n!==undefined&&!O(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},fO=function(t,n,e,o){var r={shared:{providers:{icons:function(){return n.ui.registry.getAll().icons},menuItems:function(){return n.ui.registry.getAll().menuItems},translate:yp.translate},interpreter:function(t){return vk(pk,t,r)},anchors:Ak(n,e,o),getSink:function(){return R.value(t)}},urlinput:lO(n),styleselect:function(e){var o=function(t){return function(){return e.formatter.match(t)}},r=function(n){return function(){var t=e.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:e.formatter.getCssText(n)}):et.none()}},i=function(t){var n=t.items;return n!==undefined&&0<n.length?K(n,i):[t.format]},u=se([]),a=se([]),c=se([]),s=se([]),l=se(!1);e.on("init",function(){var t=Ik(e),n=Vk(e,t,o,r);u.set(n),a.set(K(n,i))}),e.on("addStyleModifications",function(t){var n=Vk(e,t.items,o,r);c.set(n),l.set(t.replace),s.set(K(n,i))});return{getData:function(){var t=l.get()?[]:u.get(),n=c.get();return t.concat(n)},getFlattenedKeys:function(){var t=l.get()?[]:a.get(),n=s.get();return t.concat(n)}}}(n),colorinput:_k(n)};return r},dO=nt([zn("dom"),te("shell",!0),ol("toolbarBehaviours",[Sm])]),mO=nt([Fl({name:"groups",overrides:function(t){return{behaviours:Gu([Sm.config({})])}}})]),gO=sf({name:"Toolbar",configFields:dO(),partFields:mO(),factory:function(n,t,e,o){var r=function(t){return n.shell?et.some(t):Gl(t,n,"groups")},i=n.shell?{behaviours:[Sm.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:i.components,behaviours:il(n.toolbarBehaviours,i.behaviours),apis:{setGroups:function(t,n){r(t).fold(function(){throw F.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){Sm.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),pO=Er("within","extra","withinWidth"),hO=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return et.some({element:nt(t),start:nt(n),finish:nt(n+e),width:nt(e)})},U(t,function(n,t){return e(t,n.len).fold(nt(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=L(r,function(t){return t.finish()<=n}),u=j(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:nt(i),extra:nt(a),withinWidth:nt(u)}},vO=function(t){return P(t,function(t){return t.element()})},bO=function(t,n,e,o){var r,i,u,a,c,s,l,f,d,m,g,p,h=(r=t,i=n,u=e,a=hO(i,r,u),0===a.extra().length?et.some(a):et.none()).getOrThunk(function(){return hO(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=vO(v.concat(m)),pO(p,[],g)):1<=b.length?(s=b,l=o,f=y,d=vO(v).concat([l]),pO(d,vO(s),f)):(c=y,pO(vO(v),[],c))},yO=function(t,n){var e=P(n,function(t){return fu(t)});gO.setGroups(t,e)},xO=function(t,n,e,o){var r=Xl(t,n,"primary"),i=Gl(t,n,"overflow-button"),u=Vb.getCoupled(t,"overflowGroup");Gi(r.element(),"visibility","hidden");var a,c=(a=i,e.bind(function(n){return Pf(n.element()).bind(function(t){return n.getSystem().getByDom(t).toOption()})}).orThunk(function(){return a.filter(Lm.isFocused)}));e.each(function(t){gO.setGroups(t,[])});var s=n.builtGroups.get();yO(r,s.concat([u]));var l=fa(r.element()),f=bO(l,s,function(t){return fa(t.element())},u);0===f.extra().length?(Sm.remove(r,u),e.each(function(t){gO.setGroups(t,[])})):(yO(r,f.within()),e.each(function(t){yO(t,f.extra())})),Ji(r.element(),"visibility"),Qi(r.element()),e.each(function(n){i.each(function(t){return Zm.set(t,o(n))}),c.each(Lm.focus)})},wO=nt([zn("items"),_u(["itemSelector"]),ol("tgroupBehaviours",[vm])]),SO=nt([Il({name:"items",unit:"item"})]),CO=sf({name:"ToolbarGroup",configFields:wO(),partFields:SO(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,behaviours:il(t.tgroupBehaviours,[vm.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),kO=nt([ol("splitToolbarBehaviours",[]),ce("builtGroups",function(){return se([])})]),OO=function(o,t,n,e,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:il(o.splitToolbarBehaviours,[Vb.config({others:I({},r.coupling,{overflowGroup:function(n){return CO.sketch(I({},e["overflow-group"](),{items:[Sg.sketch(I({},e["overflow-button"](),{action:function(t){Lo(n,i)}}))]}))}})}),Vm("toolbar-toggle-events",[gr(i,function(t){r.toggleToolbar(t,o,e)})])]),apis:{setGroups:function(t,n){var e;e=P(n,t.getSystem().build),o.builtGroups.set(e),r.refresh(t,o)},refresh:function(t){r.refresh(t,o)},getMoreButton:function(t){return Gl(t,o,"overflow-button")},getOverflow:function(t){return n=t,r.getOverflow(n);var n},toggle:function(t){r.toggleToolbar(t,o,e)}},domModification:{attributes:{role:"group"}}}},EO=nt([_u(["overflowToggledClass"]),zn("getAnchor"),zn("lazySink")].concat(kO())),TO=nt([_l({factory:gO,schema:dO(),name:"primary"}),Ml({factory:gO,schema:dO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:Gu([vm.config({mode:"cyclic",onEscape:function(t){return Gl(t,n,"overflow-button").each(Lm.focus),et.none()}})])}}}),Ml({name:"overflow-button",overrides:function(t){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:Gu([Zm.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),Ml({name:"overflow-group"})]),BO=function(t,n,e){var o=Vb.getCoupled(t,"sandbox");Js.isOpen(o)?Js.close(o):Js.open(o,e.overflow())},DO=function(t){return t.getSystem().isConnected()},AO=function(o,r){var t=Js.getState(Vb.getCoupled(o,"sandbox"));xO(o,r,t,DO),t.each(function(t){var n=r.lazySink(o).getOrDie(),e=r.getAnchor(o);Ms.position(n,e,t)})},_O=sf({name:"SplitFloatingToolbar",configFields:EO(),partFields:TO(),factory:function(n,t,e,o){return OO(n,t,0,o,{refresh:AO,toggleToolbar:BO,getOverflow:function(t){return Js.getState(Vb.getCoupled(t,"sandbox"))},coupling:{sandbox:function(t){return o=t,e=n,{dom:{tag:"div",attributes:{id:(r=pu()).id()}},behaviours:Gu([vm.config({mode:"special",onEscape:function(t){return Js.close(t),et.some(!0)}}),Js.config({onOpen:function(t,n){AO(o,e),Gl(o,e,"overflow-button").each(function(t){Zm.on(t),r.link(t.element())}),vm.focusIn(n)},onClose:function(){Gl(o,e,"overflow-button").each(function(t){Zm.off(t),Lm.focus(t),r.unlink(t.element())})},isPartOf:function(t,n,e){return vu(n,e)||vu(o,e)},getAttachPoint:function(){return e.lazySink(o).getOrDie()}})])};var o,e,r}}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),MO=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},FO=function(t){return t.dimension.property},IO=function(t,n){return t.dimension.getDimension(n)},RO=function(t,n){var e=MO(t,n);Li(e,[n.shrinkingClass,n.growingClass])},VO=function(t,n){Hi(t.element(),n.openClass),Vi(t.element(),n.closedClass),Gi(t.element(),FO(n),"0px"),Qi(t.element())},NO=function(t,n){Hi(t.element(),n.closedClass),Vi(t.element(),n.openClass),Ji(t.element(),FO(n))},HO=function(t,n,e,o){e.setCollapsed(),Gi(t.element(),FO(n),IO(n,t.element())),Qi(t.element()),RO(t,n),VO(t,n),n.onStartShrink(t),n.onShrunk(t)},PO=function(t,n,e,o){var r=o.getOrThunk(function(){return IO(n,t.element())});e.setCollapsed(),Gi(t.element(),FO(n),r),Qi(t.element());var i=MO(t,n);Hi(i,n.growingClass),Vi(i,n.shrinkingClass),VO(t,n),n.onStartShrink(t)},zO=function(t,n,e){var o=IO(n,t.element());("0px"===o?HO:PO)(t,n,e,et.some(o))},LO=function(t,n,e){var o=MO(t,n),r=Pi(o,n.shrinkingClass),i=IO(n,t.element());NO(t,n);var u=IO(n,t.element());(r?function(){Gi(t.element(),FO(n),i),Qi(t.element())}:function(){VO(t,n)})(),Hi(o,n.shrinkingClass),Vi(o,n.growingClass),NO(t,n),Gi(t.element(),FO(n),u),e.setExpanded(),n.onStartGrow(t)},jO=function(t,n,e){var o=MO(t,n);return!0===Pi(o,n.growingClass)},UO=function(t,n,e){var o=MO(t,n);return!0===Pi(o,n.shrinkingClass)},WO=/* */Object.freeze({refresh:function(t,n,e){if(e.isExpanded()){Ji(t.element(),FO(n));var o=IO(n,t.element());Gi(t.element(),FO(n),o)}},grow:function(t,n,e){e.isExpanded()||LO(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&zO(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&HO(t,n,e)},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:jO,isShrinking:UO,isTransitioning:function(t,n,e){return!0===jO(t,n)||!0===UO(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?zO:LO)(t,n,e)},disableTransitions:RO}),GO=/* */Object.freeze({exhibit:function(t,n){var e=n.expanded;return Ci(e?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:It(n.dimension.property,"0px")})},events:function(e,o){return fr([wr(po(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(RO(t,e),o.isExpanded()&&Ji(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),XO=[zn("closedClass"),zn("openClass"),zn("shrinkingClass"),zn("growingClass"),qn("getAnimationRoot"),Fu("onShrunk"),Fu("onStartShrink"),Fu("onGrown"),Fu("onStartGrow"),te("expanded",!1),Ln("dimension",Mn("property",{width:[Nu("property","width"),Nu("getDimension",function(t){return fa(t)+"px"})],height:[Nu("property","height"),Nu("getDimension",function(t){return ca(t)+"px"})]}))],YO=Yu({fields:XO,name:"sliding",active:GO,apis:WO,state:/* */Object.freeze({init:function(t){var n=se(t.expanded);return wi({isExpanded:function(){return!0===n.get()},isCollapsed:function(){return!1===n.get()},setCollapsed:g(n.set,!1),setExpanded:g(n.set,!0),readState:function(){return"expanded: "+n.get()}})}})}),qO=nt([_u(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"])].concat(kO())),KO=nt([_l({factory:gO,schema:dO(),name:"primary"}),_l({factory:gO,schema:dO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:Gu([YO.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass,onShrunk:function(t){Gl(t,n,"overflow-button").each(function(t){Zm.off(t),Lm.focus(t)})},onGrown:function(t){vm.focusIn(t)},onStartGrow:function(t){Gl(t,n,"overflow-button").each(Zm.on)}}),vm.config({mode:"acyclic",onEscape:function(t){return Gl(t,n,"overflow-button").each(Lm.focus),et.some(!0)}})])}}}),Ml({name:"overflow-button",overrides:function(t){return{buttonBehaviours:Gu([Zm.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),Ml({name:"overflow-group"})]),$O=function(n,e){Gl(n,e,"overflow").each(function(t){QO(n,e),YO.toggleGrow(t)})},JO=function(t){return YO.hasGrown(t)},QO=function(t,n){var e=Gl(t,n,"overflow");xO(t,n,e,JO),e.each(YO.refresh)},ZO=sf({name:"SplitSlidingToolbar",configFields:qO(),partFields:KO(),factory:function(n,t,e,o){return OO(n,t,0,o,{refresh:QO,toggleToolbar:$O,getOverflow:function(t){return Gl(t,n,"overflow")},coupling:{}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),tE="silver.readonly",nE=pn([(qC="readonly",Ln(qC,Nn))]),eE=function(t,n){var e,o,r,i=t.outerContainer;o=n,r=(e=t).outerContainer.element(),o&&(e.mothership.broadcastOn([Qs()],{target:r}),e.uiMothership.broadcastOn([Qs()],{target:r})),e.mothership.broadcastOn([tE],{readonly:o}),e.uiMothership.broadcastOn([tE],{readonly:o}),qe("*",i.element()).forEach(function(t){i.getSystem().getByDom(t).each(function(t){t.hasConfigured(Zp)&&Zp.set(t,n)})})},oE=function(t,n){t.on("init",function(){t.readonly&&eE(n,!0)}),t.on("SwitchMode",function(){return eE(n,t.readonly)}),t.getParam("readonly",!1,"boolean")&&t.setMode("readonly")},rE=function(n){var t;return Zu.config({channels:(t={},t[tE]={schema:nE,onReceive:function(t,o){n(t).each(function(t){var n,e;n=t,e=o.readonly,qe("*",n.element()).forEach(function(t){n.getSystem().getByDom(t).each(function(t){t.hasConfigured(Zp)&&Zp.set(t,e)})})})}},t)})},iE=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:I({tag:"div",classes:["tox-toolbar__group"]},n),components:[CO.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:Gu([Ny.config({}),Lm.config({})])}},uE=function(t){return CO.sketch(iE(t))},aE=function(e,t,n){var o=Sr(function(t){var n=P(e.initGroups,uE);gO.setGroups(t,n)});return Gu([vm.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Vm("toolbar-events",[o]),rE(n)])},cE=function(t,n){var e=t.cyclicKeying?"cyclic":"acyclic";return{uid:t.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":iE({title:et.none(),items:[]}),"overflow-button":dC({name:"more",icon:et.some("more-drawer"),disabled:!1,tooltip:et.some("More..."),primary:!1,borderless:!1},et.none(),t.backstage.shared.providers)},splitToolbarBehaviours:aE(t,e,n)}},sE=function(t){var n=cE(t,_O.getOverflow),e=_O.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return _O.sketch(I({},n,{lazySink:t.getSink,getAnchor:function(){return t.backstage.shared.anchors.toolbarOverflow()},parts:I({},n.parts,{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"]}}}),components:[e],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))},lE=function(t){var n=ZO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=ZO.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),o=cE(t,ZO.getOverflow);return ZO.sketch(I({},o,{components:[n,e],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"}}))},fE=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return gO.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[gO.parts().groups({})],toolbarBehaviours:aE(t,n,nt(et.none()))})},dE=[ie("disabled",!1),Jn("tooltip"),Jn("icon"),Jn("text"),ue("onSetup",function(){return tt})],mE=pn([jn("type"),Wn("onAction")].concat(dE)),gE=function(t){return Bn("toolbarbutton",mE,t)},pE=[Jn("text"),Jn("tooltip"),Jn("icon"),Wn("fetch"),ue("onSetup",function(){return tt})],hE=pn([jn("type")].concat(pE)),vE=function(t){return Bn("menubutton",hE,t)},bE=pn([jn("type"),Jn("tooltip"),Jn("icon"),Jn("text"),Qn("select"),Wn("fetch"),ue("onSetup",function(){return tt}),re("presets","normal",["normal","color","listpreview"]),te("columns",1),Wn("onAction"),Wn("onItemAction")]),yE=[ie("active",!1)].concat(dE),xE=pn(yE.concat([jn("type"),Wn("onAction")])),wE=function(t){return Bn("ToggleButton",xE,t)},SE=[ue("predicate",function(){return!1}),re("scope","node",["node","editor"]),re("position","selection",["node","selection","line"])],CE=dE.concat([te("type","contextformbutton"),te("primary",!1),Wn("onAction"),ce("original",d)]),kE=yE.concat([te("type","contextformbutton"),te("primary",!1),Wn("onAction"),ce("original",d)]),OE=dE.concat([te("type","contextformbutton")]),EE=yE.concat([te("type","contextformtogglebutton")]),TE=Mn("type",{contextformbutton:CE,contextformtogglebutton:kE}),BE=pn([te("type","contextform"),ue("initValue",function(){return""}),Jn("label"),Yn("commands",TE),Kn("launch",Mn("type",{contextformbutton:OE,contextformtogglebutton:EE}))].concat(SE)),DE=pn([te("type","contexttoolbar"),jn("items")].concat(SE)),AE=/* */Object.freeze({getState:function(t,n,e){return e}}),_E=/* */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());Ps(e),z(n,function(t){Rs(e,e.getSystem().build(t))})})};return fr([gr(wo(),function(t,n){var e=r.channel;M(n.channels(),e)&&o(t,n.data())}),Sr(function(n,t){r.initialData.each(function(t){o(n,t)})})])}}),ME=/* */Object.freeze({init:function(t){var n=se(et.none());return{readState:function(){return n.get().getOr("none")},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(et.none())}}}}),FE=[zn("channel"),qn("renderComponents"),qn("updateState"),qn("initialData")],IE=Yu({fields:FE,name:"reflecting",active:_E,apis:AE,state:ME}),RE=nt([zn("toggleClass"),zn("fetch"),Ru("onExecute"),te("getHotspot",et.some),te("getAnchorOverrides",nt({})),te("layouts",et.none()),Ru("onItemExecute"),qn("lazySink"),zn("dom"),Fu("onOpen"),ol("splitDropdownBehaviours",[Vb,vm,Lm]),te("matchWidth",!1),te("useMinWidth",!1),te("eventOrder",{}),qn("role")].concat(sy())),VE=_l({factory:Sg,schema:[zn("dom")],name:"arrow",defaults:function(t){return{buttonBehaviours:Gu([Lm.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(Uo)},buttonBehaviours:Gu([Zm.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),NE=_l({factory:Sg,schema:[zn("dom")],name:"button",defaults:function(t){return{buttonBehaviours:Gu([Lm.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)})}}}}),HE=nt([VE,NE,Fl({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[zn("text")],name:"aria-descriptor"}),Ml({schema:[Au()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),Yb()]),PE=sf({name:"SplitDropdown",configFields:RE(),partFields:HE(),factory:function(o,t,n,e){var r=function(t){mf.getCurrent(t).each(function(t){Ef.highlightFirst(t),vm.focusIn(t)})},i=function(t){Jb(o,function(t){return t},t,e,r,vb.HighlightFirst).get(tt)},u=function(t){var n=Xl(t,o,"button");return Uo(n),et.some(!0)},a=yt(fr([Sr(function(e,t){Gl(e,o,"aria-descriptor").each(function(t){var n=ri("aria");Yr(t.element(),"id",n),Yr(e.element(),"aria-describedby",n)})})]),wg(et.some(i)));return{uid:o.uid,dom:o.dom,components:t,eventOrder:I({},o.eventOrder,{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:il(o.splitDropdownBehaviours,[Vb.config({others:{sandbox:function(t){var n=Xl(t,o,"arrow");return ty(o,t,{onOpen:function(){Zm.on(n),Zm.on(t)},onClose:function(){Zm.off(n),Zm.off(t)}})}}}),vm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),et.some(!0)}}),Lm.config({}),Zm.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),zE=function(n){return{isDisabled:function(){return Zp.isDisabled(n)},setDisabled:function(t){return Zp.set(n,t)}}},LE=function(n){return{setActive:function(t){Zm.set(n,t)},isActive:function(){return Zm.isOn(n)},isDisabled:function(){return Zp.isDisabled(n)},setDisabled:function(t){return Zp.set(n,t)}}},jE=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},UE=ri("focus-button"),WE=["checklist","ordered-list"],GE=["indent","outdent","table-insert-column-after","table-insert-column-before","unordered-list"],XE=function(n,e,t,o,r,i){var u,a=function(t){return yp.isRtl()&&M(WE,t)?t+"-rtl":t},c=yp.isRtl()&&n.exists(function(t){return M(GE,t)});return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]).concat(c?["tox-tbtn__icon-rtl"]:[]),attributes:jE(t,i)},components:ch([n.map(function(t){return nC(a(t),i.icons)}),e.map(function(t){return oC(t,"tox-tbtn",i)})]),eventOrder:(u={},u[eo()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:Gu([Vm("common-button-display-events",[gr(eo(),function(t,n){n.event().prevent(),Lo(t,UE)})])].concat(o.map(function(t){return IE.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t,n){return ch([t.icon.map(function(t){return nC(a(t),i.icons)}),t.text.map(function(t){return oC(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},YE=function(t,n,e){var o,r=se(tt),i=XE(t.icon,t.text,t.tooltip,et.none(),et.none(),e);return Sg.sketch({dom:i.dom,components:i.components,eventOrder:iC,buttonBehaviours:Gu([Vm("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},Or(function(n,t){oh(o,n)(function(t){jo(n,rC,{buttonApi:t}),o.onAction(t)})})),rh(n,r),ih(n,r)]),nh(t.disabled)].concat(n.toolbarButtonBehaviours))})},qE=function(t,n,e){return YE(t,{toolbarButtonBehaviours:[].concat(0<e.length?[Vm("toolbarButtonWith",e)]:[]),getApi:zE,onSetup:t.onSetup},n)},KE=function(t,n,e){return bt(YE(t,{toolbarButtonBehaviours:[Sm.config({}),Zm.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[Vm("toolbarToggleButtonWith",e)]:[]),getApi:LE,onSetup:t.onSetup},n))},$E=function(n,t){var e,o,r,i,u=ri("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return Zp.isDisabled(e)},setDisabled:function(t){return Zp.set(e,t)},setIconFill:function(t,n){mu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Yr(t,"fill",n)})},setIconStroke:function(t,n){mu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Yr(t,"stroke",n)})},setActive:function(n){Yr(e.element(),"aria-pressed",n),mu(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return Zm.set(t,n)})})},isActive:function(){return mu(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists(Zm.isOn)})}}},c=se(tt),s={getApi:a,onSetup:n.onSetup};return PE.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:yt({"aria-pressed":!1},jE(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(t,n,e){},splitDropdownBehaviours:Gu([eh(!1),Vm("split-dropdown-events",[gr(UE,Lm.focus),rh(s,c),ih(s,c)])]),eventOrder:(e={},e[Mo()]=["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 Gb.nu(function(t){return r.fetch(t)}).map(function(t){return et.from(Rv(bt(bv(ri("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,uh.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:xv(r.columns,r.presets),menuBehaviours:sp("auto"!==r.columns?[]:[Sr(function(o,t){ap(o,4,Bp(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;vm.setGridSize(o,n,e)})})])})))})}),parts:{menu:gv(0,n.columns,n.presets)},components:[PE.parts().button(XE(n.icon,n.text,et.none(),et.some(u),et.some([Zm.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),PE.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:Og("chevron-down",t.providers.icons)}}),PE.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},JE=function(i,u){return gr(rC,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return Lo(e,To())},getValue:function(){return Rm.getValue(e)}});u.onAction(r,n.event().buttonApi())})},QE=function(t,n,e){var o,r,i,u,a,c,s,l,f,d,m,g,p={backstage:{shared:{providers:e}}};return"contextformtogglebutton"===n.type?(s=t,f=p,(d=(l=n).original).primary,m=h(d,["primary"]),g=Dn(wE(I({},m,{type:"togglebutton",onAction:function(){}}))),KE(g,f.backstage.shared.providers,[JE(s,l)])):(o=t,i=p,(u=(r=n).original).primary,a=h(u,["primary"]),c=Dn(gE(I({},a,{type:"button",onAction:function(){}}))),qE(c,i.backstage.shared.providers,[JE(o,r)]))},ZE=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=Cg(ky.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:Gu([vm.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return Uo(t),!0})},onLeft:function(t,n){return n.cut(),et.none()},onRight:function(t,n){return n.cut(),et.none()}})])})),c=(e=a,o=t.commands,r=n.shared.providers,i=P(o,function(t){return Cg(QE(e,t,r))}),{asSpecs:function(){return P(i,function(t){return t.asSpec()})},findPrimary:function(e){return yu(o,function(t,n){return t.primary?et.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(x(Zp.isDisabled)):et.none()})}});return fE({uid:ri("context-toolbar"),initGroups:[{title:et.none(),items:[a.asSpec()]},{title:et.none(),items:c.asSpecs()}],onEscape:et.none,cyclicKeying:!0,backstage:n,getSink:function(){return R.error("")}})},tT=ri("forward-slide"),nT=ri("backward-slide"),eT=ri("change-slide-event"),oT="tox-pop--resizing",rT=function(t,n,e){var o=Math.max(n.left(),e.x()),r=e.right()-o,i=F.window.innerWidth-(o-n.left());return{x:o,width:Math.min(r,i)}},iT=function(n,t){return yu(t,function(t){return t.predicate(n.dom())?et.some({toolbarApi:t,elem:n}):et.none()})},uT=function(n,e){var t=function(t){return t.dom()===e.getBody()},o=fe.fromDom(e.selection.getNode());return iT(o,n.inNodeScope).orThunk(function(){return iT(o,n.inEditorScope).orThunk(function(){return function(t,n,e){for(var o=t.dom(),r=B(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=fe.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return et.none()}(o,function(t){return iT(t,n.inNodeScope)},t)})})},aT=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=Dn(Bn("ContextForm",BE,e));(t[n]=o).launch.map(function(t){a["form:"+n]=I({},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,Bn("ContextToolbar",DE,t)).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=ut(e);return z(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}},cT=function(o,r){return function(n){var e=se(et.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(et.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},sT=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},lT=function(t,n,e,o){var u,a,r,c,i,s="basic"===e.type?function(){return P(e.data,function(t){return Rk(t,o.isSelectedFor,o.getPreviewFor)})}:e.getData;return{items:(u=n,a=o,r=function(t,n,e,o){var r=u.shared.providers.translate(t.title);if("separator"===t.type)return et.some({type:"separator",text:r});if("submenu"!==t.type)return et.some(I({type:"togglemenuitem",text:r,active:t.isSelected(o),disabled:e,onAction:a.onAction(t)},t.getStylePreview().fold(function(){return{}},function(t){return{meta:{style:t}}})));var i=K(t.getStyleItems(),function(t){return c(t,n,o)});return 0===n&&i.length<=0?et.none():et.some({type:"nestedmenuitem",text:r,disabled:i.length<=0,getSubmenuItems:function(){return K(t.getStyleItems(),function(t){return c(t,n,o)})}})},c=function(t,n,e){var o="formatter"===t.type&&a.isInvalid(t);return 0===n?o?[]:r(t,n,!1,e).toArray():r(t,n,o,e).toArray()},i=function(t){var n=a.getCurrentValue(),e=a.shouldHide?0:1;return K(t,function(t){return c(t,e,n)})},{validateItems:i,getFetch:function(o,r){return function(t){var n=r(),e=i(n);t(Cy(e,uh.CLOSE_ON_EXECUTE,o))}}}),getStyleItems:s}},fT=function(o,t,n,r){var e=lT(0,t,n,r),i=e.items,u=e.getStyleItems;return cC({text:r.icon.isSome()?et.none():et.some(""),icon:r.icon,tooltip:et.from(r.tooltip),role:et.none(),fetch:i.getFetch(t,u),onSetup:function(e){return r.setInitialValue.each(function(t){return t(e.getComponent())}),r.nodeChangeHandler.map(function(t){var n=t(e.getComponent());return o.on("NodeChange",n),function(){o.off("NodeChange",n)}}).getOr(tt)},getApi:function(t){return{getComponent:function(){return t}}},columns:1,presets:"normal",classes:r.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};($C=KC||(KC={}))[$C.SemiColon=0]="SemiColon",$C[$C.Space=1]="Space";var dT,mT,gT=function(t,n,e,o){var r,i,u=Ft(t.settings,n).getOr(e);return{type:"basic",data:(i=u,r=o===KC.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),P(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}}))}},pT=[{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"}],hT=function(e){var n=function(t){var n=W(pT,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});jo(t,aC,{icon:"align-"+n})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),r={type:"basic",data:pT};return{tooltip:"Align",icon:et.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getCurrentValue:nt(et.none()),getPreviewFor:function(t){return function(){return et.none()}},onAction:sT(e),setInitialValue:o,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},vT=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],bT=function(t){var n=t.split(/\s*,\s*/);return P(n,function(t){return t.replace(/^['"]+|['"]+$/g,"")})},yT=function(r){var i=function(){var e=function(t){return t?bT(t)[0]:""},t=r.queryCommandValue("FontName"),n=u.data,o=t?t.toLowerCase():"";return{matchOpt:W(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=bT(t.toLowerCase()),$(vT,function(t){return-1<n.indexOf(t.toLowerCase())}))?et.from({title:"System Font",format:o}):et.none();var t,n}),font:t}},n=function(t){var n=i(),e=n.matchOpt,o=n.font,r=e.fold(function(){return o},function(t){return t.title});jo(t,uC,{text:r})},t=et.some(function(t){return function(){return n(t)}}),e=et.some(function(t){return n(t)}),u=gT(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",KC.SemiColon);return{tooltip:"Fonts",icon:et.none(),isSelectedFor:function(n){return function(t){return t.exists(function(t){return t.format===n})}},getCurrentValue:function(){return i().matchOpt},getPreviewFor:function(t){return function(){return et.some({tag:"div",styleAttr:-1===t.indexOf("dings")?"font-family:"+t:""})}},onAction:function(t){return function(){r.undoManager.transact(function(){r.focus(),r.execCommand("FontName",!1,t.format)})}},setInitialValue:e,nodeChangeHandler:t,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}},xT={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},wT=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},ST=function(e){var i=function(){var o=et.none(),r=u.data,i=e.queryCommandValue("FontSize");if(i)for(var t=function(t){var n=wT(i,t),e=mt(xT,n).getOr("");o=W(r,function(t){return t.format===i||t.format===n||t.format===e})},n=3;o.isNone()&&0<=n;n--)t(n);return{matchOpt:o,px:i}},n=function(t){var n=i(),e=n.matchOpt,o=n.px,r=e.fold(function(){return o},function(t){return t.title});jo(t,uC,{text:r})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),u=gT(e,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",KC.Space);return{tooltip:"Font sizes",icon:et.none(),isSelectedFor:function(n){return function(t){return t.exists(function(t){return t.format===n})}},getPreviewFor:function(){return nt(et.none())},getCurrentValue:function(){return i().matchOpt},onAction:function(t){return function(){e.undoManager.transact(function(){e.focus(),e.execCommand("FontSize",!1,t.format)})}},setInitialValue:o,nodeChangeHandler:t,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}},CT=function(e,t,n){var o=t();return yu(n,function(n){return W(o,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?et.some({title:"Paragraph",format:"p"}):et.none()})},kT=function(t){var n=t.selection.getStart(!0)||t.getBody();return t.dom.getParents(n,function(){return!0},t.getBody())},OT=function(o){var e=function(t,n){var e=CT(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});jo(n,uC,{text:e})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=kT(o);e(n,t)}),r=gT(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",KC.SemiColon);return{tooltip:"Blocks",icon:et.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getCurrentValue:nt(et.none()),getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:o.formatter.getCssText(n)})}},onAction:sT(o),setInitialValue:n,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},ET=function(i){var e=function(t,n){var e=function(t){var n=t.items;return n!==undefined&&0<n.length?K(n,e):[{title:t.title,format:t.format}]},o=K(Ik(i),e),r=CT(i,function(){return o},t).fold(function(){return"Paragraph"},function(t){return t.title});jo(n,uC,{text:r})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=kT(i);e(n,t)});return{tooltip:"Formats",icon:et.none(),isSelectedFor:function(t){return function(){return i.formatter.match(t)}},getCurrentValue:nt(et.none()),getPreviewFor:function(n){return function(){var t=i.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:i.formatter.getCssText(n)}):et.none()}},onAction:sT(i),setInitialValue:n,nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)}}},TT=[{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"]}],BT=function(o,r){return function(t,n){var e=o(t).mapError(function(t){return _n(t)}).getOrDie();return r(e,n)}},DT={button:BT(gE,function(t,n){return e=t,o=n.backstage.shared.providers,qE(e,o,[]);var e,o}),togglebutton:BT(wE,function(t,n){return e=t,o=n.backstage.shared.providers,KE(e,o,[]);var e,o}),menubutton:BT(vE,function(t,n){return lC(t,"tox-tbtn",n.backstage,et.none())}),splitbutton:BT(function(t){return Bn("SplitButton",bE,t)},function(t,n){return $E(t,n.backstage.shared)}),styleSelectButton:function(t,n){return e=t,o=n.backstage,r=o.styleselect,fT(e,o,r,ET(e));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,r=ST(e),fT(e,o,r.dataset,r);var e,o,r},fontSelectButton:function(t,n){return e=t,o=n.backstage,r=yT(e),fT(e,o,r.dataset,r);var e,o,r},formatButton:function(t,n){return e=t,o=n.backstage,r=OT(e),fT(e,o,r.dataset,r);var e,o,r},alignMenuButton:function(t,n){return e=t,o=n.backstage,r=hT(e),fT(e,o,r.dataset,r);var e,o,r}},AT={styleselect:DT.styleSelectButton,fontsizeselect:DT.fontsizeSelectButton,fontselect:DT.fontSelectButton,formatselect:DT.formatButton,align:DT.alignMenuButton},_T=function(t){var n,e,o,r=t.toolbar,i=t.buttons;return!1===r?[]:r===undefined||!0===r?(e=i,o=P(TT,function(t){var n=L(t.items,function(t){return gt(e,t)||gt(AT,t)});return{name:t.name,items:n}}),L(o,function(t){return 0<t.items.length})):k(r)?(n=r.split("|"),P(n,function(t){return{items:t.trim().split(" ")}})):D(r,function(t){return gt(t,"name")&>(t,"items")})?r:(F.console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},MT=function(n,e,o,r,t){return mt(e,o.toLowerCase()).orThunk(function(){return t.bind(function(t){return yu(t,function(t){return mt(e,t+o.toLowerCase())})})}).fold(function(){return mt(AT,o.toLowerCase()).map(function(t){return t(n,r)}).orThunk(function(){return et.none()})},function(t){return e=r,mt(DT,(n=t).type).fold(function(){return F.console.error("skipping button defined by",n),et.none()},function(t){return et.some(t(n,e))});var n,e})},FT=function(e,o,r,i){var t=_T(o),n=P(t,function(t){var n=K(t.items,function(t){return 0===t.trim().length?[]:MT(e,o.buttons,t,r,i).toArray()});return{title:et.from(e.translate(t.name)),items:n}});return L(n,function(t){return 0<t.items.length})},IT=function(v,t,e,s){var o,r,l=lu((o={sink:e,onEscape:function(){return v.focus(),et.some(!0)}},r=se([]),xg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){r.set([]),xg.getContent(t).each(function(t){Ji(t.element(),"visibility")}),Hi(t.element(),oT),Ji(t.element(),"width")},inlineBehaviours:Gu([Vm("context-toolbar-events",[wr(po(),function(t,n){xg.getContent(t).each(function(t){}),Hi(t.element(),oT),Ji(t.element(),"width")}),gr(eT,function(n,e){Ji(n.element(),"width");var t=fa(n.element());xg.setContent(n,e.event().contents()),Vi(n.element(),oT);var o=fa(n.element());Gi(n.element(),"width",t+"px"),xg.getContent(n).each(function(t){e.event().focus().bind(function(t){return Nf(t),Pf(n.element())}).orThunk(function(){return vm.focusIn(t),Hf()})}),Bg.setTimeout(function(){Gi(n.element(),"width",o+"px")},0)}),gr(tT,function(t,n){xg.getContent(t).each(function(t){r.set(r.get().concat([{bar:t,focus:Hf()}]))}),jo(t,eT,{contents:n.event().forwardContents(),focus:et.none()})}),gr(nT,function(n,t){rt(r.get()).each(function(t){r.set(r.get().slice(0,r.get().length-1)),jo(n,eT,{contents:fu(t.bar),focus:t.focus})})})]),vm.config({mode:"special",onEscape:function(n){return rt(r.get()).fold(function(){return o.onEscape()},function(t){return Lo(n,nT),et.some(!0)})}})]),lazySink:function(){return R.value(o.sink)}}))),b=mb(v)||gb(v)||hb(v),f=function(){var t,n,e,o,r,i,u,a,c,s,l,f,d,m,g,p=Xa(),h=ha(fe.fromDom(v.getContentAreaContainer()));return v.inline&&!b?et.some((d=rT(0,f=p,h),m=d.x,g=d.width,pa(m,f.top(),g,F.window.innerHeight))):v.inline?et.some(function(t,n,e){var o=rT(0,n,e),r=o.x,i=o.width,u=ha(fe.fromDom(t.getContainer())),a=F.window.innerHeight,c=n.top();if(u.y()>=e.bottom()){var s=Math.min(a+c,u.y());return pa(r,c,i,s-c)}var l=Math.max(c,u.bottom());return pa(r,l,i,a-(l-c))}(v,p,h)):et.some((t=v,o=rT(0,n=p,e=h),r=o.x,i=o.width,u=ha(fe.fromDom(t.getContainer())),a=Math.max(n.top(),e.y()),c=u.bottom()-a,s=F.window.innerHeight-(a-n.top()),l=Math.min(c,s),pa(r,a,i,l)))},d=function(){var t,n=g.get().map(function(t){return t.getBoundingClientRect()}).getOr(v.selection.getRng().getBoundingClientRect()),e=_r(fe.fromDom(v.getBody())).dom().innerHeight,o=n.bottom<(t="fixed"===Yi(fe.fromDom(v.getContainer()),"position"),b&&t?v.getContainer().getBoundingClientRect().bottom:0),r=n.top>e;return o||r},i=function(){m.get().each(function(t){var n=l.element();Ji(n,"display"),d()?Gi(n,"display","none"):Ms.positionWithinBounds(e,t,l,f())})};v.on("init",function(){if(v.on("ScrollWindow",i),!v.inline){var t=_r(fe.fromDom(v.getBody())),n=Lv(t,"scroll",i);v.on("remove",function(){n.unbind()})}});var m=se(et.none()),g=se(et.none()),n=se(null),p=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:Gu([vm.config({mode:"acyclic"}),Vm("pop-dialog-wrap-events",[Sr(function(t){v.shortcuts.add("ctrl+F9","focus statusbar",function(){return vm.focusIn(t)})}),Cr(function(t){v.shortcuts.remove("ctrl+F9")})])])}},u=xt(function(){return aT(t,function(t){var n=h(t);jo(l,tT,{forwardContents:p(n)})})}),h=function(t){var n,e,o=v.ui.registry.getAll().buttons,r=u();return"contexttoolbar"===t.type?(n=yt(o,r.formNavigators),e=FT(v,{buttons:n,toolbar:t.items},s,et.some(["form:"])),fE({uid:ri("context-toolbar"),initGroups:e,onEscape:et.none,cyclicKeying:!0,backstage:s.backstage,getSink:function(){return R.error("")}})):ZE(t,s.backstage)};v.on("contexttoolbar-show",function(n){var t=u();Ft(t.lookupTable,n.toolbarKey).each(function(t){w(t,n.target===v?et.none():et.some(n)),xg.getContent(l).each(vm.focusIn)})});var a={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"]},c={maxHeightFunction:Cs()},y={bubble:ba(12,0,a),layouts:{onLtr:function(){return[ja]},onRtl:function(){return[Ua]}},overrides:c},x={bubble:ba(0,12,a),layouts:{onLtr:function(){return[za,La,Ha,Va,Pa,Na,Tk,Bk,Ok,Ck,Ek,kk]},onRtl:function(){return[za,La,Pa,Na,Ha,Va,Tk,Bk,Ek,kk,Ok,Ck]}},overrides:c},w=function(t,n){C();var e,o,r,i=h(t),u=n.map(fe.fromDom),a=(e=t.position,o=u,r="node"===e?s.backstage.shared.anchors.node(o):s.backstage.shared.anchors.cursor(),bt(r,"line"===e?y:x));m.set(et.some(a)),g.set(n);var c=l.element();Ji(c,"display"),xg.showWithinBounds(l,a,p(i),f()),d()&&Gi(c,"display","none")},S=function(){var t=u();uT(t,v).fold(function(){m.set(et.none()),xg.hide(l)},function(t){w(t.toolbarApi,et.some(t.elem.dom()))})},C=function(){var t=n.get();null!==t&&(Bg.clearTimeout(t),n.set(null))},k=function(t){C(),n.set(t)};v.on("init",function(){v.on("click keyup SetContent ObjectResized ResizeEditor",function(t){k(Bg.setEditorTimeout(v,S,0))}),v.on("focusout",function(t){Bg.setEditorTimeout(v,function(){Pf(e.element()).isNone()&&Pf(l.element()).isNone()&&(m.set(et.none()),xg.hide(l))},0)}),v.on("SwitchMode",function(){v.readonly&&(m.set(et.none()),xg.hide(l))}),v.on("NodeChange",function(t){Pf(l.element()).fold(function(){k(Bg.setEditorTimeout(v,S,0))},function(t){})})})},RT=function(t,e,o){var n=Lv(fe.fromDom(F.document),"mousedown",function(n){z([e,o],function(t){t.broadcastOn([Qs()],{target:n.target()})})}),r=Lv(fe.fromDom(F.document),"touchstart",function(n){z([e,o],function(t){t.broadcastOn([Qs()],{target:n.target()})})}),i=Lv(fe.fromDom(F.document),"mouseup",function(n){0===n.raw().button&&z([e,o],function(t){t.broadcastOn([Zs()],{target:n.target()})})}),u=function(n){z([e,o],function(t){t.broadcastOn([Qs()],{target:fe.fromDom(n.target)})})};t.on("mousedown",u),t.on("touchstart",u);var a=function(n){0===n.button&&z([e,o],function(t){t.broadcastOn([Zs()],{target:fe.fromDom(n.target)})})};t.on("mouseup",a);var c=function(n){z([e,o],function(t){t.broadcastEvent(Ao(),n)})};t.on("ScrollWindow",c);var s=function(n){z([e,o],function(t){t.broadcastEvent(_o(),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(){js(e),js(o),e.destroy(),o.destroy()})},VT=nt([te("shell",!1),zn("makeItem"),te("setupItem",tt),ul("listBehaviours",[Sm])]),NT=Fl({name:"items",overrides:function(t){return{behaviours:Gu([Sm.config({})])}}}),HT=nt([NT]),PT=sf({name:nt("CustomList")(),configFields:VT(),partFields:HT(),factory:function(s,t,n,e){var o=s.shell?{behaviours:[Sm.config({})],components:[]}:{behaviours:[],components:t},r=function(t){return s.shell?et.some(t):Gl(t,s,"items")};return{uid:s.uid,dom:s.dom,components:o.components,behaviours:il(s.listBehaviours,o.behaviours),apis:{setItems:function(a,c){r(a).fold(function(){throw F.console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},function(n){var t=Sm.contents(n),e=c.length,o=e-t.length,r=0<o?function(t,n){for(var e=[],o=0;o<t;o++)e.push(n(o));return e}(o,function(){return s.makeItem()}):[],i=t.slice(e);z(i,function(t){return Sm.remove(n,t)}),z(r,function(t){return Sm.append(n,t)});var u=Sm.contents(n);z(u,function(t,n){s.setupItem(a,t,c[n],n)})})}}}},apis:{setItems:function(t,n,e){t.setItems(n,e)}}}),zT=Zl,LT=Vl,jT=cf({factory:function(n,o){var t={focus:vm.focusIn,setMenus:function(t,n){var e=P(n,function(n){var t={type:"menubutton",text:n.text,fetch:function(t){t(n.getItems())}},e=vE(t).mapError(function(t){return _n(t)}).getOrDie();return lC(e,"tox-mbtn",o.backstage,et.some("menuitem"))});Sm.set(t,e)}};return{uid:n.uid,dom:n.dom,components:[],behaviours:Gu([Sm.config({}),Vm("menubar-events",[Sr(function(t){n.onSetup(t)}),gr(uo(),function(e,t){mu(e.element(),".tox-mbtn--active").each(function(n){gu(t.event().target(),".tox-mbtn").each(function(t){Ke(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){zy.expand(t),zy.close(n),Lm.focus(t)})})})})}),gr(Ro(),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){zy.isOpen(n)&&(zy.expand(t),zy.close(n))})})})]),vm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return n.onEscape(t),et.some(!0)}}),Ny.config({})]),apis:t,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[zn("dom"),zn("uid"),zn("onEscape"),zn("backstage"),te("onSetup",tt)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),UT="container",WT=[ol("slotBehaviours",[])],GT=function(t){return"<alloy.field."+t+">"},XT=function(r,t,n){var e,o=function(t){return Kl(r)},i=function(e,o){return void 0===o&&(o=undefined),function(t,n){return Gl(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},u=function(t,n){return"true"!==Kr(t.element(),"aria-hidden")},a=i(u,!1),c=i(function(t,n){if(u(t)){var e=t.element();Gi(e,"display","none"),Yr(e,"aria-hidden","true"),jo(t,Vo(),{name:n,visible:!1})}}),s=(e=c,function(n,t){z(t,function(t){return e(n,t)})}),l=i(function(t,n){if(!u(t)){var e=t.element();Ji(e,"display"),Jr(e,"aria-hidden"),jo(t,Vo(),{name:n,visible:!0})}}),f={getSlotNames:o,getSlot:function(t,n){return Gl(t,r,n)},isShowing:a,hideSlot:c,hideAllSlots:function(t){return s(t,o())},showSlot:l};return{uid:r.uid,dom:r.dom,components:t,behaviours:rl(r.slotBehaviours),apis:f}},YT=st({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)}},yi),qT=I({},YT,{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),zl(UT,GT(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=P(r,function(t){return _l({name:t,pname:GT(t)})});return nf(UT,WT,i,XT,o)}}),KT=pn([Jn("icon"),Jn("tooltip"),ue("onShow",tt),ue("onHide",tt),ue("onSetup",function(){return tt})]),$T=function(t){return{element:function(){return t.element().dom()}}},JT=function(e,o){var r=P(ut(o),function(t){var n=o[t],e=Dn(Bn("sidebar",KT,n));return{name:t,getApi:$T,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return P(r,function(t){var n=se(tt);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:sp([rh(t,n),ih(t,n),gr(Vo(),function(n,t){var e=t.event();W(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},QT=function(t,e){mf.getCurrent(t).each(function(t){return Sm.set(t,[(n=e,qT.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:JT(t,n),slotBehaviours:sp([Sr(function(t){return qT.hideAllSlots(t)})])}}))]);var n})},ZT=function(t){return mf.getCurrent(t).bind(function(t){return YO.isGrowing(t)||YO.hasGrown(t)?mf.getCurrent(t).bind(function(n){return W(qT.getSlotNames(n),function(t){return qT.isShowing(n,t)})}):et.none()})},tB=ri("FixSizeEvent"),nB=ri("AutoSizeEvent"),eB=function(t,n,e){var o,r=t.element();!0===n?(Sm.set(t,[(o=e,{dom:{tag:"div",attributes:{"aria-label":o.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:bp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:Gu([vm.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),Lm.config({})])})]),Ji(r,"display"),Jr(r,"aria-hidden")):(Sm.set(t,[]),Gi(r,"display","none"),Yr(r,"aria-hidden","true"))},oB=LT.optional({factory:jT,name:"menubar",schema:[zn("backstage")]}),rB=LT.optional({factory:{sketch:function(t){return PT.sketch({uid:t.uid,dom:t.dom,listBehaviours:Gu([vm.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:function(){return fE({uid:ri("multiple-toolbar-item"),backstage:t.backstage,cyclicKeying:!1,getSink:t.getSink,initGroups:[],onEscape:function(){return et.none()}})},setupItem:function(t,n,e,o){gO.setGroups(n,e)},shell:!0})}},name:"multiple-toolbar",schema:[zn("dom"),zn("onEscape")]}),iB=LT.optional({factory:{sketch:function(t){var n;return((n=t).split===ub.sliding?lE:n.split===ub.floating?sE:fE)({uid:t.uid,onEscape:function(){return t.onEscape(),et.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,backstage:t.backstage,moreDrawerData:{lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton}})}},name:"toolbar",schema:[zn("dom"),zn("onEscape"),zn("getSink")]}),uB=LT.optional({name:"socket",schema:[zn("dom")]}),aB=LT.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:Gu([Ny.config({}),Lm.config({}),YO.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){mf.getCurrent(t).each(qT.hideAllSlots),Lo(t,nB)},onGrown:function(t){Lo(t,nB)},onStartGrow:function(t){jo(t,tB,{width:Ki(t.element(),"width").getOr("")})},onStartShrink:function(t){jo(t,tB,{width:fa(t.element())+"px"})}}),Sm.config({}),mf.config({find:function(t){var n=Sm.contents(t);return ot(n)}})])}],behaviours:Gu([Kw(0),Vm("sidebar-sliding-events",[gr(tB,function(t,n){Gi(t.element(),"width",n.event().width())}),gr(nB,function(t,n){Ji(t.element(),"width")})])])}}},name:"sidebar",schema:[zn("dom")]}),cB=LT.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:Gu([Sm.config({})]),components:[]}}},name:"throbber",schema:[zn("dom")]}),sB=sf({name:"OuterContainer",factory:function(e,t,n){var o={getSocket:function(t){return zT.getPart(t,e,"socket")},setSidebar:function(t,n){zT.getPart(t,e,"sidebar").each(function(t){return QT(t,n)})},toggleSidebar:function(t,o){zT.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void mf.getCurrent(n).each(function(n){mf.getCurrent(n).each(function(t){YO.hasGrown(n)?qT.isShowing(t,e)?YO.shrink(n):(qT.hideAllSlots(t),qT.showSlot(t,e)):(qT.hideAllSlots(t),qT.showSlot(t,e),YO.grow(n))})});var n,e})},whichSidebar:function(t){return zT.getPart(t,e,"sidebar").bind(ZT).getOrNull()},getToolbar:function(t){return zT.getPart(t,e,"toolbar")},setToolbar:function(t,n){zT.getPart(t,e,"toolbar").each(function(t){t.getApis().setGroups(t,n)})},setToolbars:function(t,n){zT.getPart(t,e,"multiple-toolbar").each(function(t){PT.setItems(t,n)})},refreshToolbar:function(t){zT.getPart(t,e,"toolbar").each(function(t){return t.getApis().refresh(t)})},getMoreButton:function(t){return zT.getPart(t,e,"toolbar").bind(function(t){return t.getApis().getMoreButton(t)})},getThrobber:function(t){return zT.getPart(t,e,"throbber")},focusToolbar:function(t){zT.getPart(t,e,"toolbar").orThunk(function(){return zT.getPart(t,e,"multiple-toolbar")}).each(function(t){vm.focusIn(t)})},setMenubar:function(t,n){zT.getPart(t,e,"menubar").each(function(t){jT.setMenus(t,n)})},focusMenubar:function(t){zT.getPart(t,e,"menubar").each(function(t){jT.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:o,behaviours:e.behaviours}},configFields:[zn("dom"),zn("behaviours")],partFields:[oB,iB,rB,uB,aB,cB],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=P(e,function(t){return uE(t)});t.setToolbar(n,o)},setToolbars:function(t,n,e){var o=P(e,function(t){return P(t,uE)});t.setToolbars(n,o)},getMoreButton:function(t,n){return t.getMoreButton(n)},refreshToolbar:function(t,n){return t.refreshToolbar(n)},getThrobber:function(t,n){return t.getThrobber(n)},setMenubar:function(t,n,e){t.setMenubar(n,e)},focusMenubar:function(t,n){t.focusMenubar(n)},focusToolbar:function(t,n){t.focusToolbar(n)}}}),lB={file:{title:"File",items:"newdocument restoredraft | preview | print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align | forecolor backcolor | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck code wordcount"},table:{title:"Table",items:"inserttable tableprops deletetable row column cell"},help:{title:"Help",items:"help"}},fB=function(t){return"string"==typeof t?t.split(" "):t},dB=function(u,a){var c=yt(lB,a.menus),n=0<ut(a.menus).length,t=a.menubar===undefined||!0===a.menubar?fB("file edit view insert format tools table help"):fB(!1===a.menubar?"":a.menubar),e=L(t,function(t){return n&&a.menus.hasOwnProperty(t)&&a.menus[t].hasOwnProperty("items")||lB.hasOwnProperty(t)}),o=P(e,function(t){var n,e,o,r,i=c[t];return n={title:i.title,items:fB(i.items)},e=a,r=(o=u,o.getParam("removed_menuitems","")).split(/[ ,]/),{text:n.title,getItems:function(){return K(n.items,function(t){var n=t.toLowerCase();return 0===n.trim().length?[]:N(r,function(t){return t===n})?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]})}}});return L(o,function(t){return 0<t.getItems().length&&N(t.getItems(),function(t){return"separator"!==t.type})})},mB=function(t){var n=function(){t._skinLoaded=!0,qh(t)};return function(){t.initialized?n():t.on("init",n)}},gB=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):lb.baseURL+"/skins/ui/"+r}return o}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),!1==(!1===n.getParam("skin"))&&e?fh.DOM.styleSheetLoader.load(e,mB(n)):mB(n)()},pB=g(gB,!1),hB=g(gB,!0),vB=function(n,t,e,o){var r=t.outerContainer,i=e.toolbar,u=e.buttons;if(D(i,k)){var a=i.map(function(t){return FT(n,{toolbar:t,buttons:u},{backstage:o},et.none())});sB.setToolbars(r,a)}else sB.setToolbar(r,FT(n,e,{backstage:o},et.none()))},bB=fh.DOM,yB={render:function(e,o,t,n,r){var i,u,a=se(0);pB(e),i=fe.fromDom(r.targetNode),u=o.mothership,Ls(i,u,Nr),zs(ir(),o.uiMothership),e.on("init",function(){vB(e,o,t,n),a.set(e.getWin().innerWidth),sB.setMenubar(o.outerContainer,dB(e,t)),sB.setSidebar(o.outerContainer,t.sidebar),function(o){var r=o.getWin(),t=o.getDoc().documentElement,i=se(ea(r.innerWidth,r.innerHeight)),u=se(ea(t.offsetWidth,t.offsetHeight)),n=function(){var t=o.getDoc().documentElement,n=i.get(),e=u.get();n.left()!==r.innerWidth||n.top()!==r.innerHeight?(i.set(ea(r.innerWidth,r.innerHeight)),$h(o)):e.left()===t.offsetWidth&&e.top()===t.offsetHeight||(u.set(ea(t.offsetWidth,t.offsetHeight)),$h(o))};bB.bind(r,"resize",n);var e=jv(fe.fromDom(o.getBody()),"load",n);o.on("remove",function(){e.unbind(),bB.unbind(r,"resize",n)})}(e)});var c=sB.getSocket(o.outerContainer).getOrDie("Could not find expected socket element");oE(e,o),e.addCommand("ToggleSidebar",function(t,n){sB.toggleSidebar(o.outerContainer,n),e.fire("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",function(){return sB.whichSidebar(o.outerContainer)});var s=yb(e);return s!==ub.sliding&&s!==ub.floating||e.on("ResizeContent",function(){var t=e.getWin().innerWidth;t!==a.get()&&sB.refreshToolbar(o.outerContainer),a.set(t)}),{iframeContainer:c.element().dom(),editorContainer:o.outerContainer.element().dom()}},getBehaviours:function(t){return[]}},xB=function(e,n){return Fr(e).orThunk(function(){var t=fe.fromTag("span");Vr(e,t);var n=Fr(t);return jr(t),n}).map(function(t){return ra(t).translate(-n.left(),-n.top())}).getOrThunk(function(){return ea(0,0)})},wB=pt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),SB=function(n){return function(t){return t.translate(-n.left(),-n.top())}},CB=function(n){return function(t){return t.translate(n.left(),n.top())}},kB=function(e){return function(t,n){return U(e,function(t,n){return n(t)},ea(t,n))}},OB=function(t,n,e){return t.fold(kB([CB(e),SB(n)]),kB([SB(n)]),kB([]))},EB=function(t,n,e){return t.fold(kB([CB(e)]),kB([]),kB([CB(n)]))},TB=function(t,n,e){return t.fold(kB([]),kB([SB(e)]),kB([CB(n),SB(e)]))},BB=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"}})},DB=wB.offset,AB=wB.absolute,_B=wB.fixed,MB=function(t,n){Vi(t.element(),n.transitionClass),Hi(t.element(),n.fadeOutClass),Vi(t.element(),n.fadeInClass)},FB=function(t,n){Vi(t.element(),n.transitionClass),Hi(t.element(),n.fadeInClass),Vi(t.element(),n.fadeOutClass)},IB=function(t,n){return t.y()>=n.y()&&t.bottom()<=n.bottom()},RB=function(t,n){return $r(t,n)?et.some(parseInt(Kr(t,n),10)):et.none()},VB=function(o,r,i){return(u=o,t=r,n=u.element(),RB(n,t.leftAttr).bind(function(o){return RB(n,t.topAttr).map(function(t){var n=fa(u.element()),e=ca(u.element());return pa(o,t,n,e)})})).bind(function(t){return IB(t,i)?(n=r,e=o.element(),Jr(e,n.leftAttr),Jr(e,n.topAttr),et.some(AB(t.x(),t.y()))):et.none();var n,e});var u,t,n},NB=function(t,n,e,o,r){var i=ra(t.element()),u=pa(i.left(),i.top(),fa(t.element()),ca(t.element()));if(IB(u,e))return et.none();a=t,c=n,s=i.left(),l=i.top(),f=a.element(),Yr(f,c.leftAttr,s),Yr(f,c.topAttr,l);var a,c,s,l,f,d=AB(i.left(),i.top()),m=OB(d,o,r),g=AB(e.x(),e.y()),p=OB(g,o,r),h=u.y()<=e.y()?p.top():p.top()+e.height()-u.height();return et.some(_B(m.left(),h))},HB=function(i,t,n){var u=t.lazyViewport(i);t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=ha(t);((e=u,(n=o).y()<e.bottom()&&n.bottom()>e.y())?MB:FB)(i,r)})});var e,o,r,a,c,s=Ar(i.element()),l=Xa(s),f=xB(i.element(),l);(e=i,o=t,r=u,a=l,c=f,Ki(e.element(),"position").is("fixed")?VB(e,o,r):NB(e,o,r,a,c)).each(function(t){var n=BB(t,0,f);Xi(i.element(),n)})},PB=/* */Object.freeze({refresh:HB}),zB=/* */Object.freeze({events:function(o,t){return fr([gr(po(),function(n,e){o.contextual.each(function(t){Ke(n.element(),e.event().target())&&(Hi(n.element(),t.transitionClass),e.stop())})}),gr(Ao(),function(t,n){HB(t,o)})])}}),LB=[Zn("contextual",[zn("fadeInClass"),zn("fadeOutClass"),zn("transitionClass"),zn("lazyContext")]),te("lazyViewport",function(t){var n=Xa();return pa(n.left(),n.top(),F.window.innerWidth,F.window.innerHeight)}),zn("leftAttr"),zn("topAttr")],jB=Yu({fields:LB,name:"docking",active:zB,apis:PB}),UB={render:function(o,n,e,r,t){var i,u=fh.DOM,a=wb(o),c=yb(o),s=c===ub.sliding||c===ub.floating;hB(o);var l=function(t){var n=Ki(i.element(),"position").is("fixed"),e=function(t){void 0===t&&(t=0);var n=ra(fe.fromDom(o.getBody()));return{top:Math.round(n.top()-ca(i.element()))+t,left:Math.round(n.left())}}(s?t.fold(function(){return 0},function(t){return 1<t.components().length?ca(t.components()[1].element()):0}):0);n?qr(i.element(),lt(e,function(t,n){return{k:"data-dock-"+n,v:t}})):Xi(i.element(),st(e,function(t){return t+"px"})),jB.refresh(i)},f=function(){var t=sB.getToolbar(n.outerContainer);s&&sB.refreshToolbar(n.outerContainer),a||l(t)},d=function(){Gi(n.outerContainer.element(),"display","flex"),u.addClass(o.getBody(),"mce-edit-focus"),Ji(n.uiMothership.element(),"display"),f()},m=function(){n.outerContainer&&(Gi(n.outerContainer.element(),"display","none"),u.removeClass(o.getBody(),"mce-edit-focus")),Gi(n.uiMothership.element(),"display","none")},g=function(){if(i)d();else{i=n.outerContainer;var t=xb(o).getOr(ir());zs(t,n.mothership),zs(t,n.uiMothership),vB(o,n,e,r),sB.setMenubar(n.outerContainer,dB(o,e)),a||Gi(i.element(),"position","absolute"),f(),d(),o.on("NodeChange ResizeWindow",f),o.on("activate",d),o.on("deactivate",m),o.nodeChanged()}};return o.on("focus",g),o.on("blur hide",m),o.on("init",function(){o.hasFocus()&&g()}),oE(o,n),{editorContainer:n.outerContainer.element().dom()}},getBehaviours:function(n){return wb(n)?[]:[jB.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(t){return et.from(n).map(function(t){return fe.fromDom(t.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),Lm.config({})]}},WB=function(n){VC.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:cT(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})},GB=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},XB=function(t){var n,e;!function(e){VC.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:cT(e,t.name),onAction:GB(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:cT(e,n),onAction:GB(e,n)})}}(t),n=t,VC.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,VC.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:cT(e,t.name)})})},YB=function(t){var n;XB(t),n=t,VC.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:GB(n,"code")})},qB=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)}},KB=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return qB(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 qB(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return qB(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return qB(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},$B=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")}})},QB=function(t,n){var e,o,r,i,u,a,c,s,l,f,d,m,g,p,h,v,b,y,x,w;o=n,r=hT(e=t),i=lT(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=yT(u=t),s=lT(0,a,c.dataset,c),u.ui.registry.addNestedMenuItem("fontformats",{text:a.shared.providers.translate("Fonts"),getSubmenuItems:function(){return s.items.validateItems(s.getStyleItems())}}),l=t,d=(f=n).styleselect,m=lT(0,f,d,ET(l)),l.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=n,h=OT(g=t),v=lT(0,p,h.dataset,h),g.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return v.items.validateItems(v.getStyleItems())}}),y=n,x=ST(b=t),w=lT(0,y,x.dataset,x),b.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return w.items.validateItems(w.getStyleItems())}})},ZB=function(t,n){WB(t),YB(t),QB(t,n),KB(t),cv.register(t),$B(t),JB(t)},tD=function(t,n){return{anchor:"makeshift",x:t,y:n}},nD=function(t,n){var e,o,r,i=fh.DOM.getPos(t);return e=n,o=i.x,r=i.y,tD(e.x+o,e.y+r)},eD=function(t,n){return"contextmenu"===n.type?t.inline?tD((o=n).pageX,o.pageY):nD(t.getContentAreaContainer(),tD((e=n).clientX,e.clientY)):oD(t);var e,o},oD=function(t){return{anchor:"selection",root:fe.fromDom(t.selection.getNode())}},rD=function(t){return"string"==typeof t?t.split(/[ ,]/):t},iD=function(t){return t.settings.contextmenu_never_use_native||!1},uD=function(t){return e="contextmenu",o="link linkchecker image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,mt(n.settings,e).map(rD).getOrThunk(function(){return L(rD(o),function(t){return gt(r,t)})});var n,e,o,r},aD=function(t){return!1===t.getParam("contextmenu")},cD=function(t){return k(t)?"|"===t:"separator"===t.type},sD={type:"separator"},lD=function(n){if(k(n))return n;switch(n.type){case"separator":return sD;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return k(t)?t:P(t,lD)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:(t=n.onAction,function(){return t()})}}var t},fD=function(t,n){if(0===n.length)return t;var e=rt(t).filter(function(t){return!cD(t)}).fold(function(){return[]},function(t){return[sD]});return t.concat(e).concat(n).concat([sD])},dD=function(d,t,m){var g=lu(xg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return d.focus()},fireDismissalEventInstead:{},inlineBehaviours:Gu([Vm("dismissContextMenu",[gr(Io(),function(t,n){Js.close(t),d.focus()})])])}));d.on("init",function(){d.on("contextmenu",function(n){if(iD(d)&&n.preventDefault(),t=d,!(n.ctrlKey&&!iD(t)||aD(d))){var t,e,r,i,o,u=2!==n.button||n.target===d.getBody(),a=u?(e=d,{anchor:"node",node:et.some(fe.fromDom(e.selection.getNode())),root:fe.fromDom(e.getBody())}):eD(d,n),c=d.ui.registry.getAll(),s=uD(d),l=u?d.selection.getStart(!0):n.target,f=(r=c.contextMenus,i=l,0<(o=U(s,function(t,n){if(gt(r,n)){var e=r[n].update(i);if(k(e))return fD(t,e.split(" "));if(0<e.length){var o=P(e,lD);return fD(t,o)}return t}return t.concat([n])},[])).length&&cD(o[o.length-1])&&o.pop(),o);Cy(f,uh.CLOSE_ON_EXECUTE,m).map(function(t){n.preventDefault(),xg.showMenuAt(g,a,{menu:{markers:dv("normal")},data:t})})}})})},mD=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?et.some(parseInt(t,10)):et.none()},gD=function(t){return V(t)?t+"px":t},pD="data-initial-z-index",hD=function(t,n){var e;t.getSystem().addToGui(n),Mr((e=n).element()).each(function(n){Ki(n,"z-index").each(function(t){Yr(n,pD,t)}),Gi(n,"z-index",Yi(e.element(),"z-index"))})},vD=function(t){Mr(t.element()).each(function(t){var n=Kr(t,pD);$r(t,pD)?Gi(t,"z-index",n):Ji(t,"z-index"),Jr(t,pD)}),t.getSystem().removeFromGui(t)},bD=function(t,n,e,o){return(r=t,i=n,u=r.element(),a=parseInt(Kr(u,i.leftAttr),10),c=parseInt(Kr(u,i.topAttr),10),isNaN(a)||isNaN(c)?et.none():et.some(ea(a,c))).fold(function(){return e},function(t){return _B(t.left()+o.left(),t.top()+o.top())});var r,i,u,a,c},yD=function(t,n,e,o,r,i){var u,a,c,s=bD(t,n,e,o),l=wD(t,n,s,r,i),f=OB(s,r,i);return u=n,a=f,c=t.element(),Yr(c,u.leftAttr,a.left()+"px"),Yr(c,u.topAttr,a.top()+"px"),l.fold(function(){return{coord:_B(f.left(),f.top()),extra:et.none()}},function(t){return{coord:t.output(),extra:t.extra()}})},xD=function(t,n){var e,o;e=n,o=t.element(),Jr(o,e.leftAttr),Jr(o,e.topAttr)},wD=function(t,n,p,h,v){var e=n.getSnapPoints(t);return yu(e,function(t){var n,e,o,r,i,u,a,c,s,l,f,d,m,g=t.sensor();return(n=p,e=g,o=t.range().left(),r=t.range().top(),a=EB(n,i=h,u=v),c=EB(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r)?et.some({output:nt((s=t.output(),l=p,f=h,d=v,m=function(o,r){return function(t,n){var e=o(l,f,d);return r(t.getOr(e.left()),n.getOr(e.top()))}},s.fold(m(TB,wB.offset),m(EB,wB.absolute),m(OB,wB.fixed)))),extra:t.extra}):et.none()})},SD=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 wB.offset(t+e,n+o)},function(t,n){return wB.absolute(t+e,n+o)},function(t,n){return wB.fixed(t+e,n+o)})),r=OB(n,u,a);return _B(r.left(),r.top())},function(n){var t=yD(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord})},CD=function(t,n,e){var o,r=n.getTarget(t.element());if(n.repositionTarget){var i=Ar(t.element()),u=Xa(i),a=xB(r,u),c=Ki(o=r,"left").bind(function(e){return Ki(o,"top").bind(function(n){return Ki(o,"position").map(function(t){return("fixed"===t?_B:DB)(parseInt(e,10),parseInt(n,10))})})}).getOrThunk(function(){var t=ra(o);return AB(t.left(),t.top())}),s=SD(t,n.snaps,c,u,a,e),l=BB(s,0,a);Xi(r,l)}n.onDrag(t,r,e)},kD=Zn("snaps",[zn("getSnapPoints"),Fu("onSensor"),zn("leftAttr"),zn("topAttr"),te("lazyViewport",function(){var t=Xa();return{x:t.left,y:t.top,width:nt(F.window.innerWidth),height:nt(F.window.innerHeight),bottom:nt(t.top()+F.window.innerHeight),right:nt(t.left()+F.window.innerWidth)}})]),OD=/* */Object.freeze({getData:function(t){return et.from(ea(t.x(),t.y()))},getDelta:function(t,n){return ea(n.left()-t.left(),n.top()-t.top())}}),ED=[te("useFixed",!1),zn("blockerClass"),te("getTarget",d),te("onDrag",tt),te("repositionTarget",!0),Fu("onDrop"),kD,Nu("dragger",{handlers:function(a,c){return fr([gr(eo(),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(OD,t).each(function(t){CD(n,a,t)})}},r=n.getSystem().build(cb.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[a.blockerClass]},events:(e=o,fr([gr(eo(),e.forceDrop),gr(io(),e.drop),gr(oo(),function(t,n){e.move(n.event())}),gr(ro(),e.delayDrop)]))})),i=function(){vD(r),a.snaps.each(function(t){xD(n,t)});var t=a.getTarget(n.element());a.onDrop(n,t)},u=Wv(i,200);c.reset(),hD(n,r)}})])}})],TD=/* */Object.freeze({getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],et.some(ea(n.clientX,n.clientY))):et.none()},getDelta:function(t,n){return ea(n.left()-t.left(),n.top()-t.top())}}),BD=ED,DD=[te("useFixed",!1),te("getTarget",d),te("onDrag",tt),te("repositionTarget",!0),te("onDrop",tt),kD,Nu("dragger",{handlers:function(o,r){return fr([xr(Ze()),gr(to(),function(n,t){t.stop(),r.update(TD,t.event()).each(function(t){CD(n,o,t)})}),gr(no(),function(n,t){o.snaps.each(function(t){xD(n,t)});var e=o.getTarget(n.element());r.reset(),o.onDrop(n,e)})])}})],AD=/* */Object.freeze({mouse:BD,touch:DD}),_D=/* */Object.freeze({init:function(){var i=et.none(),t=nt({});return wi({readState:t,reset:function(){i=et.none()},update:function(r,t){return r.getData(t).bind(function(t){return n=r,e=t,o=i.map(function(t){return n.getDelta(t,e)}),i=et.some(e),o;var n,e,o})}})}}),MD=Ku({branchKey:"mode",branches:AD,name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:Dr(["sensor","range","output"],["extra"])},state:_D});(mT=dT||(dT={}))[mT.None=0]="None",mT[mT.Both=1]="Both",mT[mT.Vertical=2]="Vertical";var FD,ID,RD,VD=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)},ND=function(t,n,e,o,r){var i,u,a={};return a.height=VD(o,n.top(),db(t),(i=t,et.from(i.getParam("max_height")).filter(V))),e===dT.Both&&(a.width=VD(r,n.left(),fb(t),(u=t,et.from(u.getParam("max_width")).filter(V)))),a},HD=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},PD=function(i,u){u.delimiter||(u.delimiter="\xbb");return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Gu([vm.config({mode:"flow",selector:"div[role=button]"}),Ny.config({}),Sm.config({}),Vm("elementPathEvents",[Sr(function(r,t){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return vm.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&&!HD(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&&Sm.set(r,(n=P(e||[],function(n,t){return Sg.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:[]}},zD=function(s,u){var t,n,e,o,r,i=function(c){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:u.translate("Resize")},innerHtml:Og("resize-handle",u.icons)},behaviours:Gu([MD.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){var o,r,i,u,a;o=s,r=e,i=c,u=fe.fromDom(o.getContainer()),a=ND(o,r,i,ca(u),fa(u)),ct(a,function(t,n){return Gi(u,n,gD(t))}),Kh(o)},blockerClass:"tox-blocker"})])}};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(o=function(){var t,o,n,r,e,i=[];return s.getParam("elementpath",!0,"boolean")&&i.push(PD(s,{})),Fe(s.settings.plugins,"wordcount")&&i.push((t=s,o=u,r=function(t,n,e){return Sm.set(t,[au(o.translate(["{0} "+e,n[e]]))])},Sg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Gu([Ny.config({}),Sm.config({}),Rm.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Vm("wordcount-events",[gr(Oo(),function(t){var n=Rm.getValue(t),e="words"===n.mode?"characters":"words";Rm.setValue(t,{mode:e,count:n.count}),r(t,n.count,e)}),Sr(function(e){t.on("wordCountUpdate",function(t){var n=Rm.getValue(e).mode;Rm.setValue(e,{mode:n,count:t.wordCount}),r(e,t.wordCount,n)})})])]),eventOrder:(n={},n[Oo()]=["wordcount-events","alloy.base.behaviour"],n)}))),s.getParam("branding",!0,"boolean")&&i.push({dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:'<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&utm_medium=poweredby&utm_source=tinymce&utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="'+(e=yp.translate(["Powered by {0}","Tiny"]))+'">'+e+"</a>"}}),0<i.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:i}]:[]}(),n=!Fe((t=s).settings.plugins,"autoresize"),r=!1===(e=t.getParam("resize",n))?dT.None:"both"===e?dT.Both:dT.Vertical,r!==dT.None&&o.push(i(r)),o)}},LD=function(y){var t=y.getParam("inline",!1,"boolean"),x=t?UB:yB,n=et.none(),e=ze.detect().browser.isIE()?["tox-platform-ie"]:[],o=yp.isRtl()?{attributes:{dir:"rtl"}}:{},w=lu({dom:I({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(e)},o),behaviours:Gu([Ms.config({useFixed:!1})])}),r=Cg({dom:{tag:"div",classes:["tox-anchorbar"]}}),i=function(){return n.bind(function(t){return sB.getMoreButton(t)}).getOrDie("Could not find more button element")},S=function(){return n.bind(function(t){return sB.getThrobber(t)}).getOrDie("Could not find throbber element")},C=fO(w,y,function(){return n.bind(function(t){return r.getOpt(t)}).getOrDie("Could not find a anchor bar element")},i),k=function(){return R.value(w)},u=sB.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:C,onEscape:function(){y.focus()}}),a=function(t){return yb(t)},c=sB.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:k,backstage:C,onEscape:function(){y.focus()},split:a(y),lazyToolbar:function(){return n.bind(function(t){return sB.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:i}),s=sB.parts()["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},onEscape:function(){}}),l=sB.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),f=sB.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),d=sB.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:C}),m=y.getParam("statusbar",!0,"boolean")&&!t?et.some(zD(y,C.shared.providers)):et.none(),g={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[l,f]},p=hb(y),h=gb(y),v=mb(y),b=a(y)!==ub["default"],O=q([v?[u]:[],p?(b&&F.console.warn("Toolbar drawer cannot be applied when multiple toolbars are active"),[s]):h?[c]:[],wb(y)?[]:[r.asSpec()],t?[]:[g]]),E=q([[{dom:{tag:"div",classes:["tox-editor-container"]},components:O}],t?[]:m.toArray(),[d]]),T=t&&!v&&!h&&!p,B=I({role:"application"},yp.isRtl()?{dir:"rtl"}:{},T?{"aria-hidden":"true"}:{}),D=lu(sB.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(t?["tox-tinymce-inline"]:[]).concat(e),styles:I({visibility:"hidden"},T?{opacity:"0",border:"0"}:{}),attributes:B},components:E,behaviours:Gu(x.getBehaviours(y).concat([vm.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"})]))}));n=et.some(D),y.shortcuts.add("alt+F9","focus menubar",function(){sB.focusMenubar(D)}),y.shortcuts.add("alt+F10","focus toolbar",function(){sB.focusToolbar(D)});var A=sb(D),_=sb(w);RT(y,A,_);var M=function(t){var n,e=fh.DOM,o=y.getParam("width",e.getStyle(t,"width")),r=(n=y).getParam("height",Math.max(n.getElement().offsetHeight,200)),i=fb(y),u=db(y),a=mD(o).bind(function(n){return gD(i.map(function(t){return Math.max(n,t)}))}).getOr(gD(o)),c=mD(r).bind(function(n){return u.map(function(t){return Math.max(n,t)})}).getOr(r),s=gD(a);if($i("div","width",s)&&Gi(D.element(),"width",s),!y.inline){var l=gD(c);$i("div","height",l)?Gi(D.element(),"height",l):Gi(D.element(),"height","200px")}return c};return{mothership:A,uiMothership:_,backstage:C,renderUI:function(){var o,r,e,n,i,u,a,c;ZB(y,C),dD(y,k,C),r=(o=y).ui.registry.getAll().sidebars,z(ut(r),function(n){var t=r[n],e=function(){return et.from(o.queryCommandValue("ToggleSidebar")).is(n)};o.ui.registry.addToggleButton(n,{icon:t.icon,tooltip:t.tooltip,onAction:function(t){o.execCommand("ToggleSidebar",!1,n),t.setActive(e())},onSetup:function(t){var n=function(){return t.setActive(e())};return o.on("ToggleSidebar",n),function(){o.off("ToggleSidebar",n)}}})}),e=y,n=S,i=C.shared,u=se(!1),a=se(et.none()),c=function(t){t!==u.get()&&(eB(n(),t,i.providers),u.set(t))},e.on("ProgressState",function(t){if(a.get().each(Bg.clearTimeout),V(t.time)){var n=Bg.setEditorTimeout(e,function(){return c(t.state)},t.time);a.set(et.some(n))}else c(t.state),a.set(et.none())});var t=y.ui.registry.getAll(),s=t.buttons,l=t.menuItems,f=t.contextToolbars,d=t.sidebars,m=pb(y),g={menuItems:l,menus:y.settings.menu?st(y.settings.menu,function(t){return yt(t,{items:t.items})}):{},menubar:y.settings.menubar,toolbar:m.getOrThunk(function(){return y.getParam("toolbar",!0)}),buttons:s,sidebar:d};IT(y,f,w,{backstage:C});var p=y.getElement(),h=M(p),v={mothership:A,uiMothership:_,outerContainer:D},b={targetNode:p,height:h};return x.render(y,v,g,C,b)},getUi:function(){return{channels:{broadcastAll:_.broadcast,broadcastOn:_.broadcastOn,register:function(){}}}}}},jD=function(t,n){var e=et.from(Kr(t,"id")).fold(function(){var t=ri("dialog-label");return Yr(n,"id",t),t},d);Yr(t,"aria-labelledby",e)},UD=nt([zn("lazySink"),qn("dragBlockClass"),te("useTabstopAt",nt(!0)),te("eventOrder",{}),ol("modalBehaviours",[vm]),Iu("onExecute"),Vu("onEscape")]),WD={sketch:d},GD=nt([Fl({name:"draghandle",overrides:function(t,n){return{behaviours:Gu([MD.config({mode:"mouse",getTarget:function(t){return du(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"+un(n,null,2)).message)})])}}}),_l({schema:[zn("dom")],name:"title"}),_l({factory:WD,schema:[zn("dom")],name:"close"}),_l({factory:WD,schema:[zn("dom")],name:"body"}),Fl({factory:WD,schema:[zn("dom")],name:"footer"}),Ml({factory:{sketch:function(t,n){return I({},t,{dom:n.dom,components:n.components})}},schema:[te("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),te("components",[])],name:"blocker"})]),XD=sf({name:"ModalDialog",configFields:UD(),partFields:GD(),factory:function(r,t,n,o){var a=ri("alloy.dialog.busy"),c=ri("alloy.dialog.idle"),s=Gu([vm.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),Lm.config({})]),e=ri("modal-events"),i=I({},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=se(et.none()),n=o.blocker(),e=t.getSystem().build(I({},n,{components:n.components.concat([fu(i)]),behaviours:Gu([Vm("dialog-blocker-events",[gr(c,function(t,n){$r(i.element(),"aria-busy")&&(Jr(i.element(),"aria-busy"),u.get().each(function(t){return Sm.remove(i,t)}))}),gr(a,function(t,n){Yr(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){Sm.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(et.some(r)),Sm.append(i,fu(r)),r.hasConfigured(vm)&&vm.focusIn(r)})])])}));Rs(t,e),vm.focusIn(i)},hide:function(n){Mr(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){Hs(t)})})},getBody:function(t){return Xl(t,r,"body")},getFooter:function(t){return Xl(t,r,"footer")},setIdle:function(t){Lo(t,c)},setBusy:function(t,n){jo(t,a,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:il(r.modalBehaviours,[Sm.config({}),vm.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt}),Vm(e,[Sr(function(t){var n,e,o;jD(t.element(),Xl(t,r,"title").element()),n=t.element(),e=Xl(t,r,"body").element(),o=et.from(Kr(n,"id")).fold(function(){var t=ri("dialog-describe");return Yr(e,"id",t),t},d),Yr(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)}}}),YD=[jn("type"),jn("text"),Un("level",["info","warn","error","success"]),jn("icon"),te("url","")],qD=[jn("type"),jn("text"),ie("disabled",!1),ie("primary",!1),wn("name","name",Ot(function(){return ri("button-name")}),Vn),Jn("icon"),ie("borderless",!1)],KD=[jn("type"),jn("name"),jn("label"),ie("disabled",!1)],$D=Nn,JD=[jn("type"),jn("name")],QD=JD.concat([Jn("label")]),ZD=QD,tA=Vn,nA=QD,eA=Vn,oA=QD,rA=hn(kn),iA=function(t){return[jn("type"),(n="columns",Ln(n,Rn)),t];var n},uA=QD.concat([ie("sandboxed",!0)]),aA=Vn,cA=QD.concat([Jn("placeholder"),ie("maximized",!1),ie("disabled",!1)]),sA=Vn,lA=QD.concat([Xn("items",[jn("text"),jn("value")]),ee("size",1),ie("disabled",!1)]),fA=Vn,dA=QD.concat([ie("constrain",!0),ie("disabled",!1)]),mA=pn([jn("width"),jn("height")]),gA=QD.concat([Jn("placeholder"),ie("maximized",!1),ie("disabled",!1)]),pA=Vn,hA=QD.concat([re("filetype","file",["image","media","file"]),te("disabled",!1)]),vA=pn([jn("value"),te("meta",{})]),bA=JD.concat([oe("tag","textarea"),Wn("init")]),yA=Vn,xA=[jn("type"),jn("html"),re("presets","presentation",["presentation","document"])],wA=QD.concat([Ln("currentState",pn([zn("blob"),jn("url")]))]),SA=QD.concat([te("columns","auto")]),CA=(FD=[jn("value"),jn("text"),jn("icon")],yn(FD)),kA=[jn("type"),Yn("header",Vn),Yn("cells",hn(Vn))],OA=function(n){return wn("items","items",Ct(),hn(En(function(t){return Bn("Checking item of "+n,EA,t).fold(function(t){return R.error(_n(t))},function(t){return R.value(t)})})))},EA=On(function(){return Mn("type",{alertbanner:YD,bar:(n=OA("bar"),[jn("type"),n]),button:qD,checkbox:KD,colorinput:ZD,colorpicker:nA,dropzone:oA,grid:iA(OA("grid")),iframe:uA,input:cA,selectbox:lA,sizeinput:dA,textarea:gA,urlinput:hA,customeditor:bA,htmlpanel:xA,imagetools:wA,collection:SA,label:(t=OA("label"),[jn("type"),jn("label"),t]),table:kA,panel:TA});var t,n}),TA=[jn("type"),te("classes",[]),Yn("items",EA)],BA=[wn("name","name",Ot(function(){return ri("tab-name")}),Vn),jn("title"),Yn("items",EA)],DA=[jn("type"),Xn("tabs",BA)],AA=[wn("name","name",Ot(function(){return ri("button-name")}),Vn),Jn("icon"),re("align","end",["start","end"]),ie("primary",!1),ie("disabled",!1)],_A=AA.concat([jn("text")]),MA=[Un("type",["submit","cancel","custom"])].concat(_A),FA=[Un("type",["menu"])].concat(AA,pE),IA=Mn("type",{submit:MA,cancel:MA,custom:MA,menu:FA}),RA=pn([jn("title"),Ln("body",Mn("type",{panel:TA,tabpanel:DA})),oe("size","normal"),Yn("buttons",IA),te("initialData",{}),ue("onAction",tt),ue("onChange",tt),ue("onSubmit",tt),ue("onClose",tt),ue("onCancel",tt),te("onTabChange",tt)]),VA=function(t){return O(t)?[t].concat(K(dt(t),VA)):E(t)?K(t,VA):[]},NA=function(t){return k(t.type)&&k(t.name)},HA={checkbox:$D,colorinput:tA,colorpicker:eA,dropzone:rA,input:sA,iframe:aA,sizeinput:mA,selectbox:fA,size:mA,textarea:pA,urlinput:vA,customeditor:yA,collection:CA},PA=function(t){var n=K(L(VA(t),NA),function(n){return(t=n,et.from(HA[t.type])).fold(function(){return[]},function(t){return[Ln(n.name,t)]});var t});return pn(n)},zA=pn([Un("type",["cancel","custom"])].concat(_A)),LA=pn([jn("title"),jn("url"),$n("height"),$n("width"),(ID="buttons",RD=zA,Kn(ID,hn(RD))),ue("onAction",tt),ue("onCancel",tt),ue("onClose",tt),ue("onMessage",tt)]),jA=function(t){return{internalDialog:Dn(Bn("dialog",RA,t)),dataValidator:PA(t),initialData:t.initialData}},UA={open:function(t,n){var e=jA(n);return t(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(t,n){return t(Dn(Bn("dialog",LA,n)))},redial:function(t){return jA(t)}},WA=function(t){var e=[],o={};return ct(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?R.error(e):R.value(o)},GA=cf({name:"TabButton",configFields:[te("uid",undefined),zn("value"),wn("dom","dom",Et(function(t){return{attributes:{role:"tab",id:ri("aria"),"aria-selected":"false"}}}),Fn()),qn("action"),te("domModification",{}),ol("tabButtonBehaviours",[Lm,vm,Rm]),zn("view")],factory:function(t,n){return{uid:t.uid,dom:t.dom,components:t.components,events:wg(t.action),behaviours:il(t.tabButtonBehaviours,[Lm.config({}),vm.config({mode:"execution",useSpace:!0,useEnter:!0}),Rm.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),XA=nt([zn("tabs"),zn("dom"),te("clickToDismiss",!1),ol("tabbarBehaviours",[Ef,vm]),_u(["tabClass","selectedClass"])]),YA=Il({factory:GA,name:"tabs",unit:"tab",overrides:function(o,t){var r=function(t,n){Ef.dehighlight(t,n),jo(t,Ho(),{tabbar:t,button:n})},i=function(t,n){Ef.highlight(t,n),jo(t,No(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=Ef.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?tt:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),qA=nt([YA]),KA=sf({name:"Tabbar",configFields:XA(),partFields:qA(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:il(t.tabbarBehaviours,[Ef.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){Yr(n.element(),"aria-selected","true")},onDehighlight:function(t,n){Yr(n.element(),"aria-selected","false")}}),vm.config({mode:"flow",getInitial:function(t){return Ef.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),$A=cf({name:"Tabview",configFields:[ol("tabviewBehaviours",[Sm])],factory:function(t,n){return{uid:t.uid,dom:t.dom,behaviours:il(t.tabviewBehaviours,[Sm.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),JA=nt([te("selectFirst",!0),Fu("onChangeTab"),Fu("onDismissTab"),te("tabs",[]),ol("tabSectionBehaviours",[])]),QA=_l({factory:KA,schema:[zn("dom"),Gn("markers",[zn("tabClass"),zn("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),ZA=_l({factory:$A,name:"tabview"}),t_=nt([QA,ZA]),n_=sf({name:"TabSection",configFields:JA(),partFields:t_(),factory:function(i,t,n,e){var o=function(t,n){Gl(t,i,"tabbar").each(function(t){n(t).each(Uo)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:rl(i.tabSectionBehaviours),events:fr(q([i.selectFirst?[Sr(function(t,n){o(t,Ef.getFirst)})]:[],[gr(No(),function(t,n){var o,r,e=n.event().button();o=e,r=Rm.getValue(o),Gl(o,i,"tabview").each(function(e){W(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();Yr(e.element(),"aria-labelledby",Kr(o.element(),"id")),Sm.set(e,n),i.onChangeTab(e,o,n)})})}),gr(Ho(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return Gl(t,i,"tabview").map(function(t){return Sm.contents(t)}).getOr([])},showTab:function(t,e){o(t,function(n){var t=Ef.getCandidates(n);return W(t,function(t){return Rm.getValue(t)===e}).filter(function(t){return!Ef.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),e_=function(t){return ot((n=t,e=function(t,n){return n<t?-1:t<n?1:0},(o=A.call(n,0)).sort(e),o));var n,e,o},o_=function(i,u,t){du(i,'[role="dialog"]').each(function(r){t.get().map(function(t){return Gi(u,"height","0"),Math.min(t,(e=i,o=du(n=r,".tox-dialog-wrap").getOr(n),("fixed"===Yi(o,"position")?Math.max(F.document.documentElement.clientHeight,F.window.innerHeight):Math.max(F.document.documentElement.offsetHeight,F.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-e.dom().getBoundingClientRect().height)));var n,e,o}).each(function(t){Gi(u,"height",t+"px")})})},r_=function(a){var c;return{smartTabHeight:(c=se(et.none()),{extraEvents:[Sr(function(t){mu(t.element(),'[role="tabpanel"]').each(function(u){var n;Gi(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,P(o=a,function(t,n){Sm.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return Sm.set(i,[]),e.height})),e=e_(n);c.set(e)}),o_(t.element(),u,c),Ji(u,"visibility"),n=t,ot(a).each(function(t){return n_.showTab(n,t.value)}),Bg.requestAnimationFrame(function(){o_(t.element(),u,c)})})}),gr(_o(),function(n){mu(n.element(),'[role="tabpanel"]').each(function(t){o_(n.element(),t,c)})}),gr(Ab,function(r,t){mu(r.element(),'[role="tabpanel"]').each(function(n){var t=Hf();Gi(n,"visibility","hidden");var e=Ki(n,"height").map(function(t){return parseInt(t,10)});Ji(n,"height");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(et.from(o)),o_(r.element(),n,c)):e.each(function(t){Gi(n,"height",t+"px")}),Ji(n,"visibility"),t.each(Nf)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},i_="send-data-to-section",u_="send-data-to-view",a_=ri("update-dialog"),c_=ri("update-title"),s_=ri("update-body"),l_=ri("update-footer"),f_=ri("body-send-message"),d_=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:I({},n.map(function(t){return{id:t}}).getOr({}),e?{"aria-live":"polite"}:{})},components:[],behaviours:Gu([Kw(0),IE.config({channel:s_,updateState:function(t,n){return et.some({isTabPanel:function(){return"tabpanel"===n.body.type}})},renderComponents:function(t){switch(t.body.type){case"tabpanel":return[(r=t.body,i=d,u=se({}),a=function(t){var n=Rm.getValue(t),e=WA(n).getOr({}),o=u.get(),r=bt(o,e);u.set(r)},c=function(t){var n=u.get();Rm.setValue(t,n)},s=se(null),l=P(r.tabs,function(t){return{value:t.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:i.shared.providers.translate(t.title)},view:function(){return[Pw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:P(t.items,function(t){return hk(n,t,i)}),formBehaviours:Gu([vm.config({mode:"acyclic",useTabstopAt:x(lS)}),Vm("TabView.form.events",[Sr(c),Cr(a)]),Zu.config({channels:Rt([{key:i_,value:{onReceive:a}},{key:u_,value:{onReceive:c}}])})])}})]}}}),f=r_(l).smartTabHeight,n_.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n,e){var o=Rm.getValue(n);jo(t,Db,{name:o,oldName:s.get()}),s.set(o)},tabs:l,components:[n_.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[KA.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:Gu([Ny.config({})])}),n_.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:f.selectFirst,tabSectionBehaviours:Gu([Vm("tabpanel",f.extraEvents),vm.config({mode:"acyclic"}),mf.config({find:function(t){return ot(n_.getViewItems(t))}}),Rm.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([i_],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([u_],{})}}})])}))];default:return[(e=t.body,o=d,n=Cg(Pw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:P(e.items,function(t){return hk(n,t,o)})}})),{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:Gu([vm.config({mode:"acyclic",useTabstopAt:x(lS)}),qw(n),nS(n,{postprocess:function(t){return WA(t).fold(function(t){return F.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,l,f},initialData:t})])}},m_=function(t,e){return[br(ao(),fS),t(Cb,function(t,n){e.onClose(),n.onClose()}),t(kb,function(t,n,e,o){n.onCancel(t),Lo(o,Cb)}),gr(Bb,function(t,n){return e.onUnblock()}),gr(Tb,function(t,n){return e.onBlock(n.event())})]},g_=function(i,t){var n=function(t,r){return gr(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){IE.getState(n).get().each(function(t){e(t,n)})};return m_(n,t).concat([n(Ob,function(t,n,e){n.onAction(t,{name:e.name()})})])},p_=function(i,t){var n=function(t,r){return gr(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){IE.getState(n).get().each(function(t){e(t.internalDialog,n)})};return m_(n,t).concat([n(Eb,function(t,n){return n.onSubmit(t)}),n(Sb,function(t,n,e){n.onChange(t,{name:e.name()})}),n(Ob,function(t,n,e){n.onAction(t,{name:e.name(),value:e.value()})}),n(Db,function(t,n,e){n.onTabChange(t,{newTabName:e.name(),oldTabName:e.oldName()})}),Cr(function(t){var n=i();Rm.setValue(t,n.getData())})])},h_=function(t,n){var e=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}}(n.map(function(t){return t.footerButtons}).getOr([]),function(t){return"start"===t.align}),o=function(t,n){return cb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:P(n,function(t){return t.memento.asSpec()})})};return[o("start",e.pass),o("end",e.fail)]},v_=function(t,i){return{dom:bp('<div class="tox-dialog__footer"></div>'),components:[],behaviours:Gu([IE.config({channel:l_,initialData:t,updateState:function(t,n){var r=P(n.buttons,function(t){var n,e,o=Cg((e=i,vC(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return et.some({lookupByName:function(t,n){return e=t,o=n,W(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:h_})])}},b_=function(t,n){return XD.parts().footer(v_(t,n))},y_=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=mf.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return Pw.getField(o,e).fold(function(){var t=n.getFooter();return IE.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return et.some(t)})}return et.none()},x_=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 Rm.getValue(n)},setData:function(a){t(function(t){var n,e,o=s.getData(),r=yt(o,a),i=(n=r,e=c.getRoot(),IE.getState(e).get().map(function(t){return Dn(Bn("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();Rm.setValue(u,i)})},disable:function(t){y_(c,t).each(Zp.disable)},enable:function(t){y_(c,t).each(Zp.enable)},focus:function(t){y_(c,t).each(Lm.focus)},block:function(n){if(!k(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){jo(t,Tb,{message:n})})},unblock:function(){t(function(t){Lo(t,Bb)})},showTab:function(e){t(function(t){var n=c.getBody();IE.getState(n).get().exists(function(t){return t.isTabPanel()})&&mf.getCurrent(n).each(function(t){n_.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([a_],n),t.getSystem().broadcastOn([c_],n.internalDialog),t.getSystem().broadcastOn([s_],n.internalDialog),t.getSystem().broadcastOn([l_],n.internalDialog),s.setData(n.initialData)})},close:function(){t(function(t){Lo(t,Cb)})}};return s},w_=function(t){return Sg.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){Lo(t,kb)}})},S_=function(t,n,e){var o=function(t){return[au(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:I({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:Gu([IE.config({channel:c_,renderComponents:o})])}},C_=function(t,n){return e={title:n.shared.providers.translate(t),draggable:!0},o=n.shared.providers,r=XD.parts().title(S_(e,et.none(),o)),i=XD.parts().draghandle({dom:bp('<div class="tox-dialog__draghandle"></div>')}),u=XD.parts().close(w_(o)),a=[r].concat(e.draggable?[i]:[]).concat([u]),cb.sketch({dom:bp('<div class="tox-dialog__header"></div>'),components:a});var e,o,r,i,u,a},k_=function(t,n){return{onClose:function(){return n.closeWindow()},onBlock:function(e){XD.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:bp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){XD.setIdle(t())}}},O_=function(t,n,e,o){var r;return lu(XD.sketch({lazySink:o.shared.getSink,onEscape:function(t){return Lo(t,kb),et.some(!0)},useTabstopAt:function(t){return!lS(t)&&("button"!==Zo(t)||"disabled"!==Kr(t,"disabled"))},modalBehaviours:Gu([IE.config({channel:a_,updateState:function(t,n){return et.some(n)},initialData:n}),rS({}),Lm.config({}),Vm("execute-on-form",e.concat([wr(ao(),function(t,n){vm.focusIn(t)})])),Vm("scroll-lock",[Sr(function(){Vi(ir(),"tox-dialog__disable-scroll")}),Cr(function(){Hi(ir(),"tox-dialog__disable-scroll")})])].concat(t.extraBehaviours)),eventOrder:(r={},r[So()]=["execute-on-form"],r[wo()]=["reflecting","receiving"],r[Mo()]=["scroll-lock","reflecting","messages","execute-on-form","alloy.base.behaviour"],r[Fo()]=["alloy.base.behaviour","execute-on-form","messages","reflecting","scroll-lock"],r),dom:{tag:"div",classes:["tox-dialog"].concat(t.extraClasses),styles:I({position:"relative"},t.extraStyles)},components:[t.header,t.body].concat(t.footer.toArray()),dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:bp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}}))},E_=function(t,n,e){var o,r,i,u=C_(t.internalDialog.title,e),a=(o={body:t.internalDialog.body},r=e,i=d_(o,et.none(),r,!1),XD.parts().body(i)),c=b_({buttons:t.internalDialog.buttons},e),s=p_(function(){return m},k_(function(){return d},n)),l="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?["tox-dialog--width-lg"]:["tox-dialog--width-md"]:[],f={header:u,body:a,footer:et.some(c),extraClasses:l,extraBehaviours:[],extraStyles:{}},d=O_(f,t,s,e),m=x_({getRoot:function(){return d},getBody:function(){return XD.getBody(d)},getFooter:function(){return XD.getFooter(d)},getFormWrapper:function(){var t=XD.getBody(d);return mf.getCurrent(t).getOr(t)}},n.redial);return{dialog:d,instanceApi:m}},T_=tinymce.util.Tools.resolve("tinymce.util.URI"),B_=["insertContent","setContent","execCommand","close","block","unblock"],D_=function(t){return O(t)&&-1!==B_.indexOf(t.mceAction)},A_=function(o,t,r,n){var e,i,u,a,c=C_(o.title,n),s=(i={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[dS({dom:{tag:"iframe",attributes:{src:o.url}},behaviours:Gu([Ny.config({}),Lm.config({})])})]}],behaviours:Gu([vm.config({mode:"acyclic",useTabstopAt:x(lS)})])},XD.parts().body(i)),l=o.buttons.bind(function(t){return 0===t.length?et.none():et.some(b_({buttons:t},n))}),f=g_(function(){return y},k_(function(){return b},t)),d=I({},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 T_(o.url,{base_uri:new T_(F.window.location.href)}),p=g.protocol+"://"+g.host+(g.port?":"+g.port:""),h=se(et.none()),v=[Vm("messages",[Sr(function(){var t=Lv(fe.fromDom(F.window),"message",function(t){if(g.isSameOrigin(new T_(t.raw().origin))){var n=t.raw().data;D_(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=!!T(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):!D_(e=n)&&O(e)&>(e,"mceAction")&&o.onMessage(y,n)}var e});h.set(et.some(t))}),Cr(function(){h.get().each(function(t){return t.unbind()})})]),Zu.config({channels:(e={},e[f_]={onReceive:function(t,n){mu(t.element(),"iframe").each(function(t){t.dom().contentWindow.postMessage(n,p)})}},e)})],b=O_({header:c,body:s,footer:l,extraClasses:m,extraBehaviours:v,extraStyles:d},o,f,n),y=(u=b,a=function(t){u.getSystem().isConnected()&&t(u)},{block:function(n){if(!k(n))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");a(function(t){jo(t,Tb,{message:n})})},unblock:function(){a(function(t){Lo(t,Bb)})},close:function(){a(function(t){Lo(t,Cb)})},sendMessage:function(n){a(function(t){t.getSystem().broadcastOn([f_],n)})}});return{dialog:b,instanceApi:y}},__=function(t,n,e,o){var r,i,u,a,c,s,l,f,d,m,g=ri("dialog-label"),p=ri("dialog-content"),h=Cg((u={title:t.internalDialog.title,draggable:!0},a=g,c=e.shared.providers,cb.sketch({dom:bp('<div class="tox-dialog__header"></div>'),components:[S_(u,et.some(a),c),w_(c)],containerBehaviours:Gu([MD.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return gu(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),v=Cg((s={body:t.internalDialog.body},l=p,f=e,d=o,d_(s,et.some(l),f,d))),b=Cg((m={buttons:t.internalDialog.buttons},v_(m,e))),y=p_(function(){return w},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),x=lu({dom:{tag:"div",classes:["tox-dialog"],attributes:(r={role:"dialog"},r["aria-labelledby"]=g,r["aria-describedby"]=""+p,r)},eventOrder:(i={},i[wo()]=[IE.name(),Zu.name()],i[So()]=["execute-on-form"],i[Mo()]=["reflecting","execute-on-form"],i),behaviours:Gu([vm.config({mode:"cyclic",onEscape:function(t){return Lo(t,Cb),et.some(!0)},useTabstopAt:function(t){return!lS(t)&&("button"!==Zo(t)||"disabled"!==Kr(t,"disabled"))}}),IE.config({channel:a_,updateState:function(t,n){return et.some(n)},initialData:t}),Vm("execute-on-form",y),rS({})]),components:[h.asSpec(),v.asSpec(),b.asSpec()]}),w=x_({getRoot:function(){return x},getFooter:function(){return b.get(x)},getBody:function(){return v.get(x)},getFormWrapper:function(){var t=v.get(x);return mf.getCurrent(t).getOr(t)}},n.redial);return{dialog:x,instanceApi:w}},M_={dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]}},F_={dom:{tag:"div",classes:["tox-dialog__header"]}},I_=function(t,n){return XD.parts().close(Sg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:Gu([Ny.config({})])}))},R_=function(){return XD.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},V_=function(t,n){return XD.parts().body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:bp("<p>"+n.translate(t)+"</p>")}]}]})},N_=function(t){return XD.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},H_=function(t,n){return[cb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),cb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},P_=function(e){return XD.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),et.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(e.extraClasses)},components:[bt(e.headerOverride.getOr(F_),{components:[e.partSpecs.title,e.partSpecs.close]}),e.partSpecs.body,e.partSpecs.footer],parts:{blocker:{dom:bp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:Gu([Vm("basic-dialog-events",[gr(kb,function(t,n){e.onCancel()}),gr(Eb,function(t,n){e.onSubmit()})])])})},z_=function(s){var u,a,c,l,e=(a=(u=s).backstage.shared,{open:function(t,n){var e=function(){XD.hide(r),n()},o=Cg(vC({name:"close-alert",text:"OK",primary:!0,align:"end",disabled:!1,icon:et.none()},"cancel",u.backstage)),r=lu(P_({lazySink:function(){return a.getSink()},headerOverride:et.some(M_),partSpecs:{title:R_(),close:I_(function(){e()},a.providers),body:V_(t,a.providers),footer:N_(H_([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:tt,extraClasses:["tox-alert-dialog"]}));XD.show(r);var i=o.get(r);Lm.focus(i)}}),o=(l=(c=s).backstage.shared,{open:function(t,n){var e=function(t){XD.hide(i),n(t)},o=Cg(vC({name:"yes",text:"Yes",primary:!0,align:"end",disabled:!1,icon:et.none()},"submit",c.backstage)),r=vC({name:"no",text:"No",primary:!0,align:"end",disabled:!1,icon:et.none()},"cancel",c.backstage),i=lu(P_({lazySink:function(){return l.getSink()},headerOverride:et.some(M_),partSpecs:{title:R_(),close:I_(function(){e(!1)},l.providers),body:V_(t,l.providers),footer:N_(H_([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));XD.show(i);var u=o.get(i);Lm.focus(u)}}),r=function(t,e){return UA.openUrl(function(t){var n=A_(t,{closeWindow:function(){XD.hide(n.dialog),e(n.instanceApi)}},s.editor,s.backstage);return XD.show(n.dialog),n.instanceApi},t)},i=function(t,i){return UA.open(function(t,n,e){var o=n,r=E_({dataValidator:e,initialData:o,internalDialog:t},{redial:UA.redial,closeWindow:function(){XD.hide(r.dialog),i(r.instanceApi)}},s.backstage);return XD.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},f=function(t,u,a,c){return UA.open(function(t,n,e){var o=Dn(Bn("data",e,n)),r=__({dataValidator:e,initialData:o,internalDialog:t},{redial:UA.redial,closeWindow:function(){xg.hide(i),a(r.instanceApi)}},s.backstage,c),i=lu(xg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:Gu([Vm("window-manager-inline-events",[gr(Io(),function(t,n){Lo(r.dialog,kb)})])])}));return xg.showAt(i,u,fu(r.dialog)),r.instanceApi.setData(o),vm.focusIn(r.dialog),r.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?f(t,s.backstage.shared.anchors.toolbar(),e,n.ariaAttrs):n!==undefined&&"cursor"===n.inline?f(t,s.backstage.shared.anchors.cursor(),e,n.ariaAttrs):i(t,e)},openUrl:function(t,n){return r(t,n)},alert:function(t,n){e.open(t,function(){n()})},close:function(t){t.close()},confirm:function(t,n){o.open(t,function(t){n(t)})}}};!function $_(){e.add("silver",function(t){var n=LD(t),e=n.uiMothership,o=n.backstage,r=n.renderUI,i=n.getUi;Vv(t,o.shared);var u=z_({editor:t,backstage:o});return{renderUI:r,getWindowManagerImpl:nt(u),getNotificationManagerImpl:function(){return Dg(t,{backstage:o},e)},ui:i()}})}()}(window);
|