11 lines
376 KiB
JavaScript
11 lines
376 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.16 (2019-09-24)
|
|
*/
|
|
|
|
!function(M){"use strict";function Z(){}function c(e,o){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e(o.apply(null,n))}}function f(n){return n}var nn=function(n){return function(){return n}};function l(o){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=r.concat(n);return o.apply(null,e)}}function v(e){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return!e.apply(null,n)}}function r(n){return function(){throw new Error(n)}}var i=nn(!1),u=nn(!0),n=tinymce.util.Tools.resolve("tinymce.ThemeManager"),I=function(){return(I=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}).apply(this,arguments)};function a(n,t){var e={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&t.indexOf(o)<0&&(e[o]=n[o]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(n);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(n,o[r])&&(e[o[r]]=n[o[r]])}return e}function d(){for(var n=0,t=0,e=arguments.length;t<e;t++)n+=arguments[t].length;var o=Array(n),r=0;for(t=0;t<e;t++)for(var i=arguments[t],u=0,a=i.length;u<a;u++,r++)o[r]=i[u];return o}function t(){return s}var e,s=(e={fold:function(n,t){return n()},is:i,isSome:i,isNone:u,getOr:g,getOrThunk:m,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:nn(null),getOrUndefined:nn(undefined),or:g,orThunk:m,map:t,each:Z,bind:t,exists:i,forall:u,filter:t,equals:o,equals_:o,toArray:function(){return[]},toString:nn("none()")},Object.freeze&&Object.freeze(e),e);function o(n){return n.isNone()}function m(n){return n()}function g(n){return n}function p(t){return function(n){return function(n){if(null===n)return"null";var t=typeof n;return"object"==t&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":t}(n)===t}}function h(n,t){if(fn(n)){for(var e=0,o=n.length;e<o;++e)if(!0!==t(n[e]))return!1;return!0}return!1}function b(n,t){return pn.call(n,t)}function y(n,t){for(var e=0,o=n.length;e<o;e++){if(t(n[e],e))return!0}return!1}function x(n,t){for(var e=[],o=0;o<n.length;o+=t){var r=gn.call(n,o,o+t);e.push(r)}return e}function w(n,t){for(var e=n.length,o=new Array(e),r=0;r<e;r++){var i=n[r];o[r]=t(i,r)}return o}function S(n,t){for(var e=[],o=0,r=n.length;o<r;o++){var i=n[o];t(i,o)&&e.push(i)}return e}function k(n,t,e){return function(n,t){for(var e=n.length-1;0<=e;e--){t(n[e],e)}}(n,function(n){e=t(e,n)}),e}function C(n,t,e){return bn(n,function(n){e=t(e,n)}),e}function O(n,t){for(var e=0,o=n.length;e<o;e++){var r=n[e];if(t(r,e))return on.some(r)}return on.none()}function T(n,t){for(var e=0,o=n.length;e<o;e++){if(t(n[e],e))return on.some(e)}return on.none()}function R(n){for(var t=[],e=0,o=n.length;e<o;++e){if(!fn(n[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+n);hn.apply(t,n[e])}return t}function E(n,t){var e=w(n,t);return R(e)}function B(n,t){for(var e=0,o=n.length;e<o;++e){if(!0!==t(n[e],e))return!1}return!0}function _(n){var t=gn.call(n,0);return t.reverse(),t}function D(n,t){return S(n,function(n){return!vn(t,n)})}function A(n){return[n]}function F(n){return 0===n.length?on.none():on.some(n[0])}function V(n){return 0===n.length?on.none():on.some(n[n.length-1])}function N(n,e){return kn(n,function(n,t){return{k:t,v:e(n,t)}})}function H(n){return Cn(n,function(n){return n})}function P(n,t){return On(n,t)?on.from(n[t]):on.none()}function z(u){return function(){for(var n=new Array(arguments.length),t=0;t<n.length;t++)n[t]=arguments[t];if(0===n.length)throw new Error("Can't merge zero objects");for(var e={},o=0;o<n.length;o++){var r=n[o];for(var i in r)En.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}}function L(e){var o,r=!1;return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return r||(r=!0,o=e.apply(null,n)),o}}function j(n){return Dn.defaultedThunk(nn(n))}function U(t){return function(n){return On(n,t)?on.from(n[t]):on.none()}}function W(n,t){return U(t)(n)}function G(n,t){var e={};return e[n]=t,e}function X(n,t){return function(n,e){var o={};return Sn(n,function(n,t){vn(e,t)||(o[t]=n)}),o}(n,t)}function Y(n,t){return function(t,e){return function(n){return On(n,t)?n[t]:e}}(n,t)}function q(n,t){return G(n,t)}function K(n){return function(n){var t={};return bn(n,function(n){t[n.key]=n.value}),t}(n)}function J(n,t){var e=function(n){var t=[],e=[];return bn(n,function(n){n.fold(function(n){t.push(n)},function(n){e.push(n)})}),{errors:t,values:e}}(n);return 0<e.errors.length?function(n){return an.error(R(n))}(e.errors):function(n,t){return 0===n.length?an.value(t):an.value(Bn(t,_n.apply(undefined,n)))}(e.values,t)}function $(n,t){return function(n,t){return On(n,t)&&n[t]!==undefined&&null!==n[t]}(n,t)}var Q,tn,en=function(e){function n(){return r}function t(n){return n(e)}var o=nn(e),r={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:u,isNone:i,getOr:o,getOrThunk:o,getOrDie:o,getOrNull:o,getOrUndefined:o,or:n,orThunk:n,map:function(n){return en(n(e))},each:function(n){n(e)},bind:t,exists:t,forall:t,filter:function(n){return n(e)?r:s},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(i,function(n){return t(e,n)})}};return r},on={some:en,none:t,from:function(n){return null===n||n===undefined?s:en(n)}},rn=function(e){return{is:function(n){return e===n},isValue:u,isError:i,getOr:nn(e),getOrThunk:nn(e),getOrDie:nn(e),or:function(n){return rn(e)},orThunk:function(n){return rn(e)},fold:function(n,t){return t(e)},map:function(n){return rn(n(e))},mapError:function(n){return rn(e)},each:function(n){n(e)},bind:function(n){return n(e)},exists:function(n){return n(e)},forall:function(n){return n(e)},toOption:function(){return on.some(e)}}},un=function(e){return{is:i,isValue:i,isError:u,getOr:f,getOrThunk:function(n){return n()},getOrDie:function(){return r(String(e))()},or:function(n){return n},orThunk:function(n){return n()},fold:function(n,t){return n(e)},map:function(n){return un(e)},mapError:function(n){return un(n(e))},each:Z,bind:function(n){return un(e)},exists:i,forall:u,toOption:on.none}},an={value:rn,error:un,fromOption:function(n,t){return n.fold(function(){return un(t)},rn)}},cn=p("string"),sn=p("object"),fn=p("array"),ln=p("boolean"),dn=p("function"),mn=p("number"),gn=Array.prototype.slice,pn=Array.prototype.indexOf,hn=Array.prototype.push,vn=function(n,t){return-1<b(n,t)},bn=function(n,t){for(var e=0,o=n.length;e<o;e++){t(n[e],e)}},yn=dn(Array.from)?Array.from:function(n){return gn.call(n)},xn=Object.keys,wn=Object.hasOwnProperty,Sn=function(n,t){for(var e=xn(n),o=0,r=e.length;o<r;o++){var i=e[o];t(n[i],i)}},kn=function(n,o){var r={};return Sn(n,function(n,t){var e=o(n,t);r[e.k]=e.v}),r},Cn=function(n,e){var o=[];return Sn(n,function(n,t){o.push(e(n,t))}),o},On=function(n,t){return wn.call(n,t)},Tn=function(u){if(!fn(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 bn(u,function(n,o){var t=xn(n);if(1!==t.length)throw new Error("one and only one name per case");var r=t[0],i=n[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(!fn(i))throw new Error("case arguments must be an array");a.push(r),e[r]=function(){var n=arguments.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+r+". Expected "+i.length+" ("+i+"), got "+n);for(var e=new Array(n),t=0;t<e.length;t++)e[t]=arguments[t];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(n){var t=xn(n);if(a.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+t.join(","));if(!B(a,function(n){return vn(t,n)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+a.join(", "));return n[r].apply(null,e)},log:function(n){M.console.log(n,{constructors:a,constructor:r,params:e})}}}}),e},En=Object.prototype.hasOwnProperty,Bn=z(function(n,t){return sn(n)&&sn(t)?Bn(n,t):t}),_n=z(function(n,t){return t}),Dn=Tn([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),An=Dn.strict,Fn=Dn.asOption,Mn=Dn.defaultedThunk,In=Dn.mergeWithThunk,Rn=(Tn([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(n){return U(n)}),Vn=function(n,t){return W(n,t)};(tn=Q=Q||{})[tn.Error=0]="Error",tn[tn.Value=1]="Value";function Nn(n,t,e){return n.stype===Q.Error?t(n.serror):e(n.svalue)}function Hn(n){return{stype:Q.Value,svalue:n}}function Pn(n){return{stype:Q.Error,serror:n}}function zn(n){return c(Zt,R)(n)}function Ln(n){return sn(n)&&100<xn(n).length?" removed due to size":JSON.stringify(n,null,2)}function jn(n,t){return Zt([{path:n,getErrorInfo:t}])}function Un(n,t,e){return W(t,e).fold(function(){return function(n,t,e){return jn(n,function(){return'Could not find valid *strict* value for "'+t+'" in '+Ln(e)})}(n,e,t)},$t)}function Wn(n,t,e){var o=W(n,t).fold(function(){return e(n)},f);return $t(o)}function Gn(u,a,n,c){return n.fold(function(o,e,n,r){function i(n){var t=r.extract(u.concat([o]),c,n);return ee(t,function(n){return G(e,c(n))})}function t(n){return n.fold(function(){var n=G(e,c(on.none()));return $t(n)},function(n){var t=r.extract(u.concat([o]),c,n);return ee(t,function(n){return G(e,c(on.some(n)))})})}return n.fold(function(){return ne(Un(u,a,o),i)},function(n){return ne(Wn(a,o,n),i)},function(){return ne(function(n,t){return $t(W(n,t))}(a,o),t)},function(n){return ne(function(t,n,e){var o=W(t,n).map(function(n){return!0===n?e(t):n});return $t(o)}(a,o,n),t)},function(n){var t=n(a),e=ee(Wn(a,o,nn({})),function(n){return Bn(t,n)});return ne(e,i)})},function(n,t){var e=t(a);return $t(G(n,c(e)))})}function Xn(o){return{extract:function(t,n,e){return te(o(e,n),function(n){return function(n,t){return jn(n,function(){return t})}(t,n)})},toString:function(){return"val"},toDsl:function(){return ue.itemOf(o)}}}function Yn(n){var i=se(n),u=k(n,function(t,n){return n.fold(function(n){return Bn(t,q(n,!0))},nn(t))},{});return{extract:function(n,t,e){var o=ln(e)?[]:function(t){var n=xn(t);return S(n,function(n){return $(t,n)})}(e),r=S(o,function(n){return!$(u,n)});return 0===r.length?i.extract(n,t,e):function(n,t){return jn(n,function(){return"There are unsupported fields: ["+t.join(", ")+"] specified"})}(n,r)},toString:i.toString,toDsl:i.toDsl}}function qn(r){return{extract:function(e,o,n){var t=w(n,function(n,t){return r.extract(e.concat(["["+t+"]"]),o,n)});return ie(t)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return ue.arrOf(r)}}}function Kn(i,u){return{extract:function(e,o,r){var n=xn(r),t=function(n,t){return qn(Xn(i)).extract(n,f,t)}(e,n);return ne(t,function(n){var t=w(n,function(n){return ce.field(n,n,An(),u)});return se(t).extract(e,o,r)})},toString:function(){return"setOf("+u.toString()+")"},toDsl:function(){return ue.setOf(i,u)}}}function Jn(t,e,o,n,r){return Vn(n,r).fold(function(){return function(n,t,e){return jn(n,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+Ln(t)})}(t,n,r)},function(n){return n.extract(t.concat(["branch: "+r]),e,o)})}function $n(n,r){return{extract:function(t,e,o){return Vn(o,n).fold(function(){return function(n,t){return jn(n,function(){return'Choice schema did not contain choice key: "'+t+'"'})}(t,n)},function(n){return Jn(t,e,o,r,n)})},toString:function(){return"chooseOn("+n+"). Possible values: "+xn(r)},toDsl:function(){return ue.choiceOf(n,r)}}}function Qn(t){return Xn(function(n){return t(n).fold(Zt,$t)})}function Zn(t,n){return Kn(function(n){return Kt(t(n))},n)}function nt(n,t,e){return Jt(function(n,t,e,o){var r=t.extract([n],e,o);return oe(r,function(n){return{input:o,errors:n}})}(n,t,f,e))}function tt(n){return n.fold(function(n){throw new Error(he(n))},f)}function et(n,t,e){return tt(nt(n,t,e))}function ot(n,t){return $n(n,t)}function rt(n,t){return $n(n,N(t,se))}function it(e,o){return Xn(function(n){var t=typeof n;return e(n)?$t(n):Zt("Expected type: "+o+" but got: "+t)})}function ut(t){return Qn(function(n){return vn(t,n)?an.value(n):an.error('Unsupported value: "'+n+'", choose one of "'+t.join(", ")+'".')})}function at(n){return me(n,n,An(),fe())}function ct(n,t){return me(n,n,An(),t)}function st(n){return ct(n,ye)}function ft(n,t){return me(n,n,An(),ut(t))}function lt(n){return ct(n,we)}function dt(n,t){return me(n,n,An(),se(t))}function mt(n,t){return me(n,n,An(),le(t))}function gt(n,t){return me(n,n,An(),qn(t))}function pt(n){return me(n,n,Fn(),fe())}function ht(n,t){return me(n,n,Fn(),t)}function vt(n){return ht(n,be)}function bt(n){return ht(n,ye)}function yt(n){return ht(n,we)}function xt(n,t){return ht(n,se(t))}function wt(n,t){return me(n,n,j(t),fe())}function St(n,t,e){return me(n,n,j(t),e)}function kt(n,t){return St(n,t,be)}function Ct(n,t){return St(n,t,ye)}function Ot(n,t,e){return St(n,t,ut(e))}function Tt(n,t){return St(n,t,xe)}function Et(n,t){return St(n,t,we)}function Bt(n,t,e){return St(n,t,se(e))}function _t(n,t){return de(n,t)}function Dt(n,t,e){return 0!=(n.compareDocumentPosition(t)&e)}function At(n,t){var e=function(n,t){for(var e=0;e<n.length;e++){var o=n[e];if(o.test(t))return o}return undefined}(n,t);if(!e)return{major:0,minor:0};function o(n){return Number(t.replace(e,"$"+n))}return _e(o(1),o(2))}function Ft(n,t){return function(){return t===n}}function Mt(n,t){return function(){return t===n}}function It(n,t){var e=String(t).toLowerCase();return O(n,function(n){return n.search(e)})}function Rt(n,t){return-1!==n.indexOf(t)}function Vt(t){return function(n){return Rt(n,t)}}function Nt(n,t){var e=n.dom();if(e.nodeType!==$e)return!1;var o=e;if(o.matches!==undefined)return o.matches(t);if(o.msMatchesSelector!==undefined)return o.msMatchesSelector(t);if(o.webkitMatchesSelector!==undefined)return o.webkitMatchesSelector(t);if(o.mozMatchesSelector!==undefined)return o.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}function Ht(n){return n.nodeType!==$e&&n.nodeType!==Qe||0===n.childElementCount}function Pt(n,t){var e=t===undefined?M.document:t.dom();return Ht(e)?[]:w(e.querySelectorAll(n),Te.fromDom)}function zt(n,t){return n.dom()===t.dom()}function Lt(n,t){return zt(n.element(),t.event().target())}function jt(n){if(!$(n,"can")&&!$(n,"abort")&&!$(n,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(n,null,2)+" does not have can, abort, or run!");return et("Extracting event.handler",Yn([wt("can",nn(!0)),wt("abort",nn(!1)),wt("run",Z)]),n)}function Ut(e){var n=function(t,o){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return C(t,function(n,t){return n&&o(t).apply(undefined,e)},!0)}}(e,function(n){return n.can}),t=function(t,o){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return C(t,function(n,t){return n||o(t).apply(undefined,e)},!1)}}(e,function(n){return n.abort});return jt({can:n,abort:t,run:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];bn(e,function(n){n.run.apply(undefined,t)})}})}function Wt(n,t){jo(n,n.element(),t,{})}function Gt(n,t,e){jo(n,n.element(),t,e)}function Xt(n){Wt(n,ko())}function Yt(n,t,e){jo(n,t,e,{})}function qt(n,t,e,o){n.getSystem().triggerEvent(e,t,o.event())}var Kt=function(n){return n.fold(Pn,Hn)},Jt=function(n){return Nn(n,an.error,an.value)},$t=Hn,Qt=function(n){var t=[],e=[];return bn(n,function(n){Nn(n,function(n){return e.push(n)},function(n){return t.push(n)})}),{values:t,errors:e}},Zt=Pn,ne=function(n,t){return n.stype===Q.Value?t(n.svalue):n},te=function(n,t){return n.stype===Q.Error?t(n.serror):n},ee=function(n,t){return n.stype===Q.Value?{stype:Q.Value,svalue:t(n.svalue)}:n},oe=function(n,t){return n.stype===Q.Error?{stype:Q.Error,serror:t(n.serror)}:n},re=function(n,t){var e=Qt(n);return 0<e.errors.length?zn(e.errors):function(n,t){return 0<n.length?$t(Bn(t,_n.apply(undefined,n))):$t(t)}(e.values,t)},ie=function(n){var t=Qt(n);return 0<t.errors.length?zn(t.errors):$t(t.values)},ue=Tn([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),ae=Tn([{field:["name","presence","type"]},{state:["name"]}]),ce=Tn([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),se=function(o){return{extract:function(n,t,e){return function(t,e,n,o){var r=w(n,function(n){return Gn(t,e,n,o)});return re(r,{})}(n,e,o,t)},toString:function(){return"obj{\n"+w(o,function(n){return n.fold(function(n,t,e,o){return n+" -> "+o.toString()},function(n,t){return"state("+n+")"})}).join("\n")+"}"},toDsl:function(){return ue.objOf(w(o,function(n){return n.fold(function(n,t,e,o){return ae.field(n,e,o)},function(n,t){return ae.state(n)})}))}}},fe=nn(Xn($t)),le=c(qn,se),de=ce.state,me=ce.field,ge=Xn($t),pe=function(o){return{extract:function(n,t,e){return o().extract(n,t,e)},toString:function(){return o().toString()},toDsl:function(){return o().toDsl()}}},he=function(n){return"Errors: \n"+function(n){var t=10<n.length?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n;return w(t,function(n){return"Failed path: ("+n.path.join(" > ")+")\n"+n.getErrorInfo()})}(n.errors)+"\n\nInput object: "+Ln(n.input)},ve=nn(ge),be=it(mn,"number"),ye=it(cn,"string"),xe=it(ln,"boolean"),we=it(dn,"function"),Se=function(t){function n(n,t){for(var e=n.next();!e.done;){if(!t(e.value))return!1;e=n.next()}return!0}if(Object(t)!==t)return!0;switch({}.toString.call(t).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(t).every(function(n){return Se(t[n])});case"Map":return n(t.keys(),Se)&&n(t.values(),Se);case"Set":return n(t.keys(),Se);default:return!1}},ke=Xn(function(n){return Se(n)?$t(n):Zt("Expected value to be acceptable for sending via postMessage")}),Ce=function(n){function t(){return e}var e=n;return{get:t,set:function(n){e=n},clone:function(){return Ce(t())}}},Oe=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:nn(n)}},Te={fromHtml:function(n,t){var e=(t||M.document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||1<e.childNodes.length)throw M.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return Oe(e.childNodes[0])},fromTag:function(n,t){var e=(t||M.document).createElement(n);return Oe(e)},fromText:function(n,t){var e=(t||M.document).createTextNode(n);return Oe(e)},fromDom:Oe,fromPoint:function(n,t,e){var o=n.dom();return on.from(o.elementFromPoint(t,e)).map(Oe)}},Ee=function(n,t){return Dt(n,t,M.Node.DOCUMENT_POSITION_CONTAINED_BY)},Be=function(){return _e(0,0)},_e=function(n,t){return{major:n,minor:t}},De={nu:_e,detect:function(n,t){var e=String(t).toLowerCase();return 0===n.length?Be():At(n,e)},unknown:Be},Ae="Firefox",Fe=function(n){var t=n.current;return{current:t,version:n.version,isEdge:Ft("Edge",t),isChrome:Ft("Chrome",t),isIE:Ft("IE",t),isOpera:Ft("Opera",t),isFirefox:Ft(Ae,t),isSafari:Ft("Safari",t)}},Me={unknown:function(){return Fe({current:undefined,version:De.unknown()})},nu:Fe,edge:nn("Edge"),chrome:nn("Chrome"),ie:nn("IE"),opera:nn("Opera"),firefox:nn(Ae),safari:nn("Safari")},Ie="Windows",Re="Android",Ve="Solaris",Ne="FreeBSD",He=function(n){var t=n.current;return{current:t,version:n.version,isWindows:Mt(Ie,t),isiOS:Mt("iOS",t),isAndroid:Mt(Re,t),isOSX:Mt("OSX",t),isLinux:Mt("Linux",t),isSolaris:Mt(Ve,t),isFreeBSD:Mt(Ne,t)}},Pe={unknown:function(){return He({current:undefined,version:De.unknown()})},nu:He,windows:nn(Ie),ios:nn("iOS"),android:nn(Re),linux:nn("Linux"),osx:nn("OSX"),solaris:nn(Ve),freebsd:nn(Ne)},ze=function(n,e){return It(n,e).map(function(n){var t=De.detect(n.versionRegexes,e);return{current:n.name,version:t}})},Le=function(n,e){return It(n,e).map(function(n){var t=De.detect(n.versionRegexes,e);return{current:n.name,version:t}})},je=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Ue=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(n){return Rt(n,"edge/")&&Rt(n,"chrome")&&Rt(n,"safari")&&Rt(n,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,je],search:function(n){return Rt(n,"chrome")&&!Rt(n,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(n){return Rt(n,"msie")||Rt(n,"trident")}},{name:"Opera",versionRegexes:[je,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Vt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Vt("firefox")},{name:"Safari",versionRegexes:[je,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(n){return(Rt(n,"safari")||Rt(n,"mobile/"))&&Rt(n,"applewebkit")}}],We=[{name:"Windows",search:Vt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(n){return Rt(n,"iphone")||Rt(n,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Vt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Vt("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Vt("linux"),versionRegexes:[]},{name:"Solaris",search:Vt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Vt("freebsd"),versionRegexes:[]}],Ge={browsers:nn(Ue),oses:nn(We)},Xe=function(n){var t=Ge.browsers(),e=Ge.oses(),o=ze(t,n).fold(Me.unknown,Me.nu),r=Le(e,n).fold(Pe.unknown,Pe.nu);return{browser:o,os:r,deviceType:function(n,t,e){var o=n.isiOS()&&!0===/ipad/i.test(e),r=n.isiOS()&&!o,i=n.isAndroid()&&3===n.version.major,u=n.isAndroid()&&4===n.version.major,a=o||i||u&&!0===/mobile/i.test(e),c=n.isiOS()||n.isAndroid(),s=c&&!a,f=t.isSafari()&&n.isiOS()&&!1===/safari/i.test(e);return{isiPad:nn(o),isiPhone:nn(r),isTablet:nn(a),isPhone:nn(s),isTouch:nn(c),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:nn(f)}}(r,o,n)}},Ye={detect:L(function(){var n=M.navigator.userAgent;return Xe(n)})},qe=(M.Node.ATTRIBUTE_NODE,M.Node.CDATA_SECTION_NODE,M.Node.COMMENT_NODE,M.Node.DOCUMENT_NODE),Ke=(M.Node.DOCUMENT_TYPE_NODE,M.Node.DOCUMENT_FRAGMENT_NODE,M.Node.ELEMENT_NODE),Je=M.Node.TEXT_NODE,$e=(M.Node.PROCESSING_INSTRUCTION_NODE,M.Node.ENTITY_REFERENCE_NODE,M.Node.ENTITY_NODE,M.Node.NOTATION_NODE,Ke),Qe=qe,Ze=Ye.detect().browser.isIE()?function(n,t){return Ee(n.dom(),t.dom())}:function(n,t){var e=n.dom(),o=t.dom();return e!==o&&e.contains(o)},no=nn("touchstart"),to=nn("touchmove"),eo=nn("touchend"),oo=nn("mousedown"),ro=nn("mousemove"),io=nn("mouseout"),uo=nn("mouseup"),ao=nn("mouseover"),co=nn("focusin"),so=nn("focusout"),fo=nn("keydown"),lo=nn("keyup"),mo=nn("input"),go=nn("change"),po=nn("click"),ho=nn("transitionend"),vo=nn("selectstart"),bo={tap:nn("alloy.tap")},yo=nn("alloy.focus"),xo=nn("alloy.blur.post"),wo=nn("alloy.paste.post"),So=nn("alloy.receive"),ko=nn("alloy.execute"),Co=nn("alloy.focus.item"),Oo=bo.tap,To=Ye.detect().deviceType.isTouch()?bo.tap:po,Eo=nn("alloy.longpress"),Bo=nn("alloy.sandbox.close"),_o=nn("alloy.typeahead.cancel"),Do=nn("alloy.system.init"),Ao=nn("alloy.system.scroll"),Fo=nn("alloy.system.resize"),Mo=nn("alloy.system.attached"),Io=nn("alloy.system.detached"),Ro=nn("alloy.system.dismissRequested"),Vo=nn("alloy.focusmanager.shifted"),No=nn("alloy.slotcontainer.visibility"),Ho=nn("alloy.change.tab"),Po=nn("alloy.dismiss.tab"),zo=nn("alloy.highlight"),Lo=nn("alloy.dehighlight"),jo=function(n,t,e,o){var r=I({target:t},o);n.getSystem().triggerEvent(e,t,N(r,nn))};function Uo(n,t,e,o,r){return n(e,o)?on.some(e):dn(r)&&r(e)?on.none():t(e,o,r)}function Wo(n){return n.dom().nodeName.toLowerCase()}function Go(t){return function(n){return function(n){return n.dom().nodeType}(n)===t}}"undefined"!=typeof M.window?M.window:Function("return this;")();function Xo(n){var t=Ri(n)?n.dom().parentNode:n.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}function Yo(n,t,e){for(var o=n.dom(),r=dn(e)?e:nn(!1);o.parentNode;){o=o.parentNode;var i=Te.fromDom(o);if(t(i))return on.some(i);if(r(i))break}return on.none()}function qo(n,t,e){return Uo(function(n,t){return t(n)},Yo,n,t,e)}function Ko(n,r){var i=function(n){for(var t=0;t<n.childNodes.length;t++){var e=Te.fromDom(n.childNodes[t]);if(r(e))return on.some(e);var o=i(n.childNodes[t]);if(o.isSome())return o}return on.none()};return i(n.dom())}function Jo(n){return K(n)}function $o(n,t){return{key:n,value:jt({abort:t})}}function Qo(n){return{key:n,value:jt({run:function(n,t){t.event().prevent()}})}}function Zo(n,t){return{key:n,value:jt({run:t})}}function nr(n,t,e){return{key:n,value:jt({run:function(n){t.apply(undefined,[n].concat(e))}})}}function tr(n){return function(e){return{key:n,value:jt({run:function(n,t){Lt(n,t)&&e(n,t)}})}}}function er(n,t,e){return function(e,o){return Zo(e,function(n,t){n.getSystem().getByUid(o).each(function(n){qt(n,n.element(),e,t)})})}(n,t.partUids[e])}function or(n,r){return Zo(n,function(t,n){var e=n.event(),o=t.getSystem().getByDom(e.target()).fold(function(){return Hi(e.target(),function(n){return t.getSystem().getByDom(n).toOption()},nn(!1)).getOr(t)},function(n){return n});r(t,o,n)})}function rr(n){return Zo(n,function(n,t){t.cut()})}function ir(n,t){return tr(n)(t)}function ur(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(t.length!==e.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+e.length+" arguments");var o={};return bn(t,function(n,t){o[n]=nn(e[t])}),o}}function ar(n){return n.slice(0).sort()}function cr(t,n){if(!fn(n))throw new Error("The "+t+" fields must be an array. Was: "+n+".");bn(n,function(n){if(!cn(n))throw new Error("The value "+n+" in the "+t+" fields was not a string.")})}function sr(r,i){var u=r.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return cr("required",r),cr("optional",i),function(n){var e=ar(n);O(e,function(n,t){return t<e.length-1&&n===e[t+1]}).each(function(n){throw new Error("The field: "+n+" occurs more than once in the combined fields: ["+e.join(", ")+"].")})}(u),function(t){var e=xn(t);B(r,function(n){return vn(e,n)})||function(n,t){throw new Error("All required keys ("+ar(n).join(", ")+") were not specified. Specified keys were: "+ar(t).join(", ")+".")}(r,e);var n=S(e,function(n){return!vn(u,n)});0<n.length&&function(n){throw new Error("Unsupported keys for object: "+ar(n).join(", "))}(n);var o={};return bn(r,function(n){o[n]=nn(t[n])}),bn(i,function(n){o[n]=nn(Object.prototype.hasOwnProperty.call(t,n)?on.some(t[n]):on.none())}),o}}function fr(n){return Te.fromDom(n.dom().ownerDocument)}function lr(n){return Te.fromDom(n.dom().ownerDocument.defaultView)}function dr(n){return on.from(n.dom().parentNode).map(Te.fromDom)}function mr(n){return on.from(n.dom().offsetParent).map(Te.fromDom)}function gr(n){return w(n.dom().childNodes,Te.fromDom)}function pr(n,t){var e=n.dom().childNodes;return on.from(e[t]).map(Te.fromDom)}function hr(t,e){dr(t).each(function(n){n.dom().insertBefore(e.dom(),t.dom())})}function vr(n,t){(function(n){return on.from(n.dom().nextSibling).map(Te.fromDom)})(n).fold(function(){dr(n).each(function(n){Ui(n,t)})},function(n){hr(n,t)})}function br(t,e){(function(n){return pr(n,0)})(t).fold(function(){Ui(t,e)},function(n){t.dom().insertBefore(e.dom(),n.dom())})}function yr(t,n){bn(n,function(n){Ui(t,n)})}function xr(n){n.dom().textContent="",bn(gr(n),function(n){Wi(n)})}function wr(n){var t=gr(n);0<t.length&&function(t,n){bn(n,function(n){hr(t,n)})}(n,t),Wi(n)}function Sr(n){return n.dom().innerHTML}function kr(n,t){var e=fr(n).dom(),o=Te.fromDom(e.createDocumentFragment()),r=function(n,t){var e=(t||M.document).createElement("div");return e.innerHTML=n,gr(Te.fromDom(e))}(t,e);yr(o,r),xr(n),Ui(n,o)}function Cr(n,t,e){if(!(cn(e)||ln(e)||mn(e)))throw M.console.error("Invalid call to Attr.set. Key ",t,":: Value ",e,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(t,e+"")}function Or(n,t,e){Cr(n.dom(),t,e)}function Tr(n,t){var e=n.dom();Sn(t,function(n,t){Cr(e,t,n)})}function Er(n,t){var e=n.dom().getAttribute(t);return null===e?undefined:e}function Br(n,t){var e=n.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(t)}function _r(n,t){n.dom().removeAttribute(t)}function Dr(n){return function(n,t){return Te.fromDom(n.dom().cloneNode(t))}(n,!1)}function Ar(n){return function(n){var t=Te.fromTag("div"),e=Te.fromDom(n.dom().cloneNode(!0));return Ui(t,e),Sr(t)}(Dr(n))}function Fr(n){return Ar(n)}function Mr(n){var t=(new Date).getTime();return n+"_"+Math.floor(1e9*Math.random())+ ++Yi+String(t)}function Ir(n){return Mr(n)}function Rr(t){function n(n){return function(){throw new Error("The component must be in a context to send: "+n+"\n"+Fr(t().element())+" is not in context.")}}return{debugInfo:nn("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),build:n("build"),addToWorld:n("addToWorld"),removeFromWorld:n("removeFromWorld"),addToGui:n("addToGui"),removeFromGui:n("removeFromGui"),getByUid:n("getByUid"),getByDom:n("getByDom"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),isConnected:nn(!1)}}function Vr(n,t){var e=n.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:t,parameters:eu(i)}},n}function Nr(n){return q(ou,n)}function Hr(o){return function(n,t){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:eu(i.slice(1))}},n}(function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return o.apply(undefined,[n.getApis()].concat([n].concat(t)))},o)}function Pr(n,r){var i={};return Sn(n,function(n,o){Sn(n,function(n,t){var e=Y(t,[])(i);i[t]=e.concat([r(o,n)])})}),i}function zr(n){return{classes:n.classes!==undefined?n.classes:[],attributes:n.attributes!==undefined?n.attributes:{},styles:n.styles!==undefined?n.styles:{}}}function Lr(n){return n.cHandler}function jr(n,t){return{name:nn(n),handler:nn(t)}}function Ur(n,t,e){var o=I(I({},e),function(n,t){var e={};return bn(n,function(n){e[n.name()]=n.handlers(t)}),e}(t,n));return Pr(o,jr)}function Wr(n){var i=function(n){return dn(n)?{can:nn(!0),abort:nn(!1),run:n}:n}(n);return function(n,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=[n,t].concat(e);i.abort.apply(undefined,r)?t.stop():i.can.apply(undefined,r)&&i.run.apply(undefined,r)}}function Gr(n,t,e){var o=t[e];return o?function(u,a,n,c){var t=n.slice(0);try{var e=t.sort(function(n,t){var e=n[a](),o=t[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: "+JSON.stringify(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+JSON.stringify(c,null,2));return r<i?-1:i<r?1:0});return an.value(e)}catch(o){return an.error([o])}}("Event: "+e,"name",n,o).map(function(n){var t=w(n,function(n){return n.handler()});return Ut(t)}):function(n,t){return an.error(["The event ("+n+') 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: '+JSON.stringify(w(t,function(n){return n.name()}),null,2)])}(e,n)}function Xr(n){return nt("custom.definition",se([me("dom","dom",An(),se([at("tag"),wt("styles",{}),wt("classes",[]),wt("attributes",{}),pt("value"),pt("innerHtml")])),at("components"),at("uid"),wt("events",{}),wt("apis",{}),me("eventOrder","eventOrder",function(n){return Dn.mergeWithThunk(nn(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"]}),ve()),pt("domModification")]),n)}function Yr(n,t){var e=Er(n,t);return e===undefined||""===e?[]:e.split(" ")}function qr(n){return n.dom().classList!==undefined}function Kr(n,t){return function(n,t,e){var o=Yr(n,t).concat([e]);return Or(n,t,o.join(" ")),!0}(n,"class",t)}function Jr(n,t){return function(n,t,e){var o=S(Yr(n,t),function(n){return n!==e});return 0<o.length?Or(n,t,o.join(" ")):_r(n,t),!1}(n,"class",t)}function $r(n,t){qr(n)?n.dom().classList.add(t):Kr(n,t)}function Qr(n){0===(qr(n)?n.dom().classList:function(n){return Yr(n,"class")}(n)).length&&_r(n,"class")}function Zr(n,t){qr(n)?n.dom().classList.remove(t):Jr(n,t),Qr(n)}function ni(n,t){return qr(n)&&n.dom().classList.contains(t)}function ti(t,n){bn(n,function(n){$r(t,n)})}function ei(t,n){bn(n,function(n){Zr(t,n)})}function oi(n){return n.style!==undefined&&dn(n.style.getPropertyValue)}function ri(n,t,e){if(!cn(e))throw M.console.error("Invalid call to CSS.set. Property ",t,":: Value ",e,":: Element ",n),new Error("CSS value must be a string: "+e);oi(n)&&n.style.setProperty(t,e)}function ii(n,t){oi(n)&&n.style.removeProperty(t)}function ui(n,t,e){var o=n.dom();ri(o,t,e)}function ai(n,t){var e=n.dom();Sn(t,function(n,t){ri(e,t,n)})}function ci(n,t){var e=n.dom(),o=M.window.getComputedStyle(e).getPropertyValue(t),r=""!==o||Xo(n)?o:cu(e,t);return null===r?undefined:r}function si(n,t){var e=n.dom(),o=cu(e,t);return on.from(o).filter(function(n){return 0<n.length})}function fi(n,t,e){var o=Te.fromTag(n);return ui(o,t,e),si(o,t).isSome()}function li(n,t){var e=n.dom();ii(e,t),Br(n,"style")&&""===function(n){return n.replace(/^\s+|\s+$/g,"")}(Er(n,"style"))&&_r(n,"style")}function di(n){return n.dom().offsetWidth}function mi(n){return n.dom().value}function gi(n,t){if(t===undefined)throw new Error("Value.set was undefined");n.dom().value=t}function pi(n,t){return function(t,n){var e=w(n,function(n){return xt(n.name(),[at("config"),wt("state",ru)])}),o=nt("component.behaviours",se(e),t.behaviours).fold(function(n){throw new Error(he(n)+"\nComplete spec:\n"+JSON.stringify(t,null,2))},function(n){return n});return{list:n,data:N(o,function(n){var t=n.map(function(n){return{config:n.config,state:n.state.init(n.config)}});return function(){return t}})}}(n,t)}function hi(n){var t=function(n){var t=Y("behaviours",{})(n),e=S(xn(t),function(n){return t[n]!==undefined});return w(e,function(n){return t[n].me})}(n);return pi(n,t)}function vi(n,t,e){var o=function(n){return I(I({},n.dom),{uid:n.uid,domChildren:w(n.components,function(n){return n.element()})})}(n),r=function(n){return n.domModification.fold(function(){return zr({})},zr)}(n),i={"alloy.base.modification":r};return function(n,t){return I(I({},n),{attributes:I(I({},n.attributes),t.attributes),styles:I(I({},n.styles),t.styles),classes:n.classes.concat(t.classes)})}(o,0<t.length?function(t,n,e,o){var r=I({},n);bn(e,function(n){r[n.name()]=n.exhibit(t,o)});function i(n){return k(n,function(n,t){return I(I({},t.modification),n)},{})}var u=Pr(r,function(n,t){return{name:n,modification:t}}),a=k(u.classes,function(n,t){return t.modification.concat(n)},[]),c=i(u.attributes),s=i(u.styles);return zr({classes:a,attributes:c,styles:s})}(e,i,t,o):r)}function bi(n,t,e){var o={"alloy.base.behaviour":function(n){return n.events}(n)};return function(n,t,e,o){var r=Ur(n,e,o);return au(r,t)}(e,n.eventOrder,t,o).getOrDie()}function yi(e){function n(){return f}var o=Ce(tu),t=tt(Xr(e)),r=hi(e),i=function(n){return n.list}(r),u=function(n){return n.data}(r),a=function(n){var t=Te.fromTag(n.tag);Tr(t,n.attributes),ti(t,n.classes),ai(t,n.styles),n.innerHtml.each(function(n){return kr(t,n)});var e=n.domChildren;return yr(t,e),n.value.each(function(n){gi(t,n)}),n.uid,Qi(t,n.uid),t}(vi(t,i,u)),c=bi(t,i,u),s=Ce(t.components),f={getSystem:o.get,config:function(n){var t=u;return(dn(t[n.name()])?t[n.name()]:function(){throw new Error("Could not find "+n.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:function(n){return dn(u[n.name()])},spec:nn(e),readState:function(n){return u[n]().map(function(n){return n.state.readState()}).getOr("not enabled")},getApis:function(){return t.apis},connect:function(n){o.set(n)},disconnect:function(){o.set(Rr(n))},element:nn(a),syncComponents:function(){var n=gr(a),t=E(n,function(n){return o.get().getByDom(n).fold(function(){return[]},function(n){return[n]})});s.set(t)},components:s.get,events:nn(c)};return f}function xi(n){var t=nu(n),e=t.events,o=a(t,["events"]),r=function(n){var t=Y("components",[])(n);return w(t,lu)}(o),i=I(I({},o),{events:I(I({},Xi),e),components:r});return an.value(yi(i))}function wi(n){var t=Te.fromText(n);return su({element:t})}function Si(n,t,e){return Yo(n,function(n){return Nt(n,t)},e)}function ki(n,t){return function(n,t){var e=t===undefined?M.document:t.dom();return Ht(e)?on.none():on.from(e.querySelector(n)).map(Te.fromDom)}(t,n)}function Ci(n,t,e){return Uo(Nt,Si,n,t,e)}function Oi(){var t=Mr("aria-owns");return{id:nn(t),link:function(n){Or(n,"aria-owns",t)},unlink:function(n){_r(n,"aria-owns")}}}function Ti(t,n){return function(n){return qo(n,function(n){if(!Ii(n))return!1;var t=Er(n,"id");return t!==undefined&&-1<t.indexOf("aria-owns")}).bind(function(n){var t=Er(n,"id"),e=fr(n);return ki(e,'[aria-owns="'+t+'"]')})}(n).exists(function(n){return mu(t,n)})}function Ei(n){for(var t=[],e=function(n){t.push(n)},o=0;o<n.length;o++)n[o].each(e);return t}function Bi(n,t){for(var e=0;e<n.length;e++){var o=t(n[e],e);if(o.isSome())return o}return on.none()}var _i,Di,Ai,Fi,Mi,Ii=Go(Ke),Ri=Go(Je),Vi=L(function(){return Ni(Te.fromDom(M.document))}),Ni=function(n){var t=n.dom().body;if(null===t||t===undefined)throw new Error("Body is not available yet");return Te.fromDom(t)},Hi=function(n,t,e){return qo(n,function(n){return t(n).isSome()},e).bind(t)},Pi=tr(Mo()),zi=tr(Io()),Li=tr(Do()),ji=(_i=ko(),function(n){return Zo(_i,n)}),Ui=(ur("element","offset"),function(n,t){n.dom().appendChild(t.dom())}),Wi=function(n){var t=n.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},Gi=Jo([(Di=yo(),Ai=function(n,t){var e=t.event().originator(),o=t.event().target();return!function(n,t,e){return zt(t,n.element())&&!zt(t,e)}(n,e,o)||(M.console.warn(yo()+" did not get interpreted by the desired target. \nOriginator: "+Fr(e)+"\nTarget: "+Fr(o)+"\nCheck the "+yo()+" event handlers"),!1)},{key:Di,value:jt({can:Ai})})]),Xi=/* */Object.freeze({events:Gi}),Yi=0,qi=nn("alloy-id-"),Ki=nn("data-alloy-id"),Ji=qi(),$i=Ki(),Qi=function(n,t){Object.defineProperty(n.dom(),$i,{value:t,writable:!0})},Zi=function(n){var t=Ii(n)?n.dom()[$i]:null;return on.from(t)},nu=f,tu=Rr(),eu=function(n){return w(n,function(n){return function(n,t){return function(n,t,e){return""===t||!(n.length<t.length)&&n.substr(e,e+t.length)===t}(n,t,n.length-t.length)}(n,"/*")?n.substring(0,n.length-"/*".length):n})},ou=Mr("alloy-premade"),ru={init:function(){return iu({readState:function(){return"No State required"}})}},iu=function(n){return n},uu=function(n,t){return function(n,t){return{cHandler:n,purpose:nn(t)}}(l.apply(undefined,[n.handler].concat(t)),n.purpose())},au=function(n,i){var t=Cn(n,function(o,r){return(1===o.length?an.value(o[0].handler()):Gr(o,i,r)).map(function(n){var t=Wr(n),e=1<o.length?S(i[r],function(t){return y(o,function(n){return n.name()===t})}).join(" > "):o[0].name();return q(r,function(n,t){return{handler:n,purpose:nn(t)}}(t,e))})});return J(t,{})},cu=function(n,t){return oi(n)?n.style.getPropertyValue(t):""},su=function(n){var t=et("external.component",Yn([at("element"),pt("uid")]),n),e=Ce(Rr());t.uid.each(function(n){Qi(t.element,n)});var o={getSystem:e.get,config:on.none,hasConfigured:nn(!1),connect:function(n){e.set(n)},disconnect:function(){e.set(Rr(function(){return o}))},getApis:function(){return{}},element:nn(t.element),spec:nn(n),readState:nn("No state"),syncComponents:Z,components:nn([]),events:nn({})};return Nr(o)},fu=Ir,lu=function(t){return function(n){return Vn(n,ou)}(t).fold(function(){var n=t.hasOwnProperty("uid")?t:I({uid:fu("")},t);return xi(n).getOrDie()},function(n){return n})},du=Nr,mu=function(t,n){return function(n,t,e){return qo(n,t,e).isSome()}(n,function(n){return zt(n,t.element())},nn(!1))||Ti(t,n)},gu="unknown";(Mi=Fi=Fi||{})[Mi.STOP=0]="STOP",Mi[Mi.NORMAL=1]="NORMAL",Mi[Mi.LOGGING=2]="LOGGING";function pu(t,n,e){switch(Vn(Ru.get(),t).orThunk(function(){var n=xn(Ru.get());return Bi(n,function(n){return-1<t.indexOf(n)?on.some(Ru.get()[n]):on.none()})}).getOr(Fi.NORMAL)){case Fi.NORMAL:return e(Nu());case Fi.LOGGING:var o=function(t,e){var o=[],r=(new Date).getTime();return{logEventCut:function(n,t,e){o.push({outcome:"cut",target:t,purpose:e})},logEventStopped:function(n,t,e){o.push({outcome:"stopped",target:t,purpose:e})},logNoParent:function(n,t,e){o.push({outcome:"no-parent",target:t,purpose:e})},logEventNoHandlers:function(n,t){o.push({outcome:"no-handlers-left",target:t})},logEventResponse:function(n,t,e){o.push({outcome:"response",purpose:e,target:t})},write:function(){var n=(new Date).getTime();vn(["mousemove","mouseover","mouseout",Do()],t)||M.console.log(t,{event:t,time:n-r,target:e.dom(),sequence:w(o,function(n){return vn(["cut","stopped","response"],n.outcome)?"{"+n.purpose+"} "+n.outcome+" at ("+Fr(n.target)+")":n.outcome})})}}}(t,n),r=e(o);return o.write(),r;case Fi.STOP:return!0}}function hu(n,t,e){return pu(n,t,e)}function vu(){return dt("markers",[at("backgroundMenu")].concat(Hu()).concat(Pu()))}function bu(n){return dt("markers",w(n,at))}function yu(n,t,e){return function(){var n=new Error;if(n.stack===undefined)return;var t=n.stack.split("\n");O(t,function(t){return 0<t.indexOf("alloy")&&!y(Vu,function(n){return-1<t.indexOf(n)})}).getOr(gu)}(),me(t,t,e,Qn(function(e){return an.value(function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.apply(undefined,n)})}))}function xu(n){return yu(0,n,j(Z))}function wu(n){return yu(0,n,j(on.none))}function Su(n){return yu(0,n,An())}function ku(n){return yu(0,n,An())}function Cu(n,t){return _t(n,nn(t))}function Ou(n){return _t(n,f)}function Tu(e,o,r){return Li(function(n,t){r(n,e,o)})}function Eu(n,t,e,o,r,i){var u=Yn(n),a=xt(t,[function(n,t){return ht(n,Yn(t))}("config",n)]);return Uu(u,a,t,e,o,r,i)}function Bu(r,i,u){return function(n,t,e){var o=e.toString(),r=o.indexOf(")")+1,i=o.indexOf("("),u=o.substring(i+1,r-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:t,parameters:eu(u.slice(0,1).concat(u.slice(3)))}},n}(function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var o=[e].concat(n);return e.config({name:nn(r)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+r+". Using API: "+u)},function(n){var t=Array.prototype.slice.call(o,1);return i.apply(undefined,[e,n.config,n.state].concat(t))})},u,i)}function _u(n){return{key:n,value:undefined}}function Du(n){return K(n)}function Au(n){var t=et("Creating behaviour: "+n.name,Wu,n);return Eu(t.fields,t.name,t.active,t.apis,t.extra,t.state)}function Fu(n){var t=et("Creating behaviour: "+n.name,Gu,n);return function(n,t,e,o,r,i){var u=n,a=xt(t,[ht("config",n)]);return Uu(u,a,t,e,o,r,i)}(rt(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)}function Mu(n,t){return n!==undefined?n:t!==undefined?t:0}function Iu(n){var t=n.dom().ownerDocument,e=t.body,o=t.defaultView,r=t.documentElement,i=Mu(o.pageYOffset,r.scrollTop),u=Mu(o.pageXOffset,r.scrollLeft),a=Mu(r.clientTop,e.clientTop),c=Mu(r.clientLeft,e.clientLeft);return Zu(n).translate(u-c,i-a)}var Ru=Ce({}),Vu=["alloy/data/Fields","alloy/debugging/Debugging"],Nu=nn({logEventCut:Z,logEventStopped:Z,logNoParent:Z,logEventNoHandlers:Z,logEventResponse:Z,write:Z}),Hu=nn([at("menu"),at("selectedMenu")]),Pu=nn([at("item"),at("selectedItem")]),zu=(nn(se(Pu().concat(Hu()))),nn(se(Pu()))),Lu=dt("initSize",[at("numColumns"),at("numRows")]),ju=nn(Lu),Uu=function(e,n,o,r,t,i,u){function a(n){return $(n,o)?n[o]():on.none()}var c=N(t,function(n,t){return Bu(o,n,t)}),s=N(i,function(n,t){return Vr(n,t)}),f=I(I(I({},s),c),{revoke:l(_u,o),config:function(n){var t=et(o+"-config",e,n);return{key:o,value:{config:t,me:f,configAsRaw:L(function(){return et(o+"-config",e,n)}),initialConfig:n,state:u}}},schema:function(){return n},exhibit:function(n,e){return a(n).bind(function(t){return Vn(r,"exhibit").map(function(n){return n(e,t.config,t.state)})}).getOr(zr({}))},name:function(){return o},handlers:function(n){return a(n).map(function(n){return Y("events",function(n,t){return{}})(r)(n.config,n.state)}).getOr({})}});return f},Wu=Yn([at("fields"),at("name"),wt("active",{}),wt("apis",{}),wt("state",ru),wt("extra",{})]),Gu=Yn([at("branchKey"),at("branches"),at("name"),wt("active",{}),wt("apis",{}),wt("state",ru),wt("extra",{})]),Xu=nn(undefined),Yu=/* */Object.freeze({events:function(t){return Jo([Zo(So(),function(r,i){var u=t.channels,n=function(n,t){return t.universal()?n:S(n,function(n){return vn(t.channels(),n)})}(xn(u),i);bn(n,function(n){var t=u[n],e=t.schema,o=et("channel["+n+"] data\nReceiver: "+Fr(r.element()),e,i.data());t.onReceive(r,o)})})])}}),qu=[ct("channels",Zn(an.value,Yn([Su("onReceive"),wt("schema",ve())])))],Ku=Au({fields:qu,name:"receiving",active:Yu}),Ju=/* */Object.freeze({exhibit:function(n,t){return zr({classes:[],styles:t.useFixed?{}:{position:"relative"}})}}),$u=function(e,o){return{left:nn(e),top:nn(o),translate:function(n,t){return $u(e+n,o+t)}}},Qu=$u,Zu=function(n){var t=n.dom(),e=t.ownerDocument.body;return e===t?Qu(e.offsetLeft,e.offsetTop):Xo(n)?function(n){var t=n.getBoundingClientRect();return Qu(t.left,t.top)}(t):Qu(0,0)};function na(o,r){function n(n){var t=r(n);if(t<=0||null===t){var e=ci(n,o);return parseFloat(e)||0}return t}function i(r,n){return C(n,function(n,t){var e=ci(r,t),o=e===undefined?0:parseInt(e,10);return isNaN(o)?n:n+o},0)}return{set:function(n,t){if(!mn(t)&&!t.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+t);var e=n.dom();oi(e)&&(e.style[o]=t+"px")},get:n,getOuter:n,aggregate:i,max:function(n,t,e){var o=i(n,e);return o<t?t-o:0}}}function ta(n){return za.get(n)}function ea(n){return za.getOuter(n)}function oa(n){return La.get(n)}function ra(n){return La.getOuter(n)}function ia(n){var t=n!==undefined?n.dom():M.document,e=t.body.scrollLeft||t.documentElement.scrollLeft,o=t.body.scrollTop||t.documentElement.scrollTop;return Qu(e,o)}function ua(o){var n=Te.fromDom(M.document),r=ia(n);return function(n,t){var e=t.owner(n),o=ja(t,e);return on.some(o)}(o,Ua).fold(l(Iu,o),function(n){var t=Zu(o),e=k(n,function(n,t){var e=Zu(t);return{left:n.left+e.left(),top:n.top+e.top()}},{left:0,top:0});return Qu(e.left+t.left()+r.left(),e.top+t.top()+r.top())})}function aa(n,t,e,o){return{x:nn(n),y:nn(t),width:nn(e),height:nn(o),right:nn(n+e),bottom:nn(t+o)}}function ca(n){var t=Iu(n),e=ra(n),o=ea(n);return aa(t.left(),t.top(),e,o)}function sa(){var n=M.window.innerWidth,t=M.window.innerHeight,e=Te.fromDom(M.document),o=ia(e);return aa(o.left(),o.top(),n,t)}function fa(n,t,e){function r(n){return Vn(e,n).getOr([])}function o(n,t,e){var o=D(Xa,e);return{offset:function(){return Qu(n,t)},classesOn:function(){return E(e,r)},classesOff:function(){return E(o,r)}}}return{southeast:function(){return o(-n,t,["top","alignLeft"])},southwest:function(){return o(n,t,["top","alignRight"])},south:function(){return o(-n/2,t,["top","alignCentre"])},northeast:function(){return o(-n,-t,["bottom","alignLeft"])},northwest:function(){return o(n,-t,["bottom","alignRight"])},north:function(){return o(-n/2,-t,["bottom","alignCentre"])},east:function(){return o(n,-t/2,["valignCentre","left"])},west:function(){return o(-n,-t/2,["valignCentre","right"])},innerNorthwest:function(){return o(-n,t,["top","alignRight"])},innerNortheast:function(){return o(n,t,["top","alignLeft"])},innerNorth:function(){return o(-n/2,t,["top","alignCentre"])},innerSouthwest:function(){return o(-n,-t,["bottom","alignRight"])},innerSoutheast:function(){return o(n,-t,["bottom","alignLeft"])},innerSouth:function(){return o(-n/2,-t,["bottom","alignCentre"])},innerWest:function(){return o(n,-t/2,["valignCentre","right"])},innerEast:function(){return o(-n,-t/2,["valignCentre","left"])}}}function la(){return fa(0,0,{})}function da(n){return n.x()}function ma(n,t){return n.x()+n.width()/2-t.width()/2}function ga(n,t){return n.x()+n.width()-t.width()}function pa(n,t){return n.y()-t.height()}function ha(n){return n.y()+n.height()}function va(n,t){return n.y()+n.height()/2-t.height()/2}function ba(n,t,e){return Ya(da(n),ha(n),e.southeast(),Ka(),"layout-se")}function ya(n,t,e){return Ya(ga(n,t),ha(n),e.southwest(),Ja(),"layout-sw")}function xa(n,t,e){return Ya(da(n),pa(n,t),e.northeast(),$a(),"layout-ne")}function wa(n,t,e){return Ya(ga(n,t),pa(n,t),e.northwest(),Qa(),"layout-nw")}function Sa(n,t,e){return Ya(ma(n,t),pa(n,t),e.north(),nc(),"layout-n")}function ka(n,t,e){return Ya(ma(n,t),ha(n),e.south(),Za(),"layout-s")}function Ca(n,t,e){return Ya(function(n){return n.x()+n.width()}(n),va(n,t),e.east(),tc(),"layout-e")}function Oa(n,t,e){return Ya(function(n,t){return n.x()-t.width()}(n,t),va(n,t),e.west(),ec(),"layout-w")}function Ta(){return[ba,ya,xa,wa,ka,Sa,Ca,Oa]}function Ea(){return[ya,ba,wa,xa,ka,Sa,Ca,Oa]}function Ba(n,t,e,o,r,i){var u=t.x()-e,a=t.y()-o,c=r-(u+t.width()),s=i-(a+t.height()),f=on.some(u),l=on.some(a),d=on.some(c),m=on.some(s),g=on.none();return function(n,t,e,o,r,i,u,a,c){return n.fold(t,e,o,r,i,u,a,c)}(t.direction(),function(){return rc(n,f,l,g,g)},function(){return rc(n,g,l,d,g)},function(){return rc(n,f,g,g,m)},function(){return rc(n,g,g,d,m)},function(){return rc(n,f,l,g,g)},function(){return rc(n,f,g,g,m)},function(){return rc(n,f,l,g,g)},function(){return rc(n,g,l,d,g)})}function _a(n,t){var e=l(ua,t),o=n.fold(e,e,function(){var n=ia();return ua(t).translate(-n.left(),-n.top())}),r=ra(t),i=ea(t);return aa(o.left(),o.top(),r,i)}function Da(n){return n}function Aa(t,e){return function(n){return"rtl"===cc(n)?e:t}}function Fa(){return xt("layouts",[at("onLtr"),at("onRtl")])}function Ma(t,n,e,o){var r=n.layouts.map(function(n){return n.onLtr(t)}).getOr(e),i=n.layouts.map(function(n){return n.onRtl(t)}).getOr(o);return Aa(r,i)(t)}function Ia(n,t,e){var o=n.document.createRange();return function(e,n){n.fold(function(n){e.setStartBefore(n.dom())},function(n,t){e.setStart(n.dom(),t)},function(n){e.setStartAfter(n.dom())})}(o,t),function(e,n){n.fold(function(n){e.setEndBefore(n.dom())},function(n,t){e.setEnd(n.dom(),t)},function(n){e.setEndAfter(n.dom())})}(o,e),o}function Ra(n,t,e,o,r){var i=n.document.createRange();return i.setStart(t.dom(),e),i.setEnd(o.dom(),r),i}function Va(n){return{left:nn(n.left),top:nn(n.top),right:nn(n.right),bottom:nn(n.bottom),width:nn(n.width),height:nn(n.height)}}function Na(n,t,e){return t(Te.fromDom(e.startContainer),e.startOffset,Te.fromDom(e.endContainer),e.endOffset)}function Ha(n,t){return function(n,t){var e=t.ltr();return e.collapsed?t.rtl().filter(function(n){return!1===n.collapsed}).map(function(n){return hc.rtl(Te.fromDom(n.endContainer),n.endOffset,Te.fromDom(n.startContainer),n.startOffset)}).getOrThunk(function(){return Na(0,hc.ltr,e)}):Na(0,hc.ltr,e)}(0,function(r,n){return n.match({domRange:function(n){return{ltr:nn(n),rtl:on.none}},relative:function(n,t){return{ltr:L(function(){return Ia(r,n,t)}),rtl:L(function(){return on.some(Ia(r,t,n))})}},exact:function(n,t,e,o){return{ltr:L(function(){return Ra(r,n,t,e,o)}),rtl:L(function(){return on.some(Ra(r,e,o,n,t))})}}})}(n,t))}function Pa(n,t,e){return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}var za=na("height",function(n){var t=n.dom();return Xo(n)?t.getBoundingClientRect().height:t.offsetHeight}),La=na("width",function(n){return n.dom().offsetWidth}),ja=(Ye.detect().browser.isSafari(),function(o,n){return o.view(n).fold(nn([]),function(n){var t=o.owner(n),e=ja(o,t);return[n].concat(e)})}),Ua=/* */Object.freeze({view:function(n){return(n.dom()===M.document?on.none():on.from(n.dom().defaultView.frameElement)).map(Te.fromDom)},owner:function(n){return fr(n)}}),Wa=ur("point","width","height"),Ga=ur("x","y","width","height"),Xa=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],Ya=ur("x","y","bubble","direction","label"),qa=Tn([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Ka=qa.southeast,Ja=qa.southwest,$a=qa.northeast,Qa=qa.northwest,Za=qa.south,nc=qa.north,tc=qa.east,ec=qa.west,oc=sr(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),rc=ur("position","left","top","right","bottom"),ic=Tn([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),uc=ic.relative,ac=ic.fixed,cc=function(n){return"rtl"===ci(n,"direction")?"rtl":"ltr"},sc=[at("hotspot"),pt("bubble"),wt("overrides",{}),Fa(),Cu("placement",function(n,t,e){var o=t.hotspot,r=_a(e,o.element()),i=Ma(n.element(),t,Ta(),Ea());return on.some(Da({anchorBox:r,bubble:t.bubble.getOr(la()),overrides:t.overrides,layouts:i,placer:on.none()}))})],fc=[at("x"),at("y"),wt("height",0),wt("width",0),wt("bubble",la()),wt("overrides",{}),Fa(),Cu("placement",function(n,t,e){var o=aa(t.x,t.y,t.width,t.height),r=Ma(n.element(),t,Ta(),Ea());return on.some(Da({anchorBox:o,bubble:t.bubble,overrides:t.overrides,layouts:r,placer:on.none()}))})],lc={create:ur("start","soffset","finish","foffset")},dc=Tn([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),mc=(dc.before,dc.on,dc.after,function(n){return n.fold(f,f,f)}),gc=Tn([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),pc={domRange:gc.domRange,relative:gc.relative,exact:gc.exact,exactFromRange:function(n){return gc.exact(n.start(),n.soffset(),n.finish(),n.foffset())},getWin:function(n){var t=function(n){return n.match({domRange:function(n){return Te.fromDom(n.startContainer)},relative:function(n,t){return mc(n)},exact:function(n,t,e,o){return n}})}(n);return lr(t)},range:lc.create},hc=Tn([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]);function vc(n){return Is.get(n)}function bc(n){return Is.getOption(n)}function yc(e,o,n,t,r){function i(n){var t=e.dom().createRange();return t.setStart(o.dom(),n),t.collapse(!0),t}var u=vc(o).length,a=function(n,t,e,o,r){if(0===r)return 0;if(t===o)return r-1;for(var i=o,u=1;u<r;u++){var a=n(u),c=Math.abs(t-a.left);if(e<=a.bottom){if(e<a.top||i<c)return u-1;i=c}}return 0}(function(n){return i(n).getBoundingClientRect()},n,t,r.right,u);return i(a)}function xc(n){return function(n){return bc(n).filter(function(n){return 0!==n.trim().length||-1<n.indexOf("\xa0")}).isSome()}(n)||vn(Vs,Wo(n))}function wc(n){return Ko(n,xc)}function Sc(n){return Ns(n,xc)}function kc(n,t){return t-n.left<n.right-t}function Cc(n,t,e){var o=n.dom().createRange();return o.selectNode(t.dom()),o.collapse(e),o}function Oc(t,n,e){var o=t.dom().createRange();o.selectNode(n.dom());var r=o.getBoundingClientRect(),i=kc(r,e);return(!0===i?wc:Sc)(n).map(function(n){return Cc(t,n,i)})}function Tc(n,t,e){var o=t.dom().getBoundingClientRect(),r=kc(o,e);return on.some(Cc(n,t,r))}function Ec(n,t,e,o){var r=n.dom().createRange();r.selectNode(t.dom());var i=r.getBoundingClientRect();return function(n,t,e,o){var r=n.dom().createRange();r.selectNode(t.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 Rs(n,t,u,a)}(n,t,Math.max(i.left,Math.min(i.right,e)),Math.max(i.top,Math.min(i.bottom,o)))}function Bc(n,t){return Pt(t,n)}function _c(n,t,e,o){var r=function(n,t,e,o){var r=fr(n).dom().createRange();return r.setStart(n.dom(),t),r.setEnd(e.dom(),o),r}(n,t,e,o),i=zt(n,e)&&t===o;return r.collapsed&&!i}function Dc(n){var t=Te.fromDom(n.anchorNode),e=Te.fromDom(n.focusNode);return _c(t,n.anchorOffset,e,n.focusOffset)?on.some(lc.create(t,n.anchorOffset,e,n.focusOffset)):function(n){if(0<n.rangeCount){var t=n.getRangeAt(0),e=n.getRangeAt(n.rangeCount-1);return on.some(lc.create(Te.fromDom(t.startContainer),t.startOffset,Te.fromDom(e.endContainer),e.endOffset))}return on.none()}(n)}function Ac(n,t){return function(n){var t=n.getClientRects(),e=0<t.length?t[0]:n.getBoundingClientRect();return 0<e.width||0<e.height?on.some(e).map(Va):on.none()}(function(i,n){return Ha(i,n).match({ltr:function(n,t,e,o){var r=i.document.createRange();return r.setStart(n.dom(),t),r.setEnd(e.dom(),o),r},rtl:function(n,t,e,o){var r=i.document.createRange();return r.setStart(e.dom(),o),r.setEnd(n.dom(),t),r}})}(n,t))}function Fc(n){return n.fold(function(n){return n},function(n,t,e){return n.translate(-t,-e)})}function Mc(n){return n.fold(function(n){return n},function(n,t,e){return n})}function Ic(n){return C(n,function(n,t){return n.translate(t.left(),t.top())},Qu(0,0))}function Rc(n){var t=w(n,Mc);return Ic(t)}function Vc(n,t,e){var o=fr(n.element()),r=ia(o),i=function(o,n,t){var e=lr(t.root).dom();return on.from(e.frameElement).map(Te.fromDom).filter(function(n){var t=fr(n),e=fr(o.element());return zt(t,e)}).map(Iu)}(n,0,e).getOr(r);return Ls(i,r.left(),r.top())}function Nc(n,t){return Ri(n)?Ws(n,t):function(n,t){var e=gr(n);if(0===e.length)return Hs(n,t);if(t<e.length)return Hs(e[t],0);var o=e[e.length-1],r=Ri(o)?vc(o).length:gr(o).length;return Hs(o,r)}(n,t)}function Hc(n,t){return t.getSelection.getOrThunk(function(){return function(){return function(n){return on.from(n.getSelection()).filter(function(n){return 0<n.rangeCount}).bind(Dc)}(n)}})().map(function(n){var t=Nc(n.start(),n.soffset()),e=Nc(n.finish(),n.foffset());return pc.range(t.element(),t.offset(),e.element(),e.offset())})}function Pc(n){return n.x()+n.width()}function zc(n,t){return n.x()-t.width()}function Lc(n,t){return n.y()-t.height()+n.height()}function jc(n){return n.y()}function Uc(n,t,e){return Ya(Pc(n),jc(n),e.southeast(),Ka(),"link-layout-se")}function Wc(n,t,e){return Ya(zc(n,t),jc(n),e.southwest(),Ja(),"link-layout-sw")}function Gc(n,t,e){return Ya(Pc(n),Lc(n,t),e.northeast(),$a(),"link-layout-ne")}function Xc(n,t,e){return Ya(zc(n,t),Lc(n,t),e.northwest(),Qa(),"link-layout-nw")}function Yc(n,t,e,u,a){function o(n,o,r,i){return function(n,t,e,o){var r=n.x(),i=n.y(),u=n.bubble().offset().left(),a=n.bubble().offset().top(),c=o.x(),s=o.y(),f=o.width(),l=o.height(),d=r+u,m=i+a,g=c<=d,p=s<=m,h=g&&p,v=d+t<=c+f&&m+e<=s+l,b=g?Math.min(t,c+f-d):Math.abs(c-(d+t)),y=p?Math.min(e,s+l-m):Math.abs(s-(m+e)),x=o.x()+o.width(),w=Math.max(o.x(),d),S=Math.min(w,x),k=p?m:m+(e-y),C=nn(k+y-s),O=nn(s+l-k),T=function(n,t,e,o){return n.fold(t,t,o,o,t,o,e,e)}(n.direction(),O,O,C),E=oc({x:S,y:k,width:b,height:y,maxHeight:T,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:m});return h&&v?Js.fit(E):Js.nofit(E,b,y)}(n(t,e,u),c,s,a).fold(Js.fit,function(n,t,e){return i<e||r<t?Js.nofit(n,t,e):Js.nofit(o,r,i)})}var c=e.width(),s=e.height();return C(n,function(n,t){var e=l(o,t);return n.fold(Js.fit,e)},Js.nofit(oc({x:t.x(),y:t.y(),width:e.width(),height:e.height(),maxHeight:e.height(),direction:Ka(),classes:[],label:"none",candidateYforTest:t.y()}),-1,-1)).fold(f,f)}function qc(n,t,e,o){li(t,"max-height");var r=function(n){return{width:nn(ra(n)),height:nn(ea(n))}}(t);return Yc(o.preference(),n,r,e,o.bounds())}function Kc(n,t,e){function o(n){return n+"px"}var r=function(n,r){return n.fold(function(){return rc("absolute",on.some(r.x()),on.some(r.y()),on.none(),on.none())},function(n,t,e,o){return Ba("absolute",r,n,t,e,o)},function(n,t,e,o){return Ba("fixed",r,n,t,e,o)})}(e.origin(),t);!function(n,t){var e=n.dom();Sn(t,function(n,t){n.fold(function(){ii(e,t)},function(n){ri(e,t,n)})})}(n,{position:on.some(r.position()),left:r.left().map(o),top:r.top().map(o),right:r.right().map(o),bottom:r.bottom().map(o)})}function Jc(n,t){!function(n,t){var e=za.max(n,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);ui(n,"max-height",e+"px")}(n,Math.floor(t))}function $c(n,t,e,o,r,i){var u=function(n,t,e){return n[t]===undefined?e:n[t]}(i,"maxHeightFunction",$s()),a=n.anchorBox(),c=n.origin(),s=Zs({bounds:function(t,n){return n.fold(function(){return t.fold(sa,sa,aa)},function(n){return t.fold(n,n,aa)})}(c,r),origin:c,preference:o,maxHeightFunction:u});nf(a,t,e,s)}function Qc(n,t,e,o,r){var i=function(n,t){return Ks(n,t)}(e.anchorBox,t);$c(i,r.element(),e.bubble,e.layouts,o,e.overrides)}function Zc(n,t){sf(n,t,Ui)}function ns(n){af(n),Wi(n.element()),n.getSystem().removeFromWorld(n)}function ts(t){var n=dr(t.element()).bind(function(n){return t.getSystem().getByDom(n).toOption()});ns(t),n.each(function(n){n.syncComponents()})}function es(n){var t=n.components();bn(t,ns),xr(n.element()),n.syncComponents()}function os(n,t){ff(n,t,Ui)}function rs(t){var n=gr(t.element());bn(n,function(n){t.getByDom(n).each(af)}),Wi(t.element())}function is(n,t,e,o){var r=function(t,n,e,o){e.get().each(function(n){es(t)});var r=n.getAttachPoint(t);Zc(r,t);var i=t.getSystem().build(o);return Zc(t,i),e.set(i),i}(n,t,e,o);return t.onOpen(n,r),r}function us(t,e,o){o.get().each(function(n){es(t),ts(t),e.onClose(t,n),o.clear()})}function as(n,t,e){return e.isOpen()}function cs(n){var t=xf(n);return Ku.config(t)}function ss(t,n){return Bt(t,{},w(n,function(n){return function(t,e){return me(t,t,Fn(),Xn(function(n){return Zt("The field: "+t+" is forbidden. "+e)}))}(n.name(),"Cannot configure "+n.name()+" for "+t)}).concat([_t("dump",f)]))}function fs(n){return n.dump}function ls(n,t){return I(I({},n.dump),Du(t))}function ds(n,t,e,o){return e.uiType===kf?function(n,t,e,o){return n.exists(function(n){return n!==e.owner})?Cf.single(!0,nn(e)):Vn(o,e.name).fold(function(){throw new Error("Unknown placeholder component: "+e.name+"\nKnown: ["+xn(o)+"]\nNamespace: "+n.getOr("none")+"\nSpec: "+JSON.stringify(e,null,2))},function(n){return n.replace()})}(n,0,e,o):Cf.single(!1,nn(e))}function ms(t,e,n,o){var r=N(o,function(n,t){return function(n,t){var e=!1;return{name:nn(n),required:function(){return t.fold(function(n,t){return n},function(n,t){return n})},used:function(){return e},replace:function(){if(!0===e)throw new Error("Trying to use the same placeholder more than once: "+n);return e=!0,t}}}(t,n)}),i=function(t,e,n,o){return E(n,function(n){return Of(t,e,n,o)})}(t,e,n,r);return Sn(r,function(n){if(!1===n.used()&&n.required())throw new Error("Placeholder: "+n.name()+" was not found in components list\nNamespace: "+t.getOr("none")+"\nComponents: "+JSON.stringify(e.components,null,2))}),i}function gs(n){return n.fold(on.some,on.none,on.some,on.some)}function ps(n){function t(n){return n.name}return n.fold(t,t,t,t)}function hs(e,o){return function(n){var t=et("Converting part type",o,n);return e(t)}}function vs(n,t,e,o){return Bn(t.defaults(n,e,o),e,{uid:n.partUids[t.name]},t.overrides(n,e,o))}function bs(r,n){var t={};return bn(n,function(n){gs(n).each(function(e){var o=Yf(r,e.pname);t[e.name]=function(n){var t=et("Part: "+e.name+" in "+r,se(e.schema),n);return I(I({},o),{config:n,validated:t})}})}),t}function ys(n,t,e){return{uiType:Bf(),owner:n,name:t,config:e,validated:{}}}function xs(n){return E(n,function(n){return n.fold(on.none,on.some,on.none,on.none).map(function(n){return dt(n.name,n.schema.concat([Ou(Gf())]))}).toArray()})}function ws(n){return w(n,ps)}function Ss(n,t,e){return function(n,e,t){var i={},o={};return bn(t,function(n){n.fold(function(o){i[o.pname]=Tf(!0,function(n,t,e){return o.factory.sketch(vs(n,o,t,e))})},function(n){var t=e.parts[n.name];o[n.name]=nn(n.factory.sketch(vs(e,n,t[Gf()]),t))},function(o){i[o.pname]=Tf(!1,function(n,t,e){return o.factory.sketch(vs(n,o,t,e))})},function(r){i[r.pname]=Ef(!0,function(t,n,e){var o=t[r.name];return w(o,function(n){return r.factory.sketch(Bn(r.defaults(t,n,e),n,r.overrides(t,n)))})})})}),{internals:nn(i),externals:nn(o)}}(0,t,e)}function ks(n,t,e){return ms(on.some(n),t,t.components,e)}function Cs(n,t,e){var o=t.partUids[e];return n.getSystem().getByUid(o).toOption()}function Os(n,t,e){return Cs(n,t,e).getOrDie("Could not find part: "+e)}function Ts(n,t,e){var o={},r=t.partUids,i=n.getSystem();return bn(e,function(n){o[n]=nn(i.getByUid(r[n]))}),o}function Es(n,t){var e=n.getSystem();return N(t.partUids,function(n,t){return nn(e.getByUid(n))})}function Bs(n){return xn(n.partUids)}function _s(n,t,e){var o={},r=t.partUids,i=n.getSystem();return bn(e,function(n){o[n]=nn(i.getByUid(r[n]).getOrDie())}),o}function Ds(t,n){var e=ws(n);return K(w(e,function(n){return{key:n,value:t+"-"+n}}))}function As(t){return me("partUids","partUids",In(function(n){return Ds(n.uid,t)}),ve())}function Fs(n,t,e,o,r){var i=function(n,t){return(0<n.length?[dt("parts",n)]:[]).concat([at("uid"),wt("dom",{}),wt("components",[]),Ou("originalSpec"),wt("debug.sketcher",{})]).concat(t)}(o,r);return et(n+" [SpecSchema]",Yn(i.concat(t)),e)}function Ms(n,t,e,o,r){var i=Kf(r),u=xs(e),a=As(e),c=Fs(n,t,i,u,[a]),s=Ss(0,c,e);return o(c,ks(n,c,s.internals()),i,s.externals())}var Is=function CF(e,o){var t=function(n){return e(n)?on.from(n.dom().nodeValue):on.none()};return{get:function(n){if(!e(n))throw new Error("Can only get "+o+" value of a "+o+" node");return t(n).getOr("")},getOption:t,set:function(n,t){if(!e(n))throw new Error("Can only set raw "+o+" value of a "+o+" node");n.dom().nodeValue=t}}}(Ri,"text"),Rs=function(n,t,e,o){return Ri(t)?function(t,e,o,r){var n=t.dom().createRange();n.selectNode(e.dom());var i=n.getClientRects();return Bi(i,function(n){return Pa(n,o,r)?on.some(n):on.none()}).map(function(n){return yc(t,e,o,r,n)})}(n,t,e,o):function(t,n,e,o){var r=t.dom().createRange(),i=gr(n);return Bi(i,function(n){return r.selectNode(n.dom()),Pa(r.getBoundingClientRect(),e,o)?Rs(t,n,e,o):on.none()})}(n,t,e,o)},Vs=["img","br"],Ns=function(n,i){var u=function(n){for(var t=gr(n),e=t.length-1;0<=e;e--){var o=t[e];if(i(o))return on.some(o);var r=u(o);if(r.isSome())return r}return on.none()};return u(n)},Hs=(document.caretPositionFromPoint||document.caretRangeFromPoint,ur("element","offset")),Ps=Tn([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),zs=Ps.screen,Ls=Ps.absolute,js=function(n,t,e,o){var r=n,i=t,u=e,a=o;n<0&&(r=0,u=e+n),t<0&&(i=0,a=o+t);var c=zs(Qu(r,i));return on.some(Wa(c,u,a))},Us=function(n,i,u,a,c){return n.map(function(n){var t=[i,n.point()],e=function(n,t,e,o){return n.fold(t,e,o)}(a,function(){return Rc(t)},function(){return Rc(t)},function(){return function(n){var t=w(n,Fc);return Ic(t)}(t)}),o=Ga(e.left(),e.top(),n.width(),n.height()),r=Ma(c,u,u.showAbove?[xa,wa,ba,ya,Sa,ka]:[ba,ya,xa,wa,ka,ka],u.showAbove?[wa,xa,ya,ba,Sa,ka]:[ya,ba,wa,xa,ka,Sa]);return Da({anchorBox:o,bubble:u.bubble.getOr(la()),overrides:u.overrides,layouts:r,placer:on.none()})})},Ws=ur("element","offset"),Gs=[pt("getSelection"),at("root"),pt("bubble"),Fa(),wt("overrides",{}),wt("showAbove",!1),Cu("placement",function(n,t,e){var o=lr(t.root).dom(),r=Vc(n,0,t),i=Hc(o,t).bind(function(n){return Ac(o,pc.exactFromRange(n)).orThunk(function(){var t=Te.fromText("\ufeff");return hr(n.start(),t),Ac(o,pc.exact(t,0,t,1)).map(function(n){return Wi(t),n})}).bind(function(n){return js(n.left(),n.top(),n.width(),n.height())})}),u=Hc(o,t).bind(function(n){return Ii(n.start())?on.some(n.start()):dr(n.start())}).getOr(n.element());return Us(i,r,t,e,u)})],Xs=[at("node"),at("root"),pt("bubble"),Fa(),wt("overrides",{}),wt("showAbove",!1),Cu("placement",function(r,i,u){var a=Vc(r,0,i);return i.node.bind(function(n){var t=n.dom().getBoundingClientRect(),e=js(t.left,t.top,t.width,t.height),o=i.node.getOr(r.element());return Us(e,a,i,u,o)})})],Ys=[at("item"),Fa(),wt("overrides",{}),Cu("placement",function(n,t,e){var o=_a(e,t.item.element()),r=Ma(n.element(),t,[Uc,Wc,Gc,Xc],[Wc,Uc,Xc,Gc]);return on.some(Da({anchorBox:o,bubble:la(),overrides:t.overrides,layouts:r,placer:on.none()}))})],qs=rt("anchor",{selection:Gs,node:Xs,hotspot:sc,submenu:Ys,makeshift:fc}),Ks=ur("anchorBox","origin"),Js=Tn([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),$s=nn(function(n,t){Jc(n,t),ai(n,{"overflow-x":"hidden","overflow-y":"auto"})}),Qs=nn(function(n,t){Jc(n,t)}),Zs=sr(["bounds","origin","preference","maxHeightFunction"],[]),nf=function(n,t,e,o){var r=qc(n,t,e,o);Kc(t,r,o),function(n,t){var e=t.classes();ei(n,e.off),ti(n,e.on)}(t,r),function(n,t,e){e.maxHeightFunction()(n,t.maxHeight())}(t,r,o)},tf=function(n,t,e,o,r,i){var u=i.map(ca);return ef(n,t,e,o,r,u)},ef=function(t,n,e,o,r,i){var u=et("positioning anchor.info",qs,o);ui(r.element(),"position","fixed");var a=si(r.element(),"visibility");ui(r.element(),"visibility","hidden");var c=n.useFixed?ac(0,0,M.window.innerWidth,M.window.innerHeight):function(n){var t=Iu(n.element()),e=n.element().dom().getBoundingClientRect();return uc(t.left(),t.top(),e.width,e.height)}(t),s=u.placement,f=i.map(nn).or(n.getBounds);s(t,u,c).each(function(n){n.placer.getOr(Qc)(t,c,n,f,r)}),a.fold(function(){li(r.element(),"visibility")},function(n){ui(r.element(),"visibility",n)}),si(r.element(),"left").isNone()&&si(r.element(),"top").isNone()&&si(r.element(),"right").isNone()&&si(r.element(),"bottom").isNone()&&si(r.element(),"position").is("fixed")&&li(r.element(),"position")},of=/* */Object.freeze({position:function(n,t,e,o,r){tf(n,t,e,o,r,on.none())},positionWithin:tf,positionWithinBounds:ef,getMode:function(n,t,e){return t.useFixed?"fixed":"absolute"}}),rf=[wt("useFixed",!1),pt("getBounds")],uf=Au({fields:rf,name:"positioning",active:Ju,apis:of}),af=function(n){Wt(n,Io());var t=n.components();bn(t,af)},cf=function(n){var t=n.components();bn(t,cf),Wt(n,Mo())},sf=function(n,t,e){n.getSystem().addToWorld(t),e(n.element(),t.element()),Xo(n.element())&&cf(t),n.syncComponents()},ff=function(n,t,e){e(n,t.element());var o=gr(t.element());bn(o,function(n){t.getByDom(n).each(cf)})},lf=function(n,t,e){var o=t.getAttachPoint(n);ui(n.element(),"position",uf.getMode(o)),function(t,n,e,o){si(t.element(),n).fold(function(){_r(t.element(),e)},function(n){Or(t.element(),e,n)}),ui(t.element(),n,o)}(n,"visibility",t.cloakVisibilityAttr,"hidden")},df=function(n,t,e){!function(t){return y(["top","left","right","bottom"],function(n){return si(t,n).isSome()})}(n.element())&&li(n.element(),"position"),function(n,t,e){if(Br(n.element(),e)){var o=Er(n.element(),e);ui(n.element(),t,o)}else li(n.element(),t)}(n,"visibility",t.cloakVisibilityAttr)},mf=/* */Object.freeze({cloak:lf,decloak:df,open:is,openWhileCloaked:function(n,t,e,o,r){lf(n,t),is(n,t,e,o),r(),df(n,t)},close:us,isOpen:as,isPartOf:function(t,e,n,o){return as(0,0,n)&&n.get().exists(function(n){return e.isPartOf(t,n,o)})},getState:function(n,t,e){return e.get()}}),gf=/* */Object.freeze({events:function(e,o){return Jo([Zo(Bo(),function(n,t){us(n,e,o)})])}}),pf=[xu("onOpen"),xu("onClose"),at("isPartOf"),at("getAttachPoint"),wt("cloakVisibilityAttr","data-precloak-visibility")],hf=Au({fields:pf,name:"sandboxing",active:gf,apis:mf,state:/* */Object.freeze({init:function(){var t=Ce(on.none()),n=nn("not-implemented");return iu({readState:n,isOpen:function(){return t.get().isSome()},clear:function(){t.set(on.none())},set:function(n){t.set(on.some(n))},get:function(n){return t.get()}})}})}),vf=nn("dismiss.popups"),bf=nn("mouse.released"),yf=Yn([wt("isExtraPart",nn(!1)),xt("fireEventInstead",[wt("event",Ro())])]),xf=function(n){var e=et("Dismissal",yf,n);return{channels:q(vf(),{schema:Yn([at("target")]),onReceive:function(t,n){hf.isOpen(t)&&(hf.isPartOf(t,n.target)||e.isExtraPart(t,n.target)||e.fireEventInstead.fold(function(){return hf.close(t)},function(n){return Wt(t,n.event)}))}})}},wf=ss,Sf=ls,kf="placeholder",Cf=Tn([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Of=function(i,u,a,c){return ds(i,0,a,c).fold(function(n,t){var e=t(u,a.config,a.validated),o=Vn(e,"components").getOr([]),r=E(o,function(n){return Of(i,u,n,c)});return[I(I({},e),{components:r})]},function(n,t){var e=t(u,a.config,a.validated);return a.validated.preprocess.getOr(f)(e)})},Tf=Cf.single,Ef=Cf.multiple,Bf=nn(kf),_f=Tn([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Df=wt("factory",{sketch:f}),Af=wt("schema",[]),Ff=at("name"),Mf=me("pname","pname",Mn(function(n){return"<alloy."+Mr(n.name)+">"}),ve()),If=_t("schema",function(){return[pt("preprocess")]}),Rf=wt("defaults",nn({})),Vf=wt("overrides",nn({})),Nf=se([Df,Af,Ff,Mf,Rf,Vf]),Hf=se([Df,Af,Ff,Rf,Vf]),Pf=se([Df,Af,Ff,Mf,Rf,Vf]),zf=se([Df,If,Ff,at("unit"),Mf,Rf,Vf]),Lf=hs(_f.required,Nf),jf=hs(_f.external,Hf),Uf=hs(_f.optional,Pf),Wf=hs(_f.group,zf),Gf=nn("entirety"),Xf=/* */Object.freeze({required:Lf,external:jf,optional:Uf,group:Wf,asNamedPart:gs,name:ps,asCommon:function(n){return n.fold(f,f,f,f)},original:Gf}),Yf=function(n,t){return{uiType:Bf(),owner:n,name:t}},qf=/* */Object.freeze({generate:bs,generateOne:ys,schemas:xs,names:ws,substitutes:Ss,components:ks,defaultUids:Ds,defaultUidsSchema:As,getAllParts:Es,getAllPartNames:Bs,getPart:Cs,getPartOrDie:Os,getParts:Ts,getPartsOrDie:_s}),Kf=function(n){return n.hasOwnProperty("uid")?n:I(I({},n),{uid:Ir("uid")})};function Jf(n){var t=et("Sketcher for "+n.name,wl,n),e=N(t.apis,Hr),o=N(t.extraApis,function(n,t){return Vr(n,t)});return I(I({name:nn(t.name),partFields:nn([]),configFields:nn(t.configFields),sketch:function(n){return function(n,t,e,o){var r=Kf(o);return e(Fs(n,t,r,[],[]),r)}(t.name,t.configFields,t.factory,n)}},e),o)}function $f(n){var t=et("Sketcher for "+n.name,Sl,n),e=bs(t.name,t.partFields),o=N(t.apis,Hr),r=N(t.extraApis,function(n,t){return Vr(n,t)});return I(I({name:nn(t.name),partFields:nn(t.partFields),configFields:nn(t.configFields),sketch:function(n){return Ms(t.name,t.configFields,t.partFields,t.factory,n)},parts:nn(e)},o),r)}function Qf(n){return"input"===Wo(n)&&"radio"!==Er(n,"type")||"textarea"===Wo(n)}function Zf(n,t,e,o){var r=n+t;return o<r?e:r<e?o:r}function nl(n,t,e){return n<=t?t:e<=n?e:n}function tl(e,o,n,r){var t=Bc(e.element(),"."+o.highlightClass);bn(t,function(t){y(r,function(n){return n.element()===t})||(Zr(t,o.highlightClass),e.getSystem().getByDom(t).each(function(n){o.onDehighlight(e,n),Wt(n,Lo())}))})}function el(n,t,e,o){tl(n,t,0,[o]),Tl(n,t,e,o)||($r(o.element(),t.highlightClass),t.onHighlight(n,o),Wt(o,zo()))}function ol(e,t,n,o){var r=Bc(e.element(),"."+t.itemClass);return T(r,function(n){return ni(n,t.highlightClass)}).bind(function(n){var t=Zf(n,o,0,r.length-1);return e.getSystem().getByDom(r[t]).toOption()})}function rl(n,t,e){var o=_(n.slice(0,t)),r=_(n.slice(t+1));return O(o.concat(r),e)}function il(n,t,e){var o=_(n.slice(0,t));return O(o,e)}function ul(n,t,e){var o=n.slice(0,t),r=n.slice(t+1);return O(r.concat(o),e)}function al(n,t,e){var o=n.slice(t+1);return O(o,e)}function cl(e){return function(n){var t=n.raw();return vn(e,t.which)}}function sl(n){return function(t){return B(n,function(n){return n(t)})}}function fl(n){return!0===n.raw().shiftKey}function ll(n){return!0===n.raw().ctrlKey}function dl(n,t){return{matches:n,classification:t}}function ml(n){n.dom().focus()}function gl(n){var t=n!==undefined?n.dom():M.document;return on.from(t.activeElement).map(Te.fromDom)}function pl(t){return gl(fr(t)).filter(function(n){return t.dom().contains(n.dom())})}function hl(n,t,e){t.exists(function(t){return e.exists(function(n){return zt(n,t)})})||Gt(n,Vo(),{prevFocus:t,newFocus:e})}function vl(){function r(n){return pl(n.element())}return{get:r,set:function(n,t){var e=r(n);n.getSystem().triggerFocus(t,n.element());var o=r(n);hl(n,e,o)}}}function bl(){function r(n){return Ml.getHighlighted(n).map(function(n){return n.element()})}return{get:r,set:function(t,n){var e=r(t);t.getSystem().getByDom(n).fold(Z,function(n){Ml.highlight(t,n)});var o=r(t);hl(t,e,o)}}}var yl,xl,wl=Yn([at("name"),at("factory"),at("configFields"),wt("apis",{}),wt("extraApis",{})]),Sl=Yn([at("name"),at("factory"),at("configFields"),at("partFields"),wt("apis",{}),wt("extraApis",{})]),kl=/* */Object.freeze({getCurrent:function(n,t,e){return t.find(n)}}),Cl=[at("find")],Ol=Au({fields:Cl,name:"composing",apis:kl}),Tl=function(n,t,e,o){return ni(o.element(),t.highlightClass)},El=function(n,t,e,o){var r=Bc(n.element(),"."+t.itemClass);return on.from(r[o]).fold(function(){return an.error("No element found with index "+o)},n.getSystem().getByDom)},Bl=function(t,n,e){return ki(t.element(),"."+n.itemClass).bind(function(n){return t.getSystem().getByDom(n).toOption()})},_l=function(t,n,e){var o=Bc(t.element(),"."+n.itemClass);return(0<o.length?on.some(o[o.length-1]):on.none()).bind(function(n){return t.getSystem().getByDom(n).toOption()})},Dl=function(t,n,e){var o=Bc(t.element(),"."+n.itemClass);return Ei(w(o,function(n){return t.getSystem().getByDom(n).toOption()}))},Al=/* */Object.freeze({dehighlightAll:function(n,t,e){return tl(n,t,0,[])},dehighlight:function(n,t,e,o){Tl(n,t,e,o)&&(Zr(o.element(),t.highlightClass),t.onDehighlight(n,o),Wt(o,Lo()))},highlight:el,highlightFirst:function(t,e,o){Bl(t,e).each(function(n){el(t,e,o,n)})},highlightLast:function(t,e,o){_l(t,e).each(function(n){el(t,e,o,n)})},highlightAt:function(t,e,o,n){El(t,e,o,n).fold(function(n){throw new Error(n)},function(n){el(t,e,o,n)})},highlightBy:function(t,e,o,n){var r=Dl(t,e);O(r,n).each(function(n){el(t,e,o,n)})},isHighlighted:Tl,getHighlighted:function(t,n,e){return ki(t.element(),"."+n.highlightClass).bind(function(n){return t.getSystem().getByDom(n).toOption()})},getFirst:Bl,getLast:_l,getPrevious:function(n,t,e){return ol(n,t,0,-1)},getNext:function(n,t,e){return ol(n,t,0,1)},getCandidates:Dl}),Fl=[at("highlightClass"),at("itemClass"),xu("onHighlight"),xu("onDehighlight")],Ml=Au({fields:Fl,name:"highlighting",apis:Al}),Il=v(fl);(xl=yl=yl||{}).OnFocusMode="onFocus",xl.OnEnterOrSpaceMode="onEnterOrSpace",xl.OnApiMode="onApi";function Rl(n,t,e,i,u){function a(t,e,n,o,r){return function(n,t){return O(n,function(n){return n.matches(t)}).map(function(n){return n.classification})}(n(t,e,o,r),e.event()).bind(function(n){return n(t,e,o,r)})}var o={schema:function(){return n.concat([wt("focusManager",vl()),St("focusInside","onFocus",Qn(function(n){return vn(["onFocus","onEnterOrSpace","onApi"],n)?an.value(n):an.error("Invalid value for focusInside")})),Cu("handler",o),Cu("state",t),Cu("sendFocusIn",u)])},processKey:a,toEvents:function(o,r){var n=o.focusInside!==yl.OnFocusMode?on.none():u(o).map(function(e){return Zo(yo(),function(n,t){e(n,o,r),t.stop()})});return Jo(n.toArray().concat([Zo(fo(),function(n,t){a(n,t,e,o,r).fold(function(){!function(t,e){var n=cl([32].concat([13]))(e.event());o.focusInside===yl.OnEnterOrSpaceMode&&n&&Lt(t,e)&&u(o).each(function(n){n(t,o,r),e.stop()})}(n,t)},function(n){t.stop()})}),Zo(lo(),function(n,t){a(n,t,i,o,r).each(function(n){t.stop()})})]))}};return o}function Vl(n){function i(n,t){var e=n.visibilitySelector.bind(function(n){return Ci(t,n)}).getOr(t);return 0<ta(e)}function t(t,e){(function(n,t){var e=Bc(n.element(),t.selector),o=S(e,function(n){return i(t,n)});return on.from(o[t.firstTabstop])})(t,e).each(function(n){e.focusManager.set(t,n)})}function u(t,n,e,o,r){return r(n,e,function(n){return function(n,t){return i(n,t)&&n.useTabstopAt(t)}(o,n)}).fold(function(){return o.cyclic?on.some(!0):on.none()},function(n){return o.focusManager.set(t,n),on.some(!0)})}function a(t,n,e,o){var r=Bc(t.element(),e.selector);return function(n,t){return t.focusManager.get(n).bind(function(n){return Ci(n,t.selector)})}(t,e).bind(function(n){return T(r,l(zt,n)).bind(function(n){return u(t,r,n,e,o)})})}var e=[pt("onEscape"),pt("onEnter"),wt("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),wt("firstTabstop",0),wt("useTabstopAt",nn(!0)),pt("visibilitySelector")].concat([n]),o=nn([dl(sl([fl,cl([9])]),function(n,t,e,o){var r=e.cyclic?rl:il;return a(n,0,e,r)}),dl(cl([9]),function(n,t,e,o){var r=e.cyclic?ul:al;return a(n,0,e,r)}),dl(cl([27]),function(t,e,n,o){return n.onEscape.bind(function(n){return n(t,e)})}),dl(sl([Il,cl([13])]),function(t,e,n,o){return n.onEnter.bind(function(n){return n(t,e)})})]),r=nn([]);return Rl(e,ru.init,o,r,function(){return on.some(t)})}function Nl(n,t,e){return Qf(e)&&cl([32])(t.event())?on.none():function(n,t,e){return Yt(n,e,ko()),on.some(!0)}(n,0,e)}function Hl(n,t){return on.some(!0)}function Pl(n,t,e){return e.execute(n,t,n.element())}function zl(n){var e=Ce(on.none());return iu({readState:function(){return e.get().map(function(n){return{numRows:n.numRows(),numColumns:n.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(n,t){e.set(on.some({numRows:nn(n),numColumns:nn(t)}))},getNumRows:function(){return e.get().map(function(n){return n.numRows()})},getNumColumns:function(){return e.get().map(function(n){return n.numColumns()})}})}function Ll(i){return function(n,t,e,o){var r=i(n.element());return Yd(r,n,t,e,o)}}function jl(n,t){var e=Aa(n,t);return Ll(e)}function Ul(n,t){var e=Aa(t,n);return Ll(e)}function Wl(r){return function(n,t,e,o){return Yd(r,n,t,e,o)}}function Gl(n){return!function(n){return n.offsetWidth<=0&&n.offsetHeight<=0}(n.dom())}function Xl(n,t,e){var o=l(zt,t),r=Bc(n,e);return function(t,n){return T(t,n).map(function(n){return $d({index:n,candidates:t})})}(S(r,Gl),o)}function Yl(n,t){return T(n,function(n){return zt(t,n)})}function ql(e,n,o,t){return t(Math.floor(n/o),n%o).bind(function(n){var t=n.row()*o+n.column();return 0<=t&&t<e.length?on.some(e[t]):on.none()})}function Kl(r,n,i,u,a){return ql(r,n,u,function(n,t){var e=n===i-1?r.length-n*u:u,o=Zf(t,a,0,e-1);return on.some({row:nn(n),column:nn(o)})})}function Jl(i,n,u,a,c){return ql(i,n,a,function(n,t){var e=Zf(n,c,0,u-1),o=e===u-1?i.length-e*a:a,r=nl(t,0,o-1);return on.some({row:nn(e),column:nn(r)})})}function $l(t,e,n){ki(t.element(),e.selector).each(function(n){e.focusManager.set(t,n)})}function Ql(r){return function(n,t,e,o){return Xl(n,t,e.selector).bind(function(n){return r(n.candidates(),n.index(),o.getNumRows().getOr(e.initSize.numRows),o.getNumColumns().getOr(e.initSize.numColumns))})}}function Zl(n,t,e,o){return e.captureTab?on.some(!0):on.none()}function nd(n,t,e,r){var i=function(n,t,e){var o=Zf(t,r,0,e.length-1);return o===n?on.none():function(n){return"button"===Wo(n)&&"disabled"===Er(n,"disabled")}(e[o])?i(n,o,e):on.from(e[o])};return Xl(n,e,t).bind(function(n){var t=n.index(),e=n.candidates();return i(t,t,e)})}function td(t,e,o){return function(n,t){return t.focusManager.get(n).bind(function(n){return Ci(n,t.selector)})}(t,o).bind(function(n){return o.execute(t,e,n)})}function ed(t,e){e.getInitial(t).orThunk(function(){return ki(t.element(),e.selector)}).each(function(n){e.focusManager.set(t,n)})}function od(n,t,e){return nd(n,e.selector,t,-1)}function rd(n,t,e){return nd(n,e.selector,t,1)}function id(o){return function(n,t,e){return o(n,t,e).bind(function(){return e.executeOnMove?td(n,t,e):on.some(!0)})}}function ud(n,t,e,o){return e.onEscape(n,t)}function ad(n,t,e){return on.from(n[t]).bind(function(n){return on.from(n[e]).map(function(n){return sm({rowIndex:t,columnIndex:e,cell:n})})})}function cd(n,t,e,o){var r=n[t].length,i=Zf(e,o,0,r-1);return ad(n,t,i)}function sd(n,t,e,o){var r=Zf(e,o,0,n.length-1),i=n[r].length,u=nl(t,0,i-1);return ad(n,r,u)}function fd(n,t,e,o){var r=n[t].length,i=nl(e+o,0,r-1);return ad(n,t,i)}function ld(n,t,e,o){var r=nl(e+o,0,n.length-1),i=n[r].length,u=nl(t,0,i-1);return ad(n,r,u)}function dd(t,e){e.previousSelector(t).orThunk(function(){var n=e.selectors;return ki(t.element(),n.cell)}).each(function(n){e.focusManager.set(t,n)})}function md(n,t){return function(r,e,i){var u=i.cycles?n:t;return Ci(e,i.selectors.row).bind(function(n){var t=Bc(n,i.selectors.cell);return Yl(t,e).bind(function(e){var o=Bc(r,i.selectors.row);return Yl(o,n).bind(function(n){var t=function(n,t){return w(n,function(n){return Bc(n,t.selectors.cell)})}(o,i);return u(t,n,e).map(function(n){return n.cell()})})})})}}function gd(t,e,o){return o.focusManager.get(t).bind(function(n){return o.execute(t,e,n)})}function pd(t,e){ki(t.element(),e.selector).each(function(n){e.focusManager.set(t,n)})}function hd(n,t,e){return nd(n,e.selector,t,-1)}function vd(n,t,e){return nd(n,e.selector,t,1)}function bd(n,t,e,o){var r=n.getSystem().build(o);sf(n,r,e)}function yd(n,t,e,o){var r=Mm(n);O(r,function(n){return zt(o.element(),n.element())}).each(ts)}function xd(t,n,e,o,r){var i=Mm(t);return on.from(i[o]).map(function(n){return yd(t,0,0,n),r.each(function(n){bd(t,0,function(n,t){!function(n,t,e){pr(n,e).fold(function(){Ui(n,t)},function(n){hr(n,t)})}(n,t,o)},n)}),n})}function wd(n,t,e){t.store.manager.onLoad(n,t,e)}function Sd(n,t,e){t.store.manager.onUnload(n,t,e)}function kd(){var n=Ce(null);return iu({set:n.set,get:n.get,isNotSet:function(){return null===n.get()},clear:function(){n.set(null)},readState:function(){return{mode:"memory",value:n.get()}}})}function Cd(){var i=Ce({}),u=Ce({});return iu({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(n){return Vn(i.get(),n).orThunk(function(){return Vn(u.get(),n)})},update:function(n){var t=i.get(),e=u.get(),o={},r={};bn(n,function(t){o[t.value]=t,Vn(t,"meta").each(function(n){Vn(n,"text").each(function(n){r[n]=t})})}),i.set(I(I({},t),o)),u.set(I(I({},e),r))},clear:function(){i.set({}),u.set({})}})}function Od(n,t,e,o){var r=t.store;e.update([o]),r.setValue(n,o),t.onSetValue(n,o)}function Td(n,t){return{key:n,value:{config:{},me:function(n,t){var e=Jo(t);return Au({fields:[at("enabled")],name:n,active:{events:nn(e)}})}(n,t),configAsRaw:nn({}),initialConfig:{},state:ru}}}function Ed(n,t){t.ignore||(ml(n.element()),t.onFocus(n))}function Bd(n,t,e){var o=t.aria;o.update(n,o,e.get())}function _d(t,n,e){n.toggleClass.each(function(n){e.get()?$r(t.element(),n):Zr(t.element(),n)})}function Dd(n,t,e){Ym(n,t,e,!e.get())}function Ad(n,t,e){e.set(!0),_d(n,t,e),Bd(n,t,e)}function Fd(n,t,e){e.set(!1),_d(n,t,e),Bd(n,t,e)}function Md(n,t,e){Ym(n,t,e,t.selected)}function Id(n){(pl(n.element()).isNone()||Xm.isFocused(n))&&(Xm.isFocused(n)||Xm.focus(n),Gt(n,Zm,{item:n}))}function Rd(n){Gt(n,ng,{item:n})}function Vd(n,t){var e={};Sn(n,function(n,t){bn(n,function(n){e[n]=t})});var o=t,r=function(n){return kn(n,function(n,t){return{k:n,v:t}})}(t),i=N(r,function(n,t){return[t].concat(dg(e,o,r,t))});return N(e,function(n){return Vn(i,n).getOr([n])})}function Nd(n){function t(n,t){t.stop(),Xt(n)}var e=Ye.detect().deviceType.isTouch()?[Zo(Oo(),t)]:[Zo(po(),t),Zo(oo(),function(n,t){t.cut()})];return Jo(R([n.map(function(e){return Zo(ko(),function(n,t){e(n),t.stop()})}).toArray(),e]))}function Hd(n){var t=function e(n){return n.uid!==undefined}(n)&&$(n,"uid")?n.uid:Ir("memento");return{get:function(n){return n.getSystem().getByUid(t).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(t).toOption()},asSpec:function(){return I(I({},n),{uid:t})}}}function Pd(n){return on.from(n()["temporary-placeholder"]).getOr("!not found!")}function zd(n,t){return on.from(t()[n]).getOrThunk(function(){return Pd(t)})}var Ld,jd=Vl(_t("cyclic",nn(!1))),Ud=Vl(_t("cyclic",nn(!0))),Wd=[wt("execute",Nl),wt("useSpace",!1),wt("useEnter",!0),wt("useControlEnter",!1),wt("useDown",!1)],Gd=Rl(Wd,ru.init,function(n,t,e,o){var r=e.useSpace&&!Qf(n.element())?[32]:[],i=e.useEnter?[13]:[],u=e.useDown?[40]:[],a=r.concat(i).concat(u);return[dl(cl(a),Pl)].concat(e.useControlEnter?[dl(sl([ll,cl([13])]),Pl)]:[])},function(n,t,e,o){return e.useSpace&&!Qf(n.element())?[dl(cl([32]),Hl)]:[]},function(){return on.none()}),Xd=/* */Object.freeze({flatgrid:zl,init:function(n){return n.state(n)}}),Yd=function(t,e,n,o,r){return o.focusManager.get(e).bind(function(n){return t(e.element(),n,o,r)}).map(function(n){return o.focusManager.set(e,n),!0})},qd=Wl,Kd=Wl,Jd=Wl,$d=sr(["index","candidates"],[]),Qd=[at("selector"),wt("execute",Nl),wu("onEscape"),wt("captureTab",!1),ju()],Zd=Ql(function(n,t,e,o){return Kl(n,t,e,o,-1)}),nm=Ql(function(n,t,e,o){return Kl(n,t,e,o,1)}),tm=Ql(function(n,t,e,o){return Jl(n,t,e,o,-1)}),em=Ql(function(n,t,e,o){return Jl(n,t,e,o,1)}),om=nn([dl(cl([37]),jl(Zd,nm)),dl(cl([39]),Ul(Zd,nm)),dl(cl([38]),qd(tm)),dl(cl([40]),Kd(em)),dl(sl([fl,cl([9])]),Zl),dl(sl([Il,cl([9])]),Zl),dl(cl([27]),function(n,t,e,o){return e.onEscape(n,t)}),dl(cl([32].concat([13])),function(t,e,o,n){return function(n,t){return t.focusManager.get(n).bind(function(n){return Ci(n,t.selector)})}(t,o).bind(function(n){return o.execute(t,e,n)})})]),rm=nn([dl(cl([32]),Hl)]),im=Rl(Qd,zl,om,rm,function(){return on.some($l)}),um=[at("selector"),wt("getInitial",on.none),wt("execute",Nl),wu("onEscape"),wt("executeOnMove",!1),wt("allowVertical",!0)],am=nn([dl(cl([32]),Hl)]),cm=Rl(um,ru.init,function(n,t,e,o){var r=[37].concat(e.allowVertical?[38]:[]),i=[39].concat(e.allowVertical?[40]:[]);return[dl(cl(r),id(jl(od,rd))),dl(cl(i),id(Ul(od,rd))),dl(cl([13]),td),dl(cl([32]),td),dl(cl([27]),ud)]},am,function(){return on.some(ed)}),sm=sr(["rowIndex","columnIndex","cell"],[]),fm=[dt("selectors",[at("row"),at("cell")]),wt("cycles",!0),wt("previousSelector",on.none),wt("execute",Nl)],lm=md(function(n,t,e){return cd(n,t,e,-1)},function(n,t,e){return fd(n,t,e,-1)}),dm=md(function(n,t,e){return cd(n,t,e,1)},function(n,t,e){return fd(n,t,e,1)}),mm=md(function(n,t,e){return sd(n,e,t,-1)},function(n,t,e){return ld(n,e,t,-1)}),gm=md(function(n,t,e){return sd(n,e,t,1)},function(n,t,e){return ld(n,e,t,1)}),pm=nn([dl(cl([37]),jl(lm,dm)),dl(cl([39]),Ul(lm,dm)),dl(cl([38]),qd(mm)),dl(cl([40]),Kd(gm)),dl(cl([32].concat([13])),function(t,e,o){return pl(t.element()).bind(function(n){return o.execute(t,e,n)})})]),hm=nn([dl(cl([32]),Hl)]),vm=Rl(fm,ru.init,pm,hm,function(){return on.some(dd)}),bm=[at("selector"),wt("execute",Nl),wt("moveOnTab",!1)],ym=nn([dl(cl([38]),Jd(hd)),dl(cl([40]),Jd(vd)),dl(sl([fl,cl([9])]),function(n,t,e){return e.moveOnTab?Jd(hd)(n,t,e):on.none()}),dl(sl([Il,cl([9])]),function(n,t,e){return e.moveOnTab?Jd(vd)(n,t,e):on.none()}),dl(cl([13]),gd),dl(cl([32]),gd)]),xm=nn([dl(cl([32]),Hl)]),wm=Rl(bm,ru.init,ym,xm,function(){return on.some(pd)}),Sm=[wu("onSpace"),wu("onEnter"),wu("onShiftEnter"),wu("onLeft"),wu("onRight"),wu("onTab"),wu("onShiftTab"),wu("onUp"),wu("onDown"),wu("onEscape"),wt("stopSpaceKeyup",!1),pt("focusIn")],km=Rl(Sm,ru.init,function(n,t,e){return[dl(cl([32]),e.onSpace),dl(sl([Il,cl([13])]),e.onEnter),dl(sl([fl,cl([13])]),e.onShiftEnter),dl(sl([fl,cl([9])]),e.onShiftTab),dl(sl([Il,cl([9])]),e.onTab),dl(cl([38]),e.onUp),dl(cl([40]),e.onDown),dl(cl([37]),e.onLeft),dl(cl([39]),e.onRight),dl(cl([32]),e.onSpace),dl(cl([27]),e.onEscape)]},function(n,t,e){return e.stopSpaceKeyup?[dl(cl([32]),Hl)]:[]},function(n){return n.focusIn}),Cm=jd.schema(),Om=Ud.schema(),Tm=cm.schema(),Em=im.schema(),Bm=vm.schema(),_m=Gd.schema(),Dm=wm.schema(),Am=km.schema(),Fm=Fu({branchKey:"mode",branches:/* */Object.freeze({acyclic:Cm,cyclic:Om,flow:Tm,flatgrid:Em,matrix:Bm,execution:_m,menu:Dm,special:Am}),name:"keying",active:{events:function(n,t){return n.handler.toEvents(n,t)}},apis:{focusIn:function(t,e,o){e.sendFocusIn(e).fold(function(){t.getSystem().triggerFocus(t.element(),t.element())},function(n){n(t,e,o)})},setGridSize:function(n,t,e,o,r){$(e,"setGridSize")?e.setGridSize(o,r):M.console.error("Layout does not support setGridSize")}},state:Xd}),Mm=function(n,t){return n.components()},Im=Au({fields:[],name:"replacing",apis:/* */Object.freeze({append:function(n,t,e,o){bd(n,0,Ui,o)},prepend:function(n,t,e,o){bd(n,0,br,o)},remove:yd,replaceAt:xd,replaceBy:function(t,n,e,o,r){var i=Mm(t);return T(i,o).bind(function(n){return xd(t,0,0,n,r)})},set:function(t,n,e,o){es(t),function(n,e){var o=fr(e),t=gl(o).bind(function(t){function n(n){return zt(t,n)}return n(e)?on.some(e):Ko(e,n)}),r=n(e);t.each(function(t){gl(o).filter(function(n){return zt(n,t)}).fold(function(){ml(t)},Z)})}(function(){var n=w(o,t.getSystem().build);bn(n,function(n){Zc(t,n)})},t.element())},contents:Mm})}),Rm=/* */Object.freeze({onLoad:wd,onUnload:Sd,setValue:function(n,t,e,o){t.store.manager.setValue(n,t,e,o)},getValue:function(n,t,e){return t.store.manager.getValue(n,t,e)},getState:function(n,t,e){return e}}),Vm=/* */Object.freeze({events:function(e,o){var n=e.resetOnDom?[Pi(function(n,t){wd(n,e,o)}),zi(function(n,t){Sd(n,e,o)})]:[Tu(e,o,wd)];return Jo(n)}}),Nm=/* */Object.freeze({memory:kd,dataset:Cd,manual:function(){return iu({readState:function(){}})},init:function(n){return n.store.manager.state(n)}}),Hm=[pt("initialValue"),at("getFallbackEntry"),at("getDataKey"),at("setValue"),Cu("manager",{setValue:Od,getValue:function(n,t,e){var o=t.store,r=o.getDataKey(n);return e.lookup(r).fold(function(){return o.getFallbackEntry(r)},function(n){return n})},onLoad:function(t,e,o){e.store.initialValue.each(function(n){Od(t,e,o,n)})},onUnload:function(n,t,e){e.clear()},state:Cd})],Pm=[at("getValue"),wt("setValue",Z),pt("initialValue"),Cu("manager",{setValue:function(n,t,e,o){t.store.setValue(n,o),t.onSetValue(n,o)},getValue:function(n,t,e){return t.store.getValue(n)},onLoad:function(t,e,n){e.store.initialValue.each(function(n){e.store.setValue(t,n)})},onUnload:Z,state:ru.init})],zm=[pt("initialValue"),Cu("manager",{setValue:function(n,t,e,o){e.set(o),t.onSetValue(n,o)},getValue:function(n,t,e){return e.get()},onLoad:function(n,t,e){t.store.initialValue.each(function(n){e.isNotSet()&&e.set(n)})},onUnload:function(n,t,e){e.clear()},state:kd})],Lm=[St("store",{mode:"memory"},rt("mode",{memory:zm,manual:Pm,dataset:Hm})),xu("onSetValue"),wt("resetOnDom",!1)],jm=Au({fields:Lm,name:"representing",active:Vm,apis:Rm,extra:{setValueFrom:function(n,t){var e=jm.getValue(t);jm.setValue(n,e)}},state:Nm}),Um=/* */Object.freeze({focus:Ed,blur:function(n,t){t.ignore||function(n){n.dom().blur()}(n.element())},isFocused:function(n){return function(n){var t=fr(n).dom();return n.dom()===t.activeElement}(n.element())}}),Wm=/* */Object.freeze({exhibit:function(n,t){var e=t.ignore?{}:{attributes:{tabindex:"-1"}};return zr(e)},events:function(e){return Jo([Zo(yo(),function(n,t){Ed(n,e),t.stop()})].concat(e.stopMousedown?[Zo(oo(),function(n,t){t.event().prevent()})]:[]))}}),Gm=[xu("onFocus"),wt("stopMousedown",!1),wt("ignore",!1)],Xm=Au({fields:Gm,name:"focusing",active:Wm,apis:Um}),Ym=function(n,t,e,o){(o?Ad:Fd)(n,t,e)},qm=/* */Object.freeze({onLoad:Md,toggle:Dd,isOn:function(n,t,e){return e.get()},on:Ad,off:Fd,set:Ym}),Km=/* */Object.freeze({exhibit:function(n,t,e){return zr({})},events:function(n,t){var e=function(t,e,o){return ji(function(n){o(n,t,e)})}(n,t,Dd),o=Tu(n,t,Md);return Jo(R([n.toggleOnExecute?[e]:[],[o]]))}}),Jm=function(n,t,e){Or(n.element(),"aria-expanded",e)},$m=[wt("selected",!1),pt("toggleClass"),wt("toggleOnExecute",!0),St("aria",{mode:"none"},rt("mode",{pressed:[wt("syncWithExpanded",!1),Cu("update",function(n,t,e){Or(n.element(),"aria-pressed",e),t.syncWithExpanded&&Jm(n,t,e)})],checked:[Cu("update",function(n,t,e){Or(n.element(),"aria-checked",e)})],expanded:[Cu("update",Jm)],selected:[Cu("update",function(n,t,e){Or(n.element(),"aria-selected",e)})],none:[Cu("update",Z)]}))],Qm=Au({fields:$m,name:"toggling",active:Km,apis:qm,state:(Ld=!1,{init:function(){var t=Ce(Ld);return{get:function(){return t.get()},set:function(n){return t.set(n)},clear:function(){return t.set(Ld)},readState:function(){return t.get()}}}})}),Zm="alloy.item-hover",ng="alloy.item-focus",tg=nn(Zm),eg=nn(ng),og=[at("data"),at("components"),at("dom"),wt("hasSubmenu",!1),pt("toggling"),wf("itemBehaviours",[Qm,Xm,Fm,jm]),wt("ignoreFocus",!1),wt("domModification",{}),Cu("builder",function(n){return{dom:n.dom,domModification:I(I({},n.domModification),{attributes:I(I(I({role:n.toggling.isSome()?"menuitemcheckbox":"menuitem"},n.domModification.attributes),{"aria-haspopup":n.hasSubmenu}),n.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:Sf(n.itemBehaviours,[n.toggling.fold(Qm.revoke,function(n){return Qm.config(I({aria:{mode:"checked"}},n))}),Xm.config({ignore:n.ignoreFocus,stopMousedown:n.ignoreFocus,onFocus:function(n){Rd(n)}}),Fm.config({mode:"execution"}),jm.config({store:{mode:"memory",initialValue:n.data}}),Td("item-type-events",[Zo(To(),Xt),rr(oo()),Zo(ao(),Id),Zo(Co(),Xm.focus)])]),components:n.components,eventOrder:n.eventOrder}}),wt("eventOrder",{})],rg=[at("dom"),at("components"),Cu("builder",function(n){return{dom:n.dom,components:n.components,events:Jo([function(n){return Zo(n,function(n,t){t.stop()})}(Co())])}})],ig=nn([Lf({name:"widget",overrides:function(t){return{behaviours:Du([jm.config({store:{mode:"manual",getValue:function(n){return t.data},setValue:function(){}}})])}}})]),ug=[at("uid"),at("data"),at("components"),at("dom"),wt("autofocus",!1),wt("ignoreFocus",!1),wf("widgetBehaviours",[jm,Xm,Fm]),wt("domModification",{}),As(ig()),Cu("builder",function(e){function o(n){return Cs(n,e,"widget").map(function(n){return Fm.focusIn(n),n})}function n(n,t){return Qf(t.event().target())||e.autofocus&&t.setSource(n.element()),on.none()}var t=Ss(0,e,ig()),r=ks("item-widget",e,t.internals());return{dom:e.dom,components:r,domModification:e.domModification,events:Jo([ji(function(n,t){o(n).each(function(n){t.stop()})}),Zo(ao(),Id),Zo(Co(),function(n,t){e.autofocus?o(n):Xm.focus(n)})]),behaviours:Sf(e.widgetBehaviours,[jm.config({store:{mode:"memory",initialValue:e.data}}),Xm.config({ignore:e.ignoreFocus,onFocus:function(n){Rd(n)}}),Fm.config({mode:"special",focusIn:e.autofocus?function(n){o(n)}:Xu(),onLeft:n,onRight:n,onEscape:function(n,t){return Xm.isFocused(n)||e.autofocus?(e.autofocus&&t.setSource(n.element()),on.none()):(Xm.focus(n),on.some(!0))}})])}})],ag=rt("type",{widget:ug,item:og,separator:rg}),cg=nn([Wf({factory:{sketch:function(n){var t=et("menu.spec item",ag,n);return t.builder(t)}},name:"items",unit:"item",defaults:function(n,t){return t.hasOwnProperty("uid")?t:I(I({},t),{uid:Ir("item")})},overrides:function(n,t){return{type:t.type,ignoreFocus:n.fakeFocus,domModification:{classes:[n.markers.item]}}}})]),sg=nn([at("value"),at("items"),at("dom"),at("components"),wt("eventOrder",{}),ss("menuBehaviours",[Ml,jm,Ol,Fm]),St("movement",{mode:"menu",moveOnTab:!0},rt("mode",{grid:[ju(),Cu("config",function(n,t){return{mode:"flatgrid",selector:"."+n.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:n.focusManager}})],matrix:[Cu("config",function(n,t){return{mode:"matrix",selectors:{row:t.rowSelector,cell:"."+n.markers.item},focusManager:n.focusManager}}),at("rowSelector")],menu:[wt("moveOnTab",!0),Cu("config",function(n,t){return{mode:"menu",selector:"."+n.markers.item,moveOnTab:t.moveOnTab,focusManager:n.focusManager}})]})),ct("markers",zu()),wt("fakeFocus",!1),wt("focusManager",vl()),xu("onHighlight")]),fg=nn("alloy.menu-focus"),lg=$f({name:"Menu",configFields:sg(),partFields:cg(),factory:function(n,t,e,o){return{uid:n.uid,dom:n.dom,markers:n.markers,behaviours:ls(n.menuBehaviours,[Ml.config({highlightClass:n.markers.selectedItem,itemClass:n.markers.item,onHighlight:n.onHighlight}),jm.config({store:{mode:"memory",initialValue:n.value}}),Ol.config({find:on.some}),Fm.config(n.movement.config(n,n.movement))]),events:Jo([Zo(eg(),function(t,e){var n=e.event();t.getSystem().getByDom(n.target()).each(function(n){Ml.highlight(t,n),e.stop(),Gt(t,fg(),{menu:t,item:n})})}),Zo(tg(),function(n,t){var e=t.event().item();Ml.highlight(n,e)})]),components:t,eventOrder:n.eventOrder,domModification:{attributes:{role:"menu"}}}}}),dg=function(e,o,r,n){return Vn(r,n).bind(function(n){return Vn(e,n).bind(function(n){var t=dg(e,o,r,n);return on.some([n].concat(t))})}).getOr([])},mg=function(){function t(n){return Vn(u.get(),n)}var i=Ce({}),u=Ce({}),a=Ce({}),c=Ce(on.none()),s=Ce({});return{setMenuBuilt:function(n,t){var e;u.set(I(I({},u.get()),((e={})[n]={type:"prepared",menu:t},e)))},setContents:function(n,t,e,o){c.set(on.some(n)),i.set(e),u.set(t),s.set(o);var r=Vd(o,e);a.set(r)},expand:function(e){return Vn(i.get(),e).map(function(n){var t=Vn(a.get(),e).getOr([]);return[n].concat(t)})},refresh:function(n){return Vn(a.get(),n)},collapse:function(n){return Vn(a.get(),n).bind(function(n){return 1<n.length?on.some(n.slice(1)):on.none()})},lookupMenu:t,otherMenus:function(n){var t=s.get();return D(xn(t),n)},getPrimary:function(){return c.get().bind(function(n){return t(n).bind(function(n){return"prepared"===n.type?on.some(n.menu):on.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(on.none())},isClear:function(){return c.get().isNone()}}},gg=nn("collapse-item"),pg=Jf({name:"TieredMenu",configFields:[ku("onExecute"),ku("onEscape"),Su("onOpenMenu"),Su("onOpenSubmenu"),xu("onCollapseMenu"),wt("highlightImmediately",!0),dt("data",[at("primary"),at("menus"),at("expansions")]),wt("fakeFocus",!1),xu("onHighlight"),xu("onHover"),vu(),at("dom"),wt("navigateOnHover",!0),wt("stayInDom",!1),ss("tmenuBehaviours",[Fm,Ml,Ol,Im]),wt("eventOrder",{})],apis:{collapseMenu:function(n,t){n.collapseMenu(t)},highlightPrimary:function(n,t){n.highlightPrimary(t)}},factory:function(a,n){function e(n){var t=function(o,r,n){return N(n,function(n,t){function e(){return lg.sketch(I(I({dom:n.dom},n),{value:t,items:n.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?bl():vl()}))}return t===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})}(n,a.data.primary,a.data.menus),e=o();return g.setContents(a.data.primary,t,a.data.expansions,e),g.getPrimary()}function c(n){return jm.getValue(n).value}function u(t,n){Ml.highlight(t,n),Ml.getHighlighted(n).orThunk(function(){return Ml.getFirst(n)}).each(function(n){Yt(t,n.element(),Co())})}function s(t,n){return Ei(w(n,function(n){return t.lookupMenu(n).bind(function(n){return"prepared"===n.type?on.some(n.menu):on.none()})}))}function f(t,n,e){var o=s(n,n.otherMenus(e));bn(o,function(n){ei(n.element(),[a.markers.backgroundMenu]),a.stayInDom||Im.remove(t,n)})}function l(n,o){var t=function(o){return r.get().getOrThunk(function(){var e={},n=Bc(o.element(),"."+a.markers.item),t=S(n,function(n){return"true"===Er(n,"aria-haspopup")});return bn(t,function(n){o.getSystem().getByDom(n).each(function(n){var t=c(n);e[t]=n})}),r.set(on.some(e)),e})}(n);Sn(t,function(n,t){var e=vn(o,t);Or(n.element(),"aria-expanded",e)})}function d(o,r,i){return on.from(i[0]).bind(function(n){return r.lookupMenu(n).bind(function(n){if("notbuilt"===n.type)return on.none();var t=n.menu,e=s(r,i.slice(1));return bn(e,function(n){$r(n.element(),a.markers.backgroundMenu)}),Xo(t.element())||Im.append(o,du(t)),ei(t.element(),[a.markers.backgroundMenu]),u(o,t),f(o,r,i),on.some(t)})})}var m,t,r=Ce(on.none()),g=mg(),o=function(n){return N(a.data.menus,function(n,t){return E(n.items,function(n){return"separator"===n.type?[]:[n.data.value]})})};(t=m=m||{})[t.HighlightSubmenu=0]="HighlightSubmenu",t[t.HighlightParent=1]="HighlightParent";function i(r,i,u){void 0===u&&(u=m.HighlightSubmenu);var n=c(i);return g.expand(n).bind(function(o){return l(r,o),on.from(o[0]).bind(function(e){return g.lookupMenu(e).bind(function(n){var t=function(n,t,e){if("notbuilt"!==e.type)return e.menu;var o=n.getSystem().build(e.nbMenu());return g.setMenuBuilt(t,o),o}(r,e,n);return Xo(t.element())||Im.append(r,du(t)),a.onOpenSubmenu(r,i,t),u===m.HighlightSubmenu?(Ml.highlightFirst(t),d(r,g,o)):(Ml.dehighlightAll(t),on.some(i))})})})}function p(t,e){var n=c(e);return g.collapse(n).bind(function(n){return l(t,n),d(t,g,n).map(function(n){return a.onCollapseMenu(t,e,n),n})})}function h(e){return function(t,n){return Ci(n.getSource(),"."+a.markers.item).bind(function(n){return t.getSystem().getByDom(n).toOption().bind(function(n){return e(t,n).map(function(){return!0})})})}}var v=Jo([Zo(fg(),function(t,n){var e=n.event().menu();Ml.highlight(t,e);var o=c(n.event().item());g.refresh(o).each(function(n){return f(t,g,n)})}),ji(function(t,n){var e=n.event().target();t.getSystem().getByDom(e).each(function(n){0===c(n).indexOf("collapse-item")&&p(t,n),i(t,n,m.HighlightSubmenu).fold(function(){a.onExecute(t,n)},function(){})})}),Pi(function(t,n){e(t).each(function(n){Im.append(t,du(n)),a.onOpenMenu(t,n),a.highlightImmediately&&u(t,n)})})].concat(a.navigateOnHover?[Zo(tg(),function(n,t){var e=t.event().item();!function(t,n){var e=c(n);g.refresh(e).bind(function(n){return l(t,n),d(t,g,n)})}(n,e),i(n,e,m.HighlightParent),a.onHover(n,e)})]:[])),b={collapseMenu:function(t){Ml.getHighlighted(t).each(function(n){Ml.getHighlighted(n).each(function(n){p(t,n)})})},highlightPrimary:function(t){g.getPrimary().each(function(n){u(t,n)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:ls(a.tmenuBehaviours,[Fm.config({mode:"special",onRight:h(function(n,t){return Qf(t.element())?on.none():i(n,t,m.HighlightSubmenu)}),onLeft:h(function(n,t){return Qf(t.element())?on.none():p(n,t)}),onEscape:h(function(n,t){return p(n,t).orThunk(function(){return a.onEscape(n,t).map(function(){return n})})}),focusIn:function(t,n){g.getPrimary().each(function(n){Yt(t,n.element(),Co())})}}),Ml.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),Ol.config({find:function(n){return Ml.getHighlighted(n)}}),Im.config({})]),eventOrder:a.eventOrder,apis:b,events:v}},extraApis:{tieredData:function(n,t,e){return{primary:n,menus:t,expansions:e}},singleData:function(n,t){return{primary:n,menus:q(n,t),expansions:{}}},collapseItem:function(n){return{value:Mr(gg()),meta:{text:n}}}}}),hg=Jf({name:"InlineView",configFields:[at("lazySink"),xu("onShow"),xu("onHide"),yt("onEscape"),ss("inlineBehaviours",[hf,Ku]),xt("fireDismissalEventInstead",[wt("event",Ro())]),wt("getRelated",on.none),wt("eventOrder",on.none)],factory:function(i,n){var o=function(n,t,e,o){var r=i.lazySink(n).getOrDie();hf.openWhileCloaked(n,e,function(){return uf.positionWithin(r,t,n,o)}),i.onShow(n)},t={setContent:function(n,t){hf.open(n,t)},showAt:function(n,t,e){o(n,t,e,on.none())},showWithin:o,showWithinBounds:function(n,t,e,o){var r=i.lazySink(n).getOrDie();hf.openWhileCloaked(n,e,function(){return uf.positionWithinBounds(r,t,n,o)}),i.onShow(n)},showMenuAt:function(n,t,e){var o=function(n,t,e,o){function r(){return n.lazySink(t)}return pg.sketch({dom:{tag:"div"},data:o.data,markers:o.menu.markers,onEscape:function(){return hf.close(t),n.onEscape.map(function(n){return n(t)}),on.some(!0)},onExecute:function(){return on.some(!0)},onOpenMenu:function(n,t){uf.position(r().getOrDie(),e,t)},onOpenSubmenu:function(n,t,e){var o=r().getOrDie();uf.position(o,{anchor:"submenu",item:t},e)}})}(i,n,t,e);hf.open(n,o),i.onShow(n)},hide:function(n){hf.close(n),i.onHide(n)},getContent:function(n){return hf.getState(n)},isOpen:hf.isOpen};return{uid:i.uid,dom:i.dom,behaviours:ls(i.inlineBehaviours,[hf.config({isPartOf:function(n,t,e){return mu(t,e)||function(n,t){return i.getRelated(n).exists(function(n){return mu(n,t)})}(n,e)},getAttachPoint:function(n){return i.lazySink(n).getOrDie()}}),cs(I({isExtraPart:nn(!1)},i.fireDismissalEventInstead.map(function(n){return{fireEventInstead:{event:n.event}}}).getOr({})))]),eventOrder:i.eventOrder,apis:t}},apis:{showAt:function(n,t,e,o){n.showAt(t,e,o)},showWithin:function(n,t,e,o,r){n.showWithin(t,e,o,r)},showWithinBounds:function(n,t,e,o,r){n.showWithinBounds(t,e,o,r)},showMenuAt:function(n,t,e,o){n.showMenuAt(t,e,o)},hide:function(n,t){n.hide(t)},isOpen:function(n,t){return n.isOpen(t)},getContent:function(n,t){return n.getContent(t)},setContent:function(n,t,e){n.setContent(t,e)}}}),vg=Jf({name:"Button",factory:function(n){function e(t){return Vn(n.dom,"attributes").bind(function(n){return Vn(n,t)})}var t=Nd(n.action),o=n.dom.tag;return{uid:n.uid,dom:n.dom,components:n.components,events:t,behaviours:Sf(n.buttonBehaviours,[Xm.config({}),Fm.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:function(){if("button"!==o)return{role:e("role").getOr("button")};var n=e("type").getOr("button"),t=e("role").map(function(n){return{role:n}}).getOr({});return I({type:n},t)}()},eventOrder:n.eventOrder}},configFields:[wt("uid",undefined),at("dom"),wt("components",[]),wf("buttonBehaviours",[Xm,Fm]),pt("action"),pt("role"),wt("eventOrder",{})]}),bg={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},yg=Jf({name:"Notification",factory:function(t){function e(n){return{dom:{tag:"div",classes:["tox-bar"],attributes:{style:"width: "+n+"%"}}}}function o(n){return{dom:{tag:"div",classes:["tox-text"],innerHtml:n+"%"}}}var r=Hd({dom:{tag:"p",innerHtml:t.translationProvider(t.text)},behaviours:Du([Im.config({})])}),i=Hd({dom:{tag:"div",classes:t.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[e(0)]},o(0)],behaviours:Du([Im.config({})])}),n={updateProgress:function(n,t){n.getSystem().isConnected()&&i.getOpt(n).each(function(n){Im.set(n,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[e(t)]},o(t)])})},updateText:function(n,t){if(n.getSystem().isConnected()){var e=r.get(n);Im.set(e,[wi(t)])}}},u=R([t.icon.toArray(),t.level.toArray(),t.level.bind(function(n){return on.from(bg[n])}).toArray()]);return{uid:t.uid,dom:{tag:"div",attributes:{role:"alert"},classes:t.level.map(function(n){return["tox-notification","tox-notification--in","tox-notification--"+n]}).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:function(n,t){return Bi(n,function(n){return on.from(t()[n])}).getOrThunk(function(){return Pd(t)})}(u,t.iconProvider)}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[r.asSpec()],behaviours:Du([Im.config({})])}].concat(t.progress?[i.asSpec()]:[]).concat(vg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:zd("close",t.iconProvider),attributes:{"aria-label":t.translationProvider("Close")}}}],action:function(n){t.onAction(n)}})),apis:n}},configFields:[pt("level"),at("progress"),at("icon"),at("onAction"),at("text"),at("iconProvider"),at("translationProvider")],apis:{updateProgress:function(n,t,e){n.updateProgress(t,e)},updateText:function(n,t,e){n.updateText(t,e)}}}),xg=tinymce.util.Tools.resolve("tinymce.util.Delay");function wg(o,i,u){var a=i.backstage;return{open:function(n,t){function e(){t(),hg.hide(r)}var o=lu(yg.sketch({text:n.text,level:vn(["success","error","warning","info"],n.type)?n.type:undefined,progress:!0===n.progressBar,icon:on.from(n.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=lu(hg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),0<n.timeout&&xg.setTimeout(function(){e()},n.timeout),{close:e,moveTo:function(n,t){hg.showAt(r,{anchor:"makeshift",x:n,y:t},du(o))},moveRel:function(n,t){hg.showAt(r,i.backstage.shared.anchors.banner(),du(o))},text:function(n){yg.updateText(o,n)},settings:n,getEl:function(){},progressBar:{value:function(n){yg.updateProgress(o,n)}}}},close:function(n){n.close()},reposition:function(n){!function(n){bn(n,function(n){n.moveTo(0,0)})}(n),function(e){if(0<e.length){var n=e.slice(0,1)[0],t=function(n){return n.inline?n.getElement():n.getContentAreaContainer()}(o);n.moveRel(t,"tc-tc"),bn(e,function(n,t){0<t&&n.moveRel(e[t-1].getEl(),"bc-tc")})}}(n)},getArgs:function(n){return n.settings}}}function Sg(e,o){var r=null;return{cancel:function(){null!==r&&(M.clearTimeout(r),r=null)},throttle:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];null!==r&&M.clearTimeout(r),r=M.setTimeout(function(){e.apply(null,n),r=null},o)}}}function kg(n,t,e,o,r){var i=new ep(t,r||n.getRoot());return ip(n,t,on.some(e),o,i.prev,on.none())}function Cg(t,e){return up(Te.fromDom(t.selection.getNode())).getOrThunk(function(){var n=Te.fromHtml('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',t.getDoc());return Ui(n,Te.fromDom(e.extractContents())),e.insertNode(n.dom()),dr(n).each(function(n){return n.dom().normalize()}),Sc(n).map(function(n){t.selection.setCursorLocation(n.dom(),function(n){return"img"===Wo(n)?1:bc(n).fold(function(){return gr(n).length},function(n){return n.length})}(n))}),n})}function Og(n,t){return n.toString().substring(t.length).replace(/\u00A0/g," ").replace(/\uFEFF/g,"")}function Tg(n,u,a,c){return void 0===c&&(c=0),function(n){return n.collapsed&&3===n.startContainer.nodeType}(u)?kg(n,u.startContainer,u.startOffset,function(e,o,r,n){var i=n.getOr(r.length);return function(n,t,e,o){var r;for(r=t-1;0<=r;r--){var i=n.charAt(r);if(ap.test(i))return on.none();if(i===e)break}return-1===r||t-r<o?on.none():on.some(n.substring(r+1,t))}(r,i,a,1).fold(function(){return r.match(ap)?e.abort():e.kontinue()},function(n){var t=u.cloneRange();return t.setStart(o,i-n.length-1),t.setEnd(u.endContainer,u.endOffset),r.length<c?e.abort():e.finish({text:Og(t,a),range:t,triggerChar:a})})}).fold(on.none,on.none,on.some):on.none()}function Eg(e,n,o,t){return void 0===t&&(t=0),up(Te.fromDom(n.startContainer)).fold(function(){return Tg(e,n,o,t)},function(n){var t=e.createRng();return t.selectNode(n.dom()),on.some({range:t,text:Og(t,o),triggerChar:o})})}function Bg(n,t){return{element:n,offset:t}}function _g(t,e){var n=e(),o=t.selection.getRng();return function(t,e,n){return Bi(n.triggerChars,function(n){return Eg(t,e,n)})}(t.dom,o,n).bind(function(n){return dp(t,e,n)})}function Dg(n){var t=n.ui.registry.getAll().popups,e=N(t,function(n){return function(n){return nt("Autocompleter",pp,n)}(n).fold(function(n){throw new Error(he(n))},function(n){return n})}),o=function(n){var t={};return bn(n,function(n){t[n]={}}),xn(t)}(Cn(e,function(n){return n.ch})),r=H(e);return{dataset:e,triggerChars:o,lookupByChar:function(t){return S(r,function(n){return n.ch===t})}}}function Ag(n,o,t){var r=Bc(n.element(),"."+t);if(0<r.length){var e=T(r,function(n){var t=n.dom().getBoundingClientRect().top,e=r[0].dom().getBoundingClientRect().top;return Math.abs(t-e)>o}).getOr(r.length);return on.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return on.none()}function Fg(n,t){return Du([Td(n,t)])}function Mg(n,t,e){n.getSystem().broadcastOn([Op],{})}function Ig(n){var t=Te.fromHtml(n),e=gr(t),o=function(n){var t=n.dom().attributes!==undefined?n.dom().attributes:[];return C(t,function(n,t){var e;return"class"===t.name?n:I(I({},n),((e={})[t.name]=t.value,e))},{})}(t),r=function(n){return Array.prototype.slice.call(n.dom().classList,0)}(t),i=0===e.length?{}:{innerHtml:Sr(t)};return I({tag:Wo(t),classes:r,attributes:o},i)}function Rg(n){return Vn(Ip,n).getOr(Ap)}function Vg(n){return{dom:{tag:"div",classes:[Vp],innerHtml:n}}}function Ng(n){return{dom:{tag:"div",classes:[Np]},components:[wi(Dp.translate(n))]}}function Hg(n,t){return{dom:{tag:"div",classes:[Np]},components:[{dom:{tag:n.tag,attributes:{style:n.styleAttr}},components:[wi(Dp.translate(t))]}]}}function Pg(n){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:zp(n)}}}function zg(n){return{dom:{tag:"div",classes:[Vp,"tox-collection__item-checkmark"],innerHtml:zd("checkmark",n)}}}function Lg(n,t,e,o,r){var i=e?n.checkMark.orThunk(function(){return t.or(on.some("")).map(Vg)}):on.none(),u=n.ariaLabel.map(function(n){return{attributes:{title:Dp.translate(n)}}}).getOr({});return{dom:_n({tag:"div",classes:[Ap,Fp].concat(r?["tox-collection__item-icon-rtl"]:[])},u),optComponents:[i,n.htmlContent.fold(function(){return n.textContent.map(o)},function(n){return on.some(function(n){return{dom:{tag:"div",classes:[Np],innerHtml:n}}}(n))}),n.shortcutContent.map(Pg),n.caret]}}function jg(n,t,e,o){void 0===o&&(o=on.none());var r=Dp.isRtl()&&n.iconContent.exists(function(n){return vn(jp,n)}),i=n.iconContent.map(function(n){return Dp.isRtl()&&vn(Lp,n)?n+"-rtl":n}).map(function(n){return function(n,t,e){return on.from(t()[n]).or(e).getOrThunk(function(){return Pd(t)})}(n,t.icons,o)}),u=on.from(n.meta).fold(function(){return Ng},function(n){return On(n,"style")?l(Hg,n.style):Ng});return"color"===n.presets?function(n,t,e,o){var r,i,u;return{dom:(r=Mp,i=e.getOr(""),u=n.map(function(n){return' title="'+o.translate(n)+'"'}).getOr(""),Ig("custom"===t?'<button class="'+r+' tox-swatches__picker-btn"'+u+">"+i+"</button>":"remove"===t?'<div class="'+r+' tox-swatch--remove"'+u+">"+i+"</div>":'<div class="'+r+'" style="background-color: '+t+'" data-mce-color="'+t+'"'+u+"></div>")),optComponents:[]}}(n.ariaLabel,n.value,i,t):Lg(n,i,e,u,r)}function Ug(n,t,e){t.disabled&&Wp(n,t)}function Wg(n,t){return!0===t.useNative&&vn(Up,Wo(n.element()))}function Gg(n){Or(n.element(),"disabled","disabled")}function Xg(n){_r(n.element(),"disabled")}function Yg(n){Or(n.element(),"aria-disabled","true")}function qg(n){Or(n.element(),"aria-disabled","false")}function Kg(t,n,e){n.disableClass.each(function(n){Zr(t.element(),n)}),(Wg(t,n)?Xg:qg)(t),n.onEnabled(t)}function Jg(n,t){return Wg(n,t)?function(n){return Br(n.element(),"disabled")}(n):function(n){return"true"===Er(n.element(),"aria-disabled")}(n)}function $g(n,t){var e=n.getApi(t);return function(n){n(e)}}function Qg(e,o){return Pi(function(n){$g(e,n)(function(n){var t=e.onSetup(n);null!==t&&t!==undefined&&o.set(t)})})}function Zg(t,e){return zi(function(n){return $g(t,n)(e.get())})}var np,tp,ep=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),op=Tn([{aborted:[]},{edge:["element"]},{success:["info"]}]),rp=Tn([{abort:[]},{kontinue:[]},{finish:["info"]}]),ip=function(t,e,n,o,r,i){function u(){return i.fold(op.aborted,op.edge)}function a(){var n=r();return n?ip(t,n,on.none(),o,r,on.some(e)):u()}if(t.isBlock(e))return u();if(function(n){return n.nodeType===M.Node.TEXT_NODE}(e)){var c=e.textContent;return o(rp,e,c,n).fold(op.aborted,function(){return a()},op.success)}return a()},up=function(n){return Ci(n,"[data-mce-autocompleter]")},ap=/[\u00a0 \t\r\n]/,cp=function(e,n){n.on("keypress compositionend",e.onKeypress.throttle),n.on("remove",e.onKeypress.cancel);function o(n,t){Gt(n,fo(),{raw:t})}n.on("keydown",function(t){function n(){return e.getView().bind(Ml.getHighlighted)}8===t.which&&e.onKeypress.throttle(t),e.isActive()&&(27===t.which&&e.cancelIfNecessary(),e.isMenuOpen()?13===t.which?(n().each(Xt),t.preventDefault()):40===t.which?(n().fold(function(){e.getView().each(Ml.highlightFirst)},function(n){o(n,t)}),t.preventDefault(),t.stopImmediatePropagation()):37!==t.which&&38!==t.which&&39!==t.which||n().each(function(n){o(n,t),t.preventDefault(),t.stopImmediatePropagation()}):13!==t.which&&38!==t.which&&40!==t.which||e.cancelIfNecessary())}),n.on("NodeChange",function(n){e.isActive()&&up(Te.fromDom(n.element)).isNone()&&e.cancelIfNecessary()})},sp=tinymce.util.Tools.resolve("tinymce.util.Promise"),fp=function(n){if(function(n){return n.nodeType===M.Node.TEXT_NODE}(n))return Bg(n,n.data.length);var t=n.childNodes;return 0<t.length?fp(t[t.length-1]):Bg(n,t.length)},lp=function(n,t){var e=n.childNodes;return 0<e.length&&t<e.length?lp(e[t],0):0<e.length&&function(n){return n.nodeType===M.Node.ELEMENT_NODE}(n)&&e.length===t?fp(e[e.length-1]):Bg(n,t)},dp=function(t,n,e,o){void 0===o&&(o={});var r=n(),i=t.selection.getRng().startContainer.nodeValue,u=S(r.lookupByChar(e.triggerChar),function(n){return e.text.length>=n.minChars&&n.matches.getOrThunk(function(){return function(e){function o(n,t,e,o){var r=o.getOr(e.length);return 0===r?n.kontinue():n.finish(/\s/.test(e.charAt(r-1)))}return function(n){var t=lp(n.startContainer,n.startOffset);return kg(e,t.element,t.offset,o).fold(nn(!0),nn(!0),f)}}(t.dom)})(e.range,i,e.text)});if(0===u.length)return on.none();var a=sp.all(w(u,function(t){return t.fetch(e.text,t.maxResults,o).then(function(n){return{matchText:e.text,items:n,columns:t.columns,onAction:t.onAction}})}));return on.some({lookupData:a,context:e})},mp=se([st("type"),bt("text")]),gp=se([_t("type",function(){return"autocompleteitem"}),_t("active",function(){return!1}),_t("disabled",function(){return!1}),wt("meta",{}),st("value"),bt("text"),bt("icon")]),pp=se([st("type"),st("ch"),kt("minChars",1),wt("columns",1),kt("maxResults",10),yt("matches"),lt("fetch"),lt("onAction")]),hp=[Tt("disabled",!1),bt("text"),bt("shortcut"),me("value","value",Mn(function(){return Mr("menuitem-value")}),ve()),wt("meta",{})],vp=se([st("type"),Et("onSetup",function(){return Z}),Et("onAction",Z),bt("icon")].concat(hp)),bp=se([st("type"),lt("getSubmenuItems"),Et("onSetup",function(){return Z}),bt("icon")].concat(hp)),yp=se([st("type"),Tt("active",!1),Et("onSetup",function(){return Z}),lt("onAction")].concat(hp)),xp=se([st("type"),Tt("active",!1),bt("icon")].concat(hp)),wp=se([st("type"),ft("fancytype",["inserttable","colorswatch"]),Et("onAction",Z)]),Sp=function(n){return Fg(Mr("unnamed-events"),n)},kp=[at("lazySink"),at("tooltipDom"),wt("exclusive",!0),wt("tooltipComponents",[]),wt("delay",300),Ot("mode","normal",["normal","follow-highlight"]),wt("anchor",function(n){return{anchor:"hotspot",hotspot:n,layouts:{onLtr:nn([ka,Sa,ba,xa,ya,wa]),onRtl:nn([ka,Sa,ba,xa,ya,wa])}}}),xu("onHide"),xu("onShow")],Cp=/* */Object.freeze({init:function(){function e(){o.get().each(function(n){M.clearTimeout(n)})}var o=Ce(on.none()),t=Ce(on.none()),n=nn("not-implemented");return iu({getTooltip:function(){return t.get()},isShowing:function(){return t.get().isSome()},setTooltip:function(n){t.set(on.some(n))},clearTooltip:function(){t.set(on.none())},clearTimer:e,resetTimer:function(n,t){e(),o.set(on.some(M.setTimeout(function(){n()},t)))},readState:n})}}),Op=Mr("tooltip.exclusive"),Tp=Mr("tooltip.show"),Ep=Mr("tooltip.hide"),Bp=/* */Object.freeze({hideAllExclusive:Mg,setComponents:function(n,t,e,o){e.getTooltip().each(function(n){n.getSystem().isConnected()&&Im.set(n,o)})}}),_p=Au({fields:kp,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){function e(t){r.getTooltip().each(function(n){ts(n),o.onHide(t,n),r.clearTooltip()}),r.clearTimer()}return Jo(R([[Zo(Tp,function(n){r.resetTimer(function(){!function(t){if(!r.isShowing()){Mg(t);var n=o.lazySink(t).getOrDie(),e=t.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:Jo("normal"===o.mode?[Zo(ao(),function(n){Wt(t,Tp)}),Zo(io(),function(n){Wt(t,Ep)})]:[]),behaviours:Du([Im.config({})])});r.setTooltip(e),Zc(n,e),o.onShow(t,e),uf.position(n,o.anchor(t),e)}}(n)},o.delay)}),Zo(Ep,function(n){r.resetTimer(function(){e(n)},o.delay)}),Zo(So(),function(n,t){vn(t.channels(),Op)&&e(n)}),zi(function(n){e(n)})],"normal"===o.mode?[Zo(co(),function(n){Wt(n,Tp)}),Zo(xo(),function(n){Wt(n,Ep)}),Zo(ao(),function(n){Wt(n,Tp)}),Zo(io(),function(n){Wt(n,Ep)})]:[Zo(zo(),function(n,t){Wt(n,Tp)}),Zo(Lo(),function(n){Wt(n,Ep)})]]))}}),state:Cp,apis:Bp}),Dp=tinymce.util.Tools.resolve("tinymce.util.I18n"),Ap="tox-menu-nav__js",Fp="tox-collection__item",Mp="tox-swatch",Ip={normal:Ap,color:Mp},Rp="tox-collection__item--enabled",Vp="tox-collection__item-icon",Np="tox-collection__item-label",Hp="tox-collection__item--active",Pp=tinymce.util.Tools.resolve("tinymce.Env"),zp=function(n){var e=Pp.mac?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},t=n.split("+"),o=w(t,function(n){var t=n.toLowerCase().trim();return On(e,t)?e[t]:n});return Pp.mac?o.join(""):o.join("+")},Lp=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],jp=["list-bull-circle","list-bull-default","list-bull-square"],Up=["input","button","textarea","select"],Wp=function(t,n,e){n.disableClass.each(function(n){$r(t.element(),n)}),(Wg(t,n)?Gg:Yg)(t),n.onDisabled(t)},Gp=/* */Object.freeze({enable:Kg,disable:Wp,isDisabled:Jg,onLoad:Ug,set:function(n,t,e,o){(o?Wp:Kg)(n,t,e)}}),Xp=/* */Object.freeze({exhibit:function(n,t,e){return zr({classes:t.disabled?t.disableClass.map(A).getOr([]):[]})},events:function(e,n){return Jo([$o(ko(),function(n,t){return Jg(n,e)}),Tu(e,n,Ug)])}}),Yp=[wt("disabled",!1),wt("useNative",!0),pt("disableClass"),xu("onDisabled"),xu("onEnabled")],qp=Au({fields:Yp,name:"disabling",active:Xp,apis:Gp}),Kp=function(n){return qp.config({disabled:n,disableClass:"tox-collection__item--state-disabled"})},Jp=function(n){return qp.config({disabled:n})},$p=function(n){return qp.config({disabled:n,disableClass:"tox-tbtn--disabled"})},Qp=function(n){return qp.config({disabled:n,disableClass:"tox-tbtn--disabled",useNative:!1})};(tp=np=np||{})[tp.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",tp[tp.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";function Zp(n){return E(n,function(n){return n.toArray()})}function nh(n,t,e){var o=Ce(Z);return{type:"item",dom:t.dom,components:Zp(t.optComponents),data:n.data,eventOrder:ih,hasSubmenu:n.triggersSubmenu,itemBehaviours:Du([Td("item-events",[function(e,o){return ji(function(n,t){$g(e,n)(e.onAction),e.triggersSubmenu||o!==rh.CLOSE_ON_EXECUTE||(Wt(n,Bo()),t.stop())})}(n,e),Qg(n,o),Zg(n,o)]),Kp(n.disabled),Im.config({})].concat(n.itemBehaviours))}}function th(n){return{value:n.value,meta:_n({text:n.text.getOr("")},n.meta)}}function eh(n,t){var e=function(n){return uh.DOM.encode(n)}(Dp.translate(n));if(0<t.length){var o=new RegExp(function(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"gi");return e.replace(o,function(n){return'<span class="tox-autocompleter-highlight">'+n+"</span>"})}return e}function oh(t,e,n){function o(n){return Gt(n,sh,{row:t,col:e})}var r;return lu({dom:{tag:"div",attributes:(r={role:"button"},r["aria-labelledby"]=n,r)},behaviours:Du([Td("insert-table-picker-cell",[Zo(ao(),Xm.focus),Zo(ko(),o),Zo(To(),o)]),Qm.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Xm.config({onFocus:function(n){return Gt(n,ch,{row:t,col:e})}})])})}var rh=np,ih={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},uh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),ah=nn(bs("item-widget",ig())),ch=Mr("cell-over"),sh=Mr("cell-execute");function fh(n){return{value:nn(n)}}function lh(n){return wh.test(n)||Sh.test(n)}function dh(n){var t=function(n){var t=n.value().replace(wh,function(n,t,e,o){return t+t+e+e+o+o});return{value:nn(t)}}(n),e=Sh.exec(t.value());return null===e?["FFFFFF","FF","FF","FF"]:e}function mh(n){var t=n.toString(16);return 1===t.length?"0"+t:t}function gh(n){var t=mh(n.red())+mh(n.green())+mh(n.blue());return fh(t)}function ph(n,t,e,o){return{red:nn(n),green:nn(t),blue:nn(e),alpha:nn(o)}}function hh(n){var t=parseInt(n,10);return t.toString()===n&&0<=t&&t<=255}function vh(n){var t,e,o,r=(n.hue()||0)%360,i=n.saturation()/100,u=n.value()/100;if(i=Ch(0,kh(i,1)),u=Ch(0,kh(u,1)),0===i)return t=e=o=Oh(255*u),ph(t,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),f=u-c;switch(Math.floor(a)){case 0:t=c,e=s,o=0;break;case 1:t=s,e=c,o=0;break;case 2:t=0,e=c,o=s;break;case 3:t=0,e=s,o=c;break;case 4:t=s,e=0,o=c;break;case 5:t=c,e=0,o=s;break;default:t=e=o=0}return t=Oh(255*(t+f)),e=Oh(255*(e+f)),o=Oh(255*(o+f)),ph(t,e,o,1)}function bh(n){var t=dh(n),e=parseInt(t[1],16),o=parseInt(t[2],16),r=parseInt(t[3],16);return ph(e,o,r,1)}function yh(n,t,e,o){var r=parseInt(n,10),i=parseInt(t,10),u=parseInt(e,10),a=parseFloat(o);return ph(r,i,u,a)}function xh(n){return"rgba("+n.red()+","+n.green()+","+n.blue()+","+n.alpha()+")"}var wh=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Sh=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,kh=Math.min,Ch=Math.max,Oh=Math.round,Th=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,Eh=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Bh=nn(ph(255,0,0,1)),_h=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Dh="tinymce-custom-colors";function Ah(n){var t=[],u=M.document.createElement("canvas");u.height=1,u.width=1;for(var a=u.getContext("2d"),c=function(n,t){var e=t/255;return("0"+Math.round(n*e+255*(1-e)).toString(16)).slice(-2).toUpperCase()},e=function(n){if(/^[0-9A-Fa-f]{6}$/.test(n))return"#"+n.toUpperCase();a.clearRect(0,0,u.width,u.height),a.fillStyle="#FFFFFF",a.fillStyle=n,a.fillRect(0,0,1,1);var t=a.getImageData(0,0,1,1).data,e=t[0],o=t[1],r=t[2],i=t[3];return"#"+c(e,i)+c(o,i)+c(r,i)},o=0;o<n.length;o+=2)t.push({text:n[o+1],value:e(n[o]),type:"choiceitem"});return t}function Fh(n){return n.getParam("color_map")}function Mh(n,e){var o;return n.dom.getParents(n.selection.getStart(),function(n){var t;(t=n.style["forecolor"===e?"color":"background-color"])&&(o=o||t)}),o}function Ih(n){return Math.max(5,Math.ceil(Math.sqrt(n)))}function Rh(n){var t=ov(n),e=Ih(t.length);return tv(n,e)}function Vh(t,e,n,o){"custom"===n?fv(t)(function(n){n.each(function(n){iv(n),t.execCommand("mceApplyTextcolor",e,n),o(n)})},"#000000"):"remove"===n?(o(""),t.execCommand("mceRemoveTextcolor",e)):(o(n),t.execCommand("mceApplyTextcolor",e,n))}function Nh(n,t){return n.concat(rv().concat(function(n){var t="choiceitem",e={type:t,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"};return n?[e,{type:t,text:"Custom color",icon:"color-picker",value:"custom"}]:[e]}(t)))}function Hh(t,e){return function(n){n(Nh(t,e))}}function Ph(n,t,e){var o,r;o="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color",r=e,n.setIconFill(o,r),n.setIconStroke(o,r)}function zh(o,e,r,n,i){o.ui.registry.addSplitButton(e,{tooltip:n,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){return on.from(Mh(o,r)).bind(function(n){return function(n){if("transparent"===n)return on.some(ph(0,0,0,0));var t=Th.exec(n);if(null!==t)return on.some(yh(t[1],t[2],t[3],"1"));var e=Eh.exec(n);return null!==e?on.some(yh(e[1],e[2],e[3],e[4])):on.none()}(n).map(function(n){var t=gh(n).value();return Rt(e.toLowerCase(),t)})}).getOr(!1)},columns:Rh(o),fetch:Hh(ov(o),ev(o)),onAction:function(n){null!==i.get()&&Vh(o,r,i.get(),function(){})},onItemAction:function(n,t){Vh(o,r,t,function(n){i.set(n),sv(o,{name:e,color:n})})},onSetup:function(t){null!==i.get()&&Ph(t,e,i.get());function n(n){n.name===e&&Ph(t,n.name,n.color)}return o.on("TextColorChange",n),function(){o.off("TextColorChange",n)}}})}function Lh(t,n,e,o){t.ui.registry.addNestedMenuItem(n,{text:o,icon:"forecolor"===n?"text-color":"highlight-bg-color",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"colorswatch",onAction:function(n){Vh(t,e,n.value,Z)}}]}})}function jh(e,o){return function(n){var t=x(n,o);return w(t,function(n){return{dom:e,components:n}})}}function Uh(t,e,n){return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===t?["tox-collection--list"]:["tox-collection--grid"])},components:[lg.parts().items({preprocess:function(n){return"auto"!==t&&1<t?jh({tag:"div",classes:["tox-collection__group"]},t)(n):function(n,e){var o=[],r=[];return bn(n,function(n,t){e(n,t)?(0<r.length&&o.push(r),r=[],On(n.dom,"innerHtml")&&r.push(n)):r.push(n)}),0<r.length&&o.push(r),w(o,function(n){return{dom:{tag:"div",classes:["tox-collection__group"]},components:n}})}(n,function(n,t){return"separator"===e[t].type})}})]}}function Wh(n){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:function(n){return"color"===n?"tox-swatches":"tox-menu"}(n),tieredMenu:"tox-tiered-menu"}}function Gh(n){var t=Wh(n);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:Rg(n)}}function Xh(n,t,e){var o=Wh(e);return{dom:{tag:"div",classes:R([[o.tieredMenu]])},markers:Gh(e)}}function Yh(n){return n.icon!==undefined||"togglemenuitem"===n.type||"choicemenuitem"===n.type}function qh(n){return M.console.error(he(n)),M.console.log(n),on.none()}function Kh(n,t,e,o,r){var i;return"color"===r?{value:n,dom:(i=function(n){return{dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[lg.parts().items({preprocess:"auto"!==n?jh({tag:"div",classes:["tox-swatches__row"]},n):f})]}]}}(o)).dom,components:i.components,items:e}:"normal"===r&&"auto"===o?{value:n,dom:(i=Uh(o,e)).dom,components:i.components,items:e}:"normal"===r&&1===o?{value:n,dom:(i=Uh(1,e)).dom,components:i.components,items:e}:"normal"===r?{value:n,dom:(i=Uh(o,e)).dom,components:i.components,items:e}:"listpreview"!==r||"auto"===o?{value:n,dom:function(n,t,e){var o=Wh(e);return{tag:"div",classes:R([[o.menu,"tox-menu-"+t+"-column"],n?[o.hasIcons]:[]])}}(t,o,r),components:dv,items:e}:{value:n,dom:(i=function(n){return{dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[lg.parts().items({preprocess:jh({tag:"div",classes:["tox-collection__group"]},n)})]}}(o)).dom,components:i.components,items:e}}function Jh(n,t,e,o,r,i,u,a){var c=function(n){return y(n,Yh)}(t),s=mv(t,e,o,"color"!==r?"normal":"color",i,u,a);return Kh(n,c,s,o,r)}function $h(n,t){var e=Gh(t);return 1===n?{mode:"menu",moveOnTab:!0}:"auto"===n?{mode:"grid",selector:"."+e.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group")}}var Qh="choiceitem",Zh=[{type:Qh,text:"Light Green",value:"#BFEDD2"},{type:Qh,text:"Light Yellow",value:"#FBEEB8"},{type:Qh,text:"Light Red",value:"#F8CAC6"},{type:Qh,text:"Light Purple",value:"#ECCAFA"},{type:Qh,text:"Light Blue",value:"#C2E0F4"},{type:Qh,text:"Green",value:"#2DC26B"},{type:Qh,text:"Yellow",value:"#F1C40F"},{type:Qh,text:"Red",value:"#E03E2D"},{type:Qh,text:"Purple",value:"#B96AD9"},{type:Qh,text:"Blue",value:"#3598DB"},{type:Qh,text:"Dark Turquoise",value:"#169179"},{type:Qh,text:"Orange",value:"#E67E23"},{type:Qh,text:"Dark Red",value:"#BA372A"},{type:Qh,text:"Dark Purple",value:"#843FA1"},{type:Qh,text:"Dark Blue",value:"#236FA1"},{type:Qh,text:"Light Gray",value:"#ECF0F1"},{type:Qh,text:"Medium Gray",value:"#CED4D9"},{type:Qh,text:"Gray",value:"#95A5A6"},{type:Qh,text:"Dark Gray",value:"#7E8C8D"},{type:Qh,text:"Navy Blue",value:"#34495E"},{type:Qh,text:"Black",value:"#000000"},{type:Qh,text:"White",value:"#ffffff"}],nv=function OF(t){void 0===t&&(t=10);var n,e=_h.getItem(Dh),o=cn(e)?JSON.parse(e):[],r=t-(n=o).length<0?n.slice(0,t):n,i=function(n){r.splice(n,1)};return{add:function(n){(function(n,t){var e=b(n,t);return-1===e?on.none():on.some(e)})(r,n).each(i),r.unshift(n),r.length>t&&r.pop(),_h.setItem(Dh,JSON.stringify(r))},state:function(){return r.slice(0)}}}(10),tv=function(n,t){return n.getParam("color_cols",t,"number")},ev=function(n){return!1!==n.getParam("custom_colors")},ov=function(n){var t=Fh(n);return t!==undefined?Ah(t):Zh},rv=function(){return w(nv.state(),function(n){return{type:Qh,text:n,value:n}})},iv=function(n){nv.add(n)},uv=function(n){return n.fire("SkinLoaded")},av=function(n){return n.fire("ResizeEditor")},cv=function(n){return n.fire("ResizeContent")},sv=function(n,t){n.fire("TextColorChange",t)},fv=function(i){return function(n,t){var e,o={colorpicker:t},r=(e=n,function(n){var t=n.getData();e(on.from(t.colorpicker)),n.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(n,t){"hex-valid"===t.name&&(t.value?n.enable("ok"):n.disable("ok"))},onSubmit:r,onClose:function(){},onCancel:function(){n(on.none())}})}},lv={register:function(n){!function(e){e.addCommand("mceApplyTextcolor",function(n,t){!function(n,t,e){n.undoManager.transact(function(){n.focus(),n.formatter.apply(t,{value:e}),n.nodeChanged()})}(e,n,t)}),e.addCommand("mceRemoveTextcolor",function(n){!function(n,t){n.undoManager.transact(function(){n.focus(),n.formatter.remove(t,{value:null},null,!0),n.nodeChanged()})}(e,n)})}(n);var t=Ce(null),e=Ce(null);zh(n,"forecolor","forecolor","Text color",t),zh(n,"backcolor","hilitecolor","Background color",e),Lh(n,"forecolor","forecolor","Text color"),Lh(n,"backcolor","hilitecolor","Background color")},getColors:Nh,getFetch:Hh,colorPickerDialog:fv,getCurrentColor:Mh,getColorCols:Rh,calcCols:Ih},dv=[lg.parts().items({})],mv=function(n,e,o,r,i,u,a){return Ei(w(n,function(t){return"choiceitem"===t.type?function(n){return nt("choicemenuitem",xp,n)}(t).fold(qh,function(n){return on.some(function(t,n,e,o,r,i,u){var a=jg({presets:e,textContent:n?t.text:on.none(),htmlContent:on.none(),ariaLabel:t.text,iconContent:t.icon,shortcutContent:n?t.shortcut:on.none(),checkMark:n?on.some(zg(u.icons)):on.none(),caret:on.none(),value:t.value},u,!0);return Bn(nh({data:th(t),disabled:t.disabled,getApi:function(t){return{setActive:function(n){Qm.set(t,n)},isActive:function(){return Qm.isOn(t)},isDisabled:function(){return qp.isDisabled(t)},setDisabled:function(n){return qp.set(t,n)}}},onAction:function(n){return o(t.value)},onSetup:function(n){return n.setActive(r),function(){}},triggersSubmenu:!1,itemBehaviours:[]},a,i),{toggling:{toggleClass:Rp,toggleOnExecute:!1,selected:t.active}})}(n,1===o,r,e,u(t.value),i,a))}):on.none()}))};var gv,pv,hv={inserttable:function TF(o){var n=Mr("size-label"),i=function(n,t,e){for(var o=[],r=0;r<t;r++){for(var i=[],u=0;u<e;u++)i.push(oh(r,u,n));o.push(i)}return o}(n,10,10),u=Hd({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[wi("0x0")],behaviours:Du([Im.config({})])});return{type:"widget",data:{value:Mr("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ah().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:function(n){return E(n,function(n){return w(n,du)})}(i).concat(u.asSpec()),behaviours:Du([Td("insert-table-picker",[or(ch,function(n,t,e){var o=e.event().row(),r=e.event().col();!function(n,t,e,o,r){for(var i=0;i<o;i++)for(var u=0;u<r;u++)Qm.set(n[i][u],i<=t&&u<=e)}(i,o,r,10,10),Im.set(u.get(n),[function(n,t){return wi(t+1+"x"+(n+1))}(o,r)])}),or(sh,function(n,t,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),Wt(n,Bo())})]),Fm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:function EF(t,n){var e=lv.getColors(n.colorinput.getColors(),n.colorinput.hasCustomColors()),o=n.colorinput.getColorCols(),r=Jh(Mr("menu-value"),e,function(n){t.onAction({value:n})},o,"color",rh.CLOSE_ON_EXECUTE,function(){return!1},n.shared.providers),i=Bn(I(I({},r),{markers:Gh("color"),movement:$h(o,"color")}));return{type:"widget",data:{value:Mr("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ah().widget(lg.sketch(i))]}}},vv=function(t,e,n,o,r,i,u,a){void 0===a&&(a=!0);var c=jg({presets:o,textContent:on.none(),htmlContent:n?t.text.map(function(n){return eh(n,e)}):on.none(),ariaLabel:t.text,iconContent:t.icon,shortcutContent:on.none(),checkMark:on.none(),caret:on.none(),value:t.value},u.providers,a,t.icon);return nh({data:th(t),disabled:t.disabled,getApi:function(){return{}},onAction:function(n){return r(t.value,t.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:function(n,t){return P(n,"tooltipWorker").map(function(e){return[_p.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(n){return{anchor:"submenu",item:n,overrides:{maxHeightFunction:Qs}}},mode:"follow-highlight",onShow:function(t,n){e(function(n){_p.setComponents(t,[su({element:Te.fromDom(n)})])})}})]}).getOr([])}(t.meta,u)},c,i)},bv=function(n){var t=n.text.fold(function(){return{}},function(n){return{innerHtml:n}});return{type:"separator",dom:I({tag:"div",classes:[Fp,"tox-collection__group-heading"]},t),components:[]}},yv=function(n,t,e,o){void 0===o&&(o=!0);var r=jg({presets:"normal",iconContent:n.icon,textContent:n.text,htmlContent:on.none(),ariaLabel:n.text,caret:on.none(),checkMark:on.none(),shortcutContent:n.shortcut},e,o);return nh({data:th(n),getApi:function(t){return{isDisabled:function(){return qp.isDisabled(t)},setDisabled:function(n){return qp.set(t,n)}}},disabled:n.disabled,onAction:n.onAction,onSetup:n.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t)},xv=function(n,t,e,o){void 0===o&&(o=!0);var r=function(n){return{dom:{tag:"div",classes:["tox-collection__item-caret"],innerHtml:zd("chevron-right",n)}}}(e.icons),i=jg({presets:"normal",iconContent:n.icon,textContent:n.text,htmlContent:on.none(),ariaLabel:n.text,caret:on.some(r),checkMark:on.none(),shortcutContent:n.shortcut},e,o);return nh({data:th(n),getApi:function(t){return{isDisabled:function(){return qp.isDisabled(t)},setDisabled:function(n){return qp.set(t,n)}}},disabled:n.disabled,onAction:Z,onSetup:n.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t)},wv=function(n,t,e){var o=jg({iconContent:on.none(),textContent:n.text,htmlContent:on.none(),ariaLabel:n.text,checkMark:on.some(zg(e.icons)),caret:on.none(),shortcutContent:n.shortcut,presets:"normal",meta:n.meta},e,!0);return Bn(nh({data:th(n),disabled:n.disabled,getApi:function(t){return{setActive:function(n){Qm.set(t,n)},isActive:function(){return Qm.isOn(t)},isDisabled:function(){return qp.isDisabled(t)},setDisabled:function(n){return qp.set(t,n)}}},onAction:n.onAction,onSetup:n.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,t),{toggling:{toggleClass:Rp,toggleOnExecute:!1,selected:n.active}})},Sv=function(t,e){return function(n,t){return Object.prototype.hasOwnProperty.call(n,t)?on.some(n[t]):on.none()}(hv,t.fancytype).map(function(n){return n(t,e)})};(pv=gv=gv||{})[pv.ContentFocus=0]="ContentFocus",pv[pv.UiFocus=1]="UiFocus";function kv(n){return n.icon!==undefined||"togglemenuitem"===n.type||"choicemenuitem"===n.type}function Cv(n){return y(n,kv)}function Ov(n,t,e,o){void 0===o&&(o=!0);var r=e.shared.providers;switch(n.type){case"menuitem":return function(n){return nt("menuitem",vp,n)}(n).fold(qh,function(n){return on.some(yv(n,t,r,o))});case"nestedmenuitem":return function(n){return nt("nestedmenuitem",bp,n)}(n).fold(qh,function(n){return on.some(xv(n,t,r,o))});case"togglemenuitem":return function(n){return nt("togglemenuitem",yp,n)}(n).fold(qh,function(n){return on.some(wv(n,t,r))});case"separator":return function(n){return nt("separatormenuitem",mp,n)}(n).fold(qh,function(n){return on.some(bv(n))});case"fancymenuitem":return function(n){return nt("fancymenuitem",wp,n)}(n).fold(qh,function(n){return Sv(n,e)});default:return M.console.error("Unknown item in general menu",n),on.none()}}function Tv(n,t,e,o,r,i){var u=1===o,a=!u||Cv(n);return Ei(w(n,function(n){return"separator"===n.type?function(n){return nt("Autocompleter.Separator",mp,n)}(n).fold(qh,function(n){return on.some(bv(n))}):function(n){return nt("Autocompleter.Item",gp,n)}(n).fold(qh,function(n){return on.some(vv(n,t,u,"normal",e,r,i,a))})}))}function Ev(n,t,e,o){var r=Cv(t),i=Ei(w(t,function(n){function t(n){return Ov(n,e,o,r)}return"nestedmenuitem"===n.type&&n.getSubmenuItems().length<=0?t(_n(n,{disabled:!0})):t(n)}));return Kh(n,r,i,1,"normal")}function Bv(n){return pg.singleData(n.value,n)}function _v(u,a){return function(n){if(u(n)){var t=Te.fromDom(n.target),e=function(){n.stopPropagation()},o=function(){n.preventDefault()},r=c(o,e),i=function(n,t,e,o,r,i,u){return{target:nn(n),x:nn(t),y:nn(e),stop:o,prevent:r,kill:i,raw:nn(u)}}(t,n.clientX,n.clientY,e,o,r,n);a(i)}}}function Dv(n,t,e,o,r){var i=_v(e,o);return n.dom().addEventListener(t,i,r),{unbind:l(Rv,n,t,i,r)}}function Av(n,t,e){return function(n,t,e,o){return Dv(n,t,e,o,!1)}(n,t,Vv,e)}function Fv(n,t,e){return function(n,t,e,o){return Dv(n,t,e,o,!0)}(n,t,Vv,e)}function Mv(n,t,e){return Ci(n,t,e).isSome()}var Iv=function(u,a){function e(){return s.get().isSome()}function c(){e()&&hg.hide(f)}function i(n,t,e,o){n.matchLength=t.text.length;var r=Bi(e,function(n){return on.from(n.columns)}).getOr(1);hg.showAt(f,{anchor:"node",root:Te.fromDom(u.getBody()),node:on.from(n.element)},lg.sketch(function(n,t,e,o){var r=e===gv.ContentFocus?bl():vl(),i=$h(t,o),u=Gh(o);return{dom:n.dom,components:n.components,items:n.items,value:n.value,markers:{selectedItem:u.selectedItem,item:u.item},movement:i,fakeFocus:e===gv.ContentFocus,focusManager:r,menuBehaviours:Sp("auto"!==t?[]:[Pi(function(o,n){Ag(o,4,u.item).each(function(n){var t=n.numColumns,e=n.numRows;Fm.setGridSize(o,e,t)})})])}}(Kh("autocompleter-value",!0,o,r,"normal"),r,gv.ContentFocus,"normal"))),hg.getContent(f).each(Ml.highlightFirst)}var s=Ce(on.none()),f=lu(hg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:Du([Td("dismissAutocompleter",[Zo(Ro(),function(){return l()})])]),lazySink:a.getSink})),l=function(){if(e()){var n=s.get().map(function(n){return n.element});up(n.getOr(Te.fromDom(u.selection.getNode()))).each(wr),c(),s.set(on.none())}},o=L(function(){return Dg(u)}),d=function(n){(function(t){return s.get().map(function(n){return Eg(u.dom,u.selection.getRng(),n.triggerChar).bind(function(n){return dp(u,o,n,t)})}).getOrThunk(function(){return _g(u,o)})})(n).fold(l,function(r){!function(n){if(!e()){var t=Cg(u,n.range);s.set(on.some({triggerChar:n.triggerChar,element:t,matchLength:n.text.length}))}}(r.context),r.lookupData.then(function(o){s.get().map(function(n){var t=r.context;if(n.triggerChar===t.triggerChar){var e=function(t,n){var e=Bi(n,function(n){return on.from(n.columns)}).getOr(1);return E(n,function(i){var n=i.items;return Tv(n,i.matchText,function(o,r){var n=u.selection.getRng();Eg(u.dom,n,t).fold(function(){return M.console.error("Lost context. Cursor probably moved")},function(n){var t=n.range,e={hide:l,reload:function(n){c(),d(n)}};i.onAction(e,t,o,r)})},e,rh.BUBBLE_TO_SANDBOX,a)})}(t.triggerChar,o);0<e.length?i(n,t,o,e):10<=t.text.length-n.matchLength?l():c()}})})})},n=Sg(function(n){27!==n.which&&d()},50);cp({onKeypress:n,cancelIfNecessary:l,isMenuOpen:function(){return hg.isOpen(f)},isActive:e,getView:function(){return hg.getContent(f)}},u)},Rv=function(n,t,e,o){n.dom().removeEventListener(t,e,o)},Vv=nn(!0);function Nv(e,o){var r=null;return{cancel:function(){null!==r&&(M.clearTimeout(r),r=null)},schedule:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];r=M.setTimeout(function(){e.apply(null,n),r=null},o)}}}function Hv(n){var t=n.raw();return t.touches===undefined||1!==t.touches.length?on.none():on.some(t.touches[0])}function Pv(e){var o=Ce(on.none()),r=Nv(function(n){o.set(on.none()),e.triggerEvent(Eo(),n)},400),i=K([{key:no(),value:function(e){return Hv(e).each(function(n){r.cancel();var t={x:nn(n.clientX),y:nn(n.clientY),target:e.target};r.schedule(e),o.set(on.some(t))}),on.none()}},{key:to(),value:function(n){return r.cancel(),Hv(n).each(function(t){o.get().each(function(n){!function(n,t){var e=Math.abs(n.clientX-t.x()),o=Math.abs(n.clientY-t.y());return 5<e||5<o}(t,n)||o.set(on.none())})}),on.none()}},{key:eo(),value:function(t){r.cancel();return o.get().filter(function(n){return zt(n.target(),t.target())}).map(function(n){return e.triggerEvent(Oo(),t)})}}]);return{fireIfReady:function(t,n){return Vn(i,n).bind(function(n){return n(t)})}}}function zv(t,n){var e=et("Getting GUI events settings",Gv,n),o=Ye.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],r=Pv(e),i=w(o.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(n){return Av(t,n,function(t){r.fireIfReady(t,n).each(function(n){n&&t.kill()}),e.triggerEvent(n,t)&&t.kill()})}),u=Ce(on.none()),a=Av(t,"paste",function(t){r.fireIfReady(t,"paste").each(function(n){n&&t.kill()}),e.triggerEvent("paste",t)&&t.kill(),u.set(on.some(M.setTimeout(function(){e.triggerEvent(wo(),t)},0)))}),c=Av(t,"keydown",function(n){e.triggerEvent("keydown",n)?n.kill():!0===e.stopBackspace&&function(n){return 8===n.raw().which&&!vn(["input","textarea"],Wo(n.target()))&&!Mv(n.target(),'[contenteditable="true"]')}(n)&&n.prevent()}),s=function(n,t){return Wv?Fv(n,"focus",t):Av(n,"focusin",t)}(t,function(n){e.triggerEvent("focusin",n)&&n.kill()}),f=Ce(on.none()),l=function(n,t){return Wv?Fv(n,"blur",t):Av(n,"focusout",t)}(t,function(n){e.triggerEvent("focusout",n)&&n.kill(),f.set(on.some(M.setTimeout(function(){e.triggerEvent(xo(),n)},0)))});return{unbind:function(){bn(i,function(n){n.unbind()}),c.unbind(),s.unbind(),l.unbind(),a.unbind(),u.get().each(M.clearTimeout),f.get().each(M.clearTimeout)}}}function Lv(n,t){var e=Vn(n,"target").map(function(n){return n()}).getOr(t);return Ce(e)}function jv(n,o,t,e,r,i){var u=n(o,e),a=function(n,t){var e=Ce(!1),o=Ce(!1);return{stop:function(){e.set(!0)},cut:function(){o.set(!0)},isStopped:e.get,isCut:o.get,event:nn(n),setSource:t.set,getSource:t.get}}(t,r);return u.fold(function(){return i.logEventNoHandlers(o,e),Xv.complete()},function(t){var e=t.descHandler();return Lr(e)(a),a.isStopped()?(i.logEventStopped(o,t.element(),e.purpose()),Xv.stopped()):a.isCut()?(i.logEventCut(o,t.element(),e.purpose()),Xv.complete()):dr(t.element()).fold(function(){return i.logNoParent(o,t.element(),e.purpose()),Xv.complete()},function(n){return i.logEventResponse(o,t.element(),e.purpose()),Xv.resume(n)})})}function Uv(n,t,e){var o=function(n){var t=Ce(!1);return{stop:function(){t.set(!0)},cut:Z,isStopped:t.get,isCut:nn(!1),event:nn(n),setSource:r("Cannot set source of a broadcasted event"),getSource:r("Cannot get source of a broadcasted event")}}(t);return bn(n,function(n){var t=n.descHandler();Lr(t)(o)}),o.isStopped()}var Wv=Ye.detect().browser.isFirefox(),Gv=Yn([lt("triggerEvent"),wt("stopBackspace",!0)]),Xv=Tn([{stopped:[]},{resume:["element"]},{complete:[]}]),Yv=function(t,e,o,n,r,i){return jv(t,e,o,n,r,i).fold(function(){return!0},function(n){return Yv(t,e,o,n,r,i)},function(){return!1})},qv=function(n,t,e,o,r){var i=Lv(e,o);return Yv(n,t,e,o,i,r)},Kv=ur("element","descHandler"),Jv=function(n,t){return{id:nn(n),descHandler:nn(t)}};function $v(){var i={};return{registerId:function(o,r,n){Sn(n,function(n,t){var e=i[t]!==undefined?i[t]:{};e[r]=uu(n,o),i[t]=e})},unregisterId:function(e){Sn(i,function(n,t){n.hasOwnProperty(e)&&delete n[e]})},filterByType:function(n){return Vn(i,n).map(function(n){return Cn(n,function(n,t){return Jv(t,n)})}).getOr([])},find:function(n,t,e){var o=Rn(t)(i);return Hi(e,function(n){return function(e,o){return Zi(o).fold(function(){return on.none()},function(n){var t=Rn(n);return e.bind(t).map(function(n){return Kv(o,n)})})}(o,n)},n)}}}function Qv(){function o(n){var t=n.element();return Zi(t).fold(function(){return function(n,t){var e=Mr(Ji+n);return Qi(t,e),e}("uid-",n.element())},function(n){return n})}var r=$v(),i={},u=function(n){Zi(n.element()).each(function(n){delete i[n],r.unregisterId(n)})};return{find:function(n,t,e){return r.find(n,t,e)},filter:function(n){return r.filterByType(n)},register:function(n){var t=o(n);$(i,t)&&function(n,t){var e=i[t];if(e!==n)throw new Error('The tagId "'+t+'" is already used by: '+Fr(e.element())+"\nCannot use it for: "+Fr(n.element())+"\nThe conflicting element is"+(Xo(e.element())?" ":" not ")+"already in the DOM");u(n)}(n,t);var e=[n];r.registerId(e,t,n.events()),i[t]=n},unregister:u,getById:function(n){return Rn(n)(i)}}}function Zv(e){function o(t){return dr(e.element()).fold(function(){return!0},function(n){return zt(t,n)})}function r(n,t){return u.find(o,n,t)}function i(e){var n=u.filter(So());bn(n,function(n){var t=n.descHandler();Lr(t)(e)})}var u=Qv(),n=zv(e.element(),{triggerEvent:function(t,e){return hu(t,e.target(),function(n){return function(n,t,e,o){var r=e.target();return qv(n,t,e,r,o)}(r,t,e,n)})}}),a={debugInfo:nn("real"),triggerEvent:function(t,e,o){hu(t,e,function(n){qv(r,t,o,e,n)})},triggerFocus:function(t,e){Zi(t).fold(function(){ml(t)},function(n){hu(yo(),t,function(n){!function(n,t,e,o,r){var i=Lv(e,o);jv(n,t,e,o,i,r)}(r,yo(),{originator:nn(e),kill:Z,prevent:Z,target:nn(t)},t,n)})})},triggerEscape:function(n,t){a.triggerEvent("keydown",n.element(),t.event())},getByUid:function(n){return g(n)},getByDom:function(n){return p(n)},build:lu,addToGui:function(n){s(n)},removeFromGui:function(n){f(n)},addToWorld:function(n){t(n)},removeFromWorld:function(n){c(n)},broadcast:function(n){l(n)},broadcastOn:function(n,t){d(n,t)},broadcastEvent:function(n,t){m(n,t)},isConnected:nn(!0)},t=function(n){n.connect(a),Ri(n.element())||(u.register(n),bn(n.components(),t),a.triggerEvent(Do(),n.element(),{target:nn(n.element())}))},c=function(n){Ri(n.element())||(bn(n.components(),c),u.unregister(n)),n.disconnect()},s=function(n){Zc(e,n)},f=function(n){ts(n)},l=function(n){i({universal:nn(!0),data:nn(n)})},d=function(n,t){i({universal:nn(!1),channels:nn(n),data:nn(t)})},m=function(n,t){var e=u.filter(n);return Uv(e,t)},g=function(n){return u.getById(n).fold(function(){return an.error(new Error('Could not find component with uid: "'+n+'" in system.'))},an.value)},p=function(n){var t=Zi(n).getOr("not found");return g(t)};return t(e),{root:nn(e),element:e.element,destroy:function(){n.unbind(),Wi(e.element())},add:s,remove:f,getByUid:g,getByDom:p,addToWorld:t,removeFromWorld:c,broadcast:l,broadcastOn:d,broadcastEvent:m}}function nb(n){return on.from(n.settings.min_width).filter(mn)}function tb(n){return on.from(n.settings.min_height).filter(mn)}function eb(n){return!1!==n.getParam("menubar",!0,"boolean")}function ob(n){var t=n.getParam("toolbar",!0),e=!0===t,o=cn(t),r=fn(t)&&0<t.length;return!sb(n)&&(r||o||e)}function rb(t){var n=xn(t.settings),e=S(n,function(n){return/^toolbar([1-9])$/.test(n)}),o=w(e,function(n){return t.getParam(n,!1,"string")}),r=S(o,function(n){return"string"==typeof n});return 0<r.length?on.some(r):on.none()}var ib,ub,ab=Jf({name:"Container",factory:function(n){var t=n.dom,e=t.attributes,o=a(t,["attributes"]);return{uid:n.uid,dom:I({tag:"div",attributes:I({role:"presentation"},e)},o),components:n.components,behaviours:fs(n.containerBehaviours),events:n.events,domModification:n.domModification,eventOrder:n.eventOrder}},configFields:[wt("components",[]),ss("containerBehaviours",[]),wt("events",{}),wt("domModification",{}),wt("eventOrder",{})]}),cb=tinymce.util.Tools.resolve("tinymce.EditorManager"),sb=function(n){return rb(n).fold(function(){return 0<n.getParam("toolbar",[],"string[]").length},function(){return!0})};(ub=ib=ib||{})["default"]="",ub.floating="floating",ub.sliding="sliding";function fb(n){return n.getParam("toolbar_drawer","","string")}function lb(n){var t=function(n){return n.getParam("fixed_toolbar_container","","string")}(n),e=n.getParam("inline",!1,"boolean");return 0<t.length&&e?ki(Vi(),t):on.none()}function db(n){return n.getParam("inline",!1,"boolean")&&lb(n).isSome()}function mb(n){var t=Ce(null);return iu({readState:function(){return{timer:null!==t.get()?"set":"unset"}},setTimer:function(n){t.set(n)},cancel:function(){var n=t.get();null!==n&&n.cancel()}})}var gb,pb,hb,vb,bb=Mr("form-component-change"),yb=Mr("form-close"),xb=Mr("form-cancel"),wb=Mr("form-action"),Sb=Mr("form-submit"),kb=Mr("form-block"),Cb=Mr("form-unblock"),Ob=Mr("form-tabchange"),Tb=Mr("form-resize"),Eb=nn([wt("prefix","form-field"),ss("fieldBehaviours",[Ol,jm])]),Bb=nn([Uf({schema:[at("dom")],name:"label"}),Uf({factory:{sketch:function(n){return{uid:n.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:n.text}}}},schema:[at("text")],name:"aria-descriptor"}),Lf({factory:{sketch:function(n){var t=X(n,["factory"]);return n.factory.sketch(t)}},schema:[at("factory")],name:"field"})]),_b=$f({name:"FormField",configFields:Eb(),partFields:Bb(),factory:function(r,n,t,e){var o=ls(r.fieldBehaviours,[Ol.config({find:function(n){return Cs(n,r,"field")}}),jm.config({store:{mode:"manual",getValue:function(n){return Ol.getCurrent(n).bind(jm.getValue)},setValue:function(n,t){Ol.getCurrent(n).each(function(n){jm.setValue(n,t)})}}})]),i=Jo([Pi(function(n,t){var o=Ts(n,r,["label","field","aria-descriptor"]);o.field().each(function(e){var t=Mr(r.prefix);o.label().each(function(n){Or(n.element(),"for",t),Or(e.element(),"id",t)}),o["aria-descriptor"]().each(function(n){var t=Mr(r.prefix);Or(n.element(),"id",t),Or(e.element(),"aria-describedby",t)})})})]),u={getField:function(n){return Cs(n,r,"field")},getLabel:function(n){return Cs(n,r,"label")}};return{uid:r.uid,dom:r.dom,components:n,behaviours:o,events:i,apis:u}},apis:{getField:function(n,t){return n.getField(t)},getLabel:function(n,t){return n.getLabel(t)}}}),Db=/* */Object.freeze({getCoupled:function(n,t,e,o){return e.getOrCreate(n,t,o)}}),Ab=[ct("others",Zn(an.value,ve()))],Fb=Au({fields:Ab,name:"coupling",apis:Db,state:/* */Object.freeze({init:function(n){var i={},t=nn({});return iu({readState:t,getOrCreate:function(e,o,r){var n=xn(o.others);if(n)return Vn(i,r).getOrThunk(function(){var n=Vn(o.others,r).getOrDie("No information found for coupled component: "+r)(e),t=e.getSystem().build(n);return i[r]=t});throw new Error("Cannot find coupled component: "+r+". Known coupled components: "+JSON.stringify(n,null,2))}})}})}),Mb=/* */Object.freeze({events:function(n,t){var e=n.stream.streams.setup(n,t);return Jo([Zo(n.event,e),zi(function(){return t.cancel()})].concat(n.cancelEvent.map(function(n){return[Zo(n,function(){return t.cancel()})]}).getOr([])))}}),Ib=/* */Object.freeze({throttle:mb,init:function(n){return n.stream.streams.state(n)}}),Rb=[ct("stream",rt("mode",{throttle:[at("delay"),wt("stopEvent",!0),Cu("streams",{setup:function(n,t){var e=n.stream,o=Sg(n.onStream,e.delay);return t.setTimer(o),function(n,t){o.throttle(n,t),e.stopEvent&&t.stop()}},state:mb})]})),wt("event","input"),pt("cancelEvent"),Su("onStream")],Vb=Au({fields:Rb,name:"streaming",active:Mb,state:Ib}),Nb={},Hb={exports:Nb};gb=undefined,pb=Nb,hb=Hb,vb=undefined,function(n){"object"==typeof pb&&void 0!==hb?hb.exports=n():"function"==typeof gb&&gb.amd?gb([],n):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EphoxContactWrapper=n()}(function(){return function f(i,u,a){function c(t,n){if(!u[t]){if(!i[t]){var e="function"==typeof vb&&vb;if(!n&&e)return e(t,!0);if(s)return s(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var r=u[t]={exports:{}};i[t][0].call(r.exports,function(n){return c(i[t][1][n]||n)},r,r.exports,f,i,u,a)}return u[t].exports}for(var s="function"==typeof vb&&vb,n=0;n<a.length;n++)c(a[n]);return c}({1:[function(n,t,e){var o,r,i=t.exports={};function u(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(n){if(o===setTimeout)return setTimeout(n,0);if((o===u||!o)&&setTimeout)return o=setTimeout,setTimeout(n,0);try{return o(n,0)}catch(t){try{return o.call(null,n,0)}catch(t){return o.call(this,n,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:u}catch(n){o=u}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(n){r=a}}();var s,f=[],l=!1,d=-1;function m(){l&&s&&(l=!1,s.length?f=s.concat(f):d=-1,f.length&&g())}function g(){if(!l){var n=c(m);l=!0;for(var t=f.length;t;){for(s=f,f=[];++d<t;)s&&s[d].run();d=-1,t=f.length}s=null,l=!1,function e(n){if(r===clearTimeout)return clearTimeout(n);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(n);try{return r(n)}catch(t){try{return r.call(null,n)}catch(t){return r.call(this,n)}}}(n)}}function p(n,t){this.fun=n,this.array=t}function h(){}i.nextTick=function(n){var t=new Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];f.push(new p(n,t)),1!==f.length||l||c(g)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(n){return[]},i.binding=function(n){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(n){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(n,l,t){(function(t){function o(){}function i(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],f(n,this)}function r(o,r){for(;3===o._state;)o=o._value;0!==o._state?(o._handled=!0,i._immediateFn(function(){var n=1===o._state?r.onFulfilled:r.onRejected;if(null!==n){var t;try{t=n(o._value)}catch(e){return void a(r.promise,e)}u(r.promise,t)}else(1===o._state?u:a)(r.promise,o._value)})):o._deferreds.push(r)}function u(n,t){try{if(t===n)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if(t instanceof i)return n._state=3,n._value=t,void c(n);if("function"==typeof e)return void f(function o(n,t){return function(){n.apply(t,arguments)}}(e,t),n)}n._state=1,n._value=t,c(n)}catch(r){a(n,r)}}function a(n,t){n._state=2,n._value=t,c(n)}function c(n){2===n._state&&0===n._deferreds.length&&i._immediateFn(function(){n._handled||i._unhandledRejectionFn(n._value)});for(var t=0,e=n._deferreds.length;t<e;t++)r(n,n._deferreds[t]);n._deferreds=null}function s(n,t,e){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.promise=e}function f(n,t){var e=!1;try{n(function(n){e||(e=!0,u(t,n))},function(n){e||(e=!0,a(t,n))})}catch(o){if(e)return;e=!0,a(t,o)}}var n,e;n=this,e=setTimeout,i.prototype["catch"]=function(n){return this.then(null,n)},i.prototype.then=function(n,t){var e=new this.constructor(o);return r(this,new s(n,t,e)),e},i.all=function(n){var c=Array.prototype.slice.call(n);return new i(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void e.call(n,function(n){a(t,n)},i)}c[t]=n,0==--u&&r(c)}catch(o){i(o)}}for(var n=0;n<c.length;n++)a(n,c[n])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(n){n(t)})},i.reject=function(e){return new i(function(n,t){t(e)})},i.race=function(r){return new i(function(n,t){for(var e=0,o=r.length;e<o;e++)r[e].then(n,t)})},i._immediateFn="function"==typeof t?function(n){t(n)}:function(n){e(n,0)},i._unhandledRejectionFn=function(n){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)},i._setImmediateFn=function(n){i._immediateFn=n},i._setUnhandledRejectionFn=function(n){i._unhandledRejectionFn=n},void 0!==l&&l.exports?l.exports=i:n.Promise||(n.Promise=i)}).call(this,n("timers").setImmediate)},{timers:3}],3:[function(c,n,s){(function(n,t){var o=c("process/browser.js").nextTick,e=Function.prototype.apply,r=Array.prototype.slice,i={},u=0;function a(n,t){this._id=n,this._clearFn=t}s.setTimeout=function(){return new a(e.call(setTimeout,window,arguments),clearTimeout)},s.setInterval=function(){return new a(e.call(setInterval,window,arguments),clearInterval)},s.clearTimeout=s.clearInterval=function(n){n.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},s.enroll=function(n,t){clearTimeout(n._idleTimeoutId),n._idleTimeout=t},s.unenroll=function(n){clearTimeout(n._idleTimeoutId),n._idleTimeout=-1},s._unrefActive=s.active=function(n){clearTimeout(n._idleTimeoutId);var t=n._idleTimeout;0<=t&&(n._idleTimeoutId=setTimeout(function(){n._onTimeout&&n._onTimeout()},t))},s.setImmediate="function"==typeof n?n:function(n){var t=u++,e=!(arguments.length<2)&&r.call(arguments,1);return i[t]=!0,o(function(){i[t]&&(e?n.apply(null,e):n.call(null),s.clearImmediate(t))}),t},s.clearImmediate="function"==typeof t?t:function(n){delete i[n]}}).call(this,c("timers").setImmediate,c("timers").clearImmediate)},{"process/browser.js":1,timers:3}],4:[function(n,t,e){var o=n("promise-polyfill"),r="undefined"!=typeof window?window:Function("return this;")();t.exports={boltExport:r.Promise||o}},{"promise-polyfill":2}]},{},[4])(4)});function Pb(n){M.setTimeout(function(){throw n},0)}var zb,Lb,jb=Hb.exports.boltExport,Ub=function(n){var e=on.none(),t=[],o=function(n){r()?u(n):t.push(n)},r=function(){return e.isSome()},i=function(n){bn(n,u)},u=function(t){e.each(function(n){M.setTimeout(function(){t(n)},0)})};return n(function(n){e=on.some(n),i(t),t=[]}),{get:o,map:function(e){return Ub(function(t){o(function(n){t(e(n))})})},isReady:r}},Wb={nu:Ub,pure:function(t){return Ub(function(n){n(t)})}},Gb=function(e){function n(n){e().then(n,Pb)}return{map:function(n){return Gb(function(){return e().then(n)})},bind:function(t){return Gb(function(){return e().then(function(n){return t(n).toPromise()})})},anonBind:function(n){return Gb(function(){return e().then(function(){return n.toPromise()})})},toLazy:function(){return Wb.nu(n)},toCached:function(){var n=null;return Gb(function(){return null===n&&(n=e()),n})},toPromise:e,get:n}},Xb=function(n){return Gb(function(){return new jb(n)})},Yb=function(n){return Gb(function(){return jb.resolve(n)})},qb=nn("sink"),Kb=nn(Uf({name:qb(),overrides:nn({dom:{tag:"div"},behaviours:Du([uf.config({useFixed:!0})]),events:Jo([rr(fo()),rr(oo()),rr(po())])})}));(Lb=zb=zb||{})[Lb.HighlightFirst=0]="HighlightFirst",Lb[Lb.HighlightNone=1]="HighlightNone";function Jb(n,t){var e=n.getHotspot(t).getOr(t),o=n.getAnchorOverrides();return n.layouts.fold(function(){return{anchor:"hotspot",hotspot:e,overrides:o}},function(n){return{anchor:"hotspot",hotspot:e,overrides:o,layouts:n}})}function $b(n,t,e,o,r,i,u){return function(n,t,o,e,r,i,u){var a=function(n,t,e){return(0,n.fetch)(e).map(t)}(n,t,e),c=Ix(e,n);return a.map(function(n){return n.bind(function(n){return on.from(pg.sketch(I(I({},i.menu()),{uid:Ir(""),data:n,highlightImmediately:u===zb.HighlightFirst,onOpenMenu:function(n,t){var e=c().getOrDie();uf.position(e,o,t),hf.decloak(r)},onOpenSubmenu:function(n,t,e){var o=c().getOrDie();uf.position(o,{anchor:"submenu",item:t},e),hf.decloak(r)},onEscape:function(){return Xm.focus(e),hf.close(r),on.some(!0)}})))})})}(n,t,Jb(n,e),e,o,r,u).map(function(n){return n.fold(function(){hf.isOpen(o)&&hf.close(o)},function(n){hf.cloak(o),hf.open(o,n),i(o)}),o})}function Qb(n,t,e,o,r,i,u){return hf.close(o),Yb(o)}function Zb(n,t,e,o,r,i){var u=Fb.getCoupled(e,"sandbox");return(hf.isOpen(u)?Qb:$b)(n,t,e,u,o,r,i)}function ny(n,t,e){var o=Ol.getCurrent(t).getOr(t),r=oa(n.element());e?ui(o.element(),"min-width",r+"px"):function(n,t){La.set(n,t)}(o.element(),r)}function ty(o,r,i){var u=Oi(),n=Ix(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id(),role:"listbox"}},behaviours:Sf(o.sandboxBehaviours,[jm.config({store:{mode:"memory",initialValue:r}}),hf.config({onOpen:function(n,t){var e=Jb(o,r);u.link(r.element()),o.matchWidth&&ny(e.hotspot,t,o.useMinWidth),o.onOpen(e,n,t),i!==undefined&&i.onOpen!==undefined&&i.onOpen(n,t)},onClose:function(n,t){u.unlink(r.element()),i!==undefined&&i.onClose!==undefined&&i.onClose(n,t)},isPartOf:function(n,t,e){return mu(t,e)||mu(r,e)},getAttachPoint:function(){return n().getOrDie()}}),Ol.config({find:function(n){return hf.getState(n).bind(function(n){return Ol.getCurrent(n)})}}),cs({isExtraPart:nn(!1)})])}}function ey(n,t,e){var o=jm.getValue(e);jm.setValue(t,o),Rx(t)}function oy(n,t){var e=n.element(),o=mi(e),r=e.dom();"number"!==Er(e,"type")&&t(r,o)}function ry(n,t,e){if(n.selectsOver){var o=jm.getValue(t),r=n.getDisplayText(o),i=jm.getValue(e);return 0===n.getDisplayText(i).indexOf(r)?on.some(function(){ey(0,t,e),function(n,e){oy(n,function(n,t){return n.setSelectionRange(e,t.length)})}(t,r.length)}):on.none()}return on.none()}function iy(n){return Du([Xm.config({onFocus:!1===n.selectOnFocus?Z:function(n){var t=n.element(),e=mi(t);t.dom().setSelectionRange(0,e.length)}})])}function uy(n){return{tag:n.tag,attributes:I({type:"text"},n.inputAttributes),styles:n.inputStyles,classes:n.inputClasses}}function ay(){return[wt("sandboxClasses",[]),wf("sandboxBehaviours",[Ol,Ku,hf,jm])]}function cy(n,t,e,o){var r=Lx(n,t,e,o);return _b.sketch(r)}function sy(n,t){return cy(n,t,[],[])}function fy(n,t){return _b.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:t.translate(n)}})}function ly(n){return"separator"===n.type}function dy(n,e){var t=C(n,function(n,t){return function(n){return cn(n)}(t)?""===t?n:"|"===t?0<n.length&&!ly(n[n.length-1])?n.concat([Ux]):n:On(e,t.toLowerCase())?n.concat([e[t.toLowerCase()]]):n:n.concat([t])},[]);return 0<t.length&&ly(t[t.length-1])&&t.pop(),t}function my(n,t){return function(n){return On(n,"getSubmenuItems")}(n)?function(n,t){var e=n.getSubmenuItems(),o=Wx(e,t);return{item:n,menus:Bn(o.menus,q(n.value,o.items)),expansions:Bn(o.expansions,q(n.value,n.value))}}(n,t):{item:n,menus:{},expansions:{}}}function gy(n,e,o){var t=Mr("primary-menu"),r=Wx(n,o.shared.providers.menuItems());if(0===r.items.length)return on.none();var i=Ev(t,r.items,e,o),u=N(r.menus,function(n,t){return Ev(t,n,e,o)}),a=Bn(u,q(t,i));return on.from(pg.tieredData(t,a,r.expansions))}function py(n){var t=Wo(n);return vn(Xx,t)}function hy(n,t){var e=t.getRoot(n).getOr(n.element());Zr(e,t.invalidClass),t.notify.each(function(t){py(n.element())&&Or(n.element(),"aria-invalid",!1),t.getContainer(n).each(function(n){kr(n,t.validHtml)}),t.onValid(n)})}function vy(t,n,e,o){var r=n.getRoot(t).getOr(t.element());$r(r,n.invalidClass),n.notify.each(function(n){py(t.element())&&Or(t.element(),"aria-invalid",!0),n.getContainer(t).each(function(n){kr(n,o)}),n.onInvalid(t,o)})}function by(t,n,e){return n.validator.fold(function(){return Yb(an.value(!0))},function(n){return n.validate(t)})}function yy(t,e,n){return e.notify.each(function(n){n.onValidate(t)}),by(t,e).map(function(n){return t.getSystem().isConnected()?n.fold(function(n){return vy(t,e,0,n),an.error(n)},function(n){return hy(t,e),an.value(n)}):an.error("No longer in system")})}function xy(e,t,o){function r(n,t){Gt(n,iw,{value:t})}var n=_b.parts().field({factory:Gx,inputClasses:["tox-textfield"],onSetValue:function(n){return Jx.run(n).get(function(){})},inputBehaviours:Du([Zx.config({}),Jx.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(n){return dr(n.element())},notify:{onValid:function(n){var t=jm.getValue(n);Gt(n,rw,{color:t})}},validator:{validateOnLoad:!1,validate:function(n){var t=jm.getValue(n);if(0===t.length)return Yb(an.value(!0));var e=Te.fromTag("span");ui(e,"background-color",t);var o=si(e,"background-color").fold(function(){return an.error("blah")},function(n){return an.value(t)});return Yb(o)}}})]),selectOnFocus:!1}),i=e.label.map(function(n){return fy(n,t.providers)}),u=Hd(function(e,o){return ew.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:Du([ow.config({}),Zx.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:o.getSink,fetch:function(t){return Xb(function(n){return e.fetch(n)}).map(function(n){return on.from(Bv(Bn(Jh(Mr("menu-value"),n,function(n){e.onItemAction(t,n)},e.columns,e.presets,rh.CLOSE_ON_EXECUTE,function(){return!1},o.providers),{movement:$h(e.columns,e.presets)})))})},parts:{menu:Xh(0,0,e.presets)}})}({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:on.some({onRtl:function(){return[ba]},onLtr:function(){return[ya]}}),components:[],fetch:lv.getFetch(o.getColors(),o.hasCustomColors()),columns:o.getColorCols(),presets:"color",onItemAction:function(n,e){u.getOpt(n).each(function(t){"custom"===e?o.colorPicker(function(n){n.fold(function(){return Wt(t,uw)},function(n){r(t,n),iv(n)})},"#ffffff"):r(t,"remove"===e?"":e)})}},t));return _b.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:i.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[n,u.asSpec()]}]),fieldBehaviours:Du([Td("form-field-events",[Zo(rw,function(n,t){u.getOpt(n).each(function(n){ui(n.element(),"background-color",t.event().color())}),Gt(n,bb,{name:e.name})}),Zo(iw,function(t,e){_b.getField(t).each(function(n){jm.setValue(n,e.event().value()),Ol.getCurrent(t).each(Xm.focus)})}),Zo(uw,function(t,n){_b.getField(t).each(function(n){Ol.getCurrent(t).each(Xm.focus)})})])])})}function wy(n,t,e){return{hue:nn(n),saturation:nn(t),value:nn(e)}}function Sy(n){return Uf({name:n+"-edge",overrides:function(o){return o.model.manager.edgeActions[n].fold(function(){return{}},function(e){var n=Jo([nr(no(),e,[o])]),t=Jo([nr(oo(),e,[o]),nr(ro(),function(n,t){t.mouseIsDown.get()&&e(n,t)},[o])]);return{events:fw?n:t}})}})}function ky(n){var t=n.event().raw();if(xw){var e=t;return e.touches!==undefined&&1===e.touches.length?on.some(e.touches[0]).map(function(n){return Qu(n.clientX,n.clientY)}):on.none()}var o=t;return o.clientX!==undefined?on.some(o).map(function(n){return Qu(n.clientX,n.clientY)}):on.none()}function Cy(n){return n.model.minX}function Oy(n){return n.model.minY}function Ty(n){return n.model.minX-1}function Ey(n){return n.model.minY-1}function By(n){return n.model.maxX}function _y(n){return n.model.maxY}function Dy(n){return n.model.maxX+1}function Ay(n){return n.model.maxY+1}function Fy(n,t,e){return t(n)-e(n)}function My(n){return Fy(n,By,Cy)}function Iy(n){return Fy(n,_y,Oy)}function Ry(n){return My(n)/2}function Vy(n){return Iy(n)/2}function Ny(n){return n.stepSize}function Hy(n){return n.snapToGrid}function Py(n){return n.snapStart}function zy(n){return n.rounded}function Ly(n,t){return n[t+"-edge"]!==undefined}function jy(n){return Ly(n,"left")}function Uy(n){return Ly(n,"right")}function Wy(n){return Ly(n,"top")}function Gy(n){return Ly(n,"bottom")}function Xy(n){return n.model.value.get()}function Yy(n){return{x:nn(n)}}function qy(n){return{y:nn(n)}}function Ky(n,t){return{x:nn(n),y:nn(t)}}function Jy(n,t){Gt(n,ww(),{value:t})}function $y(n,t,e,o){return n<t?n:e<n?e:n===t?t-1:Math.max(t,n-o)}function Qy(n,t,e,o){return e<n?n:n<t?t:n===e?e+1:Math.min(e,n+o)}function Zy(n,t,e){return Math.max(t,Math.min(e,n))}function nx(n){var t=n.min,e=n.max,o=n.range,r=n.value,i=n.step,u=n.snap,a=n.snapStart,c=n.rounded,s=n.hasMinEdge,f=n.hasMaxEdge,l=n.minBound,d=n.maxBound,m=n.screenRange,g=s?t-1:t,p=f?e+1:e;if(r<l)return g;if(d<r)return p;var h=function(n,t,e){return Math.min(e,Math.max(n,t))-t}(r,l,d),v=Zy(h/m*o+t,g,p);return u&&t<=v&&v<=e?function(u,e,a,c,n){return n.fold(function(){var n=u-e,t=Math.round(n/c)*c;return Zy(e+t,e-1,a+1)},function(n){var t=(u-n)%c,e=Math.round(t/c),o=Math.floor((u-n)/c),r=Math.floor((a-n)/c),i=n+Math.min(r,o+e)*c;return Math.max(n,i)})}(v,t,e,i,a):c?Math.round(v):v}function tx(n){var t=n.min,e=n.max,o=n.range,r=n.value,i=n.hasMinEdge,u=n.hasMaxEdge,a=n.maxBound,c=n.maxOffset,s=n.centerMinEdge,f=n.centerMaxEdge;return r<t?i?0:s:e<r?u?a:f:(r-t)/o*c}function ex(n){return n.element().dom().getBoundingClientRect()}function ox(n,t){return n[t]}function rx(n){var t=ex(n);return ox(t,Sw)}function ix(n){var t=ex(n);return ox(t,"right")}function ux(n){var t=ex(n);return ox(t,"top")}function ax(n){var t=ex(n);return ox(t,"bottom")}function cx(n){var t=ex(n);return ox(t,"width")}function sx(n){var t=ex(n);return ox(t,"height")}function fx(n,t,e){return(n+t)/2-e}function lx(n,t){var e=ex(n),o=ex(t),r=ox(e,Sw),i=ox(e,"right"),u=ox(o,Sw);return fx(r,i,u)}function dx(n,t){var e=ex(n),o=ex(t),r=ox(e,"top"),i=ox(e,"bottom"),u=ox(o,"top");return fx(r,i,u)}function mx(n,t){Gt(n,ww(),{value:t})}function gx(n){return{x:nn(n)}}function px(n,t,e){var o={min:Cy(t),max:By(t),range:My(t),value:e,step:Ny(t),snap:Hy(t),snapStart:Py(t),rounded:zy(t),hasMinEdge:jy(t),hasMaxEdge:Uy(t),minBound:rx(n),maxBound:ix(n),screenRange:cx(n)};return nx(o)}function hx(e){return function(n,t){return function(n,t,e){var o=(0<n?Qy:$y)(Xy(e).x(),Cy(e),By(e),Ny(e));return mx(t,gx(o)),on.some(o)}(e,n,t).map(function(){return!0})}}function vx(n,t,e,o,r,i){var u=function(t,n,e,o,r){var i=cx(t),u=o.bind(function(n){return on.some(lx(n,t))}).getOr(0),a=r.bind(function(n){return on.some(lx(n,t))}).getOr(i),c={min:Cy(n),max:By(n),range:My(n),value:e,hasMinEdge:jy(n),hasMaxEdge:Uy(n),minBound:rx(t),minOffset:0,maxBound:ix(t),maxOffset:i,centerMinEdge:u,centerMaxEdge:a};return tx(c)}(t,i,e,o,r);return rx(t)-rx(n)+u}function bx(n,t){Gt(n,ww(),{value:t})}function yx(n){return{y:nn(n)}}function xx(n,t,e){var o={min:Oy(t),max:_y(t),range:Iy(t),value:e,step:Ny(t),snap:Hy(t),snapStart:Py(t),rounded:zy(t),hasMinEdge:Wy(t),hasMaxEdge:Gy(t),minBound:ux(n),maxBound:ax(n),screenRange:sx(n)};return nx(o)}function wx(e){return function(n,t){return function(n,t,e){var o=(0<n?Qy:$y)(Xy(e).y(),Oy(e),_y(e),Ny(e));return bx(t,yx(o)),on.some(o)}(e,n,t).map(function(){return!0})}}function Sx(n,t,e,o,r,i){var u=function(t,n,e,o,r){var i=sx(t),u=o.bind(function(n){return on.some(dx(n,t))}).getOr(0),a=r.bind(function(n){return on.some(dx(n,t))}).getOr(i),c={min:Oy(n),max:_y(n),range:Iy(n),value:e,hasMinEdge:Wy(n),hasMaxEdge:Gy(n),minBound:ux(t),minOffset:0,maxBound:ax(t),maxOffset:i,centerMinEdge:u,centerMaxEdge:a};return tx(c)}(t,i,e,o,r);return ux(t)-ux(n)+u}function kx(n,t){Gt(n,ww(),{value:t})}function Cx(n,t){return{x:nn(n),y:nn(t)}}function Ox(e,o){return function(n,t){return function(n,t,e,o){var r=0<n?Qy:$y,i=t?Xy(o).x():r(Xy(o).x(),Cy(o),By(o),Ny(o)),u=t?r(Xy(o).y(),Oy(o),_y(o),Ny(o)):Xy(o).y();return kx(e,Cx(i,u)),on.some(i)}(e,o,n,t).map(function(){return!0})}}function Tx(n){return"<alloy.field."+n+">"}function Ex(n){return function(n){return iS[n]}(n)}function Bx(n,t,e){return jm.config(Bn({store:{mode:"manual",getValue:t,setValue:e}},n.map(function(n){return{store:{initialValue:n}}}).getOr({})))}function _x(n,t,e){return Bx(n,function(n){return t(n.element())},function(n,t){return e(n.element(),t)})}function Dx(e,t){function o(n,t){t.stop()}function r(n){return function(t,e){bn(n,function(n){n(t,e)})}}function i(n,t){if(!qp.isDisabled(n)){var e=t.event().raw();a(n,e.dataTransfer.files)}}function u(n,t){var e=t.event().raw().target.files;a(n,e)}var a=function(n,t){jm.setValue(n,function(n){var t=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i");return S(yn(n),function(n){return t.test(n.name)})}(t)),Gt(n,bb,{name:e.name})},c=Hd({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:Du([Td("input-file-events",[rr(To())])])}),n=e.label.map(function(n){return fy(n,t)}),s=_b.parts().field({factory:{sketch:function(n){return{uid:n.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Du([lS([]),eS(),qp.config({}),Qm.config({toggleClass:"dragenter",toggleOnExecute:!1}),Td("dropzone-events",[Zo("dragenter",r([o,Qm.toggle])),Zo("dragleave",r([o,Qm.toggle])),Zo("dragover",o),Zo("drop",r([o,i])),Zo(go(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:t.translate("Drop an image here")}},vg.sketch({dom:{tag:"button",innerHtml:t.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[c.asSpec()],action:function(n){c.get(n).element().dom().click()},buttonBehaviours:Du([Zx.config({})])})]}]}}}});return cy(n,s,["tox-form__group--stretched"],[])}function Ax(n){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:n},behaviours:Du([Xm.config({ignore:!0}),Zx.config({})])}}function Fx(n,t){Gt(n,fo(),{raw:{which:9,shiftKey:t}})}function Mx(n,t){var e=vS&&n.sandboxed,o=I(I({},n.label.map(function(n){return{title:n}}).getOr({})),e?{sandbox:"allow-scripts allow-same-origin"}:{}),r=function(o){var r=Ce("");return{getValue:function(n){return r.get()},setValue:function(n,t){if(o)Or(n.element(),"srcdoc",t);else{Or(n.element(),"src","javascript:''");var e=n.element().dom().contentWindow.document;e.open(),e.write(t),e.close()}r.set(t)}}}(e),i=n.label.map(function(n){return fy(n,t)}),u=_b.parts().field({factory:{sketch:function(n){return hS({uid:n.uid,dom:{tag:"iframe",attributes:o},behaviours:Du([Zx.config({}),Xm.config({}),sS(on.none(),r.getValue,r.setValue)])})}}});return cy(i,u,["tox-form__group--stretched"],[])}var Ix=function(t,n){return t.getSystem().getByUid(n.uid+"-"+qb()).map(function(n){return function(){return an.value(n)}}).getOrThunk(function(){return n.lazySink.fold(function(){return function(){return an.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(n){return function(){return n(t)}})})},Rx=function(n){oy(n,function(n,t){return n.setSelectionRange(t.length,t.length)})},Vx=nn([pt("data"),wt("inputAttributes",{}),wt("inputStyles",{}),wt("tag","input"),wt("inputClasses",[]),xu("onSetValue"),wt("styles",{}),wt("eventOrder",{}),ss("inputBehaviours",[jm,Xm]),wt("selectOnFocus",!0)]),Nx=nn("alloy.typeahead.itemexecute"),Hx=nn([pt("lazySink"),at("fetch"),wt("minChars",5),wt("responseTime",1e3),xu("onOpen"),wt("getHotspot",on.some),wt("getAnchorOverrides",nn({})),wt("layouts",on.none()),wt("eventOrder",{}),Bt("model",{},[wt("getDisplayText",function(n){return n.meta!==undefined&&n.meta.text!==undefined?n.meta.text:n.value}),wt("selectsOver",!0),wt("populateFromBrowse",!0)]),xu("onSetValue"),wu("onExecute"),xu("onItemExecute"),wt("inputClasses",[]),wt("inputAttributes",{}),wt("inputStyles",{}),wt("matchWidth",!0),wt("useMinWidth",!1),wt("dismissOnBlur",!0),bu(["openClass"]),pt("initialData"),ss("typeaheadBehaviours",[Xm,jm,Vb,Fm,Qm,Fb]),_t("previewing",function(){return Ce(!0)})].concat(Vx()).concat(ay())),Px=nn([jf({schema:[vu()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(t,e){o.previewing.get()?t.getSystem().getByUid(o.uid).each(function(n){ry(o.model,n,e).fold(function(){return Ml.dehighlight(t,e)},function(n){return n()})}):t.getSystem().getByUid(o.uid).each(function(n){o.model.populateFromBrowse&&ey(o.model,n,e)}),o.previewing.set(!1)},onExecute:function(n,t){return n.getSystem().getByUid(o.uid).toOption().map(function(n){return Gt(n,Nx(),{item:t}),!0})},onHover:function(n,t){o.previewing.set(!1),n.getSystem().getByUid(o.uid).each(function(n){o.model.populateFromBrowse&&ey(o.model,n,t)})}}}})]),zx=$f({name:"Typeahead",configFields:Hx(),partFields:Px(),factory:function(r,n,t,i){function e(n,t,e){r.previewing.set(!1);var o=Fb.getCoupled(n,"sandbox");if(hf.isOpen(o))Ol.getCurrent(o).each(function(n){Ml.getHighlighted(n).fold(function(){e(n)},function(){qt(o,n.element(),"keydown",t)})});else{$b(r,u(n),n,o,i,function(n){Ol.getCurrent(n).each(e)},zb.HighlightFirst).get(Z)}}var o=iy(r),u=function(o){return function(n){return n.map(function(n){var t=H(n.menus),e=E(t,function(n){return S(n.items,function(n){return"item"===n.type})});return jm.getState(o).update(w(e,function(n){return n.data})),n})}},a=[Xm.config({}),jm.config({onSetValue:r.onSetValue,store:I({mode:"dataset",getDataKey:function(n){return mi(n.element())},getFallbackEntry:function(n){return{value:n,meta:{}}},setValue:function(n,t){gi(n.element(),r.model.getDisplayText(t))}},r.initialData.map(function(n){return q("initialValue",n)}).getOr({}))}),Vb.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(n,t){var e=Fb.getCoupled(n,"sandbox");if(Xm.isFocused(n)&&mi(n.element()).length>=r.minChars){var o=Ol.getCurrent(e).bind(function(n){return Ml.getHighlighted(n).map(jm.getValue)});r.previewing.set(!0);$b(r,u(n),n,e,i,function(n){Ol.getCurrent(e).each(function(n){o.fold(function(){r.model.selectsOver&&Ml.highlightFirst(n)},function(t){Ml.highlightBy(n,function(n){return jm.getValue(n).value===t.value}),Ml.getHighlighted(n).orThunk(function(){return Ml.highlightFirst(n),on.none()})})})},zb.HighlightFirst).get(Z)}},cancelEvent:_o()}),Fm.config({mode:"special",onDown:function(n,t){return e(n,t,Ml.highlightFirst),on.some(!0)},onEscape:function(n){var t=Fb.getCoupled(n,"sandbox");return hf.isOpen(t)?(hf.close(t),on.some(!0)):on.none()},onUp:function(n,t){return e(n,t,Ml.highlightLast),on.some(!0)},onEnter:function(t){var n=Fb.getCoupled(t,"sandbox"),e=hf.isOpen(n);if(e&&!r.previewing.get())return Ol.getCurrent(n).bind(function(n){return Ml.getHighlighted(n)}).map(function(n){return Gt(t,Nx(),{item:n}),!0});var o=jm.getValue(t);return Wt(t,_o()),r.onExecute(n,t,o),e&&hf.close(n),on.some(!0)}}),Qm.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),Fb.config({others:{sandbox:function(n){return ty(r,n,{onOpen:function(){return Qm.on(n)},onClose:function(){return Qm.off(n)}})}}}),Td("typeaheadevents",[ji(function(n){var t=Z;Zb(r,u(n),n,i,t,zb.HighlightFirst).get(Z)}),Zo(Nx(),function(n,t){var e=Fb.getCoupled(n,"sandbox");ey(r.model,n,t.event().item()),Wt(n,_o()),r.onItemExecute(n,e,t.event().item(),jm.getValue(n)),hf.close(e),Rx(n)})].concat(r.dismissOnBlur?[Zo(xo(),function(n){var t=Fb.getCoupled(n,"sandbox");pl(t.element()).isNone()&&hf.close(t)})]:[]))];return{uid:r.uid,dom:uy(Bn(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:I(I({},o),ls(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),Lx=function(n,t,e,o){return{dom:jx(e),components:n.toArray().concat([t]),fieldBehaviours:Du(o)}},jx=function(n){return{tag:"div",classes:["tox-form__group"].concat(n)}},Ux={type:"separator"},Wx=function(n,r){var t=dy(cn(n)?n.split(" "):n,r);return k(t,function(n,t){var e=function(n){if(ly(n))return n;var t=Vn(n,"value").getOrThunk(function(){return Mr("generated-menu-item")});return Bn({value:t},n)}(t),o=my(e,r);return{menus:Bn(n.menus,o.menus),items:[o.item].concat(n.items),expansions:Bn(n.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},Gx=Jf({name:"Input",configFields:Vx(),factory:function(n,t){return{uid:n.uid,dom:uy(n),components:[],behaviours:function(n){return I(I({},iy(n)),ls(n.inputBehaviours,[jm.config({store:{mode:"manual",initialValue:n.data.getOr(undefined),getValue:function(n){return mi(n.element())},setValue:function(n,t){mi(n.element())!==t&&gi(n.element(),t)}},onSetValue:n.onSetValue})]))}(n),eventOrder:n.eventOrder}}}),Xx=["input","textarea"],Yx=/* */Object.freeze({markValid:hy,markInvalid:vy,query:by,run:yy,isInvalid:function(n,t){var e=t.getRoot(n).getOr(n.element());return ni(e,t.invalidClass)}}),qx=/* */Object.freeze({events:function(t,n){return t.validator.map(function(n){return Jo([Zo(n.onEvent,function(n){yy(n,t).get(f)})].concat(n.validateOnLoad?[Pi(function(n){yy(n,t).get(Z)})]:[]))}).getOr({})}}),Kx=[at("invalidClass"),wt("getRoot",on.none),xt("notify",[wt("aria","alert"),wt("getContainer",on.none),wt("validHtml",""),xu("onValid"),xu("onInvalid"),xu("onValidate")]),xt("validator",[at("validate"),wt("onEvent","input"),wt("validateOnLoad",!0)])],Jx=Au({fields:Kx,name:"invalidating",active:qx,apis:Yx,extra:{validation:function(e){return function(n){var t=jm.getValue(n);return Yb(e(t))}}}}),$x=/* */Object.freeze({exhibit:function(n,t){return zr({attributes:K([{key:t.tabAttr,value:"true"}])})}}),Qx=[wt("tabAttr","data-alloy-tabstop")],Zx=Au({fields:Qx,name:"tabstopping",active:$x}),nw=nn([at("dom"),at("fetch"),xu("onOpen"),wu("onExecute"),wt("getHotspot",on.some),wt("getAnchorOverrides",nn({})),wt("layouts",on.none()),ss("dropdownBehaviours",[Qm,Fb,Fm,Xm]),at("toggleClass"),wt("eventOrder",{}),pt("lazySink"),wt("matchWidth",!1),wt("useMinWidth",!1),pt("role")].concat(ay())),tw=nn([jf({schema:[vu()],name:"menu",defaults:function(n){return{onExecute:n.onExecute}}}),Kb()]),ew=$f({name:"Dropdown",configFields:nw(),partFields:tw(),factory:function(t,n,e,o){function r(n){hf.getState(n).each(function(n){pg.highlightPrimary(n)})}function i(n,t){return Xt(n),on.some(!0)}var u,a,c={expand:function(n){Qm.isOn(n)||Zb(t,function(n){return n},n,o,Z,zb.HighlightNone).get(Z)},open:function(n){Qm.isOn(n)||Zb(t,function(n){return n},n,o,Z,zb.HighlightFirst).get(Z)},isOpen:Qm.isOn,close:function(n){Qm.isOn(n)&&Zb(t,function(n){return n},n,o,Z,zb.HighlightFirst).get(Z)}};return{uid:t.uid,dom:t.dom,components:n,behaviours:ls(t.dropdownBehaviours,[Qm.config({toggleClass:t.toggleClass,aria:{mode:"expanded"}}),Fb.config({others:{sandbox:function(n){return ty(t,n,{onOpen:function(){Qm.on(n)},onClose:function(){Qm.off(n)}})}}}),Fm.config({mode:"special",onSpace:i,onEnter:i,onDown:function(n,t){if(ew.isOpen(n)){var e=Fb.getCoupled(n,"sandbox");r(e)}else ew.open(n);return on.some(!0)},onEscape:function(n,t){return ew.isOpen(n)?(ew.close(n),on.some(!0)):on.none()}}),Xm.config({})]),events:Nd(on.some(function(n){Zb(t,function(n){return n},n,o,r,zb.HighlightFirst).get(Z)})),eventOrder:I(I({},t.eventOrder),(u={},u[ko()]=["disabling","toggling","alloy.base.behaviour"],u)),apis:c,domModification:{attributes:I(I({"aria-haspopup":"true"},t.role.fold(function(){return{}},function(n){return{role:n}})),"button"===t.dom.tag?{type:(a="type",Vn(t.dom,"attributes").bind(function(n){return Vn(n,a)})).getOr("button")}:{})}}},apis:{open:function(n,t){return n.open(t)},expand:function(n,t){return n.expand(t)},close:function(n,t){return n.close(t)},isOpen:function(n,t){return n.isOpen(t)}}}),ow=Au({fields:[],name:"unselecting",active:/* */Object.freeze({events:function(n){return Jo([$o(vo(),nn(!0))])},exhibit:function(n,t){return zr({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),rw=Mr("color-input-change"),iw=Mr("color-swatch-change"),uw=Mr("color-picker-cancel"),aw=nn(Mr("rgb-hex-update")),cw=nn(Mr("slider-update")),sw=nn(Mr("palette-update")),fw=Ye.detect().deviceType.isTouch(),lw=Uf({schema:[at("dom")],name:"label"}),dw=Sy("top-left"),mw=Sy("top"),gw=Sy("top-right"),pw=Sy("right"),hw=Sy("bottom-right"),vw=Sy("bottom"),bw=Sy("bottom-left"),yw=[lw,Sy("left"),pw,mw,vw,dw,gw,bw,hw,Lf({name:"thumb",defaults:nn({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:Jo([er(no(),n,"spectrum"),er(to(),n,"spectrum"),er(eo(),n,"spectrum"),er(oo(),n,"spectrum"),er(ro(),n,"spectrum"),er(uo(),n,"spectrum")])}}}),Lf({schema:[_t("mouseIsDown",function(){return Ce(!1)})],name:"spectrum",overrides:function(e){function o(t,n){return r.getValueFromEvent(n).map(function(n){return r.setValueFrom(t,e,n)})}var r=e.model.manager,n=Jo([Zo(no(),o),Zo(to(),o)]),t=Jo([Zo(oo(),o),Zo(ro(),function(n,t){e.mouseIsDown.get()&&o(n,t)})]);return{behaviours:Du(fw?[]:[Fm.config({mode:"special",onLeft:function(n){return r.onLeft(n,e)},onRight:function(n){return r.onRight(n,e)},onUp:function(n){return r.onUp(n,e)},onDown:function(n){return r.onDown(n,e)}}),Xm.config({})]),events:fw?n:t}}})],xw=Ye.detect().deviceType.isTouch(),ww=nn("slider.change.value"),Sw="left",kw=hx(-1),Cw=hx(1),Ow=on.none,Tw=on.none,Ew={"top-left":on.none(),top:on.none(),"top-right":on.none(),right:on.some(function(n,t){Jy(n,Yy(Dy(t)))}),"bottom-right":on.none(),bottom:on.none(),"bottom-left":on.none(),left:on.some(function(n,t){Jy(n,Yy(Ty(t)))})},Bw=/* */Object.freeze({setValueFrom:function(n,t,e){var o=px(n,t,e),r=gx(o);return mx(n,r),o},setToMin:function(n,t){var e=Cy(t);mx(n,gx(e))},setToMax:function(n,t){var e=By(t);mx(n,gx(e))},findValueOfOffset:px,getValueFromEvent:function(n){return ky(n).map(function(n){return n.left()})},findPositionOfValue:vx,setPositionFromValue:function(n,t,e,o){var r=Xy(e),i=vx(n,o.getSpectrum(n),r.x(),o.getLeftEdge(n),o.getRightEdge(n),e),u=oa(t.element())/2;ui(t.element(),"left",i-u+"px")},onLeft:kw,onRight:Cw,onUp:Ow,onDown:Tw,edgeActions:Ew}),_w=on.none,Dw=on.none,Aw=wx(-1),Fw=wx(1),Mw={"top-left":on.none(),top:on.some(function(n,t){Jy(n,qy(Ey(t)))}),"top-right":on.none(),right:on.none(),"bottom-right":on.none(),bottom:on.some(function(n,t){Jy(n,qy(Ay(t)))}),"bottom-left":on.none(),left:on.none()},Iw=/* */Object.freeze({setValueFrom:function(n,t,e){var o=xx(n,t,e),r=yx(o);return bx(n,r),o},setToMin:function(n,t){var e=Oy(t);bx(n,yx(e))},setToMax:function(n,t){var e=_y(t);bx(n,yx(e))},findValueOfOffset:xx,getValueFromEvent:function(n){return ky(n).map(function(n){return n.top()})},findPositionOfValue:Sx,setPositionFromValue:function(n,t,e,o){var r=Xy(e),i=Sx(n,o.getSpectrum(n),r.y(),o.getTopEdge(n),o.getBottomEdge(n),e),u=ta(t.element())/2;ui(t.element(),"top",i-u+"px")},onLeft:_w,onRight:Dw,onUp:Aw,onDown:Fw,edgeActions:Mw}),Rw=Ox(-1,!1),Vw=Ox(1,!1),Nw=Ox(-1,!0),Hw=Ox(1,!0),Pw={"top-left":on.some(function(n,t){Jy(n,Ky(Ty(t),Ey(t)))}),top:on.some(function(n,t){Jy(n,Ky(Ry(t),Ey(t)))}),"top-right":on.some(function(n,t){Jy(n,Ky(Dy(t),Ey(t)))}),right:on.some(function(n,t){Jy(n,Ky(Dy(t),Vy(t)))}),"bottom-right":on.some(function(n,t){Jy(n,Ky(Dy(t),Ay(t)))}),bottom:on.some(function(n,t){Jy(n,Ky(Ry(t),Ay(t)))}),"bottom-left":on.some(function(n,t){Jy(n,Ky(Ty(t),Ay(t)))}),left:on.some(function(n,t){Jy(n,Ky(Ty(t),Vy(t)))})},zw=/* */Object.freeze({setValueFrom:function(n,t,e){var o=px(n,t,e.left()),r=xx(n,t,e.top()),i=Cx(o,r);return kx(n,i),i},setToMin:function(n,t){var e=Cy(t),o=Oy(t);kx(n,Cx(e,o))},setToMax:function(n,t){var e=By(t),o=_y(t);kx(n,Cx(e,o))},getValueFromEvent:function(n){return ky(n)},setPositionFromValue:function(n,t,e,o){var r=Xy(e),i=vx(n,o.getSpectrum(n),r.x(),o.getLeftEdge(n),o.getRightEdge(n),e),u=Sx(n,o.getSpectrum(n),r.y(),o.getTopEdge(n),o.getBottomEdge(n),e),a=oa(t.element())/2,c=ta(t.element())/2;ui(t.element(),"left",i-a+"px"),ui(t.element(),"top",u-c+"px")},onLeft:Rw,onRight:Vw,onUp:Nw,onDown:Hw,edgeActions:Pw}),Lw=Ye.detect().deviceType.isTouch(),jw=[wt("stepSize",1),wt("onChange",Z),wt("onChoose",Z),wt("onInit",Z),wt("onDragStart",Z),wt("onDragEnd",Z),wt("snapToGrid",!1),wt("rounded",!0),pt("snapStart"),ct("model",rt("mode",{x:[wt("minX",0),wt("maxX",100),_t("value",function(n){return Ce(n.mode.minX)}),at("getInitialValue"),Cu("manager",Bw)],y:[wt("minY",0),wt("maxY",100),_t("value",function(n){return Ce(n.mode.minY)}),at("getInitialValue"),Cu("manager",Iw)],xy:[wt("minX",0),wt("maxX",100),wt("minY",0),wt("maxY",100),_t("value",function(n){return Ce({x:nn(n.mode.minX),y:nn(n.mode.minY)})}),at("getInitialValue"),Cu("manager",zw)]})),ss("sliderBehaviours",[Fm,jm])].concat(Lw?[]:[_t("mouseIsDown",function(){return Ce(!1)})]),Uw=Ye.detect().deviceType.isTouch(),Ww=$f({name:"Slider",configFields:jw,partFields:yw,factory:function(i,n,t,e){function u(n){return Os(n,i,"thumb")}function a(n){return Os(n,i,"spectrum")}function o(n){return Cs(n,i,"left-edge")}function r(n){return Cs(n,i,"right-edge")}function c(n){return Cs(n,i,"top-edge")}function s(n){return Cs(n,i,"bottom-edge")}function f(n,t){m.setPositionFromValue(n,t,i,{getLeftEdge:o,getRightEdge:r,getTopEdge:c,getBottomEdge:s,getSpectrum:a})}function l(n,t){d.value.set(t);var e=u(n);return f(n,e),i.onChange(n,e,t),on.some(!0)}var d=i.model,m=d.manager,g=[Zo(no(),function(n,t){i.onDragStart(n,u(n))}),Zo(eo(),function(n,t){i.onDragEnd(n,u(n))})],p=[Zo(oo(),function(n,t){t.stop(),i.onDragStart(n,u(n)),i.mouseIsDown.set(!0)}),Zo(uo(),function(n,t){i.onDragEnd(n,u(n))})],h=Uw?g:p;return{uid:i.uid,dom:i.dom,components:n,behaviours:ls(i.sliderBehaviours,R([Uw?[]:[Fm.config({mode:"special",focusIn:function(n){return Cs(n,i,"spectrum").map(Fm.focusIn).map(nn(!0))}})],[jm.config({store:{mode:"manual",getValue:function(n){return d.value.get()}}}),Ku.config({channels:{"mouse.released":{onReceive:function(e,n){var t=i.mouseIsDown.get();i.mouseIsDown.set(!1),t&&Cs(e,i,"thumb").each(function(n){var t=d.value.get();i.onChoose(e,n,t)})}}}})]])),events:Jo([Zo(ww(),function(n,t){l(n,t.event().value())}),Pi(function(n,t){var e=d.getInitialValue();d.value.set(e);var o=u(n);f(n,o);var r=a(n);i.onInit(n,o,r,d.value.get())})].concat(h)),apis:{resetToMin:function(n){m.setToMin(n,i)},resetToMax:function(n){m.setToMax(n,i)},changeValue:l,refresh:f},domModification:{styles:{position:"relative"}}}},apis:{resetToMin:function(n,t){n.resetToMin(t)},resetToMax:function(n,t){n.resetToMax(t)},refresh:function(n,t){n.refresh(t)}}}),Gw=function(n,t){var e=Ww.parts().spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Ww.parts().thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return Ww.sketch({dom:{tag:"div",classes:[t("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:nn({y:nn(0)})},components:[e,o],sliderBehaviours:Du([Xm.config({})]),onChange:function(n,t,e){Gt(n,cw(),{value:e})}})},Xw=[ss("formBehaviours",[jm])],Yw=function(o,n,t){return{uid:o.uid,dom:o.dom,components:n,behaviours:ls(o.formBehaviours,[jm.config({store:{mode:"manual",getValue:function(n){var t=Es(n,o);return N(t,function(n,t){return n().bind(function(n){return function(n,t){return n.fold(function(){return an.error(t)},an.value)}(Ol.getCurrent(n),"missing current")}).map(jm.getValue)})},setValue:function(e,n){Sn(n,function(t,n){Cs(e,o,n).each(function(n){Ol.getCurrent(n).each(function(n){jm.setValue(n,t)})})})}}})]),apis:{getField:function(n,t){return Cs(n,o,t).bind(Ol.getCurrent)}}}},qw={getField:Hr(function(n,t,e){return n.getField(t,e)}),sketch:function(n){var e,t=(e=[],{field:function(n,t){return e.push(n),ys("form",Tx(n),t)},record:function(){return e}}),o=n(t),r=t.record(),i=w(r,function(n){return Lf({name:n,pname:Tx(n)})});return Ms("form",Xw,i,Yw,o)}},Kw=Mr("valid-input"),Jw=Mr("invalid-input"),$w=Mr("validating-input"),Qw="colorcustom.rgb.",Zw=function(d,m,g,p){function h(n,t,e,o,r){var i=d(Qw+"range"),u=[_b.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),_b.parts().field({data:r,factory:Gx,inputAttributes:I({type:"text"},"hex"===t?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:Du([function(t,o){return Jx.config({invalidClass:m("invalid"),notify:{onValidate:function(n){Gt(n,$w,{type:t})},onValid:function(n){Gt(n,Kw,{type:t,value:jm.getValue(n)})},onInvalid:function(n){Gt(n,Jw,{type:t,value:jm.getValue(n)})}},validator:{validate:function(n){var t=jm.getValue(n),e=o(t)?an.value(!0):an.error(d("aria.input.invalid"));return Yb(e)},validateOnLoad:!1}})}(t,n),Zx.config({})]),onSetValue:function(n){Jx.isInvalid(n)&&Jx.run(n).get(Z)}})],a="hex"!==t?[_b.parts()["aria-descriptor"]({text:i})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:u.concat(a)}}function v(n,t){var e=t.red(),o=t.green(),r=t.blue();jm.setValue(n,{red:e,green:o,blue:r})}function b(n,t){y.getOpt(n).each(function(n){ui(n.element(),"background-color","#"+t.value())})}var y=Hd({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}});return Jf({factory:function(){function r(n){return u[n]().get()}function i(n,t){u[n]().set(t)}function t(n,t){var e=t.event();"hex"!==e.type()?i(e.type(),on.none()):p(n)}function o(e,n,t){var o=parseInt(t,10);i(n,on.some(o)),r("red").bind(function(e){return r("green").bind(function(t){return r("blue").map(function(n){return ph(e,t,n,1)})})}).each(function(n){var t=function(t,n){var e=gh(n);return qw.getField(t,"hex").each(function(n){Xm.isFocused(n)||jm.setValue(t,{hex:e.value()})}),e}(e,n);b(e,t)})}function e(n,t){var e=t.event();!function(n){return"hex"===n.type()}(e)?o(n,e.type(),e.value()):function(n,t){g(n);var e=fh(t);i("hex",on.some(t));var o=bh(e);v(n,o),a(o),Gt(n,aw(),{hex:e}),b(n,e)}(n,e.value())}function n(n){return{label:d(Qw+n+".label"),description:d(Qw+n+".description")}}var u={red:nn(Ce(on.some(255))),green:nn(Ce(on.some(255))),blue:nn(Ce(on.some(255))),hex:nn(Ce(on.some("ffffff")))},a=function(n){var t=n.red(),e=n.green(),o=n.blue();i("red",on.some(t)),i("green",on.some(e)),i("blue",on.some(o))},c=n("red"),s=n("green"),f=n("blue"),l=n("hex");return Bn(qw.sketch(function(n){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[n.field("red",_b.sketch(h(hh,"red",c.label,c.description,255))),n.field("green",_b.sketch(h(hh,"green",s.label,s.description,255))),n.field("blue",_b.sketch(h(hh,"blue",f.label,f.description,255))),n.field("hex",_b.sketch(h(lh,"hex",l.label,l.description,"ffffff"))),y.asSpec()],formBehaviours:Du([Jx.config({invalidClass:m("form-invalid")}),Td("rgb-form-events",[Zo(Kw,e),Zo(Jw,t),Zo($w,t)])])}}),{apis:{updateHex:function(n,t){jm.setValue(n,{hex:t.value()}),function(n,t){var e=bh(t);v(n,e),a(e)}(n,t),b(n,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(n,t,e){n.updateHex(t,e)}},extraApis:{}})},nS=function(n,o){function r(n,t){var e=n.width,o=n.height,r=n.getContext("2d");if(null!==r){r.fillStyle=t,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)}}var i=Ww.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),u=Ww.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette-thumb")],innerHtml:"<div class="+o("sv-palette-inner-thumb")+' role="presentation"></div>'}});return Jf({factory:function(n){var t=nn({x:nn(0),y:nn(0)}),e=Du([Ol.config({find:on.some}),Xm.config({})]);return Ww.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette")]},model:{mode:"xy",getInitialValue:t},rounded:!1,components:[i,u],onChange:function(n,t,e){Gt(n,sw(),{value:e})},onInit:function(n,t,e,o){r(e.element().dom(),xh(Bh()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(n,t,e){!function(n,t){var e=n.components()[0].element().dom();r(e,xh(t))}(t,e)}},extraApis:{}})},tS=function(l,d){return Jf({name:"ColourPicker",configFields:[at("dom"),wt("onValidHex",Z),wt("onInvalidHex",Z)],factory:function(n){function t(n,e){u.getOpt(n).each(function(n){var t=bh(e);s.paletteRgba().set(t),i.setRgba(n,t)})}function e(n,t){f.getOpt(n).each(function(n){r.updateHex(n,t)})}function a(t,e,n){bn(n,function(n){n(t,e)})}var o,c,r=Zw(l,d,n.onValidHex,n.onInvalidHex),i=nS(l,d),s={paletteRgba:nn(Ce(Bh()))},u=Hd(i.sketch({})),f=Hd(r.sketch({}));return{uid:n.uid,dom:n.dom,components:[u.asSpec(),Gw(l,d),f.asSpec()],behaviours:Du([Td("colour-picker-events",[Zo(sw(),(c=[e],function(n,t){var e=t.event().value(),o=function(n){var t,e=0,o=0,r=n.red()/255,i=n.green()/255,u=n.blue()/255,a=Math.min(r,Math.min(i,u)),c=Math.max(r,Math.max(i,u));return a===c?wy(0,0,100*(o=a)):(e=60*((e=r===a?3:u===a?1:5)-(r===a?i-u:u===a?r-i:u-r)/(c-a)),t=(c-a)/c,o=c,wy(Math.round(e),Math.round(100*t),Math.round(100*o)))}(s.paletteRgba().get()),r=wy(o.hue(),e.x(),100-e.y()),i=vh(r),u=gh(i);a(n,u,c)})),Zo(cw(),(o=[t,e],function(n,t){var e=function(n){var t=wy((100-n)/100*360,100,100),e=vh(t);return gh(e)}(t.event().value().y());a(n,e,o)}))]),Ol.config({find:function(n){return f.getOpt(n)}}),Fm.config({mode:"acyclic"})])}}})},eS=function(){return Ol.config({find:on.some})},oS=function(n){return Ol.config({find:n.getOpt})},rS=function(n){return Ol.config({find:function(t){return pr(t.element(),n).bind(function(n){return t.getSystem().getByDom(n).toOption()})}})},iS={"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"},uS=tinymce.util.Tools.resolve("tinymce.Resource"),aS=se([wt("preprocess",f),wt("postprocess",f)]),cS=function(r,n){var i=et("RepresentingConfigs.memento processors",aS,n);return jm.config({store:{mode:"manual",getValue:function(n){var t=r.get(n),e=jm.getValue(t);return i.postprocess(e)},setValue:function(n,t){var e=i.preprocess(t),o=r.get(n);jm.setValue(o,e)}}})},sS=Bx,fS=function(n){return _x(n,Sr,kr)},lS=function(n){return jm.config({store:{mode:"memory",initialValue:n}})},dS=Mr("alloy-fake-before-tabstop"),mS=Mr("alloy-fake-after-tabstop"),gS=function(n){return Mv(n,["."+dS,"."+mS].join(","),nn(!1))},pS=function(n,t){var e=t.element();ni(e,dS)?Fx(n,!0):ni(e,mS)&&Fx(n,!1)},hS=function(n){return{dom:{tag:"div",classes:["tox-navobj"]},components:[Ax([dS]),n,Ax([mS])],behaviours:Du([rS(1)])}},vS=!(Ye.detect().browser.isIE()||Ye.detect().browser.isEdge());function bS(n,t){return wS(M.document.createElement("canvas"),n,t)}function yS(n){var t=bS(n.width,n.height);return xS(t).drawImage(n,0,0),t}function xS(n){return n.getContext("2d")}function wS(n,t,e){return n.width=t,n.height=e,n}function SS(n){return n.naturalWidth||n.width}function kS(n){return n.naturalHeight||n.height}var CS,OS,TS=window.Promise?window.Promise:(CS=ES.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(n){M.setTimeout(n,1)},OS=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)},ES.prototype["catch"]=function(n){return this.then(null,n)},ES.prototype.then=function(e,o){var r=this;return new ES(function(n,t){_S.call(r,new MS(e,o,n,t))})},ES.all=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var c=Array.prototype.slice.call(1===n.length&&OS(n[0])?n[0]:n);return new ES(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void e.call(n,function(n){a(t,n)},i)}c[t]=n,0==--u&&r(c)}catch(o){i(o)}}for(var n=0;n<c.length;n++)a(n,c[n])})},ES.resolve=function(t){return t&&"object"==typeof t&&t.constructor===ES?t:new ES(function(n){n(t)})},ES.reject=function(e){return new ES(function(n,t){t(e)})},ES.race=function(r){return new ES(function(n,t){for(var e=0,o=r;e<o.length;e++)o[e].then(n,t)})},ES);function ES(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],IS(n,BS(DS,this),BS(AS,this))}function BS(n,t){return function(){return n.apply(t,arguments)}}function _S(o){var r=this;null!==this._state?CS(function(){var n=r._state?o.onFulfilled:o.onRejected;if(null!==n){var t;try{t=n(r._value)}catch(e){return void o.reject(e)}o.resolve(t)}else(r._state?o.resolve:o.reject)(r._value)}):this._deferreds.push(o)}function DS(n){try{if(n===this)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if("function"==typeof t)return void IS(BS(t,n),BS(DS,this),BS(AS,this))}this._state=!0,this._value=n,FS.call(this)}catch(e){AS.call(this,e)}}function AS(n){this._state=!1,this._value=n,FS.call(this)}function FS(){for(var n=0,t=this._deferreds;n<t.length;n++){var e=t[n];_S.call(this,e)}this._deferreds=[]}function MS(n,t,e,o){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=o}function IS(n,t,e){var o=!1;try{n(function(n){o||(o=!0,t(n))},function(n){o||(o=!0,e(n))})}catch(r){if(o)return;o=!0,e(r)}}function RS(e){return new TS(function(n,t){(function p(n){var t=n.split(","),e=/data:([^;]+)/.exec(t[0]);if(!e)return on.none();for(var o=e[1],r=t[1],i=M.atob(r),u=i.length,a=Math.ceil(u/1024),c=new Array(a),s=0;s<a;++s){for(var f=1024*s,l=Math.min(1024+f,u),d=new Array(l-f),m=f,g=0;m<l;++g,++m)d[g]=i[m].charCodeAt(0);c[s]=new Uint8Array(d)}return on.some(new M.Blob(c,{type:o}))})(e).fold(function(){t("uri is not base64: "+e)},n)})}function VS(n,o,r){return o=o||"image/png",M.HTMLCanvasElement.prototype.toBlob?new TS(function(t,e){n.toBlob(function(n){n?t(n):e()},o,r)}):RS(n.toDataURL(o,r))}function NS(n){return function t(a){return new TS(function(n,t){var e=M.URL.createObjectURL(a),o=new M.Image,r=function(){o.removeEventListener("load",i),o.removeEventListener("error",u)};function i(){r(),n(o)}function u(){r(),t("Unable to load data of type "+a.type+": "+e)}o.addEventListener("load",i),o.addEventListener("error",u),o.src=e,o.complete&&i()})}(n).then(function(n){!function e(n){M.URL.revokeObjectURL(n.src)}(n);var t=bS(SS(n),kS(n));return xS(t).drawImage(n,0,0),t})}function HS(n,t,e){var o=t.type;function r(t,e){return n.then(function(n){return function o(n,t,e){return t=t||"image/png",n.toDataURL(t,e)}(n,t,e)})}return{getType:nn(o),toBlob:function i(){return TS.resolve(t)},toDataURL:function u(){return e},toBase64:function a(){return e.split(",")[1]},toAdjustedBlob:function c(t,e){return n.then(function(n){return VS(n,t,e)})},toAdjustedDataURL:r,toAdjustedBase64:function s(n,t){return r(n,t).then(function(n){return n.split(",")[1]})},toCanvas:function f(){return n.then(yS)}}}function PS(t){return function n(e){return new TS(function(n){var t=new M.FileReader;t.onloadend=function(){n(t.result)},t.readAsDataURL(e)})}(t).then(function(n){return HS(NS(t),t,n)})}function zS(t,n){return VS(t,n).then(function(n){return HS(TS.resolve(t),n,t.toDataURL())})}function LS(n,t,e){var o="string"==typeof n?parseFloat(n):n;return e<o?o=e:o<t&&(o=t),o}var jS=[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 US(n,t){for(var e,o=[],r=new Array(25),i=0;i<5;i++){for(var u=0;u<5;u++)o[u]=t[u+5*i];for(u=0;u<5;u++){for(var a=e=0;a<5;a++)e+=n[u+5*a]*o[a];r[u+5*i]=e}}return r}function WS(t,e){return t.toCanvas().then(function(n){return function i(n,t,e){var o=xS(n);var r=function B(n,t){for(var e,o,r,i,u=n.data,a=t[0],c=t[1],s=t[2],f=t[3],l=t[4],d=t[5],m=t[6],g=t[7],p=t[8],h=t[9],v=t[10],b=t[11],y=t[12],x=t[13],w=t[14],S=t[15],k=t[16],C=t[17],O=t[18],T=t[19],E=0;E<u.length;E+=4)e=u[E],o=u[E+1],r=u[E+2],i=u[E+3],u[E]=e*a+o*c+r*s+i*f+l,u[E+1]=e*d+o*m+r*g+i*p+h,u[E+2]=e*v+o*b+r*y+i*x+w,u[E+3]=e*S+o*k+r*C+i*O+T;return n}(o.getImageData(0,0,n.width,n.height),e);return o.putImageData(r,0,0),zS(n,t)}(n,t.getType(),e)})}function GS(t,e){return t.toCanvas().then(function(n){return function u(n,t,e){var o=xS(n);var r=o.getImageData(0,0,n.width,n.height),i=o.getImageData(0,0,n.width,n.height);return i=function w(n,t,e){function o(n,t,e){return e<n?n=e:n<t&&(n=t),n}for(var r=Math.round(Math.sqrt(e.length)),i=Math.floor(r/2),u=n.data,a=t.data,c=n.width,s=n.height,f=0;f<s;f++)for(var l=0;l<c;l++){for(var d=0,m=0,g=0,p=0;p<r;p++)for(var h=0;h<r;h++){var v=o(l+h-i,0,c-1),b=4*(o(f+p-i,0,s-1)*c+v),y=e[p*r+h];d+=u[b]*y,m+=u[1+b]*y,g+=u[2+b]*y}var x=4*(f*c+l);a[x]=o(d,0,255),a[1+x]=o(m,0,255),a[2+x]=o(g,0,255)}return t}(r,i,e),o.putImageData(i,0,0),zS(n,t)}(n,t.getType(),e)})}function XS(e){return function(n,t){return WS(n,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],t))}}function YS(n,t,e,o){return WS(n,function r(n,t,e,o){return US(n,[t=LS(t,0,2),0,0,0,0,0,e=LS(e,0,2),0,0,0,0,0,o=LS(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])}([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],t,e,o))}var qS=function BF(t){return function(n){return WS(n,t)}}([-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]),KS=XS(function _F(n,t){return US(n,[1,0,0,0,t=LS(255*t,-255,255),0,1,0,0,t,0,0,1,0,t,0,0,0,1,0,0,0,0,0,1])}),JS=XS(function DF(n,t){var e;return t=LS(t,-1,1),US(n,[(e=(t*=100)<0?127+t/100*127:127*(e=0===(e=t%1)?jS[t]:jS[Math.floor(t)]*(1-e)+jS[Math.floor(t)+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])}),$S=function AF(t){return function(n){return GS(n,t)}}([0,-1,0,-1,5,-1,0,-1,0]),QS=function FF(c){return function(t,e){return t.toCanvas().then(function(n){return function(n,t,e){var o=xS(n),r=new Array(256);for(var i=0;i<r.length;i++)r[i]=c(i,e);var u=function a(n,t){for(var e=n.data,o=0;o<e.length;o+=4)e[o]=t[e[o]],e[o+1]=t[e[o+1]],e[o+2]=t[e[o+2]];return n}(o.getImageData(0,0,n.width,n.height),r);return o.putImageData(u,0,0),zS(n,t)}(n,t.getType(),e)})}}(function(n,t){return 255*Math.pow(n/255,1-t)});function ZS(n,t,e){var o=SS(n),r=kS(n),i=t/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 s(u,a,c){return new TS(function(n){var t=SS(u),e=kS(u),o=Math.floor(t*a),r=Math.floor(e*c),i=bS(o,r);xS(i).drawImage(u,0,0,t,e,0,0,o,r),n(i)})}(n,i,u);return a?c.then(function(n){return ZS(n,t,e)}):c}function nk(t,e){return t.toCanvas().then(function(n){return function a(n,t,e){var o=bS(n.width,n.height),r=xS(o),i=0,u=0;90!==(e=e<0?360+e:e)&&270!==e||wS(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(n,0,0),zS(o,t)}(n,t.getType(),e)})}function tk(t,e){return t.toCanvas().then(function(n){return function i(n,t,e){var o=bS(n.width,n.height),r=xS(o);"v"===e?(r.scale(1,-1),r.drawImage(n,0,-o.height)):(r.scale(-1,1),r.drawImage(n,-o.width,0));return zS(o,t)}(n,t.getType(),e)})}function ek(t,e,o,r,i){return t.toCanvas().then(function(n){return function a(n,t,e,o,r,i){var u=bS(r,i);return xS(u).drawImage(n,-e,-o),zS(u,t)}(n,t.getType(),e,o,r,i)})}function ok(n){return qS(n)}function rk(n){return $S(n)}function ik(n,t){return QS(n,t)}function uk(n,t){return KS(n,t)}function ak(n,t){return JS(n,t)}function ck(n,t){return tk(n,t)}function sk(n,t,e){return function r(t,e,o){return t.toCanvas().then(function(n){return ZS(n,e,o).then(function(n){return zS(n,t.getType())})})}(n,t,e)}function fk(n,t){return nk(n,t)}function lk(n,t){return I({dom:{tag:"span",innerHtml:n,classes:["tox-icon","tox-tbtn__icon-wrap"]}},t)}function dk(n,t){return lk(zd(n,t),{})}function mk(n,t){return lk(zd(n,t),{behaviours:Du([Im.config({})])})}function gk(n,t,e){return{dom:{tag:"span",innerHtml:e.translate(n),classes:[t+"__select-label"]},behaviours:Du([Im.config({})])}}function pk(n,t,o){function e(n,t){var e=jm.getValue(n);return Xm.focus(e),Gt(e,"keydown",{raw:t.event().raw()}),ew.close(e),on.some(!0)}var r=Ce(Z),i=n.text.map(function(n){return Hd(gk(n,t,o.providers))}),u=n.icon.map(function(n){return Hd(mk(n,o.providers.icons))}),a=n.role.fold(function(){return{}},function(n){return{role:n}}),c=n.tooltip.fold(function(){return{}},function(n){var t=o.providers.translate(n);return{title:t,"aria-label":t}});return Hd(ew.sketch(I(I({},a),{dom:{tag:"button",classes:[t,t+"--select"].concat(w(n.classes,function(n){return t+"--"+n})),attributes:I({},c)},components:Zp([u.map(function(n){return n.asSpec()}),i.map(function(n){return n.asSpec()}),on.some({dom:{tag:"div",classes:[t+"__select-chevron"],innerHtml:zd("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:Du(d(n.dropdownBehaviours,[Jp(n.disabled),ow.config({}),Im.config({}),Td("dropdown-events",[Qg(n,r),Zg(n,r)]),Td("menubutton-update-display-text",[Zo(Rk,function(t,e){i.bind(function(n){return n.getOpt(t)}).each(function(n){Im.set(n,[wi(o.providers.translate(e.event().text()))])})}),Zo(Vk,function(t,e){u.bind(function(n){return n.getOpt(t)}).each(function(n){Im.set(n,[mk(e.event().icon(),o.providers.icons)])})})])])),eventOrder:Bn(Ik,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:Du([Fm.config({mode:"special",onLeft:e,onRight:e})]),lazySink:o.getSink,toggleClass:t+"--active",parts:{menu:Xh(0,n.columns,n.presets)},fetch:function(){return Xb(n.fetch)}}))).asSpec()}function hk(e){return{isDisabled:function(){return qp.isDisabled(e)},setDisabled:function(n){return qp.set(e,n)},setActive:function(n){var t=e.element();n?($r(t,"tox-tbtn--enabled"),Or(t,"aria-pressed",!0)):(Zr(t,"tox-tbtn--enabled"),_r(t,"aria-pressed"))},isActive:function(){return ni(e.element(),"tox-tbtn--enabled")}}}function vk(n,t,e,o){return pk({text:n.text,icon:n.icon,tooltip:n.tooltip,role:o,fetch:function(t){n.fetch(function(n){t(gy(n,rh.CLOSE_ON_EXECUTE,e))})},onSetup:n.onSetup,getApi:hk,columns:1,presets:"normal",classes:[],dropdownBehaviours:[Zx.config({})]},t,e.shared)}function bk(t,o,r){return function(n){n(w(t,function(n){var t=n.text.fold(function(){return{}},function(n){return{text:n}});return I(I({type:n.type},t),{onAction:function(e){return function(n){r.shared.getSink().each(function(n){o().getOpt(n).each(function(n){ml(n.element()),Gt(n,wb,{name:e.name,value:e.storage.get()})})});var t=!n.isActive();n.setActive(t),e.storage.set(t)}}(n),onSetup:function(t){return function(n){n.setActive(t.storage.get())}}(n)})}))}}function yk(n,t,e,o,r){void 0===e&&(e=[]);var i=t.fold(function(){return{}},function(n){return{action:n}}),u=I({buttonBehaviours:Du([Jp(n.disabled),Zx.config({}),Td("button press",[Qo("click"),Qo("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=Bn(u,{dom:o});return Bn(a,{components:r})}function xk(n,t,e,o){void 0===o&&(o=[]);var r={tag:"button",classes:["tox-tbtn"],attributes:n.tooltip.map(function(n){return{"aria-label":e.translate(n),title:e.translate(n)}}).getOr({})},i=n.icon.map(function(n){return dk(n,e.icons)}),u=Zp([i]);return yk(n,t,o,r,u)}function wk(n,t,e,o){void 0===o&&(o=[]);var r=xk(n,on.some(t),e,o);return vg.sketch(r)}function Sk(n,t,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=e.translate(n.text),u=n.icon?n.icon.map(function(n){return dk(n,e.icons)}):on.none(),a=u.isSome()?Zp([u]):[],c=u.isSome()?{}:{innerHtml:i},s=d(n.primary||n.borderless?["tox-button"]:["tox-button","tox-button--secondary"],u.isSome()?["tox-button--icon"]:[],n.borderless?["tox-button--naked"]:[],r),f=I(I({tag:"button",classes:s},c),{attributes:{title:i}});return yk(n,t,o,f,a)}function kk(n,t,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=Sk(n,on.some(t),e,o,r);return vg.sketch(i)}function Ck(t,e){return function(n){"custom"===e?Gt(n,wb,{name:t,value:{}}):"submit"===e?Wt(n,Sb):"cancel"===e?Wt(n,xb):M.console.error("Unknown button type: ",e)}}function Ok(n,t,e){if(function(n,t){return"menu"===t}(0,t)){var o=n,r=I(I({},n),{fetch:bk(o.items,function(){return i},e)}),i=Hd(vk(r,"tox-tbtn",e,on.none()));return i.asSpec()}if(function(n,t){return"custom"===t||"cancel"===t||"submit"===t}(0,t)){var u=Ck(n.name,t),a=I(I({},n),{borderless:!1});return kk(a,u,e.shared.providers,[])}M.console.error("Unknown footer button type: ",t)}function Tk(n,t){return Lf({factory:_b,name:n,overrides:function(o){return{fieldBehaviours:Du([Td("coupled-input-behaviour",[Zo(mo(),function(e){(function(n,t,e){return Cs(n,t,e).bind(Ol.getCurrent)})(e,o,t).each(function(t){Cs(e,o,"lock").each(function(n){Qm.isOn(n)&&o.onLockedChange(e,t,n)})})})])])}}})}function Ek(n){var t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(n);if(null===t)return an.error(n);var e=parseFloat(t[1]),o=t[2];return an.value({value:e,unit:o})}function Bk(n,t){function e(n){return Object.prototype.hasOwnProperty.call(o,n)}var o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,"in":1};return n.unit===t?on.some(n.value):e(n.unit)&&e(t)?o[n.unit]===o[t]?on.some(n.value):on.some(n.value/o[n.unit]*o[t]):on.none()}function _k(n){return on.none()}function Dk(n,t){return function(n,t,e){return n.isSome()&&t.isSome()?on.some(e(n.getOrDie(),t.getOrDie())):on.none()}(Ek(n).toOption(),Ek(t).toOption(),function(n,t){return Bk(n,t.unit).map(function(n){return t.value/n}).map(function(n){return function(t,e){return function(n){return Bk(n,e).map(function(n){return{value:n*t,unit:e}})}}(n,t.unit)}).getOr(_k)}).getOr(_k)}function Ak(o,t){function n(n){return{dom:{tag:"div",classes:["tox-form__group"]},components:n}}function e(e){return _b.parts().field({factory:Gx,inputClasses:["tox-textfield"],inputBehaviours:Du([qp.config({disabled:o.disabled}),Zx.config({}),Td("size-input-events",[Zo(co(),function(n,t){Gt(n,i,{isField1:e})}),Zo(go(),function(n,t){Gt(n,bb,{name:o.name})})])]),selectOnFocus:!1})}function r(n){return{dom:{tag:"label",classes:["tox-label"],innerHtml:t.translate(n)}}}var a=_k,i=Mr("ratio-event"),u=Pk.parts().lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:t.translate(o.label.getOr("Constrain proportions"))}},components:[{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__lock"],innerHtml:zd("lock",t.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:zd("unlock",t.icons)}}],buttonBehaviours:Du([Jp(o.disabled),Zx.config({})])}),c=Pk.parts().field1(n([_b.parts().label(r("Width")),e(!0)])),s=Pk.parts().field2(n([_b.parts().label(r("Height")),e(!1)]));return Pk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,n([r(" "),u])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(n,t,e){Ek(jm.getValue(n)).each(function(n){a(n).each(function(n){jm.setValue(t,function(n){var t,e={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,"in":4,"%":4},o=n.value.toFixed((t=n.unit)in e?e[t]:1);return-1!==o.indexOf(".")&&(o=o.replace(/\.?0*$/,"")),o+n.unit}(n))})})},coupledFieldBehaviours:Du([qp.config({disabled:o.disabled,onDisabled:function(n){Pk.getField1(n).bind(_b.getField).each(qp.disable),Pk.getField2(n).bind(_b.getField).each(qp.disable),Pk.getLock(n).each(qp.disable)},onEnabled:function(n){Pk.getField1(n).bind(_b.getField).each(qp.enable),Pk.getField2(n).bind(_b.getField).each(qp.enable),Pk.getLock(n).each(qp.enable)}}),Td("size-input-events2",[Zo(i,function(n,t){var e=t.event().isField1(),o=e?Pk.getField1(n):Pk.getField2(n),r=e?Pk.getField2(n):Pk.getField1(n),i=o.map(jm.getValue).getOr(""),u=r.map(jm.getValue).getOr("");a=Dk(i,u)})])])})}function Fk(r,c){function n(n,t,e,o){return Hd(kk({name:n,text:n,disabled:e,primary:o,icon:on.none(),borderless:!1},t,c))}function t(n,t,e,o){return Hd(wk({name:n,icon:on.some(n),tooltip:on.some(t),disabled:o,primary:!1,borderless:!1},e,c))}function u(n,e){n.map(function(n){var t=n.get(e);t.hasConfigured(qp)&&qp.disable(t)})}function a(n,e){n.map(function(n){var t=n.get(e);t.hasConfigured(qp)&&qp.enable(t)})}function i(n,t,e){Gt(n,t,e)}function e(n){return Wt(n,Wk.disable())}function o(n){return Wt(n,Wk.enable())}function s(n,t){e(n),i(n,zk.transform(),{transform:t}),o(n)}function f(n){return function(){Q.getOpt(n).each(function(n){Im.set(n,[J])})}}function l(n,t){e(n),i(n,zk.transformApply(),{transform:t,swap:f(n)}),o(n)}function d(){return n("Back",function(n){return i(n,zk.back(),{swap:f(n)})},!1,!1)}function m(){return Hd({dom:{tag:"div",classes:["tox-spacer"]},behaviours:Du([qp.config({})])})}function g(){return n("Apply",function(n){return i(n,zk.apply(),{swap:f(n)})},!0,!0)}function p(){return function(n){var t=r.getRect();return function(n,t,e,o,r){return ek(n,t,e,o,r)}(n,t.x,t.y,t.w,t.h)}}function h(t,e){return function(n){return t(n,e)}}function v(n,t){!function(n,t){e(n),i(n,zk.tempTransform(),{transform:t}),o(n)}(n,t)}function b(n,t,e,o,r){var i=Ww.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(n)}}),u=Ww.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=Ww.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Hd(Ww.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:nn({x:nn(o)})},components:[i,u,a],sliderBehaviours:Du([Xm.config({})]),onChoose:t}))}function y(n,t,e,o,r){return[d(),function(n,r,t,e,o){return b(n,function(n,t,e){var o=h(r,e.x()/100);s(n,o)},t,e,o)}(n,t,e,o,r),g()]}function x(n,t,e,o,r){var i=y(n,t,e,o,r);return ab.sketch({dom:C,components:i.map(function(n){return n.asSpec()}),containerBehaviours:Du([Td("image-tools-filter-panel-buttons-events",[Zo(Wk.disable(),function(n,t){u(i,n)}),Zo(Wk.enable(),function(n,t){a(i,n)})])])})}function w(t,e,o){return function(n){return function(n,t,e,o){return YS(n,t,e,o)}(n,t,e,o)}}function S(n){return b(n,function(a,n,t){var e=j.getOpt(a),o=W.getOpt(a),r=U.getOpt(a);e.each(function(u){o.each(function(i){r.each(function(n){var t=jm.getValue(u).x()/100,e=jm.getValue(n).x()/100,o=jm.getValue(i).x()/100,r=w(t,e,o);s(a,r)})})})},0,100,200)}function k(t,e,o){return function(n){i(n,zk.swap(),{transform:e,swap:function(){Q.getOpt(n).each(function(n){Im.set(n,[t]),o(n)})}})}}var C={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},O=Z,T=[d(),m(),n("Apply",function(n){var t=p();l(n,t),r.hideCrop()},!1,!0)],E=ab.sketch({dom:C,components:T.map(function(n){return n.asSpec()}),containerBehaviours:Du([Td("image-tools-crop-buttons-events",[Zo(Wk.disable(),function(n,t){u(T,n)}),Zo(Wk.enable(),function(n,t){a(T,n)})])])}),B=Hd(Ak({name:"size",label:on.none(),constrain:!0,disabled:!1},c)),_=[d(),m(),B,m(),n("Apply",function(o){B.getOpt(o).each(function(n){var t=jm.getValue(n),e=function(t,e){return function(n){return sk(n,t,e)}}(parseInt(t.width,10),parseInt(t.height,10));l(o,e)})},!1,!0)],D=ab.sketch({dom:C,components:_.map(function(n){return n.asSpec()}),containerBehaviours:Du([Td("image-tools-resize-buttons-events",[Zo(Wk.disable(),function(n,t){u(_,n)}),Zo(Wk.enable(),function(n,t){a(_,n)})])])}),A=h(ck,"h"),F=h(ck,"v"),M=h(fk,-90),I=h(fk,90),R=[d(),m(),t("flip-horizontally","Flip horizontally",function(n){v(n,A)},!1),t("flip-vertically","Flip vertically",function(n){v(n,F)},!1),t("rotate-left","Rotate counterclockwise",function(n){v(n,M)},!1),t("rotate-right","Rotate clockwise",function(n){v(n,I)},!1),m(),g()],V=ab.sketch({dom:C,components:R.map(function(n){return n.asSpec()}),containerBehaviours:Du([Td("image-tools-fliprotate-buttons-events",[Zo(Wk.disable(),function(n,t){u(R,n)}),Zo(Wk.enable(),function(n,t){a(R,n)})])])}),N=[d(),m(),g()],H=ab.sketch({dom:C,components:N.map(function(n){return n.asSpec()})}),P=x("Brightness",uk,-100,0,100),z=x("Contrast",ak,-100,0,100),L=x("Gamma",ik,-100,0,100),j=S("R"),U=S("G"),W=S("B"),G=[d(),j,U,W,g()],X=ab.sketch({dom:C,components:G.map(function(n){return n.asSpec()})}),Y=on.some(rk),q=on.some(ok),K=[t("crop","Crop",k(E,on.none(),function(n){r.showCrop()}),!1),t("resize","Resize",k(D,on.none(),function(n){B.getOpt(n).each(function(n){var t=r.getMeasurements(),e=t.width,o=t.height;jm.setValue(n,{width:e,height:o})})}),!1),t("orientation","Orientation",k(V,on.none(),O),!1),t("brightness","Brightness",k(P,on.none(),O),!1),t("sharpen","Sharpen",k(H,Y,O),!1),t("contrast","Contrast",k(z,on.none(),O),!1),t("color-levels","Color levels",k(X,on.none(),O),!1),t("gamma","Gamma",k(L,on.none(),O),!1),t("invert","Invert",k(H,q,O),!1)],J=ab.sketch({dom:C,components:K.map(function(n){return n.asSpec()})}),$=ab.sketch({dom:{tag:"div"},components:[J],containerBehaviours:Du([Im.config({})])}),Q=Hd($);return{memContainer:Q,getApplyButton:function(n){return Q.getOpt(n).map(function(n){var t=n.components()[0];return t.components()[t.components().length-1]})}}}var Mk=Mr("toolbar.button.execute"),Ik={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},Rk=Mr("update-menu-text"),Vk=Mr("update-menu-icon"),Nk=nn([wt("field1Name","field1"),wt("field2Name","field2"),Su("onLockedChange"),bu(["lockClass"]),wt("locked",!1),wf("coupledFieldBehaviours",[Ol,jm])]),Hk=nn([Tk("field1","field2"),Tk("field2","field1"),Lf({factory:vg,schema:[at("dom")],name:"lock",overrides:function(n){return{buttonBehaviours:Du([Qm.config({selected:n.locked,toggleClass:n.markers.lockClass,aria:{mode:"pressed"}})])}}})]),Pk=$f({name:"FormCoupledInputs",configFields:Nk(),partFields:Hk(),factory:function(o,n,t,e){return{uid:o.uid,dom:o.dom,components:n,behaviours:Sf(o.coupledFieldBehaviours,[Ol.config({find:on.some}),jm.config({store:{mode:"manual",getValue:function(n){var t,e=_s(n,o,["field1","field2"]);return(t={})[o.field1Name]=jm.getValue(e.field1()),t[o.field2Name]=jm.getValue(e.field2()),t},setValue:function(n,t){var e=_s(n,o,["field1","field2"]);$(t,o.field1Name)&&jm.setValue(e.field1(),t[o.field1Name]),$(t,o.field2Name)&&jm.setValue(e.field2(),t[o.field2Name])}}})]),apis:{getField1:function(n){return Cs(n,o,"field1")},getField2:function(n){return Cs(n,o,"field2")},getLock:function(n){return Cs(n,o,"lock")}}}},apis:{getField1:function(n,t){return n.getField1(t)},getField2:function(n,t){return n.getField2(t)},getLock:function(n,t){return n.getLock(t)}}}),zk={undo:nn(Mr("undo")),redo:nn(Mr("redo")),zoom:nn(Mr("zoom")),back:nn(Mr("back")),apply:nn(Mr("apply")),swap:nn(Mr("swap")),transform:nn(Mr("transform")),tempTransform:nn(Mr("temp-transform")),transformApply:nn(Mr("transform-apply"))},Lk=nn("save-state"),jk=nn("disable"),Uk=nn("enable"),Wk={formActionEvent:wb,saveState:Lk,disable:jk,enable:Uk},Gk=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Xk=tinymce.util.Tools.resolve("tinymce.geom.Rect"),Yk=tinymce.util.Tools.resolve("tinymce.util.Observable"),qk=tinymce.util.Tools.resolve("tinymce.util.Tools"),Kk=tinymce.util.Tools.resolve("tinymce.util.VK");function Jk(n){var t,e;if(n.changedTouches)for(t="screenX screenY pageX pageY clientX clientY".split(" "),e=0;e<t.length;e++)n[t[e]]=n.changedTouches[0][t[e]]}function $k(n,r){var i,u,t,a,c,f,l,d=r.document||M.document;r=r||{};var m=d.getElementById(r.handle||n);t=function(n){var t,e,o=function s(n){var t,e,o,r,i,u,a,c=Math.max;return t=n.documentElement,e=n.body,o=c(t.scrollWidth,e.scrollWidth),r=c(t.clientWidth,e.clientWidth),i=c(t.offsetWidth,e.offsetWidth),u=c(t.scrollHeight,e.scrollHeight),a=c(t.clientHeight,e.clientHeight),{width:o<i?r:o,height:u<c(t.offsetHeight,e.offsetHeight)?a:u}}(d);Jk(n),n.preventDefault(),u=n.button,t=m,f=n.screenX,l=n.screenY,e=M.window.getComputedStyle?M.window.getComputedStyle(t,null).getPropertyValue("cursor"):t.runtimeStyle.cursor,i=Gk("<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),Gk(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(n)},c=function(n){if(Jk(n),n.button!==u)return a(n);n.deltaX=n.screenX-f,n.deltaY=n.screenY-l,n.preventDefault(),r.drag(n)},a=function(n){Jk(n),Gk(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(n)},this.destroy=function(){Gk(m).off()},Gk(m).on("mousedown touchstart",t)}function Qk(t){function u(n,s){c.getOpt(n).each(function(n){var e=l.get(),o=oa(n.element()),r=ta(n.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),t={left:a.toString()+"px",top:c.toString()+"px",width:i.toString()+"px",height:u.toString()+"px",position:"absolute"};ai(s,t),f.getOpt(n).each(function(n){ai(n.element(),t)}),d.get().each(function(n){var t=m.get();n.setRect({x:t.x*e+a,y:t.y*e+c,w:t.w*e,h:t.h*e}),n.setClampRect({x:a,y:c,w:i,h:u}),n.setViewPortRect({x:0,y:0,w:o,h:r})})})}function e(n,t){var i=Te.fromTag("img");return Or(i,"src",t),function(e){return new sp(function(n){var t=function(){e.removeEventListener("load",t),n(e)};e.complete?n(e):e.addEventListener("load",t)})}(i.dom()).then(function(){return c.getOpt(n).map(function(n){var t=su({element:i});Im.replaceAt(n,1,on.some(t));var e=a.get(),o={x:0,y:0,w:i.dom().naturalWidth,h:i.dom().naturalHeight};a.set(o);var r=Xk.inflate(o,-20,-20);return m.set(r),e.w===o.w&&e.h===o.h||function(n,u){c.getOpt(n).each(function(n){var t=oa(n.element()),e=ta(n.element()),o=u.dom().naturalWidth,r=u.dom().naturalHeight,i=Math.min(t/o,e/r);1<=i?l.set(1):l.set(i)})}(n,i),u(n,i),i})})}var f=Hd({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),l=Ce(1),d=Ce(on.none()),m=Ce({x:0,y:0,w:1,h:1}),a=Ce({x:0,y:0,w:1,h:1}),n=ab.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[f.asSpec(),{dom:{tag:"img",attributes:{src:t}}},{dom:{tag:"div"},behaviours:Du([Td("image-panel-crop-events",[Pi(function(n){c.getOpt(n).each(function(n){var t=n.element().dom(),e=eC({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,function(){});e.toggleVisibility(!1),e.on("updateRect",function(n){var t=n.rect,e=l.get(),o={x:Math.round(t.x/e),y:Math.round(t.y/e),w:Math.round(t.w/e),h:Math.round(t.h/e)};m.set(o)}),d.set(on.some(e))})})])])}],containerBehaviours:Du([Im.config({}),Td("image-panel-events",[Pi(function(n){e(n,t)})])])}),c=Hd(n);return{memContainer:c,updateSrc:e,zoom:function(n,t){var e=l.get(),o=0<t?Math.min(2,e+.1):Math.max(.1,e-.1);l.set(o),c.getOpt(n).each(function(n){var t=n.components()[1].element();u(n,t)})},showCrop:function(){d.get().each(function(n){n.toggleVisibility(!0)})},hideCrop:function(){d.get().each(function(n){n.toggleVisibility(!1)})},getRect:function(){return m.get()},getMeasurements:function(){var n=a.get();return{width:n.w,height:n.h}}}}function Zk(n,t,e,o,r){return wk({name:n,icon:on.some(t),disabled:e,tooltip:on.some(n),primary:!1,borderless:!1},o,r)}function nC(n,t){t?qp.enable(n):qp.disable(n)}var tC=0,eC=function(s,e,f,o,r){var l,t,i,u="tox-",a="tox-crid-"+tC++,c=[{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"];var d=function(n,t){return{x:t.x+n.x,y:t.y+n.y,w:t.w,h:t.h}},m=function(n,t){return{x:t.x-n.x,y:t.y-n.y,w:t.w,h:t.h}};function g(n,t,e,o){var r,i,u,a,c;r=t.x,i=t.y,u=t.w,a=t.h,r+=e*n.deltaX,i+=o*n.deltaY,(u+=e*n.deltaW)<20&&(u=20),(a+=o*n.deltaH)<20&&(a=20),c=s=Xk.clamp({x:r,y:i,w:u,h:a},f,"move"===n.name),c=m(f,c),l.fire("updateRect",{rect:c}),v(c)}function p(t){function n(n,t){t.h<0&&(t.h=0),t.w<0&&(t.w=0),Gk("#"+a+"-"+n,o).css({left:t.x,top:t.y,width:t.w,height:t.h})}qk.each(c,function(n){Gk("#"+a+"-"+n.name,o).css({left:t.w*n.xMul+t.x,top:t.h*n.yMul+t.y})}),n("top",{x:e.x,y:e.y,w:e.w,h:t.y-e.y}),n("right",{x:t.x+t.w,y:t.y,w:e.w-t.x-t.w+e.x,h:t.h}),n("bottom",{x:e.x,y:t.y+t.h,w:e.w,h:e.h-t.y-t.h+e.y}),n("left",{x:e.x,y:t.y,w:t.x-e.x,h:t.h}),n("move",t)}function h(n){p(s=n)}function v(n){h(d(f,n))}return function b(){Gk('<div id="'+a+'" class="'+u+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),qk.each(i,function(n){Gk("#"+a,o).append('<div id="'+a+"-"+n+'"class="'+u+'croprect-block" style="display: none" data-mce-bogus="all">')}),qk.each(c,function(n){Gk("#"+a,o).append('<div id="'+a+"-"+n.name+'" class="'+u+"croprect-handle "+u+"croprect-handle-"+n.name+'"style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1" aria-label="'+n.label+'" aria-grabbed="false" title="'+n.label+'">')}),t=qk.map(c,function n(t){var e;return new $k(a,{document:o.ownerDocument,handle:a+"-"+t.name,start:function(){e=s},drag:function(n){g(t,e,n.deltaX,n.deltaY)}})}),p(s),Gk(o).on("focusin focusout",function(n){Gk(n.target).attr("aria-grabbed","focus"===n.type?"true":"false")}),Gk(o).on("keydown",function(t){var i;function n(n,t,e,o,r){n.stopPropagation(),n.preventDefault(),g(i,e,o,r)}switch(qk.each(c,function(n){if(t.target.id===a+"-"+n.name)return i=n,!1}),t.keyCode){case Kk.LEFT:n(t,0,s,-10,0);break;case Kk.RIGHT:n(t,0,s,10,0);break;case Kk.UP:n(t,0,s,0,-10);break;case Kk.DOWN:n(t,0,s,0,10);break;case Kk.ENTER:case Kk.SPACEBAR:t.preventDefault(),r()}})}(),l=qk.extend({toggleVisibility:function y(n){var t;t=qk.map(c,function(n){return"#"+a+"-"+n.name}).concat(qk.map(i,function(n){return"#"+a+"-"+n})).join(","),n?Gk(t,o).show():Gk(t,o).hide()},setClampRect:function x(n){f=n,p(s)},setRect:h,getInnerRect:function(){return m(f,s)},setInnerRect:v,setViewPortRect:function w(n){e=n,p(s)},destroy:function n(){qk.each(t,function(n){n.destroy()}),t=[]}},Yk)};function oC(n){var t=Ce(n),e=Ce(on.none()),o=function s(){var e=[],o=-1;function n(){return 0<o}function t(){return-1!==o&&o<e.length-1}return{data:e,add:function r(n){var t;return t=e.splice(++o),e.push(n),{state:n,removed:t}},undo:function i(){if(n())return e[--o]},redo:function u(){if(t())return e[++o]},canUndo:n,canRedo:t}}();function r(n){t.set(n)}function i(n){M.URL.revokeObjectURL(n.url)}function u(n){var t=a(n);return r(t),function(n){qk.each(n,i)}(o.add(t).removed),t.url}o.add(n);var a=function(n){return{blob:n,url:M.URL.createObjectURL(n)}},c=function(){e.get().each(i),e.set(on.none())};return{getBlobState:function(){return t.get()},setBlobState:r,addBlobState:u,getTempState:function(){return e.get().fold(function(){return t.get()},function(n){return n})},updateTempState:function(n){var t=a(n);return c(),e.set(on.some(t)),t.url},addTempState:function(n){var t=a(n);return e.set(on.some(t)),t.url},applyTempState:function(t){return e.get().fold(function(){},function(n){u(n.blob),t()})},destroyTempState:c,undo:function(){var n=o.undo();return r(n),n.url},redo:function(){var n=o.redo();return r(n),n.url},getHistoryStates:function(){return{undoEnabled:o.canUndo(),redoEnabled:o.canRedo()}}}}function rC(n,t){function i(n){var t=s.getHistoryStates();m.updateButtonUndoStates(n,t.undoEnabled,t.redoEnabled),Gt(n,Wk.formActionEvent,{name:Wk.saveState(),value:t.undoEnabled})}function u(n){return n.toBlob()}function a(n){Gt(n,Wk.formActionEvent,{name:Wk.disable(),value:{}})}function r(t,n,e,o,r){return a(t),function(n){return PS(n)}(n).then(e).then(u).then(o).then(function(n){return l(t,n).then(function(n){return i(t),r(),f(t),n})})["catch"](function(n){return M.console.log(n),f(t),n})}function c(n,t,e){var o=s.getBlobState().blob;r(n,o,t,function(n){return s.updateTempState(n)},e)}var s=oC(n.currentState),f=function(n){e.getApplyButton(n).each(function(n){qp.enable(n)}),Gt(n,Wk.formActionEvent,{name:Wk.enable(),value:{}})},l=function(n,t){return a(n),o.updateSrc(n,t)},d=function(n){var t=s.getBlobState().url;return s.destroyTempState(),i(n),t},o=Qk(n.currentState.url),m=function(n){var o=Hd(Zk("Undo","undo",!0,function(n){Gt(n,zk.undo(),{direction:1})},n)),r=Hd(Zk("Redo","redo",!0,function(n){Gt(n,zk.redo(),{direction:1})},n));return{container:ab.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),Zk("Zoom in","zoom-in",!1,function(n){Gt(n,zk.zoom(),{direction:1})},n),Zk("Zoom out","zoom-out",!1,function(n){Gt(n,zk.zoom(),{direction:-1})},n)]}),updateButtonUndoStates:function(n,t,e){o.getOpt(n).each(function(n){nC(n,t)}),r.getOpt(n).each(function(n){nC(n,e)})}}}(t),e=Fk(o,t);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[e.memContainer.asSpec(),o.memContainer.asSpec(),m.container],behaviours:Du([jm.config({store:{mode:"manual",getValue:function(){return s.getBlobState()}}}),Td("image-tools-events",[Zo(zk.undo(),function(t,n){var e=s.undo();l(t,e).then(function(n){f(t),i(t)})}),Zo(zk.redo(),function(t,n){var e=s.redo();l(t,e).then(function(n){f(t),i(t)})}),Zo(zk.zoom(),function(n,t){var e=t.event().direction();o.zoom(n,e)}),Zo(zk.back(),function(n,t){!function(t){var n=d(t);l(t,n).then(function(n){f(t)})}(n),t.event().swap()(),o.hideCrop()}),Zo(zk.apply(),function(n,t){s.applyTempState(function(){d(n),t.event().swap()()})}),Zo(zk.transform(),function(n,t){return c(n,t.event().transform(),Z)}),Zo(zk.tempTransform(),function(n,t){return function(n,t){var e=s.getTempState().blob;r(n,e,t,function(n){return s.addTempState(n)},Z)}(n,t.event().transform())}),Zo(zk.transformApply(),function(n,t){return function(e,n,t){var o=s.getBlobState().blob;r(e,o,n,function(n){var t=s.addBlobState(n);return d(e),t},t)}(n,t.event().transform(),t.event().swap())}),Zo(zk.swap(),function(t,n){!function(n){m.updateButtonUndoStates(n,!1,!1)}(t);var e=n.event().transform(),o=n.event().swap();e.fold(function(){o()},function(n){c(t,n,o)})})]),eS()])}}function iC(e,t){var n=e.label.map(function(n){return fy(n,t)}),o=[qp.config({disabled:e.disabled}),Fm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(n){return Wt(n,Sb),on.some(!0)}}),Td("textfield-change",[Zo(mo(),function(n,t){Gt(n,bb,{name:e.name})}),Zo(wo(),function(n,t){Gt(n,bb,{name:e.name})})]),Zx.config({})],r=e.validation.map(function(o){return Jx.config({getRoot:function(n){return dr(n.element())},invalidClass:"tox-invalid",validator:{validate:function(n){var t=jm.getValue(n),e=o.validator(t);return Yb(!0===e?an.value(t):an.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=e.placeholder.fold(nn({}),function(n){return{placeholder:t.translate(n)}}),u=I({},i),a=_b.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:u,inputClasses:[e.classname],inputBehaviours:Du(R([o,r])),selectOnFocus:!1,factory:Gx}),c=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),s=[qp.config({disabled:e.disabled,onDisabled:function(n){_b.getField(n).each(qp.disable)},onEnabled:function(n){_b.getField(n).each(qp.enable)}})];return cy(n,a,c,s)}function uC(n){return nT(Xb(n))}function aC(n){return{type:"menuitem",value:n.url,text:n.title,meta:{attach:n.attach},onAction:function(){}}}function cC(n,t){return{type:"menuitem",value:t,text:n,meta:{attach:undefined},onAction:function(){}}}function sC(n,t){return function(n){return w(n,aC)}(function(t,n){return S(n,function(n){return n.type===t})}(n,t))}function fC(n,t){var e=n.toLowerCase();return S(t,function(n){var t=n.meta!==undefined&&n.meta.text!==undefined?n.meta.text:n.text;return Rt(t.toLowerCase(),e)||Rt(n.value.toLowerCase(),e)})}function lC(e,n,o){var t=jm.getValue(n),r=t.meta.text!==undefined?t.meta.text:t.value;return o.getLinkInformation().fold(function(){return[]},function(n){var t=fC(r,function(n){return w(n,function(n){return cC(n,n)})}(o.getHistory(e)));return"file"===e?function(n){return C(n,function(n,t){return 0===n.length||0===t.length?n.concat(t):n.concat(eT,t)},[])}([t,fC(r,function(n){return sC("header",n.targets)}(n)),fC(r,R([function(n){return on.from(n.anchorTop).map(function(n){return cC("<top>",n)}).toArray()}(n),function(n){return sC("anchor",n.targets)}(n),function(n){return on.from(n.anchorBottom).map(function(n){return cC("<bottom>",n)}).toArray()}(n)]))]):t})}function dC(r,o,i){function u(n){var t=jm.getValue(n);i.addToHistory(t.value,r.filetype)}var n,t,e,a,c,s=o.shared.providers,f=_b.parts().field({factory:zx,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":oT},minChars:0,responseTime:0,fetch:function(n){var t=lC(r.filetype,n,i),e=gy(t,rh.BUBBLE_TO_SANDBOX,o);return Yb(e)},getHotspot:function(n){return h.getOpt(n)},onSetValue:function(n,t){n.hasConfigured(Jx)&&Jx.run(n).get(Z)},typeaheadBehaviours:Du(R([i.getValidationHandler().map(function(e){return Jx.config({getRoot:function(n){return dr(n.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(n,t){d.getOpt(n).each(function(n){Or(n.element(),"title",s.translate(t))})}},validator:{validate:function(n){var t=jm.getValue(n);return tT(function(o){e({type:r.filetype,url:t.value},function(n){if("invalid"===n.status){var t=an.error(n.message);o(t)}else{var e=an.value(n.message);o(e)}})})},validateOnLoad:!1}})}).toArray(),[qp.config({disabled:r.disabled}),Zx.config({}),Td("urlinput-events",R(["file"===r.filetype?[Zo(mo(),function(n){Gt(n,bb,{name:r.name})})]:[],[Zo(go(),function(n){Gt(n,bb,{name:r.name}),u(n)}),Zo(wo(),function(n){Gt(n,bb,{name:r.name}),u(n)})]]))]])),eventOrder:(n={},n[mo()]=["streaming","urlinput-events","invalidating"],n),model:{getDisplayText:function(n){return n.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:o.shared.getSink,parts:{menu:Xh(0,0,"normal")},onExecute:function(n,t,e){Gt(t,Sb,{})},onItemExecute:function(n,t,e,o){u(n),Gt(n,bb,{name:r.name})}}),l=r.label.map(function(n){return fy(n,s)}),d=Hd((t="invalid",e=on.some(oT),void 0===(a="warning")&&(a=t),void 0===c&&(c=t),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+t],innerHtml:zd(a,s.icons),attributes:I({title:s.translate(c),"aria-live":"polite"},e.fold(function(){return{}},function(n){return{id:n}}))}})),m=Hd({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),g=i.getUrlPicker(r.filetype),p=Mr("browser.url.event"),h=Hd({dom:{tag:"div",classes:["tox-control-wrap"]},components:[f,m.asSpec()],behaviours:Du([qp.config({disabled:r.disabled})])}),v=Hd(kk({name:r.name,icon:on.some("browse"),text:r.label.getOr(""),disabled:r.disabled,primary:!1,borderless:!0},function(n){return Wt(n,p)},s,[],["tox-browse-url"]));return _b.sketch({dom:jx([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:R([[h.asSpec()],g.map(function(){return v.asSpec()}).toArray()])}]),fieldBehaviours:Du([qp.config({disabled:r.disabled,onDisabled:function(n){_b.getField(n).each(qp.disable),v.getOpt(n).each(qp.disable)},onEnabled:function(n){_b.getField(n).each(qp.enable),v.getOpt(n).each(qp.enable)}}),Td("url-input-events",[Zo(p,function(o){Ol.getCurrent(o).each(function(t){var e=jm.getValue(t);g.each(function(n){n(e).get(function(n){jm.setValue(t,n),Gt(o,bb,{name:r.name})})})})})])])})}function mC(u,t){function n(e){return function(t,n){Ci(n.event().target(),"[data-collection-item-value]").each(function(n){e(t,n,Er(n,"data-collection-item-value"))})}}var e=u.label.map(function(n){return fy(n,t)}),o=[Zo(ao(),n(function(n,t){ml(t)})),Zo(To(),n(function(n,t,e){Gt(n,wb,{name:u.name,value:e})})),Zo(co(),n(function(n,t,e){ki(n.element(),"."+Hp).each(function(n){Zr(n,Hp)}),$r(t,Hp)})),Zo(so(),n(function(n,t,e){ki(n.element(),"."+Hp).each(function(n){Zr(n,Hp)})})),ji(n(function(n,t,e){Gt(n,wb,{name:u.name,value:e})}))],r=_b.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==u.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:f},behaviours:Du([Im.config({}),jm.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,n){!function(n,t){var e=w(t,function(n){var t=Dp.translate(n.text),e=1===u.columns?'<div class="tox-collection__item-label">'+t+"</div>":"",o='<div class="tox-collection__item-icon">'+n.icon+"</div>",r={_:" "," - ":" ","-":" "},i=t.replace(/\_| \- |\-/g,function(n){return r[n]});return'<div class="tox-collection__item" tabindex="-1" data-collection-item-value="'+function(n){return'"'===n?""":n}(n.value)+'" title="'+i+'" aria-label="'+i+'">'+o+e+"</div>"}),o=1<u.columns&&"auto"!==u.columns?x(e,u.columns):[e],r=w(o,function(n){return'<div class="tox-collection__group">'+n.join("")+"</div>"});kr(n.element(),r.join(""))}(o,n),"auto"===u.columns&&Ag(o,5,"tox-collection__item").each(function(n){var t=n.numRows,e=n.numColumns;Fm.setGridSize(o,t,e)}),Wt(o,Tb)}}),Zx.config({}),Fm.config(function(n,t){return 1===n?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===n?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===t?".tox-swatches__row":".tox-collection__group",cell:"color"===t?"."+Mp:"."+Fp}}}(u.columns,"normal")),Td("collection-events",o)])});return cy(e,r,["tox-form__group--collection"],[])}function gC(r){return function(t,e,o){return Vn(e,"name").fold(function(){return r(e,o)},function(n){return t.field(n,r(e,o))})}}function pC(t,n,e){var o=Bn(e,{shared:{interpreter:function(n){return uT(t,n,o)}}});return uT(t,n,o)}function hC(n){return n.x()}function vC(n,t){return n.x()+n.width()/2-t.width()/2}function bC(n,t){return n.x()+n.width()-t.width()}function yC(n){return n.y()}function xC(n,t){return n.y()+n.height()-t.height()}function wC(n,t,e){return Ya(hC(n),xC(n,t),e.innerSoutheast(),Ka(),"layout-se")}function SC(n,t,e){return Ya(bC(n,t),xC(n,t),e.innerSouthwest(),Ja(),"layout-sw")}function kC(n,t,e){return Ya(hC(n),yC(n),e.innerNortheast(),$a(),"layout-ne")}function CC(n,t,e){return Ya(bC(n,t),yC(n),e.innerNorthwest(),Qa(),"layout-nw")}function OC(n,t,e){return Ya(vC(n,t),yC(n),e.innerNorth(),nc(),"layout-n")}function TC(n,t,e){return Ya(vC(n,t),xC(n,t),e.innerSouth(),Za(),"layout-s")}function EC(n){return{colorPicker:function(e){return function(n,t){lv.colorPickerDialog(e)(n,t)}}(n),hasCustomColors:function(n){return function(){return ev(n)}}(n),getColors:function(n){return function(){return ov(n)}}(n),getColorCols:function(n){return function(){return lv.getColorCols(n)}}(n)}}function BC(e){return function(n){return on.from(n.getParam("style_formats")).filter(fn)}(e).map(function(n){var t=function(t,n){function e(n){bn(n,function(n){t.formatter.has(n.name)||t.formatter.register(n.name,n.format)})}var o=fT(n);return t.formatter?e(o.customFormats):t.on("init",function(){e(o.customFormats)}),o.formats}(e,n);return function(n){return n.getParam("style_formats_merge",!1,"boolean")}(e)?sT.concat(t):t}).getOr(sT)}function _C(n,t,e){var o={type:"formatter",isSelected:t(n.format),getStylePreview:e(n.format)};return Bn(n,o)}function DC(r,n,i,u){var o=function(n){return w(n,function(n){var t=xn(n);if($(n,"items")){var e=o(n.items);return Bn(function(n){var t={type:"submenu",isSelected:nn(!1),getStylePreview:function(){return on.none()}};return Bn(n,t)}(n),{getStyleItems:function(){return e}})}return $(n,"format")?function(n){return _C(n,i,u)}(n):1===t.length&&vn(t,"title")?Bn(n,{type:"separator"}):function(n){var t=Mr(n.title),e={type:"formatter",format:t,isSelected:i(t),getStylePreview:u(t)},o=Bn(n,e);return r.formatter.register(t,o),o}(n)})};return o(n)}function AC(t){return function(n){if(n&&1===n.nodeType){if(n.contentEditable===t)return!0;if(n.getAttribute("data-mce-contenteditable")===t)return!0}return!1}}function FC(n,t,e,o,r){return{type:n,title:t,url:e,level:o,attach:r}}function MC(n){return n.innerText||n.textContent}function IC(n){return function(n){return n&&"A"===n.nodeName&&(n.id||n.name)!==undefined}(n)&&gT(n)}function RC(n){return n&&/^(H[1-6])$/.test(n.nodeName)}function VC(n){return RC(n)&&gT(n)}function NC(n){var t=function(n){return n.id?n.id:Mr("h")}(n);return FC("header",MC(n),"#"+t,function(n){return RC(n)?parseInt(n.nodeName.substr(1),10):0}(n),function(){n.id=t})}function HC(n){var t=n.id||n.name,e=MC(n);return FC("anchor",e||"#"+t,"#"+t,0,Z)}function PC(n){return function(n,t){return w(Bc(Te.fromDom(t),n),function(n){return n.dom()})}("h1,h2,h3,h4,h5,h6,a:not([href])",n)}function zC(n){return 0<lT(n.title).length}function LC(n){return cn(n)&&/^https?/.test(n)}function jC(n){return sn(n)&&function(n,t){for(var e=xn(n),o=0,r=e.length;o<r;o++){var i=e[o],u=n[i];if(t(u,i,n))return on.some(u)}return on.none()}(n,function(n){return!function(n){return fn(n)&&n.length<=5&&B(n,LC)}(n)}).isNone()}function UC(){var n,t=M.localStorage.getItem(hT);if(null===t)return{};try{n=JSON.parse(t)}catch(e){if(e instanceof SyntaxError)return M.console.log("Local storage "+hT+" was not valid JSON",e),{};throw e}return jC(n)?n:(M.console.log("Local storage "+hT+" was not valid format",n),{})}function WC(n){var t=UC();return Object.prototype.hasOwnProperty.call(t,n)?t[n]:[]}function GC(t,n){if(LC(t)){var e=UC(),o=Object.prototype.hasOwnProperty.call(e,n)?e[n]:[],r=S(o,function(n){return n!==t});e[n]=[t].concat(r).slice(0,5),function(n){if(!jC(n))throw new Error("Bad format for history:\n"+JSON.stringify(n));M.localStorage.setItem(hT,JSON.stringify(n))}(e)}}function XC(n){return!!n}function YC(n){return N(qk.makeMap(n,/[, ]/),XC)}function qC(n,t,e){var o=function(n,t){return vT.call(n,t)?on.some(n[t]):on.none()}(n,t).getOr(e);return cn(o)?on.some(o):on.none()}function KC(n){return on.some(n.file_picker_callback).filter(dn)}function JC(n,t){var e=function(n){var t=on.some(n.file_picker_types).filter(XC),e=on.some(n.file_browser_callback_types).filter(XC),o=t.or(e).map(YC);return KC(n).fold(function(){return!1},function(n){return o.fold(function(){return!0},function(n){return 0<xn(n).length&&n})})}(n);return ln(e)?e?KC(n):on.none():e[t]?KC(n):on.none()}function $C(t){return{getHistory:WC,addToHistory:GC,getLinkInformation:function(){return function(n){return!1===n.settings.typeahead_urls?on.none():on.some({targets:pT(n.getBody()),anchorTop:qC(n.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:qC(n.settings,"anchor_bottom","#bottom").getOrUndefined()})}(t)},getValidationHandler:function(){return function(n){return on.from(n.settings.file_picker_validator_handler).filter(dn).orThunk(function(){return on.from(n.settings.filepicker_validator_handler).filter(dn)})}(t)},getUrlPicker:function(n){return function(r,i){return JC(r.settings,i).map(function(o){return function(t){return Xb(function(e){var n=qk.extend({filetype:i},on.from(t.meta).getOr({}));o.call(r,function(n,t){if(!cn(n))throw new Error("Expected value to be string");if(t!==undefined&&!sn(t))throw new Error("Expected meta to be a object");e({value:n,meta:t})},t.value,n)})}})}(t,n)}}}function QC(n,t,e,o){var r={shared:{providers:{icons:function(){return t.ui.registry.getAll().icons},menuItems:function(){return t.ui.registry.getAll().menuItems},translate:Dp.translate},interpreter:function(n){return function(n,t){return uT(iT,n,t)}(n,r)},anchors:cT(t,e,o),getSink:function(){return an.value(n)}},urlinput:$C(t),styleselect:function(e){function o(n){return function(){return e.formatter.match(n)}}function r(t){return function(){var n=e.formatter.get(t);return n!==undefined?on.some({tag:0<n.length&&(n[0].inline||n[0].block)||"div",styleAttr:e.formatter.getCssText(t)}):on.none()}}var i=function(n){var t=n.items;return t!==undefined&&0<t.length?E(t,i):[n.format]},u=Ce([]),a=Ce([]),c=Ce([]),s=Ce([]),f=Ce(!1);e.on("init",function(){var n=BC(e),t=DC(e,n,o,r);u.set(t),a.set(E(t,i))}),e.on("addStyleModifications",function(n){var t=DC(e,n.items,o,r);c.set(t),f.set(n.replace),s.set(E(t,i))});return{getData:function(){var n=f.get()?[]:u.get(),t=c.get();return n.concat(t)},getFlattenedKeys:function(){var n=f.get()?[]:a.get(),t=s.get();return n.concat(t)}}}(t),colorinput:EC(t),dialog:function(n){return{isDraggableModal:function(n){return function(){return function(n){return n.getParam("draggable_modal",!1,"boolean")}(n)}}(n)}}(t)};return r}function ZC(n,t,o){var e=function(n,e){return C(n,function(t,n){return e(n,t.len).fold(nn(t),function(n){return{len:n.finish(),list:t.list.concat([n])}})},{len:0,list:[]}).list}(n,function(n,t){var e=o(n);return on.some({element:nn(n),start:nn(t),finish:nn(t+e),width:nn(e)})}),r=S(e,function(n){return n.finish()<=t}),i=k(r,function(n,t){return n+t.width()},0),u=e.slice(r.length);return{within:nn(r),extra:nn(u),withinWidth:nn(i)}}function nO(n){return w(n,function(n){return n.element()})}function tO(n,t,e,o){var r=function(n,t,e){var o=ZC(t,n,e);return 0===o.extra().length?on.some(o):on.none()}(n,t,e).getOrThunk(function(){return ZC(t,n-e(o),e)}),i=r.within(),u=r.extra(),a=r.withinWidth();return 1===u.length&&u[0].width()<=e(o)?function(n,t,e){var o=nO(n.concat(t));return wT(o,[],e)}(i,u,a):1<=u.length?function(n,t,e,o){var r=nO(n).concat([e]);return wT(r,nO(t),o)}(i,u,o,a):function(n,t,e){return wT(nO(n),[],e)}(i,0,a)}function eO(n,t){var e=w(t,function(n){return du(n)});xT.setGroups(n,e)}function oO(n,t,e,o){var r=Os(n,t,"primary"),i=Cs(n,t,"overflow-button"),u=Fb.getCoupled(n,"overflowGroup");ui(r.element(),"visibility","hidden");var a=function(n,t){return n.bind(function(t){return pl(t.element()).bind(function(n){return t.getSystem().getByDom(n).toOption()})}).orThunk(function(){return t.filter(Xm.isFocused)})}(e,i);e.each(function(n){xT.setGroups(n,[])});var c=t.builtGroups.get();eO(r,c.concat([u]));var s=oa(r.element()),f=tO(s,c,function(n){return oa(n.element())},u);0===f.extra().length?(Im.remove(r,u),e.each(function(n){xT.setGroups(n,[])})):(eO(r,f.within()),e.each(function(n){eO(n,f.extra())})),li(r.element(),"visibility"),di(r.element()),e.each(function(t){i.each(function(n){return Qm.set(n,o(t))}),a.each(Xm.focus)})}function rO(o,n,t,e,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:n,behaviours:ls(o.splitToolbarBehaviours,[Fb.config({others:I(I({},r.coupling),{overflowGroup:function(t){return CT.sketch(I(I({},e["overflow-group"]()),{items:[vg.sketch(I(I({},e["overflow-button"]()),{action:function(n){Wt(t,i)}}))]}))}})}),Td("toolbar-toggle-events",[Zo(i,function(n){r.toggleToolbar(n,o,e)})])]),apis:{setGroups:function(n,t){!function(n,t){var e=w(t,n.getSystem().build);o.builtGroups.set(e)}(n,t),r.refresh(n,o)},refresh:function(n){r.refresh(n,o)},getMoreButton:function(n){return function(n){return Cs(n,o,"overflow-button")}(n)},getOverflow:function(n){return function(n){return r.getOverflow(n)}(n)},toggle:function(n){r.toggleToolbar(n,o,e)}},domModification:{attributes:{role:"group"}}}}function iO(n,t,e){var o=Fb.getCoupled(n,"sandbox");hf.isOpen(o)?hf.close(o):hf.open(o,e.overflow())}function uO(n){return n.getSystem().isConnected()}function aO(o,r){var n=hf.getState(Fb.getCoupled(o,"sandbox"));oO(o,r,n,uO),n.each(function(n){var t=r.lazySink(o).getOrDie(),e=r.getAnchor(o);uf.position(t,e,n)})}function cO(t,n){return n.getAnimationRoot.fold(function(){return t.element()},function(n){return n(t)})}function sO(n){return n.dimension.property}function fO(n,t){return n.dimension.getDimension(t)}function lO(n,t){var e=cO(n,t);ei(e,[t.shrinkingClass,t.growingClass])}function dO(n,t){Zr(n.element(),t.openClass),$r(n.element(),t.closedClass),ui(n.element(),sO(t),"0px"),di(n.element())}function mO(n,t){Zr(n.element(),t.closedClass),$r(n.element(),t.openClass),li(n.element(),sO(t))}function gO(n,t,e,o){e.setCollapsed(),ui(n.element(),sO(t),fO(t,n.element())),di(n.element()),lO(n,t),dO(n,t),t.onStartShrink(n),t.onShrunk(n)}function pO(n,t,e,o){var r=o.getOrThunk(function(){return fO(t,n.element())});e.setCollapsed(),ui(n.element(),sO(t),r),di(n.element());var i=cO(n,t);Zr(i,t.growingClass),$r(i,t.shrinkingClass),dO(n,t),t.onStartShrink(n)}function hO(n,t,e){var o=fO(t,n.element());("0px"===o?gO:pO)(n,t,e,on.some(o))}function vO(n,t,e){var o=cO(n,t),r=ni(o,t.shrinkingClass),i=fO(t,n.element());mO(n,t);var u=fO(t,n.element());(r?function(){ui(n.element(),sO(t),i),di(n.element())}:function(){dO(n,t)})(),Zr(o,t.shrinkingClass),$r(o,t.growingClass),mO(n,t),ui(n.element(),sO(t),u),e.setExpanded(),t.onStartGrow(n)}function bO(n,t,e){var o=cO(n,t);return!0===ni(o,t.growingClass)}function yO(n,t,e){var o=cO(n,t);return!0===ni(o,t.shrinkingClass)}function xO(t,e){Cs(t,e,"overflow").each(function(n){RT(t,e),FT.toggleGrow(n)})}function wO(n){return FT.hasGrown(n)}function SO(n,t){var e=n.outerContainer;!function(n,t){var e=n.outerContainer.element();t&&(n.mothership.broadcastOn([vf()],{target:e}),n.uiMothership.broadcastOn([vf()],{target:e})),n.mothership.broadcastOn([NT],{readonly:t}),n.uiMothership.broadcastOn([NT],{readonly:t})}(n,t),Pt("*",e.element()).forEach(function(n){e.getSystem().getByDom(n).each(function(n){n.hasConfigured(qp)&&qp.set(n,t)})})}function kO(n,t){n.on("init",function(){n.readonly&&SO(t,!0)}),n.on("SwitchMode",function(){return SO(t,n.readonly)}),function(n){return n.getParam("readonly",!1,"boolean")}(n)&&n.setMode("readonly")}function CO(e){var n;return Ku.config({channels:(n={},n[NT]={schema:HT,onReceive:function(n,t){e(n).each(function(n){!function(t,e){Pt("*",t.element()).forEach(function(n){t.getSystem().getByDom(n).each(function(n){n.hasConfigured(qp)&&qp.set(n,e)})})}(n,t.readonly)})}},n)})}function OO(n){var t=n.title.fold(function(){return{}},function(n){return{attributes:{title:n}}});return{dom:I({tag:"div",classes:["tox-toolbar__group"]},t),components:[CT.parts().items({})],items:n.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])"},tgroupBehaviours:Du([Zx.config({}),Xm.config({})])}}function TO(n){return CT.sketch(OO(n))}function EO(e,n,t){var o=Pi(function(n){var t=w(e.initGroups,TO);xT.setGroups(n,t)});return Du([Fm.config({mode:n,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Td("toolbar-events",[o]),CO(t)])}function BO(n,t){var e=n.cyclicKeying?"cyclic":"acyclic";return{uid:n.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":OO({title:on.none(),items:[]}),"overflow-button":xk({name:"more",icon:on.some("more-drawer"),disabled:!1,tooltip:on.some("More..."),primary:!1,borderless:!1},on.none(),n.backstage.shared.providers)},splitToolbarBehaviours:EO(n,e,t)}}function _O(n){var t=BO(n,BT.getOverflow),e=BT.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return BT.sketch(I(I({},t),{lazySink:n.getSink,getAnchor:function(){return n.backstage.shared.anchors.toolbarOverflow()},parts:I(I({},t.parts),{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"]}}}),components:[e],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))}function DO(n){var t=VT.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=VT.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),o=BO(n,VT.getOverflow);return VT.sketch(I(I({},o),{components:[t,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"}}))}function AO(n){var t=n.cyclicKeying?"cyclic":"acyclic";return xT.sketch({uid:n.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[xT.parts().groups({})],toolbarBehaviours:EO(n,t,nn(on.none()))})}function FO(n){return nt("toolbarbutton",zT,n)}function MO(n){return nt("menubutton",jT,n)}function IO(n){return nt("ToggleButton",GT,n)}function RO(t){return{isDisabled:function(){return qp.isDisabled(t)},setDisabled:function(n){return qp.set(t,n)}}}function VO(t){return{setActive:function(n){Qm.set(t,n)},isActive:function(){return Qm.isOn(t)},isDisabled:function(){return qp.isDisabled(t)},setDisabled:function(n){return qp.set(t,n)}}}function NO(n,t){return n.map(function(n){return{"aria-label":t.translate(n),title:t.translate(n)}}).getOr({})}function HO(t,e,n,o,r,i){function u(n){return Dp.isRtl()&&vn(lE,n)?n+"-rtl":n}var a,c=Dp.isRtl()&&t.exists(function(n){return vn(dE,n)});return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]).concat(c?["tox-tbtn__icon-rtl"]:[]),attributes:NO(n,i)},components:Zp([t.map(function(n){return dk(u(n),i.icons)}),e.map(function(n){return gk(n,"tox-tbtn",i)})]),eventOrder:(a={},a[oo()]=["focusing","alloy.base.behaviour","common-button-display-events"],a),buttonBehaviours:Du([Td("common-button-display-events",[Zo(oo(),function(n,t){t.event().prevent(),Wt(n,fE)})])].concat(o.map(function(n){return rE.config({channel:n,initialData:{icon:t,text:e},renderComponents:function(n,t){return Zp([n.icon.map(function(n){return dk(u(n),i.icons)}),n.text.map(function(n){return gk(n,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}}function PO(n,t,e){var o=Ce(Z),r=HO(n.icon,n.text,n.tooltip,on.none(),on.none(),e);return vg.sketch({dom:r.dom,components:r.components,eventOrder:Ik,buttonBehaviours:Du([Td("toolbar-button-events",[function(e){return ji(function(t,n){$g(e,t)(function(n){Gt(t,Mk,{buttonApi:n}),e.onAction(n)})})}({onAction:n.onAction,getApi:t.getApi}),Qg(t,o),Zg(t,o)]),Qp(n.disabled)].concat(t.toolbarButtonBehaviours))})}function zO(t,n){function e(e){return{isDisabled:function(){return qp.isDisabled(e)},setDisabled:function(n){return qp.set(e,n)},setIconFill:function(n,t){ki(e.element(),'svg path[id="'+n+'"], rect[id="'+n+'"]').each(function(n){Or(n,"fill",t)})},setIconStroke:function(n,t){ki(e.element(),'svg path[id="'+n+'"], rect[id="'+n+'"]').each(function(n){Or(n,"stroke",t)})},setActive:function(t){Or(e.element(),"aria-pressed",t),ki(e.element(),"span").each(function(n){e.getSystem().getByDom(n).each(function(n){return Qm.set(n,t)})})},isActive:function(){return ki(e.element(),"span").exists(function(n){return e.getSystem().getByDom(n).exists(Qm.isOn)})}}}var o,r=Mr("channel-update-split-dropdown-display"),i=Ce(Z),u={getApi:e,onSetup:t.onSetup};return sE.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:_n({"aria-pressed":!1},NO(t.tooltip,n.providers))},onExecute:function(n){t.onAction(e(n))},onItemExecute:function(n,t,e){},splitDropdownBehaviours:Du([$p(!1),Td("split-dropdown-events",[Zo(fE,Xm.focus),Qg(u,i),Zg(u,i)])]),eventOrder:(o={},o[Mo()]=["alloy.base.behaviour","split-dropdown-events"],o),toggleClass:"tox-tbtn--enabled",lazySink:n.getSink,fetch:function(e,r,o){return function(t){return Xb(function(n){return r.fetch(n)}).map(function(n){return on.from(Bv(Bn(Jh(Mr("menu-value"),n,function(n){r.onItemAction(e(t),n)},r.columns,r.presets,rh.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),o),{movement:$h(r.columns,r.presets),menuBehaviours:Sp("auto"!==r.columns?[]:[Pi(function(o,n){Ag(o,4,Rg(r.presets)).each(function(n){var t=n.numRows,e=n.numColumns;Fm.setGridSize(o,t,e)})})])})))})}}(e,t,n.providers),parts:{menu:Xh(0,t.columns,t.presets)},components:[sE.parts().button(HO(t.icon,t.text,on.none(),on.some(r),on.some([Qm.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),n.providers)),sE.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:zd("chevron-down",n.providers.icons)}}),sE.parts()["aria-descriptor"]({text:n.providers.translate("To open the popup, press Shift+Enter")})]})}function LO(o,r){return Zo(Mk,function(n,t){var e=function(n){return{hide:function(){return Wt(n,Bo())},getValue:function(){return jm.getValue(n)}}}(o.get(n));r.onAction(e,t.event().buttonApi())})}function jO(n,t,e){var o={backstage:{shared:{providers:e}}};return"contextformtogglebutton"===t.type?function(n,t,e){var o=t.original,r=(o.primary,a(o,["primary"])),i=tt(IO(I(I({},r),{type:"togglebutton",onAction:function(){}})));return gE(i,e.backstage.shared.providers,[LO(n,t)])}(n,t,o):function(n,t,e){var o=t.original,r=(o.primary,a(o,["primary"])),i=tt(FO(I(I({},r),{type:"button",onAction:function(){}})));return mE(i,e.backstage.shared.providers,[LO(n,t)])}(n,t,o)}function UO(n,t,e){var o=Math.max(t.left(),e.x()),r=e.right()-o,i=M.window.innerWidth-(o-t.left());return{x:o,width:Math.min(r,i)}}function WO(t,n){return Bi(n,function(n){return n.predicate(t.dom())?on.some({toolbarApi:n,elem:t}):on.none()})}function GO(o,r){return function(t){function n(){t.setActive(o.formatter.match(r));var n=o.formatter.formatChanged(r,t.setActive).unbind;e.set(on.some(n))}var e=Ce(on.none());return o.initialized?n():o.on("init",n),function(){return e.get().each(function(n){return n()})}}}function XO(t){return function(n){return function(){t.undoManager.transact(function(){t.focus(),t.execCommand("mceToggleFormat",!1,n.format)})}}}function YO(n,t,e){var o=e.dataset,r="basic"===o.type?function(){return w(o.data,function(n){return _C(n,e.isSelectedFor,e.getPreviewFor)})}:o.getData;return{items:function(n,u,a){function r(n,t,e,o){var r=u.shared.providers.translate(n.title);if("separator"===n.type)return on.some({type:"separator",text:r});if("submenu"!==n.type)return on.some(I({type:"togglemenuitem",text:r,active:n.isSelected(o),disabled:e,onAction:a.onAction(n)},n.getStylePreview().fold(function(){return{}},function(n){return{meta:{style:n}}})));var i=E(n.getStyleItems(),function(n){return c(n,t,o)});return 0===t&&i.length<=0?on.none():on.some({type:"nestedmenuitem",text:r,disabled:i.length<=0,getSubmenuItems:function(){return E(n.getStyleItems(),function(n){return c(n,t,o)})}})}function i(n){var t=a.getCurrentValue(),e=a.shouldHide?0:1;return E(n,function(n){return c(n,e,t)})}var c=function(n,t,e){var o="formatter"===n.type&&a.isInvalid(n);return 0===t?o?[]:r(n,t,!1,e).toArray():r(n,t,o,e).toArray()};return{validateItems:i,getFetch:function(o,r){return function(n){var t=r(),e=i(t);n(gy(e,rh.CLOSE_ON_EXECUTE,o))}}}}(0,t,e),getStyleItems:r}}function qO(o,n,t){var e=YO(0,n,t),r=e.items,i=e.getStyleItems;return pk({text:t.icon.isSome()?on.none():on.some(""),icon:t.icon,tooltip:on.from(t.tooltip),role:on.none(),fetch:r.getFetch(n,i),onSetup:function(e){return t.setInitialValue.each(function(n){return n(e.getComponent())}),t.nodeChangeHandler.map(function(n){var t=n(e.getComponent());return o.on("NodeChange",t),function(){o.off("NodeChange",t)}}).getOr(Z)},getApi:function(n){return{getComponent:function(){return n}}},columns:1,presets:"normal",classes:t.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",n.shared)}var KO,JO,$O,QO,ZO=Jf({name:"HtmlSelect",configFields:[at("options"),ss("selectBehaviours",[Xm,jm]),wt("selectClasses",[]),wt("selectAttributes",{}),pt("data")],factory:function(e,n){var t=w(e.options,function(n){return{dom:{tag:"option",value:n.value,innerHtml:n.text}}}),o=e.data.map(function(n){return q("initialValue",n)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:t,behaviours:ls(e.selectBehaviours,[Xm.config({}),jm.config({store:I({mode:"manual",getValue:function(n){return mi(n.element())},setValue:function(n,t){O(e.options,function(n){return n.value===t}).isSome()&&gi(n.element(),t)}},o)})])}}}),nT=function(i){return I(I({},i),{toCached:function(){return nT(i.toCached())},bindFuture:function(t){return nT(i.bind(function(n){return n.fold(function(n){return Yb(an.error(n))},function(n){return t(n)})}))},bindResult:function(t){return nT(i.map(function(n){return n.bind(t)}))},mapResult:function(t){return nT(i.map(function(n){return n.map(t)}))},mapError:function(t){return nT(i.map(function(n){return n.mapError(t)}))},foldResult:function(t,e){return i.map(function(n){return n.fold(t,e)})},withTimeout:function(n,r){return nT(Xb(function(t){var e=!1,o=M.setTimeout(function(){e=!0,t(an.error(r()))},n);i.get(function(n){e||(M.clearTimeout(o),t(n))})}))}})},tT=uC,eT={type:"separator"},oT=Mr("aria-invalid"),rT={bar:gC(function(n,t){return function(n,t){return{dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:w(n.items,t.interpreter)}}(n,t.shared)}),collection:gC(function(n,t){return mC(n,t.shared.providers)}),alloy:gC(f),alertbanner:gC(function(n,t){return function(t,n){return ab.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in","tox-notification--"+t.level]},components:[{dom:{tag:"div",classes:["tox-notification__icon"]},components:[vg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:zd(t.icon,n.icons),attributes:{title:n.translate(t.iconTooltip)}},action:function(n){Gt(n,wb,{name:"alert-banner",value:t.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:n.translate(t.text)}}]})}(n,t.shared.providers)}),input:gC(function(n,t){return function(n,t){return iC({name:n.name,multiline:!1,label:n.label,placeholder:n.placeholder,flex:!1,disabled:n.disabled,classname:"tox-textfield",validation:on.none(),maximized:n.maximized},t)}(n,t.shared.providers)}),textarea:gC(function(n,t){return function(n,t){return iC({name:n.name,multiline:!0,label:n.label,placeholder:n.placeholder,flex:!0,disabled:n.disabled,classname:"tox-textarea",validation:on.none(),maximized:n.maximized},t)}(n,t.shared.providers)}),listbox:gC(function(n,t){return function(n,t){var e=fy(n.label,t),o=_b.parts().field({factory:ZO,dom:{classes:["mce-select-field"]},selectBehaviours:Du([Zx.config({})]),options:n.values,data:n.initialValue.getOr(undefined)});return sy(on.some(e),o)}(n,t.shared.providers)}),label:gC(function(n,t){return function(n,t){var e={dom:{tag:"label",innerHtml:t.providers.translate(n.label),classes:["tox-label"]}},o=w(n.items,t.interpreter);return{dom:{tag:"div",classes:["tox-form__group"]},components:[e].concat(o),behaviours:Du([eS(),Im.config({}),fS(on.none()),Fm.config({mode:"acyclic"})])}}(n,t.shared)}),iframe:(KO=function(n,t){return Mx(n,t.shared.providers)},function(n,t,e){var o=Bn(t,{source:"dynamic"});return gC(KO)(n,o,e)}),autocomplete:gC(function(n,t){return function(r,i){var n=fy(r.label.getOr("?"),i.shared.providers),t=_b.parts().field({factory:zx,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(n){var t=jm.getValue(n),e=r.getItems(t),o=gy(e,rh.BUBBLE_TO_SANDBOX,i);return Yb(o)},markers:{openClass:"dog"},lazySink:i.shared.getSink,parts:{menu:Xh(0,0,"normal")}});return sy(on.some(n),t)}(n,t)}),button:gC(function(n,t){return function(n,t){var e=Ck(n.name,"custom");return sy(on.none(),_b.parts().field(I({factory:vg},Sk(n,on.some(e),t,[lS(""),eS()]))))}(n,t.shared.providers)}),checkbox:gC(function(n,t){return function(e,t){function n(n){return n.element().dom().click(),on.some(!0)}function o(n){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+n],innerHtml:zd("checked"===n?"selected":"unselected",t.icons)}}}var r=jm.config({store:{mode:"manual",getValue:function(n){return n.element().dom().checked},setValue:function(n,t){n.element().dom().checked=t}}}),i=_b.parts().field({factory:{sketch:f},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:Du([eS(),qp.config({disabled:e.disabled}),Zx.config({}),Xm.config({}),r,Fm.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),Td("checkbox-events",[Zo(go(),function(n,t){Gt(n,bb,{name:e.name})})])])}),u=_b.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:t.translate(e.label)},behaviours:Du([ow.config({})])}),a=Hd({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[o("checked"),o("unchecked")]});return _b.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[i,a.asSpec(),u],fieldBehaviours:Du([qp.config({disabled:e.disabled,disableClass:"tox-checkbox--disabled",onDisabled:function(n){_b.getField(n).each(qp.disable)},onEnabled:function(n){_b.getField(n).each(qp.enable)}})])})}(n,t.shared.providers)}),colorinput:gC(function(n,t){return xy(n,t.shared,t.colorinput)}),colorpicker:gC(function(n){function t(n){return"tox-"+n}var e=tS(Ex,t),r=Hd(e.sketch({dom:{tag:"div",classes:[t("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(n){Gt(n,wb,{name:"hex-valid",value:!0})},onInvalidHex:function(n){Gt(n,wb,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:Du([jm.config({store:{mode:"manual",getValue:function(n){var t=r.get(n);return Ol.getCurrent(t).bind(function(n){return jm.getValue(n).hex}).map(function(n){return"#"+n}).getOr("")},setValue:function(n,t){var e=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t),o=r.get(n);Ol.getCurrent(o).fold(function(){M.console.log("Can not find form")},function(n){jm.setValue(n,{hex:on.from(e[1]).getOr("")}),qw.getField(n,"hex").each(function(n){Wt(n,mo())})})}}}),eS()])}}),dropzone:gC(function(n,t){return Dx(n,t.shared.providers)}),grid:gC(function(n,t){return function(n,t){return{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+n.columns+"col"]},components:w(n.items,t.interpreter)}}(n,t.shared)}),selectbox:gC(function(n,t){return function(e,t){var n=w(e.items,function(n){return{text:t.translate(n.text),value:n.value}}),o=e.label.map(function(n){return fy(n,t)}),r=_b.parts().field({dom:{},selectAttributes:{size:e.size},options:n,factory:ZO,selectBehaviours:Du([qp.config({disabled:e.disabled}),Zx.config({}),Td("selectbox-change",[Zo(go(),function(n,t){Gt(n,bb,{name:e.name})})])])}),i=1<e.size?on.none():on.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:zd("chevron-down",t.icons)}}),u={dom:{tag:"div",classes:["tox-selectfield"]},components:R([[r],i.toArray()])};return _b.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:R([o.toArray(),[u]]),fieldBehaviours:Du([qp.config({disabled:e.disabled,onDisabled:function(n){_b.getField(n).each(qp.disable)},onEnabled:function(n){_b.getField(n).each(qp.enable)}})])})}(n,t.shared.providers)}),sizeinput:gC(function(n,t){return Ak(n,t.shared.providers)}),urlinput:gC(function(n,t){return dC(n,t,t.urlinput)}),customeditor:gC(function(e){var o=Ce(on.none()),t=Hd({dom:{tag:e.tag}}),r=Ce(on.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:Du([Td("editor-foo-events",[Pi(function(n){t.getOpt(n).each(function(t){(!function(n){return Object.prototype.hasOwnProperty.call(n,"init")}(e)?uS.load(e.scriptId,e.scriptUrl).then(function(n){return n(t.element().dom(),e.settings)}):e.init(t.element().dom())).then(function(t){r.get().each(function(n){t.setValue(n)}),r.set(on.none()),o.set(on.some(t))})})})]),jm.config({store:{mode:"manual",getValue:function(){return o.get().fold(function(){return r.get().getOr("")},function(n){return n.getValue()})},setValue:function(n,t){o.get().fold(function(){r.set(on.some(t))},function(n){return n.setValue(t)})}}}),eS()]),components:[t.asSpec()]}}),htmlpanel:gC(function(n){return"presentation"===n.presets?ab.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:n.html}}):ab.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:n.html,attributes:{role:"document"}},containerBehaviours:Du([Zx.config({}),Xm.config({})])})}),imagetools:gC(function(n,t){return rC(n,t.shared.providers)}),table:gC(function(n,t){return function(n,t){function e(n){return{dom:{tag:"th",innerHtml:t.translate(n)}}}function o(n){return{dom:{tag:"td",innerHtml:t.translate(n)}}}function r(n){return{dom:{tag:"tr"},components:w(n,o)}}var i,u;return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(u=n.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:w(u,e)}]}),(i=n.cells,{dom:{tag:"tbody"},components:w(i,r)})],behaviours:Du([Zx.config({}),Xm.config({})])}}(n,t.shared.providers)}),panel:gC(function(n,t){return function(n,t){return{dom:{tag:"div",classes:n.classes},components:w(n.items,t.shared.interpreter)}}(n,t)})},iT={field:function(n,t){return t}},uT=function(t,e,o){return Vn(rT,e.type).fold(function(){return M.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(n){return n(t,e,o)})},aT={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},cT=function(n,t,e){function o(){return Te.fromDom(n.getBody())}var r=db(n);return{toolbar:function(n,t,e){return e?function(){return{anchor:"node",root:n(),node:on.from(n()),bubble:fa(-12,-12,aT),layouts:{onRtl:function(){return[kC]},onLtr:function(){return[CC]}}}}:function(){return{anchor:"hotspot",hotspot:t(),bubble:fa(-12,12,aT),layouts:{onRtl:function(){return[ba]},onLtr:function(){return[ya]}}}}}(o,t,r),toolbarOverflow:function(n){return function(){return{anchor:"hotspot",hotspot:n(),layouts:{onRtl:function(){return[ba]},onLtr:function(){return[ya]}}}}}(e),banner:function(n,t,e){return e?function(){return{anchor:"node",root:n(),node:on.from(n()),layouts:{onRtl:function(){return[OC]},onLtr:function(){return[OC]}}}}:function(){return{anchor:"hotspot",hotspot:t(),layouts:{onRtl:function(){return[ka]},onLtr:function(){return[ka]}}}}}(o,t,r),cursor:function(t,n){return function(){return{anchor:"selection",root:n(),getSelection:function(){var n=t.selection.getRng();return on.some(pc.range(Te.fromDom(n.startContainer),n.startOffset,Te.fromDom(n.endContainer),n.endOffset))}}}}(n,o),node:function(t){return function(n){return{anchor:"node",root:t(),node:n}}}(o)}},sT=[{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"}]}],fT=function(n){return C(n,function(n,t){if(function(n){return On(n,"items")}(t)){var e=fT(t.items);return{customFormats:n.customFormats.concat(e.customFormats),formats:n.formats.concat([{title:t.title,items:e.formats}])}}if(function(n){return On(n,"inline")}(t)||function(n){return On(n,"block")}(t)||function(n){return On(n,"selector")}(t)){var o="custom-"+t.title.toLowerCase();return{customFormats:n.customFormats.concat([{name:o,format:t}]),formats:n.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return I(I({},n),{formats:n.formats.concat(t)})},{customFormats:[],formats:[]})},lT=qk.trim,dT=AC("true"),mT=AC("false"),gT=function(n){return function(n){for(;n=n.parentNode;){var t=n.contentEditable;if(t&&"inherit"!==t)return dT(n)}return!1}(n)&&!mT(n)},pT=function(n){var t=PC(n);return S(function(n){return w(S(n,VC),NC)}(t).concat(function(n){return w(S(n,IC),HC)}(t)),zC)},hT="tinymce-url-history",vT=Object.prototype.hasOwnProperty,bT=nn([at("dom"),wt("shell",!0),ss("toolbarBehaviours",[Im])]),yT=nn([Uf({name:"groups",overrides:function(n){return{behaviours:Du([Im.config({})])}}})]),xT=$f({name:"Toolbar",configFields:bT(),partFields:yT(),factory:function(t,n,e,o){var r=function(n){return t.shell?on.some(n):Cs(n,t,"groups")},i=t.shell?{behaviours:[Im.config({})],components:[]}:{behaviours:[],components:n};return{uid:t.uid,dom:t.dom,components:i.components,behaviours:ls(t.toolbarBehaviours,i.behaviours),apis:{setGroups:function(n,t){r(n).fold(function(){throw M.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(n){Im.set(n,t)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(n,t,e){n.setGroups(t,e)}}}),wT=ur("within","extra","withinWidth"),ST=nn([at("items"),bu(["itemSelector"]),ss("tgroupBehaviours",[Fm])]),kT=nn([Wf({name:"items",unit:"item"})]),CT=$f({name:"ToolbarGroup",configFields:ST(),partFields:kT(),factory:function(n,t,e,o){return{uid:n.uid,dom:n.dom,components:t,behaviours:ls(n.tgroupBehaviours,[Fm.config({mode:"flow",selector:n.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),OT=nn([ss("splitToolbarBehaviours",[]),_t("builtGroups",function(){return Ce([])})]),TT=nn([bu(["overflowToggledClass"]),at("getAnchor"),at("lazySink")].concat(OT())),ET=nn([Lf({factory:xT,schema:bT(),name:"primary"}),jf({factory:xT,schema:bT(),name:"overflow",overrides:function(t){return{toolbarBehaviours:Du([Fm.config({mode:"cyclic",onEscape:function(n){return Cs(n,t,"overflow-button").each(Xm.focus),on.none()}})])}}}),jf({name:"overflow-button",overrides:function(n){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:Du([Qm.config({toggleClass:n.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),jf({name:"overflow-group"})]),BT=$f({name:"SplitFloatingToolbar",configFields:TT(),partFields:ET(),factory:function(t,n,e,o){return rO(t,n,0,o,{refresh:aO,toggleToolbar:iO,getOverflow:function(n){return hf.getState(Fb.getCoupled(n,"sandbox"))},coupling:{sandbox:function(n){return function(o,e){var r=Oi();return{dom:{tag:"div",attributes:{id:r.id()}},behaviours:Du([Fm.config({mode:"special",onEscape:function(n){return hf.close(n),on.some(!0)}}),hf.config({onOpen:function(n,t){aO(o,e),Cs(o,e,"overflow-button").each(function(n){Qm.on(n),r.link(n.element())}),Fm.focusIn(t)},onClose:function(){Cs(o,e,"overflow-button").each(function(n){Qm.off(n),Xm.focus(n),r.unlink(n.element())})},isPartOf:function(n,t,e){return mu(t,e)||mu(o,e)},getAttachPoint:function(){return e.lazySink(o).getOrDie()}})])}}(n,t)}}})},apis:{setGroups:function(n,t,e){n.setGroups(t,e)},refresh:function(n,t){n.refresh(t)},getMoreButton:function(n,t){return n.getMoreButton(t)},getOverflow:function(n,t){return n.getOverflow(t)},toggle:function(n,t){n.toggle(t)}}}),_T=/* */Object.freeze({refresh:function(n,t,e){if(e.isExpanded()){li(n.element(),sO(t));var o=fO(t,n.element());ui(n.element(),sO(t),o)}},grow:function(n,t,e){e.isExpanded()||vO(n,t,e)},shrink:function(n,t,e){e.isExpanded()&&hO(n,t,e)},immediateShrink:function(n,t,e){e.isExpanded()&&gO(n,t,e)},hasGrown:function(n,t,e){return e.isExpanded()},hasShrunk:function(n,t,e){return e.isCollapsed()},isGrowing:bO,isShrinking:yO,isTransitioning:function(n,t,e){return!0===bO(n,t)||!0===yO(n,t)},toggleGrow:function(n,t,e){(e.isExpanded()?hO:vO)(n,t,e)},disableTransitions:lO}),DT=/* */Object.freeze({exhibit:function(n,t){var e=t.expanded;return zr(e?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:q(t.dimension.property,"0px")})},events:function(e,o){return Jo([ir(ho(),function(n,t){t.event().raw().propertyName===e.dimension.property&&(lO(n,e),o.isExpanded()&&li(n.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(n))})])}}),AT=[at("closedClass"),at("openClass"),at("shrinkingClass"),at("growingClass"),pt("getAnimationRoot"),xu("onShrunk"),xu("onStartShrink"),xu("onGrown"),xu("onStartGrow"),wt("expanded",!1),ct("dimension",rt("property",{width:[Cu("property","width"),Cu("getDimension",function(n){return oa(n)+"px"})],height:[Cu("property","height"),Cu("getDimension",function(n){return ta(n)+"px"})]}))],FT=Au({fields:AT,name:"sliding",active:DT,apis:_T,state:/* */Object.freeze({init:function(n){var t=Ce(n.expanded);return iu({isExpanded:function(){return!0===t.get()},isCollapsed:function(){return!1===t.get()},setCollapsed:l(t.set,!1),setExpanded:l(t.set,!0),readState:function(){return"expanded: "+t.get()}})}})}),MT=nn([bu(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"])].concat(OT())),IT=nn([Lf({factory:xT,schema:bT(),name:"primary"}),Lf({factory:xT,schema:bT(),name:"overflow",overrides:function(t){return{toolbarBehaviours:Du([FT.config({dimension:{property:"height"},closedClass:t.markers.closedClass,openClass:t.markers.openClass,shrinkingClass:t.markers.shrinkingClass,growingClass:t.markers.growingClass,onShrunk:function(n){Cs(n,t,"overflow-button").each(function(n){Qm.off(n),Xm.focus(n)})},onGrown:function(n){Fm.focusIn(n)},onStartGrow:function(n){Cs(n,t,"overflow-button").each(Qm.on)}}),Fm.config({mode:"acyclic",onEscape:function(n){return Cs(n,t,"overflow-button").each(Xm.focus),on.some(!0)}})])}}}),jf({name:"overflow-button",overrides:function(n){return{buttonBehaviours:Du([Qm.config({toggleClass:n.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),jf({name:"overflow-group"})]),RT=function(n,t){var e=Cs(n,t,"overflow");oO(n,t,e,wO),e.each(FT.refresh)},VT=$f({name:"SplitSlidingToolbar",configFields:MT(),partFields:IT(),factory:function(t,n,e,o){return rO(t,n,0,o,{refresh:RT,toggleToolbar:xO,getOverflow:function(n){return Cs(n,t,"overflow")},coupling:{}})},apis:{setGroups:function(n,t,e){n.setGroups(t,e)},refresh:function(n,t){n.refresh(t)},getMoreButton:function(n,t){return n.getMoreButton(t)},getOverflow:function(n,t){return n.getOverflow(t)},toggle:function(n,t){n.toggle(t)}}}),NT="silver.readonly",HT=se([(JO="readonly",ct(JO,xe))]),PT=[Tt("disabled",!1),bt("tooltip"),bt("icon"),bt("text"),Et("onSetup",function(){return Z})],zT=se([st("type"),lt("onAction")].concat(PT)),LT=[bt("text"),bt("tooltip"),bt("icon"),lt("fetch"),Et("onSetup",function(){return Z})],jT=se(d([st("type")],LT)),UT=se([st("type"),bt("tooltip"),bt("icon"),bt("text"),yt("select"),lt("fetch"),Et("onSetup",function(){return Z}),Ot("presets","normal",["normal","color","listpreview"]),wt("columns",1),lt("onAction"),lt("onItemAction")]),WT=[Tt("active",!1)].concat(PT),GT=se(WT.concat([st("type"),lt("onAction")])),XT=[Et("predicate",function(){return!1}),Ot("scope","node",["node","editor"]),Ot("position","selection",["node","selection","line"])],YT=PT.concat([wt("type","contextformbutton"),wt("primary",!1),lt("onAction"),_t("original",f)]),qT=WT.concat([wt("type","contextformbutton"),wt("primary",!1),lt("onAction"),_t("original",f)]),KT=PT.concat([wt("type","contextformbutton")]),JT=WT.concat([wt("type","contextformtogglebutton")]),$T=rt("type",{contextformbutton:YT,contextformtogglebutton:qT}),QT=se([wt("type","contextform"),Et("initValue",function(){return""}),bt("label"),gt("commands",$T),ht("launch",rt("type",{contextformbutton:KT,contextformtogglebutton:JT}))].concat(XT)),ZT=se([wt("type","contexttoolbar"),st("items")].concat(XT)),nE=/* */Object.freeze({getState:function(n,t,e){return e}}),tE=/* */Object.freeze({events:function(r,i){function o(e,o){r.updateState.each(function(n){var t=n(e,o);i.set(t)}),r.renderComponents.each(function(n){var t=n(o,i.get());es(e),bn(t,function(n){Zc(e,e.getSystem().build(n))})})}return Jo([Zo(So(),function(n,t){var e=r.channel;vn(t.channels(),e)&&o(n,t.data())}),Pi(function(t,n){r.initialData.each(function(n){o(t,n)})})])}}),eE=/* */Object.freeze({init:function(n){var t=Ce(on.none());return{readState:function(){return t.get().fold(function(){return"none"},function(n){return n})},get:function(){return t.get()},set:function(n){return t.set(n)},clear:function(){return t.set(on.none())}}}}),oE=[at("channel"),pt("renderComponents"),pt("updateState"),pt("initialData")],rE=Au({fields:oE,name:"reflecting",active:tE,apis:nE,state:eE}),iE=nn([at("toggleClass"),at("fetch"),Su("onExecute"),wt("getHotspot",on.some),wt("getAnchorOverrides",nn({})),wt("layouts",on.none()),Su("onItemExecute"),pt("lazySink"),at("dom"),xu("onOpen"),ss("splitDropdownBehaviours",[Fb,Fm,Xm]),wt("matchWidth",!1),wt("useMinWidth",!1),wt("eventOrder",{}),pt("role")].concat(ay())),uE=Lf({factory:vg,schema:[at("dom")],name:"arrow",defaults:function(n){return{buttonBehaviours:Du([Xm.revoke()])}},overrides:function(t){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(n){n.getSystem().getByUid(t.uid).each(Xt)},buttonBehaviours:Du([Qm.config({toggleOnExecute:!1,toggleClass:t.toggleClass})])}}}),aE=Lf({factory:vg,schema:[at("dom")],name:"button",defaults:function(n){return{buttonBehaviours:Du([Xm.revoke()])}},overrides:function(e){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(e.uid).each(function(n){e.onExecute(n,t)})}}}}),cE=nn([uE,aE,Uf({factory:{sketch:function(n){return{uid:n.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:n.text}}}},schema:[at("text")],name:"aria-descriptor"}),jf({schema:[vu()],name:"menu",defaults:function(o){return{onExecute:function(t,e){t.getSystem().getByUid(o.uid).each(function(n){o.onItemExecute(n,t,e)})}}}}),Kb()]),sE=$f({name:"SplitDropdown",configFields:iE(),partFields:cE(),factory:function(o,n,t,e){function r(n){Ol.getCurrent(n).each(function(n){Ml.highlightFirst(n),Fm.focusIn(n)})}function i(n){Zb(o,function(n){return n},n,e,r,zb.HighlightFirst).get(Z)}function u(n){var t=Os(n,o,"button");return Xt(t),on.some(!0)}var a=_n(Jo([Pi(function(e,n){Cs(e,o,"aria-descriptor").each(function(n){var t=Mr("aria");Or(n.element(),"id",t),Or(e.element(),"aria-describedby",t)})})]),Nd(on.some(i)));return{uid:o.uid,dom:o.dom,components:n,eventOrder:I(I({},o.eventOrder),{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:ls(o.splitDropdownBehaviours,[Fb.config({others:{sandbox:function(n){var t=Os(n,o,"arrow");return ty(o,n,{onOpen:function(){Qm.on(t),Qm.on(n)},onClose:function(){Qm.off(t),Qm.off(n)}})}}}),Fm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(n){return i(n),on.some(!0)}}),Xm.config({}),Qm.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),fE=Mr("focus-button"),lE=["checklist","ordered-list"],dE=["indent","outdent","table-insert-column-after","table-insert-column-before","unordered-list"],mE=function(n,t,e){return PO(n,{toolbarButtonBehaviours:[].concat(0<e.length?[Td("toolbarButtonWith",e)]:[]),getApi:RO,onSetup:n.onSetup},t)},gE=function(n,t,e){return Bn(PO(n,{toolbarButtonBehaviours:[Im.config({}),Qm.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[Td("toolbarToggleButtonWith",e)]:[]),getApi:VO,onSetup:n.onSetup},t))},pE=function(n,t){var e=n.label.fold(function(){return{}},function(n){return{"aria-label":n}}),o=Hd(Gx.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:n.initValue(),inputAttributes:e,selectOnFocus:!0,inputBehaviours:Du([Fm.config({mode:"special",onEnter:function(n){return r.findPrimary(n).map(function(n){return Xt(n),!0})},onLeft:function(n,t){return t.cut(),on.none()},onRight:function(n,t){return t.cut(),on.none()}})])})),r=function(t,n,e){var o=w(n,function(n){return Hd(jO(t,n,e))});return{asSpecs:function(){return w(o,function(n){return n.asSpec()})},findPrimary:function(e){return Bi(n,function(n,t){return n.primary?on.from(o[t]).bind(function(n){return n.getOpt(e)}).filter(v(qp.isDisabled)):on.none()})}}}(o,n.commands,t.shared.providers);return AO({uid:Mr("context-toolbar"),initGroups:[{title:on.none(),items:[o.asSpec()]},{title:on.none(),items:r.asSpecs()}],onEscape:on.none,cyclicKeying:!0,backstage:t,getSink:function(){return an.error("")}})},hE=Mr("forward-slide"),vE=Mr("backward-slide"),bE=Mr("change-slide-event"),yE="tox-pop--resizing",xE=function(t,e){function n(n){return n.dom()===e.getBody()}var o=Te.fromDom(e.selection.getNode());return WO(o,t.inNodeScope).orThunk(function(){return WO(o,t.inEditorScope).orThunk(function(){return function(n,t,e){for(var o=n.dom(),r=dn(e)?e:nn(!1);o.parentNode;){o=o.parentNode;var i=Te.fromDom(o),u=t(i);if(u.isSome())return u;if(r(i))break}return on.none()}(o,function(n){return WO(n,t.inNodeScope)},n)})})},wE=function(e,r){function o(t,e){var o=tt(function(n){return nt("ContextForm",QT,n)}(e));(n[t]=o).launch.map(function(n){c["form:"+t]=I(I({},e.launch),{type:"contextformtogglebutton"===n.type?"togglebutton":"button",onAction:function(){r(o)}})}),"editor"===o.scope?a.push(o):u.push(o),s[t]=o}function i(t,e){(function(n){return nt("ContextToolbar",ZT,n)})(e).each(function(n){"editor"===e.scope?a.push(n):u.push(n),s[t]=n})}var n={},u=[],a=[],c={},s={},t=xn(e);return bn(t,function(n){var t=e[n];"contextform"===t.type?o(n,t):"contexttoolbar"===t.type&&i(n,t)}),{forms:n,inNodeScope:u,inEditorScope:a,lookupTable:s,formNavigators:c}};(QO=$O=$O||{})[QO.SemiColon=0]="SemiColon",QO[QO.Space=1]="Space";function SE(n,t,e,o){return{type:"basic",data:function(n){return w(n,function(n){var t=n,e=n,o=n.split("=");return 1<o.length&&(t=o[0],e=o[1]),{title:t,format:e}})}(function(n,t){return t===$O.SemiColon?n.replace(/;$/,"").split(";"):n.split(" ")}(Vn(n.settings,t).getOr(e),o))}}function kE(e){function t(n){var t=O(EB,function(n){return e.formatter.match(n.format)}).fold(function(){return"left"},function(n){return n.title.toLowerCase()});Gt(n,Vk,{icon:"align-"+t})}var n=on.some(function(n){return function(){return t(n)}}),o=on.some(function(n){return t(n)}),r=function(n){return{type:"basic",data:n}}(EB);return{tooltip:"Align",icon:on.some("align-left"),isSelectedFor:function(n){return function(){return e.formatter.match(n)}},getCurrentValue:nn(on.none()),getPreviewFor:function(n){return function(){return on.none()}},onAction:XO(e),setInitialValue:o,nodeChangeHandler:n,dataset:r,shouldHide:!1,isInvalid:function(n){return!e.formatter.canApply(n.format)}}}function CE(n){var t=n.split(/\s*,\s*/);return w(t,function(n){return n.replace(/^['"]+|['"]+$/g,"")})}function OE(r){function i(){function e(n){return n?CE(n)[0]:""}var n=r.queryCommandValue("FontName"),t=u.data,o=n?n.toLowerCase():"";return{matchOpt:O(t,function(n){var t=n.format;return t.toLowerCase()===o||e(t).toLowerCase()===e(o).toLowerCase()}).orThunk(function(){return function(n){var t;return 0===n.indexOf("-apple-system")&&(t=CE(n.toLowerCase()),B(BB,function(n){return-1<t.indexOf(n.toLowerCase())}))}(o)?on.from({title:"System Font",format:o}):on.none()}),font:n}}function t(n){var t=i(),e=t.matchOpt,o=t.font,r=e.fold(function(){return o},function(n){return n.title});Gt(n,Rk,{text:r})}var n=on.some(function(n){return function(){return t(n)}}),e=on.some(function(n){return t(n)}),u=SE(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",$O.SemiColon);return{tooltip:"Fonts",icon:on.none(),isSelectedFor:function(t){return function(n){return n.exists(function(n){return n.format===t})}},getCurrentValue:function(){return i().matchOpt},getPreviewFor:function(n){return function(){return on.some({tag:"div",styleAttr:-1===n.indexOf("dings")?"font-family:"+n:""})}},onAction:function(n){return function(){r.undoManager.transact(function(){r.focus(),r.execCommand("FontName",!1,n.format)})}},setInitialValue:e,nodeChangeHandler:n,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}}function TE(n,t){return/[0-9.]+px$/.test(n)?function(n,t){var e=Math.pow(10,t);return Math.round(n*e)/e}(72*parseInt(n,10)/96,t||0)+"pt":n}function EE(e){function i(){var o=on.none(),r=u.data,i=e.queryCommandValue("FontSize");if(i)for(var n=function(n){var t=TE(i,n),e=function(n){return P(_B,n).getOr("")}(t);o=O(r,function(n){return n.format===i||n.format===t||n.format===e})},t=3;o.isNone()&&0<=t;t--)n(t);return{matchOpt:o,px:i}}function t(n){var t=i(),e=t.matchOpt,o=t.px,r=e.fold(function(){return o},function(n){return n.title});Gt(n,Rk,{text:r})}var n=nn(nn(on.none())),o=on.some(function(n){return function(){return t(n)}}),r=on.some(function(n){return t(n)}),u=SE(e,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",$O.Space);return{tooltip:"Font sizes",icon:on.none(),isSelectedFor:function(t){return function(n){return n.exists(function(n){return n.format===t})}},getPreviewFor:n,getCurrentValue:function(){return i().matchOpt},onAction:function(n){return function(){e.undoManager.transact(function(){e.focus(),e.execCommand("FontSize",!1,n.format)})}},setInitialValue:r,nodeChangeHandler:o,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}}function BE(e,n,t){var o=n();return Bi(t,function(t){return O(o,function(n){return e.formatter.matchNode(t,n.format)})}).orThunk(function(){return e.formatter.match("p")?on.some({title:"Paragraph",format:"p"}):on.none()})}function _E(n){var t=n.selection.getStart(!0)||n.getBody();return n.dom.getParents(t,function(){return!0},n.getBody())}function DE(o){function e(n,t){var e=function(n){return BE(o,function(){return r.data},n)}(n).fold(function(){return"Paragraph"},function(n){return n.title});Gt(t,Rk,{text:e})}var n=on.some(function(t){return function(n){return e(n.parents,t)}}),t=on.some(function(n){var t=_E(o);e(t,n)}),r=SE(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",$O.SemiColon);return{tooltip:"Blocks",icon:on.none(),isSelectedFor:function(n){return function(){return o.formatter.match(n)}},getCurrentValue:nn(on.none()),getPreviewFor:function(t){return function(){var n=o.formatter.get(t);return on.some({tag:0<n.length&&(n[0].inline||n[0].block)||"div",styleAttr:o.formatter.getCssText(t)})}},onAction:XO(o),setInitialValue:t,nodeChangeHandler:n,dataset:r,shouldHide:!1,isInvalid:function(n){return!o.formatter.canApply(n.format)}}}function AE(i,n){function e(n,t){var e=function(n){var t=n.items;return t!==undefined&&0<t.length?E(t,e):[{title:n.title,format:n.format}]},o=E(BC(i),e),r=BE(i,function(){return o},n).fold(function(){return"Paragraph"},function(n){return n.title});Gt(t,Rk,{text:r})}var t=on.some(function(t){return function(n){return e(n.parents,t)}}),o=on.some(function(n){var t=_E(i);e(t,n)});return{tooltip:"Formats",icon:on.none(),isSelectedFor:function(n){return function(){return i.formatter.match(n)}},getCurrentValue:nn(on.none()),getPreviewFor:function(t){return function(){var n=i.formatter.get(t);return n!==undefined?on.some({tag:0<n.length&&(n[0].inline||n[0].block)||"div",styleAttr:i.formatter.getCssText(t)}):on.none()}},onAction:XO(i),setInitialValue:o,nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(n){return!i.formatter.canApply(n.format)},dataset:n}}function FE(o,r){return function(n,t){var e=o(n).mapError(function(n){return he(n)}).getOrDie();return r(e,t)}}function ME(n){var t=n.toolbar,e=n.buttons;return!1===t?[]:t===undefined||!0===t?function(e){var n=w(DB,function(n){var t=S(n.items,function(n){return On(e,n)||On(FB,n)});return{name:n.name,items:t}});return S(n,function(n){return 0<n.items.length})}(e):cn(t)?function(n){var t=n.split("|");return w(t,function(n){return{items:n.trim().split(" ")}})}(t):function(n){return h(n,function(n){return On(n,"name")&&On(n,"items")})}(t)?t:(M.console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])}function IE(t,e,o,r,n){return P(e,o.toLowerCase()).orThunk(function(){return n.bind(function(n){return Bi(n,function(n){return P(e,n+o.toLowerCase())})})}).fold(function(){return P(FB,o.toLowerCase()).map(function(n){return n(t,r)}).orThunk(function(){return on.none()})},function(n){return function(t,e){return P(AB,t.type).fold(function(){return M.console.error("skipping button defined by",t),on.none()},function(n){return on.some(n(t,e))})}(n,r)})}function RE(e,o,r,i){var n=ME(o),t=w(n,function(n){var t=E(n.items,function(n){return 0===n.trim().length?[]:IE(e,o.buttons,n,r,i).toArray()});return{title:on.from(e.translate(n.name)),items:t}});return S(t,function(n){return 0<n.items.length})}function VE(n){return"<alloy.field."+n+">"}function NE(n){return{element:function(){return n.element().dom()}}}function HE(e,o){var r=w(xn(o),function(n){var t=o[n],e=tt(function(n){return nt("sidebar",YB,n)}(t));return{name:n,getApi:NE,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return w(r,function(n){var t=Ce(Z);return e.slot(n.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Sp([Qg(n,t),Zg(n,t),Zo(No(),function(t,n){var e=n.event();O(r,function(n){return n.name===e.name()}).each(function(n){(e.visible()?n.onShow:n.onHide)(n.getApi(t))})})])})})}function PE(n,t){Ol.getCurrent(n).each(function(n){return Im.set(n,[function(t){return XB.sketch(function(n){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:HE(n,t),slotBehaviours:Sp([Pi(function(n){return XB.hideAllSlots(n)})])}})}(t)])})}function zE(n){return Ol.getCurrent(n).bind(function(n){return FT.isGrowing(n)||FT.hasGrown(n)?Ol.getCurrent(n).bind(function(t){return O(XB.getSlotNames(t),function(n){return XB.isShowing(t,n)})}):on.none()})}function LE(n,t,e){var o=n.element();!0===t?(Im.set(n,[function(n){return{dom:{tag:"div",attributes:{"aria-label":n.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:Ig('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:Du([Fm.config({mode:"special",onTab:function(){return on.some(!0)},onShiftTab:function(){return on.some(!0)}}),Xm.config({})])}}(e)]),li(o,"display"),_r(o,"aria-hidden")):(Im.set(n,[]),ui(o,"display","none"),Or(o,"aria-hidden","true"))}function jE(n){return"string"==typeof n?n.split(" "):n}function UE(e,o){var r=_n(o_,o.menus),t=0<xn(o.menus).length,n=o.menubar===undefined||!0===o.menubar?jE("file edit view insert format tools table help"):jE(!1===o.menubar?"":o.menubar),i=S(n,function(n){return t&&o.menus.hasOwnProperty(n)&&o.menus[n].hasOwnProperty("items")||o_.hasOwnProperty(n)}),u=w(i,function(n){var t=r[n];return function(n,e,t){var o=function(n){return n.getParam("removed_menuitems","")}(t).split(/[ ,]/);return{text:n.title,getItems:function(){return E(n.items,function(n){var t=n.toLowerCase();return 0===t.trim().length?[]:y(o,function(n){return n===t})?[]:"separator"===t||"|"===t?[{type:"separator"}]:e.menuItems[t]?[e.menuItems[t]]:[]})}}}({title:t.title,items:jE(t.items)},o,e)});return S(u,function(n){return 0<n.getItems().length&&y(n.getItems(),function(n){return"separator"!==n.type})})}function WE(n,t){var e,o=function(n){var t=n.settings,e=t.skin,o=t.skin_url;if(!1!==e){var r=e||"oxide";o=o?n.documentBaseURI.toAbsolute(o):cb.baseURL+"/skins/ui/"+r}return o}(t);o&&(e=o+"/skin.min.css",t.contentCSS.push(o+(n?"/content.inline":"/content")+".min.css")),!1===function(n){return!1===n.getParam("skin")}(t)&&e?uh.DOM.styleSheetLoader.load(e,r_(t)):r_(t)()}function GE(t,n,e,o){var r=n.outerContainer,i=e.toolbar,u=e.buttons;if(h(i,cn)){var a=i.map(function(n){return RE(t,{toolbar:n,buttons:u},{backstage:o},on.none())});e_.setToolbars(r,a)}else e_.setToolbar(r,RE(t,e,{backstage:o},on.none()))}function XE(e,t){return mr(e).orThunk(function(){var n=Te.fromTag("span");hr(e,n);var t=mr(n);return Wi(n),t}).map(function(n){return Iu(n).translate(-t.left(),-t.top())}).getOrThunk(function(){return Qu(0,0)})}function YE(t){return function(n){return n.translate(-t.left(),-t.top())}}function qE(t){return function(n){return n.translate(t.left(),t.top())}}function KE(e){return function(n,t){return C(e,function(n,t){return t(n)},Qu(n,t))}}function JE(n,t,e){return n.fold(KE([qE(e),YE(t)]),KE([YE(t)]),KE([]))}function $E(n,t,e){return n.fold(KE([qE(e)]),KE([]),KE([qE(t)]))}function QE(n,t,e){return n.fold(KE([]),KE([YE(e)]),KE([qE(t),YE(e)]))}function ZE(n,t,e){return n.fold(function(n,t){return{position:"absolute",left:n+"px",top:t+"px"}},function(n,t){return{position:"absolute",left:n-e.left()+"px",top:t-e.top()+"px"}},function(n,t){return{position:"fixed",left:n+"px",top:t+"px"}})}function nB(n,t){$r(n.element(),t.transitionClass),Zr(n.element(),t.fadeOutClass),$r(n.element(),t.fadeInClass)}function tB(n,t){$r(n.element(),t.transitionClass),Zr(n.element(),t.fadeInClass),$r(n.element(),t.fadeOutClass)}function eB(n,t){return n.y()>=t.y()&&n.bottom()<=t.bottom()}function oB(n,t){return Br(n,t)?on.some(parseInt(Er(n,t),10)):on.none()}function rB(t,e,o){return function(r,n){var t=r.element();return oB(t,n.leftAttr).bind(function(o){return oB(t,n.topAttr).map(function(n){var t=oa(r.element()),e=ta(r.element());return aa(o,n,t,e)})})}(t,e).bind(function(n){return eB(n,o)?(function(n,t){var e=n.element();_r(e,t.leftAttr),_r(e,t.topAttr)}(t,e),on.some(d_(n.x(),n.y()))):on.none()})}function iB(n,t,e,o,r){var i=Iu(n.element()),u=aa(i.left(),i.top(),oa(n.element()),ta(n.element()));if(eB(u,e))return on.none();!function(n,t,e,o){var r=n.element();Or(r,t.leftAttr,e),Or(r,t.topAttr,o)}(n,t,i.left(),i.top());var a=d_(i.left(),i.top()),c=JE(a,o,r),s=d_(e.x(),e.y()),f=JE(s,o,r),l=u.y()<=e.y()?f.top():f.top()+e.height()-u.height();return on.some(m_(c.left(),l))}function uB(e,n,t){var o=n.lazyViewport(e);n.contextual.each(function(t){t.lazyContext(e).each(function(n){(function(n,t){return n.y()<t.bottom()&&n.bottom()>t.y()}(ca(n),o)?nB:tB)(e,t)})});var r=fr(e.element()),i=ia(r),u=XE(e.element(),i);(function(n,t,e,o,r){return si(n.element(),"position").is("fixed")?rB(n,t,e):iB(n,t,e,o,r)})(e,n,o,i,u).each(function(n){var t=ZE(n,0,u);ai(e.element(),t)})}function aB(n,t){return function(){n.execCommand("mceToggleFormat",!1,t)}}function cB(n){!function(e){qk.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(n,t){e.ui.registry.addToggleButton(n.name,{tooltip:n.text,icon:n.icon,onSetup:GO(e,n.name),onAction:aB(e,n.name)})});for(var n=1;n<=6;n++){var t="h"+n;e.ui.registry.addToggleButton(t,{text:t.toUpperCase(),tooltip:"Heading "+n,onSetup:GO(e,t),onAction:aB(e,t)})}}(n),function(t){qk.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(n){t.ui.registry.addButton(n.name,{tooltip:n.text,icon:n.icon,onAction:function(){return t.execCommand(n.action)}})})}(n),function(t){qk.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],function(n){t.ui.registry.addToggleButton(n.name,{tooltip:n.text,icon:n.icon,onAction:function(){return t.execCommand(n.action)},onSetup:GO(t,n.name)})})}(n)}function sB(n,t,e){function o(){return!!t.undoManager&&t.undoManager[e]()}function r(){n.setDisabled(t.readonly||!o())}return n.setDisabled(!o()),t.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r),function(){return t.off("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r)}}function fB(n,t){return{anchor:"makeshift",x:n,y:t}}function lB(n,t){var e=uh.DOM.getPos(n);return function(n,t,e){return fB(n.x+t,n.y+e)}(t,e.x,e.y)}function dB(n,t){return"contextmenu"===t.type?n.inline?function(n){return fB(n.pageX,n.pageY)}(t):lB(n.getContentAreaContainer(),function(n){return fB(n.clientX,n.clientY)}(t)):T_(n)}function mB(n){return"string"==typeof n?n.split(/[ ,]/):n}function gB(n){return cn(n)?"|"===n:"separator"===n.type}function pB(n,t){if(0===t.length)return n;var e=V(n).filter(function(n){return!gB(n)}).fold(function(){return[]},function(n){return[D_]});return n.concat(e).concat(t).concat([D_])}function hB(a,n,c){var s=lu(hg.sketch({dom:{tag:"div"},lazySink:n,onEscape:function(){return a.focus()},fireDismissalEventInstead:{},inlineBehaviours:Du([Td("dismissContextMenu",[Zo(Ro(),function(n,t){hf.close(n),a.focus()})])])}));a.on("init",function(){a.on("contextmenu",function(t){if(E_(a)&&t.preventDefault(),!function(n,t){return t.ctrlKey&&!E_(n)}(a,t)&&!__(a)){var n=2!==t.button||t.target===a.getBody(),e=n?function(n){return{anchor:"node",node:on.some(Te.fromDom(n.selection.getNode())),root:Te.fromDom(n.getBody())}}(a):dB(a,t),o=a.ui.registry.getAll(),r=B_(a),i=n?a.selection.getStart(!0):t.target,u=function(r,n,i){var t=C(n,function(n,t){if(On(r,t)){var e=r[t].update(i);if(cn(e))return pB(n,e.split(" "));if(0<e.length){var o=w(e,A_);return pB(n,o)}return n}return n.concat([t])},[]);return 0<t.length&&gB(t[t.length-1])&&t.pop(),t}(o.contextMenus,r,i);gy(u,rh.CLOSE_ON_EXECUTE,c).map(function(n){t.preventDefault(),hg.showMenuAt(s,e,{menu:{markers:Gh("normal")},data:n})})}})})}function vB(n,t){n.getSystem().addToGui(t),function(n){dr(n.element()).filter(Ii).each(function(t){si(t,"z-index").each(function(n){Or(t,I_,n)}),ui(t,"z-index",ci(n.element(),"z-index"))})}(t)}function bB(n){!function(n){dr(n.element()).filter(Ii).each(function(n){var t=Er(n,I_);Br(n,I_)?ui(n,"z-index",t):li(n,"z-index"),_r(n,I_)})}(n),n.getSystem().removeFromGui(n)}function yB(n,t,e,o){return function(n,t){var e=n.element(),o=parseInt(Er(e,t.leftAttr),10),r=parseInt(Er(e,t.topAttr),10);return isNaN(o)||isNaN(r)?on.none():on.some(Qu(o,r))}(n,t).fold(function(){return e},function(n){return m_(n.left()+o.left(),n.top()+o.top())})}function xB(n,t,e,o,r,i){var u=yB(n,t,e,o),a=R_(n,t,u,r,i),c=JE(u,r,i);return function(n,t,e){var o=n.element();Or(o,t.leftAttr,e.left()+"px"),Or(o,t.topAttr,e.top()+"px")}(n,t,c),a.fold(function(){return{coord:m_(c.left(),c.top()),extra:on.none()}},function(n){return{coord:n.output(),extra:n.extra()}})}function wB(n,t){!function(n,t){var e=n.element();_r(e,t.leftAttr),_r(e,t.topAttr)}(n,t)}function SB(e,n,o,r,i,u,t){return function(n,t,e,o,r){var i=r.bounds,u=$E(t,e,o),a=nl(u.left(),i.x(),i.x()+i.width()-r.width),c=nl(u.top(),i.y(),i.y()+i.height()-r.height),s=d_(a,c);return t.fold(function(){var n=QE(s,e,o);return l_(n.left(),n.top())},function(){return s},function(){var n=JE(s,e,o);return m_(n.left(),n.top())})}(0,n.fold(function(){var n=function(n,e,o){return n.fold(function(n,t){return f_.offset(n+e,t+o)},function(n,t){return f_.absolute(n+e,t+o)},function(n,t){return f_.fixed(n+e,t+o)})}(o,u.left(),u.top()),t=JE(n,r,i);return m_(t.left(),t.top())},function(t){var n=xB(e,t,o,u,r,i);return n.extra.each(function(n){t.onSensor(e,n)}),n.coord}),r,i,t)}function kB(n,t,e,o){var r=t.getTarget(n.element());if(t.repositionTarget){var i=fr(n.element()),u=ia(i),a=XE(r,u),c=function(o){return si(o,"left").bind(function(e){return si(o,"top").bind(function(t){return si(o,"position").map(function(n){return("fixed"===n?m_:l_)(parseInt(e,10),parseInt(t,10))})})}).getOrThunk(function(){var n=Iu(o);return d_(n.left(),n.top())})}(r),s=SB(n,t.snaps,c,u,a,o,e),f=ZE(s,0,a);ai(r,f)}t.onDrag(n,r,o)}function CB(n,t){return{bounds:n.getBounds(),height:ea(t.element()),width:ra(t.element())}}var OB,TB,EB=[{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"}],BB=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],_B={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},DB=[{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"]}],AB={button:FE(FO,function(n,t){return function(n,t){return mE(n,t,[])}(n,t.backstage.shared.providers)}),togglebutton:FE(IO,function(n,t){return function(n,t){return gE(n,t,[])}(n,t.backstage.shared.providers)}),menubutton:FE(MO,function(n,t){return vk(n,"tox-tbtn",t.backstage,on.none())}),splitbutton:FE(function(n){return nt("SplitButton",UT,n)},function(n,t){return zO(n,t.backstage.shared)}),styleSelectButton:function(n,t){return function(n,t){var e=I({type:"advanced"},t.styleselect);return qO(n,t,AE(n,e))}(n,t.backstage)},fontsizeSelectButton:function(n,t){return function(n,t){return qO(n,t,EE(n))}(n,t.backstage)},fontSelectButton:function(n,t){return function(n,t){return qO(n,t,OE(n))}(n,t.backstage)},formatButton:function(n,t){return function(n,t){return qO(n,t,DE(n))}(n,t.backstage)},alignMenuButton:function(n,t){return function(n,t){return qO(n,t,kE(n))}(n,t.backstage)}},FB={styleselect:AB.styleSelectButton,fontsizeselect:AB.fontsizeSelectButton,fontselect:AB.fontSelectButton,formatselect:AB.formatButton,align:AB.alignMenuButton},MB=function(i,n,e,u){function a(){var n=ia(),t=ca(Te.fromDom(i.getContentAreaContainer()));return i.inline&&!r?on.some(function(n,t,e){var o=UO(0,t,e),r=o.x,i=o.width;return aa(r,t.top(),i,M.window.innerHeight)}(0,n,t)):i.inline?on.some(function(n,t,e){var o=UO(0,t,e),r=o.x,i=o.width,u=ca(Te.fromDom(n.getContainer())),a=M.window.innerHeight,c=t.top();if(u.y()>=e.bottom()){var s=Math.min(a+c,u.y());return aa(r,c,i,s-c)}var f=Math.max(c,u.bottom());return aa(r,f,i,a-(f-c))}(i,n,t)):on.some(function(n,t,e){var o=UO(0,t,e),r=o.x,i=o.width,u=ca(Te.fromDom(n.getContainer())),a=Math.max(t.top(),e.y()),c=u.bottom()-a,s=M.window.innerHeight-(a-t.top()),f=Math.min(c,s);return aa(r,a,i,f)}(i,n,t))}function c(){var n=d.get().map(function(n){return n.getBoundingClientRect()}).getOr(i.selection.getRng().getBoundingClientRect()),t=lr(Te.fromDom(i.getBody())).dom().innerHeight,e=n.bottom<function(){var n="fixed"===ci(Te.fromDom(i.getContainer()),"position");return i.inline&&r&&n?i.getContainer().getBoundingClientRect().bottom:0}(),o=n.top>t;return e||o}function o(){l.get().each(function(n){var t=s.element();li(t,"display"),c()?ui(t,"display","none"):uf.positionWithinBounds(e,n,s,a())})}var s=lu(function(n){var e=Ce([]);return hg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(n){e.set([]),hg.getContent(n).each(function(n){li(n.element(),"visibility")}),Zr(n.element(),yE),li(n.element(),"width")},inlineBehaviours:Du([Td("context-toolbar-events",[ir(ho(),function(n,t){hg.getContent(n).each(function(n){}),Zr(n.element(),yE),li(n.element(),"width")}),Zo(bE,function(t,e){li(t.element(),"width");var n=oa(t.element());hg.setContent(t,e.event().contents()),$r(t.element(),yE);var o=oa(t.element());ui(t.element(),"width",n+"px"),hg.getContent(t).each(function(n){e.event().focus().bind(function(n){return ml(n),pl(t.element())}).orThunk(function(){return Fm.focusIn(n),gl()})}),xg.setTimeout(function(){ui(t.element(),"width",o+"px")},0)}),Zo(hE,function(n,t){hg.getContent(n).each(function(n){e.set(e.get().concat([{bar:n,focus:gl()}]))}),Gt(n,bE,{contents:t.event().forwardContents(),focus:on.none()})}),Zo(vE,function(t,n){V(e.get()).each(function(n){e.set(e.get().slice(0,e.get().length-1)),Gt(t,bE,{contents:du(n.bar),focus:n.focus})})})]),Fm.config({mode:"special",onEscape:function(t){return V(e.get()).fold(function(){return n.onEscape()},function(n){return Wt(t,vE),on.some(!0)})}})]),lazySink:function(){return an.value(n.sink)}})}({sink:e,onEscape:function(){return i.focus(),on.some(!0)}})),r=eb(i)||ob(i)||sb(i);i.on("init",function(){if(i.on("ScrollWindow",o),!i.inline){var n=lr(Te.fromDom(i.getBody())),t=Av(n,"scroll",o);i.on("remove",function(){t.unbind()})}});function f(n){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[n],behaviours:Du([Fm.config({mode:"acyclic"}),Td("pop-dialog-wrap-events",[Pi(function(n){i.shortcuts.add("ctrl+F9","focus statusbar",function(){return Fm.focusIn(n)})}),zi(function(n){i.shortcuts.remove("ctrl+F9")})])])}}var l=Ce(on.none()),d=Ce(on.none()),t=Ce(null),m=L(function(){return wE(n,function(n){var t=g(n);Gt(s,hE,{forwardContents:f(t)})})}),g=function(n){var t,e,o=i.ui.registry.getAll().buttons,r=m();return"contexttoolbar"===n.type?(t=_n(o,r.formNavigators),e=RE(i,{buttons:t,toolbar:n.items},u,on.some(["form:"])),AO({uid:Mr("context-toolbar"),initGroups:e,onEscape:on.none,cyclicKeying:!0,backstage:u.backstage,getSink:function(){return an.error("")}})):pE(n,u.backstage)};i.on("contexttoolbar-show",function(t){var n=m();Vn(n.lookupTable,t.toolbarKey).each(function(n){w(n,t.target===i?on.none():on.some(t)),hg.getContent(s).each(Fm.focusIn)})});function p(){var n=m();xE(n,i).fold(function(){l.set(on.none()),hg.hide(s)},function(n){w(n.toolbarApi,on.some(n.elem.dom()))})}function h(n){S(),t.set(n)}var v={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"]},b={maxHeightFunction:Qs()},y={bubble:fa(12,0,v),layouts:{onLtr:function(){return[Ca]},onRtl:function(){return[Oa]}},overrides:b},x={bubble:fa(0,12,v),layouts:{onLtr:function(){return[Sa,ka,xa,ba,wa,ya,OC,TC,kC,wC,CC,SC]},onRtl:function(){return[Sa,ka,wa,ya,xa,ba,OC,TC,CC,SC,kC,wC]}},overrides:b},w=function(n,t){S();var e=g(n),o=t.map(Te.fromDom),r=function(n,t){var e="node"===n?u.backstage.shared.anchors.node(t):u.backstage.shared.anchors.cursor();return Bn(e,"line"===n?y:x)}(n.position,o);l.set(on.some(r)),d.set(t);var i=s.element();li(i,"display"),hg.showWithinBounds(s,r,f(e),a()),c()&&ui(i,"display","none")},S=function(){var n=t.get();null!==n&&(xg.clearTimeout(n),t.set(null))};i.on("init",function(){i.on("click keyup SetContent ObjectResized ResizeEditor",function(n){h(xg.setEditorTimeout(i,p,0))}),i.on("focusout",function(n){xg.setEditorTimeout(i,function(){pl(e.element()).isNone()&&pl(s.element()).isNone()&&(l.set(on.none()),hg.hide(s))},0)}),i.on("SwitchMode",function(){i.readonly&&(l.set(on.none()),hg.hide(s))}),i.on("NodeChange",function(n){pl(s.element()).fold(function(){h(xg.setEditorTimeout(i,p,0))},function(n){})})})},IB=function(n,e,o){function t(t){bn([e,o],function(n){n.broadcastOn([vf()],{target:Te.fromDom(t.target)})})}var r=Av(Te.fromDom(M.document),"mousedown",function(t){bn([e,o],function(n){n.broadcastOn([vf()],{target:t.target()})})}),i=Av(Te.fromDom(M.document),"touchstart",function(t){bn([e,o],function(n){n.broadcastOn([vf()],{target:t.target()})})}),u=Av(Te.fromDom(M.document),"mouseup",function(t){0===t.raw().button&&bn([e,o],function(n){n.broadcastOn([bf()],{target:t.target()})})});n.on("mousedown",t),n.on("touchstart",t);function a(t){0===t.button&&bn([e,o],function(n){n.broadcastOn([bf()],{target:Te.fromDom(t.target)})})}n.on("mouseup",a);function c(t){bn([e,o],function(n){n.broadcastEvent(Ao(),t)})}n.on("ScrollWindow",c);function s(t){bn([e,o],function(n){n.broadcastEvent(Fo(),t)})}n.on("ResizeWindow",s),n.on("remove",function(){n.off("mousedown",t),n.off("touchstart",t),n.off("mouseup",a),n.off("ResizeWindow",s),n.off("ScrollWindow",c),r.unbind(),i.unbind(),u.unbind()}),n.on("detach",function(){rs(e),rs(o),e.destroy(),o.destroy()})},RB=nn([wt("shell",!1),at("makeItem"),wt("setupItem",Z),wf("listBehaviours",[Im])]),VB=Uf({name:"items",overrides:function(n){return{behaviours:Du([Im.config({})])}}}),NB=nn([VB]),HB=$f({name:nn("CustomList")(),configFields:RB(),partFields:NB(),factory:function(s,n,t,e){var o=s.shell?{behaviours:[Im.config({})],components:[]}:{behaviours:[],components:n},r=function(n){return s.shell?on.some(n):Cs(n,s,"items")};return{uid:s.uid,dom:s.dom,components:o.components,behaviours:ls(s.listBehaviours,o.behaviours),apis:{setItems:function(a,c){r(a).fold(function(){throw M.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(t){var n=Im.contents(t),e=c.length,o=e-n.length,r=0<o?function(n,t){for(var e=[],o=0;o<n;o++)e.push(t(o));return e}(o,function(){return s.makeItem()}):[],i=n.slice(e);bn(i,function(n){return Im.remove(t,n)}),bn(r,function(n){return Im.append(t,n)});var u=Im.contents(t);bn(u,function(n,t){s.setupItem(a,n,c[t],t)})})}}}},apis:{setItems:function(n,t,e){n.setItems(t,e)}}}),PB=qf,zB=Xf,LB=Jf({factory:function(t,o){var n={focus:Fm.focusIn,setMenus:function(n,t){var e=w(t,function(t){var n={type:"menubutton",text:t.text,fetch:function(n){n(t.getItems())}},e=MO(n).mapError(function(n){return he(n)}).getOrDie();return vk(e,"tox-mbtn",o.backstage,on.some("menuitem"))});Im.set(n,e)}};return{uid:t.uid,dom:t.dom,components:[],behaviours:Du([Im.config({}),Td("menubar-events",[Pi(function(n){t.onSetup(n)}),Zo(ao(),function(e,n){ki(e.element(),".tox-mbtn--active").each(function(t){Ci(n.event().target(),".tox-mbtn").each(function(n){zt(t,n)||e.getSystem().getByDom(t).each(function(t){e.getSystem().getByDom(n).each(function(n){ew.expand(n),ew.close(t),Xm.focus(n)})})})})}),Zo(Vo(),function(e,n){n.event().prevFocus().bind(function(n){return e.getSystem().getByDom(n).toOption()}).each(function(t){n.event().newFocus().bind(function(n){return e.getSystem().getByDom(n).toOption()}).each(function(n){ew.isOpen(t)&&(ew.expand(n),ew.close(t))})})})]),Fm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(n){return t.onEscape(n),on.some(!0)}}),Zx.config({})]),apis:n,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[at("dom"),at("uid"),at("onEscape"),at("backstage"),wt("onSetup",Z)],apis:{focus:function(n,t){n.focus(t)},setMenus:function(n,t,e){n.setMenus(t,e)}}}),jB="container",UB=[ss("slotBehaviours",[])],WB=function(r,n,t){function e(n){return Bs(r)}function o(e,o){return void 0===o&&(o=undefined),function(n,t){return Cs(n,r,t).map(function(n){return e(n,t)}).getOr(o)}}function i(n,t){return"true"!==Er(n.element(),"aria-hidden")}var u,a=o(i,!1),c=o(function(n,t){if(i(n)){var e=n.element();ui(e,"display","none"),Or(e,"aria-hidden","true"),Gt(n,No(),{name:t,visible:!1})}}),s=(u=c,function(t,n){bn(n,function(n){return u(t,n)})}),f=o(function(n,t){if(!i(n)){var e=n.element();li(e,"display"),_r(e,"aria-hidden"),Gt(n,No(),{name:t,visible:!0})}}),l={getSlotNames:e,getSlot:function(n,t){return Cs(n,r,t)},isShowing:a,hideSlot:c,hideAllSlots:function(n){return s(n,e())},showSlot:f};return{uid:r.uid,dom:r.dom,components:n,behaviours:fs(r.slotBehaviours),apis:l}},GB=N({getSlotNames:function(n,t){return n.getSlotNames(t)},getSlot:function(n,t,e){return n.getSlot(t,e)},isShowing:function(n,t,e){return n.isShowing(t,e)},hideSlot:function(n,t,e){return n.hideSlot(t,e)},hideAllSlots:function(n,t){return n.hideAllSlots(t)},showSlot:function(n,t,e){return n.showSlot(t,e)}},Hr),XB=I(I({},GB),{sketch:function(n){var e,t=(e=[],{slot:function(n,t){return e.push(n),ys(jB,VE(n),t)},record:function(){return e}}),o=n(t),r=t.record(),i=w(r,function(n){return Lf({name:n,pname:VE(n)})});return Ms(jB,UB,i,WB,o)}}),YB=se([bt("icon"),bt("tooltip"),Et("onShow",Z),Et("onHide",Z),Et("onSetup",function(){return Z})]),qB=Mr("FixSizeEvent"),KB=Mr("AutoSizeEvent"),JB=zB.optional({factory:LB,name:"menubar",schema:[at("backstage")]}),$B=zB.optional({factory:{sketch:function(n){return HB.sketch({uid:n.uid,dom:n.dom,listBehaviours:Du([Fm.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:function(){return AO({uid:Mr("multiple-toolbar-item"),backstage:n.backstage,cyclicKeying:!1,getSink:n.getSink,initGroups:[],onEscape:function(){return on.none()}})},setupItem:function(n,t,e,o){xT.setGroups(t,e)},shell:!0})}},name:"multiple-toolbar",schema:[at("dom"),at("onEscape")]}),QB=zB.optional({factory:{sketch:function(n){return function(n){return n.split===ib.sliding?DO:n.split===ib.floating?_O:AO}(n)({uid:n.uid,onEscape:function(){return n.onEscape(),on.some(!0)},cyclicKeying:!1,initGroups:[],getSink:n.getSink,backstage:n.backstage,moreDrawerData:{lazyToolbar:n.lazyToolbar,lazyMoreButton:n.lazyMoreButton}})}},name:"toolbar",schema:[at("dom"),at("onEscape"),at("getSink")]}),ZB=zB.optional({name:"socket",schema:[at("dom")]}),n_=zB.optional({factory:{sketch:function(n){return{uid:n.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"complementary"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:Du([Zx.config({}),Xm.config({}),FT.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(n){Ol.getCurrent(n).each(XB.hideAllSlots),Wt(n,KB)},onGrown:function(n){Wt(n,KB)},onStartGrow:function(n){Gt(n,qB,{width:si(n.element(),"width").getOr("")})},onStartShrink:function(n){Gt(n,qB,{width:oa(n.element())+"px"})}}),Im.config({}),Ol.config({find:function(n){var t=Im.contents(n);return F(t)}})])}],behaviours:Du([rS(0),Td("sidebar-sliding-events",[Zo(qB,function(n,t){ui(n.element(),"width",t.event().width())}),Zo(KB,function(n,t){li(n.element(),"width")})])])}}},name:"sidebar",schema:[at("dom")]}),t_=zB.optional({factory:{sketch:function(n){return{uid:n.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:Du([Im.config({})]),components:[]}}},name:"throbber",schema:[at("dom")]}),e_=$f({name:"OuterContainer",factory:function(e,n,t){var o={getSocket:function(n){return PB.getPart(n,e,"socket")},setSidebar:function(n,t){PB.getPart(n,e,"sidebar").each(function(n){return PE(n,t)})},toggleSidebar:function(n,t){PB.getPart(n,e,"sidebar").each(function(n){return function(n,e){Ol.getCurrent(n).each(function(t){Ol.getCurrent(t).each(function(n){FT.hasGrown(t)?XB.isShowing(n,e)?FT.shrink(t):(XB.hideAllSlots(n),XB.showSlot(n,e)):(XB.hideAllSlots(n),XB.showSlot(n,e),FT.grow(t))})})}(n,t)})},whichSidebar:function(n){return PB.getPart(n,e,"sidebar").bind(zE).getOrNull()},getToolbar:function(n){return PB.getPart(n,e,"toolbar")},setToolbar:function(n,t){PB.getPart(n,e,"toolbar").each(function(n){n.getApis().setGroups(n,t)})},setToolbars:function(n,t){PB.getPart(n,e,"multiple-toolbar").each(function(n){HB.setItems(n,t)})},refreshToolbar:function(n){PB.getPart(n,e,"toolbar").each(function(n){return n.getApis().refresh(n)})},getMoreButton:function(n){return PB.getPart(n,e,"toolbar").bind(function(n){return n.getApis().getMoreButton(n)})},getThrobber:function(n){return PB.getPart(n,e,"throbber")},focusToolbar:function(n){PB.getPart(n,e,"toolbar").orThunk(function(){return PB.getPart(n,e,"multiple-toolbar")}).each(function(n){Fm.focusIn(n)})},setMenubar:function(n,t){PB.getPart(n,e,"menubar").each(function(n){LB.setMenus(n,t)})},focusMenubar:function(n){PB.getPart(n,e,"menubar").each(function(n){LB.focus(n)})}};return{uid:e.uid,dom:e.dom,components:n,apis:o,behaviours:e.behaviours}},configFields:[at("dom"),at("behaviours")],partFields:[JB,QB,$B,ZB,n_,t_],apis:{getSocket:function(n,t){return n.getSocket(t)},setSidebar:function(n,t,e){n.setSidebar(t,e)},toggleSidebar:function(n,t,e){n.toggleSidebar(t,e)},whichSidebar:function(n,t){return n.whichSidebar(t)},getToolbar:function(n,t){return n.getToolbar(t)},setToolbar:function(n,t,e){var o=w(e,function(n){return TO(n)});n.setToolbar(t,o)},setToolbars:function(n,t,e){var o=w(e,function(n){return w(n,TO)});n.setToolbars(t,o)},getMoreButton:function(n,t){return n.getMoreButton(t)},refreshToolbar:function(n,t){return n.refreshToolbar(t)},getThrobber:function(n,t){return n.getThrobber(t)},setMenubar:function(n,t,e){n.setMenubar(t,e)},focusMenubar:function(n,t){n.focusMenubar(t)},focusToolbar:function(n,t){n.focusToolbar(t)}}}),o_={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"}},r_=function(n){function t(){n._skinLoaded=!0,uv(n)}return function(){n.initialized?t():n.on("init",t)}},i_=l(WE,!1),u_=l(WE,!0),a_=uh.DOM,c_=Ye.detect().deviceType.isTouch(),s_={render:function(e,o,n,t,r){var i=Ce(0);i_(e),function(n,t){ff(n,t,vr)}(Te.fromDom(r.targetNode),o.mothership),os(Vi(),o.uiMothership),e.on("init",function(){GE(e,o,n,t),i.set(e.getWin().innerWidth),e_.setMenubar(o.outerContainer,UE(e,n)),e_.setSidebar(o.outerContainer,n.sidebar),function(o){function n(){var n=o.getDoc().documentElement,t=i.get(),e=u.get();t.left()!==r.innerWidth||t.top()!==r.innerHeight?(i.set(Qu(r.innerWidth,r.innerHeight)),cv(o)):e.left()===n.offsetWidth&&e.top()===n.offsetHeight||(u.set(Qu(n.offsetWidth,n.offsetHeight)),cv(o))}var r=o.getWin(),t=o.getDoc().documentElement,i=Ce(Qu(r.innerWidth,r.innerHeight)),u=Ce(Qu(t.offsetWidth,t.offsetHeight));a_.bind(r,"resize",n);var e=Fv(Te.fromDom(o.getBody()),"load",n);o.on("remove",function(){e.unbind(),a_.unbind(r,"resize",n)})}(e)});var u=e_.getSocket(o.outerContainer).getOrDie("Could not find expected socket element");!0===c_&&ai(u.element(),{overflow:"scroll","-webkit-overflow-scrolling":"touch"}),kO(e,o),e.addCommand("ToggleSidebar",function(n,t){e_.toggleSidebar(o.outerContainer,t),e.fire("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",function(){return e_.whichSidebar(o.outerContainer)});var a=fb(e);return a!==ib.sliding&&a!==ib.floating||e.on("ResizeContent",function(){var n=e.getWin().innerWidth;n!==i.get()&&e_.refreshToolbar(o.outerContainer),i.set(n)}),{iframeContainer:u.element().dom(),editorContainer:o.outerContainer.element().dom()}},getBehaviours:function(n){return[]}},f_=Tn([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),l_=f_.offset,d_=f_.absolute,m_=f_.fixed,g_=/* */Object.freeze({refresh:uB}),p_=/* */Object.freeze({events:function(o,n){return Jo([Zo(ho(),function(t,e){o.contextual.each(function(n){zt(t.element(),e.event().target())&&(Zr(t.element(),n.transitionClass),e.stop())})}),Zo(Ao(),function(n,t){uB(n,o)})])}}),h_=[xt("contextual",[at("fadeInClass"),at("fadeOutClass"),at("transitionClass"),at("lazyContext")]),wt("lazyViewport",function(n){var t=ia();return aa(t.left(),t.top(),M.window.innerWidth,M.window.innerHeight)}),at("leftAttr"),at("topAttr")],v_=Au({fields:h_,name:"docking",active:p_,apis:g_}),b_={render:function(o,t,e,r,n){var i,u=uh.DOM,a=db(o),c=fb(o),s=c===ib.sliding||c===ib.floating;u_(o);function f(n){var t=si(i.element(),"position").is("fixed"),e=function(n){void 0===n&&(n=0);var t=Iu(Te.fromDom(o.getBody()));return{top:Math.round(t.top()-ta(i.element()))+n,left:Math.round(t.left())}}(s?n.fold(function(){return 0},function(n){return 1<n.components().length?ta(n.components()[1].element()):0}):0);t?Tr(i.element(),kn(e,function(n,t){return{k:"data-dock-"+t,v:n}})):ai(i.element(),N(e,function(n){return n+"px"})),v_.refresh(i)}function l(){var n=e_.getToolbar(t.outerContainer);s&&e_.refreshToolbar(t.outerContainer),a||f(n)}function d(){ui(t.outerContainer.element(),"display","flex"),u.addClass(o.getBody(),"mce-edit-focus"),li(t.uiMothership.element(),"display"),l()}function m(){t.outerContainer&&(ui(t.outerContainer.element(),"display","none"),u.removeClass(o.getBody(),"mce-edit-focus")),ui(t.uiMothership.element(),"display","none")}function g(){if(i)d();else{i=t.outerContainer;var n=function(n){return lb(n).getOr(Vi())}(o);os(n,t.mothership),os(n,t.uiMothership),GE(o,t,e,r),e_.setMenubar(t.outerContainer,UE(o,e)),a||ui(i.element(),"position","absolute"),l(),d(),o.on("NodeChange ResizeWindow",l),o.on("activate",d),o.on("deactivate",m),o.nodeChanged()}}return o.on("focus",g),o.on("blur hide",m),o.on("init",function(){o.hasFocus()&&g()}),kO(o,t),{editorContainer:t.outerContainer.element().dom()}},getBehaviours:function(t){return db(t)?[]:[v_.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(n){return on.from(t).map(function(n){return Te.fromDom(n.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),Xm.config({})]}},y_=function(t){qk.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(n){t.ui.registry.addToggleButton(n.name,{tooltip:n.text,onAction:function(){return t.execCommand(n.cmd)},icon:n.icon,onSetup:GO(t,n.name)})});var n="alignnone",e="No alignment",o="JustifyNone",r="align-none";t.ui.registry.addButton(n,{tooltip:e,onAction:function(){return t.execCommand(o)},icon:r})},x_=function(n){cB(n),function(t){qk.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(n){t.ui.registry.addMenuItem(n.name,{text:n.text,icon:n.icon,shortcut:n.shortcut,onAction:function(){return t.execCommand(n.action)}})}),t.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onAction:aB(t,"code")})}(n)},w_=function(n){!function(t){t.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(n){return sB(n,t,"hasUndo")},onAction:function(){return t.execCommand("undo")}}),t.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:function(n){return sB(n,t,"hasRedo")},onAction:function(){return t.execCommand("redo")}})}(n),function(t){t.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(n){return sB(n,t,"hasUndo")},onAction:function(){return t.execCommand("undo")}}),t.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(n){return sB(n,t,"hasRedo")},onAction:function(){return t.execCommand("redo")}})}(n)},S_=function(n){!function(n){n.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:function(){return n.execCommand("mceToggleVisualAid")}})}(n),function(t){t.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:function(n){return function(t,n){t.setActive(n.hasVisual);function e(n){t.setActive(n.hasVisual)}return n.on("VisualAid",e),function(){return n.off("VisualAid",e)}}(n,t)},onAction:function(){t.execCommand("mceToggleVisualAid")}})}(n)},k_=function(n){!function(t){t.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:function(n){return function(n,t){n.setDisabled(!t.queryCommandState("outdent"));function e(){n.setDisabled(!t.queryCommandState("outdent"))}return t.on("NodeChange",e),function(){return t.off("NodeChange",e)}}(n,t)},onAction:function(){return t.execCommand("outdent")}}),t.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:function(){return t.execCommand("indent")}})}(n)},C_=function(n,t){!function(n,t){var e=YO(0,t,kE(n));n.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),getSubmenuItems:function(){return e.items.validateItems(e.getStyleItems())}})}(n,t),function(n,t){var e=YO(0,t,OE(n));n.ui.registry.addNestedMenuItem("fontformats",{text:t.shared.providers.translate("Fonts"),getSubmenuItems:function(){return e.items.validateItems(e.getStyleItems())}})}(n,t),function(n,t){var e=I({type:"advanced"},t.styleselect),o=YO(0,t,AE(n,e));n.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return o.items.validateItems(o.getStyleItems())}})}(n,t),function(n,t){var e=YO(0,t,DE(n));n.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return e.items.validateItems(e.getStyleItems())}})}(n,t),function(n,t){var e=YO(0,t,EE(n));n.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return e.items.validateItems(e.getStyleItems())}})}(n,t)},O_=function(n,t){y_(n),x_(n),C_(n,t),w_(n),lv.register(n),S_(n),k_(n)},T_=function(n){return{anchor:"selection",root:Te.fromDom(n.selection.getNode())}},E_=function(n){return n.settings.contextmenu_never_use_native||!1},B_=function(n){return function(n,t,e){var o=n.ui.registry.getAll().contextMenus;return P(n.settings,t).map(mB).getOrThunk(function(){return S(mB(e),function(n){return On(o,n)})})}(n,"contextmenu","link linkchecker image imagetools table spellchecker configurepermanentpen")},__=function(n){return!1===n.getParam("contextmenu")},D_={type:"separator"},A_=function(t){if(cn(t))return t;switch(t.type){case"separator":return D_;case"submenu":return{type:"nestedmenuitem",text:t.text,icon:t.icon,getSubmenuItems:function(){var n=t.getSubmenuItems();return cn(n)?n:w(n,A_)}};default:return{type:"menuitem",text:t.text,icon:t.icon,onAction:function(n){return function(){return n()}}(t.onAction)}}},F_=function(n){return/^[0-9\.]+(|px)$/i.test(""+n)?on.some(parseInt(n,10)):on.none()},M_=function(n){return mn(n)?n+"px":n},I_="data-initial-z-index",R_=function(n,t,e,o,r){var i=t.getSnapPoints(n);return Bi(i,function(n){var t=n.sensor();return function(n,t,e,o,r,i){var u=$E(n,r,i),a=$E(t,r,i);return Math.abs(u.left()-a.left())<=e&&Math.abs(u.top()-a.top())<=o}(e,t,n.range().left(),n.range().top(),o,r)?on.some({output:nn(function(n,i,u,a){function t(o,r){return function(n,t){var e=o(i,u,a);return r(n.getOr(e.left()),t.getOr(e.top()))}}return n.fold(t(QE,f_.offset),t($E,f_.absolute),t(JE,f_.fixed))}(n.output(),e,o,r)),extra:n.extra}):on.none()})},V_=xt("snaps",[at("getSnapPoints"),xu("onSensor"),at("leftAttr"),at("topAttr"),wt("lazyViewport",function(){var n=ia();return{x:n.left,y:n.top,width:nn(M.window.innerWidth),height:nn(M.window.innerHeight),bottom:nn(n.top()+M.window.innerHeight),right:nn(n.left()+M.window.innerWidth)}})]),N_=/* */Object.freeze({getData:function(n){return on.from(Qu(n.x(),n.y()))},getDelta:function(n,t){return Qu(t.left()-n.left(),t.top()-n.top())}}),H_=[wt("useFixed",!1),at("blockerClass"),wt("getTarget",f),wt("onDrag",Z),wt("repositionTarget",!0),xu("onDrop"),Et("getBounds",sa),V_,Cu("dragger",{handlers:function(u,a){function c(n){a.setStartData(CB(u,n))}return Jo([Zo(Ao(),c),Zo(oo(),function(o,n){if(0===n.event().raw().button){n.stop();var t={drop:function(){r()},delayDrop:function(){i.schedule()},forceDrop:function(){r()},move:function(n){i.cancel();var t=a.update(N_,n),e=a.getStartData().getOrThunk(function(){return CB(u,o)});t.each(function(n){kB(o,u,e,n)})}},e=o.getSystem().build(ab.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[u.blockerClass]},events:function(e){return Jo([Zo(oo(),e.forceDrop),Zo(uo(),e.drop),Zo(ro(),function(n,t){e.move(t.event())}),Zo(io(),e.delayDrop)])}(t)})),r=function(){bB(e),u.snaps.each(function(n){wB(o,n)});var n=u.getTarget(o.element());a.reset(),u.onDrop(o,n)},i=Nv(r,200);c(o),vB(o,e)}})])}})],P_=/* */Object.freeze({getData:function(n){var t=n.raw().touches;return 1===t.length?function(n){var t=n[0];return on.some(Qu(t.clientX,t.clientY))}(t):on.none()},getDelta:function(n,t){return Qu(t.left()-n.left(),t.top()-n.top())}}),z_=H_,L_=[wt("useFixed",!1),wt("getTarget",f),wt("onDrag",Z),wt("repositionTarget",!0),wt("onDrop",Z),Et("getBounds",sa),V_,Cu("dragger",{handlers:function(r,i){function e(n){i.setStartData(CB(r,n))}return Jo([Zo(Ao(),e),Zo(no(),function(n,t){e(n),t.stop()}),Zo(to(),function(t,n){n.stop();var e=i.update(P_,n.event()),o=i.getStartData().getOrThunk(function(){return CB(r,t)});e.each(function(n){kB(t,r,o,n)})}),Zo(eo(),function(t,n){r.snaps.each(function(n){wB(t,n)});var e=r.getTarget(t.element());i.reset(),r.onDrop(t,e)})])}})],j_=/* */Object.freeze({mouse:z_,touch:L_}),U_=/* */Object.freeze({init:function(){var o=on.none(),t=on.none(),n=nn({});return iu({readState:n,reset:function(){o=on.none(),t=on.none()},update:function(t,n){return t.getData(n).bind(function(n){return function(t,e){var n=o.map(function(n){return t.getDelta(n,e)});return o=on.some(e),n}(t,n)})},getStartData:function(){return t},setStartData:function(n){t=on.some(n)}})}}),W_=Fu({branchKey:"mode",branches:j_,name:"dragging",active:{events:function(n,t){return n.dragger.handlers(n,t)}},extra:{snap:sr(["sensor","range","output"],["extra"])},state:U_});(TB=OB=OB||{})[TB.None=0]="None",TB[TB.Both=1]="Both",TB[TB.Vertical=2]="Vertical";function G_(n,t,e,o){var r=n+t,i=e.filter(function(n){return r<n}),u=o.filter(function(n){return n<r});return i.or(u).getOr(r)}function X_(n,t,e,o,r){var i={};return i.height=G_(o,t.top(),tb(n),function(n){return on.from(n.getParam("max_height")).filter(mn)}(n)),e===OB.Both&&(i.width=G_(r,t.left(),nb(n),function(n){return on.from(n.getParam("max_width")).filter(mn)}(n))),i}function Y_(n){if(1===n.nodeType){if("BR"===n.nodeName||n.getAttribute("data-mce-bogus"))return!0;if("bookmark"===n.getAttribute("data-mce-type"))return!0}return!1}function q_(r,t){function n(o){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize")},innerHtml:zd("resize-handle",t.icons)},behaviours:Du([W_.config({mode:"mouse",repositionTarget:!1,onDrag:function(n,t,e){!function(n,t,e){var o=Te.fromDom(n.getContainer()),r=X_(n,t,e,ta(o),oa(o));Sn(r,function(n,t){return ui(o,t,M_(n))}),av(n)}(r,e,o)},blockerClass:"tox-blocker"})])}}var e,o;return{dom:{tag:"div",classes:["tox-statusbar"]},components:(e=function(){var n=[];return r.getParam("elementpath",!0,"boolean")&&n.push(ID(r,{})),Rt(r.settings.plugins,"wordcount")&&n.push(function(n,o){function r(n,t,e){return Im.set(n,[wi(o.translate(["{0} "+e,t[e]]))])}var t;return vg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Du([Zx.config({}),Im.config({}),jm.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Td("wordcount-events",[Zo(To(),function(n){var t=jm.getValue(n),e="words"===t.mode?"characters":"words";jm.setValue(n,{mode:e,count:t.count}),r(n,t.count,e)}),Pi(function(e){n.on("wordCountUpdate",function(n){var t=jm.getValue(e).mode;jm.setValue(e,{mode:t,count:n.wordCount}),r(e,n.wordCount,t)})})])]),eventOrder:(t={},t[To()]=["wordcount-events","alloy.base.behaviour"],t)})}(r,t)),r.getParam("branding",!0,"boolean")&&n.push(function(){var n=Dp.translate(["Powered by {0}","Tiny"]);return{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="'+n+'">'+n+"</a>"}}}()),0<n.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:n}]:[]}(),o=function(n){var t=!Rt(n.settings.plugins,"autoresize"),e=n.getParam("resize",t);return!1===e?OB.None:"both"===e?OB.Both:OB.Vertical}(r),o!==OB.None&&e.push(n(o)),e)}}function K_(n){return[st("type"),function(n){return ct(n,be)}("columns"),n]}function J_(t){return me("items","items",An(),qn(Qn(function(n){return nt("Checking item of "+t,MA,n).fold(function(n){return an.error(he(n))},function(n){return an.value(n)})})))}function $_(n){return cn(n.type)&&cn(n.name)}function Q_(n){var t=function(n){return S(qA(n),$_)}(n),e=E(t,function(t){return function(n){return on.from(KA[n.type])}(t).fold(function(){return[]},function(n){return[ct(t.name,n)]})});return se(e)}function Z_(n){return{internalDialog:tt(function(n){return nt("dialog",YA,n)}(n)),dataValidator:Q_(n),initialData:n.initialData}}function nD(n){var e=[],o={};return Sn(n,function(n,t){n.fold(function(){e.push(t)},function(n){o[t]=n})}),0<e.length?an.error(e):an.value(o)}function tD(n){return F(function(n,t){var e=gn.call(n,0);return e.sort(t),e}(n,function(n,t){return t<n?-1:n<t?1:0}))}function eD(e,o,n){Si(e,'[role="dialog"]').each(function(t){n.get().map(function(n){return ui(o,"height","0"),Math.min(n,function(n,t){var e=Si(n,".tox-dialog-wrap").getOr(n);return("fixed"===ci(e,"position")?Math.max(M.document.documentElement.clientHeight,M.window.innerHeight):Math.max(M.document.documentElement.offsetHeight,M.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-t.dom().getBoundingClientRect().height)}(t,e))}).each(function(n){ui(o,"height",n+"px")})})}function oD(r){var i;return{smartTabHeight:(i=Ce(on.none()),{extraEvents:[Pi(function(n){ki(n.element(),'[role="tabpanel"]').each(function(o){ui(o,"visibility","hidden"),n.getSystem().getByDom(o).toOption().each(function(n){var t=function(o,r,i){return w(o,function(n,t){Im.set(i,o[t].view());var e=r.dom().getBoundingClientRect();return Im.set(i,[]),e.height})}(r,o,n),e=tD(t);i.set(e)}),eD(n.element(),o,i),li(o,"visibility"),function(n,t){F(n).each(function(n){return sF.showTab(t,n.value)})}(r,n),xg.requestAnimationFrame(function(){eD(n.element(),o,i)})})}),Zo(Fo(),function(t){ki(t.element(),'[role="tabpanel"]').each(function(n){eD(t.element(),n,i)})}),Zo(Tb,function(r,n){ki(r.element(),'[role="tabpanel"]').each(function(t){var n=gl();ui(t,"visibility","hidden");var e=si(t,"height").map(function(n){return parseInt(n,10)});li(t,"height");var o=t.dom().getBoundingClientRect().height;e.forall(function(n){return n<o})?(i.set(on.from(o)),eD(r.element(),t,i)):e.each(function(n){ui(t,"height",n+"px")}),li(t,"visibility"),n.each(ml)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}}function rD(n,t,e,o){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:I(I({},t.map(function(n){return{id:n}}).getOr({})),o?{"aria-live":"polite"}:{})},components:[],behaviours:Du([rS(0),rE.config({channel:gF,updateState:function(n,t){return on.some({isTabPanel:function(){return"tabpanel"===t.body.type}})},renderComponents:function(n){switch(n.body.type){case"tabpanel":return[function(n,e){function o(n){var t=jm.getValue(n),e=nD(t).getOr({}),o=i.get(),r=Bn(o,e);i.set(r)}function r(n){var t=i.get();jm.setValue(n,t)}var i=Ce({}),u=Ce(null),t=w(n.tabs,function(n){return{value:n.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:e.shared.providers.translate(n.title)},view:function(){return[qw.sketch(function(t){return{dom:{tag:"div",classes:["tox-form"]},components:w(n.items,function(n){return pC(t,n,e)}),formBehaviours:Du([Fm.config({mode:"acyclic",useTabstopAt:v(gS)}),Td("TabView.form.events",[Pi(r),zi(o)]),Ku.config({channels:K([{key:fF,value:{onReceive:o}},{key:lF,value:{onReceive:r}}])})])}})]}}}),a=oD(t).smartTabHeight;return sF.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(n,t,e){var o=jm.getValue(t);Gt(n,Ob,{name:o,oldName:u.get()}),u.set(o)},tabs:t,components:[sF.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[oF.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:Du([Zx.config({})])}),sF.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:a.selectFirst,tabSectionBehaviours:Du([Td("tabpanel",a.extraEvents),Fm.config({mode:"acyclic"}),Ol.config({find:function(n){return F(sF.getViewItems(n))}}),jm.config({store:{mode:"manual",getValue:function(n){return n.getSystem().broadcastOn([fF],{}),i.get()},setValue:function(n,t){i.set(t),n.getSystem().broadcastOn([lF],{})}}})])})}(n.body,e)];default:return[function(n,e){var t=Hd(qw.sketch(function(t){return{dom:{tag:"div",classes:["tox-form"].concat(n.classes)},components:w(n.items,function(n){return pC(t,n,e)})}}));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[t.asSpec()]}],behaviours:Du([Fm.config({mode:"acyclic",useTabstopAt:v(gS)}),oS(t),cS(t,{postprocess:function(n){return nD(n).fold(function(n){return M.console.error(n),{}},function(n){return n})}})])}}(n.body,e)]}},initialData:n})])}}function iD(n,e){return[or(co(),pS),n(yb,function(n,t){e.onClose(),t.onClose()}),n(xb,function(n,t,e,o){t.onCancel(n),Wt(o,yb)}),Zo(Cb,function(n,t){return e.onUnblock()}),Zo(kb,function(n,t){return e.onBlock(t.event())})]}function uD(n,t){function e(n,t){return ab.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+n]},components:w(t,function(n){return n.memento.asSpec()})})}var o=function(n,t){for(var e=[],o=[],r=0,i=n.length;r<i;r++){var u=n[r];(t(u,r)?e:o).push(u)}return{pass:e,fail:o}}(t.map(function(n){return n.footerButtons}).getOr([]),function(n){return"start"===n.align});return[e("start",o.pass),e("end",o.fail)]}function aD(n,o){return{dom:Ig('<div class="tox-dialog__footer"></div>'),components:[],behaviours:Du([rE.config({channel:pF,initialData:n,updateState:function(n,t){var e=w(t.buttons,function(n){var t=Hd(function(n,t){return Ok(n,n.type,t)}(n,o));return{name:n.name,align:n.align,memento:t}});return on.some({lookupByName:function(n,t){return function(t,n,e){return O(n,function(n){return n.name===e}).bind(function(n){return n.memento.getOpt(t)})}(n,e,t)},footerButtons:e})},renderComponents:uD})])}}function cD(n,t){return zD.parts().footer(aD(n,t))}function sD(t,e){if(t.getRoot().getSystem().isConnected()){var o=Ol.getCurrent(t.getFormWrapper()).getOr(t.getFormWrapper());return qw.getField(o,e).fold(function(){var n=t.getFooter();return rE.getState(n).get().bind(function(n){return n.lookupByName(o,e)})},function(n){return on.some(n)})}return on.none()}function fD(u,o,a){function n(n){var t=u.getRoot();t.getSystem().isConnected()&&n(t)}var c={getData:function(){var n=u.getRoot(),t=n.getSystem().isConnected()?u.getFormWrapper():n,e=jm.getValue(t),o=N(a,function(n){return n.get()});return I(I({},e),o)},setData:function(i){n(function(n){var t=c.getData(),e=_n(t,i),o=function(n,t){var e=n.getRoot();return rE.getState(e).get().map(function(n){return tt(nt("data",n.dataValidator,t))}).getOr(t)}(u,e),r=u.getFormWrapper();jm.setValue(r,o),Sn(a,function(n,t){On(e,t)&&n.set(e[t])})})},disable:function(n){sD(u,n).each(qp.disable)},enable:function(n){sD(u,n).each(qp.enable)},focus:function(n){sD(u,n).each(Xm.focus)},block:function(t){if(!cn(t))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(function(n){Gt(n,kb,{message:t})})},unblock:function(){n(function(n){Wt(n,Cb)})},showTab:function(e){n(function(n){var t=u.getBody();rE.getState(t).get().exists(function(n){return n.isTabPanel()})&&Ol.getCurrent(t).each(function(n){sF.showTab(n,e)})})},redial:function(e){n(function(n){var t=o(e);n.getSystem().broadcastOn([dF],t),n.getSystem().broadcastOn([mF],t.internalDialog),n.getSystem().broadcastOn([gF],t.internalDialog),n.getSystem().broadcastOn([pF],t.internalDialog),c.setData(t.initialData)})},close:function(){n(function(n){Wt(n,yb)})}};return c}function lD(n){return vg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close"),title:n.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(n){Wt(n,xb)}})}function dD(n,t,e){function o(n){return[wi(e.translate(n.title))]}return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:I({},t.map(function(n){return{id:n}}).getOr({}))},components:o(n),behaviours:Du([rE.config({channel:mF,renderComponents:o})])}}function mD(){return{dom:Ig('<div class="tox-dialog__draghandle"></div>')}}function gD(n,t){return function(n,t){var e=zD.parts().title(dD(n,on.none(),t)),o=zD.parts().draghandle(mD()),r=zD.parts().close(lD(t)),i=[e].concat(n.draggable?[o]:[]).concat([r]);return ab.sketch({dom:Ig('<div class="tox-dialog__header"></div>'),components:i})}({title:t.shared.providers.translate(n),draggable:t.dialog.isDraggableModal()},t.shared.providers)}function pD(n,t){return{onClose:function(){return t.closeWindow()},onBlock:function(e){zD.setBusy(n(),function(n,t){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:t,components:[{dom:Ig('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){zD.setIdle(n())}}}function hD(n,t,e,o){var r;return lu(zD.sketch({lazySink:o.shared.getSink,onEscape:function(n){return Wt(n,xb),on.some(!0)},useTabstopAt:function(n){return!gS(n)},modalBehaviours:Du(d([rE.config({channel:dF,updateState:function(n,t){return on.some(t)},initialData:t}),lS({}),Xm.config({}),Td("execute-on-form",e.concat([ir(co(),function(n,t){Fm.focusIn(n)})])),Td("scroll-lock",[Pi(function(){$r(Vi(),"tox-dialog__disable-scroll")}),zi(function(){Zr(Vi(),"tox-dialog__disable-scroll")})])],n.extraBehaviours)),eventOrder:(r={},r[ko()]=["execute-on-form"],r[So()]=["reflecting","receiving"],r[Mo()]=["scroll-lock","reflecting","messages","execute-on-form","alloy.base.behaviour"],r[Io()]=["alloy.base.behaviour","execute-on-form","messages","reflecting","scroll-lock"],r),dom:{tag:"div",classes:["tox-dialog"].concat(n.extraClasses),styles:I({position:"relative"},n.extraStyles)},components:d([n.header,n.body],n.footer.toArray()),dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:Ig('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}}))}function vD(n){return w(n,function(n){return"menu"===n.type?function(n){var t=w(n.items,function(n){var t=Ce(!1);return I(I({},n),{storage:t})});return I(I({},n),{items:t})}(n):n})}function bD(n){return C(n,function(n,t){return"menu"!==t.type?n:C(t.items,function(n,t){return n[t.name]=t.storage,n},n)},{})}function yD(n,t,e){var o=gD(n.internalDialog.title,e),r=function(n,t){var e=rD(n,on.none(),t,!1);return zD.parts().body(e)}({body:n.internalDialog.body},e),i=vD(n.internalDialog.buttons),u=bD(i),a=cD({buttons:i},e),c=bF(function(){return d},pD(function(){return l},t)),s="normal"!==n.internalDialog.size?"large"===n.internalDialog.size?["tox-dialog--width-lg"]:["tox-dialog--width-md"]:[],f={header:o,body:r,footer:on.some(a),extraClasses:s,extraBehaviours:[],extraStyles:{}},l=hD(f,n,c,e),d=fD({getRoot:function(){return l},getBody:function(){return zD.getBody(l)},getFooter:function(){return zD.getFooter(l)},getFormWrapper:function(){var n=zD.getBody(l);return Ol.getCurrent(n).getOr(n)}},t.redial,u);return{dialog:l,instanceApi:d}}function xD(n){return sn(n)&&-1!==xF.indexOf(n.mceAction)}function wD(e,n,o,t){var r,i=gD(e.title,t),u=function(n){var t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[hS({dom:{tag:"iframe",attributes:{src:n.url}},behaviours:Du([Zx.config({}),Xm.config({})])})]}],behaviours:Du([Fm.config({mode:"acyclic",useTabstopAt:v(gS)})])};return zD.parts().body(t)}(e),a=e.buttons.bind(function(n){return 0===n.length?on.none():on.some(cD({buttons:n},t))}),c=vF(function(){return h},pD(function(){return p},n)),s=I(I({},e.height.fold(function(){return{}},function(n){return{height:n+"px","max-height":n+"px"}})),e.width.fold(function(){return{}},function(n){return{width:n+"px","max-width":n+"px"}})),f=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],l=new yF(e.url,{base_uri:new yF(M.window.location.href)}),d=l.protocol+"://"+l.host+(l.port?":"+l.port:""),m=Ce(on.none()),g=[Td("messages",[Pi(function(){var n=Av(Te.fromDom(M.window),"message",function(n){if(l.isSameOrigin(new yF(n.raw().origin))){var t=n.raw().data;xD(t)?function(n,t,e){switch(e.mceAction){case"insertContent":n.insertContent(e.content);break;case"setContent":n.setContent(e.content);break;case"execCommand":var o=!!ln(e.ui)&&e.ui;n.execCommand(e.cmd,o,e.value);break;case"close":t.close();break;case"block":t.block(e.message);break;case"unblock":t.unblock()}}(o,h,t):function(n){return!xD(n)&&sn(n)&&On(n,"mceAction")}(t)&&e.onMessage(h,t)}});m.set(on.some(n))}),zi(function(){m.get().each(function(n){return n.unbind()})})]),Ku.config({channels:(r={},r[hF]={onReceive:function(n,t){ki(n.element(),"iframe").each(function(n){n.dom().contentWindow.postMessage(t,d)})}},r)})],p=hD({header:i,body:u,footer:a,extraClasses:f,extraBehaviours:g,extraStyles:s},e,c,t),h=function(t){function n(n){t.getSystem().isConnected()&&n(t)}return{block:function(t){if(!cn(t))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(function(n){Gt(n,kb,{message:t})})},unblock:function(){n(function(n){Wt(n,Cb)})},close:function(){n(function(n){Wt(n,yb)})},sendMessage:function(t){n(function(n){n.getSystem().broadcastOn([hF],t)})}}}(p);return{dialog:p,instanceApi:h}}function SD(n,t,e,o){var r,i,u=Mr("dialog-label"),a=Mr("dialog-content"),c=Hd(function(n,t,e){return ab.sketch({dom:Ig('<div class="tox-dialog__header"></div>'),components:[dD(n,on.some(t),e),mD(),lD(e)],containerBehaviours:Du([W_.config({mode:"mouse",blockerClass:"blocker",getTarget:function(n){return Ci(n,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])})}({title:n.internalDialog.title,draggable:!0},u,e.shared.providers)),s=Hd(function(n,t,e,o){return rD(n,on.some(t),e,o)}({body:n.internalDialog.body},a,e,o)),f=vD(n.internalDialog.buttons),l=bD(f),d=Hd(function(n,t){return aD(n,t)}({buttons:f},e)),m=bF(function(){return p},{onBlock:function(){},onUnblock:function(){},onClose:function(){return t.closeWindow()}}),g=lu({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline"],attributes:(r={role:"dialog"},r["aria-labelledby"]=u,r["aria-describedby"]=""+a,r)},eventOrder:(i={},i[So()]=[rE.name(),Ku.name()],i[ko()]=["execute-on-form"],i[Mo()]=["reflecting","execute-on-form"],i),behaviours:Du([Fm.config({mode:"cyclic",onEscape:function(n){return Wt(n,yb),on.some(!0)},useTabstopAt:function(n){return!gS(n)&&("button"!==Wo(n)||"disabled"!==Er(n,"disabled"))}}),rE.config({channel:dF,updateState:function(n,t){return on.some(t)},initialData:n}),Xm.config({}),Td("execute-on-form",m.concat([ir(co(),function(n,t){Fm.focusIn(n)})])),lS({})]),components:[c.asSpec(),s.asSpec(),d.asSpec()]}),p=fD({getRoot:function(){return g},getFooter:function(){return d.get(g)},getBody:function(){return s.get(g)},getFormWrapper:function(){var n=s.get(g);return Ol.getCurrent(n).getOr(n)}},t.redial,l);return{dialog:g,instanceApi:p}}function kD(n,t){return zD.parts().close(vg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:n,buttonBehaviours:Du([Zx.config({})])}))}function CD(){return zD.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})}function OD(n,t){return zD.parts().body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:Ig("<p>"+t.translate(n)+"</p>")}]}]})}function TD(n){return zD.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:n})}function ED(n,t){return[ab.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:n}),ab.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})]}function BD(e){return zD.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),on.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(e.extraClasses)},components:[Bn(e.headerOverride.getOr(SF),{components:[e.partSpecs.title,e.partSpecs.close]}),e.partSpecs.body,e.partSpecs.footer],parts:{blocker:{dom:Ig('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:Du([Td("basic-dialog-events",[Zo(xb,function(n,t){e.onCancel()}),Zo(Sb,function(n,t){e.onSubmit()})])])})}var _D,DD,AD,FD,MD,ID=function(i,r){r.delimiter||(r.delimiter="\xbb");return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Du([Fm.config({mode:"flow",selector:"div[role=button]"}),Zx.config({}),Im.config({}),Td("elementPathEvents",[Pi(function(e,n){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return Fm.focusIn(e)}),i.on("NodeChange",function(n){var t=function(n){for(var t=[],e=n.length;0<e--;){var o=n[e];if(1===o.nodeType&&!Y_(o)){var r=i.fire("ResolveName",{name:o.nodeName.toLowerCase(),target:o});if(r.isDefaultPrevented()||t.push({name:r.name,element:o}),r.isPropagationStopped())break}}return t}(n.parents);0<t.length&&Im.set(e,function(n){var t=w(n||[],function(t,n){return vg.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{role:"button","data-index":n,"tab-index":-1,"aria-level":n+1},innerHtml:t.name},action:function(n){i.focus(),i.selection.select(t.element),i.nodeChanged()}})}),o={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+r.delimiter+" "}};return C(t.slice(1),function(n,t){var e=n;return e.push(o),e.push(t),e},[t[0]])}(t))})})])]),components:[]}},RD=function(l){function n(){return o.bind(function(n){return e_.getMoreButton(n)}).getOrDie("Could not find more button element")}function d(){return o.bind(function(n){return e_.getThrobber(n)}).getOrDie("Could not find throbber element")}function m(){return an.value(p)}function t(n){return fb(n)}var e=l.getParam("inline",!1,"boolean"),g=e?b_:s_,o=on.none(),r=Ye.detect().browser.isIE()?["tox-platform-ie"]:[],i=Dp.isRtl()?{attributes:{dir:"rtl"}}:{},p=lu({dom:I({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(r)},i),behaviours:Du([uf.config({useFixed:!1})])}),u=Hd({dom:{tag:"div",classes:["tox-anchorbar"]}}),h=QC(p,l,function(){return o.bind(function(n){return u.getOpt(n)}).getOrDie("Could not find a anchor bar element")},n),a=e_.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:h,onEscape:function(){l.focus()}}),c=e_.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:m,backstage:h,onEscape:function(){l.focus()},split:t(l),lazyToolbar:function(){return o.bind(function(n){return e_.getToolbar(n)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:n}),s=e_.parts()["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},onEscape:function(){}}),f=e_.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),v=e_.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),b=e_.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:h}),y=l.getParam("statusbar",!0,"boolean")&&!e?on.some(q_(l,h.shared.providers)):on.none(),x={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[f,v]},w=sb(l),S=ob(l),k=eb(l),C=t(l)!==ib["default"],O=R([k?[a]:[],w?(C&&M.console.warn("Toolbar drawer cannot be applied when multiple toolbars are active"),[s]):S?[c]:[],db(l)?[]:[u.asSpec()],e?[]:[x]]),T=R([[{dom:{tag:"div",classes:["tox-editor-container"]},components:O}],e?[]:y.toArray(),[b]]),E=e&&!k&&!S&&!w,B=I(I({role:"application"},Dp.isRtl()?{dir:"rtl"}:{}),E?{"aria-hidden":"true"}:{}),_=lu(e_.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(e?["tox-tinymce-inline"]:[]).concat(r),styles:I({visibility:"hidden"},E?{opacity:"0",border:"0"}:{}),attributes:B},components:T,behaviours:Du(g.getBehaviours(l).concat([Fm.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a"})]))}));o=on.some(_),l.shortcuts.add("alt+F9","focus menubar",function(){e_.focusMenubar(_)}),l.shortcuts.add("alt+F10","focus toolbar",function(){e_.focusToolbar(_)});var D=Zv(_),A=Zv(p);IB(l,D,A);function F(n){var t=uh.DOM,e=l.getParam("width",t.getStyle(n,"width")),o=function(n){return n.getParam("height",Math.max(n.getElement().offsetHeight,200))}(l),r=nb(l),i=tb(l),u=F_(e).bind(function(t){return M_(r.map(function(n){return Math.max(t,n)}))}).getOr(M_(e)),a=F_(o).bind(function(t){return i.map(function(n){return Math.max(t,n)})}).getOr(o),c=M_(u);if(fi("div","width",c)&&ui(_.element(),"width",c),!l.inline){var s=M_(a);fi("div","height",s)?ui(_.element(),"height",s):ui(_.element(),"height","200px")}return a}return{mothership:D,uiMothership:A,backstage:h,renderUI:function(){O_(l,h),hB(l,m,h),function(o){var r=o.ui.registry.getAll().sidebars;bn(xn(r),function(t){function e(){return on.from(o.queryCommandValue("ToggleSidebar")).is(t)}var n=r[t];o.ui.registry.addToggleButton(t,{icon:n.icon,tooltip:n.tooltip,onAction:function(n){o.execCommand("ToggleSidebar",!1,t),n.setActive(e())},onSetup:function(n){function t(){return n.setActive(e())}return o.on("ToggleSidebar",t),function(){o.off("ToggleSidebar",t)}}})})}(l),function(e,t,o){function r(n){n!==i.get()&&(LE(t(),n,o.providers),i.set(n))}var i=Ce(!1),u=Ce(on.none());e.on("ProgressState",function(n){if(u.get().each(xg.clearTimeout),mn(n.time)){var t=xg.setEditorTimeout(e,function(){return r(n.state)},n.time);u.set(on.some(t))}else r(n.state),u.set(on.none())})}(l,d,h.shared);var n=l.ui.registry.getAll(),t=n.buttons,e=n.menuItems,o=n.contextToolbars,r=n.sidebars,i=rb(l),u={menuItems:e,menus:l.settings.menu?N(l.settings.menu,function(n){return _n(n,{items:n.items})}):{},menubar:l.settings.menubar,toolbar:i.getOrThunk(function(){return l.getParam("toolbar",!0)}),buttons:t,sidebar:r};MB(l,o,p,{backstage:h});var a=l.getElement(),c=F(a),s={mothership:D,uiMothership:A,outerContainer:_},f={targetNode:a,height:c};return g.render(l,s,u,h,f)},getUi:function(){return{channels:{broadcastAll:A.broadcast,broadcastOn:A.broadcastOn,register:function(){}}}}}},VD=function(n,t){var e=on.from(Er(n,"id")).fold(function(){var n=Mr("dialog-label");return Or(t,"id",n),n},f);Or(n,"aria-labelledby",e)},ND=nn([at("lazySink"),pt("dragBlockClass"),Et("getBounds",sa),wt("useTabstopAt",nn(!0)),wt("eventOrder",{}),ss("modalBehaviours",[Fm]),wu("onExecute"),ku("onEscape")]),HD={sketch:f},PD=nn([Uf({name:"draghandle",overrides:function(n,t){return{behaviours:Du([W_.config({mode:"mouse",getTarget:function(n){return Si(n,'[role="dialog"]').getOr(n)},blockerClass:n.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+JSON.stringify(t,null,2)).message),getBounds:n.getDragBounds})])}}}),Lf({schema:[at("dom")],name:"title"}),Lf({factory:HD,schema:[at("dom")],name:"close"}),Lf({factory:HD,schema:[at("dom")],name:"body"}),Uf({factory:HD,schema:[at("dom")],name:"footer"}),jf({factory:{sketch:function(n,t){return I(I({},n),{dom:t.dom,components:t.components})}},schema:[wt("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),wt("components",[])],name:"blocker"})]),zD=$f({name:"ModalDialog",configFields:ND(),partFields:PD(),factory:function(o,n,t,r){var a=Mr("alloy.dialog.busy"),c=Mr("alloy.dialog.idle"),s=Du([Fm.config({mode:"special",onTab:function(){return on.some(!0)},onShiftTab:function(){return on.some(!0)}}),Xm.config({})]),e=Mr("modal-events"),i=I(I({},o.eventOrder),{"alloy.system.attached":[e].concat(o.eventOrder["alloy.system.attached"]||[])});return{uid:o.uid,dom:o.dom,components:n,apis:{show:function(i){var n=o.lazySink(i).getOrDie(),u=Ce(on.none()),t=r.blocker(),e=n.getSystem().build(I(I({},t),{components:t.components.concat([du(i)]),behaviours:Du([Td("dialog-blocker-events",[Zo(c,function(n,t){Br(i.element(),"aria-busy")&&(_r(i.element(),"aria-busy"),u.get().each(function(n){return Im.remove(i,n)}))}),Zo(a,function(n,t){Or(i.element(),"aria-busy","true");var e=t.event().getBusySpec();u.get().each(function(n){Im.remove(i,n)});var o=e(i,s),r=n.getSystem().build(o);u.set(on.some(r)),Im.append(i,du(r)),r.hasConfigured(Fm)&&Fm.focusIn(r)})])])}));Zc(n,e),Fm.focusIn(i)},hide:function(t){dr(t.element()).each(function(n){t.getSystem().getByDom(n).each(function(n){ts(n)})})},getBody:function(n){return Os(n,o,"body")},getFooter:function(n){return Os(n,o,"footer")},setIdle:function(n){Wt(n,c)},setBusy:function(n,t){Gt(n,a,{getBusySpec:t})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:ls(o.modalBehaviours,[Im.config({}),Fm.config({mode:"cyclic",onEnter:o.onExecute,onEscape:o.onEscape,useTabstopAt:o.useTabstopAt}),Td(e,[Pi(function(n){VD(n.element(),Os(n,o,"title").element()),function(n,t){var e=on.from(Er(n,"id")).fold(function(){var n=Mr("dialog-describe");return Or(t,"id",n),n},f);Or(n,"aria-describedby",e)}(n.element(),Os(n,o,"body").element())})])])}},apis:{show:function(n,t){n.show(t)},hide:function(n,t){n.hide(t)},getBody:function(n,t){return n.getBody(t)},getFooter:function(n,t){return n.getFooter(t)},setBusy:function(n,t,e){n.setBusy(t,e)},setIdle:function(n,t){n.setIdle(t)}}}),LD=[st("type"),st("text"),ft("level",["info","warn","error","success"]),st("icon"),wt("url","")],jD=se(LD),UD=[st("type"),st("text"),Tt("disabled",!1),Tt("primary",!1),me("name","name",Mn(function(){return Mr("button-name")}),ye),bt("icon"),Tt("borderless",!1)],WD=se(UD),GD=[st("type"),st("name"),st("label"),Tt("disabled",!1)],XD=se(GD),YD=xe,qD=[st("type"),st("name")],KD=qD.concat([bt("label")]),JD=se(KD),$D=ye,QD=se(KD),ZD=ye,nA=se(KD),tA=qn(ge),eA=KD.concat([Tt("sandboxed",!0)]),oA=se(eA),rA=ye,iA=KD.concat([bt("placeholder"),Tt("maximized",!1),Tt("disabled",!1)]),uA=se(iA),aA=ye,cA=KD.concat([mt("items",[st("text"),st("value")]),kt("size",1),Tt("disabled",!1)]),sA=se(cA),fA=ye,lA=KD.concat([Tt("constrain",!0),Tt("disabled",!1)]),dA=se(lA),mA=se([st("width"),st("height")]),gA=KD.concat([bt("placeholder"),Tt("maximized",!1),Tt("disabled",!1)]),pA=se(gA),hA=ye,vA=KD.concat([Ot("filetype","file",["image","media","file"]),wt("disabled",!1)]),bA=se(vA),yA=se([st("value"),wt("meta",{})]),xA=qD.concat([Ct("tag","textarea"),st("scriptId"),st("scriptUrl"),(_D="settings",DD=undefined,St(_D,DD,ke))]),wA=qD.concat([Ct("tag","textarea"),lt("init")]),SA=Qn(function(n){return nt("customeditor.old",Yn(wA),n).orThunk(function(){return nt("customeditor.new",Yn(xA),n)})}),kA=ye,CA=[st("type"),st("html"),Ot("presets","presentation",["presentation","document"])],OA=se(CA),TA=KD.concat([ct("currentState",se([at("blob"),st("url")]))]),EA=se(TA),BA=KD.concat([wt("columns","auto")]),_A=se(BA),DA=(AD=[st("value"),st("text"),st("icon")],le(AD)),AA=[st("type"),gt("header",ye),gt("cells",qn(ye))],FA=se(AA),MA=pe(function(){return ot("type",{alertbanner:jD,bar:se(function(n){return[st("type"),n]}(J_("bar"))),button:WD,checkbox:XD,colorinput:JD,colorpicker:QD,dropzone:nA,grid:se(K_(J_("grid"))),iframe:oA,input:uA,selectbox:sA,sizeinput:dA,textarea:pA,urlinput:bA,customeditor:SA,htmlpanel:OA,imagetools:EA,collection:_A,label:se(function(n){return[st("type"),st("label"),n]}(J_("label"))),table:FA,panel:RA})}),IA=[st("type"),wt("classes",[]),gt("items",MA)],RA=se(IA),VA=[me("name","name",Mn(function(){return Mr("tab-name")}),ye),st("title"),gt("items",MA)],NA=[st("type"),mt("tabs",VA)],HA=se(NA),PA=se([st("type"),st("name"),Tt("active",!1)].concat(hp)),zA=xe,LA=[me("name","name",Mn(function(){return Mr("button-name")}),ye),bt("icon"),Ot("align","end",["start","end"]),Tt("primary",!1),Tt("disabled",!1)],jA=d(LA,[st("text")]),UA=d([ft("type",["submit","cancel","custom"])],jA),WA=d([ft("type",["menu"]),bt("text"),bt("tooltip"),bt("icon"),gt("items",PA),Et("onSetup",function(){return Z})],LA),GA=jA,XA=rt("type",{submit:UA,cancel:UA,custom:UA,menu:WA}),YA=se([st("title"),ct("body",ot("type",{panel:RA,tabpanel:HA})),Ct("size","normal"),gt("buttons",XA),wt("initialData",{}),Et("onAction",Z),Et("onChange",Z),Et("onSubmit",Z),Et("onClose",Z),Et("onCancel",Z),wt("onTabChange",Z)]),qA=function(n){return sn(n)?[n].concat(E(H(n),qA)):fn(n)?E(n,qA):[]},KA={checkbox:YD,colorinput:$D,colorpicker:ZD,dropzone:tA,input:aA,iframe:rA,sizeinput:mA,selectbox:fA,size:mA,textarea:hA,urlinput:yA,customeditor:kA,collection:DA,togglemenuitem:zA},JA=se(d([ft("type",["cancel","custom"])],GA)),$A=se([st("title"),st("url"),vt("height"),vt("width"),(FD="buttons",MD=JA,ht(FD,qn(MD))),Et("onAction",Z),Et("onCancel",Z),Et("onClose",Z),Et("onMessage",Z)]),QA={open:function(n,t){var e=Z_(t);return n(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(n,t){return n(tt(function(n){return nt("dialog",$A,n)}(t)))},redial:function(n){return Z_(n)}},ZA=Jf({name:"TabButton",configFields:[wt("uid",undefined),at("value"),me("dom","dom",In(function(n){return{attributes:{role:"tab",id:Mr("aria"),"aria-selected":"false"}}}),ve()),pt("action"),wt("domModification",{}),ss("tabButtonBehaviours",[Xm,Fm,jm]),at("view")],factory:function(n,t){return{uid:n.uid,dom:n.dom,components:n.components,events:Nd(n.action),behaviours:ls(n.tabButtonBehaviours,[Xm.config({}),Fm.config({mode:"execution",useSpace:!0,useEnter:!0}),jm.config({store:{mode:"memory",initialValue:n.value}})]),domModification:n.domModification}}}),nF=nn([at("tabs"),at("dom"),wt("clickToDismiss",!1),ss("tabbarBehaviours",[Ml,Fm]),bu(["tabClass","selectedClass"])]),tF=Wf({factory:ZA,name:"tabs",unit:"tab",overrides:function(o,n){function r(n,t){Ml.dehighlight(n,t),Gt(n,Po(),{tabbar:n,button:t})}function i(n,t){Ml.highlight(n,t),Gt(n,Ho(),{tabbar:n,button:t})}return{action:function(n){var t=n.getSystem().getByUid(o.uid).getOrDie(),e=Ml.isHighlighted(t,n);(e&&o.clickToDismiss?r:e?Z:i)(t,n)},domModification:{classes:[o.markers.tabClass]}}}}),eF=nn([tF]),oF=$f({name:"Tabbar",configFields:nF(),partFields:eF(),factory:function(n,t,e,o){return{uid:n.uid,dom:n.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:ls(n.tabbarBehaviours,[Ml.config({highlightClass:n.markers.selectedClass,itemClass:n.markers.tabClass,onHighlight:function(n,t){Or(t.element(),"aria-selected","true")},onDehighlight:function(n,t){Or(t.element(),"aria-selected","false")}}),Fm.config({mode:"flow",getInitial:function(n){return Ml.getHighlighted(n).map(function(n){return n.element()})},selector:"."+n.markers.tabClass,executeOnMove:!0})])}}}),rF=Jf({name:"Tabview",configFields:[ss("tabviewBehaviours",[Im])],factory:function(n,t){return{uid:n.uid,dom:n.dom,behaviours:ls(n.tabviewBehaviours,[Im.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),iF=nn([wt("selectFirst",!0),xu("onChangeTab"),xu("onDismissTab"),wt("tabs",[]),ss("tabSectionBehaviours",[])]),uF=Lf({factory:oF,schema:[at("dom"),dt("markers",[at("tabClass"),at("selectedClass")])],name:"tabbar",defaults:function(n){return{tabs:n.tabs}}}),aF=Lf({factory:rF,name:"tabview"}),cF=nn([uF,aF]),sF=$f({name:"TabSection",configFields:iF(),partFields:cF(),factory:function(r,n,t,e){function o(n,t){Cs(n,r,"tabbar").each(function(n){t(n).each(Xt)})}return{uid:r.uid,dom:r.dom,components:n,behaviours:fs(r.tabSectionBehaviours),events:Jo(R([r.selectFirst?[Pi(function(n,t){o(n,Ml.getFirst)})]:[],[Zo(Ho(),function(n,t){!function(o){var t=jm.getValue(o);Cs(o,r,"tabview").each(function(e){O(r.tabs,function(n){return n.value===t}).each(function(n){var t=n.view();Or(e.element(),"aria-labelledby",Er(o.element(),"id")),Im.set(e,t),r.onChangeTab(e,o,t)})})}(t.event().button())}),Zo(Po(),function(n,t){var e=t.event().button();r.onDismissTab(n,e)})]])),apis:{getViewItems:function(n){return Cs(n,r,"tabview").map(function(n){return Im.contents(n)}).getOr([])},showTab:function(n,e){o(n,function(t){var n=Ml.getCandidates(t);return O(n,function(n){return jm.getValue(n)===e}).filter(function(n){return!Ml.isHighlighted(t,n)})})}}}},apis:{getViewItems:function(n,t){return n.getViewItems(t)},showTab:function(n,t,e){n.showTab(t,e)}}}),fF="send-data-to-section",lF="send-data-to-view",dF=Mr("update-dialog"),mF=Mr("update-title"),gF=Mr("update-body"),pF=Mr("update-footer"),hF=Mr("body-send-message"),vF=function(i,n){function t(n,r){return Zo(n,function(e,o){u(e,function(n,t){r(i(),n,o.event(),e)})})}var u=function(t,e){rE.getState(t).get().each(function(n){e(n,t)})};return d(iD(t,n),[t(wb,function(n,t,e){t.onAction(n,{name:e.name()})})])},bF=function(i,n){function t(n,r){return Zo(n,function(e,o){u(e,function(n,t){r(i(),n,o.event(),e)})})}var u=function(t,e){rE.getState(t).get().each(function(n){e(n.internalDialog,t)})};return d(iD(t,n),[t(Sb,function(n,t){return t.onSubmit(n)}),t(bb,function(n,t,e){t.onChange(n,{name:e.name()})}),t(wb,function(n,t,e,o){function r(){return Fm.focusIn(o)}var i=gl();t.onAction(n,{name:e.name(),value:e.value()}),gl().fold(function(){r()},function(n){!Ze(o.element(),n)||Br(n,"disabled")?r():Ze(n,i.getOrNull())&&Br(i.getOrDie(),"disabled")&&r()})}),t(Ob,function(n,t,e){t.onTabChange(n,{newTabName:e.name(),oldTabName:e.oldName()})}),zi(function(n){var t=i();jm.setValue(n,t.getData())})])},yF=tinymce.util.Tools.resolve("tinymce.util.URI"),xF=["insertContent","setContent","execCommand","close","block","unblock"],wF={dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]}},SF={dom:{tag:"div",classes:["tox-dialog__header"]}},kF=function(s){var e=function(u){var a=u.backstage.shared;return{open:function(n,t){function e(){zD.hide(r),t()}var o=Hd(Ok({name:"close-alert",text:"OK",primary:!0,align:"end",disabled:!1,icon:on.none()},"cancel",u.backstage)),r=lu(BD({lazySink:function(){return a.getSink()},headerOverride:on.some(wF),partSpecs:{title:CD(),close:kD(function(){e()},a.providers),body:OD(n,a.providers),footer:TD(ED([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:Z,extraClasses:["tox-alert-dialog"]}));zD.show(r);var i=o.get(r);Xm.focus(i)}}}(s),o=function(a){var c=a.backstage.shared;return{open:function(n,t){function e(n){zD.hide(i),t(n)}var o=Hd(Ok({name:"yes",text:"Yes",primary:!0,align:"end",disabled:!1,icon:on.none()},"submit",a.backstage)),r=Ok({name:"no",text:"No",primary:!0,align:"end",disabled:!1,icon:on.none()},"cancel",a.backstage),i=lu(BD({lazySink:function(){return c.getSink()},headerOverride:on.some(wF),partSpecs:{title:CD(),close:kD(function(){e(!1)},c.providers),body:OD(n,c.providers),footer:TD(ED([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));zD.show(i);var u=o.get(i);Xm.focus(u)}}}(s),r=function(n,e){return QA.openUrl(function(n){var t=wD(n,{closeWindow:function(){zD.hide(t.dialog),e(t.instanceApi)}},s.editor,s.backstage);return zD.show(t.dialog),t.instanceApi},n)},i=function(n,i){return QA.open(function(n,t,e){var o=t,r=yD({dataValidator:e,initialData:o,internalDialog:n},{redial:QA.redial,closeWindow:function(){zD.hide(r.dialog),i(r.instanceApi)}},s.backstage);return zD.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},n)},u=function(n,u,a,c){return QA.open(function(n,t,e){var o=function(n,t){return tt(nt("data",t,n))}(t,e),r=SD({dataValidator:e,initialData:o,internalDialog:n},{redial:QA.redial,closeWindow:function(){hg.hide(i),a(r.instanceApi)}},s.backstage,c),i=lu(hg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:Du([Td("window-manager-inline-events",[Zo(Ro(),function(n,t){Wt(r.dialog,xb)})])])}));return hg.showAt(i,u,du(r.dialog)),r.instanceApi.setData(o),Fm.focusIn(r.dialog),r.instanceApi},n)};return{open:function(n,t,e){return t!==undefined&&"toolbar"===t.inline?u(n,s.backstage.shared.anchors.toolbar(),e,t.ariaAttrs):t!==undefined&&"cursor"===t.inline?u(n,s.backstage.shared.anchors.cursor(),e,t.ariaAttrs):i(n,e)},openUrl:function(n,t){return r(n,t)},alert:function(n,t){e.open(n,function(){t()})},close:function(n){n.close()},confirm:function(n,t){o.open(n,function(n){t(n)})}}};!function MF(){n.add("silver",function(n){var t=RD(n),e=t.uiMothership,o=t.backstage,r=t.renderUI,i=t.getUi;Iv(n,o.shared);var u=kF({editor:n,backstage:o});return{renderUI:r,getWindowManagerImpl:nn(u),getNotificationManagerImpl:function(){return wg(n,{backstage:o},e)},ui:i()}})}()}(window);
|