/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.0.0-1 (2019-02-04) */ !function(){"use strict";var Q=function(){for(var t=[],n=0;n "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"},toDsl:function(){return wo.objOf(V(a,function(t){return t.fold(function(t,n,e,o){return zo.field(t,e,o)},function(t,n){return zo.state(t)})}))}}},Do=function(r){return{extract:function(e,o,t){var n=V(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return xo(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return wo.arrOf(r)}}},_o=function(a,c){return{extract:function(e,o,r){var t,n,i=K(r),u=(t=e,n=i,Do(To(a)).extract(t,d,n));return ho(u,function(t){var n=V(t,function(t){return Mo.field(t,t,no(),c)});return Bo(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return wo.setOf(a,c)}}},Fo=Z(To(lo)),Io=g(Do,Bo),Lo=Mo.state,Ro=Mo.field,No=function(e,n,o,r,i){return wt(r,i).fold(function(){return t=r,n=i,Oo(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+Co(t)});var t,n},function(t){return Bo(t).extract(e.concat(["branch: "+i]),n,o)})},Po=function(r,i){return{extract:function(n,e,o){return wt(o,r).fold(function(){return t=r,Oo(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return No(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+K(i)},toDsl:function(){return wo.choiceOf(r,i)}}},jo=To(lo),Uo=function(n){return To(function(t){return n(t).fold(mo,lo)})},Wo=function(n,t){return _o(function(t){return co(n(t))},t)},Go=function(t,n,e){return so((o=t,r=d,i=e,u=n.extract([o],r,i),po(u,function(t){return{input:i,errors:t}})));var o,r,i,u},Xo=function(t){return t.fold(function(t){throw new Error(qo(t))},d)},Yo=function(t,n,e){return Xo(Go(t,n,e))},qo=function(t){return"Errors: \n"+(n=t.errors,e=10 ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+Co(t.input);var n,e},Ko=function(t,n){return Po(t,n)},Jo=Z(jo),$o=function(e,o){return To(function(t){var n=typeof t;return e(t)?lo(t):mo("Expected type: "+o+" but got: "+n)})},Qo=$o(k,"number"),Zo=$o(x,"string"),tr=$o(z,"boolean"),nr=$o(S,"function"),er=function(n){return Uo(function(t){return M(n,t)?dt.value(t):dt.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},or=function(t){return Ro(t,t,no(),Fo())},rr=function(t,n){return Ro(t,t,no(),n)},ir=function(t){return rr(t,Zo)},ur=function(t,n){return Ro(t,t,no(),er(n))},ar=function(t){return rr(t,nr)},cr=function(t,n){return Ro(t,t,no(),Bo(n))},sr=function(t,n){return Ro(t,t,no(),Io(n))},lr=function(t,n){return Ro(t,t,no(),Do(n))},fr=function(t){return Ro(t,t,eo(),Fo())},dr=function(t,n){return Ro(t,t,eo(),n)},mr=function(t){return dr(t,Zo)},hr=function(t){return dr(t,nr)},gr=function(t,n){return Ro(t,t,eo(),Bo(n))},vr=function(t,n){return Ro(t,t,to(n),Fo())},pr=function(t,n,e){return Ro(t,t,to(n),e)},br=function(t,n){return pr(t,n,Qo)},yr=function(t,n){return pr(t,n,Zo)},xr=function(t,n,e){return pr(t,n,er(e))},wr=function(t,n){return pr(t,n,tr)},zr=function(t,n){return pr(t,n,nr)},Sr=function(t,n,e){return Ro(t,t,to(n),Bo(e))},kr=function(t,n){return Lo(t,n)},Cr=function(t,n){return ae(t.element(),n.event().target())},Or=function(t){if(!Ct(t,"can")&&!Ct(t,"abort")&&!Ct(t,"run"))throw new Error("EventHandler defined by: "+ko(t,null,2)+" does not have can, abort, or run!");return Yo("Extracting event.handler",Ao([vr("can",Z(!0)),vr("abort",Z(!1)),vr("run",Q)]),t)},Mr=function(e){var n,o,r,i,t=(n=e,o=function(t){return t.can},function(){for(var e=[],t=0;t "):o[0].name();return zt(r,{handler:n,purpose:Z(e)})})});return kt(n,{})},Di=function(t){return Go("custom.definition",Bo([Ro("dom","dom",no(),Bo([or("tag"),vr("styles",{}),vr("classes",[]),vr("attributes",{}),fr("value"),fr("innerHtml")])),or("components"),or("uid"),vr("events",{}),vr("apis",{}),Ro("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"]},Ze.mergeWithThunk(Z(n))),Jo()),fr("domModification")]),t);var n},_i=function(t,n){var e=Te(t,n);return e===undefined||""===e?[]:e.split(" ")},Fi=function(t){return t.dom().classList!==undefined},Ii=function(t,n){return r=n,i=_i(e=t,o="class").concat([r]),Ee(e,o,i.join(" ")),!0;var e,o,r,i},Li=function(t,n){return r=n,0<(i=A(_i(e=t,o="class"),function(t){return t!==r})).length?Ee(e,o,i.join(" ")):Be(e,o),!1;var e,o,r,i},Ri=function(t,n){Fi(t)?t.dom().classList.add(n):Ii(t,n)},Ni=function(t){0===(Fi(t)?t.dom().classList:_i(t,"class")).length&&Be(t,"class")},Pi=function(t,n){Fi(t)?t.dom().classList.remove(n):Li(t,n),Ni(t)},ji=function(t,n){return Fi(t)&&t.dom().classList.contains(n)},Ui=function(n,t){T(t,function(t){Ri(n,t)})},Wi=function(n,t){T(t,function(t){Pi(n,t)})},Gi=function(t){return t.style!==undefined},Xi=function(t,n,e){if(!x(e))throw console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);Gi(t)&&t.style.setProperty(n,e)},Yi=function(t,n){Gi(t)&&t.style.removeProperty(n)},qi=function(t,n,e){var o=t.dom();Xi(o,n,e)},Ki=function(t,n){var e=t.dom();$(n,function(t,n){Xi(e,n,t)})},Ji=function(t,n){var e=t.dom(),o=window.getComputedStyle(e).getPropertyValue(n),r=""!==o||Lr(t)?o:$i(e,n);return null===r?undefined:r},$i=function(t,n){return Gi(t)?t.style.getPropertyValue(n):""},Qi=function(t,n){var e=t.dom(),o=$i(e,n);return tt.from(o).filter(function(t){return 0"}),Jo()),Qs=kr("schema",function(){return[fr("preprocess")]}),Zs=vr("defaults",Z({})),tl=vr("overrides",Z({})),nl=Bo([qs,Ks,Js,$s,Zs,tl]),el=Bo([qs,Ks,Js,Zs,tl]),ol=Bo([qs,Ks,Js,$s,Zs,tl]),rl=Bo([qs,Qs,Js,or("unit"),$s,Zs,tl]),il=function(t){return t.fold(tt.some,tt.none,tt.some,tt.some)},ul=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},al=function(e,o){return function(t){var n=Yo("Converting part type",o,t);return e(n)}},cl=al(Ys.required,nl),sl=al(Ys.external,el),ll=al(Ys.optional,ol),fl=al(Ys.group,rl),dl=Z("entirety"),ml=/* */Object.freeze({required:cl,external:sl,optional:ll,group:fl,asNamedPart:il,name:ul,asCommon:function(t){return t.fold(d,d,d,d)},original:dl}),hl=function(t,n,e,o){return vt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},gl=function(r,t){var n={};return T(t,function(t){il(t).each(function(e){var o=vl(r,e.pname);n[e.name]=function(t){var n=Yo("Part: "+e.name+" in "+r,Bo(e.schema),t);return Ke({},o,{config:t,validated:n})}})}),n},vl=function(t,n){return{uiType:Xs(),owner:t,name:n}},pl=function(t,n,e){return{uiType:Xs(),owner:t,name:n,config:e,validated:{}}},bl=function(t){return N(t,function(t){return t.fold(tt.none,tt.some,tt.none,tt.none).map(function(t){return cr(t.name,t.schema.concat([Au(dl())]))}).toArray()})},yl=function(t){return V(t,ul)},xl=function(t,n,e){return o=n,i={},r={},T(e,function(t){t.fold(function(o){i[o.pname]=Ws(!0,function(t,n,e){return o.factory.sketch(hl(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=Z(t.factory.sketch(hl(o,t,n[dl()]),n))},function(o){i[o.pname]=Ws(!1,function(t,n,e){return o.factory.sketch(hl(t,o,n,e))})},function(r){i[r.pname]=Gs(!0,function(n,t,e){var o=n[r.name];return V(o,function(t){return r.factory.sketch(vt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:Z(i),externals:Z(r)};var o,i,r},wl=function(t,n,e){return Us(tt.some(t),n,n.components,e)},zl=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},Sl=function(t,n,e){return zl(t,n,e).getOrDie("Could not find part: "+e)},kl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return T(e,function(t){o[t]=i.getByUid(r[t])}),nt(o,Z)},Cl=function(t,n){var e=t.getSystem();return nt(n.partUids,function(t,n){return Z(e.getByUid(t))})},Ol=function(t){return K(t.partUids)},Ml=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return T(e,function(t){o[t]=i.getByUid(r[t]).getOrDie()}),nt(o,Z)},Hl=function(n,t){var e=yl(t);return St(V(e,function(t){return{key:t,value:n+"-"+t}}))},El=function(n){return Ro("partUids","partUids",ro(function(t){return Hl(t.uid,n)}),Jo())},Vl=/* */Object.freeze({generate:gl,generateOne:pl,schemas:bl,names:yl,substitutes:xl,components:wl,defaultUids:Hl,defaultUidsSchema:El,getAllParts:Cl,getAllPartNames:Ol,getPart:zl,getPartOrDie:Sl,getParts:kl,getPartsOrDie:Ml}),Tl=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[cr("parts",i)]:[]).concat([or("uid"),vr("dom",{}),vr("components",[]),Au("originalSpec"),vr("debug.sketcher",{})]).concat(u));return Yo(t+" [SpecSchema]",Ao(a.concat(n)),e)},Al=function(t,n,e,o,r){var i=Bl(r),u=bl(e),a=El(e),c=Tl(t,n,i,u,[a]),s=xl(0,c,e);return o(c,wl(t,c,s.internals()),i,s.externals())},Bl=function(t){return t.hasOwnProperty("uid")?t:Ke({},t,{uid:hi("uid")})},Dl=Ao([or("name"),or("factory"),or("configFields"),vr("apis",{}),vr("extraApis",{})]),_l=Ao([or("name"),or("factory"),or("configFields"),or("partFields"),vr("apis",{}),vr("extraApis",{})]),Fl=function(t){var i=Yo("Sketcher for "+t.name,Dl,t),n=nt(i.apis,zi),e=nt(i.extraApis,function(t,n){return yi(t,n)});return Ke({name:Z(i.name),partFields:Z([]),configFields:Z(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=Bl(t),o(Tl(n,e,r,[],[]),r);var n,e,o,r}},n,e)},Il=function(t){var n=Yo("Sketcher for "+t.name,_l,t),e=gl(n.name,n.partFields),o=nt(n.apis,zi),r=nt(n.extraApis,function(t,n){return yi(t,n)});return Ke({name:Z(n.name),partFields:Z(n.partFields),configFields:Z(n.configFields),sketch:function(t){return Al(n.name,n.configFields,n.partFields,n.factory,t)},parts:Z(e)},o,r)},Ll=function(t){return"input"===Se(t)&&"radio"!==Te(t,"type")||"textarea"===Se(t)},Rl=/* */Object.freeze({getCurrent:function(t,n,e){return n.find(t)}}),Nl=[or("find")],Pl=Pu({fields:Nl,name:"composing",apis:Rl}),jl=function(t,n,e,o){var r=t+n;return o',"align-center":'',"align-justify":'',"align-left":'',"align-none":'',"align-right":'',"arrow-left":'',"arrow-right":'',bold:'',bookmark:'',"border-width":'',brightness:'',browse:'',cancel:'',"change-case":'',"character-count":'',checklist:'',checkmark:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',close:'',"code-sample":'',"color-levels":'',"color-picker":'',"color-swatch-remove-color":'',"color-swatch":'',comment:'',contrast:'',copy:'',crop:'',cut:'',"document-properties":'',drag:'',duplicate:'',"edit-image":'',"embed-page":'',embed:'',emoji:'',fill:'',"flip-horizontally":'',"flip-vertically":'',"format-painter":'',fullscreen:'',gamma:'',help:'',"highlight-bg-color":'',home:'',"horizontal-rule":'',"image-options":'',image:'',indent:'',indeterminate:'',info:'',"insert-character":'',"insert-time":'',invert:'',italic:'',line:'',link:'',"list-bull-circle":'',"list-bull-default":'',"list-bull-square":'',"list-num-default":'',"list-num-lower-alpha":'',"list-num-lower-greek":'',"list-num-lower-roman":'',"list-num-upper-alpha":'',"list-num-upper-roman":'',lock:'',ltr:'',"new-document":'',"new-tab":'',"non-breaking":'',notice:'',"ordered-list":'',orientation:'',outdent:'',"page-break":'',paragraph:'',"paste-text":'',paste:'',"permanent-pen":'',plus:'',preferences:'',preview:'',print:'',quote:'',redo:'',reload:'',"remove-formatting":'',remove:'',"resize-handle":'',resize:'',"restore-draft":'',"rotate-left":'',"rotate-right":'',rtl:'',save:'',search:'',"select-all":'',selected:'',settings:'',sharpen:'',sourcecode:'',"spell-check":'',"strike-through":'',subscript:'',superscript:'',"table-cell-properties":'',"table-cell-select-all":'',"table-cell-select-inner":'',"table-delete-column":'',"table-delete-row":'',"table-delete-table":'',"table-insert-column-after":'',"table-insert-column-before":'',"table-insert-row-above":'',"table-insert-row-after":'',"table-left-header":'',"table-merge-cells":'',"table-row-properties":'',"table-split-cells":'',"table-top-header":'',table:'',template:'',"temporary-placeholder":'',"text-color":'',toc:'',translate:'',underline:'',undo:'',unlink:'',unlock:'',"unordered-list":'',unselected:'',upload:'',user:'',warning:'',"zoom-in":'',"zoom-out":''},nh=tt.from(th["temporary-placeholder"]).getOr("!not found!"),eh=function(n,t){return tt.from(t()[n]).getOrThunk(function(){return t=n,tt.from(th[t]).getOr(nh);var t})},oh=function(e,t,o){return tt.from(t()[e]).getOrThunk(function(){return t=e,n=o,tt.from(th[t]).getOrThunk(function(){return n.getOr(nh)});var t,n})},rh=function(t,n){return Ht(t,function(t){return tt.from(n()[t])}).getOrThunk(function(){return Ht(t,function(t){return tt.from(th[t])}).getOr(nh)})},ih={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},uh=Fl({name:"Notification",factory:function(n){var o=Zm({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:Ru([$d.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-bar"],attributes:{style:"width: "+t+"%"}}}},r=function(t){return{dom:{tag:"div",classes:["tox-text"],innerHtml:t+"%"}}},i=Zm({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)]},r(0)],behaviours:Ru([$d.config({})])}),t={updateProgress:function(t,n){t.getSystem().isConnected()&&i.getOpt(t).each(function(t){$d.set(t,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[e(n)]},r(n)])})},updateText:function(t,n){if(t.getSystem().isConnected()){var e=o.get(t);$d.set(e,[lu(n)])}}},u=R([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return tt.from(ih[t])}).toArray()]);return{uid:n.uid,dom:{tag:"div",attributes:{role:"alert"},classes:n.level.map(function(t){return["tox-notification","tox-notification--in","tox-notification--"+t]}).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:rh(u,n.iconProvider)}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:Ru([$d.config({})])}].concat(n.progress?[i.asSpec()]:[]).concat(Qm.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:eh("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:t}},configFields:[fr("level"),or("progress"),or("icon"),or("onAction"),or("text"),or("iconProvider"),or("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}});function ah(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),Jm.hide(r)},o=mu(uh.sketch({text:t.text,level:M(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:tt.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=mu(Jm.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),t.timeout&&setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){Jm.showAt(r,{anchor:"makeshift",x:t,y:n},hu(o))},moveRel:function(t,n){Jm.showAt(r,i.backstage.shared.anchors.banner(),hu(o))},text:function(t){uh.updateText(o,t)},settings:t,getEl:function(){},progressBar:{value:function(t){uh.updateProgress(o,t)}}}},close:function(t){t.close()},reposition:function(t){T(t,function(t){t.moveTo(0,0)}),function(e){if(0=t.minChars&&t.matches(e.range,a,e.text)});return{lookupData:hh.all(V(t,function(n){return n.fetch(e.text,n.maxResults).then(function(t){return{items:t,columns:n.columns,onAction:n.onAction}})})),triggerChar:e.triggerChar,range:e.range}})},vh=Bo([kr("type",function(){return"autocompleteitem"}),kr("active",function(){return!1}),kr("disabled",function(){return!1}),vr("meta",{}),ir("value"),mr("text"),mr("icon")]),ph=Bo([ir("type"),ir("ch"),br("minChars",0),vr("columns",1),br("maxResults",10),zr("matches",function(){return!0}),ar("fetch"),ar("onAction")]),bh=function(t){var n,e,o=t.ui.registry.getAll().popups,r=nt(o,function(t){return(n=t,Go("Autocompleter",ph,n)).fold(function(t){throw new Error(qo(t))},function(t){return t});var n}),i=(n=ot(r,function(t){return t.ch}),e={},T(n,function(t){e[t]={}}),K(e)),u=rt(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return A(u,function(t){return t.ch===n})}}},yh=[wr("disabled",!1),mr("text"),mr("shortcut"),Ro("value","value",oo(function(){return Ye("menuitem-value")}),Jo()),vr("meta",{})],xh=Bo([ir("type"),zr("onSetup",function(){return Q}),zr("onAction",Q),mr("icon")].concat(yh)),wh=Bo([ir("type"),ar("getSubmenuItems"),zr("onSetup",function(){return Q}),mr("icon")].concat(yh)),zh=Bo([ir("type"),wr("active",!1),zr("onSetup",function(){return Q}),ar("onAction")].concat(yh)),Sh=Bo([ir("type"),wr("active",!1),mr("icon")].concat(yh)),kh=Bo([ir("type"),mr("text")]),Ch=Bo([ir("type"),ur("fancytype",["inserttable"]),zr("onAction",Q)]),Oh=function(t,o,n){var r=Vc(t.element(),"."+n);if(0o}).getOr(r.length);return tt.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return tt.none()},Mh=function(t,n){return Ru([_m(t,n)])},Hh=function(t){return Mh(Ye("unnamed-events"),t)},Eh=["input","button","textarea"],Vh=function(t,n,e){n.disabled&&Fh(t,n,e)},Th=function(t){return M(Eh,Se(t.element()))},Ah=function(t){Ee(t.element(),"disabled","disabled")},Bh=function(t){Be(t.element(),"disabled")},Dh=function(t){Ee(t.element(),"aria-disabled","true")},_h=function(t){Ee(t.element(),"aria-disabled","false")},Fh=function(n,t,e){t.disableClass.each(function(t){Ri(n.element(),t)}),(Th(n)?Ah:Dh)(n)},Ih=function(t){return Th(t)?Ae(t.element(),"disabled"):"true"===Te(t.element(),"aria-disabled")},Lh=/* */Object.freeze({enable:function(n,t,e){t.disableClass.each(function(t){Pi(n.element(),t)}),(Th(n)?Bh:_h)(n)},disable:Fh,isDisabled:Ih,onLoad:Vh}),Rh=/* */Object.freeze({exhibit:function(t,n,e){return Oi({classes:n.disabled?n.disableClass.map(G).getOr([]):[]})},events:function(t,n){return Gr([Xr(Cn(),function(t,n){return Ih(t)}),Du(t,n,Vh)])}}),Nh=[vr("disabled",!1),fr("disableClass")],Ph=Pu({fields:Nh,name:"disabling",active:Rh,apis:Lh}),jh=[or("lazySink"),or("tooltipDom"),vr("exclusive",!0),vr("tooltipComponents",[]),vr("delay",300),xr("mode","normal",["normal","follow-highlight"]),vr("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:Z([uc,ic,nc,oc,ec,rc]),onRtl:Z([uc,ic,nc,oc,ec,rc])}}}),Mu("onHide"),Mu("onShow")],Uh=/* */Object.freeze({init:function(){var e=Ot(tt.none()),n=Ot(tt.none()),o=function(){e.get().each(function(t){clearTimeout(t)})},t=Z("not-implemented");return ki({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(tt.some(t))},clearTooltip:function(){n.set(tt.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(tt.some(setTimeout(function(){t()},n)))},readState:t})}}),Wh=Ye("tooltip.exclusive"),Gh=Ye("tooltip.show"),Xh=Ye("tooltip.hide"),Yh=function(t,n,e){t.getSystem().broadcastOn([Wh],{})},qh=/* */Object.freeze({hideAllExclusive:Yh,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&$d.set(t,o)})}}),Kh=Pu({fields:jh,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){gs(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return Gr(R([[qr(Gh,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){Yh(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:Gr("normal"===o.mode?[qr(Ft(),function(t){Hr(n,Gh)}),qr(Dt(),function(t){Hr(n,Xh)})]:[]),behaviours:Ru([$d.config({})])});r.setTooltip(e),ds(t,e),o.onShow(n,e),ss.position(t,o.anchor(n),e)}}(t)},o.delay)}),qr(Xh,function(t){r.resetTimer(function(){e(t)},o.delay)}),qr(kn(),function(t,n){M(n.channels(),Wh)&&e(t)}),oi(function(t){e(t)})],"normal"===o.mode?[qr(It(),function(t){Hr(t,Gh)}),qr(zn(),function(t){Hr(t,Xh)}),qr(Ft(),function(t){Hr(t,Gh)}),qr(Dt(),function(t){Hr(t,Xh)})]:[qr(jn(),function(t,n){Hr(t,Gh)}),qr(Un(),function(t){Hr(t,Xh)})]]))}}),state:Uh,apis:qh}),Jh="tox-menu-nav__js",$h="tox-collection__item",Qh="tox-swatch",Zh={normal:Jh,color:Qh},tg="tox-collection__item--enabled",ng="tox-collection__item-icon",eg="tox-collection__item-label",og="tox-collection__item--active",rg=function(t){return wt(Zh,t).getOr(Jh)},ig=tinymce.util.Tools.resolve("tinymce.util.I18n"),ug=tinymce.util.Tools.resolve("tinymce.Env"),ag=function(t){var e=ug.mac?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘"}:{meta:"Ctrl"},n=t.split("+"),o=V(n,function(t){var n=t.toLowerCase().trim();return ut(e,n)?e[n]:t});return ug.mac?o.join(""):o.join("+")},cg=function(t){return{dom:{tag:"span",classes:[ng],innerHtml:t}}},sg=function(t){return{dom:{tag:"span",classes:[eg]},components:[lu(ig.translate(t))]}},lg=function(t,n){return{dom:{tag:"span",classes:[eg]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[lu(ig.translate(n))]}]}},fg=function(t){return{dom:{tag:"span",classes:["tox-collection__item-accessory"],innerHtml:ag(t)}}},dg=function(t){return{dom:{tag:"span",classes:[ng,"tox-collection__item-checkmark"],innerHtml:eh("checkmark",t)}}},mg=function(t){var n,e,o,r=Gn.fromHtml(t),i=de(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],D(e,function(t,n){var e;return"class"===n.name?t:Ke({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:we(r)};return Ke({tag:Se(r),classes:a,attributes:u},c)},hg=function(t,n,e,o){void 0===o&&(o=tt.none());var r,i,u,a,c,s,l,f,d,m,h=t.iconContent.map(function(t){return oh(t,n.icons,o)}),g=tt.from(t.meta).fold(function(){return sg},function(t){return ut(t,"style")?v(lg,t.style):sg});return"color"===t.presets?(s=t.ariaLabel,l=t.value,{dom:(f=Qh,d=h.getOr(""),m=s.map(function(t){return' title="'+t+'"'}).getOr(""),mg("custom"===l?'":"remove"===l?'
"+d+"
":'
")),optComponents:[]}):(r=t,i=h,u=g,a=e?r.checkMark.orThunk(function(){return i.or(tt.some("")).map(cg)}):tt.none(),c=r.ariaLabel.map(function(t){return{attributes:{title:ig.translate(t)}}}).getOr({}),{dom:pt({tag:"div",classes:[Jh,$h]},c),optComponents:[a,r.textContent.map(u),r.shortcutContent.map(fg),r.caret]})},gg=function(t){return Ph.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},vg=function(t){return Ph.config({disabled:t})},pg=function(t){return Ph.config({disabled:t,disableClass:"tox-tbtn--disabled"})},bg=function(t,n){var e=t.getApi(n);return function(t){t(e)}},yg=function(e,o){return ei(function(t){bg(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},xg=function(n,e){return oi(function(t){return bg(n,t)(e.get())})};(sh=ch||(ch={}))[sh.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",sh[sh.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var wg,zg,Sg=ch,kg={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},Cg=function(t){return N(t,function(t){return t.toArray()})},Og=function(t,n,e){var o,r,i=Ot(Q);return{type:"item",dom:n.dom,components:Cg(n.optComponents),data:t.data,eventOrder:kg,hasSubmenu:t.triggersSubmenu,itemBehaviours:Ru([_m("item-events",[(o=t,r=e,ii(function(t,n){bg(o,t)(o.onAction),o.triggersSubmenu||r!==Sg.CLOSE_ON_EXECUTE||(Hr(t,Vn()),n.stop())})),yg(t,i),xg(t,i)]),gg(t.disabled),$d.config({})].concat(t.itemBehaviours))}},Mg=function(t){return{value:t.value,meta:pt({text:t.text.getOr("")},t.meta)}},Hg=Z(gl("item-widget",Lm())),Eg=Ye("cell-over"),Vg=Ye("cell-execute"),Tg=function(n,e,t){var o,r=function(t){return Er(t,Vg,{row:n,col:e})};return mu({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:Ru([_m("insert-table-picker-cell",[qr(Ft(),gm.focus),qr(Cn(),r),qr(Hn(),r)]),Hm.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),gm.config({onFocus:function(t){return Er(t,Eg,{row:n,col:e})}})])})},Ag={inserttable:function zE(o){var t,n=Ye("size-label"),a=function(t,n,e){for(var o=[],r=0;r=r.minChars){var o=Pl.getCurrent(e).bind(function(t){return tf.getHighlighted(t).map(lm.getValue)});r.previewing.set(!0),sp(r,u(t),t,e,i,function(t){Pl.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&tf.highlightFirst(t)},function(n){tf.highlightBy(t,function(t){return lm.getValue(t).value===n.value}),tf.getHighlighted(t).orThunk(function(){return tf.highlightFirst(t),tt.none()})})})},Mv.HighlightFirst).get(Q)}},cancelEvent:Tn()}),Xd.config({mode:"special",onDown:function(t,n){return e(t,n,tf.highlightFirst),tt.some(!0)},onEscape:function(t){var n=Jv.getCoupled(t,"sandbox");return Hs.isOpen(n)?(Hs.close(n),tt.some(!0)):tt.none()},onUp:function(t,n){return e(t,n,tf.highlightLast),tt.some(!0)},onEnter:function(n){var t=Jv.getCoupled(n,"sandbox"),e=Hs.isOpen(t);if(e&&!r.previewing.get())return Pl.getCurrent(t).bind(function(t){return tf.getHighlighted(t)}).map(function(t){return Er(n,zp(),{item:t}),!0});var o=lm.getValue(n);return Hr(n,Tn()),r.onExecute(t,n,o),e&&Hs.close(t),tt.some(!0)}}),Hm.config({toggleClass:r.markers.openClass,aria:{mode:"pressed",syncWithExpanded:!0}}),Jv.config({others:{sandbox:function(t){return hp(r,t,{onOpen:d,onClose:d})}}}),_m("typeaheadevents",[ii(function(t){var n=Q;fp(r,u(t),t,i,n,Mv.HighlightFirst).get(Q)}),qr(zp(),function(t,n){var e=Jv.getCoupled(t,"sandbox");gp(r.model,t,n.event().item()),Hr(t,Tn()),r.onItemExecute(t,e,n.event().item(),lm.getValue(t)),Hs.close(e),pp(t)})].concat(r.dismissOnBlur?[qr(zn(),function(t){var n=Jv.getCoupled(t,"sandbox");hf(n.element()).isNone()&&Hs.close(n)})]:[]))];return{uid:r.uid,dom:wp(r),behaviours:Ke({},o,Fs(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),Mp=function(t,n,e){var o=Ep(t,n,e);return Yv.sketch(o)},Hp=function(t,n){return Mp(t,n,[])},Ep=function(t,n,e){return{dom:Vp(e),components:t.toArray().concat([n])}},Vp=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},Tp=function(t,n){return Yv.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},Ap=function(t){return"separator"===t.type},Bp={type:"separator"},Dp=function(t,e){var n=D(t,function(t,n){return x(n)?""===n?t:"|"===n?0r&&i.pop(),wb.setItem(zb,JSON.stringify(i))},state:function(){return i.slice(0)}}}(10),Ob=function(t){var n,e=[];for(n=0;n'}}),u=function(t,n){var e=t.width,o=t.height,r=t.getContext("2d");r.fillStyle=n,r.fillRect(0,0,e,o);var i=r.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,e,o);var u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=u,r.fillRect(0,0,e,o)};return Fl({factory:function(t){var n=Z({x:Z(0),y:Z(0)}),e=Ru([Pl.config({find:tt.some}),gm.config({})]);return Dx.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette")]},model:{mode:"xy",getInitialValue:n},rounded:!1,components:[r,i],onChange:function(t,n,e){Er(t,Ix(),{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),yb(xb()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,yb(o))}},extraApis:{}})},Rx=function(t,n){var e=Dx.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Dx.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return Dx.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:Z({y:Z(0)})},components:[e,o],sliderBehaviours:Ru([gm.config({})]),onChange:function(t,n,e){Er(t,Fx(),{value:e})}})},Nx=[Ds("formBehaviours",[lm])],Px=function(t){return""},jx=function(o,t,n){return{uid:o.uid,dom:o.dom,components:t,behaviours:Fs(o.formBehaviours,[lm.config({store:{mode:"manual",getValue:function(t){var n=Cl(t,o);return nt(n,function(t,n){return t().bind(function(t){var n,e=Pl.getCurrent(t);return n="missing current",e.fold(function(){return dt.error(n)},dt.value)}).map(lm.getValue)})},setValue:function(e,t){$(t,function(n,t){zl(e,o,t).each(function(t){Pl.getCurrent(t).each(function(t){lm.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return zl(t,o,n).bind(Pl.getCurrent)}}}},Ux={getField:zi(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),pl("form",Px(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=V(r,function(t){return cl({name:t,pname:Px(t)})});return Al("form",Nx,i,jx,o)}},Wx=Ye("valid-input"),Gx=Ye("invalid-input"),Xx=Ye("validating-input"),Yx="colorcustom.rgb.",qx=function(m,h,g,v){var p=function(t,n,e,o,r){var i,u,a=m(Yx+"range"),c=[Yv.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),Yv.parts().field({data:r,factory:Lp,inputAttributes:Ke({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[h("textfield")],inputBehaviours:Ru([(i=n,u=t,Qp.config({invalidClass:h("invalid"),notify:{onValidate:function(t){Er(t,Xx,{type:i})},onValid:function(t){Er(t,Wx,{type:i,value:lm.getValue(t)})},onInvalid:function(t){Er(t,Gx,{type:i,value:lm.getValue(t)})}},validator:{validate:function(t){var n=lm.getValue(t),e=u(n)?dt.value(!0):dt.error(m("aria.input.invalid"));return ip.pure(e)},validateOnLoad:!1}})),nb.config({})]),onSetValue:function(t){Qp.isInvalid(t)&&Qp.run(t).get(Q)}})],s="hex"!==n?[Yv.parts()["aria-descriptor"]({text:a})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:c.concat(s)}},b=function(t,n){var e=n.red(),o=n.green(),r=n.blue();lm.setValue(t,{red:e,green:o,blue:r})},y=Zm({dom:{tag:"div",classes:[h("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),x=function(t,n){y.getOpt(t).each(function(t){qi(t.element(),"background-color","#"+n.value())})};return Fl({factory:function(t){var e={red:Z(Ot(tt.some(255))),green:Z(Ot(tt.some(255))),blue:Z(Ot(tt.some(255))),hex:Z(Ot(tt.some("ffffff")))},o=function(t){return e[t]().get()},i=function(t,n){e[t]().set(n)},r=function(t){var n=t.red(),e=t.green(),o=t.blue();i("red",tt.some(n)),i("green",tt.some(e)),i("blue",tt.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),tt.none()):v(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,tt.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return hb(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=cb(t),Ux.getField(n,"hex").each(function(t){gm.isFocused(t)||lm.setValue(n,{hex:e.value()})}),e);x(r,o)})},a=function(t,n){var e=n.event();"hex"===e.type()?function(t,n){g(t);var e=eb(n);i("hex",tt.some(n));var o=pb(e);b(t,o),r(o),Er(t,_x(),{hex:e}),x(t,e)}(t,e.value()):u(t,e.type(),e.value())},c=function(t){return{label:m(Yx+t+".label"),description:m(Yx+t+".description")}},s=c("red"),l=c("green"),f=c("blue"),d=c("hex");return vt(Ux.sketch(function(t){return{dom:{tag:"form",classes:[h("rgb-form")],attributes:{"aria-label":m("aria.color.picker")}},components:[t.field("red",Yv.sketch(p(gb,"red",s.label,s.description,255))),t.field("green",Yv.sketch(p(gb,"green",l.label,l.description,255))),t.field("blue",Yv.sketch(p(gb,"blue",f.label,f.description,255))),t.field("hex",Yv.sketch(p(ib,"hex",d.label,d.description,"ffffff"))),y.asSpec()],formBehaviours:Ru([Qp.config({invalidClass:h("form-invalid")}),_m("rgb-form-events",[qr(Wx,a),qr(Gx,n),qr(Xx,n)])])}}),{apis:{updateHex:function(t,n){var e,o;lm.setValue(t,{hex:n.value()}),e=t,o=pb(n),b(e,o),r(o),x(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},Kx=function(t,n,e){return{hue:Z(t),saturation:Z(n),value:Z(e)}},Jx=function(c,s){return Fl({name:"ColourPicker",configFields:[vr("onValidHex",Q),vr("onInvalidHex",Q),mr("formChangeEvent")],factory:function(t){var a,p,e=qx(c,s,t.onValidHex,t.onInvalidHex),o=Lx(c,s),b={paletteRgba:Z(Ot(xb()))},n=Zm(o.sketch({})),r=Zm(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=pb(e);b.paletteRgba().set(n),o.setRgba(t,n)})},u=function(t,n){r.getOpt(t).each(function(t){e.updateHex(t,n)})},y=function(n,e,t){T(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),Rx(c,s),r.asSpec()],behaviours:Ru([_m("colour-picker-events",[qr(Ix(),(p=[u],function(t,n){var e,o,r,i,u,a,c,s,l,f=n.event().value(),d=b.paletteRgba().get(),m=(c=u=0,o=(e=d).red()/255,r=e.green()/255,i=e.blue()/255,(s=Math.min(o,Math.min(r,i)))===(l=Math.max(o,Math.max(r,i)))?Kx(0,0,100*(c=s)):(u=60*((u=o===s?3:i===s?1:5)-(o===s?r-i:i===s?o-r:i-o)/(l-s)),a=(l-s)/l,c=l,Kx(Math.round(u),Math.round(100*a),Math.round(100*c)))),h=Kx(m.hue(),f.x(),100-f.y()),g=vb(h),v=cb(g);y(t,v,p)})),qr(Fx(),(a=[i,u],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=Kx(360*(100-e/100),100,100),r=vb(o),cb(r));y(t,u,a)}))]),Pl.config({find:function(t){return r.getOpt(t)}}),Xd.config({mode:"acyclic"})])}}})},$x=function(){return Pl.config({find:tt.some})},Qx=function(t){return Pl.config({find:t.getOpt})},Zx=function(t){return Pl.config({find:function(n){return me(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},tw={"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"},nw=function(t){return tw[t]},ew=Bo([vr("preprocess",d),vr("postprocess",d)]),ow=function(t,n,e){return lm.config(vt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},rw=function(t,n,e){return ow(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},iw=function(r,t){var i=Yo("RepresentingConfigs.memento processors",ew,t);return lm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=lm.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);lm.setValue(o,e)}}})},uw=ow,aw=function(t){return rw(t,we,ze)},cw=function(t){return lm.config({store:{mode:"memory",initialValue:t}})},sw=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){T(t,function(t){t(n,e)})}},i=function(t,n){if(!Ph.isDisabled(t)){var e=n.event().raw();a(t,e.dataTransfer.files)}},u=function(t,n){var e=n.event().raw().target.files;a(t,e)},a=function(t,n){var e,o;lm.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),A(q(e),function(t){return o.test(t.name)}))),Er(t,Fv,{name:r.name})},c=Zm({dom:{tag:"input",attributes:{type:"file",multiple:"multiple"},styles:{display:"none"}},behaviours:Ru([_m("input-file-events",[Zr(Ut())])])}),t=r.label.map(function(t){return Tp(t,n)}),s=Yv.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Ru([cw([]),$x(),Ph.config({}),Hm.config({toggleClass:"dragenter",toggleOnExecute:!1}),_m("dropzone-events",[qr("dragenter",o([e,Hm.toggle])),qr("dragleave",o([e,Hm.toggle])),qr("dragover",e),qr("drop",o([e,i])),qr(jt(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},Qm.sketch({dom:{tag:"button",innerHtml:n.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[c.asSpec()],action:function(t){c.get(t).element().dom().click()},buttonBehaviours:Ru([nb.config({})])})]}]}}}});return Mp(t,s,["tox-form__group--stretched"])},lw=Ye("alloy-fake-before-tabstop"),fw=Ye("alloy-fake-after-tabstop"),dw=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:Ru([gm.config({ignore:!0}),nb.config({})])}},mw=function(t,n){Er(t,Rt(),{raw:{which:9,shiftKey:n}})},hw=function(t){return lv(t,["."+lw,"."+fw].join(","),Z(!1))},gw=function(t,n){var e=n.element();ji(e,lw)?mw(t,!0):ji(e,fw)&&mw(t,!1)},vw=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[dw([lw]),t,dw([fw])],behaviours:Ru([Zx(1)])}},pw=!(yn.detect().browser.isIE()||yn.detect().browser.isEdge()),bw=function(t,n){var o,r,e=pw&&t.sandboxed,i=Ke({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts"}:{}),u=(o=e,r=Ot(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Ee(t.element(),"src","data:text/html;charset=utf-8,"+encodeURIComponent(n));else{Ee(t.element(),"src","javascript:''");var e=t.element().dom().contentWindow.document;e.open(),e.write(n),e.close()}r.set(n)}}),a=t.label.map(function(t){return Tp(t,n)}),c=Yv.parts().field({factory:{sketch:function(t){return vw({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:Ru([nb.config({}),gm.config({}),uw(tt.none(),u.getValue,u.setValue)])})}}});return Mp(a,c,["tox-form__group--stretched"])};function yw(t,n){return ww(document.createElement("canvas"),t,n)}function xw(t){return t.getContext("2d")}function ww(t,n,e){return t.width=n,t.height=e,t}var zw={create:yw,clone:function kE(t){var n;return xw(n=yw(t.width,t.height)).drawImage(t,0,0),n},resize:ww,get2dContext:xw,get3dContext:function CE(t){var n=null;try{n=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(e){}return n||(n=null),n}},Sw={getWidth:function OE(t){return t.naturalWidth||t.width},getHeight:function ME(t){return t.naturalHeight||t.height}},kw=window.Promise?window.Promise:function(){var t=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],s(t,o(r,this),o(u,this))},n=t.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){setTimeout(t,1)};function o(t,n){return function(){t.apply(n,arguments)}}var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(o){var r=this;null!==this._state?n(function(){var t=r._state?o.onFulfilled:o.onRejected;if(null!==t){var n;try{n=t(r._value)}catch(e){return void o.reject(e)}o.resolve(n)}else(r._state?o.resolve:o.reject)(r._value)}):this._deferreds.push(o)}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void s(o(n,t),o(r,this),o(u,this))}this._state=!0,this._value=t,a.call(this)}catch(e){u.call(this,e)}}function u(t){this._state=!1,this._value=t,a.call(this)}function a(){for(var t=0,n=this._deferreds.length;tthis.length())return null;for(var e=this.littleEndian?0:-8*(n-1),o=0,r=0;o").css({position:"absolute",top:0,left:0,width:o.width,height:o.height,zIndex:2147483647,opacity:1e-4,cursor:e}).appendTo(d.body),Tz(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(Fz(t),t.button!==u)return a(t);t.deltaX=t.screenX-l,t.deltaY=t.screenY-f,t.preventDefault(),r.drag(t)},a=function(t){Fz(t),Tz(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){Tz(m).off()},Tz(m).on("mousedown touchstart",n)}var Lz,Rz,Nz,Pz=0,jz=function(n){var l=Zm({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),f=Ot(1),d=Ot(tt.none()),m=Ot({x:0,y:0,w:1,h:1}),c=Ot({x:0,y:0,w:1,h:1}),s=function(t,s){h.getOpt(t).each(function(t){var e=f.get(),o=ia(t.element()),r=ca(t.element()),i=s.dom().naturalWidth*e,u=s.dom().naturalHeight*e,a=Math.max(0,o/2-i/2),c=Math.max(0,r/2-u/2),n={left:a.toString()+"px",top:c.toString()+"px",width:i.toString()+"px",height:u.toString()+"px",position:"absolute"};Ki(s,n),l.getOpt(t).each(function(t){Ki(t.element(),n)}),d.get().each(function(t){var n=m.get();t.setRect({x:n.x*e+a,y:n.y*e+c,w:n.w*e,h:n.h*e}),t.setClampRect({x:a,y:c,w:i,h:u}),t.setViewPortRect({x:0,y:0,w:o,h:r})})})},e=function(t,n){var e,a=Gn.fromTag("img");return Ee(a,"src",n),(e=a.dom(),new hh(function(t){var n=function(){e.removeEventListener("load",n),t(e)};e.complete?t(e):e.addEventListener("load",n)})).then(function(){return h.getOpt(t).map(function(t){var n=fu({element:a});$d.replaceAt(t,1,tt.some(n));var e=c.get(),o={x:0,y:0,w:a.dom().naturalWidth,h:a.dom().naturalHeight};c.set(o);var r,u,i=Az.inflate(o,-20,-20);return m.set(i),e.w===o.w&&e.h===o.h||(r=t,u=a,h.getOpt(r).each(function(t){var n=ia(t.element()),e=ca(t.element()),o=u.dom().naturalWidth,r=u.dom().naturalHeight,i=Math.min(n/o,e/r);1<=i?f.set(1):f.set(i)})),s(t,a),a})})},t=Ev.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[l.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:Ru([_m("image-panel-crop-events",[ei(function(t){h.getOpt(t).each(function(t){var n=function z(s,e,l,o,r){var f,u,n,i,a="tox-",c="tox-crid-"+Pz++;function d(t,n){return{x:n.x-t.x,y:n.y-t.y,w:n.w,h:n.h}}function m(t,n,e,o){var r,i,u,a,c;r=n.x,i=n.y,u=n.w,a=n.h,r+=e*t.deltaX,i+=o*t.deltaY,(u+=e*t.deltaW)<20&&(u=20),(a+=o*t.deltaH)<20&&(a=20),c=s=Az.clamp({x:r,y:i,w:u,h:a},l,"move"===t.name),c=d(l,c),f.fire("updateRect",{rect:c}),v(c)}function h(n){function t(t,n){n.h<0&&(n.h=0),n.w<0&&(n.w=0),Tz("#"+c+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}Dz.each(u,function(t){Tz("#"+c+"-"+t.name,o).css({left:n.w*t.xMul+n.x,top:n.h*t.yMul+n.y})}),t("top",{x:e.x,y:e.y,w:e.w,h:n.y-e.y}),t("right",{x:n.x+n.w,y:n.y,w:e.w-n.x-n.w+e.x,h:n.h}),t("bottom",{x:e.x,y:n.y+n.h,w:e.w,h:e.h-n.y-n.h+e.y}),t("left",{x:e.x,y:n.y,w:n.x-e.x,h:n.h}),t("move",n)}function g(t){h(s=t)}function v(t){g(function e(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}}(l,t))}return u=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}],i=["top","right","bottom","left"],function p(){Tz('
').appendTo(o),Dz.each(i,function(t){Tz("#"+c,o).append(''),components:[],behaviours:Ru([Mk.config({channel:NH,initialData:t,updateState:function(t,n){var r=V(n.buttons,function(t){var n,e,o=Zm((e=i,gz(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return tt.some({lookupByName:function(t,n){return e=t,o=n,_(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:uE})])}},cE=function(t){return Qm.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close"),title:t.translate("Close")}},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:''}}],action:function(t){Hr(t,Lv)}})},sE=function(t,n,e){var o=function(t){return[lu(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:Ke({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:Ru([Mk.config({channel:LH,renderComponents:o})])}},lE=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=Pl.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return Ux.getField(o,e).fold(function(){var t=n.getFooter();return Mk.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return tt.some(t)})}return tt.none()},fE=function(c,o){var t=function(t){var n=c.getRoot();n.getSystem().isConnected()&&t(n)},s={getData:function(){var t=c.getRoot(),n=t.getSystem().isConnected()?c.getFormWrapper():t;return lm.getValue(n)},setData:function(a){t(function(t){var n,e,o=s.getData(),r=pt(o,a),i=(n=r,e=c.getRoot(),Mk.getState(e).get().map(function(t){return Xo(Go("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();lm.setValue(u,i)})},disable:function(t){lE(c,t).each(Ph.disable)},enable:function(t){lE(c,t).each(Ph.enable)},focus:function(t){lE(c,t).each(gm.focus)},block:function(n){if(!x(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){Er(t,Pv,{message:n})})},unblock:function(){t(function(t){Hr(t,jv)})},showTab:function(e){t(function(t){var n=c.getBody();Mk.getState(n).get().exists(function(t){return t.isTabPanel()})&&Pl.getCurrent(n).each(function(t){QH.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([IH],n),t.getSystem().broadcastOn([LH],n.internalDialog),t.getSystem().broadcastOn([RH],n.internalDialog),t.getSystem().broadcastOn([NH],n.internalDialog),s.setData(n.initialData)})},close:function(){t(function(t){Hr(t,Iv)})}};return s},dE=function(t,n,e){var o,r,i,u,a,c,s,l,f,d,m,h=(r={title:e.shared.providers.translate(t.internalDialog.title),draggable:!0},i=e.shared.providers,u=YM.parts().title(sE(r,tt.none(),i)),a=YM.parts().draghandle({dom:mg('
')}),c=YM.parts().close(cE(i)),s=[u].concat(r.draggable?[a]:[]).concat([c]),Ev.sketch({dom:mg('
'),components:s})),g=(l={body:t.internalDialog.body},f=e,YM.parts().body(rE(l,f))),v=(d={buttons:t.internalDialog.buttons},m=e.shared.providers,YM.parts().footer(aE(d,m))),p=iE(function(){return x},{onClose:function(){return n.closeWindow()},onBlock:function(e){YM.setBusy(y,function(t,n){return{dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":e.message()},styles:{left:"0px",right:"0px",bottom:"0px",top:"0px",position:"absolute"}},behaviours:n,components:[{dom:mg('
')}]}})},onUnblock:function(){YM.setIdle(y)}}),b="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?"tox-dialog--width-lg":"tox-dialog--width-md":[],y=mu(YM.sketch({lazySink:e.shared.getSink,onEscape:function(t){return Hr(t,Lv),tt.some(!0)},useTabstopAt:function(t){return!hw(t)&&("button"!==Se(t)||"disabled"!==Te(t,"disabled"))},modalBehaviours:Ru([Mk.config({channel:IH,updateState:function(t,n){return tt.some(n)},initialData:t}),gm.config({}),_m("execute-on-form",p.concat([ni(It(),function(t,n){Xd.focusIn(t)})])),cw({})]),eventOrder:(o={},o[Cn()]=["execute-on-form"],o[_n()]=["reflecting","execute-on-form"],o),dom:{tag:"div",classes:["tox-dialog"].concat(b),styles:{position:"relative"}},components:[h,g,v],dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:mg('
'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}})),x=fE({getRoot:function(){return y},getBody:function(){return YM.getBody(y)},getFooter:function(){return YM.getFooter(y)},getFormWrapper:function(){var t=YM.getBody(y);return Pl.getCurrent(t).getOr(t)}},n.redial);return{dialog:y,instanceApi:x}},mE=function(t,n,e){var o,r,i,u,a,c,s,l,f=Ye("dialog-label"),d=Zm((i={title:t.internalDialog.title,draggable:!0},u=f,a=e.shared.providers,Ev.sketch({dom:mg('
'),components:[sE(i,tt.some(u),a),cE(a)],containerBehaviours:Ru([xM.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return pu(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),m=Zm((c={body:t.internalDialog.body},rE(c,e))),h=Zm((s={buttons:t.internalDialog.buttons},l=e.shared.providers,aE(s,l))),g=iE(function(){return p},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),v=mu({dom:{tag:"div",classes:["tox-dialog"],attributes:(o={role:"dialog"},o["aria-labelledby"]=f,o)},eventOrder:(r={},r[kn()]=[Mk.name(),Yu.name()],r[Cn()]=["execute-on-form"],r[_n()]=["reflecting","execute-on-form"],r),behaviours:Ru([Xd.config({mode:"cyclic",onEscape:function(t){return Hr(t,Iv),tt.some(!0)},useTabstopAt:function(t){return!hw(t)&&("button"!==Se(t)||"disabled"!==Te(t,"disabled"))}}),Mk.config({channel:IH,updateState:function(t,n){return tt.some(n)},initialData:t}),_m("execute-on-form",g),cw({})]),components:[d.asSpec(),m.asSpec(),h.asSpec()]}),p=fE({getRoot:function(){return v},getFooter:function(){return h.get(v)},getBody:function(){return m.get(v)},getFormWrapper:function(){var t=m.get(v);return Pl.getCurrent(t).getOr(t)}},n.redial);return{dialog:v,instanceApi:p}},hE=function(t,n){return YM.parts().close(Qm.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:Ru([nb.config({})])}))},gE=function(){return YM.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},vE=function(t,n){return YM.parts().body({dom:{tag:"div",classes:["tox-dialog__body","todo-tox-fit"]},components:[{dom:mg("

"+n.translate(t)+"

")}]})},pE=function(t){return YM.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},bE=function(t,n){return[Ev.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),Ev.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},yE=function(e){return YM.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),tt.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(e.extraClasses)},components:[{dom:{tag:"div",classes:["tox-dialog__header"]},components:[e.partSpecs.title,e.partSpecs.close]},e.partSpecs.body,e.partSpecs.footer],parts:{blocker:{dom:mg('
'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:Ru([_m("basic-dialog-events",[qr(Lv,function(t,n){e.onCancel()}),qr(Nv,function(t,n){e.onSubmit()})])])})},xE=function(c){var u,a,e=(u=c.backstage.shared,{open:function(t,n){var e=function(){YM.hide(r),n()},o=Zm(gz({name:"close-alert",text:"OK",primary:!0,icon:tt.none()},"cancel",u.providers)),r=mu(yE({lazySink:function(){return u.getSink()},partSpecs:{title:gE(),close:hE(function(){e()},u.providers),body:vE(t,u.providers),footer:pE(bE([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:Q,extraClasses:["tox-alert-dialog"]}));YM.show(r);var i=o.get(r);gm.focus(i)}}),o=(a=c.backstage.shared,{open:function(t,n){var e=function(t){YM.hide(i),n(t)},o=Zm(gz({name:"yes",text:"Yes",primary:!0,icon:tt.none()},"submit",a.providers)),r=gz({name:"no",text:"No",primary:!0,icon:tt.none()},"cancel",a.providers),i=mu(yE({lazySink:function(){return a.getSink()},partSpecs:{title:gE(),close:hE(function(){e(!1)},a.providers),body:vE(t,a.providers),footer:pE(bE([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));YM.show(i);var u=o.get(i);gm.focus(u)}}),r=function(t,i){return FH.open(function(t,n,e){var o=n,r=dE({dataValidator:e,initialData:o,internalDialog:t},{redial:FH.redial,closeWindow:function(){YM.hide(r.dialog),i(r.instanceApi)}},c.backstage);return YM.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},i=function(t,u,a){return FH.open(function(t,n,e){var o=Xo(Go("data",e,n)),r=mE({dataValidator:e,initialData:o,internalDialog:t},{redial:FH.redial,closeWindow:function(){Jm.hide(i),a(r.instanceApi)}},c.backstage),i=mu(Jm.sketch({lazySink:c.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:Ru([_m("window-manager-inline-events",[qr(In(),function(t,n){Hr(r.dialog,Lv)})])])}));return Jm.showAt(i,u,hu(r.dialog)),r.instanceApi.setData(o),Xd.focusIn(r.dialog),r.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?i(t,c.backstage.shared.anchors.toolbar(),e):n!==undefined&&"cursor"===n.inline?i(t,c.backstage.shared.anchors.cursor(),e):r(t,e)},alert:function(t,n){e.open(t,function(){n()})},close:function(t){t.close()},confirm:function(t,n){o.open(t,function(t){n(t)})}}};qe.add("silver",function(t){var n=TM(t),e=n.mothership,o=n.uiMothership,r=n.backstage,i=n.renderUI,u=n.getUi;jM(t,r),We(Ye("silver-demo"),e),We(Ye("silver-ui-demo"),o),ov(t,r.shared);var a=xE({backstage:r});return{renderUI:i,getWindowManagerImpl:Z(a),getNotificationManagerImpl:function(){return ah(t,{backstage:r},o)},ui:u()}}),function $E(){}}();