/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.0.15 (2019-09-02) */ !function(v){"use strict";var b=function(){return(b=Object.assign||function(n){for(var e,t=1,r=arguments.length;t "+r.toString()},function(n,e){return"state("+n+")"})}).join("\n")+"}"},toDsl:function(){return qt.objOf(kn(c,function(n){return n.fold(function(n,e,t,r){return Yt.field(n,t,r)},function(n,e){return Yt.state(n)})}))}}},ir=function(t,i){var u=function(n,e){return(o=tr(t),{extract:function(t,r,n){var e=kn(n,function(n,e){return o.extract(t.concat(["["+e+"]"]),r,n)});return Xt(e)},toString:function(){return"array("+o.toString()+")"},toDsl:function(){return qt.arrOf(o)}}).extract(n,y,e);var o};return{extract:function(t,r,o){var n=E(o),e=u(t,n);return zt(e,function(n){var e=kn(n,function(n){return Qt.field(n,n,vt(),i)});return or(e).extract(t,r,o)})},toString:function(){return"setOf("+i.toString()+")"},toDsl:function(){return qt.setOf(t,i)}}},ur=h(tr(_t)),cr=Qt.state,ar=Qt.field,fr=function(t,e,r,o,i){return Et(o,i).fold(function(){return n=o,e=i,Jt(t,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+Kt(n)});var n,e},function(n){return n.extract(t.concat(["branch: "+i]),e,r)})},sr=function(o,i){return{extract:function(e,t,r){return Et(r,o).fold(function(){return n=o,Jt(e,function(){return'Choice schema did not contain choice key: "'+n+'"'});var n},function(n){return fr(e,t,r,i,n)})},toString:function(){return"chooseOn("+o+"). Possible values: "+E(i)},toDsl:function(){return qt.choiceOf(o,i)}}},lr=tr(_t),dr=function(e){return tr(function(n){return e(n).fold(Pt,_t)})},mr=function(e,n){return ir(function(n){return Nt(e(n))},n)},gr=function(n,e,t){return jt((r=n,o=y,i=t,u=e.extract([r],o,i),Ut(u,function(n){return{input:i,errors:n}})));var r,o,i,u},pr=function(n){return n.fold(function(n){throw new Error(hr(n))},y)},vr=function(n,e,t){return pr(gr(n,e,t))},hr=function(n){return"Errors: \n"+(e=n.errors,t=10 ")+")\n"+n.getErrorInfo()}))+"\n\nInput object: "+Kt(n.input);var e,t},yr=function(n,e){return sr(n,M(e,or))},br=h(lr),xr=(Rt=bn,At="function",tr(function(n){var e=typeof n;return Rt(n)?_t(n):Pt("Expected type: "+At+" but got: "+e)})),wr=function(n){return ar(n,n,vt(),ur())},Sr=function(n,e){return ar(n,n,vt(),e)},Tr=function(n,e){return ar(n,n,vt(),or(e))},Or=function(n){return ar(n,n,ht(),ur())},kr=function(n,e){return ar(n,n,ht(),e)},Er=function(n,e){return kr(n,or(e))},Cr=function(n,e){return kr(n,rr(e))},Dr=function(n,e){return ar(n,n,pt(e),ur())},Mr=function(n,e,t){return ar(n,n,pt(e),t)},Ir=function(n,e){return cr(n,e)},Rr=function(n,e){return ze(n.element(),e.event().target())},Ar=function(n){if(!It(n,"can")&&!It(n,"abort")&&!It(n,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(n,null,2)+" does not have can, abort, or run!");return vr("Extracting event.handler",rr([Dr("can",h(!0)),Dr("abort",h(!1)),Dr("run",x)]),n)},Fr=function(t){var e,r,o,i,n=(e=t,r=function(n){return n.can},function(){for(var t=[],n=0;n"}),br()),ja=Ir("schema",function(){return[Or("preprocess")]}),_a=Dr("defaults",h({})),Ha=Dr("overrides",h({})),Pa=or([Fa,Ba,Va,Na,_a,Ha]),za=or([Fa,Ba,Va,Na,_a,Ha]),La=or([Fa,ja,Va,wr("unit"),Na,_a,Ha]),Ga=function(n){var e=function(n){return n.name};return n.fold(e,e,e,e)},Ua=function(t,r){return function(n){var e=vr("Converting part type",r,n);return t(e)}},$a=Ua(Aa.required,Pa),Wa=Ua(Aa.optional,za),Xa=Ua(Aa.group,La),qa=h("entirety"),Ya=function(n,e,t,r){return dt(e.defaults(n,t,r),t,{uid:n.partUids[e.name]},e.overrides(n,t,r))},Ka=function(o,n){var i={};return En(n,function(n){var e;(e=n,e.fold(k.some,k.none,k.some,k.some)).each(function(t){var r=Ja(o,t.pname);i[t.name]=function(n){var e=vr("Part: "+t.name+" in "+o,or(t.schema),n);return b({},r,{config:n,validated:e})}})}),i},Ja=function(n,e){return{uiType:Ma(),owner:n,name:e}},Qa=function(n,e,t){return r=e,i={},o={},En(t,function(n){n.fold(function(r){i[r.pname]=Ca(!0,function(n,e,t){return r.factory.sketch(Ya(n,r,e,t))})},function(n){var e=r.parts[n.name];o[n.name]=h(n.factory.sketch(Ya(r,n,e[qa()]),e))},function(r){i[r.pname]=Ca(!1,function(n,e,t){return r.factory.sketch(Ya(n,r,e,t))})},function(o){i[o.pname]=Da(!0,function(e,n,t){var r=e[o.name];return kn(r,function(n){return o.factory.sketch(dt(o.defaults(e,n,t),n,o.overrides(e,n)))})})})}),{internals:h(i),externals:h(o)};var r,i,o},Za=function(n,e,t){return Ea(k.some(n),e,e.components,t)},nf=function(n,e,t){var r=e.partUids[t];return n.getSystem().getByUid(r).toOption()},ef=function(n,e,t){return nf(n,e,t).getOrDie("Could not find part: "+t)},tf=function(e,n){var t=kn(n,Ga);return Dt(kn(t,function(n){return{key:n,value:e+"-"+n}}))},rf=function(e){return ar("partUids","partUids",bt(function(n){return tf(n.uid,e)}),br())},of=Ra("alloy-premade"),uf=function(n){return Ct(of,n)},cf=function(r){return n=function(n){for(var e=[],t=1;t')},function(n){return kf(''+n+"")})},Mf=function(n,e,t,r){return Sf.sketch({dom:Df(n,r),action:e,buttonBehaviours:dt(ao([Tf.config({})]),t)})},If={forToolbar:Mf,forToolbarCommand:function(n,e){return Mf(e,function(){n.execCommand(e)},{},n)},forToolbarStateAction:function(n,e,t,r){var o=Cf(t);return Mf(e,r,o,n)},forToolbarStateCommand:function(n,e){var t=Cf(e);return Mf(e,function(){n.execCommand(e)},t,n)},getToolbarIconButton:Df},Rf=Yn.detect().deviceType.isTouch(),Af=Wa({schema:[wr("dom")],name:"label"}),Ff=function(n){return Wa({name:n+"-edge",overrides:function(r){return r.model.manager.edgeActions[n].fold(function(){return{}},function(t){var n=Lr([$r(F(),t,[r])]),e=Lr([$r(N(),t,[r]),$r(j(),function(n,e){e.mouseIsDown.get()&&t(n,e)},[r])]);return{events:Rf?n:e}})}})},Bf=Ff("top-left"),Vf=Ff("top"),Nf=Ff("top-right"),jf=Ff("right"),_f=Ff("bottom-right"),Hf=Ff("bottom"),Pf=Ff("bottom-left"),zf=[Af,Ff("left"),jf,Vf,Hf,Bf,Nf,Pf,_f,$a({name:"thumb",defaults:h({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:Lr([Xr(F(),n,"spectrum"),Xr(B(),n,"spectrum"),Xr(V(),n,"spectrum"),Xr(N(),n,"spectrum"),Xr(j(),n,"spectrum"),Xr(_(),n,"spectrum")])}}}),$a({schema:[Ir("mouseIsDown",function(){return Ao(!1)})],name:"spectrum",overrides:function(t){var r=t.model.manager,o=function(e,n){return r.getValueFromEvent(n).map(function(n){return r.setValueFrom(e,t,n)})},n=Lr([Ur(F(),o),Ur(B(),o)]),e=Lr([Ur(N(),o),Ur(j(),function(n,e){t.mouseIsDown.get()&&o(n,e)})]);return{behaviours:ao(Rf?[]:[va.config({mode:"special",onLeft:function(n){return r.onLeft(n,t)},onRight:function(n){return r.onRight(n,t)},onUp:function(n){return r.onUp(n,t)},onDown:function(n){return r.onDown(n,t)}}),ji.config({})]),events:Rf?n:e}}})],Lf=function(n,e,t){e.store.manager.onLoad(n,e,t)},Gf=function(n,e,t){e.store.manager.onUnload(n,e,t)},Uf=/* */Object.freeze({onLoad:Lf,onUnload:Gf,setValue:function(n,e,t,r){e.store.manager.setValue(n,e,t,r)},getValue:function(n,e,t){return e.store.manager.getValue(n,e,t)},getState:function(n,e,t){return t}}),$f=/* */Object.freeze({events:function(t,r){var n=t.resetOnDom?[Yr(function(n,e){Lf(n,t,r)}),Kr(function(n,e){Gf(n,t,r)})]:[to(t,r,Lf)];return Lr(n)}}),Wf=function(){var n=Ao(null);return co({set:n.set,get:n.get,isNotSet:function(){return null===n.get()},clear:function(){n.set(null)},readState:function(){return{mode:"memory",value:n.get()}}})},Xf=function(){var i=Ao({}),u=Ao({});return co({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(n){return Et(i.get(),n).orThunk(function(){return Et(u.get(),n)})},update:function(n){var e=i.get(),t=u.get(),r={},o={};En(n,function(e){r[e.value]=e,Et(e,"meta").each(function(n){Et(n,"text").each(function(n){o[n]=e})})}),i.set(b({},e,r)),u.set(b({},t,o))},clear:function(){i.set({}),u.set({})}})},qf=/* */Object.freeze({memory:Wf,dataset:Xf,manual:function(){return co({readState:function(){}})},init:function(n){return n.store.manager.state(n)}}),Yf=function(n,e,t,r){var o=e.store;t.update([r]),o.setValue(n,r),e.onSetValue(n,r)},Kf=[Or("initialValue"),wr("getFallbackEntry"),wr("getDataKey"),wr("setValue"),li("manager",{setValue:Yf,getValue:function(n,e,t){var r=e.store,o=r.getDataKey(n);return t.lookup(o).fold(function(){return r.getFallbackEntry(o)},function(n){return n})},onLoad:function(e,t,r){t.store.initialValue.each(function(n){Yf(e,t,r,n)})},onUnload:function(n,e,t){t.clear()},state:Xf})],Jf=[wr("getValue"),Dr("setValue",x),Or("initialValue"),li("manager",{setValue:function(n,e,t,r){e.store.setValue(n,r),e.onSetValue(n,r)},getValue:function(n,e,t){return e.store.getValue(n)},onLoad:function(e,t,n){t.store.initialValue.each(function(n){t.store.setValue(e,n)})},onUnload:x,state:uo.init})],Qf=[Or("initialValue"),li("manager",{setValue:function(n,e,t,r){t.set(r),e.onSetValue(n,r)},getValue:function(n,e,t){return t.get()},onLoad:function(n,e,t){e.store.initialValue.each(function(n){t.isNotSet()&&t.set(n)})},onUnload:function(n,e,t){t.clear()},state:Wf})],Zf=[Mr("store",{mode:"memory"},yr("mode",{memory:Qf,manual:Jf,dataset:Kf})),ci("onSetValue"),Dr("resetOnDom",!1)],ns=so({fields:Zf,name:"representing",active:$f,apis:Uf,extra:{setValueFrom:function(n,e){var t=ns.getValue(e);ns.setValue(n,t)}},state:qf}),es=Xi("width",function(n){return n.dom().offsetWidth}),ts=function(n,e){es.set(n,e)},rs=function(n){return es.get(n)},os=function(t,r){return{left:h(t),top:h(r),translate:function(n,e){return os(t+n,r+e)}}},is=os,us=Yn.detect().deviceType.isTouch(),cs=h("slider.change.value"),as=function(n){var e=n.event().raw();if(us){var t=e;return t.touches!==undefined&&1===t.touches.length?k.some(t.touches[0]).map(function(n){return is(n.clientX,n.clientY)}):k.none()}var r=e;return r.clientX!==undefined?k.some(r).map(function(n){return is(n.clientX,n.clientY)}):k.none()},fs=function(n){return n.model.minX},ss=function(n){return n.model.minY},ls=function(n){return n.model.minX-1},ds=function(n){return n.model.minY-1},ms=function(n){return n.model.maxX},gs=function(n){return n.model.maxY},ps=function(n){return n.model.maxX+1},vs=function(n){return n.model.maxY+1},hs=function(n,e,t){return e(n)-t(n)},ys=function(n){return hs(n,ms,fs)},bs=function(n){return hs(n,gs,ss)},xs=function(n){return ys(n)/2},ws=function(n){return bs(n)/2},Ss=function(n){return n.stepSize},Ts=function(n){return n.snapToGrid},Os=function(n){return n.snapStart},ks=function(n){return n.rounded},Es=function(n,e){return n[e+"-edge"]!==undefined},Cs=function(n){return Es(n,"left")},Ds=function(n){return Es(n,"right")},Ms=function(n){return Es(n,"top")},Is=function(n){return Es(n,"bottom")},Rs=function(n){return n.model.value.get()},As=function(n){return{x:h(n)}},Fs=function(n){return{y:h(n)}},Bs=function(n,e){return{x:h(n),y:h(e)}},Vs=function(n,e){me(n,cs(),{value:e})},Ns=function(n,e,t,r){return n'),components:[Fl.parts()["left-edge"](Ef('
')),Fl.parts().spectrum({dom:kf('
'),components:[Ef('
')],behaviours:ao([Ci.config({toggleClass:Ai.resolve("thumb-active")})])}),Fl.parts()["right-edge"](Ef('
')),Fl.parts().thumb({dom:kf('
'),behaviours:ao([Ci.config({toggleClass:Ai.resolve("thumb-active")})])})],onChange:function(n,e,t){var r=i(t.x());Pi(e.element(),"background-color",r),o.onChange(n,e,r)},onDragStart:function(n,e){Ci.on(e)},onDragEnd:function(n,e){Ci.off(e)},onInit:function(n,e,t,r){var o=i(r.x());Pi(e.element(),"background-color",o)},stepSize:10,model:{mode:"x",minX:0,maxX:360,getInitialValue:function(){return{x:function(){return o.getInitialValue()}}}},sliderBehaviours:ao([Mi(Fl.refresh)])}))];var o,i},Nl=function(n,r){var e={onChange:function(n,e,t){r.undoManager.transact(function(){r.formatter.apply("forecolor",{value:t}),r.nodeChanged()})},getInitialValue:function(){return-1}};return Bl(n,"color-levels",function(){return Vl(e)},r)},jl=rr([wr("getInitialValue"),wr("onChange"),wr("category"),wr("sizes")]),_l=function(n){var i=vr("SizeSlider",jl,n);return Fl.sketch({dom:{tag:"div",classes:[Ai.resolve("slider-"+i.category+"-size-container"),Ai.resolve("slider"),Ai.resolve("slider-size-container")]},onChange:function(n,e,t){var r,o=t.x();0<=(r=o)&&r'),components:[Ef('
')]}),Fl.parts().thumb({dom:kf('
'),behaviours:ao([Ci.config({toggleClass:Ai.resolve("thumb-active")})])})]})},Hl=["9px","10px","11px","12px","14px","16px","18px","20px","24px","32px","36px"],Pl=function(n){var e,t,r=n.selection.getStart(),o=ye.fromDom(r),i=ye.fromDom(n.getBody()),u=(e=function(n){return ze(i,n)},(Oe(t=o)?k.some(t):Ge(t).filter(Oe)).map(function(n){return Hr(n,function(n){return Ui(n,"font-size").isSome()},e).bind(function(n){return Ui(n,"font-size")}).getOrThunk(function(){return Li(n,"font-size")})}).getOr(""));return In(Hl,function(n){return u===n}).getOr("medium")},zl={candidates:h(Hl),get:function(n){var e,t=Pl(n);return(e=t,Rn(Hl,function(n){return n===e})).getOr(2)},apply:function(r,n){var e;(e=n,k.from(Hl[e])).each(function(n){var e,t;t=n,Pl(e=r)!==t&&e.execCommand("fontSize",!1,t)})}},Ll=zl.candidates(),Gl=function(n){return[Ef(''),(e=n,_l({onChange:e.onChange,sizes:Ll,category:"font",getInitialValue:e.getInitialValue})),Ef('')];var e},Ul=function(n){var e=function t(n){return n.uid!==undefined}(n)&&It(n,"uid")?n.uid:gf("memento");return{get:function(n){return n.getSystem().getByUid(e).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(e).fold(k.none,k.some)},asSpec:function(){return b({},n,{uid:e})}}},$l=window.Promise?window.Promise:function(){var i=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=[],s(n,r(o,this),r(c,this))},n=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(n){v.setTimeout(n,1)};function r(n,e){return function(){return n.apply(e,arguments)}}var t=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)};function u(r){var o=this;null!==this._state?n(function(){var n=o._state?r.onFulfilled:r.onRejected;if(null!==n){var e;try{e=n(o._value)}catch(t){return void r.reject(t)}r.resolve(e)}else(o._state?r.resolve:r.reject)(o._value)}):this._deferreds.push(r)}function o(n){try{if(n===this)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void s(r(e,n),r(o,this),r(c,this))}this._state=!0,this._value=n,a.call(this)}catch(t){c.call(this,t)}}function c(n){this._state=!1,this._value=n,a.call(this)}function a(){for(var n=0,e=this._deferreds;n'),action:function(n){var e=t.get(n);ns.setValue(e,"")}}));return{name:n,spec:sd.sketch({dom:kf('
'),components:[t.asSpec(),r.asSpec()],containerBehaviours:ao([Ci.config({toggleClass:Ai.resolve("input-container-empty")}),fd.config({find:function(n){return k.some(t.get(n))}}),ud("input-clearing",[Ur(L(),function(n){var e=t.get(n);(0"},_d=function(o,n,e){return{uid:o.uid,dom:o.dom,components:n,behaviours:ba(o.formBehaviours,[ns.config({store:{mode:"manual",getValue:function(n){var e,t,r=(e=o,t=n.getSystem(),M(e.partUids,function(n,e){return h(t.getByUid(n))}));return M(r,function(n,e){return n().bind(function(n){var e,t=fd.getCurrent(n);return e="missing current",t.fold(function(){return at.error(e)},at.value)}).map(ns.getValue)})},setValue:function(t,n){D(n,function(e,n){nf(t,o,n).each(function(n){fd.getCurrent(n).each(function(n){ns.setValue(n,e)})})})}}})]),apis:{getField:function(n,e){return nf(n,o,e).bind(fd.getCurrent)}}}},Hd=(cf(function(n,e,t){return n.getField(e,t)}),function(n){var i,e=(i=[],{field:function(n,e){return i.push(n),t="form",r=jd(n),o=e,{uiType:Ma(),owner:t,name:r,config:o,validated:{}};var t,r,o},record:function(){return i}}),t=n(e),r=e.record(),o=kn(r,function(n){return $a({name:n,pname:jd(n)})});return vf("form",Nd,o,_d,t)}),Pd=function(){var e=Ao(k.none()),t=function(){e.get().each(function(n){n.destroy()})};return{clear:function(){t(),e.set(k.none())},isSet:function(){return e.get().isSome()},set:function(n){t(),e.set(k.some(n))},run:function(n){e.get().each(n)}}},zd=function(){var e=Ao(k.none());return{clear:function(){e.set(k.none())},set:function(n){e.set(k.some(n))},isSet:function(){return e.get().isSome()},on:function(n){e.get().each(n)}}},Ld=function(n){return{xValue:n,points:[]}},Gd=function(n,e){if(e===n.xValue)return n;var t=0'),action:function(n){me(n,r,{direction:e})},buttonBehaviours:ao([Vd.config({disableClass:Ai.resolve("toolbar-navigation-disabled"),disabled:!t})])})},i=function(n,o){var i=nu(n.element(),"."+Ai.resolve("serialised-dialog-screen"));ru(n.element(),"."+Ai.resolve("serialised-dialog-chain")).each(function(r){0<=u.state.currentScreen.get()+o&&u.state.currentScreen.get()+o'),components:[sd.sketch({dom:kf('
'),components:kn(u.fields,function(n,e){return e<=u.maxFieldIndex?sd.sketch({dom:kf('
'),components:[o(-1,"previous",0'),behaviours:ao([Cu.config({highlightClass:Ai.resolve("dot-active"),itemClass:Ai.resolve("dot-item")})]),components:Vn(u.fields,function(n,e){return e<=u.maxFieldIndex?[Ef('
')]:[]})});return{dom:kf('
'),components:[a.asSpec(),f.asSpec()],behaviours:ao([va.config({mode:"special",focusIn:function(n){var e=a.get(n);va.focusIn(e)}}),ud("serializer-wrapper-events",[Ur(F(),function(n,e){var t=e.event();u.state.dialogSwipeState.set(Ld(t.raw().touches[0].clientX))}),Ur(B(),function(n,e){var t=e.event();u.state.dialogSwipeState.on(function(n){e.event().prevent(),u.state.dialogSwipeState.set(Gd(n,t.raw().touches[0].clientX))})}),Ur(V(),function(r){u.state.dialogSwipeState.on(function(n){var e=a.get(r),t=-1*Ud(n);i(e,t)})})])])}},Wd=X(function(t,r){return[{label:"the link group",items:[$d({fields:[wd("url","Type or paste URL"),wd("text","Link text"),wd("title","Link title"),wd("target","Link target"),(n="link",{name:n,spec:ld.sketch({dom:{tag:"span",styles:{display:"none"}},getInitialValue:function(){return k.none()}})})],maxFieldIndex:["url","text","title","target"].length-1,getInitialValue:function(){return k.some(td.getInfo(r))},onExecute:function(n){var e=ns.getValue(n);td.applyInfo(r,e),t.restoreToolbar(),r.focus()}})]}];var n}),Xd=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],qd=Lr([(Xl=Jn(),ql=function(n,e){var t,r,o=e.event().originator(),i=e.event().target();return r=i,!(ze(t=o,n.element())&&!ze(t,r))||(v.console.warn(Jn()+" did not get interpreted by the desired target. \nOriginator: "+$o(o)+"\nTarget: "+$o(i)+"\nCheck the "+Jn()+" event handlers"),!1)},{key:Xl,value:Ar({can:ql})})]),Yd=/* */Object.freeze({events:qd}),Kd=y,Jd=function(e){var n=function(n){return function(){throw new Error("The component must be in a context to send: "+n+"\n"+$o(e().element())+" is not in context.")}};return{debugInfo:h("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),build:n("build"),addToWorld:n("addToWorld"),removeFromWorld:n("removeFromWorld"),addToGui:n("addToGui"),removeFromGui:n("removeFromGui"),getByUid:n("getByUid"),getByDom:n("getByDom"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),isConnected:h(!1)}},Qd=Jd(),Zd=function(n,o){var i={};return D(n,function(n,r){D(n,function(n,e){var t=kt(e,[])(i);i[e]=t.concat([o(r,n)])})}),i},nm=function(n,e){return t=l.apply(undefined,[n.handler].concat(e)),r=n.purpose(),{cHandler:t,purpose:h(r)};var t,r},em=function(n){return n.cHandler},tm=function(n,e){return{name:h(n),handler:h(e)}},rm=function(n,e,t){var r,o,i=b({},t,(r=n,o={},En(e,function(n){o[n.name()]=n.handlers(r)}),o));return Zd(i,tm)},om=function(n){var e,i=bn(e=n)?{can:h(!0),abort:h(!1),run:e}:e;return function(n,e){for(var t=[],r=2;r "):r[0].name();return Ct(o,{handler:e,purpose:h(t)})})});return Mt(e,{})},cm=function(n){return gr("custom.definition",or([ar("dom","dom",vt(),or([wr("tag"),Dr("styles",{}),Dr("classes",[]),Dr("attributes",{}),Or("value"),Or("innerHtml")])),wr("components"),wr("uid"),Dr("events",{}),Dr("apis",{}),ar("eventOrder","eventOrder",(e={"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"]},gt.mergeWithThunk(h(e))),br()),Or("domModification")]),n);var e},am=function(e,n){En(n,function(n){Oo(e,n)})},fm=function(e,n){En(n,function(n){Eo(e,n)})},sm=function(n,e){return t=n,o=kn(r=e,function(n){return Er(n.name(),[wr("config"),Dr("state",uo)])}),i=gr("component.behaviours",or(o),t.behaviours).fold(function(n){throw new Error(hr(n)+"\nComplete spec:\n"+JSON.stringify(t,null,2))},function(n){return n}),{list:r,data:M(i,function(n){var e=n.map(function(n){return{config:n.config,state:n.state.init(n.config)}});return function(){return e}})};var t,r,o,i},lm=function(n){var e,t,r,o=(e=n,t=kt("behaviours",{})(e),r=Cn(E(t),function(n){return t[n]!==undefined}),kn(r,function(n){return t[n].me}));return sm(n,o)},dm=function(n,e,t){var r,o,i,u=b({},(r=n).dom,{uid:r.uid,domChildren:kn(r.components,function(n){return n.element()})}),c=n.domModification.fold(function(){return eo({})},eo),a={"alloy.base.modification":c},f=0");r[t[0]]=Ct(t[1],n),r[t[1]]=Ct(t[0],n)}),r},createBistate:function(n,e,t){return Dt([{key:n,value:Ct(e,t)},{key:e,value:Ct(n,t)}])},createTristate:function(n,e,t,r){return Dt([{key:n,value:Dt([{key:e,value:r},{key:t,value:r}])},{key:e,value:Dt([{key:n,value:r},{key:t,value:r}])},{key:t,value:Dt([{key:n,value:r},{key:e,value:r}])}])}}}),eg=Ai.resolve("scrollable"),tg={register:function(n){Oo(n,eg)},deregister:function(n){Eo(n,eg)},scrollable:h(eg)},rg=function(n){return Et(n,"format").getOr(n.title)},og=function(n,e,t,r,o){return{data:{value:n,text:e},type:"item",dom:{tag:"div",classes:o?[Ai.resolve("styles-item-is-menu")]:[]},toggling:{toggleOnExecute:!1,toggleClass:Ai.resolve("format-matches"),selected:t},itemBehaviours:ao(o?[]:[Di(n,function(n,e){(e?Ci.on:Ci.off)(n)})]),components:[{dom:{tag:"div",attributes:{style:r},innerHtml:e}}]}},ig=function(n,e,t,r){return{value:n,dom:{tag:"div"},components:[Sf.sketch({dom:{tag:"div",classes:[Ai.resolve("styles-collapser")]},components:r?[{dom:{tag:"span",classes:[Ai.resolve("styles-collapse-icon")]}},vm(n)]:[vm(n)],action:function(n){if(r){var e=t().get(n);$m.collapseMenu(e)}}}),{dom:{tag:"div",classes:[Ai.resolve("styles-menu-items-container")]},components:[Vm.parts().items({})],behaviours:ao([ud("adhoc-scrollable-menu",[Yr(function(n,e){Pi(n.element(),"overflow-y","auto"),Pi(n.element(),"-webkit-overflow-scrolling","touch"),tg.register(n.element())}),Kr(function(n){$i(n.element(),"overflow-y"),$i(n.element(),"-webkit-overflow-scrolling"),tg.deregister(n.element())})])])}],items:e,menuBehaviours:ao([ng.config({initialState:"after",routes:ng.createTristate("before","current","after",{transition:{property:"transform",transitionClass:"transitioning"}})})])}},ug=function(r){var o,i,n,e,t,u=(o=r.formats,i=function(){return c},n=ig("Styles",[].concat(kn(o.items,function(n){return og(rg(n),n.title,n.isSelected(),n.getPreview(),It(o.expansions,rg(n)))})),i,!1),e=M(o.menus,function(n,e){var t=kn(n,function(n){return og(rg(n),n.title,n.isSelected!==undefined&&n.isSelected(),n.getPreview!==undefined?n.getPreview():"",It(o.expansions,rg(n)))});return ig(e,t,i,!0)}),t=dt(e,Ct("styles",n)),{tmenu:$m.tieredData("styles",t,o.expansions)}),c=Ul($m.sketch({dom:{tag:"div",classes:[Ai.resolve("styles-menu")]},components:[],fakeFocus:!0,stayInDom:!0,onExecute:function(n,e){var t=ns.getValue(e);return r.handle(e,t.value),k.none()},onEscape:function(){return k.none()},onOpenMenu:function(n,e){var t=rs(n.element());ts(e.element(),t),ng.jumpTo(e,"current")},onOpenSubmenu:function(n,e,t){var r=rs(n.element()),o=tu(e.element(),'[role="menu"]').getOrDie("hacky"),i=n.getSystem().getByDom(o).getOrDie();ts(t.element(),r),ng.progressTo(i,"before"),ng.jumpTo(t,"after"),ng.progressTo(t,"current")},onCollapseMenu:function(n,e,t){var r=tu(e.element(),'[role="menu"]').getOrDie("hacky"),o=n.getSystem().getByDom(r).getOrDie();ng.progressTo(o,"after"),ng.progressTo(t,"current")},navigateOnHover:!1,highlightImmediately:!0,data:u.tmenu,markers:{backgroundMenu:Ai.resolve("styles-background-menu"),menu:Ai.resolve("styles-menu"),selectedMenu:Ai.resolve("styles-selected-menu"),item:Ai.resolve("styles-item"),selectedItem:Ai.resolve("styles-selected-item")}}));return c.asSpec()},cg=function(n){return It(n,"items")?(t=dt(Tt(e=n,["items"]),{menu:!0}),r=ag(e.items),{item:t,menus:dt(r.menus,Ct(e.title,r.items)),expansions:dt(r.expansions,Ct(e.title,e.title))}):{item:n,menus:{},expansions:{}};var e,t,r},ag=function(n){return Dn(n,function(n,e){var t=cg(e);return{menus:dt(n.menus,t.menus),items:[t.item].concat(n.items),expansions:dt(n.expansions,t.expansions)}},{menus:{},expansions:{},items:[]})},fg={expand:ag},sg=function(u,n){var c=function(n){return function(){return u.formatter.match(n)}},a=function(n){return function(){return u.formatter.getCssText(n)}},e=Et(n,"style_formats").getOr(Xd),f=function(n){return kn(n,function(n){if(It(n,"items")){var e=f(n.items);return dt(dt(n,{isSelected:h(!1),getPreview:h("")}),{items:e})}return It(n,"format")?dt(i=n,{isSelected:c(i.format),getPreview:a(i.format)}):(r=Ra((t=n).title),o=dt(t,{format:r,isSelected:c(r),getPreview:a(r)}),u.formatter.register(r,o),o);var t,r,o,i})};return f(e)},lg=function(t,n,r){var e,o,i,u=(e=t,i=(o=function(n){return Vn(n,function(n){return n.items===undefined?!It(n,"format")||e.formatter.canApply(n.format)?[n]:[]:0e.innerHeight||n.bottom()>e.innerHeight?n.bottom()-e.innerHeight+50:0;0!==t&&e.scrollTo(e.pageXOffset,e.pageYOffset+t)})})].concat(!0===Ag?[]:[Sg(ye.fromDom(r.win()),"blur",function(){t.getByDom(e).each(Ci.off)}),Sg(i,"select",n),Sg(r.doc(),"selectionchange",n)]);return{destroy:function(){En(c,function(n){n.unbind()})}}},Bg=function(n,e){var t=parseInt(ho(n,e),10);return isNaN(t)?0:t};var Vg,Ng=function Qh(t,r){var e=function(n){return t(n)?k.from(n.dom().nodeValue):k.none()};return{get:function(n){if(!t(n))throw new Error("Can only get "+r+" value of a "+r+" node");return e(n).getOr("")},getOption:e,set:function(n,e){if(!t(n))throw new Error("Can only set raw "+r+" value of a "+r+" node");n.dom().nodeValue=e}}}(ke,"text"),jg=function(n){return Ng.getOption(n)},_g=["img","br"],Hg=function(n){return jg(n).filter(function(n){return 0!==n.trim().length||-1=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom},Qg=function(t,r,n,e,o){var i,u=function(n){var e=t.dom().createRange();return e.setStart(r.dom(),n),e.collapse(!0),e},c=(i=r,Ng.get(i)).length,a=function(n,e,t,r,o){if(0===o)return 0;if(e===r)return o-1;for(var i=r,u=1;ue.innerHeight||t.bottom()>e.innerHeight?Math.min(r,t.bottom()-e.innerHeight+50):0);0!==o&&u.scrollTo(u.pageXOffset,u.pageYOffset+o)})}),wp(e,n.innerHeight)});wp(e,n.innerHeight);return{toEditing:function(){bp(u)},destroy:function(){t.unbind()}}},kp=function(n){return k.some(ye.fromDom(n.dom().contentWindow.document.body))},Ep=function(n){return k.some(ye.fromDom(n.dom().contentWindow.document))},Cp=function(n){return k.from(n.dom().contentWindow)},Dp=function(n){return Cp(n).bind(mp)},Mp=function(n){return n.getFrame()},Ip=function(n,t){return function(e){return e[n].getOrThunk(function(){var n=Mp(e);return function(){return t(n)}})()}},Rp=function(n,e,t,r){return n[t].getOrThunk(function(){return function(n){return Sg(e,r,n)}})},Ap=function(n){return{left:h(n.left),top:h(n.top),right:h(n.right),bottom:h(n.bottom),width:h(n.width),height:h(n.height)}},Fp={getBody:Ip("getBody",kp),getDoc:Ip("getDoc",Ep),getWin:Ip("getWin",Cp),getSelection:Ip("getSelection",Dp),getFrame:Mp,getActiveApi:function(c){var a=Mp(c);return kp(a).bind(function(u){return Ep(a).bind(function(i){return Cp(a).map(function(o){var n=ye.fromDom(i.dom().documentElement),e=c.getCursorBox.getOrThunk(function(){return function(){return(n=o,mp(n).map(function(n){return Ug.exact(n.start(),n.soffset(),n.finish(),n.foffset())})).bind(function(n){return gp(o,n).orThunk(function(){return mp(o).filter(function(n){return ze(n.start(),n.finish())&&n.soffset()===n.foffset()}).bind(function(n){var e=n.start().dom().getBoundingClientRect();return 0