agenda-libre-ruby/public/assets/tinymce/themes/silver/theme-b4a4182f53e3ed5da87400ed5743e1578b1a5870fa0f6a3f7069b96b41eee4b6.js
2019-09-15 14:18:27 +02:00

11 lines
370 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.15 (2019-09-02)
*/
!function(M){"use strict";var tt=function(){},p=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},nt=function(t){return function(){return t}},d=function(t){return t};function g(o){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=r.concat(t);return o.apply(null,e)}}var x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return!e.apply(null,t)}},u=function(t){return function(){throw new Error(t)}},t=nt(!1),n=nt(!0),e=tinymce.util.Tools.resolve("tinymce.ThemeManager"),I=function(){return(I=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function h(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(e[o[r]]=t[o[r]])}return e}var o,r,i,a,c,s,l,f=t,m=n,v=function(){return b},b=(a={fold:function(t,n){return t()},is:f,isSome:f,isNone:m,getOr:i=function(t){return t},getOrThunk:r=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:i,orThunk:r,map:v,ap:v,each:function(){},bind:v,flatten:v,exists:f,forall:m,filter:v,equals:o=function(t){return t.isNone()},equals_:o,toArray:function(){return[]},toString:nt("none()")},Object.freeze&&Object.freeze(a),a),y=function(e){var t=function(){return e},n=function(){return r},o=function(t){return t(e)},r={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:m,isNone:f,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return y(t(e))},ap:function(t){return t.fold(v,function(t){return y(t(e))})},each:function(t){t(e)},bind:o,flatten:t,exists:o,forall:o,filter:function(t){return t(e)?r:b},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(f,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return r},et={some:y,none:v,from:function(t){return null===t||t===undefined?b:y(t)}},w=function(e){return{is:function(t){return e===t},isValue:n,isError:t,getOr:nt(e),getOrThunk:nt(e),getOrDie:nt(e),or:function(t){return w(e)},orThunk:function(t){return w(e)},fold:function(t,n){return n(e)},map:function(t){return w(t(e))},mapError:function(t){return w(e)},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return et.some(e)}}},S=function(e){return{is:t,isValue:t,isError:n,getOr:d,getOrThunk:function(t){return t()},getOrDie:function(){return u(String(e))()},or:function(t){return t},orThunk:function(t){return t()},fold:function(t,n){return t(e)},map:function(t){return S(e)},mapError:function(t){return S(t(e))},each:tt,bind:function(t){return S(e)},exists:t,forall:n,toOption:et.none}},R={value:w,error:S,fromOption:function(t,n){return t.fold(function(){return S(n)},w)}},k=function(n){return function(t){return function(t){if(null===t)return"null";var n=typeof t;return"object"===n&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===n&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":n}(t)===n}},C=k("string"),O=k("object"),T=k("array"),E=k("boolean"),B=k("function"),V=k("number"),_=function(t,n){if(T(t)){for(var e=0,o=t.length;e<o;++e)if(!0!==n(t[e]))return!1;return!0}return!1},D=Array.prototype.slice,A=(c=Array.prototype.indexOf)===undefined?function(t,n){return X(t,n)}:function(t,n){return c.call(t,n)},F=function(t,n){return-1<A(t,n)},N=function(t,n){return G(t,n).isSome()},H=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=D.call(t,o,o+n);e.push(r)}return e},P=function(t,n){for(var e=t.length,o=new Array(e),r=0;r<e;r++){var i=t[r];o[r]=n(i,r,t)}return o},z=function(t,n){for(var e=0,o=t.length;e<o;e++){n(t[e],e,t)}},L=function(t,n){for(var e=[],o=0,r=t.length;o<r;o++){var i=t[o];n(i,o,t)&&e.push(i)}return e},j=function(t,n,e){return function(t,n){for(var e=t.length-1;0<=e;e--)n(t[e],e,t)}(t,function(t){e=n(e,t)}),e},U=function(t,n,e){return z(t,function(t){e=n(e,t)}),e},W=function(t,n){for(var e=0,o=t.length;e<o;e++){var r=t[e];if(n(r,e,t))return et.some(r)}return et.none()},G=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e,t))return et.some(e)}return et.none()},X=function(t,n){for(var e=0,o=t.length;e<o;++e)if(t[e]===n)return e;return-1},Y=Array.prototype.push,q=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!T(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);Y.apply(n,t[e])}return n},K=function(t,n){var e=P(t,n);return q(e)},J=function(t,n){for(var e=0,o=t.length;e<o;++e){if(!0!==n(t[e],e,t))return!1}return!0},$=function(t){var n=D.call(t,0);return n.reverse(),n},Q=function(t,n){return L(t,function(t){return!F(n,t)})},Z=function(t){return[t]},ot=function(t){return 0===t.length?et.none():et.some(t[0])},rt=function(t){return 0===t.length?et.none():et.some(t[t.length-1])},it=B(Array.from)?Array.from:function(t){return D.call(t)},ut=Object.keys,at=Object.hasOwnProperty,ct=function(t,n){for(var e=ut(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i,t)}},st=function(t,o){return lt(t,function(t,n,e){return{k:n,v:o(t,n,e)}})},lt=function(o,r){var i={};return ct(o,function(t,n){var e=r(t,n,o);i[e.k]=e.v}),i},ft=function(t,e){var o=[];return ct(t,function(t,n){o.push(e(t,n))}),o},dt=function(t){return ft(t,function(t){return t})},mt=function(t,n){return gt(t,n)?et.from(t[n]):et.none()},gt=function(t,n){return at.call(t,n)},pt=function(u){if(!T(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],e={};return z(u,function(t,o){var n=ut(t);if(1!==n.length)throw new Error("one and only one name per case");var r=n[0],i=t[r];if(e[r]!==undefined)throw new Error("duplicate key detected:"+r);if("cata"===r)throw new Error("cannot have a case named cata (sorry)");if(!T(i))throw new Error("case arguments must be an array");a.push(r),e[r]=function(){var t=arguments.length;if(t!==i.length)throw new Error("Wrong number of arguments to case "+r+". Expected "+i.length+" ("+i+"), got "+t);for(var e=new Array(t),n=0;n<e.length;n++)e[n]=arguments[n];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[o].apply(null,e)},match:function(t){var n=ut(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!J(a,function(t){return F(n,t)}))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+a.join(", "));return t[r].apply(null,e)},log:function(t){M.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},ht=Object.prototype.hasOwnProperty,vt=function(u){return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(0===t.length)throw new Error("Can't merge zero objects");for(var e={},o=0;o<t.length;o++){var r=t[o];for(var i in r)ht.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},bt=vt(function(t,n){return O(t)&&O(n)?bt(t,n):n}),yt=vt(function(t,n){return n}),xt=function(e){var o,r=!1;return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r||(r=!0,o=e.apply(null,t)),o}},wt=pt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),St=function(t){return wt.defaultedThunk(nt(t))},kt=wt.strict,Ct=wt.asOption,Ot=wt.defaultedThunk,Tt=wt.mergeWithThunk,Et=function(n){return function(t){return gt(t,n)?et.from(t[n]):et.none()}},Bt=function(t,n){return Et(n)(t)},_t=function(t,n){var e={};return e[t]=n,e},Dt=(pt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(t,n){return e=n,o={},ct(t,function(t,n){F(e,n)||(o[n]=t)}),o;var e,o}),At=function(t){return Et(t)},Ft=function(t,n){return e=t,o=n,function(t){return gt(t,e)?t[e]:o};var e,o},Mt=function(t,n){return Bt(t,n)},It=function(t,n){return _t(t,n)},Rt=function(t){return n={},z(t,function(t){n[t.key]=t.value}),n;var n},Vt=function(t,n){var e,o,r,i,u,a=(e=[],o=[],z(t,function(t){t.fold(function(t){e.push(t)},function(t){o.push(t)})}),{errors:e,values:o});return 0<a.errors.length?(u=a.errors,R.error(q(u))):(i=n,0===(r=a.values).length?R.value(i):R.value(bt(i,yt.apply(undefined,r))))},Nt=function(t,n){return gt(e=t,o=n)&&e[o]!==undefined&&null!==e[o];var e,o};(l=s||(s={}))[l.Error=0]="Error",l[l.Value=1]="Value";var Ht=function(t,n,e){return t.stype===s.Error?n(t.serror):e(t.svalue)},Pt=function(t){return{stype:s.Value,svalue:t}},zt=function(t){return{stype:s.Error,serror:t}},Lt=function(t){return t.fold(zt,Pt)},jt=function(t){return Ht(t,R.error,R.value)},Ut=Pt,Wt=function(t){var n=[],e=[];return z(t,function(t){Ht(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Gt=zt,Xt=function(t,n){return t.stype===s.Value?n(t.svalue):t},Yt=function(t,n){return t.stype===s.Error?n(t.serror):t},qt=function(t,n){return t.stype===s.Value?{stype:s.Value,svalue:n(t.svalue)}:t},Kt=function(t,n){return t.stype===s.Error?{stype:s.Error,serror:n(t.serror)}:t},Jt=function(t){return p(Gt,q)(t)},$t=function(t,n){var e,o,r=Wt(t);return 0<r.errors.length?Jt(r.errors):(e=r.values,o=n,0<e.length?Ut(bt(o,yt.apply(undefined,e))):Ut(o))},Qt=function(t){var n=Wt(t);return 0<n.errors.length?Jt(n.errors):Ut(n.values)},Zt=pt([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),tn=pt([{field:["name","presence","type"]},{state:["name"]}]),nn=function(t){return O(t)&&100<ut(t).length?" removed due to size":JSON.stringify(t,null,2)},en=function(t,n){return Gt([{path:t,getErrorInfo:n}])},on=pt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),rn=function(e,o,r){return Bt(o,r).fold(function(){return t=r,n=o,en(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+nn(n)});var t,n},Ut)},un=function(t,n,e){var o=Bt(t,n).fold(function(){return e(t)},d);return Ut(o)},an=function(a,c,t,s){return t.fold(function(r,e,t,o){var i=function(t){var n=o.extract(a.concat([r]),s,t);return qt(n,function(t){return _t(e,s(t))})},u=function(t){return t.fold(function(){var t=_t(e,s(et.none()));return Ut(t)},function(t){var n=o.extract(a.concat([r]),s,t);return qt(n,function(t){return _t(e,s(et.some(t)))})})};return t.fold(function(){return Xt(rn(a,c,r),i)},function(t){return Xt(un(c,r,t),i)},function(){return Xt(Ut(Bt(c,r)),u)},function(t){return Xt((e=t,o=Bt(n=c,r).map(function(t){return!0===t?e(n):t}),Ut(o)),u);var n,e,o},function(t){var n=t(c),e=qt(un(c,r,nt({})),function(t){return bt(n,t)});return Xt(e,i)})},function(t,n){var e=n(c);return Ut(_t(t,s(e)))})},cn=function(o){return{extract:function(e,t,n){return Yt(o(n,t),function(t){return n=t,en(e,function(){return n});var n})},toString:function(){return"val"},toDsl:function(){return Zt.itemOf(o)}}},sn=function(t){var c=ln(t),s=j(t,function(n,t){return t.fold(function(t){return bt(n,It(t,!0))},nt(n))},{});return{extract:function(t,n,e){var o,r,i,u=E(e)?[]:(r=ut(o=e),L(r,function(t){return Nt(o,t)})),a=L(u,function(t){return!Nt(s,t)});return 0===a.length?c.extract(t,n,e):(i=a,en(t,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},ln=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=P(a,function(t){return an(o,r,t,i)}),$t(u,{});var o,r,i,u},toString:function(){return"obj{\n"+P(a,function(t){return t.fold(function(t,n,e,o){return t+" -> "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"},toDsl:function(){return Zt.objOf(P(a,function(t){return t.fold(function(t,n,e,o){return tn.field(t,e,o)},function(t,n){return tn.state(t)})}))}}},fn=function(r){return{extract:function(e,o,t){var n=P(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return Qt(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return Zt.arrOf(r)}}},dn=function(a,c){return{extract:function(e,o,r){var t,n,i=ut(r),u=(t=e,n=i,fn(cn(a)).extract(t,d,n));return Xt(u,function(t){var n=P(t,function(t){return on.field(t,t,kt(),c)});return ln(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return Zt.setOf(a,c)}}},mn=nt(cn(Ut)),gn=p(fn,ln),pn=on.state,hn=on.field,vn=function(e,n,o,r,i){return Mt(r,i).fold(function(){return t=r,n=i,en(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+nn(t)});var t,n},function(t){return t.extract(e.concat(["branch: "+i]),n,o)})},bn=function(r,i){return{extract:function(n,e,o){return Mt(o,r).fold(function(){return t=r,en(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return vn(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+ut(i)},toDsl:function(){return Zt.choiceOf(r,i)}}},yn=cn(Ut),xn=function(o){return{extract:function(t,n,e){return o().extract(t,n,e)},toString:function(){return o().toString()},toDsl:function(){return o().toDsl()}}},wn=function(n){return cn(function(t){return n(t).fold(Gt,Ut)})},Sn=function(n,t){return dn(function(t){return Lt(n(t))},t)},kn=function(t,n,e){return jt((o=t,r=d,i=e,u=n.extract([o],r,i),Kt(u,function(t){return{input:i,errors:t}})));var o,r,i,u},Cn=function(t){return t.fold(function(t){throw new Error(Tn(t))},d)},On=function(t,n,e){return Cn(kn(t,n,e))},Tn=function(t){return"Errors: \n"+(n=t.errors,e=10<n.length?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n,P(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+nn(t.input);var n,e},En=function(t,n){return bn(t,n)},Bn=function(t,n){return bn(t,st(n,ln))},_n=nt(yn),Dn=function(e,o){return cn(function(t){var n=typeof t;return e(t)?Ut(t):Gt("Expected type: "+o+" but got: "+n)})},An=Dn(V,"number"),Fn=Dn(C,"string"),Mn=Dn(E,"boolean"),In=Dn(B,"function"),Rn=function(n){var t=function(t,n){for(var e=t.next();!e.done;){if(!n(e.value))return!1;e=t.next()}return!0};if(Object(n)!==n)return!0;switch({}.toString.call(n).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(n).every(function(t){return Rn(n[t])});case"Map":return t(n.keys(),Rn)&&t(n.values(),Rn);case"Set":return t(n.keys(),Rn);default:return!1}},Vn=cn(function(t){return Rn(t)?Ut(t):Gt("Expected value to be acceptable for sending via postMessage")}),Nn=function(n){return wn(function(t){return F(n,t)?R.value(t):R.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},Hn=function(t){return hn(t,t,kt(),mn())},Pn=function(t,n){return hn(t,t,kt(),n)},zn=function(t){return Pn(t,Fn)},Ln=function(t,n){return hn(t,t,kt(),Nn(n))},jn=function(t){return Pn(t,In)},Un=function(t,n){return hn(t,t,kt(),ln(n))},Wn=function(t,n){return hn(t,t,kt(),gn(n))},Gn=function(t,n){return hn(t,t,kt(),fn(n))},Xn=function(t){return hn(t,t,Ct(),mn())},Yn=function(t,n){return hn(t,t,Ct(),n)},qn=function(t){return Yn(t,An)},Kn=function(t){return Yn(t,Fn)},Jn=function(t){return Yn(t,In)},$n=function(t,n){return Yn(t,ln(n))},Qn=function(t,n){return hn(t,t,St(n),mn())},Zn=function(t,n,e){return hn(t,t,St(n),e)},te=function(t,n){return Zn(t,n,An)},ne=function(t,n){return Zn(t,n,Fn)},ee=function(t,n,e){return Zn(t,n,Nn(e))},oe=function(t,n){return Zn(t,n,Mn)},re=function(t,n){return Zn(t,n,In)},ie=function(t,n,e){return Zn(t,n,ln(e))},ue=function(t,n){return pn(t,n)},ae=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return ae(e())}}},ce=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:nt(t)}},se={fromHtml:function(t,n){var e=(n||M.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw M.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return ce(e.childNodes[0])},fromTag:function(t,n){var e=(n||M.document).createElement(t);return ce(e)},fromText:function(t,n){var e=(n||M.document).createTextNode(t);return ce(e)},fromDom:ce,fromPoint:function(t,n,e){var o=t.dom();return et.from(o.elementFromPoint(n,e)).map(ce)}},le=function(t,n,e){return 0!=(t.compareDocumentPosition(n)&e)},fe=function(t,n){return le(t,n,M.Node.DOCUMENT_POSITION_CONTAINED_BY)},de=function(t,n){var e=function(t,n){for(var e=0;e<t.length;e++){var o=t[e];if(o.test(n))return o}return undefined}(t,n);if(!e)return{major:0,minor:0};var o=function(t){return Number(n.replace(e,"$"+t))};return ge(o(1),o(2))},me=function(){return ge(0,0)},ge=function(t,n){return{major:t,minor:n}},pe={nu:ge,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?me():de(t,e)},unknown:me},he="Firefox",ve=function(t,n){return function(){return n===t}},be=function(t){var n=t.current;return{current:n,version:t.version,isEdge:ve("Edge",n),isChrome:ve("Chrome",n),isIE:ve("IE",n),isOpera:ve("Opera",n),isFirefox:ve(he,n),isSafari:ve("Safari",n)}},ye={unknown:function(){return be({current:undefined,version:pe.unknown()})},nu:be,edge:nt("Edge"),chrome:nt("Chrome"),ie:nt("IE"),opera:nt("Opera"),firefox:nt(he),safari:nt("Safari")},xe="Windows",we="Android",Se="Solaris",ke="FreeBSD",Ce=function(t,n){return function(){return n===t}},Oe=function(t){var n=t.current;return{current:n,version:t.version,isWindows:Ce(xe,n),isiOS:Ce("iOS",n),isAndroid:Ce(we,n),isOSX:Ce("OSX",n),isLinux:Ce("Linux",n),isSolaris:Ce(Se,n),isFreeBSD:Ce(ke,n)}},Te={unknown:function(){return Oe({current:undefined,version:pe.unknown()})},nu:Oe,windows:nt(xe),ios:nt("iOS"),android:nt(we),linux:nt("Linux"),osx:nt("OSX"),solaris:nt(Se),freebsd:nt(ke)},Ee=function(t,n){var e=String(n).toLowerCase();return W(t,function(t){return t.search(e)})},Be=function(t,e){return Ee(t,e).map(function(t){var n=pe.detect(t.versionRegexes,e);return{current:t.name,version:n}})},_e=function(t,e){return Ee(t,e).map(function(t){var n=pe.detect(t.versionRegexes,e);return{current:t.name,version:n}})},De=function(t,n){return-1!==t.indexOf(n)},Ae=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Fe=function(n){return function(t){return De(t,n)}},Me=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return De(t,"edge/")&&De(t,"chrome")&&De(t,"safari")&&De(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ae],search:function(t){return De(t,"chrome")&&!De(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return De(t,"msie")||De(t,"trident")}},{name:"Opera",versionRegexes:[Ae,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Fe("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Fe("firefox")},{name:"Safari",versionRegexes:[Ae,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(De(t,"safari")||De(t,"mobile/"))&&De(t,"applewebkit")}}],Ie=[{name:"Windows",search:Fe("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return De(t,"iphone")||De(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Fe("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Fe("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Fe("linux"),versionRegexes:[]},{name:"Solaris",search:Fe("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Fe("freebsd"),versionRegexes:[]}],Re={browsers:nt(Me),oses:nt(Ie)},Ve=function(t){var n,e,o,r,i,u,a,c,s,l,f,d=Re.browsers(),m=Re.oses(),g=Be(d,t).fold(ye.unknown,ye.nu),p=_e(m,t).fold(Te.unknown,Te.nu);return{browser:g,os:p,deviceType:(e=g,o=t,r=(n=p).isiOS()&&!0===/ipad/i.test(o),i=n.isiOS()&&!r,u=n.isAndroid()&&3===n.version.major,a=n.isAndroid()&&4===n.version.major,c=r||u||a&&!0===/mobile/i.test(o),s=n.isiOS()||n.isAndroid(),l=s&&!c,f=e.isSafari()&&n.isiOS()&&!1===/safari/i.test(o),{isiPad:nt(r),isiPhone:nt(i),isTablet:nt(c),isPhone:nt(l),isTouch:nt(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:nt(f)})}},Ne={detect:xt(function(){var t=M.navigator.userAgent;return Ve(t)})},He=(M.Node.ATTRIBUTE_NODE,M.Node.CDATA_SECTION_NODE,M.Node.COMMENT_NODE,M.Node.DOCUMENT_NODE),Pe=(M.Node.DOCUMENT_TYPE_NODE,M.Node.DOCUMENT_FRAGMENT_NODE,M.Node.ELEMENT_NODE),ze=M.Node.TEXT_NODE,Le=(M.Node.PROCESSING_INSTRUCTION_NODE,M.Node.ENTITY_REFERENCE_NODE,M.Node.ENTITY_NODE,M.Node.NOTATION_NODE,Pe),je=He,Ue=function(t,n){var e=t.dom();if(e.nodeType!==Le)return!1;var o=e;if(o.matches!==undefined)return o.matches(n);if(o.msMatchesSelector!==undefined)return o.msMatchesSelector(n);if(o.webkitMatchesSelector!==undefined)return o.webkitMatchesSelector(n);if(o.mozMatchesSelector!==undefined)return o.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")},We=function(t){return t.nodeType!==Le&&t.nodeType!==je||0===t.childElementCount},Ge=function(t,n){var e=n===undefined?M.document:n.dom();return We(e)?[]:P(e.querySelectorAll(t),se.fromDom)},Xe=function(t,n){return t.dom()===n.dom()},Ye=Ne.detect().browser.isIE()?function(t,n){return fe(t.dom(),n.dom())}:function(t,n){var e=t.dom(),o=n.dom();return e!==o&&e.contains(o)},qe=function(t,n){return Xe(t.element(),n.event().target())},Ke=function(t){if(!Nt(t,"can")&&!Nt(t,"abort")&&!Nt(t,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(t,null,2)+" does not have can, abort, or run!");return On("Extracting event.handler",sn([Qn("can",nt(!0)),Qn("abort",nt(!1)),Qn("run",tt)]),t)},Je=function(e){var n,o,r,i,t=(n=e,o=function(t){return t.can},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return U(n,function(t,n){return t&&o(n).apply(undefined,e)},!0)}),u=(r=e,i=function(t){return t.abort},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return U(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return Ke({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];z(e,function(t){t.run.apply(undefined,n)})}})},$e=nt("touchstart"),Qe=nt("touchmove"),Ze=nt("touchend"),to=nt("mousedown"),no=nt("mousemove"),eo=nt("mouseout"),oo=nt("mouseup"),ro=nt("mouseover"),io=nt("focusin"),uo=nt("focusout"),ao=nt("keydown"),co=nt("keyup"),so=nt("input"),lo=nt("change"),fo=nt("click"),mo=nt("transitionend"),go=nt("selectstart"),po={tap:nt("alloy.tap")},ho=nt("alloy.focus"),vo=nt("alloy.blur.post"),bo=nt("alloy.paste.post"),yo=nt("alloy.receive"),xo=nt("alloy.execute"),wo=nt("alloy.focus.item"),So=po.tap,ko=Ne.detect().deviceType.isTouch()?po.tap:fo,Co=nt("alloy.longpress"),Oo=nt("alloy.sandbox.close"),To=nt("alloy.typeahead.cancel"),Eo=nt("alloy.system.init"),Bo=nt("alloy.system.scroll"),_o=nt("alloy.system.resize"),Do=nt("alloy.system.attached"),Ao=nt("alloy.system.detached"),Fo=nt("alloy.system.dismissRequested"),Mo=nt("alloy.focusmanager.shifted"),Io=nt("alloy.slotcontainer.visibility"),Ro=nt("alloy.change.tab"),Vo=nt("alloy.dismiss.tab"),No=nt("alloy.highlight"),Ho=nt("alloy.dehighlight"),Po=function(t,n){Uo(t,t.element(),n,{})},zo=function(t,n,e){Uo(t,t.element(),n,e)},Lo=function(t){Po(t,xo())},jo=function(t,n,e){Uo(t,n,e,{})},Uo=function(t,n,e,o){var r=I({target:n},o);t.getSystem().triggerEvent(e,n,st(r,nt))},Wo=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())};function Go(t,n,e,o,r){return t(e,o)?et.some(e):B(r)&&r(e)?et.none():n(e,o,r)}"undefined"!=typeof M.window?M.window:Function("return this;")();var Xo,Yo,qo,Ko,Jo,$o=function(t){return t.dom().nodeName.toLowerCase()},Qo=function(n){return function(t){return t.dom().nodeType===n}},Zo=Qo(Pe),tr=Qo(ze),nr=function(t){var n=tr(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},er=xt(function(){return or(se.fromDom(M.document))}),or=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return se.fromDom(n)},rr=function(t,n,e){for(var o=t.dom(),r=B(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=se.fromDom(o);if(n(i))return et.some(i);if(r(i))break}return et.none()},ir=function(t,n,e){return Go(function(t,n){return n(t)},rr,t,n,e)},ur=function(t,r){var i=function(t){for(var n=0;n<t.childNodes.length;n++){var e=se.fromDom(t.childNodes[n]);if(r(e))return et.some(e);var o=i(t.childNodes[n]);if(o.isSome())return o}return et.none()};return i(t.dom())},ar=function(t,n,e){return ir(t,function(t){return n(t).isSome()},e).bind(n)},cr=function(t){return Rt(t)},sr=function(t,n){return{key:t,value:Ke({abort:n})}},lr=function(t){return{key:t,value:Ke({run:function(t,n){n.event().prevent()}})}},fr=function(t,n){return{key:t,value:Ke({run:n})}},dr=function(t,n,e){return{key:t,value:Ke({run:function(t){n.apply(undefined,[t].concat(e))}})}},mr=function(t){return function(e){return{key:t,value:Ke({run:function(t,n){qe(t,n)&&e(t,n)}})}}},gr=function(t,n,e){var o,r,i=n.partUids[e];return r=i,fr(o=t,function(t,n){t.getSystem().getByUid(r).each(function(t){Wo(t,t.element(),o,n)})})},pr=function(t,r){return fr(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return ar(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},nt(!1)).getOr(n)},function(t){return t});r(n,o,t)})},hr=function(t){return fr(t,function(t,n){n.cut()})},vr=function(t,n){return mr(t)(n)},br=mr(Do()),yr=mr(Ao()),xr=mr(Eo()),wr=(Xo=xo(),function(t){return fr(Xo,t)}),Sr=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(n.length!==e.length)throw new Error('Wrong number of arguments to struct. Expected "['+n.length+']", got '+e.length+" arguments");var o={};return z(n,function(t,n){o[t]=nt(e[n])}),o}},kr=function(t){return t.slice(0).sort()},Cr=function(n,t){if(!T(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");z(t,function(t){if(!C(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},Or=function(r,i){var e,u=r.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return Cr("required",r),Cr("optional",i),e=kr(u),W(e,function(t,n){return n<e.length-1&&t===e[n+1]}).each(function(t){throw new Error("The field: "+t+" occurs more than once in the combined fields: ["+e.join(", ")+"].")}),function(n){var e=ut(n);J(r,function(t){return F(e,t)})||function(t,n){throw new Error("All required keys ("+kr(t).join(", ")+") were not specified. Specified keys were: "+kr(n).join(", ")+".")}(r,e);var t=L(e,function(t){return!F(u,t)});0<t.length&&function(t){throw new Error("Unsupported keys for object: "+kr(t).join(", "))}(t);var o={};return z(r,function(t){o[t]=nt(n[t])}),z(i,function(t){o[t]=nt(Object.prototype.hasOwnProperty.call(n,t)?et.some(n[t]):et.none())}),o}},Tr=function(t){return se.fromDom(t.dom().ownerDocument)},Er=function(t){return se.fromDom(t.dom().ownerDocument.defaultView)},Br=function(t){return et.from(t.dom().parentNode).map(se.fromDom)},_r=function(t){return et.from(t.dom().offsetParent).map(se.fromDom)},Dr=function(t){return P(t.dom().childNodes,se.fromDom)},Ar=function(t,n){var e=t.dom().childNodes;return et.from(e[n]).map(se.fromDom)},Fr=(Sr("element","offset"),function(n,e){Br(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})}),Mr=function(t,n){var e;(e=t,et.from(e.dom().nextSibling).map(se.fromDom)).fold(function(){Br(t).each(function(t){Rr(t,n)})},function(t){Fr(t,n)})},Ir=function(n,e){Ar(n,0).fold(function(){Rr(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},Rr=function(t,n){t.dom().appendChild(n.dom())},Vr=function(n,t){z(t,function(t){Rr(n,t)})},Nr=function(t){t.dom().textContent="",z(Dr(t),function(t){Hr(t)})},Hr=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},Pr=function(t){var n,e=Dr(t);0<e.length&&(n=t,z(e,function(t){Fr(n,t)})),Hr(t)},zr=function(t){return t.dom().innerHTML},Lr=function(t,n){var e,o,r=Tr(t).dom(),i=se.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||M.document).createElement("div")).innerHTML=e,Dr(se.fromDom(o)));Vr(i,u),Nr(t),Rr(t,i)},jr=function(t,n,e){if(!(C(e)||E(e)||V(e)))throw M.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},Ur=function(t,n,e){jr(t.dom(),n,e)},Wr=function(t,n){var e=t.dom();ct(n,function(t,n){jr(e,n,t)})},Gr=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},Xr=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},Yr=function(t,n){t.dom().removeAttribute(n)},qr=function(t){return n=t,e=!1,se.fromDom(n.dom().cloneNode(e));var n,e},Kr=function(t){var n,e,o,r=qr(t);return n=r,e=se.fromTag("div"),o=se.fromDom(n.dom().cloneNode(!0)),Rr(e,o),zr(e)},Jr=function(t){return Kr(t)},$r=cr([(Yo=ho(),qo=function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(Xe(e=r,t.element())&&!Xe(e,o))||(M.console.warn(ho()+" did not get interpreted by the desired target. \nOriginator: "+Jr(r)+"\nTarget: "+Jr(i)+"\nCheck the "+ho()+" event handlers"),!1)},{key:Yo,value:Ke({can:qo})})]),Qr=/* */Object.freeze({events:$r}),Zr=0,ti=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++Zr+String(n)},ni=nt("alloy-id-"),ei=nt("data-alloy-id"),oi=ni(),ri=ei(),ii=function(t,n){Object.defineProperty(t.dom(),ri,{value:n,writable:!0})},ui=function(t){var n=Zo(t)?t.dom()[ri]:null;return et.from(n)},ai=function(t){return ti(t)},ci=d,si=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+Jr(n().element())+" is not in context.")}};return{debugInfo:nt("fake"),triggerEvent:t("triggerEvent"),triggerFocus:t("triggerFocus"),triggerEscape:t("triggerEscape"),build:t("build"),addToWorld:t("addToWorld"),removeFromWorld:t("removeFromWorld"),addToGui:t("addToGui"),removeFromGui:t("removeFromGui"),getByUid:t("getByUid"),getByDom:t("getByDom"),broadcast:t("broadcast"),broadcastOn:t("broadcastOn"),broadcastEvent:t("broadcastEvent"),isConnected:nt(!1)}},li=si(),fi=function(t){return P(t,function(t){return o=n="/*",r=(e=t).length-n.length,""!==o&&(e.length<o.length||e.substr(r,r+o.length)!==o)?t:t.substring(0,t.length-"/*".length);var n,e,o,r})},di=function(t,n){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return t.toFunctionAnnotation=function(){return{name:n,parameters:fi(i)}},t},mi=ti("alloy-premade"),gi=function(t){return It(mi,t)},pi=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(undefined,[t.getApis()].concat([t].concat(n)))},n=o.toString(),e=n.indexOf(")")+1,r=n.indexOf("("),i=n.substring(r+1,e-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:fi(i.slice(1))}},t;var t,n,e,r,i},hi={init:function(){return vi({readState:function(){return"No State required"}})}},vi=function(t){return t},bi=function(t,r){var i={};return ct(t,function(t,o){ct(t,function(t,n){var e=Ft(n,[])(i);i[n]=e.concat([r(o,t)])})}),i},yi=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},xi=function(t,n){return e=g.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:nt(o)};var e,o},wi=function(t){return t.cHandler},Si=function(t,n){return{name:nt(t),handler:nt(n)}},ki=function(t,n,e){var o,r,i=I({},e,(o=t,r={},z(n,function(t){r[t.name()]=t.handlers(o)}),r));return bi(i,Si)},Ci=function(t){var n,i=B(n=t)?{can:nt(!0),abort:nt(!1),run:n}:n;return function(t,n){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=[t,n].concat(e);i.abort.apply(undefined,r)?n.stop():i.can.apply(undefined,r)&&i.run.apply(undefined,r)}},Oi=function(t,n,e){var o,r,i=n[e];return i?function(u,a,t,c){var n=t.slice(0);try{var e=n.sort(function(t,n){var e=t[a](),o=n[a](),r=c.indexOf(e),i=c.indexOf(o);if(-1===r)throw new Error("The ordering for "+u+" does not have an entry for "+e+".\nOrder specified: "+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 R.value(e)}catch(o){return R.error([o])}}("Event: "+e,"name",t,i).map(function(t){var n=P(t,function(t){return t.handler()});return Je(n)}):(o=e,r=t,R.error(["The event ("+o+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(P(r,function(t){return t.name()}),null,2)]))},Ti=function(t,i){var n=ft(t,function(o,r){return(1===o.length?R.value(o[0].handler()):Oi(o,i,r)).map(function(t){var n=Ci(t),e=1<o.length?L(i[r],function(n){return N(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return It(r,{handler:n,purpose:nt(e)})})});return Vt(n,{})},Ei=function(t){return kn("custom.definition",ln([hn("dom","dom",kt(),ln([Hn("tag"),Qn("styles",{}),Qn("classes",[]),Qn("attributes",{}),Xn("value"),Xn("innerHtml")])),Hn("components"),Hn("uid"),Qn("events",{}),Qn("apis",{}),hn("eventOrder","eventOrder",(n={"alloy.execute":["disabling","alloy.base.behaviour","toggling","typeaheadevents"],"alloy.focus":["alloy.base.behaviour","focusing","keying"],"alloy.system.init":["alloy.base.behaviour","disabling","toggling","representing"],input:["alloy.base.behaviour","representing","streaming","invalidating"],"alloy.system.detached":["alloy.base.behaviour","representing","item-events","tooltipping"],mousedown:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"]},wt.mergeWithThunk(nt(n))),_n()),Xn("domModification")]),t);var n},Bi=function(t,n){var e=Gr(t,n);return e===undefined||""===e?[]:e.split(" ")},_i=function(t){return t.dom().classList!==undefined},Di=function(t,n){return r=n,i=Bi(e=t,o="class").concat([r]),Ur(e,o,i.join(" ")),!0;var e,o,r,i},Ai=function(t,n){return r=n,0<(i=L(Bi(e=t,o="class"),function(t){return t!==r})).length?Ur(e,o,i.join(" ")):Yr(e,o),!1;var e,o,r,i},Fi=function(t,n){_i(t)?t.dom().classList.add(n):Di(t,n)},Mi=function(t){0===(_i(t)?t.dom().classList:Bi(t,"class")).length&&Yr(t,"class")},Ii=function(t,n){_i(t)?t.dom().classList.remove(n):Ai(t,n);Mi(t)},Ri=function(t,n){return _i(t)&&t.dom().classList.contains(n)},Vi=function(n,t){z(t,function(t){Fi(n,t)})},Ni=function(n,t){z(t,function(t){Ii(n,t)})},Hi=function(t){return t.style!==undefined&&B(t.style.getPropertyValue)},Pi=function(t,n,e){if(!C(e))throw M.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);Hi(t)&&t.style.setProperty(n,e)},zi=function(t,n){Hi(t)&&t.style.removeProperty(n)},Li=function(t,n,e){var o=t.dom();Pi(o,n,e)},ji=function(t,n){var e=t.dom();ct(n,function(t,n){Pi(e,n,t)})},Ui=function(t,n){var e=t.dom(),o=M.window.getComputedStyle(e).getPropertyValue(n),r=""!==o||nr(t)?o:Wi(e,n);return null===r?undefined:r},Wi=function(t,n){return Hi(t)?t.style.getPropertyValue(n):""},Gi=function(t,n){var e=t.dom(),o=Wi(e,n);return et.from(o).filter(function(t){return 0<t.length})},Xi=function(t,n,e){var o=se.fromTag(t);return Li(o,n,e),Gi(o,n).isSome()},Yi=function(t,n){var e=t.dom();zi(e,n),Xr(t,"style")&&""===Gr(t,"style").replace(/^\s+|\s+$/g,"")&&Yr(t,"style")},qi=function(t){return t.dom().offsetWidth},Ki=function(t){return t.dom().value},Ji=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},$i=function(t,n){return e=t,r=P(o=n,function(t){return $n(t.name(),[Hn("config"),Qn("state",hi)])}),i=kn("component.behaviours",ln(r),e.behaviours).fold(function(t){throw new Error(Tn(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))},function(t){return t}),{list:o,data:st(i,function(t){var n=t.map(function(t){return{config:t.config,state:t.state.init(t.config)}});return function(){return n}})};var e,o,r,i},Qi=function(t){var n,e,o,r=(n=t,e=Ft("behaviours",{})(n),o=L(ut(e),function(t){return e[t]!==undefined}),P(o,function(t){return e[t].me}));return $i(t,r)},Zi=function(t,n,e){var o,r,i,u=I({},(o=t).dom,{uid:o.uid,domChildren:P(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return yi({})},yi),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=I({},t);z(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=bi(r,function(t,n){return{name:t,modification:n}}),u=function(t){return j(t,function(t,n){return I({},n.modification,t)},{})},a=j(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return yi({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,I({},r=u,{attributes:I({},r.attributes,i.attributes),styles:I({},r.styles,i.styles),classes:r.classes.concat(i.classes)})},tu=function(t,n,e){var o,r,i,u,a,c,s={"alloy.base.behaviour":(o=t,o.events)};return(r=e,i=t.eventOrder,u=n,a=s,c=ki(r,u,a),Ti(c,i)).getOrDie()},nu=function(e){var t=function(){return l},o=ae(li),n=Cn(Ei(e)),r=Qi(e),i=r.list,u=r.data,a=function(t){var n=se.fromTag(t.tag);Wr(n,t.attributes),Vi(n,t.classes),ji(n,t.styles),t.innerHtml.each(function(t){return Lr(n,t)});var e=t.domChildren;return Vr(n,e),t.value.each(function(t){Ji(n,t)}),t.uid,ii(n,t.uid),n}(Zi(n,i,u)),c=tu(n,i,u),s=ae(n.components),l={getSystem:o.get,config:function(t){var n=u;return(B(n[t.name()])?n[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:function(t){return B(u[t.name()])},spec:nt(e),readState:function(t){return u[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return n.apis},connect:function(t){o.set(t)},disconnect:function(){o.set(si(t))},element:nt(a),syncComponents:function(){var t=Dr(a),n=K(t,function(t){return o.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});s.set(n)},components:s.get,events:nt(c)};return l},eu=function(t){var n,e,o=ci(t),r=o.events,i=h(o,["events"]),u=(n=i,e=Ft("components",[])(n),P(e,uu)),a=I({},i,{events:I({},Qr,r),components:u});return R.value(nu(a))},ou=function(t){var n=se.fromText(t);return ru({element:n})},ru=function(t){var n=On("external.component",sn([Hn("element"),Xn("uid")]),t),e=ae(si());n.uid.each(function(t){ii(n.element,t)});var o={getSystem:e.get,config:et.none,hasConfigured:nt(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(si(function(){return o}))},getApis:function(){return{}},element:nt(n.element),spec:nt(t),readState:nt("No state"),syncComponents:tt,components:nt([]),events:nt({})};return gi(o)},iu=ai,uu=function(n){return(t=n,Mt(t,mi)).fold(function(){var t=n.hasOwnProperty("uid")?n:I({uid:iu("")},n);return eu(t).getOrDie()},function(t){return t});var t},au=gi,cu=function(t,n,e){return rr(t,function(t){return Ue(t,n)},e)},su=function(t,n){return e=n,r=(o=t)===undefined?M.document:o.dom(),We(r)?et.none():et.from(r.querySelector(e)).map(se.fromDom);var e,o,r},lu=function(t,n,e){return Go(Ue,cu,t,n,e)},fu=function(){var n=ti("aria-owns");return{id:nt(n),link:function(t){Ur(t,"aria-owns",n)},unlink:function(t){Yr(t,"aria-owns")}}},du=function(n,t){return(e=t,ir(e,function(t){if(!Zo(t))return!1;var n=Gr(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=Gr(t,"id"),e=Tr(t);return su(e,'[aria-owns="'+n+'"]')})).exists(function(t){return mu(n,t)});var e},mu=function(n,t){return e=t,r=nt(!(o=function(t){return Xe(t,n.element())})),ir(e,o,r).isSome()||du(n,t);var e,o,r},gu=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},pu=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return et.none()},hu="unknown";(Jo=Ko||(Ko={}))[Jo.STOP=0]="STOP",Jo[Jo.NORMAL=1]="NORMAL",Jo[Jo.LOGGING=2]="LOGGING";var vu=ae({}),bu=function(n,t,e){var o,r,i,u;switch(Mt(vu.get(),n).orThunk(function(){var t=ut(vu.get());return pu(t,function(t){return-1<n.indexOf(t)?et.some(vu.get()[t]):et.none()})}).getOr(Ko.NORMAL)){case Ko.NORMAL:return e(wu());case Ko.LOGGING:var a=(o=n,r=t,i=[],u=(new Date).getTime(),{logEventCut:function(t,n,e){i.push({outcome:"cut",target:n,purpose:e})},logEventStopped:function(t,n,e){i.push({outcome:"stopped",target:n,purpose:e})},logNoParent:function(t,n,e){i.push({outcome:"no-parent",target:n,purpose:e})},logEventNoHandlers:function(t,n){i.push({outcome:"no-handlers-left",target:n})},logEventResponse:function(t,n,e){i.push({outcome:"response",purpose:e,target:n})},write:function(){var t=(new Date).getTime();F(["mousemove","mouseover","mouseout",Eo()],o)||M.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:P(i,function(t){return F(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+Jr(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Ko.STOP:return!0}},yu=["alloy/data/Fields","alloy/debugging/Debugging"],xu=function(t,n,e){return bu(t,n,e)},wu=nt({logEventCut:tt,logEventStopped:tt,logNoParent:tt,logEventNoHandlers:tt,logEventResponse:tt,write:tt}),Su=nt([Hn("menu"),Hn("selectedMenu")]),ku=nt([Hn("item"),Hn("selectedItem")]),Cu=(nt(ln(ku().concat(Su()))),nt(ln(ku()))),Ou=Un("initSize",[Hn("numColumns"),Hn("numRows")]),Tu=function(){return Un("markers",[Hn("backgroundMenu")].concat(Su()).concat(ku()))},Eu=function(t){return Un("markers",P(t,Hn))},Bu=function(t,n,e){!function(){var t=new Error;if(t.stack===undefined)return;var n=t.stack.split("\n");W(n,function(n){return 0<n.indexOf("alloy")&&!N(yu,function(t){return-1<n.indexOf(t)})}).getOr(hu)}();return hn(n,n,e,wn(function(e){return R.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},_u=function(t){return Bu(0,t,St(tt))},Du=function(t){return Bu(0,t,St(et.none))},Au=function(t){return Bu(0,t,kt())},Fu=function(t){return Bu(0,t,kt())},Mu=function(t,n){return ue(t,nt(n))},Iu=function(t){return ue(t,d)},Ru=nt(Ou),Vu=function(e,o,r){return xr(function(t,n){r(t,e,o)})},Nu=function(t,n,e,o,r,i){var u,a,c=sn(t),s=$n(n,[(u="config",a=t,Yn(u,sn(a)))]);return zu(c,s,n,e,o,r,i)},Hu=function(r,i,u){var t,n,e,o,a,c;return t=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=[e].concat(t);return e.config({name:nt(r)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+r+". Using API: "+u)},function(t){var n=Array.prototype.slice.call(o,1);return i.apply(undefined,[e,t.config,t.state].concat(n))})},n=u,e=i.toString(),o=e.indexOf(")")+1,a=e.indexOf("("),c=e.substring(a+1,o-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:n,parameters:fi(c.slice(0,1).concat(c.slice(3)))}},t},Pu=function(t){return{key:t,value:undefined}},zu=function(e,t,o,r,n,i,u){var a=function(t){return Nt(t,o)?t[o]():et.none()},c=st(n,function(t,n){return Hu(o,t,n)}),s=st(i,function(t,n){return di(t,n)}),l=I({},s,c,{revoke:g(Pu,o),config:function(t){var n=On(o+"-config",e,t);return{key:o,value:{config:n,me:l,configAsRaw:xt(function(){return On(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Mt(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(yi({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Ft("events",function(t,n){return{}})(r)(t.config,t.state)}).getOr({})}});return l},Lu=function(t){return Rt(t)},ju=sn([Hn("fields"),Hn("name"),Qn("active",{}),Qn("apis",{}),Qn("state",hi),Qn("extra",{})]),Uu=function(t){var n=On("Creating behaviour: "+t.name,ju,t);return Nu(n.fields,n.name,n.active,n.apis,n.extra,n.state)},Wu=sn([Hn("branchKey"),Hn("branches"),Hn("name"),Qn("active",{}),Qn("apis",{}),Qn("state",hi),Qn("extra",{})]),Gu=function(t){var n,e,o,r,i,u,a,c,s=On("Creating behaviour: "+t.name,Wu,t);return n=Bn(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=$n(e,[Yn("config",a=n)]),zu(a,c,e,o,r,i,u)},Xu=nt(undefined),Yu=/* */Object.freeze({events:function(a){return cr([fr(yo(),function(r,i){var t,n,u=a.channels,e=ut(u),o=(t=e,(n=i).universal()?t:L(t,function(t){return F(n.channels(),t)}));z(o,function(t){var n=u[t],e=n.schema,o=On("channel["+t+"] data\nReceiver: "+Jr(r.element()),e,i.data());n.onReceive(r,o)})})])}}),qu=[Pn("channels",Sn(R.value,sn([Au("onReceive"),Qn("schema",_n())])))],Ku=Uu({fields:qu,name:"receiving",active:Yu}),Ju=/* */Object.freeze({exhibit:function(t,n){return yi({classes:[],styles:n.useFixed?{}:{position:"relative"}})}}),$u=function(e,o){return{left:nt(e),top:nt(o),translate:function(t,n){return $u(e+t,o+n)}}},Qu=$u,Zu=function(t,n){return t!==undefined?t:n!==undefined?n:0},ta=function(t){var n=t.dom().ownerDocument,e=n.body,o=n.defaultView,r=n.documentElement,i=Zu(o.pageYOffset,r.scrollTop),u=Zu(o.pageXOffset,r.scrollLeft),a=Zu(r.clientTop,e.clientTop),c=Zu(r.clientLeft,e.clientLeft);return na(t).translate(u-c,i-a)},na=function(t){var n,e=t.dom(),o=e.ownerDocument.body;return o===e?Qu(o.offsetLeft,o.offsetTop):nr(t)?(n=e.getBoundingClientRect(),Qu(n.left,n.top)):Qu(0,0)};function ea(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=Ui(t,o);return parseFloat(e)||0}return n},i=function(r,t){return U(t,function(t,n){var e=Ui(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!V(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();Hi(e)&&(e.style[o]=n+"px")},get:t,getOuter:t,aggregate:i,max:function(t,n,e){var o=i(t,e);return o<n?n-o:0}}}var oa=ea("height",function(t){var n=t.dom();return nr(t)?n.getBoundingClientRect().height:n.offsetHeight}),ra=function(t){return oa.get(t)},ia=function(t){return oa.getOuter(t)},ua=ea("width",function(t){return t.dom().offsetWidth}),aa=function(t){return ua.get(t)},ca=function(t){return ua.getOuter(t)},sa=(Ne.detect().browser.isSafari(),function(t){var n=t!==undefined?t.dom():M.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return Qu(e,o)}),la=function(o,t){return o.view(t).fold(nt([]),function(t){var n=o.owner(t),e=la(o,n);return[t].concat(e)})},fa=/* */Object.freeze({view:function(t){return(t.dom()===M.document?et.none():et.from(t.dom().defaultView.frameElement)).map(se.fromDom)},owner:function(t){return Tr(t)}}),da=function(o){var t,n,e,r,i=se.fromDom(M.document),u=sa(i);return(t=o,e=(n=fa).owner(t),r=la(n,e),et.some(r)).fold(g(ta,o),function(t){var n=na(o),e=j(t,function(t,n){var e=na(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return Qu(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},ma=Sr("point","width","height"),ga=Sr("x","y","width","height"),pa=function(t,n,e,o){return{x:nt(t),y:nt(n),width:nt(e),height:nt(o),right:nt(t+e),bottom:nt(n+o)}},ha=function(t){var n=ta(t),e=ca(t),o=ia(t);return pa(n.left(),n.top(),e,o)},va=function(){var t=M.window.innerWidth,n=M.window.innerHeight,e=se.fromDom(M.document),o=sa(e);return pa(o.left(),o.top(),t,n)},ba=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],ya=function(t,n,e){var r=function(t){return Mt(e,t).getOr([])},o=function(t,n,e){var o=Q(ba,e);return{offset:function(){return Qu(t,n)},classesOn:function(){return K(e,r)},classesOff:function(){return K(o,r)}}};return{southeast:function(){return o(-t,n,["top","alignLeft"])},southwest:function(){return o(t,n,["top","alignRight"])},south:function(){return o(-t/2,n,["top","alignCentre"])},northeast:function(){return o(-t,-n,["bottom","alignLeft"])},northwest:function(){return o(t,-n,["bottom","alignRight"])},north:function(){return o(-t/2,-n,["bottom","alignCentre"])},east:function(){return o(t,-n/2,["valignCentre","left"])},west:function(){return o(-t,-n/2,["valignCentre","right"])},innerNorthwest:function(){return o(-t,n,["top","alignRight"])},innerNortheast:function(){return o(t,n,["top","alignLeft"])},innerNorth:function(){return o(-t/2,n,["top","alignCentre"])},innerSouthwest:function(){return o(-t,-n,["bottom","alignRight"])},innerSoutheast:function(){return o(t,-n,["bottom","alignLeft"])},innerSouth:function(){return o(-t/2,-n,["bottom","alignCentre"])},innerWest:function(){return o(t,-n/2,["valignCentre","right"])},innerEast:function(){return o(-t,-n/2,["valignCentre","left"])}}},xa=function(){return ya(0,0,{})},wa=Sr("x","y","bubble","direction","label"),Sa=pt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),ka=Sa.southeast,Ca=Sa.southwest,Oa=Sa.northeast,Ta=Sa.northwest,Ea=Sa.south,Ba=Sa.north,_a=Sa.east,Da=Sa.west,Aa=function(t){return t.x()},Fa=function(t,n){return t.x()+t.width()/2-n.width()/2},Ma=function(t,n){return t.x()+t.width()-n.width()},Ia=function(t,n){return t.y()-n.height()},Ra=function(t){return t.y()+t.height()},Va=function(t,n){return t.y()+t.height()/2-n.height()/2},Na=function(t,n,e){return wa(Aa(t),Ra(t),e.southeast(),ka(),"layout-se")},Ha=function(t,n,e){return wa(Ma(t,n),Ra(t),e.southwest(),Ca(),"layout-sw")},Pa=function(t,n,e){return wa(Aa(t),Ia(t,n),e.northeast(),Oa(),"layout-ne")},za=function(t,n,e){return wa(Ma(t,n),Ia(t,n),e.northwest(),Ta(),"layout-nw")},La=function(t,n,e){return wa(Fa(t,n),Ia(t,n),e.north(),Ba(),"layout-n")},ja=function(t,n,e){return wa(Fa(t,n),Ra(t),e.south(),Ea(),"layout-s")},Ua=function(t,n,e){return wa((o=t).x()+o.width(),Va(t,n),e.east(),_a(),"layout-e");var o},Wa=function(t,n,e){return wa((o=n,t.x()-o.width()),Va(t,n),e.west(),Da(),"layout-w");var o},Ga=function(){return[Na,Ha,Pa,za,ja,La,Ua,Wa]},Xa=function(){return[Ha,Na,za,Pa,ja,La,Ua,Wa]},Ya=Or(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),qa=Sr("position","left","top","right","bottom"),Ka=pt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Ja=function(t,n,e,o,r,i){var u,a,c,s,l,f,d,m,g,p=n.x()-e,h=n.y()-o,v=r-(p+n.width()),b=i-(h+n.height()),y=et.some(p),x=et.some(h),w=et.some(v),S=et.some(b),k=et.none();return u=n.direction(),a=function(){return qa(t,y,x,k,k)},c=function(){return qa(t,k,x,w,k)},s=function(){return qa(t,y,k,k,S)},l=function(){return qa(t,k,k,w,S)},f=function(){return qa(t,y,x,k,k)},d=function(){return qa(t,y,k,k,S)},m=function(){return qa(t,y,x,k,k)},g=function(){return qa(t,k,x,w,k)},u.fold(a,c,s,l,f,d,m,g)},$a=function(t,n){var e=g(da,n),o=t.fold(e,e,function(){var t=sa();return da(n).translate(-t.left(),-t.top())}),r=ca(n),i=ia(n);return pa(o.left(),o.top(),r,i)},Qa=Ka.relative,Za=Ka.fixed,tc=function(t){return t},nc=function(n,e){return function(t){return"rtl"===ec(t)?e:n}},ec=function(t){return"rtl"===Ui(t,"direction")?"rtl":"ltr"},oc=function(){return $n("layouts",[Hn("onLtr"),Hn("onRtl")])},rc=function(n,t,e,o){var r=t.layouts.map(function(t){return t.onLtr(n)}).getOr(e),i=t.layouts.map(function(t){return t.onRtl(n)}).getOr(o);return nc(r,i)(n)},ic=[Hn("hotspot"),Xn("bubble"),Qn("overrides",{}),oc(),Mu("placement",function(t,n,e){var o=n.hotspot,r=$a(e,o.element()),i=rc(t.element(),n,Ga(),Xa());return et.some(tc({anchorBox:r,bubble:n.bubble.getOr(xa()),overrides:n.overrides,layouts:i,placer:et.none()}))})],uc=[Hn("x"),Hn("y"),Qn("height",0),Qn("width",0),Qn("bubble",xa()),Qn("overrides",{}),oc(),Mu("placement",function(t,n,e){var o=pa(n.x,n.y,n.width,n.height),r=rc(t.element(),n,Ga(),Xa());return et.some(tc({anchorBox:o,bubble:n.bubble,overrides:n.overrides,layouts:r,placer:et.none()}))})],ac={create:Sr("start","soffset","finish","foffset")},cc=pt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),sc=(cc.before,cc.on,cc.after,function(t){return t.fold(d,d,d)}),lc=pt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),fc={domRange:lc.domRange,relative:lc.relative,exact:lc.exact,exactFromRange:function(t){return lc.exact(t.start(),t.soffset(),t.finish(),t.foffset())},getWin:function(t){var n=t.match({domRange:function(t){return se.fromDom(t.startContainer)},relative:function(t,n){return sc(t)},exact:function(t,n,e,o){return t}});return Er(n)},range:ac.create},dc=function(t,n,e){var o,r,i=t.document.createRange();return o=i,n.fold(function(t){o.setStartBefore(t.dom())},function(t,n){o.setStart(t.dom(),n)},function(t){o.setStartAfter(t.dom())}),r=i,e.fold(function(t){r.setEndBefore(t.dom())},function(t,n){r.setEnd(t.dom(),n)},function(t){r.setEndAfter(t.dom())}),i},mc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},gc=function(t){return{left:nt(t.left),top:nt(t.top),right:nt(t.right),bottom:nt(t.bottom),width:nt(t.width),height:nt(t.height)}},pc=pt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),hc=function(t,n,e){return n(se.fromDom(e.startContainer),e.startOffset,se.fromDom(e.endContainer),e.endOffset)},vc=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:nt(t),rtl:et.none}},relative:function(t,n){return{ltr:xt(function(){return dc(r,t,n)}),rtl:xt(function(){return et.some(dc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:xt(function(){return mc(r,t,n,e,o)}),rtl:xt(function(){return et.some(mc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return pc.rtl(se.fromDom(t.endContainer),t.endOffset,se.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return hc(0,pc.ltr,o)}):hc(0,pc.ltr,o)},bc=function(t,n,e){return n>=t.left&&n<=t.right&&e>=t.top&&e<=t.bottom};var yc=function sF(e,o){var n=function(t){return e(t)?et.from(t.dom().nodeValue):et.none()};return{get:function(t){if(!e(t))throw new Error("Can only get "+o+" value of a "+o+" node");return n(t).getOr("")},getOption:n,set:function(t,n){if(!e(t))throw new Error("Can only set raw "+o+" value of a "+o+" node");t.dom().nodeValue=n}}}(tr,"text"),xc=function(t){return yc.get(t)},wc=function(t){return yc.getOption(t)},Sc=function(e,o,t,n,r){var i=function(t){var n=e.dom().createRange();return n.setStart(o.dom(),t),n.collapse(!0),n},u=xc(o).length,a=function(t,n,e,o,r){if(0===r)return 0;if(n===o)return r-1;for(var i=o,u=1;u<r;u++){var a=t(u),c=Math.abs(n-a.left);if(e<=a.bottom){if(e<a.top||i<c)return u-1;i=c}}return 0}(function(t){return i(t).getBoundingClientRect()},t,n,r.right,u);return i(a)},kc=function(t,n,e,o){return tr(n)?function(n,e,o,r){var t=n.dom().createRange();t.selectNode(e.dom());var i=t.getClientRects();return pu(i,function(t){return bc(t,o,r)?et.some(t):et.none()}).map(function(t){return Sc(n,e,o,r,t)})}(t,n,e,o):(i=n,u=e,a=o,c=(r=t).dom().createRange(),s=Dr(i),pu(s,function(t){return c.selectNode(t.dom()),bc(c.getBoundingClientRect(),u,a)?kc(r,t,u,a):et.none()}));var r,i,u,a,c,s},Cc=["img","br"],Oc=function(t){return wc(t).filter(function(t){return 0!==t.trim().length||-1<t.indexOf("\xa0")}).isSome()||F(Cc,$o(t))},Tc=function(t){return ur(t,Oc)},Ec=function(t){return Bc(t,Oc)},Bc=function(t,i){var u=function(t){for(var n=Dr(t),e=n.length-1;0<=e;e--){var o=n[e];if(i(o))return et.some(o);var r=u(o);if(r.isSome())return r}return et.none()};return u(t)},_c=function(t,n){return n-t.left<t.right-n},Dc=function(t,n,e){var o=t.dom().createRange();return o.selectNode(n.dom()),o.collapse(e),o},Ac=function(n,t,e){var o=n.dom().createRange();o.selectNode(t.dom());var r=o.getBoundingClientRect(),i=_c(r,e);return(!0===i?Tc:Ec)(t).map(function(t){return Dc(n,t,i)})},Fc=function(t,n,e){var o=n.dom().getBoundingClientRect(),r=_c(o,e);return et.some(Dc(t,n,r))},Mc=function(t,n,e,o){var r=t.dom().createRange();r.selectNode(n.dom());var i=r.getBoundingClientRect();return function(t,n,e,o){var r=t.dom().createRange();r.selectNode(n.dom());var i=r.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,e)),a=Math.max(i.top,Math.min(i.bottom,o));return kc(t,n,u,a)}(t,n,Math.max(i.left,Math.min(i.right,e)),Math.max(i.top,Math.min(i.bottom,o)))},Ic=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(t,n){return Ge(n,t)}),Rc=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=Tr(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),l=Xe(t,e)&&n===o;return s.collapsed&&!l},Vc=function(t){var n=se.fromDom(t.anchorNode),e=se.fromDom(t.focusNode);return Rc(n,t.anchorOffset,e,t.focusOffset)?et.some(ac.create(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return et.some(ac.create(se.fromDom(n.startContainer),n.startOffset,se.fromDom(e.endContainer),e.endOffset))}return et.none()}(t)},Nc=function(t,n){var i,e,o,r,u=vc(i=t,n).match({ltr:function(t,n,e,o){var r=i.document.createRange();return r.setStart(t.dom(),n),r.setEnd(e.dom(),o),r},rtl:function(t,n,e,o){var r=i.document.createRange();return r.setStart(e.dom(),o),r.setEnd(t.dom(),n),r}});return o=(e=u).getClientRects(),0<(r=0<o.length?o[0]:e.getBoundingClientRect()).width||0<r.height?et.some(r).map(gc):et.none()},Hc=Sr("element","offset"),Pc=pt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),zc=function(t){return t.fold(function(t){return t},function(t,n,e){return t.translate(-n,-e)})},Lc=function(t){return t.fold(function(t){return t},function(t,n,e){return t})},jc=function(t){return U(t,function(t,n){return t.translate(n.left(),n.top())},Qu(0,0))},Uc=function(t){var n=P(t,Lc);return jc(n)},Wc=Pc.screen,Gc=Pc.absolute,Xc=function(t,n,e){var o,r,i,u=Tr(t.element()),a=sa(u),c=(o=t,r=e,i=Er(r.root).dom(),et.from(i.frameElement).map(se.fromDom).filter(function(t){var n=Tr(t),e=Tr(o.element());return Xe(n,e)}).map(ta)).getOr(a);return Gc(c,a.left(),a.top())},Yc=function(t,n,e,o){var r=t,i=n,u=e,a=o;t<0&&(r=0,u=e+t),n<0&&(i=0,a=o+n);var c=Wc(Qu(r,i));return et.some(ma(c,u,a))},qc=function(t,c,s,l,f){return t.map(function(t){var n,e,o,r=[c,t.point()],i=(n=function(){return Uc(r)},e=function(){return Uc(r)},o=function(){return t=P(r,zc),jc(t);var t},l.fold(n,e,o)),u=ga(i.left(),i.top(),t.width(),t.height()),a=rc(f,s,s.showAbove?[Pa,za,Na,Ha,La,ja]:[Na,Ha,Pa,za,ja,ja],s.showAbove?[za,Pa,Ha,Na,La,ja]:[Ha,Na,za,Pa,ja,La]);return tc({anchorBox:u,bubble:s.bubble.getOr(xa()),overrides:s.overrides,layouts:a,placer:et.none()})})},Kc=Sr("element","offset"),Jc=function(t,n){return tr(t)?Kc(t,n):function(t,n){var e=Dr(t);if(0===e.length)return Hc(t,n);if(n<e.length)return Hc(e[n],0);var o=e[e.length-1],r=tr(o)?xc(o).length:Dr(o).length;return Hc(o,r)}(t,n)},$c=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,et.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(Vc);var t}})().map(function(t){var n=Jc(t.start(),t.soffset()),e=Jc(t.finish(),t.foffset());return fc.range(n.element(),n.offset(),e.element(),e.offset())})},Qc=[Xn("getSelection"),Hn("root"),Xn("bubble"),oc(),Qn("overrides",{}),Qn("showAbove",!1),Mu("placement",function(t,n,e){var o=Er(n.root).dom(),r=Xc(t,0,n),i=$c(o,n).bind(function(t){return Nc(o,fc.exactFromRange(t)).orThunk(function(){var n=se.fromText("\ufeff");return Fr(t.start(),n),Nc(o,fc.exact(n,0,n,1)).map(function(t){return Hr(n),t})}).bind(function(t){return Yc(t.left(),t.top(),t.width(),t.height())})}),u=$c(o,n).bind(function(t){return Zo(t.start())?et.some(t.start()):Br(t.start())}).getOr(t.element());return qc(i,r,n,e,u)})],Zc=[Hn("node"),Hn("root"),Xn("bubble"),oc(),Qn("overrides",{}),Qn("showAbove",!1),Mu("placement",function(r,i,u){var a=Xc(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=Yc(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return qc(e,a,i,u,o)})})],ts=function(t){return t.x()+t.width()},ns=function(t,n){return t.x()-n.width()},es=function(t,n){return t.y()-n.height()+t.height()},os=function(t){return t.y()},rs=function(t,n,e){return wa(ts(t),os(t),e.southeast(),ka(),"link-layout-se")},is=function(t,n,e){return wa(ns(t,n),os(t),e.southwest(),Ca(),"link-layout-sw")},us=function(t,n,e){return wa(ts(t),es(t,n),e.northeast(),Oa(),"link-layout-ne")},as=function(t,n,e){return wa(ns(t,n),es(t,n),e.northwest(),Ta(),"link-layout-nw")},cs=[Hn("item"),oc(),Qn("overrides",{}),Mu("placement",function(t,n,e){var o=$a(e,n.item.element()),r=rc(t.element(),n,[rs,is,us,as],[is,rs,as,us]);return et.some(tc({anchorBox:o,bubble:xa(),overrides:n.overrides,layouts:r,placer:et.none()}))})],ss=Bn("anchor",{selection:Qc,node:Zc,hotspot:ic,submenu:cs,makeshift:uc}),ls=Sr("anchorBox","origin"),fs=pt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),ds=function(t,N,H,P,z){var L=H.width(),j=H.height(),o=function(t,o,r,i){var n,e,u,a,c,s,l,f,d,m,g,p,h,v,b,y,x,w,S,k,C,O,T,E,B,_,D,A,F,M,I,R,V=t(N,H,P);return(e=L,u=j,a=z,d=(n=V).x(),m=n.y(),g=n.bubble().offset().left(),p=n.bubble().offset().top(),h=a.x(),v=a.y(),b=a.width(),y=a.height(),k=v<=(w=m+p),C=(S=h<=(x=d+g))&&k,O=x+e<=h+b&&w+u<=v+y,T=S?Math.min(e,h+b-x):Math.abs(h-(x+e)),E=k?Math.min(u,v+y-w):Math.abs(v-(w+u)),B=a.x()+a.width(),_=Math.max(a.x(),x),D=Math.min(_,B),F=nt((A=k?w:w+(u-E))+E-v),M=nt(v+y-A),c=n.direction(),l=s=M,f=F,I=c.fold(s,s,f,f,s,f,l,l),R=Ya({x:D,y:A,width:T,height:E,maxHeight:I,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:w}),C&&O?fs.fit(R):fs.nofit(R,T,E)).fold(fs.fit,function(t,n,e){return i<e||r<n?fs.nofit(t,n,e):fs.nofit(o,r,i)})};return U(t,function(t,n){var e=g(o,n);return t.fold(fs.fit,e)},fs.nofit(Ya({x:N.x(),y:N.y(),width:H.width(),height:H.height(),maxHeight:H.height(),direction:ka(),classes:[],label:"none",candidateYforTest:N.y()}),-1,-1)).fold(d,d)},ms=function(t,n,e,o){Yi(n,"max-height");var r,i={width:nt(ca(r=n)),height:nt(ia(r))};return ds(o.preference(),t,i,e,o.bounds())},gs=function(t,n,e){var o,r,i,u,a,c=function(t){return t+"px"},s=(o=e.origin(),r=n,o.fold(function(){return qa("absolute",et.some(r.x()),et.some(r.y()),et.none(),et.none())},function(t,n,e,o){return Ja("absolute",r,t,n,e,o)},function(t,n,e,o){return Ja("fixed",r,t,n,e,o)}));i=t,u={position:et.some(s.position()),left:s.left().map(c),top:s.top().map(c),right:s.right().map(c),bottom:s.bottom().map(c)},a=i.dom(),ct(u,function(t,n){t.fold(function(){zi(a,n)},function(t){Pi(a,n,t)})})},ps=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=oa.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),Li(e,"max-height",r+"px")},hs=nt(function(t,n){ps(t,n),ji(t,{"overflow-x":"hidden","overflow-y":"auto"})}),vs=nt(function(t,n){ps(t,n)}),bs=Or(["bounds","origin","preference","maxHeightFunction"],[]),ys=function(t,n,e,o,r,i){var u,a,c,s,l,f=(u=i,a="maxHeightFunction",c=hs(),u[a]===undefined?c:u[a]),d=t.anchorBox(),m=t.origin(),g=bs({bounds:(s=m,l=r,l.fold(function(){return s.fold(va,va,pa)},function(t){return s.fold(t,t,pa)})),origin:m,preference:o,maxHeightFunction:f});xs(d,n,e,g)},xs=function(t,n,e,o){var r,i,u,a,c=ms(t,n,e,o);gs(n,c,o),r=n,i=c.classes(),Ni(r,i.off),Vi(r,i.on),u=n,a=c,o.maxHeightFunction()(u,a.maxHeight())},ws=function(t,n,e,o,r){var i,u=(i=e.anchorBox,ls(i,n));ys(u,r.element(),e.bubble,e.layouts,o,e.overrides)},Ss=function(t,n,e,o,r,i){var u=i.map(ha);return ks(t,n,e,o,r,u)},ks=function(n,t,e,o,r,i){var u=On("positioning anchor.info",ss,o);Li(r.element(),"position","fixed");var a=Gi(r.element(),"visibility");Li(r.element(),"visibility","hidden");var c,s,l,f=t.useFixed?Za(0,0,M.window.innerWidth,M.window.innerHeight):(s=ta((c=n).element()),l=c.element().dom().getBoundingClientRect(),Qa(s.left(),s.top(),l.width,l.height)),d=u.placement,m=i.map(nt).or(t.getBounds);d(n,u,f).each(function(t){t.placer.getOr(ws)(n,f,t,m,r)}),a.fold(function(){Yi(r.element(),"visibility")},function(t){Li(r.element(),"visibility",t)}),Gi(r.element(),"left").isNone()&&Gi(r.element(),"top").isNone()&&Gi(r.element(),"right").isNone()&&Gi(r.element(),"bottom").isNone()&&Gi(r.element(),"position").is("fixed")&&Yi(r.element(),"position")},Cs=/* */Object.freeze({position:function(t,n,e,o,r){var i=et.none();Ss(t,n,e,o,r,i)},positionWithin:Ss,positionWithinBounds:ks,getMode:function(t,n,e){return n.useFixed?"fixed":"absolute"}}),Os=[Qn("useFixed",!1),Xn("getBounds")],Ts=Uu({fields:Os,name:"positioning",active:Ju,apis:Cs}),Es=function(t){Po(t,Ao());var n=t.components();z(n,Es)},Bs=function(t){var n=t.components();z(n,Bs),Po(t,Do())},_s=function(t,n){Ds(t,n,Rr)},Ds=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),nr(t.element())&&Bs(n),t.syncComponents()},As=function(t){Es(t),Hr(t.element()),t.getSystem().removeFromWorld(t)},Fs=function(n){var t=Br(n.element()).bind(function(t){return n.getSystem().getByDom(t).fold(et.none,et.some)});As(n),t.each(function(t){t.syncComponents()})},Ms=function(t){var n=t.components();z(n,As),Nr(t.element()),t.syncComponents()},Is=function(t,n){Rs(t,n,Rr)},Rs=function(t,n,e){e(t,n.element());var o=Dr(n.element());z(o,function(t){n.getByDom(t).each(Bs)})},Vs=function(n){var t=Dr(n.element());z(t,function(t){n.getByDom(t).each(Es)}),Hr(n.element())},Ns=function(t,n,e,o){var r=function(n,t,e,o){e.get().each(function(t){Ms(n)});var r=t.getAttachPoint(n);_s(r,n);var i=n.getSystem().build(o);return _s(n,i),e.set(i),i}(t,n,e,o);return n.onOpen(t,r),r},Hs=function(n,e,o){o.get().each(function(t){Ms(n),Fs(n),e.onClose(n,t),o.clear()})},Ps=function(t,n,e){return e.isOpen()},zs=function(t,n,e){var o,r,i,u,a=n.getAttachPoint(t);Li(t.element(),"position",Ts.getMode(a)),o=t,r="visibility",i=n.cloakVisibilityAttr,u="hidden",Gi(o.element(),r).fold(function(){Yr(o.element(),i)},function(t){Ur(o.element(),i,t)}),Li(o.element(),r,u)},Ls=function(t,n,e){var o;o=t.element(),N(["top","left","right","bottom"],function(t){return Gi(o,t).isSome()})||Yi(t.element(),"position"),function(t,n,e){if(Xr(t.element(),e)){var o=Gr(t.element(),e);Li(t.element(),n,o)}else Yi(t.element(),n)}(t,"visibility",n.cloakVisibilityAttr)},js=/* */Object.freeze({cloak:zs,decloak:Ls,open:Ns,openWhileCloaked:function(t,n,e,o,r){zs(t,n),Ns(t,n,e,o),r(),Ls(t,n)},close:Hs,isOpen:Ps,isPartOf:function(n,e,t,o){return Ps(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()}}),Us=/* */Object.freeze({events:function(e,o){return cr([fr(Oo(),function(t,n){Hs(t,e,o)})])}}),Ws=[_u("onOpen"),_u("onClose"),Hn("isPartOf"),Hn("getAttachPoint"),Qn("cloakVisibilityAttr","data-precloak-visibility")],Gs=Uu({fields:Ws,name:"sandboxing",active:Us,apis:js,state:/* */Object.freeze({init:function(){var n=ae(et.none()),t=nt("not-implemented");return vi({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(et.none())},set:function(t){n.set(et.some(t))},get:function(t){return n.get()}})}})}),Xs=nt("dismiss.popups"),Ys=nt("mouse.released"),qs=sn([Qn("isExtraPart",nt(!1)),$n("fireEventInstead",[Qn("event",Fo())])]),Ks=function(t){var n=Js(t);return Ku.config(n)},Js=function(t){var e=On("Dismissal",qs,t);return{channels:It(Xs(),{schema:sn([Hn("target")]),onReceive:function(n,t){Gs.isOpen(n)&&(Gs.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return Gs.close(n)},function(t){return Po(n,t.event)}))}})}},$s=function(o,t){return ie(o,{},P(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,hn(n,n,Ct(),cn(function(t){return Gt("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([ue("dump",d)]))},Qs=function(t){return t.dump},Zs=function(t,n){return I({},t.dump,Lu(n))},tl=$s,nl=Zs,el="placeholder",ol=pt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),rl=function(t,n,e,o){return e.uiType===el?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?ol.single(!0,nt(i)):Mt(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+ut(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+JSON.stringify(i,null,2))},function(t){return t.replace()})):ol.single(!1,nt(e));var r,i,u},il=function(i,u,a,c){return rl(i,0,a,c).fold(function(t,n){var e=n(u,a.config,a.validated),o=Mt(e,"components").getOr([]),r=K(o,function(t){return il(i,u,t,c)});return[I({},e,{components:r})]},function(t,n){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(d)(e)})},ul=function(n,e,t,o){var r,i,u,a=st(o,function(t,n){return o=t,r=!1,{name:nt(e=n),required:function(){return o.fold(function(t,n){return t},function(t,n){return t})},used:function(){return r},replace:function(){if(!0===r)throw new Error("Trying to use the same placeholder more than once: "+e);return r=!0,o}};var e,o,r}),c=(r=n,i=e,u=a,K(t,function(t){return il(r,i,t,u)}));return ct(a,function(t){if(!1===t.used()&&t.required())throw new Error("Placeholder: "+t.name()+" was not found in components list\nNamespace: "+n.getOr("none")+"\nComponents: "+JSON.stringify(e.components,null,2))}),c},al=ol.single,cl=ol.multiple,sl=nt(el),ll=pt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),fl=Qn("factory",{sketch:d}),dl=Qn("schema",[]),ml=Hn("name"),gl=hn("pname","pname",Ot(function(t){return"<alloy."+ti(t.name)+">"}),_n()),pl=ue("schema",function(){return[Xn("preprocess")]}),hl=Qn("defaults",nt({})),vl=Qn("overrides",nt({})),bl=ln([fl,dl,ml,gl,hl,vl]),yl=ln([fl,dl,ml,hl,vl]),xl=ln([fl,dl,ml,gl,hl,vl]),wl=ln([fl,pl,ml,Hn("unit"),gl,hl,vl]),Sl=function(t){return t.fold(et.some,et.none,et.some,et.some)},kl=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},Cl=function(e,o){return function(t){var n=On("Converting part type",o,t);return e(n)}},Ol=Cl(ll.required,bl),Tl=Cl(ll.external,yl),El=Cl(ll.optional,xl),Bl=Cl(ll.group,wl),_l=nt("entirety"),Dl=/* */Object.freeze({required:Ol,external:Tl,optional:El,group:Bl,asNamedPart:Sl,name:kl,asCommon:function(t){return t.fold(d,d,d,d)},original:_l}),Al=function(t,n,e,o){return bt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},Fl=function(r,t){var n={};return z(t,function(t){Sl(t).each(function(e){var o=Ml(r,e.pname);n[e.name]=function(t){var n=On("Part: "+e.name+" in "+r,ln(e.schema),t);return I({},o,{config:t,validated:n})}})}),n},Ml=function(t,n){return{uiType:sl(),owner:t,name:n}},Il=function(t,n,e){return{uiType:sl(),owner:t,name:n,config:e,validated:{}}},Rl=function(t){return K(t,function(t){return t.fold(et.none,et.some,et.none,et.none).map(function(t){return Un(t.name,t.schema.concat([Iu(_l())]))}).toArray()})},Vl=function(t){return P(t,kl)},Nl=function(t,n,e){return o=n,i={},r={},z(e,function(t){t.fold(function(o){i[o.pname]=al(!0,function(t,n,e){return o.factory.sketch(Al(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=nt(t.factory.sketch(Al(o,t,n[_l()]),n))},function(o){i[o.pname]=al(!1,function(t,n,e){return o.factory.sketch(Al(t,o,n,e))})},function(r){i[r.pname]=cl(!0,function(n,t,e){var o=n[r.name];return P(o,function(t){return r.factory.sketch(bt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:nt(i),externals:nt(r)};var o,i,r},Hl=function(t,n,e){return ul(et.some(t),n,n.components,e)},Pl=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},zl=function(t,n,e){return Pl(t,n,e).getOrDie("Could not find part: "+e)},Ll=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return z(e,function(t){o[t]=nt(i.getByUid(r[t]))}),o},jl=function(t,n){var e=t.getSystem();return st(n.partUids,function(t,n){return nt(e.getByUid(t))})},Ul=function(t){return ut(t.partUids)},Wl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return z(e,function(t){o[t]=nt(i.getByUid(r[t]).getOrDie())}),o},Gl=function(n,t){var e=Vl(t);return Rt(P(e,function(t){return{key:t,value:n+"-"+t}}))},Xl=function(n){return hn("partUids","partUids",Tt(function(t){return Gl(t.uid,n)}),_n())},Yl=/* */Object.freeze({generate:Fl,generateOne:Il,schemas:Rl,names:Vl,substitutes:Nl,components:Hl,defaultUids:Gl,defaultUidsSchema:Xl,getAllParts:jl,getAllPartNames:Ul,getPart:Pl,getPartOrDie:zl,getParts:Ll,getPartsOrDie:Wl}),ql=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[Un("parts",i)]:[]).concat([Hn("uid"),Qn("dom",{}),Qn("components",[]),Iu("originalSpec"),Qn("debug.sketcher",{})]).concat(u));return On(t+" [SpecSchema]",sn(a.concat(n)),e)},Kl=function(t,n,e,o,r){var i=Jl(r),u=Rl(e),a=Xl(e),c=ql(t,n,i,u,[a]),s=Nl(0,c,e);return o(c,Hl(t,c,s.internals()),i,s.externals())},Jl=function(t){return t.hasOwnProperty("uid")?t:I({},t,{uid:ai("uid")})};var $l,Ql,Zl=sn([Hn("name"),Hn("factory"),Hn("configFields"),Qn("apis",{}),Qn("extraApis",{})]),tf=sn([Hn("name"),Hn("factory"),Hn("configFields"),Hn("partFields"),Qn("apis",{}),Qn("extraApis",{})]),nf=function(t){var i=On("Sketcher for "+t.name,Zl,t),n=st(i.apis,pi),e=st(i.extraApis,function(t,n){return di(t,n)});return I({name:nt(i.name),partFields:nt([]),configFields:nt(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=Jl(t),o(ql(n,e,r,[],[]),r);var n,e,o,r}},n,e)},ef=function(t){var n=On("Sketcher for "+t.name,tf,t),e=Fl(n.name,n.partFields),o=st(n.apis,pi),r=st(n.extraApis,function(t,n){return di(t,n)});return I({name:nt(n.name),partFields:nt(n.partFields),configFields:nt(n.configFields),sketch:function(t){return Kl(n.name,n.configFields,n.partFields,n.factory,t)},parts:nt(e)},o,r)},of=function(t){return"input"===$o(t)&&"radio"!==Gr(t,"type")||"textarea"===$o(t)},rf=/* */Object.freeze({getCurrent:function(t,n,e){return n.find(t)}}),uf=[Hn("find")],af=Uu({fields:uf,name:"composing",apis:rf}),cf=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},sf=function(t,n,e){return t<=n?n:e<=t?e:t},lf=function(e,o,t,r){var n=Ic(e.element(),"."+o.highlightClass);z(n,function(n){N(r,function(t){return t.element()===n})||(Ii(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),Po(t,Ho())}))})},ff=function(t,n,e,o){lf(t,n,0,[o]),df(t,n,e,o)||(Fi(o.element(),n.highlightClass),n.onHighlight(t,o),Po(o,No()))},df=function(t,n,e,o){return Ri(o.element(),n.highlightClass)},mf=function(t,n,e,o){var r=Ic(t.element(),"."+n.itemClass);return et.from(r[o]).fold(function(){return R.error("No element found with index "+o)},t.getSystem().getByDom)},gf=function(n,t,e){return su(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},pf=function(n,t,e){var o=Ic(n.element(),"."+t.itemClass);return(0<o.length?et.some(o[o.length-1]):et.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},hf=function(e,n,t,o){var r=Ic(e.element(),"."+n.itemClass);return G(r,function(t){return Ri(t,n.highlightClass)}).bind(function(t){var n=cf(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},vf=function(n,t,e){var o=Ic(n.element(),"."+t.itemClass);return gu(P(o,function(t){return n.getSystem().getByDom(t).toOption()}))},bf=/* */Object.freeze({dehighlightAll:function(t,n,e){return lf(t,n,0,[])},dehighlight:function(t,n,e,o){df(t,n,e,o)&&(Ii(o.element(),n.highlightClass),n.onDehighlight(t,o),Po(o,Ho()))},highlight:ff,highlightFirst:function(n,e,o){gf(n,e).each(function(t){ff(n,e,o,t)})},highlightLast:function(n,e,o){pf(n,e).each(function(t){ff(n,e,o,t)})},highlightAt:function(n,e,o,t){mf(n,e,o,t).fold(function(t){throw new Error(t)},function(t){ff(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=vf(n,e);W(r,t).each(function(t){ff(n,e,o,t)})},isHighlighted:df,getHighlighted:function(n,t,e){return su(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:gf,getLast:pf,getPrevious:function(t,n,e){return hf(t,n,0,-1)},getNext:function(t,n,e){return hf(t,n,0,1)},getCandidates:vf}),yf=[Hn("highlightClass"),Hn("itemClass"),_u("onHighlight"),_u("onDehighlight")],xf=Uu({fields:yf,name:"highlighting",apis:bf}),wf=function(t,n,e){var o=$(t.slice(0,n)),r=$(t.slice(n+1));return W(o.concat(r),e)},Sf=function(t,n,e){var o=$(t.slice(0,n));return W(o,e)},kf=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return W(r.concat(o),e)},Cf=function(t,n,e){var o=t.slice(n+1);return W(o,e)},Of=function(e){return function(t){var n=t.raw();return F(e,n.which)}},Tf=function(t){return function(n){return J(t,function(t){return t(n)})}},Ef=function(t){return!0===t.raw().shiftKey},Bf=function(t){return!0===t.raw().ctrlKey},_f=x(Ef),Df=function(t,n){return{matches:t,classification:n}},Af=function(t){t.dom().focus()},Ff=function(t){var n=t!==undefined?t.dom():M.document;return et.from(n.activeElement).map(se.fromDom)},Mf=function(n){return Ff(Tr(n)).filter(function(t){return n.dom().contains(t.dom())})},If=function(t,n,e){n.exists(function(n){return e.exists(function(t){return Xe(t,n)})})||zo(t,Mo(),{prevFocus:n,newFocus:e})},Rf=function(){var r=function(t){return Mf(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);If(t,e,o)}}},Vf=function(){var r=function(t){return xf.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(tt,function(t){xf.highlight(n,t)});var o=r(n);If(n,e,o)}}};(Ql=$l||($l={})).OnFocusMode="onFocus",Ql.OnEnterOrSpaceMode="onEnterOrSpace",Ql.OnApiMode="onApi";var Nf,Hf=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i,u,a=t(n,e,o,r);return(i=a,u=e.event(),W(i,function(t){return t.matches(u)}).map(function(t){return t.classification})).bind(function(t){return t(n,e,o,r)})},r={schema:function(){return t.concat([Qn("focusManager",Rf()),Zn("focusInside","onFocus",wn(function(t){return F(["onFocus","onEnterOrSpace","onApi"],t)?R.value(t):R.error("Invalid value for focusInside")})),Mu("handler",r),Mu("state",n),Mu("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==$l.OnFocusMode?et.none():a(i).map(function(e){return fr(ho(),function(t,n){e(t,i,u),n.stop()})});return cr(t.toArray().concat([fr(ao(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=Of([32].concat([13]))(e.event()),i.focusInside===$l.OnEnterOrSpaceMode&&t&&qe(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(t){r.stop()})}),fr(co(),function(t,n){c(t,n,o,i,u).each(function(t){n.stop()})})]))}};return r},Pf=function(t){var n=[Xn("onEscape"),Xn("onEnter"),Qn("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Qn("firstTabstop",0),Qn("useTabstopAt",nt(!0)),Xn("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return lu(n,t)}).getOr(n);return 0<ra(e)},e=function(n,e){var t,o,r,i;(t=n,o=e,r=Ic(t.element(),o.selector),i=L(r,function(t){return u(o,t)}),et.from(i[o.firstTabstop])).each(function(t){e.focusManager.set(n,t)})},a=function(n,t,e,o,r){return r(t,e,function(t){return u(n=o,e=t)&&n.useTabstopAt(e);var n,e}).fold(function(){return o.cyclic?et.some(!0):et.none()},function(t){return o.focusManager.set(n,t),et.some(!0)})},i=function(n,t,e,o){var r,i,u=Ic(n.element(),e.selector);return(r=n,i=e,i.focusManager.get(r).bind(function(t){return lu(t,i.selector)})).bind(function(t){return G(u,g(Xe,t)).bind(function(t){return a(n,u,t,e,o)})})},o=nt([Df(Tf([Ef,Of([9])]),function(t,n,e,o){var r=e.cyclic?wf:Sf;return i(t,0,e,r)}),Df(Of([9]),function(t,n,e,o){var r=e.cyclic?kf:Cf;return i(t,0,e,r)}),Df(Of([27]),function(n,e,t,o){return t.onEscape.bind(function(t){return t(n,e)})}),Df(Tf([_f,Of([13])]),function(n,e,t,o){return t.onEnter.bind(function(t){return t(n,e)})})]),r=nt([]);return Hf(n,hi.init,o,r,function(){return et.some(e)})},zf=Pf(ue("cyclic",nt(!1))),Lf=Pf(ue("cyclic",nt(!0))),jf=function(t,n,e){return of(e)&&Of([32])(n.event())?et.none():(jo(t,e,xo()),et.some(!0))},Uf=function(t,n){return et.some(!0)},Wf=[Qn("execute",jf),Qn("useSpace",!1),Qn("useEnter",!0),Qn("useControlEnter",!1),Qn("useDown",!1)],Gf=function(t,n,e){return e.execute(t,n,t.element())},Xf=Hf(Wf,hi.init,function(t,n,e,o){var r=e.useSpace&&!of(t.element())?[32]:[],i=e.useEnter?[13]:[],u=e.useDown?[40]:[],a=r.concat(i).concat(u);return[Df(Of(a),Gf)].concat(e.useControlEnter?[Df(Tf([Bf,Of([13])]),Gf)]:[])},function(t,n,e,o){return e.useSpace&&!of(t.element())?[Df(Of([32]),Uf)]:[]},function(){return et.none()}),Yf=function(t){var e=ae(et.none());return vi({readState:function(){return e.get().map(function(t){return{numRows:t.numRows(),numColumns:t.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(et.some({numRows:nt(t),numColumns:nt(n)}))},getNumRows:function(){return e.get().map(function(t){return t.numRows()})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns()})}})},qf=/* */Object.freeze({flatgrid:Yf,init:function(t){return t.state(t)}}),Kf=function(i){return function(t,n,e,o){var r=i(t.element());return Zf(r,t,n,e,o)}},Jf=function(t,n){var e=nc(t,n);return Kf(e)},$f=function(t,n){var e=nc(n,t);return Kf(e)},Qf=function(r){return function(t,n,e,o){return Zf(r,t,n,e,o)}},Zf=function(n,e,t,o,r){return o.focusManager.get(e).bind(function(t){return n(e.element(),t,o,r)}).map(function(t){return o.focusManager.set(e,t),!0})},td=Qf,nd=Qf,ed=Qf,od=function(t){var n,e=t.dom();return!((n=e).offsetWidth<=0&&n.offsetHeight<=0)},rd=Or(["index","candidates"],[]),id=function(t,n,e){var o,r=g(Xe,n),i=Ic(t,e),u=L(i,od);return G(o=u,r).map(function(t){return rd({index:t,candidates:o})})},ud=function(t,n){return G(t,function(t){return Xe(n,t)})},ad=function(e,t,o,n){return n(Math.floor(t/o),t%o).bind(function(t){var n=t.row()*o+t.column();return 0<=n&&n<e.length?et.some(e[n]):et.none()})},cd=function(r,t,i,u,a){return ad(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=cf(n,a,0,e-1);return et.some({row:nt(t),column:nt(o)})})},sd=function(i,t,u,a,c){return ad(i,t,a,function(t,n){var e=cf(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=sf(n,0,o-1);return et.some({row:nt(e),column:nt(r)})})},ld=[Hn("selector"),Qn("execute",jf),Du("onEscape"),Qn("captureTab",!1),Ru()],fd=function(n,e,t){su(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},dd=function(r){return function(t,n,e,o){return id(t,n,e.selector).bind(function(t){return r(t.candidates(),t.index(),o.getNumRows().getOr(e.initSize.numRows),o.getNumColumns().getOr(e.initSize.numColumns))})}},md=function(t,n,e,o){return e.captureTab?et.some(!0):et.none()},gd=dd(function(t,n,e,o){return cd(t,n,e,o,-1)}),pd=dd(function(t,n,e,o){return cd(t,n,e,o,1)}),hd=dd(function(t,n,e,o){return sd(t,n,e,o,-1)}),vd=dd(function(t,n,e,o){return sd(t,n,e,o,1)}),bd=nt([Df(Of([37]),Jf(gd,pd)),Df(Of([39]),$f(gd,pd)),Df(Of([38]),td(hd)),Df(Of([40]),nd(vd)),Df(Tf([Ef,Of([9])]),md),Df(Tf([_f,Of([9])]),md),Df(Of([27]),function(t,n,e,o){return e.onEscape(t,n)}),Df(Of([32].concat([13])),function(n,e,o,t){return(r=n,i=o,i.focusManager.get(r).bind(function(t){return lu(t,i.selector)})).bind(function(t){return o.execute(n,e,t)});var r,i})]),yd=nt([Df(Of([32]),Uf)]),xd=Hf(ld,Yf,bd,yd,function(){return et.some(fd)}),wd=function(t,n,e,i){var u=function(t,n,e){var o,r=cf(n,i,0,e.length-1);return r===t?et.none():(o=e[r],"button"===$o(o)&&"disabled"===Gr(o,"disabled")?u(t,r,e):et.from(e[r]))};return id(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},Sd=[Hn("selector"),Qn("getInitial",et.none),Qn("execute",jf),Du("onEscape"),Qn("executeOnMove",!1),Qn("allowVertical",!0)],kd=function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return lu(t,r.selector)})).bind(function(t){return o.execute(n,e,t)});var t,r},Cd=function(n,e){e.getInitial(n).orThunk(function(){return su(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},Od=function(t,n,e){return wd(t,e.selector,n,-1)},Td=function(t,n,e){return wd(t,e.selector,n,1)},Ed=function(o){return function(t,n,e){return o(t,n,e).bind(function(){return e.executeOnMove?kd(t,n,e):et.some(!0)})}},Bd=function(t,n,e,o){return e.onEscape(t,n)},_d=nt([Df(Of([32]),Uf)]),Dd=Hf(Sd,hi.init,function(t,n,e,o){var r=[37].concat(e.allowVertical?[38]:[]),i=[39].concat(e.allowVertical?[40]:[]);return[Df(Of(r),Ed(Jf(Od,Td))),Df(Of(i),Ed($f(Od,Td))),Df(Of([13]),kd),Df(Of([32]),kd),Df(Of([27]),Bd)]},_d,function(){return et.some(Cd)}),Ad=Or(["rowIndex","columnIndex","cell"],[]),Fd=function(t,n,e){return et.from(t[n]).bind(function(t){return et.from(t[e]).map(function(t){return Ad({rowIndex:n,columnIndex:e,cell:t})})})},Md=function(t,n,e,o){var r=t[n].length,i=cf(e,o,0,r-1);return Fd(t,n,i)},Id=function(t,n,e,o){var r=cf(e,o,0,t.length-1),i=t[r].length,u=sf(n,0,i-1);return Fd(t,r,u)},Rd=function(t,n,e,o){var r=t[n].length,i=sf(e+o,0,r-1);return Fd(t,n,i)},Vd=function(t,n,e,o){var r=sf(e+o,0,t.length-1),i=t[r].length,u=sf(n,0,i-1);return Fd(t,r,u)},Nd=[Un("selectors",[Hn("row"),Hn("cell")]),Qn("cycles",!0),Qn("previousSelector",et.none),Qn("execute",jf)],Hd=function(n,e){e.previousSelector(n).orThunk(function(){var t=e.selectors;return su(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},Pd=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return lu(o,i.selectors.row).bind(function(t){var n=Ic(t,i.selectors.cell);return ud(n,o).bind(function(o){var r=Ic(e,i.selectors.row);return ud(r,t).bind(function(t){var n,e=(n=i,P(r,function(t){return Ic(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell()})})})})}},zd=Pd(function(t,n,e){return Md(t,n,e,-1)},function(t,n,e){return Rd(t,n,e,-1)}),Ld=Pd(function(t,n,e){return Md(t,n,e,1)},function(t,n,e){return Rd(t,n,e,1)}),jd=Pd(function(t,n,e){return Id(t,e,n,-1)},function(t,n,e){return Vd(t,e,n,-1)}),Ud=Pd(function(t,n,e){return Id(t,e,n,1)},function(t,n,e){return Vd(t,e,n,1)}),Wd=nt([Df(Of([37]),Jf(zd,Ld)),Df(Of([39]),$f(zd,Ld)),Df(Of([38]),td(jd)),Df(Of([40]),nd(Ud)),Df(Of([32].concat([13])),function(n,e,o){return Mf(n.element()).bind(function(t){return o.execute(n,e,t)})})]),Gd=nt([Df(Of([32]),Uf)]),Xd=Hf(Nd,hi.init,Wd,Gd,function(){return et.some(Hd)}),Yd=[Hn("selector"),Qn("execute",jf),Qn("moveOnTab",!1)],qd=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},Kd=function(n,e){su(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},Jd=function(t,n,e){return wd(t,e.selector,n,-1)},$d=function(t,n,e){return wd(t,e.selector,n,1)},Qd=nt([Df(Of([38]),ed(Jd)),Df(Of([40]),ed($d)),Df(Tf([Ef,Of([9])]),function(t,n,e){return e.moveOnTab?ed(Jd)(t,n,e):et.none()}),Df(Tf([_f,Of([9])]),function(t,n,e){return e.moveOnTab?ed($d)(t,n,e):et.none()}),Df(Of([13]),qd),Df(Of([32]),qd)]),Zd=nt([Df(Of([32]),Uf)]),tm=Hf(Yd,hi.init,Qd,Zd,function(){return et.some(Kd)}),nm=[Du("onSpace"),Du("onEnter"),Du("onShiftEnter"),Du("onLeft"),Du("onRight"),Du("onTab"),Du("onShiftTab"),Du("onUp"),Du("onDown"),Du("onEscape"),Qn("stopSpaceKeyup",!1),Xn("focusIn")],em=Hf(nm,hi.init,function(t,n,e){return[Df(Of([32]),e.onSpace),Df(Tf([_f,Of([13])]),e.onEnter),Df(Tf([Ef,Of([13])]),e.onShiftEnter),Df(Tf([Ef,Of([9])]),e.onShiftTab),Df(Tf([_f,Of([9])]),e.onTab),Df(Of([38]),e.onUp),Df(Of([40]),e.onDown),Df(Of([37]),e.onLeft),Df(Of([39]),e.onRight),Df(Of([32]),e.onSpace),Df(Of([27]),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[Df(Of([32]),Uf)]:[]},function(t){return t.focusIn}),om=zf.schema(),rm=Lf.schema(),im=Dd.schema(),um=xd.schema(),am=Xd.schema(),cm=Xf.schema(),sm=tm.schema(),lm=em.schema(),fm=Gu({branchKey:"mode",branches:/* */Object.freeze({acyclic:om,cyclic:rm,flow:im,flatgrid:um,matrix:am,execution:cm,menu:sm,special:lm}),name:"keying",active:{events:function(t,n){return t.handler.toEvents(t,n)}},apis:{focusIn:function(n,e,o){e.sendFocusIn(e).fold(function(){n.getSystem().triggerFocus(n.element(),n.element())},function(t){t(n,e,o)})},setGridSize:function(t,n,e,o,r){Nt(e,"setGridSize")?e.setGridSize(o,r):M.console.error("Layout does not support setGridSize")}},state:qf}),dm=function(t,n,e,o){var r=t.getSystem().build(o);Ds(t,r,e)},mm=function(t,n,e,o){var r=gm(t);W(r,function(t){return Xe(o.element(),t.element())}).each(Fs)},gm=function(t,n){return t.components()},pm=function(n,t,e,r,o){var i=gm(n);return et.from(i[r]).map(function(t){return mm(n,0,0,t),o.each(function(t){dm(n,0,function(t,n){var e,o;o=n,Ar(e=t,r).fold(function(){Rr(e,o)},function(t){Fr(t,o)})},t)}),t})},hm=Uu({fields:[],name:"replacing",apis:/* */Object.freeze({append:function(t,n,e,o){dm(t,0,Rr,o)},prepend:function(t,n,e,o){dm(t,0,Ir,o)},remove:mm,replaceAt:pm,replaceBy:function(n,t,e,o,r){var i=gm(n);return G(i,o).bind(function(t){return pm(n,0,0,t,r)})},set:function(n,t,e,o){var r,i,u,a;Ms(n),r=function(){var t=P(o,n.getSystem().build);z(t,function(t){_s(n,t)})},i=n.element(),u=Tr(i),a=Ff(u).bind(function(n){var t=function(t){return Xe(n,t)};return t(i)?et.some(i):ur(i,t)}),r(i),a.each(function(n){Ff(u).filter(function(t){return Xe(t,n)}).fold(function(){Af(n)},tt)})},contents:gm})}),vm=function(t,n,e){n.store.manager.onLoad(t,n,e)},bm=function(t,n,e){n.store.manager.onUnload(t,n,e)},ym=/* */Object.freeze({onLoad:vm,onUnload:bm,setValue:function(t,n,e,o){n.store.manager.setValue(t,n,e,o)},getValue:function(t,n,e){return n.store.manager.getValue(t,n,e)},getState:function(t,n,e){return e}}),xm=/* */Object.freeze({events:function(e,o){var t=e.resetOnDom?[br(function(t,n){vm(t,e,o)}),yr(function(t,n){bm(t,e,o)})]:[Vu(e,o,vm)];return cr(t)}}),wm=function(){var t=ae(null);return vi({set:t.set,get:t.get,isNotSet:function(){return null===t.get()},clear:function(){t.set(null)},readState:function(){return{mode:"memory",value:t.get()}}})},Sm=function(){var i=ae({}),u=ae({});return vi({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Mt(i.get(),t).orThunk(function(){return Mt(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};z(t,function(n){o[n.value]=n,Mt(n,"meta").each(function(t){Mt(t,"text").each(function(t){r[t]=n})})}),i.set(I({},n,o)),u.set(I({},e,r))},clear:function(){i.set({}),u.set({})}})},km=/* */Object.freeze({memory:wm,dataset:Sm,manual:function(){return vi({readState:function(){}})},init:function(t){return t.store.manager.state(t)}}),Cm=function(t,n,e,o){var r=n.store;e.update([o]),r.setValue(t,o),n.onSetValue(t,o)},Om=[Xn("initialValue"),Hn("getFallbackEntry"),Hn("getDataKey"),Hn("setValue"),Mu("manager",{setValue:Cm,getValue:function(t,n,e){var o=n.store,r=o.getDataKey(t);return e.lookup(r).fold(function(){return o.getFallbackEntry(r)},function(t){return t})},onLoad:function(n,e,o){e.store.initialValue.each(function(t){Cm(n,e,o,t)})},onUnload:function(t,n,e){e.clear()},state:Sm})],Tm=[Hn("getValue"),Qn("setValue",tt),Xn("initialValue"),Mu("manager",{setValue:function(t,n,e,o){n.store.setValue(t,o),n.onSetValue(t,o)},getValue:function(t,n,e){return n.store.getValue(t)},onLoad:function(n,e,t){e.store.initialValue.each(function(t){e.store.setValue(n,t)})},onUnload:tt,state:hi.init})],Em=[Xn("initialValue"),Mu("manager",{setValue:function(t,n,e,o){e.set(o),n.onSetValue(t,o)},getValue:function(t,n,e){return e.get()},onLoad:function(t,n,e){n.store.initialValue.each(function(t){e.isNotSet()&&e.set(t)})},onUnload:function(t,n,e){e.clear()},state:wm})],Bm=[Zn("store",{mode:"memory"},Bn("mode",{memory:Em,manual:Tm,dataset:Om})),_u("onSetValue"),Qn("resetOnDom",!1)],_m=Uu({fields:Bm,name:"representing",active:xm,apis:ym,extra:{setValueFrom:function(t,n){var e=_m.getValue(n);_m.setValue(t,e)}},state:km}),Dm=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=cr(n),Uu({fields:[Hn("enabled")],name:e,active:{events:nt(o)}})),configAsRaw:nt({}),initialConfig:{},state:hi}}},Am=function(t,n){n.ignore||(Af(t.element()),n.onFocus(t))},Fm=/* */Object.freeze({focus:Am,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=Tr(n).dom(),n.dom()===e.activeElement;var n,e}}),Mm=/* */Object.freeze({exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return yi(e)},events:function(e){return cr([fr(ho(),function(t,n){Am(t,e),n.stop()})].concat(e.stopMousedown?[fr(to(),function(t,n){n.event().prevent()})]:[]))}}),Im=[_u("onFocus"),Qn("stopMousedown",!1),Qn("ignore",!1)],Rm=Uu({fields:Im,name:"focusing",active:Mm,apis:Fm}),Vm=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},Nm=function(n,t,e){t.toggleClass.each(function(t){e.get()?Fi(n.element(),t):Ii(n.element(),t)})},Hm=function(t,n,e){Lm(t,n,e,!e.get())},Pm=function(t,n,e){e.set(!0),Nm(t,n,e),Vm(t,n,e)},zm=function(t,n,e){e.set(!1),Nm(t,n,e),Vm(t,n,e)},Lm=function(t,n,e,o){(o?Pm:zm)(t,n,e)},jm=function(t,n,e){Lm(t,n,e,n.selected)},Um=/* */Object.freeze({onLoad:jm,toggle:Hm,isOn:function(t,n,e){return e.get()},on:Pm,off:zm,set:Lm}),Wm=/* */Object.freeze({exhibit:function(t,n,e){return yi({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=Hm,wr(function(t){r(t,e,o)})),u=Vu(t,n,jm);return cr(q([t.toggleOnExecute?[i]:[],[u]]))}}),Gm=function(t,n,e){Ur(t.element(),"aria-expanded",e)},Xm=[Qn("selected",!1),Xn("toggleClass"),Qn("toggleOnExecute",!0),Zn("aria",{mode:"none"},Bn("mode",{pressed:[Qn("syncWithExpanded",!1),Mu("update",function(t,n,e){Ur(t.element(),"aria-pressed",e),n.syncWithExpanded&&Gm(t,n,e)})],checked:[Mu("update",function(t,n,e){Ur(t.element(),"aria-checked",e)})],expanded:[Mu("update",Gm)],selected:[Mu("update",function(t,n,e){Ur(t.element(),"aria-selected",e)})],none:[Mu("update",tt)]}))],Ym=Uu({fields:Xm,name:"toggling",active:Wm,apis:Um,state:(Nf=!1,{init:function(){var n=ae(Nf);return{get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(Nf)},readState:function(){return n.get()}}}})}),qm="alloy.item-hover",Km="alloy.item-focus",Jm=function(t){(Mf(t.element()).isNone()||Rm.isFocused(t))&&(Rm.isFocused(t)||Rm.focus(t),zo(t,qm,{item:t}))},$m=function(t){zo(t,Km,{item:t})},Qm=nt(qm),Zm=nt(Km),tg=[Hn("data"),Hn("components"),Hn("dom"),Qn("hasSubmenu",!1),Xn("toggling"),tl("itemBehaviours",[Ym,Rm,fm,_m]),Qn("ignoreFocus",!1),Qn("domModification",{}),Mu("builder",function(t){return{dom:t.dom,domModification:I({},t.domModification,{attributes:I({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes,{"aria-haspopup":t.hasSubmenu},t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:nl(t.itemBehaviours,[t.toggling.fold(Ym.revoke,function(t){return Ym.config(I({aria:{mode:"checked"}},t))}),Rm.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){$m(t)}}),fm.config({mode:"execution"}),_m.config({store:{mode:"memory",initialValue:t.data}}),Dm("item-type-events",[fr(ko(),Lo),hr(to()),fr(ro(),Jm),fr(wo(),Rm.focus)])]),components:t.components,eventOrder:t.eventOrder}}),Qn("eventOrder",{})],ng=[Hn("dom"),Hn("components"),Mu("builder",function(t){return{dom:t.dom,components:t.components,events:cr([(n=wo(),fr(n,function(t,n){n.stop()}))])};var n})],eg=nt([Ol({name:"widget",overrides:function(n){return{behaviours:Lu([_m.config({store:{mode:"manual",getValue:function(t){return n.data},setValue:function(){}}})])}}})]),og=[Hn("uid"),Hn("data"),Hn("components"),Hn("dom"),Qn("autofocus",!1),Qn("ignoreFocus",!1),tl("widgetBehaviours",[_m,Rm,fm]),Qn("domModification",{}),Xl(eg()),Mu("builder",function(e){var t=Nl(0,e,eg()),n=Hl("item-widget",e,t.internals()),o=function(t){return Pl(t,e,"widget").map(function(t){return fm.focusIn(t),t})},r=function(t,n){return of(n.event().target())||e.autofocus&&n.setSource(t.element()),et.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:cr([wr(function(t,n){o(t).each(function(t){n.stop()})}),fr(ro(),Jm),fr(wo(),function(t,n){e.autofocus?o(t):Rm.focus(t)})]),behaviours:nl(e.widgetBehaviours,[_m.config({store:{mode:"memory",initialValue:e.data}}),Rm.config({ignore:e.ignoreFocus,onFocus:function(t){$m(t)}}),fm.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:Xu(),onLeft:r,onRight:r,onEscape:function(t,n){return Rm.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),et.none()):(Rm.focus(t),et.some(!0))}})])}})],rg=Bn("type",{widget:og,item:tg,separator:ng}),ig=nt([Bl({factory:{sketch:function(t){var n=On("menu.spec item",rg,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:I({},n,{uid:ai("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),ug=nt([Hn("value"),Hn("items"),Hn("dom"),Hn("components"),Qn("eventOrder",{}),$s("menuBehaviours",[xf,_m,af,fm]),Zn("movement",{mode:"menu",moveOnTab:!0},Bn("mode",{grid:[Ru(),Mu("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[Mu("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),Hn("rowSelector")],menu:[Qn("moveOnTab",!0),Mu("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),Pn("markers",Cu()),Qn("fakeFocus",!1),Qn("focusManager",Rf()),_u("onHighlight")]),ag=nt("alloy.menu-focus"),cg=ef({name:"Menu",configFields:ug(),partFields:ig(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:Zs(t.menuBehaviours,[xf.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),_m.config({store:{mode:"memory",initialValue:t.value}}),af.config({find:et.some}),fm.config(t.movement.config(t,t.movement))]),events:cr([fr(Zm(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){xf.highlight(n,t),e.stop(),zo(n,ag(),{menu:n,item:t})})}),fr(Qm(),function(t,n){var e=n.event().item();xf.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),sg=function(e,o,r,t){return Mt(r,t).bind(function(t){return Mt(e,t).bind(function(t){var n=sg(e,o,r,t);return et.some([t].concat(n))})}).getOr([])},lg=function(t,n){var e={};ct(t,function(t,n){z(t,function(t){e[t]=n})});var o=n,r=lt(n,function(t,n){return{k:t,v:n}}),i=st(r,function(t,n){return[n].concat(sg(e,o,r,n))});return st(e,function(t){return Mt(i,t).getOr([t])})},fg=function(){var i=ae({}),u=ae({}),a=ae({}),c=ae(et.none()),s=ae({}),n=function(t){return Mt(u.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(I({},u.get(),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(et.some(t)),i.set(e),u.set(n),s.set(o);var r=lg(o,e);a.set(r)},expand:function(e){return Mt(i.get(),e).map(function(t){var n=Mt(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Mt(a.get(),t)},collapse:function(t){return Mt(a.get(),t).bind(function(t){return 1<t.length?et.some(t.slice(1)):et.none()})},lookupMenu:n,otherMenus:function(t){var n=s.get();return Q(ut(n),t)},getPrimary:function(){return c.get().bind(function(t){return n(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(et.none())},isClear:function(){return c.get().isNone()}}},dg=nt("collapse-item"),mg=nf({name:"TieredMenu",configFields:[Fu("onExecute"),Fu("onEscape"),Au("onOpenMenu"),Au("onOpenSubmenu"),_u("onCollapseMenu"),Qn("highlightImmediately",!0),Un("data",[Hn("primary"),Hn("menus"),Hn("expansions")]),Qn("fakeFocus",!1),_u("onHighlight"),_u("onHover"),Tu(),Hn("dom"),Qn("navigateOnHover",!0),Qn("stayInDom",!1),$s("tmenuBehaviours",[fm,xf,af,hm]),Qn("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)}},factory:function(a,t){var c,n,i=ae(et.none()),s=fg(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,st(n,function(t,n){var e=function(){return cg.sketch(I({dom:t.dom},t,{value:n,items:t.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?Vf():Rf()}))};return n===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})),i=u();return s.setContents(a.data.primary,e,a.data.expansions,i),s.getPrimary()},l=function(t){return _m.getValue(t).value},u=function(t){return st(a.data.menus,function(t,n){return K(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},f=function(n,t){xf.highlight(n,t),xf.getHighlighted(t).orThunk(function(){return xf.getFirst(t)}).each(function(t){jo(n,t.element(),wo())})},d=function(n,t){return gu(P(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));z(o,function(t){Ni(t.element(),[a.markers.backgroundMenu]),a.stayInDom||hm.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=Ic(r.element(),"."+a.markers.item),n=L(t,function(t){return"true"===Gr(t,"aria-haspopup")});return z(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=l(t);e[n]=t})}),i.set(et.some(e)),e}));ct(n,function(t,n){var e=F(o,n);Ur(t.element(),"aria-expanded",e)})},p=function(o,r,i){return et.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return et.none();var n=t.menu,e=d(r,i.slice(1));return z(e,function(t){Fi(t.element(),a.markers.backgroundMenu)}),nr(n.element())||hm.append(o,au(n)),Ni(n.element(),[a.markers.backgroundMenu]),f(o,n),m(o,r,i),et.some(n)})})};(n=c||(c={}))[n.HighlightSubmenu=0]="HighlightSubmenu",n[n.HighlightParent=1]="HighlightParent";var h=function(r,i,u){void 0===u&&(u=c.HighlightSubmenu);var t=l(i);return s.expand(t).bind(function(o){return g(r,o),et.from(o[0]).bind(function(e){return s.lookupMenu(e).bind(function(t){var n=function(t,n,e){if("notbuilt"!==e.type)return e.menu;var o=t.getSystem().build(e.nbMenu());return s.setMenuBuilt(n,o),o}(r,e,t);return nr(n.element())||hm.append(r,au(n)),a.onOpenSubmenu(r,i,n),u===c.HighlightSubmenu?(xf.highlightFirst(n),p(r,s,o)):(xf.dehighlightAll(n),et.some(i))})})})},o=function(n,e){var t=l(e);return s.collapse(t).bind(function(t){return g(n,t),p(n,s,t).map(function(t){return a.onCollapseMenu(n,e,t),t})})},r=function(e){return function(n,t){return lu(t.getSource(),"."+a.markers.item).bind(function(t){return n.getSystem().getByDom(t).toOption().bind(function(t){return e(n,t).map(function(){return!0})})})}},v=cr([fr(ag(),function(n,t){var e=t.event().menu();xf.highlight(n,e);var o=l(t.event().item());s.refresh(o).each(function(t){return m(n,s,t)})}),wr(function(n,t){var e=t.event().target();n.getSystem().getByDom(e).each(function(t){0===l(t).indexOf("collapse-item")&&o(n,t),h(n,t,c.HighlightSubmenu).fold(function(){a.onExecute(n,t)},function(){})})}),br(function(n,t){e(n).each(function(t){hm.append(n,au(t)),a.onOpenMenu(n,t),a.highlightImmediately&&f(n,t)})})].concat(a.navigateOnHover?[fr(Qm(),function(t,n){var e,o,r=n.event().item();e=t,o=l(r),s.refresh(o).bind(function(t){return g(e,t),p(e,s,t)}),h(t,r,c.HighlightParent),a.onHover(t,r)})]:[])),b={collapseMenu:function(n){xf.getHighlighted(n).each(function(t){xf.getHighlighted(t).each(function(t){o(n,t)})})},highlightPrimary:function(n){s.getPrimary().each(function(t){f(n,t)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:Zs(a.tmenuBehaviours,[fm.config({mode:"special",onRight:r(function(t,n){return of(n.element())?et.none():h(t,n,c.HighlightSubmenu)}),onLeft:r(function(t,n){return of(n.element())?et.none():o(t,n)}),onEscape:r(function(t,n){return o(t,n).orThunk(function(){return a.onEscape(t,n).map(function(){return t})})}),focusIn:function(n,t){s.getPrimary().each(function(t){jo(n,t.element(),wo())})}}),xf.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),af.config({find:function(t){return xf.getHighlighted(t)}}),hm.config({})]),eventOrder:a.eventOrder,apis:b,events:v}},extraApis:{tieredData:function(t,n,e){return{primary:t,menus:n,expansions:e}},singleData:function(t,n){return{primary:t,menus:It(t,n),expansions:{}}},collapseItem:function(t){return{value:ti(dg()),meta:{text:t}}}}}),gg=nf({name:"InlineView",configFields:[Hn("lazySink"),_u("onShow"),_u("onHide"),Jn("onEscape"),$s("inlineBehaviours",[Gs,Ku]),$n("fireDismissalEventInstead",[Qn("event",Fo())]),Qn("getRelated",et.none),Qn("eventOrder",et.none)],factory:function(s,t){var r=function(t,n,e,o){var r=s.lazySink(t).getOrDie();Gs.openWhileCloaked(t,e,function(){return Ts.positionWithin(r,n,t,o)}),s.onShow(t)},n={setContent:function(t,n){Gs.open(t,n)},showAt:function(t,n,e){var o=et.none();r(t,n,e,o)},showWithin:r,showWithinBounds:function(t,n,e,o){var r=s.lazySink(t).getOrDie();Gs.openWhileCloaked(t,e,function(){return Ts.positionWithinBounds(r,n,t,o)}),s.onShow(t)},showMenuAt:function(t,n,e){var o,r,i,u,a,c=(o=s,r=t,i=n,u=e,a=function(){return o.lazySink(r)},mg.sketch({dom:{tag:"div"},data:u.data,markers:u.menu.markers,onEscape:function(){return Gs.close(r),o.onEscape.map(function(t){return t(r)}),et.some(!0)},onExecute:function(){return et.some(!0)},onOpenMenu:function(t,n){Ts.position(a().getOrDie(),i,n)},onOpenSubmenu:function(t,n,e){var o=a().getOrDie();Ts.position(o,{anchor:"submenu",item:n},e)}}));Gs.open(t,c),s.onShow(t)},hide:function(t){Gs.close(t),s.onHide(t)},getContent:function(t){return Gs.getState(t)},isOpen:Gs.isOpen};return{uid:s.uid,dom:s.dom,behaviours:Zs(s.inlineBehaviours,[Gs.config({isPartOf:function(t,n,e){return mu(n,e)||(o=t,r=e,s.getRelated(o).exists(function(t){return mu(t,r)}));var o,r},getAttachPoint:function(t){return s.lazySink(t).getOrDie()}}),Ks(I({isExtraPart:nt(!1)},s.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))]),eventOrder:s.eventOrder,apis:n}},apis:{showAt:function(t,n,e,o){t.showAt(n,e,o)},showWithin:function(t,n,e,o,r){t.showWithin(n,e,o,r)},showWithinBounds:function(t,n,e,o,r){t.showWithinBounds(n,e,o,r)},showMenuAt:function(t,n,e,o){t.showMenuAt(n,e,o)},hide:function(t,n){t.hide(n)},isOpen:function(t,n){return t.isOpen(n)},getContent:function(t,n){return t.getContent(n)},setContent:function(t,n,e){t.setContent(n,e)}}}),pg=function(t){var n=function(t,n){n.stop(),Lo(t)},e=Ne.detect().deviceType.isTouch()?[fr(So(),n)]:[fr(fo(),n),fr(to(),function(t,n){n.cut()})];return cr(q([t.map(function(e){return fr(xo(),function(t,n){e(t),n.stop()})}).toArray(),e]))},hg=nf({name:"Button",factory:function(t){var n=pg(t.action),e=t.dom.tag,o=function(n){return Mt(t.dom,"attributes").bind(function(t){return Mt(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:nl(t.buttonBehaviours,[Rm.config({}),fm.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:function(){if("button"!==e)return{role:o("role").getOr("button")};var t=o("type").getOr("button"),n=o("role").map(function(t){return{role:t}}).getOr({});return I({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[Qn("uid",undefined),Hn("dom"),Qn("components",[]),tl("buttonBehaviours",[Rm,fm]),Xn("action"),Xn("role"),Qn("eventOrder",{})]}),vg=function(t){var n=function e(t){return t.uid!==undefined}(t)&&Nt(t,"uid")?t.uid:ai("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).fold(et.none,et.some)},asSpec:function(){return I({},t,{uid:n})}}},bg=function(t){return et.from(t()["temporary-placeholder"]).getOr("!not found!")},yg=function(t,n){return et.from(n()[t]).getOrThunk(function(){return bg(n)})},xg={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},wg=nf({name:"Notification",factory:function(n){var t,e,o=vg({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:Lu([hm.config({})])}),r=function(t){return{dom:{tag:"div",classes:["tox-bar"],attributes:{style:"width: "+t+"%"}}}},i=function(t){return{dom:{tag:"div",classes:["tox-text"],innerHtml:t+"%"}}},u=vg({dom:{tag:"div",classes:n.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[r(0)]},i(0)],behaviours:Lu([hm.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){hm.set(t,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[r(n)]},i(n)])})},updateText:function(t,n){if(t.getSystem().isConnected()){var e=o.get(t);hm.set(e,[ou(n)])}}},c=q([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return et.from(xg[t])}).toArray()]);return{uid:n.uid,dom:{tag:"div",attributes:{role:"alert"},classes:n.level.map(function(t){return["tox-notification","tox-notification--in","tox-notification--"+t]}).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:(t=c,e=n.iconProvider,pu(t,function(t){return et.from(e()[t])}).getOrThunk(function(){return bg(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:Lu([hm.config({})])}].concat(n.progress?[u.asSpec()]:[]).concat(hg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:yg("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},configFields:[Xn("level"),Hn("progress"),Hn("icon"),Hn("onAction"),Hn("text"),Hn("iconProvider"),Hn("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}}),Sg=tinymce.util.Tools.resolve("tinymce.util.Delay");function kg(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),gg.hide(r)},o=uu(wg.sketch({text:t.text,level:F(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:et.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=uu(gg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),0<t.timeout&&Sg.setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){gg.showAt(r,{anchor:"makeshift",x:t,y:n},au(o))},moveRel:function(t,n){gg.showAt(r,i.backstage.shared.anchors.banner(),au(o))},text:function(t){wg.updateText(o,t)},settings:t,getEl:function(){},progressBar:{value:function(t){wg.updateProgress(o,t)}}}},close:function(t){t.close()},reposition:function(t){z(t,function(t){t.moveTo(0,0)}),function(e){if(0<e.length){var t=e.slice(0,1)[0],n=(o=r).inline?o.getElement():o.getContentAreaContainer();t.moveRel(n,"tc-tc"),z(e,function(t,n){0<n&&t.moveRel(e[n-1].getEl(),"bc-tc")})}var o}(t)},getArgs:function(t){return t.settings}}}var Cg,Og,Tg=function(e,o){var r=null;return{cancel:function(){null!==r&&(M.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&M.clearTimeout(r),r=M.setTimeout(function(){e.apply(null,t),r=null},o)}}},Eg=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Bg=pt([{aborted:[]},{edge:["element"]},{success:["info"]}]),_g=pt([{abort:[]},{kontinue:[]},{finish:["info"]}]),Dg=function(n,e,t,o,r,i){var u=function(){return i.fold(Bg.aborted,Bg.edge)},a=function(){var t=r();return t?Dg(n,t,et.none(),o,r,et.some(e)):u()};if(n.isBlock(e))return u();if(e.nodeType!==M.Node.TEXT_NODE)return a();var c=e.textContent;return o(_g,e,c,t).fold(Bg.aborted,function(){return a()},Bg.success)},Ag=function(t,n,e,o,r){var i=new Eg(n,r||t.getRoot());return Dg(t,n,et.some(e),o,i.prev,et.none())},Fg=function(e,n){return Mg(se.fromDom(e.selection.getNode())).getOrThunk(function(){var t=se.fromHtml('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',e.getDoc());return Rr(t,se.fromDom(n.extractContents())),n.insertNode(t.dom()),Br(t).each(function(t){return t.dom().normalize()}),Ec(t).map(function(t){var n;e.selection.setCursorLocation(t.dom(),"img"===$o(n=t)?1:wc(n).fold(function(){return Dr(n).length},function(t){return t.length}))}),t})},Mg=function(t){return lu(t,"[data-mce-autocompleter]")},Ig=/[\u00a0 \t\r\n]/,Rg=function(t,n){return t.toString().substring(n.length).replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},Vg=function(t,u,a,c){if(void 0===c&&(c=0),!(n=u).collapsed||3!==n.startContainer.nodeType)return et.none();var n;return Ag(t,u.startContainer,u.startOffset,function(e,o,r,t){var i=t.getOr(r.length);return function(t,n,e,o){var r;for(r=n-1;0<=r;r--){var i=t.charAt(r);if(Ig.test(i))return et.none();if(i===e)break}return-1===r||n-r<o?et.none():et.some(t.substring(r+1,n))}(r,i,a,1).fold(function(){return r.match(Ig)?e.abort():e.kontinue()},function(t){var n=u.cloneRange();return n.setStart(o,i-t.length-1),n.setEnd(u.endContainer,u.endOffset),r.length<c?e.abort():e.finish({text:Rg(n,a),range:n,triggerChar:a})})}).fold(et.none,et.none,et.some)},Ng=function(e,t,o,n){return void 0===n&&(n=0),Mg(se.fromDom(t.startContainer)).fold(function(){return Vg(e,t,o,n)},function(t){var n=e.createRng();return n.selectNode(t.dom()),et.some({range:n,text:Rg(n,o),triggerChar:o})})},Hg=function(e,t){t.on("keypress compositionend",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){zo(t,ao(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(xf.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which&&e.cancelIfNecessary(),e.isMenuOpen()?13===n.which?(t().each(Lo),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(xf.highlightFirst)},function(t){o(t,n)}),n.preventDefault(),n.stopImmediatePropagation()):37!==n.which&&38!==n.which&&39!==n.which||t().each(function(t){o(t,n),n.preventDefault(),n.stopImmediatePropagation()}):13!==n.which&&38!==n.which&&40!==n.which||e.cancelIfNecessary())}),t.on("NodeChange",function(t){e.isActive()&&Mg(se.fromDom(t.element)).isNone()&&e.cancelIfNecessary()})},Pg=tinymce.util.Tools.resolve("tinymce.util.Promise"),zg=function(t,n){return{element:t,offset:n}},Lg=function(t){if(t.nodeType===M.Node.TEXT_NODE)return zg(t,t.data.length);var n=t.childNodes;return 0<n.length?Lg(n[n.length-1]):zg(t,n.length)},jg=function(t,n){var e=t.childNodes;return 0<e.length&&n<e.length?jg(e[n],0):0<e.length&&t.nodeType===M.Node.ELEMENT_NODE&&e.length===n?Lg(e[e.length-1]):zg(t,n)},Ug=function(n,e){var o,r,t,i=e(),u=n.selection.getRng();return(o=n.dom,r=u,t=i,pu(t.triggerChars,function(t){return Ng(o,r,t)})).bind(function(t){return Wg(n,e,t)})},Wg=function(n,t,e,o){void 0===o&&(o={});var r=t(),i=n.selection.getRng().startContainer.nodeValue,u=L(r.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOrThunk(function(){return e=n.dom,o=function(t,n,e,o){var r=o.getOr(e.length);return 0===r?t.kontinue():t.finish(/\s/.test(e.charAt(r-1)))},function(t){var n=jg(t.startContainer,t.startOffset);return Ag(e,n.element,n.offset,o).fold(nt(!0),nt(!0),d)};var e,o})(e.range,i,e.text)});if(0===u.length)return et.none();var a=Pg.all(P(u,function(n){return n.fetch(e.text,n.maxResults,o).then(function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}})}));return et.some({lookupData:a,context:e})},Gg=ln([zn("type"),Kn("text")]),Xg=ln([ue("type",function(){return"autocompleteitem"}),ue("active",function(){return!1}),ue("disabled",function(){return!1}),Qn("meta",{}),zn("value"),Kn("text"),Kn("icon")]),Yg=ln([zn("type"),zn("ch"),te("minChars",1),Qn("columns",1),te("maxResults",10),Jn("matches"),jn("fetch"),jn("onAction")]),qg=function(t){var n,e,o=t.ui.registry.getAll().popups,r=st(o,function(t){return(n=t,kn("Autocompleter",Yg,n)).fold(function(t){throw new Error(Tn(t))},function(t){return t});var n}),i=(n=ft(r,function(t){return t.ch}),e={},z(n,function(t){e[t]={}}),ut(e)),u=dt(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return L(u,function(t){return t.ch===n})}}},Kg=[oe("disabled",!1),Kn("text"),Kn("shortcut"),hn("value","value",Ot(function(){return ti("menuitem-value")}),_n()),Qn("meta",{})],Jg=ln([zn("type"),re("onSetup",function(){return tt}),re("onAction",tt),Kn("icon")].concat(Kg)),$g=ln([zn("type"),jn("getSubmenuItems"),re("onSetup",function(){return tt}),Kn("icon")].concat(Kg)),Qg=ln([zn("type"),oe("active",!1),re("onSetup",function(){return tt}),jn("onAction")].concat(Kg)),Zg=ln([zn("type"),oe("active",!1),Kn("icon")].concat(Kg)),tp=ln([zn("type"),Ln("fancytype",["inserttable","colorswatch"]),re("onAction",tt)]),np=function(t,o,n){var r=Ic(t.element(),"."+n);if(0<r.length){var e=G(r,function(t){var n=t.dom().getBoundingClientRect().top,e=r[0].dom().getBoundingClientRect().top;return Math.abs(n-e)>o}).getOr(r.length);return et.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return et.none()},ep=function(t,n){return Lu([Dm(t,n)])},op=function(t){return ep(ti("unnamed-events"),t)},rp=[Hn("lazySink"),Hn("tooltipDom"),Qn("exclusive",!0),Qn("tooltipComponents",[]),Qn("delay",300),ee("mode","normal",["normal","follow-highlight"]),Qn("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:nt([ja,La,Na,Pa,Ha,za]),onRtl:nt([ja,La,Na,Pa,Ha,za])}}}),_u("onHide"),_u("onShow")],ip=/* */Object.freeze({init:function(){var e=ae(et.none()),n=ae(et.none()),o=function(){e.get().each(function(t){M.clearTimeout(t)})},t=nt("not-implemented");return vi({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(et.some(t))},clearTooltip:function(){n.set(et.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(et.some(M.setTimeout(function(){t()},n)))},readState:t})}}),up=ti("tooltip.exclusive"),ap=ti("tooltip.show"),cp=ti("tooltip.hide"),sp=function(t,n,e){t.getSystem().broadcastOn([up],{})},lp=/* */Object.freeze({hideAllExclusive:sp,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&hm.set(t,o)})}}),fp=Uu({fields:rp,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){Fs(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return cr(q([[fr(ap,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){sp(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:cr("normal"===o.mode?[fr(ro(),function(t){Po(n,ap)}),fr(eo(),function(t){Po(n,cp)})]:[]),behaviours:Lu([hm.config({})])});r.setTooltip(e),_s(t,e),o.onShow(n,e),Ts.position(t,o.anchor(n),e)}}(t)},o.delay)}),fr(cp,function(t){r.resetTimer(function(){e(t)},o.delay)}),fr(yo(),function(t,n){F(n.channels(),up)&&e(t)}),yr(function(t){e(t)})],"normal"===o.mode?[fr(io(),function(t){Po(t,ap)}),fr(vo(),function(t){Po(t,cp)}),fr(ro(),function(t){Po(t,ap)}),fr(eo(),function(t){Po(t,cp)})]:[fr(No(),function(t,n){Po(t,ap)}),fr(Ho(),function(t){Po(t,cp)})]]))}}),state:ip,apis:lp}),dp=function(t){var n,e,o,r=se.fromHtml(t),i=Dr(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],U(e,function(t,n){var e;return"class"===n.name?t:I({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:zr(r)};return I({tag:$o(r),classes:a,attributes:u},c)},mp=tinymce.util.Tools.resolve("tinymce.util.I18n"),gp="tox-menu-nav__js",pp="tox-collection__item",hp="tox-swatch",vp={normal:gp,color:hp},bp="tox-collection__item--enabled",yp="tox-collection__item-icon",xp="tox-collection__item-label",wp="tox-collection__item--active",Sp=function(t){return Mt(vp,t).getOr(gp)},kp=tinymce.util.Tools.resolve("tinymce.Env"),Cp=function(t){var e=kp.mac?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl",access:"Shift+Alt"},n=t.split("+"),o=P(n,function(t){var n=t.toLowerCase().trim();return gt(e,n)?e[n]:t});return kp.mac?o.join(""):o.join("+")},Op=function(t){return{dom:{tag:"div",classes:[yp],innerHtml:t}}},Tp=function(t){return{dom:{tag:"div",classes:[xp]},components:[ou(mp.translate(t))]}},Ep=function(t,n){return{dom:{tag:"div",classes:[xp]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[ou(mp.translate(n))]}]}},Bp=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:Cp(t)}}},_p=function(t){return{dom:{tag:"div",classes:[yp,"tox-collection__item-checkmark"],innerHtml:yg("checkmark",t)}}},Dp=function(t,n,e,o,r){var i=e?t.checkMark.orThunk(function(){return n.or(et.some("")).map(Op)}):et.none(),u=t.ariaLabel.map(function(t){return{attributes:{title:mp.translate(t)}}}).getOr({});return{dom:yt({tag:"div",classes:[gp,pp].concat(r?["tox-collection__item-icon-rtl"]:[])},u),optComponents:[i,t.htmlContent.fold(function(){return t.textContent.map(o)},function(t){return et.some({dom:{tag:"div",classes:[xp],innerHtml:t}})}),t.shortcutContent.map(Bp),t.caret]}},Ap=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],Fp=["list-bull-circle","list-bull-default","list-bull-square"],Mp=function(t,r,n,i){void 0===i&&(i=et.none());var e,o,u,a,c,s,l,f=mp.isRtl()&&t.iconContent.exists(function(t){return F(Fp,t)}),d=(e=t.iconContent,e.map(function(t){return mp.isRtl()&&F(Ap,t)?t+"-rtl":t})).map(function(t){return n=t,e=r.icons,o=i,et.from(e()[n]).or(o).getOrThunk(function(){return bg(e)});var n,e,o}),m=et.from(t.meta).fold(function(){return Tp},function(t){return gt(t,"style")?g(Ep,t.style):Tp});return"color"===t.presets?(o=t.ariaLabel,u=t.value,a=r,{dom:(c=hp,s=d.getOr(""),l=o.map(function(t){return' title="'+a.translate(t)+'"'}).getOr(""),dp("custom"===u?'<button class="'+c+' tox-swatches__picker-btn"'+l+">"+s+"</button>":"remove"===u?'<div class="'+c+' tox-swatch--remove"'+l+">"+s+"</div>":'<div class="'+c+'" style="background-color: '+u+'" data-mce-color="'+u+'"'+l+"></div>")),optComponents:[]}):Dp(t,d,n,m,f)},Ip=["input","button","textarea","select"],Rp=function(t,n,e){n.disabled&&Lp(t,n)},Vp=function(t,n){return!0===n.useNative&&F(Ip,$o(t.element()))},Np=function(t){Ur(t.element(),"disabled","disabled")},Hp=function(t){Yr(t.element(),"disabled")},Pp=function(t){Ur(t.element(),"aria-disabled","true")},zp=function(t){Ur(t.element(),"aria-disabled","false")},Lp=function(n,t,e){t.disableClass.each(function(t){Fi(n.element(),t)}),(Vp(n,t)?Np:Pp)(n),t.onDisabled(n)},jp=function(n,t,e){t.disableClass.each(function(t){Ii(n.element(),t)}),(Vp(n,t)?Hp:zp)(n),t.onEnabled(n)},Up=function(t,n){return Vp(t,n)?Xr(t.element(),"disabled"):"true"===Gr(t.element(),"aria-disabled")},Wp=/* */Object.freeze({enable:jp,disable:Lp,isDisabled:Up,onLoad:Rp,set:function(t,n,e,o){(o?Lp:jp)(t,n,e)}}),Gp=/* */Object.freeze({exhibit:function(t,n,e){return yi({classes:n.disabled?n.disableClass.map(Z).getOr([]):[]})},events:function(e,t){return cr([sr(xo(),function(t,n){return Up(t,e)}),Vu(e,t,Rp)])}}),Xp=[Qn("disabled",!1),Qn("useNative",!0),Xn("disableClass"),_u("onDisabled"),_u("onEnabled")],Yp=Uu({fields:Xp,name:"disabling",active:Gp,apis:Wp}),qp=function(t){return Yp.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},Kp=function(t){return Yp.config({disabled:t})},Jp=function(t){return Yp.config({disabled:t,disableClass:"tox-tbtn--disabled"})},$p=function(t){return Yp.config({disabled:t,disableClass:"tox-tbtn--disabled",useNative:!1})},Qp=function(t,n){var e=t.getApi(n);return function(t){t(e)}},Zp=function(e,o){return br(function(t){Qp(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},th=function(n,e){return yr(function(t){return Qp(n,t)(e.get())})};(Og=Cg||(Cg={}))[Og.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",Og[Og.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var nh=Cg,eh={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},oh=function(t){return K(t,function(t){return t.toArray()})},rh=function(t,n,e){var o,r,i=ae(tt);return{type:"item",dom:n.dom,components:oh(n.optComponents),data:t.data,eventOrder:eh,hasSubmenu:t.triggersSubmenu,itemBehaviours:Lu([Dm("item-events",[(o=t,r=e,wr(function(t,n){Qp(o,t)(o.onAction),o.triggersSubmenu||r!==nh.CLOSE_ON_EXECUTE||(Po(t,Oo()),n.stop())})),Zp(t,i),th(t,i)]),qp(t.disabled),hm.config({})].concat(t.itemBehaviours))}},ih=function(t){return{value:t.value,meta:yt({text:t.text.getOr("")},t.meta)}},uh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),ah=function(t,n){var e,o=mp.translate(t),r=(e=o,uh.DOM.encode(e));if(0<n.length){var i=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");return r.replace(i,function(t){return'<span class="tox-autocompleter-highlight">'+t+"</span>"})}return r},ch=nt(Fl("item-widget",eg())),sh=ti("cell-over"),lh=ti("cell-execute"),fh=function(n,e,t){var o,r=function(t){return zo(t,lh,{row:n,col:e})};return uu({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:Lu([Dm("insert-table-picker-cell",[fr(ro(),Rm.focus),fr(xo(),r),fr(ko(),r)]),Ym.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Rm.config({onFocus:function(t){return zo(t,sh,{row:n,col:e})}})])})};var dh=function(t){return{value:nt(t)}},mh=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,gh=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,ph=function(t){return mh.test(t)||gh.test(t)},hh=function(t){var n,e=(n=t.value().replace(mh,function(t,n,e,o){return n+n+e+e+o+o}),{value:nt(n)}),o=gh.exec(e.value());return null===o?["FFFFFF","FF","FF","FF"]:o},vh=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},bh=function(t){var n=vh(t.red())+vh(t.green())+vh(t.blue());return dh(n)},yh=Math.min,xh=Math.max,wh=Math.round,Sh=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,kh=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Ch=function(t,n,e,o){return{red:nt(t),green:nt(n),blue:nt(e),alpha:nt(o)}},Oh=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},Th=function(t){var n,e,o,r=(t.hue()||0)%360,i=t.saturation()/100,u=t.value()/100;if(i=xh(0,yh(i,1)),u=xh(0,yh(u,1)),0===i)return n=e=o=wh(255*u),Ch(n,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),l=u-c;switch(Math.floor(a)){case 0:n=c,e=s,o=0;break;case 1:n=s,e=c,o=0;break;case 2:n=0,e=c,o=s;break;case 3:n=0,e=s,o=c;break;case 4:n=s,e=0,o=c;break;case 5:n=c,e=0,o=s;break;default:n=e=o=0}return n=wh(255*(n+l)),e=wh(255*(e+l)),o=wh(255*(o+l)),Ch(n,e,o,1)},Eh=function(t){var n=hh(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return Ch(e,o,r,1)},Bh=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return Ch(r,i,u,a)},_h=function(t){return"rgba("+t.red()+","+t.green()+","+t.blue()+","+t.alpha()+")"},Dh=nt(Ch(255,0,0,1)),Ah=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Fh="tinymce-custom-colors";var Mh="choiceitem",Ih=[{type:Mh,text:"Light Green",value:"#BFEDD2"},{type:Mh,text:"Light Yellow",value:"#FBEEB8"},{type:Mh,text:"Light Red",value:"#F8CAC6"},{type:Mh,text:"Light Purple",value:"#ECCAFA"},{type:Mh,text:"Light Blue",value:"#C2E0F4"},{type:Mh,text:"Green",value:"#2DC26B"},{type:Mh,text:"Yellow",value:"#F1C40F"},{type:Mh,text:"Red",value:"#E03E2D"},{type:Mh,text:"Purple",value:"#B96AD9"},{type:Mh,text:"Blue",value:"#3598DB"},{type:Mh,text:"Dark Turquoise",value:"#169179"},{type:Mh,text:"Orange",value:"#E67E23"},{type:Mh,text:"Dark Red",value:"#BA372A"},{type:Mh,text:"Dark Purple",value:"#843FA1"},{type:Mh,text:"Dark Blue",value:"#236FA1"},{type:Mh,text:"Light Gray",value:"#ECF0F1"},{type:Mh,text:"Medium Gray",value:"#CED4D9"},{type:Mh,text:"Gray",value:"#95A5A6"},{type:Mh,text:"Dark Gray",value:"#7E8C8D"},{type:Mh,text:"Navy Blue",value:"#34495E"},{type:Mh,text:"Black",value:"#000000"},{type:Mh,text:"White",value:"#ffffff"}],Rh=function lF(r){void 0===r&&(r=10);var t,n=Ah.getItem(Fh),e=C(n)?JSON.parse(n):[],i=r-(t=e).length<0?t.slice(0,r):t,u=function(t){i.splice(t,1)};return{add:function(t){var n,e,o;(n=i,e=t,o=A(n,e),-1===o?et.none():et.some(o)).each(u),i.unshift(t),i.length>r&&i.pop(),Ah.setItem(Fh,JSON.stringify(i))},state:function(){return i.slice(0)}}}(10),Vh=function(t){var n=[],u=M.document.createElement("canvas");u.height=1,u.width=1;for(var a=u.getContext("2d"),c=function(t,n){var e=n/255;return("0"+Math.round(t*e+255*(1-e)).toString(16)).slice(-2).toUpperCase()},e=function(t){if(/^[0-9A-Fa-f]{6}$/.test(t))return"#"+t.toUpperCase();a.clearRect(0,0,u.width,u.height),a.fillStyle="#FFFFFF",a.fillStyle=t,a.fillRect(0,0,1,1);var n=a.getImageData(0,0,1,1).data,e=n[0],o=n[1],r=n[2],i=n[3];return"#"+c(e,i)+c(o,i)+c(r,i)},o=0;o<t.length;o+=2)n.push({text:t[o+1],value:e(t[o]),type:"choiceitem"});return n},Nh=function(t){return t.getParam("color_map")},Hh=function(t,n){return t.getParam("color_cols",n,"number")},Ph=function(t){return!1!==t.getParam("custom_colors")},zh=function(t){var n=Nh(t);return n!==undefined?Vh(n):Ih},Lh=function(){return P(Rh.state(),function(t){return{type:Mh,text:t,value:t}})},jh=function(t){Rh.add(t)},Uh=function(t){return t.fire("SkinLoaded")},Wh=function(t){return t.fire("ResizeEditor")},Gh=function(t){return t.fire("ResizeContent")},Xh=function(t,n){t.fire("TextColorChange",n)},Yh=function(t,e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var n;(n=t.style["forecolor"===e?"color":"background-color"])&&(o=o||n)}),o},qh=function(t){return Math.max(5,Math.ceil(Math.sqrt(t)))},Kh=function(t){var n=zh(t),e=qh(n.length);return Hh(t,e)},Jh=function(n,e,t,o){"custom"===t?ev(n)(function(t){t.each(function(t){jh(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},$h=function(t,n){return t.concat(Lh().concat((o={type:e="choiceitem",text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},n?[o,{type:e,text:"Custom color",icon:"color-picker",value:"custom"}]:[o])));var e,o},Qh=function(n,e){return function(t){t($h(n,e))}},Zh=function(t,n,e){var o,r;o="forecolor"===n?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color",r=e,t.setIconFill(o,r),t.setIconStroke(o,r)},tv=function(o,e,r,t,i){o.ui.registry.addSplitButton(e,{tooltip:t,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){return et.from(Yh(o,r)).bind(function(t){return function(t){if("transparent"===t)return et.some(Ch(0,0,0,0));var n=Sh.exec(t);if(null!==n)return et.some(Bh(n[1],n[2],n[3],"1"));var e=kh.exec(t);return null!==e?et.some(Bh(e[1],e[2],e[3],e[4])):et.none()}(t).map(function(t){var n=bh(t).value();return De(e.toLowerCase(),n)})}).getOr(!1)},columns:Kh(o),fetch:Qh(zh(o),Ph(o)),onAction:function(t){null!==i.get()&&Jh(o,r,i.get(),function(){})},onItemAction:function(t,n){Jh(o,r,n,function(t){i.set(t),Xh(o,{name:e,color:t})})},onSetup:function(n){null!==i.get()&&Zh(n,e,i.get());var t=function(t){t.name===e&&Zh(n,t.name,t.color)};return o.on("TextColorChange",t),function(){o.off("TextColorChange",t)}}})},nv=function(n,t,e,o){n.ui.registry.addNestedMenuItem(t,{text:o,icon:"forecolor"===t?"text-color":"highlight-bg-color",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"colorswatch",onAction:function(t){Jh(n,e,t.value,tt)}}]}})},ev=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(et.from(n.colorpicker)),t.close()});i.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onAction:function(t,n){"hex-valid"===n.name&&(n.value?t.enable("ok"):t.disable("ok"))},onSubmit:r,onClose:function(){},onCancel:function(){t(et.none())}})}},ov={register:function(t){var i;(i=t).addCommand("mceApplyTextcolor",function(t,n){var e,o,r;o=t,r=n,(e=i).undoManager.transact(function(){e.focus(),e.formatter.apply(o,{value:r}),e.nodeChanged()})}),i.addCommand("mceRemoveTextcolor",function(t){var n,e;e=t,(n=i).undoManager.transact(function(){n.focus(),n.formatter.remove(e,{value:null},null,!0),n.nodeChanged()})});var n=ae(null),e=ae(null);tv(t,"forecolor","forecolor","Text color",n),tv(t,"backcolor","hilitecolor","Background color",e),nv(t,"forecolor","forecolor","Text color"),nv(t,"backcolor","hilitecolor","Background color")},getColors:$h,getFetch:Qh,colorPickerDialog:ev,getCurrentColor:Yh,getColorCols:Kh,calcCols:qh},rv=function(e,o){return function(t){var n=H(t,o);return P(n,function(t){return{dom:e,components:t}})}},iv=function(n,i,t){return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:["tox-collection--grid"])},components:[cg.parts().items({preprocess:function(t){return"auto"!==n&&1<n?rv({tag:"div",classes:["tox-collection__group"]},n)(t):(e=function(t,n){return"separator"===i[n].type},o=[],r=[],z(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],gt(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),P(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}));var e,o,r}})]}},uv=function(t){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:(n=t,"color"===n?"tox-swatches":"tox-menu"),tieredMenu:"tox-tiered-menu"};var n},av=function(t){var n=uv(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:Sp(t)}},cv=[cg.parts().items({})],sv=function(t,n,e){var o=uv(e);return{dom:{tag:"div",classes:q([[o.tieredMenu]])},markers:av(e)}},lv=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},fv=function(t){return M.console.error(Tn(t)),M.console.log(t),et.none()},dv=function(t,n,e,o,r){var i,u,a,c,s,l,f;return"color"===r?{value:t,dom:(f=(i=o,{dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[cg.parts().items({preprocess:"auto"!==i?rv({tag:"div",classes:["tox-swatches__row"]},i):d})]}]})).dom,components:f.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(f=iv(o,e)).dom,components:f.components,items:e}:"normal"===r&&1===o?{value:t,dom:(f=iv(1,e)).dom,components:f.components,items:e}:"normal"===r?{value:t,dom:(f=iv(o,e)).dom,components:f.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=r,l=uv(s),{tag:"div",classes:q([[l.menu,"tox-menu-"+c+"-column"],a?[l.hasIcons]:[]])}),components:cv,items:e}:{value:t,dom:(f=(u=o,{dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[cg.parts().items({preprocess:rv({tag:"div",classes:["tox-collection__group"]},u)})]})).dom,components:f.components,items:e}},mv=function(t,n,e,o,r,i,u,a){var c=N(n,lv),s=gv(n,e,o,"color"!==r?"normal":"color",i,u,a);return dv(t,c,s,o,r)},gv=function(t,l,f,d,m,g,p){return gu(P(t,function(s){return"choiceitem"===s.type?(t=s,kn("choicemenuitem",Zg,t)).fold(fv,function(t){return et.some((n=t,e=1===f,o=d,r=l,i=g(s.value),u=m,a=p,c=Mp({presets:o,textContent:e?n.text:et.none(),htmlContent:et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:e?n.shortcut:et.none(),checkMark:e?et.some(_p(a.icons)):et.none(),caret:et.none(),value:n.value},a,!0),bt(rh({data:ih(n),disabled:n.disabled,getApi:function(n){return{setActive:function(t){Ym.set(n,t)},isActive:function(){return Ym.isOn(n)},isDisabled:function(){return Yp.isDisabled(n)},setDisabled:function(t){return Yp.set(n,t)}}},onAction:function(t){return r(n.value)},onSetup:function(t){return t.setActive(i),function(){}},triggersSubmenu:!1,itemBehaviours:[]},c,u),{toggling:{toggleClass:bp,toggleOnExecute:!1,selected:n.active}})));var n,e,o,r,i,u,a,c}):et.none();var t}))},pv=function(t,n){var e=av(n);return 1===t?{mode:"menu",moveOnTab:!0}:"auto"===t?{mode:"grid",selector:"."+e.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===n?"tox-swatches__row":"tox-collection__group")}};var hv,vv,bv={inserttable:function fF(o){var t,n=ti("size-label"),a=function(t,n,e){for(var o=[],r=0;r<n;r++){for(var i=[],u=0;u<e;u++)i.push(fh(r,u,t));o.push(i)}return o}(n,10,10),c=vg({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[ou("0x0")],behaviours:Lu([hm.config({})])});return{type:"widget",data:{value:ti("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ch().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:(t=a,K(t,function(t){return P(t,au)})).concat(c.asSpec()),behaviours:Lu([Dm("insert-table-picker",[pr(sh,function(t,n,e){var o,r,i=e.event().row(),u=e.event().col();!function(t,n,e,o,r){for(var i=0;i<o;i++)for(var u=0;u<r;u++)Ym.set(t[i][u],i<=n&&u<=e)}(a,i,u,10,10),hm.set(c.get(t),[(o=i,r=u,ou(r+1+"x"+(o+1)))])}),pr(lh,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),Po(t,Oo())})]),fm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:function dF(n,t){var e=ov.getColors(t.colorinput.getColors(),t.colorinput.hasCustomColors()),o=t.colorinput.getColorCols(),r=mv(ti("menu-value"),e,function(t){n.onAction({value:t})},o,"color",nh.CLOSE_ON_EXECUTE,function(){return!1},t.shared.providers),i=bt(I({},r,{markers:av("color"),movement:pv(o,"color")}));return{type:"widget",data:{value:ti("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ch().widget(cg.sketch(i))]}}},yv=function(n,e,t,o,r,i,u,a){void 0===a&&(a=!0);var c,s,l=Mp({presets:o,textContent:et.none(),htmlContent:t?n.text.map(function(t){return ah(t,e)}):et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:et.none(),checkMark:et.none(),caret:et.none(),value:n.value},u.providers,a,n.icon);return rh({data:ih(n),disabled:n.disabled,getApi:function(){return{}},onAction:function(t){return r(n.value,n.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:(c=n.meta,s=u,mt(c,"tooltipWorker").map(function(e){return[fp.config({lazySink:s.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t,overrides:{maxHeightFunction:vs}}},mode:"follow-highlight",onShow:function(n,t){e(function(t){fp.setComponents(n,[ru({element:se.fromDom(t)})])})}})]}).getOr([]))},l,i)},xv=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:I({tag:"div",classes:[pp,"tox-collection__group-heading"]},n),components:[]}},wv=function(t,n,e,o){void 0===o&&(o=!0);var r=Mp({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.none(),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return rh({data:ih(t),getApi:function(n){return{isDisabled:function(){return Yp.isDisabled(n)},setDisabled:function(t){return Yp.set(n,t)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n)},Sv=function(t,n,e,o){void 0===o&&(o=!0);var r,i=(r=e.icons,{dom:{tag:"div",classes:["tox-collection__item-caret"],innerHtml:yg("chevron-right",r)}}),u=Mp({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.some(i),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return rh({data:ih(t),getApi:function(n){return{isDisabled:function(){return Yp.isDisabled(n)},setDisabled:function(t){return Yp.set(n,t)}}},disabled:t.disabled,onAction:tt,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},u,n)},kv=function(t,n,e){var o=Mp({iconContent:et.none(),textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,checkMark:et.some(_p(e.icons)),caret:et.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,!0);return bt(rh({data:ih(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){Ym.set(n,t)},isActive:function(){return Ym.isOn(n)},isDisabled:function(){return Yp.isDisabled(n)},setDisabled:function(t){return Yp.set(n,t)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,n),{toggling:{toggleClass:bp,toggleOnExecute:!1,selected:t.active}})},Cv=function(n,e){return(t=bv,o=n.fancytype,Object.prototype.hasOwnProperty.call(t,o)?et.some(t[o]):et.none()).map(function(t){return t(n,e)});var t,o};(vv=hv||(hv={}))[vv.ContentFocus=0]="ContentFocus",vv[vv.UiFocus=1]="UiFocus";var Ov=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},Tv=function(t){return N(t,Ov)},Ev=function(t,n,e,o){void 0===o&&(o=!0);var r,i,u,a,c,s=e.shared.providers;switch(t.type){case"menuitem":return(c=t,kn("menuitem",Jg,c)).fold(fv,function(t){return et.some(wv(t,n,s,o))});case"nestedmenuitem":return(a=t,kn("nestedmenuitem",$g,a)).fold(fv,function(t){return et.some(Sv(t,n,s,o))});case"togglemenuitem":return(u=t,kn("togglemenuitem",Qg,u)).fold(fv,function(t){return et.some(kv(t,n,s))});case"separator":return(i=t,kn("separatormenuitem",Gg,i)).fold(fv,function(t){return et.some(xv(t))});case"fancymenuitem":return(r=t,kn("fancymenuitem",tp,r)).fold(fv,function(t){return Cv(t,e)});default:return M.console.error("Unknown item in general menu",t),et.none()}},Bv=function(t,o,r,n,i,u){var a=1===n,c=!a||Tv(t);return gu(P(t,function(t){return"separator"===t.type?(e=t,kn("Autocompleter.Separator",Gg,e)).fold(fv,function(t){return et.some(xv(t))}):(n=t,kn("Autocompleter.Item",Xg,n)).fold(fv,function(t){return et.some(yv(t,o,a,"normal",r,i,u,c))});var n,e}))},_v=function(t,n,e,o){var r=Tv(n),i=gu(P(n,function(t){var n=function(t){return Ev(t,e,o,r)};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(yt(t,{disabled:!0})):n(t)}));return dv(t,r,i,1,"normal")},Dv=function(t){return mg.singleData(t.value,t)},Av=function(d,c){var e=ae(et.none()),m=uu(gg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:Lu([Dm("dismissAutocompleter",[fr(Fo(),function(){return l()})])]),lazySink:c.getSink})),o=function(){return e.get().isSome()},s=function(){o()&&gg.hide(m)},l=function(){if(o()){var t=e.get().map(function(t){return t.element});Mg(t.getOr(se.fromDom(d.selection.getNode()))).each(Pr),s(),e.set(et.none())}},r=xt(function(){return qg(d)}),f=function(t,n,e,o){t.matchLength=n.text.length;var r,i,u,a,c,s,l,f=pu(e,function(t){return et.from(t.columns)}).getOr(1);gg.showAt(m,{anchor:"node",root:se.fromDom(d.getBody()),node:et.from(t.element)},cg.sketch((r=dv("autocompleter-value",!0,o,f,"normal"),i=f,u=hv.ContentFocus,a="normal",c=u===hv.ContentFocus?Vf():Rf(),s=pv(i,a),l=av(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:l.selectedItem,item:l.item},movement:s,fakeFocus:u===hv.ContentFocus,focusManager:c,menuBehaviours:op("auto"!==i?[]:[br(function(o,t){np(o,4,l.item).each(function(t){var n=t.numColumns,e=t.numRows;fm.setGridSize(o,e,n)})})])}))),gg.getContent(m).each(xf.highlightFirst)},g=function(t){var n;(n=t,e.get().map(function(t){return Ng(d.dom,d.selection.getRng(),t.triggerChar).bind(function(t){return Wg(d,r,t,n)})}).getOrThunk(function(){return Ug(d,r)})).fold(l,function(a){!function(t){if(!o()){var n=Fg(d,t.range);e.set(et.some({triggerChar:t.triggerChar,element:n,matchLength:t.text.length}))}}(a.context),a.lookupData.then(function(u){e.get().map(function(t){var n,e,o,r=a.context;if(t.triggerChar===r.triggerChar){var i=(n=r.triggerChar,o=pu(e=u,function(t){return et.from(t.columns)}).getOr(1),K(e,function(i){var t=i.items;return Bv(t,i.matchText,function(o,r){var t=d.selection.getRng();Ng(d.dom,t,n).fold(function(){return M.console.error("Lost context. Cursor probably moved")},function(t){var n=t.range,e={hide:l,reload:function(t){s(),g(t)}};i.onAction(e,n,o,r)})},o,nh.BUBBLE_TO_SANDBOX,c)}));0<i.length?f(t,r,u,i):10<=r.text.length-t.matchLength?l():s()}})})})},t=Tg(function(t){27!==t.which&&g()},50);Hg({onKeypress:t,cancelIfNecessary:l,isMenuOpen:function(){return gg.isOpen(m)},isActive:o,getView:function(){return gg.getContent(m)}},d)},Fv=function(m,g){return function(t){if(m(t)){var n,e,o,r,i,u,a,c=se.fromDom(t.target),s=function(){t.stopPropagation()},l=function(){t.preventDefault()},f=p(l,s),d=(n=c,e=t.clientX,o=t.clientY,r=s,i=l,u=f,a=t,{target:nt(n),x:nt(e),y:nt(o),stop:r,prevent:i,kill:u,raw:nt(a)});g(d)}}},Mv=function(t,n,e,o,r){var i=Fv(e,o);return t.dom().addEventListener(n,i,r),{unbind:g(Iv,t,n,i,r)}},Iv=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},Rv=nt(!0),Vv=function(t,n,e){return Mv(t,n,Rv,e,!1)},Nv=function(t,n,e){return Mv(t,n,Rv,e,!0)},Hv=function(t,n,e){return lu(t,n,e).isSome()};function Pv(e,o){var r=null;return{cancel:function(){null!==r&&(M.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=M.setTimeout(function(){e.apply(null,t),r=null},o)}}}var zv=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?et.none():et.some(n.touches[0])},Lv=function(e){var u=ae(et.none()),o=Pv(function(t){u.set(et.none()),e.triggerEvent(Co(),t)},400),r=Rt([{key:$e(),value:function(e){return zv(e).each(function(t){o.cancel();var n={x:nt(t.clientX),y:nt(t.clientY),target:e.target};o.schedule(e),u.set(et.some(n))}),et.none()}},{key:Qe(),value:function(t){return o.cancel(),zv(t).each(function(i){u.get().each(function(t){var n,e,o,r;n=i,e=t,o=Math.abs(n.clientX-e.x()),r=Math.abs(n.clientY-e.y()),(5<o||5<r)&&u.set(et.none())})}),et.none()}},{key:Ze(),value:function(n){o.cancel();return u.get().filter(function(t){return Xe(t.target(),n.target())}).map(function(t){return e.triggerEvent(So(),n)})}}]);return{fireIfReady:function(n,t){return Mt(r,t).bind(function(t){return t(n)})}}},jv=Ne.detect().browser.isFirefox(),Uv=sn([jn("triggerEvent"),Qn("stopBackspace",!0)]),Wv=function(n,t){var e,o,r,i,u=On("Getting GUI events settings",Uv,t),a=Ne.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=Lv(u),s=P(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return Vv(n,t,function(n){c.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),l=ae(et.none()),f=Vv(n,"paste",function(n){c.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),l.set(et.some(M.setTimeout(function(){u.triggerEvent(bo(),n)},0)))}),d=Vv(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||(8!==(n=t).raw().which||F(["input","textarea"],$o(n.target()))||Hv(n.target(),'[contenteditable="true"]'))||t.prevent()}),m=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},jv?Nv(e,"focus",o):Vv(e,"focusin",o)),g=ae(et.none()),p=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),g.set(et.some(M.setTimeout(function(){u.triggerEvent(vo(),t)},0)))},jv?Nv(r,"blur",i):Vv(r,"focusout",i));return{unbind:function(){z(s,function(t){t.unbind()}),d.unbind(),m.unbind(),p.unbind(),f.unbind(),l.get().each(M.clearTimeout),g.get().each(M.clearTimeout)}}},Gv=function(t,n){var e=Mt(t,"target").map(function(t){return t()}).getOr(n);return ae(e)},Xv=pt([{stopped:[]},{resume:["element"]},{complete:[]}]),Yv=function(t,o,n,e,r,i){var u,a,c,s,l=t(o,e),f=(u=n,a=r,c=ae(!1),s=ae(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:nt(u),setSource:a.set,getSource:a.get});return l.fold(function(){return i.logEventNoHandlers(o,e),Xv.complete()},function(n){var e=n.descHandler();return wi(e)(f),f.isStopped()?(i.logEventStopped(o,n.element(),e.purpose()),Xv.stopped()):f.isCut()?(i.logEventCut(o,n.element(),e.purpose()),Xv.complete()):Br(n.element()).fold(function(){return i.logNoParent(o,n.element(),e.purpose()),Xv.complete()},function(t){return i.logEventResponse(o,n.element(),e.purpose()),Xv.resume(t)})})},qv=function(n,e,o,t,r,i){return Yv(n,e,o,t,r,i).fold(function(){return!0},function(t){return qv(n,e,o,t,r,i)},function(){return!1})},Kv=function(t,n,e){var o,r,i=(o=n,r=ae(!1),{stop:function(){r.set(!0)},cut:tt,isStopped:r.get,isCut:nt(!1),event:nt(o),setSource:u("Cannot set source of a broadcasted event"),getSource:u("Cannot get source of a broadcasted event")});return z(t,function(t){var n=t.descHandler();wi(n)(i)}),i.isStopped()},Jv=function(t,n,e,o,r){var i=Gv(e,o);return qv(t,n,e,o,i,r)},$v=Sr("element","descHandler"),Qv=function(t,n){return{id:nt(t),descHandler:nt(n)}};function Zv(){var i={};return{registerId:function(o,r,t){ct(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=xi(t,o),i[n]=e})},unregisterId:function(e){ct(i,function(t,n){t.hasOwnProperty(e)&&delete t[e]})},filterByType:function(t){return Mt(i,t).map(function(t){return ft(t,function(t,n){return Qv(n,t)})}).getOr([])},find:function(t,n,e){var r=At(n)(i);return ar(e,function(t){return e=r,ui(o=t).fold(function(){return et.none()},function(t){var n=At(t);return e.bind(n).map(function(t){return $v(o,t)})});var e,o},t)}}}function tb(){var o=Zv(),r={},i=function(o){var t=o.element();return ui(t).fold(function(){return t="uid-",n=o.element(),e=ti(oi+t),ii(n,e),e;var t,n,e},function(t){return t})},u=function(t){ui(t.element()).each(function(t){delete r[t],o.unregisterId(t)})};return{find:function(t,n,e){return o.find(t,n,e)},filter:function(t){return o.filterByType(t)},register:function(t){var n=i(t);Nt(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+Jr(e.element())+"\nCannot use it for: "+Jr(t.element())+"\nThe conflicting element is"+(nr(e.element())?" ":" not ")+"already in the DOM");u(t)}(t,n);var e=[t];o.registerId(e,n,t.events()),r[n]=t},unregister:u,getById:function(t){return At(t)(r)}}}var nb,eb,ob=nf({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=h(n,["attributes"]);return{uid:t.uid,dom:I({tag:"div",attributes:I({role:"presentation"},e)},o),components:t.components,behaviours:Qs(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[Qn("components",[]),$s("containerBehaviours",[]),Qn("events",{}),Qn("domModification",{}),Qn("eventOrder",{})]}),rb=function(e){var o=function(n){return Br(e.element()).fold(function(){return!0},function(t){return Xe(n,t)})},r=tb(),s=function(t,n){return r.find(o,t,n)},t=Wv(e.element(),{triggerEvent:function(u,a){return xu(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),Jv(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:nt("real"),triggerEvent:function(n,e,o){xu(n,e,function(t){Jv(s,n,o,e,t)})},triggerFocus:function(a,c){ui(a).fold(function(){Af(a)},function(t){xu(ho(),a,function(t){var n,e,o,r,i,u;n=s,e=ho(),o={originator:nt(c),kill:tt,prevent:tt,target:nt(a)},i=t,u=Gv(o,r=a),Yv(n,e,o,r,u,i)})})},triggerEscape:function(t,n){i.triggerEvent("keydown",t.element(),n.event())},getByUid:function(t){return g(t)},getByDom:function(t){return p(t)},build:uu,addToGui:function(t){a(t)},removeFromGui:function(t){c(t)},addToWorld:function(t){n(t)},removeFromWorld:function(t){u(t)},broadcast:function(t){f(t)},broadcastOn:function(t,n){d(t,n)},broadcastEvent:function(t,n){m(t,n)},isConnected:nt(!0)},n=function(t){t.connect(i),tr(t.element())||(r.register(t),z(t.components(),n),i.triggerEvent(Eo(),t.element(),{target:nt(t.element())}))},u=function(t){tr(t.element())||(z(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){_s(e,t)},c=function(t){Fs(t)},l=function(e){var t=r.filter(yo());z(t,function(t){var n=t.descHandler();wi(n)(e)})},f=function(t){l({universal:nt(!0),data:nt(t)})},d=function(t,n){l({universal:nt(!1),channels:nt(t),data:nt(n)})},m=function(t,n){var e=r.filter(t);return Kv(e,n)},g=function(t){return r.getById(t).fold(function(){return R.error(new Error('Could not find component with uid: "'+t+'" in system.'))},R.value)},p=function(t){var n=ui(t).getOr("not found");return g(n)};return n(e),{root:nt(e),element:e.element,destroy:function(){t.unbind(),Hr(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:f,broadcastOn:d,broadcastEvent:m}},ib=tinymce.util.Tools.resolve("tinymce.EditorManager"),ub=function(t){return et.from(t.settings.min_width).filter(V)},ab=function(t){return et.from(t.settings.min_height).filter(V)},cb=function(t){return!1!==t.getParam("menubar",!0,"boolean")},sb=function(t){var n=t.getParam("toolbar",!0),e=!0===n,o=C(n),r=T(n)&&0<n.length;return!fb(t)&&(r||o||e)},lb=function(n){var t=ut(n.settings),e=L(t,function(t){return/^toolbar([1-9])$/.test(t)}),o=P(e,function(t){return n.getParam(t,!1,"string")}),r=L(o,function(t){return"string"==typeof t});return 0<r.length?et.some(r):et.none()},fb=function(t){return lb(t).fold(function(){return 0<t.getParam("toolbar",[],"string[]").length},function(){return!0})};(eb=nb||(nb={}))["default"]="",eb.floating="floating",eb.sliding="sliding";var db,mb,gb,pb,hb=function(t){return t.getParam("toolbar_drawer","","string")},vb=function(t){var n=t.getParam("fixed_toolbar_container","","string"),e=t.getParam("inline",!1,"boolean");return 0<n.length&&e?su(er(),n):et.none()},bb=function(t){return t.getParam("inline",!1,"boolean")&&vb(t).isSome()},yb=ti("form-component-change"),xb=ti("form-close"),wb=ti("form-cancel"),Sb=ti("form-action"),kb=ti("form-submit"),Cb=ti("form-block"),Ob=ti("form-unblock"),Tb=ti("form-tabchange"),Eb=ti("form-resize"),Bb=nt([Qn("prefix","form-field"),$s("fieldBehaviours",[af,_m])]),_b=nt([El({schema:[Hn("dom")],name:"label"}),El({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Hn("text")],name:"aria-descriptor"}),Ol({factory:{sketch:function(t){var n=Dt(t,["factory"]);return t.factory.sketch(n)}},schema:[Hn("factory")],name:"field"})]),Db=ef({name:"FormField",configFields:Bb(),partFields:_b(),factory:function(r,t,n,e){var o=Zs(r.fieldBehaviours,[af.config({find:function(t){return Pl(t,r,"field")}}),_m.config({store:{mode:"manual",getValue:function(t){return af.getCurrent(t).bind(_m.getValue)},setValue:function(t,n){af.getCurrent(t).each(function(t){_m.setValue(t,n)})}}})]),i=cr([br(function(t,n){var o=Ll(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=ti(r.prefix);o.label().each(function(t){Ur(t.element(),"for",n),Ur(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=ti(r.prefix);Ur(t.element(),"id",n),Ur(e.element(),"aria-describedby",n)})})})]),u={getField:function(t){return Pl(t,r,"field")},getLabel:function(t){return Pl(t,r,"label")}};return{uid:r.uid,dom:r.dom,components:t,behaviours:o,events:i,apis:u}},apis:{getField:function(t,n){return t.getField(n)},getLabel:function(t,n){return t.getLabel(n)}}}),Ab=/* */Object.freeze({getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),Fb=[Pn("others",Sn(R.value,_n()))],Mb=Uu({fields:Fb,name:"coupling",apis:Ab,state:/* */Object.freeze({init:function(t){var i={},n=nt({});return vi({readState:n,getOrCreate:function(e,o,r){var t=ut(o.others);if(t)return Mt(i,r).getOrThunk(function(){var t=Mt(o.others,r).getOrDie("No information found for coupled component: "+r)(e),n=e.getSystem().build(t);return i[r]=n});throw new Error("Cannot find coupled component: "+r+". Known coupled components: "+JSON.stringify(t,null,2))}})}})}),Ib=/* */Object.freeze({events:function(t,n){var e=t.stream.streams.setup(t,n);return cr([fr(t.event,e),yr(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[fr(t,function(){return n.cancel()})]}).getOr([])))}}),Rb=function(t){var n=ae(null);return vi({readState:function(){return{timer:null!==n.get()?"set":"unset"}},setTimer:function(t){n.set(t)},cancel:function(){var t=n.get();null!==t&&t.cancel()}})},Vb=/* */Object.freeze({throttle:Rb,init:function(t){return t.stream.streams.state(t)}}),Nb=[Pn("stream",Bn("mode",{throttle:[Hn("delay"),Qn("stopEvent",!0),Mu("streams",{setup:function(t,n){var e=t.stream,o=Tg(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:Rb})]})),Qn("event","input"),Xn("cancelEvent"),Au("onStream")],Hb=Uu({fields:Nb,name:"streaming",active:Ib,state:Vb}),Pb={},zb={exports:Pb};db=undefined,mb=Pb,gb=zb,pb=undefined,function(t){"object"==typeof mb&&void 0!==gb?gb.exports=t():"function"==typeof db&&db.amd?db([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EphoxContactWrapper=t()}(function(){return function l(i,u,a){function c(n,t){if(!u[n]){if(!i[n]){var e="function"==typeof pb&&pb;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var r=u[n]={exports:{}};i[n][0].call(r.exports,function(t){return c(i[n][1][t]||t)},r,r.exports,l,i,u,a)}return u[n].exports}for(var s="function"==typeof pb&&pb,t=0;t<a.length;t++)c(a[t]);return c}({1:[function(t,n,e){var o,r,i=n.exports={};function u(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(o===setTimeout)return setTimeout(t,0);if((o===u||!o)&&setTimeout)return o=setTimeout,setTimeout(t,0);try{return o(t,0)}catch(n){try{return o.call(null,t,0)}catch(n){return o.call(this,t,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:u}catch(t){o=u}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var s,l=[],f=!1,d=-1;function m(){f&&s&&(f=!1,s.length?l=s.concat(l):d=-1,l.length&&g())}function g(){if(!f){var t=c(m);f=!0;for(var n=l.length;n;){for(s=l,l=[];++d<n;)s&&s[d].run();d=-1,n=l.length}s=null,f=!1,function e(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(n){try{return r.call(null,t)}catch(n){return r.call(this,t)}}}(t)}}function p(t,n){this.fun=t,this.array=n}function h(){}i.nextTick=function(t){var n=new Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)n[e-1]=arguments[e];l.push(new p(t,n)),1!==l.length||f||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(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(t,f,n){(function(e){!function(t){var n=setTimeout;function o(){}function i(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],l(t,this)}function r(o,r){for(;3===o._state;)o=o._value;0!==o._state?(o._handled=!0,i._immediateFn(function(){var t=1===o._state?r.onFulfilled:r.onRejected;if(null!==t){var n;try{n=t(o._value)}catch(e){return void a(r.promise,e)}u(r.promise,n)}else(1===o._state?u:a)(r.promise,o._value)})):o._deferreds.push(r)}function u(t,n){try{if(n===t)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if(n instanceof i)return t._state=3,t._value=n,void c(t);if("function"==typeof e)return void l(function o(t,n){return function(){t.apply(n,arguments)}}(e,n),t)}t._state=1,t._value=n,c(t)}catch(r){a(t,r)}}function a(t,n){t._state=2,t._value=n,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var n=0,e=t._deferreds.length;n<e;n++)r(t,t._deferreds[n]);t._deferreds=null}function s(t,n,e){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=e}function l(t,n){var e=!1;try{t(function(t){e||(e=!0,u(n,t))},function(t){e||(e=!0,a(n,t))})}catch(o){if(e)return;e=!0,a(n,o)}}i.prototype["catch"]=function(t){return this.then(null,t)},i.prototype.then=function(t,n){var e=new this.constructor(o);return r(this,new s(t,n,e)),e},i.all=function(t){var c=Array.prototype.slice.call(t);return new i(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(n,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void e.call(t,function(t){a(n,t)},i)}c[n]=t,0==--u&&r(c)}catch(o){i(o)}}for(var t=0;t<c.length;t++)a(t,c[t])})},i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(t){t(n)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(r){return new i(function(t,n){for(var e=0,o=r.length;e<o;e++)r[e].then(t,n)})},i._immediateFn="function"==typeof e?function(t){e(t)}:function(t){n(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},i._setImmediateFn=function(t){i._immediateFn=t},i._setUnhandledRejectionFn=function(t){i._unhandledRejectionFn=t},void 0!==f&&f.exports?f.exports=i:t.Promise||(t.Promise=i)}(this)}).call(this,t("timers").setImmediate)},{timers:3}],3:[function(c,t,s){(function(t,n){var o=c("process/browser.js").nextTick,e=Function.prototype.apply,r=Array.prototype.slice,i={},u=0;function a(t,n){this._id=t,this._clearFn=n}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(t){t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},s.enroll=function(t,n){clearTimeout(t._idleTimeoutId),t._idleTimeout=n},s.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},s._unrefActive=s.active=function(t){clearTimeout(t._idleTimeoutId);var n=t._idleTimeout;0<=n&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},n))},s.setImmediate="function"==typeof t?t:function(t){var n=u++,e=!(arguments.length<2)&&r.call(arguments,1);return i[n]=!0,o(function(){i[n]&&(e?t.apply(null,e):t.call(null),s.clearImmediate(n))}),n},s.clearImmediate="function"==typeof n?n:function(t){delete i[t]}}).call(this,c("timers").setImmediate,c("timers").clearImmediate)},{"process/browser.js":1,timers:3}],4:[function(t,n,e){var o=t("promise-polyfill"),r="undefined"!=typeof window?window:Function("return this;")();n.exports={boltExport:r.Promise||o}},{"promise-polyfill":2}]},{},[4])(4)});var Lb,jb,Ub=zb.exports.boltExport,Wb=function(t){var e=et.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){z(t,u)},u=function(n){e.each(function(t){M.setTimeout(function(){n(t)},0)})};return t(function(t){e=et.some(t),i(n),n=[]}),{get:o,map:function(e){return Wb(function(n){o(function(t){n(e(t))})})},isReady:r}},Gb={nu:Wb,pure:function(n){return Wb(function(t){t(n)})}},Xb=function(t){M.setTimeout(function(){throw t},0)},Yb=function(e){var t=function(t){e().then(t,Xb)};return{map:function(t){return Yb(function(){return e().then(t)})},bind:function(n){return Yb(function(){return e().then(function(t){return n(t).toPromise()})})},anonBind:function(t){return Yb(function(){return e().then(function(){return t.toPromise()})})},toLazy:function(){return Gb.nu(t)},toCached:function(){var t=null;return Yb(function(){return null===t&&(t=e()),t})},toPromise:e,get:t}},qb=function(t){return Yb(function(){return new Ub(t)})},Kb=function(t){return Yb(function(){return Ub.resolve(t)})},Jb=nt("sink"),$b=nt(El({name:Jb(),overrides:nt({dom:{tag:"div"},behaviours:Lu([Ts.config({useFixed:!0})]),events:cr([hr(ao()),hr(to()),hr(fo())])})}));(jb=Lb||(Lb={}))[jb.HighlightFirst=0]="HighlightFirst",jb[jb.HighlightNone=1]="HighlightNone";var Qb=function(t,n){var e=t.getHotspot(n).getOr(n),o=t.getAnchorOverrides();return t.layouts.fold(function(){return{anchor:"hotspot",hotspot:e,overrides:o}},function(t){return{anchor:"hotspot",hotspot:e,overrides:o,layouts:t}})},Zb=function(t,n,e,o,r,i,u){var a,c,s,l,f,d,m,g,p,h,v=Qb(t,e);return(c=v,l=o,f=r,d=u,m=n,g=s=e,p=(0,(a=t).fetch)(g).map(m),h=oy(s,a),p.map(function(t){return t.bind(function(t){return et.from(mg.sketch(I({},f.menu(),{uid:ai(""),data:t,highlightImmediately:d===Lb.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();Ts.position(e,c,n),Gs.decloak(l)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();Ts.position(o,{anchor:"submenu",item:n},e),Gs.decloak(l)},onEscape:function(){return Rm.focus(s),Gs.close(l),et.some(!0)}})))})})).map(function(t){return t.fold(function(){Gs.isOpen(o)&&Gs.close(o)},function(t){Gs.cloak(o),Gs.open(o,t),i(o)}),o})},ty=function(t,n,e,o,r,i,u){return Gs.close(o),Kb(o)},ny=function(t,n,e,o,r,i){var u=Mb.getCoupled(e,"sandbox");return(Gs.isOpen(u)?ty:Zb)(t,n,e,u,o,r,i)},ey=function(t,n,e){var o,r,i=af.getCurrent(n).getOr(n),u=aa(t.element());e?Li(i.element(),"min-width",u+"px"):(o=i.element(),r=u,ua.set(o,r))},oy=function(n,t){return n.getSystem().getByUid(t.uid+"-"+Jb()).map(function(t){return function(){return R.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return R.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},ry=function(o,r,i){var u=fu(),t=oy(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id(),role:"listbox"}},behaviours:nl(o.sandboxBehaviours,[_m.config({store:{mode:"memory",initialValue:r}}),Gs.config({onOpen:function(t,n){var e=Qb(o,r);u.link(r.element()),o.matchWidth&&ey(e.hotspot,n,o.useMinWidth),o.onOpen(e,t,n),i!==undefined&&i.onOpen!==undefined&&i.onOpen(t,n)},onClose:function(t,n){u.unlink(r.element()),i!==undefined&&i.onClose!==undefined&&i.onClose(t,n)},isPartOf:function(t,n,e){return mu(n,e)||mu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),af.config({find:function(t){return Gs.getState(t).bind(function(t){return af.getCurrent(t)})}}),Ks({isExtraPart:nt(!1)})])}},iy=function(t,n,e){var o=_m.getValue(e);_m.setValue(n,o),ay(n)},uy=function(t,n){var e=t.element(),o=Ki(e),r=e.dom();"number"!==Gr(e,"type")&&n(r,o)},ay=function(t){uy(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},cy=function(t,n,o){if(t.selectsOver){var e=_m.getValue(n),r=t.getDisplayText(e),i=_m.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?et.some(function(){var t,e;iy(0,n,o),t=n,e=r.length,uy(t,function(t,n){return t.setSelectionRange(e,n.length)})}):et.none()}return et.none()},sy=nt([Xn("data"),Qn("inputAttributes",{}),Qn("inputStyles",{}),Qn("tag","input"),Qn("inputClasses",[]),_u("onSetValue"),Qn("styles",{}),Qn("eventOrder",{}),$s("inputBehaviours",[_m,Rm]),Qn("selectOnFocus",!0)]),ly=function(t){return Lu([Rm.config({onFocus:!1===t.selectOnFocus?tt:function(t){var n=t.element(),e=Ki(n);n.dom().setSelectionRange(0,e.length)}})])},fy=function(t){return{tag:t.tag,attributes:I({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},dy=nt("alloy.typeahead.itemexecute"),my=function(){return[Qn("sandboxClasses",[]),tl("sandboxBehaviours",[af,Ku,Gs,_m])]},gy=nt([Xn("lazySink"),Hn("fetch"),Qn("minChars",5),Qn("responseTime",1e3),_u("onOpen"),Qn("getHotspot",et.some),Qn("getAnchorOverrides",nt({})),Qn("layouts",et.none()),Qn("eventOrder",{}),ie("model",{},[Qn("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),Qn("selectsOver",!0),Qn("populateFromBrowse",!0)]),_u("onSetValue"),Du("onExecute"),_u("onItemExecute"),Qn("inputClasses",[]),Qn("inputAttributes",{}),Qn("inputStyles",{}),Qn("matchWidth",!0),Qn("useMinWidth",!1),Qn("dismissOnBlur",!0),Eu(["openClass"]),Xn("initialData"),$s("typeaheadBehaviours",[Rm,_m,Hb,fm,Ym,Mb]),ue("previewing",function(){return ae(!0)})].concat(sy()).concat(my())),py=nt([Tl({schema:[Tu()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){cy(o.model,t,e).fold(function(){return xf.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&iy(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return zo(t,dy(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&iy(o.model,t,n)})}}}})]),hy=ef({name:"Typeahead",configFields:gy(),partFields:py(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=Mb.getCoupled(t,"sandbox");Gs.isOpen(o)?af.getCurrent(o).each(function(t){xf.getHighlighted(t).fold(function(){e(t)},function(){Wo(o,t.element(),"keydown",n)})}):Zb(r,u(t),t,o,i,function(t){af.getCurrent(t).each(e)},Lb.HighlightFirst).get(tt)},o=ly(r),u=function(o){return function(t){return t.map(function(t){var n=dt(t.menus),e=K(n,function(t){return L(t.items,function(t){return"item"===t.type})});return _m.getState(o).update(P(e,function(t){return t.data})),t})}},a=[Rm.config({}),_m.config({onSetValue:r.onSetValue,store:I({mode:"dataset",getDataKey:function(t){return Ki(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){Ji(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return It("initialValue",t)}).getOr({}))}),Hb.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t,n){var e=Mb.getCoupled(t,"sandbox");if(Rm.isFocused(t)&&Ki(t.element()).length>=r.minChars){var o=af.getCurrent(e).bind(function(t){return xf.getHighlighted(t).map(_m.getValue)});r.previewing.set(!0),Zb(r,u(t),t,e,i,function(t){af.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&xf.highlightFirst(t)},function(n){xf.highlightBy(t,function(t){return _m.getValue(t).value===n.value}),xf.getHighlighted(t).orThunk(function(){return xf.highlightFirst(t),et.none()})})})},Lb.HighlightFirst).get(tt)}},cancelEvent:To()}),fm.config({mode:"special",onDown:function(t,n){return e(t,n,xf.highlightFirst),et.some(!0)},onEscape:function(t){var n=Mb.getCoupled(t,"sandbox");return Gs.isOpen(n)?(Gs.close(n),et.some(!0)):et.none()},onUp:function(t,n){return e(t,n,xf.highlightLast),et.some(!0)},onEnter:function(n){var t=Mb.getCoupled(n,"sandbox"),e=Gs.isOpen(t);if(e&&!r.previewing.get())return af.getCurrent(t).bind(function(t){return xf.getHighlighted(t)}).map(function(t){return zo(n,dy(),{item:t}),!0});var o=_m.getValue(n);return Po(n,To()),r.onExecute(t,n,o),e&&Gs.close(t),et.some(!0)}}),Ym.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),Mb.config({others:{sandbox:function(t){return ry(r,t,{onOpen:function(){return Ym.on(t)},onClose:function(){return Ym.off(t)}})}}}),Dm("typeaheadevents",[wr(function(t){var n=tt;ny(r,u(t),t,i,n,Lb.HighlightFirst).get(tt)}),fr(dy(),function(t,n){var e=Mb.getCoupled(t,"sandbox");iy(r.model,t,n.event().item()),Po(t,To()),r.onItemExecute(t,e,n.event().item(),_m.getValue(t)),Gs.close(e),ay(t)})].concat(r.dismissOnBlur?[fr(vo(),function(t){var n=Mb.getCoupled(t,"sandbox");Mf(n.element()).isNone()&&Gs.close(n)})]:[]))];return{uid:r.uid,dom:fy(bt(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:I({},o,Zs(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),vy=function(t,n,e,o){var r=yy(t,n,e,o);return Db.sketch(r)},by=function(t,n){return vy(t,n,[],[])},yy=function(t,n,e,o){return{dom:xy(e),components:t.toArray().concat([n]),fieldBehaviours:Lu(o)}},xy=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},wy=function(t,n){return Db.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},Sy=function(t){return"separator"===t.type},ky={type:"separator"},Cy=function(t,e){var n=U(t,function(t,n){return C(n)?""===n?t:"|"===n?0<t.length&&!Sy(t[t.length-1])?t.concat([ky]):t:gt(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&Sy(n[n.length-1])&&n.pop(),n},Oy=function(t,n){return gt(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=Ty(r,o),{item:e,menus:bt(i.menus,It(e.value,i.items)),expansions:bt(i.expansions,It(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},Ty=function(t,r){var n=Cy(C(t)?t.split(" "):t,r);return j(n,function(t,n){var e=function(t){if(Sy(t))return t;var n=Mt(t,"value").getOrThunk(function(){return ti("generated-menu-item")});return bt({value:n},t)}(n),o=Oy(e,r);return{menus:bt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:bt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},Ey=function(t,e,o){var n=ti("primary-menu"),r=Ty(t,o.shared.providers.menuItems());if(0===r.items.length)return et.none();var i=_v(n,r.items,e,o),u=st(r.menus,function(t,n){return _v(n,t,e,o)}),a=bt(u,It(n,i));return et.from(mg.tieredData(n,a,r.expansions))},By=nf({name:"Input",configFields:sy(),factory:function(t,n){return{uid:t.uid,dom:fy(t),components:[],behaviours:(e=t,I({},ly(e),Zs(e.inputBehaviours,[_m.config({store:{mode:"manual",initialValue:e.data.getOr(undefined),getValue:function(t){return Ki(t.element())},setValue:function(t,n){Ki(t.element())!==n&&Ji(t.element(),n)}},onSetValue:e.onSetValue})]))),eventOrder:t.eventOrder};var e}}),_y=["input","textarea"],Dy=function(t){var n=$o(t);return F(_y,n)},Ay=function(t,n){var e=n.getRoot(t).getOr(t.element());Ii(e,n.invalidClass),n.notify.each(function(n){Dy(t.element())&&Ur(t.element(),"aria-invalid",!1),n.getContainer(t).each(function(t){Lr(t,n.validHtml)}),n.onValid(t)})},Fy=function(n,t,e,o){var r=t.getRoot(n).getOr(n.element());Fi(r,t.invalidClass),t.notify.each(function(t){Dy(n.element())&&Ur(n.element(),"aria-invalid",!0),t.getContainer(n).each(function(t){Lr(t,o)}),t.onInvalid(n,o)})},My=function(n,t,e){return t.validator.fold(function(){return Kb(R.value(!0))},function(t){return t.validate(n)})},Iy=function(n,e,t){return e.notify.each(function(t){t.onValidate(n)}),My(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return Fy(n,e,0,t),R.error(t)},function(t){return Ay(n,e),R.value(t)}):R.error("No longer in system")})},Ry=/* */Object.freeze({markValid:Ay,markInvalid:Fy,query:My,run:Iy,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return Ri(e,n.invalidClass)}}),Vy=/* */Object.freeze({events:function(n,t){return n.validator.map(function(t){return cr([fr(t.onEvent,function(t){Iy(t,n).get(d)})].concat(t.validateOnLoad?[br(function(t){Iy(t,n).get(tt)})]:[]))}).getOr({})}}),Ny=[Hn("invalidClass"),Qn("getRoot",et.none),$n("notify",[Qn("aria","alert"),Qn("getContainer",et.none),Qn("validHtml",""),_u("onValid"),_u("onInvalid"),_u("onValidate")]),$n("validator",[Hn("validate"),Qn("onEvent","input"),Qn("validateOnLoad",!0)])],Hy=Uu({fields:Ny,name:"invalidating",active:Vy,apis:Ry,extra:{validation:function(e){return function(t){var n=_m.getValue(t);return Kb(e(n))}}}}),Py=/* */Object.freeze({exhibit:function(t,n){return yi({attributes:Rt([{key:n.tabAttr,value:"true"}])})}}),zy=[Qn("tabAttr","data-alloy-tabstop")],Ly=Uu({fields:zy,name:"tabstopping",active:Py}),jy=nt([Hn("dom"),Hn("fetch"),_u("onOpen"),Du("onExecute"),Qn("getHotspot",et.some),Qn("getAnchorOverrides",nt({})),Qn("layouts",et.none()),$s("dropdownBehaviours",[Ym,Mb,fm,Rm]),Hn("toggleClass"),Qn("eventOrder",{}),Xn("lazySink"),Qn("matchWidth",!1),Qn("useMinWidth",!1),Xn("role")].concat(my())),Uy=nt([Tl({schema:[Tu()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),$b()]),Wy=ef({name:"Dropdown",configFields:jy(),partFields:Uy(),factory:function(n,t,e,o){var r,i,u=function(t){Gs.getState(t).each(function(t){mg.highlightPrimary(t)})},a={expand:function(t){Ym.isOn(t)||ny(n,function(t){return t},t,o,tt,Lb.HighlightNone).get(tt)},open:function(t){Ym.isOn(t)||ny(n,function(t){return t},t,o,tt,Lb.HighlightFirst).get(tt)},isOpen:Ym.isOn,close:function(t){Ym.isOn(t)&&ny(n,function(t){return t},t,o,tt,Lb.HighlightFirst).get(tt)}},c=function(t,n){return Lo(t),et.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:Zs(n.dropdownBehaviours,[Ym.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),Mb.config({others:{sandbox:function(t){return ry(n,t,{onOpen:function(){Ym.on(t)},onClose:function(){Ym.off(t)}})}}}),fm.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t,n){if(Wy.isOpen(t)){var e=Mb.getCoupled(t,"sandbox");u(e)}else Wy.open(t);return et.some(!0)},onEscape:function(t,n){return Wy.isOpen(t)?(Wy.close(t),et.some(!0)):et.none()}}),Rm.config({})]),events:pg(et.some(function(t){ny(n,function(t){return t},t,o,u,Lb.HighlightFirst).get(tt)})),eventOrder:I({},n.eventOrder,(r={},r[xo()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:I({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}}),"button"===n.dom.tag?{type:(i="type",Mt(n.dom,"attributes").bind(function(t){return Mt(t,i)})).getOr("button")}:{})}}},apis:{open:function(t,n){return t.open(n)},expand:function(t,n){return t.expand(n)},close:function(t,n){return t.close(n)},isOpen:function(t,n){return t.isOpen(n)}}}),Gy=Uu({fields:[],name:"unselecting",active:/* */Object.freeze({events:function(t){return cr([sr(go(),nt(!0))])},exhibit:function(t,n){return yi({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),Xy=ti("color-input-change"),Yy=ti("color-swatch-change"),qy=ti("color-picker-cancel"),Ky=function(e,n,o){var r,i,t=Db.parts().field({factory:By,inputClasses:["tox-textfield"],onSetValue:function(t){return Hy.run(t).get(function(){})},inputBehaviours:Lu([Ly.config({}),Hy.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return Br(t.element())},notify:{onValid:function(t){var n=_m.getValue(t);zo(t,Xy,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=_m.getValue(t);if(0===n.length)return Kb(R.value(!0));var e=se.fromTag("span");Li(e,"background-color",n);var o=Gi(e,"background-color").fold(function(){return R.error("blah")},function(t){return R.value(n)});return Kb(o)}}})]),selectOnFocus:!1}),u=e.label.map(function(t){return wy(t,n.providers)}),a=function(t,n){zo(t,Yy,{value:n})},c=vg((r={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:et.some({onRtl:function(){return[Na]},onLtr:function(){return[Ha]}}),components:[],fetch:ov.getFetch(o.getColors(),o.hasCustomColors()),columns:o.getColorCols(),presets:"color",onItemAction:function(t,e){c.getOpt(t).each(function(n){"custom"===e?o.colorPicker(function(t){t.fold(function(){return Po(n,qy)},function(t){a(n,t),jh(t)})},"#ffffff"):a(n,"remove"===e?"":e)})}},i=n,Wy.sketch({dom:r.dom,components:r.components,toggleClass:"mce-active",dropdownBehaviours:Lu([Gy.config({}),Ly.config({})]),layouts:r.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:i.getSink,fetch:function(n){return qb(function(t){return r.fetch(t)}).map(function(t){return et.from(Dv(bt(mv(ti("menu-value"),t,function(t){r.onItemAction(n,t)},r.columns,r.presets,nh.CLOSE_ON_EXECUTE,function(){return!1},i.providers),{movement:pv(r.columns,r.presets)})))})},parts:{menu:sv(0,0,r.presets)}})));return Db.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[t,c.asSpec()]}]),fieldBehaviours:Lu([Dm("form-field-events",[fr(Xy,function(t,n){c.getOpt(t).each(function(t){Li(t.element(),"background-color",n.event().color())}),zo(t,yb,{name:e.name})}),fr(Yy,function(n,e){Db.getField(n).each(function(t){_m.setValue(t,e.event().value()),af.getCurrent(n).each(Rm.focus)})}),fr(qy,function(n,t){Db.getField(n).each(function(t){af.getCurrent(n).each(Rm.focus)})})])])})},Jy=function(t,n,e){return{hue:nt(t),saturation:nt(n),value:nt(e)}},$y=nt(ti("rgb-hex-update")),Qy=nt(ti("slider-update")),Zy=nt(ti("palette-update")),tx=Ne.detect().deviceType.isTouch(),nx=El({schema:[Hn("dom")],name:"label"}),ex=function(t){return El({name:t+"-edge",overrides:function(o){return o.model.manager.edgeActions[t].fold(function(){return{}},function(e){var t=cr([dr($e(),e,[o])]),n=cr([dr(to(),e,[o]),dr(no(),function(t,n){n.mouseIsDown.get()&&e(t,n)},[o])]);return{events:tx?t:n}})}})},ox=ex("top-left"),rx=ex("top"),ix=ex("top-right"),ux=ex("right"),ax=ex("bottom-right"),cx=ex("bottom"),sx=ex("bottom-left"),lx=[nx,ex("left"),ux,rx,cx,ox,ix,sx,ax,Ol({name:"thumb",defaults:nt({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:cr([gr($e(),t,"spectrum"),gr(Qe(),t,"spectrum"),gr(Ze(),t,"spectrum"),gr(to(),t,"spectrum"),gr(no(),t,"spectrum"),gr(oo(),t,"spectrum")])}}}),Ol({schema:[ue("mouseIsDown",function(){return ae(!1)})],name:"spectrum",overrides:function(e){var o=e.model.manager,r=function(n,t){return o.getValueFromEvent(t).map(function(t){return o.setValueFrom(n,e,t)})},t=cr([fr($e(),r),fr(Qe(),r)]),n=cr([fr(to(),r),fr(no(),function(t,n){e.mouseIsDown.get()&&r(t,n)})]);return{behaviours:Lu(tx?[]:[fm.config({mode:"special",onLeft:function(t){return o.onLeft(t,e)},onRight:function(t){return o.onRight(t,e)},onUp:function(t){return o.onUp(t,e)},onDown:function(t){return o.onDown(t,e)}}),Rm.config({})]),events:tx?t:n}}})],fx=Ne.detect().deviceType.isTouch(),dx=nt("slider.change.value"),mx=function(t){var n=t.event().raw();if(fx){var e=n;return e.touches!==undefined&&1===e.touches.length?et.some(e.touches[0]).map(function(t){return Qu(t.clientX,t.clientY)}):et.none()}var o=n;return o.clientX!==undefined?et.some(o).map(function(t){return Qu(t.clientX,t.clientY)}):et.none()},gx=function(t){return t.model.minX},px=function(t){return t.model.minY},hx=function(t){return t.model.minX-1},vx=function(t){return t.model.minY-1},bx=function(t){return t.model.maxX},yx=function(t){return t.model.maxY},xx=function(t){return t.model.maxX+1},wx=function(t){return t.model.maxY+1},Sx=function(t,n,e){return n(t)-e(t)},kx=function(t){return Sx(t,bx,gx)},Cx=function(t){return Sx(t,yx,px)},Ox=function(t){return kx(t)/2},Tx=function(t){return Cx(t)/2},Ex=function(t){return t.stepSize},Bx=function(t){return t.snapToGrid},_x=function(t){return t.snapStart},Dx=function(t){return t.rounded},Ax=function(t,n){return t[n+"-edge"]!==undefined},Fx=function(t){return Ax(t,"left")},Mx=function(t){return Ax(t,"right")},Ix=function(t){return Ax(t,"top")},Rx=function(t){return Ax(t,"bottom")},Vx=function(t){return t.model.value.get()},Nx=function(t){return{x:nt(t)}},Hx=function(t){return{y:nt(t)}},Px=function(t,n){return{x:nt(t),y:nt(n)}},zx=function(t,n){zo(t,dx(),{value:n})},Lx=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},jx=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},Ux=function(t,n,e){return Math.max(n,Math.min(e,t))},Wx=function(t){var n=t.min,e=t.max,o=t.range,r=t.value,i=t.step,u=t.snap,a=t.snapStart,c=t.rounded,s=t.hasMinEdge,l=t.hasMaxEdge,f=t.minBound,d=t.maxBound,m=t.screenRange,g=s?n-1:n,p=l?e+1:e;if(r<f)return g;if(d<r)return p;var h,v,b,y,x,w,S,k=(x=r,w=f,S=d,Math.min(S,Math.max(x,w))-w),C=Ux(k/m*o+n,g,p);return u&&n<=C&&C<=e?(h=C,v=n,b=e,y=i,a.fold(function(){var t=h-v,n=Math.round(t/y)*y;return Ux(v+n,v-1,b+1)},function(t){var n=(h-t)%y,e=Math.round(n/y),o=Math.floor((h-t)/y),r=Math.floor((b-t)/y),i=t+Math.min(r,o+e)*y;return Math.max(t,i)})):c?Math.round(C):C},Gx=function(t){var n=t.min,e=t.max,o=t.range,r=t.value,i=t.hasMinEdge,u=t.hasMaxEdge,a=t.maxBound,c=t.maxOffset,s=t.centerMinEdge,l=t.centerMaxEdge;return r<n?i?0:s:e<r?u?a:l:(r-n)/o*c},Xx="left",Yx=function(t){return t.element().dom().getBoundingClientRect()},qx=function(t,n){return t[n]},Kx=function(t){var n=Yx(t);return qx(n,Xx)},Jx=function(t){var n=Yx(t);return qx(n,"right")},$x=function(t){var n=Yx(t);return qx(n,"top")},Qx=function(t){var n=Yx(t);return qx(n,"bottom")},Zx=function(t){var n=Yx(t);return qx(n,"width")},tw=function(t){var n=Yx(t);return qx(n,"height")},nw=function(t,n,e){return(t+n)/2-e},ew=function(t,n){var e=Yx(t),o=Yx(n),r=qx(e,Xx),i=qx(e,"right"),u=qx(o,Xx);return nw(r,i,u)},ow=function(t,n){var e=Yx(t),o=Yx(n),r=qx(e,"top"),i=qx(e,"bottom"),u=qx(o,"top");return nw(r,i,u)},rw=function(t,n){zo(t,dx(),{value:n})},iw=function(t){return{x:nt(t)}},uw=function(t,n,e){var o={min:gx(n),max:bx(n),range:kx(n),value:e,step:Ex(n),snap:Bx(n),snapStart:_x(n),rounded:Dx(n),hasMinEdge:Fx(n),hasMaxEdge:Mx(n),minBound:Kx(t),maxBound:Jx(t),screenRange:Zx(t)};return Wx(o)},aw=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?jx:Lx)(Vx(r).x(),gx(r),bx(r),Ex(r)),rw(o,iw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},cw=function(t,n,e,o,r,i){var u,a,c,s,l,f,d,m,g,p=(a=i,c=e,s=o,l=r,f=Zx(u=n),d=s.bind(function(t){return et.some(ew(t,u))}).getOr(0),m=l.bind(function(t){return et.some(ew(t,u))}).getOr(f),g={min:gx(a),max:bx(a),range:kx(a),value:c,hasMinEdge:Fx(a),hasMaxEdge:Mx(a),minBound:Kx(u),minOffset:0,maxBound:Jx(u),maxOffset:f,centerMinEdge:d,centerMaxEdge:m},Gx(g));return Kx(n)-Kx(t)+p},sw=aw(-1),lw=aw(1),fw=et.none,dw=et.none,mw={"top-left":et.none(),top:et.none(),"top-right":et.none(),right:et.some(function(t,n){zx(t,Nx(xx(n)))}),"bottom-right":et.none(),bottom:et.none(),"bottom-left":et.none(),left:et.some(function(t,n){zx(t,Nx(hx(n)))})},gw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=uw(t,n,e),r=iw(o);return rw(t,r),o},setToMin:function(t,n){var e=gx(n);rw(t,iw(e))},setToMax:function(t,n){var e=bx(n);rw(t,iw(e))},findValueOfOffset:uw,getValueFromEvent:function(t){return mx(t).map(function(t){return t.left()})},findPositionOfValue:cw,setPositionFromValue:function(t,n,e,o){var r=Vx(e),i=cw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=aa(n.element())/2;Li(n.element(),"left",i-u+"px")},onLeft:sw,onRight:lw,onUp:fw,onDown:dw,edgeActions:mw}),pw=function(t,n){zo(t,dx(),{value:n})},hw=function(t){return{y:nt(t)}},vw=function(t,n,e){var o={min:px(n),max:yx(n),range:Cx(n),value:e,step:Ex(n),snap:Bx(n),snapStart:_x(n),rounded:Dx(n),hasMinEdge:Ix(n),hasMaxEdge:Rx(n),minBound:$x(t),maxBound:Qx(t),screenRange:tw(t)};return Wx(o)},bw=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?jx:Lx)(Vx(r).y(),px(r),yx(r),Ex(r)),pw(o,hw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},yw=function(t,n,e,o,r,i){var u,a,c,s,l,f,d,m,g,p=(a=i,c=e,s=o,l=r,f=tw(u=n),d=s.bind(function(t){return et.some(ow(t,u))}).getOr(0),m=l.bind(function(t){return et.some(ow(t,u))}).getOr(f),g={min:px(a),max:yx(a),range:Cx(a),value:c,hasMinEdge:Ix(a),hasMaxEdge:Rx(a),minBound:$x(u),minOffset:0,maxBound:Qx(u),maxOffset:f,centerMinEdge:d,centerMaxEdge:m},Gx(g));return $x(n)-$x(t)+p},xw=et.none,ww=et.none,Sw=bw(-1),kw=bw(1),Cw={"top-left":et.none(),top:et.some(function(t,n){zx(t,Hx(vx(n)))}),"top-right":et.none(),right:et.none(),"bottom-right":et.none(),bottom:et.some(function(t,n){zx(t,Hx(wx(n)))}),"bottom-left":et.none(),left:et.none()},Ow=/* */Object.freeze({setValueFrom:function(t,n,e){var o=vw(t,n,e),r=hw(o);return pw(t,r),o},setToMin:function(t,n){var e=px(n);pw(t,hw(e))},setToMax:function(t,n){var e=yx(n);pw(t,hw(e))},findValueOfOffset:vw,getValueFromEvent:function(t){return mx(t).map(function(t){return t.top()})},findPositionOfValue:yw,setPositionFromValue:function(t,n,e,o){var r=Vx(e),i=yw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=ra(n.element())/2;Li(n.element(),"top",i-u+"px")},onLeft:xw,onRight:ww,onUp:Sw,onDown:kw,edgeActions:Cw}),Tw=function(t,n){zo(t,dx(),{value:n})},Ew=function(t,n){return{x:nt(t),y:nt(n)}},Bw=function(s,l){return function(t,n){return(e=s,o=l,r=t,i=n,u=0<e?jx:Lx,a=o?Vx(i).x():u(Vx(i).x(),gx(i),bx(i),Ex(i)),c=o?u(Vx(i).y(),px(i),yx(i),Ex(i)):Vx(i).y(),Tw(r,Ew(a,c)),et.some(a)).map(function(){return!0});var e,o,r,i,u,a,c}},_w=Bw(-1,!1),Dw=Bw(1,!1),Aw=Bw(-1,!0),Fw=Bw(1,!0),Mw={"top-left":et.some(function(t,n){zx(t,Px(hx(n),vx(n)))}),top:et.some(function(t,n){zx(t,Px(Ox(n),vx(n)))}),"top-right":et.some(function(t,n){zx(t,Px(xx(n),vx(n)))}),right:et.some(function(t,n){zx(t,Px(xx(n),Tx(n)))}),"bottom-right":et.some(function(t,n){zx(t,Px(xx(n),wx(n)))}),bottom:et.some(function(t,n){zx(t,Px(Ox(n),wx(n)))}),"bottom-left":et.some(function(t,n){zx(t,Px(hx(n),wx(n)))}),left:et.some(function(t,n){zx(t,Px(hx(n),Tx(n)))})},Iw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=uw(t,n,e.left()),r=vw(t,n,e.top()),i=Ew(o,r);return Tw(t,i),i},setToMin:function(t,n){var e=gx(n),o=px(n);Tw(t,Ew(e,o))},setToMax:function(t,n){var e=bx(n),o=yx(n);Tw(t,Ew(e,o))},getValueFromEvent:function(t){return mx(t)},setPositionFromValue:function(t,n,e,o){var r=Vx(e),i=cw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=yw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=aa(n.element())/2,c=ra(n.element())/2;Li(n.element(),"left",i-a+"px"),Li(n.element(),"top",u-c+"px")},onLeft:_w,onRight:Dw,onUp:Aw,onDown:Fw,edgeActions:Mw}),Rw=Ne.detect().deviceType.isTouch(),Vw=[Qn("stepSize",1),Qn("onChange",tt),Qn("onChoose",tt),Qn("onInit",tt),Qn("onDragStart",tt),Qn("onDragEnd",tt),Qn("snapToGrid",!1),Qn("rounded",!0),Xn("snapStart"),Pn("model",Bn("mode",{x:[Qn("minX",0),Qn("maxX",100),ue("value",function(t){return ae(t.mode.minX)}),Hn("getInitialValue"),Mu("manager",gw)],y:[Qn("minY",0),Qn("maxY",100),ue("value",function(t){return ae(t.mode.minY)}),Hn("getInitialValue"),Mu("manager",Ow)],xy:[Qn("minX",0),Qn("maxX",100),Qn("minY",0),Qn("maxY",100),ue("value",function(t){return ae({x:nt(t.mode.minX),y:nt(t.mode.minY)})}),Hn("getInitialValue"),Mu("manager",Iw)]})),$s("sliderBehaviours",[fm,_m])].concat(Rw?[]:[ue("mouseIsDown",function(){return ae(!1)})]),Nw=Ne.detect().deviceType.isTouch(),Hw=ef({name:"Slider",configFields:Vw,partFields:lx,factory:function(i,t,n,e){var u=function(t){return zl(t,i,"thumb")},a=function(t){return zl(t,i,"spectrum")},o=function(t){return Pl(t,i,"left-edge")},r=function(t){return Pl(t,i,"right-edge")},c=function(t){return Pl(t,i,"top-edge")},s=function(t){return Pl(t,i,"bottom-edge")},l=i.model,f=l.manager,d=function(t,n){f.setPositionFromValue(t,n,i,{getLeftEdge:o,getRightEdge:r,getTopEdge:c,getBottomEdge:s,getSpectrum:a})},m=function(t,n){l.value.set(n);var e=u(t);return d(t,e),i.onChange(t,e,n),et.some(!0)},g=[fr($e(),function(t,n){i.onDragStart(t,u(t))}),fr(Ze(),function(t,n){i.onDragEnd(t,u(t))})],p=[fr(to(),function(t,n){n.stop(),i.onDragStart(t,u(t)),i.mouseIsDown.set(!0)}),fr(oo(),function(t,n){i.onDragEnd(t,u(t))})],h=Nw?g:p;return{uid:i.uid,dom:i.dom,components:t,behaviours:Zs(i.sliderBehaviours,q([Nw?[]:[fm.config({mode:"special",focusIn:function(t){return Pl(t,i,"spectrum").map(fm.focusIn).map(nt(!0))}})],[_m.config({store:{mode:"manual",getValue:function(t){return l.value.get()}}}),Ku.config({channels:{"mouse.released":{onReceive:function(e,t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&Pl(e,i,"thumb").each(function(t){var n=l.value.get();i.onChoose(e,t,n)})}}}})]])),events:cr([fr(dx(),function(t,n){m(t,n.event().value())}),br(function(t,n){var e=l.getInitialValue();l.value.set(e);var o=u(t);d(t,o);var r=a(t);i.onInit(t,o,r,l.value.get())})].concat(h)),apis:{resetToMin:function(t){f.setToMin(t,i)},resetToMax:function(t){f.setToMax(t,i)},changeValue:m,refresh:d},domModification:{styles:{position:"relative"}}}},apis:{resetToMin:function(t,n){t.resetToMin(n)},resetToMax:function(t,n){t.resetToMax(n)},refresh:function(t,n){t.refresh(n)}}}),Pw=function(t,n){var e=Hw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Hw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return Hw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:nt({y:nt(0)})},components:[e,o],sliderBehaviours:Lu([Rm.config({})]),onChange:function(t,n,e){zo(t,Qy(),{value:e})}})},zw=[$s("formBehaviours",[_m])],Lw=function(t){return"<alloy.field."+t+">"},jw=function(o,t,n){return{uid:o.uid,dom:o.dom,components:t,behaviours:Zs(o.formBehaviours,[_m.config({store:{mode:"manual",getValue:function(t){var n=jl(t,o);return st(n,function(t,n){return t().bind(function(t){var n,e=af.getCurrent(t);return n="missing current",e.fold(function(){return R.error(n)},R.value)}).map(_m.getValue)})},setValue:function(e,t){ct(t,function(n,t){Pl(e,o,t).each(function(t){af.getCurrent(t).each(function(t){_m.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return Pl(t,o,n).bind(af.getCurrent)}}}},Uw={getField:pi(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),Il("form",Lw(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=P(r,function(t){return Ol({name:t,pname:Lw(t)})});return Kl("form",zw,i,jw,o)}},Ww=ti("valid-input"),Gw=ti("invalid-input"),Xw=ti("validating-input"),Yw="colorcustom.rgb.",qw=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(Yw+"range"),c=[Db.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),Db.parts().field({data:r,factory:By,inputAttributes:I({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:Lu([(i=n,u=t,Hy.config({invalidClass:m("invalid"),notify:{onValidate:function(t){zo(t,Xw,{type:i})},onValid:function(t){zo(t,Ww,{type:i,value:_m.getValue(t)})},onInvalid:function(t){zo(t,Gw,{type:i,value:_m.getValue(t)})}},validator:{validate:function(t){var n=_m.getValue(t),e=u(n)?R.value(!0):R.error(d("aria.input.invalid"));return Kb(e)},validateOnLoad:!1}})),Ly.config({})]),onSetValue:function(t){Hy.isInvalid(t)&&Hy.run(t).get(tt)}})],s="hex"!==n?[Db.parts()["aria-descriptor"]({text:a})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:c.concat(s)}},v=function(t,n){var e=n.red(),o=n.green(),r=n.blue();_m.setValue(t,{red:e,green:o,blue:r})},b=vg({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){Li(t.element(),"background-color","#"+n.value())})};return nf({factory:function(){var e={red:nt(ae(et.some(255))),green:nt(ae(et.some(255))),blue:nt(ae(et.some(255))),hex:nt(ae(et.some("ffffff")))},o=function(t){return e[t]().get()},i=function(t,n){e[t]().set(n)},r=function(t){var n=t.red(),e=t.green(),o=t.blue();i("red",et.some(n)),i("green",et.some(e)),i("blue",et.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),et.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,et.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return Ch(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=bh(t),Uw.getField(n,"hex").each(function(t){Rm.isFocused(t)||_m.setValue(n,{hex:e.value()})}),e);y(r,o)})},a=function(t,n){var e=n.event();"hex"===e.type()?function(t,n){g(t);var e=dh(n);i("hex",et.some(n));var o=Eh(e);v(t,o),r(o),zo(t,$y(),{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(Yw+t+".label"),description:d(Yw+t+".description")}},c=t("red"),s=t("green"),l=t("blue"),f=t("hex");return bt(Uw.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",Db.sketch(h(Oh,"red",c.label,c.description,255))),t.field("green",Db.sketch(h(Oh,"green",s.label,s.description,255))),t.field("blue",Db.sketch(h(Oh,"blue",l.label,l.description,255))),t.field("hex",Db.sketch(h(ph,"hex",f.label,f.description,"ffffff"))),b.asSpec()],formBehaviours:Lu([Hy.config({invalidClass:m("form-invalid")}),Dm("rgb-form-events",[fr(Ww,a),fr(Gw,n),fr(Xw,n)])])}}),{apis:{updateHex:function(t,n){var e,o;_m.setValue(t,{hex:n.value()}),e=t,o=Eh(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},Kw=function(t,o){var r=Hw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=Hw.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette-thumb")],innerHtml:"<div class="+o("sv-palette-inner-thumb")+' role="presentation"></div>'}}),u=function(t,n){var e=t.width,o=t.height,r=t.getContext("2d");if(null!==r){r.fillStyle=n,r.fillRect(0,0,e,o);var i=r.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,e,o);var u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=u,r.fillRect(0,0,e,o)}};return nf({factory:function(t){var n=nt({x:nt(0),y:nt(0)}),e=Lu([af.config({find:et.some}),Rm.config({})]);return Hw.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette")]},model:{mode:"xy",getInitialValue:n},rounded:!1,components:[r,i],onChange:function(t,n,e){zo(t,Zy(),{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),_h(Dh()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,_h(o))}},extraApis:{}})},Jw=function(c,s){return nf({name:"ColourPicker",configFields:[Hn("dom"),Qn("onValidHex",tt),Qn("onInvalidHex",tt)],factory:function(t){var a,v,e=qw(c,s,t.onValidHex,t.onInvalidHex),o=Kw(c,s),b={paletteRgba:nt(ae(Dh()))},n=vg(o.sketch({})),r=vg(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=Eh(e);b.paletteRgba().set(n),o.setRgba(t,n)})},u=function(t,n){r.getOpt(t).each(function(t){e.updateHex(t,n)})},y=function(n,e,t){z(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),Pw(c,s),r.asSpec()],behaviours:Lu([Dm("colour-picker-events",[fr(Zy(),(v=[u],function(t,n){var e,o,r,i,u,a,c,s,l,f=n.event().value(),d=b.paletteRgba().get(),m=(i=r=0,u=(e=d).red()/255,a=e.green()/255,c=e.blue()/255,s=Math.min(u,Math.min(a,c)),l=Math.max(u,Math.max(a,c)),s===l?Jy(0,0,100*(i=s)):(r=60*((r=u===s?3:c===s?1:5)-(u===s?a-c:c===s?u-a:c-u)/(l-s)),o=(l-s)/l,i=l,Jy(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=Jy(m.hue(),f.x(),100-f.y()),p=Th(g),h=bh(p);y(t,h,v)})),fr(Qy(),(a=[i,u],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=Jy((100-e)/100*360,100,100),r=Th(o),bh(r));y(t,u,a)}))]),af.config({find:function(t){return r.getOpt(t)}}),fm.config({mode:"acyclic"})])}}})},$w=function(){return af.config({find:et.some})},Qw=function(t){return af.config({find:t.getOpt})},Zw=function(t){return af.config({find:function(n){return Ar(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},tS={"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"},nS=function(t){return tS[t]},eS=tinymce.util.Tools.resolve("tinymce.Resource"),oS=ln([Qn("preprocess",d),Qn("postprocess",d)]),rS=function(t,n,e){return _m.config(bt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},iS=function(t,n,e){return rS(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},uS=function(r,t){var i=On("RepresentingConfigs.memento processors",oS,t);return _m.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=_m.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);_m.setValue(o,e)}}})},aS=rS,cS=function(t){return iS(t,zr,Lr)},sS=function(t){return _m.config({store:{mode:"memory",initialValue:t}})},lS=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){z(t,function(t){t(n,e)})}},i=function(t,n){if(!Yp.isDisabled(t)){var e=n.event().raw();a(t,e.dataTransfer.files)}},u=function(t,n){var e=n.event().raw().target.files;a(t,e)},a=function(t,n){var e,o;_m.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),L(it(e),function(t){return o.test(t.name)}))),zo(t,yb,{name:r.name})},c=vg({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:Lu([Dm("input-file-events",[hr(ko())])])}),t=r.label.map(function(t){return wy(t,n)}),s=Db.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Lu([sS([]),$w(),Yp.config({}),Ym.config({toggleClass:"dragenter",toggleOnExecute:!1}),Dm("dropzone-events",[fr("dragenter",o([e,Ym.toggle])),fr("dragleave",o([e,Ym.toggle])),fr("dragover",e),fr("drop",o([e,i])),fr(lo(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},hg.sketch({dom:{tag:"button",innerHtml:n.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[c.asSpec()],action:function(t){c.get(t).element().dom().click()},buttonBehaviours:Lu([Ly.config({})])})]}]}}}});return vy(t,s,["tox-form__group--stretched"],[])},fS=ti("alloy-fake-before-tabstop"),dS=ti("alloy-fake-after-tabstop"),mS=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:Lu([Rm.config({ignore:!0}),Ly.config({})])}},gS=function(t,n){zo(t,ao(),{raw:{which:9,shiftKey:n}})},pS=function(t){return Hv(t,["."+fS,"."+dS].join(","),nt(!1))},hS=function(t,n){var e=n.element();Ri(e,fS)?gS(t,!0):Ri(e,dS)&&gS(t,!1)},vS=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[mS([fS]),t,mS([dS])],behaviours:Lu([Zw(1)])}},bS=!(Ne.detect().browser.isIE()||Ne.detect().browser.isEdge()),yS=function(t,n){var o,r,e=bS&&t.sandboxed,i=I({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=ae(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Ur(t.element(),"srcdoc",n);else{Ur(t.element(),"src","javascript:''");var e=t.element().dom().contentWindow.document;e.open(),e.write(n),e.close()}r.set(n)}}),a=t.label.map(function(t){return wy(t,n)}),c=Db.parts().field({factory:{sketch:function(t){return vS({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:Lu([Ly.config({}),Rm.config({}),aS(et.none(),u.getValue,u.setValue)])})}}});return vy(a,c,["tox-form__group--stretched"],[])};function xS(t,n){return kS(M.document.createElement("canvas"),t,n)}function wS(t){var n=xS(t.width,t.height);return SS(n).drawImage(t,0,0),n}function SS(t){return t.getContext("2d")}function kS(t,n,e){return t.width=n,t.height=e,t}function CS(t){return t.naturalWidth||t.width}function OS(t){return t.naturalHeight||t.height}var TS=window.Promise?window.Promise:function(){var i=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],l(t,o(r,this),o(a,this))},t=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){M.setTimeout(t,1)};function o(t,n){return function(){return t.apply(n,arguments)}}var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function u(o){var r=this;null!==this._state?t(function(){var t=r._state?o.onFulfilled:o.onRejected;if(null!==t){var n;try{n=t(r._value)}catch(e){return void o.reject(e)}o.resolve(n)}else(r._state?o.resolve:o.reject)(r._value)}):this._deferreds.push(o)}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void l(o(n,t),o(r,this),o(a,this))}this._state=!0,this._value=t,c.call(this)}catch(e){a.call(this,e)}}function a(t){this._state=!1,this._value=t,c.call(this)}function c(){for(var t=0,n=this._deferreds;t<n.length;t++){var e=n[t];u.call(this,e)}this._deferreds=[]}function s(t,n,e,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.resolve=e,this.reject=o}function l(t,n,e){var o=!1;try{t(function(t){o||(o=!0,n(t))},function(t){o||(o=!0,e(t))})}catch(r){if(o)return;o=!0,e(r)}}return i.prototype["catch"]=function(t){return this.then(null,t)},i.prototype.then=function(e,o){var r=this;return new i(function(t,n){u.call(r,new s(e,o,t,n))})},i.all=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var c=Array.prototype.slice.call(1===t.length&&e(t[0])?t[0]:t);return new i(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(n,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void e.call(t,function(t){a(n,t)},i)}c[n]=t,0==--u&&r(c)}catch(o){i(o)}}for(var t=0;t<c.length;t++)a(t,c[t])})},i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(t){t(n)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(r){return new i(function(t,n){for(var e=0,o=r;e<o.length;e++)o[e].then(t,n)})},i}();function ES(e){return new TS(function(t,n){(function p(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return et.none();for(var o=e[1],r=n[1],i=M.atob(r),u=i.length,a=Math.ceil(u/1024),c=new Array(a),s=0;s<a;++s){for(var l=1024*s,f=Math.min(l+1024,u),d=new Array(f-l),m=l,g=0;m<f;++g,++m)d[g]=i[m].charCodeAt(0);c[s]=new Uint8Array(d)}return et.some(new M.Blob(c,{type:o}))})(e).fold(function(){n("uri is not base64: "+e)},t)})}function BS(t,o,r){return o=o||"image/png",M.HTMLCanvasElement.prototype.toBlob?new TS(function(n,e){t.toBlob(function(t){t?n(t):e()},o,r)}):ES(t.toDataURL(o,r))}function _S(t){return function n(a){return new TS(function(t,n){var e=M.URL.createObjectURL(a),o=new M.Image,r=function(){o.removeEventListener("load",i),o.removeEventListener("error",u)};function i(){r(),t(o)}function u(){r(),n("Unable to load data of type "+a.type+": "+e)}o.addEventListener("load",i),o.addEventListener("error",u),o.src=e,o.complete&&i()})}(t).then(function(t){!function e(t){M.URL.revokeObjectURL(t.src)}(t);var n=xS(CS(t),OS(t));return SS(n).drawImage(t,0,0),n})}function DS(t,n,e){var o=n.type;function r(n,e){return t.then(function(t){return function o(t,n,e){return n=n||"image/png",t.toDataURL(n,e)}(t,n,e)})}return{getType:nt(o),toBlob:function i(){return TS.resolve(n)},toDataURL:function u(){return e},toBase64:function a(){return e.split(",")[1]},toAdjustedBlob:function c(n,e){return t.then(function(t){return BS(t,n,e)})},toAdjustedDataURL:r,toAdjustedBase64:function s(t,n){return r(t,n).then(function(t){return t.split(",")[1]})},toCanvas:function l(){return t.then(wS)}}}function AS(n){return function t(e){return new TS(function(t){var n=new M.FileReader;n.onloadend=function(){t(n.result)},n.readAsDataURL(e)})}(n).then(function(t){return DS(_S(n),n,t)})}function FS(n,t){return BS(n,t).then(function(t){return DS(TS.resolve(n),t,n.toDataURL())})}function MS(t,n,e){var o="string"==typeof t?parseFloat(t):t;return e<o?o=e:o<n&&(o=n),o}var IS=[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 RS(t,n){for(var e,o=[],r=new Array(25),i=0;i<5;i++){for(var u=0;u<5;u++)o[u]=n[u+5*i];for(u=0;u<5;u++){for(var a=e=0;a<5;a++)e+=t[u+5*a]*o[a];r[u+5*i]=e}}return r}function VS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=SS(t);var r=function B(t,n){for(var e,o,r,i,u=t.data,a=n[0],c=n[1],s=n[2],l=n[3],f=n[4],d=n[5],m=n[6],g=n[7],p=n[8],h=n[9],v=n[10],b=n[11],y=n[12],x=n[13],w=n[14],S=n[15],k=n[16],C=n[17],O=n[18],T=n[19],E=0;E<u.length;E+=4)e=u[E],o=u[E+1],r=u[E+2],i=u[E+3],u[E]=e*a+o*c+r*s+i*l+f,u[E+1]=e*d+o*m+r*g+i*p+h,u[E+2]=e*v+o*b+r*y+i*x+w,u[E+3]=e*S+o*k+r*C+i*O+T;return t}(o.getImageData(0,0,t.width,t.height),e);return o.putImageData(r,0,0),FS(t,n)}(t,n.getType(),e)})}function NS(n,e){return n.toCanvas().then(function(t){return function u(t,n,e){var o=SS(t);var r=o.getImageData(0,0,t.width,t.height),i=o.getImageData(0,0,t.width,t.height);return i=function S(t,n,e){function o(t,n,e){return e<t?t=e:t<n&&(t=n),t}for(var r=Math.round(Math.sqrt(e.length)),i=Math.floor(r/2),u=t.data,a=n.data,c=t.width,s=t.height,l=0;l<s;l++)for(var f=0;f<c;f++){for(var d=0,m=0,g=0,p=0;p<r;p++)for(var h=0;h<r;h++){var v=o(f+h-i,0,c-1),b=o(l+p-i,0,s-1),y=4*(b*c+v),x=e[p*r+h];d+=u[y]*x,m+=u[y+1]*x,g+=u[y+2]*x}var w=4*(l*c+f);a[w]=o(d,0,255),a[w+1]=o(m,0,255),a[w+2]=o(g,0,255)}return n}(r,i,e),o.putImageData(i,0,0),FS(t,n)}(t,n.getType(),e)})}function HS(e){return function(t,n){return VS(t,e([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n))}}var PS=function mF(n){return function(t){return VS(t,n)}}([-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0,0,0,0,0,1]),zS=HS(function gF(t,n){return RS(t,[1,0,0,0,n=MS(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])}),LS=HS(function pF(t,n){var e;return n=MS(n,-1,1),RS(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0==(e=n%1)?IS[n]:IS[Math.floor(n)]*(1-e)+IS[Math.floor(n)+1]*e)+127)/127,0,0,0,.5*(127-e),0,e/127,0,0,.5*(127-e),0,0,e/127,0,.5*(127-e),0,0,0,1,0,0,0,0,0,1])}),jS=function(t,n,e,o){return VS(t,function r(t,n,e,o){return RS(t,[n=MS(n,0,2),0,0,0,0,0,e=MS(e,0,2),0,0,0,0,0,o=MS(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])}([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n,e,o))},US=function hF(n){return function(t){return NS(t,n)}}([0,-1,0,-1,5,-1,0,-1,0]),WS=function vF(c){return function(n,e){return n.toCanvas().then(function(t){return function(t,n,e){for(var o=SS(t),r=new Array(256),i=0;i<r.length;i++)r[i]=c(i,e);var u=function a(t,n){for(var e=t.data,o=0;o<e.length;o+=4)e[o]=n[e[o]],e[o+1]=n[e[o+1]],e[o+2]=n[e[o+2]];return t}(o.getImageData(0,0,t.width,t.height),r);return o.putImageData(u,0,0),FS(t,n)}(t,n.getType(),e)})}}(function(t,n){return 255*Math.pow(t/255,1-n)});function GS(t,n,e){var o=CS(t),r=OS(t),i=n/o,u=e/r,a=!1;(i<.5||2<i)&&(i=i<.5?.5:2,a=!0),(u<.5||2<u)&&(u=u<.5?.5:2,a=!0);var c=function l(a,c,s){return new TS(function(t){var n=CS(a),e=OS(a),o=Math.floor(n*c),r=Math.floor(e*s),i=xS(o,r),u=SS(i);u.drawImage(a,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return GS(t,n,e)}):c}function XS(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=xS(t.width,t.height),r=SS(o),i=0,u=0;90!==(e=e<0?360+e:e)&&270!==e||kS(o,o.height,o.width);90!==e&&180!==e||(i=o.width);270!==e&&180!==e||(u=o.height);return r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),FS(o,n)}(t,n.getType(),e)})}function YS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=xS(t.width,t.height),r=SS(o);"v"===e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0));return FS(o,n)}(t,n.getType(),e)})}function qS(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=xS(r,i);return SS(u).drawImage(t,-e,-o),FS(u,n)}(t,n.getType(),e,o,r,i)})}var KS=function(t){return PS(t)},JS=function(t){return US(t)},$S=function(t,n){return WS(t,n)},QS=function(t,n){return zS(t,n)},ZS=function(t,n){return LS(t,n)},tk=function(t,n){return YS(t,n)},nk=function(t,n,e){return function r(n,e,o){return n.toCanvas().then(function(t){return GS(t,e,o).then(function(t){return FS(t,n.getType())})})}(t,n,e)},ek=function(t,n){return XS(t,n)},ok=function(t,n){return I({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},rk=function(t,n){return ok(yg(t,n),{})},ik=function(t,n){return ok(yg(t,n),{behaviours:Lu([hm.config({})])})},uk=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:Lu([hm.config({})])}},ak=ti("toolbar.button.execute"),ck={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},sk=ti("update-menu-text"),lk=ti("update-menu-icon"),fk=function(t,n,o){var e=ae(tt),r=t.text.map(function(t){return vg(uk(t,n,o.providers))}),i=t.icon.map(function(t){return vg(ik(t,o.providers.icons))}),u=function(t,n){var e=_m.getValue(t);return Rm.focus(e),zo(e,"keydown",{raw:n.event().raw()}),Wy.close(e),et.some(!0)},a=t.role.fold(function(){return{}},function(t){return{role:t}}),c=t.tooltip.fold(function(){return{}},function(t){var n=o.providers.translate(t);return{title:n,"aria-label":n}});return vg(Wy.sketch(I({},a,{dom:{tag:"button",classes:[n,n+"--select"].concat(P(t.classes,function(t){return n+"--"+t})),attributes:I({},c)},components:oh([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),et.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:yg("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:Lu(t.dropdownBehaviours.concat([Kp(t.disabled),Gy.config({}),hm.config({}),Dm("dropdown-events",[Zp(t,e),th(t,e)]),Dm("menubutton-update-display-text",[fr(sk,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){hm.set(t,[ou(o.providers.translate(e.event().text()))])})}),fr(lk,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){hm.set(t,[ik(e.event().icon(),o.providers.icons)])})})])])),eventOrder:bt(ck,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:Lu([fm.config({mode:"special",onLeft:u,onRight:u})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:sv(0,t.columns,t.presets)},fetch:function(){return qb(t.fetch)}}))).asSpec()},dk=function(e){return{isDisabled:function(){return Yp.isDisabled(e)},setDisabled:function(t){return Yp.set(e,t)},setActive:function(t){var n=e.element();t?(Fi(n,"tox-tbtn--enabled"),Ur(n,"aria-pressed",!0)):(Ii(n,"tox-tbtn--enabled"),Yr(n,"aria-pressed"))},isActive:function(){return Ri(e.element(),"tox-tbtn--enabled")}}},mk=function(t,n,e,o){return fk({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(Ey(t,nh.CLOSE_ON_EXECUTE,e))})},onSetup:t.onSetup,getApi:dk,columns:1,presets:"normal",classes:[],dropdownBehaviours:[Ly.config({})]},n,e.shared)},gk=function(t,n,e,o,r){void 0===e&&(e=[]);var i=n.fold(function(){return{}},function(t){return{action:t}}),u=I({buttonBehaviours:Lu([Kp(t.disabled),Ly.config({}),Dm("button press",[lr("click"),lr("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=bt(u,{dom:o});return bt(a,{components:r})},pk=function(t,n,e,o){void 0===o&&(o=[]);var r={tag:"button",classes:["tox-tbtn"],attributes:t.tooltip.map(function(t){return{"aria-label":e.translate(t),title:e.translate(t)}}).getOr({})},i=t.icon.map(function(t){return rk(t,e.icons)}),u=oh([i]);return gk(t,n,o,r,u)},hk=function(t,n,e,o){void 0===o&&(o=[]);var r=pk(t,et.some(n),e,o);return hg.sketch(r)},vk=function(t,n,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=e.translate(t.text),u=t.icon?t.icon.map(function(t){return rk(t,e.icons)}):et.none(),a=u.isSome()?oh([u]):[],c=u.isSome()?{}:{innerHtml:i},s=(t.primary||t.borderless?["tox-button"]:["tox-button","tox-button--secondary"]).concat(u.isSome()?["tox-button--icon"]:[],t.borderless?["tox-button--naked"]:[],r),l=I({tag:"button",classes:s},c,{attributes:{title:i}});return gk(t,n,o,l,a)},bk=function(t,n,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=vk(t,et.some(n),e,o,r);return hg.sketch(i)},yk=function(n,e){return function(t){"custom"===e?zo(t,Sb,{name:n,value:{}}):"submit"===e?Po(t,kb):"cancel"===e?Po(t,wb):M.console.error("Unknown button type: ",e)}},xk=function(t,n,e){if("menu"===n)return mk(t,"tox-tbtn",e,et.none());if("custom"===(i=n)||"cancel"===i||"submit"===i){var o=yk(t.name,n),r=I({},t,{borderless:!1});return bk(r,o,e.shared.providers,[])}var i;M.console.error("Unknown footer button type: ",n)},wk=nt([Qn("field1Name","field1"),Qn("field2Name","field2"),Au("onLockedChange"),Eu(["lockClass"]),Qn("locked",!1),tl("coupledFieldBehaviours",[af,_m])]),Sk=function(t,i){return Ol({factory:Db,name:t,overrides:function(r){return{fieldBehaviours:Lu([Dm("coupled-input-behaviour",[fr(so(),function(e){var t,n,o;(t=e,n=r,o=i,Pl(t,n,o).bind(af.getCurrent)).each(function(n){Pl(e,r,"lock").each(function(t){Ym.isOn(t)&&r.onLockedChange(e,n,t)})})})])])}}})},kk=nt([Sk("field1","field2"),Sk("field2","field1"),Ol({factory:hg,schema:[Hn("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:Lu([Ym.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),Ck=ef({name:"FormCoupledInputs",configFields:wk(),partFields:kk(),factory:function(o,t,n,e){return{uid:o.uid,dom:o.dom,components:t,behaviours:nl(o.coupledFieldBehaviours,[af.config({find:et.some}),_m.config({store:{mode:"manual",getValue:function(t){var n,e=Wl(t,o,["field1","field2"]);return(n={})[o.field1Name]=_m.getValue(e.field1()),n[o.field2Name]=_m.getValue(e.field2()),n},setValue:function(t,n){var e=Wl(t,o,["field1","field2"]);Nt(n,o.field1Name)&&_m.setValue(e.field1(),n[o.field1Name]),Nt(n,o.field2Name)&&_m.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return Pl(t,o,"field1")},getField2:function(t){return Pl(t,o,"field2")},getLock:function(t){return Pl(t,o,"lock")}}}},apis:{getField1:function(t,n){return t.getField1(n)},getField2:function(t,n){return t.getField2(n)},getLock:function(t,n){return t.getLock(n)}}}),Ok=function(t){var n=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(t);if(null===n)return R.error(t);var e=parseFloat(n[1]),o=n[2];return R.value({value:e,unit:o})},Tk=function(t,n){var e={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,"in":1},o=function(t){return Object.prototype.hasOwnProperty.call(e,t)};return t.unit===n?et.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?et.some(t.value):et.some(t.value/e[t.unit]*e[n]):et.none()},Ek=function(t){return et.none()},Bk=function(t,n){return function(t,n){for(var e=[],o=0;o<t.length;o++){var r=t[o];if(!r.isSome())return et.none();e.push(r.getOrDie())}return et.some(n.apply(null,e))}([Ok(t).toOption(),Ok(n).toOption()],function(t,o){return Tk(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return Tk(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr(Ek)}).getOr(Ek)},_k=function(o,n){var a=Ek,r=ti("ratio-event"),t=Ck.parts().lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:n.translate(o.label.getOr("Constrain proportions"))}},components:[{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__lock"],innerHtml:yg("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:yg("unlock",n.icons)}}],buttonBehaviours:Lu([Kp(o.disabled),Ly.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(e){return Db.parts().field({factory:By,inputClasses:["tox-textfield"],inputBehaviours:Lu([Yp.config({disabled:o.disabled}),Ly.config({}),Dm("size-input-events",[fr(io(),function(t,n){zo(t,r,{isField1:e})}),fr(lo(),function(t,n){zo(t,yb,{name:o.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=Ck.parts().field1(e([Db.parts().label(u("Width")),i(!0)])),s=Ck.parts().field2(e([Db.parts().label(u("Height")),i(!1)]));return Ck.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,e([u("&nbsp;"),t])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(t,i,n){Ok(_m.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;_m.setValue(i,(o={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,"in":4,"%":4},-1!==(r=(n=t).value.toFixed((e=n.unit)in o?o[e]:1)).indexOf(".")&&(r=r.replace(/\.?0*$/,"")),r+n.unit))})})},coupledFieldBehaviours:Lu([Yp.config({disabled:o.disabled,onDisabled:function(t){Ck.getField1(t).bind(Db.getField).each(Yp.disable),Ck.getField2(t).bind(Db.getField).each(Yp.disable),Ck.getLock(t).each(Yp.disable)},onEnabled:function(t){Ck.getField1(t).bind(Db.getField).each(Yp.enable),Ck.getField2(t).bind(Db.getField).each(Yp.enable),Ck.getLock(t).each(Yp.enable)}}),Dm("size-input-events2",[fr(r,function(t,n){var e=n.event().isField1(),o=e?Ck.getField1(t):Ck.getField2(t),r=e?Ck.getField2(t):Ck.getField1(t),i=o.map(_m.getValue).getOr(""),u=r.map(_m.getValue).getOr("");a=Bk(i,u)})])])})},Dk={undo:nt(ti("undo")),redo:nt(ti("redo")),zoom:nt(ti("zoom")),back:nt(ti("back")),apply:nt(ti("apply")),swap:nt(ti("swap")),transform:nt(ti("transform")),tempTransform:nt(ti("temp-transform")),transformApply:nt(ti("transform-apply"))},Ak=nt("save-state"),Fk=nt("disable"),Mk=nt("enable"),Ik={formActionEvent:Sb,saveState:Ak,disable:Fk,enable:Mk},Rk=function(a,c){var t=function(t,n,e,o){return vg(bk({name:t,text:t,disabled:e,primary:o,icon:et.none(),borderless:!1},n,c))},n=function(t,n,e,o){return vg(hk({name:t,icon:et.some(t),tooltip:et.some(n),disabled:o,primary:!1,borderless:!1},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Yp)&&Yp.disable(n)})},s=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Yp)&&Yp.enable(n)})},l={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=et.none(),o=tt,r=function(t,n,e){zo(t,n,e)},i=function(t){return Po(t,Ik.disable())},f=function(t){return Po(t,Ik.enable())},d=function(t,n){i(t),r(t,Dk.transform(),{transform:n}),f(t)},m=function(t){return function(){Z.getOpt(t).each(function(t){hm.set(t,[$])})}},g=function(t,n){i(t),r(t,Dk.transformApply(),{transform:n,swap:m(t)}),f(t)},p=function(){return t("Back",function(t){return r(t,Dk.back(),{swap:m(t)})},!1,!1)},h=function(){return vg({dom:{tag:"div",classes:["tox-spacer"]},behaviours:Lu([Yp.config({})])})},v=function(){return t("Apply",function(t){return r(t,Dk.apply(),{swap:m(t)})},!0,!0)},b=function(){return function(t){var n,e,o,r,i,u=a.getRect();return n=t,e=u.x,o=u.y,r=u.w,i=u.h,qS(n,e,o,r,i)}},y=[p(),h(),t("Apply",function(t){var n=b();g(t,n),a.hideCrop()},!1,!0)],x=ob.sketch({dom:l,components:y.map(function(t){return t.asSpec()}),containerBehaviours:Lu([Dm("image-tools-crop-buttons-events",[fr(Ik.disable(),function(t,n){u(y,t)}),fr(Ik.enable(),function(t,n){s(y,t)})])])}),w=vg(_k({name:"size",label:e,constrain:!0,disabled:!1},c)),S=[p(),h(),w,h(),t("Apply",function(a){w.getOpt(a).each(function(t){var n,e,o=_m.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return nk(t,n,e)});g(a,u)})},!1,!0)],k=ob.sketch({dom:l,components:S.map(function(t){return t.asSpec()}),containerBehaviours:Lu([Dm("image-tools-resize-buttons-events",[fr(Ik.disable(),function(t,n){u(S,t)}),fr(Ik.enable(),function(t,n){s(S,t)})])])}),C=function(n,e){return function(t){return n(t,e)}},O=C(tk,"h"),T=C(tk,"v"),E=C(ek,-90),B=C(ek,90),_=function(t,n){var e,o;o=n,i(e=t),r(e,Dk.tempTransform(),{transform:o}),f(e)},D=[p(),h(),n("flip-horizontally","Flip horizontally",function(t){_(t,O)},!1),n("flip-vertically","Flip vertically",function(t){_(t,T)},!1),n("rotate-left","Rotate counterclockwise",function(t){_(t,E)},!1),n("rotate-right","Rotate clockwise",function(t){_(t,B)},!1),h(),v()],A=ob.sketch({dom:l,components:D.map(function(t){return t.asSpec()}),containerBehaviours:Lu([Dm("image-tools-fliprotate-buttons-events",[fr(Ik.disable(),function(t,n){u(D,t)}),fr(Ik.enable(),function(t,n){s(D,t)})])])}),F=function(t,n,e,o,r){var i=Hw.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=Hw.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=Hw.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return vg(Hw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:nt({x:nt(o)})},components:[i,u,a],sliderBehaviours:Lu([Rm.config({})]),onChoose:n}))},M=function(t,n,e,o,r){return[p(),(i=t,u=n,a=e,c=o,s=r,F(i,function(t,n,e){var o=C(u,e.x()/100);d(t,o)},a,c,s)),v()];var i,u,a,c,s},I=function(t,n,e,o,r){var i=M(t,n,e,o,r);return ob.sketch({dom:l,components:i.map(function(t){return t.asSpec()}),containerBehaviours:Lu([Dm("image-tools-filter-panel-buttons-events",[fr(Ik.disable(),function(t,n){u(i,t)}),fr(Ik.enable(),function(t,n){s(i,t)})])])})},R=[p(),h(),v()],V=ob.sketch({dom:l,components:R.map(function(t){return t.asSpec()})}),N=I("Brightness",QS,-100,0,100),H=I("Contrast",ZS,-100,0,100),P=I("Gamma",$S,-100,0,100),z=function(n,e,o){return function(t){return jS(t,n,e,o)}},L=function(t){return F(t,function(a,t,n){var e=j.getOpt(a),o=W.getOpt(a),r=U.getOpt(a);e.each(function(u){o.each(function(i){r.each(function(t){var n=_m.getValue(u).x()/100,e=_m.getValue(t).x()/100,o=_m.getValue(i).x()/100,r=z(n,e,o);d(a,r)})})})},0,100,200)},j=L("R"),U=L("G"),W=L("B"),G=[p(),j,U,W,v()],X=ob.sketch({dom:l,components:G.map(function(t){return t.asSpec()})}),Y=function(n,e,o){return function(t){r(t,Dk.swap(),{transform:e,swap:function(){Z.getOpt(t).each(function(t){hm.set(t,[n]),o(t)})}})}},q=et.some(JS),K=et.some(KS),J=[n("crop","Crop",Y(x,e,function(t){a.showCrop()}),!1),n("resize","Resize",Y(k,e,function(t){w.getOpt(t).each(function(t){var n=a.getMeasurements(),e=n.width,o=n.height;_m.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",Y(A,e,o),!1),n("brightness","Brightness",Y(N,e,o),!1),n("sharpen","Sharpen",Y(V,q,o),!1),n("contrast","Contrast",Y(H,e,o),!1),n("color-levels","Color levels",Y(X,e,o),!1),n("gamma","Gamma",Y(P,e,o),!1),n("invert","Invert",Y(V,K,o),!1)],$=ob.sketch({dom:l,components:J.map(function(t){return t.asSpec()})}),Q=ob.sketch({dom:{tag:"div"},components:[$],containerBehaviours:Lu([hm.config({})])}),Z=vg(Q);return{memContainer:Z,getApplyButton:function(t){return Z.getOpt(t).map(function(t){var n=t.components()[0];return n.components()[n.components().length-1]})}}},Vk=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Nk=tinymce.util.Tools.resolve("tinymce.geom.Rect"),Hk=tinymce.util.Tools.resolve("tinymce.util.Observable"),Pk=tinymce.util.Tools.resolve("tinymce.util.Tools"),zk=tinymce.util.Tools.resolve("tinymce.util.VK");function Lk(t){var n,e;if(t.changedTouches)for(n="screenX screenY pageX pageY clientX clientY".split(" "),e=0;e<n.length;e++)t[n[e]]=t.changedTouches[0][n[e]]}function jk(t,r){var i,u,n,a,c,l,f,d=r.document||M.document;r=r||{};var m=d.getElementById(r.handle||t);n=function(t){var n,e,o=function s(t){var n,e,o,r,i,u,a,c=Math.max;return n=t.documentElement,e=t.body,o=c(n.scrollWidth,e.scrollWidth),r=c(n.clientWidth,e.clientWidth),i=c(n.offsetWidth,e.offsetWidth),u=c(n.scrollHeight,e.scrollHeight),a=c(n.clientHeight,e.clientHeight),{width:o<i?r:o,height:u<c(n.offsetHeight,e.offsetHeight)?a:u}}(d);Lk(t),t.preventDefault(),u=t.button,n=m,l=t.screenX,f=t.screenY,e=M.window.getComputedStyle?M.window.getComputedStyle(n,null).getPropertyValue("cursor"):n.runtimeStyle.cursor,i=Vk("<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),Vk(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(Lk(t),t.button!==u)return a(t);t.deltaX=t.screenX-l,t.deltaY=t.screenY-f,t.preventDefault(),r.drag(t)},a=function(t){Lk(t),Vk(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){Vk(m).off()},Vk(m).on("mousedown touchstart",n)}var Uk=0;var Wk=function(n){var l=vg({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),f=ae(1),d=ae(et.none()),m=ae({x:0,y:0,w:1,h:1}),c=ae({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=f.get(),o=aa(t.element()),r=ra(t.element()),i=s.dom().naturalWidth*e,u=s.dom().naturalHeight*e,a=Math.max(0,o/2-i/2),c=Math.max(0,r/2-u/2),n={left:a.toString()+"px",top:c.toString()+"px",width:i.toString()+"px",height:u.toString()+"px",position:"absolute"};ji(s,n),l.getOpt(t).each(function(t){ji(t.element(),n)}),d.get().each(function(t){var n=m.get();t.setRect({x:n.x*e+a,y:n.y*e+c,w:n.w*e,h:n.h*e}),t.setClampRect({x:a,y:c,w:i,h:u}),t.setViewPortRect({x:0,y:0,w:o,h:r})})})},e=function(t,n){var e,a=se.fromTag("img");return Ur(a,"src",n),(e=a.dom(),new Pg(function(t){var n=function(){e.removeEventListener("load",n),t(e)};e.complete?t(e):e.addEventListener("load",n)})).then(function(){return g.getOpt(t).map(function(t){var n=ru({element:a});hm.replaceAt(t,1,et.some(n));var e=c.get(),o={x:0,y:0,w:a.dom().naturalWidth,h:a.dom().naturalHeight};c.set(o);var r,u,i=Nk.inflate(o,-20,-20);return m.set(i),e.w===o.w&&e.h===o.h||(r=t,u=a,g.getOpt(r).each(function(t){var n=aa(t.element()),e=ra(t.element()),o=u.dom().naturalWidth,r=u.dom().naturalHeight,i=Math.min(n/o,e/r);1<=i?f.set(1):f.set(i)})),s(t,a),a})})},t=ob.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[l.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:Lu([Dm("image-panel-crop-events",[br(function(t){g.getOpt(t).each(function(t){var n=function S(s,e,l,o,r){var f,u,n,i,a="tox-",c="tox-crid-"+Uk++;function d(t,n){return{x:n.x-t.x,y:n.y-t.y,w:n.w,h:n.h}}function m(t,n,e,o){var r,i,u,a,c;r=n.x,i=n.y,u=n.w,a=n.h,r+=e*t.deltaX,i+=o*t.deltaY,(u+=e*t.deltaW)<20&&(u=20),(a+=o*t.deltaH)<20&&(a=20),c=s=Nk.clamp({x:r,y:i,w:u,h:a},l,"move"===t.name),c=d(l,c),f.fire("updateRect",{rect:c}),h(c)}function g(n){function t(t,n){n.h<0&&(n.h=0),n.w<0&&(n.w=0),Vk("#"+c+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}Pk.each(u,function(t){Vk("#"+c+"-"+t.name,o).css({left:n.w*t.xMul+n.x,top:n.h*t.yMul+n.y})}),t("top",{x:e.x,y:e.y,w:e.w,h:n.y-e.y}),t("right",{x:n.x+n.w,y:n.y,w:e.w-n.x-n.w+e.x,h:n.h}),t("bottom",{x:e.x,y:n.y+n.h,w:e.w,h:e.h-n.y-n.h+e.y}),t("left",{x:e.x,y:n.y,w:n.x-e.x,h:n.h}),t("move",n)}function p(t){g(s=t)}function h(t){p(function e(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}}(l,t))}return u=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}],i=["top","right","bottom","left"],function v(){Vk('<div id="'+c+'" class="'+a+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),Pk.each(i,function(t){Vk("#"+c,o).append('<div id="'+c+"-"+t+'"class="'+a+'croprect-block" style="display: none" data-mce-bogus="all">')}),Pk.each(u,function(t){Vk("#"+c,o).append('<div id="'+c+"-"+t.name+'" class="'+a+"croprect-handle "+a+"croprect-handle-"+t.name+'"style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1" aria-label="'+t.label+'" aria-grabbed="false" title="'+t.label+'">')}),n=Pk.map(u,function t(n){var e;return new jk(c,{document:o.ownerDocument,handle:c+"-"+n.name,start:function(){e=s},drag:function(t){m(n,e,t.deltaX,t.deltaY)}})}),g(s),Vk(o).on("focusin focusout",function(t){Vk(t.target).attr("aria-grabbed","focus"===t.type?"true":"false")}),Vk(o).on("keydown",function(n){var i;function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),m(i,e,o,r)}switch(Pk.each(u,function(t){if(n.target.id===c+"-"+t.name)return i=t,!1}),n.keyCode){case zk.LEFT:t(n,0,s,-10,0);break;case zk.RIGHT:t(n,0,s,10,0);break;case zk.UP:t(n,0,s,0,-10);break;case zk.DOWN:t(n,0,s,0,10);break;case zk.ENTER:case zk.SPACEBAR:n.preventDefault(),r()}})}(),f=Pk.extend({toggleVisibility:function b(t){var n;n=Pk.map(u,function(t){return"#"+c+"-"+t.name}).concat(Pk.map(i,function(t){return"#"+c+"-"+t})).join(","),t?Vk(n,o).show():Vk(n,o).hide()},setClampRect:function y(t){l=t,g(s)},setRect:p,getInnerRect:function t(){return d(l,s)},setInnerRect:h,setViewPortRect:function x(t){e=t,g(s)},destroy:function w(){Pk.each(n,function(t){t.destroy()}),n=[]}},Hk)}({x:10,y:10,w:100,h:100},{x:0,y:0,w:200,h:200},{x:0,y:0,w:200,h:200},t.element().dom(),function(){});n.toggleVisibility(!1),n.on("updateRect",function(t){var n=t.rect,e=f.get(),o={x:Math.round(n.x/e),y:Math.round(n.y/e),w:Math.round(n.w/e),h:Math.round(n.h/e)};m.set(o)}),d.set(et.some(n))})})])])}],containerBehaviours:Lu([hm.config({}),Dm("image-panel-events",[br(function(t){e(t,n)})])])}),g=vg(t);return{memContainer:g,updateSrc:e,zoom:function(t,n){var e=f.get(),o=0<n?Math.min(2,e+.1):Math.max(.1,e-.1);f.set(o),g.getOpt(t).each(function(t){var n=t.components()[1].element();s(t,n)})},showCrop:function(){d.get().each(function(t){t.toggleVisibility(!0)})},hideCrop:function(){d.get().each(function(t){t.toggleVisibility(!1)})},getRect:function(){return m.get()},getMeasurements:function(){var t=c.get();return{width:t.w,height:t.h}}}},Gk=function(t,n,e,o,r){return hk({name:t,icon:et.some(n),disabled:e,tooltip:et.some(t),primary:!1,borderless:!1},o,r)},Xk=function(t,n){n?Yp.enable(t):Yp.disable(t)};var Yk,qk,Kk,Jk,$k=function(t){var n=ae(t),e=ae(et.none()),r=function s(){var e=[],o=-1;function t(){return 0<o}function n(){return-1!==o&&o<e.length-1}return{data:e,add:function r(t){var n;return n=e.splice(++o),e.push(t),{state:t,removed:n}},undo:function i(){if(t())return e[--o]},redo:function u(){if(n())return e[++o]},canUndo:t,canRedo:n}}();r.add(t);var i=function(t){n.set(t)},u=function(t){return{blob:t,url:M.URL.createObjectURL(t)}},a=function(t){M.URL.revokeObjectURL(t.url)},o=function(){e.get().each(a),e.set(et.none())},c=function(t){var n=u(t);i(n);var e,o=r.add(n).removed;return e=o,Pk.each(e,a),n.url};return{getBlobState:function(){return n.get()},setBlobState:i,addBlobState:c,getTempState:function(){return e.get().fold(function(){return n.get()},function(t){return t})},updateTempState:function(t){var n=u(t);return o(),e.set(et.some(n)),n.url},addTempState:function(t){var n=u(t);return e.set(et.some(n)),n.url},applyTempState:function(n){return e.get().fold(function(){},function(t){c(t.blob),n()})},destroyTempState:o,undo:function(){var t=r.undo();return i(t),t.url},redo:function(){var t=r.redo();return i(t),t.url},getHistoryStates:function(){return{undoEnabled:r.canUndo(),redoEnabled:r.canRedo()}}}},Qk=function(t,n){var e,o,r,u=$k(t.currentState),a=function(t){var n=u.getHistoryStates();p.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),zo(t,Ik.formActionEvent,{name:Ik.saveState(),value:n.undoEnabled})},c=function(t){return t.toBlob()},s=function(t){zo(t,Ik.formActionEvent,{name:Ik.disable(),value:{}})},l=function(t){h.getApplyButton(t).each(function(t){Yp.enable(t)}),zo(t,Ik.formActionEvent,{name:Ik.enable(),value:{}})},f=function(t,n){return s(t),g.updateSrc(t,n)},d=function(n,t,e,o,r){return s(n),(i=t,AS(i)).then(e).then(c).then(o).then(function(t){return f(n,t).then(function(t){return a(n),r(),l(n),t})})["catch"](function(t){return M.console.log(t),l(n),t});var i},i=function(t,n,e){var o=u.getBlobState().blob;d(t,o,n,function(t){return u.updateTempState(t)},e)},m=function(t){var n=u.getBlobState().url;return u.destroyTempState(),a(t),n},g=Wk(t.currentState.url),p=(o=vg(Gk("Undo","undo",!0,function(t){zo(t,Dk.undo(),{direction:1})},e=n)),r=vg(Gk("Redo","redo",!0,function(t){zo(t,Dk.redo(),{direction:1})},e)),{container:ob.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),Gk("Zoom in","zoom-in",!1,function(t){zo(t,Dk.zoom(),{direction:1})},e),Gk("Zoom out","zoom-out",!1,function(t){zo(t,Dk.zoom(),{direction:-1})},e)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){Xk(t,n)}),r.getOpt(t).each(function(t){Xk(t,e)})}}),h=Rk(g,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[h.memContainer.asSpec(),g.memContainer.asSpec(),p.container],behaviours:Lu([_m.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),Dm("image-tools-events",[fr(Dk.undo(),function(n,t){var e=u.undo();f(n,e).then(function(t){l(n),a(n)})}),fr(Dk.redo(),function(n,t){var e=u.redo();f(n,e).then(function(t){l(n),a(n)})}),fr(Dk.zoom(),function(t,n){var e=n.event().direction();g.zoom(t,e)}),fr(Dk.back(),function(t,n){var e,o;o=m(e=t),f(e,o).then(function(t){l(e)}),n.event().swap()(),g.hideCrop()}),fr(Dk.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),fr(Dk.transform(),function(t,n){return i(t,n.event().transform(),tt)}),fr(Dk.tempTransform(),function(t,n){return e=t,o=n.event().transform(),r=u.getTempState().blob,void d(e,r,o,function(t){return u.addTempState(t)},tt);var e,o,r}),fr(Dk.transformApply(),function(t,n){return e=t,o=n.event().transform(),r=n.event().swap(),i=u.getBlobState().blob,void d(e,i,o,function(t){var n=u.addBlobState(t);return m(e),n},r);var e,o,r,i}),fr(Dk.swap(),function(n,t){var e;e=n,p.updateButtonUndoStates(e,!1,!1);var o=t.event().transform(),r=t.event().swap();o.fold(function(){r()},function(t){i(n,t,r)})})]),$w()])}},Zk=nf({name:"HtmlSelect",configFields:[Hn("options"),$s("selectBehaviours",[Rm,_m]),Qn("selectClasses",[]),Qn("selectAttributes",{}),Xn("data")],factory:function(e,t){var n=P(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),o=e.data.map(function(t){return It("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:n,behaviours:Zs(e.selectBehaviours,[Rm.config({}),_m.config({store:I({mode:"manual",getValue:function(t){return Ki(t.element())},setValue:function(t,n){W(e.options,function(t){return t.value===n}).isSome()&&Ji(t.element(),n)}},o)})])}}}),tC=function(e,n){var t=e.label.map(function(t){return wy(t,n)}),o=[Yp.config({disabled:e.disabled}),fm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(t){return Po(t,kb),et.some(!0)}}),Dm("textfield-change",[fr(so(),function(t,n){zo(t,yb,{name:e.name})}),fr(bo(),function(t,n){zo(t,yb,{name:e.name})})]),Ly.config({})],r=e.validation.map(function(o){return Hy.config({getRoot:function(t){return Br(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=_m.getValue(t),e=o.validator(n);return Kb(!0===e?R.value(n):R.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=Db.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:e.placeholder.fold(function(){},function(t){return{placeholder:n.translate(t)}}),inputClasses:[e.classname],inputBehaviours:Lu(q([o,r])),selectOnFocus:!1,factory:By}),u=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),a=[Yp.config({disabled:e.disabled,onDisabled:function(t){Db.getField(t).each(Yp.disable)},onEnabled:function(t){Db.getField(t).each(Yp.enable)}})];return vy(t,i,u,a)},nC=function(i){return I({},i,{toCached:function(){return nC(i.toCached())},bindFuture:function(n){return nC(i.bind(function(t){return t.fold(function(t){return Kb(R.error(t))},function(t){return n(t)})}))},bindResult:function(n){return nC(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return nC(i.map(function(t){return t.map(n)}))},mapError:function(n){return nC(i.map(function(t){return t.mapError(n)}))},foldResult:function(n,e){return i.map(function(t){return t.fold(n,e)})},withTimeout:function(t,r){return nC(qb(function(n){var e=!1,o=M.setTimeout(function(){e=!0,n(R.error(r()))},t);i.get(function(t){e||(M.clearTimeout(o),n(t))})}))}})},eC=function(t){return nC(qb(t))},oC=eC,rC={type:"separator"},iC=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},uC=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},aC=function(t,n){return o=t,e=L(n,function(t){return t.type===o}),P(e,iC);var e,o},cC=function(t,n){var e=t.toLowerCase();return L(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return De(n.toLowerCase(),e)||De(t.value.toLowerCase(),e)})},sC=function(c,t,s){var n=_m.getValue(t),l=n.meta.text!==undefined?n.meta.text:n.value;return s.getLinkInformation().fold(function(){return[]},function(t){var n,e,o,r,i,u,a=cC(l,(n=s.getHistory(c),P(n,function(t){return uC(t,t)})));return"file"===c?(e=[a,cC(l,(u=t,aC("header",u.targets))),cC(l,q([(i=t,et.from(i.anchorTop).map(function(t){return uC("<top>",t)}).toArray()),(r=t,aC("anchor",r.targets)),(o=t,et.from(o.anchorBottom).map(function(t){return uC("<bottom>",t)}).toArray())]))],U(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat(rC,n)},[])):a})},lC=ti("aria-invalid"),fC=function(r,o,i){var t,n,e,u,a,c=o.shared.providers,s=function(t){var n=_m.getValue(t);i.addToHistory(n.value,r.filetype)},l=Db.parts().field({factory:hy,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":lC},minChars:0,responseTime:0,fetch:function(t){var n=sC(r.filetype,t,i),e=Ey(n,nh.BUBBLE_TO_SANDBOX,o);return Kb(e)},getHotspot:function(t){return h.getOpt(t)},onSetValue:function(t,n){t.hasConfigured(Hy)&&Hy.run(t).get(tt)},typeaheadBehaviours:Lu(q([i.getValidationHandler().map(function(o){return Hy.config({getRoot:function(t){return Br(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(t,n){d.getOpt(t).each(function(t){Ur(t.element(),"title",c.translate(n))})}},validator:{validate:function(t){var e=_m.getValue(t);return oC(function(n){o({type:r.filetype,url:e.value},function(t){n(("invalid"===t.status?R.error:R.value)(t.message))})})},validateOnLoad:!1}})}).toArray(),[Yp.config({disabled:r.disabled}),Ly.config({}),Dm("urlinput-events",q(["file"===r.filetype?[fr(so(),function(t){zo(t,yb,{name:r.name})})]:[],[fr(lo(),function(t){zo(t,yb,{name:r.name}),s(t)}),fr(bo(),function(t){zo(t,yb,{name:r.name}),s(t)})]]))]])),eventOrder:(t={},t[so()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:o.shared.getSink,parts:{menu:sv(0,0,"normal")},onExecute:function(t,n,e){zo(n,kb,{})},onItemExecute:function(t,n,e,o){s(t),zo(t,yb,{name:r.name})}}),f=r.label.map(function(t){return wy(t,c)}),d=vg((n="invalid",e=et.some(lC),void 0===(u="warning")&&(u=n),void 0===a&&(a=n),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+n],innerHtml:yg(u,c.icons),attributes:I({title:c.translate(a),"aria-live":"polite"},e.fold(function(){return{}},function(t){return{id:t}}))}})),m=vg({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),g=i.getUrlPicker(r.filetype),p=ti("browser.url.event"),h=vg({dom:{tag:"div",classes:["tox-control-wrap"]},components:[l,m.asSpec()],behaviours:Lu([Yp.config({disabled:r.disabled})])}),v=vg(bk({name:r.name,icon:et.some("browse"),text:r.label.getOr(""),disabled:r.disabled,primary:!1,borderless:!0},function(t){return Po(t,p)},c,[],["tox-browse-url"]));return Db.sketch({dom:xy([]),components:f.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[h.asSpec()],g.map(function(){return v.asSpec()}).toArray()])}]),fieldBehaviours:Lu([Yp.config({disabled:r.disabled,onDisabled:function(t){Db.getField(t).each(Yp.disable),v.getOpt(t).each(Yp.disable)},onEnabled:function(t){Db.getField(t).each(Yp.enable),v.getOpt(t).each(Yp.enable)}}),Dm("url-input-events",[fr(p,function(o){af.getCurrent(o).each(function(n){var e=_m.getValue(n);g.each(function(t){t(e).get(function(t){_m.setValue(n,t),zo(o,yb,{name:r.name})})})})})])])})},dC=function(a,n){var t,e,o=a.label.map(function(t){return wy(t,n)}),r=function(e){return function(n,t){lu(t.event().target(),"[data-collection-item-value]").each(function(t){e(n,t,Gr(t,"data-collection-item-value"))})}},i=[fr(ro(),r(function(t,n){Af(n)})),fr(ko(),r(function(t,n,e){zo(t,Sb,{name:a.name,value:e})})),fr(io(),r(function(t,n,e){su(t.element(),"."+wp).each(function(t){Ii(t,wp)}),Fi(n,wp)})),fr(uo(),r(function(t,n,e){su(t.element(),"."+wp).each(function(t){Ii(t,wp)})})),wr(r(function(t,n,e){zo(t,Sb,{name:a.name,value:e})}))],u=Db.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==a.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:d},behaviours:Lu([hm.config({}),_m.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){var n,e,r,i;n=o,e=P(t,function(t){var n,e=mp.translate(t.text),o=1===a.columns?'<div class="tox-collection__item-label">'+e+"</div>":"",r='<div class="tox-collection__item-icon">'+t.icon+"</div>",i={_:" "," - ":" ","-":" "},u=e.replace(/\_| \- |\-/g,function(t){return i[t]});return'<div class="tox-collection__item" tabindex="-1" data-collection-item-value="'+('"'===(n=t.value)?"&quot;":n)+'" title="'+u+'" aria-label="'+u+'">'+r+o+"</div>"}),r=1<a.columns&&"auto"!==a.columns?H(e,a.columns):[e],i=P(r,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"}),Lr(n.element(),i.join("")),"auto"===a.columns&&np(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;fm.setGridSize(o,n,e)}),Po(o,Eb)}}),Ly.config({}),fm.config((t=a.columns,e="normal",1===t?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===t?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===e?".tox-swatches__row":".tox-collection__group",cell:"color"===e?"."+hp:"."+pp}})),Dm("collection-events",i)])});return vy(o,u,["tox-form__group--collection"],[])},mC=function(r){return function(n,e,o){return Mt(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},gC={bar:mC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:P(e.items,o.interpreter)};var e,o}),collection:mC(function(t,n){return dC(t,n.shared.providers)}),alloy:mC(d),alertbanner:mC(function(t,n){return e=t,o=n.shared.providers,ob.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in","tox-notification--"+e.level]},components:[{dom:{tag:"div",classes:["tox-notification__icon"]},components:[hg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:yg(e.icon,o.icons),attributes:{title:o.translate(e.iconTooltip)}},action:function(t){zo(t,Sb,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:mC(function(t,n){return e=t,o=n.shared.providers,tC({name:e.name,multiline:!1,label:e.label,placeholder:e.placeholder,flex:!1,disabled:e.disabled,classname:"tox-textfield",validation:et.none(),maximized:e.maximized},o);var e,o}),textarea:mC(function(t,n){return e=t,o=n.shared.providers,tC({name:e.name,multiline:!0,label:e.label,placeholder:e.placeholder,flex:!0,disabled:e.disabled,classname:"tox-textarea",validation:et.none(),maximized:e.maximized},o);var e,o}),listbox:mC(function(t,n){return e=t,o=n.shared.providers,r=wy(e.label,o),i=Db.parts().field({factory:Zk,dom:{classes:["mce-select-field"]},selectBehaviours:Lu([Ly.config({})]),options:e.values,data:e.initialValue.getOr(undefined)}),by(et.some(r),i);var e,o,r,i}),label:mC(function(t,n){return e=t,o=n.shared,r={dom:{tag:"label",innerHtml:o.providers.translate(e.label),classes:["tox-label"]}},i=P(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:Lu([$w(),hm.config({}),cS(et.none()),fm.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(Yk=function(t,n){return yS(t,n.shared.providers)},function(t,n,e){var o=bt(n,{source:"dynamic"});return mC(Yk)(t,o,e)}),autocomplete:mC(function(t,n){return i=n,e=wy((r=t).label.getOr("?"),i.shared.providers),o=Db.parts().field({factory:hy,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(t){var n=_m.getValue(t),e=r.getItems(n),o=Ey(e,nh.BUBBLE_TO_SANDBOX,i);return Kb(o)},markers:{openClass:"dog"},lazySink:i.shared.getSink,parts:{menu:sv(0,0,"normal")}}),by(et.some(e),o);var r,i,e,o}),button:mC(function(t,n){return e=t,o=n.shared.providers,r=yk(e.name,"custom"),by(et.none(),Db.parts().field(I({factory:hg},vk(e,et.some(r),o,[sS(""),$w()]))));var e,o,r}),checkbox:mC(function(t,n){return e=t,o=n.shared.providers,r=_m.config({store:{mode:"manual",getValue:function(t){return t.element().dom().checked},setValue:function(t,n){t.element().dom().checked=n}}}),i=function(t){return t.element().dom().click(),et.some(!0)},u=Db.parts().field({factory:{sketch:d},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:Lu([$w(),Yp.config({disabled:e.disabled}),Ly.config({}),Rm.config({}),r,fm.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),Dm("checkbox-events",[fr(lo(),function(t,n){zo(t,yb,{name:e.name})})])])}),a=Db.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:Lu([Gy.config({})])}),s=vg({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:yg("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),Db.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a],fieldBehaviours:Lu([Yp.config({disabled:e.disabled,disableClass:"tox-checkbox--disabled",onDisabled:function(t){Db.getField(t).each(Yp.disable)},onEnabled:function(t){Db.getField(t).each(Yp.enable)}})])});var e,o,r,i,u,a,c,s}),colorinput:mC(function(t,n){return Ky(t,n.shared,n.colorinput)}),colorpicker:mC(function(t){var n=function(t){return"tox-"+t},e=Jw(nS,n),r=vg(e.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(t){zo(t,Sb,{name:"hex-valid",value:!0})},onInvalidHex:function(t){zo(t,Sb,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:Lu([_m.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return af.getCurrent(n).bind(function(t){return _m.getValue(t).hex}).map(function(t){return"#"+t}).getOr("")},setValue:function(t,n){var e=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(n),o=r.get(t);af.getCurrent(o).fold(function(){M.console.log("Can not find form")},function(t){_m.setValue(t,{hex:et.from(e[1]).getOr("")}),Uw.getField(t,"hex").each(function(t){Po(t,so())})})}}}),$w()])}}),dropzone:mC(function(t,n){return lS(t,n.shared.providers)}),grid:mC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:P(e.items,o.interpreter)};var e,o}),selectbox:mC(function(t,n){return e=t,o=n.shared.providers,r=P(e.items,function(t){return{text:o.translate(t.text),value:t.value}}),i=e.label.map(function(t){return wy(t,o)}),u=Db.parts().field({dom:{},selectAttributes:{size:e.size},options:r,factory:Zk,selectBehaviours:Lu([Yp.config({disabled:e.disabled}),Ly.config({}),Dm("selectbox-change",[fr(lo(),function(t,n){zo(t,yb,{name:e.name})})])])}),a=1<e.size?et.none():et.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:yg("chevron-down",o.icons)}}),c={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[u],a.toArray()])},Db.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([i.toArray(),[c]]),fieldBehaviours:Lu([Yp.config({disabled:e.disabled,onDisabled:function(t){Db.getField(t).each(Yp.disable)},onEnabled:function(t){Db.getField(t).each(Yp.enable)}})])});var e,o,r,i,u,a,c}),sizeinput:mC(function(t,n){return _k(t,n.shared.providers)}),urlinput:mC(function(t,n){return fC(t,n,n.urlinput)}),customeditor:mC(function(e){var o=ae(et.none()),n=vg({dom:{tag:e.tag}}),r=ae(et.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:Lu([Dm("editor-foo-events",[br(function(t){n.getOpt(t).each(function(n){var t;(t=e,Object.prototype.hasOwnProperty.call(t,"init")?e.init(n.element().dom()):eS.load(e.scriptId,e.scriptUrl).then(function(t){return t(n.element().dom(),e.settings)})).then(function(n){r.get().each(function(t){n.setValue(t)}),r.set(et.none()),o.set(et.some(n))})})})]),_m.config({store:{mode:"manual",getValue:function(){return o.get().fold(function(){return r.get().getOr("")},function(t){return t.getValue()})},setValue:function(t,n){o.get().fold(function(){r.set(et.some(n))},function(t){return t.setValue(n)})}}}),$w()]),components:[n.asSpec()]}}),htmlpanel:mC(function(t){return"presentation"===t.presets?ob.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):ob.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:Lu([Ly.config({}),Rm.config({})])})}),imagetools:mC(function(t,n){return Qk(t,n.shared.providers)}),table:mC(function(t,n){return e=t,o=n.shared.providers,u=function(t){return{dom:{tag:"th",innerHtml:o.translate(t)}}},a=function(t){return{dom:{tag:"td",innerHtml:o.translate(t)}}},c=function(t){return{dom:{tag:"tr"},components:P(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:P(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:P(r,c)})],behaviours:Lu([Ly.config({}),Rm.config({})])};var e,o,r,i,u,a,c}),panel:mC(function(t,n){return o=n,{dom:{tag:"div",classes:(e=t).classes},components:P(e.items,o.shared.interpreter)};var e,o})},pC={field:function(t,n){return n}},hC=function(n,t,e){var o=bt(e,{shared:{interpreter:function(t){return vC(n,t,o)}}});return vC(n,t,o)},vC=function(n,e,o){return Mt(gC,e.type).fold(function(){return M.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},bC=function(t){return t.x()},yC=function(t,n){return t.x()+t.width()/2-n.width()/2},xC=function(t,n){return t.x()+t.width()-n.width()},wC=function(t){return t.y()},SC=function(t,n){return t.y()+t.height()-n.height()},kC=function(t,n,e){return wa(bC(t),SC(t,n),e.innerSoutheast(),ka(),"layout-se")},CC=function(t,n,e){return wa(xC(t,n),SC(t,n),e.innerSouthwest(),Ca(),"layout-sw")},OC=function(t,n,e){return wa(bC(t),wC(t),e.innerNortheast(),Oa(),"layout-ne")},TC=function(t,n,e){return wa(xC(t,n),wC(t),e.innerNorthwest(),Ta(),"layout-nw")},EC=function(t,n,e){return wa(yC(t,n),wC(t),e.innerNorth(),Ba(),"layout-n")},BC=function(t,n,e){return wa(yC(t,n),SC(t,n),e.innerSouth(),Ea(),"layout-s")},_C={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},DC=function(t,n,e){var o,r,i,u,a,c,s,l,f,d,m=bb(t),g=function(){return se.fromDom(t.getBody())};return{toolbar:(l=g,f=n,d=m,d?function(){return{anchor:"node",root:l(),node:et.from(l()),bubble:ya(-12,-12,_C),layouts:{onRtl:function(){return[OC]},onLtr:function(){return[TC]}}}}:function(){return{anchor:"hotspot",hotspot:f(),bubble:ya(-12,12,_C),layouts:{onRtl:function(){return[Na]},onLtr:function(){return[Ha]}}}}),toolbarOverflow:(s=e,function(){return{anchor:"hotspot",hotspot:s(),layouts:{onRtl:function(){return[Na]},onLtr:function(){return[Ha]}}}}),banner:(u=g,a=n,c=e,c?function(){return{anchor:"node",root:u(),node:et.from(u()),layouts:{onRtl:function(){return[EC]},onLtr:function(){return[EC]}}}}:function(){return{anchor:"hotspot",hotspot:a(),layouts:{onRtl:function(){return[ja]},onLtr:function(){return[ja]}}}}),cursor:(r=t,i=g,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return et.some(fc.range(se.fromDom(t.startContainer),t.startOffset,se.fromDom(t.endContainer),t.endOffset))}}}),node:(o=g,function(t){return{anchor:"node",root:o(),node:t}})}},AC=function(t){return{colorPicker:(r=t,function(t,n){ov.colorPickerDialog(r)(t,n)}),hasCustomColors:(o=t,function(){return Ph(o)}),getColors:(e=t,function(){return zh(e)}),getColorCols:(n=t,function(){return ov.getColorCols(n)})};var n,e,o,r},FC=[{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"}]}],MC=function(t){return U(t,function(t,n){if(gt(n,"items")){var e=MC(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(gt(n,"inline")||gt(n,"block")||gt(n,"selector")){var o="custom-"+n.title.toLowerCase();return{customFormats:t.customFormats.concat([{name:o,format:n}]),formats:t.formats.concat([{title:n.title,format:o,icon:n.icon}])}}return I({},t,{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},IC=function(i){return(t=i,et.from(t.getParam("style_formats")).filter(T)).map(function(t){var n,e,o,r=(n=i,e=MC(t),o=function(t){z(t,function(t){n.formatter.has(t.name)||n.formatter.register(t.name,t.format)})},n.formatter?o(e.customFormats):n.on("init",function(){o(e.customFormats)}),e.formats);return i.getParam("style_formats_merge",!1,"boolean")?FC.concat(r):r}).getOr(FC);var t},RC=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return bt(t,o)},VC=function(s,t,l,f){var d=function(t){return P(t,function(t){var n,e,o,r,i,u,a=ut(t);if(Nt(t,"items")){var c=d(t.items);return bt((i=t,u={type:"submenu",isSelected:nt(!1),getStylePreview:function(){return et.none()}},bt(i,u)),{getStyleItems:function(){return c}})}return Nt(t,"format")?RC(t,l,f):1===a.length&&F(a,"title")?bt(t,{type:"separator"}):(e=ti((n=t).title),o={type:"formatter",format:e,isSelected:l(e),getStylePreview:f(e)},r=bt(n,o),s.formatter.register(e,r),r)})};return d(t)},NC=Pk.trim,HC=function(n){return function(t){if(t&&1===t.nodeType){if(t.contentEditable===n)return!0;if(t.getAttribute("data-mce-contenteditable")===n)return!0}return!1}},PC=HC("true"),zC=HC("false"),LC=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},jC=function(t){return t.innerText||t.textContent},UC=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&GC(t);var n},WC=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},GC=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return PC(t)}return!1}(t)&&!zC(t)},XC=function(t){return WC(t)&&GC(t)},YC=function(t){var n,e,o=(n=t).id?n.id:ti("h");return LC("header",jC(t),"#"+o,WC(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},qC=function(t){var n=t.id||t.name,e=jC(t);return LC("anchor",e||"#"+n,"#"+n,0,tt)},KC=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,P(Ic(se.fromDom(e),n),function(t){return t.dom()})},JC=function(t){return 0<NC(t.title).length},$C=function(t){var n,e=KC(t);return L((n=e,P(L(n,XC),YC)).concat(P(L(e,UC),qC)),JC)},QC="tinymce-url-history",ZC=function(t){return C(t)&&/^https?/.test(t)},tO=function(t){return O(t)&&function(t,n){for(var e=ut(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return et.some(u)}return et.none()}(t,function(t){return!(T(n=t)&&n.length<=5&&J(n,ZC));var n}).isNone()},nO=function(){var t,n=M.localStorage.getItem(QC);if(null===n)return{};try{t=JSON.parse(n)}catch(e){if(e instanceof SyntaxError)return M.console.log("Local storage "+QC+" was not valid JSON",e),{};throw e}return tO(t)?t:(M.console.log("Local storage "+QC+" was not valid format",t),{})},eO=function(t){var n=nO();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},oO=function(n,t){if(ZC(n)){var e=nO(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=L(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!tO(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));M.localStorage.setItem(QC,JSON.stringify(t))}(e)}},rO=Object.prototype.hasOwnProperty,iO=function(t){return!!t},uO=function(t){return st(Pk.makeMap(t,/[, ]/),iO)},aO=function(t,n,e){var o,r,i=(o=t,r=n,rO.call(o,r)?et.some(o[r]):et.none()).getOr(e);return C(i)?et.some(i):et.none()},cO=function(t){return et.some(t.file_picker_callback).filter(B)},sO=function(t,n){var e,o,r,i,u=(e=t,o=et.some(e.file_picker_types).filter(iO),r=et.some(e.file_browser_callback_types).filter(iO),i=o.or(r).map(uO),cO(e).fold(function(){return!1},function(t){return i.fold(function(){return!0},function(t){return 0<ut(t).length&&t})}));return E(u)?u?cO(t):et.none():u[n]?cO(t):et.none()},lO=function(n){return{getHistory:eO,addToHistory:oO,getLinkInformation:function(){return!1===(t=n).settings.typeahead_urls?et.none():et.some({targets:$C(t.getBody()),anchorTop:aO(t.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:aO(t.settings,"anchor_bottom","#bottom").getOrUndefined()});var t},getValidationHandler:function(){return t=n,et.from(t.settings.file_picker_validator_handler).filter(B).orThunk(function(){return et.from(t.settings.filepicker_validator_handler).filter(B)});var t},getUrlPicker:function(t){return i=t,sO((r=n).settings,i).map(function(o){return function(n){return qb(function(e){var t=Pk.extend({filetype:i},et.from(n.meta).getOr({}));o.call(r,function(t,n){if(!C(t))throw new Error("Expected value to be string");if(n!==undefined&&!O(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},fO=function(t,n,e,o){var r,i,u={shared:{providers:{icons:function(){return n.ui.registry.getAll().icons},menuItems:function(){return n.ui.registry.getAll().menuItems},translate:mp.translate},interpreter:function(t){return vC(pC,t,u)},anchors:DC(n,e,o),getSink:function(){return R.value(t)}},urlinput:lO(n),styleselect:function(e){var o=function(t){return function(){return e.formatter.match(t)}},r=function(n){return function(){var t=e.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:e.formatter.getCssText(n)}):et.none()}},i=function(t){var n=t.items;return n!==undefined&&0<n.length?K(n,i):[t.format]},u=ae([]),a=ae([]),c=ae([]),s=ae([]),l=ae(!1);e.on("init",function(){var t=IC(e),n=VC(e,t,o,r);u.set(n),a.set(K(n,i))}),e.on("addStyleModifications",function(t){var n=VC(e,t.items,o,r);c.set(n),l.set(t.replace),s.set(K(n,i))});return{getData:function(){var t=l.get()?[]:u.get(),n=c.get();return t.concat(n)},getFlattenedKeys:function(){var t=l.get()?[]:a.get(),n=s.get();return t.concat(n)}}}(n),colorinput:AC(n),dialog:(r=n,{isDraggableModal:(i=r,function(){return i.getParam("draggable_modal",!1,"boolean")})})};return u},dO=nt([Hn("dom"),Qn("shell",!0),$s("toolbarBehaviours",[hm])]),mO=nt([El({name:"groups",overrides:function(t){return{behaviours:Lu([hm.config({})])}}})]),gO=ef({name:"Toolbar",configFields:dO(),partFields:mO(),factory:function(n,t,e,o){var r=function(t){return n.shell?et.some(t):Pl(t,n,"groups")},i=n.shell?{behaviours:[hm.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:i.components,behaviours:Zs(n.toolbarBehaviours,i.behaviours),apis:{setGroups:function(t,n){r(t).fold(function(){throw 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(t){hm.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),pO=Sr("within","extra","withinWidth"),hO=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return et.some({element:nt(t),start:nt(n),finish:nt(n+e),width:nt(e)})},U(t,function(n,t){return e(t,n.len).fold(nt(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=L(r,function(t){return t.finish()<=n}),u=j(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:nt(i),extra:nt(a),withinWidth:nt(u)}},vO=function(t){return P(t,function(t){return t.element()})},bO=function(t,n,e,o){var r,i,u,a,c,s,l,f,d,m,g,p,h=(r=t,i=n,u=e,a=hO(i,r,u),0===a.extra().length?et.some(a):et.none()).getOrThunk(function(){return hO(n,t-e(o),e)}),v=h.within(),b=h.extra(),y=h.withinWidth();return 1===b.length&&b[0].width()<=e(o)?(m=b,g=y,p=vO(v.concat(m)),pO(p,[],g)):1<=b.length?(s=b,l=o,f=y,d=vO(v).concat([l]),pO(d,vO(s),f)):(c=y,pO(vO(v),[],c))},yO=function(t,n){var e=P(n,function(t){return au(t)});gO.setGroups(t,e)},xO=function(t,n,e,o){var r=zl(t,n,"primary"),i=Pl(t,n,"overflow-button"),u=Mb.getCoupled(t,"overflowGroup");Li(r.element(),"visibility","hidden");var a,c=(a=i,e.bind(function(n){return Mf(n.element()).bind(function(t){return n.getSystem().getByDom(t).toOption()})}).orThunk(function(){return a.filter(Rm.isFocused)}));e.each(function(t){gO.setGroups(t,[])});var s=n.builtGroups.get();yO(r,s.concat([u]));var l=aa(r.element()),f=bO(l,s,function(t){return aa(t.element())},u);0===f.extra().length?(hm.remove(r,u),e.each(function(t){gO.setGroups(t,[])})):(yO(r,f.within()),e.each(function(t){yO(t,f.extra())})),Yi(r.element(),"visibility"),qi(r.element()),e.each(function(n){i.each(function(t){return Ym.set(t,o(n))}),c.each(Rm.focus)})},wO=nt([Hn("items"),Eu(["itemSelector"]),$s("tgroupBehaviours",[fm])]),SO=nt([Bl({name:"items",unit:"item"})]),kO=ef({name:"ToolbarGroup",configFields:wO(),partFields:SO(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,behaviours:Zs(t.tgroupBehaviours,[fm.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),CO=nt([$s("splitToolbarBehaviours",[]),ue("builtGroups",function(){return ae([])})]),OO=function(o,t,n,e,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:Zs(o.splitToolbarBehaviours,[Mb.config({others:I({},r.coupling,{overflowGroup:function(n){return kO.sketch(I({},e["overflow-group"](),{items:[hg.sketch(I({},e["overflow-button"](),{action:function(t){Po(n,i)}}))]}))}})}),Dm("toolbar-toggle-events",[fr(i,function(t){r.toggleToolbar(t,o,e)})])]),apis:{setGroups:function(t,n){var e;e=P(n,t.getSystem().build),o.builtGroups.set(e),r.refresh(t,o)},refresh:function(t){r.refresh(t,o)},getMoreButton:function(t){return Pl(t,o,"overflow-button")},getOverflow:function(t){return n=t,r.getOverflow(n);var n},toggle:function(t){r.toggleToolbar(t,o,e)}},domModification:{attributes:{role:"group"}}}},TO=nt([Eu(["overflowToggledClass"]),Hn("getAnchor"),Hn("lazySink")].concat(CO())),EO=nt([Ol({factory:gO,schema:dO(),name:"primary"}),Tl({factory:gO,schema:dO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:Lu([fm.config({mode:"cyclic",onEscape:function(t){return Pl(t,n,"overflow-button").each(Rm.focus),et.none()}})])}}}),Tl({name:"overflow-button",overrides:function(t){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:Lu([Ym.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),Tl({name:"overflow-group"})]),BO=function(t,n,e){var o=Mb.getCoupled(t,"sandbox");Gs.isOpen(o)?Gs.close(o):Gs.open(o,e.overflow())},_O=function(t){return t.getSystem().isConnected()},DO=function(o,r){var t=Gs.getState(Mb.getCoupled(o,"sandbox"));xO(o,r,t,_O),t.each(function(t){var n=r.lazySink(o).getOrDie(),e=r.getAnchor(o);Ts.position(n,e,t)})},AO=ef({name:"SplitFloatingToolbar",configFields:TO(),partFields:EO(),factory:function(n,t,e,o){return OO(n,t,0,o,{refresh:DO,toggleToolbar:BO,getOverflow:function(t){return Gs.getState(Mb.getCoupled(t,"sandbox"))},coupling:{sandbox:function(t){return o=t,e=n,{dom:{tag:"div",attributes:{id:(r=fu()).id()}},behaviours:Lu([fm.config({mode:"special",onEscape:function(t){return Gs.close(t),et.some(!0)}}),Gs.config({onOpen:function(t,n){DO(o,e),Pl(o,e,"overflow-button").each(function(t){Ym.on(t),r.link(t.element())}),fm.focusIn(n)},onClose:function(){Pl(o,e,"overflow-button").each(function(t){Ym.off(t),Rm.focus(t),r.unlink(t.element())})},isPartOf:function(t,n,e){return mu(n,e)||mu(o,e)},getAttachPoint:function(){return e.lazySink(o).getOrDie()}})])};var o,e,r}}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),FO=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},MO=function(t){return t.dimension.property},IO=function(t,n){return t.dimension.getDimension(n)},RO=function(t,n){var e=FO(t,n);Ni(e,[n.shrinkingClass,n.growingClass])},VO=function(t,n){Ii(t.element(),n.openClass),Fi(t.element(),n.closedClass),Li(t.element(),MO(n),"0px"),qi(t.element())},NO=function(t,n){Ii(t.element(),n.closedClass),Fi(t.element(),n.openClass),Yi(t.element(),MO(n))},HO=function(t,n,e,o){e.setCollapsed(),Li(t.element(),MO(n),IO(n,t.element())),qi(t.element()),RO(t,n),VO(t,n),n.onStartShrink(t),n.onShrunk(t)},PO=function(t,n,e,o){var r=o.getOrThunk(function(){return IO(n,t.element())});e.setCollapsed(),Li(t.element(),MO(n),r),qi(t.element());var i=FO(t,n);Ii(i,n.growingClass),Fi(i,n.shrinkingClass),VO(t,n),n.onStartShrink(t)},zO=function(t,n,e){var o=IO(n,t.element());("0px"===o?HO:PO)(t,n,e,et.some(o))},LO=function(t,n,e){var o=FO(t,n),r=Ri(o,n.shrinkingClass),i=IO(n,t.element());NO(t,n);var u=IO(n,t.element());(r?function(){Li(t.element(),MO(n),i),qi(t.element())}:function(){VO(t,n)})(),Ii(o,n.shrinkingClass),Fi(o,n.growingClass),NO(t,n),Li(t.element(),MO(n),u),e.setExpanded(),n.onStartGrow(t)},jO=function(t,n,e){var o=FO(t,n);return!0===Ri(o,n.growingClass)},UO=function(t,n,e){var o=FO(t,n);return!0===Ri(o,n.shrinkingClass)},WO=/* */Object.freeze({refresh:function(t,n,e){if(e.isExpanded()){Yi(t.element(),MO(n));var o=IO(n,t.element());Li(t.element(),MO(n),o)}},grow:function(t,n,e){e.isExpanded()||LO(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&zO(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&HO(t,n,e)},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:jO,isShrinking:UO,isTransitioning:function(t,n,e){return!0===jO(t,n)||!0===UO(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?zO:LO)(t,n,e)},disableTransitions:RO}),GO=/* */Object.freeze({exhibit:function(t,n){var e=n.expanded;return yi(e?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:It(n.dimension.property,"0px")})},events:function(e,o){return cr([vr(mo(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(RO(t,e),o.isExpanded()&&Yi(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),XO=[Hn("closedClass"),Hn("openClass"),Hn("shrinkingClass"),Hn("growingClass"),Xn("getAnimationRoot"),_u("onShrunk"),_u("onStartShrink"),_u("onGrown"),_u("onStartGrow"),Qn("expanded",!1),Pn("dimension",Bn("property",{width:[Mu("property","width"),Mu("getDimension",function(t){return aa(t)+"px"})],height:[Mu("property","height"),Mu("getDimension",function(t){return ra(t)+"px"})]}))],YO=Uu({fields:XO,name:"sliding",active:GO,apis:WO,state:/* */Object.freeze({init:function(t){var n=ae(t.expanded);return vi({isExpanded:function(){return!0===n.get()},isCollapsed:function(){return!1===n.get()},setCollapsed:g(n.set,!1),setExpanded:g(n.set,!0),readState:function(){return"expanded: "+n.get()}})}})}),qO=nt([Eu(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"])].concat(CO())),KO=nt([Ol({factory:gO,schema:dO(),name:"primary"}),Ol({factory:gO,schema:dO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:Lu([YO.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass,onShrunk:function(t){Pl(t,n,"overflow-button").each(function(t){Ym.off(t),Rm.focus(t)})},onGrown:function(t){fm.focusIn(t)},onStartGrow:function(t){Pl(t,n,"overflow-button").each(Ym.on)}}),fm.config({mode:"acyclic",onEscape:function(t){return Pl(t,n,"overflow-button").each(Rm.focus),et.some(!0)}})])}}}),Tl({name:"overflow-button",overrides:function(t){return{buttonBehaviours:Lu([Ym.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),Tl({name:"overflow-group"})]),JO=function(n,e){Pl(n,e,"overflow").each(function(t){QO(n,e),YO.toggleGrow(t)})},$O=function(t){return YO.hasGrown(t)},QO=function(t,n){var e=Pl(t,n,"overflow");xO(t,n,e,$O),e.each(YO.refresh)},ZO=ef({name:"SplitSlidingToolbar",configFields:qO(),partFields:KO(),factory:function(n,t,e,o){return OO(n,t,0,o,{refresh:QO,toggleToolbar:JO,getOverflow:function(t){return Pl(t,n,"overflow")},coupling:{}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),tT="silver.readonly",nT=ln([(qk="readonly",Pn(qk,Mn))]),eT=function(t,n){var e,o,r,i=t.outerContainer;o=n,r=(e=t).outerContainer.element(),o&&(e.mothership.broadcastOn([Xs()],{target:r}),e.uiMothership.broadcastOn([Xs()],{target:r})),e.mothership.broadcastOn([tT],{readonly:o}),e.uiMothership.broadcastOn([tT],{readonly:o}),Ge("*",i.element()).forEach(function(t){i.getSystem().getByDom(t).each(function(t){t.hasConfigured(Yp)&&Yp.set(t,n)})})},oT=function(t,n){t.on("init",function(){t.readonly&&eT(n,!0)}),t.on("SwitchMode",function(){return eT(n,t.readonly)}),t.getParam("readonly",!1,"boolean")&&t.setMode("readonly")},rT=function(n){var t;return Ku.config({channels:(t={},t[tT]={schema:nT,onReceive:function(t,o){n(t).each(function(t){var n,e;n=t,e=o.readonly,Ge("*",n.element()).forEach(function(t){n.getSystem().getByDom(t).each(function(t){t.hasConfigured(Yp)&&Yp.set(t,e)})})})}},t)})},iT=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:I({tag:"div",classes:["tox-toolbar__group"]},n),components:[kO.parts().items({})],items:t.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])"},tgroupBehaviours:Lu([Ly.config({}),Rm.config({})])}},uT=function(t){return kO.sketch(iT(t))},aT=function(e,t,n){var o=br(function(t){var n=P(e.initGroups,uT);gO.setGroups(t,n)});return Lu([fm.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Dm("toolbar-events",[o]),rT(n)])},cT=function(t,n){var e=t.cyclicKeying?"cyclic":"acyclic";return{uid:t.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":iT({title:et.none(),items:[]}),"overflow-button":pk({name:"more",icon:et.some("more-drawer"),disabled:!1,tooltip:et.some("More..."),primary:!1,borderless:!1},et.none(),t.backstage.shared.providers)},splitToolbarBehaviours:aT(t,e,n)}},sT=function(t){var n=cT(t,AO.getOverflow),e=AO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return AO.sketch(I({},n,{lazySink:t.getSink,getAnchor:function(){return t.backstage.shared.anchors.toolbarOverflow()},parts:I({},n.parts,{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"]}}}),components:[e],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))},lT=function(t){var n=ZO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=ZO.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),o=cT(t,ZO.getOverflow);return ZO.sketch(I({},o,{components:[n,e],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"}}))},fT=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return gO.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[gO.parts().groups({})],toolbarBehaviours:aT(t,n,nt(et.none()))})},dT=[oe("disabled",!1),Kn("tooltip"),Kn("icon"),Kn("text"),re("onSetup",function(){return tt})],mT=ln([zn("type"),jn("onAction")].concat(dT)),gT=function(t){return kn("toolbarbutton",mT,t)},pT=[Kn("text"),Kn("tooltip"),Kn("icon"),jn("fetch"),re("onSetup",function(){return tt})],hT=ln([zn("type")].concat(pT)),vT=function(t){return kn("menubutton",hT,t)},bT=ln([zn("type"),Kn("tooltip"),Kn("icon"),Kn("text"),Jn("select"),jn("fetch"),re("onSetup",function(){return tt}),ee("presets","normal",["normal","color","listpreview"]),Qn("columns",1),jn("onAction"),jn("onItemAction")]),yT=[oe("active",!1)].concat(dT),xT=ln(yT.concat([zn("type"),jn("onAction")])),wT=function(t){return kn("ToggleButton",xT,t)},ST=[re("predicate",function(){return!1}),ee("scope","node",["node","editor"]),ee("position","selection",["node","selection","line"])],kT=dT.concat([Qn("type","contextformbutton"),Qn("primary",!1),jn("onAction"),ue("original",d)]),CT=yT.concat([Qn("type","contextformbutton"),Qn("primary",!1),jn("onAction"),ue("original",d)]),OT=dT.concat([Qn("type","contextformbutton")]),TT=yT.concat([Qn("type","contextformtogglebutton")]),ET=Bn("type",{contextformbutton:kT,contextformtogglebutton:CT}),BT=ln([Qn("type","contextform"),re("initValue",function(){return""}),Kn("label"),Gn("commands",ET),Yn("launch",Bn("type",{contextformbutton:OT,contextformtogglebutton:TT}))].concat(ST)),_T=ln([Qn("type","contexttoolbar"),zn("items")].concat(ST)),DT=/* */Object.freeze({getState:function(t,n,e){return e}}),AT=/* */Object.freeze({events:function(r,i){var o=function(e,o){r.updateState.each(function(t){var n=t(e,o);i.set(n)}),r.renderComponents.each(function(t){var n=t(o,i.get());Ms(e),z(n,function(t){_s(e,e.getSystem().build(t))})})};return cr([fr(yo(),function(t,n){var e=r.channel;F(n.channels(),e)&&o(t,n.data())}),br(function(n,t){r.initialData.each(function(t){o(n,t)})})])}}),FT=/* */Object.freeze({init:function(t){var n=ae(et.none());return{readState:function(){return n.get().fold(function(){return"none"},function(t){return t})},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(et.none())}}}}),MT=[Hn("channel"),Xn("renderComponents"),Xn("updateState"),Xn("initialData")],IT=Uu({fields:MT,name:"reflecting",active:AT,apis:DT,state:FT}),RT=nt([Hn("toggleClass"),Hn("fetch"),Au("onExecute"),Qn("getHotspot",et.some),Qn("getAnchorOverrides",nt({})),Qn("layouts",et.none()),Au("onItemExecute"),Xn("lazySink"),Hn("dom"),_u("onOpen"),$s("splitDropdownBehaviours",[Mb,fm,Rm]),Qn("matchWidth",!1),Qn("useMinWidth",!1),Qn("eventOrder",{}),Xn("role")].concat(my())),VT=Ol({factory:hg,schema:[Hn("dom")],name:"arrow",defaults:function(t){return{buttonBehaviours:Lu([Rm.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(Lo)},buttonBehaviours:Lu([Ym.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),NT=Ol({factory:hg,schema:[Hn("dom")],name:"button",defaults:function(t){return{buttonBehaviours:Lu([Rm.revoke()])}},overrides:function(e){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(n){n.getSystem().getByUid(e.uid).each(function(t){e.onExecute(t,n)})}}}}),HT=nt([VT,NT,El({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Hn("text")],name:"aria-descriptor"}),Tl({schema:[Tu()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),$b()]),PT=ef({name:"SplitDropdown",configFields:RT(),partFields:HT(),factory:function(o,t,n,e){var r=function(t){af.getCurrent(t).each(function(t){xf.highlightFirst(t),fm.focusIn(t)})},i=function(t){ny(o,function(t){return t},t,e,r,Lb.HighlightFirst).get(tt)},u=function(t){var n=zl(t,o,"button");return Lo(n),et.some(!0)},a=yt(cr([br(function(e,t){Pl(e,o,"aria-descriptor").each(function(t){var n=ti("aria");Ur(t.element(),"id",n),Ur(e.element(),"aria-describedby",n)})})]),pg(et.some(i)));return{uid:o.uid,dom:o.dom,components:t,eventOrder:I({},o.eventOrder,{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:Zs(o.splitDropdownBehaviours,[Mb.config({others:{sandbox:function(t){var n=zl(t,o,"arrow");return ry(o,t,{onOpen:function(){Ym.on(n),Ym.on(t)},onClose:function(){Ym.off(n),Ym.off(t)}})}}}),fm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),et.some(!0)}}),Rm.config({}),Ym.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),zT=function(n){return{isDisabled:function(){return Yp.isDisabled(n)},setDisabled:function(t){return Yp.set(n,t)}}},LT=function(n){return{setActive:function(t){Ym.set(n,t)},isActive:function(){return Ym.isOn(n)},isDisabled:function(){return Yp.isDisabled(n)},setDisabled:function(t){return Yp.set(n,t)}}},jT=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},UT=ti("focus-button"),WT=["checklist","ordered-list"],GT=["indent","outdent","table-insert-column-after","table-insert-column-before","unordered-list"],XT=function(n,e,t,o,r,i){var u,a=function(t){return mp.isRtl()&&F(WT,t)?t+"-rtl":t},c=mp.isRtl()&&n.exists(function(t){return F(GT,t)});return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]).concat(c?["tox-tbtn__icon-rtl"]:[]),attributes:jT(t,i)},components:oh([n.map(function(t){return rk(a(t),i.icons)}),e.map(function(t){return uk(t,"tox-tbtn",i)})]),eventOrder:(u={},u[to()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:Lu([Dm("common-button-display-events",[fr(to(),function(t,n){n.event().prevent(),Po(t,UT)})])].concat(o.map(function(t){return IT.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t,n){return oh([t.icon.map(function(t){return rk(a(t),i.icons)}),t.text.map(function(t){return uk(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},YT=function(t,n,e){var o,r=ae(tt),i=XT(t.icon,t.text,t.tooltip,et.none(),et.none(),e);return hg.sketch({dom:i.dom,components:i.components,eventOrder:ck,buttonBehaviours:Lu([Dm("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},wr(function(n,t){Qp(o,n)(function(t){zo(n,ak,{buttonApi:t}),o.onAction(t)})})),Zp(n,r),th(n,r)]),$p(t.disabled)].concat(n.toolbarButtonBehaviours))})},qT=function(t,n,e){return YT(t,{toolbarButtonBehaviours:[].concat(0<e.length?[Dm("toolbarButtonWith",e)]:[]),getApi:zT,onSetup:t.onSetup},n)},KT=function(t,n,e){return bt(YT(t,{toolbarButtonBehaviours:[hm.config({}),Ym.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[Dm("toolbarToggleButtonWith",e)]:[]),getApi:LT,onSetup:t.onSetup},n))},JT=function(n,t){var e,o,r,i,u=ti("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return Yp.isDisabled(e)},setDisabled:function(t){return Yp.set(e,t)},setIconFill:function(t,n){su(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Ur(t,"fill",n)})},setIconStroke:function(t,n){su(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Ur(t,"stroke",n)})},setActive:function(n){Ur(e.element(),"aria-pressed",n),su(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return Ym.set(t,n)})})},isActive:function(){return su(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists(Ym.isOn)})}}},c=ae(tt),s={getApi:a,onSetup:n.onSetup};return PT.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:yt({"aria-pressed":!1},jT(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(t,n,e){},splitDropdownBehaviours:Lu([Jp(!1),Dm("split-dropdown-events",[fr(UT,Rm.focus),Zp(s,c),th(s,c)])]),eventOrder:(e={},e[Do()]=["alloy.base.behaviour","split-dropdown-events"],e),toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:(o=a,r=n,i=t.providers,function(n){return qb(function(t){return r.fetch(t)}).map(function(t){return et.from(Dv(bt(mv(ti("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,nh.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:pv(r.columns,r.presets),menuBehaviours:op("auto"!==r.columns?[]:[br(function(o,t){np(o,4,Sp(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;fm.setGridSize(o,n,e)})})])})))})}),parts:{menu:sv(0,n.columns,n.presets)},components:[PT.parts().button(XT(n.icon,n.text,et.none(),et.some(u),et.some([Ym.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),PT.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:yg("chevron-down",t.providers.icons)}}),PT.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},$T=function(i,u){return fr(ak,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return Po(e,Oo())},getValue:function(){return _m.getValue(e)}});u.onAction(r,n.event().buttonApi())})},QT=function(t,n,e){var o,r,i,u,a,c,s,l,f,d,m,g,p={backstage:{shared:{providers:e}}};return"contextformtogglebutton"===n.type?(s=t,f=p,(d=(l=n).original).primary,m=h(d,["primary"]),g=Cn(wT(I({},m,{type:"togglebutton",onAction:function(){}}))),KT(g,f.backstage.shared.providers,[$T(s,l)])):(o=t,i=p,(u=(r=n).original).primary,a=h(u,["primary"]),c=Cn(gT(I({},a,{type:"button",onAction:function(){}}))),qT(c,i.backstage.shared.providers,[$T(o,r)]))},ZT=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=vg(By.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:Lu([fm.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return Lo(t),!0})},onLeft:function(t,n){return n.cut(),et.none()},onRight:function(t,n){return n.cut(),et.none()}})])})),c=(e=a,o=t.commands,r=n.shared.providers,i=P(o,function(t){return vg(QT(e,t,r))}),{asSpecs:function(){return P(i,function(t){return t.asSpec()})},findPrimary:function(e){return pu(o,function(t,n){return t.primary?et.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(x(Yp.isDisabled)):et.none()})}});return fT({uid:ti("context-toolbar"),initGroups:[{title:et.none(),items:[a.asSpec()]},{title:et.none(),items:c.asSpecs()}],onEscape:et.none,cyclicKeying:!0,backstage:n,getSink:function(){return R.error("")}})},tE=ti("forward-slide"),nE=ti("backward-slide"),eE=ti("change-slide-event"),oE="tox-pop--resizing",rE=function(t,n,e){var o=Math.max(n.left(),e.x()),r=e.right()-o,i=M.window.innerWidth-(o-n.left());return{x:o,width:Math.min(r,i)}},iE=function(n,t){return pu(t,function(t){return t.predicate(n.dom())?et.some({toolbarApi:t,elem:n}):et.none()})},uE=function(n,e){var t=function(t){return t.dom()===e.getBody()},o=se.fromDom(e.selection.getNode());return iE(o,n.inNodeScope).orThunk(function(){return iE(o,n.inEditorScope).orThunk(function(){return function(t,n,e){for(var o=t.dom(),r=B(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=se.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return et.none()}(o,function(t){return iE(t,n.inNodeScope)},t)})})},aE=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=Cn(kn("ContextForm",BT,e));(t[n]=o).launch.map(function(t){a["form:"+n]=I({},e.launch,{type:"contextformtogglebutton"===t.type?"togglebutton":"button",onAction:function(){r(o)}})}),"editor"===o.scope?u.push(o):i.push(o),c[n]=o},s=function(n,e){var t;(t=e,kn("ContextToolbar",_T,t)).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=ut(e);return z(n,function(t){var n=e[t];"contextform"===n.type?o(t,n):"contexttoolbar"===n.type&&s(t,n)}),{forms:t,inNodeScope:i,inEditorScope:u,lookupTable:c,formNavigators:a}},cE=function(o,r){return function(n){var e=ae(et.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(et.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},sE=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},lE=function(t,n,e,o){var u,a,r,c,i,s="basic"===e.type?function(){return P(e.data,function(t){return RC(t,o.isSelectedFor,o.getPreviewFor)})}:e.getData;return{items:(u=n,a=o,r=function(t,n,e,o){var r=u.shared.providers.translate(t.title);if("separator"===t.type)return et.some({type:"separator",text:r});if("submenu"!==t.type)return et.some(I({type:"togglemenuitem",text:r,active:t.isSelected(o),disabled:e,onAction:a.onAction(t)},t.getStylePreview().fold(function(){return{}},function(t){return{meta:{style:t}}})));var i=K(t.getStyleItems(),function(t){return c(t,n,o)});return 0===n&&i.length<=0?et.none():et.some({type:"nestedmenuitem",text:r,disabled:i.length<=0,getSubmenuItems:function(){return K(t.getStyleItems(),function(t){return c(t,n,o)})}})},c=function(t,n,e){var o="formatter"===t.type&&a.isInvalid(t);return 0===n?o?[]:r(t,n,!1,e).toArray():r(t,n,o,e).toArray()},i=function(t){var n=a.getCurrentValue(),e=a.shouldHide?0:1;return K(t,function(t){return c(t,e,n)})},{validateItems:i,getFetch:function(o,r){return function(t){var n=r(),e=i(n);t(Ey(e,nh.CLOSE_ON_EXECUTE,o))}}}),getStyleItems:s}},fE=function(o,t,n,r){var e=lE(0,t,n,r),i=e.items,u=e.getStyleItems;return fk({text:r.icon.isSome()?et.none():et.some(""),icon:r.icon,tooltip:et.from(r.tooltip),role:et.none(),fetch:i.getFetch(t,u),onSetup:function(e){return r.setInitialValue.each(function(t){return t(e.getComponent())}),r.nodeChangeHandler.map(function(t){var n=t(e.getComponent());return o.on("NodeChange",n),function(){o.off("NodeChange",n)}}).getOr(tt)},getApi:function(t){return{getComponent:function(){return t}}},columns:1,presets:"normal",classes:r.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};(Jk=Kk||(Kk={}))[Jk.SemiColon=0]="SemiColon",Jk[Jk.Space=1]="Space";var dE,mE,gE=function(t,n,e,o){var r,i,u=Mt(t.settings,n).getOr(e);return{type:"basic",data:(i=u,r=o===Kk.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),P(r,function(t){var n=t,e=t,o=t.split("=");return 1<o.length&&(n=o[0],e=o[1]),{title:n,format:e}}))}},pE=[{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"}],hE=function(e){var n=function(t){var n=W(pE,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});zo(t,lk,{icon:"align-"+n})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),r={type:"basic",data:pE};return{tooltip:"Align",icon:et.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getCurrentValue:nt(et.none()),getPreviewFor:function(t){return function(){return et.none()}},onAction:sE(e),setInitialValue:o,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},vE=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],bE=function(t){var n=t.split(/\s*,\s*/);return P(n,function(t){return t.replace(/^['"]+|['"]+$/g,"")})},yE=function(r){var i=function(){var e=function(t){return t?bE(t)[0]:""},t=r.queryCommandValue("FontName"),n=u.data,o=t?t.toLowerCase():"";return{matchOpt:W(n,function(t){var n=t.format;return n.toLowerCase()===o||e(n).toLowerCase()===e(o).toLowerCase()}).orThunk(function(){return 0===(t=o).indexOf("-apple-system")&&(n=bE(t.toLowerCase()),J(vE,function(t){return-1<n.indexOf(t.toLowerCase())}))?et.from({title:"System Font",format:o}):et.none();var t,n}),font:t}},n=function(t){var n=i(),e=n.matchOpt,o=n.font,r=e.fold(function(){return o},function(t){return t.title});zo(t,sk,{text:r})},t=et.some(function(t){return function(){return n(t)}}),e=et.some(function(t){return n(t)}),u=gE(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",Kk.SemiColon);return{tooltip:"Fonts",icon:et.none(),isSelectedFor:function(n){return function(t){return t.exists(function(t){return t.format===n})}},getCurrentValue:function(){return i().matchOpt},getPreviewFor:function(t){return function(){return et.some({tag:"div",styleAttr:-1===t.indexOf("dings")?"font-family:"+t:""})}},onAction:function(t){return function(){r.undoManager.transact(function(){r.focus(),r.execCommand("FontName",!1,t.format)})}},setInitialValue:e,nodeChangeHandler:t,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}},xE={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},wE=function(t,n){return/[0-9.]+px$/.test(t)?(e=72*parseInt(t,10)/96,o=n||0,r=Math.pow(10,o),Math.round(e*r)/r+"pt"):t;var e,o,r},SE=function(e){var i=function(){var o=et.none(),r=u.data,i=e.queryCommandValue("FontSize");if(i)for(var t=function(t){var n=wE(i,t),e=mt(xE,n).getOr("");o=W(r,function(t){return t.format===i||t.format===n||t.format===e})},n=3;o.isNone()&&0<=n;n--)t(n);return{matchOpt:o,px:i}},n=function(t){var n=i(),e=n.matchOpt,o=n.px,r=e.fold(function(){return o},function(t){return t.title});zo(t,sk,{text:r})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),u=gE(e,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",Kk.Space);return{tooltip:"Font sizes",icon:et.none(),isSelectedFor:function(n){return function(t){return t.exists(function(t){return t.format===n})}},getPreviewFor:function(){return nt(et.none())},getCurrentValue:function(){return i().matchOpt},onAction:function(t){return function(){e.undoManager.transact(function(){e.focus(),e.execCommand("FontSize",!1,t.format)})}},setInitialValue:o,nodeChangeHandler:t,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}},kE=function(e,t,n){var o=t();return pu(n,function(n){return W(o,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?et.some({title:"Paragraph",format:"p"}):et.none()})},CE=function(t){var n=t.selection.getStart(!0)||t.getBody();return t.dom.getParents(n,function(){return!0},t.getBody())},OE=function(o){var e=function(t,n){var e=kE(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});zo(n,sk,{text:e})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=CE(o);e(n,t)}),r=gE(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",Kk.SemiColon);return{tooltip:"Blocks",icon:et.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getCurrentValue:nt(et.none()),getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:o.formatter.getCssText(n)})}},onAction:sE(o),setInitialValue:n,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},TE=function(i){var e=function(t,n){var e=function(t){var n=t.items;return n!==undefined&&0<n.length?K(n,e):[{title:t.title,format:t.format}]},o=K(IC(i),e),r=kE(i,function(){return o},t).fold(function(){return"Paragraph"},function(t){return t.title});zo(n,sk,{text:r})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=CE(i);e(n,t)});return{tooltip:"Formats",icon:et.none(),isSelectedFor:function(t){return function(){return i.formatter.match(t)}},getCurrentValue:nt(et.none()),getPreviewFor:function(n){return function(){var t=i.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:i.formatter.getCssText(n)}):et.none()}},onAction:sE(i),setInitialValue:n,nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)}}},EE=[{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"]}],BE=function(o,r){return function(t,n){var e=o(t).mapError(function(t){return Tn(t)}).getOrDie();return r(e,n)}},_E={button:BE(gT,function(t,n){return e=t,o=n.backstage.shared.providers,qT(e,o,[]);var e,o}),togglebutton:BE(wT,function(t,n){return e=t,o=n.backstage.shared.providers,KT(e,o,[]);var e,o}),menubutton:BE(vT,function(t,n){return mk(t,"tox-tbtn",n.backstage,et.none())}),splitbutton:BE(function(t){return kn("SplitButton",bT,t)},function(t,n){return JT(t,n.backstage.shared)}),styleSelectButton:function(t,n){return e=t,o=n.backstage,r=o.styleselect,fE(e,o,r,TE(e));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,r=SE(e),fE(e,o,r.dataset,r);var e,o,r},fontSelectButton:function(t,n){return e=t,o=n.backstage,r=yE(e),fE(e,o,r.dataset,r);var e,o,r},formatButton:function(t,n){return e=t,o=n.backstage,r=OE(e),fE(e,o,r.dataset,r);var e,o,r},alignMenuButton:function(t,n){return e=t,o=n.backstage,r=hE(e),fE(e,o,r.dataset,r);var e,o,r}},DE={styleselect:_E.styleSelectButton,fontsizeselect:_E.fontsizeSelectButton,fontselect:_E.fontSelectButton,formatselect:_E.formatButton,align:_E.alignMenuButton},AE=function(t){var n,e,o,r=t.toolbar,i=t.buttons;return!1===r?[]:r===undefined||!0===r?(e=i,o=P(EE,function(t){var n=L(t.items,function(t){return gt(e,t)||gt(DE,t)});return{name:t.name,items:n}}),L(o,function(t){return 0<t.items.length})):C(r)?(n=r.split("|"),P(n,function(t){return{items:t.trim().split(" ")}})):_(r,function(t){return gt(t,"name")&&gt(t,"items")})?r:(M.console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},FE=function(n,e,o,r,t){return mt(e,o.toLowerCase()).orThunk(function(){return t.bind(function(t){return pu(t,function(t){return mt(e,t+o.toLowerCase())})})}).fold(function(){return mt(DE,o.toLowerCase()).map(function(t){return t(n,r)}).orThunk(function(){return et.none()})},function(t){return e=r,mt(_E,(n=t).type).fold(function(){return M.console.error("skipping button defined by",n),et.none()},function(t){return et.some(t(n,e))});var n,e})},ME=function(e,o,r,i){var t=AE(o),n=P(t,function(t){var n=K(t.items,function(t){return 0===t.trim().length?[]:FE(e,o.buttons,t,r,i).toArray()});return{title:et.from(e.translate(t.name)),items:n}});return L(n,function(t){return 0<t.items.length})},IE=function(v,t,e,s){var o,r,l=uu((o={sink:e,onEscape:function(){return v.focus(),et.some(!0)}},r=ae([]),gg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){r.set([]),gg.getContent(t).each(function(t){Yi(t.element(),"visibility")}),Ii(t.element(),oE),Yi(t.element(),"width")},inlineBehaviours:Lu([Dm("context-toolbar-events",[vr(mo(),function(t,n){gg.getContent(t).each(function(t){}),Ii(t.element(),oE),Yi(t.element(),"width")}),fr(eE,function(n,e){Yi(n.element(),"width");var t=aa(n.element());gg.setContent(n,e.event().contents()),Fi(n.element(),oE);var o=aa(n.element());Li(n.element(),"width",t+"px"),gg.getContent(n).each(function(t){e.event().focus().bind(function(t){return Af(t),Mf(n.element())}).orThunk(function(){return fm.focusIn(t),Ff()})}),Sg.setTimeout(function(){Li(n.element(),"width",o+"px")},0)}),fr(tE,function(t,n){gg.getContent(t).each(function(t){r.set(r.get().concat([{bar:t,focus:Ff()}]))}),zo(t,eE,{contents:n.event().forwardContents(),focus:et.none()})}),fr(nE,function(n,t){rt(r.get()).each(function(t){r.set(r.get().slice(0,r.get().length-1)),zo(n,eE,{contents:au(t.bar),focus:t.focus})})})]),fm.config({mode:"special",onEscape:function(n){return rt(r.get()).fold(function(){return o.onEscape()},function(t){return Po(n,nE),et.some(!0)})}})]),lazySink:function(){return R.value(o.sink)}}))),b=cb(v)||sb(v)||fb(v),f=function(){var t,n,e,o,r,i,u,a,c,s,l,f,d,m,g,p=sa(),h=ha(se.fromDom(v.getContentAreaContainer()));return v.inline&&!b?et.some((d=rE(0,f=p,h),m=d.x,g=d.width,pa(m,f.top(),g,M.window.innerHeight))):v.inline?et.some(function(t,n,e){var o=rE(0,n,e),r=o.x,i=o.width,u=ha(se.fromDom(t.getContainer())),a=M.window.innerHeight,c=n.top();if(u.y()>=e.bottom()){var s=Math.min(a+c,u.y());return pa(r,c,i,s-c)}var l=Math.max(c,u.bottom());return pa(r,l,i,a-(l-c))}(v,p,h)):et.some((t=v,o=rE(0,n=p,e=h),r=o.x,i=o.width,u=ha(se.fromDom(t.getContainer())),a=Math.max(n.top(),e.y()),c=u.bottom()-a,s=M.window.innerHeight-(a-n.top()),l=Math.min(c,s),pa(r,a,i,l)))},d=function(){var t,n=g.get().map(function(t){return t.getBoundingClientRect()}).getOr(v.selection.getRng().getBoundingClientRect()),e=Er(se.fromDom(v.getBody())).dom().innerHeight,o=n.bottom<(t="fixed"===Ui(se.fromDom(v.getContainer()),"position"),v.inline&&b&&t?v.getContainer().getBoundingClientRect().bottom:0),r=n.top>e;return o||r},i=function(){m.get().each(function(t){var n=l.element();Yi(n,"display"),d()?Li(n,"display","none"):Ts.positionWithinBounds(e,t,l,f())})};v.on("init",function(){if(v.on("ScrollWindow",i),!v.inline){var t=Er(se.fromDom(v.getBody())),n=Vv(t,"scroll",i);v.on("remove",function(){n.unbind()})}});var m=ae(et.none()),g=ae(et.none()),n=ae(null),p=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:Lu([fm.config({mode:"acyclic"}),Dm("pop-dialog-wrap-events",[br(function(t){v.shortcuts.add("ctrl+F9","focus statusbar",function(){return fm.focusIn(t)})}),yr(function(t){v.shortcuts.remove("ctrl+F9")})])])}},u=xt(function(){return aE(t,function(t){var n=h(t);zo(l,tE,{forwardContents:p(n)})})}),h=function(t){var n,e,o=v.ui.registry.getAll().buttons,r=u();return"contexttoolbar"===t.type?(n=yt(o,r.formNavigators),e=ME(v,{buttons:n,toolbar:t.items},s,et.some(["form:"])),fT({uid:ti("context-toolbar"),initGroups:e,onEscape:et.none,cyclicKeying:!0,backstage:s.backstage,getSink:function(){return R.error("")}})):ZT(t,s.backstage)};v.on("contexttoolbar-show",function(n){var t=u();Mt(t.lookupTable,n.toolbarKey).each(function(t){w(t,n.target===v?et.none():et.some(n)),gg.getContent(l).each(fm.focusIn)})});var a={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},c={maxHeightFunction:vs()},y={bubble:ya(12,0,a),layouts:{onLtr:function(){return[Ua]},onRtl:function(){return[Wa]}},overrides:c},x={bubble:ya(0,12,a),layouts:{onLtr:function(){return[La,ja,Pa,Na,za,Ha,EC,BC,OC,kC,TC,CC]},onRtl:function(){return[La,ja,za,Ha,Pa,Na,EC,BC,TC,CC,OC,kC]}},overrides:c},w=function(t,n){k();var e,o,r,i=h(t),u=n.map(se.fromDom),a=(e=t.position,o=u,r="node"===e?s.backstage.shared.anchors.node(o):s.backstage.shared.anchors.cursor(),bt(r,"line"===e?y:x));m.set(et.some(a)),g.set(n);var c=l.element();Yi(c,"display"),gg.showWithinBounds(l,a,p(i),f()),d()&&Li(c,"display","none")},S=function(){var t=u();uE(t,v).fold(function(){m.set(et.none()),gg.hide(l)},function(t){w(t.toolbarApi,et.some(t.elem.dom()))})},k=function(){var t=n.get();null!==t&&(Sg.clearTimeout(t),n.set(null))},C=function(t){k(),n.set(t)};v.on("init",function(){v.on("click keyup SetContent ObjectResized ResizeEditor",function(t){C(Sg.setEditorTimeout(v,S,0))}),v.on("focusout",function(t){Sg.setEditorTimeout(v,function(){Mf(e.element()).isNone()&&Mf(l.element()).isNone()&&(m.set(et.none()),gg.hide(l))},0)}),v.on("SwitchMode",function(){v.readonly&&(m.set(et.none()),gg.hide(l))}),v.on("NodeChange",function(t){Mf(l.element()).fold(function(){C(Sg.setEditorTimeout(v,S,0))},function(t){})})})},RE=function(t,e,o){var n=Vv(se.fromDom(M.document),"mousedown",function(n){z([e,o],function(t){t.broadcastOn([Xs()],{target:n.target()})})}),r=Vv(se.fromDom(M.document),"touchstart",function(n){z([e,o],function(t){t.broadcastOn([Xs()],{target:n.target()})})}),i=Vv(se.fromDom(M.document),"mouseup",function(n){0===n.raw().button&&z([e,o],function(t){t.broadcastOn([Ys()],{target:n.target()})})}),u=function(n){z([e,o],function(t){t.broadcastOn([Xs()],{target:se.fromDom(n.target)})})};t.on("mousedown",u),t.on("touchstart",u);var a=function(n){0===n.button&&z([e,o],function(t){t.broadcastOn([Ys()],{target:se.fromDom(n.target)})})};t.on("mouseup",a);var c=function(n){z([e,o],function(t){t.broadcastEvent(Bo(),n)})};t.on("ScrollWindow",c);var s=function(n){z([e,o],function(t){t.broadcastEvent(_o(),n)})};t.on("ResizeWindow",s),t.on("remove",function(){t.off("mousedown",u),t.off("touchstart",u),t.off("mouseup",a),t.off("ResizeWindow",s),t.off("ScrollWindow",c),n.unbind(),r.unbind(),i.unbind()}),t.on("detach",function(){Vs(e),Vs(o),e.destroy(),o.destroy()})},VE=nt([Qn("shell",!1),Hn("makeItem"),Qn("setupItem",tt),tl("listBehaviours",[hm])]),NE=El({name:"items",overrides:function(t){return{behaviours:Lu([hm.config({})])}}}),HE=nt([NE]),PE=ef({name:nt("CustomList")(),configFields:VE(),partFields:HE(),factory:function(s,t,n,e){var o=s.shell?{behaviours:[hm.config({})],components:[]}:{behaviours:[],components:t},r=function(t){return s.shell?et.some(t):Pl(t,s,"items")};return{uid:s.uid,dom:s.dom,components:o.components,behaviours:Zs(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(n){var t=hm.contents(n),e=c.length,o=e-t.length,r=0<o?function(t,n){for(var e=[],o=0;o<t;o++)e.push(n(o));return e}(o,function(){return s.makeItem()}):[],i=t.slice(e);z(i,function(t){return hm.remove(n,t)}),z(r,function(t){return hm.append(n,t)});var u=hm.contents(n);z(u,function(t,n){s.setupItem(a,t,c[n],n)})})}}}},apis:{setItems:function(t,n,e){t.setItems(n,e)}}}),zE=Yl,LE=Dl,jE=nf({factory:function(n,o){var t={focus:fm.focusIn,setMenus:function(t,n){var e=P(n,function(n){var t={type:"menubutton",text:n.text,fetch:function(t){t(n.getItems())}},e=vT(t).mapError(function(t){return Tn(t)}).getOrDie();return mk(e,"tox-mbtn",o.backstage,et.some("menuitem"))});hm.set(t,e)}};return{uid:n.uid,dom:n.dom,components:[],behaviours:Lu([hm.config({}),Dm("menubar-events",[br(function(t){n.onSetup(t)}),fr(ro(),function(e,t){su(e.element(),".tox-mbtn--active").each(function(n){lu(t.event().target(),".tox-mbtn").each(function(t){Xe(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){Wy.expand(t),Wy.close(n),Rm.focus(t)})})})})}),fr(Mo(),function(e,t){t.event().prevFocus().bind(function(t){return e.getSystem().getByDom(t).toOption()}).each(function(n){t.event().newFocus().bind(function(t){return e.getSystem().getByDom(t).toOption()}).each(function(t){Wy.isOpen(n)&&(Wy.expand(t),Wy.close(n))})})})]),fm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return n.onEscape(t),et.some(!0)}}),Ly.config({})]),apis:t,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[Hn("dom"),Hn("uid"),Hn("onEscape"),Hn("backstage"),Qn("onSetup",tt)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),UE="container",WE=[$s("slotBehaviours",[])],GE=function(t){return"<alloy.field."+t+">"},XE=function(r,t,n){var e,o=function(t){return Ul(r)},i=function(e,o){return void 0===o&&(o=undefined),function(t,n){return Pl(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},u=function(t,n){return"true"!==Gr(t.element(),"aria-hidden")},a=i(u,!1),c=i(function(t,n){if(u(t)){var e=t.element();Li(e,"display","none"),Ur(e,"aria-hidden","true"),zo(t,Io(),{name:n,visible:!1})}}),s=(e=c,function(n,t){z(t,function(t){return e(n,t)})}),l=i(function(t,n){if(!u(t)){var e=t.element();Yi(e,"display"),Yr(e,"aria-hidden"),zo(t,Io(),{name:n,visible:!0})}}),f={getSlotNames:o,getSlot:function(t,n){return Pl(t,r,n)},isShowing:a,hideSlot:c,hideAllSlots:function(t){return s(t,o())},showSlot:l};return{uid:r.uid,dom:r.dom,components:t,behaviours:Qs(r.slotBehaviours),apis:f}},YE=st({getSlotNames:function(t,n){return t.getSlotNames(n)},getSlot:function(t,n,e){return t.getSlot(n,e)},isShowing:function(t,n,e){return t.isShowing(n,e)},hideSlot:function(t,n,e){return t.hideSlot(n,e)},hideAllSlots:function(t,n){return t.hideAllSlots(n)},showSlot:function(t,n,e){return t.showSlot(n,e)}},pi),qE=I({},YE,{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),Il(UE,GE(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=P(r,function(t){return Ol({name:t,pname:GE(t)})});return Kl(UE,WE,i,XE,o)}}),KE=ln([Kn("icon"),Kn("tooltip"),re("onShow",tt),re("onHide",tt),re("onSetup",function(){return tt})]),JE=function(t){return{element:function(){return t.element().dom()}}},$E=function(e,o){var r=P(ut(o),function(t){var n=o[t],e=Cn(kn("sidebar",KE,n));return{name:t,getApi:JE,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return P(r,function(t){var n=ae(tt);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:op([Zp(t,n),th(t,n),fr(Io(),function(n,t){var e=t.event();W(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},QE=function(t,e){af.getCurrent(t).each(function(t){return hm.set(t,[(n=e,qE.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:$E(t,n),slotBehaviours:op([br(function(t){return qE.hideAllSlots(t)})])}}))]);var n})},ZE=function(t){return af.getCurrent(t).bind(function(t){return YO.isGrowing(t)||YO.hasGrown(t)?af.getCurrent(t).bind(function(n){return W(qE.getSlotNames(n),function(t){return qE.isShowing(n,t)})}):et.none()})},tB=ti("FixSizeEvent"),nB=ti("AutoSizeEvent"),eB=function(t,n,e){var o,r=t.element();!0===n?(hm.set(t,[(o=e,{dom:{tag:"div",attributes:{"aria-label":o.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:dp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:Lu([fm.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),Rm.config({})])})]),Yi(r,"display"),Yr(r,"aria-hidden")):(hm.set(t,[]),Li(r,"display","none"),Ur(r,"aria-hidden","true"))},oB=LE.optional({factory:jE,name:"menubar",schema:[Hn("backstage")]}),rB=LE.optional({factory:{sketch:function(t){return PE.sketch({uid:t.uid,dom:t.dom,listBehaviours:Lu([fm.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:function(){return fT({uid:ti("multiple-toolbar-item"),backstage:t.backstage,cyclicKeying:!1,getSink:t.getSink,initGroups:[],onEscape:function(){return et.none()}})},setupItem:function(t,n,e,o){gO.setGroups(n,e)},shell:!0})}},name:"multiple-toolbar",schema:[Hn("dom"),Hn("onEscape")]}),iB=LE.optional({factory:{sketch:function(t){var n;return((n=t).split===nb.sliding?lT:n.split===nb.floating?sT:fT)({uid:t.uid,onEscape:function(){return t.onEscape(),et.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,backstage:t.backstage,moreDrawerData:{lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton}})}},name:"toolbar",schema:[Hn("dom"),Hn("onEscape"),Hn("getSink")]}),uB=LE.optional({name:"socket",schema:[Hn("dom")]}),aB=LE.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"complementary"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:Lu([Ly.config({}),Rm.config({}),YO.config({dimension:{property:"width"},closedClass:"tox-sidebar--sliding-closed",openClass:"tox-sidebar--sliding-open",shrinkingClass:"tox-sidebar--sliding-shrinking",growingClass:"tox-sidebar--sliding-growing",onShrunk:function(t){af.getCurrent(t).each(qE.hideAllSlots),Po(t,nB)},onGrown:function(t){Po(t,nB)},onStartGrow:function(t){zo(t,tB,{width:Gi(t.element(),"width").getOr("")})},onStartShrink:function(t){zo(t,tB,{width:aa(t.element())+"px"})}}),hm.config({}),af.config({find:function(t){var n=hm.contents(t);return ot(n)}})])}],behaviours:Lu([Zw(0),Dm("sidebar-sliding-events",[fr(tB,function(t,n){Li(t.element(),"width",n.event().width())}),fr(nB,function(t,n){Yi(t.element(),"width")})])])}}},name:"sidebar",schema:[Hn("dom")]}),cB=LE.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:Lu([hm.config({})]),components:[]}}},name:"throbber",schema:[Hn("dom")]}),sB=ef({name:"OuterContainer",factory:function(e,t,n){var o={getSocket:function(t){return zE.getPart(t,e,"socket")},setSidebar:function(t,n){zE.getPart(t,e,"sidebar").each(function(t){return QE(t,n)})},toggleSidebar:function(t,o){zE.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void af.getCurrent(n).each(function(n){af.getCurrent(n).each(function(t){YO.hasGrown(n)?qE.isShowing(t,e)?YO.shrink(n):(qE.hideAllSlots(t),qE.showSlot(t,e)):(qE.hideAllSlots(t),qE.showSlot(t,e),YO.grow(n))})});var n,e})},whichSidebar:function(t){return zE.getPart(t,e,"sidebar").bind(ZE).getOrNull()},getToolbar:function(t){return zE.getPart(t,e,"toolbar")},setToolbar:function(t,n){zE.getPart(t,e,"toolbar").each(function(t){t.getApis().setGroups(t,n)})},setToolbars:function(t,n){zE.getPart(t,e,"multiple-toolbar").each(function(t){PE.setItems(t,n)})},refreshToolbar:function(t){zE.getPart(t,e,"toolbar").each(function(t){return t.getApis().refresh(t)})},getMoreButton:function(t){return zE.getPart(t,e,"toolbar").bind(function(t){return t.getApis().getMoreButton(t)})},getThrobber:function(t){return zE.getPart(t,e,"throbber")},focusToolbar:function(t){zE.getPart(t,e,"toolbar").orThunk(function(){return zE.getPart(t,e,"multiple-toolbar")}).each(function(t){fm.focusIn(t)})},setMenubar:function(t,n){zE.getPart(t,e,"menubar").each(function(t){jE.setMenus(t,n)})},focusMenubar:function(t){zE.getPart(t,e,"menubar").each(function(t){jE.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:o,behaviours:e.behaviours}},configFields:[Hn("dom"),Hn("behaviours")],partFields:[oB,iB,rB,uB,aB,cB],apis:{getSocket:function(t,n){return t.getSocket(n)},setSidebar:function(t,n,e){t.setSidebar(n,e)},toggleSidebar:function(t,n,e){t.toggleSidebar(n,e)},whichSidebar:function(t,n){return t.whichSidebar(n)},getToolbar:function(t,n){return t.getToolbar(n)},setToolbar:function(t,n,e){var o=P(e,function(t){return uT(t)});t.setToolbar(n,o)},setToolbars:function(t,n,e){var o=P(e,function(t){return P(t,uT)});t.setToolbars(n,o)},getMoreButton:function(t,n){return t.getMoreButton(n)},refreshToolbar:function(t,n){return t.refreshToolbar(n)},getThrobber:function(t,n){return t.getThrobber(n)},setMenubar:function(t,n,e){t.setMenubar(n,e)},focusMenubar:function(t,n){t.focusMenubar(n)},focusToolbar:function(t,n){t.focusToolbar(n)}}}),lB={file:{title:"File",items:"newdocument restoredraft | preview | print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align | forecolor backcolor | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck code wordcount"},table:{title:"Table",items:"inserttable tableprops deletetable row column cell"},help:{title:"Help",items:"help"}},fB=function(t){return"string"==typeof t?t.split(" "):t},dB=function(u,a){var c=yt(lB,a.menus),n=0<ut(a.menus).length,t=a.menubar===undefined||!0===a.menubar?fB("file edit view insert format tools table help"):fB(!1===a.menubar?"":a.menubar),e=L(t,function(t){return n&&a.menus.hasOwnProperty(t)&&a.menus[t].hasOwnProperty("items")||lB.hasOwnProperty(t)}),o=P(e,function(t){var n,e,o,r,i=c[t];return n={title:i.title,items:fB(i.items)},e=a,r=(o=u,o.getParam("removed_menuitems","")).split(/[ ,]/),{text:n.title,getItems:function(){return K(n.items,function(t){var n=t.toLowerCase();return 0===n.trim().length?[]:N(r,function(t){return t===n})?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]})}}});return L(o,function(t){return 0<t.getItems().length&&N(t.getItems(),function(t){return"separator"!==t.type})})},mB=function(t){var n=function(){t._skinLoaded=!0,Uh(t)};return function(){t.initialized?n():t.on("init",n)}},gB=function(t,n){var e,o=function(t){var n=t.settings,e=n.skin,o=n.skin_url;if(!1!==e){var r=e||"oxide";o=o?t.documentBaseURI.toAbsolute(o):ib.baseURL+"/skins/ui/"+r}return o}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),!1==(!1===n.getParam("skin"))&&e?uh.DOM.styleSheetLoader.load(e,mB(n)):mB(n)()},pB=g(gB,!1),hB=g(gB,!0),vB=function(n,t,e,o){var r=t.outerContainer,i=e.toolbar,u=e.buttons;if(_(i,C)){var a=i.map(function(t){return ME(n,{toolbar:t,buttons:u},{backstage:o},et.none())});sB.setToolbars(r,a)}else sB.setToolbar(r,ME(n,e,{backstage:o},et.none()))},bB=uh.DOM,yB=Ne.detect().deviceType.isTouch(),xB={render:function(e,o,t,n,r){var i,u,a=ae(0);pB(e),i=se.fromDom(r.targetNode),u=o.mothership,Rs(i,u,Mr),Is(er(),o.uiMothership),e.on("init",function(){vB(e,o,t,n),a.set(e.getWin().innerWidth),sB.setMenubar(o.outerContainer,dB(e,t)),sB.setSidebar(o.outerContainer,t.sidebar),function(o){var r=o.getWin(),t=o.getDoc().documentElement,i=ae(Qu(r.innerWidth,r.innerHeight)),u=ae(Qu(t.offsetWidth,t.offsetHeight)),n=function(){var t=o.getDoc().documentElement,n=i.get(),e=u.get();n.left()!==r.innerWidth||n.top()!==r.innerHeight?(i.set(Qu(r.innerWidth,r.innerHeight)),Gh(o)):e.left()===t.offsetWidth&&e.top()===t.offsetHeight||(u.set(Qu(t.offsetWidth,t.offsetHeight)),Gh(o))};bB.bind(r,"resize",n);var e=Nv(se.fromDom(o.getBody()),"load",n);o.on("remove",function(){e.unbind(),bB.unbind(r,"resize",n)})}(e)});var c=sB.getSocket(o.outerContainer).getOrDie("Could not find expected socket element");!0===yB&&ji(c.element(),{overflow:"scroll","-webkit-overflow-scrolling":"touch"}),oT(e,o),e.addCommand("ToggleSidebar",function(t,n){sB.toggleSidebar(o.outerContainer,n),e.fire("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",function(){return sB.whichSidebar(o.outerContainer)});var s=hb(e);return s!==nb.sliding&&s!==nb.floating||e.on("ResizeContent",function(){var t=e.getWin().innerWidth;t!==a.get()&&sB.refreshToolbar(o.outerContainer),a.set(t)}),{iframeContainer:c.element().dom(),editorContainer:o.outerContainer.element().dom()}},getBehaviours:function(t){return[]}},wB=function(e,n){return _r(e).orThunk(function(){var t=se.fromTag("span");Fr(e,t);var n=_r(t);return Hr(t),n}).map(function(t){return ta(t).translate(-n.left(),-n.top())}).getOrThunk(function(){return Qu(0,0)})},SB=pt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),kB=function(n){return function(t){return t.translate(-n.left(),-n.top())}},CB=function(n){return function(t){return t.translate(n.left(),n.top())}},OB=function(e){return function(t,n){return U(e,function(t,n){return n(t)},Qu(t,n))}},TB=function(t,n,e){return t.fold(OB([CB(e),kB(n)]),OB([kB(n)]),OB([]))},EB=function(t,n,e){return t.fold(OB([CB(e)]),OB([]),OB([CB(n)]))},BB=function(t,n,e){return t.fold(OB([]),OB([kB(e)]),OB([CB(n),kB(e)]))},_B=function(t,n,e){return t.fold(function(t,n){return{position:"absolute",left:t+"px",top:n+"px"}},function(t,n){return{position:"absolute",left:t-e.left()+"px",top:n-e.top()+"px"}},function(t,n){return{position:"fixed",left:t+"px",top:n+"px"}})},DB=SB.offset,AB=SB.absolute,FB=SB.fixed,MB=function(t,n){Fi(t.element(),n.transitionClass),Ii(t.element(),n.fadeOutClass),Fi(t.element(),n.fadeInClass)},IB=function(t,n){Fi(t.element(),n.transitionClass),Ii(t.element(),n.fadeInClass),Fi(t.element(),n.fadeOutClass)},RB=function(t,n){return t.y()>=n.y()&&t.bottom()<=n.bottom()},VB=function(t,n){return Xr(t,n)?et.some(parseInt(Gr(t,n),10)):et.none()},NB=function(o,r,i){return(u=o,t=r,n=u.element(),VB(n,t.leftAttr).bind(function(o){return VB(n,t.topAttr).map(function(t){var n=aa(u.element()),e=ra(u.element());return pa(o,t,n,e)})})).bind(function(t){return RB(t,i)?(n=r,e=o.element(),Yr(e,n.leftAttr),Yr(e,n.topAttr),et.some(AB(t.x(),t.y()))):et.none();var n,e});var u,t,n},HB=function(t,n,e,o,r){var i=ta(t.element()),u=pa(i.left(),i.top(),aa(t.element()),ra(t.element()));if(RB(u,e))return et.none();a=t,c=n,s=i.left(),l=i.top(),f=a.element(),Ur(f,c.leftAttr,s),Ur(f,c.topAttr,l);var a,c,s,l,f,d=AB(i.left(),i.top()),m=TB(d,o,r),g=AB(e.x(),e.y()),p=TB(g,o,r),h=u.y()<=e.y()?p.top():p.top()+e.height()-u.height();return et.some(FB(m.left(),h))},PB=function(i,t,n){var u=t.lazyViewport(i);t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=ha(t);((e=u,(n=o).y()<e.bottom()&&n.bottom()>e.y())?MB:IB)(i,r)})});var e,o,r,a,c,s=Tr(i.element()),l=sa(s),f=wB(i.element(),l);(e=i,o=t,r=u,a=l,c=f,Gi(e.element(),"position").is("fixed")?NB(e,o,r):HB(e,o,r,a,c)).each(function(t){var n=_B(t,0,f);ji(i.element(),n)})},zB=/* */Object.freeze({refresh:PB}),LB=/* */Object.freeze({events:function(o,t){return cr([fr(mo(),function(n,e){o.contextual.each(function(t){Xe(n.element(),e.event().target())&&(Ii(n.element(),t.transitionClass),e.stop())})}),fr(Bo(),function(t,n){PB(t,o)})])}}),jB=[$n("contextual",[Hn("fadeInClass"),Hn("fadeOutClass"),Hn("transitionClass"),Hn("lazyContext")]),Qn("lazyViewport",function(t){var n=sa();return pa(n.left(),n.top(),M.window.innerWidth,M.window.innerHeight)}),Hn("leftAttr"),Hn("topAttr")],UB=Uu({fields:jB,name:"docking",active:LB,apis:zB}),WB={render:function(o,n,e,r,t){var i,u=uh.DOM,a=bb(o),c=hb(o),s=c===nb.sliding||c===nb.floating;hB(o);var l=function(t){var n=Gi(i.element(),"position").is("fixed"),e=function(t){void 0===t&&(t=0);var n=ta(se.fromDom(o.getBody()));return{top:Math.round(n.top()-ra(i.element()))+t,left:Math.round(n.left())}}(s?t.fold(function(){return 0},function(t){return 1<t.components().length?ra(t.components()[1].element()):0}):0);n?Wr(i.element(),lt(e,function(t,n){return{k:"data-dock-"+n,v:t}})):ji(i.element(),st(e,function(t){return t+"px"})),UB.refresh(i)},f=function(){var t=sB.getToolbar(n.outerContainer);s&&sB.refreshToolbar(n.outerContainer),a||l(t)},d=function(){Li(n.outerContainer.element(),"display","flex"),u.addClass(o.getBody(),"mce-edit-focus"),Yi(n.uiMothership.element(),"display"),f()},m=function(){n.outerContainer&&(Li(n.outerContainer.element(),"display","none"),u.removeClass(o.getBody(),"mce-edit-focus")),Li(n.uiMothership.element(),"display","none")},g=function(){if(i)d();else{i=n.outerContainer;var t=vb(o).getOr(er());Is(t,n.mothership),Is(t,n.uiMothership),vB(o,n,e,r),sB.setMenubar(n.outerContainer,dB(o,e)),a||Li(i.element(),"position","absolute"),f(),d(),o.on("NodeChange ResizeWindow",f),o.on("activate",d),o.on("deactivate",m),o.nodeChanged()}};return o.on("focus",g),o.on("blur hide",m),o.on("init",function(){o.hasFocus()&&g()}),oT(o,n),{editorContainer:n.outerContainer.element().dom()}},getBehaviours:function(n){return bb(n)?[]:[UB.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(t){return et.from(n).map(function(t){return se.fromDom(t.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),Rm.config({})]}},GB=function(n){Pk.each([{name:"alignleft",text:"Align left",cmd:"JustifyLeft",icon:"align-left"},{name:"aligncenter",text:"Align center",cmd:"JustifyCenter",icon:"align-center"},{name:"alignright",text:"Align right",cmd:"JustifyRight",icon:"align-right"},{name:"alignjustify",text:"Justify",cmd:"JustifyFull",icon:"align-justify"}],function(t){n.ui.registry.addToggleButton(t.name,{tooltip:t.text,onAction:function(){return n.execCommand(t.cmd)},icon:t.icon,onSetup:cE(n,t.name)})});var t="alignnone",e="No alignment",o="JustifyNone",r="align-none";n.ui.registry.addButton(t,{tooltip:e,onAction:function(){return n.execCommand(o)},icon:r})},XB=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},YB=function(t){var n,e;!function(e){Pk.each([{name:"bold",text:"Bold",icon:"bold"},{name:"italic",text:"Italic",icon:"italic"},{name:"underline",text:"Underline",icon:"underline"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],function(t,n){e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:cE(e,t.name),onAction:XB(e,t.name)})});for(var t=1;t<=6;t++){var n="h"+t;e.ui.registry.addToggleButton(n,{text:n.toUpperCase(),tooltip:"Heading "+t,onSetup:cE(e,n),onAction:XB(e,n)})}}(t),n=t,Pk.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"help",text:"Help",action:"mceHelp",icon:"help"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"}],function(t){n.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:function(){return n.execCommand(t.action)}})}),e=t,Pk.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],function(t){e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:function(){return e.execCommand(t.action)},onSetup:cE(e,t.name)})})},qB=function(t){var n;YB(t),n=t,Pk.each([{name:"bold",text:"Bold",action:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",action:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",action:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",action:"Strikethrough",icon:"strike-through",shortcut:""},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript",shortcut:""},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript",shortcut:""},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting",shortcut:""},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document",shortcut:""},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"}],function(t){n.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:function(){return n.execCommand(t.action)}})}),n.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onAction:XB(n,"code")})},KB=function(t,n,e){var o=function(){return!!n.undoManager&&n.undoManager[e]()},r=function(){t.setDisabled(n.readonly||!o())};return t.setDisabled(!o()),n.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r),function(){return n.off("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r)}},JB=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return KB(t,n,"hasUndo")},onAction:function(){return n.execCommand("undo")}}),n.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:function(t){return KB(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return KB(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return KB(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},$B=function(t){var n,e;(n=t).ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:function(){return n.execCommand("mceToggleVisualAid")}}),(e=t).ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:function(t){return function(n,t){n.setActive(t.hasVisual);var e=function(t){n.setActive(t.hasVisual)};return t.on("VisualAid",e),function(){return t.off("VisualAid",e)}}(t,e)},onAction:function(){e.execCommand("mceToggleVisualAid")}})},QB=function(t){var n;(n=t).ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:function(t){return function(t,n){t.setDisabled(!n.queryCommandState("outdent"));var e=function(){t.setDisabled(!n.queryCommandState("outdent"))};return n.on("NodeChange",e),function(){return n.off("NodeChange",e)}}(t,n)},onAction:function(){return n.execCommand("outdent")}}),n.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:function(){return n.execCommand("indent")}})},ZB=function(t,n){var e,o,r,i,u,a,c,s,l,f,d,m,g,p,h,v,b,y,x,w;o=n,r=hE(e=t),i=lE(0,o,r.dataset,r),e.ui.registry.addNestedMenuItem("align",{text:o.shared.providers.translate("Align"),getSubmenuItems:function(){return i.items.validateItems(i.getStyleItems())}}),a=n,c=yE(u=t),s=lE(0,a,c.dataset,c),u.ui.registry.addNestedMenuItem("fontformats",{text:a.shared.providers.translate("Fonts"),getSubmenuItems:function(){return s.items.validateItems(s.getStyleItems())}}),l=t,d=(f=n).styleselect,m=lE(0,f,d,TE(l)),l.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=n,h=OE(g=t),v=lE(0,p,h.dataset,h),g.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return v.items.validateItems(v.getStyleItems())}}),y=n,x=SE(b=t),w=lE(0,y,x.dataset,x),b.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return w.items.validateItems(w.getStyleItems())}})},t_=function(t,n){GB(t),qB(t),ZB(t,n),JB(t),ov.register(t),$B(t),QB(t)},n_=function(t,n){return{anchor:"makeshift",x:t,y:n}},e_=function(t,n){var e,o,r,i=uh.DOM.getPos(t);return e=n,o=i.x,r=i.y,n_(e.x+o,e.y+r)},o_=function(t,n){return"contextmenu"===n.type?t.inline?n_((o=n).pageX,o.pageY):e_(t.getContentAreaContainer(),n_((e=n).clientX,e.clientY)):r_(t);var e,o},r_=function(t){return{anchor:"selection",root:se.fromDom(t.selection.getNode())}},i_=function(t){return"string"==typeof t?t.split(/[ ,]/):t},u_=function(t){return t.settings.contextmenu_never_use_native||!1},a_=function(t){return e="contextmenu",o="link linkchecker image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,mt(n.settings,e).map(i_).getOrThunk(function(){return L(i_(o),function(t){return gt(r,t)})});var n,e,o,r},c_=function(t){return!1===t.getParam("contextmenu")},s_=function(t){return C(t)?"|"===t:"separator"===t.type},l_={type:"separator"},f_=function(n){if(C(n))return n;switch(n.type){case"separator":return l_;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return C(t)?t:P(t,f_)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:(t=n.onAction,function(){return t()})}}var t},d_=function(t,n){if(0===n.length)return t;var e=rt(t).filter(function(t){return!s_(t)}).fold(function(){return[]},function(t){return[l_]});return t.concat(e).concat(n).concat([l_])},m_=function(d,t,m){var g=uu(gg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return d.focus()},fireDismissalEventInstead:{},inlineBehaviours:Lu([Dm("dismissContextMenu",[fr(Fo(),function(t,n){Gs.close(t),d.focus()})])])}));d.on("init",function(){d.on("contextmenu",function(n){if(u_(d)&&n.preventDefault(),t=d,!(n.ctrlKey&&!u_(t)||c_(d))){var t,e,r,i,o,u=2!==n.button||n.target===d.getBody(),a=u?(e=d,{anchor:"node",node:et.some(se.fromDom(e.selection.getNode())),root:se.fromDom(e.getBody())}):o_(d,n),c=d.ui.registry.getAll(),s=a_(d),l=u?d.selection.getStart(!0):n.target,f=(r=c.contextMenus,i=l,0<(o=U(s,function(t,n){if(gt(r,n)){var e=r[n].update(i);if(C(e))return d_(t,e.split(" "));if(0<e.length){var o=P(e,f_);return d_(t,o)}return t}return t.concat([n])},[])).length&&s_(o[o.length-1])&&o.pop(),o);Ey(f,nh.CLOSE_ON_EXECUTE,m).map(function(t){n.preventDefault(),gg.showMenuAt(g,a,{menu:{markers:av("normal")},data:t})})}})})},g_=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?et.some(parseInt(t,10)):et.none()},p_=function(t){return V(t)?t+"px":t},h_="data-initial-z-index",v_=function(t,n){var e;t.getSystem().addToGui(n),Br((e=n).element()).filter(Zo).each(function(n){Gi(n,"z-index").each(function(t){Ur(n,h_,t)}),Li(n,"z-index",Ui(e.element(),"z-index"))})},b_=function(t){Br(t.element()).filter(Zo).each(function(t){var n=Gr(t,h_);Xr(t,h_)?Li(t,"z-index",n):Yi(t,"z-index"),Yr(t,h_)}),t.getSystem().removeFromGui(t)},y_=function(t,n,e,o){return(r=t,i=n,u=r.element(),a=parseInt(Gr(u,i.leftAttr),10),c=parseInt(Gr(u,i.topAttr),10),isNaN(a)||isNaN(c)?et.none():et.some(Qu(a,c))).fold(function(){return e},function(t){return FB(t.left()+o.left(),t.top()+o.top())});var r,i,u,a,c},x_=function(t,n,e,o,r,i){var u,a,c,s=y_(t,n,e,o),l=S_(t,n,s,r,i),f=TB(s,r,i);return u=n,a=f,c=t.element(),Ur(c,u.leftAttr,a.left()+"px"),Ur(c,u.topAttr,a.top()+"px"),l.fold(function(){return{coord:FB(f.left(),f.top()),extra:et.none()}},function(t){return{coord:t.output(),extra:t.extra()}})},w_=function(t,n){var e,o;e=n,o=t.element(),Yr(o,e.leftAttr),Yr(o,e.topAttr)},S_=function(t,n,p,h,v){var e=n.getSnapPoints(t);return pu(e,function(t){var n,e,o,r,i,u,a,c,s,l,f,d,m,g=t.sensor();return(n=p,e=g,o=t.range().left(),r=t.range().top(),a=EB(n,i=h,u=v),c=EB(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r)?et.some({output:nt((s=t.output(),l=p,f=h,d=v,m=function(o,r){return function(t,n){var e=o(l,f,d);return r(t.getOr(e.left()),n.getOr(e.top()))}},s.fold(m(BB,SB.offset),m(EB,SB.absolute),m(TB,SB.fixed)))),extra:t.extra}):et.none()})},k_=function(e,t,i,u,a,c,n){var o,r,s,l,f,d,m,g,p,h=t.fold(function(){var t,e,o,n=(t=i,e=c.left(),o=c.top(),t.fold(function(t,n){return SB.offset(t+e,n+o)},function(t,n){return SB.absolute(t+e,n+o)},function(t,n){return SB.fixed(t+e,n+o)})),r=TB(n,u,a);return FB(r.left(),r.top())},function(n){var t=x_(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord});return o=h,r=u,s=a,f=(l=n).bounds,d=EB(o,r,s),m=sf(d.left(),f.x(),f.width()-l.width),g=sf(d.top(),f.y(),f.height()-l.height),p=AB(m,g),o.fold(function(){var t=BB(p,r,s);return DB(t.left(),t.top())},function(){return p},function(){var t=TB(p,r,s);return FB(t.left(),t.top())})},C_=function(t,n,e,o){var r,i=n.getTarget(t.element());if(n.repositionTarget){var u=Tr(t.element()),a=sa(u),c=wB(i,a),s=Gi(r=i,"left").bind(function(e){return Gi(r,"top").bind(function(n){return Gi(r,"position").map(function(t){return("fixed"===t?FB:DB)(parseInt(e,10),parseInt(n,10))})})}).getOrThunk(function(){var t=ta(r);return AB(t.left(),t.top())}),l=k_(t,n.snaps,s,a,c,o,e),f=_B(l,0,c);ji(i,f)}n.onDrag(t,i,o)},O_=function(t,n){return{bounds:t.getBounds(),height:ia(n.element()),width:ca(n.element())}},T_=$n("snaps",[Hn("getSnapPoints"),_u("onSensor"),Hn("leftAttr"),Hn("topAttr"),Qn("lazyViewport",function(){var t=sa();return{x:t.left,y:t.top,width:nt(M.window.innerWidth),height:nt(M.window.innerHeight),bottom:nt(t.top()+M.window.innerHeight),right:nt(t.left()+M.window.innerWidth)}})]),E_=/* */Object.freeze({getData:function(t){return et.from(Qu(t.x(),t.y()))},getDelta:function(t,n){return Qu(n.left()-t.left(),n.top()-t.top())}}),B_=[Qn("useFixed",!1),Hn("blockerClass"),Qn("getTarget",d),Qn("onDrag",tt),Qn("repositionTarget",!0),_u("onDrop"),re("getBounds",va),T_,Mu("dragger",{handlers:function(a,c){var s=function(t){c.setStartData(O_(a,t))};return cr([fr(Bo(),s),fr(to(),function(o,t){if(0===t.event().raw().button){t.stop();var e,n={drop:function(){i()},delayDrop:function(){u.schedule()},forceDrop:function(){i()},move:function(t){u.cancel();var n=c.update(E_,t),e=c.getStartData().getOrThunk(function(){return O_(a,o)});n.each(function(t){C_(o,a,e,t)})}},r=o.getSystem().build(ob.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[a.blockerClass]},events:(e=n,cr([fr(to(),e.forceDrop),fr(oo(),e.drop),fr(no(),function(t,n){e.move(n.event())}),fr(eo(),e.delayDrop)]))})),i=function(){b_(r),a.snaps.each(function(t){w_(o,t)});var t=a.getTarget(o.element());c.reset(),a.onDrop(o,t)},u=Pv(i,200);s(o),v_(o,r)}})])}})],__=/* */Object.freeze({getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],et.some(Qu(n.clientX,n.clientY))):et.none()},getDelta:function(t,n){return Qu(n.left()-t.left(),n.top()-t.top())}}),D_=B_,A_=[Qn("useFixed",!1),Qn("getTarget",d),Qn("onDrag",tt),Qn("repositionTarget",!0),Qn("onDrop",tt),re("getBounds",va),T_,Mu("dragger",{handlers:function(r,i){var e=function(t){i.setStartData(O_(r,t))};return cr([fr(Bo(),e),fr($e(),function(t,n){e(t),n.stop()}),fr(Qe(),function(n,t){t.stop();var e=i.update(__,t.event()),o=i.getStartData().getOrThunk(function(){return O_(r,n)});e.each(function(t){C_(n,r,o,t)})}),fr(Ze(),function(n,t){r.snaps.each(function(t){w_(n,t)});var e=r.getTarget(n.element());i.reset(),r.onDrop(n,e)})])}})],F_=/* */Object.freeze({mouse:D_,touch:A_}),M_=/* */Object.freeze({init:function(){var i=et.none(),n=et.none(),t=nt({});return vi({readState:t,reset:function(){i=et.none(),n=et.none()},update:function(r,t){return r.getData(t).bind(function(t){return n=r,e=t,o=i.map(function(t){return n.getDelta(t,e)}),i=et.some(e),o;var n,e,o})},getStartData:function(){return n},setStartData:function(t){n=et.some(t)}})}}),I_=Gu({branchKey:"mode",branches:F_,name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:Or(["sensor","range","output"],["extra"])},state:M_});(mE=dE||(dE={}))[mE.None=0]="None",mE[mE.Both=1]="Both",mE[mE.Vertical=2]="Vertical";var R_,V_,N_,H_,P_,z_=function(t,n,e,o){var r=t+n,i=e.filter(function(t){return r<t}),u=o.filter(function(t){return t<r});return i.or(u).getOr(r)},L_=function(t,n,e,o,r){var i,u,a={};return a.height=z_(o,n.top(),ab(t),(i=t,et.from(i.getParam("max_height")).filter(V))),e===dE.Both&&(a.width=z_(r,n.left(),ub(t),(u=t,et.from(u.getParam("max_width")).filter(V)))),a},j_=function(t){if(1===t.nodeType){if("BR"===t.nodeName||t.getAttribute("data-mce-bogus"))return!0;if("bookmark"===t.getAttribute("data-mce-type"))return!0}return!1},U_=function(i,u){u.delimiter||(u.delimiter="\xbb");return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Lu([fm.config({mode:"flow",selector:"div[role=button]"}),Ly.config({}),hm.config({}),Dm("elementPathEvents",[br(function(r,t){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return fm.focusIn(r)}),i.on("NodeChange",function(t){var n,o,e=function(t){for(var n=[],e=t.length;0<e--;){var o=t[e];if(1===o.nodeType&&!j_(o)){var r=i.fire("ResolveName",{name:o.nodeName.toLowerCase(),target:o});if(r.isDefaultPrevented()||n.push({name:r.name,element:o}),r.isPropagationStopped())break}}return n}(t.parents);0<e.length&&hm.set(r,(n=P(e||[],function(n,t){return hg.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{role:"button","data-index":t,"tab-index":-1,"aria-level":t+1},innerHtml:n.name},action:function(t){i.focus(),i.selection.select(n.element),i.nodeChanged()}})}),o={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+u.delimiter+" "}},U(n.slice(1),function(t,n){var e=t;return e.push(o),e.push(n),e},[n[0]])))})})])]),components:[]}},W_=function(s,u){var t,n,e,o,r,i=function(c){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:u.translate("Resize")},innerHtml:yg("resize-handle",u.icons)},behaviours:Lu([I_.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){var o,r,i,u,a;o=s,r=e,i=c,u=se.fromDom(o.getContainer()),a=L_(o,r,i,ra(u),aa(u)),ct(a,function(t,n){return Li(u,n,p_(t))}),Wh(o)},blockerClass:"tox-blocker"})])}};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(o=function(){var t,o,n,r,e,i=[];return s.getParam("elementpath",!0,"boolean")&&i.push(U_(s,{})),De(s.settings.plugins,"wordcount")&&i.push((t=s,o=u,r=function(t,n,e){return hm.set(t,[ou(o.translate(["{0} "+e,n[e]]))])},hg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Lu([Ly.config({}),hm.config({}),_m.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Dm("wordcount-events",[fr(ko(),function(t){var n=_m.getValue(t),e="words"===n.mode?"characters":"words";_m.setValue(t,{mode:e,count:n.count}),r(t,n.count,e)}),br(function(e){t.on("wordCountUpdate",function(t){var n=_m.getValue(e).mode;_m.setValue(e,{mode:n,count:t.wordCount}),r(e,t.wordCount,n)})})])]),eventOrder:(n={},n[ko()]=["wordcount-events","alloy.base.behaviour"],n)}))),s.getParam("branding",!0,"boolean")&&i.push({dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:'<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="'+(e=mp.translate(["Powered by {0}","Tiny"]))+'">'+e+"</a>"}}),0<i.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:i}]:[]}(),n=!De((t=s).settings.plugins,"autoresize"),r=!1===(e=t.getParam("resize",n))?dE.None:"both"===e?dE.Both:dE.Vertical,r!==dE.None&&o.push(i(r)),o)}},G_=function(y){var t=y.getParam("inline",!1,"boolean"),x=t?WB:xB,n=et.none(),e=Ne.detect().browser.isIE()?["tox-platform-ie"]:[],o=mp.isRtl()?{attributes:{dir:"rtl"}}:{},w=uu({dom:I({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(e)},o),behaviours:Lu([Ts.config({useFixed:!1})])}),r=vg({dom:{tag:"div",classes:["tox-anchorbar"]}}),i=function(){return n.bind(function(t){return sB.getMoreButton(t)}).getOrDie("Could not find more button element")},S=function(){return n.bind(function(t){return sB.getThrobber(t)}).getOrDie("Could not find throbber element")},k=fO(w,y,function(){return n.bind(function(t){return r.getOpt(t)}).getOrDie("Could not find a anchor bar element")},i),C=function(){return R.value(w)},u=sB.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:k,onEscape:function(){y.focus()}}),a=function(t){return hb(t)},c=sB.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:C,backstage:k,onEscape:function(){y.focus()},split:a(y),lazyToolbar:function(){return n.bind(function(t){return sB.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:i}),s=sB.parts()["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},onEscape:function(){}}),l=sB.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),f=sB.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),d=sB.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:k}),m=y.getParam("statusbar",!0,"boolean")&&!t?et.some(W_(y,k.shared.providers)):et.none(),g={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[l,f]},p=fb(y),h=sb(y),v=cb(y),b=a(y)!==nb["default"],O=q([v?[u]:[],p?(b&&M.console.warn("Toolbar drawer cannot be applied when multiple toolbars are active"),[s]):h?[c]:[],bb(y)?[]:[r.asSpec()],t?[]:[g]]),T=q([[{dom:{tag:"div",classes:["tox-editor-container"]},components:O}],t?[]:m.toArray(),[d]]),E=t&&!v&&!h&&!p,B=I({role:"application"},mp.isRtl()?{dir:"rtl"}:{},E?{"aria-hidden":"true"}:{}),_=uu(sB.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(t?["tox-tinymce-inline"]:[]).concat(e),styles:I({visibility:"hidden"},E?{opacity:"0",border:"0"}:{}),attributes:B},components:T,behaviours:Lu(x.getBehaviours(y).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"})]))}));n=et.some(_),y.shortcuts.add("alt+F9","focus menubar",function(){sB.focusMenubar(_)}),y.shortcuts.add("alt+F10","focus toolbar",function(){sB.focusToolbar(_)});var D=rb(_),A=rb(w);RE(y,D,A);var F=function(t){var n,e=uh.DOM,o=y.getParam("width",e.getStyle(t,"width")),r=(n=y).getParam("height",Math.max(n.getElement().offsetHeight,200)),i=ub(y),u=ab(y),a=g_(o).bind(function(n){return p_(i.map(function(t){return Math.max(n,t)}))}).getOr(p_(o)),c=g_(r).bind(function(n){return u.map(function(t){return Math.max(n,t)})}).getOr(r),s=p_(a);if(Xi("div","width",s)&&Li(_.element(),"width",s),!y.inline){var l=p_(c);Xi("div","height",l)?Li(_.element(),"height",l):Li(_.element(),"height","200px")}return c};return{mothership:D,uiMothership:A,backstage:k,renderUI:function(){var o,r,e,n,i,u,a,c;t_(y,k),m_(y,C,k),r=(o=y).ui.registry.getAll().sidebars,z(ut(r),function(n){var t=r[n],e=function(){return et.from(o.queryCommandValue("ToggleSidebar")).is(n)};o.ui.registry.addToggleButton(n,{icon:t.icon,tooltip:t.tooltip,onAction:function(t){o.execCommand("ToggleSidebar",!1,n),t.setActive(e())},onSetup:function(t){var n=function(){return t.setActive(e())};return o.on("ToggleSidebar",n),function(){o.off("ToggleSidebar",n)}}})}),e=y,n=S,i=k.shared,u=ae(!1),a=ae(et.none()),c=function(t){t!==u.get()&&(eB(n(),t,i.providers),u.set(t))},e.on("ProgressState",function(t){if(a.get().each(Sg.clearTimeout),V(t.time)){var n=Sg.setEditorTimeout(e,function(){return c(t.state)},t.time);a.set(et.some(n))}else c(t.state),a.set(et.none())});var t=y.ui.registry.getAll(),s=t.buttons,l=t.menuItems,f=t.contextToolbars,d=t.sidebars,m=lb(y),g={menuItems:l,menus:y.settings.menu?st(y.settings.menu,function(t){return yt(t,{items:t.items})}):{},menubar:y.settings.menubar,toolbar:m.getOrThunk(function(){return y.getParam("toolbar",!0)}),buttons:s,sidebar:d};IE(y,f,w,{backstage:k});var p=y.getElement(),h=F(p),v={mothership:D,uiMothership:A,outerContainer:_},b={targetNode:p,height:h};return x.render(y,v,g,k,b)},getUi:function(){return{channels:{broadcastAll:A.broadcast,broadcastOn:A.broadcastOn,register:function(){}}}}}},X_=function(t,n){var e=et.from(Gr(t,"id")).fold(function(){var t=ti("dialog-label");return Ur(n,"id",t),t},d);Ur(t,"aria-labelledby",e)},Y_=nt([Hn("lazySink"),Xn("dragBlockClass"),re("getBounds",va),Qn("useTabstopAt",nt(!0)),Qn("eventOrder",{}),$s("modalBehaviours",[fm]),Du("onExecute"),Fu("onEscape")]),q_={sketch:d},K_=nt([El({name:"draghandle",overrides:function(t,n){return{behaviours:Lu([I_.config({mode:"mouse",getTarget:function(t){return cu(t,'[role="dialog"]').getOr(t)},blockerClass:t.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+JSON.stringify(n,null,2)).message),getBounds:t.getDragBounds})])}}}),Ol({schema:[Hn("dom")],name:"title"}),Ol({factory:q_,schema:[Hn("dom")],name:"close"}),Ol({factory:q_,schema:[Hn("dom")],name:"body"}),El({factory:q_,schema:[Hn("dom")],name:"footer"}),Tl({factory:{sketch:function(t,n){return I({},t,{dom:n.dom,components:n.components})}},schema:[Qn("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Qn("components",[])],name:"blocker"})]),J_=ef({name:"ModalDialog",configFields:Y_(),partFields:K_(),factory:function(r,t,n,o){var a=ti("alloy.dialog.busy"),c=ti("alloy.dialog.idle"),s=Lu([fm.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),Rm.config({})]),e=ti("modal-events"),i=I({},r.eventOrder,{"alloy.system.attached":[e].concat(r.eventOrder["alloy.system.attached"]||[])});return{uid:r.uid,dom:r.dom,components:t,apis:{show:function(i){var t=r.lazySink(i).getOrDie(),u=ae(et.none()),n=o.blocker(),e=t.getSystem().build(I({},n,{components:n.components.concat([au(i)]),behaviours:Lu([Dm("dialog-blocker-events",[fr(c,function(t,n){Xr(i.element(),"aria-busy")&&(Yr(i.element(),"aria-busy"),u.get().each(function(t){return hm.remove(i,t)}))}),fr(a,function(t,n){Ur(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){hm.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(et.some(r)),hm.append(i,au(r)),r.hasConfigured(fm)&&fm.focusIn(r)})])])}));_s(t,e),fm.focusIn(i)},hide:function(n){Br(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){Fs(t)})})},getBody:function(t){return zl(t,r,"body")},getFooter:function(t){return zl(t,r,"footer")},setIdle:function(t){Po(t,c)},setBusy:function(t,n){zo(t,a,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Zs(r.modalBehaviours,[hm.config({}),fm.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt}),Dm(e,[br(function(t){var n,e,o;X_(t.element(),zl(t,r,"title").element()),n=t.element(),e=zl(t,r,"body").element(),o=et.from(Gr(n,"id")).fold(function(){var t=ti("dialog-describe");return Ur(e,"id",t),t},d),Ur(n,"aria-describedby",o)})])])}},apis:{show:function(t,n){t.show(n)},hide:function(t,n){t.hide(n)},getBody:function(t,n){return t.getBody(n)},getFooter:function(t,n){return t.getFooter(n)},setBusy:function(t,n,e){t.setBusy(n,e)},setIdle:function(t,n){t.setIdle(n)}}}),$_=[zn("type"),zn("text"),Ln("level",["info","warn","error","success"]),zn("icon"),Qn("url","")],Q_=ln($_),Z_=[zn("type"),zn("text"),oe("disabled",!1),oe("primary",!1),hn("name","name",Ot(function(){return ti("button-name")}),Fn),Kn("icon"),oe("borderless",!1)],tD=ln(Z_),nD=[zn("type"),zn("name"),zn("label"),oe("disabled",!1)],eD=ln(nD),oD=Mn,rD=[zn("type"),zn("name")],iD=rD.concat([Kn("label")]),uD=ln(iD),aD=Fn,cD=ln(iD),sD=Fn,lD=ln(iD),fD=fn(yn),dD=function(t){return[zn("type"),(n="columns",Pn(n,An)),t];var n},mD=iD.concat([oe("sandboxed",!0)]),gD=ln(mD),pD=Fn,hD=iD.concat([Kn("placeholder"),oe("maximized",!1),oe("disabled",!1)]),vD=ln(hD),bD=Fn,yD=iD.concat([Wn("items",[zn("text"),zn("value")]),te("size",1),oe("disabled",!1)]),xD=ln(yD),wD=Fn,SD=iD.concat([oe("constrain",!0),oe("disabled",!1)]),kD=ln(SD),CD=ln([zn("width"),zn("height")]),OD=iD.concat([Kn("placeholder"),oe("maximized",!1),oe("disabled",!1)]),TD=ln(OD),ED=Fn,BD=iD.concat([ee("filetype","file",["image","media","file"]),Qn("disabled",!1)]),_D=ln(BD),DD=ln([zn("value"),Qn("meta",{})]),AD=rD.concat([ne("tag","textarea"),zn("scriptId"),zn("scriptUrl"),(R_="settings",V_=undefined,Zn(R_,V_,Vn))]),FD=rD.concat([ne("tag","textarea"),jn("init")]),MD=wn(function(t){return kn("customeditor.old",sn(FD),t).orThunk(function(){return kn("customeditor.new",sn(AD),t)})}),ID=Fn,RD=[zn("type"),zn("html"),ee("presets","presentation",["presentation","document"])],VD=ln(RD),ND=iD.concat([Pn("currentState",ln([Hn("blob"),zn("url")]))]),HD=ln(ND),PD=iD.concat([Qn("columns","auto")]),zD=ln(PD),LD=(N_=[zn("value"),zn("text"),zn("icon")],gn(N_)),jD=[zn("type"),Gn("header",Fn),Gn("cells",fn(Fn))],UD=ln(jD),WD=function(n){return hn("items","items",kt(),fn(wn(function(t){return kn("Checking item of "+n,GD,t).fold(function(t){return R.error(Tn(t))},function(t){return R.value(t)})})))},GD=xn(function(){return En("type",{alertbanner:Q_,bar:ln((n=WD("bar"),[zn("type"),n])),button:tD,checkbox:eD,colorinput:uD,colorpicker:cD,dropzone:lD,grid:ln(dD(WD("grid"))),iframe:gD,input:vD,selectbox:xD,sizeinput:kD,textarea:TD,urlinput:_D,customeditor:MD,htmlpanel:VD,imagetools:HD,collection:zD,label:ln((t=WD("label"),[zn("type"),zn("label"),t])),table:UD,panel:YD});var t,n}),XD=[zn("type"),Qn("classes",[]),Gn("items",GD)],YD=ln(XD),qD=[hn("name","name",Ot(function(){return ti("tab-name")}),Fn),zn("title"),Gn("items",GD)],KD=[zn("type"),Wn("tabs",qD)],JD=ln(KD),$D=[hn("name","name",Ot(function(){return ti("button-name")}),Fn),Kn("icon"),ee("align","end",["start","end"]),oe("primary",!1),oe("disabled",!1)],QD=$D.concat([zn("text")]),ZD=[Ln("type",["submit","cancel","custom"])].concat(QD),tA=[Ln("type",["menu"])].concat($D,pT),nA=Bn("type",{submit:ZD,cancel:ZD,custom:ZD,menu:tA}),eA=ln([zn("title"),Pn("body",En("type",{panel:YD,tabpanel:JD})),ne("size","normal"),Gn("buttons",nA),Qn("initialData",{}),re("onAction",tt),re("onChange",tt),re("onSubmit",tt),re("onClose",tt),re("onCancel",tt),Qn("onTabChange",tt)]),oA=function(t){return O(t)?[t].concat(K(dt(t),oA)):T(t)?K(t,oA):[]},rA=function(t){return C(t.type)&&C(t.name)},iA={checkbox:oD,colorinput:aD,colorpicker:sD,dropzone:fD,input:bD,iframe:pD,sizeinput:CD,selectbox:wD,size:CD,textarea:ED,urlinput:DD,customeditor:ID,collection:LD},uA=function(t){var n=K(L(oA(t),rA),function(n){return(t=n,et.from(iA[t.type])).fold(function(){return[]},function(t){return[Pn(n.name,t)]});var t});return ln(n)},aA=ln([Ln("type",["cancel","custom"])].concat(QD)),cA=ln([zn("title"),zn("url"),qn("height"),qn("width"),(H_="buttons",P_=aA,Yn(H_,fn(P_))),re("onAction",tt),re("onCancel",tt),re("onClose",tt),re("onMessage",tt)]),sA=function(t){return{internalDialog:Cn(kn("dialog",eA,t)),dataValidator:uA(t),initialData:t.initialData}},lA={open:function(t,n){var e=sA(n);return t(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(t,n){return t(Cn(kn("dialog",cA,n)))},redial:function(t){return sA(t)}},fA=function(t){var e=[],o={};return ct(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?R.error(e):R.value(o)},dA=nf({name:"TabButton",configFields:[Qn("uid",undefined),Hn("value"),hn("dom","dom",Tt(function(t){return{attributes:{role:"tab",id:ti("aria"),"aria-selected":"false"}}}),_n()),Xn("action"),Qn("domModification",{}),$s("tabButtonBehaviours",[Rm,fm,_m]),Hn("view")],factory:function(t,n){return{uid:t.uid,dom:t.dom,components:t.components,events:pg(t.action),behaviours:Zs(t.tabButtonBehaviours,[Rm.config({}),fm.config({mode:"execution",useSpace:!0,useEnter:!0}),_m.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),mA=nt([Hn("tabs"),Hn("dom"),Qn("clickToDismiss",!1),$s("tabbarBehaviours",[xf,fm]),Eu(["tabClass","selectedClass"])]),gA=Bl({factory:dA,name:"tabs",unit:"tab",overrides:function(o,t){var r=function(t,n){xf.dehighlight(t,n),zo(t,Vo(),{tabbar:t,button:n})},i=function(t,n){xf.highlight(t,n),zo(t,Ro(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=xf.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?tt:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),pA=nt([gA]),hA=ef({name:"Tabbar",configFields:mA(),partFields:pA(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Zs(t.tabbarBehaviours,[xf.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){Ur(n.element(),"aria-selected","true")},onDehighlight:function(t,n){Ur(n.element(),"aria-selected","false")}}),fm.config({mode:"flow",getInitial:function(t){return xf.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),vA=nf({name:"Tabview",configFields:[$s("tabviewBehaviours",[hm])],factory:function(t,n){return{uid:t.uid,dom:t.dom,behaviours:Zs(t.tabviewBehaviours,[hm.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),bA=nt([Qn("selectFirst",!0),_u("onChangeTab"),_u("onDismissTab"),Qn("tabs",[]),$s("tabSectionBehaviours",[])]),yA=Ol({factory:hA,schema:[Hn("dom"),Un("markers",[Hn("tabClass"),Hn("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),xA=Ol({factory:vA,name:"tabview"}),wA=nt([yA,xA]),SA=ef({name:"TabSection",configFields:bA(),partFields:wA(),factory:function(i,t,n,e){var o=function(t,n){Pl(t,i,"tabbar").each(function(t){n(t).each(Lo)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:Qs(i.tabSectionBehaviours),events:cr(q([i.selectFirst?[br(function(t,n){o(t,xf.getFirst)})]:[],[fr(Ro(),function(t,n){var o,r,e=n.event().button();o=e,r=_m.getValue(o),Pl(o,i,"tabview").each(function(e){W(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();Ur(e.element(),"aria-labelledby",Gr(o.element(),"id")),hm.set(e,n),i.onChangeTab(e,o,n)})})}),fr(Vo(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return Pl(t,i,"tabview").map(function(t){return hm.contents(t)}).getOr([])},showTab:function(t,e){o(t,function(n){var t=xf.getCandidates(n);return W(t,function(t){return _m.getValue(t)===e}).filter(function(t){return!xf.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),kA=function(t){return ot((n=t,e=function(t,n){return n<t?-1:t<n?1:0},(o=D.call(n,0)).sort(e),o));var n,e,o},CA=function(i,u,t){cu(i,'[role="dialog"]').each(function(r){t.get().map(function(t){return Li(u,"height","0"),Math.min(t,(e=i,o=cu(n=r,".tox-dialog-wrap").getOr(n),("fixed"===Ui(o,"position")?Math.max(M.document.documentElement.clientHeight,M.window.innerHeight):Math.max(M.document.documentElement.offsetHeight,M.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-e.dom().getBoundingClientRect().height)));var n,e,o}).each(function(t){Li(u,"height",t+"px")})})},OA=function(a){var c;return{smartTabHeight:(c=ae(et.none()),{extraEvents:[br(function(t){su(t.element(),'[role="tabpanel"]').each(function(u){var n;Li(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,P(o=a,function(t,n){hm.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return hm.set(i,[]),e.height})),e=kA(n);c.set(e)}),CA(t.element(),u,c),Yi(u,"visibility"),n=t,ot(a).each(function(t){return SA.showTab(n,t.value)}),Sg.requestAnimationFrame(function(){CA(t.element(),u,c)})})}),fr(_o(),function(n){su(n.element(),'[role="tabpanel"]').each(function(t){CA(n.element(),t,c)})}),fr(Eb,function(r,t){su(r.element(),'[role="tabpanel"]').each(function(n){var t=Ff();Li(n,"visibility","hidden");var e=Gi(n,"height").map(function(t){return parseInt(t,10)});Yi(n,"height");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(et.from(o)),CA(r.element(),n,c)):e.each(function(t){Li(n,"height",t+"px")}),Yi(n,"visibility"),t.each(Af)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},TA="send-data-to-section",EA="send-data-to-view",BA=ti("update-dialog"),_A=ti("update-title"),DA=ti("update-body"),AA=ti("update-footer"),FA=ti("body-send-message"),MA=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:I({},n.map(function(t){return{id:t}}).getOr({}),e?{"aria-live":"polite"}:{})},components:[],behaviours:Lu([Zw(0),IT.config({channel:DA,updateState:function(t,n){return et.some({isTabPanel:function(){return"tabpanel"===n.body.type}})},renderComponents:function(t){switch(t.body.type){case"tabpanel":return[(r=t.body,i=d,u=ae({}),a=function(t){var n=_m.getValue(t),e=fA(n).getOr({}),o=u.get(),r=bt(o,e);u.set(r)},c=function(t){var n=u.get();_m.setValue(t,n)},s=ae(null),l=P(r.tabs,function(t){return{value:t.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:i.shared.providers.translate(t.title)},view:function(){return[Uw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:P(t.items,function(t){return hC(n,t,i)}),formBehaviours:Lu([fm.config({mode:"acyclic",useTabstopAt:x(pS)}),Dm("TabView.form.events",[br(c),yr(a)]),Ku.config({channels:Rt([{key:TA,value:{onReceive:a}},{key:EA,value:{onReceive:c}}])})])}})]}}}),f=OA(l).smartTabHeight,SA.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n,e){var o=_m.getValue(n);zo(t,Tb,{name:o,oldName:s.get()}),s.set(o)},tabs:l,components:[SA.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[hA.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:Lu([Ly.config({})])}),SA.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:f.selectFirst,tabSectionBehaviours:Lu([Dm("tabpanel",f.extraEvents),fm.config({mode:"acyclic"}),af.config({find:function(t){return ot(SA.getViewItems(t))}}),_m.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([TA],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([EA],{})}}})])}))];default:return[(e=t.body,o=d,n=vg(Uw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:P(e.items,function(t){return hC(n,t,o)})}})),{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:Lu([fm.config({mode:"acyclic",useTabstopAt:x(pS)}),Qw(n),uS(n,{postprocess:function(t){return fA(t).fold(function(t){return M.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,l,f},initialData:t})])}},IA=function(t,e){return[pr(io(),hS),t(xb,function(t,n){e.onClose(),n.onClose()}),t(wb,function(t,n,e,o){n.onCancel(t),Po(o,xb)}),fr(Ob,function(t,n){return e.onUnblock()}),fr(Cb,function(t,n){return e.onBlock(n.event())})]},RA=function(i,t){var n=function(t,r){return fr(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){IT.getState(n).get().each(function(t){e(t,n)})};return IA(n,t).concat([n(Sb,function(t,n,e){n.onAction(t,{name:e.name()})})])},VA=function(i,t){var n=function(t,r){return fr(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){IT.getState(n).get().each(function(t){e(t.internalDialog,n)})};return IA(n,t).concat([n(kb,function(t,n){return n.onSubmit(t)}),n(yb,function(t,n,e){n.onChange(t,{name:e.name()})}),n(Sb,function(t,n,e,o){var r=function(){return fm.focusIn(o)},i=Ff();n.onAction(t,{name:e.name(),value:e.value()}),Ff().fold(function(){r()},function(t){!Ye(o.element(),t)||Xr(t,"disabled")?r():Ye(t,i.getOrNull())&&Xr(i.getOrDie(),"disabled")&&r()})}),n(Tb,function(t,n,e){n.onTabChange(t,{newTabName:e.name(),oldTabName:e.oldName()})}),yr(function(t){var n=i();_m.setValue(t,n.getData())})])},NA=function(t,n){var e=function(t,n){for(var e=[],o=[],r=0,i=t.length;r<i;r++){var u=t[r];(n(u,r,t)?e:o).push(u)}return{pass:e,fail:o}}(n.map(function(t){return t.footerButtons}).getOr([]),function(t){return"start"===t.align}),o=function(t,n){return ob.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:P(n,function(t){return t.memento.asSpec()})})};return[o("start",e.pass),o("end",e.fail)]},HA=function(t,i){return{dom:dp('<div class="tox-dialog__footer"></div>'),components:[],behaviours:Lu([IT.config({channel:AA,initialData:t,updateState:function(t,n){var r=P(n.buttons,function(t){var n,e,o=vg((e=i,xk(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return et.some({lookupByName:function(t,n){return e=t,o=n,W(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:NA})])}},PA=function(t,n){return J_.parts().footer(HA(t,n))},zA=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=af.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return Uw.getField(o,e).fold(function(){var t=n.getFooter();return IT.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return et.some(t)})}return et.none()},LA=function(c,o){var t=function(t){var n=c.getRoot();n.getSystem().isConnected()&&t(n)},s={getData:function(){var t=c.getRoot(),n=t.getSystem().isConnected()?c.getFormWrapper():t;return _m.getValue(n)},setData:function(a){t(function(t){var n,e,o=s.getData(),r=yt(o,a),i=(n=r,e=c.getRoot(),IT.getState(e).get().map(function(t){return Cn(kn("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();_m.setValue(u,i)})},disable:function(t){zA(c,t).each(Yp.disable)},enable:function(t){zA(c,t).each(Yp.enable)},focus:function(t){zA(c,t).each(Rm.focus)},block:function(n){if(!C(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){zo(t,Cb,{message:n})})},unblock:function(){t(function(t){Po(t,Ob)})},showTab:function(e){t(function(t){var n=c.getBody();IT.getState(n).get().exists(function(t){return t.isTabPanel()})&&af.getCurrent(n).each(function(t){SA.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([BA],n),t.getSystem().broadcastOn([_A],n.internalDialog),t.getSystem().broadcastOn([DA],n.internalDialog),t.getSystem().broadcastOn([AA],n.internalDialog),s.setData(n.initialData)})},close:function(){t(function(t){Po(t,xb)})}};return s},jA=function(t){return hg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close"),title:t.translate("Close")}},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:'<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M17.953 7.453L13.422 12l4.531 4.547-1.406 1.406L12 13.422l-4.547 4.531-1.406-1.406L10.578 12 6.047 7.453l1.406-1.406L12 10.578l4.547-4.531z" fill-rule="evenodd"></path></svg>'}}],action:function(t){Po(t,wb)}})},UA=function(t,n,e){var o=function(t){return[ou(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:I({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:Lu([IT.config({channel:_A,renderComponents:o})])}},WA=function(){return{dom:dp('<div class="tox-dialog__draghandle"></div>')}},GA=function(t,n){return e={title:n.shared.providers.translate(t),draggable:n.dialog.isDraggableModal()},o=n.shared.providers,r=J_.parts().title(UA(e,et.none(),o)),i=J_.parts().draghandle(WA()),u=J_.parts().close(jA(o)),a=[r].concat(e.draggable?[i]:[]).concat([u]),ob.sketch({dom:dp('<div class="tox-dialog__header"></div>'),components:a});var e,o,r,i,u,a},XA=function(t,n){return{onClose:function(){return n.closeWindow()},onBlock:function(e){J_.setBusy(t(),function(t,n){return{dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":e.message()},styles:{left:"0px",right:"0px",bottom:"0px",top:"0px",position:"absolute"}},behaviours:n,components:[{dom:dp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){J_.setIdle(t())}}},YA=function(t,n,e,o){var r;return uu(J_.sketch({lazySink:o.shared.getSink,onEscape:function(t){return Po(t,wb),et.some(!0)},useTabstopAt:function(t){return!pS(t)},modalBehaviours:Lu([IT.config({channel:BA,updateState:function(t,n){return et.some(n)},initialData:n}),sS({}),Rm.config({}),Dm("execute-on-form",e.concat([vr(io(),function(t,n){fm.focusIn(t)})])),Dm("scroll-lock",[br(function(){Fi(er(),"tox-dialog__disable-scroll")}),yr(function(){Ii(er(),"tox-dialog__disable-scroll")})])].concat(t.extraBehaviours)),eventOrder:(r={},r[xo()]=["execute-on-form"],r[yo()]=["reflecting","receiving"],r[Do()]=["scroll-lock","reflecting","messages","execute-on-form","alloy.base.behaviour"],r[Ao()]=["alloy.base.behaviour","execute-on-form","messages","reflecting","scroll-lock"],r),dom:{tag:"div",classes:["tox-dialog"].concat(t.extraClasses),styles:I({position:"relative"},t.extraStyles)},components:[t.header,t.body].concat(t.footer.toArray()),dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:dp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}}))},qA=function(t,n,e){var o,r,i,u=GA(t.internalDialog.title,e),a=(o={body:t.internalDialog.body},r=e,i=MA(o,et.none(),r,!1),J_.parts().body(i)),c=PA({buttons:t.internalDialog.buttons},e),s=VA(function(){return m},XA(function(){return d},n)),l="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?["tox-dialog--width-lg"]:["tox-dialog--width-md"]:[],f={header:u,body:a,footer:et.some(c),extraClasses:l,extraBehaviours:[],extraStyles:{}},d=YA(f,t,s,e),m=LA({getRoot:function(){return d},getBody:function(){return J_.getBody(d)},getFooter:function(){return J_.getFooter(d)},getFormWrapper:function(){var t=J_.getBody(d);return af.getCurrent(t).getOr(t)}},n.redial);return{dialog:d,instanceApi:m}},KA=tinymce.util.Tools.resolve("tinymce.util.URI"),JA=["insertContent","setContent","execCommand","close","block","unblock"],$A=function(t){return O(t)&&-1!==JA.indexOf(t.mceAction)},QA=function(o,t,r,n){var e,i,u,a,c=GA(o.title,n),s=(i={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[vS({dom:{tag:"iframe",attributes:{src:o.url}},behaviours:Lu([Ly.config({}),Rm.config({})])})]}],behaviours:Lu([fm.config({mode:"acyclic",useTabstopAt:x(pS)})])},J_.parts().body(i)),l=o.buttons.bind(function(t){return 0===t.length?et.none():et.some(PA({buttons:t},n))}),f=RA(function(){return y},XA(function(){return b},t)),d=I({},o.height.fold(function(){return{}},function(t){return{height:t+"px","max-height":t+"px"}}),o.width.fold(function(){return{}},function(t){return{width:t+"px","max-width":t+"px"}})),m=o.width.isNone()&&o.height.isNone()?["tox-dialog--width-lg"]:[],g=new KA(o.url,{base_uri:new KA(M.window.location.href)}),p=g.protocol+"://"+g.host+(g.port?":"+g.port:""),h=ae(et.none()),v=[Dm("messages",[br(function(){var t=Vv(se.fromDom(M.window),"message",function(t){if(g.isSameOrigin(new KA(t.raw().origin))){var n=t.raw().data;$A(n)?function(t,n,e){switch(e.mceAction){case"insertContent":t.insertContent(e.content);break;case"setContent":t.setContent(e.content);break;case"execCommand":var o=!!E(e.ui)&&e.ui;t.execCommand(e.cmd,o,e.value);break;case"close":n.close();break;case"block":n.block(e.message);break;case"unblock":n.unblock()}}(r,y,n):!$A(e=n)&&O(e)&&gt(e,"mceAction")&&o.onMessage(y,n)}var e});h.set(et.some(t))}),yr(function(){h.get().each(function(t){return t.unbind()})})]),Ku.config({channels:(e={},e[FA]={onReceive:function(t,n){su(t.element(),"iframe").each(function(t){t.dom().contentWindow.postMessage(n,p)})}},e)})],b=YA({header:c,body:s,footer:l,extraClasses:m,extraBehaviours:v,extraStyles:d},o,f,n),y=(u=b,a=function(t){u.getSystem().isConnected()&&t(u)},{block:function(n){if(!C(n))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");a(function(t){zo(t,Cb,{message:n})})},unblock:function(){a(function(t){Po(t,Ob)})},close:function(){a(function(t){Po(t,xb)})},sendMessage:function(n){a(function(t){t.getSystem().broadcastOn([FA],n)})}});return{dialog:b,instanceApi:y}},ZA=function(t,n,e,o){var r,i,u,a,c,s,l,f,d,m,g=ti("dialog-label"),p=ti("dialog-content"),h=vg((u={title:t.internalDialog.title,draggable:!0},a=g,c=e.shared.providers,ob.sketch({dom:dp('<div class="tox-dialog__header"></div>'),components:[UA(u,et.some(a),c),WA(),jA(c)],containerBehaviours:Lu([I_.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return lu(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),v=vg((s={body:t.internalDialog.body},l=p,f=e,d=o,MA(s,et.some(l),f,d))),b=vg((m={buttons:t.internalDialog.buttons},HA(m,e))),y=VA(function(){return w},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),x=uu({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline"],attributes:(r={role:"dialog"},r["aria-labelledby"]=g,r["aria-describedby"]=""+p,r)},eventOrder:(i={},i[yo()]=[IT.name(),Ku.name()],i[xo()]=["execute-on-form"],i[Do()]=["reflecting","execute-on-form"],i),behaviours:Lu([fm.config({mode:"cyclic",onEscape:function(t){return Po(t,xb),et.some(!0)},useTabstopAt:function(t){return!pS(t)&&("button"!==$o(t)||"disabled"!==Gr(t,"disabled"))}}),IT.config({channel:BA,updateState:function(t,n){return et.some(n)},initialData:t}),Rm.config({}),Dm("execute-on-form",y.concat([vr(io(),function(t,n){fm.focusIn(t)})])),sS({})]),components:[h.asSpec(),v.asSpec(),b.asSpec()]}),w=LA({getRoot:function(){return x},getFooter:function(){return b.get(x)},getBody:function(){return v.get(x)},getFormWrapper:function(){var t=v.get(x);return af.getCurrent(t).getOr(t)}},n.redial);return{dialog:x,instanceApi:w}},tF={dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]}},nF={dom:{tag:"div",classes:["tox-dialog__header"]}},eF=function(t,n){return J_.parts().close(hg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:Lu([Ly.config({})])}))},oF=function(){return J_.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},rF=function(t,n){return J_.parts().body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:dp("<p>"+n.translate(t)+"</p>")}]}]})},iF=function(t){return J_.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},uF=function(t,n){return[ob.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),ob.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},aF=function(e){return J_.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),et.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(e.extraClasses)},components:[bt(e.headerOverride.getOr(nF),{components:[e.partSpecs.title,e.partSpecs.close]}),e.partSpecs.body,e.partSpecs.footer],parts:{blocker:{dom:dp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:Lu([Dm("basic-dialog-events",[fr(wb,function(t,n){e.onCancel()}),fr(kb,function(t,n){e.onSubmit()})])])})},cF=function(s){var u,a,c,l,e=(a=(u=s).backstage.shared,{open:function(t,n){var e=function(){J_.hide(r),n()},o=vg(xk({name:"close-alert",text:"OK",primary:!0,align:"end",disabled:!1,icon:et.none()},"cancel",u.backstage)),r=uu(aF({lazySink:function(){return a.getSink()},headerOverride:et.some(tF),partSpecs:{title:oF(),close:eF(function(){e()},a.providers),body:rF(t,a.providers),footer:iF(uF([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:tt,extraClasses:["tox-alert-dialog"]}));J_.show(r);var i=o.get(r);Rm.focus(i)}}),o=(l=(c=s).backstage.shared,{open:function(t,n){var e=function(t){J_.hide(i),n(t)},o=vg(xk({name:"yes",text:"Yes",primary:!0,align:"end",disabled:!1,icon:et.none()},"submit",c.backstage)),r=xk({name:"no",text:"No",primary:!0,align:"end",disabled:!1,icon:et.none()},"cancel",c.backstage),i=uu(aF({lazySink:function(){return l.getSink()},headerOverride:et.some(tF),partSpecs:{title:oF(),close:eF(function(){e(!1)},l.providers),body:rF(t,l.providers),footer:iF(uF([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));J_.show(i);var u=o.get(i);Rm.focus(u)}}),r=function(t,e){return lA.openUrl(function(t){var n=QA(t,{closeWindow:function(){J_.hide(n.dialog),e(n.instanceApi)}},s.editor,s.backstage);return J_.show(n.dialog),n.instanceApi},t)},i=function(t,i){return lA.open(function(t,n,e){var o=n,r=qA({dataValidator:e,initialData:o,internalDialog:t},{redial:lA.redial,closeWindow:function(){J_.hide(r.dialog),i(r.instanceApi)}},s.backstage);return J_.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},f=function(t,u,a,c){return lA.open(function(t,n,e){var o=Cn(kn("data",e,n)),r=ZA({dataValidator:e,initialData:o,internalDialog:t},{redial:lA.redial,closeWindow:function(){gg.hide(i),a(r.instanceApi)}},s.backstage,c),i=uu(gg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:Lu([Dm("window-manager-inline-events",[fr(Fo(),function(t,n){Po(r.dialog,wb)})])])}));return gg.showAt(i,u,au(r.dialog)),r.instanceApi.setData(o),fm.focusIn(r.dialog),r.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?f(t,s.backstage.shared.anchors.toolbar(),e,n.ariaAttrs):n!==undefined&&"cursor"===n.inline?f(t,s.backstage.shared.anchors.cursor(),e,n.ariaAttrs):i(t,e)},openUrl:function(t,n){return r(t,n)},alert:function(t,n){e.open(t,function(){n()})},close:function(t){t.close()},confirm:function(t,n){o.open(t,function(t){n(t)})}}};!function bF(){e.add("silver",function(t){var n=G_(t),e=n.uiMothership,o=n.backstage,r=n.renderUI,i=n.getUi;Av(t,o.shared);var u=cF({editor:t,backstage:o});return{renderUI:r,getWindowManagerImpl:nt(u),getNotificationManagerImpl:function(){return kg(t,{backstage:o},e)},ui:i()}})}()}(window);