(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["app~b3729c41"],{"8d29":function(n,t,e){(function(n){e("d9e2"),e("14d9"),e("3c65"),e("130f"),e("907a"),e("986a"),e("1d02"),e("3c5d"),e("1b3b"),e("3d71"),e("c6e3"),function(t){"use strict";var e=function(){},o=function(n){return function(){return n()}},r=function(n,t){return function(){for(var e=[],o=0;o-1},L=function(n,t){for(var e=0,o=n.length;e=0;e--){var o=n[e];t(o,e)}},Y=function(n,t){for(var e=[],o=[],r=0,i=n.length;r0?$n(e.errors):Jn(e.values,t)},Zn=function(n,t){return zn(n,t)};(function(n){n[n["Error"]=0]="Error",n[n["Value"]=1]="Value"})(v||(v={}));var nt=function(n,t,e){return n.stype===v.Error?t(n.serror):e(n.svalue)},tt=function(n){var t=[],e=[];return G(n,(function(n){nt(n,(function(n){return e.push(n)}),(function(n){return t.push(n)}))})),{values:t,errors:e}},et=function(n,t){return n.stype===v.Error?{stype:v.Error,serror:t(n.serror)}:n},ot=function(n,t){return n.stype===v.Value?{stype:v.Value,svalue:t(n.svalue)}:n},rt=function(n,t){return n.stype===v.Value?t(n.svalue):n},it=function(n,t){return n.stype===v.Error?t(n.serror):n},ut=function(n){return{stype:v.Value,svalue:n}},at=function(n){return{stype:v.Error,serror:n}},ct=function(n){return nt(n,O.error,O.value)},st=function(n){return n.fold(at,ut)},ft={fromResult:st,toResult:ct,svalue:ut,partition:tt,serror:at,bind:rt,bindError:it,map:ot,mapError:et,fold:nt},lt=function(n,t){return n.length>0?ft.svalue(Tn(t,En.apply(void 0,n))):ft.svalue(t)},dt=function(n){return r(ft.serror,Z)(n)},mt=function(n,t){var e=ft.partition(n);return e.errors.length>0?dt(e.errors):lt(e.values,t)},gt=function(n){var t=ft.partition(n);return t.errors.length>0?dt(t.errors):ft.svalue(t.values)},pt={consolidateObj:mt,consolidateArr:gt},vt=wn.generate([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),ht=wn.generate([{field:["name","presence","type"]},{state:["name"]}]),bt=function(n){return D(n)&&fn(n).length>100?" removed due to size":JSON.stringify(n,null,2)},yt=function(n){var t=n.length>10?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n;return W(t,(function(n){return"Failed path: ("+n.path.join(" > ")+")\n"+n.getErrorInfo()}))},xt=function(n,t){return ft.serror([{path:n,getErrorInfo:t}])},wt=function(n,t,e){return xt(n,(function(){return'Could not find valid *strict* value for "'+t+'" in '+bt(e)}))},St=function(n,t){return xt(n,(function(){return'Choice schema did not contain choice key: "'+t+'"'}))},Ct=function(n,t,e){return xt(n,(function(){return'The chosen schema: "'+e+'" did not exist in branches: '+bt(t)}))},kt=function(n,t){return xt(n,(function(){return"There are unsupported fields: ["+t.join(", ")+"] specified"}))},Ot=function(n,t){return xt(n,(function(){return t}))},Tt=wn.generate([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),Et=function(n,t,e){return Pn(t,e).fold((function(){return wt(n,e,t)}),ft.svalue)},Bt=function(n,t,e){var o=Pn(n,t).fold((function(){return e(n)}),u);return ft.svalue(o)},Dt=function(n,t){return ft.svalue(Pn(n,t))},At=function(n,t,e){var o=Pn(n,t).map((function(t){return!0===t?e(n):t}));return ft.svalue(o)},_t=function(n,t,e,o){return e.fold((function(e,r,u,a){var c=function(t){var i=a.extract(n.concat([e]),o,t);return ft.map(i,(function(n){return Ln(r,o(n))}))},s=function(t){return t.fold((function(){var n=Ln(r,o(w.none()));return ft.svalue(n)}),(function(t){var i=a.extract(n.concat([e]),o,t);return ft.map(i,(function(n){return Ln(r,o(w.some(n)))}))}))};return function(){return u.fold((function(){return ft.bind(Et(n,t,e),c)}),(function(n){return ft.bind(Bt(t,e,n),c)}),(function(){return ft.bind(Dt(t,e),s)}),(function(n){return ft.bind(At(t,e,n),s)}),(function(n){var o=n(t),r=ft.map(Bt(t,e,i({})),(function(n){return Tn(o,n)}));return ft.bind(r,c)}))}()}),(function(n,e){var r=e(t);return ft.svalue(Ln(n,o(r)))}))},Mt=function(n,t,e,o){var r=W(e,(function(e){return _t(n,t,e,o)}));return pt.consolidateObj(r,{})},Ft=function(n){var t=function(t,e,o){return n().extract(t,e,o)},e=function(){return n().toString()},o=function(){return n().toDsl()};return{extract:t,toString:e,toDsl:o}},It=function(n){var t=function(t,e,o){return ft.bindError(n(o,e),(function(n){return Ot(t,n)}))},e=function(){return"val"},o=function(){return vt.itemOf(n)};return{extract:t,toString:e,toDsl:o}},Rt=function(n){var t=fn(n);return q(t,(function(t){return Zn(n,t)}))},Nt=function(n){var t=Vt(n),e=K(n,(function(n,t){return t.fold((function(t){return Tn(n,qn(t,!0))}),i(n))}),{}),o=function(n,o,r){var i=_(r)?[]:Rt(r),u=q(i,(function(n){return!Zn(e,n)}));return 0===u.length?t.extract(n,o,r):kt(n,u)};return{extract:o,toString:t.toString,toDsl:t.toDsl}},Vt=function(n){var t=function(t,e,o){return Mt(t,o,n,e)},e=function(){var t=W(n,(function(n){return n.fold((function(n,t,e,o){return n+" -> "+o.toString()}),(function(n,t){return"state("+n+")"}))}));return"obj{\n"+t.join("\n")+"}"},o=function(){return vt.objOf(W(n,(function(n){return n.fold((function(n,t,e,o){return ht.field(n,e,o)}),(function(n,t){return ht.state(n)}))})))};return{extract:t,toString:e,toDsl:o}},Ht=function(n){var t=function(t,e,o){var r=W(o,(function(o,r){return n.extract(t.concat(["["+r+"]"]),e,o)}));return pt.consolidateArr(r)},e=function(){return"array("+n.toString()+")"},o=function(){return vt.arrOf(n)};return{extract:t,toString:e,toDsl:o}},Pt=function(n,t){var e=function(t,e){return Ht(It(n)).extract(t,u,e)},o=function(n,o,r){var i=fn(r),u=e(n,i);return ft.bind(u,(function(e){var i=W(e,(function(n){return Tt.field(n,n,Mn(),t)}));return Vt(i).extract(n,o,r)}))},r=function(){return"setOf("+t.toString()+")"},i=function(){return vt.setOf(n,t)};return{extract:o,toString:r,toDsl:i}},zt=i(It(ft.svalue)),Lt=r(Ht,Vt),jt=Tt.state,Ut=Tt.field,Wt=function(n,t,e,o,r){var i=Yn(o,r);return i.fold((function(){return Ct(n,o,r)}),(function(o){return o.extract(n.concat(["branch: "+r]),t,e)}))},Gt=function(n,t){var e=function(e,o,r){var i=Yn(r,n);return i.fold((function(){return St(e,n)}),(function(n){return Wt(e,o,r,t,n)}))},o=function(){return"chooseOn("+n+"). Possible values: "+fn(t)},r=function(){return vt.choiceOf(n,t)};return{extract:e,toString:o,toDsl:r}},Xt=It(ft.svalue),Yt=function(n){return Lt(n)},qt=function(){return Ht(Xt)},Kt=Ft,Jt=function(n){return It((function(t){return n(t).fold(ft.serror,ft.svalue)}))},$t=function(n,t){return Pt((function(t){return ft.fromResult(n(t))}),t)},Qt=function(n,t,e,o){var r=t.extract([n],e,o);return ft.mapError(r,(function(n){return{input:o,errors:n}}))},Zt=function(n,t,e){return ft.toResult(Qt(n,t,u,e))},ne=function(n){return n.fold((function(n){throw new Error(ee(n))}),u)},te=function(n,t,e){return ne(Zt(n,t,e))},ee=function(n){return"Errors: \n"+yt(n.errors)+"\n\nInput object: "+bt(n.input)},oe=function(n,t){return Gt(n,t)},re=function(n,t){return Gt(n,mn(t,Vt))},ie=i(Xt),ue=function(n,t){return It((function(e){var o=typeof e;return n(e)?ft.svalue(e):ft.serror("Expected type: "+t+" but got: "+o)}))},ae=ue(F,"number"),ce=ue(B,"string"),se=ue(_,"boolean"),fe=ue(M,"function"),le=function(n){var t=function(n,t){var e=n.next();while(!e.done){if(!t(e.value))return!1;e=n.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 le(n[t])}));case"Map":return t(n.keys(),le)&&t(n.values(),le);case"Set":return t(n.keys(),le);default:return!1}},de=It((function(n){return le(n)?ft.svalue(n):ft.serror("Expected value to be acceptable for sending via postMessage")})),me=function(n){return Jt((function(t){return z(n,t)?O.value(t):O.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')}))},ge=function(n){return Ut(n,n,Mn(),zt())},pe=function(n,t){return Ut(n,n,Mn(),t)},ve=function(n){return pe(n,ae)},he=function(n){return pe(n,ce)},be=function(n,t){return Ut(n,n,Mn(),me(t))},ye=function(n){return pe(n,se)},xe=function(n){return pe(n,fe)},we=function(n,t){return Ut(n,n,Fn(),It((function(e){return ft.serror("The field: "+n+" is forbidden. "+t)})))},Se=function(n,t){return Ut(n,n,Mn(),Vt(t))},Ce=function(n,t){return Ut(n,n,Mn(),Lt(t))},ke=function(n,t){return Ut(n,n,Mn(),Ht(t))},Oe=function(n){return Ut(n,n,Fn(),zt())},Te=function(n,t){return Ut(n,n,Fn(),t)},Ee=function(n){return Te(n,ae)},Be=function(n){return Te(n,ce)},De=function(n){return Te(n,fe)},Ae=function(n,t){return Te(n,Ht(t))},_e=function(n,t){return Te(n,Vt(t))},Me=function(n,t){return Te(n,Nt(t))},Fe=function(n,t){return Ut(n,n,An(t),zt())},Ie=function(n,t,e){return Ut(n,n,An(t),e)},Re=function(n,t){return Ie(n,t,ae)},Ne=function(n,t){return Ie(n,t,ce)},Ve=function(n,t,e){return Ie(n,t,me(e))},He=function(n,t){return Ie(n,t,se)},Pe=function(n,t){return Ie(n,t,fe)},ze=function(n,t){return Ie(n,t,de)},Le=function(n,t,e){return Ie(n,t,Ht(e))},je=function(n,t,e){return Ie(n,t,Vt(e))},Ue=function(n,t){return jt(n,t)},We=function(n){var t=n,e=function(){return t},o=function(n){t=n},r=function(){return We(e())};return{get:e,set:o,clone:r}},Ge=function(n,e){var o=e||t.document,r=o.createElement("div");if(r.innerHTML=n,!r.hasChildNodes()||r.childNodes.length>1)throw t.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return qe(r.childNodes[0])},Xe=function(n,e){var o=e||t.document,r=o.createElement(n);return qe(r)},Ye=function(n,e){var o=e||t.document,r=o.createTextNode(n);return qe(r)},qe=function(n){if(null===n||void 0===n)throw new Error("Node cannot be null or undefined");return{dom:i(n)}},Ke=function(n,t,e){var o=n.dom();return w.from(o.elementFromPoint(t,e)).map(qe)},Je={fromHtml:Ge,fromTag:Xe,fromText:Ye,fromDom:qe,fromPoint:Ke},$e=function(n,t,e){return 0!==(n.compareDocumentPosition(t)&e)},Qe=function(n,e){return $e(n,e,t.Node.DOCUMENT_POSITION_PRECEDING)},Ze=function(n,e){return $e(n,e,t.Node.DOCUMENT_POSITION_CONTAINED_BY)},no={documentPositionPreceding:Qe,documentPositionContainedBy:Ze},to=function(n,t){for(var e=0;e0&&Wi(a);var c={};return G(n,(function(n){c[n]=i(o[n])})),G(t,(function(n){c[n]=i(Object.prototype.hasOwnProperty.call(o,n)?w.some(o[n]):w.none())})),c}},qi=function(n){return Je.fromDom(n.dom().ownerDocument)},Ki=function(n){return Je.fromDom(n.dom().ownerDocument.documentElement)},Ji=function(n){return Je.fromDom(n.dom().ownerDocument.defaultView)},$i=function(n){return w.from(n.dom().parentNode).map(Je.fromDom)},Qi=function(n){return w.from(n.dom().offsetParent).map(Je.fromDom)},Zi=function(n){return w.from(n.dom().nextSibling).map(Je.fromDom)},nu=function(n){return W(n.dom().childNodes,Je.fromDom)},tu=function(n,t){var e=n.dom().childNodes;return w.from(e[t]).map(Je.fromDom)},eu=function(n){return tu(n,0)},ou=(Li("element","offset"),function(n,e){var o=e||t.document,r=o.createElement("div");return r.innerHTML=n,nu(Je.fromDom(r))}),ru=function(n,t){var e=$i(n);e.each((function(e){e.dom().insertBefore(t.dom(),n.dom())}))},iu=function(n,t){var e=Zi(n);e.fold((function(){var e=$i(n);e.each((function(n){au(n,t)}))}),(function(n){ru(n,t)}))},uu=function(n,t){var e=eu(n);e.fold((function(){au(n,t)}),(function(e){n.dom().insertBefore(t.dom(),e.dom())}))},au=function(n,t){n.dom().appendChild(t.dom())},cu=function(n,t,e){tu(n,e).fold((function(){au(n,t)}),(function(n){ru(n,t)}))},su=function(n,t){G(t,(function(t){ru(n,t)}))},fu=function(n,t){G(t,(function(t){au(n,t)}))},lu=function(n){n.dom().textContent="",G(nu(n),(function(n){du(n)}))},du=function(n){var t=n.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},mu=function(n){var t=nu(n);t.length>0&&su(n,t),du(n)},gu=function(n){return n.dom().innerHTML},pu=function(n,t){var e=qi(n),o=e.dom(),r=Je.fromDom(o.createDocumentFragment()),i=ou(t,o);fu(r,i),lu(n),au(n,r)},vu=function(n){var t=Je.fromTag("div"),e=Je.fromDom(n.dom().cloneNode(!0));return au(t,e),gu(t)},hu=function(n,e,o){if(!(B(o)||_(o)||F(o)))throw t.console.error("Invalid call to Attr.set. Key ",e,":: Value ",o,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(e,o+"")},bu=function(n,t,e){hu(n.dom(),t,e)},yu=function(n,t){var e=n.dom();dn(t,(function(n,t){hu(e,t,n)}))},xu=function(n,t){var e=n.dom().getAttribute(t);return null===e?void 0:e},wu=function(n,t){var e=n.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(t)},Su=function(n,t){n.dom().removeAttribute(t)},Cu=function(n,t){return Je.fromDom(n.dom().cloneNode(t))},ku=function(n){return Cu(n,!1)},Ou=function(n){var t=ku(n);return vu(t)},Tu=function(n){return Ou(n)},Eu=function(n,t,e){return or(t,n.element())&&!or(t,e)},Bu=Ci([Oi(Mr(),(function(n,e){var o=e.event().originator(),r=e.event().target();return!Eu(n,o,r)||(t.console.warn(Mr()+" did not get interpreted by the desired target. \nOriginator: "+Tu(o)+"\nTarget: "+Tu(r)+"\nCheck the "+Mr()+" event handlers"),!1)}))]),Du=Object.freeze({events:Bu}),Au=0,_u=function(n){var t=new Date,e=t.getTime(),o=Math.floor(1e9*Math.random());return Au++,n+"_"+o+Au+String(e)},Mu=i("alloy-id-"),Fu=i("data-alloy-id"),Iu=Mu(),Ru=Fu(),Nu=function(n,t){var e=_u(Iu+n);return Vu(t,e),e},Vu=function(n,t){Object.defineProperty(n.dom(),Ru,{value:t,writable:!0})},Hu=function(n){var t=gi(n)?n.dom()[Ru]:null;return w.from(t)},Pu=function(n){return _u(n)},zu=u,Lu=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+Tu(n().element())+" is not in context.")}};return{debugInfo:i("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:i(!1)}},ju=Lu(),Uu=function(n,t,e){var o=e.toString(),r=o.indexOf(")")+1,i=o.indexOf("("),u=o.substring(i+1,r-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:t,parameters:Wu(u.slice(0,1).concat(u.slice(3)))}},n},Wu=function(n){return W(n,(function(n){return No(n,"/*")?n.substring(0,n.length-"/*".length):n}))},Gu=function(n,t){var e=n.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:t,parameters:Wu(i)}},n},Xu=function(n,t){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:Wu(i.slice(1))}},n},Yu=_u("alloy-premade"),qu=function(n){return qn(Yu,n)},Ku=function(n){return Yn(n,Yu)},Ju=function(n){return Xu((function(t){for(var e=[],o=1;o1?q(t[e],(function(t){return L(n,(function(n){return n.name()===t}))})).join(" > "):n[0].name();return qn(e,aa(r,i))}))}));return Qn(e,{})},ya=function(n){return Zt("custom.definition",Vt([Ut("dom","dom",Mn(),Vt([ge("tag"),Fe("styles",{}),Fe("classes",[]),Fe("attributes",{}),Oe("value"),Oe("innerHtml")])),ge("components"),ge("uid"),Fe("events",{}),Fe("apis",{}),Ut("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"]}),ie()),Oe("domModification")]),n)},xa=function(n){return m(m({},n.dom),{uid:n.uid,domChildren:W(n.components,(function(n){return n.element()}))})},wa=function(n){return n.domModification.fold((function(){return oa({})}),oa)},Sa=function(n){return n.events},Ca=function(n,t){var e=xu(n,t);return void 0===e||""===e?[]:e.split(" ")},ka=function(n,t,e){var o=Ca(n,t),r=o.concat([e]);return bu(n,t,r.join(" ")),!0},Oa=function(n,t,e){var o=q(Ca(n,t),(function(n){return n!==e}));return o.length>0?bu(n,t,o.join(" ")):Su(n,t),!1},Ta=function(n){return void 0!==n.dom().classList},Ea=function(n){return Ca(n,"class")},Ba=function(n,t){return ka(n,"class",t)},Da=function(n,t){return Oa(n,"class",t)},Aa=function(n,t){Ta(n)?n.dom().classList.add(t):Ba(n,t)},_a=function(n){var t=Ta(n)?n.dom().classList:Ea(n);0===t.length&&Su(n,"class")},Ma=function(n,t){if(Ta(n)){var e=n.dom().classList;e.remove(t)}else Da(n,t);_a(n)},Fa=function(n,t){return Ta(n)&&n.dom().classList.contains(t)},Ia=function(n,t){G(t,(function(t){Aa(n,t)}))},Ra=function(n,t){G(t,(function(t){Ma(n,t)}))},Na=function(n){return void 0!==n.style&&M(n.style.getPropertyValue)},Va=function(n,e,o){if(!B(o))throw t.console.error("Invalid call to CSS.set. Property ",e,":: Value ",o,":: Element ",n),new Error("CSS value must be a string: "+o);Na(n)&&n.style.setProperty(e,o)},Ha=function(n,t){Na(n)&&n.style.removeProperty(t)},Pa=function(n,t,e){var o=n.dom();Va(o,t,e)},za=function(n,t){var e=n.dom();dn(t,(function(n,t){Va(e,t,n)}))},La=function(n,t){var e=n.dom();dn(t,(function(n,t){n.fold((function(){Ha(e,t)}),(function(n){Va(e,t,n)}))}))},ja=function(n,e){var o=n.dom(),r=t.window.getComputedStyle(o),i=r.getPropertyValue(e),u=""!==i||vi(n)?i:Ua(o,e);return null===u?void 0:u},Ua=function(n,t){return Na(n)?n.style.getPropertyValue(t):""},Wa=function(n,t){var e=n.dom(),o=Ua(e,t);return w.from(o).filter((function(n){return n.length>0}))},Ga=function(n,t,e){var o=Je.fromTag(n);Pa(o,t,e);var r=Wa(o,t);return r.isSome()},Xa=function(n,t){var e=n.dom();Ha(e,t),wu(n,"style")&&""===Vo(xu(n,"style"))&&Su(n,"style")},Ya=function(n){return n.dom().offsetWidth},qa=function(n){return n.dom().value},Ka=function(n,t){if(void 0===t)throw new Error("Value.set was undefined");n.dom().value=t},Ja=function(n){var t=Je.fromTag(n.tag);yu(t,n.attributes),Ia(t,n.classes),za(t,n.styles),n.innerHtml.each((function(n){return pu(t,n)}));var e=n.domChildren;return fu(t,e),n.value.each((function(n){Ka(t,n)})),n.uid,Vu(t,n.uid),t},$a=function(n){var t=Xn("behaviours",{})(n),e=q(fn(t),(function(n){return void 0!==t[n]}));return W(e,(function(n){return t[n].me}))},Qa=function(n,t){return Zu(n,t)},Za=function(n){var t=$a(n);return Qa(n,t)},nc=function(n,t,e){var o=xa(n),r=wa(n),i={"alloy.base.modification":r},u=t.length>0?ia(e,i,t,o):r;return ra(o,u)},tc=function(n,t,e){var o={"alloy.base.behaviour":Sa(n)};return ga(e,n.eventOrder,t,o).getOrDie()},ec=function(n){var t=function(){return y},e=We(ju),o=ne(ya(n)),r=Za(n),u=na(r),a=ta(r),c=nc(o,u,a),s=Ja(c),f=tc(o,u,a),l=We(o.components),d=function(n){e.set(n)},m=function(){e.set(Lu(t))},g=function(){var n=nu(s),t=nn(n,(function(n){return e.get().getByDom(n).fold((function(){return[]}),(function(n){return[n]}))}));l.set(t)},p=function(t){var e=a,o=M(e[t.name()])?e[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+JSON.stringify(n,null,2))};return o()},v=function(n){return M(a[n.name()])},h=function(){return o.apis},b=function(n){return a[n]().map((function(n){return n.state.readState()})).getOr("not enabled")},y={getSystem:e.get,config:p,hasConfigured:v,spec:i(n),readState:b,getApis:h,connect:d,disconnect:m,element:i(s),syncComponents:g,components:l.get,events:i(f)};return y},oc=function(n){var t=Xn("components",[])(n);return W(t,cc)},rc=function(n){var t=zu(n),e=t.events,o=g(t,["events"]),r=oc(o),i=m(m({},o),{events:m(m({},Du),e),components:r});return O.value(ec(i))},ic=function(n){var t=Je.fromText(n);return uc({element:t})},uc=function(n){var t=te("external.component",Nt([ge("element"),Oe("uid")]),n),o=We(Lu()),r=function(n){o.set(n)},u=function(){o.set(Lu((function(){return a})))};t.uid.each((function(n){Vu(t.element,n)}));var a={getSystem:o.get,config:w.none,hasConfigured:i(!1),connect:r,disconnect:u,getApis:function(){return{}},element:i(t.element),spec:i(n),readState:i("No state"),syncComponents:e,components:i([]),events:i({})};return qu(a)},ac=Pu,cc=function(n){return Ku(n).fold((function(){var t=n.hasOwnProperty("uid")?n:m({uid:ac("")},n);return rc(t).getOrDie()}),(function(n){return n}))},sc=qu;function fc(n,t){var e=function(t,e){if(!F(e)&&!e.match(/^[0-9]+$/))throw new Error(n+".set accepts only positive integer values. Value was "+e);var o=t.dom();Na(o)&&(o.style[n]=e+"px")},o=function(e){var o=t(e);if(o<=0||null===o){var r=ja(e,n);return parseFloat(r)||0}return o},r=o,i=function(n,t){return J(t,(function(t,e){var o=ja(n,e),r=void 0===o?0:parseInt(o,10);return isNaN(r)?t:t+r}),0)},u=function(n,t,e){var o=i(n,e),r=t>o?t-o:0;return r};return{set:e,get:o,getOuter:r,aggregate:i,max:u}}var lc,dc=fc("height",(function(n){var t=n.dom();return vi(n)?t.getBoundingClientRect().height:t.offsetHeight})),mc=function(n){return dc.get(n)},gc=function(n){return dc.getOuter(n)},pc=function(n,t){var e=["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"],o=dc.max(n,t,e);Pa(n,"max-height",o+"px")},vc=function(n,t){var e=function(e,o){return vc(n+e,t+o)};return{left:i(n),top:i(t),translate:e}},hc=vc,bc=function(n){var t=n.getBoundingClientRect();return hc(t.left,t.top)},yc=function(n,t){return void 0!==n?n:void 0!==t?t:0},xc=function(n){var t=n.dom().ownerDocument,e=t.body,o=t.defaultView,r=t.documentElement;if(e===n.dom())return hc(e.offsetLeft,e.offsetTop);var i=yc(o.pageYOffset,r.scrollTop),u=yc(o.pageXOffset,r.scrollLeft),a=yc(r.clientTop,e.clientTop),c=yc(r.clientLeft,e.clientLeft);return wc(n).translate(u-c,i-a)},wc=function(n){var t=n.dom(),e=t.ownerDocument,o=e.body;return o===t?hc(o.offsetLeft,o.offsetTop):vi(n)?bc(t):hc(0,0)},Sc=fc("width",(function(n){return n.dom().offsetWidth})),Cc=function(n,t){Sc.set(n,t)},kc=function(n){return Sc.get(n)},Oc=function(n){return Sc.getOuter(n)},Tc=function(n,t){var e=["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"],o=Sc.max(n,t,e);Pa(n,"max-width",o+"px")},Ec=(Yo().browser.isSafari(),function(n){var e=void 0!==n?n.dom():t.document,o=e.body.scrollLeft||e.documentElement.scrollLeft,r=e.body.scrollTop||e.documentElement.scrollTop;return hc(o,r)}),Bc=function(n,t,e,o){return{x:i(n),y:i(t),width:i(e),height:i(o),right:i(n+e),bottom:i(t+o)}},Dc=function(n){var e=void 0===n?t.window:n,o=e["visualViewport"];if(void 0!==o)return Bc(o.pageLeft,o.pageTop,o.width,o.height);var r=Je.fromDom(e.document),i=e.document.documentElement,u=Ec(r),a=i.clientWidth,c=i.clientHeight;return Bc(u.left(),u.top(),a,c)},Ac=function(n,t){var e=n.view(t);return e.fold(i([]),(function(t){var e=n.owner(t),o=Ac(n,e);return[t].concat(o)}))},_c=function(n,t){var e=t.owner(n),o=Ac(t,e);return w.some(o)},Mc=function(n){var e=n.dom()===t.document?w.none():w.from(n.dom().defaultView.frameElement);return e.map(Je.fromDom)},Fc=function(n){return qi(n)},Ic=Object.freeze({view:Mc,owner:Fc}),Rc=function(n){var e=Je.fromDom(t.document),o=Ec(e),r=_c(n,Ic);return r.fold(a(xc,n),(function(t){var e=wc(n),r=K(t,(function(n,t){var e=wc(t);return{left:n.left+e.left(),top:n.top+e.top()}}),{left:0,top:0});return hc(r.left+e.left()+o.left(),r.top+e.top()+o.top())}))},Nc=Li("point","width","height"),Vc=Li("x","y","width","height"),Hc=function(n,t,e,o){return{x:i(n),y:i(t),width:i(e),height:i(o),right:i(n+e),bottom:i(t+o)}},Pc=function(n){var t=xc(n),e=Oc(n),o=gc(n);return Hc(t.left(),t.top(),e,o)},zc=function(n){var t=Rc(n),e=Oc(n),o=gc(n);return Hc(t.left(),t.top(),e,o)},Lc=function(){return Dc(t.window)},jc=function(n,t,e){return xi(n,t,e).isSome()},Uc=function(n,t,e){return yi(n,(function(n){return Zo(n,t)}),e)},Wc=function(n,t){return er(t,n)},Gc=function(n,t,e){return fi(Zo,Uc,n,t,e)},Xc=function(n){var t=xi(n,(function(n){if(!gi(n))return!1;var t=xu(n,"id");return void 0!==t&&t.indexOf("aria-owns")>-1}));return t.bind((function(n){var t=xu(n,"id"),e=qi(n);return Wc(e,'[aria-owns="'+t+'"]')}))},Yc=function(){var n=_u("aria-owns"),t=function(t){bu(t,"aria-owns",n)},e=function(n){Su(n,"aria-owns")};return{id:i(n),link:t,unlink:e}},qc=function(n,t){return Xc(t).exists((function(t){return Kc(n,t)}))},Kc=function(n,t){return jc(t,(function(t){return or(t,n.element())}),i(!1))||qc(n,t)},Jc=function(n){for(var t=[],e=function(n){t.push(n)},o=0;o-1?w.some(ts.get()[t]):w.none()}))})).getOr(lc.NORMAL);switch(o){case lc.NORMAL:return e(cs());case lc.LOGGING:var r=es(n,t),i=e(r);return r.write(),i;case lc.STOP:return!0}},rs=["alloy/data/Fields","alloy/debugging/Debugging"],is=function(){var n=new Error;if(void 0!==n.stack){var t=n.stack.split("\n");return $(t,(function(n){return n.indexOf("alloy")>0&&!L(rs,(function(t){return n.indexOf(t)>-1}))})).getOr(ns)}return ns},us={logEventCut:e,logEventStopped:e,logNoParent:e,logEventNoHandlers:e,logEventResponse:e,write:e},as=function(n,t,e){return os(n,t,e)},cs=i(us),ss=i([ge("menu"),ge("selectedMenu")]),fs=i([ge("item"),ge("selectedItem")]),ls=(i(Vt(fs().concat(ss()))),i(Vt(fs()))),ds=Se("initSize",[ge("numColumns"),ge("numRows")]),ms=function(){return pe("markers",ls())},gs=function(){return Se("markers",[ge("backgroundMenu")].concat(ss()).concat(fs()))},ps=function(n){return Se("markers",W(n,ge))},vs=function(n,t,e){is();return Ut(t,t,e,Jt((function(n){return O.value((function(){for(var t=[],e=0;e0?t[0]:n.getBoundingClientRect();return e.width>0||e.height>0?w.some(e).map(Sl):w.none()},kl=wn.generate([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Ol=function(n,t,e){return t(Je.fromDom(e.startContainer),e.startOffset,Je.fromDom(e.endContainer),e.endOffset)},Tl=function(n,t){return t.match({domRange:function(n){return{ltr:i(n),rtl:w.none}},relative:function(t,e){return{ltr:Bn((function(){return xl(n,t,e)})),rtl:Bn((function(){return w.some(xl(n,e,t))}))}},exact:function(t,e,o,r){return{ltr:Bn((function(){return wl(n,t,e,o,r)})),rtl:Bn((function(){return w.some(wl(n,o,r,t,e))}))}}})},El=function(n,t){var e=t.ltr();if(e.collapsed){var o=t.rtl().filter((function(n){return!1===n.collapsed}));return o.map((function(n){return kl.rtl(Je.fromDom(n.endContainer),n.endOffset,Je.fromDom(n.startContainer),n.startOffset)})).getOrThunk((function(){return Ol(n,kl.ltr,e)}))}return Ol(n,kl.ltr,e)},Bl=function(n,t){var e=Tl(n,t);return El(n,e)},Dl=function(n,t){var e=Bl(n,t);return e.match({ltr:function(t,e,o,r){var i=n.document.createRange();return i.setStart(t.dom(),e),i.setEnd(o.dom(),r),i},rtl:function(t,e,o,r){var i=n.document.createRange();return i.setStart(o.dom(),r),i.setEnd(t.dom(),e),i}})},Al=function(n,t,e,o,r){if(0===r)return 0;if(t===o)return r-1;for(var i=o,u=1;ui)return u-1;i=c}}return 0},_l=function(n,t,e){return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom};function Ml(n,t){var e=function(e){if(!n(e))throw new Error("Can only get "+t+" value of a "+t+" node");return o(e).getOr("")},o=function(t){return n(t)?w.from(t.dom().nodeValue):w.none()},r=function(e,o){if(!n(e))throw new Error("Can only set raw "+t+" value of a "+t+" node");e.dom().nodeValue=o};return{get:e,getOption:o,set:r}}var Fl=Ml(pi,"text"),Il=function(n){return Fl.get(n)},Rl=function(n){return Fl.getOption(n)},Nl=function(n,t,e,o,r){var i=function(e){var o=n.dom().createRange();return o.setStart(t.dom(),e),o.collapse(!0),o},u=function(n){var t=i(n);return t.getBoundingClientRect()},a=Il(t).length,c=Al(u,e,o,r.right,a);return i(c)},Vl=function(n,t,e,o){var r=n.dom().createRange();r.selectNode(t.dom());var i=r.getClientRects(),u=Qc(i,(function(n){return _l(n,e,o)?w.some(n):w.none()}));return u.map((function(r){return Nl(n,t,e,o,r)}))},Hl=function(n,t,e,o){var r=n.dom().createRange(),i=nu(t);return Qc(i,(function(t){return r.selectNode(t.dom()),_l(r.getBoundingClientRect(),e,o)?Pl(n,t,e,o):w.none()}))},Pl=function(n,t,e,o){return pi(t)?Vl(n,t,e,o):Hl(n,t,e,o)},zl=function(n,t,e,o){var r=n.dom().createRange();r.selectNode(t.dom());var i=r.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,e)),a=Math.max(i.top,Math.min(i.bottom,o));return Pl(n,t,u,a)},Ll=function(n){return"img"===li(n)?1:Rl(n).fold((function(){return nu(n).length}),(function(n){return n.length}))},jl=" ",Ul=function(n){return Rl(n).filter((function(n){return 0!==n.trim().length||n.indexOf(jl)>-1})).isSome()},Wl=["img","br"],Gl=function(n){var t=Ul(n);return t||z(Wl,li(n))},Xl=function(n){return wi(n,Gl)},Yl=function(n){return ql(n,Gl)},ql=function(n,t){var e=function(n){for(var o=nu(n),r=o.length-1;r>=0;r--){var i=o[r];if(t(i))return w.some(i);var u=e(i);if(u.isSome())return u}return w.none()};return e(n)},Kl=!0,Jl=!1,$l=function(n,t){return t-n.left0){var t=n.getRangeAt(0),e=n.getRangeAt(n.rangeCount-1);return w.some(tl.create(Je.fromDom(t.startContainer),t.startOffset,Je.fromDom(e.endContainer),e.endOffset))}return w.none()},fd=function(n){var t=Je.fromDom(n.anchorNode),e=Je.fromDom(n.focusNode);return cd(t,n.anchorOffset,e,n.focusOffset)?w.some(tl.create(t,n.anchorOffset,e,n.focusOffset)):sd(n)},ld=function(n){return w.from(n.getSelection()).filter((function(n){return n.rangeCount>0})).bind(fd)},dd=function(n,t){var e=Dl(n,t);return Cl(e)},md=Li("element","offset"),gd=function(n,t){var e=nu(n);if(0===e.length)return md(n,t);if(to?e:r=e?e:n},Qd=wn.generate([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),Zd=function(n,t,e,o,r){var i=r.x(),u=r.y(),a=r.width(),c=r.height(),s=n>=i,f=t>=u,l=s&&f,d=n+e<=i+a,m=t+o<=u+c,g=d&&m,p=Math.abs(Math.min(e,s?i+a-n:i-(n+e))),v=Math.abs(Math.min(o,f?u+c-t:u-(t+o))),h=$d(n,r.x(),r.right()),b=$d(t,r.y(),r.bottom());return{originInBounds:l,sizeInBounds:g,limitX:h,limitY:b,deltaW:p,deltaH:v}},nm=function(n,t,e,o){var r=n.x(),u=n.y(),a=n.bubble().offset().left(),c=n.bubble().offset().top(),s=o.y(),f=o.bottom(),l=o.x(),d=o.right(),m=r+a,g=u+c,p=Zd(m,g,t,e,o),v=p.originInBounds,h=p.sizeInBounds,b=p.limitX,y=p.limitY,x=p.deltaW,w=p.deltaH,S=i(y+w-s),C=i(f-y),k=Es(n.direction(),C,C,S),O=i(b+x-l),T=i(d-b),E=Bs(n.direction(),T,T,O),B=Ff({x:b,y:y,width:x,height:w,maxHeight:k,maxWidth:E,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:g});return v&&h?Qd.fit(B):Qd.nofit(B,x,w)},tm=function(n,t,e,o,r){var i=e.width(),c=e.height(),s=function(n,u,a,s){var f=n(t,e,o),l=nm(f,i,c,r);return l.fold(Qd.fit,(function(n,t,e){var o=e>s||t>a;return o?Qd.nofit(n,t,e):Qd.nofit(u,a,s)}))},f=J(n,(function(n,t){var e=a(s,t);return n.fold(Qd.fit,e)}),Qd.nofit(Ff({x:t.x(),y:t.y(),width:e.width(),height:e.height(),maxHeight:e.height(),maxWidth:e.width(),direction:Ds(),classes:{on:[],off:[]},label:"none",candidateYforTest:t.y()}),-1,-1));return f.fold(u,u)},em=function(n){return{width:i(Oc(n)),height:i(gc(n))}},om=function(n,t,e,o){Xa(t,"max-height"),Xa(t,"max-width");var r=em(t);return tm(o.preference(),n,r,e,o.bounds())},rm=function(n,t){var e=t.classes();Ra(n,e.off),Ia(n,e.on)},im=function(n,t,e){var o=e.maxHeightFunction();o(n,t.maxHeight())},um=function(n,t,e){var o=e.maxWidthFunction();o(n,t.maxWidth())},am=function(n,t,e){var o=function(n){return n+"px"},r=Vf(e.origin(),t);La(n,{position:w.some(r.position()),left:r.left().map(o),top:r.top().map(o),right:r.right().map(o),bottom:r.bottom().map(o)})},cm=function(n,t){pc(n,Math.floor(t))},sm=i((function(n,t){cm(n,t),za(n,{"overflow-x":"hidden","overflow-y":"auto"})})),fm=i((function(n,t){cm(n,t)})),lm=Yi(["bounds","origin","preference","maxHeightFunction","maxWidthFunction"],[]),dm=function(n,t,e){return void 0===n[t]?e:n[t]},mm=function(n,t,o,r,i,u){var a=dm(u,"maxHeightFunction",sm()),c=dm(u,"maxWidthFunction",e),s=n.anchorBox(),f=n.origin(),l=lm({bounds:Pf(f,i),origin:f,preference:r,maxHeightFunction:a,maxWidthFunction:c});gm(s,t,o,l)},gm=function(n,t,e,o){var r=om(n,t,e,o);am(t,r,o),rm(t,r),im(t,r,o),um(t,r,o)},pm=function(){var n=t.document.documentElement;return Uf(0,0,n.clientWidth,n.clientHeight)},vm=function(n){var t=xc(n.element()),e=n.element().dom().getBoundingClientRect();return jf(t.left(),t.top(),e.width,e.height)},hm=function(n,t,e,o,r){var i=Kd(e.anchorBox,t);mm(i,r.element(),e.bubble,e.layouts,o,e.overrides)},bm=function(n,t,e,o,r){ym(n,t,e,o,r,w.none())},ym=function(n,t,e,o,r,i){var u=i.map(Pc);return xm(n,t,e,o,r,u)},xm=function(n,t,e,o,r,u){var a=te("positioning anchor.info",Yd,o);Df((function(){Pa(r.element(),"position","fixed");var e=Wa(r.element(),"visibility");Pa(r.element(),"visibility","hidden");var o=t.useFixed()?pm():vm(n),c=a.placement,s=u.map(i).or(t.getBounds);c(n,a,o).each((function(t){var e=t.placer.getOr(hm);e(n,o,t,s,r)})),e.fold((function(){Xa(r.element(),"visibility")}),(function(n){Pa(r.element(),"visibility",n)})),Wa(r.element(),"left").isNone()&&Wa(r.element(),"top").isNone()&&Wa(r.element(),"right").isNone()&&Wa(r.element(),"bottom").isNone()&&Wa(r.element(),"position").is("fixed")&&Xa(r.element(),"position")}),r.element())},wm=function(n,t,e){return t.useFixed()?"fixed":"absolute"},Sm=Object.freeze({position:bm,positionWithin:ym,positionWithinBounds:xm,getMode:wm}),Cm=[Fe("useFixed",f),Oe("getBounds")],km=mf({fields:Cm,name:"positioning",active:Cf,apis:Sm}),Om=function(n){ri(n,Kr());var t=n.components();G(t,Om)},Tm=function(n){var t=n.components();G(t,Tm),ri(n,qr())},Em=function(n,t){au(n.element(),t.element())},Bm=function(n){G(n.components(),(function(n){return du(n.element())})),lu(n.element()),n.syncComponents()},Dm=function(n,t){var e=n.components();Bm(n);var o=on(e,t);G(o,(function(t){Om(t),n.getSystem().removeFromWorld(t)})),G(t,(function(t){t.getSystem().isConnected()?Em(n,t):(n.getSystem().addToWorld(t),Em(n,t),vi(n.element())&&Tm(t)),n.syncComponents()}))},Am=function(n,t){_m(n,t,au)},_m=function(n,t,e){n.getSystem().addToWorld(t),e(n.element(),t.element()),vi(n.element())&&Tm(t),n.syncComponents()},Mm=function(n){Om(n),du(n.element()),n.getSystem().removeFromWorld(n)},Fm=function(n){var t=$i(n.element()).bind((function(t){return n.getSystem().getByDom(t).toOption()}));Mm(n),t.each((function(n){n.syncComponents()}))},Im=function(n){var t=n.components();G(t,Mm),lu(n.element()),n.syncComponents()},Rm=function(n,t){Vm(n,t,au)},Nm=function(n,t){Vm(n,t,iu)},Vm=function(n,t,e){e(n,t.element());var o=nu(t.element());G(o,(function(n){t.getByDom(n).each(Tm)}))},Hm=function(n){var t=nu(n.element());G(t,(function(t){n.getByDom(t).each(Om)})),du(n.element())},Pm=function(n,t,e,o){e.get().each((function(t){Im(n)}));var r=t.getAttachPoint(n);Am(r,n);var i=n.getSystem().build(o);return Am(n,i),e.set(i),i},zm=function(n,t,e,o){var r=Pm(n,t,e,o);return t.onOpen(n,r),r},Lm=function(n,t,e,o){return e.get().map((function(){return Pm(n,t,e,o)}))},jm=function(n,t,e,o,r){Km(n,t),zm(n,t,e,o),r(),$m(n,t)},Um=function(n,t,e){e.get().each((function(o){Im(n),Fm(n),t.onClose(n,o),e.clear()}))},Wm=function(n,t,e){return e.isOpen()},Gm=function(n,t,e,o){return Wm(n,t,e)&&e.get().exists((function(e){return t.isPartOf(n,e,o)}))},Xm=function(n,t,e){return e.get()},Ym=function(n,t,e,o){Wa(n.element(),t).fold((function(){Su(n.element(),e)}),(function(t){bu(n.element(),e,t)})),Pa(n.element(),t,o)},qm=function(n,t,e){if(wu(n.element(),e)){var o=xu(n.element(),e);Pa(n.element(),t,o)}else Xa(n.element(),t)},Km=function(n,t,e){var o=t.getAttachPoint(n);Pa(n.element(),"position",km.getMode(o)),Ym(n,"visibility",t.cloakVisibilityAttr,"hidden")},Jm=function(n){return L(["top","left","right","bottom"],(function(t){return Wa(n,t).isSome()}))},$m=function(n,t,e){Jm(n.element())||Xa(n.element(),"position"),qm(n,"visibility",t.cloakVisibilityAttr)},Qm=Object.freeze({cloak:Km,decloak:$m,open:zm,openWhileCloaked:jm,close:Um,isOpen:Wm,isPartOf:Gm,getState:Xm,setContent:Lm}),Zm=function(n,t){return Ci([Ei(Lr(),(function(e,o){Um(e,n,t)}))])},ng=Object.freeze({events:Zm}),tg=[hs("onOpen"),hs("onClose"),ge("isPartOf"),ge("getAttachPoint"),Fe("cloakVisibilityAttr","data-precloak-visibility")],eg=function(){var n=We(w.none()),t=i("not-implemented"),e=function(){return n.get().isSome()},o=function(t){n.set(w.some(t))},r=function(t){return n.get()},u=function(){n.set(w.none())};return Qu({readState:t,isOpen:e,clear:u,set:o,get:r})},og=Object.freeze({init:eg}),rg=mf({fields:tg,name:"sandboxing",active:ng,apis:Qm,state:og}),ig=i("dismiss.popups"),ug=i("reposition.popups"),ag=i("mouse.released"),cg=Nt([Fe("isExtraPart",i(!1)),_e("fireEventInstead",[Fe("event",Jr())])]),sg=function(n){var t,e=te("Dismissal",cg,n);return t={},t[ig()]={schema:Nt([ge("target")]),onReceive:function(n,t){if(rg.isOpen(n)){var o=rg.isPartOf(n,t.target)||e.isExtraPart(n,t.target);o||e.fireEventInstead.fold((function(){return rg.close(n)}),(function(t){return ri(n,t.event)}))}}},t},fg=Nt([Fe("isExtraPart",i(!1)),_e("fireEventInstead",[Fe("event",$r())]),xe("doReposition")]),lg=function(n){var t,e=te("Reposition",fg,n);return t={},t[ug()]={onReceive:function(n){rg.isOpen(n)&&e.fireEventInstead.fold((function(){return e.doReposition(n)}),(function(t){return ri(n,t.event)}))}},t},dg=function(n,t,e){t.store.manager.onLoad(n,t,e)},mg=function(n,t,e){t.store.manager.onUnload(n,t,e)},gg=function(n,t,e,o){t.store.manager.setValue(n,t,e,o)},pg=function(n,t,e){return t.store.manager.getValue(n,t,e)},vg=function(n,t,e){return e},hg=Object.freeze({onLoad:dg,onUnload:mg,setValue:gg,getValue:pg,getState:vg}),bg=function(n,t){var e=n.resetOnDom?[Vi((function(e,o){dg(e,n,t)})),Hi((function(e,o){mg(e,n,t)}))]:[rf(n,t,dg)];return Ci(e)},yg=Object.freeze({events:bg}),xg=function(){var n=We(null),t=function(){return{mode:"memory",value:n.get()}},e=function(){return null===n.get()},o=function(){n.set(null)};return Qu({set:n.set,get:n.get,isNotSet:e,clear:o,readState:t})},wg=function(){var n=function(){};return Qu({readState:n})},Sg=function(){var n=We({}),t=We({}),e=function(){return{mode:"dataset",dataByValue:n.get(),dataByText:t.get()}},o=function(){n.set({}),t.set({})},r=function(e){return Yn(n.get(),e).orThunk((function(){return Yn(t.get(),e)}))},i=function(e){var o=n.get(),r=t.get(),i={},u={};G(e,(function(n){i[n.value]=n,Yn(n,"meta").each((function(t){Yn(t,"text").each((function(t){u[t]=n}))}))})),n.set(m(m({},o),i)),t.set(m(m({},r),u))};return Qu({readState:e,lookup:r,update:i,clear:o})},Cg=function(n){return n.store.manager.state(n)},kg=Object.freeze({memory:xg,dataset:Sg,manual:wg,init:Cg}),Og=function(n,t,e,o){var r=t.store;e.update([o]),r.setValue(n,o),t.onSetValue(n,o)},Tg=function(n,t,e){var o=t.store,r=o.getDataKey(n);return e.lookup(r).fold((function(){return o.getFallbackEntry(r)}),(function(n){return n}))},Eg=function(n,t,e){var o=t.store;o.initialValue.each((function(o){Og(n,t,e,o)}))},Bg=function(n,t,e){e.clear()},Dg=[Oe("initialValue"),ge("getFallbackEntry"),ge("getDataKey"),ge("setValue"),ws("manager",{setValue:Og,getValue:Tg,onLoad:Eg,onUnload:Bg,state:Sg})],Ag=function(n,t,e){return t.store.getValue(n)},_g=function(n,t,e,o){t.store.setValue(n,o),t.onSetValue(n,o)},Mg=function(n,t,e){t.store.initialValue.each((function(e){t.store.setValue(n,e)}))},Fg=[ge("getValue"),Fe("setValue",e),Oe("initialValue"),ws("manager",{setValue:_g,getValue:Ag,onLoad:Mg,onUnload:e,state:$u.init})],Ig=function(n,t,e,o){e.set(o),t.onSetValue(n,o)},Rg=function(n,t,e){return e.get()},Ng=function(n,t,e){t.store.initialValue.each((function(n){e.isNotSet()&&e.set(n)}))},Vg=function(n,t,e){e.clear()},Hg=[Oe("initialValue"),ws("manager",{setValue:Ig,getValue:Rg,onLoad:Ng,onUnload:Vg,state:xg})],Pg=[Ie("store",{mode:"memory"},re("mode",{memory:Hg,manual:Fg,dataset:Dg})),hs("onSetValue"),Fe("resetOnDom",!1)],zg=mf({fields:Pg,name:"representing",active:yg,apis:hg,extra:{setValueFrom:function(n,t){var e=zg.getValue(t);zg.setValue(n,e)}},state:kg}),Lg=function(n,t){return je(n,{},W(t,(function(t){return we(t.name(),"Cannot configure "+t.name()+" for "+n)})).concat([Ue("dump",u)]))},jg=function(n){return n.dump},Ug=function(n,t){return m(m({},n.dump),lf(t))},Wg={field:Lg,augment:Ug,get:jg},Gg="placeholder",Xg=wn.generate([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Yg=function(n,t,e,o){return n.exists((function(n){return n!==e.owner}))?Xg.single(!0,i(e)):Yn(o,e.name).fold((function(){throw new Error("Unknown placeholder component: "+e.name+"\nKnown: ["+fn(o)+"]\nNamespace: "+n.getOr("none")+"\nSpec: "+JSON.stringify(e,null,2))}),(function(n){return n.replace()}))},qg=function(n,t,e,o){return e.uiType===Gg?Yg(n,t,e,o):Xg.single(!1,i(e))},Kg=function(n,t,e,o){var r=qg(n,t,e,o);return r.fold((function(r,i){var u=i(t,e.config,e.validated),a=Yn(u,"components").getOr([]),c=nn(a,(function(e){return Kg(n,t,e,o)}));return[m(m({},u),{components:c})]}),(function(n,o){var r=o(t,e.config,e.validated),i=e.validated.preprocess.getOr(u);return i(r)}))},Jg=function(n,t,e,o){return nn(e,(function(e){return Kg(n,t,e,o)}))},$g=function(n,t){var e=!1,o=function(){return e},r=function(){if(!0===e)throw new Error("Trying to use the same placeholder more than once: "+n);return e=!0,t},u=function(){return t.fold((function(n,t){return n}),(function(n,t){return n}))};return{name:i(n),required:u,used:o,replace:r}},Qg=function(n,t,e,o){var r=mn(o,(function(n,t){return $g(t,n)})),i=Jg(n,t,e,r);return dn(r,(function(e){if(!1===e.used()&&e.required())throw new Error("Placeholder: "+e.name()+" was not found in components list\nNamespace: "+n.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),i},Zg=Xg.single,np=Xg.multiple,tp=i(Gg),ep=wn.generate([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),op=Fe("factory",{sketch:u}),rp=Fe("schema",[]),ip=ge("name"),up=Ut("pname","pname",In((function(n){return""})),ie()),ap=Ue("schema",(function(){return[Oe("preprocess")]})),cp=Fe("defaults",i({})),sp=Fe("overrides",i({})),fp=Vt([op,rp,ip,up,cp,sp]),lp=Vt([op,rp,ip,cp,sp]),dp=Vt([op,rp,ip,up,cp,sp]),mp=Vt([op,ap,ip,ge("unit"),up,cp,sp]),gp=function(n){return n.fold(w.some,w.none,w.some,w.some)},pp=function(n){var t=function(n){return n.name};return n.fold(t,t,t,t)},vp=function(n){return n.fold(u,u,u,u)},hp=function(n,t){return function(e){var o=te("Converting part type",t,e);return n(o)}},bp=hp(ep.required,fp),yp=hp(ep.external,lp),xp=hp(ep.optional,dp),wp=hp(ep.group,mp),Sp=i("entirety"),Cp=Object.freeze({required:bp,external:yp,optional:xp,group:wp,asNamedPart:gp,name:pp,asCommon:vp,original:Sp}),kp=function(n,t,e,o){return Tn(t.defaults(n,e,o),e,{uid:n.partUids[t.name]},t.overrides(n,e,o))},Op=function(n,t,e){var o={},r={};return G(e,(function(n){n.fold((function(n){o[n.pname]=Zg(!0,(function(t,e,o){return n.factory.sketch(kp(t,n,e,o))}))}),(function(n){var e=t.parts[n.name];r[n.name]=i(n.factory.sketch(kp(t,n,e[Sp()]),e))}),(function(n){o[n.pname]=Zg(!1,(function(t,e,o){return n.factory.sketch(kp(t,n,e,o))}))}),(function(n){o[n.pname]=np(!0,(function(t,e,o){var r=t[n.name];return W(r,(function(e){return n.factory.sketch(Tn(n.defaults(t,e,o),e,n.overrides(t,e)))}))}))}))})),{internals:i(o),externals:i(r)}},Tp=function(n,t){var e={};return G(t,(function(t){gp(t).each((function(t){var o=Ep(n,t.pname);e[t.name]=function(e){var r=te("Part: "+t.name+" in "+n,Vt(t.schema),e);return m(m({},o),{config:e,validated:r})}}))})),e},Ep=function(n,t){return{uiType:tp(),owner:n,name:t}},Bp=function(n,t,e){return{uiType:tp(),owner:n,name:t,config:e,validated:{}}},Dp=function(n){return nn(n,(function(n){return n.fold(w.none,w.some,w.none,w.none).map((function(n){return Se(n.name,n.schema.concat([Ss(Sp())]))})).toArray()}))},Ap=function(n){return W(n,pp)},_p=function(n,t,e){return Op(n,t,e)},Mp=function(n,t,e){return Qg(w.some(n),t,t.components,e)},Fp=function(n,t,e){var o=t.partUids[e];return n.getSystem().getByUid(o).toOption()},Ip=function(n,t,e){return Fp(n,t,e).getOrDie("Could not find part: "+e)},Rp=function(n,t,e){var o={},r=t.partUids,u=n.getSystem();return G(e,(function(n){o[n]=i(u.getByUid(r[n]))})),o},Np=function(n,t){var e=n.getSystem();return mn(t.partUids,(function(n,t){return i(e.getByUid(n))}))},Vp=function(n){return fn(n.partUids)},Hp=function(n,t,e){var o={},r=t.partUids,u=n.getSystem();return G(e,(function(n){o[n]=i(u.getByUid(r[n]).getOrDie())})),o},Pp=function(n,t){var e=Ap(t);return Kn(W(e,(function(t){return{key:t,value:n+"-"+t}})))},zp=function(n){return Ut("partUids","partUids",Rn((function(t){return Pp(t.uid,n)})),ie())},Lp=Object.freeze({generate:Tp,generateOne:Bp,schemas:Dp,names:Ap,substitutes:_p,components:Mp,defaultUids:Pp,defaultUidsSchema:zp,getAllParts:Np,getAllPartNames:Vp,getPart:Fp,getPartOrDie:Ip,getParts:Rp,getPartsOrDie:Hp}),jp=function(n,t){var e=n.length>0?[Se("parts",n)]:[];return e.concat([ge("uid"),Fe("dom",{}),Fe("components",[]),Ss("originalSpec"),Fe("debug.sketcher",{})]).concat(t)},Up=function(n,t,e,o,r){var i=jp(o,r);return te(n+" [SpecSchema]",Nt(i.concat(t)),e)},Wp=function(n,t,e,o){var r=Xp(o),i=Up(n,t,r,[],[]);return e(i,r)},Gp=function(n,t,e,o,r){var i=Xp(r),u=Dp(e),a=zp(e),c=Up(n,t,i,u,[a]),s=_p(n,c,e),f=Mp(n,c,s.internals());return o(c,f,i,s.externals())},Xp=function(n){return n.hasOwnProperty("uid")?n:m(m({},n),{uid:Pu("uid")})};function Yp(n){return void 0!==n.uid}var qp,Kp=Nt([ge("name"),ge("factory"),ge("configFields"),Fe("apis",{}),Fe("extraApis",{})]),Jp=Nt([ge("name"),ge("factory"),ge("configFields"),ge("partFields"),Fe("apis",{}),Fe("extraApis",{})]),$p=function(n){var t=te("Sketcher for "+n.name,Kp,n),e=function(n){return Wp(t.name,t.configFields,t.factory,n)},o=mn(t.apis,Ju),r=mn(t.extraApis,(function(n,t){return Gu(n,t)}));return m(m({name:i(t.name),partFields:i([]),configFields:i(t.configFields),sketch:e},o),r)},Qp=function(n){var t=te("Sketcher for "+n.name,Jp,n),e=function(n){return Gp(t.name,t.configFields,t.partFields,t.factory,n)},o=Tp(t.name,t.partFields),r=mn(t.apis,Ju),u=mn(t.extraApis,(function(n,t){return Gu(n,t)}));return m(m({name:i(t.name),partFields:i(t.partFields),configFields:i(t.configFields),sketch:e,parts:i(o)},r),u)},Zp=function(n){return"input"===li(n)&&"radio"!==xu(n,"type")||"textarea"===li(n)},nv=function(n,t,e){return t.find(n)},tv=Object.freeze({getCurrent:nv}),ev=[ge("find")],ov=mf({fields:ev,name:"composing",apis:tv}),rv=function(n,t,e,o){var r=ud(n.element(),"."+t.highlightClass);G(r,(function(e){L(o,(function(n){return n.element()===e}))||(Ma(e,t.highlightClass),n.getSystem().getByDom(e).each((function(e){t.onDehighlight(n,e),ri(e,oi())})))}))},iv=function(n,t,e){return rv(n,t,e,[])},uv=function(n,t,e,o){dv(n,t,e,o)&&(Ma(o.element(),t.highlightClass),t.onDehighlight(n,o),ri(o,oi()))},av=function(n,t,e,o){rv(n,t,e,[o]),dv(n,t,e,o)||(Aa(o.element(),t.highlightClass),t.onHighlight(n,o),ri(o,ei()))},cv=function(n,t,e){pv(n,t).each((function(o){av(n,t,e,o)}))},sv=function(n,t,e){vv(n,t).each((function(o){av(n,t,e,o)}))},fv=function(n,t,e,o){gv(n,t,e,o).fold((function(n){throw new Error(n)}),(function(o){av(n,t,e,o)}))},lv=function(n,t,e,o){var r=xv(n,t),i=$(r,o);i.each((function(o){av(n,t,e,o)}))},dv=function(n,t,e,o){return Fa(o.element(),t.highlightClass)},mv=function(n,t,e){return Wc(n.element(),"."+t.highlightClass).bind((function(t){return n.getSystem().getByDom(t).toOption()}))},gv=function(n,t,e,o){var r=ud(n.element(),"."+t.itemClass);return w.from(r[o]).fold((function(){return O.error("No element found with index "+o)}),n.getSystem().getByDom)},pv=function(n,t,e){return Wc(n.element(),"."+t.itemClass).bind((function(t){return n.getSystem().getByDom(t).toOption()}))},vv=function(n,t,e){var o=ud(n.element(),"."+t.itemClass),r=o.length>0?w.some(o[o.length-1]):w.none();return r.bind((function(t){return n.getSystem().getByDom(t).toOption()}))},hv=function(n,t,e,o){var r=ud(n.element(),"."+t.itemClass),i=Q(r,(function(n){return Fa(n,t.highlightClass)}));return i.bind((function(t){var e=Jd(t,o,0,r.length-1);return n.getSystem().getByDom(r[e]).toOption()}))},bv=function(n,t,e){return hv(n,t,e,-1)},yv=function(n,t,e){return hv(n,t,e,1)},xv=function(n,t,e){var o=ud(n.element(),"."+t.itemClass);return Jc(W(o,(function(t){return n.getSystem().getByDom(t).toOption()})))},wv=Object.freeze({dehighlightAll:iv,dehighlight:uv,highlight:av,highlightFirst:cv,highlightLast:sv,highlightAt:fv,highlightBy:lv,isHighlighted:dv,getHighlighted:mv,getFirst:pv,getLast:vv,getPrevious:bv,getNext:yv,getCandidates:xv}),Sv=[ge("highlightClass"),ge("itemClass"),hs("onHighlight"),hs("onDehighlight")],Cv=mf({fields:Sv,name:"highlighting",apis:wv}),kv=function(){return[8]},Ov=function(){return[9]},Tv=function(){return[13]},Ev=function(){return[27]},Bv=function(){return[32]},Dv=function(){return[37]},Av=function(){return[38]},_v=function(){return[39]},Mv=function(){return[40]},Fv=function(n,t,e){var o=en(n.slice(0,t)),r=en(n.slice(t+1));return $(o.concat(r),e)},Iv=function(n,t,e){var o=en(n.slice(0,t));return $(o,e)},Rv=function(n,t,e){var o=n.slice(0,t),r=n.slice(t+1);return $(r.concat(o),e)},Nv=function(n,t,e){var o=n.slice(t+1);return $(o,e)},Vv=function(n){return function(t){var e=t.raw();return z(n,e.which)}},Hv=function(n){return function(t){return tn(n,(function(n){return n(t)}))}},Pv=function(n){var t=n.raw();return!0===t.shiftKey},zv=function(n){var t=n.raw();return!0===t.ctrlKey},Lv=c(Pv),jv=function(n,t){return{matches:n,classification:t}},Uv=function(n,t){var e=$(n,(function(n){return n.matches(t)}));return e.map((function(n){return n.classification}))},Wv=function(n,t,e){var o=t.exists((function(n){return e.exists((function(t){return or(t,n)}))}));o||ii(n,Qr(),{prevFocus:t,newFocus:e})},Gv=function(){var n=function(n){return Bf(n.element())},t=function(t,e){var o=n(t);t.getSystem().triggerFocus(e,t.element());var r=n(t);Wv(t,o,r)};return{get:n,set:t}},Xv=function(){var n=function(n){return Cv.getHighlighted(n).map((function(n){return n.element()}))},t=function(t,o){var r=n(t);t.getSystem().getByDom(o).fold(e,(function(n){Cv.highlight(t,n)}));var i=n(t);Wv(t,r,i)};return{get:n,set:t}};(function(n){n["OnFocusMode"]="onFocus",n["OnEnterOrSpaceMode"]="onEnterOrSpace",n["OnApiMode"]="onApi"})(qp||(qp={}));var Yv=function(n,t,e,o,r){var i=function(){return n.concat([Fe("focusManager",Gv()),Ie("focusInside","onFocus",Jt((function(n){return z(["onFocus","onEnterOrSpace","onApi"],n)?O.value(n):O.error("Invalid value for focusInside")}))),ws("handler",c),ws("state",t),ws("sendFocusIn",r)])},u=function(n,t,e,o,r){var i=e(n,t,o,r);return Uv(i,t.event()).bind((function(e){return e(n,t,o,r)}))},a=function(n,t){var i=n.focusInside!==qp.OnFocusMode?w.none():r(n).map((function(e){return Ei(Mr(),(function(o,r){e(o,n,t),r.stop()}))})),a=function(e,o){var i=Vv(Bv().concat(Tv()))(o.event());n.focusInside===qp.OnEnterOrSpaceMode&&i&&cr(e,o)&&r(n).each((function(r){r(e,n,t),o.stop()}))};return Ci(i.toArray().concat([Ei(kr(),(function(o,r){u(o,r,e,n,t).fold((function(){a(o,r)}),(function(n){r.stop()}))})),Ei(Or(),(function(e,r){u(e,r,o,n,t).each((function(n){r.stop()}))}))]))},c={schema:i,processKey:u,toEvents:a};return c},qv=function(n){var t=[Oe("onEscape"),Oe("onEnter"),Fe("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Fe("firstTabstop",0),Fe("useTabstopAt",i(!0)),Oe("visibilitySelector")].concat([n]),e=function(n,t){var e=n.visibilitySelector.bind((function(n){return Gc(t,n)})).getOr(t);return mc(e)>0},o=function(n,t){var o=ud(n.element(),t.selector),r=q(o,(function(n){return e(t,n)}));return w.from(r[t.firstTabstop])},r=function(n,t){return t.focusManager.get(n).bind((function(n){return Gc(n,t.selector)}))},u=function(n,t){return e(n,t)&&n.useTabstopAt(t)},c=function(n,t){o(n,t).each((function(e){t.focusManager.set(n,e)}))},s=function(n,t,e,o,r){return r(t,e,(function(n){return u(o,n)})).fold((function(){return o.cyclic?w.some(!0):w.none()}),(function(t){return o.focusManager.set(n,t),w.some(!0)}))},f=function(n,t,e,o){var i=ud(n.element(),e.selector);return r(n,e).bind((function(t){var r=Q(i,a(or,t));return r.bind((function(t){return s(n,i,t,e,o)}))}))},l=function(n,t,e,o){var r=e.cyclic?Fv:Iv;return f(n,t,e,r)},d=function(n,t,e,o){var r=e.cyclic?Rv:Nv;return f(n,t,e,r)},m=function(n,t,e,o){return e.onEnter.bind((function(e){return e(n,t)}))},g=function(n,t,e,o){return e.onEscape.bind((function(e){return e(n,t)}))},p=i([jv(Hv([Pv,Vv(Ov())]),l),jv(Vv(Ov()),d),jv(Vv(Ev()),g),jv(Hv([Lv,Vv(Tv())]),m)]),v=i([]);return Yv(t,$u.init,p,v,(function(){return w.some(c)}))},Kv=qv(Ue("cyclic",i(!1))),Jv=qv(Ue("cyclic",i(!0))),$v=function(n,t,e){return ai(n,e,Nr()),w.some(!0)},Qv=function(n,t,e){return Zp(e)&&Vv(Bv())(t.event())?w.none():$v(n,t,e)},Zv=function(n,t){return w.some(!0)},nh=[Fe("execute",Qv),Fe("useSpace",!1),Fe("useEnter",!0),Fe("useControlEnter",!1),Fe("useDown",!1)],th=function(n,t,e){return e.execute(n,t,n.element())},eh=function(n,t,e,o){var r=e.useSpace&&!Zp(n.element())?Bv():[],i=e.useEnter?Tv():[],u=e.useDown?Mv():[],a=r.concat(i).concat(u);return[jv(Vv(a),th)].concat(e.useControlEnter?[jv(Hv([zv,Vv(Tv())]),th)]:[])},oh=function(n,t,e,o){return e.useSpace&&!Zp(n.element())?[jv(Vv(Bv()),Zv)]:[]},rh=Yv(nh,$u.init,eh,oh,(function(){return w.none()})),ih=function(n){var t=We(w.none()),e=function(n,e){t.set(w.some({numRows:i(n),numColumns:i(e)}))},o=function(){return t.get().map((function(n){return n.numRows()}))},r=function(){return t.get().map((function(n){return n.numColumns()}))};return Qu({readState:function(){return t.get().map((function(n){return{numRows:n.numRows(),numColumns:n.numColumns()}})).getOr({numRows:"?",numColumns:"?"})},setGridSize:e,getNumRows:o,getNumColumns:r})},uh=function(n){return n.state(n)},ah=Object.freeze({flatgrid:ih,init:uh}),ch=function(n){return function(t,e,o,r){var i=n(t.element());return dh(i,t,e,o,r)}},sh=function(n,t){var e=Gf(n,t);return ch(e)},fh=function(n,t){var e=Gf(t,n);return ch(e)},lh=function(n){return function(t,e,o,r){return dh(n,t,e,o,r)}},dh=function(n,t,e,o,r){var i=o.focusManager.get(t).bind((function(e){return n(t.element(),e,o,r)}));return i.map((function(n){return o.focusManager.set(t,n),!0}))},mh=lh,gh=lh,ph=lh,vh=function(n){return n.offsetWidth<=0&&n.offsetHeight<=0},hh=function(n){var t=n.dom();return!vh(t)},bh=Yi(["index","candidates"],[]),yh=function(n,t){return Q(n,t).map((function(t){return bh({index:t,candidates:n})}))},xh=function(n,t,e){var o=a(or,t),r=ud(n,e),i=q(r,hh);return yh(i,o)},wh=function(n,t){return Q(n,(function(n){return or(t,n)}))},Sh=function(n,t,e,o){var r=Math.floor(t/e),i=t%e;return o(r,i).bind((function(t){var o=t.row()*e+t.column();return o>=0&&o1?w.some(n.slice(1)):w.none()}))},p=function(n){return Yn(e.get(),n)},v=function(n){return h(n).bind(fx)},h=function(n){return Yn(t.get(),n)},b=function(t){return Yn(n.get(),t)},y=function(n){var t=r.get();return on(fn(t),n)},x=function(){return o.get().bind(v)},S=function(){return t.get()};return{setMenuBuilt:a,setContents:c,expand:d,refresh:p,collapse:g,lookupMenu:h,lookupItem:b,otherMenus:y,getPrimary:x,getMenus:S,clear:i,isClear:u,getTriggeringPath:l}},fx=function(n){return"prepared"===n.type?w.some(n.menu):w.none()},lx={init:sx,extractPreparedMenu:fx},dx=function(n,t){var e,o=We(w.none()),r=function(t,e,o){return mn(o,(function(o,r){var i=function(){return ix.sketch(m(m({dom:o.dom},o),{value:r,items:o.items,markers:n.markers,fakeFocus:n.fakeFocus,onHighlight:n.onHighlight,focusManager:n.fakeFocus?Xv():Gv()}))};return r===e?{type:"prepared",menu:t.getSystem().build(i())}:{type:"notbuilt",nbMenu:i}}))},i=lx.init(),u=function(t){var e=r(t,n.data.primary,n.data.menus),o=s();return i.setContents(n.data.primary,e,n.data.expansions,o),i.getPrimary()},a=function(n){return zg.getValue(n).value},c=function(n,t,e){return Qc(t,(function(n){if(!n.getSystem().isConnected())return w.none();var t=Cv.getCandidates(n);return $(t,(function(n){return a(n)===e}))}))},s=function(t){return mn(n.data.menus,(function(n,t){return nn(n.items,(function(n){return"separator"===n.type?[]:[n.data.value]}))}))},f=function(n,t){Cv.highlight(n,t),Cv.getHighlighted(t).orThunk((function(){return Cv.getFirst(t)})).each((function(t){ai(n,t.element(),Vr())}))},l=function(n,t){return Jc(W(t,(function(t){return n.lookupMenu(t).bind((function(n){return"prepared"===n.type?w.some(n.menu):w.none()}))})))},d=function(t,e,o){var r=l(e,e.otherMenus(o));G(r,(function(e){Ra(e.element(),[n.markers.backgroundMenu]),n.stayInDom||uy.remove(t,e)}))},g=function(t){return o.get().getOrThunk((function(){var e={},r=ud(t.element(),"."+n.markers.item),i=q(r,(function(n){return"true"===xu(n,"aria-haspopup")}));return G(i,(function(n){t.getSystem().getByDom(n).each((function(n){var t=a(n);e[t]=n}))})),o.set(w.some(e)),e}))},p=function(n,t){var e=g(n);dn(e,(function(n,e){var o=z(t,e);bu(n.element(),"aria-expanded",o)}))},v=function(t,e,o){return w.from(o[0]).bind((function(r){return e.lookupMenu(r).bind((function(r){if("notbuilt"===r.type)return w.none();var i=r.menu,u=l(e,o.slice(1));return G(u,(function(t){Aa(t.element(),n.markers.backgroundMenu)})),vi(i.element())||uy.append(t,sc(i)),Ra(i.element(),[n.markers.backgroundMenu]),f(t,i),d(t,e,o),w.some(i)}))}))};(function(n){n[n["HighlightSubmenu"]=0]="HighlightSubmenu",n[n["HighlightParent"]=1]="HighlightParent"})(e||(e={}));var h=function(n,t,e){if("notbuilt"===e.type){var o=n.getSystem().build(e.nbMenu());return i.setMenuBuilt(t,o),o}return e.menu},b=function(t,o,r){void 0===r&&(r=e.HighlightSubmenu);var u=a(o);return i.expand(u).bind((function(u){return p(t,u),w.from(u[0]).bind((function(a){return i.lookupMenu(a).bind((function(c){var s=h(t,a,c);return vi(s.element())||uy.append(t,sc(s)),n.onOpenSubmenu(t,o,s,en(u)),r===e.HighlightSubmenu?(Cv.highlightFirst(s),v(t,i,u)):(Cv.dehighlightAll(s),w.some(o))}))}))}))},y=function(t,e){var o=a(e);return i.collapse(o).bind((function(o){return p(t,o),v(t,i,o).map((function(o){return n.onCollapseMenu(t,e,o),o}))}))},x=function(n,t){var e=a(t);return i.refresh(e).bind((function(t){return p(n,t),v(n,i,t)}))},S=function(n,t){return Zp(t.element())?w.none():b(n,t,e.HighlightSubmenu)},C=function(n,t){return Zp(t.element())?w.none():y(n,t)},k=function(t,e){return y(t,e).orThunk((function(){return n.onEscape(t,e).map((function(){return t}))}))},O=function(t){return function(e,o){return Gc(o.getSource(),"."+n.markers.item).bind((function(n){return e.getSystem().getByDom(n).toOption().bind((function(n){return t(e,n).map((function(){return!0}))}))}))}},T=Ci([Ei(ox(),(function(n,t){var e=t.event().item();i.lookupItem(a(e)).each((function(){var e=t.event().menu();Cv.highlight(n,e);var o=a(t.event().item());i.refresh(o).each((function(t){return d(n,i,t)}))}))})),zi((function(t,o){var r=o.event().target();t.getSystem().getByDom(r).each((function(o){var r=a(o);0===r.indexOf("collapse-item")&&y(t,o),b(t,o,e.HighlightSubmenu).fold((function(){n.onExecute(t,o)}),(function(){}))}))})),Vi((function(t,e){u(t).each((function(e){uy.append(t,sc(e)),n.onOpenMenu(t,e),n.highlightImmediately&&f(t,e)}))}))].concat(n.navigateOnHover?[Ei(Ly(),(function(t,o){var r=o.event().item();x(t,r),b(t,r,e.HighlightParent),n.onHover(t,r)}))]:[])),E=function(n){return Cv.getHighlighted(n).bind(Cv.getHighlighted)},B=function(n){E(n).each((function(t){y(n,t)}))},D=function(n){i.getPrimary().each((function(t){f(n,t)}))},A=function(n){return w.from(n.components()[0]).filter((function(n){return"menu"===xu(n.element(),"role")}))},_=function(t){var e=i.getPrimary().bind((function(n){return E(t).bind((function(n){var e=a(n),o=hn(i.getMenus()),r=Jc(W(o,lx.extractPreparedMenu));return i.getTriggeringPath(e,(function(n){return c(t,r,n)}))})).map((function(t){return{primary:n,triggeringPath:t}}))}));e.fold((function(){A(t).each((function(e){n.onRepositionMenu(t,e,[])}))}),(function(e){var o=e.primary,r=e.triggeringPath;n.onRepositionMenu(t,o,r)}))},M={collapseMenu:B,highlightPrimary:D,repositionMenus:_};return{uid:n.uid,dom:n.dom,markers:n.markers,behaviours:Ug(n.tmenuBehaviours,[Jb.config({mode:"special",onRight:O(S),onLeft:O(C),onEscape:O(k),focusIn:function(n,t){i.getPrimary().each((function(t){ai(n,t.element(),Vr())}))}}),Cv.config({highlightClass:n.markers.selectedMenu,itemClass:n.markers.menu}),ov.config({find:function(n){return Cv.getHighlighted(n)}}),uy.config({})]),eventOrder:n.eventOrder,apis:M,events:T}},mx=i("collapse-item"),gx=function(n,t,e){return{primary:n,menus:t,expansions:e}},px=function(n,t){return{primary:n,menus:qn(n,t),expansions:{}}},vx=function(n){return{value:_u(mx()),meta:{text:n}}},hx=$p({name:"TieredMenu",configFields:[xs("onExecute"),xs("onEscape"),ys("onOpenMenu"),ys("onOpenSubmenu"),ys("onRepositionMenu"),hs("onCollapseMenu"),Fe("highlightImmediately",!0),Se("data",[ge("primary"),ge("menus"),ge("expansions")]),Fe("fakeFocus",!1),hs("onHighlight"),hs("onHover"),gs(),ge("dom"),Fe("navigateOnHover",!0),Fe("stayInDom",!1),Lg("tmenuBehaviours",[Jb,Cv,ov,uy]),Fe("eventOrder",{})],apis:{collapseMenu:function(n,t){n.collapseMenu(t)},highlightPrimary:function(n,t){n.highlightPrimary(t)},repositionMenus:function(n,t){n.repositionMenus(t)}},factory:dx,extraApis:{tieredData:gx,singleData:px,collapseItem:vx}}),bx=function(n,t,e,o,r){var i=function(){return n.lazySink(t)},u="horizontal"===o.type?{layouts:{onLtr:function(){return tf()},onRtl:function(){return ef()}}}:{},a=function(n){return 2===n.length},c=function(n){return a(n)?u:{}};return hx.sketch({dom:{tag:"div"},data:o.data,markers:o.menu.markers,onEscape:function(){return rg.close(t),n.onEscape.map((function(n){return n(t)})),w.some(!0)},onExecute:function(){return w.some(!0)},onOpenMenu:function(n,t){km.positionWithinBounds(i().getOrDie(),e,t,r())},onOpenSubmenu:function(n,t,e,o){var r=i().getOrDie();km.position(r,m({anchor:"submenu",item:t},c(o)),e)},onRepositionMenu:function(n,t,o){var u=i().getOrDie();km.positionWithinBounds(u,e,t,r()),G(o,(function(n){var t=c(n.triggeringPath);km.position(u,m({anchor:"submenu",item:n.triggeringItem},t),n.triggeredMenu)}))}})},yx=function(n,t){var e=function(t,e){var o=n.getRelated(t);return o.exists((function(n){return Kc(n,e)}))},o=function(n,t){rg.setContent(n,t)},r=function(n,t,e){u(n,t,e,w.none())},u=function(n,t,e,o){a(n,t,e,(function(){return o.map((function(n){return Pc(n)}))}))},a=function(t,e,o,r){var i=n.lazySink(t).getOrDie();rg.openWhileCloaked(t,o,(function(){return km.positionWithinBounds(i,e,t,r())})),zg.setValue(t,w.some({mode:"position",anchor:e,getBounds:r}))},c=function(n,t,e){s(n,t,e,(function(){return w.none()}))},s=function(t,e,o,r){var i=bx(n,t,e,o,r);rg.open(t,i),zg.setValue(t,w.some({mode:"menu",menu:i}))},f=function(n){zg.setValue(n,w.none()),rg.close(n)},l=function(n){return rg.getState(n)},d=function(t){rg.isOpen(t)&&zg.getValue(t).each((function(e){switch(e.mode){case"menu":rg.getState(t).each((function(n){hx.repositionMenus(n)}));break;case"position":var o=n.lazySink(t).getOrDie();km.positionWithinBounds(o,e.anchor,t,e.getBounds());break}}))},g={setContent:o,showAt:r,showWithin:u,showWithinBounds:a,showMenuAt:c,showMenuWithinBounds:s,hide:f,getContent:l,reposition:d,isOpen:rg.isOpen};return{uid:n.uid,dom:n.dom,behaviours:Ug(n.inlineBehaviours,[rg.config({isPartOf:function(n,t,o){return Kc(t,o)||e(n,o)},getAttachPoint:function(t){return n.lazySink(t).getOrDie()},onOpen:function(t){n.onShow(t)},onClose:function(t){n.onHide(t)}}),zg.config({store:{mode:"memory",initialValue:w.none()}}),wf.config({channels:m(m({},sg(m({isExtraPart:i(!1)},n.fireDismissalEventInstead.map((function(n){return{fireEventInstead:{event:n.event}}})).getOr({})))),lg(m(m({isExtraPart:i(!1)},n.fireRepositionEventInstead.map((function(n){return{fireEventInstead:{event:n.event}}})).getOr({})),{doReposition:d})))})]),eventOrder:n.eventOrder,apis:g}},xx=$p({name:"InlineView",configFields:[ge("lazySink"),hs("onShow"),hs("onHide"),De("onEscape"),Lg("inlineBehaviours",[rg,zg,wf]),_e("fireDismissalEventInstead",[Fe("event",Jr())]),_e("fireRepositionEventInstead",[Fe("event",$r())]),Fe("getRelated",w.none),Fe("eventOrder",w.none)],factory:yx,apis:{showAt:function(n,t,e,o){n.showAt(t,e,o)},showWithin:function(n,t,e,o,r){n.showWithin(t,e,o,r)},showWithinBounds:function(n,t,e,o,r){n.showWithinBounds(t,e,o,r)},showMenuAt:function(n,t,e,o){n.showMenuAt(t,e,o)},showMenuWithinBounds:function(n,t,e,o,r){n.showMenuWithinBounds(t,e,o,r)},hide:function(n,t){n.hide(t)},isOpen:function(n,t){return n.isOpen(t)},getContent:function(n,t){return n.getContent(t)},setContent:function(n,t,e){n.setContent(t,e)},reposition:function(n,t){n.reposition(t)}}}),wx=function(n){return n.x()},Sx=function(n,t){return n.x()+n.width()/2-t.width()/2},Cx=function(n,t){return n.x()+n.width()-t.width()},kx=function(n){return n.y()},Ox=function(n,t){return n.y()+n.height()-t.height()},Tx=function(n,t,e){return ks(wx(n),Ox(n,t),e.innerSoutheast(),Ds(),"layout-se")},Ex=function(n,t,e){return ks(Cx(n,t),Ox(n,t),e.innerSouthwest(),As(),"layout-sw")},Bx=function(n,t,e){return ks(wx(n),kx(n),e.innerNortheast(),_s(),"layout-ne")},Dx=function(n,t,e){return ks(Cx(n,t),kx(n),e.innerNorthwest(),Ms(),"layout-nw")},Ax=function(n,t,e){return ks(Sx(n,t),kx(n),e.innerNorth(),Is(),"layout-n")},_x=function(n,t,e){return ks(Sx(n,t),Ox(n,t),e.innerSouth(),Fs(),"layout-s")},Mx=function(n){var t=function(n){return Ei(Nr(),(function(t,e){n(t),e.stop()}))},e=function(n,t){t.stop(),ui(n)},o=function(n,t){t.cut()},r=Yo().deviceType.isTouch()?[Ei(Hr(),e)]:[Ei(Br(),e),Ei(hr(),o)];return Ci(Z([n.map(t).toArray(),r]))},Fx=function(n){var t=Mx(n.action),e=n.dom.tag,o=function(t){return Yn(n.dom,"attributes").bind((function(n){return Yn(n,t)}))},r=function(){if("button"===e){var n=o("type").getOr("button"),t=o("role").map((function(n){return{role:n}})).getOr({});return m({type:n},t)}var r=o("role").getOr("button");return{role:r}};return{uid:n.uid,dom:n.dom,components:n.components,events:t,behaviours:Wg.augment(n.buttonBehaviours,[hy.config({}),Jb.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:r()},eventOrder:n.eventOrder}},Ix=$p({name:"Button",factory:Fx,configFields:[Fe("uid",void 0),ge("dom"),Fe("components",[]),Wg.field("buttonBehaviours",[hy,Jb]),Oe("action"),Oe("role"),Fe("eventOrder",{})]}),Rx=function(n){var t=Yp(n)&&Zn(n,"uid")?n.uid:Pu("memento"),e=function(n){return n.getSystem().getByUid(t).getOrDie()},o=function(n){return n.getSystem().getByUid(t).toOption()},r=function(){return m(m({},n),{uid:t})};return{get:e,getOpt:o,asSpec:r}},Nx=function(n){return w.from(n()["temporary-placeholder"]).getOr("!not found!")},Vx=function(n,t){return w.from(t()[n]).getOrThunk((function(){return Nx(t)}))},Hx=function(n,t,e){return w.from(t()[n]).or(e).getOrThunk((function(){return Nx(t)}))},Px=function(n,t){return Qc(n,(function(n){return w.from(t()[n])})).getOrThunk((function(){return Nx(t)}))},zx={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Lx=function(n){var t=Rx({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:lf([uy.config({})])}),e=function(n){return{dom:{tag:"div",classes:["tox-bar"],attributes:{style:"width: "+n+"%"}}}},o=function(n){return{dom:{tag:"div",classes:["tox-text"],innerHtml:n+"%"}}},r=Rx({dom:{tag:"div",classes:n.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[e(0)]},o(0)],behaviours:lf([uy.config({})])}),i=function(n,t){n.getSystem().isConnected()&&r.getOpt(n).each((function(n){uy.set(n,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[e(t)]},o(t)])}))},u=function(n,e){if(n.getSystem().isConnected()){var o=t.get(n);uy.set(o,[ic(e)])}},a={updateProgress:i,updateText:u},c=Z([n.icon.toArray(),n.level.toArray(),n.level.bind((function(n){return w.from(zx[n])})).toArray()]);return{uid:n.uid,dom:{tag:"div",attributes:{role:"alert"},classes:n.level.map((function(n){return["tox-notification","tox-notification--in","tox-notification--"+n]})).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:Px(c,n.iconProvider)}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:lf([uy.config({})])}].concat(n.progress?[r.asSpec()]:[]).concat(Ix.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:Vx("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},jx=$p({name:"Notification",factory:Lx,configFields:[Oe("level"),ge("progress"),ge("icon"),ge("onAction"),ge("text"),ge("iconProvider"),ge("translationProvider")],apis:{updateProgress:function(n,t,e){n.updateProgress(t,e)},updateText:function(n,t,e){n.updateText(t,e)}}}),Ux=tinymce.util.Tools.resolve("tinymce.util.Delay");function Wx(n,t,e){var o=t.backstage,r=function(n){switch(n){case"bc-bc":return _x;case"tc-tc":return Ax;case"tc-bc":return Ks;case"bc-tc":default:return Js}},i=function(n){G(n,(function(n){return n.moveTo(0,0)}))},u=function(n){n.length>0&&(an(n).each((function(n){return n.moveRel(null,"banner")})),G(n,(function(t,e){e>0&&t.moveRel(n[e-1].getEl(),"bc-tc")})))},a=function(n){i(n),u(n)},c=function(n,i){var u=function(){i(),xx.hide(c)},a=cc(jx.sketch({text:n.text,level:z(["success","error","warning","warn","info"],n.type)?n.type:void 0,progress:!0===n.progressBar,icon:w.from(n.icon),onAction:u,iconProvider:o.shared.providers.icons,translationProvider:o.shared.providers.translate})),c=cc(xx.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:t.backstage.shared.getSink,fireDismissalEventInstead:{}}));return e.add(c),n.timeout>0&&Ux.setTimeout((function(){u()}),n.timeout),{close:u,moveTo:function(n,t){xx.showAt(c,{anchor:"makeshift",x:n,y:t},sc(a))},moveRel:function(n,e){if("banner"!==e){var o=r(e),i={anchor:"node",root:hi(),node:w.some(Je.fromDom(n)),layouts:{onRtl:function(){return[o]},onLtr:function(){return[o]}}};xx.showAt(c,i,sc(a))}else xx.showAt(c,t.backstage.shared.anchors.banner(),sc(a))},text:function(n){jx.updateText(a,n)},settings:n,getEl:function(){return a.element().dom()},progressBar:{value:function(n){jx.updateProgress(a,n)}}}},s=function(n){n.close()},f=function(n){return n.settings};return{open:c,close:s,reposition:a,getArgs:f}}var Gx,Xx=function(n,e){var o=null,r=function(){null!==o&&(t.clearTimeout(o),o=null)},i=function(){for(var r=[],i=0;i',n.getDoc());return au(e,Je.fromDom(t.extractContents())),t.insertNode(e.dom()),$i(e).each((function(n){return n.dom().normalize()})),Yl(e).map((function(t){n.selection.setCursorLocation(t.dom(),Ll(t))})),e}))},ow=function(n){return Gc(n,tw)},rw=function(n){return n.collapsed&&3===n.startContainer.nodeType},iw=/[\u00a0 \t\r\n]/,uw=function(n,t,e,o){var r;for(r=t-1;r>=0;r--){var i=n.charAt(r);if(iw.test(i))return w.none();if(i===e)break}return-1===r||t-r0?vw(t[t.length-1]):mw(n,t.length)},hw=function(n,t){var e=n.childNodes;return e.length>0&&t0&&pw(n)&&e.length===t?vw(e[e.length-1]):mw(n,t)},bw=function(n){var t=function(n,t,e,o){var r=o.getOr(e.length);return 0===r?n.kontinue():n.finish(/\s/.test(e.charAt(r-1)))};return function(e){var o=hw(e.startContainer,e.startOffset);return nw(n,o.element,o.offset,t).fold(i(!0),i(!0),u)}},yw=function(n,t,e){return Qc(e.triggerChars,(function(e){return sw(n,t,e)}))},xw=function(n,t){var e=t(),o=n.selection.getRng();return yw(n.dom,o,e).bind((function(e){return ww(n,t,e)}))},ww=function(n,t,e,o){void 0===o&&(o={});var r=t(),i=n.selection.getRng(),u=i.startContainer.nodeValue,a=q(r.lookupByChar(e.triggerChar),(function(t){return e.text.length>=t.minChars&&t.matches.getOrThunk((function(){return bw(n.dom)}))(e.range,u,e.text)}));if(0===a.length)return w.none();var c=dw.all(W(a,(function(n){var t=n.fetch(e.text,n.maxResults,o);return t.then((function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}}))})));return w.some({lookupData:c,context:e})},Sw=Vt([he("type"),Be("text")]),Cw=function(n){return Zt("separatormenuitem",Sw,n)},kw=Vt([Ue("type",(function(){return"autocompleteitem"})),Ue("active",(function(){return!1})),Ue("disabled",(function(){return!1})),Fe("meta",{}),he("value"),Be("text"),Be("icon")]),Ow=Vt([he("type"),he("ch"),Re("minChars",1),Fe("columns",1),Re("maxResults",10),De("matches"),xe("fetch"),xe("onAction")]),Tw=function(n){return Zt("Autocompleter.Separator",Sw,n)},Ew=function(n){return Zt("Autocompleter.Item",kw,n)},Bw=function(n){return Zt("Autocompleter",Ow,n)},Dw=function(n){var t={};return G(n,(function(n){t[n]={}})),fn(t)},Aw=function(n){var t=n.ui.registry.getAll().popups,e=mn(t,(function(n){return Bw(n).fold((function(n){throw new Error(ee(n))}),(function(n){return n}))})),o=Dw(pn(e,(function(n){return n.ch}))),r=hn(e),i=function(n){return q(r,(function(t){return t.ch===n}))};return{dataset:e,triggerChars:o,lookupByChar:i}},_w=[He("disabled",!1),Be("text"),Be("shortcut"),Ut("value","value",In((function(){return _u("menuitem-value")})),ie()),Fe("meta",{})],Mw=Vt([he("type"),Pe("onSetup",(function(){return e})),Pe("onAction",e),Be("icon")].concat(_w)),Fw=function(n){return Zt("menuitem",Mw,n)},Iw=Vt([he("type"),xe("getSubmenuItems"),Pe("onSetup",(function(){return e})),Be("icon")].concat(_w)),Rw=function(n){return Zt("nestedmenuitem",Iw,n)},Nw=Vt([he("type"),He("active",!1),Pe("onSetup",(function(){return e})),xe("onAction")].concat(_w)),Vw=function(n){return Zt("togglemenuitem",Nw,n)},Hw=Vt([he("type"),He("active",!1),Be("icon")].concat(_w)),Pw=function(n){return Zt("choicemenuitem",Hw,n)},zw=["inserttable","colorswatch"],Lw=Vt([he("type"),be("fancytype",zw),Pe("onAction",e)]),jw=function(n){return Zt("fancymenuitem",Lw,n)},Uw=function(n,t,e){var o=ud(n.element(),"."+e);if(o.length>0){var r=Q(o,(function(n){var e=n.dom().getBoundingClientRect().top,r=o[0].dom().getBoundingClientRect().top;return Math.abs(e-r)>t})).getOr(o.length);return w.some({numColumns:r,numRows:Math.ceil(o.length/r)})}return w.none()},Ww=function(n,t){return lf([cy(n,t)])},Gw=function(n){return Ww(_u("unnamed-events"),n)},Xw={namedEvents:Ww,unnamedEvents:Gw},Yw=[ge("lazySink"),ge("tooltipDom"),Fe("exclusive",!0),Fe("tooltipComponents",[]),Fe("delay",300),Ve("mode","normal",["normal","follow-highlight"]),Fe("anchor",(function(n){return{anchor:"hotspot",hotspot:n,layouts:{onLtr:i([Js,Ks,Gs,Ys,Xs,qs]),onRtl:i([Js,Ks,Gs,Ys,Xs,qs])}}})),hs("onHide"),hs("onShow")],qw=function(){var n=We(w.none()),e=We(w.none()),o=function(){return e.get()},r=function(n){e.set(w.some(n))},u=function(){e.set(w.none())},a=function(){n.get().each((function(n){t.clearTimeout(n)}))},c=function(e,o){a(),n.set(w.some(t.setTimeout((function(){e()}),o)))},s=function(){return e.get().isSome()},f=i("not-implemented");return Qu({getTooltip:o,isShowing:s,setTooltip:r,clearTooltip:u,clearTimer:a,resetTimer:c,readState:f})},Kw=Object.freeze({init:qw}),Jw=_u("tooltip.exclusive"),$w=_u("tooltip.show"),Qw=_u("tooltip.hide"),Zw=function(n,t,e){n.getSystem().broadcastOn([Jw],{})},nS=function(n,t,e,o){e.getTooltip().each((function(n){n.getSystem().isConnected()&&uy.set(n,o)}))},tS=Object.freeze({hideAllExclusive:Zw,setComponents:nS}),eS=function(n,t){var e=function(e){t.getTooltip().each((function(o){Fm(o),n.onHide(e,o),t.clearTooltip()})),t.clearTimer()},o=function(e){if(!t.isShowing()){Zw(e);var o=n.lazySink(e).getOrDie(),r=e.getSystem().build({dom:n.tooltipDom,components:n.tooltipComponents,events:Ci("normal"===n.mode?[Ei(wr(),(function(n){ri(e,$w)})),Ei(yr(),(function(n){ri(e,Qw)}))]:[]),behaviours:lf([uy.config({})])});t.setTooltip(r),Am(o,r),n.onShow(e,r),km.position(o,n.anchor(e),r)}};return Ci(Z([[Ei($w,(function(e){t.resetTimer((function(){o(e)}),n.delay)})),Ei(Qw,(function(o){t.resetTimer((function(){e(o)}),n.delay)})),Ei(Rr(),(function(n,t){var o=t;z(o.channels(),Jw)&&e(n)})),Hi((function(n){e(n)}))],"normal"===n.mode?[Ei(Sr(),(function(n){ri(n,$w)})),Ei(Fr(),(function(n){ri(n,Qw)})),Ei(wr(),(function(n){ri(n,$w)})),Ei(yr(),(function(n){ri(n,Qw)}))]:[Ei(ei(),(function(n,t){ri(n,$w)})),Ei(oi(),(function(n){ri(n,Qw)}))]]))},oS=Object.freeze({events:eS}),rS=mf({fields:Yw,name:"tooltipping",active:oS,state:Kw,apis:tS}),iS=function(n){var t=void 0!==n.dom().attributes?n.dom().attributes:[];return J(t,(function(n,t){var e;return"class"===t.name?n:m(m({},n),(e={},e[t.name]=t.value,e))}),{})},uS=function(n){return Array.prototype.slice.call(n.dom().classList,0)},aS=function(n){var t=Je.fromHtml(n),e=nu(t),o=iS(t),r=uS(t),i=0===e.length?{}:{innerHtml:gu(t)};return m({tag:li(t),classes:r,attributes:o},i)},cS=tinymce.util.Tools.resolve("tinymce.util.I18n"),sS="tox-menu-nav__js",fS="tox-collection__item",lS="tox-swatch",dS={normal:sS,color:lS},mS="tox-collection__item--enabled",gS="tox-collection__group-heading",pS="tox-collection__item-icon",vS="tox-collection__item-label",hS="tox-collection__item-accessory",bS="tox-collection__item-caret",yS="tox-collection__item-checkmark",xS="tox-collection__item--active",wS="tox-collection__item-icon-rtl",SS=function(n){return Yn(dS,n).getOr(sS)},CS=tinymce.util.Tools.resolve("tinymce.Env"),kS=function(n){var t={alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"},e={meta:"Ctrl",access:"Shift+Alt"},o=CS.mac?t:e,r=n.split("+"),i=W(r,(function(n){var t=n.toLowerCase().trim();return yn(o,t)?o[t]:n}));return CS.mac?i.join(""):i.join("+")},OS={convertText:kS},TS=function(n){return{dom:{tag:"div",classes:[pS],innerHtml:n}}},ES=function(n){return{dom:{tag:"div",classes:[vS]},components:[ic(cS.translate(n))]}},BS=function(n){return{dom:{tag:"div",classes:[vS],innerHtml:n}}},DS=function(n,t){return{dom:{tag:"div",classes:[vS]},components:[{dom:{tag:n.tag,attributes:{style:n.styleAttr}},components:[ic(cS.translate(t))]}]}},AS=function(n){return{dom:{tag:"div",classes:[hS],innerHtml:OS.convertText(n)}}},_S=function(n){return{dom:{tag:"div",classes:[pS,yS],innerHtml:Vx("checkmark",n)}}},MS=function(n){return{dom:{tag:"div",classes:[bS],innerHtml:Vx("chevron-right",n)}}},FS=function(n){return{dom:{tag:"div",classes:[bS],innerHtml:Vx("chevron-down",n)}}},IS=function(n,t,e,o){var r="custom",i="remove",u=function(){var u=lS,a=e.getOr(""),c=n.map((function(n){return' title="'+o.translate(n)+'"'})).getOr("");return aS(t===r?'":t===i?'
"+a+"
":'
")};return{dom:u(),optComponents:[]}},RS=function(n,t,e,o,r){var i=e?n.checkMark.orThunk((function(){return t.or(w.some("")).map(TS)})):w.none(),u=n.ariaLabel.map((function(n){return{attributes:{title:cS.translate(n)}}})).getOr({}),a=En({tag:"div",classes:[sS,fS].concat(r?[wS]:[])},u),c=n.htmlContent.fold((function(){return n.textContent.map(o)}),(function(n){return w.some(BS(n))})),s={dom:a,optComponents:[i,c,n.shortcutContent.map(AS),n.caret]};return s},NS=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],VS=["list-bull-circle","list-bull-default","list-bull-square"],HS=function(n,t,e,o){void 0===o&&(o=w.none());var r=function(n){return n.map((function(n){return cS.isRtl()&&z(NS,n)?n+"-rtl":n}))},i=cS.isRtl()&&n.iconContent.exists((function(n){return z(VS,n)})),u=r(n.iconContent).map((function(n){return Hx(n,t.icons,o)})),c=w.from(n.meta).fold((function(){return ES}),(function(n){return yn(n,"style")?a(DS,n.style):ES}));return"color"===n.presets?IS(n.ariaLabel,n.value,u,t):RS(n,u,e,c,i)},PS=["input","button","textarea","select"],zS=function(n,t,e){t.disabled&&qS(n,t)},LS=function(n,t){return!0===t.useNative&&z(PS,li(n.element()))},jS=function(n){return wu(n.element(),"disabled")},US=function(n){bu(n.element(),"disabled","disabled")},WS=function(n){Su(n.element(),"disabled")},GS=function(n){return"true"===xu(n.element(),"aria-disabled")},XS=function(n){bu(n.element(),"aria-disabled","true")},YS=function(n){bu(n.element(),"aria-disabled","false")},qS=function(n,t,e){t.disableClass.each((function(t){Aa(n.element(),t)}));var o=LS(n,t)?US:XS;o(n),t.onDisabled(n)},KS=function(n,t,e){t.disableClass.each((function(t){Ma(n.element(),t)}));var o=LS(n,t)?WS:YS;o(n),t.onEnabled(n)},JS=function(n,t){return LS(n,t)?jS(n):GS(n)},$S=function(n,t,e,o){var r=o?qS:KS;r(n,t,e)},QS=Object.freeze({enable:KS,disable:qS,isDisabled:JS,onLoad:zS,set:$S}),ZS=function(n,t,e){return oa({classes:t.disabled?t.disableClass.map(rn).getOr([]):[]})},nC=function(n,t){return Ci([ki(Nr(),(function(t,e){return JS(t,n)})),rf(n,t,zS)])},tC=Object.freeze({exhibit:ZS,events:nC}),eC=[Fe("disabled",!1),Fe("useNative",!0),Oe("disableClass"),hs("onDisabled"),hs("onEnabled")],oC=mf({fields:eC,name:"disabling",active:tC,apis:QS}),rC=function(n){return oC.config({disabled:n,disableClass:"tox-collection__item--state-disabled"})},iC=function(n){return oC.config({disabled:n})},uC=function(n){return oC.config({disabled:n,disableClass:"tox-tbtn--disabled"})},aC=function(n){return oC.config({disabled:n,disableClass:"tox-tbtn--disabled",useNative:!1})},cC={item:rC,button:iC,splitButton:uC,toolbarButton:aC},sC=function(n,t){var e=n.getApi(t);return function(n){n(e)}},fC=function(n,t){return Vi((function(e){var o=sC(n,e);o((function(e){var o=n.onSetup(e);null!==o&&void 0!==o&&t.set(o)}))}))},lC=function(n,t){return Hi((function(e){return sC(n,e)(t.get())}))};(function(n){n[n["CLOSE_ON_EXECUTE"]=0]="CLOSE_ON_EXECUTE",n[n["BUBBLE_TO_SANDBOX"]=1]="BUBBLE_TO_SANDBOX"})(Gx||(Gx={}));var dC=Gx,mC=function(n,t){return zi((function(e,o){sC(n,e)(n.onAction),n.triggersSubmenu||t!==dC.CLOSE_ON_EXECUTE||(ri(e,Lr()),o.stop())}))},gC={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},pC=function(n){return nn(n,(function(n){return n.toArray()}))},vC=function(n,t,o){var r=We(e);return{type:"item",dom:t.dom,components:pC(t.optComponents),data:n.data,eventOrder:gC,hasSubmenu:n.triggersSubmenu,itemBehaviours:lf([cy("item-events",[mC(n,o),fC(n,r),lC(n,r)]),cC.item(n.disabled),uy.config({})].concat(n.itemBehaviours))}},hC=function(n){return{value:n.value,meta:En({text:n.text.getOr("")},n.meta)}},bC=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),yC=function(n,t){return bn(n,"tooltipWorker").map((function(n){return[rS.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(n){return{anchor:"submenu",item:n,overrides:{maxHeightFunction:fm}}},mode:"follow-highlight",onShow:function(t,e){n((function(n){rS.setComponents(t,[uc({element:Je.fromDom(n)})])}))}})]})).getOr([])},xC=function(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},wC=function(n){return bC.DOM.encode(n)},SC=function(n,t){var e=cS.translate(n),o=wC(e);if(t.length>0){var r=new RegExp(xC(t),"gi");return o.replace(r,(function(n){return''+n+""}))}return o},CC=function(n,t,e,o,r,i,u,a){void 0===a&&(a=!0);var c=HS({presets:o,textContent:w.none(),htmlContent:e?n.text.map((function(n){return SC(n,t)})):w.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:w.none(),checkMark:w.none(),caret:w.none(),value:n.value},u.providers,a,n.icon);return vC({data:hC(n),disabled:n.disabled,getApi:function(){return{}},onAction:function(t){return r(n.value,n.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:yC(n.meta,u)},c,i)},kC=function(n,t,e,o,r,i,u){var a=function(n){return{setActive:function(t){Ny.set(n,t)},isActive:function(){return Ny.isOn(n)},isDisabled:function(){return oC.isDisabled(n)},setDisabled:function(t){return oC.set(n,t)}}},c=HS({presets:e,textContent:t?n.text:w.none(),htmlContent:w.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:t?n.shortcut:w.none(),checkMark:t?w.some(_S(u.icons)):w.none(),caret:w.none(),value:n.value},u,!0);return Tn(vC({data:hC(n),disabled:n.disabled,getApi:a,onAction:function(t){return o(n.value)},onSetup:function(n){return n.setActive(r),function(){}},triggersSubmenu:!1,itemBehaviours:[]},c,i),{toggling:{toggleClass:mS,toggleOnExecute:!1,selected:n.active}})},OC=i(Tp(Yy(),qy())),TC=_u("cell-over"),EC=_u("cell-execute"),BC=function(n,t,e){var o,r=function(e){return ii(e,TC,{row:n,col:t})},i=function(e){return ii(e,EC,{row:n,col:t})};return cc({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=e,o)},behaviours:lf([cy("insert-table-picker-cell",[Ei(wr(),hy.focus),Ei(Nr(),i),Ei(Pr(),i)]),Ny.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),hy.config({onFocus:r})])})},DC=function(n,t,e){for(var o=[],r=0;r=0&&t<=255},KC=function(n){var t,e,o,r=(n.hue()||0)%360,i=n.saturation()/100,u=n.value()/100;if(i=UC(0,jC(i,1)),u=UC(0,jC(u,1)),0===i)return t=e=o=WC(255*u),YC(t,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),f=u-c;switch(Math.floor(a)){case 0:t=c,e=s,o=0;break;case 1:t=s,e=c,o=0;break;case 2:t=0,e=c,o=s;break;case 3:t=0,e=s,o=c;break;case 4:t=s,e=0,o=c;break;case 5:t=c,e=0,o=s;break;default:t=e=o=0}return t=WC(255*(t+f)),e=WC(255*(e+f)),o=WC(255*(o+f)),YC(t,e,o,1)},JC=function(n){var t=PC(n),e=parseInt(t[1],16),o=parseInt(t[2],16),r=parseInt(t[3],16);return YC(e,o,r,1)},$C=function(n,t,e,o){var r=parseInt(n,10),i=parseInt(t,10),u=parseInt(e,10),a=parseFloat(o);return YC(r,i,u,a)},QC=function(n){if("transparent"===n)return w.some(YC(0,0,0,0));var t=GC.exec(n);if(null!==t)return w.some($C(t[1],t[2],t[3],"1"));var e=XC.exec(n);return null!==e?w.some($C(e[1],e[2],e[3],e[4])):w.none()},ZC=function(n){return"rgba("+n.red()+","+n.green()+","+n.blue()+","+n.alpha()+")"},nk=i(YC(255,0,0,1)),tk=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),ek="tinymce-custom-colors";function ok(n){void 0===n&&(n=10);var t=tk.getItem(ek),e=B(t)?JSON.parse(t):[],o=function(t){var e=n-t.length;return e<0?t.slice(0,n):t},r=o(e),i=function(t){P(r,t).each(u),r.unshift(t),r.length>n&&r.pop(),tk.setItem(ek,JSON.stringify(r))},u=function(n){r.splice(n,1)},a=function(){return r.slice(0)};return{add:i,state:a}}var rk="choiceitem",ik=[{type:rk,text:"Light Green",value:"#BFEDD2"},{type:rk,text:"Light Yellow",value:"#FBEEB8"},{type:rk,text:"Light Red",value:"#F8CAC6"},{type:rk,text:"Light Purple",value:"#ECCAFA"},{type:rk,text:"Light Blue",value:"#C2E0F4"},{type:rk,text:"Green",value:"#2DC26B"},{type:rk,text:"Yellow",value:"#F1C40F"},{type:rk,text:"Red",value:"#E03E2D"},{type:rk,text:"Purple",value:"#B96AD9"},{type:rk,text:"Blue",value:"#3598DB"},{type:rk,text:"Dark Turquoise",value:"#169179"},{type:rk,text:"Orange",value:"#E67E23"},{type:rk,text:"Dark Red",value:"#BA372A"},{type:rk,text:"Dark Purple",value:"#843FA1"},{type:rk,text:"Dark Blue",value:"#236FA1"},{type:rk,text:"Light Gray",value:"#ECF0F1"},{type:rk,text:"Medium Gray",value:"#CED4D9"},{type:rk,text:"Gray",value:"#95A5A6"},{type:rk,text:"Dark Gray",value:"#7E8C8D"},{type:rk,text:"Navy Blue",value:"#34495E"},{type:rk,text:"Black",value:"#000000"},{type:rk,text:"White",value:"#ffffff"}],uk=ok(10),ak=function(n){var e=[],o=t.document.createElement("canvas");o.height=1,o.width=1;for(var r=o.getContext("2d"),i=function(n,t){var e=255,o=t/255,r=Math.round(n*o+e*(1-o));return("0"+r.toString(16)).slice(-2).toUpperCase()},u=function(n){if(/^[0-9A-Fa-f]{6}$/.test(n))return"#"+n.toUpperCase();r.clearRect(0,0,o.width,o.height),r.fillStyle="#FFFFFF",r.fillStyle=n,r.fillRect(0,0,1,1);var t=r.getImageData(0,0,1,1).data,e=t[0],u=t[1],a=t[2],c=t[3];return"#"+i(e,c)+i(u,c)+i(a,c)},a=0;a0&&e.push(o),o=[],yn(n.dom,"innerHtml")&&o.push(n)):o.push(n)})),o.length>0&&e.push(o),W(e,(function(n){return{dom:{tag:"div",classes:["tox-collection__group"]},components:n}}))},jk=function(n,t,e){return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:["tox-collection--grid"])},components:[ix.parts().items({preprocess:function(e){return"auto"!==n&&n>1?Hk({tag:"div",classes:["tox-collection__group"]},n)(e):Lk(e,(function(n,e){return"separator"===t[e].type}))}})]}},Uk=function(n,t){return{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[ix.parts().items({preprocess:function(t){return Lk(t,(function(t,e){return"separator"===n[e].type}))}})]}},Wk=function(n){return"color"===n?"tox-swatches":"tox-menu"},Gk=function(n){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:Wk(n),tieredMenu:"tox-tiered-menu"}},Xk=function(n){var t=Gk(n);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:SS(n)}},Yk=function(n,t,e){var o=Gk(e);return{tag:"div",classes:Z([[o.menu,"tox-menu-"+t+"-column"],n?[o.hasIcons]:[]])}},qk=[ix.parts().items({})],Kk=function(n,t,e){var o=Gk(e),r={tag:"div",classes:Z([[o.tieredMenu]])};return{dom:r,markers:Xk(e)}},Jk=function(n){return void 0!==n.icon||"togglemenuitem"===n.type||"choicemenuitem"===n.type},$k=function(n){return L(n,Jk)},Qk=function(n){return t.console.error(ee(n)),t.console.log(n),w.none()},Zk=function(n,t,e,o,r){var i=Uk(e);return{value:n,dom:i.dom,components:i.components,items:e}},nO=function(n,t,e,o,r){if("color"===r){var i=Pk(o);return{value:n,dom:i.dom,components:i.components,items:e}}if("normal"===r&&"auto"===o){i=jk(o,e);return{value:n,dom:i.dom,components:i.components,items:e}}if("normal"===r&&1===o){i=jk(1,e);return{value:n,dom:i.dom,components:i.components,items:e}}if("normal"===r){i=jk(o,e);return{value:n,dom:i.dom,components:i.components,items:e}}if("listpreview"===r&&"auto"!==o){i=zk(o);return{value:n,dom:i.dom,components:i.components,items:e}}return{value:n,dom:Yk(t,o,r),components:qk,items:e}},tO=function(n,t,e,o,r,i,u,a){var c=$k(t),s="color"!==r?"normal":"color",f=eO(t,e,o,s,i,u,a);return nO(n,c,f,o,r)},eO=function(n,t,e,o,r,i,u){return Jc(W(n,(function(n){return"choiceitem"===n.type?Pw(n).fold(Qk,(function(a){return w.some(kC(a,1===e,o,t,i(n.value),r,u))})):w.none()})))},oO=function(n,t){var e=Xk(t);if(1===n)return{mode:"menu",moveOnTab:!0};if("auto"===n)return{mode:"grid",selector:"."+e.item,initSize:{numColumns:1,numRows:1}};var o="color"===t?"tox-swatches__row":"tox-collection__group";return{mode:"matrix",rowSelector:"."+o}},rO=function(n,t){return 1===n?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===n?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===t?".tox-swatches__row":".tox-collection__group",cell:"color"===t?"."+lS:"."+fS}}};function iO(n,t){var e=Vk.getColors(t.colorinput.getColors(),t.colorinput.hasCustomColors()),o=t.colorinput.getColorCols(),r="color",i=tO(_u("menu-value"),e,(function(t){n.onAction({value:t})}),o,r,dC.CLOSE_ON_EXECUTE,(function(){return!1}),t.shared.providers),u=Tn(m(m({},i),{markers:Xk(r),movement:oO(o,r)}));return{type:"widget",data:{value:_u("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[OC().widget(ix.sketch(u))]}}var uO,aO={inserttable:FC,colorswatch:iO},cO=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)?w.some(n[t]):w.none()},sO=function(n,t){return cO(aO,n.fancytype).map((function(e){return e(n,t)}))},fO=function(n,t,e,o){void 0===o&&(o=!0);var r=function(n){return{isDisabled:function(){return oC.isDisabled(n)},setDisabled:function(t){return oC.set(n,t)}}},i=HS({presets:"normal",iconContent:n.icon,textContent:n.text,htmlContent:w.none(),ariaLabel:n.text,caret:w.none(),checkMark:w.none(),shortcutContent:n.shortcut},e,o);return vC({data:hC(n),getApi:r,disabled:n.disabled,onAction:n.onAction,onSetup:n.onSetup,triggersSubmenu:!1,itemBehaviours:[]},i,t)},lO=function(n,t,o,r,i){void 0===r&&(r=!0),void 0===i&&(i=!1);var u=i?FS(o.icons):MS(o.icons),a=function(n){return{isDisabled:function(){return oC.isDisabled(n)},setDisabled:function(t){return oC.set(n,t)}}},c=HS({presets:"normal",iconContent:n.icon,textContent:n.text,htmlContent:w.none(),ariaLabel:n.text,caret:w.some(u),checkMark:w.none(),shortcutContent:n.shortcut},o,r);return vC({data:hC(n),getApi:a,disabled:n.disabled,onAction:e,onSetup:n.onSetup,triggersSubmenu:!0,itemBehaviours:[]},c,t)},dO=function(n){var t=n.text.fold((function(){return{}}),(function(n){return{innerHtml:n}}));return{type:"separator",dom:m({tag:"div",classes:[fS,gS]},t),components:[]}},mO=function(n,t,e){var o=function(n){return{setActive:function(t){Ny.set(n,t)},isActive:function(){return Ny.isOn(n)},isDisabled:function(){return oC.isDisabled(n)},setDisabled:function(t){return oC.set(n,t)}}},r=HS({iconContent:w.none(),textContent:n.text,htmlContent:w.none(),ariaLabel:n.text,checkMark:w.some(_S(e.icons)),caret:w.none(),shortcutContent:n.shortcut,presets:"normal",meta:n.meta},e,!0);return Tn(vC({data:hC(n),disabled:n.disabled,getApi:o,onAction:n.onAction,onSetup:n.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t),{toggling:{toggleClass:mS,toggleOnExecute:!1,selected:n.active}})},gO=CC,pO=dO,vO=fO,hO=lO,bO=mO,yO=sO;(function(n){n[n["ContentFocus"]=0]="ContentFocus",n[n["UiFocus"]=1]="UiFocus"})(uO||(uO={}));var xO=function(n){return void 0!==n.icon||"togglemenuitem"===n.type||"choicemenuitem"===n.type},wO=function(n){return L(n,xO)},SO=function(n,e,o,r,i){var u=o.shared.providers,a=function(n){return i?m(m({},n),{shortcut:w.none(),icon:n.text.isSome()?w.none():n.icon}):n};switch(n.type){case"menuitem":return Fw(n).fold(Qk,(function(n){return w.some(vO(a(n),e,u,r))}));case"nestedmenuitem":return Rw(n).fold(Qk,(function(n){return w.some(hO(a(n),e,u,r,i))}));case"togglemenuitem":return Vw(n).fold(Qk,(function(n){return w.some(bO(a(n),e,u))}));case"separator":return Cw(n).fold(Qk,(function(n){return w.some(pO(n))}));case"fancymenuitem":return jw(n).fold(Qk,(function(n){return yO(a(n),o)}));default:return t.console.error("Unknown item in general menu",n),w.none()}},CO=function(n,t,e,o,r,i){var u=1===o,a=!u||wO(n);return Jc(W(n,(function(n){return"separator"===n.type?Tw(n).fold(Qk,(function(n){return w.some(pO(n))})):Ew(n).fold(Qk,(function(n){return w.some(gO(n,t,u,"normal",e,r,i,a))}))})))},kO=function(n,t,e,o,r){var i=wO(t),u=Jc(W(t,(function(n){var t=function(n){return r?!n.hasOwnProperty("text"):i},u=function(n){return SO(n,e,o,t(n),r)};return"nestedmenuitem"===n.type&&n.getSubmenuItems().length<=0?u(En(n,{disabled:!0})):u(n)}))),a=r?Zk:nO;return a(n,i,u,1,"normal")},OO=function(n){return hx.singleData(n.value,n)},TO=function(n,t,e,o){var r=e===uO.ContentFocus?Xv():Gv(),i=oO(t,o),u=Xk(o);return{dom:n.dom,components:n.components,items:n.items,value:n.value,markers:{selectedItem:u.selectedItem,item:u.item},movement:i,fakeFocus:e===uO.ContentFocus,focusManager:r,menuBehaviours:Xw.unnamedEvents("auto"!==t?[]:[Vi((function(n,t){Uw(n,4,u.item).each((function(t){var e=t.numColumns,o=t.numRows;Jb.setGridSize(n,o,e)}))}))])}},EO=function(n,e){var o=We(w.none()),r=We(!1),i=cc(xx.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:lf([cy("dismissAutocompleter",[Ei(Jr(),(function(){return s()}))])]),lazySink:e.getSink})),u=function(){return xx.isOpen(i)},a=function(){return o.get().isSome()},c=function(){a()&&xx.hide(i)},s=function(){if(a()){var t=o.get().map((function(n){return n.element}));ow(t.getOr(Je.fromDom(n.selection.getNode()))).each(mu),c(),o.set(w.none()),r.set(!1)}},f=Bn((function(){return Aw(n)})),l=function(o,i){var u=Qc(i,(function(n){return w.from(n.columns)})).getOr(1);return nn(i,(function(i){var a=i.items;return CO(a,i.matchText,(function(e,u){var a=n.selection.getRng();sw(n.dom,a,o).fold((function(){return t.console.error("Lost context. Cursor probably moved")}),(function(n){var t=n.range,o={hide:function(){s()},reload:function(n){c(),p(n)}};r.set(!0),i.onAction(o,t,e,u),r.set(!1)}))}),u,dC.BUBBLE_TO_SANDBOX,e)}))},d=function(t){if(!a()){var e=ew(n,t.range);o.set(w.some({triggerChar:t.triggerChar,element:e,matchLength:t.text.length})),r.set(!1)}},m=function(t,e,o,r){t.matchLength=e.text.length;var u=Qc(o,(function(n){return w.from(n.columns)})).getOr(1);xx.showAt(i,{anchor:"node",root:Je.fromDom(n.getBody()),node:w.from(t.element)},ix.sketch(TO(nO("autocompleter-value",!0,r,u,"normal"),u,uO.ContentFocus,"normal"))),xx.getContent(i).each(Cv.highlightFirst)},g=function(t){return o.get().map((function(e){return sw(n.dom,n.selection.getRng(),e.triggerChar).bind((function(e){return ww(n,f,e,t)}))})).getOrThunk((function(){return xw(n,f)}))},p=function(n){g(n).fold(s,(function(n){d(n.context),n.lookupData.then((function(t){o.get().map((function(e){var o=n.context;if(e.triggerChar===o.triggerChar){var r=l(o.triggerChar,t);r.length>0?m(e,o,t,r):o.text.length-e.matchLength>=10?s():c()}}))}))}))},v=Yx((function(n){27!==n.which&&p()}),50),h={onKeypress:v,cancelIfNecessary:s,isMenuOpen:u,isActive:a,isProcessingAction:r.get,getView:function(){return xx.getContent(i)}};lw.setup(h,n)},BO={register:EO},DO=function(n,t,e,o,r,u,a){return{target:i(n),x:i(t),y:i(e),stop:o,prevent:r,kill:u,raw:i(a)}},AO=function(n){var t=Je.fromDom(n.target),e=function(){n.stopPropagation()},o=function(){n.preventDefault()},i=r(o,e);return DO(t,n.clientX,n.clientY,e,o,i,n)},_O=function(n,t){return function(e){n(e)&&t(AO(e))}},MO=function(n,t,e,o,r){var i=_O(e,o);return n.dom().addEventListener(t,i,r),{unbind:a(RO,n,t,i,r)}},FO=function(n,t,e,o){return MO(n,t,e,o,!1)},IO=function(n,t,e,o){return MO(n,t,e,o,!0)},RO=function(n,t,e,o){n.dom().removeEventListener(t,e,o)},NO=i(!0),VO=function(n,t,e){return FO(n,t,NO,e)},HO=function(n,t,e){return IO(n,t,NO,e)},PO=AO,zO=function(n,t,e){return Gc(n,t,e).isSome()};function LO(n,e){var o=null,r=function(){for(var r=[],i=0;ijO||o>jO},XO=function(n){var t=We(w.none()),e=We(!1),o=LO((function(t){n.triggerEvent(zr(),t),e.set(!0)}),UO),r=function(n){return WO(n).each((function(r){o.cancel();var u={x:i(r.clientX),y:i(r.clientY),target:n.target};o.schedule(n),e.set(!1),t.set(w.some(u))})),w.none()},u=function(n){return o.cancel(),WO(n).each((function(n){t.get().each((function(e){GO(n,e)&&t.set(w.none())}))})),w.none()},a=function(r){o.cancel();var i=function(n){return or(n.target(),r.target())};return t.get().filter(i).map((function(t){return e.get()?(r.prevent(),!1):n.triggerEvent(Hr(),r)}))},c=Kn([{key:gr(),value:r},{key:pr(),value:u},{key:vr(),value:a}]),s=function(n,t){return Yn(c,t).bind((function(t){return t(n)}))};return{fireIfReady:s}},YO=function(n){var t=n.raw();return t.which===kv()[0]&&!z(["input","textarea"],li(n.target()))&&!zO(n.target(),'[contenteditable="true"]')},qO=Yo().browser.isFirefox(),KO=Nt([xe("triggerEvent"),Fe("stopBackspace",!0)]),JO=function(n,t){return qO?HO(n,"focus",t):VO(n,"focusin",t)},$O=function(n,t){return qO?HO(n,"blur",t):VO(n,"focusout",t)},QO=function(n,e){var o=te("Getting GUI events settings",KO,e),r=Yo().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],i=XO(o),u=W(r.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(function(t){return VO(n,t,(function(n){i.fireIfReady(n,t).each((function(t){t&&n.kill()}));var e=o.triggerEvent(t,n);e&&n.kill()}))})),a=We(w.none()),c=VO(n,"paste",(function(n){i.fireIfReady(n,"paste").each((function(t){t&&n.kill()}));var e=o.triggerEvent("paste",n);e&&n.kill(),a.set(w.some(t.setTimeout((function(){o.triggerEvent(Ir(),n)}),0)))})),s=VO(n,"keydown",(function(n){var t=o.triggerEvent("keydown",n);t?n.kill():!0===o.stopBackspace&&YO(n)&&n.prevent()})),f=JO(n,(function(n){var t=o.triggerEvent("focusin",n);t&&n.kill()})),l=We(w.none()),d=$O(n,(function(n){var e=o.triggerEvent("focusout",n);e&&n.kill(),l.set(w.some(t.setTimeout((function(){o.triggerEvent(Fr(),n)}),0)))})),m=function(){G(u,(function(n){n.unbind()})),s.unbind(),f.unbind(),d.unbind(),c.unbind(),a.get().each(t.clearTimeout),l.get().each(t.clearTimeout)};return{unbind:m}},ZO=function(n,t){var e=Yn(n,"target").map((function(n){return n()})).getOr(t);return We(e)},nT=function(n,t){var e=We(!1),o=We(!1),r=function(){e.set(!0)},u=function(){o.set(!0)};return{stop:r,cut:u,isStopped:e.get,isCut:o.get,event:i(n),setSource:t.set,getSource:t.get}},tT=function(n){var t=We(!1),o=function(){t.set(!0)};return{stop:o,cut:e,isStopped:t.get,isCut:i(!1),event:i(n),setSource:s("Cannot set source of a broadcasted event"),getSource:s("Cannot get source of a broadcasted event")}},eT=wn.generate([{stopped:[]},{resume:["element"]},{complete:[]}]),oT=function(n,t,e,o,r,i){var u=n(t,o),a=nT(e,r);return u.fold((function(){return i.logEventNoHandlers(t,o),eT.complete()}),(function(n){var e=n.descHandler(),o=fa(e);return o(a),a.isStopped()?(i.logEventStopped(t,n.element(),e.purpose()),eT.stopped()):a.isCut()?(i.logEventCut(t,n.element(),e.purpose()),eT.complete()):$i(n.element()).fold((function(){return i.logNoParent(t,n.element(),e.purpose()),eT.complete()}),(function(o){return i.logEventResponse(t,n.element(),e.purpose()),eT.resume(o)}))}))},rT=function(n,t,e,o,r,i){return oT(n,t,e,o,r,i).fold((function(){return!0}),(function(o){return rT(n,t,e,o,r,i)}),(function(){return!1}))},iT=function(n,t,e,o,r){var i=ZO(e,o);return oT(n,t,e,o,i,r)},uT=function(n,t,e){var o=tT(t);return G(n,(function(n){var t=n.descHandler(),e=fa(t);e(o)})),o.isStopped()},aT=function(n,t,e,o){var r=e.target();return cT(n,t,e,r,o)},cT=function(n,t,e,o,r){var i=ZO(e,o);return rT(n,t,e,o,i,r)},sT=Li("element","descHandler"),fT=function(n,t){return{id:i(n),descHandler:i(t)}};function lT(){var n={},t=function(t,e,o){dn(o,(function(o,r){var i=void 0!==n[r]?n[r]:{};i[e]=sa(o,t),n[r]=i}))},e=function(n,t){return Hu(t).fold((function(){return w.none()}),(function(e){var o=Gn(e);return n.bind(o).map((function(n){return sT(t,n)}))}))},o=function(t){return Yn(n,t).map((function(n){return pn(n,(function(n,t){return fT(t,n)}))})).getOr([])},r=function(t,o,r){var i=Gn(o),u=i(n);return Si(r,(function(n){return e(u,n)}),t)},i=function(t){dn(n,(function(n,e){n.hasOwnProperty(t)&&delete n[t]}))};return{registerId:t,unregisterId:i,filterByType:o,find:r}}function dT(){var n=lT(),t={},e=function(n){var t=n.element();return Hu(t).fold((function(){return Nu("uid-",n.element())}),(function(n){return n}))},o=function(n,e){var o=t[e];if(o!==n)throw new Error('The tagId "'+e+'" is already used by: '+Tu(o.element())+"\nCannot use it for: "+Tu(n.element())+"\nThe conflicting element is"+(vi(o.element())?" ":" not ")+"already in the DOM");i(n)},r=function(r){var i=e(r);Zn(t,i)&&o(r,i);var u=[r];n.registerId(u,i,r.events()),t[i]=r},i=function(e){Hu(e.element()).each((function(e){delete t[e],n.unregisterId(e)}))},u=function(t){return n.filterByType(t)},a=function(t,e,o){return n.find(t,e,o)},c=function(n){return Gn(n)(t)};return{find:a,filter:u,register:r,unregister:i,getById:c}}var mT,gT=function(n){var t=n.dom,e=t.attributes,o=g(t,["attributes"]);return{uid:n.uid,dom:m({tag:"div",attributes:m({role:"presentation"},e)},o),components:n.components,behaviours:jg(n.containerBehaviours),events:n.events,domModification:n.domModification,eventOrder:n.eventOrder}},pT=$p({name:"Container",factory:gT,configFields:[Fe("components",[]),Lg("containerBehaviours",[]),Fe("events",{}),Fe("domModification",{}),Fe("eventOrder",{})]}),vT=function(n){var t=function(t){return $i(n.element()).fold((function(){return!0}),(function(n){return or(t,n)}))},o=dT(),r=function(n,e){return o.find(t,n,e)},u=QO(n.element(),{triggerEvent:function(n,t){return as(n,t.target(),(function(e){return aT(r,n,t,e)}))}}),a={debugInfo:i("real"),triggerEvent:function(n,t,e){as(n,t,(function(o){cT(r,n,e,t,o)}))},triggerFocus:function(n,t){Hu(n).fold((function(){kf(n)}),(function(o){as(Mr(),n,(function(o){iT(r,Mr(),{originator:i(t),kill:e,prevent:e,target:i(n)},n,o)}))}))},triggerEscape:function(n,t){a.triggerEvent("keydown",n.element(),t.event())},getByUid:function(n){return h(n)},getByDom:function(n){return b(n)},build:cc,addToGui:function(n){f(n)},removeFromGui:function(n){l(n)},addToWorld:function(n){c(n)},removeFromWorld:function(n){s(n)},broadcast:function(n){g(n)},broadcastOn:function(n,t){p(n,t)},broadcastEvent:function(n,t){v(n,t)},isConnected:i(!0)},c=function(n){n.connect(a),pi(n.element())||(o.register(n),G(n.components(),c),a.triggerEvent(Ur(),n.element(),{target:i(n.element())}))},s=function(n){pi(n.element())||(G(n.components(),s),o.unregister(n)),n.disconnect()},f=function(t){Am(n,t)},l=function(n){Fm(n)},d=function(){u.unbind(),du(n.element())},m=function(n){var t=o.filter(Rr());G(t,(function(t){var e=t.descHandler(),o=fa(e);o(n)}))},g=function(n){m({universal:i(!0),data:i(n)})},p=function(n,t){m({universal:i(!1),channels:i(n),data:i(t)})},v=function(n,t){var e=o.filter(n);return uT(e,t)},h=function(n){return o.getById(n).fold((function(){return O.error(new Error('Could not find component with uid: "'+n+'" in system.'))}),O.value)},b=function(n){var t=Hu(n).getOr("not found");return h(t)};return c(n),{root:i(n),element:n.element,destroy:d,add:f,remove:l,getByUid:h,getByDom:b,addToWorld:c,removeFromWorld:s,broadcast:g,broadcastOn:p,broadcastEvent:v}},hT=tinymce.util.Tools.resolve("tinymce.EditorManager"),bT=function(n){var t=n.settings,e=t.skin,o=t.skin_url;if(!1!==e){var r=e||"oxide";o=o?n.documentBaseURI.toAbsolute(o):hT.baseURL+"/skins/ui/"+r}return o},yT=function(n){return n.getParam("readonly",!1,"boolean")},xT=function(n){return!1===n.getParam("skin")},wT=function(n){return n.getParam("height",Math.max(n.getElement().offsetHeight,200))},ST=function(n){return w.from(n.settings.min_width).filter(F)},CT=function(n){return w.from(n.settings.min_height).filter(F)},kT=function(n){return w.from(n.getParam("max_width")).filter(F)},OT=function(n){return w.from(n.getParam("max_height")).filter(F)},TT=function(n){return w.from(n.getParam("style_formats")).filter(A)},ET=function(n){return n.getParam("style_formats_merge",!1,"boolean")},BT=function(n){return n.getParam("removed_menuitems","")},DT=function(n){return!1!==n.getParam("menubar",!0,"boolean")},AT=function(n){var t=n.getParam("toolbar",!0),e=!0===t,o=B(t),r=A(t)&&t.length>0;return!MT(n)&&(r||o||e)},_T=function(n){var t=fn(n.settings),e=q(t,(function(n){return/^toolbar([1-9])$/.test(n)})),o=W(e,(function(t){return n.getParam(t,!1,"string")})),r=q(o,(function(n){return"string"===typeof n}));return r.length>0?w.some(r):w.none()},MT=function(n){return _T(n).fold((function(){var t=n.getParam("toolbar",[],"string[]");return t.length>0}),(function(){return!0}))};(function(n){n["default"]="",n["floating"]="floating",n["sliding"]="sliding"})(mT||(mT={}));var FT=function(n){return n.getParam("toolbar_drawer","","string")},IT=function(n){return n.getParam("fixed_toolbar_container","","string")},RT=function(n){var t=IT(n);return t.length>0&&n.inline?Wc(hi(),t):w.none()},NT=function(n){return n.inline&&RT(n).isSome()},VT=function(n){var t=RT(n);return t.getOr(hi())},HT=function(n){return n.inline&&!DT(n)&&!AT(n)&&!MT(n)},PT=function(n){var t=n.getParam("toolbar_sticky",!1,"boolean");return(t||n.inline)&&!NT(n)&&!HT(n)},zT=function(n){return n.getParam("draggable_modal",!1,"boolean")},LT=_u("form-component-change"),jT=_u("form-close"),UT=_u("form-cancel"),WT=_u("form-action"),GT=_u("form-submit"),XT=_u("form-block"),YT=_u("form-unblock"),qT=_u("form-tabchange"),KT=_u("form-resize"),JT=function(n,t){return pT.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in","tox-notification--"+n.level]},components:[{dom:{tag:"div",classes:["tox-notification__icon"]},components:[Ix.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:Vx(n.icon,t.icons),attributes:{title:t.translate(n.iconTooltip)}},action:function(t){ii(t,WT,{name:"alert-banner",value:n.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(n.text)}}]})},$T=function(n,t){return{dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:W(n.items,t.interpreter)}},QT=i([Fe("prefix","form-field"),Lg("fieldBehaviours",[ov,zg])]),ZT=i([xp({schema:[ge("dom")],name:"label"}),xp({factory:{sketch:function(n){return{uid:n.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:n.text}}}},schema:[ge("text")],name:"aria-descriptor"}),bp({factory:{sketch:function(n){var t=Wn(n,["factory"]);return n.factory.sketch(t)}},schema:[ge("factory")],name:"field"})]),nE=function(n,t,e,o){var r=Ug(n.fieldBehaviours,[ov.config({find:function(t){return Fp(t,n,"field")}}),zg.config({store:{mode:"manual",getValue:function(n){return ov.getCurrent(n).bind(zg.getValue)},setValue:function(n,t){ov.getCurrent(n).each((function(n){zg.setValue(n,t)}))}}})]),i=Ci([Vi((function(t,e){var o=Rp(t,n,["label","field","aria-descriptor"]);o.field().each((function(t){var e=_u(n.prefix);o.label().each((function(n){bu(n.element(),"for",e),bu(t.element(),"id",e)})),o["aria-descriptor"]().each((function(e){var o=_u(n.prefix);bu(e.element(),"id",o),bu(t.element(),"aria-describedby",o)}))}))}))]),u={getField:function(t){return Fp(t,n,"field")},getLabel:function(t){return Fp(t,n,"label")}};return{uid:n.uid,dom:n.dom,components:t,behaviours:r,events:i,apis:u}},tE=Qp({name:"FormField",configFields:QT(),partFields:ZT(),factory:nE,apis:{getField:function(n,t){return n.getField(t)},getLabel:function(n,t){return n.getLabel(t)}}}),eE=i([Oe("data"),Fe("inputAttributes",{}),Fe("inputStyles",{}),Fe("tag","input"),Fe("inputClasses",[]),hs("onSetValue"),Fe("styles",{}),Fe("eventOrder",{}),Lg("inputBehaviours",[zg,hy]),Fe("selectOnFocus",!0)]),oE=function(n){return lf([hy.config({onFocus:!1===n.selectOnFocus?e:function(n){var t=n.element(),e=qa(t);t.dom().setSelectionRange(0,e.length)}})])},rE=function(n){return m(m({},oE(n)),Ug(n.inputBehaviours,[zg.config({store:{mode:"manual",initialValue:n.data.getOr(void 0),getValue:function(n){return qa(n.element())},setValue:function(n,t){var e=qa(n.element());e!==t&&Ka(n.element(),t)}},onSetValue:n.onSetValue})]))},iE=function(n){return{tag:n.tag,attributes:m({type:"text"},n.inputAttributes),styles:n.inputStyles,classes:n.inputClasses}},uE=function(n,t){return{uid:n.uid,dom:iE(n),components:[],behaviours:rE(n),eventOrder:n.eventOrder}},aE=$p({name:"Input",configFields:eE(),factory:uE}),cE={},sE={exports:cE};(function(t,e,o,r){(function(r){if("object"===typeof e&&"undefined"!==typeof o)o.exports=r();else if("function"===typeof t&&t.amd)t([],r);else{var i;i="undefined"!==typeof window?window:"undefined"!==typeof n?n:"undefined"!==typeof self?self:this,i.EphoxContactWrapper=r()}})((function(){return function(){function n(t,e,o){function i(a,c){if(!e[a]){if(!t[a]){var s="function"==typeof r&&r;if(!c&&s)return s(a,!0);if(u)return u(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=e[a]={exports:{}};t[a][0].call(l.exports,(function(n){var e=t[a][1][n];return i(e||n)}),l,l.exports,n,t,e,o)}return e[a].exports}for(var u="function"==typeof r&&r,a=0;a1)for(var e=1;e=0&&(n._idleTimeoutId=setTimeout((function(){n._onTimeout&&n._onTimeout()}),t))},e.setImmediate="function"===typeof t?t:function(n){var t=c++,o=!(arguments.length<2)&&u.call(arguments,1);return a[t]=!0,r((function(){a[t]&&(o?n.apply(null,o):n.call(null),e.clearImmediate(t))})),t},e.clearImmediate="function"===typeof o?o:function(n){delete a[n]}}).call(this,n("timers").setImmediate,n("timers").clearImmediate)},{"process/browser.js":1,timers:3}],4:[function(n,t,e){var o=n("promise-polyfill"),r=function(){return"undefined"!==typeof window?window:Function("return this;")()}();t.exports={boltExport:r.Promise||o}},{"promise-polyfill":2}]},{},[4])(4)}))})(void 0,cE,sE,void 0);var fE,lE=sE.exports.boltExport,dE=function(n){var e=w.none(),o=[],r=function(n){return dE((function(t){i((function(e){t(n(e))}))}))},i=function(n){a()?s(n):o.push(n)},u=function(n){e=w.some(n),c(o),o=[]},a=function(){return e.isSome()},c=function(n){G(n,s)},s=function(n){e.each((function(e){t.setTimeout((function(){n(e)}),0)}))};return n(u),{get:i,map:r,isReady:a}},mE=function(n){return dE((function(t){t(n)}))},gE={nu:dE,pure:mE},pE=function(n){t.setTimeout((function(){throw n}),0)},vE=function(n){var t=function(t){n().then(t,pE)},e=function(t){return vE((function(){return n().then(t)}))},o=function(t){return vE((function(){return n().then((function(n){return t(n).toPromise()}))}))},r=function(t){return vE((function(){return n().then((function(){return t.toPromise()}))}))},i=function(){return gE.nu(t)},u=function(){var t=null;return vE((function(){return null===t&&(t=n()),t}))},a=n;return{map:e,bind:o,anonBind:r,toLazy:i,toCached:u,toPromise:a,get:t}},hE=function(n){return vE((function(){return new lE(n)}))},bE=function(n){return vE((function(){return lE.resolve(n)}))},yE={nu:hE,pure:bE},xE=["input","textarea"],wE=function(n){var t=li(n);return z(xE,t)},SE=function(n,t){var e=t.getRoot(n).getOr(n.element());Ma(e,t.invalidClass),t.notify.each((function(t){wE(n.element())&&bu(n.element(),"aria-invalid",!1),t.getContainer(n).each((function(n){pu(n,t.validHtml)})),t.onValid(n)}))},CE=function(n,t,e,o){var r=t.getRoot(n).getOr(n.element());Aa(r,t.invalidClass),t.notify.each((function(t){wE(n.element())&&bu(n.element(),"aria-invalid",!0),t.getContainer(n).each((function(n){pu(n,o)})),t.onInvalid(n,o)}))},kE=function(n,t,e){return t.validator.fold((function(){return yE.pure(O.value(!0))}),(function(t){return t.validate(n)}))},OE=function(n,t,e){return t.notify.each((function(t){t.onValidate(n)})),kE(n,t).map((function(o){return n.getSystem().isConnected()?o.fold((function(o){return CE(n,t,e,o),O.error(o)}),(function(e){return SE(n,t),O.value(e)})):O.error("No longer in system")}))},TE=function(n,t){var e=t.getRoot(n).getOr(n.element());return Fa(e,t.invalidClass)},EE=Object.freeze({markValid:SE,markInvalid:CE,query:kE,run:OE,isInvalid:TE}),BE=function(n,t){return n.validator.map((function(o){return Ci([Ei(o.onEvent,(function(e){OE(e,n,t).get(u)}))].concat(o.validateOnLoad?[Vi((function(o){OE(o,n,t).get(e)}))]:[]))})).getOr({})},DE=Object.freeze({events:BE}),AE=[ge("invalidClass"),Fe("getRoot",w.none),_e("notify",[Fe("aria","alert"),Fe("getContainer",w.none),Fe("validHtml",""),hs("onValid"),hs("onInvalid"),hs("onValidate")]),_e("validator",[ge("validate"),Fe("onEvent","input"),Fe("validateOnLoad",!0)])],_E=mf({fields:AE,name:"invalidating",active:DE,apis:EE,extra:{validation:function(n){return function(t){var e=zg.getValue(t);return yE.pure(n(e))}}}}),ME=function(n,t){return oa({attributes:Kn([{key:t.tabAttr,value:"true"}])})},FE=Object.freeze({exhibit:ME}),IE=[Fe("tabAttr","data-alloy-tabstop")],RE=mf({fields:IE,name:"tabstopping",active:FE}),NE=function(n,t,e,o){var r=HE(n,t,e,o);return tE.sketch(r)},VE=function(n,t){return NE(n,t,[],[])},HE=function(n,t,e,o){return{dom:zE(e),components:n.toArray().concat([t]),fieldBehaviours:lf(o)}},PE=function(){return zE([])},zE=function(n){return{tag:"div",classes:["tox-form__group"].concat(n)}},LE=function(n,t){return tE.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:t.translate(n)}})},jE=function(n,t,e,o){return e.getOrCreate(n,t,o)},UE=Object.freeze({getCoupled:jE}),WE=[pe("others",$t(O.value,ie()))],GE=function(n){var t={},e=function(n,e,o){var r=fn(e.others);if(r)return Yn(t,o).getOrThunk((function(){var r=Yn(e.others,o).getOrDie("No information found for coupled component: "+o),i=r(n),u=n.getSystem().build(i);return t[o]=u,u}));throw new Error("Cannot find coupled component: "+o+". Known coupled components: "+JSON.stringify(r,null,2))},o=i({});return Qu({readState:o,getOrCreate:e})},XE=Object.freeze({init:GE}),YE=mf({fields:WE,name:"coupling",apis:UE,state:XE}),qE=i("sink"),KE=i(xp({name:qE(),overrides:i({dom:{tag:"div"},behaviours:lf([km.config({useFixed:l})]),events:Ci([Ii(kr()),Ii(hr()),Ii(Br())])})}));(function(n){n[n["HighlightFirst"]=0]="HighlightFirst",n[n["HighlightNone"]=1]="HighlightNone"})(fE||(fE={}));var JE=function(n,t){var e=n.getHotspot(t).getOr(t),o="hotspot",r=n.getAnchorOverrides();return n.layouts.fold((function(){return{anchor:o,hotspot:e,overrides:r}}),(function(n){return{anchor:o,hotspot:e,overrides:r,layouts:n}}))},$E=function(n,t,e){var o=n.fetch;return o(e).map(t)},QE=function(n,t,e,o,r,i,u){var a=$E(n,t,o),c=oB(o,n);return a.map((function(n){return n.bind((function(n){return w.from(hx.sketch(m(m({},i.menu()),{uid:Pu(""),data:n,highlightImmediately:u===fE.HighlightFirst,onOpenMenu:function(n,t){var o=c().getOrDie();km.position(o,e,t),rg.decloak(r)},onOpenSubmenu:function(n,t,e){var o=c().getOrDie();km.position(o,{anchor:"submenu",item:t},e),rg.decloak(r)},onRepositionMenu:function(n,t,o){var r=c().getOrDie();km.position(r,e,t),G(o,(function(n){km.position(r,{anchor:"submenu",item:n.triggeringItem},n.triggeredMenu)}))},onEscape:function(){return hy.focus(o),rg.close(r),w.some(!0)}})))}))}))},ZE=function(n,t,e,o,r,i,u){var a=JE(n,e),c=QE(n,t,a,e,o,r,u);return c.map((function(n){return n.fold((function(){rg.isOpen(o)&&rg.close(o)}),(function(n){rg.cloak(o),rg.open(o,n),i(o)})),o}))},nB=function(n,t,e,o,r,i,u){return rg.close(o),yE.pure(o)},tB=function(n,t,e,o,r,i){var u=YE.getCoupled(e,"sandbox"),a=rg.isOpen(u),c=a?nB:ZE;return c(n,t,e,u,o,r,i)},eB=function(n,t,e){var o=ov.getCurrent(t).getOr(t),r=kc(n.element());e?Pa(o.element(),"min-width",r+"px"):Cc(o.element(),r)},oB=function(n,t){return n.getSystem().getByUid(t.uid+"-"+qE()).map((function(n){return function(){return O.value(n)}})).getOrThunk((function(){return t.lazySink.fold((function(){return function(){return O.error(new Error("No internal sink is specified, nor could an external sink be found"))}}),(function(t){return function(){return t(n)}}))}))},rB=function(n){rg.getState(n).each((function(n){hx.repositionMenus(n)}))},iB=function(n,t,e){var o=Yc(),r=function(r,i){var u=JE(n,t);o.link(t.element()),n.matchWidth&&eB(u.hotspot,i,n.useMinWidth),n.onOpen(u,r,i),void 0!==e&&void 0!==e.onOpen&&e.onOpen(r,i)},u=function(n,r){o.unlink(t.element()),void 0!==e&&void 0!==e.onClose&&e.onClose(n,r)},a=oB(t,n);return{dom:{tag:"div",classes:n.sandboxClasses,attributes:{id:o.id(),role:"listbox"}},behaviours:Wg.augment(n.sandboxBehaviours,[zg.config({store:{mode:"memory",initialValue:t}}),rg.config({onOpen:r,onClose:u,isPartOf:function(n,e,o){return Kc(e,o)||Kc(t,o)},getAttachPoint:function(){return a().getOrDie()}}),ov.config({find:function(n){return rg.getState(n).bind((function(n){return ov.getCurrent(n)}))}}),wf.config({channels:m(m({},sg({isExtraPart:i(!1)})),lg({isExtraPart:i(!1),doReposition:rB}))})])}},uB=function(n){var t=YE.getCoupled(n,"sandbox");rB(t)},aB=function(){return[Fe("sandboxClasses",[]),Wg.field("sandboxBehaviours",[ov,wf,rg,zg])]},cB=i([ge("dom"),ge("fetch"),hs("onOpen"),bs("onExecute"),Fe("getHotspot",w.some),Fe("getAnchorOverrides",i({})),Fe("layouts",w.none()),Lg("dropdownBehaviours",[Ny,YE,Jb,hy]),ge("toggleClass"),Fe("eventOrder",{}),Oe("lazySink"),Fe("matchWidth",!1),Fe("useMinWidth",!1),Oe("role")].concat(aB())),sB=i([yp({schema:[gs()],name:"menu",defaults:function(n){return{onExecute:n.onExecute}}}),KE()]),fB=function(n,t,o,r){var i,u=function(t){return Yn(n.dom,"attributes").bind((function(n){return Yn(n,t)}))},a=function(n){rg.getState(n).each((function(n){hx.highlightPrimary(n)}))},c=function(t){var o=a;tB(n,(function(n){return n}),t,r,o,fE.HighlightFirst).get(e)},s={expand:function(t){Ny.isOn(t)||tB(n,(function(n){return n}),t,r,e,fE.HighlightNone).get(e)},open:function(t){Ny.isOn(t)||tB(n,(function(n){return n}),t,r,e,fE.HighlightFirst).get(e)},isOpen:Ny.isOn,close:function(t){Ny.isOn(t)&&tB(n,(function(n){return n}),t,r,e,fE.HighlightFirst).get(e)},repositionMenus:function(n){Ny.isOn(n)&&uB(n)}},f=function(n,t){return ui(n),w.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:Ug(n.dropdownBehaviours,[Ny.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),YE.config({others:{sandbox:function(t){return iB(n,t,{onOpen:function(){Ny.on(t)},onClose:function(){Ny.off(t)}})}}}),Jb.config({mode:"special",onSpace:f,onEnter:f,onDown:function(n,t){if(lB.isOpen(n)){var e=YE.getCoupled(n,"sandbox");a(e)}else lB.open(n);return w.some(!0)},onEscape:function(n,t){return lB.isOpen(n)?(lB.close(n),w.some(!0)):w.none()}}),hy.config({})]),events:Mx(w.some(c)),eventOrder:m(m({},n.eventOrder),(i={},i[Nr()]=["disabling","toggling","alloy.base.behaviour"],i)),apis:s,domModification:{attributes:m(m({"aria-haspopup":"true"},n.role.fold((function(){return{}}),(function(n){return{role:n}}))),"button"===n.dom.tag?{type:u("type").getOr("button")}:{})}}},lB=Qp({name:"Dropdown",configFields:cB(),partFields:sB(),factory:fB,apis:{open:function(n,t){return n.open(t)},expand:function(n,t){return n.expand(t)},close:function(n,t){return n.close(t)},isOpen:function(n,t){return n.isOpen(t)},repositionMenus:function(n,t){return n.repositionMenus(t)}}}),dB=function(n,t){return oa({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})},mB=function(n){return Ci([ki(Ar(),i(!0))])},gB=Object.freeze({events:mB,exhibit:dB}),pB=mf({fields:[],name:"unselecting",active:gB}),vB=function(n,t){return lB.sketch({dom:n.dom,components:n.components,toggleClass:"mce-active",dropdownBehaviours:lf([pB.config({}),RE.config({})]),layouts:n.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:function(e){return yE.nu((function(t){return n.fetch(t)})).map((function(o){return w.from(OO(Tn(tO(_u("menu-value"),o,(function(t){n.onItemAction(e,t)}),n.columns,n.presets,dC.CLOSE_ON_EXECUTE,(function(){return!1}),t.providers),{movement:oO(n.columns,n.presets)})))}))},parts:{menu:Kk(!1,1,n.presets)}})},hB=_u("color-input-change"),bB=_u("color-swatch-change"),yB=_u("color-picker-cancel"),xB=function(n,t,e){var o=tE.parts().field({factory:aE,inputClasses:["tox-textfield"],onSetValue:function(n){return _E.run(n).get((function(){}))},inputBehaviours:lf([RE.config({}),_E.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(n){return $i(n.element())},notify:{onValid:function(n){var t=zg.getValue(n);ii(n,hB,{color:t})}},validator:{validateOnLoad:!1,validate:function(n){var t=zg.getValue(n);if(0===t.length)return yE.pure(O.value(!0));var e=Je.fromTag("span");Pa(e,"background-color",t);var o=Wa(e,"background-color").fold((function(){return O.error("blah")}),(function(n){return O.value(t)}));return yE.pure(o)}}})]),selectOnFocus:!1}),r=n.label.map((function(n){return LE(n,t.providers)})),i=function(n,t){ii(n,bB,{value:t})},u=function(n,t){a.getOpt(n).each((function(n){"custom"===t?e.colorPicker((function(t){t.fold((function(){return ri(n,yB)}),(function(t){i(n,t),gk.addColor(t)}))}),"#ffffff"):i(n,"remove"===t?"":t)}))},a=Rx(vB({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:w.some({onRtl:function(){return[Gs]},onLtr:function(){return[Xs]}}),components:[],fetch:Vk.getFetch(e.getColors(),e.hasCustomColors()),columns:e.getColorCols(),presets:"color",onItemAction:u},t));return tE.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:r.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[o,a.asSpec()]}]),fieldBehaviours:lf([cy("form-field-events",[Ei(hB,(function(t,e){a.getOpt(t).each((function(n){Pa(n.element(),"background-color",e.event().color())})),ii(t,LT,{name:n.name})})),Ei(bB,(function(n,t){tE.getField(n).each((function(e){zg.setValue(e,t.event().value()),ov.getCurrent(n).each(hy.focus)}))})),Ei(yB,(function(n,t){tE.getField(n).each((function(t){ov.getCurrent(n).each(hy.focus)}))}))])])})},wB=function(n,t,e){return{hue:i(n),saturation:i(t),value:i(e)}},SB=function(n){var t=0,e=0,o=0,r=n.red()/255,i=n.green()/255,u=n.blue()/255,a=Math.min(r,Math.min(i,u)),c=Math.max(r,Math.max(i,u));if(a===c)return o=a,wB(0,0,100*o);var s=r===a?i-u:u===a?r-i:u-r;return t=r===a?3:u===a?1:5,t=60*(t-s/(c-a)),e=(c-a)/c,o=c,wB(Math.round(t),Math.round(100*e),Math.round(100*o))},CB=function(n){var t=(100-n)/100*360,e=wB(t,100,100),o=KC(e);return LC(o)},kB=i(_u("rgb-hex-update")),OB=i(_u("slider-update")),TB=i(_u("palette-update")),EB=Yo(),BB=EB.deviceType.isTouch(),DB=xp({schema:[ge("dom")],name:"label"}),AB=function(n){return xp({name:n+"-edge",overrides:function(t){var e=t.model.manager.edgeActions[n];return e.fold((function(){return{}}),(function(n){var e=Ci([Bi(gr(),n,[t])]),o=Ci([Bi(hr(),n,[t]),Bi(br(),(function(t,e){e.mouseIsDown.get()&&n(t,e)}),[t])]);return{events:BB?e:o}}))}})},_B=AB("top-left"),MB=AB("top"),FB=AB("top-right"),IB=AB("right"),RB=AB("bottom-right"),NB=AB("bottom"),VB=AB("bottom-left"),HB=AB("left"),PB=bp({name:"thumb",defaults:i({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:Ci([Mi(gr(),n,"spectrum"),Mi(pr(),n,"spectrum"),Mi(vr(),n,"spectrum"),Mi(hr(),n,"spectrum"),Mi(br(),n,"spectrum"),Mi(xr(),n,"spectrum")])}}}),zB=bp({schema:[Ue("mouseIsDown",(function(){return We(!1)}))],name:"spectrum",overrides:function(n){var t=n.model,e=t.manager,o=function(t,o){return e.getValueFromEvent(o).map((function(o){return e.setValueFrom(t,n,o)}))},r=Ci([Ei(gr(),o),Ei(pr(),o)]),i=Ci([Ei(hr(),o),Ei(br(),(function(t,e){n.mouseIsDown.get()&&o(t,e)}))]);return{behaviours:lf(BB?[]:[Jb.config({mode:"special",onLeft:function(t){return e.onLeft(t,n)},onRight:function(t){return e.onRight(t,n)},onUp:function(t){return e.onUp(t,n)},onDown:function(t){return e.onDown(t,n)}}),hy.config({})]),events:BB?r:i}}}),LB=[DB,HB,IB,MB,NB,_B,FB,VB,RB,PB,zB],jB=Yo().deviceType.isTouch(),UB="slider.change.value",WB=i(UB),GB=function(n){var t=n.event().raw();if(jB){var e=t;return void 0!==e.touches&&1===e.touches.length?w.some(e.touches[0]).map((function(n){return hc(n.clientX,n.clientY)})):w.none()}var o=t;return void 0!==o.clientX?w.some(o).map((function(n){return hc(n.clientX,n.clientY)})):w.none()},XB="top",YB="right",qB="bottom",KB="left",JB=function(n){return n.model.minX},$B=function(n){return n.model.minY},QB=function(n){return n.model.minX-1},ZB=function(n){return n.model.minY-1},nD=function(n){return n.model.maxX},tD=function(n){return n.model.maxY},eD=function(n){return n.model.maxX+1},oD=function(n){return n.model.maxY+1},rD=function(n,t,e){return t(n)-e(n)},iD=function(n){return rD(n,nD,JB)},uD=function(n){return rD(n,tD,$B)},aD=function(n){return iD(n)/2},cD=function(n){return uD(n)/2},sD=function(n){return n.stepSize},fD=function(n){return n.snapToGrid},lD=function(n){return n.snapStart},dD=function(n){return n.rounded},mD=function(n,t){return void 0!==n[t+"-edge"]},gD=function(n){return mD(n,KB)},pD=function(n){return mD(n,YB)},vD=function(n){return mD(n,XB)},hD=function(n){return mD(n,qB)},bD=function(n){return n.model.value.get()},yD=function(n){return{x:i(n)}},xD=function(n){return{y:i(n)}},wD=function(n,t){return{x:i(n),y:i(t)}},SD=function(n,t){ii(n,WB(),{value:t})},CD=function(n,t){SD(n,wD(QB(t),ZB(t)))},kD=function(n,t){SD(n,xD(ZB(t)))},OD=function(n,t){SD(n,wD(aD(t),ZB(t)))},TD=function(n,t){SD(n,wD(eD(t),ZB(t)))},ED=function(n,t){SD(n,yD(eD(t)))},BD=function(n,t){SD(n,wD(eD(t),cD(t)))},DD=function(n,t){SD(n,wD(eD(t),oD(t)))},AD=function(n,t){SD(n,xD(oD(t)))},_D=function(n,t){SD(n,wD(aD(t),oD(t)))},MD=function(n,t){SD(n,wD(QB(t),oD(t)))},FD=function(n,t){SD(n,yD(QB(t)))},ID=function(n,t){SD(n,wD(QB(t),cD(t)))},RD=function(n,t,e,o){return ne?e:n===t?t-1:Math.max(t,n-o)},ND=function(n,t,e,o){return n>e?n:nd)return p;var v=PD(r,l,d),h=VD(v/m*o+t,g,p);return u&&h>=t&&h<=e?HD(h,t,e,i,a):c?Math.round(h):h},LD=function(n){var t=n.min,e=n.max,o=n.range,r=n.value,i=n.hasMinEdge,u=n.hasMaxEdge,a=n.maxBound,c=n.maxOffset,s=n.centerMinEdge,f=n.centerMaxEdge;return re?u?a:f:(r-t)/o*c},jD="top",UD="right",WD="bottom",GD="left",XD="width",YD="height",qD=function(n){return n.element().dom().getBoundingClientRect()},KD=function(n,t){return n[t]},JD=function(n){var t=qD(n);return KD(t,GD)},$D=function(n){var t=qD(n);return KD(t,UD)},QD=function(n){var t=qD(n);return KD(t,jD)},ZD=function(n){var t=qD(n);return KD(t,WD)},nA=function(n){var t=qD(n);return KD(t,XD)},tA=function(n){var t=qD(n);return KD(t,YD)},eA=function(n,t,e){return(n+t)/2-e},oA=function(n,t){var e=qD(n),o=qD(t),r=KD(e,GD),i=KD(e,UD),u=KD(o,GD);return eA(r,i,u)},rA=function(n,t){var e=qD(n),o=qD(t),r=KD(e,jD),i=KD(e,WD),u=KD(o,jD);return eA(r,i,u)},iA=function(n,t){ii(n,WB(),{value:t})},uA=function(n){return{x:i(n)}},aA=function(n,t,e){var o={min:JB(t),max:nD(t),range:iD(t),value:e,step:sD(t),snap:fD(t),snapStart:lD(t),rounded:dD(t),hasMinEdge:gD(t),hasMaxEdge:pD(t),minBound:JD(n),maxBound:$D(n),screenRange:nA(n)};return zD(o)},cA=function(n,t,e){var o=aA(n,t,e),r=uA(o);return iA(n,r),o},sA=function(n,t){var e=JB(t);iA(n,uA(e))},fA=function(n,t){var e=nD(t);iA(n,uA(e))},lA=function(n,t,e){var o=n>0?ND:RD,r=o(bD(e).x(),JB(e),nD(e),sD(e));return iA(t,uA(r)),w.some(r)},dA=function(n){return function(t,e){return lA(n,t,e).map((function(){return!0}))}},mA=function(n){var t=GB(n);return t.map((function(n){return n.left()}))},gA=function(n,t,e,o,r){var i=0,u=nA(n),a=o.bind((function(t){return w.some(oA(t,n))})).getOr(i),c=r.bind((function(t){return w.some(oA(t,n))})).getOr(u),s={min:JB(t),max:nD(t),range:iD(t),value:e,hasMinEdge:gD(t),hasMaxEdge:pD(t),minBound:JD(n),minOffset:i,maxBound:$D(n),maxOffset:u,centerMinEdge:a,centerMaxEdge:c};return LD(s)},pA=function(n,t,e,o,r,i){var u=gA(t,i,e,o,r);return JD(t)-JD(n)+u},vA=function(n,t,e,o){var r=bD(e),i=pA(n,o.getSpectrum(n),r.x(),o.getLeftEdge(n),o.getRightEdge(n),e),u=kc(t.element())/2;Pa(t.element(),"left",i-u+"px")},hA=dA(-1),bA=dA(1),yA=w.none,xA=w.none,wA={"top-left":w.none(),top:w.none(),"top-right":w.none(),right:w.some(ED),"bottom-right":w.none(),bottom:w.none(),"bottom-left":w.none(),left:w.some(FD)},SA=Object.freeze({setValueFrom:cA,setToMin:sA,setToMax:fA,findValueOfOffset:aA,getValueFromEvent:mA,findPositionOfValue:pA,setPositionFromValue:vA,onLeft:hA,onRight:bA,onUp:yA,onDown:xA,edgeActions:wA}),CA=function(n,t){ii(n,WB(),{value:t})},kA=function(n){return{y:i(n)}},OA=function(n,t,e){var o={min:$B(t),max:tD(t),range:uD(t),value:e,step:sD(t),snap:fD(t),snapStart:lD(t),rounded:dD(t),hasMinEdge:vD(t),hasMaxEdge:hD(t),minBound:QD(n),maxBound:ZD(n),screenRange:tA(n)};return zD(o)},TA=function(n,t,e){var o=OA(n,t,e),r=kA(o);return CA(n,r),o},EA=function(n,t){var e=$B(t);CA(n,kA(e))},BA=function(n,t){var e=tD(t);CA(n,kA(e))},DA=function(n,t,e){var o=n>0?ND:RD,r=o(bD(e).y(),$B(e),tD(e),sD(e));return CA(t,kA(r)),w.some(r)},AA=function(n){return function(t,e){return DA(n,t,e).map((function(){return!0}))}},_A=function(n){var t=GB(n);return t.map((function(n){return n.top()}))},MA=function(n,t,e,o,r){var i=0,u=tA(n),a=o.bind((function(t){return w.some(rA(t,n))})).getOr(i),c=r.bind((function(t){return w.some(rA(t,n))})).getOr(u),s={min:$B(t),max:tD(t),range:uD(t),value:e,hasMinEdge:vD(t),hasMaxEdge:hD(t),minBound:QD(n),minOffset:i,maxBound:ZD(n),maxOffset:u,centerMinEdge:a,centerMaxEdge:c};return LD(s)},FA=function(n,t,e,o,r,i){var u=MA(t,i,e,o,r);return QD(t)-QD(n)+u},IA=function(n,t,e,o){var r=bD(e),i=FA(n,o.getSpectrum(n),r.y(),o.getTopEdge(n),o.getBottomEdge(n),e),u=mc(t.element())/2;Pa(t.element(),"top",i-u+"px")},RA=w.none,NA=w.none,VA=AA(-1),HA=AA(1),PA={"top-left":w.none(),top:w.some(kD),"top-right":w.none(),right:w.none(),"bottom-right":w.none(),bottom:w.some(AD),"bottom-left":w.none(),left:w.none()},zA=Object.freeze({setValueFrom:TA,setToMin:EA,setToMax:BA,findValueOfOffset:OA,getValueFromEvent:_A,findPositionOfValue:FA,setPositionFromValue:IA,onLeft:RA,onRight:NA,onUp:VA,onDown:HA,edgeActions:PA}),LA=function(n,t){ii(n,WB(),{value:t})},jA=function(n,t){return{x:i(n),y:i(t)}},UA=function(n,t,e){var o=aA(n,t,e.left()),r=OA(n,t,e.top()),i=jA(o,r);return LA(n,i),i},WA=function(n,t,e,o){var r=n>0?ND:RD,i=t?bD(o).x():r(bD(o).x(),JB(o),nD(o),sD(o)),u=t?r(bD(o).y(),$B(o),tD(o),sD(o)):bD(o).y();return LA(e,jA(i,u)),w.some(i)},GA=function(n,t){return function(e,o){return WA(n,t,e,o).map((function(){return!0}))}},XA=function(n,t){var e=JB(t),o=$B(t);LA(n,jA(e,o))},YA=function(n,t){var e=nD(t),o=tD(t);LA(n,jA(e,o))},qA=function(n){return GB(n)},KA=function(n,t,e,o){var r=bD(e),i=pA(n,o.getSpectrum(n),r.x(),o.getLeftEdge(n),o.getRightEdge(n),e),u=FA(n,o.getSpectrum(n),r.y(),o.getTopEdge(n),o.getBottomEdge(n),e),a=kc(t.element())/2,c=mc(t.element())/2;Pa(t.element(),"left",i-a+"px"),Pa(t.element(),"top",u-c+"px")},JA=GA(-1,!1),$A=GA(1,!1),QA=GA(-1,!0),ZA=GA(1,!0),n_={"top-left":w.some(CD),top:w.some(OD),"top-right":w.some(TD),right:w.some(BD),"bottom-right":w.some(DD),bottom:w.some(_D),"bottom-left":w.some(MD),left:w.some(ID)},t_=Object.freeze({setValueFrom:UA,setToMin:XA,setToMax:YA,getValueFromEvent:qA,setPositionFromValue:KA,onLeft:JA,onRight:$A,onUp:QA,onDown:ZA,edgeActions:n_}),e_=Yo().deviceType.isTouch(),o_=[Fe("stepSize",1),Fe("onChange",e),Fe("onChoose",e),Fe("onInit",e),Fe("onDragStart",e),Fe("onDragEnd",e),Fe("snapToGrid",!1),Fe("rounded",!0),Oe("snapStart"),pe("model",re("mode",{x:[Fe("minX",0),Fe("maxX",100),Ue("value",(function(n){return We(n.mode.minX)})),ge("getInitialValue"),ws("manager",SA)],y:[Fe("minY",0),Fe("maxY",100),Ue("value",(function(n){return We(n.mode.minY)})),ge("getInitialValue"),ws("manager",zA)],xy:[Fe("minX",0),Fe("maxX",100),Fe("minY",0),Fe("maxY",100),Ue("value",(function(n){return We({x:i(n.mode.minX),y:i(n.mode.minY)})})),ge("getInitialValue"),ws("manager",t_)]})),Lg("sliderBehaviours",[Jb,zg])].concat(e_?[]:[Ue("mouseIsDown",(function(){return We(!1)}))]),r_=Yo().deviceType.isTouch(),i_=function(n,t,e,o){var r=function(t){return Ip(t,n,"thumb")},u=function(t){return Ip(t,n,"spectrum")},a=function(t){return Fp(t,n,"left-edge")},c=function(t){return Fp(t,n,"right-edge")},s=function(t){return Fp(t,n,"top-edge")},f=function(t){return Fp(t,n,"bottom-edge")},l=n.model,d=l.manager,m=function(t,e){d.setPositionFromValue(t,e,n,{getLeftEdge:a,getRightEdge:c,getTopEdge:s,getBottomEdge:f,getSpectrum:u})},g=function(t,e){l.value.set(e);var o=r(t);return m(t,o),n.onChange(t,o,e),w.some(!0)},p=function(t){d.setToMin(t,n)},v=function(t){d.setToMax(t,n)},h=[Ei(gr(),(function(t,e){n.onDragStart(t,r(t))})),Ei(vr(),(function(t,e){n.onDragEnd(t,r(t))}))],b=[Ei(hr(),(function(t,e){e.stop(),n.onDragStart(t,r(t)),n.mouseIsDown.set(!0)})),Ei(xr(),(function(t,e){n.onDragEnd(t,r(t))}))],y=r_?h:b;return{uid:n.uid,dom:n.dom,components:t,behaviours:Ug(n.sliderBehaviours,Z([r_?[]:[Jb.config({mode:"special",focusIn:function(t){return Fp(t,n,"spectrum").map(Jb.focusIn).map(i(!0))}})],[zg.config({store:{mode:"manual",getValue:function(n){return l.value.get()}}}),wf.config({channels:{"mouse.released":{onReceive:function(t,e){var o=function(){Fp(t,n,"thumb").each((function(e){var o=l.value.get();n.onChoose(t,e,o)}))};if(r_)o();else{var r=n.mouseIsDown.get();n.mouseIsDown.set(!1),r&&o()}}}}})]])),events:Ci([Ei(WB(),(function(n,t){g(n,t.event().value())})),Vi((function(t,e){var o=l.getInitialValue();l.value.set(o);var i=r(t);m(t,i);var a=u(t);n.onInit(t,i,a,l.value.get())}))].concat(y)),apis:{resetToMin:p,resetToMax:v,changeValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},u_=Qp({name:"Slider",configFields:o_,partFields:LB,factory:i_,apis:{resetToMin:function(n,t){n.resetToMin(t)},resetToMax:function(n,t){n.resetToMax(t)},refresh:function(n,t){n.refresh(t)}}}),a_=function(n,t){var e=u_.parts().spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=u_.parts().thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return u_.sketch({dom:{tag:"div",classes:[t("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:i({y:i(0)})},components:[e,o],sliderBehaviours:lf([hy.config({})]),onChange:function(n,t,e){ii(n,OB(),{value:e})}})},c_={sliderFactory:a_},s_="form",f_=[Lg("formBehaviours",[zg])],l_=function(n){return""},d_=function(n){var t=function(){var n=[],t=function(t,e){return n.push(t),Bp(s_,l_(t),e)};return{field:t,record:function(){return n}}}(),e=n(t),o=t.record(),r=W(o,(function(n){return bp({name:n,pname:l_(n)})}));return Gp(s_,f_,r,g_,e)},m_=function(n,t){return n.fold((function(){return O.error(t)}),O.value)},g_=function(n,t,e){return{uid:n.uid,dom:n.dom,components:t,behaviours:Ug(n.formBehaviours,[zg.config({store:{mode:"manual",getValue:function(t){var e=Np(t,n);return mn(e,(function(n,t){return n().bind((function(n){var t=ov.getCurrent(n);return m_(t,"missing current")})).map(zg.getValue)}))},setValue:function(t,e){dn(e,(function(e,o){Fp(t,n,o).each((function(n){ov.getCurrent(n).each((function(n){zg.setValue(n,e)}))}))}))}}})]),apis:{getField:function(t,e){return Fp(t,n,e).bind(ov.getCurrent)}}}},p_={getField:Ju((function(n,t,e){return n.getField(t,e)})),sketch:d_},v_=_u("valid-input"),h_=_u("invalid-input"),b_=_u("validating-input"),y_="colorcustom.rgb.",x_=function(n,t,o,r){var u=function(e,o){return _E.config({invalidClass:t("invalid"),notify:{onValidate:function(n){ii(n,b_,{type:e})},onValid:function(n){ii(n,v_,{type:e,value:zg.getValue(n)})},onInvalid:function(n){ii(n,h_,{type:e,value:zg.getValue(n)})}},validator:{validate:function(t){var e=zg.getValue(t),r=o(e)?O.value(!0):O.error(n("aria.input.invalid"));return yE.pure(r)},validateOnLoad:!1}})},a=function(o,r,i,a,c){var s=n(y_+"range"),f=tE.parts().label({dom:{tag:"label",innerHtml:i,attributes:{"aria-label":a}}}),l=tE.parts().field({data:c,factory:aE,inputAttributes:m({type:"text"},"hex"===r?{"aria-live":"polite"}:{}),inputClasses:[t("textfield")],inputBehaviours:lf([u(r,o),RE.config({})]),onSetValue:function(n){if(_E.isInvalid(n)){var t=_E.run(n);t.get(e)}}}),d=[f,l],g="hex"!==r?[tE.parts()["aria-descriptor"]({text:s})]:[],p=d.concat(g);return{dom:{tag:"div",attributes:{role:"presentation"}},components:p}},c=function(n,t){var e=LC(t);return p_.getField(n,"hex").each((function(t){hy.isFocused(t)||zg.setValue(n,{hex:e.value()})})),e},s=function(n,t){var e=t.red(),o=t.green(),r=t.blue();zg.setValue(n,{red:e,green:o,blue:r})},f=Rx({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=function(n,t){f.getOpt(n).each((function(n){Pa(n.element(),"background-color","#"+t.value())}))},d=function(){var e={red:i(We(w.some(255))),green:i(We(w.some(255))),blue:i(We(w.some(255))),hex:i(We(w.some("ffffff")))},u=function(n,t){var e=JC(t);s(n,e),p(e)},d=function(n){return e[n]().get()},m=function(n,t){e[n]().set(t)},g=function(){return d("red").bind((function(n){return d("green").bind((function(t){return d("blue").map((function(e){return YC(n,t,e,1)}))}))}))},p=function(n){var t=n.red(),e=n.green(),o=n.blue();m("red",w.some(t)),m("green",w.some(e)),m("blue",w.some(o))},v=function(n,t){var e=t.event();"hex"!==e.type()?m(e.type(),w.none()):r(n)},h=function(n,t){o(n);var e=IC(t);m("hex",w.some(t));var r=JC(e);s(n,r),p(r),ii(n,kB(),{hex:e}),l(n,e)},b=function(n,t,e){var o=parseInt(e,10);m(t,w.some(o)),g().each((function(t){var e=c(n,t);l(n,e)}))},y=function(n){return"hex"===n.type()},x=function(n,t){var e=t.event();y(e)?h(n,e.value()):b(n,e.type(),e.value())},S=function(t){return{label:n(y_+t+".label"),description:n(y_+t+".description")}},C=S("red"),k=S("green"),O=S("blue"),T=S("hex");return Tn(p_.sketch((function(e){return{dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":n("aria.color.picker")}},components:[e.field("red",tE.sketch(a(qC,"red",C.label,C.description,255))),e.field("green",tE.sketch(a(qC,"green",k.label,k.description,255))),e.field("blue",tE.sketch(a(qC,"blue",O.label,O.description,255))),e.field("hex",tE.sketch(a(VC,"hex",T.label,T.description,"ffffff"))),f.asSpec()],formBehaviours:lf([_E.config({invalidClass:t("form-invalid")}),cy("rgb-form-events",[Ei(v_,x),Ei(h_,v),Ei(b_,v)])])}})),{apis:{updateHex:function(n,t){zg.setValue(n,{hex:t.value()}),u(n,t),l(n,t)}}})},g=$p({factory:d,name:"RgbForm",configFields:[],apis:{updateHex:function(n,t,e){n.updateHex(t,e)}},extraApis:{}});return g},w_={rgbFormFactory:x_},S_=function(n,t){var e=u_.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),o=u_.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:"'}}),r=function(n,t){var e=n.width,o=n.height,r=n.getContext("2d");if(null!==r){r.fillStyle=t,r.fillRect(0,0,e,o);var i=r.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,e,o);var u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=u,r.fillRect(0,0,e,o)}},u=function(n,t){var e=n.components()[0].element().dom();r(e,ZC(t))},a=function(n){var u=i({x:i(0),y:i(0)}),a=function(n,t,e){ii(n,TB(),{value:e})},c=function(n,t,e,o){r(e.element().dom(),ZC(nk()))},s=lf([ov.config({find:w.some}),hy.config({})]);return u_.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette")]},model:{mode:"xy",getInitialValue:u},rounded:!1,components:[e,o],onChange:a,onInit:c,sliderBehaviours:s})},c=$p({factory:a,name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(n,t,e){u(t,e)}},extraApis:{}});return c},C_={paletteFactory:S_},k_=function(n,t){var o=function(e){var o=w_.rgbFormFactory(n,t,e.onValidHex,e.onInvalidHex),r=C_.paletteFactory(n,t),u={paletteRgba:i(We(nk()))},a=Rx(r.sketch({})),c=Rx(o.sketch({})),s=function(n,t){a.getOpt(n).each((function(n){var e=JC(t);u.paletteRgba().set(e),r.setRgba(n,e)}))},f=function(n,t){c.getOpt(n).each((function(n){o.updateHex(n,t)}))},l=function(n,t,e){G(e,(function(e){e(n,t)}))},d=function(){var n=[f];return function(t,e){var o=e.event().value(),r=u.paletteRgba().get(),i=SB(r),a=wB(i.hue(),o.x(),100-o.y()),c=KC(a),s=LC(c);l(t,s,n)}},m=function(){var n=[s,f];return function(t,e){var o=e.event().value(),r=CB(o.y());l(t,r,n)}};return{uid:e.uid,dom:e.dom,components:[a.asSpec(),c_.sliderFactory(n,t),c.asSpec()],behaviours:lf([cy("colour-picker-events",[Ei(TB(),d()),Ei(OB(),m())]),ov.config({find:function(n){return c.getOpt(n)}}),Jb.config({mode:"acyclic"})])}},r=$p({name:"ColourPicker",configFields:[ge("dom"),Fe("onValidHex",e),Fe("onInvalidHex",e)],factory:o});return r},O_={makeFactory:k_},T_=function(){return ov.config({find:w.some})},E_=function(n){return ov.config({find:n.getOpt})},B_=function(n){return ov.config({find:function(t){return tu(t.element(),n).bind((function(n){return t.getSystem().getByDom(n).toOption()}))}})},D_={self:T_,memento:E_,childAt:B_},A_={"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"},__=function(n){return A_[n]},M_=function(n){return __(n)},F_=function(n){var e=function(n){return"tox-"+n},o=O_.makeFactory(M_,e),r=function(n){ii(n,WT,{name:"hex-valid",value:!0})},i=function(n){ii(n,WT,{name:"hex-valid",value:!1})},u=Rx(o.sketch({dom:{tag:"div",classes:[e("color-picker-container")],attributes:{role:"presentation"}},onValidHex:r,onInvalidHex:i}));return{dom:{tag:"div"},components:[u.asSpec()],behaviours:lf([zg.config({store:{mode:"manual",getValue:function(n){var t=u.get(n),e=ov.getCurrent(t),o=e.bind((function(n){var t=zg.getValue(n);return t.hex}));return o.map((function(n){return"#"+n})).getOr("")},setValue:function(n,e){var o=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/,r=o.exec(e),i=u.get(n),a=ov.getCurrent(i);a.fold((function(){t.console.log("Can not find form")}),(function(n){zg.setValue(n,{hex:w.from(r[1]).getOr("")}),p_.getField(n,"hex").each((function(n){ri(n,Tr())}))}))}}}),D_.self()])}},I_=tinymce.util.Tools.resolve("tinymce.Resource"),R_=function(n){return Object.prototype.hasOwnProperty.call(n,"init")},N_=function(n){var t=We(w.none()),e=Rx({dom:{tag:n.tag}}),o=We(w.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:lf([cy("editor-foo-events",[Vi((function(r){e.getOpt(r).each((function(e){(R_(n)?n.init(e.element().dom()):I_.load(n.scriptId,n.scriptUrl).then((function(t){return t(e.element().dom(),n.settings)}))).then((function(n){o.get().each((function(t){n.setValue(t)})),o.set(w.none()),t.set(w.some(n))}))}))}))]),zg.config({store:{mode:"manual",getValue:function(){return t.get().fold((function(){return o.get().getOr("")}),(function(n){return n.getValue()}))},setValue:function(n,e){t.get().fold((function(){o.set(w.some(e))}),(function(n){return n.setValue(e)}))}}}),D_.self()]),components:[e.asSpec()]}},V_=Vt([Fe("preprocess",u),Fe("postprocess",u)]),H_=function(n,t){var e=te("RepresentingConfigs.memento processors",V_,t);return zg.config({store:{mode:"manual",getValue:function(t){var o=n.get(t),r=zg.getValue(o);return e.postprocess(r)},setValue:function(t,o){var r=e.preprocess(o),i=n.get(t);zg.setValue(i,r)}}})},P_=function(n,t,e){return zg.config(Tn({store:{mode:"manual",getValue:t,setValue:e}},n.map((function(n){return{store:{initialValue:n}}})).getOr({})))},z_=function(n,t,e){return P_(n,(function(n){return t(n.element())}),(function(n,t){return e(n.element(),t)}))},L_=function(n){return z_(n,qa,Ka)},j_=function(n){return z_(n,gu,pu)},U_=function(n){return zg.config({store:{mode:"memory",initialValue:n}})},W_={memento:H_,withElement:z_,withComp:P_,domValue:L_,domHtml:j_,memory:U_},G_=".jpg,.jpeg,.png,.gif",X_=function(n){var t=new RegExp("("+G_.split(/\s*,\s*/).join("|")+")$","i");return q(sn(n),(function(n){return t.test(n.name)}))},Y_=function(n,t){var e=function(n,t){t.stop()},o=function(n){return function(t,e){G(n,(function(n){n(t,e)}))}},r=function(n,t){if(!oC.isDisabled(n)){var e=t.event().raw();u(n,e.dataTransfer.files)}},i=function(n,t){var e=t.event().raw().target.files;u(n,e)},u=function(t,e){zg.setValue(t,X_(e)),ii(t,LT,{name:n.name})},a=Rx({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:lf([cy("input-file-events",[Ii(Pr())])])}),c=function(n){return{uid:n.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:lf([W_.memory([]),D_.self(),oC.config({}),Ny.config({toggleClass:"dragenter",toggleOnExecute:!1}),cy("dropzone-events",[Ei("dragenter",o([e,Ny.toggle])),Ei("dragleave",o([e,Ny.toggle])),Ei("dragover",e),Ei("drop",o([e,r])),Ei(Er(),i)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:t.translate("Drop an image here")}},Ix.sketch({dom:{tag:"button",innerHtml:t.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[a.asSpec()],action:function(n){var t=a.get(n);t.element().dom().click()},buttonBehaviours:lf([RE.config({})])})]}]}},s=n.label.map((function(n){return LE(n,t)})),f=tE.parts().field({factory:{sketch:c}});return NE(s,f,["tox-form__group--stretched"],[])},q_=function(n,t){return{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+n.columns+"col"]},components:W(n.items,t.interpreter)}},K_=_u("alloy-fake-before-tabstop"),J_=_u("alloy-fake-after-tabstop"),$_=function(n){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:n},behaviours:lf([hy.config({ignore:!0}),RE.config({})])}},Q_=function(n){return{dom:{tag:"div",classes:["tox-navobj"]},components:[$_([K_]),n,$_([J_])],behaviours:lf([D_.childAt(1)])}},Z_=function(n,t){ii(n,kr(),{raw:{which:9,shiftKey:t}})},nM=function(n,t){var e=t.element();Fa(e,K_)?Z_(n,!0):Fa(e,J_)&&Z_(n,!1)},tM=function(n){return zO(n,["."+K_,"."+J_].join(","),i(!1))},eM={isPseudoStop:tM,onFocus:nM,craft:Q_},oM=!(Yo().browser.isIE()||Yo().browser.isEdge()),rM=function(n){var t=We("");return{getValue:function(n){return t.get()},setValue:function(e,o){if(n)bu(e.element(),"srcdoc",o);else{bu(e.element(),"src","javascript:''");var r=e.element().dom().contentWindow.document;r.open(),r.write(o),r.close()}t.set(o)}}},iM=function(n,t){var e=oM&&n.sandboxed,o=m(m({},n.label.map((function(n){return{title:n}})).getOr({})),e?{sandbox:"allow-scripts allow-same-origin"}:{}),r=rM(e),i=n.label.map((function(n){return LE(n,t)})),u=function(n){return eM.craft({uid:n.uid,dom:{tag:"iframe",attributes:o},behaviours:lf([RE.config({}),hy.config({}),W_.withComp(w.none(),r.getValue,r.setValue)])})},a=tE.parts().field({factory:{sketch:u}});return NE(i,a,["tox-form__group--stretched"],[])};function uM(n,e){return sM(t.document.createElement("canvas"),n,e)}function aM(n){var t=uM(n.width,n.height),e=cM(t);return e.drawImage(n,0,0),t}function cM(n){return n.getContext("2d")}function sM(n,t,e){return n.width=t,n.height=e,n}function fM(n){return n.naturalWidth||n.width}function lM(n){return n.naturalHeight||n.height}var dM=function(){var n=function(n){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof n)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(n,o(u,this),o(a,this))},e=n.immediateFn||"function"===typeof window.setImmediate&&window.setImmediate||function(n){t.setTimeout(n,1)};function o(n,t){return function(){return n.apply(t,arguments)}}var r=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)};function i(n){var t=this;null!==this._state?e((function(){var e=t._state?n.onFulfilled:n.onRejected;if(null!==e){var o;try{o=e(t._value)}catch(r){return void n.reject(r)}n.resolve(o)}else(t._state?n.resolve:n.reject)(t._value)})):this._deferreds.push(n)}function u(n){try{if(n===this)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"===typeof n||"function"===typeof n)){var t=n.then;if("function"===typeof t)return void f(o(t,n),o(u,this),o(a,this))}this._state=!0,this._value=n,c.call(this)}catch(e){a.call(this,e)}}function a(n){this._state=!1,this._value=n,c.call(this)}function c(){for(var n=0,t=this._deferreds;ne?o=e:oe?n=e:n2)&&(i=i<.5?.5:2,a=!0),(u<.5||u>2)&&(u=u<.5?.5:2,a=!0);var c=qM(n,i,u);return a?c.then((function(n){return YM(n,t,e)})):c}function qM(n,t,e){return new mM((function(o){var r=fM(n),i=lM(n),u=Math.floor(r*t),a=Math.floor(i*e),c=uM(u,a),s=cM(c);s.drawImage(n,0,0,r,i,0,0,u,a),o(c)}))}function KM(n,t){return n.toCanvas().then((function(e){return JM(e,n.getType(),t)}))}function JM(n,t,e){var o=uM(n.width,n.height),r=cM(o),i=0,u=0;return e=e<0?360+e:e,90!==e&&270!==e||sM(o,o.height,o.width),90!==e&&180!==e||(i=o.width),270!==e&&180!==e||(u=o.height),r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(n,0,0),kM(o,t)}function $M(n,t){return n.toCanvas().then((function(e){return QM(e,n.getType(),t)}))}function QM(n,t,e){var o=uM(n.width,n.height),r=cM(o);return"v"===e?(r.scale(1,-1),r.drawImage(n,0,-o.height)):(r.scale(-1,1),r.drawImage(n,-o.width,0)),kM(o,t)}function ZM(n,t,e,o,r){return n.toCanvas().then((function(i){return nF(i,n.getType(),t,e,o,r)}))}function nF(n,t,e,o,r,i){var u=uM(r,i),a=cM(u);return a.drawImage(n,-e,-o),kM(u,t)}function tF(n,t,e){return n.toCanvas().then((function(o){return YM(o,t,e).then((function(t){return kM(t,n.getType())}))}))}var eF=function(n){return LM(n)},oF=function(n){return GM(n)},rF=function(n,t){return XM(n,t)},iF=function(n,t,e,o){return WM(n,t,e,o)},uF=function(n,t){return jM(n,t)},aF=function(n,t){return UM(n,t)},cF=function(n,t){return $M(n,t)},sF=function(n,t,e,o,r){return ZM(n,t,e,o,r)},fF=function(n,t,e){return tF(n,t,e)},lF=function(n,t){return KM(n,t)},dF=function(n,t){return m({dom:{tag:"span",innerHtml:n,classes:["tox-icon","tox-tbtn__icon-wrap"]}},t)},mF=function(n,t){return dF(Vx(n,t),{})},gF=function(n,t){return dF(Vx(n,t),{behaviours:lf([uy.config({})])})},pF=function(n,t,e){return{dom:{tag:"span",innerHtml:e.translate(n),classes:[t+"__select-label"]},behaviours:lf([uy.config({})])}},vF=_u("toolbar.button.execute"),hF=function(n){return zi((function(t,e){sC(n,t)((function(e){ii(t,vF,{buttonApi:e}),n.onAction(e)}))}))},bF={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},yF=_u("update-menu-text"),xF=_u("update-menu-icon"),wF=function(n,t,o){var r=We(e),i=n.text.map((function(n){return Rx(pF(n,t,o.providers))})),u=n.icon.map((function(n){return Rx(gF(n,o.providers.icons))})),a=function(n,t){var e=zg.getValue(n);return hy.focus(e),ii(e,"keydown",{raw:t.event().raw()}),lB.close(e),w.some(!0)},c=n.role.fold((function(){return{}}),(function(n){return{role:n}})),s=n.tooltip.fold((function(){return{}}),(function(n){var t=o.providers.translate(n);return{title:t,"aria-label":t}})),f=Rx(lB.sketch(m(m({},c),{dom:{tag:"button",classes:[t,t+"--select"].concat(W(n.classes,(function(n){return t+"--"+n}))),attributes:m({},s)},components:pC([u.map((function(n){return n.asSpec()})),i.map((function(n){return n.asSpec()})),w.some({dom:{tag:"div",classes:[t+"__select-chevron"],innerHtml:Vx("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:lf(p(n.dropdownBehaviours,[cC.button(n.disabled),pB.config({}),uy.config({}),cy("dropdown-events",[fC(n,r),lC(n,r)]),cy("menubutton-update-display-text",[Ei(yF,(function(n,t){i.bind((function(t){return t.getOpt(n)})).each((function(n){uy.set(n,[ic(o.providers.translate(t.event().text()))])}))})),Ei(xF,(function(n,t){u.bind((function(t){return t.getOpt(n)})).each((function(n){uy.set(n,[gF(t.event().icon(),o.providers.icons)])}))}))])])),eventOrder:Tn(bF,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:lf([Jb.config({mode:"special",onLeft:a,onRight:a})]),lazySink:o.getSink,toggleClass:t+"--active",parts:{menu:Kk(!1,n.columns,n.presets)},fetch:function(){return yE.nu(n.fetch)}})));return f.asSpec()},SF=function(n){return B(n)},CF=function(n){return"separator"===n.type},kF=function(n){return yn(n,"getSubmenuItems")},OF={type:"separator"},TF=function(n,t){var e=J(n,(function(n,e){return SF(e)?""===e?n:"|"===e?n.length>0&&!CF(n[n.length-1])?n.concat([OF]):n:yn(t,e.toLowerCase())?n.concat([t[e.toLowerCase()]]):n:n.concat([e])}),[]);return e.length>0&&CF(e[e.length-1])&&e.pop(),e},EF=function(n,t){var e=n.getSubmenuItems(),o=AF(e,t),r=Tn(o.menus,qn(n.value,o.items)),i=Tn(o.expansions,qn(n.value,n.value));return{item:n,menus:r,expansions:i}},BF=function(n,t){return kF(n)?EF(n,t):{item:n,menus:{},expansions:{}}},DF=function(n){if(CF(n))return n;var t=Yn(n,"value").getOrThunk((function(){return _u("generated-menu-item")}));return Tn({value:t},n)},AF=function(n,t){var e=TF(B(n)?n.split(" "):n,t);return K(e,(function(n,e){var o=DF(e),r=BF(o,t);return{menus:Tn(n.menus,r.menus),items:[r.item].concat(n.items),expansions:Tn(n.expansions,r.expansions)}}),{menus:{},expansions:{},items:[]})},_F=function(n,t,e,o){var r=_u("primary-menu"),i=AF(n,e.shared.providers.menuItems());if(0===i.items.length)return w.none();var u=kO(r,i.items,t,e,o),a=mn(i.menus,(function(n,o){return kO(o,n,t,e,!1)})),c=Tn(a,qn(r,u));return w.from(hx.tieredData(r,c,i.expansions))},MF=function(n){return{isDisabled:function(){return oC.isDisabled(n)},setDisabled:function(t){return oC.set(n,t)},setActive:function(t){var e=n.element();t?(Aa(e,"tox-tbtn--enabled"),bu(e,"aria-pressed",!0)):(Ma(e,"tox-tbtn--enabled"),Su(e,"aria-pressed"))},isActive:function(){return Fa(n.element(),"tox-tbtn--enabled")}}},FF=function(n,t,e,o){return wF({text:n.text,icon:n.icon,tooltip:n.tooltip,role:o,fetch:function(t){n.fetch((function(n){t(_F(n,dC.CLOSE_ON_EXECUTE,e,!1))}))},onSetup:n.onSetup,getApi:MF,columns:1,presets:"normal",classes:[],dropdownBehaviours:[RE.config({})]},t,e.shared)},IF=function(n,t,e){var o=function(n){return function(o){e.shared.getSink().each((function(e){t().getOpt(e).each((function(t){kf(t.element()),ii(t,WT,{name:n.name,value:n.storage.get()})}))}));var r=!o.isActive();o.setActive(r),n.storage.set(r)}},r=function(n){return function(t){t.setActive(n.storage.get())}};return function(t){t(W(n,(function(n){var t=n.text.fold((function(){return{}}),(function(n){return{text:n}}));return m(m({type:n.type},t),{onAction:o(n),onSetup:r(n)})})))}},RF=function(n,t,e,o,r){void 0===e&&(e=[]);var i=t.fold((function(){return{}}),(function(n){return{action:n}})),u=m({buttonBehaviours:lf([cC.button(n.disabled),RE.config({}),cy("button press",[Ti("click"),Ti("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=Tn(u,{dom:o});return Tn(a,{components:r})},NF=function(n,t,e,o){void 0===o&&(o=[]);var r=n.tooltip.map((function(n){return{"aria-label":e.translate(n),title:e.translate(n)}})).getOr({}),i={tag:"button",classes:["tox-tbtn"],attributes:r},u=n.icon.map((function(n){return mF(n,e.icons)})),a=pC([u]);return RF(n,t,o,i,a)},VF=function(n,t,e,o){void 0===o&&(o=[]);var r=NF(n,w.some(t),e,o);return Ix.sketch(r)},HF=function(n,t,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=e.translate(n.text),u=n.icon?n.icon.map((function(n){return mF(n,e.icons)})):w.none(),a=u.isSome()?pC([u]):[],c=u.isSome()?{}:{innerHtml:i},s=p(n.primary||n.borderless?["tox-button"]:["tox-button","tox-button--secondary"],u.isSome()?["tox-button--icon"]:[],n.borderless?["tox-button--naked"]:[],r),f=m(m({tag:"button",classes:s},c),{attributes:{title:i}});return RF(n,t,o,f,a)},PF=function(n,t,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=HF(n,w.some(t),e,o,r);return Ix.sketch(i)},zF=function(n,e){return function(o){"custom"===e?ii(o,WT,{name:n,value:{}}):"submit"===e?ri(o,GT):"cancel"===e?ri(o,UT):t.console.error("Unknown button type: ",e)}},LF=function(n,t){return"menu"===t},jF=function(n,t){return"custom"===t||"cancel"===t||"submit"===t},UF=function(n,e,o){if(LF(n,e)){var r=function(){return a},i=n,u=m(m({},n),{fetch:IF(i.items,r,o)}),a=Rx(FF(u,"tox-tbtn",o,w.none()));return a.asSpec()}if(jF(n,e)){var c=zF(n.name,e),s=m(m({},n),{borderless:!1});return PF(s,c,o.shared.providers,[])}t.console.error("Unknown footer button type: ",e)},WF=function(n,t){var e=zF(n.name,"custom");return VE(w.none(),tE.parts().field(m({factory:Ix},HF(n,w.some(e),t,[W_.memory(""),D_.self()]))))},GF=i([Fe("field1Name","field1"),Fe("field2Name","field2"),ys("onLockedChange"),ps(["lockClass"]),Fe("locked",!1),Wg.field("coupledFieldBehaviours",[ov,zg])]),XF=function(n,t,e){return Fp(n,t,e).bind(ov.getCurrent)},YF=function(n,t){return bp({factory:tE,name:n,overrides:function(n){return{fieldBehaviours:lf([cy("coupled-input-behaviour",[Ei(Tr(),(function(e){XF(e,n,t).each((function(t){Fp(e,n,"lock").each((function(o){Ny.isOn(o)&&n.onLockedChange(e,t,o)}))}))}))])])}}})},qF=i([YF("field1","field2"),YF("field2","field1"),bp({factory:Ix,schema:[ge("dom")],name:"lock",overrides:function(n){return{buttonBehaviours:lf([Ny.config({selected:n.locked,toggleClass:n.markers.lockClass,aria:{mode:"pressed"}})])}}})]),KF=function(n,t,e,o){return{uid:n.uid,dom:n.dom,components:t,behaviours:Wg.augment(n.coupledFieldBehaviours,[ov.config({find:w.some}),zg.config({store:{mode:"manual",getValue:function(t){var e,o=Hp(t,n,["field1","field2"]);return e={},e[n.field1Name]=zg.getValue(o.field1()),e[n.field2Name]=zg.getValue(o.field2()),e},setValue:function(t,e){var o=Hp(t,n,["field1","field2"]);Zn(e,n.field1Name)&&zg.setValue(o.field1(),e[n.field1Name]),Zn(e,n.field2Name)&&zg.setValue(o.field2(),e[n.field2Name])}}})]),apis:{getField1:function(t){return Fp(t,n,"field1")},getField2:function(t){return Fp(t,n,"field2")},getLock:function(t){return Fp(t,n,"lock")}}}},JF=Qp({name:"FormCoupledInputs",configFields:GF(),partFields:qF(),factory:KF,apis:{getField1:function(n,t){return n.getField1(t)},getField2:function(n,t){return n.getField2(t)},getLock:function(n,t){return n.getLock(t)}}}),$F=function(n){var t={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4},e=function(n){return n in t?t[n]:1},o=n.value.toFixed(e(n.unit));return-1!==o.indexOf(".")&&(o=o.replace(/\.?0*$/,"")),o+n.unit},QF=function(n){var t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/,e=t.exec(n);if(null!==e){var o=parseFloat(e[1]),r=e[2];return O.value({value:o,unit:r})}return O.error(n)},ZF=function(n,t){var e={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},o=function(n){return Object.prototype.hasOwnProperty.call(e,n)};return n.unit===t?w.some(n.value):o(n.unit)&&o(t)?e[n.unit]===e[t]?w.some(n.value):w.some(n.value/e[n.unit]*e[t]):w.none()},nI=function(n){return w.none()},tI=function(n,t){return function(e){return ZF(e,t).map((function(e){return{value:e*n,unit:t}}))}},eI=function(n,t){var e=QF(n).toOption(),o=QF(t).toOption();return Zc(e,o,(function(n,t){return ZF(n,t.unit).map((function(n){return t.value/n})).map((function(n){return tI(n,t.unit)})).getOr(nI)})).getOr(nI)},oI=function(n,t){var e=nI,o=_u("ratio-event"),r=JF.parts().lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:t.translate(n.label.getOr("Constrain proportions"))}},components:[{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__lock"],innerHtml:Vx("lock",t.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:Vx("unlock",t.icons)}}],buttonBehaviours:lf([cC.button(n.disabled),RE.config({})])}),i=function(n){return{dom:{tag:"div",classes:["tox-form__group"]},components:n}},u=function(t){return tE.parts().field({factory:aE,inputClasses:["tox-textfield"],inputBehaviours:lf([oC.config({disabled:n.disabled}),RE.config({}),cy("size-input-events",[Ei(Sr(),(function(n,e){ii(n,o,{isField1:t})})),Ei(Er(),(function(t,e){ii(t,LT,{name:n.name})}))])]),selectOnFocus:!1})},a=function(n){return{dom:{tag:"label",classes:["tox-label"],innerHtml:t.translate(n)}}},c=JF.parts().field1(i([tE.parts().label(a("Width")),u(!0)])),s=JF.parts().field2(i([tE.parts().label(a("Height")),u(!1)]));return JF.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,i([a(" "),r])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(n,t,o){QF(zg.getValue(n)).each((function(n){e(n).each((function(n){zg.setValue(t,$F(n))}))}))},coupledFieldBehaviours:lf([oC.config({disabled:n.disabled,onDisabled:function(n){JF.getField1(n).bind(tE.getField).each(oC.disable),JF.getField2(n).bind(tE.getField).each(oC.disable),JF.getLock(n).each(oC.disable)},onEnabled:function(n){JF.getField1(n).bind(tE.getField).each(oC.enable),JF.getField2(n).bind(tE.getField).each(oC.enable),JF.getLock(n).each(oC.enable)}}),cy("size-input-events2",[Ei(o,(function(n,t){var o=t.event().isField1(),r=o?JF.getField1(n):JF.getField2(n),i=o?JF.getField2(n):JF.getField1(n),u=r.map(zg.getValue).getOr(""),a=i.map(zg.getValue).getOr("");e=eI(u,a)}))])])})},rI=i(_u("undo")),iI=i(_u("redo")),uI=i(_u("zoom")),aI=i(_u("back")),cI=i(_u("apply")),sI=i(_u("swap")),fI=i(_u("transform")),lI=i(_u("temp-transform")),dI=i(_u("transform-apply")),mI={undo:rI,redo:iI,zoom:uI,back:aI,apply:cI,swap:sI,transform:fI,tempTransform:lI,transformApply:dI},gI=i("save-state"),pI=i("disable"),vI=i("enable"),hI={formActionEvent:WT,saveState:gI,disable:pI,enable:vI},bI=function(n,t){var o=function(n,e,o,r){return Rx(PF({name:n,text:n,disabled:o,primary:r,icon:w.none(),borderless:!1},e,t))},r=function(n,e,o,r){return Rx(VF({name:n,icon:w.some(n),tooltip:w.some(e),disabled:r,primary:!1,borderless:!1},o,t))},u=function(n,t){n.map((function(n){var e=n.get(t);e.hasConfigured(oC)&&oC.disable(e)}))},a=function(n,t){n.map((function(n){var e=n.get(t);e.hasConfigured(oC)&&oC.enable(e)}))},c={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},s=e,f=function(n,t,e){ii(n,t,e)},l=function(n){return ri(n,hI.disable())},d=function(n){return ri(n,hI.enable())},m=function(n,t){l(n),f(n,mI.transform(),{transform:t}),d(n)},g=function(n,t){l(n),f(n,mI.tempTransform(),{transform:t}),d(n)},p=function(n){return function(){an.getOpt(n).each((function(n){uy.set(n,[rn])}))}},v=function(n,t){l(n),f(n,mI.transformApply(),{transform:t,swap:p(n)}),d(n)},h=function(){return o("Back",(function(n){return f(n,mI.back(),{swap:p(n)})}),!1,!1)},b=function(){return Rx({dom:{tag:"div",classes:["tox-spacer"]},behaviours:lf([oC.config({})])})},y=function(){return o("Apply",(function(n){return f(n,mI.apply(),{swap:p(n)})}),!0,!0)},x=function(){return function(t){var e=n.getRect();return sF(t,e.x,e.y,e.w,e.h)}},S=[h(),b(),o("Apply",(function(t){var e=x();v(t,e),n.hideCrop()}),!1,!0)],C=pT.sketch({dom:c,components:S.map((function(n){return n.asSpec()})),containerBehaviours:lf([cy("image-tools-crop-buttons-events",[Ei(hI.disable(),(function(n,t){u(S,n)})),Ei(hI.enable(),(function(n,t){a(S,n)}))])])}),k=Rx(oI({name:"size",label:w.none(),constrain:!0,disabled:!1},t)),O=function(n,t){return function(e){return fF(e,n,t)}},T=[h(),b(),k,b(),o("Apply",(function(n){k.getOpt(n).each((function(t){var e=zg.getValue(t),o=parseInt(e.width,10),r=parseInt(e.height,10),i=O(o,r);v(n,i)}))}),!1,!0)],E=pT.sketch({dom:c,components:T.map((function(n){return n.asSpec()})),containerBehaviours:lf([cy("image-tools-resize-buttons-events",[Ei(hI.disable(),(function(n,t){u(T,n)})),Ei(hI.enable(),(function(n,t){a(T,n)}))])])}),B=function(n,t){return function(e){return n(e,t)}},D=B(cF,"h"),A=B(cF,"v"),_=B(lF,-90),M=B(lF,90),F=function(n,t){g(n,t)},I=[h(),b(),r("flip-horizontally","Flip horizontally",(function(n){F(n,D)}),!1),r("flip-vertically","Flip vertically",(function(n){F(n,A)}),!1),r("rotate-left","Rotate counterclockwise",(function(n){F(n,_)}),!1),r("rotate-right","Rotate clockwise",(function(n){F(n,M)}),!1),b(),y()],R=pT.sketch({dom:c,components:I.map((function(n){return n.asSpec()})),containerBehaviours:lf([cy("image-tools-fliprotate-buttons-events",[Ei(hI.disable(),(function(n,t){u(I,n)})),Ei(hI.enable(),(function(n,t){a(I,n)}))])])}),N=function(n,e,o,r,u){var a=u_.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:t.translate(n)}}),c=u_.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),s=u_.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Rx(u_.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:o,maxX:u,getInitialValue:i({x:i(r)})},components:[a,c,s],sliderBehaviours:lf([hy.config({})]),onChoose:e}))},V=function(n,t,e,o,r){var i=function(n,e,o){var r=B(t,o.x()/100);m(n,r)};return N(n,i,e,o,r)},H=function(n,t,e,o,r){return[h(),V(n,t,e,o,r),y()]},P=function(n,t,e,o,r){var i=H(n,t,e,o,r);return pT.sketch({dom:c,components:i.map((function(n){return n.asSpec()})),containerBehaviours:lf([cy("image-tools-filter-panel-buttons-events",[Ei(hI.disable(),(function(n,t){u(i,n)})),Ei(hI.enable(),(function(n,t){a(i,n)}))])])})},z=[h(),b(),y()],L=pT.sketch({dom:c,components:z.map((function(n){return n.asSpec()}))}),j=P("Brightness",uF,-100,0,100),U=P("Contrast",aF,-100,0,100),W=P("Gamma",rF,-100,0,100),G=function(n,t,e){return function(o){return iF(o,n,t,e)}},X=function(n){var t=function(n,t,e){var o=Y.getOpt(n),r=K.getOpt(n),i=q.getOpt(n);o.each((function(t){r.each((function(e){i.each((function(o){var r=zg.getValue(t).x()/100,i=zg.getValue(o).x()/100,u=zg.getValue(e).x()/100,a=G(r,i,u);m(n,a)}))}))}))};return N(n,t,0,100,200)},Y=X("R"),q=X("G"),K=X("B"),J=[h(),Y,q,K,y()],$=pT.sketch({dom:c,components:J.map((function(n){return n.asSpec()}))}),Q=function(n,t,e){return function(o){var r=function(){an.getOpt(o).each((function(t){uy.set(t,[n]),e(t)}))};f(o,mI.swap(),{transform:t,swap:r})}},Z=function(t){n.showCrop()},nn=function(t){k.getOpt(t).each((function(t){var e=n.getMeasurements(),o=e.width,r=e.height;zg.setValue(t,{width:o,height:r})}))},tn=w.some(oF),en=w.some(eF),on=[r("crop","Crop",Q(C,w.none(),Z),!1),r("resize","Resize",Q(E,w.none(),nn),!1),r("orientation","Orientation",Q(R,w.none(),s),!1),r("brightness","Brightness",Q(j,w.none(),s),!1),r("sharpen","Sharpen",Q(L,tn,s),!1),r("contrast","Contrast",Q(U,w.none(),s),!1),r("color-levels","Color levels",Q($,w.none(),s),!1),r("gamma","Gamma",Q(W,w.none(),s),!1),r("invert","Invert",Q(L,en,s),!1)],rn=pT.sketch({dom:c,components:on.map((function(n){return n.asSpec()}))}),un=pT.sketch({dom:{tag:"div"},components:[rn],containerBehaviours:lf([uy.config({})])}),an=Rx(un),cn=function(n){return an.getOpt(n).map((function(n){var t=n.components()[0];return t.components()[t.components().length-1]}))};return{memContainer:an,getApplyButton:cn}},yI=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),xI=tinymce.util.Tools.resolve("tinymce.geom.Rect"),wI=tinymce.util.Tools.resolve("tinymce.util.Observable"),SI=tinymce.util.Tools.resolve("tinymce.util.Tools"),CI=tinymce.util.Tools.resolve("tinymce.util.VK");function kI(n){var t,e,o,r,i,u,a,c,s=Math.max;return t=n.documentElement,e=n.body,o=s(t.scrollWidth,e.scrollWidth),r=s(t.clientWidth,e.clientWidth),i=s(t.offsetWidth,e.offsetWidth),u=s(t.scrollHeight,e.scrollHeight),a=s(t.clientHeight,e.clientHeight),c=s(t.offsetHeight,e.offsetHeight),{width:o").css({position:"absolute",top:0,left:0,width:m.width,height:m.height,zIndex:2147483647,opacity:1e-4,cursor:d}).appendTo(f.body),yI(f).on("mousemove touchmove",a).on("mouseup touchend",u),e.start(n)},a=function(n){if(OI(n),n.button!==r)return u(n);n.deltaX=n.screenX-c,n.deltaY=n.screenY-s,n.preventDefault(),e.drag(n)},u=function(n){OI(n),yI(f).off("mousemove touchmove",a).off("mouseup touchend",u),o.remove(),e.stop&&e.stop(n)},this.destroy=function(){yI(l).off()},yI(l).on("mousedown touchstart",i)}var EI=0,BI=function(n,t,e,o,r){var i,u,a,c="tox-",s=c+"crid-"+EI++,f=[{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"}];a=["top","right","bottom","left"];var l=function(n,t){return{x:t.x+n.x,y:t.y+n.y,w:t.w,h:t.h}},d=function(n,t){return{x:t.x-n.x,y:t.y-n.y,w:t.w,h:t.h}},m=function(){return d(e,n)};function g(t,o,r,u){var a,c,s,f,l;a=o.x,c=o.y,s=o.w,f=o.h,a+=r*t.deltaX,c+=u*t.deltaY,s+=r*t.deltaW,f+=u*t.deltaH,s<20&&(s=20),f<20&&(f=20),l=n=xI.clamp({x:a,y:c,w:s,h:f},e,"move"===t.name),l=d(e,l),i.fire("updateRect",{rect:l}),x(l)}function p(){function t(t){var e;return new TI(s,{document:o.ownerDocument,handle:s+"-"+t.name,start:function(){e=n},drag:function(n){g(t,e,n.deltaX,n.deltaY)}})}yI('
').appendTo(o),SI.each(a,(function(n){yI("#"+s,o).append('