(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["CommodityAdd~list~role"],{"030f":function(t,e,n){(function(t){(function(){"use strict";var e=function(t){var e=typeof t;return null===t?"null":"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e},n=function(t){return function(n){return e(n)===t}},r=function(t){return function(e){return typeof e===t}},o=function(t){return function(e){return t===e}},i=n("string"),u=n("object"),a=n("array"),c=o(null),s=r("boolean"),l=o(void 0),f=function(t){return null===t||void 0===t},d=function(t){return!f(t)},m=r("function"),g=r("number"),h=function(t,e){if(a(t)){for(var n=0,r=t.length;n-1},j=function(t,e){for(var n=0,r=t.length;n=0;n--){var r=t[n];e(r,n)}},X=function(t,e){for(var n=[],r=[],o=0,i=t.length;o=0&&e=e.length&&t.substr(n,n+e.length)===e},Vt=function(t,e){return jt(t,e)?It(t,e.length):t},Ft=function(t,e){return Wt(t,e)?t:Ht(t,e)},Ut=function(t,e){return-1!==t.indexOf(e)},jt=function(t,e){return Pt(t,e,0)},Wt=function(t,e){return Pt(t,e,t.length-e.length)},qt=function(t){return function(e){return e.replace(t,"")}},$t=qt(/^\s+|\s+$/g),Gt=function(t){return t.length>0},Kt=function(t){return!Gt(t)},Xt=function(t){return void 0!==t.style&&m(t.style.getPropertyValue)},Yt=function(t,e){var n=e||document,r=n.createElement("div");if(r.innerHTML=t,!r.hasChildNodes()||r.childNodes.length>1)throw console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return Zt(r.childNodes[0])},Jt=function(t,e){var n=e||document,r=n.createElement(t);return Zt(r)},Qt=function(t,e){var n=e||document,r=n.createTextNode(t);return Zt(r)},Zt=function(t){if(null===t||void 0===t)throw new Error("Node cannot be null or undefined");return{dom:t}},te=function(t,e,n){return L.from(t.dom.elementFromPoint(e,n)).map(Zt)},ee={fromHtml:Yt,fromTag:Jt,fromText:Qt,fromDom:Zt,fromPoint:te};"undefined"!==typeof window?window:Function("return this;")();var ne,re=9,oe=11,ie=1,ue=3,ae=function(t){var e=t.dom.nodeName;return e.toLowerCase()},ce=function(t){return t.dom.nodeType},se=function(t){return function(e){return ce(e)===t}},le=se(ie),fe=se(ue),de=se(re),me=se(oe),ge=function(t){var e,n=!1;return function(){for(var r=[],o=0;o0&&e0}))},tr=function(t){var e={},n=t.dom;if(Xt(n))for(var r=0;rr?e-r:0;return o};return{set:n,get:r,getOuter:o,aggregate:i,max:u}},ir=or("height",(function(t){var e=t.dom;return Ln(t)?e.getBoundingClientRect().height:e.offsetHeight})),ur=function(t){return ir.get(t)},ar=function(t){return ir.getOuter(t)},cr=function(t,e){var n=["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"],r=ir.max(t,e,n);Kn(t,"max-height",r+"px")},sr=function(t,e){var n=function(n,r){return sr(t+n,e+r)};return{left:t,top:e,translate:n}},lr=sr,fr=function(t){var e=t.getBoundingClientRect();return lr(e.left,e.top)},dr=function(t,e){return void 0!==t?t:void 0!==e?e:0},mr=function(t){var e=t.dom.ownerDocument,n=e.body,r=e.defaultView,o=e.documentElement;if(n===t.dom)return lr(n.offsetLeft,n.offsetTop);var i=dr(null===r||void 0===r?void 0:r.pageYOffset,o.scrollTop),u=dr(null===r||void 0===r?void 0:r.pageXOffset,o.scrollLeft),a=dr(o.clientTop,n.clientTop),c=dr(o.clientLeft,n.clientLeft);return gr(t).translate(u-c,i-a)},gr=function(t){var e=t.dom,n=e.ownerDocument,r=n.body;return r===e?lr(r.offsetLeft,r.offsetTop):Ln(t)?fr(e):lr(0,0)},hr=or("width",(function(t){return t.dom.offsetWidth})),pr=function(t,e){return hr.set(t,e)},vr=function(t){return hr.get(t)},br=function(t){return hr.getOuter(t)},yr=function(t,e){var n=["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"],r=hr.max(t,e,n);Kn(t,"max-width",r+"px")},wr=function(t,e,n,r,o,i,u){return{target:t,x:e,y:n,stop:r,prevent:o,kill:i,raw:u}},xr=function(t){var e=ee.fromDom(Nn(t).getOr(t.target)),n=function(){return t.stopPropagation()},r=function(){return t.preventDefault()},o=b(r,n);return wr(e,t.clientX,t.clientY,n,r,o,t)},Cr=function(t,e){return function(n){t(n)&&e(xr(n))}},Sr=function(t,e,n,r,o){var i=Cr(n,r);return t.dom.addEventListener(e,i,o),{unbind:S(Or,t,e,i,o)}},kr=function(t,e,n,r){return Sr(t,e,n,r,!1)},Tr=function(t,e,n,r){return Sr(t,e,n,r,!0)},Or=function(t,e,n,r){t.dom.removeEventListener(e,n,r)},Er=function(t,e){var n=vn(t);n.each((function(n){n.dom.insertBefore(e.dom,t.dom)}))},_r=function(t,e){var n=wn(t);n.fold((function(){var n=vn(t);n.each((function(t){Dr(t,e)}))}),(function(t){Er(t,e)}))},Ar=function(t,e){var n=Sn(t);n.fold((function(){Dr(t,e)}),(function(n){t.dom.insertBefore(e.dom,n.dom)}))},Dr=function(t,e){t.dom.appendChild(e.dom)},Mr=function(t,e,n){Cn(t,n).fold((function(){Dr(t,e)}),(function(t){Er(t,e)}))},zr=function(t,e){G(e,(function(e){Er(t,e)}))},Rr=function(t,e){G(e,(function(e){Dr(t,e)}))},Nr=function(t){t.dom.textContent="",G(xn(t),(function(t){Br(t)}))},Br=function(t){var e=t.dom;null!==e.parentNode&&e.parentNode.removeChild(e)},Lr=function(t){var e=xn(t);e.length>0&&zr(t,e),Br(t)},Hr=function(t){var e=void 0!==t?t.dom:document,n=e.body.scrollLeft||e.documentElement.scrollLeft,r=e.body.scrollTop||e.documentElement.scrollTop;return lr(n,r)},Ir=function(t,e,n){var r=void 0!==n?n.dom:document,o=r.defaultView;o&&o.scrollTo(t,e)},Pr=function(t){var e=void 0===t?window:t;return en().browser.isFirefox()?L.none():L.from(e["visualViewport"])},Vr=function(t,e,n,r){return{x:t,y:e,width:n,height:r,right:t+n,bottom:e+r}},Fr=function(t){var e=void 0===t?window:t,n=e.document,r=Hr(ee.fromDom(n));return Pr(e).fold((function(){var t=e.document.documentElement,n=t.clientWidth,o=t.clientHeight;return Vr(r.left,r.top,n,o)}),(function(t){return Vr(Math.max(t.pageLeft,r.left),Math.max(t.pageTop,r.top),t.width,t.height)}))},Ur=function(t,e){var n=t.view(e);return n.fold(w([]),(function(e){var n=t.owner(e),r=Ur(t,n);return[e].concat(r)}))},jr=function(t,e){var n=e.owner(t),r=Ur(e,n);return L.some(r)},Wr=function(t){var e,n=t.dom===document?L.none():L.from(null===(e=t.dom.defaultView)||void 0===e?void 0:e.frameElement);return n.map(ee.fromDom)},qr=function(t){return mn(t)},$r=Object.freeze({__proto__:null,view:Wr,owner:qr}),Gr=function(t){var e=ee.fromDom(document),n=Hr(e),r=jr(t,$r);return r.fold(S(mr,t),(function(e){var r=gr(t),o=J(e,(function(t,e){var n=gr(e);return{left:t.left+n.left,top:t.top+n.top}}),{left:0,top:0});return lr(o.left+r.left+n.left,o.top+r.top+n.top)}))},Kr=function(t,e,n){return{point:t,width:e,height:n}},Xr=function(t,e,n,r){return{x:t,y:e,width:n,height:r}},Yr=function(t,e,n,r){return{x:t,y:e,width:n,height:r,right:t+n,bottom:e+r}},Jr=function(t){var e=mr(t),n=br(t),r=ar(t);return Yr(e.left,e.top,n,r)},Qr=function(t){var e=Gr(t),n=br(t),r=ar(t);return Yr(e.left,e.top,n,r)},Zr=function(){return Fr(window)},to=function(t){var e=function(e){return to(t)},n=function(e){return to(t)},r=function(e){return to(e(t))},o=function(e){return to(t)},i=function(e){e(t)},u=function(e){return e(t)},a=function(e,n){return n(t)},c=function(e){return e(t)},s=function(e){return e(t)},l=function(){return L.some(t)};return{isValue:E,isError:O,getOr:w(t),getOrThunk:w(t),getOrDie:w(t),or:e,orThunk:n,fold:a,map:r,mapError:o,each:i,bind:u,exists:c,forall:s,toOptional:l}},eo=function(t){var e=function(t){return t()},n=function(){return T(String(t))()},r=x,o=function(t){return t()},i=function(e){return eo(t)},u=function(e){return eo(e(t))},a=function(e){return eo(t)},c=function(e,n){return e(t)};return{isValue:O,isError:E,getOr:x,getOrThunk:e,getOrDie:n,or:r,orThunk:o,fold:c,map:i,mapError:u,each:p,bind:a,exists:O,forall:E,toOptional:L.none}},no=function(t,e){return t.fold((function(){return eo(e)}),to)},ro={value:to,error:eo,fromOption:no};(function(t){t[t["Error"]=0]="Error",t[t["Value"]=1]="Value"})(ne||(ne={}));var oo=function(t,e,n){return t.stype===ne.Error?e(t.serror):n(t.svalue)},io=function(t){var e=[],n=[];return G(t,(function(t){oo(t,(function(t){return n.push(t)}),(function(t){return e.push(t)}))})),{values:e,errors:n}},uo=function(t,e){return t.stype===ne.Error?{stype:ne.Error,serror:e(t.serror)}:t},ao=function(t,e){return t.stype===ne.Value?{stype:ne.Value,svalue:e(t.svalue)}:t},co=function(t,e){return t.stype===ne.Value?e(t.svalue):t},so=function(t,e){return t.stype===ne.Error?e(t.serror):t},lo=function(t){return{stype:ne.Value,svalue:t}},fo=function(t){return{stype:ne.Error,serror:t}},mo=function(t){return oo(t,ro.error,ro.value)},go=function(t){return t.fold(fo,lo)},ho={fromResult:go,toResult:mo,svalue:lo,partition:io,serror:fo,bind:co,bindError:so,map:ao,mapError:uo,fold:oo},po=function(t,e,n,r){return{tag:"field",key:t,newKey:e,presence:n,prop:r}},vo=function(t,e){return{tag:"custom",newKey:t,instantiator:e}},bo=function(t,e,n){switch(t.tag){case"field":return e(t.key,t.newKey,t.presence,t.prop);case"custom":return n(t.newKey,t.instantiator)}},yo=function(t,e){return e},wo=function(t,e){var n=u(t)&&u(e);return n?Co(t,e):e},xo=function(t){return function(){for(var e=[],n=0;n0?ho.svalue(Co(e,So.apply(void 0,t))):ho.svalue(e)},Mo=function(t){return b(ho.serror,nt)(t)},zo=function(t,e){var n=ho.partition(t);return n.errors.length>0?Mo(n.errors):Do(n.values,e)},Ro=function(t){var e=ho.partition(t);return e.errors.length>0?Mo(e.errors):ho.svalue(e.values)},No={consolidateObj:zo,consolidateArr:Ro},Bo=function(t){return u(t)&&ht(t).length>100?" removed due to size":JSON.stringify(t,null,2)},Lo=function(t){var e=t.length>10?t.slice(0,10).concat([{path:[],getErrorInfo:w("... (only showing first ten failures)")}]):t;return $(e,(function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))},Ho=function(t,e){return ho.serror([{path:t,getErrorInfo:e}])},Io=function(t,e,n){return Ho(t,(function(){return'Could not find valid *required* value for "'+e+'" in '+Bo(n)}))},Po=function(t,e){return Ho(t,(function(){return'Choice schema did not contain choice key: "'+e+'"'}))},Vo=function(t,e,n){return Ho(t,(function(){return'The chosen schema: "'+n+'" did not exist in branches: '+Bo(e)}))},Fo=function(t,e){return Ho(t,(function(){return"There are unsupported fields: ["+e.join(", ")+"] specified"}))},Uo=function(t,e){return Ho(t,w(e))},jo=function(t){var e=function(e,n){return ho.bindError(t(n),(function(t){return Uo(e,t)}))},n=w("val");return{extract:e,toString:n}},Wo=jo(ho.svalue),qo=function(t,e,n,r){return Ot(e,n).fold((function(){return Io(t,n,e)}),r)},$o=function(t,e,n,r){var o=Ot(t,e).getOrThunk((function(){return n(t)}));return r(o)},Go=function(t,e,n){return n(Ot(t,e))},Ko=function(t,e,n,r){var o=Ot(t,e).map((function(e){return!0===e?n(t):e}));return r(o)},Xo=function(t,e,n,r,o){var i=function(t){return o.extract(e.concat([r]),t)},u=function(t){return t.fold((function(){return ho.svalue(L.none())}),(function(t){var n=o.extract(e.concat([r]),t);return ho.map(n,L.some)}))};switch(t.tag){case"required":return qo(e,n,r,i);case"defaultedThunk":return $o(n,r,t.process,i);case"option":return Go(n,r,u);case"defaultedOptionThunk":return Ko(n,r,t.process,u);case"mergeWithThunk":return $o(n,r,w({}),(function(e){var r=Co(t.process(n),e);return i(r)}))}},Yo=function(t,e,n){for(var r={},o=[],i=0,u=n;i0?ho.serror(o):ho.svalue(r)},Jo=function(t){var e=function(e,n){return t().extract(e,n)},n=function(){return t().toString()};return{extract:e,toString:n}},Qo=function(t){return ht(Ct(t,d))},Zo=function(t){var e=ti(t),n=J(t,(function(t,e){return bo(e,(function(e){var n;return Co(t,(n={},n[e]=!0,n))}),w(t))}),{}),r=function(t,r){var o=s(r)?[]:Qo(r),i=Y(o,(function(t){return!_t(n,t)}));return 0===i.length?e.extract(t,r):Fo(t,i)};return{extract:r,toString:e.toString}},ti=function(t){var e=function(e,n){return Yo(e,n,t)},n=function(){var e=$(t,(function(t){return bo(t,(function(t,e,n,r){return t+" -> "+r.toString()}),(function(t,e){return"state("+t+")"}))}));return"obj{\n"+e.join("\n")+"}"};return{extract:e,toString:n}},ei=function(t){var e=function(e,n){var r=$(n,(function(n,r){return t.extract(e.concat(["["+r+"]"]),n)}));return No.consolidateArr(r)},n=function(){return"array("+t.toString()+")"};return{extract:e,toString:n}},ni=function(t){var e=function(e,n){for(var r=[],o=0,i=t;o0?pu(n.errors):hu(n.values,e)},bu=function(t){return m(t)?t:O},yu=function(t,e,n){var r=t.dom,o=bu(n);while(r.parentNode){r=r.parentNode;var i=ee.fromDom(r),u=e(i);if(u.isSome())return u;if(o(i))break}return L.none()},wu=function(t,e,n){var r=e(t),o=bu(n);return r.orThunk((function(){return o(t)?L.none():yu(t,e,o)}))},xu=function(t,e){return sn(t.element,e.event.target)},Cu={can:E,abort:O,run:p},Su=function(t){if(!_t(t,"can")&&!_t(t,"abort")&&!_t(t,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(t,null,2)+" does not have can, abort, or run!");return A(A({},Cu),t)},ku=function(t,e){return function(){for(var n=[],r=0;r1?Y(e[n],(function(e){return j(t,(function(t){return t.name===e}))})).join(" > "):t[0].name;return mu(n,Nc(o,i))}))}));return vu(n,{})},$c="alloy.base.behaviour",Gc=ti([Oi("dom","dom",ko(),ti([Ai("tag"),Ki("styles",{}),Ki("classes",[]),Ki("attributes",{}),Vi("value"),Vi("innerHtml")])),Ai("components"),Ai("uid"),Ki("events",{}),Ki("apis",{}),Oi("eventOrder","eventOrder",Ao((au={},au[ea()]=["disabling",$c,"toggling","typeaheadevents"],au[Ju()]=[$c,"focusing","keying"],au[aa()]=[$c,"disabling","toggling","representing"],au[Uu()]=[$c,"representing","streaming","invalidating"],au[ma()]=[$c,"representing","item-events","tooltipping"],au[Ru()]=["focusing",$c,"item-type-events"],au[Au()]=["focusing",$c,"item-type-events"],au[Hu()]=["item-type-events","tooltipping"],au[ta()]=["receiving","reflecting","tooltipping"],au)),ui()),Vi("domModification")]),Kc=function(t){return wi("custom.definition",Gc,t)},Xc=function(t){return A(A({},t.dom),{uid:t.uid,domChildren:$(t.components,(function(t){return t.element}))})},Yc=function(t){return t.domModification.fold((function(){return Dc({})}),Dc)},Jc=function(t){return t.events},Qc=function(t,e){var n=Un(t,e);return void 0===n||""===n?[]:n.split(" ")},Zc=function(t,e,n){var r=Qc(t,e),o=r.concat([n]);return Vn(t,e,o.join(" ")),!0},ts=function(t,e,n){var r=Y(Qc(t,e),(function(t){return t!==n}));return r.length>0?Vn(t,e,r.join(" ")):qn(t,e),!1},es=function(t){return void 0!==t.dom.classList},ns=function(t){return Qc(t,"class")},rs=function(t,e){return Zc(t,"class",e)},os=function(t,e){return ts(t,"class",e)},is=function(t,e){es(t)?t.dom.classList.add(e):rs(t,e)},us=function(t){var e=es(t)?t.dom.classList:ns(t);0===e.length&&qn(t,"class")},as=function(t,e){if(es(t)){var n=t.dom.classList;n.remove(e)}else os(t,e);us(t)},cs=function(t,e){return es(t)&&t.dom.classList.contains(e)},ss=function(t,e){G(e,(function(e){is(t,e)}))},ls=function(t,e){G(e,(function(e){as(t,e)}))},fs=function(t,e){return ot(e,(function(e){return cs(t,e)}))},ds=function(t){return t.dom.value},ms=function(t,e){if(void 0===e)throw new Error("Value.set was undefined");t.dom.value=e},gs=function(t){var e=ee.fromTag(t.tag);Fn(e,t.attributes),ss(e,t.classes),Xn(e,t.styles),t.innerHtml.each((function(t){return Ka(e,t)}));var n=t.domChildren;return Rr(e,n),t.value.each((function(t){ms(e,t)})),t.uid,lc(e,t.uid),e},hs=function(t){var e=Ot(t,"behaviours").getOr({});return rt(ht(e),(function(t){var n=e[t];return d(n)?[n.me]:[]}))},ps=function(t,e){return Oc(t,e)},vs=function(t){var e=hs(t);return ps(t,e)},bs=function(t,e,n){var r=Xc(t),o=Yc(t),i={"alloy.base.modification":o},u=e.length>0?zc(n,i,e,r):o;return Mc(r,u)},ys=function(t,e,n){var r={"alloy.base.behaviour":Jc(t)};return Fc(n,t.eventOrder,e,r).getOrDie()},ws=function(t){var e=function(){return y},n=ou(hc),r=xi(Kc(t)),o=vs(t),i=Ec(o),u=_c(o),a=bs(r,i,u),c=gs(a),s=ys(r,i,u),l=ou(r.components),f=function(t){n.set(t)},d=function(){n.set(gc(e))},g=function(){var t=xn(c),e=rt(t,(function(t){return n.get().getByDom(t).fold((function(){return[]}),ct)}));l.set(e)},h=function(e){var n=u,r=m(n[e.name()])?n[e.name()]:function(){throw new Error("Could not find "+e.name()+" in "+JSON.stringify(t,null,2))};return r()},p=function(t){return m(u[t.name()])},v=function(){return r.apis},b=function(t){return u[t]().map((function(t){return t.state.readState()})).getOr("not enabled")},y={uid:t.uid,getSystem:n.get,config:h,hasConfigured:p,spec:t,readState:b,getApis:v,connect:f,disconnect:d,element:c,syncComponents:g,components:l.get,events:s};return y},xs=function(t){var e=Ot(t,"components").getOr([]);return $(e,Es)},Cs=function(t){var e=mc(t),n=e.events,r=D(e,["events"]),o=xs(r),i=A(A({},r),{events:A(A({},nc),n),components:o});return ro.value(ws(i))},Ss=function(t){var e=ee.fromText(t);return ks({element:e})},ks=function(t){var e=Ci("external.component",Zo([Ai("element"),Vi("uid")]),t),n=ou(gc()),r=function(t){n.set(t)},o=function(){n.set(gc((function(){return u})))},i=e.uid.getOrThunk((function(){return dc("external")}));lc(e.element,i);var u={uid:i,getSystem:n.get,config:L.none,hasConfigured:O,connect:r,disconnect:o,getApis:function(){return{}},element:e.element,spec:t,readState:w("No state"),syncComponents:p,components:w([]),events:{}};return xc(u)},Ts=dc,Os=function(t){return Et(t,"uid")},Es=function(t){return Cc(t).getOrThunk((function(){var e=Os(t)?t:A({uid:Ts("")},t);return Cs(e).getOrDie()}))},_s=xc;function As(t,e,n,r,o){return t(n,r)?L.some(n):m(o)&&o(n)?L.none():e(n,r,o)}var Ds,Ms=function(t,e,n){var r=t.dom,o=m(n)?n:O;while(r.parentNode){r=r.parentNode;var i=ee.fromDom(r);if(e(i))return L.some(i);if(o(i))break}return L.none()},zs=function(t,e,n){var r=function(t,e){return e(t)};return As(r,Ms,t,e,n)},Rs=function(t,e){var n=function(t){return e(ee.fromDom(t))},r=tt(t.dom.childNodes,n);return r.map(ee.fromDom)},Ns=function(t,e){var n=function(t){for(var r=0;r-1}));return e.bind((function(t){var e=Un(t,"id"),n=An(t);return Is(n,'[aria-owns="'+e+'"]')}))},Fs=function(){var t=oc("aria-owns"),e=function(e){Vn(e,"aria-owns",t)},n=function(t){qn(t,"aria-owns")};return{id:t,link:e,unlink:n}},Us=function(t,e){return Vs(e).exists((function(e){return js(t,e)}))},js=function(t,e){return Bs(e,(function(e){return sn(e,t.element)}),O)||Us(t,e)},Ws="unknown";(function(t){t[t["STOP"]=0]="STOP",t[t["NORMAL"]=1]="NORMAL",t[t["LOGGING"]=2]="LOGGING"})(Ds||(Ds={}));var qs=ou({}),$s=function(t,e){var n=[],r=(new Date).getTime();return{logEventCut:function(t,e,r){n.push({outcome:"cut",target:e,purpose:r})},logEventStopped:function(t,e,r){n.push({outcome:"stopped",target:e,purpose:r})},logNoParent:function(t,e,r){n.push({outcome:"no-parent",target:e,purpose:r})},logEventNoHandlers:function(t,e){n.push({outcome:"no-handlers-left",target:e})},logEventResponse:function(t,e,r){n.push({outcome:"response",purpose:r,target:e})},write:function(){var o=(new Date).getTime();U(["mousemove","mouseover","mouseout",aa()],t)||console.log(t,{event:t,time:o-r,target:e.dom,sequence:$(n,(function(t){return U(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+Za(t.target)+")":t.outcome}))})}}},Gs=function(t,e,n){var r=Ot(qs.get(),t).orThunk((function(){var e=ht(qs.get());return gt(e,(function(e){return t.indexOf(e)>-1?L.some(qs.get()[e]):L.none()}))})).getOr(Ds.NORMAL);switch(r){case Ds.NORMAL:return n(Qs());case Ds.LOGGING:var o=$s(t,e),i=n(o);return o.write(),i;case Ds.STOP:return!0}},Ks=["alloy/data/Fields","alloy/debugging/Debugging"],Xs=function(){var t=new Error;if(void 0!==t.stack){var e=t.stack.split("\n");return tt(e,(function(t){return t.indexOf("alloy")>0&&!j(Ks,(function(e){return t.indexOf(e)>-1}))})).getOr(Ws)}return Ws},Ys={logEventCut:p,logEventStopped:p,logNoParent:p,logEventNoHandlers:p,logEventResponse:p,write:p},Js=function(t,e,n){return Gs(t,e,n)},Qs=w(Ys),Zs=w([Ai("menu"),Ai("selectedMenu")]),tl=w([Ai("item"),Ai("selectedItem")]);w(ti(tl().concat(Zs())));var el=w(ti(tl())),nl=Hi("initSize",[Ai("numColumns"),Ai("numRows")]),rl=function(){return Di("markers",el())},ol=function(){return Hi("markers",[Ai("backgroundMenu")].concat(Zs()).concat(tl()))},il=function(t){return Hi("markers",$(t,Ai))},ul=function(t,e,n){return Xs(),Oi(e,e,n,vi((function(t){return ro.value((function(){for(var e=[],n=0;nr?n:o=n&&u<=o,m=a>=r&&a<=i,g=d&&m,h=c<=o&&c>=n,p=s<=i&&s>=r,v=h&&p,b=Math.min(l,u>=n?o-u:c-n),y=Math.min(f,a>=r?i-a:s-r);return{originInBounds:g,sizeInBounds:v,visibleW:b,visibleH:y}},Yf=function(t,e){var n=e.x,r=e.y,o=e.right,i=e.bottom,u=t.x,a=t.y,c=t.width,s=t.height,l=Math.max(n,o-c),f=Math.max(r,i-s),d=_l(u,n,l),m=_l(a,r,f),g=Math.min(d+c,o)-d,h=Math.min(m+s,i)-m;return Yr(d,m,g,h)},Jf=function(t,e,n){var r=w(e.bottom-n.y),o=w(n.bottom-e.y),i=vl(t,o,o,r),u=w(e.right-n.x),a=w(n.right-e.x),c=bl(t,a,a,u);return{maxWidth:c,maxHeight:i}},Qf=function(t,e,n,r){var o=t.bubble,i=o.offset,u=Ml(r,t.restriction,i),a=t.x+i.left,c=t.y+i.top,s=Yr(a,c,e,n),l=Xf(s,u),f=l.originInBounds,d=l.sizeInBounds,m=l.visibleW,g=l.visibleH,h=f&&d,p=h?s:Yf(s,u),v=p.width>0&&p.height>0,b=Jf(t.direction,p,r),y=b.maxWidth,w=b.maxHeight,x={rect:p,maxHeight:w,maxWidth:y,direction:t.direction,placement:t.placement,classes:{on:o.classesOn,off:o.classesOff},layout:t.label,testY:c};return h||t.alwaysFit?Kf.fit(x):Kf.nofit(x,m,g,v)},Zf=function(t,e,n,r,o,i){var u=r.width,a=r.height,c=function(e,c,s,l,f){var d=e(n,r,o,t,i),m=Qf(d,u,a,i);return m.fold(w(m),(function(t,e,n,r){var o=f===r?n>l||e>s:!f&&r;return o?m:Kf.nofit(c,s,l,f)}))},s=Q(e,(function(t,e){var n=S(c,e);return t.fold(w(t),n)}),Kf.nofit({rect:n,maxHeight:r.height,maxWidth:r.width,direction:yl(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:n.y},-1,-1,!1));return s.fold(x,x)},td=function(t){var e=ou(L.none()),n=function(){return e.get().each(t)},r=function(){n(),e.set(L.none())},o=function(){return e.get().isSome()},i=function(){return e.get()},u=function(t){n(),e.set(L.some(t))};return{clear:r,isSet:o,get:i,set:u}},ed=function(){return td((function(t){return t.destroy()}))},nd=function(){return td((function(t){return t.unbind()}))},rd=function(){var t=ed(),e=function(e){return t.get().each(e)};return A(A({},t),{run:e})},od=function(){var t=td(p),e=function(e){return t.get().each(e)};return A(A({},t),{on:e})},id=E,ud=function(t,e,n){return kr(t,e,id,n)},ad=function(t,e,n){return Tr(t,e,id,n)},cd=xr,sd=["top","bottom","right","left"],ld="data-alloy-transition-timer",fd=function(t,e){return fs(t,e.classes)},dd=function(t,e,n){return n.exists((function(n){var r=t.mode;return"all"===r||n[r]!==e[r]}))},md=function(t,e){var n=function(t){return parseFloat(t).toFixed(3)};return kt(e,(function(e,r){var o=t[r].map(n),i=e.map(n);return!Dt(o,i)})).isSome()},gd=function(t){var e=function(e){var n=Jn(t,e),r=i(n)?n.split(/\s*,\s*/):[];return Y(r,Gt)},n=function(t){if(i(t)&&/^[\d.]+/.test(t)){var e=parseFloat(t);return Wt(t,"ms")?e:1e3*e}return 0},r=e("transition-delay"),o=e("transition-duration");return Q(o,(function(t,e,o){var i=n(r[o])+n(e);return Math.max(t,i)}),0)},hd=function(t,e){var n,r=nd(),o=nd(),i=function(e){var n,r=null!==(n=e.raw.pseudoElement)&&void 0!==n?n:"";return sn(e.target,t)&&Kt(r)&&U(sd,e.raw.propertyName)},u=function(u){if(f(u)||i(u)){r.clear(),o.clear();var a=null===u||void 0===u?void 0:u.raw.type;(f(a)||a===$u())&&(clearTimeout(n),qn(t,ld),ls(t,e.classes))}},a=function(){r.set(ud(t,$u(),u)),o.set(ud(t,qu(),u))};if("ontransitionstart"in t.dom)var c=ud(t,Gu(),(function(t){i(t)&&(c.unbind(),a())}));else a();var s=gd(t);requestAnimationFrame((function(){n=setTimeout(u,s+17),Vn(t,ld,n)}))},pd=function(t,e){ss(t,e.classes),jn(t,ld).each((function(e){clearTimeout(parseInt(e,10)),qn(t,ld)})),hd(t,e)},vd=function(t,e,n,r,o,i){var u=dd(r,o,i);if(u||fd(t,r)){Kn(t,"position",n.position);var a=Bf(e,t),c=Nf(e,A(A({},o),{rect:a})),s=at(sd,(function(t){return c[t]}));md(n,s)&&(Yn(t,s),u&&pd(t,r),rr(t))}else ls(t,r.classes)},bd=function(t){return{width:br(t),height:ar(t)}},yd=function(t,e,n,r){nr(e,"max-height"),nr(e,"max-width");var o=bd(e);return Zf(e,r.preference,t,o,n,r.bounds)},wd=function(t,e){var n=e.classes;ls(t,n.off),ss(t,n.on)},xd=function(t,e,n){var r=n.maxHeightFunction;r(t,e.maxHeight)},Cd=function(t,e,n){var r=n.maxWidthFunction;r(t,e.maxWidth)},Sd=function(t,e,n){var r=Nf(n.origin,e);n.transition.each((function(o){vd(t,n.origin,r,o,e,n.lastPlacement)})),Mf(t,r)},kd=function(t,e){qf(t,e.placement)},Td=function(t,e){cr(t,Math.floor(e))},Od=w((function(t,e){Td(t,e),Xn(t,{"overflow-x":"hidden","overflow-y":"auto"})})),Ed=w((function(t,e){Td(t,e)})),_d=function(t,e,n){return void 0===t[e]?n:t[e]},Ad=function(t,e,n,r,o,i,u,a){var c=_d(u,"maxHeightFunction",Od()),s=_d(u,"maxWidthFunction",p),l=t.anchorBox,f=t.origin,d={bounds:Lf(f,i),origin:f,preference:r,maxHeightFunction:c,maxWidthFunction:s,lastPlacement:o,transition:a};return Dd(l,e,n,d)},Dd=function(t,e,n,r){var o=yd(t,e,n,r);return Sd(e,o,r),kd(e,o),wd(e,o),xd(e,o,r),Cd(e,o,r),{layout:o.layout,placement:o.placement}},Md=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],zd=function(t,e,n,r){void 0===r&&(r=1);var o=t*r,i=e*r,u=function(t){return Ot(n,t).getOr([])},a=function(t,e,n){var r=ut(Md,n);return{offset:lr(t,e),classesOn:rt(n,u),classesOff:rt(r,u)}};return{southeast:function(){return a(-t,e,["top","alignLeft"])},southwest:function(){return a(t,e,["top","alignRight"])},south:function(){return a(-t/2,e,["top","alignCentre"])},northeast:function(){return a(-t,-e,["bottom","alignLeft"])},northwest:function(){return a(t,-e,["bottom","alignRight"])},north:function(){return a(-t/2,-e,["bottom","alignCentre"])},east:function(){return a(t,-e/2,["valignCentre","left"])},west:function(){return a(-t,-e/2,["valignCentre","right"])},insetNortheast:function(){return a(o,i,["top","alignLeft","inset"])},insetNorthwest:function(){return a(-o,i,["top","alignRight","inset"])},insetNorth:function(){return a(-o/2,i,["top","alignCentre","inset"])},insetSoutheast:function(){return a(o,-i,["bottom","alignLeft","inset"])},insetSouthwest:function(){return a(-o,-i,["bottom","alignRight","inset"])},insetSouth:function(){return a(-o/2,-i,["bottom","alignCentre","inset"])},insetEast:function(){return a(-o,-i/2,["valignCentre","right","inset"])},insetWest:function(){return a(o,-i/2,["valignCentre","left","inset"])}}},Rd=function(){return zd(0,0,{})},Nd=x,Bd=function(t,e){return function(n){return"rtl"===Ld(n)?e:t}},Ld=function(t){return"rtl"===Jn(t,"direction")?"rtl":"ltr"};(function(t){t["TopToBottom"]="toptobottom",t["BottomToTop"]="bottomtotop"})(Pf||(Pf={}));var Hd="data-alloy-vertical-dir",Id=function(t){return Bs(t,(function(t){return le(t)&&Un(t,"data-alloy-vertical-dir")===Pf.BottomToTop}))},Pd=function(){return $i("layouts",[Ai("onLtr"),Ai("onRtl"),Vi("onBottomLtr"),Vi("onBottomRtl")])},Vd=function(t,e,n,r,o,i,u){var a=u.map(Id).getOr(!1),c=e.layouts.map((function(e){return e.onLtr(t)})),s=e.layouts.map((function(e){return e.onRtl(t)})),l=a?e.layouts.bind((function(e){return e.onBottomLtr.map((function(e){return e(t)}))})).or(c).getOr(o):c.getOr(n),f=a?e.layouts.bind((function(e){return e.onBottomRtl.map((function(e){return e(t)}))})).or(s).getOr(i):s.getOr(r),d=Bd(l,f);return d(t)},Fd=function(t,e,n){var r=e.hotspot,o=Bf(n,r.element),i=Vd(t.element,e,Zl(),tf(),Jl(),Ql(),L.some(e.hotspot.element));return L.some(Nd({anchorBox:o,bubble:e.bubble.getOr(Rd()),overrides:e.overrides,layouts:i,placer:L.none()}))},Ud=[Ai("hotspot"),Vi("bubble"),Ki("overrides",{}),Pd(),fl("placement",Fd)],jd=function(t,e,n){var r=Hf(n,e.x,e.y),o=Yr(r.left,r.top,e.width,e.height),i=Vd(t.element,e,Xl(),Yl(),Xl(),Yl(),L.none());return L.some(Nd({anchorBox:o,bubble:e.bubble,overrides:e.overrides,layouts:i,placer:L.none()}))},Wd=[Ai("x"),Ai("y"),Ki("height",0),Ki("width",0),Ki("bubble",Rd()),Ki("overrides",{}),Pd(),fl("placement",jd)],qd=uu.generate([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),$d=function(t){return t.fold(x,(function(t,e,n){return t.translate(-e,-n)}))},Gd=function(t){return t.fold(x,x)},Kd=function(t){return Q(t,(function(t,e){return t.translate(e.left,e.top)}),lr(0,0))},Xd=function(t){var e=$(t,$d);return Kd(e)},Yd=function(t){var e=$(t,Gd);return Kd(e)},Jd=qd.screen,Qd=qd.absolute,Zd=function(t,e,n){var r=pn(n.root).dom,o=function(e){var n=mn(e),r=mn(t.element);return sn(n,r)};return L.from(r.frameElement).map(ee.fromDom).filter(o).map(mr)},tm=function(t,e,n){var r=mn(t.element),o=Hr(r),i=Zd(t,e,n).getOr(o);return Qd(i,o.left,o.top)},em=function(t,e,n,r){var o=Jd(lr(t,e));return L.some(Kr(o,n,r))},nm=function(t,e,n,r,o){return t.map((function(t){var i=[e,t.point],u=If(r,(function(){return Yd(i)}),(function(){return Yd(i)}),(function(){return Xd(i)})),a=Xr(u.left,u.top,t.width,t.height),c=n.showAbove?Jl():Zl(),s=n.showAbove?Ql():tf(),l=Vd(o,n,c,s,c,s,L.none());return Nd({anchorBox:a,bubble:n.bubble.getOr(Rd()),overrides:n.overrides,layouts:l,placer:L.none()})}))},rm=function(t,e,n){var r=tm(t,n,e);return e.node.filter(Ln).bind((function(o){var i=o.dom.getBoundingClientRect(),u=em(i.left,i.top,i.width,i.height),a=e.node.getOr(t.element);return nm(u,r,e,n,a)}))},om=[Ai("node"),Ai("root"),Vi("bubble"),Pd(),Ki("overrides",{}),Ki("showAbove",!1),fl("placement",rm)],im="\ufeff",um=" ",am=function(t,e,n,r){return{start:t,soffset:e,finish:n,foffset:r}},cm={create:am},sm=uu.generate([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),lm=function(t,e,n,r){return t.fold(e,n,r)},fm=function(t){return t.fold(x,x,x)},dm=sm.before,mm=sm.on,gm=sm.after,hm={before:dm,on:mm,after:gm,cata:lm,getStart:fm},pm=uu.generate([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),vm=function(t){return pm.exact(t.start,t.soffset,t.finish,t.foffset)},bm=function(t){return t.match({domRange:function(t){return ee.fromDom(t.startContainer)},relative:function(t,e){return hm.getStart(t)},exact:function(t,e,n,r){return t}})},ym=pm.domRange,wm=pm.relative,xm=pm.exact,Cm=function(t){var e=bm(t);return pn(e)},Sm=cm.create,km={domRange:ym,relative:wm,exact:xm,exactFromRange:vm,getWin:Cm,range:Sm},Tm=function(t,e){e.fold((function(e){t.setStartBefore(e.dom)}),(function(e,n){t.setStart(e.dom,n)}),(function(e){t.setStartAfter(e.dom)}))},Om=function(t,e){e.fold((function(e){t.setEndBefore(e.dom)}),(function(e,n){t.setEnd(e.dom,n)}),(function(e){t.setEndAfter(e.dom)}))},Em=function(t,e,n){var r=t.document.createRange();return Tm(r,e),Om(r,n),r},_m=function(t,e,n,r,o){var i=t.document.createRange();return i.setStart(e.dom,n),i.setEnd(r.dom,o),i},Am=function(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height}},Dm=function(t){var e=t.getClientRects(),n=e.length>0?e[0]:t.getBoundingClientRect();return n.width>0||n.height>0?L.some(n).map(Am):L.none()},Mm=function(t){var e=t.getBoundingClientRect();return e.width>0||e.height>0?L.some(e).map(Am):L.none()},zm=uu.generate([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Rm=function(t,e,n){return e(ee.fromDom(n.startContainer),n.startOffset,ee.fromDom(n.endContainer),n.endOffset)},Nm=function(t,e){return e.match({domRange:function(t){return{ltr:w(t),rtl:L.none}},relative:function(e,n){return{ltr:ge((function(){return Em(t,e,n)})),rtl:ge((function(){return L.some(Em(t,n,e))}))}},exact:function(e,n,r,o){return{ltr:ge((function(){return _m(t,e,n,r,o)})),rtl:ge((function(){return L.some(_m(t,r,o,e,n))}))}}})},Bm=function(t,e){var n=e.ltr();if(n.collapsed){var r=e.rtl().filter((function(t){return!1===t.collapsed}));return r.map((function(t){return zm.rtl(ee.fromDom(t.endContainer),t.endOffset,ee.fromDom(t.startContainer),t.startOffset)})).getOrThunk((function(){return Rm(t,zm.ltr,n)}))}return Rm(t,zm.ltr,n)},Lm=function(t,e){var n=Nm(t,e);return Bm(t,n)},Hm=function(t,e){var n=Lm(t,e);return n.match({ltr:function(e,n,r,o){var i=t.document.createRange();return i.setStart(e.dom,n),i.setEnd(r.dom,o),i},rtl:function(e,n,r,o){var i=t.document.createRange();return i.setStart(r.dom,o),i.setEnd(e.dom,n),i}})};zm.ltr,zm.rtl;var Im,Pm=function(t,e){var n=function(n){if(!t(n))throw new Error("Can only get "+e+" value of a "+e+" node");return r(n).getOr("")},r=function(e){return t(e)?L.from(e.dom.nodeValue):L.none()},o=function(n,r){if(!t(n))throw new Error("Can only set raw "+e+" value of a "+e+" node");n.dom.nodeValue=r};return{get:n,getOption:r,set:o}},Vm=Pm(fe,"text"),Fm=function(t){return Vm.get(t)},Um=function(t){return Vm.getOption(t)},jm=function(t){return"img"===ae(t)?1:Um(t).fold((function(){return xn(t).length}),(function(t){return t.length}))},Wm=function(t){return Um(t).filter((function(t){return 0!==t.trim().length||t.indexOf(um)>-1})).isSome()},qm=["img","br"],$m=function(t){var e=Wm(t);return e||U(qm,ae(t))},Gm=function(t){return Km(t,$m)},Km=function(t,e){var n=function(t){for(var r=xn(t),o=r.length-1;o>=0;o--){var i=r[o];if(e(i))return L.some(i);var u=n(i);if(u.isSome())return u}return L.none()};return n(t)},Xm=function(t,e){return an(e,t)},Ym=function(t,e,n,r){var o=mn(t),i=o.dom.createRange();return i.setStart(t.dom,e),i.setEnd(n.dom,r),i},Jm=function(t,e,n,r){var o=Ym(t,e,n,r),i=sn(t,n)&&e===r;return o.collapsed&&!i},Qm=function(t){return L.from(t.getSelection())},Zm=function(t){if(t.rangeCount>0){var e=t.getRangeAt(0),n=t.getRangeAt(t.rangeCount-1);return L.some(cm.create(ee.fromDom(e.startContainer),e.startOffset,ee.fromDom(n.endContainer),n.endOffset))}return L.none()},tg=function(t){if(null===t.anchorNode||null===t.focusNode)return Zm(t);var e=ee.fromDom(t.anchorNode),n=ee.fromDom(t.focusNode);return Jm(e,t.anchorOffset,n,t.focusOffset)?L.some(cm.create(e,t.anchorOffset,n,t.focusOffset)):Zm(t)},eg=function(t){return Qm(t).filter((function(t){return t.rangeCount>0})).bind(tg)},ng=function(t,e){var n=Hm(t,e);return Dm(n)},rg=function(t,e){var n=Hm(t,e);return Mm(n)},og=function(t,e){return{element:t,offset:e}},ig=function(t,e){var n=xn(t);if(0===n.length)return og(t,e);if(e"})),ui()),Cp=Ei("schema",(function(){return[Vi("preprocess")]})),Sp=Ki("defaults",w({})),kp=Ki("overrides",w({})),Tp=ti([bp,yp,wp,xp,Sp,kp]),Op=ti([bp,yp,wp,Sp,kp]),Ep=ti([bp,yp,wp,xp,Sp,kp]),_p=ti([bp,Cp,wp,Ai("unit"),xp,Sp,kp]),Ap=function(t){return t.fold(L.some,L.none,L.some,L.some)},Dp=function(t){var e=function(t){return t.name};return t.fold(e,e,e,e)},Mp=function(t){return t.fold(x,x,x,x)},zp=function(t,e){return function(n){var r=Ci("Converting part type",e,n);return t(r)}},Rp=zp(vp.required,Tp),Np=zp(vp.external,Op),Bp=zp(vp.optional,Ep),Lp=zp(vp.group,_p),Hp=w("entirety"),Ip=Object.freeze({__proto__:null,required:Rp,external:Np,optional:Bp,group:Lp,asNamedPart:Ap,name:Dp,asCommon:Mp,original:Hp}),Pp=function(t,e,n,r){return Co(e.defaults(t,n,r),n,{uid:t.partUids[e.name]},e.overrides(t,n,r))},Vp=function(t,e,n){var r={},o={};return G(n,(function(t){t.fold((function(t){r[t.pname]=gp(!0,(function(e,n,r){return t.factory.sketch(Pp(e,t,n,r))}))}),(function(t){var n=e.parts[t.name];o[t.name]=w(t.factory.sketch(Pp(e,t,n[Hp()]),n))}),(function(t){r[t.pname]=gp(!1,(function(e,n,r){return t.factory.sketch(Pp(e,t,n,r))}))}),(function(t){r[t.pname]=hp(!0,(function(e,n,r){var o=e[t.name];return $(o,(function(n){return t.factory.sketch(Co(t.defaults(e,n,r),n,t.overrides(e,n)))}))}))}))})),{internals:w(r),externals:w(o)}},Fp=function(t,e){var n={};return G(e,(function(e){Ap(e).each((function(e){var r=Up(t,e.pname);n[e.name]=function(n){var o=Ci("Part: "+e.name+" in "+t,ti(e.schema),n);return A(A({},r),{config:n,validated:o})}}))})),n},Up=function(t,e){return{uiType:pp(),owner:t,name:e}},jp=function(t,e,n){return{uiType:pp(),owner:t,name:e,config:n,validated:{}}},Wp=function(t){return rt(t,(function(t){return t.fold(L.none,L.some,L.none,L.none).map((function(t){return Hi(t.name,t.schema.concat([dl(Hp())]))})).toArray()}))},qp=function(t){return $(t,Dp)},$p=function(t,e,n){return Vp(t,e,n)},Gp=function(t,e,n){return mp(L.some(t),e,e.components,n)},Kp=function(t,e,n){var r=e.partUids[n];return t.getSystem().getByUid(r).toOptional()},Xp=function(t,e,n){return Kp(t,e,n).getOrDie("Could not find part: "+n)},Yp=function(t,e,n){var r={},o=e.partUids,i=t.getSystem();return G(n,(function(t){r[t]=w(i.getByUid(o[t]))})),r},Jp=function(t,e){var n=t.getSystem();return bt(e.partUids,(function(t,e){return w(n.getByUid(t))}))},Qp=function(t){return ht(t.partUids)},Zp=function(t,e,n){var r={},o=e.partUids,i=t.getSystem();return G(n,(function(t){r[t]=w(i.getByUid(o[t]).getOrDie())})),r},tv=function(t,e){var n=qp(e);return gu($(n,(function(e){return{key:e,value:t+"-"+e}})))},ev=function(t){return Oi("partUids","partUids",_o((function(e){return tv(e.uid,t)})),ui())},nv=Object.freeze({__proto__:null,generate:Fp,generateOne:jp,schemas:Wp,names:qp,substitutes:$p,components:Gp,defaultUids:tv,defaultUidsSchema:ev,getAllParts:Jp,getAllPartNames:Qp,getPart:Kp,getPartOrDie:Xp,getParts:Yp,getPartsOrDie:Zp}),rv=function(t,e){var n=t.length>0?[Hi("parts",t)]:[];return n.concat([Ai("uid"),Ki("dom",{}),Ki("components",[]),dl("originalSpec"),Ki("debug.sketcher",{})]).concat(e)},ov=function(t,e,n,r,o){var i=rv(r,o);return Ci(t+" [SpecSchema]",Zo(i.concat(e)),n)},iv=function(t,e,n,r){var o=cv(r),i=ov(t,e,o,[],[]);return n(i,o)},uv=function(t,e,n,r,o){var i=cv(o),u=Wp(n),a=ev(n),c=ov(t,e,i,u,[a]),s=$p(t,c,n),l=Gp(t,c,s.internals());return r(c,l,i,s.externals())},av=function(t){return Et(t,"uid")},cv=function(t){return av(t)?t:A(A({},t),{uid:dc("uid")})},sv=function(t){return void 0!==t.uid},lv=Zo([Ai("name"),Ai("factory"),Ai("configFields"),Ki("apis",{}),Ki("extraApis",{})]),fv=Zo([Ai("name"),Ai("factory"),Ai("configFields"),Ai("partFields"),Ki("apis",{}),Ki("extraApis",{})]),dv=function(t){var e=Ci("Sketcher for "+t.name,lv,t),n=function(t){return iv(e.name,e.configFields,e.factory,t)},r=bt(e.apis,Sc),o=bt(e.extraApis,(function(t,e){return bc(t,e)}));return A(A({name:e.name,configFields:e.configFields,sketch:n},r),o)},mv=function(t){var e=Ci("Sketcher for "+t.name,fv,t),n=function(t){return uv(e.name,e.configFields,e.partFields,e.factory,t)},r=Fp(e.name,e.partFields),o=bt(e.apis,Sc),i=bt(e.extraApis,(function(t,e){return bc(t,e)}));return A(A({name:e.name,partFields:e.partFields,configFields:e.configFields,sketch:n,parts:r},o),i)},gv=function(t){return"input"===ae(t)&&"radio"!==Un(t,"type")||"textarea"===ae(t)},hv=function(t,e,n){return e.find(t)},pv=Object.freeze({__proto__:null,getCurrent:hv}),vv=[Ai("find")],bv=hf({fields:vv,name:"composing",apis:pv}),yv=["input","button","textarea","select"],wv=function(t,e,n){var r=e.disabled()?_v:Av;r(t,e)},xv=function(t,e){return!0===e.useNative&&U(yv,ae(t.element))},Cv=function(t){return Wn(t.element,"disabled")},Sv=function(t){Vn(t.element,"disabled","disabled")},kv=function(t){qn(t.element,"disabled")},Tv=function(t){return"true"===Un(t.element,"aria-disabled")},Ov=function(t){Vn(t.element,"aria-disabled","true")},Ev=function(t){Vn(t.element,"aria-disabled","false")},_v=function(t,e,n){e.disableClass.each((function(e){is(t.element,e)}));var r=xv(t,e)?Sv:Ov;r(t),e.onDisabled(t)},Av=function(t,e,n){e.disableClass.each((function(e){as(t.element,e)}));var r=xv(t,e)?kv:Ev;r(t),e.onEnabled(t)},Dv=function(t,e){return xv(t,e)?Cv(t):Tv(t)},Mv=function(t,e,n,r){var o=r?_v:Av;o(t,e)},zv=Object.freeze({__proto__:null,enable:Av,disable:_v,isDisabled:Dv,onLoad:wv,set:Mv}),Rv=function(t,e){return Dc({classes:e.disabled()?e.disableClass.toArray():[]})},Nv=function(t,e){return _a([Aa(ea(),(function(e,n){return Dv(e,t)})),af(t,e,wv)])},Bv=Object.freeze({__proto__:null,exhibit:Rv,events:Nv}),Lv=[tu("disabled",O),Ki("useNative",!0),Vi("disableClass"),al("onDisabled"),al("onEnabled")],Hv=hf({fields:Lv,name:"disabling",active:Bv,apis:zv}),Iv=function(t,e,n,r){var o=Xm(t.element,"."+e.highlightClass);G(o,(function(n){j(r,(function(t){return t.element===n}))||(as(n,e.highlightClass),t.getSystem().getByDom(n).each((function(n){e.onDehighlight(t,n),Ca(n,xa())})))}))},Pv=function(t,e,n){return Iv(t,e,n,[])},Vv=function(t,e,n,r){$v(t,e,n,r)&&(as(r.element,e.highlightClass),e.onDehighlight(t,r),Ca(r,xa()))},Fv=function(t,e,n,r){Iv(t,e,n,[r]),$v(t,e,n,r)||(is(r.element,e.highlightClass),e.onHighlight(t,r),Ca(r,wa()))},Uv=function(t,e,n){Xv(t,e).each((function(r){Fv(t,e,n,r)}))},jv=function(t,e,n){Yv(t,e).each((function(r){Fv(t,e,n,r)}))},Wv=function(t,e,n,r){Kv(t,e,n,r).fold((function(t){throw t}),(function(r){Fv(t,e,n,r)}))},qv=function(t,e,n,r){var o=tb(t,e),i=tt(o,r);i.each((function(r){Fv(t,e,n,r)}))},$v=function(t,e,n,r){return cs(r.element,e.highlightClass)},Gv=function(t,e,n){return Is(t.element,"."+e.highlightClass).bind((function(e){return t.getSystem().getByDom(e).toOptional()}))},Kv=function(t,e,n,r){var o=Xm(t.element,"."+e.itemClass);return L.from(o[r]).fold((function(){return ro.error(new Error("No element found with index "+r))}),t.getSystem().getByDom)},Xv=function(t,e,n){return Is(t.element,"."+e.itemClass).bind((function(e){return t.getSystem().getByDom(e).toOptional()}))},Yv=function(t,e,n){var r=Xm(t.element,"."+e.itemClass),o=r.length>0?L.some(r[r.length-1]):L.none();return o.bind((function(e){return t.getSystem().getByDom(e).toOptional()}))},Jv=function(t,e,n,r){var o=Xm(t.element,"."+e.itemClass),i=et(o,(function(t){return cs(t,e.highlightClass)}));return i.bind((function(e){var n=El(e,r,0,o.length-1);return t.getSystem().getByDom(o[n]).toOptional()}))},Qv=function(t,e,n){return Jv(t,e,n,-1)},Zv=function(t,e,n){return Jv(t,e,n,1)},tb=function(t,e,n){var r=Xm(t.element,"."+e.itemClass);return Mt($(r,(function(e){return t.getSystem().getByDom(e).toOptional()})))},eb=Object.freeze({__proto__:null,dehighlightAll:Pv,dehighlight:Vv,highlight:Fv,highlightFirst:Uv,highlightLast:jv,highlightAt:Wv,highlightBy:qv,isHighlighted:$v,getHighlighted:Gv,getFirst:Xv,getLast:Yv,getPrevious:Qv,getNext:Zv,getCandidates:tb}),nb=[Ai("highlightClass"),Ai("itemClass"),al("onHighlight"),al("onDehighlight")],rb=hf({fields:nb,name:"highlighting",apis:eb}),ob=[8],ib=[9],ub=[13],ab=[27],cb=[32],sb=[37],lb=[38],fb=[39],db=[40],mb=function(t,e,n){var r=it(t.slice(0,e)),o=it(t.slice(e+1));return tt(r.concat(o),n)},gb=function(t,e,n){var r=it(t.slice(0,e));return tt(r,n)},hb=function(t,e,n){var r=t.slice(0,e),o=t.slice(e+1);return tt(o.concat(r),n)},pb=function(t,e,n){var r=t.slice(e+1);return tt(r,n)},vb=function(t){return function(e){var n=e.raw;return U(t,n.which)}},bb=function(t){return function(e){return ot(t,(function(t){return t(e)}))}},yb=function(t){var e=t.raw;return!0===e.shiftKey},wb=function(t){var e=t.raw;return!0===e.ctrlKey},xb=k(yb),Cb=function(t,e){return{matches:t,classification:e}},Sb=function(t,e){var n=tt(t,(function(t){return t.matches(e)}));return n.map((function(t){return t.classification}))},kb=function(t,e,n){var r=e.exists((function(t){return n.exists((function(e){return sn(e,t)}))}));r||Sa(t,pa(),{prevFocus:e,newFocus:n})},Tb=function(){var t=function(t){return Ef(t.element)},e=function(e,n){var r=t(e);e.getSystem().triggerFocus(n,e.element);var o=t(e);kb(e,r,o)};return{get:t,set:e}},Ob=function(){var t=function(t){return rb.getHighlighted(t).map((function(t){return t.element}))},e=function(e,n){var r=t(e);e.getSystem().getByDom(n).fold(p,(function(t){rb.highlight(e,t)}));var o=t(e);kb(e,r,o)};return{get:t,set:e}};(function(t){t["OnFocusMode"]="onFocus",t["OnEnterOrSpaceMode"]="onEnterOrSpace",t["OnApiMode"]="onApi"})(Im||(Im={}));var Eb=function(t,e,n,r,o){var i=function(){return t.concat([Ki("focusManager",Tb()),Xi("focusInside","onFocus",vi((function(t){return U(["onFocus","onEnterOrSpace","onApi"],t)?ro.value(t):ro.error("Invalid value for focusInside")}))),fl("handler",c),fl("state",e),fl("sendFocusIn",o)])},u=function(t,e,n,r,o){var i=n(t,e,r,o);return Sb(i,e.event).bind((function(n){return n(t,e,r,o)}))},a=function(t,e){var i=t.focusInside!==Im.OnFocusMode?L.none():o(t).map((function(n){return za(Ju(),(function(r,o){n(r,t,e),o.stop()}))})),a=function(n,r){var i=vb(cb.concat(ub))(r.event);t.focusInside===Im.OnEnterOrSpaceMode&&i&&xu(n,r)&&o(t).each((function(o){o(n,t,e),r.stop()}))},c=[za(Vu(),(function(r,o){u(r,o,n,t,e).fold((function(){a(r,o)}),(function(t){o.stop()}))})),za(Fu(),(function(n,o){u(n,o,r,t,e).each((function(t){o.stop()}))}))];return _a(i.toArray().concat(c))},c={schema:i,processKey:u,toEvents:a};return c},_b=function(t){var e=[Vi("onEscape"),Vi("onEnter"),Ki("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Ki("firstTabstop",0),Ki("useTabstopAt",E),Vi("visibilitySelector")].concat([t]),n=function(t,e){var n=t.visibilitySelector.bind((function(t){return Ps(e,t)})).getOr(e);return ur(n)>0},r=function(t,e){var r=Xm(t.element,e.selector),o=Y(r,(function(t){return n(e,t)}));return L.from(o[e.firstTabstop])},o=function(t,e){return e.focusManager.get(t).bind((function(t){return Ps(t,e.selector)}))},i=function(t,e){return n(t,e)&&t.useTabstopAt(e)},u=function(t,e,n){r(t,e).each((function(n){e.focusManager.set(t,n)}))},a=function(t,e,n,r,o){return o(e,n,(function(t){return i(r,t)})).fold((function(){return r.cyclic?L.some(!0):L.none()}),(function(e){return r.focusManager.set(t,e),L.some(!0)}))},c=function(t,e,n,r){var i=Xm(t.element,n.selector);return o(t,n).bind((function(e){var o=et(i,S(sn,e));return o.bind((function(e){return a(t,i,e,n,r)}))}))},s=function(t,e,n){var r=n.cyclic?mb:gb;return c(t,e,n,r)},l=function(t,e,n){var r=n.cyclic?hb:pb;return c(t,e,n,r)},f=function(t,e,n){return n.onEnter.bind((function(n){return n(t,e)}))},d=function(t,e,n){return n.onEscape.bind((function(n){return n(t,e)}))},m=w([Cb(bb([yb,vb(ib)]),s),Cb(vb(ib),l),Cb(vb(ab),d),Cb(bb([xb,vb(ub)]),f)]),g=w([]);return Eb(e,kc.init,m,g,(function(){return L.some(u)}))},Ab=_b(Ei("cyclic",O)),Db=_b(Ei("cyclic",E)),Mb=function(t,e,n){return Ta(t,n,ea()),L.some(!0)},zb=function(t,e,n){var r=gv(n)&&vb(cb)(e.event);return r?L.none():Mb(t,e,n)},Rb=function(t,e){return L.some(!0)},Nb=[Ki("execute",zb),Ki("useSpace",!1),Ki("useEnter",!0),Ki("useControlEnter",!1),Ki("useDown",!1)],Bb=function(t,e,n){return n.execute(t,e,t.element)},Lb=function(t,e,n,r){var o=n.useSpace&&!gv(t.element)?cb:[],i=n.useEnter?ub:[],u=n.useDown?db:[],a=o.concat(i).concat(u);return[Cb(vb(a),Bb)].concat(n.useControlEnter?[Cb(bb([wb,vb(ub)]),Bb)]:[])},Hb=function(t,e,n,r){return n.useSpace&&!gv(t.element)?[Cb(vb(cb),Rb)]:[]},Ib=Eb(Nb,kc.init,Lb,Hb,(function(){return L.none()})),Pb=function(){var t=od(),e=function(e,n){t.set({numRows:e,numColumns:n})},n=function(){return t.get().map((function(t){return t.numRows}))},r=function(){return t.get().map((function(t){return t.numColumns}))};return Tc({readState:function(){return t.get().map((function(t){return{numRows:String(t.numRows),numColumns:String(t.numColumns)}})).getOr({numRows:"?",numColumns:"?"})},setGridSize:e,getNumRows:n,getNumColumns:r})},Vb=function(t){return t.state(t)},Fb=Object.freeze({__proto__:null,flatgrid:Pb,init:Vb}),Ub=function(t){return function(e,n,r,o){var i=t(e.element);return $b(i,e,n,r,o)}},jb=function(t,e){var n=Bd(t,e);return Ub(n)},Wb=function(t,e){var n=Bd(e,t);return Ub(n)},qb=function(t){return function(e,n,r,o){return $b(t,e,n,r,o)}},$b=function(t,e,n,r,o){var i=r.focusManager.get(e).bind((function(n){return t(e.element,n,r,o)}));return i.map((function(t){return r.focusManager.set(e,t),!0}))},Gb=qb,Kb=qb,Xb=qb,Yb=function(t){return t.offsetWidth<=0&&t.offsetHeight<=0},Jb=function(t){return!Yb(t.dom)},Qb=function(t,e){return et(t,e).map((function(e){return{index:e,candidates:t}}))},Zb=function(t,e,n){var r=function(t){return sn(t,e)},o=Xm(t,n),i=Y(o,Jb);return Qb(i,r)},ty=function(t,e){return et(t,(function(t){return sn(e,t)}))},ey=function(t,e,n,r){var o=Math.floor(e/n),i=e%n;return r(o,i).bind((function(e){var r=e.row*n+e.column;return r>=0&&r1?L.some(t.slice(1)):L.none()}))},g=function(t){return Ot(n.get(),t)},h=function(t){return p(t).bind(qx)},p=function(t){return Ot(e.get(),t)},v=function(e){return Ot(t.get(),e)},b=function(t){var e=o.get();return ut(ht(e),t)},y=function(){return r.get().bind(h)},w=function(){return e.get()};return{setMenuBuilt:a,setContents:c,expand:d,refresh:g,collapse:m,lookupMenu:p,lookupItem:v,otherMenus:b,getPrimary:y,getMenus:w,clear:i,isClear:u,getTriggeringPath:f}},qx=function(t){return"prepared"===t.type?L.some(t.menu):L.none()},$x={init:Wx,extractPreparedMenu:qx},Gx=function(t,e){var n,r=od(),o=function(e,n,r){return bt(r,(function(r,o){var i=function(){return Vx.sketch(A(A({},r),{value:o,markers:t.markers,fakeFocus:t.fakeFocus,onHighlight:t.onHighlight,focusManager:t.fakeFocus?Ob():Tb()}))};return o===n?{type:"prepared",menu:e.getSystem().build(i())}:{type:"notbuilt",nbMenu:i}}))},i=$x.init(),u=function(e){var n=o(e,t.data.primary,t.data.menus),r=s();return i.setContents(t.data.primary,n,t.data.expansions,r),i.getPrimary()},a=function(t){return tp.getValue(t).value},c=function(t,e,n){return gt(e,(function(t){if(!t.getSystem().isConnected())return L.none();var e=rb.getCandidates(t);return tt(e,(function(t){return a(t)===n}))}))},s=function(e){return bt(t.data.menus,(function(t,e){return rt(t.items,(function(t){return"separator"===t.type?[]:[t.data.value]}))}))},l=function(t,e){rb.highlight(t,e),rb.getHighlighted(e).orThunk((function(){return rb.getFirst(e)})).each((function(e){Ta(t,e.element,na())}))},f=function(t,e){return Mt($(e,(function(e){return t.lookupMenu(e).bind((function(t){return"prepared"===t.type?L.some(t.menu):L.none()}))})))},d=function(e,n,r){var o=f(n,n.otherMenus(r));G(o,(function(n){ls(n.element,[t.markers.backgroundMenu]),t.stayInDom||Pw.remove(e,n)}))},m=function(e){return r.get().getOrThunk((function(){var n={},o=Xm(e.element,"."+t.markers.item),i=Y(o,(function(t){return"true"===Un(t,"aria-haspopup")}));return G(i,(function(t){e.getSystem().getByDom(t).each((function(t){var e=a(t);n[e]=t}))})),r.set(n),n}))},g=function(t,e){var n=m(t);vt(n,(function(t,n){var r=U(e,n);Vn(t.element,"aria-expanded",r)}))},h=function(e,n,r){return L.from(r[0]).bind((function(o){return n.lookupMenu(o).bind((function(o){if("notbuilt"===o.type)return L.none();var i=o.menu,u=f(n,r.slice(1));return G(u,(function(e){is(e.element,t.markers.backgroundMenu)})),Ln(i.element)||Pw.append(e,_s(i)),ls(i.element,[t.markers.backgroundMenu]),l(e,i),d(e,n,r),L.some(i)}))}))};(function(t){t[t["HighlightSubmenu"]=0]="HighlightSubmenu",t[t["HighlightParent"]=1]="HighlightParent"})(n||(n={}));var v=function(t,e,n){if("notbuilt"===n.type){var r=t.getSystem().build(n.nbMenu());return i.setMenuBuilt(e,r),r}return n.menu},b=function(e,r,o){if(void 0===o&&(o=n.HighlightSubmenu),r.hasConfigured(Hv)&&Hv.isDisabled(r))return L.some(r);var u=a(r);return i.expand(u).bind((function(u){return g(e,u),L.from(u[0]).bind((function(a){return i.lookupMenu(a).bind((function(c){var s=v(e,a,c);return Ln(s.element)||Pw.append(e,_s(s)),t.onOpenSubmenu(e,r,s,it(u)),o===n.HighlightSubmenu?(rb.highlightFirst(s),h(e,i,u)):(rb.dehighlightAll(s),L.some(r))}))}))}))},y=function(e,n){var r=a(n);return i.collapse(r).bind((function(r){return g(e,r),h(e,i,r).map((function(r){return t.onCollapseMenu(e,n,r),r}))}))},w=function(t,e){var n=a(e);return i.refresh(n).bind((function(e){return g(t,e),h(t,i,e)}))},x=function(t,e){return gv(e.element)?L.none():b(t,e,n.HighlightSubmenu)},C=function(t,e){return gv(e.element)?L.none():y(t,e)},S=function(e,n){return y(e,n).orThunk((function(){return t.onEscape(e,n).map((function(){return e}))}))},k=function(e){return function(n,r){return Ps(r.getSource(),"."+t.markers.item).bind((function(t){return n.getSystem().getByDom(t).toOptional().bind((function(t){return e(n,t).map(E)}))}))}},T=_a([za(Ix(),(function(t,e){var n=e.event.item;i.lookupItem(a(n)).each((function(){var n=e.event.menu;rb.highlight(t,n);var r=a(e.event.item);i.refresh(r).each((function(e){return d(t,i,e)}))}))})),qa((function(e,r){var o=r.event.target;e.getSystem().getByDom(o).each((function(r){var o=a(r);0===o.indexOf("collapse-item")&&y(e,r),b(e,r,n.HighlightSubmenu).fold((function(){t.onExecute(e,r)}),p)}))})),Ua((function(e,n){u(e).each((function(n){Pw.append(e,_s(n)),t.onOpenMenu(e,n),t.highlightImmediately&&l(e,n)}))}))].concat(t.navigateOnHover?[za(Cx(),(function(e,r){var o=r.event.item;w(e,o),b(e,o,n.HighlightParent),t.onHover(e,o)}))]:[])),O=function(t){return rb.getHighlighted(t).bind(rb.getHighlighted)},_=function(t){O(t).each((function(e){y(t,e)}))},D=function(t){i.getPrimary().each((function(e){l(t,e)}))},M=function(t){return L.from(t.components()[0]).filter((function(t){return"menu"===Un(t.element,"role")}))},z=function(e){var n=i.getPrimary().bind((function(t){return O(e).bind((function(t){var n=a(t),r=Tt(i.getMenus()),o=Mt($(r,$x.extractPreparedMenu));return i.getTriggeringPath(n,(function(t){return c(e,o,t)}))})).map((function(e){return{primary:t,triggeringPath:e}}))}));n.fold((function(){M(e).each((function(n){t.onRepositionMenu(e,n,[])}))}),(function(n){var r=n.primary,o=n.triggeringPath;t.onRepositionMenu(e,r,o)}))},R={collapseMenu:_,highlightPrimary:D,repositionMenus:z};return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:rp(t.tmenuBehaviours,[Aw.config({mode:"special",onRight:k(x),onLeft:k(C),onEscape:k(S),focusIn:function(t,e){i.getPrimary().each((function(e){Ta(t,e.element,na())}))}}),rb.config({highlightClass:t.markers.selectedMenu,itemClass:t.markers.menu}),bv.config({find:function(t){return rb.getHighlighted(t)}}),Pw.config({})]),eventOrder:t.eventOrder,apis:R,events:T}},Kx=w("collapse-item"),Xx=function(t,e,n){return{primary:t,menus:e,expansions:n}},Yx=function(t,e){return{primary:t,menus:mu(t,e),expansions:{}}},Jx=function(t){return{value:oc(Kx()),meta:{text:t}}},Qx=dv({name:"TieredMenu",configFields:[ll("onExecute"),ll("onEscape"),sl("onOpenMenu"),sl("onOpenSubmenu"),al("onRepositionMenu"),al("onCollapseMenu"),Ki("highlightImmediately",!0),Hi("data",[Ai("primary"),Ai("menus"),Ai("expansions")]),Ki("fakeFocus",!1),al("onHighlight"),al("onHover"),ol(),Ai("dom"),Ki("navigateOnHover",!0),Ki("stayInDom",!1),ep("tmenuBehaviours",[Aw,rb,bv,Pw]),Ki("eventOrder",{})],apis:{collapseMenu:function(t,e){t.collapseMenu(e)},highlightPrimary:function(t,e){t.highlightPrimary(e)},repositionMenus:function(t,e){t.repositionMenus(e)}},factory:Gx,extraApis:{tieredData:Xx,singleData:Yx,collapseItem:Jx}}),Zx=function(t,e,n,r,o){var i=function(){return t.lazySink(e)},u="horizontal"===r.type?{layouts:{onLtr:function(){return Zl()},onRtl:function(){return tf()}}}:{},a=function(t){return 2===t.length},c=function(t){return a(t)?u:{}};return Qx.sketch({dom:{tag:"div"},data:r.data,markers:r.menu.markers,highlightImmediately:r.menu.highlightImmediately,onEscape:function(){return bh.close(e),t.onEscape.map((function(t){return t(e)})),L.some(!0)},onExecute:function(){return L.some(!0)},onOpenMenu:function(t,e){Ig.positionWithinBounds(i().getOrDie(),e,n,o())},onOpenSubmenu:function(t,e,n,r){var o=i().getOrDie();Ig.position(o,n,{anchor:A({type:"submenu",item:e},c(r))})},onRepositionMenu:function(t,e,r){var u=i().getOrDie();Ig.positionWithinBounds(u,e,n,o()),G(r,(function(t){var e=c(t.triggeringPath);Ig.position(u,t.triggeredMenu,{anchor:A({type:"submenu",item:t.triggeringItem},e)})}))}})},tC=function(t,e){var n=function(e,n){var r=t.getRelated(e);return r.exists((function(t){return js(t,n)}))},r=function(t,e){bh.setContent(t,e)},o=function(t,e,n){i(t,e,n,L.none())},i=function(t,e,n,r){u(t,e,n,(function(){return r.map((function(t){return Jr(t)}))}))},u=function(e,n,r,o){var i=t.lazySink(e).getOrDie();bh.openWhileCloaked(e,n,(function(){return Ig.positionWithinBounds(i,e,r,o())})),tp.setValue(e,L.some({mode:"position",config:r,getBounds:o}))},a=function(t,e,n){c(t,e,n,L.none)},c=function(e,n,r,o){var i=Zx(t,e,n,r,o);bh.open(e,i),tp.setValue(e,L.some({mode:"menu",menu:i}))},s=function(t){bh.isOpen(t)&&(tp.setValue(t,L.none()),bh.close(t))},l=function(t){return bh.getState(t)},f=function(e){bh.isOpen(e)&&tp.getValue(e).each((function(n){switch(n.mode){case"menu":bh.getState(e).each(Qx.repositionMenus);break;case"position":var r=t.lazySink(e).getOrDie();Ig.positionWithinBounds(r,e,n.config,n.getBounds());break}}))},d={setContent:r,showAt:o,showWithin:i,showWithinBounds:u,showMenuAt:a,showMenuWithinBounds:c,hide:s,getContent:l,reposition:f,isOpen:bh.isOpen};return{uid:t.uid,dom:t.dom,behaviours:rp(t.inlineBehaviours,[bh.config({isPartOf:function(t,e,r){return js(e,r)||n(t,r)},getAttachPoint:function(e){return t.lazySink(e).getOrDie()},onOpen:function(e){t.onShow(e)},onClose:function(e){t.onHide(e)}}),tp.config({store:{mode:"memory",initialValue:L.none()}}),yf.config({channels:A(A({},Sh(A({isExtraPart:e.isExtraPart},t.fireDismissalEventInstead.map((function(t){return{fireEventInstead:{event:t.event}}})).getOr({})))),Th(A(A({},t.fireRepositionEventInstead.map((function(t){return{fireEventInstead:{event:t.event}}})).getOr({})),{doReposition:f})))})]),eventOrder:t.eventOrder,apis:d}},eC=dv({name:"InlineView",configFields:[Ai("lazySink"),al("onShow"),al("onHide"),Wi("onEscape"),ep("inlineBehaviours",[bh,tp,yf]),$i("fireDismissalEventInstead",[Ki("event",ga())]),$i("fireRepositionEventInstead",[Ki("event",ha())]),Ki("getRelated",L.none),Ki("isExtraPart",O),Ki("eventOrder",L.none)],factory:tC,apis:{showAt:function(t,e,n,r){t.showAt(e,n,r)},showWithin:function(t,e,n,r,o){t.showWithin(e,n,r,o)},showWithinBounds:function(t,e,n,r,o){t.showWithinBounds(e,n,r,o)},showMenuAt:function(t,e,n,r){t.showMenuAt(e,n,r)},showMenuWithinBounds:function(t,e,n,r,o){t.showMenuWithinBounds(e,n,r,o)},hide:function(t,e){t.hide(e)},isOpen:function(t,e){return t.isOpen(e)},getContent:function(t,e){return t.getContent(e)},setContent:function(t,e,n){t.setContent(e,n)},reposition:function(t,e){t.reposition(e)}}}),nC="layout-inset",rC=function(t){return t.x},oC=function(t,e){return t.x+t.width/2-e.width/2},iC=function(t,e){return t.x+t.width-e.width},uC=function(t){return t.y},aC=function(t,e){return t.y+t.height-e.height},cC=function(t,e){return t.y+t.height/2-e.height/2},sC=function(t,e,n){return gl(iC(t,e),aC(t,e),n.insetSouthwest(),Cl(),"southwest",Dl(t,{right:0,bottom:3}),nC)},lC=function(t,e,n){return gl(rC(t),aC(t,e),n.insetSoutheast(),xl(),"southeast",Dl(t,{left:1,bottom:3}),nC)},fC=function(t,e,n){return gl(iC(t,e),uC(t),n.insetNorthwest(),wl(),"northwest",Dl(t,{right:0,top:2}),nC)},dC=function(t,e,n){return gl(rC(t),uC(t),n.insetNortheast(),yl(),"northeast",Dl(t,{left:1,top:2}),nC)},mC=function(t,e,n){return gl(oC(t,e),uC(t),n.insetNorth(),Sl(),"north",Dl(t,{top:2}),nC)},gC=function(t,e,n){return gl(oC(t,e),aC(t,e),n.insetSouth(),kl(),"south",Dl(t,{bottom:3}),nC)},hC=function(t,e,n){return gl(iC(t,e),cC(t,e),n.insetEast(),Ol(),"east",Dl(t,{right:0}),nC)},pC=function(t,e,n){return gl(rC(t),cC(t,e),n.insetWest(),Tl(),"west",Dl(t,{left:1}),nC)},vC=function(t){switch(t){case"north":return mC;case"northeast":return dC;case"northwest":return fC;case"south":return gC;case"southeast":return lC;case"southwest":return sC;case"east":return hC;case"west":return pC}},bC=function(t,e,n,r,o){var i=$f(r).map(vC).getOr(mC);return i(t,e,n,r,o)},yC=function(t){switch(t){case"north":return gC;case"northeast":return lC;case"northwest":return sC;case"south":return mC;case"southeast":return dC;case"southwest":return fC;case"east":return pC;case"west":return hC}},wC=function(t,e,n,r,o){var i=$f(r).map(yC).getOr(mC);return i(t,e,n,r,o)},xC=tinymce.util.Tools.resolve("tinymce.util.Delay"),CC=function(t){var e=vx(t.action),n=t.dom.tag,r=function(e){return Ot(t.dom,"attributes").bind((function(t){return Ot(t,e)}))},o=function(){if("button"===n){var t=r("type").getOr("button"),e=r("role").map((function(t){return{role:t}})).getOr({});return A({type:t},e)}var o=r("role").getOr("button");return{role:o}};return{uid:t.uid,dom:t.dom,components:t.components,events:e,behaviours:op.augment(t.buttonBehaviours,[Yw.config({}),Aw.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:o()},eventOrder:t.eventOrder}},SC=dv({name:"Button",factory:CC,configFields:[Ki("uid",void 0),Ai("dom"),Ki("components",[]),op.field("buttonBehaviours",[Yw,Aw]),Vi("action"),Vi("role"),Ki("eventOrder",{})]}),kC=function(t){var e=sv(t)&&_t(t,"uid")?t.uid:dc("memento"),n=function(t){return t.getSystem().getByUid(e).getOrDie()},r=function(t){return t.getSystem().getByUid(e).toOptional()},o=function(){return A(A({},t),{uid:e})};return{get:n,getOpt:r,asSpec:o}},TC=tinymce.util.Tools.resolve("tinymce.util.I18n"),OC={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},EC="temporary-placeholder",_C=function(t){return function(){return Ot(t,EC).getOr("!not found!")}},AC=function(t,e){var n=t.toLowerCase();if(TC.isRtl()){var r=Ft(n,"-rtl");return Et(e,r)?r:n}return n},DC=function(t,e){return Ot(e,AC(t,e))},MC=function(t,e){var n=e();return DC(t,n).getOrThunk(_C(n))},zC=function(t,e,n){var r=e();return DC(t,r).or(n).getOrThunk(_C(r))},RC=function(t){return!!TC.isRtl()&&Et(OC,t)},NC=function(){return Fw("add-focusable",[Ua((function(t){Hs(t.element,"svg").each((function(t){return Vn(t,"focusable","false")}))}))])},BC=function(t,e,n,r){var o,i,u=RC(e)?["tox-icon--flip"]:[],a=Ot(n,AC(e,n)).or(r).getOrThunk(_C(n));return{dom:{tag:t.tag,attributes:null!==(o=t.attributes)&&void 0!==o?o:{},classes:t.classes.concat(u),innerHtml:a},behaviours:mf(M(M([],null!==(i=t.behaviours)&&void 0!==i?i:[],!0),[NC()],!1))}},LC=function(t,e,n,r){return void 0===r&&(r=L.none()),BC(e,t,n(),r)},HC=function(t,e,n){var r=n(),o=tt(t,(function(t){return Et(r,AC(t,r))}));return BC(e,o.getOr(EC),r,L.none())},IC={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},PC=function(t){var e=kC({dom:{tag:"p",innerHtml:t.translationProvider(t.text)},behaviours:mf([Pw.config({})])}),n=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+"%"}}},o=kC({dom:{tag:"div",classes:t.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},r(0)],behaviours:mf([Pw.config({})])}),i=function(t,e){t.getSystem().isConnected()&&o.getOpt(t).each((function(t){Pw.set(t,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(e)]},r(e)])}))},u=function(t,n){if(t.getSystem().isConnected()){var r=e.get(t);Pw.set(r,[Ss(n)])}},a={updateProgress:i,updateText:u},c=nt([t.icon.toArray(),t.level.toArray(),t.level.bind((function(t){return L.from(IC[t])})).toArray()]),s=kC(SC.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[LC("close",{tag:"div",classes:["tox-icon"],attributes:{"aria-label":t.translationProvider("Close")}},t.iconProvider)],action:function(e){t.onAction(e)}})),l=HC(c,{tag:"div",classes:["tox-notification__icon"]},t.iconProvider),f={dom:{tag:"div",classes:["tox-notification__body"]},components:[e.asSpec()],behaviours:mf([Pw.config({})])},d=[l,f];return{uid:t.uid,dom:{tag:"div",attributes:{role:"alert"},classes:t.level.map((function(t){return["tox-notification","tox-notification--in","tox-notification--"+t]})).getOr(["tox-notification","tox-notification--in"])},behaviours:mf([Yw.config({}),Fw("notification-events",[za(Iu(),(function(t){s.getOpt(t).each(Yw.focus)}))])]),components:d.concat(t.progress?[o.asSpec()]:[]).concat(t.closeButton?[s.asSpec()]:[]),apis:a}},VC=dv({name:"Notification",factory:PC,configFields:[Vi("level"),Ai("progress"),Ai("icon"),Ai("onAction"),Ai("text"),Ai("iconProvider"),Ai("translationProvider"),Zi("closeButton",!0)],apis:{updateProgress:function(t,e,n){t.updateProgress(e,n)},updateText:function(t,e,n){t.updateText(e,n)}}});function FC(t,e,n){var r=e.backstage.shared,o=function(t){switch(t){case"bc-bc":return gC;case"tc-tc":return mC;case"tc-bc":return ql;case"bc-tc":default:return $l}},i=function(t){t.length>0&&G(t,(function(e,n){0===n?e.moveRel(null,"banner"):e.moveRel(t[n-1].getEl(),"bc-tc")}))},u=function(e,i){var u=!e.closeButton&&e.timeout&&(e.timeout>0||e.timeout<0),a=function(){i(),eC.hide(s)},c=Es(VC.sketch({text:e.text,level:U(["success","error","warning","warn","info"],e.type)?e.type:void 0,progress:!0===e.progressBar,icon:L.from(e.icon),closeButton:!u,onAction:a,iconProvider:r.providers.icons,translationProvider:r.providers.translate})),s=Es(eC.sketch(A({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:r.getSink,fireDismissalEventInstead:{}},r.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}})));n.add(s),e.timeout>0&&xC.setTimeout((function(){a()}),e.timeout);var l=function(){var e=Jr(ee.fromDom(t.getContentAreaContainer())),n=Zr(),r=_l(n.x,e.x,e.right),o=_l(n.y,e.y,e.bottom),i=Math.max(e.right,n.right),u=Math.max(e.bottom,n.bottom);return L.some(Yr(r,o,i-r,u-o))};return{close:a,moveTo:function(t,e){eC.showAt(s,_s(c),{anchor:{type:"makeshift",x:t,y:e}})},moveRel:function(t,e){var n=_s(c),i={maxHeightFunction:Ed()};if("banner"!==e&&d(t)){var u=o(e),a={type:"node",root:Hn(),node:L.some(ee.fromDom(t)),overrides:i,layouts:{onRtl:function(){return[u]},onLtr:function(){return[u]}}};eC.showWithinBounds(s,n,{anchor:a},l)}else{var f=A(A({},r.anchors.banner()),{overrides:i});eC.showWithinBounds(s,n,{anchor:f},l)}},text:function(t){VC.updateText(c,t)},settings:e,getEl:function(){return c.element.dom},progressBar:{value:function(t){VC.updateProgress(c,t)}}}},a=function(t){t.close()},c=function(t){return t.settings};return{open:u,close:a,reposition:i,getArgs:c}}var UC,jC=function(t,e){var n=null,r=function(){c(n)||(clearTimeout(n),n=null)},o=function(){for(var r=[],o=0;o',t.getDoc());return Dr(n,ee.fromDom(e.extractContents())),e.insertNode(n.dom),vn(n).each((function(t){return t.dom.normalize()})),Gm(n).map((function(e){t.selection.setCursorLocation(e.dom,jm(e))})),n}))},YC=function(t){return Ps(t,KC)},JC=function(t){return t.collapsed&&3===t.startContainer.nodeType},QC=function(t){return t.toString().replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},ZC=function(t){return""!==t&&-1!=="  \f\n\r\t\v".indexOf(t)},tS=function(t,e){return t.substring(e.length)},eS=function(t,e,n){var r;for(r=e-1;r>=0;r--){var o=t.charAt(r);if(ZC(o))return L.none();if(o===n)break}return L.some(r)},nS=function(t,e,n,r){if(void 0===r&&(r=0),!JC(e))return L.none();var o=function(t,e,r){return eS(r,e,n).getOr(e)},i=t.getParent(e.startContainer,t.isBlock)||t.getRoot();return GC(t,e.startContainer,e.startOffset,o,i).bind((function(t){var o=e.cloneRange();if(o.setStart(t.container,t.offset),o.setEnd(e.endContainer,e.endOffset),o.collapsed)return L.none();var i=QC(o),u=i.lastIndexOf(n);return 0!==u||tS(i,n).length0?lS(e[e.length-1]):aS(t,e.length)},fS=function(t,e){var n=t.childNodes;return n.length>0&&e0&&sS(t)&&n.length===e?lS(n[n.length-1]):aS(t,e)},dS=function(t,e){return GC(t,e.container,e.offset,(function(t,e){return 0===e?-1:e}),t.getRoot()).filter((function(t){var e=t.container.data.charAt(t.offset-1);return!ZC(e)})).isSome()},mS=function(t){return function(e){var n=fS(e.startContainer,e.startOffset);return!dS(t,n)}},gS=function(t,e,n){return gt(n.triggerChars,(function(n){return rS(t,e,n)}))},hS=function(t,e){var n=e(),r=t.selection.getRng();return gS(t.dom,r,n).bind((function(n){return pS(t,e,n)}))},pS=function(t,e,n,r){void 0===r&&(r={});var o=e(),i=t.selection.getRng(),u=i.startContainer.nodeValue,a=Y(o.lookupByChar(n.triggerChar),(function(e){return n.text.length>=e.minChars&&e.matches.getOrThunk((function(){return mS(t.dom)}))(n.range,u,n.text)}));if(0===a.length)return L.none();var c=uS.all($(a,(function(t){var e=t.fetch(n.text,t.maxResults,r);return e.then((function(e){return{matchText:n.text,items:e,columns:t.columns,onAction:t.onAction,highlightOn:t.highlightOn}}))})));return L.some({lookupData:c,context:n})},vS=ti([zi("type"),ji("text")]),bS=function(t){return wi("separatormenuitem",vS,t)},yS=ti([Ki("type","autocompleteitem"),Ki("active",!1),Ki("disabled",!1),Ki("meta",{}),zi("value"),ji("text"),ji("icon")]),wS=ti([zi("type"),zi("ch"),Yi("minChars",1),Ki("columns",1),Yi("maxResults",10),Wi("matches"),Bi("fetch"),Bi("onAction"),nu("highlightOn",[],si)]),xS=function(t){return wi("Autocompleter.Separator",vS,t)},CS=function(t){return wi("Autocompleter.Item",yS,t)},SS=function(t){return wi("Autocompleter",wS,t)},kS=[Zi("disabled",!1),ji("tooltip"),ji("icon"),ji("text"),tu("onSetup",(function(){return p}))],TS=ti([zi("type"),Bi("onAction")].concat(kS)),OS=function(t){return wi("toolbarbutton",TS,t)},ES=[Zi("active",!1)].concat(kS),_S=ti(ES.concat([zi("type"),Bi("onAction")])),AS=function(t){return wi("ToggleButton",_S,t)},DS=[tu("predicate",O),Qi("scope","node",["node","editor"]),Qi("position","selection",["node","selection","line"])],MS=kS.concat([Ki("type","contextformbutton"),Ki("primary",!1),Bi("onAction"),Ei("original",x)]),zS=ES.concat([Ki("type","contextformbutton"),Ki("primary",!1),Bi("onAction"),Ei("original",x)]),RS=kS.concat([Ki("type","contextformbutton")]),NS=ES.concat([Ki("type","contextformtogglebutton")]),BS=ki("type",{contextformbutton:MS,contextformtogglebutton:zS}),LS=ti([Ki("type","contextform"),tu("initValue",w("")),ji("label"),Pi("commands",BS),Fi("launch",ki("type",{contextformbutton:RS,contextformtogglebutton:NS}))].concat(DS)),HS=function(t){return wi("ContextForm",LS,t)},IS=ti([Ki("type","contexttoolbar"),zi("items")].concat(DS)),PS=function(t){return wi("ContextToolbar",IS,t)},VS=function(t){var e={};return G(t,(function(t){e[t]={}})),ht(e)},FS=function(t){var e=t.ui.registry.getAll().popups,n=bt(e,(function(t){return SS(t).fold((function(t){throw new Error(Si(t))}),x)})),r=VS(St(n,(function(t){return t.ch}))),o=Tt(n),i=function(t){return Y(o,(function(e){return e.ch===t}))};return{dataset:n,triggerChars:r,lookupByChar:i}};(function(t){t[t["CLOSE_ON_EXECUTE"]=0]="CLOSE_ON_EXECUTE",t[t["BUBBLE_TO_SANDBOX"]=1]="BUBBLE_TO_SANDBOX"})(UC||(UC={}));var US,jS=UC,WS="tox-menu-nav__js",qS="tox-collection__item",$S="tox-swatch",GS={normal:WS,color:$S},KS="tox-collection__item--enabled",XS="tox-collection__group-heading",YS="tox-collection__item-icon",JS="tox-collection__item-label",QS="tox-collection__item-accessory",ZS="tox-collection__item-caret",tk="tox-collection__item-checkmark",ek="tox-collection__item--active",nk="tox-collection__item-container",rk="tox-collection__item-container--column",ok="tox-collection__item-container--row",ik="tox-collection__item-container--align-right",uk="tox-collection__item-container--align-left",ak="tox-collection__item-container--valign-top",ck="tox-collection__item-container--valign-middle",sk="tox-collection__item-container--valign-bottom",lk=function(t){return Ot(GS,t).getOr(WS)},fk=function(t){return"color"===t?"tox-swatches":"tox-menu"},dk=function(t){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:fk(t),tieredMenu:"tox-tiered-menu"}},mk=function(t){var e=dk(t);return{backgroundMenu:e.backgroundMenu,selectedMenu:e.selectedMenu,menu:e.menu,selectedItem:e.selectedItem,item:lk(t)}},gk=function(t,e,n){var r=dk(n);return{tag:"div",classes:nt([[r.menu,"tox-menu-"+e+"-column"],t?[r.hasIcons]:[]])}},hk=[Vx.parts.items({})],pk=function(t,e,n){var r=dk(n),o={tag:"div",classes:nt([[r.tieredMenu]])};return{dom:o,markers:mk(n)}},vk=function(t,e){return function(n){var r=q(n,e);return $(r,(function(e){return{dom:t,components:e}}))}},bk=function(t){return{dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[Vx.parts.items({preprocess:"auto"!==t?vk({tag:"div",classes:["tox-swatches__row"]},t):x})]}]}},yk=function(t){return{dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[Vx.parts.items({preprocess:vk({tag:"div",classes:["tox-collection__group"]},t)})]}},wk=function(t,e){var n=[],r=[];return G(t,(function(t,o){e(t,o)?(r.length>0&&n.push(r),r=[],Et(t.dom,"innerHtml")&&r.push(t)):r.push(t)})),r.length>0&&n.push(r),$(n,(function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}))},xk=function(t,e,n){return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===t?["tox-collection--list"]:["tox-collection--grid"])},components:[Vx.parts.items({preprocess:function(n){return"auto"!==t&&t>1?vk({tag:"div",classes:["tox-collection__group"]},t)(n):wk(n,(function(t,n){return"separator"===e[n].type}))}})]}},Ck=function(t,e){return{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[Vx.parts.items({preprocess:function(e){return wk(e,(function(e,n){return"separator"===t[n].type}))}})]}},Sk=function(t){return j(t,(function(t){return"icon"in t&&void 0!==t.icon}))},kk=function(t){return console.error(Si(t)),console.log(t),L.none()},Tk=function(t,e,n,r,o){var i=Ck(n);return{value:t,dom:i.dom,components:i.components,items:n}},Ok=function(t,e,n,r,o){if("color"===o){var i=bk(r);return{value:t,dom:i.dom,components:i.components,items:n}}if("normal"===o&&"auto"===r){i=xk(r,n);return{value:t,dom:i.dom,components:i.components,items:n}}if("normal"===o&&1===r){i=xk(1,n);return{value:t,dom:i.dom,components:i.components,items:n}}if("normal"===o){i=xk(r,n);return{value:t,dom:i.dom,components:i.components,items:n}}if("listpreview"===o&&"auto"!==r){i=yk(r);return{value:t,dom:i.dom,components:i.components,items:n}}return{value:t,dom:gk(e,r,o),components:hk,items:n}},Ek=[zi("type"),zi("src"),ji("alt"),nu("classes",[],si)],_k=ti(Ek),Ak=[zi("type"),zi("text"),ji("name"),nu("classes",["tox-collection__item-label"],si)],Dk=ti(Ak),Mk=Jo((function(){return hi("type",{cardimage:_k,cardtext:Dk,cardcontainer:zk})})),zk=ti([zi("type"),Ji("direction","horizontal"),Ji("align","left"),Ji("valign","middle"),Pi("items",Mk)]),Rk=[Zi("disabled",!1),ji("text"),ji("shortcut"),Oi("value","value",To((function(){return oc("menuitem-value")})),ui()),Ki("meta",{})],Nk=ti([zi("type"),ji("label"),Pi("items",Mk),tu("onSetup",(function(){return p})),tu("onAction",p)].concat(Rk)),Bk=function(t){return wi("cardmenuitem",Nk,t)},Lk=ti([zi("type"),Zi("active",!1),ji("icon")].concat(Rk)),Hk=function(t){return wi("choicemenuitem",Lk,t)},Ik=[zi("type"),zi("fancytype"),tu("onAction",p)],Pk=[Ki("initData",{})].concat(Ik),Vk=[ru("initData",{},[Zi("allowCustomColors",!0),qi("colors",ui())])].concat(Ik),Fk=ki("fancytype",{inserttable:Pk,colorswatch:Vk}),Uk=function(t){return wi("fancymenuitem",Fk,t)},jk=ti([zi("type"),tu("onSetup",(function(){return p})),tu("onAction",p),ji("icon")].concat(Rk)),Wk=function(t){return wi("menuitem",jk,t)},qk=ti([zi("type"),Bi("getSubmenuItems"),tu("onSetup",(function(){return p})),ji("icon")].concat(Rk)),$k=function(t){return wi("nestedmenuitem",qk,t)},Gk=ti([zi("type"),ji("icon"),Zi("active",!1),tu("onSetup",(function(){return p})),Bi("onAction")].concat(Rk)),Kk=function(t){return wi("togglemenuitem",Gk,t)},Xk=function(t,e,n){var r=Xm(t.element,"."+n);if(r.length>0){var o=et(r,(function(t){var n=t.dom.getBoundingClientRect().top,o=r[0].dom.getBoundingClientRect().top;return Math.abs(n-o)>e})).getOr(r.length);return L.some({numColumns:o,numRows:Math.ceil(r.length/o)})}return L.none()},Yk=function(t,e){return mf([Fw(t,e)])},Jk=function(t){return Yk(oc("unnamed-events"),t)},Qk={namedEvents:Yk,unnamedEvents:Jk},Zk=oc("tooltip.exclusive"),tT=oc("tooltip.show"),eT=oc("tooltip.hide"),nT=function(t,e,n){t.getSystem().broadcastOn([Zk],{})},rT=function(t,e,n,r){n.getTooltip().each((function(t){t.getSystem().isConnected()&&Pw.set(t,r)}))},oT=Object.freeze({__proto__:null,hideAllExclusive:nT,setComponents:rT}),iT=function(t,e){var n=function(n){e.getTooltip().each((function(r){Gg(r),t.onHide(n,r),e.clearTooltip()})),e.clearTimer()},r=function(n){if(!e.isShowing()){nT(n);var r=t.lazySink(n).getOrDie(),o=n.getSystem().build({dom:t.tooltipDom,components:t.tooltipComponents,events:_a("normal"===t.mode?[za(Hu(),(function(t){Ca(n,tT)})),za(Bu(),(function(t){Ca(n,eT)}))]:[]),behaviours:mf([Pw.config({})])});e.setTooltip(o),Wg(r,o),t.onShow(n,o),Ig.position(r,o,{anchor:t.anchor(n)})}};return _a(nt([[za(tT,(function(n){e.resetTimer((function(){r(n)}),t.delay)})),za(eT,(function(r){e.resetTimer((function(){n(r)}),t.delay)})),za(ta(),(function(t,e){var r=e;r.universal||U(r.channels,Zk)&&n(t)})),ja((function(t){n(t)}))],"normal"===t.mode?[za(Iu(),(function(t){Ca(t,tT)})),za(Qu(),(function(t){Ca(t,eT)})),za(Hu(),(function(t){Ca(t,tT)})),za(Bu(),(function(t){Ca(t,eT)}))]:[za(wa(),(function(t,e){Ca(t,tT)})),za(xa(),(function(t){Ca(t,eT)}))]]))},uT=Object.freeze({__proto__:null,events:iT}),aT=[Ai("lazySink"),Ai("tooltipDom"),Ki("exclusive",!0),Ki("tooltipComponents",[]),Ki("delay",300),Qi("mode","normal",["normal","follow-highlight"]),Ki("anchor",(function(t){return{type:"hotspot",hotspot:t,layouts:{onLtr:w([$l,ql,Fl,jl,Ul,Wl]),onRtl:w([$l,ql,Fl,jl,Ul,Wl])}}})),al("onHide"),al("onShow")],cT=function(){var t=od(),e=od(),n=function(){t.on(clearTimeout)},r=function(e,r){n(),t.set(setTimeout(e,r))},o=w("not-implemented");return Tc({getTooltip:e.get,isShowing:e.isSet,setTooltip:e.set,clearTooltip:e.clear,clearTimer:n,resetTimer:r,readState:o})},sT=Object.freeze({__proto__:null,init:cT}),lT=hf({fields:aT,name:"tooltipping",active:uT,state:sT,apis:oT}),fT=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},dT=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),mT=tinymce.util.Tools.resolve("tinymce.EditorManager"),gT=function(t){var e=t.getParam("skin"),n=t.getParam("skin_url");if(!1!==e){var r=e||"oxide";n=n?t.documentBaseURI.toAbsolute(n):mT.baseURL+"/skins/ui/"+r}return n},hT=function(t){return t.getParam("readonly",!1,"boolean")},pT=function(t){return!1===t.getParam("skin")},vT=function(t){return t.getParam("height",Math.max(t.getElement().offsetHeight,200))},bT=function(t){return t.getParam("width",dT.DOM.getStyle(t.getElement(),"width"))},yT=function(t){return L.from(t.getParam("min_width")).filter(g)},wT=function(t){return L.from(t.getParam("min_height")).filter(g)},xT=function(t){return L.from(t.getParam("max_width")).filter(g)},CT=function(t){return L.from(t.getParam("max_height")).filter(g)},ST=function(t){return L.from(t.getParam("style_formats")).filter(a)},kT=function(t){return t.getParam("style_formats_merge",!1,"boolean")},TT=function(t){return t.getParam("lineheight_formats","1 1.1 1.2 1.3 1.4 1.5 2","string").split(" ")},OT=function(t){return t.getParam("content_langs",void 0,"array")},ET=function(t){return t.getParam("removed_menuitems","")},_T=function(t){return!1!==t.getParam("menubar",!0,"boolean")},AT=function(t){var e=t.getParam("toolbar",!0),n=!0===e,r=i(e),o=a(e)&&e.length>0;return!MT(t)&&(o||r||n)},DT=function(t){var e=W(9,(function(e){return t.getParam("toolbar"+(e+1),!1,"string")})),n=Y(e,(function(t){return"string"===typeof t}));return n.length>0?L.some(n):L.none()},MT=function(t){return DT(t).fold((function(){var e=t.getParam("toolbar",[],"string[]");return e.length>0}),E)};(function(t){t["default"]="wrap",t["floating"]="floating",t["sliding"]="sliding",t["scrolling"]="scrolling"})(US||(US={}));var zT,RT=function(t){return t.getParam("toolbar_mode","","string")};(function(t){t["auto"]="auto",t["top"]="top",t["bottom"]="bottom"})(zT||(zT={}));var NT,BT=function(t){return t.getParam("toolbar_groups",{},"object")},LT=function(t){return t.getParam("toolbar_location",zT.auto,"string")},HT=function(t){return LT(t)===zT.bottom},IT=function(t){return t.getParam("fixed_toolbar_container","","string")},PT=function(t){return t.getParam("fixed_toolbar_container_target")},VT=function(t){return t.getParam("toolbar_persist",!1,"boolean")},FT=function(t){if(!t.inline)return L.none();var e=IT(t);if(e.length>0)return Is(Hn(),e);var n=PT(t);return d(n)?L.some(ee.fromDom(n)):L.none()},UT=function(t){return t.inline&&FT(t).isSome()},jT=function(t){var e=FT(t);return e.getOrThunk((function(){return Dn(An(ee.fromDom(t.getElement())))}))},WT=function(t){return t.inline&&!_T(t)&&!AT(t)&&!MT(t)},qT=function(t){var e=t.getParam("toolbar_sticky",!1,"boolean");return(e||t.inline)&&!UT(t)&&!WT(t)},$T=function(t){return t.getParam("toolbar_sticky_offset",0,"number")},GT=function(t){return t.getParam("draggable_modal",!1,"boolean")},KT=function(t){var e=t.getParam("menu");return e?bt(e,(function(t){return A(A({},t),{items:t.items})})):{}},XT=function(t){return t.getParam("menubar")},YT=function(t){return t.getParam("toolbar",!0)},JT=function(t){return t.getParam("file_picker_callback")},QT=function(t){return t.getParam("file_picker_types")},ZT=function(t){return t.getParam("file_browser_callback_types")},tO=function(t){return!1===t.getParam("typeahead_urls")},eO=function(t){return t.getParam("anchor_top","#top")},nO=function(t){return t.getParam("anchor_bottom","#bottom")},rO=function(t){var e=t.getParam("file_picker_validator_handler",void 0,"function");return void 0===e?t.getParam("filepicker_validator_handler",void 0,"function"):e},oO="silver.readonly",iO=ti([Ni("readonly")]),uO=function(t,e){var n=t.outerContainer,r=n.element;e&&(t.mothership.broadcastOn([yh()],{target:r}),t.uiMothership.broadcastOn([yh()],{target:r})),t.mothership.broadcastOn([oO],{readonly:e}),t.uiMothership.broadcastOn([oO],{readonly:e})},aO=function(t,e){t.on("init",(function(){t.mode.isReadOnly()&&uO(e,!0)})),t.on("SwitchMode",(function(){return uO(e,t.mode.isReadOnly())})),hT(t)&&t.setMode("readonly")},cO=function(){var t;return yf.config({channels:(t={},t[oO]={schema:iO,onReceive:function(t,e){Hv.set(t,e.readonly)}},t)})},sO=function(t){return Hv.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},lO=function(t){return Hv.config({disabled:t})},fO=function(t){return Hv.config({disabled:t,disableClass:"tox-tbtn--disabled"})},dO=function(t){return Hv.config({disabled:t,disableClass:"tox-tbtn--disabled",useNative:!1})},mO={item:sO,button:lO,splitButton:fO,toolbarButton:dO},gO=function(t,e){var n=t.getApi(e);return function(t){t(n)}},hO=function(t,e){return Ua((function(n){var r=gO(t,n);r((function(n){var r=t.onSetup(n);m(r)&&e.set(r)}))}))},pO=function(t,e){return ja((function(n){return gO(t,n)(e.get())}))},vO=function(t,e){return qa((function(n,r){gO(t,n)(t.onAction),t.triggersSubmenu||e!==jS.CLOSE_ON_EXECUTE||(Ca(n,ia()),r.stop())}))},bO=(NT={},NT[ea()]=["disabling","alloy.base.behaviour","toggling","item-events"],NT),yO=Mt,wO=function(t,e,n,r){var o=ou(p);return{type:"item",dom:e.dom,components:yO(e.optComponents),data:t.data,eventOrder:bO,hasSubmenu:t.triggersSubmenu,itemBehaviours:mf([Fw("item-events",[vO(t,n),hO(t,o),pO(t,o)]),mO.item((function(){return t.disabled||r.isDisabled()})),cO(),Pw.config({})].concat(t.itemBehaviours))}},xO=function(t){return{value:t.value,meta:A({text:t.text.getOr("")},t.meta)}},CO=tinymce.util.Tools.resolve("tinymce.Env"),SO=function(t){var e={alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"},n={meta:"Ctrl",access:"Shift+Alt"},r=CO.mac?e:n,o=t.split("+"),i=$(o,(function(t){var e=t.toLowerCase().trim();return Et(r,e)?r[e]:t}));return CO.mac?i.join(""):i.join("+")},kO=function(t,e,n){return void 0===n&&(n=[YS]),LC(t,{tag:"div",classes:n},e)},TO=function(t){return{dom:{tag:"div",classes:[JS]},components:[Ss(TC.translate(t))]}},OO=function(t,e){return{dom:{tag:"div",classes:e,innerHtml:t}}},EO=function(t,e){return{dom:{tag:"div",classes:[JS]},components:[{dom:{tag:t.tag,styles:t.styles},components:[Ss(TC.translate(e))]}]}},_O=function(t){return{dom:{tag:"div",classes:[QS],innerHtml:SO(t)}}},AO=function(t){return kO("checkmark",t,[tk])},DO=function(t){return kO("chevron-right",t,[ZS])},MO=function(t){return kO("chevron-down",t,[ZS])},zO=function(t,e){var n="vertical"===t.direction?rk:ok,r="left"===t.align?uk:ik,o=function(){switch(t.valign){case"top":return ak;case"middle":return ck;case"bottom":return sk}};return{dom:{tag:"div",classes:[nk,n,r,o()]},components:e}},RO=function(t,e,n){return{dom:{tag:"img",classes:e,attributes:{src:t,alt:n.getOr("")}}}},NO=function(t,e,n){var r="custom",o="remove",i=t.ariaLabel,u=t.value,a=t.iconContent.map((function(t){return zC(t,e.icons,n)})),c=function(){var t=$S,n=a.getOr(""),c=i.map((function(t){return{title:e.translate(t)}})).getOr({}),s={tag:"div",attributes:c,classes:[t]};return A(A({},s),u===r?{tag:"button",classes:M(M([],s.classes,!0),["tox-swatches__picker-btn"],!1),innerHtml:n}:u===o?{classes:M(M([],s.classes,!0),["tox-swatch--remove"],!1),innerHtml:n}:{attributes:A(A({},s.attributes),{"data-mce-color":u}),styles:{"background-color":u}})};return{dom:c(),optComponents:[]}},BO=function(t){var e=t.map((function(t){return{attributes:{title:TC.translate(t)}}})).getOr({});return A({tag:"div",classes:[WS,qS]},e)},LO=function(t,e,n,r){var o={tag:"div",classes:[YS]},i=function(t){return LC(t,o,e.icons,r)},u=function(){return L.some({dom:o})},a=n?t.iconContent.map(i).orThunk(u):L.none(),c=t.checkMark,s=L.from(t.meta).fold((function(){return TO}),(function(t){return Et(t,"style")?S(EO,t.style):TO})),l=t.htmlContent.fold((function(){return t.textContent.map(s)}),(function(t){return L.some(OO(t,[JS]))})),f={dom:BO(t.ariaLabel),optComponents:[a,l,t.shortcutContent.map(_O),c,t.caret]};return f},HO=function(t,e,n,r){return void 0===r&&(r=L.none()),"color"===t.presets?NO(t,e,r):LO(t,e,n,r)},IO=function(t,e){return Ot(t,"tooltipWorker").map((function(t){return[lT.config({lazySink:e.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(t){return{type:"submenu",item:t,overrides:{maxHeightFunction:Ed}}},mode:"follow-highlight",onShow:function(e,n){t((function(t){lT.setComponents(e,[ks({element:ee.fromDom(t)})])}))}})]})).getOr([])},PO=function(t){return dT.DOM.encode(t)},VO=function(t,e){var n=TC.translate(t),r=PO(n);if(e.length>0){var o=new RegExp(fT(e),"gi");return r.replace(o,(function(t){return''+t+""}))}return r},FO=function(t,e,n,r,o,i,u,a){void 0===a&&(a=!0);var c=HO({presets:r,textContent:L.none(),htmlContent:n?t.text.map((function(t){return VO(t,e)})):L.none(),ariaLabel:t.text,iconContent:t.icon,shortcutContent:L.none(),checkMark:L.none(),caret:L.none(),value:t.value},u.providers,a,t.icon);return wO({data:xO(t),disabled:t.disabled,getApi:w({}),onAction:function(e){return o(t.value,t.meta)},onSetup:w(p),triggersSubmenu:!1,itemBehaviours:IO(t.meta,u)},c,i,u.providers)},UO=function(t,e){return $(t,(function(t){switch(t.type){case"cardcontainer":return zO(t,UO(t.items,e));case"cardimage":return RO(t.src,t.classes,t.alt);case"cardtext":var n=t.name.exists((function(t){return U(e.cardText.highlightOn,t)})),r=n?L.from(e.cardText.matchText).getOr(""):"";return OO(VO(t.text,r),t.classes)}}))},jO=function(t,e,n,r){var o=function(t){return{isDisabled:function(){return Hv.isDisabled(t)},setDisabled:function(e){Hv.set(t,e),G(Xm(t.element,"*"),(function(n){t.getSystem().getByDom(n).each((function(t){t.hasConfigured(Hv)&&Hv.set(t,e)}))}))}}},i={dom:BO(t.label),optComponents:[L.some({dom:{tag:"div",classes:[nk,ok]},components:UO(t.items,r)})]};return wO({data:xO(A({text:L.none()},t)),disabled:t.disabled,getApi:o,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:L.from(r.itemBehaviours).getOr([])},i,e,n.providers)},WO=function(t,e,n,r,o,i,u,a){void 0===a&&(a=!0);var c=function(t){return{setActive:function(e){hx.set(t,e)},isActive:function(){return hx.isOn(t)},isDisabled:function(){return Hv.isDisabled(t)},setDisabled:function(e){return Hv.set(t,e)}}},s=HO({presets:n,textContent:e?t.text:L.none(),htmlContent:L.none(),ariaLabel:t.text,iconContent:t.icon,shortcutContent:e?t.shortcut:L.none(),checkMark:e?L.some(AO(u.icons)):L.none(),caret:L.none(),value:t.value},u,a);return Co(wO({data:xO(t),disabled:t.disabled,getApi:c,onAction:function(e){return r(t.value)},onSetup:function(t){return t.setActive(o),p},triggersSubmenu:!1,itemBehaviours:[]},s,i,u),{toggling:{toggleClass:KS,toggleOnExecute:!1,selected:t.active}})},qO=Fp(_x(),Ax()),$O=function(t){return{value:t}},GO=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,KO=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,XO=function(t){return GO.test(t)||KO.test(t)},YO=function(t){return Vt(t,"#").toUpperCase()},JO=function(t){return XO(t)?L.some({value:YO(t)}):L.none()},QO=function(t){var e=t.value.replace(GO,(function(t,e,n,r){return e+e+n+n+r+r}));return{value:e}},ZO=function(t){var e=QO(t),n=KO.exec(e.value);return null===n?["FFFFFF","FF","FF","FF"]:n},tE=function(t){var e=t.toString(16);return(1===e.length?"0"+e:e).toUpperCase()},eE=function(t){var e=tE(t.red)+tE(t.green)+tE(t.blue);return $O(e)},nE=Math.min,rE=Math.max,oE=Math.round,iE=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,uE=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,aE=function(t,e,n,r){return{red:t,green:e,blue:n,alpha:r}},cE=function(t){var e=parseInt(t,10);return e.toString()===t&&e>=0&&e<=255},sE=function(t){var e,n,r,o=(t.hue||0)%360,i=t.saturation/100,u=t.value/100;if(i=rE(0,nE(i,1)),u=rE(0,nE(u,1)),0===i)return e=n=r=oE(255*u),aE(e,n,r,1);var a=o/60,c=u*i,s=c*(1-Math.abs(a%2-1)),l=u-c;switch(Math.floor(a)){case 0:e=c,n=s,r=0;break;case 1:e=s,n=c,r=0;break;case 2:e=0,n=c,r=s;break;case 3:e=0,n=s,r=c;break;case 4:e=s,n=0,r=c;break;case 5:e=c,n=0,r=s;break;default:e=n=r=0}return e=oE(255*(e+l)),n=oE(255*(n+l)),r=oE(255*(r+l)),aE(e,n,r,1)},lE=function(t){var e=ZO(t),n=parseInt(e[1],16),r=parseInt(e[2],16),o=parseInt(e[3],16);return aE(n,r,o,1)},fE=function(t,e,n,r){var o=parseInt(t,10),i=parseInt(e,10),u=parseInt(n,10),a=parseFloat(r);return aE(o,i,u,a)},dE=function(t){if("transparent"===t)return L.some(aE(0,0,0,0));var e=iE.exec(t);if(null!==e)return L.some(fE(e[1],e[2],e[3],"1"));var n=uE.exec(t);return null!==n?L.some(fE(n[1],n[2],n[3],n[4])):L.none()},mE=function(t){return"rgba("+t.red+","+t.green+","+t.blue+","+t.alpha+")"},gE=aE(255,0,0,1),hE=function(t){return t.fire("SkinLoaded")},pE=function(t,e){return t.fire("SkinLoadError",e)},vE=function(t){return t.fire("ResizeEditor")},bE=function(t,e){return t.fire("ResizeContent",e)},yE=function(t,e){return t.fire("ScrollContent",e)},wE=function(t,e){return t.fire("TextColorChange",e)},xE=function(t,e,n){return{hue:t,saturation:e,value:n}},CE=function(t){var e=0,n=0,r=0,o=t.red/255,i=t.green/255,u=t.blue/255,a=Math.min(o,Math.min(i,u)),c=Math.max(o,Math.max(i,u));if(a===c)return r=a,xE(0,0,100*r);var s=o===a?i-u:u===a?o-i:u-o;return e=o===a?3:u===a?1:5,e=60*(e-s/(c-a)),n=(c-a)/c,r=c,xE(Math.round(e),Math.round(100*n),Math.round(100*r))},SE=function(t){return CE(lE(t))},kE=function(t){return eE(sE(t))},TE=function(t){return JO(t).orThunk((function(){return dE(t).map(eE)})).getOrThunk((function(){var e=document.createElement("canvas");e.height=1,e.width=1;var n=e.getContext("2d");n.clearRect(0,0,e.width,e.height),n.fillStyle="#FFFFFF",n.fillStyle=t,n.fillRect(0,0,1,1);var r=n.getImageData(0,0,1,1).data,o=r[0],i=r[1],u=r[2],a=r[3];return eE(aE(o,i,u,a))}))},OE=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),EE="tinymce-custom-colors";function _E(t){void 0===t&&(t=10);var e=OE.getItem(EE),n=i(e)?JSON.parse(e):[],r=function(e){var n=t-e.length;return n<0?e.slice(0,t):e},o=r(n),u=function(e){F(o,e).each(a),o.unshift(e),o.length>t&&o.pop(),OE.setItem(EE,JSON.stringify(o))},a=function(t){o.splice(t,1)},c=function(){return o.slice(0)};return{add:u,state:c}}var AE,DE="choiceitem",ME=[{type:DE,text:"Light Green",value:"#BFEDD2"},{type:DE,text:"Light Yellow",value:"#FBEEB8"},{type:DE,text:"Light Red",value:"#F8CAC6"},{type:DE,text:"Light Purple",value:"#ECCAFA"},{type:DE,text:"Light Blue",value:"#C2E0F4"},{type:DE,text:"Green",value:"#2DC26B"},{type:DE,text:"Yellow",value:"#F1C40F"},{type:DE,text:"Red",value:"#E03E2D"},{type:DE,text:"Purple",value:"#B96AD9"},{type:DE,text:"Blue",value:"#3598DB"},{type:DE,text:"Dark Turquoise",value:"#169179"},{type:DE,text:"Orange",value:"#E67E23"},{type:DE,text:"Dark Red",value:"#BA372A"},{type:DE,text:"Dark Purple",value:"#843FA1"},{type:DE,text:"Dark Blue",value:"#236FA1"},{type:DE,text:"Light Gray",value:"#ECF0F1"},{type:DE,text:"Medium Gray",value:"#CED4D9"},{type:DE,text:"Gray",value:"#95A5A6"},{type:DE,text:"Dark Gray",value:"#7E8C8D"},{type:DE,text:"Navy Blue",value:"#34495E"},{type:DE,text:"Black",value:"#000000"},{type:DE,text:"White",value:"#ffffff"}],zE=_E(10),RE=function(t){for(var e=[],n=0;n0?d(n,r,e,o):r.text.length-n.matchLength>=10?c():a()}}))}))}))},h=WC((function(t){27!==t.which&&g()}),50),p={onKeypress:h,cancelIfNecessary:c,isMenuOpen:i,isActive:u,isProcessingAction:r.get,getView:function(){return eC.getContent(o)}};!1===t.hasPlugin("rtc")&&iS.setup(p,t)},B_={register:N_},L_=function(t,e,n){return Ps(t,e,n).isSome()},H_=function(t,e){var n=null,r=function(){for(var r=[],o=0;oI_||r>I_},U_=function(t){var e=od(),n=ou(!1),r=H_((function(e){t.triggerEvent(oa(),e),n.set(!0)}),P_),o=function(t){return V_(t).each((function(o){r.cancel();var i={x:o.clientX,y:o.clientY,target:t.target};r.schedule(t),n.set(!1),e.set(i)})),L.none()},i=function(t){return r.cancel(),V_(t).each((function(t){e.on((function(n){F_(t,n)&&e.clear()}))})),L.none()},u=function(o){r.cancel();var i=function(t){return sn(t.target,o.target)};return e.get().filter(i).map((function(e){return n.get()?(o.prevent(),!1):t.triggerEvent(ra(),o)}))},a=gu([{key:Au(),value:o},{key:Du(),value:i},{key:Mu(),value:u}]),c=function(t,e){return Ot(a,e).bind((function(e){return e(t)}))};return{fireIfReady:c}},j_=function(t){var e=t.raw;return e.which===ob[0]&&!U(["input","textarea"],ae(t.target))&&!L_(t.target,'[contenteditable="true"]')},W_=function(){return en().browser.isFirefox()},q_=function(t,e){return W_()?ad(t,"focus",e):ud(t,"focusin",e)},$_=function(t,e){return W_()?ad(t,"blur",e):ud(t,"focusout",e)},G_=function(t,e){var n=A({stopBackspace:!0},e),r=["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"],o=U_(n),i=$(r.concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(function(e){return ud(t,e,(function(t){o.fireIfReady(t,e).each((function(e){e&&t.kill()}));var r=n.triggerEvent(e,t);r&&t.kill()}))})),u=od(),a=ud(t,"paste",(function(t){o.fireIfReady(t,"paste").each((function(e){e&&t.kill()}));var e=n.triggerEvent("paste",t);e&&t.kill(),u.set(setTimeout((function(){n.triggerEvent(Zu(),t)}),0))})),c=ud(t,"keydown",(function(t){var e=n.triggerEvent("keydown",t);e?t.kill():n.stopBackspace&&j_(t)&&t.prevent()})),s=q_(t,(function(t){var e=n.triggerEvent("focusin",t);e&&t.kill()})),l=od(),f=$_(t,(function(t){var e=n.triggerEvent("focusout",t);e&&t.kill(),l.set(setTimeout((function(){n.triggerEvent(Qu(),t)}),0))})),d=function(){G(i,(function(t){t.unbind()})),c.unbind(),s.unbind(),f.unbind(),a.unbind(),u.on(clearTimeout),l.on(clearTimeout)};return{unbind:d}},K_=function(t,e){var n=Ot(t,"target").getOr(e);return ou(n)},X_=function(t,e){var n=ou(!1),r=ou(!1),o=function(){n.set(!0)},i=function(){r.set(!0)};return{stop:o,cut:i,isStopped:n.get,isCut:r.get,event:t,setSource:e.set,getSource:e.get}},Y_=function(t){var e=ou(!1),n=function(){e.set(!0)};return{stop:n,cut:p,isStopped:e.get,isCut:O,event:t,setSource:T("Cannot set source of a broadcasted event"),getSource:T("Cannot get source of a broadcasted event")}},J_=uu.generate([{stopped:[]},{resume:["element"]},{complete:[]}]),Q_=function(t,e,n,r,o,i){var u=t(e,r),a=X_(n,o);return u.fold((function(){return i.logEventNoHandlers(e,r),J_.complete()}),(function(t){var n=t.descHandler,r=Hc(n);return r(a),a.isStopped()?(i.logEventStopped(e,t.element,n.purpose),J_.stopped()):a.isCut()?(i.logEventCut(e,t.element,n.purpose),J_.complete()):vn(t.element).fold((function(){return i.logNoParent(e,t.element,n.purpose),J_.complete()}),(function(r){return i.logEventResponse(e,t.element,n.purpose),J_.resume(r)}))}))},Z_=function(t,e,n,r,o,i){return Q_(t,e,n,r,o,i).fold(E,(function(r){return Z_(t,e,n,r,o,i)}),O)},tA=function(t,e,n,r,o){var i=K_(n,r);return Q_(t,e,n,r,i,o)},eA=function(t,e,n){var r=Y_(e);return G(t,(function(t){var e=t.descHandler,n=Hc(e);n(r)})),r.isStopped()},nA=function(t,e,n,r){return rA(t,e,n,n.target,r)},rA=function(t,e,n,r,o){var i=K_(n,r);return Z_(t,e,n,r,i,o)},oA=function(t,e){return{element:t,descHandler:e}},iA=function(t,e){return{id:t,descHandler:e}},uA=function(){var t={},e=function(e,n,r){vt(r,(function(r,o){var i=void 0!==t[o]?t[o]:{};i[n]=Lc(r,e),t[o]=i}))},n=function(t,e){return fc(e).bind((function(e){return Ot(t,e)})).map((function(t){return oA(e,t)}))},r=function(e){return Ot(t,e).map((function(t){return St(t,(function(t,e){return iA(e,t)}))})).getOr([])},o=function(e,r,o){return Ot(t,r).bind((function(t){return wu(o,(function(e){return n(t,e)}),e)}))},i=function(e){vt(t,(function(t,n){Et(t,e)&&delete t[e]}))};return{registerId:e,unregisterId:i,filterByType:r,find:o}},aA=function(){var t=uA(),e={},n=function(t){var e=t.element;return fc(e).getOrThunk((function(){return sc("uid-",t.element)}))},r=function(t,n){var r=e[n];if(r!==t)throw new Error('The tagId "'+n+'" is already used by: '+Za(r.element)+"\nCannot use it for: "+Za(t.element)+"\nThe conflicting element is"+(Ln(r.element)?" ":" not ")+"already in the DOM");i(t)},o=function(o){var i=n(o);_t(e,i)&&r(o,i);var u=[o];t.registerId(u,i,o.events),e[i]=o},i=function(n){fc(n.element).each((function(n){delete e[n],t.unregisterId(n)}))},u=function(e){return t.filterByType(e)},a=function(e,n,r){return t.find(e,n,r)},c=function(t){return Ot(e,t)};return{find:a,filter:u,register:o,unregister:i,getById:c}},cA=function(t){var e=t.dom,n=e.attributes,r=D(e,["attributes"]);return{uid:t.uid,dom:A({tag:"div",attributes:A({role:"presentation"},n)},r),components:t.components,behaviours:np(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},sA=dv({name:"Container",factory:cA,configFields:[Ki("components",[]),ep("containerBehaviours",[]),Ki("events",{}),Ki("domModification",{}),Ki("eventOrder",{})]}),lA=function(t){var e=function(e){return vn(t.element).fold(E,(function(t){return sn(e,t)}))},n=aA(),r=function(t,r){return n.find(e,t,r)},o=G_(t.element,{triggerEvent:function(t,e){return Js(t,e.target,(function(n){return nA(r,t,e,n)}))}}),i={debugInfo:w("real"),triggerEvent:function(t,e,n){Js(t,e,(function(o){return rA(r,t,n,e,o)}))},triggerFocus:function(t,e){fc(t).fold((function(){Sf(t)}),(function(n){Js(Ju(),t,(function(n){return tA(r,Ju(),{originator:e,kill:p,prevent:p,target:t},t,n),!1}))}))},triggerEscape:function(t,e){i.triggerEvent("keydown",t.element,e.event)},getByUid:function(t){return h(t)},getByDom:function(t){return v(t)},build:Es,addToGui:function(t){c(t)},removeFromGui:function(t){s(t)},addToWorld:function(t){u(t)},removeFromWorld:function(t){a(t)},broadcast:function(t){d(t)},broadcastOn:function(t,e){m(t,e)},broadcastEvent:function(t,e){g(t,e)},isConnected:E},u=function(t){t.connect(i),fe(t.element)||(n.register(t),G(t.components(),u),i.triggerEvent(aa(),t.element,{target:t.element}))},a=function(t){fe(t.element)||(G(t.components(),a),n.unregister(t)),t.disconnect()},c=function(e){Wg(t,e)},s=function(t){Gg(t)},l=function(){o.unbind(),Br(t.element)},f=function(t){var e=n.filter(ta());G(e,(function(e){var n=e.descHandler,r=Hc(n);r(t)}))},d=function(t){f({universal:!0,data:t})},m=function(t,e){f({universal:!1,channels:t,data:e})},g=function(t,e){var r=n.filter(t);return eA(r,e)},h=function(t){return n.getById(t).fold((function(){return ro.error(new Error('Could not find component with uid: "'+t+'" in system.'))}),ro.value)},v=function(t){var e=fc(t).getOr("not found");return h(e)};return u(t),{root:t,element:t.element,destroy:l,add:c,remove:s,getByUid:h,getByDom:v,addToWorld:u,removeFromWorld:a,broadcast:d,broadcastOn:m,broadcastEvent:g}},fA=function(t,e){return{dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:$(t.items,e.interpreter)}},dA=w([Ki("prefix","form-field"),ep("fieldBehaviours",[bv,tp])]),mA=w([Bp({schema:[Ai("dom")],name:"label"}),Bp({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Ai("text")],name:"aria-descriptor"}),Rp({factory:{sketch:function(t){var e=du(t,["factory"]);return t.factory.sketch(e)}},schema:[Ai("factory")],name:"field"})]),gA=function(t,e,n,r){var o=rp(t.fieldBehaviours,[bv.config({find:function(e){return Kp(e,t,"field")}}),tp.config({store:{mode:"manual",getValue:function(t){return bv.getCurrent(t).bind(tp.getValue)},setValue:function(t,e){bv.getCurrent(t).each((function(t){tp.setValue(t,e)}))}}})]),i=_a([Ua((function(e,n){var r=Yp(e,t,["label","field","aria-descriptor"]);r.field().each((function(e){var n=oc(t.prefix);r.label().each((function(t){Vn(t.element,"for",n),Vn(e.element,"id",n)})),r["aria-descriptor"]().each((function(n){var r=oc(t.prefix);Vn(n.element,"id",r),Vn(e.element,"aria-describedby",r)}))}))}))]),u={getField:function(e){return Kp(e,t,"field")},getLabel:function(e){return Kp(e,t,"label")}};return{uid:t.uid,dom:t.dom,components:e,behaviours:o,events:i,apis:u}},hA=mv({name:"FormField",configFields:dA(),partFields:mA(),factory:gA,apis:{getField:function(t,e){return t.getField(e)},getLabel:function(t,e){return t.getLabel(e)}}}),pA=function(t,e){return Dc({attributes:gu([{key:e.tabAttr,value:"true"}])})},vA=Object.freeze({__proto__:null,exhibit:pA}),bA=[Ki("tabAttr","data-alloy-tabstop")],yA=hf({fields:bA,name:"tabstopping",active:vA}),wA=tinymce.util.Tools.resolve("tinymce.html.Entities"),xA=function(t,e,n,r){var o=SA(t,e,n,r);return hA.sketch(o)},CA=function(t,e){return xA(t,e,[],[])},SA=function(t,e,n,r){return{dom:TA(n),components:t.toArray().concat([e]),fieldBehaviours:mf(r)}},kA=function(){return TA([])},TA=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},OA=function(t,e){return hA.parts.label({dom:{tag:"label",classes:["tox-label"],innerHtml:e.translate(t)}})},EA=oc("form-component-change"),_A=oc("form-close"),AA=oc("form-cancel"),DA=oc("form-action"),MA=oc("form-submit"),zA=oc("form-block"),RA=oc("form-unblock"),NA=oc("form-tabchange"),BA=oc("form-resize"),LA=function(t,e){var n,r=t.label.map((function(t){return OA(t,e)})),o=function(t){return function(e,n){Ps(n.event.target,"[data-collection-item-value]").each((function(r){t(e,n,r,Un(r,"data-collection-item-value"))}))}},i=function(n,r){var o=$(r,(function(n){var r=TC.translate(n.text),o=1===t.columns?'
'+r+"
":"",i='
'+n.icon+"
",u={_:" "," - ":" ","-":" "},a=r.replace(/\_| \- |\-/g,(function(t){return u[t]})),c=e.isDisabled()?" tox-collection__item--state-disabled":"";return'
'+i+o+"
"})),i="auto"!==t.columns&&t.columns>1?q(o,t.columns):[o],u=$(i,(function(t){return'
'+t.join("")+"
"}));Ka(n.element,u.join(""))},u=o((function(n,r,o,i){r.stop(),e.isDisabled()||Sa(n,DA,{name:t.name,value:i})})),a=[za(Hu(),o((function(t,e,n){Sf(n)}))),za(Wu(),u),za(ra(),u),za(Iu(),o((function(t,e,n){Is(t.element,"."+ek).each((function(t){as(t,ek)})),is(n,ek)}))),za(Pu(),o((function(t){Is(t.element,"."+ek).each((function(t){as(t,ek)}))}))),qa(o((function(e,n,r,o){Sa(e,DA,{name:t.name,value:o})})))],c=function(t,e){return $(Xm(t.element,".tox-collection__item"),e)},s=hA.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==t.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:x},behaviours:mf([Hv.config({disabled:e.isDisabled,onDisabled:function(t){c(t,(function(t){is(t,"tox-collection__item--state-disabled"),Vn(t,"aria-disabled",!0)}))},onEnabled:function(t){c(t,(function(t){as(t,"tox-collection__item--state-disabled"),qn(t,"aria-disabled")}))}}),cO(),Pw.config({}),tp.config({store:{mode:"memory",initialValue:[]},onSetValue:function(e,n){i(e,n),"auto"===t.columns&&Xk(e,5,"tox-collection__item").each((function(t){var n=t.numRows,r=t.numColumns;Aw.setGridSize(e,n,r)})),Ca(e,BA)}}),yA.config({}),Aw.config(i_(t.columns,"normal")),Fw("collection-events",a)]),eventOrder:(n={},n[ea()]=["disabling","alloy.base.behaviour","collection-events"],n)}),l=["tox-form__group--collection"];return xA(r,s,l,[])},HA=w([Vi("data"),Ki("inputAttributes",{}),Ki("inputStyles",{}),Ki("tag","input"),Ki("inputClasses",[]),al("onSetValue"),Ki("styles",{}),Ki("eventOrder",{}),ep("inputBehaviours",[tp,Yw]),Ki("selectOnFocus",!0)]),IA=function(t){return mf([Yw.config({onFocus:t.selectOnFocus?function(t){var e=t.element,n=ds(e);e.dom.setSelectionRange(0,n.length)}:p})])},PA=function(t){return A(A({},IA(t)),rp(t.inputBehaviours,[tp.config({store:A(A({mode:"manual"},t.data.map((function(t){return{initialValue:t}})).getOr({})),{getValue:function(t){return ds(t.element)},setValue:function(t,e){var n=ds(t.element);n!==e&&ms(t.element,e)}}),onSetValue:t.onSetValue})]))},VA=function(t){return{tag:t.tag,attributes:A({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},FA=function(t,e){return{uid:t.uid,dom:VA(t),components:[],behaviours:PA(t),eventOrder:t.eventOrder}},UA=dv({name:"Input",configFields:HA(),factory:FA}),jA={},WA={exports:jA};(function(e,n,r,o){(function(t,o){"object"===typeof n&&"undefined"!==typeof r?r.exports=o():"function"===typeof e&&e.amd?e(o):(t="undefined"!==typeof globalThis?globalThis:t||self,t.EphoxContactWrapper=o())})(this,(function(){var e="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{},n={exports:{}};(function(t){(function(e){var n=setTimeout;function r(){}function o(t,e){return function(){t.apply(e,arguments)}}function i(t){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(t,this)}function u(t,e){while(3===t._state)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(o){return void c(e.promise,o)}a(e.promise,r)}else(1===t._state?a:c)(e.promise,t._value)}))):t._deferreds.push(e)}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"===typeof e||"function"===typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void s(t);if("function"===typeof n)return void f(o(n,e),t)}t._state=1,t._value=e,s(t)}catch(r){c(t,r)}}function c(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&i._immediateFn((function(){t._handled||i._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;en?n:t===e?e-1:Math.max(e,t-r)},tz=function(t,e,n,r){return t>n?t:td)return h;var p=rz(o,f,d),v=ez(p/m*r+e,g,h);return u&&v>=e&&v<=n?nz(v,e,n,i,a):c?Math.round(v):v},iz=function(t){var e=t.min,n=t.max,r=t.range,o=t.value,i=t.hasMinEdge,u=t.hasMaxEdge,a=t.maxBound,c=t.maxOffset,s=t.centerMinEdge,l=t.centerMaxEdge;return on?u?a:l:(o-e)/r*c},uz="top",az="right",cz="bottom",sz="left",lz="width",fz="height",dz=function(t){return t.element.dom.getBoundingClientRect()},mz=function(t,e){return t[e]},gz=function(t){var e=dz(t);return mz(e,sz)},hz=function(t){var e=dz(t);return mz(e,az)},pz=function(t){var e=dz(t);return mz(e,uz)},vz=function(t){var e=dz(t);return mz(e,cz)},bz=function(t){var e=dz(t);return mz(e,lz)},yz=function(t){var e=dz(t);return mz(e,fz)},wz=function(t,e,n){return(t+e)/2-n},xz=function(t,e){var n=dz(t),r=dz(e),o=mz(n,sz),i=mz(n,az),u=mz(r,sz);return wz(o,i,u)},Cz=function(t,e){var n=dz(t),r=dz(e),o=mz(n,uz),i=mz(n,cz),u=mz(r,uz);return wz(o,i,u)},Sz=function(t,e){Sa(t,aM(),{value:e})},kz=function(t){return{x:t}},Tz=function(t,e,n){var r={min:gM(e),max:bM(e),range:SM(e),value:n,step:EM(e),snap:_M(e),snapStart:AM(e),rounded:DM(e),hasMinEdge:zM(e),hasMaxEdge:RM(e),minBound:gz(t),maxBound:hz(t),screenRange:bz(t)};return oz(r)},Oz=function(t,e,n){var r=Tz(t,e,n),o=kz(r);return Sz(t,o),r},Ez=function(t,e){var n=gM(e);Sz(t,kz(n))},_z=function(t,e){var n=bM(e);Sz(t,kz(n))},Az=function(t,e,n){var r=t>0?tz:ZM,o=r(LM(n).x,gM(n),bM(n),EM(n));return Sz(e,kz(o)),L.some(o)},Dz=function(t){return function(e,n){return Az(t,e,n).map(E)}},Mz=function(t){var e=sM(t);return e.map((function(t){return t.left}))},zz=function(t,e,n,r,o){var i=0,u=bz(t),a=r.bind((function(e){return L.some(xz(e,t))})).getOr(i),c=o.bind((function(e){return L.some(xz(e,t))})).getOr(u),s={min:gM(e),max:bM(e),range:SM(e),value:n,hasMinEdge:zM(e),hasMaxEdge:RM(e),minBound:gz(t),minOffset:i,maxBound:hz(t),maxOffset:u,centerMinEdge:a,centerMaxEdge:c};return iz(s)},Rz=function(t,e,n,r,o,i){var u=zz(e,i,n,r,o);return gz(e)-gz(t)+u},Nz=function(t,e,n,r){var o=LM(n),i=Rz(t,r.getSpectrum(t),o.x,r.getLeftEdge(t),r.getRightEdge(t),n),u=vr(e.element)/2;Kn(e.element,"left",i-u+"px")},Bz=Dz(-1),Lz=Dz(1),Hz=L.none,Iz=L.none,Pz={"top-left":L.none(),top:L.none(),"top-right":L.none(),right:L.some(qM),"bottom-right":L.none(),bottom:L.none(),"bottom-left":L.none(),left:L.some(JM)},Vz=Object.freeze({__proto__:null,setValueFrom:Oz,setToMin:Ez,setToMax:_z,findValueOfOffset:Tz,getValueFromEvent:Mz,findPositionOfValue:Rz,setPositionFromValue:Nz,onLeft:Bz,onRight:Lz,onUp:Hz,onDown:Iz,edgeActions:Pz}),Fz=function(t,e){Sa(t,aM(),{value:e})},Uz=function(t){return{y:t}},jz=function(t,e,n){var r={min:hM(e),max:yM(e),range:kM(e),value:n,step:EM(e),snap:_M(e),snapStart:AM(e),rounded:DM(e),hasMinEdge:NM(e),hasMaxEdge:BM(e),minBound:pz(t),maxBound:vz(t),screenRange:yz(t)};return oz(r)},Wz=function(t,e,n){var r=jz(t,e,n),o=Uz(r);return Fz(t,o),r},qz=function(t,e){var n=hM(e);Fz(t,Uz(n))},$z=function(t,e){var n=yM(e);Fz(t,Uz(n))},Gz=function(t,e,n){var r=t>0?tz:ZM,o=r(LM(n).y,hM(n),yM(n),EM(n));return Fz(e,Uz(o)),L.some(o)},Kz=function(t){return function(e,n){return Gz(t,e,n).map(E)}},Xz=function(t){var e=sM(t);return e.map((function(t){return t.top}))},Yz=function(t,e,n,r,o){var i=0,u=yz(t),a=r.bind((function(e){return L.some(Cz(e,t))})).getOr(i),c=o.bind((function(e){return L.some(Cz(e,t))})).getOr(u),s={min:hM(e),max:yM(e),range:kM(e),value:n,hasMinEdge:NM(e),hasMaxEdge:BM(e),minBound:pz(t),minOffset:i,maxBound:vz(t),maxOffset:u,centerMinEdge:a,centerMaxEdge:c};return iz(s)},Jz=function(t,e,n,r,o,i){var u=Yz(e,i,n,r,o);return pz(e)-pz(t)+u},Qz=function(t,e,n,r){var o=LM(n),i=Jz(t,r.getSpectrum(t),o.y,r.getTopEdge(t),r.getBottomEdge(t),n),u=ur(e.element)/2;Kn(e.element,"top",i-u+"px")},Zz=L.none,tR=L.none,eR=Kz(-1),nR=Kz(1),rR={"top-left":L.none(),top:L.some(UM),"top-right":L.none(),right:L.none(),"bottom-right":L.none(),bottom:L.some(KM),"bottom-left":L.none(),left:L.none()},oR=Object.freeze({__proto__:null,setValueFrom:Wz,setToMin:qz,setToMax:$z,findValueOfOffset:jz,getValueFromEvent:Xz,findPositionOfValue:Jz,setPositionFromValue:Qz,onLeft:Zz,onRight:tR,onUp:eR,onDown:nR,edgeActions:rR}),iR=function(t,e){Sa(t,aM(),{value:e})},uR=function(t,e){return{x:t,y:e}},aR=function(t,e,n){var r=Tz(t,e,n.left),o=jz(t,e,n.top),i=uR(r,o);return iR(t,i),i},cR=function(t,e,n,r){var o=t>0?tz:ZM,i=e?LM(r).x:o(LM(r).x,gM(r),bM(r),EM(r)),u=e?o(LM(r).y,hM(r),yM(r),EM(r)):LM(r).y;return iR(n,uR(i,u)),L.some(i)},sR=function(t,e){return function(n,r){return cR(t,e,n,r).map(E)}},lR=function(t,e){var n=gM(e),r=hM(e);iR(t,uR(n,r))},fR=function(t,e){var n=bM(e),r=yM(e);iR(t,uR(n,r))},dR=function(t){return sM(t)},mR=function(t,e,n,r){var o=LM(n),i=Rz(t,r.getSpectrum(t),o.x,r.getLeftEdge(t),r.getRightEdge(t),n),u=Jz(t,r.getSpectrum(t),o.y,r.getTopEdge(t),r.getBottomEdge(t),n),a=vr(e.element)/2,c=ur(e.element)/2;Kn(e.element,"left",i-a+"px"),Kn(e.element,"top",u-c+"px")},gR=sR(-1,!1),hR=sR(1,!1),pR=sR(-1,!0),vR=sR(1,!0),bR={"top-left":L.some(FM),top:L.some(jM),"top-right":L.some(WM),right:L.some($M),"bottom-right":L.some(GM),bottom:L.some(XM),"bottom-left":L.some(YM),left:L.some(QM)},yR=Object.freeze({__proto__:null,setValueFrom:aR,setToMin:lR,setToMax:fR,getValueFromEvent:dR,setPositionFromValue:mR,onLeft:gR,onRight:hR,onUp:pR,onDown:vR,edgeActions:bR}),wR=[Ki("stepSize",1),Ki("onChange",p),Ki("onChoose",p),Ki("onInit",p),Ki("onDragStart",p),Ki("onDragEnd",p),Ki("snapToGrid",!1),Ki("rounded",!0),Vi("snapStart"),Di("model",ki("mode",{x:[Ki("minX",0),Ki("maxX",100),Ei("value",(function(t){return ou(t.mode.minX)})),Ai("getInitialValue"),fl("manager",Vz)],y:[Ki("minY",0),Ki("maxY",100),Ei("value",(function(t){return ou(t.mode.minY)})),Ai("getInitialValue"),fl("manager",oR)],xy:[Ki("minX",0),Ki("maxX",100),Ki("minY",0),Ki("maxY",100),Ei("value",(function(t){return ou({x:t.mode.minX,y:t.mode.minY})})),Ai("getInitialValue"),fl("manager",yR)]})),ep("sliderBehaviours",[Aw,tp]),Ei("mouseIsDown",(function(){return ou(!1)}))],xR=function(t,e,n,r){var o,i=function(e){return Xp(e,t,"thumb")},u=function(e){return Xp(e,t,"spectrum")},a=function(e){return Kp(e,t,"left-edge")},c=function(e){return Kp(e,t,"right-edge")},s=function(e){return Kp(e,t,"top-edge")},l=function(e){return Kp(e,t,"bottom-edge")},f=t.model,d=f.manager,m=function(e,n){d.setPositionFromValue(e,n,t,{getLeftEdge:a,getRightEdge:c,getTopEdge:s,getBottomEdge:l,getSpectrum:u})},g=function(t,e){f.value.set(e);var n=i(t);m(t,n)},h=function(e,n){g(e,n);var r=i(e);return t.onChange(e,r,n),L.some(!0)},p=function(e){d.setToMin(e,t)},v=function(e){d.setToMax(e,t)},b=function(e){var n=function(){Kp(e,t,"thumb").each((function(n){var r=f.value.get();t.onChoose(e,n,r)}))},r=t.mouseIsDown.get();t.mouseIsDown.set(!1),r&&n()},y=function(e,n){n.stop(),t.mouseIsDown.set(!0),t.onDragStart(e,i(e))},w=function(e,n){n.stop(),t.onDragEnd(e,i(e)),b(e)};return{uid:t.uid,dom:t.dom,components:e,behaviours:rp(t.sliderBehaviours,[Aw.config({mode:"special",focusIn:function(e){return Kp(e,t,"spectrum").map(Aw.focusIn).map(E)}}),tp.config({store:{mode:"manual",getValue:function(t){return f.value.get()}}}),yf.config({channels:(o={},o[xh()]={onReceive:b},o)})]),events:_a([za(aM(),(function(t,e){h(t,e.event.value)})),Ua((function(e,n){var r=f.getInitialValue();f.value.set(r);var o=i(e);m(e,o);var a=u(e);t.onInit(e,o,a,f.value.get())})),za(Au(),y),za(Mu(),w),za(Ru(),y),za(Lu(),w)]),apis:{resetToMin:p,resetToMax:v,setValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},CR=mv({name:"Slider",configFields:wR,partFields:iM,factory:xR,apis:{setValue:function(t,e,n){t.setValue(e,n)},resetToMin:function(t,e){t.resetToMin(e)},resetToMax:function(t,e){t.resetToMax(e)},refresh:function(t,e){t.refresh(e)}}}),SR=oc("rgb-hex-update"),kR=oc("slider-update"),TR=oc("palette-update"),OR=function(t,e){var n=CR.parts.spectrum({dom:{tag:"div",classes:[e("hue-slider-spectrum")],attributes:{role:"presentation"}}}),r=CR.parts.thumb({dom:{tag:"div",classes:[e("hue-slider-thumb")],attributes:{role:"presentation"}}});return CR.sketch({dom:{tag:"div",classes:[e("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:w({y:0})},components:[n,r],sliderBehaviours:mf([Yw.config({})]),onChange:function(t,e,n){Sa(t,kR,{value:n})}})},ER="form",_R=[ep("formBehaviours",[tp])],AR=function(t){return""},DR=function(t){var e=function(){var t=[],e=function(e,n){return t.push(e),jp(ER,AR(e),n)};return{field:e,record:w(t)}}(),n=t(e),r=e.record(),o=$(r,(function(t){return Rp({name:t,pname:AR(t)})}));return uv(ER,_R,o,zR,n)},MR=function(t,e){return t.fold((function(){return ro.error(e)}),ro.value)},zR=function(t,e){return{uid:t.uid,dom:t.dom,components:e,behaviours:rp(t.formBehaviours,[tp.config({store:{mode:"manual",getValue:function(e){var n=Jp(e,t);return bt(n,(function(t,e){return t().bind((function(t){var n=bv.getCurrent(t);return MR(n,new Error("Cannot find a current component to extract the value from for form part '"+e+"': "+Za(t.element)))})).map(tp.getValue)}))},setValue:function(e,n){vt(n,(function(n,r){Kp(e,t,r).each((function(t){bv.getCurrent(t).each((function(t){tp.setValue(t,n)}))}))}))}}})]),apis:{getField:function(e,n){return Kp(e,t,n).bind(bv.getCurrent)}}}},RR={getField:Sc((function(t,e,n){return t.getField(e,n)})),sketch:DR},NR=oc("valid-input"),BR=oc("invalid-input"),LR=oc("validating-input"),HR="colorcustom.rgb.",IR=function(t,e,n,r){var o=function(n,r){return dD.config({invalidClass:e("invalid"),notify:{onValidate:function(t){Sa(t,LR,{type:n})},onValid:function(t){Sa(t,NR,{type:n,value:tp.getValue(t)})},onInvalid:function(t){Sa(t,BR,{type:n,value:tp.getValue(t)})}},validator:{validate:function(e){var n=tp.getValue(e),o=r(n)?ro.value(!0):ro.error(t("aria.input.invalid"));return tD.pure(o)},validateOnLoad:!1}})},i=function(n,r,i,u,a){var c=t(HR+"range"),s=hA.parts.label({dom:{tag:"label",innerHtml:i,attributes:{"aria-label":u}}}),l=hA.parts.field({data:a,factory:UA,inputAttributes:A({type:"text"},"hex"===r?{"aria-live":"polite"}:{}),inputClasses:[e("textfield")],inputBehaviours:mf([o(r,n),yA.config({})]),onSetValue:function(t){if(dD.isInvalid(t)){var e=dD.run(t);e.get(p)}}}),f=[s,l],d="hex"!==r?[hA.parts["aria-descriptor"]({text:c})]:[],m=f.concat(d);return{dom:{tag:"div",attributes:{role:"presentation"}},components:m}},u=function(t,e){var n=eE(e);return RR.getField(t,"hex").each((function(e){Yw.isFocused(e)||tp.setValue(t,{hex:n.value})})),n},a=function(t,e){var n=e.red,r=e.green,o=e.blue;tp.setValue(t,{red:n,green:r,blue:o})},c=kC({dom:{tag:"div",classes:[e("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),s=function(t,e){c.getOpt(t).each((function(t){Kn(t.element,"background-color","#"+e.value)}))},l=function(){var o={red:ou(L.some(255)),green:ou(L.some(255)),blue:ou(L.some(255)),hex:ou(L.some("ffffff"))},l=function(t,e){var n=lE(e);a(t,n),g(n)},f=function(t){return o[t].get()},d=function(t,e){o[t].set(e)},m=function(){return f("red").bind((function(t){return f("green").bind((function(e){return f("blue").map((function(n){return aE(t,e,n,1)}))}))}))},g=function(t){var e=t.red,n=t.green,r=t.blue;d("red",L.some(e)),d("green",L.some(n)),d("blue",L.some(r))},h=function(t,e){var n=e.event;"hex"!==n.type?d(n.type,L.none()):r(t)},p=function(t,e){n(t);var r=$O(e);d("hex",L.some(e));var o=lE(r);a(t,o),g(o),Sa(t,SR,{hex:r}),s(t,r)},v=function(t,e,n){var r=parseInt(n,10);d(e,L.some(r)),m().each((function(e){var n=u(t,e);Sa(t,SR,{hex:n}),s(t,n)}))},b=function(t){return"hex"===t.type},y=function(t,e){var n=e.event;b(n)?p(t,n.value):v(t,n.type,n.value)},w=function(e){return{label:t(HR+e+".label"),description:t(HR+e+".description")}},x=w("red"),C=w("green"),S=w("blue"),k=w("hex");return Co(RR.sketch((function(n){return{dom:{tag:"form",classes:[e("rgb-form")],attributes:{"aria-label":t("aria.color.picker")}},components:[n.field("red",hA.sketch(i(cE,"red",x.label,x.description,255))),n.field("green",hA.sketch(i(cE,"green",C.label,C.description,255))),n.field("blue",hA.sketch(i(cE,"blue",S.label,S.description,255))),n.field("hex",hA.sketch(i(XO,"hex",k.label,k.description,"ffffff"))),c.asSpec()],formBehaviours:mf([dD.config({invalidClass:e("form-invalid")}),Fw("rgb-form-events",[za(NR,y),za(BR,h),za(LR,h)])])}})),{apis:{updateHex:function(t,e){tp.setValue(t,{hex:e.value}),l(t,e),s(t,e)}}})},f=dv({factory:l,name:"RgbForm",configFields:[],apis:{updateHex:function(t,e,n){t.updateHex(e,n)}},extraApis:{}});return f},PR=function(t,e){var n=CR.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[e("sv-palette-spectrum")]}}),r=CR.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[e("sv-palette-thumb")],innerHtml:"'}}),o=function(t,e){var n=t.width,r=t.height,o=t.getContext("2d");if(null!==o){o.fillStyle=e,o.fillRect(0,0,n,r);var i=o.createLinearGradient(0,0,n,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),o.fillStyle=i,o.fillRect(0,0,n,r);var u=o.createLinearGradient(0,0,0,r);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),o.fillStyle=u,o.fillRect(0,0,n,r)}},i=function(t,e){var n=t.components()[0].element.dom,r=xE(e,100,100),i=sE(r);o(n,mE(i))},u=function(t,e){var n=CE(lE(e));CR.setValue(t,{x:n.saturation,y:100-n.value})},a=function(t){var i=w({x:0,y:0}),u=function(t,e,n){Sa(t,TR,{value:n})},a=function(t,e,n,r){o(n.element.dom,mE(gE))},c=mf([bv.config({find:L.some}),Yw.config({})]);return CR.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[e("sv-palette")]},model:{mode:"xy",getInitialValue:i},rounded:!1,components:[n,r],onChange:u,onInit:a,sliderBehaviours:c})},c=dv({factory:a,name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:function(t,e,n){i(e,n)},setThumb:function(t,e,n){u(e,n)}},extraApis:{}});return c},VR=function(t,e){var n=function(n){var r=IR(t,e,n.onValidHex,n.onInvalidHex),o=PR(t,e),i=function(t){return(100-t)/100*360},u=function(t){return 100-t/360*100},a={paletteRgba:ou(gE),paletteHue:ou(0)},c=kC(OR(t,e)),s=kC(o.sketch({})),l=kC(r.sketch({})),f=function(t,e,n){s.getOpt(t).each((function(t){o.setHue(t,n)}))},d=function(t,e){l.getOpt(t).each((function(t){r.updateHex(t,e)}))},m=function(t,e,n){c.getOpt(t).each((function(t){CR.setValue(t,{y:u(n)})}))},g=function(t,e){s.getOpt(t).each((function(t){o.setThumb(t,e)}))},h=function(t,e){var n=lE(t);a.paletteRgba.set(n),a.paletteHue.set(e)},p=function(t,e,n,r){h(e,n),G(r,(function(r){r(t,e,n)}))},v=function(){var t=[d];return function(e,n){var r=n.event.value,o=a.paletteHue.get(),i=xE(o,r.x,100-r.y),u=kE(i);p(e,u,o,t)}},b=function(){var t=[f,d];return function(e,n){var r=i(n.event.value.y),o=a.paletteRgba.get(),u=CE(o),c=xE(r,u.saturation,u.value),s=kE(c);p(e,s,r,t)}},y=function(){var t=[f,m,g];return function(e,n){var r=n.event.hex,o=SE(r);p(e,r,o.hue,t)}};return{uid:n.uid,dom:n.dom,components:[s.asSpec(),c.asSpec(),l.asSpec()],behaviours:mf([Fw("colour-picker-events",[za(SR,y()),za(TR,v()),za(kR,b())]),bv.config({find:function(t){return l.getOpt(t)}}),Aw.config({mode:"acyclic"})])}},r=dv({name:"ColourPicker",configFields:[Ai("dom"),Ki("onValidHex",p),Ki("onInvalidHex",p)],factory:n});return r},FR=function(){return bv.config({find:L.some})},UR=function(t){return bv.config({find:t.getOpt})},jR=function(t){return bv.config({find:function(e){return Cn(e.element,t).bind((function(t){return e.getSystem().getByDom(t).toOptional()}))}})},WR={self:FR,memento:UR,childAt:jR},qR={"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"},$R=function(t){return qR[t]},GR=function(t){return $R(t)},KR=function(t){var e=function(t){return"tox-"+t},n=VR(GR,e),r=function(t){Sa(t,DA,{name:"hex-valid",value:!0})},o=function(t){Sa(t,DA,{name:"hex-valid",value:!1})},i=kC(n.sketch({dom:{tag:"div",classes:[e("color-picker-container")],attributes:{role:"presentation"}},onValidHex:r,onInvalidHex:o}));return{dom:{tag:"div"},components:[i.asSpec()],behaviours:mf([tp.config({store:{mode:"manual",getValue:function(t){var e=i.get(t),n=bv.getCurrent(e),r=n.bind((function(t){var e=tp.getValue(t);return e.hex}));return r.map((function(t){return"#"+t})).getOr("")},setValue:function(t,e){var n=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/,r=n.exec(e),o=i.get(t),u=bv.getCurrent(o);u.fold((function(){console.log("Can not find form")}),(function(t){tp.setValue(t,{hex:L.from(r[1]).getOr("")}),RR.getField(t,"hex").each((function(t){Ca(t,Uu())}))}))}}}),WR.self()])}},XR=tinymce.util.Tools.resolve("tinymce.Resource"),YR=function(t){return Et(t,"init")},JR=function(t){var e=od(),n=kC({dom:{tag:t.tag}}),r=od();return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:mf([Fw("custom-editor-events",[Ua((function(o){n.getOpt(o).each((function(n){(YR(t)?t.init(n.element.dom):XR.load(t.scriptId,t.scriptUrl).then((function(e){return e(n.element.dom,t.settings)}))).then((function(t){r.on((function(e){t.setValue(e)})),r.clear(),e.set(t)}))}))}))]),tp.config({store:{mode:"manual",getValue:function(){return e.get().fold((function(){return r.get().getOr("")}),(function(t){return t.getValue()}))},setValue:function(t,n){e.get().fold((function(){r.set(n)}),(function(t){return t.setValue(n)}))}}}),WR.self()]),components:[n.asSpec()]}},QR=tinymce.util.Tools.resolve("tinymce.util.Tools"),ZR=ti([Ki("preprocess",x),Ki("postprocess",x)]),tN=function(t,e){var n=Ci("RepresentingConfigs.memento processors",ZR,e);return tp.config({store:{mode:"manual",getValue:function(e){var r=t.get(e),o=tp.getValue(r);return n.postprocess(o)},setValue:function(e,r){var o=n.preprocess(r),i=t.get(e);tp.setValue(i,o)}}})},eN=function(t,e,n){return tp.config(Co({store:{mode:"manual",getValue:e,setValue:n}},t.map((function(t){return{store:{initialValue:t}}})).getOr({})))},nN=function(t,e,n){return eN(t,(function(t){return e(t.element)}),(function(t,e){return n(t.element,e)}))},rN=function(t){return nN(t,ds,ms)},oN=function(t){return nN(t,Ga,Ka)},iN=function(t){return tp.config({store:{mode:"memory",initialValue:t}})},uN={memento:tN,withElement:nN,withComp:eN,domValue:rN,domHtml:oN,memory:iN},aN="jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",cN=function(t,e){var n=QR.explode(e.getSetting("images_file_types",aN,"string")),r=function(t){return j(n,(function(e){return Wt(t.name.toLowerCase(),"."+e.toLowerCase())}))};return Y(mt(t),r)},sN=function(t,e){var n=function(t,e){e.stop()},r=function(t){return function(e,n){G(t,(function(t){t(e,n)}))}},o=function(t,e){if(!Hv.isDisabled(t)){var n=e.event.raw;u(t,n.dataTransfer.files)}},i=function(t,e){var n=e.event.raw.target;u(t,n.files)},u=function(n,r){tp.setValue(n,cN(r,e)),Sa(n,EA,{name:t.name})},a=kC({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:mf([Fw("input-file-events",[Pa(Wu()),Pa(ra())])])}),c=function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:mf([uN.memory([]),WR.self(),Hv.config({}),hx.config({toggleClass:"dragenter",toggleOnExecute:!1}),Fw("dropzone-events",[za("dragenter",r([n,hx.toggle])),za("dragleave",r([n,hx.toggle])),za("dragover",n),za("drop",r([n,o])),za(ju(),i)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:e.translate("Drop an image here")}},SC.sketch({dom:{tag:"button",innerHtml:e.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[a.asSpec()],action:function(t){var e=a.get(t);e.element.dom.click()},buttonBehaviours:mf([yA.config({}),mO.button(e.isDisabled),cO()])})]}]}},s=t.label.map((function(t){return OA(t,e)})),l=hA.parts.field({factory:{sketch:c}});return xA(s,l,["tox-form__group--stretched"],[])},lN=function(t,e){return{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+t.columns+"col"]},components:$(t.items,e.interpreter)}},fN=oc("alloy-fake-before-tabstop"),dN=oc("alloy-fake-after-tabstop"),mN=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:mf([Yw.config({ignore:!0}),yA.config({})])}},gN=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[mN([fN]),t,mN([dN])],behaviours:mf([WR.childAt(1)])}},hN=function(t,e){Sa(t,Vu(),{raw:{which:9,shiftKey:e}})},pN=function(t,e){var n=e.element;cs(n,fN)?hN(t,!0):cs(n,dN)&&hN(t,!1)},vN=function(t){return L_(t,["."+fN,"."+dN].join(","),O)},bN=!(en().browser.isIE()||en().browser.isEdge()),yN=function(t){var e=ou("");return{getValue:function(t){return e.get()},setValue:function(n,r){if(t)Vn(n.element,"srcdoc",r);else{Vn(n.element,"src","javascript:''");var o=n.element.dom.contentWindow.document;o.open(),o.write(r),o.close()}e.set(r)}}},wN=function(t,e){var n=bN&&t.sandboxed,r=A(A({},t.label.map((function(t){return{title:t}})).getOr({})),n?{sandbox:"allow-scripts allow-same-origin"}:{}),o=yN(n),i=t.label.map((function(t){return OA(t,e)})),u=function(t){return gN({uid:t.uid,dom:{tag:"iframe",attributes:r},behaviours:mf([yA.config({}),Yw.config({}),uN.withComp(L.none(),o.getValue,o.setValue)])})},a=hA.parts.field({factory:{sketch:u}});return xA(i,a,["tox-form__group--stretched"],[])},xN=function(t,e){return kN(document.createElement("canvas"),t,e)},CN=function(t){var e=xN(t.width,t.height),n=SN(e);return n.drawImage(t,0,0),e},SN=function(t){return t.getContext("2d")},kN=function(t,e,n){return t.width=e,t.height=n,t},TN=function(t){return t.naturalWidth||t.width},ON=function(t){return t.naturalHeight||t.height},EN=function(t){return new $A((function(e,n){var r=URL.createObjectURL(t),o=new Image,i=function(){o.removeEventListener("load",u),o.removeEventListener("error",a)},u=function(){i(),e(o)},a=function(){i(),n("Unable to load data of type "+t.type+": "+r)};o.addEventListener("load",u),o.addEventListener("error",a),o.src=r,o.complete&&setTimeout(u,0)}))},_N=function(t){var e=t.split(","),n=/data:([^;]+)/.exec(e[0]);if(!n)return L.none();for(var r=n[1],o=e[1],i=1024,u=atob(o),a=u.length,c=Math.ceil(a/i),s=new Array(c),l=0;ln?r=n:rn?t=n:t2)&&(i=i<.5?.5:2,a=!0),(u<.5||u>2)&&(u=u<.5?.5:2,a=!0);var c=aB(t,i,u);return a?c.then((function(t){return uB(t,e,n)})):c},aB=function(t,e,n){return new $A((function(r){var o=TN(t),i=ON(t),u=Math.floor(o*e),a=Math.floor(i*n),c=xN(u,a),s=SN(c);s.drawImage(t,0,0,o,i,0,0,u,a),r(c)}))},cB=function(t,e){void 0===e&&(e=2);var n=Math.pow(10,e),r=Math.round(t*n);return Math.ceil(r/n)},sB=function(t,e){return t.toCanvas().then((function(n){return lB(n,t.getType(),e)}))},lB=function(t,e,n){var r=n<0?360+n:n,o=r*Math.PI/180,i=t.width,u=t.height,a=Math.sin(o),c=Math.cos(o),s=cB(Math.abs(i*c)+Math.abs(u*a)),l=cB(Math.abs(i*a)+Math.abs(u*c)),f=xN(s,l),d=SN(f);return d.translate(s/2,l/2),d.rotate(o),d.drawImage(t,-i/2,-u/2),HN(f,e)},fB=function(t,e){return t.toCanvas().then((function(n){return dB(n,t.getType(),e)}))},dB=function(t,e,n){var r=xN(t.width,t.height),o=SN(r);return"v"===n?(o.scale(1,-1),o.drawImage(t,0,-r.height)):(o.scale(-1,1),o.drawImage(t,-r.width,0)),HN(r,e)},mB=function(t,e,n,r,o){return t.toCanvas().then((function(i){return gB(i,t.getType(),e,n,r,o)}))},gB=function(t,e,n,r,o,i){var u=xN(o,i),a=SN(u);return a.drawImage(t,-n,-r),HN(u,e)},hB=function(t,e,n){return t.toCanvas().then((function(r){return uB(r,e,n).then((function(e){return HN(e,t.getType())}))}))},pB=function(t){return tB(t)},vB=function(t){return oB(t)},bB=function(t,e){return iB(t,e)},yB=function(t,e,n,r){return rB(t,e,n,r)},wB=function(t,e){return eB(t,e)},xB=function(t,e){return nB(t,e)},CB=function(t,e){return fB(t,e)},SB=function(t,e,n,r,o){return mB(t,e,n,r,o)},kB=function(t,e,n){return hB(t,e,n)},TB=function(t,e){return sB(t,e)},OB=function(t,e,n){return LC(t,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:n},e)},EB=function(t,e){return OB(t,e,[])},_B=function(t,e){return OB(t,e,[Pw.config({})])},AB=function(t,e,n){return{dom:{tag:"span",innerHtml:n.translate(t),classes:[e+"__select-label"]},behaviours:mf([Pw.config({})])}},DB=oc("toolbar.button.execute"),MB=function(t){return qa((function(e,n){gO(t,e)((function(n){Sa(e,DB,{buttonApi:n}),t.onAction(n)}))}))},zB=(xD={},xD[ea()]=["disabling","alloy.base.behaviour","toggling","toolbar-button-events"],xD),RB=oc("update-menu-text"),NB=oc("update-menu-icon"),BB=function(t,e,n){var r=ou(p),o=t.text.map((function(t){return kC(AB(t,e,n.providers))})),i=t.icon.map((function(t){return kC(_B(t,n.providers.icons))})),u=function(t,e){var n=tp.getValue(t);return Yw.focus(n),Sa(n,"keydown",{raw:e.event.raw}),HD.close(n),L.some(!0)},a=t.role.fold((function(){return{}}),(function(t){return{role:t}})),c=t.tooltip.fold((function(){return{}}),(function(t){var e=n.providers.translate(t);return{title:e,"aria-label":e}})),s=LC("chevron-down",{tag:"div",classes:[e+"__select-chevron"]},n.providers.icons),l=kC(HD.sketch(A(A(A({},t.uid?{uid:t.uid}:{}),a),{dom:{tag:"button",classes:[e,e+"--select"].concat($(t.classes,(function(t){return e+"--"+t}))),attributes:A({},c)},components:yO([i.map((function(t){return t.asSpec()})),o.map((function(t){return t.asSpec()})),L.some(s)]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:mf(M(M([],t.dropdownBehaviours,!0),[mO.button((function(){return t.disabled||n.providers.isDisabled()})),cO(),FD.config({}),Pw.config({}),Fw("dropdown-events",[hO(t,r),pO(t,r)]),Fw("menubutton-update-display-text",[za(RB,(function(t,e){o.bind((function(e){return e.getOpt(t)})).each((function(t){Pw.set(t,[Ss(n.providers.translate(e.event.text))])}))})),za(NB,(function(t,e){i.bind((function(e){return e.getOpt(t)})).each((function(t){Pw.set(t,[_B(e.event.icon,n.providers.icons)])}))}))])],!1)),eventOrder:Co(zB,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:mf([Aw.config({mode:"special",onLeft:u,onRight:u})]),lazySink:n.getSink,toggleClass:e+"--active",parts:{menu:pk(!1,t.columns,t.presets)},fetch:function(e){return tD.nu(S(t.fetch,e))}})));return l.asSpec()},LB=function(t){return i(t)},HB=function(t){return"separator"===t.type},IB=function(t){return Et(t,"getSubmenuItems")},PB={type:"separator"},VB=function(t,e){var n=Q(t,(function(t,n){return LB(n)?""===n?t:"|"===n?t.length>0&&!HB(t[t.length-1])?t.concat([PB]):t:Et(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])}),[]);return n.length>0&&HB(n[n.length-1])&&n.pop(),n},FB=function(t,e){var n=t.getSubmenuItems(),r=WB(n,e),o=Co(r.menus,mu(t.value,r.items)),i=Co(r.expansions,mu(t.value,t.value));return{item:t,menus:o,expansions:i}},UB=function(t,e){return IB(t)?FB(t,e):{item:t,menus:{},expansions:{}}},jB=function(t){if(HB(t))return t;var e=Ot(t,"value").getOrThunk((function(){return oc("generated-menu-item")}));return Co({value:e},t)},WB=function(t,e){var n=VB(i(t)?t.split(" "):t,e);return J(n,(function(t,n){var r=jB(n),o=UB(r,e);return{menus:Co(t.menus,o.menus),items:[o.item].concat(t.items),expansions:Co(t.expansions,o.expansions)}}),{menus:{},expansions:{},items:[]})},qB=function(t,e,n,r){var o=oc("primary-menu"),i=WB(t,n.shared.providers.menuItems());if(0===i.items.length)return L.none();var u=M_(o,i.items,e,n,r),a=bt(i.menus,(function(t,r){return M_(r,t,e,n,!1)})),c=Co(a,mu(o,u));return L.from(Qx.tieredData(o,c,i.expansions))},$B=function(t){return{isDisabled:function(){return Hv.isDisabled(t)},setDisabled:function(e){return Hv.set(t,e)},setActive:function(e){var n=t.element;e?(is(n,"tox-tbtn--enabled"),Vn(n,"aria-pressed",!0)):(as(n,"tox-tbtn--enabled"),qn(n,"aria-pressed"))},isActive:function(){return cs(t.element,"tox-tbtn--enabled")}}},GB=function(t,e,n,r){return BB({text:t.text,icon:t.icon,tooltip:t.tooltip,role:r,fetch:function(e,r){t.fetch((function(t){r(qB(t,jS.CLOSE_ON_EXECUTE,n,!1))}))},onSetup:t.onSetup,getApi:$B,columns:1,presets:"normal",classes:[],dropdownBehaviours:[yA.config({})]},e,n.shared)},KB=function(t,e,n){var r=function(t){return function(r){var o=!r.isActive();r.setActive(o),t.storage.set(o),n.shared.getSink().each((function(n){e().getOpt(n).each((function(e){Sf(e.element),Sa(e,DA,{name:t.name,value:t.storage.get()})}))}))}},o=function(t){return function(e){e.setActive(t.storage.get())}};return function(e){e($(t,(function(t){var e=t.text.fold((function(){return{}}),(function(t){return{text:t}}));return A(A({type:t.type,active:!1},e),{onAction:r(t),onSetup:o(t)})})))}},XB=function(t,e,n,r,o,i){void 0===n&&(n=[]);var u=e.fold((function(){return{}}),(function(t){return{action:t}})),a=A({buttonBehaviours:mf([mO.button((function(){return t.disabled||i.isDisabled()})),cO(),yA.config({}),Fw("button press",[Ma("click"),Ma("mousedown")])].concat(n)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},u),c=Co(a,{dom:r});return Co(c,{components:o})},YB=function(t,e,n,r){void 0===r&&(r=[]);var o=t.tooltip.map((function(t){return{"aria-label":n.translate(t),title:n.translate(t)}})).getOr({}),i={tag:"button",classes:["tox-tbtn"],attributes:o},u=t.icon.map((function(t){return EB(t,n.icons)})),a=yO([u]);return XB(t,e,r,i,a,n)},JB=function(t,e,n,r){void 0===r&&(r=[]);var o=YB(t,L.some(e),n,r);return SC.sketch(o)},QB=function(t,e,n,r,o){void 0===r&&(r=[]),void 0===o&&(o=[]);var i=n.translate(t.text),u=t.icon?t.icon.map((function(t){return EB(t,n.icons)})):L.none(),a=u.isSome()?yO([u]):[],c=u.isSome()?{}:{innerHtml:i},s=M(M(M(M([],t.primary||t.borderless?["tox-button"]:["tox-button","tox-button--secondary"],!0),u.isSome()?["tox-button--icon"]:[],!0),t.borderless?["tox-button--naked"]:[],!0),o,!0),l=A(A({tag:"button",classes:s},c),{attributes:{title:i}});return XB(t,e,r,l,a,n)},ZB=function(t,e,n,r,o){void 0===r&&(r=[]),void 0===o&&(o=[]);var i=QB(t,L.some(e),n,r,o);return SC.sketch(i)},tL=function(t,e){return function(n){"custom"===e?Sa(n,DA,{name:t,value:{}}):"submit"===e?Ca(n,MA):"cancel"===e?Ca(n,AA):console.error("Unknown button type: ",e)}},eL=function(t,e){return"menu"===e},nL=function(t,e){return"custom"===e||"cancel"===e||"submit"===e},rL=function(t,e,n){if(eL(t,e)){var r=function(){return u},o=t,i=A(A({},t),{onSetup:function(e){return e.setDisabled(t.disabled),p},fetch:KB(o.items,r,n)}),u=kC(GB(i,"tox-tbtn",n,L.none()));return u.asSpec()}if(nL(t,e)){var a=tL(t.name,e),c=A(A({},t),{borderless:!1});return ZB(c,a,n.shared.providers,[])}console.error("Unknown footer button type: ",e)},oL=function(t,e){var n=tL(t.name,"custom");return CA(L.none(),hA.parts.field(A({factory:SC},QB(t,L.some(n),e,[uN.memory(""),WR.self()]))))},iL=w([Ki("field1Name","field1"),Ki("field2Name","field2"),sl("onLockedChange"),il(["lockClass"]),Ki("locked",!1),op.field("coupledFieldBehaviours",[bv,tp])]),uL=function(t,e,n){return Kp(t,e,n).bind(bv.getCurrent)},aL=function(t,e){return Rp({factory:hA,name:t,overrides:function(t){return{fieldBehaviours:mf([Fw("coupled-input-behaviour",[za(Uu(),(function(n){uL(n,t,e).each((function(e){Kp(n,t,"lock").each((function(r){hx.isOn(r)&&t.onLockedChange(n,e,r)}))}))}))])])}}})},cL=w([aL("field1","field2"),aL("field2","field1"),Rp({factory:SC,schema:[Ai("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:mf([hx.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),sL=function(t,e,n,r){return{uid:t.uid,dom:t.dom,components:e,behaviours:op.augment(t.coupledFieldBehaviours,[bv.config({find:L.some}),tp.config({store:{mode:"manual",getValue:function(e){var n,r=Zp(e,t,["field1","field2"]);return n={},n[t.field1Name]=tp.getValue(r.field1()),n[t.field2Name]=tp.getValue(r.field2()),n},setValue:function(e,n){var r=Zp(e,t,["field1","field2"]);_t(n,t.field1Name)&&tp.setValue(r.field1(),n[t.field1Name]),_t(n,t.field2Name)&&tp.setValue(r.field2(),n[t.field2Name])}}})]),apis:{getField1:function(e){return Kp(e,t,"field1")},getField2:function(e){return Kp(e,t,"field2")},getLock:function(e){return Kp(e,t,"lock")}}}},lL=mv({name:"FormCoupledInputs",configFields:iL(),partFields:cL(),factory:sL,apis:{getField1:function(t,e){return t.getField1(e)},getField2:function(t,e){return t.getField2(e)},getLock:function(t,e){return t.getLock(e)}}}),fL=function(t){var e={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4},n=function(t){return t in e?e[t]:1},r=t.value.toFixed(n(t.unit));return-1!==r.indexOf(".")&&(r=r.replace(/\.?0*$/,"")),r+t.unit},dL=function(t){var e=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/,n=e.exec(t);if(null!==n){var r=parseFloat(n[1]),o=n[2];return ro.value({value:r,unit:o})}return ro.error(t)},mL=function(t,e){var n={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},r=function(t){return Et(n,t)};return t.unit===e?L.some(t.value):r(t.unit)&&r(e)?n[t.unit]===n[e]?L.some(t.value):L.some(t.value/n[t.unit]*n[e]):L.none()},gL=function(t){return L.none()},hL=function(t,e){return function(n){return mL(n,e).map((function(n){return{value:n*t,unit:e}}))}},pL=function(t,e){var n=dL(t).toOptional(),r=dL(e).toOptional();return Rt(n,r,(function(t,e){return mL(t,e.unit).map((function(t){return e.value/t})).map((function(t){return hL(t,e.unit)})).getOr(gL)})).getOr(gL)},vL=function(t,e){var n=gL,r=oc("ratio-event"),o=function(t){return LC(t,{tag:"span",classes:["tox-icon","tox-lock-icon__"+t]},e.icons)},i=lL.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:e.translate(t.label.getOr("Constrain proportions"))}},components:[o("lock"),o("unlock")],buttonBehaviours:mf([Hv.config({disabled:function(){return t.disabled||e.isDisabled()}}),cO(),yA.config({})])}),u=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},a=function(n){return hA.parts.field({factory:UA,inputClasses:["tox-textfield"],inputBehaviours:mf([Hv.config({disabled:function(){return t.disabled||e.isDisabled()}}),cO(),yA.config({}),Fw("size-input-events",[za(Iu(),(function(t,e){Sa(t,r,{isField1:n})})),za(ju(),(function(e,n){Sa(e,EA,{name:t.name})}))])]),selectOnFocus:!1})},c=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:e.translate(t)}}},s=lL.parts.field1(u([hA.parts.label(c("Width")),a(!0)])),l=lL.parts.field2(u([hA.parts.label(c("Height")),a(!1)]));return lL.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[s,l,u([c(" "),i])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(t,e,r){dL(tp.getValue(t)).each((function(t){n(t).each((function(t){tp.setValue(e,fL(t))}))}))},coupledFieldBehaviours:mf([Hv.config({disabled:function(){return t.disabled||e.isDisabled()},onDisabled:function(t){lL.getField1(t).bind(hA.getField).each(Hv.disable),lL.getField2(t).bind(hA.getField).each(Hv.disable),lL.getLock(t).each(Hv.disable)},onEnabled:function(t){lL.getField1(t).bind(hA.getField).each(Hv.enable),lL.getField2(t).bind(hA.getField).each(Hv.enable),lL.getLock(t).each(Hv.enable)}}),cO(),Fw("size-input-events2",[za(r,(function(t,e){var r=e.event.isField1,o=r?lL.getField1(t):lL.getField2(t),i=r?lL.getField2(t):lL.getField1(t),u=o.map(tp.getValue).getOr(""),a=i.map(tp.getValue).getOr("");n=pL(u,a)}))])])})},bL=w(oc("undo")),yL=w(oc("redo")),wL=w(oc("zoom")),xL=w(oc("back")),CL=w(oc("apply")),SL=w(oc("swap")),kL=w(oc("transform")),TL=w(oc("temp-transform")),OL=w(oc("transform-apply")),EL={undo:bL,redo:yL,zoom:wL,back:xL,apply:CL,swap:SL,transform:kL,tempTransform:TL,transformApply:OL},_L=w("save-state"),AL=w("disable"),DL=w("enable"),ML={formActionEvent:DA,saveState:_L,disable:AL,enable:DL},zL=function(t,e){var n=function(t,n,r,o){return kC(ZB({name:t,text:t,disabled:r,primary:o,icon:L.none(),borderless:!1},n,e))},r=function(t,n,r,o){return kC(JB({name:t,icon:L.some(t),tooltip:L.some(n),disabled:o,primary:!1,borderless:!1},r,e))},o=function(t,e){t.map((function(t){var n=t.get(e);n.hasConfigured(Hv)&&Hv.disable(n)}))},i=function(t,e){t.map((function(t){var n=t.get(e);n.hasConfigured(Hv)&&Hv.enable(n)}))},u={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},a=p,c=function(t,e,n){Sa(t,e,n)},s=function(t){return Ca(t,ML.disable())},l=function(t){return Ca(t,ML.enable())},f=function(t,e){s(t),c(t,EL.transform(),{transform:e}),l(t)},d=function(t,e){s(t),c(t,EL.tempTransform(),{transform:e}),l(t)},m=function(t){return function(){ut.getOpt(t).each((function(t){Pw.set(t,[ot])}))}},g=function(t,e){s(t),c(t,EL.transformApply(),{transform:e,swap:m(t)}),l(t)},h=function(){return n("Back",(function(t){return c(t,EL.back(),{swap:m(t)})}),!1,!1)},v=function(){return kC({dom:{tag:"div",classes:["tox-spacer"]},behaviours:mf([Hv.config({})])})},b=function(){return n("Apply",(function(t){return c(t,EL.apply(),{swap:m(t)})}),!0,!0)},y=function(){return function(e){var n=t.getRect();return SB(e,n.x,n.y,n.w,n.h)}},x=[h(),v(),n("Apply",(function(e){var n=y();g(e,n),t.hideCrop()}),!1,!0)],C=sA.sketch({dom:u,components:x.map((function(t){return t.asSpec()})),containerBehaviours:mf([Fw("image-tools-crop-buttons-events",[za(ML.disable(),(function(t,e){o(x,t)})),za(ML.enable(),(function(t,e){i(x,t)}))])])}),S=kC(vL({name:"size",label:L.none(),constrain:!0,disabled:!1},e)),k=function(t,e){return function(n){return kB(n,t,e)}},T=[h(),v(),S,v(),n("Apply",(function(t){S.getOpt(t).each((function(e){var n=tp.getValue(e),r=parseInt(n.width,10),o=parseInt(n.height,10),i=k(r,o);g(t,i)}))}),!1,!0)],O=sA.sketch({dom:u,components:T.map((function(t){return t.asSpec()})),containerBehaviours:mf([Fw("image-tools-resize-buttons-events",[za(ML.disable(),(function(t,e){o(T,t)})),za(ML.enable(),(function(t,e){i(T,t)}))])])}),E=function(t,e){return function(n){return t(n,e)}},_=E(CB,"h"),A=E(CB,"v"),D=E(TB,-90),M=E(TB,90),z=function(t,e){d(t,e)},R=[h(),v(),r("flip-horizontally","Flip horizontally",(function(t){z(t,_)}),!1),r("flip-vertically","Flip vertically",(function(t){z(t,A)}),!1),r("rotate-left","Rotate counterclockwise",(function(t){z(t,D)}),!1),r("rotate-right","Rotate clockwise",(function(t){z(t,M)}),!1),v(),b()],N=sA.sketch({dom:u,components:R.map((function(t){return t.asSpec()})),containerBehaviours:mf([Fw("image-tools-fliprotate-buttons-events",[za(ML.disable(),(function(t,e){o(R,t)})),za(ML.enable(),(function(t,e){i(R,t)}))])])}),B=function(t,n,r,o,i){var u=CR.parts.label({dom:{tag:"label",classes:["tox-label"],innerHtml:e.translate(t)}}),a=CR.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),c=CR.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return kC(CR.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:r,maxX:i,getInitialValue:w({x:o})},components:[u,a,c],sliderBehaviours:mf([Yw.config({})]),onChoose:n}))},H=function(t,e,n,r,o){var i=function(t,n,r){var o=E(e,r.x/100);f(t,o)};return B(t,i,n,r,o)},I=function(t,e,n,r,o){return[h(),H(t,e,n,r,o),b()]},P=function(t,e,n,r,a){var c=I(t,e,n,r,a);return sA.sketch({dom:u,components:c.map((function(t){return t.asSpec()})),containerBehaviours:mf([Fw("image-tools-filter-panel-buttons-events",[za(ML.disable(),(function(t,e){o(c,t)})),za(ML.enable(),(function(t,e){i(c,t)}))])])})},V=[h(),v(),b()],F=sA.sketch({dom:u,components:V.map((function(t){return t.asSpec()}))}),U=P("Brightness",wB,-100,0,100),j=P("Contrast",xB,-100,0,100),W=P("Gamma",bB,-100,0,100),q=function(t,e,n){return function(r){return yB(r,t,e,n)}},$=function(t){var e=function(t,e,n){var r=G.getOpt(t),o=X.getOpt(t),i=K.getOpt(t);r.each((function(e){o.each((function(n){i.each((function(r){var o=tp.getValue(e).x/100,i=tp.getValue(r).x/100,u=tp.getValue(n).x/100,a=q(o,i,u);f(t,a)}))}))}))};return B(t,e,0,100,200)},G=$("R"),K=$("G"),X=$("B"),Y=[h(),G,K,X,b()],J=sA.sketch({dom:u,components:Y.map((function(t){return t.asSpec()}))}),Q=function(t,e,n){return function(r){var o=function(){ut.getOpt(r).each((function(e){Pw.set(e,[t]),n(e)}))};c(r,EL.swap(),{transform:e,swap:o})}},Z=function(e){t.showCrop()},tt=function(e){S.getOpt(e).each((function(e){var n=t.getMeasurements(),r=n.width,o=n.height;tp.setValue(e,{width:r,height:o})}))},et=L.some(vB),nt=L.some(pB),rt=[r("crop","Crop",Q(C,L.none(),Z),!1),r("resize","Resize",Q(O,L.none(),tt),!1),r("orientation","Orientation",Q(N,L.none(),a),!1),r("brightness","Brightness",Q(U,L.none(),a),!1),r("sharpen","Sharpen",Q(F,et,a),!1),r("contrast","Contrast",Q(j,L.none(),a),!1),r("color-levels","Color levels",Q(J,L.none(),a),!1),r("gamma","Gamma",Q(W,L.none(),a),!1),r("invert","Invert",Q(F,nt,a),!1)],ot=sA.sketch({dom:u,components:rt.map((function(t){return t.asSpec()}))}),it=sA.sketch({dom:{tag:"div"},components:[ot],containerBehaviours:mf([Pw.config({})])}),ut=kC(it),at=function(t){return ut.getOpt(t).map((function(t){var e=t.components()[0];return e.components()[e.components().length-1]}))};return{memContainer:ut,getApplyButton:at}},RL=tinymce.util.Tools.resolve("tinymce.geom.Rect"),NL=tinymce.util.Tools.resolve("tinymce.util.Observable"),BL=tinymce.util.Tools.resolve("tinymce.util.VK"),LL=function(t){var e=Math.max,n=t.documentElement,r=t.body,o=e(n.scrollWidth,r.scrollWidth),i=e(n.clientWidth,r.clientWidth),u=e(n.offsetWidth,r.offsetWidth),a=e(n.scrollHeight,r.scrollHeight),c=e(n.clientHeight,r.clientHeight),s=e(n.offsetHeight,r.offsetHeight);return{width:o=1?n.set(1):n.set(a)}))},c=function(t,e){var n=ee.fromTag("img");return Vn(n,"src",e),jL(n.dom).then((function(){t.getSystem().isConnected()&&g.getOpt(t).map((function(t){var e=ks({element:n});Pw.replaceAt(t,1,L.some(e));var r=i.get(),c={x:0,y:0,w:n.dom.naturalWidth,h:n.dom.naturalHeight};i.set(c);var s=RL.inflate(c,-20,-20);o.set(s),r.w===c.w&&r.h===c.h||a(t,n),u(t,n)}))}))},s=function(t,e){var r=n.get(),o=e>0?Math.min(2,r+.1):Math.max(.1,r-.1);n.set(o),g.getOpt(t).each((function(t){var e=t.components()[1].element;u(t,e)}))},l=function(){r.run((function(t){t.toggleVisibility(!0)}))},f=function(){r.run((function(t){t.toggleVisibility(!1)}))},d=function(){return o.get()},m=sA.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[e.asSpec(),{dom:{tag:"img",attributes:{src:t}}},{dom:{tag:"div"},behaviours:mf([Fw("image-panel-crop-events",[Ua((function(t){g.getOpt(t).each((function(t){var e=t.element.dom,i=UL.create({x:10,y:10,w:100,h:100},{x:0,y:0,w:200,h:200},{x:0,y:0,w:200,h:200},e,p);i.toggleVisibility(!1),i.on("updateRect",(function(t){var e=t.rect,r=n.get(),i={x:Math.round(e.x/r),y:Math.round(e.y/r),w:Math.round(e.w/r),h:Math.round(e.h/r)};o.set(i)})),r.set(i)}))})),ja((function(){r.clear()}))])])}],containerBehaviours:mf([Pw.config({}),Fw("image-panel-events",[Ua((function(e){c(e,t)}))])])}),g=kC(m),h=function(){var t=i.get();return{width:t.w,height:t.h}};return{memContainer:g,updateSrc:c,zoom:s,showCrop:l,hideCrop:f,getRect:d,getMeasurements:h}},qL=function(t,e,n,r,o){return JB({name:t,icon:L.some(e),disabled:n,tooltip:L.some(t),primary:!1,borderless:!1},r,o)},$L=function(t,e){e?Hv.enable(t):Hv.disable(t)},GL=function(t){var e=function(t,e,o){n.getOpt(t).each((function(t){$L(t,e)})),r.getOpt(t).each((function(t){$L(t,o)}))},n=kC(qL("Undo","undo",!0,(function(t){Sa(t,EL.undo(),{direction:1})}),t)),r=kC(qL("Redo","redo",!0,(function(t){Sa(t,EL.redo(),{direction:1})}),t)),o=sA.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[n.asSpec(),r.asSpec(),qL("Zoom in","zoom-in",!1,(function(t){Sa(t,EL.zoom(),{direction:1})}),t),qL("Zoom out","zoom-out",!1,(function(t){Sa(t,EL.zoom(),{direction:-1})}),t)]});return{container:o,updateButtonUndoStates:e}};function KL(){var t=[],e=-1,n=function(n){var r=t.splice(++e);return t.push(n),{state:n,removed:r}},r=function(){if(i())return t[--e]},o=function(){if(u())return t[++e]},i=function(){return e>0},u=function(){return-1!==e&&e1?L.none():L.some(LC("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},e.icons)),u={dom:{tag:"div",classes:["tox-selectfield"]},components:nt([[o],i.toArray()])};return hA.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:nt([r.toArray(),[u]]),fieldBehaviours:mf([Hv.config({disabled:function(){return t.disabled||e.isDisabled()},onDisabled:function(t){hA.getField(t).each(Hv.disable)},onEnabled:function(t){hA.getField(t).each(Hv.enable)}}),cO()])})},cH=function(t,e){var n=function(t){return{dom:{tag:"th",innerHtml:e.translate(t)}}},r=function(t){return{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:$(t,n)}]}},o=function(t){return{dom:{tag:"td",innerHtml:e.translate(t)}}},i=function(t){return{dom:{tag:"tr"},components:$(t,o)}},u=function(t){return{dom:{tag:"tbody"},components:$(t,i)}};return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[r(t.header),u(t.cells)],behaviours:mf([yA.config({}),Yw.config({})])}},sH=function(t,e){var n=t.label.map((function(t){return OA(t,e)})),r=[Hv.config({disabled:function(){return t.disabled||e.isDisabled()}}),cO(),Aw.config({mode:"execution",useEnter:!0!==t.multiline,useControlEnter:!0===t.multiline,execute:function(t){return Ca(t,MA),L.some(!0)}}),Fw("textfield-change",[za(Uu(),(function(e,n){Sa(e,EA,{name:t.name})})),za(Zu(),(function(e,n){Sa(e,EA,{name:t.name})}))]),yA.config({})],o=t.validation.map((function(t){return dD.config({getRoot:function(t){return vn(t.element)},invalidClass:"tox-invalid",validator:{validate:function(e){var n=tp.getValue(e),r=t.validator(n);return tD.pure(!0===r?ro.value(n):ro.error(r))},validateOnLoad:t.validateOnLoad}})})).toArray(),i=t.placeholder.fold(w({}),(function(t){return{placeholder:e.translate(t)}})),u=t.inputMode.fold(w({}),(function(t){return{inputmode:t}})),a=A(A({},i),u),c=hA.parts.field({tag:!0===t.multiline?"textarea":"input",inputAttributes:a,inputClasses:[t.classname],inputBehaviours:mf(nt([r,o])),selectOnFocus:!1,factory:UA}),s=t.flex?["tox-form__group--stretched"]:[],l=s.concat(t.maximized?["tox-form-group--maximize"]:[]),f=[Hv.config({disabled:function(){return t.disabled||e.isDisabled()},onDisabled:function(t){hA.getField(t).each(Hv.disable)},onEnabled:function(t){hA.getField(t).each(Hv.enable)}}),cO()];return xA(n,c,l,f)},lH=function(t,e){return sH({name:t.name,multiline:!1,label:t.label,inputMode:t.inputMode,placeholder:t.placeholder,flex:!1,disabled:t.disabled,classname:"tox-textfield",validation:L.none(),maximized:t.maximized},e)},fH=function(t,e){return sH({name:t.name,multiline:!0,label:t.label,inputMode:L.none(),placeholder:t.placeholder,flex:!0,disabled:t.disabled,classname:"tox-textarea",validation:L.none(),maximized:t.maximized},e)},dH=function(t,e){var n=t.stream.streams,r=n.setup(t,e);return _a([za(t.event,r),ja((function(){return e.cancel()}))].concat(t.cancelEvent.map((function(t){return[za(t,(function(){return e.cancel()}))]})).getOr([])))},mH=Object.freeze({__proto__:null,events:dH}),gH=function(t){var e=ou(null),n=function(){return{timer:null!==e.get()?"set":"unset"}},r=function(t){e.set(t)},o=function(){var t=e.get();null!==t&&t.cancel()};return Tc({readState:n,setTimer:r,cancel:o})},hH=function(t){return t.stream.streams.state(t)},pH=Object.freeze({__proto__:null,throttle:gH,init:hH}),vH=function(t,e){var n=t.stream,r=WC(t.onStream,n.delay);return e.setTimer(r),function(t,e){r.throttle(t,e),n.stopEvent&&e.stop()}},bH=[Di("stream",ki("mode",{throttle:[Ai("delay"),Ki("stopEvent",!0),fl("streams",{setup:vH,state:gH})]})),Ki("event","input"),Vi("cancelEvent"),sl("onStream")],yH=hf({fields:bH,name:"streaming",active:mH,state:pH}),wH=function(t,e,n){var r=tp.getValue(n);tp.setValue(e,r),CH(e)},xH=function(t,e){var n=t.element,r=ds(n),o=n.dom;"number"!==Un(n,"type")&&e(o,r)},CH=function(t){xH(t,(function(t,e){return t.setSelectionRange(e.length,e.length)}))},SH=function(t,e){xH(t,(function(t,n){return t.setSelectionRange(e,n.length)}))},kH=function(t,e,n){if(t.selectsOver){var r=tp.getValue(e),o=t.getDisplayText(r),i=tp.getValue(n),u=t.getDisplayText(i);return 0===u.indexOf(o)?L.some((function(){wH(t,e,n),SH(e,o.length)})):L.none()}return L.none()},TH=w("alloy.typeahead.itemexecute"),OH=function(t,e,n,r){var o=function(e,n,o){t.previewing.set(!1);var i=bD.getCoupled(e,"sandbox");if(bh.isOpen(i))bv.getCurrent(i).each((function(t){rb.getHighlighted(t).fold((function(){o(t)}),(function(){Ea(i,t.element,"keydown",n)}))}));else{var a=function(t){bv.getCurrent(t).each(o)};TD(t,u(e),e,i,r,a,qA.HighlightFirst).get(p)}},i=IA(t),u=function(t){return function(e){return e.map((function(e){var n=Tt(e.menus),r=rt(n,(function(t){return Y(t.items,(function(t){return"item"===t.type}))})),o=tp.getState(t);return o.update($(r,(function(t){return t.data}))),e}))}},a=[Yw.config({}),tp.config({onSetValue:t.onSetValue,store:A({mode:"dataset",getDataKey:function(t){return ds(t.element)},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(e,n){ms(e.element,t.model.getDisplayText(n))}},t.initialData.map((function(t){return mu("initialValue",t)})).getOr({}))}),yH.config({stream:{mode:"throttle",delay:t.responseTime,stopEvent:!1},onStream:function(e,n){var o=bD.getCoupled(e,"sandbox"),i=Yw.isFocused(e);if(i&&ds(e.element).length>=t.minChars){var a=bv.getCurrent(o).bind((function(t){return rb.getHighlighted(t).map(tp.getValue)}));t.previewing.set(!0);var c=function(e){bv.getCurrent(o).each((function(e){a.fold((function(){t.model.selectsOver&&rb.highlightFirst(e)}),(function(t){rb.highlightBy(e,(function(e){var n=tp.getValue(e);return n.value===t.value})),rb.getHighlighted(e).orThunk((function(){return rb.highlightFirst(e),L.none()}))}))}))};TD(t,u(e),e,o,r,c,qA.HighlightFirst).get(p)}},cancelEvent:ua()}),Aw.config({mode:"special",onDown:function(t,e){return o(t,e,rb.highlightFirst),L.some(!0)},onEscape:function(t){var e=bD.getCoupled(t,"sandbox");return bh.isOpen(e)?(bh.close(e),L.some(!0)):L.none()},onUp:function(t,e){return o(t,e,rb.highlightLast),L.some(!0)},onEnter:function(e){var n=bD.getCoupled(e,"sandbox"),r=bh.isOpen(n);if(r&&!t.previewing.get())return bv.getCurrent(n).bind((function(t){return rb.getHighlighted(t)})).map((function(t){return Sa(e,TH(),{item:t}),!0}));var o=tp.getValue(e);return Ca(e,ua()),t.onExecute(n,e,o),r&&bh.close(n),L.some(!0)}}),hx.config({toggleClass:t.markers.openClass,aria:{mode:"expanded"}}),bD.config({others:{sandbox:function(e){return MD(t,e,{onOpen:function(){return hx.on(e)},onClose:function(){return hx.off(e)}})}}}),Fw("typeaheadevents",[qa((function(e){var n=p;ED(t,u(e),e,r,n,qA.HighlightFirst).get(p)})),za(TH(),(function(e,n){var r=bD.getCoupled(e,"sandbox");wH(t.model,e,n.event.item),Ca(e,ua()),t.onItemExecute(e,r,n.event.item,tp.getValue(e)),bh.close(r),CH(e)}))].concat(t.dismissOnBlur?[za(Qu(),(function(t){var e=bD.getCoupled(t,"sandbox");Ef(e.element).isNone()&&bh.close(e)}))]:[]))];return{uid:t.uid,dom:VA(Co(t,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:A(A({},i),rp(t.typeaheadBehaviours,a)),eventOrder:t.eventOrder}},EH=w([Vi("lazySink"),Ai("fetch"),Ki("minChars",5),Ki("responseTime",1e3),al("onOpen"),Ki("getHotspot",L.some),Ki("getAnchorOverrides",w({})),Ki("layouts",L.none()),Ki("eventOrder",{}),ru("model",{},[Ki("getDisplayText",(function(t){return void 0!==t.meta&&void 0!==t.meta.text?t.meta.text:t.value})),Ki("selectsOver",!0),Ki("populateFromBrowse",!0)]),al("onSetValue"),cl("onExecute"),al("onItemExecute"),Ki("inputClasses",[]),Ki("inputAttributes",{}),Ki("inputStyles",{}),Ki("matchWidth",!0),Ki("useMinWidth",!1),Ki("dismissOnBlur",!0),il(["openClass"]),Vi("initialData"),ep("typeaheadBehaviours",[Yw,tp,yH,Aw,hx,bD]),Ei("previewing",(function(){return ou(!0)}))].concat(HA()).concat(RD())),_H=w([Np({schema:[ol()],name:"menu",overrides:function(t){return{fakeFocus:!0,onHighlight:function(e,n){t.previewing.get()?e.getSystem().getByUid(t.uid).each((function(r){kH(t.model,r,n).fold((function(){return rb.dehighlight(e,n)}),(function(t){return t()}))})):e.getSystem().getByUid(t.uid).each((function(e){t.model.populateFromBrowse&&wH(t.model,e,n)})),t.previewing.set(!1)},onExecute:function(e,n){return e.getSystem().getByUid(t.uid).toOptional().map((function(t){return Sa(t,TH(),{item:n}),!0}))},onHover:function(e,n){t.previewing.set(!1),e.getSystem().getByUid(t.uid).each((function(e){t.model.populateFromBrowse&&wH(t.model,e,n)}))}}}})]),AH=mv({name:"Typeahead",configFields:EH(),partFields:_H(),factory:OH}),DH=function(t){var e=function(){return DH(t.toCached())},n=function(e){return DH(t.bind((function(t){return t.fold((function(t){return tD.pure(ro.error(t))}),(function(t){return e(t)}))})))},r=function(e){return DH(t.map((function(t){return t.bind(e)})))},o=function(e){return DH(t.map((function(t){return t.map(e)})))},i=function(e){return DH(t.map((function(t){return t.mapError(e)})))},u=function(e,n){return t.map((function(t){return t.fold(e,n)}))},a=function(e,n){return DH(tD.nu((function(r){var o=!1,i=setTimeout((function(){o=!0,r(ro.error(n()))}),e);t.get((function(t){o||(clearTimeout(i),r(t))}))})))};return A(A({},t),{toCached:e,bindFuture:n,bindResult:r,mapResult:o,mapError:i,foldResult:u,withTimeout:a})},MH=function(t){return DH(tD.nu(t))},zH=function(t){return DH(tD.pure(ro.value(t)))},RH=function(t){return DH(tD.pure(ro.error(t)))},NH=function(t){return DH(tD.pure(t))},BH=function(t){return DH(t.map(ro.value))},LH=function(t){return MH((function(e){t.then((function(t){e(ro.value(t))}),(function(t){e(ro.error(t))}))}))},HH={nu:MH,wrap:DH,pure:zH,value:zH,error:RH,fromResult:NH,fromFuture:BH,fromPromise:LH},IH={type:"separator"},PH=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:p}},VH=function(t,e){return{type:"menuitem",value:e,text:t,meta:{attach:void 0},onAction:p}},FH=function(t){return $(t,PH)},UH=function(t,e){return Y(e,(function(e){return e.type===t}))},jH=function(t,e){return FH(UH(t,e))},WH=function(t){return jH("header",t.targets)},qH=function(t){return jH("anchor",t.targets)},$H=function(t){return L.from(t.anchorTop).map((function(t){return VH("",t)})).toArray()},GH=function(t){return L.from(t.anchorBottom).map((function(t){return VH("",t)})).toArray()},KH=function(t){return $(t,(function(t){return VH(t,t)}))},XH=function(t){return Q(t,(function(t,e){var n=0===t.length||0===e.length;return n?t.concat(e):t.concat(IH,e)}),[])},YH=function(t,e){var n=t.toLowerCase();return Y(e,(function(t){var e=void 0!==t.meta&&void 0!==t.meta.text?t.meta.text:t.text;return Ut(e.toLowerCase(),n)||Ut(t.value.toLowerCase(),n)}))},JH=function(t,e,n){var r=tp.getValue(e),o=void 0!==r.meta.text?r.meta.text:r.value,i=n.getLinkInformation();return i.fold((function(){return[]}),(function(e){var r=YH(o,KH(n.getHistory(t)));return"file"===t?XH([r,YH(o,WH(e)),YH(o,nt([$H(e),qH(e),GH(e)]))]):r}))},QH=oc("aria-invalid"),ZH=function(t,e,n){var r,o=e.shared.providers,i=function(e){var r=tp.getValue(e);n.addToHistory(r.value,t.filetype)},u=hA.parts.field({factory:AH,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":QH,type:"url"},minChars:0,responseTime:0,fetch:function(r){var o=JH(t.filetype,r,n),i=qB(o,jS.BUBBLE_TO_SANDBOX,e,!1);return tD.pure(i)},getHotspot:function(t){return m.getOpt(t)},onSetValue:function(t,e){t.hasConfigured(dD)&&dD.run(t).get(p)},typeaheadBehaviours:mf(nt([n.getValidationHandler().map((function(e){return dD.config({getRoot:function(t){return vn(t.element)},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(t,e){s.getOpt(t).each((function(t){Vn(t.element,"title",o.translate(e))}))}},validator:{validate:function(n){var r=tp.getValue(n);return HH.nu((function(n){e({type:t.filetype,url:r.value},(function(t){if("invalid"===t.status){var e=ro.error(t.message);n(e)}else{var r=ro.value(t.message);n(r)}}))}))},validateOnLoad:!1}})})).toArray(),[Hv.config({disabled:function(){return t.disabled||o.isDisabled()}}),yA.config({}),Fw("urlinput-events",nt(["file"===t.filetype?[za(Uu(),(function(e){Sa(e,EA,{name:t.name})}))]:[],[za(ju(),(function(e){Sa(e,EA,{name:t.name}),i(e)})),za(Zu(),(function(e){Sa(e,EA,{name:t.name}),i(e)}))]]))]])),eventOrder:(r={},r[Uu()]=["streaming","urlinput-events","invalidating"],r),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:e.shared.getSink,parts:{menu:pk(!1,1,"normal")},onExecute:function(t,e,n){Sa(e,MA,{})},onItemExecute:function(e,n,r,o){i(e),Sa(e,EA,{name:t.name})}}),a=t.label.map((function(t){return OA(t,o)})),c=function(t,e,n,r){return void 0===n&&(n=t),void 0===r&&(r=t),LC(n,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+t],attributes:A({title:o.translate(r),"aria-live":"polite"},e.fold((function(){return{}}),(function(t){return{id:t}})))},o.icons)},s=kC(c("invalid",L.some(QH),"warning")),l=kC({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[s.asSpec()]}),f=n.getUrlPicker(t.filetype),d=oc("browser.url.event"),m=kC({dom:{tag:"div",classes:["tox-control-wrap"]},components:[u,l.asSpec()],behaviours:mf([Hv.config({disabled:function(){return t.disabled||o.isDisabled()}})])}),g=kC(ZB({name:t.name,icon:L.some("browse"),text:t.label.getOr(""),disabled:t.disabled,primary:!1,borderless:!0},(function(t){return Ca(t,d)}),o,[],["tox-browse-url"])),h=function(){return{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:nt([[m.asSpec()],f.map((function(){return g.asSpec()})).toArray()])}},v=function(e){bv.getCurrent(e).each((function(n){var r=tp.getValue(n),o=A({fieldname:t.name},r);f.each((function(r){r(o).get((function(r){tp.setValue(n,r),Sa(e,EA,{name:t.name})}))}))}))};return hA.sketch({dom:kA(),components:a.toArray().concat([h()]),fieldBehaviours:mf([Hv.config({disabled:function(){return t.disabled||o.isDisabled()},onDisabled:function(t){hA.getField(t).each(Hv.disable),g.getOpt(t).each(Hv.disable)},onEnabled:function(t){hA.getField(t).each(Hv.enable),g.getOpt(t).each(Hv.enable)}}),cO(),Fw("url-input-events",[za(d,v)])])})},tI=function(t,e){return sA.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in","tox-notification--"+t.level]},components:[{dom:{tag:"div",classes:["tox-notification__icon"]},components:[SC.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:MC(t.icon,e.icons),attributes:{title:e.translate(t.iconTooltip)}},action:function(e){Sa(e,DA,{name:"alert-banner",value:t.url})},buttonBehaviours:mf([NC()])})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:e.translate(t.text)}}]})},eI=function(t,e){var n=tp.config({store:{mode:"manual",getValue:function(t){var e=t.element.dom;return e.checked},setValue:function(t,e){var n=t.element.dom;n.checked=e}}}),r=function(t){return t.element.dom.click(),L.some(!0)},o=hA.parts.field({factory:{sketch:x},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:mf([WR.self(),Hv.config({disabled:function(){return t.disabled||e.isDisabled()}}),yA.config({}),Yw.config({}),n,Aw.config({mode:"special",onEnter:r,onSpace:r,stopSpaceKeyup:!0}),Fw("checkbox-events",[za(ju(),(function(e,n){Sa(e,EA,{name:t.name})}))])])}),i=hA.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:e.translate(t.label)},behaviours:mf([FD.config({})])}),u=function(t){var n="checked"===t?"selected":"unselected";return LC(n,{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t]},e.icons)},a=kC({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[u("checked"),u("unchecked")]});return hA.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[o,a.asSpec(),i],fieldBehaviours:mf([Hv.config({disabled:function(){return t.disabled||e.isDisabled()},disableClass:"tox-checkbox--disabled",onDisabled:function(t){hA.getField(t).each(Hv.disable)},onEnabled:function(t){hA.getField(t).each(Hv.enable)}}),cO()])})},nI=function(t){return"presentation"===t.presets?sA.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):sA.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:mf([yA.config({}),Yw.config({})])})},rI=function(t){return function(e,n,r){return Ot(n,"name").fold((function(){return t(n,r)}),(function(o){return e.field(o,t(n,r))}))}},oI=function(t){return function(e,n,r){var o=Co(n,{source:"dynamic"});return rI(t)(e,o,r)}},iI={bar:rI((function(t,e){return fA(t,e.shared)})),collection:rI((function(t,e){return LA(t,e.shared.providers)})),alertbanner:rI((function(t,e){return tI(t,e.shared.providers)})),input:rI((function(t,e){return lH(t,e.shared.providers)})),textarea:rI((function(t,e){return fH(t,e.shared.providers)})),label:rI((function(t,e){return QL(t,e.shared)})),iframe:oI((function(t,e){return wN(t,e.shared.providers)})),button:rI((function(t,e){return oL(t,e.shared.providers)})),checkbox:rI((function(t,e){return eI(t,e.shared.providers)})),colorinput:rI((function(t,e){return $D(t,e.shared,e.colorinput)})),colorpicker:rI(KR),dropzone:rI((function(t,e){return sN(t,e.shared.providers)})),grid:rI((function(t,e){return lN(t,e.shared)})),listbox:rI((function(t,e){return rH(t,e)})),selectbox:rI((function(t,e){return aH(t,e.shared.providers)})),sizeinput:rI((function(t,e){return vL(t,e.shared.providers)})),urlinput:rI((function(t,e){return ZH(t,e,e.urlinput)})),customeditor:rI(JR),htmlpanel:rI(nI),imagetools:rI((function(t,e){return JL(t,e.shared.providers)})),table:rI((function(t,e){return cH(t,e.shared.providers)})),panel:rI((function(t,e){return oH(t,e)}))},uI={field:function(t,e){return e}},aI=function(t,e,n){var r=Co(n,{shared:{interpreter:function(e){return cI(t,e,r)}}});return cI(t,e,r)},cI=function(t,e,n){return Ot(iI,e.type).fold((function(){return console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e}),(function(r){return r(t,e,n)}))},sI=function(t,e){var n=uI;return cI(n,t,e)},lI={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},fI=function(t,e,n){var r=12,o={maxHeightFunction:Ed()},i=function(){return{type:"node",root:Dn(t()),node:L.from(t()),bubble:zd(r,r,lI),layouts:{onRtl:function(){return[dC]},onLtr:function(){return[fC]}},overrides:o}},u=function(){return{type:"hotspot",hotspot:e(),bubble:zd(-r,r,lI),layouts:{onRtl:function(){return[Fl]},onLtr:function(){return[Ul]}},overrides:o}};return function(){return n()?i():u()}},dI=function(t,e,n){var r=function(){return{type:"node",root:Dn(t()),node:L.from(t()),layouts:{onRtl:function(){return[mC]},onLtr:function(){return[mC]}}}},o=function(){return{type:"hotspot",hotspot:e(),layouts:{onRtl:function(){return[$l]},onLtr:function(){return[$l]}}}};return function(){return n()?r():o()}},mI=function(t,e){return function(){return{type:"selection",root:e(),getSelection:function(){var e=t.selection.getRng();return L.some(km.range(ee.fromDom(e.startContainer),e.startOffset,ee.fromDom(e.endContainer),e.endOffset))}}}},gI=function(t){return function(e){return{type:"node",root:t(),node:e}}},hI=function(t,e,n){var r=UT(t),o=function(){return ee.fromDom(t.getBody())},i=function(){return ee.fromDom(t.getContentAreaContainer())},u=function(){return r||!n()};return{inlineDialog:fI(i,e,u),banner:dI(i,e,u),cursor:mI(t,o),node:gI(o)}},pI=function(t){return function(e,n){var r=t_(t);r(e,n)}},vI=function(t){return function(){return BE(t)}},bI=function(t){return function(){return HE(t)}},yI=function(t){return function(){return $E(t)}},wI=function(t){return{colorPicker:pI(t),hasCustomColors:vI(t),getColors:bI(t),getColorCols:yI(t)}},xI=function(t){return function(){return GT(t)}},CI=function(t){return{isDraggableModal:xI(t)}},SI=function(t){var e=ou(HT(t)?"bottom":"top");return{isPositionedAtTop:function(){return"top"===e.get()},getDockingMode:e.get,setDockingMode:e.set}},kI=[{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",format:"bold"},{title:"Italic",format:"italic"},{title:"Underline",format:"underline"},{title:"Strikethrough",format:"strikethrough"},{title:"Superscript",format:"superscript"},{title:"Subscript",format:"subscript"},{title:"Code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",format:"alignleft"},{title:"Center",format:"aligncenter"},{title:"Right",format:"alignright"},{title:"Justify",format:"alignjustify"}]}],TI=function(t){return Et(t,"items")},OI=function(t){return Et(t,"block")},EI=function(t){return Et(t,"inline")},_I=function(t){return Et(t,"selector")},AI=function(t){return Q(t,(function(t,e){if(TI(e)){var n=AI(e.items);return{customFormats:t.customFormats.concat(n.customFormats),formats:t.formats.concat([{title:e.title,items:n.formats}])}}if(EI(e)||OI(e)||_I(e)){var r=i(e.name)?e.name:e.title.toLowerCase(),o="custom-"+r;return{customFormats:t.customFormats.concat([{name:o,format:e}]),formats:t.formats.concat([{title:e.title,format:o,icon:e.icon}])}}return A(A({},t),{formats:t.formats.concat(e)})}),{customFormats:[],formats:[]})},DI=function(t,e){var n=AI(e),r=function(e){G(e,(function(e){t.formatter.has(e.name)||t.formatter.register(e.name,e.format)}))};return t.formatter?r(n.customFormats):t.on("init",(function(){r(n.customFormats)})),n.formats},MI=function(t){return ST(t).map((function(e){var n=DI(t,e);return kT(t)?kI.concat(n):n})).getOr(kI)},zI=function(t,e,n){var r={type:"formatter",isSelected:e(t.format),getStylePreview:n(t.format)};return Co(t,r)},RI=function(t,e,n,r){var o=function(t){return zI(t,n,r)},u=function(t){var e={type:"submenu"};return Co(t,e)},a=function(e){var o=i(e.name)?e.name:oc(e.title),u="custom-"+o,a={type:"formatter",format:u,isSelected:n(u),getStylePreview:r(u)},c=Co(e,a);return t.formatter.register(o,c),c},c=function(t){return $(t,(function(t){var e=ht(t);if(_t(t,"items")){var n=c(t.items);return Co(u(t),{getStyleItems:w(n)})}return _t(t,"format")?o(t):1===e.length&&U(e,"title")?Co(t,{type:"separator"}):a(t)}))};return c(e)},NI=function(t){var e=function(e){return function(){return t.formatter.match(e)}},n=function(e){return function(){var n=t.formatter.get(e);return void 0!==n?L.some({tag:n.length>0&&(n[0].inline||n[0].block)||"div",styles:t.dom.parseStyle(t.formatter.getCssText(e))}):L.none()}},r=function(t){var e=t.items;return void 0!==e&&e.length>0?rt(e,r):[t.format]},o=ou([]),i=ou([]),u=ou([]),a=ou([]),c=ou(!1);t.on("PreInit",(function(u){var a=MI(t),c=RI(t,a,e,n);o.set(c),i.set(rt(c,r))})),t.on("addStyleModifications",(function(o){var i=RI(t,o.items,e,n);u.set(i),c.set(o.replace),a.set(rt(i,r))}));var s=function(){var t=c.get()?[]:o.get(),e=u.get();return t.concat(e)},l=function(){var t=c.get()?[]:i.get(),e=a.get();return t.concat(e)};return{getData:s,getFlattenedKeys:l}},BI=function(t){return d(t)&&1===t.nodeType},LI=QR.trim,HI=function(t){return function(e){if(BI(e)){if(e.contentEditable===t)return!0;if(e.getAttribute("data-mce-contenteditable")===t)return!0}return!1}},II=HI("true"),PI=HI("false"),VI=function(t,e,n,r,o){return{type:t,title:e,url:n,level:r,attach:o}},FI=function(t){while(t=t.parentNode){var e=t.contentEditable;if(e&&"inherit"!==e)return II(t)}return!1},UI=function(t,e){return $(Xm(ee.fromDom(e),t),(function(t){return t.dom}))},jI=function(t){return t.innerText||t.textContent},WI=function(t){return t.id?t.id:oc("h")},qI=function(t){return t&&"A"===t.nodeName&&void 0!==(t.id||t.name)},$I=function(t){return qI(t)&&KI(t)},GI=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},KI=function(t){return FI(t)&&!PI(t)},XI=function(t){return GI(t)&&KI(t)},YI=function(t){return GI(t)?parseInt(t.nodeName.substr(1),10):0},JI=function(t){var e=WI(t),n=function(){t.id=e};return VI("header",jI(t),"#"+e,YI(t),n)},QI=function(t){var e=t.id||t.name,n=jI(t);return VI("anchor",n||"#"+e,"#"+e,0,p)},ZI=function(t){return $(Y(t,XI),JI)},tP=function(t){return $(Y(t,$I),QI)},eP=function(t){var e=UI("h1,h2,h3,h4,h5,h6,a:not([href])",t);return e},nP=function(t){return LI(t.title).length>0},rP=function(t){var e=eP(t);return Y(ZI(e).concat(tP(e)),nP)},oP={find:rP},iP="tinymce-url-history",uP=5,aP=function(t){return i(t)&&/^https?/.test(t)},cP=function(t){return a(t)&&t.length<=uP&&ot(t,aP)},sP=function(t){return u(t)&&kt(t,(function(t){return!cP(t)})).isNone()},lP=function(){var t,e=OE.getItem(iP);if(null===e)return{};try{t=JSON.parse(e)}catch(n){if(n instanceof SyntaxError)return console.log("Local storage "+iP+" was not valid JSON",n),{};throw n}return sP(t)?t:(console.log("Local storage "+iP+" was not valid format",t),{})},fP=function(t){if(!sP(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));OE.setItem(iP,JSON.stringify(t))},dP=function(t){var e=lP();return Ot(e,t).getOr([])},mP=function(t,e){if(aP(t)){var n=lP(),r=Ot(n,e).getOr([]),o=Y(r,(function(e){return e!==t}));n[e]=[t].concat(o).slice(0,uP),fP(n)}},gP=function(t){return!!t},hP=function(t){return bt(QR.makeMap(t,/[, ]/),gP)},pP=function(t){return L.from(JT(t)).filter(m)},vP=function(t){var e=L.some(QT(t)).filter(gP),n=L.some(ZT(t)).filter(gP),r=e.or(n).map(hP);return pP(t).fold(O,(function(t){return r.fold(E,(function(t){return ht(t).length>0&&t}))}))},bP=function(t,e){var n=vP(t);return s(n)?n?pP(t):L.none():n[e]?pP(t):L.none()},yP=function(t,e){return bP(t,e).map((function(n){return function(r){return tD.nu((function(o){var a=function(t,e){if(!i(t))throw new Error("Expected value to be string");if(void 0!==e&&!u(e))throw new Error("Expected meta to be a object");var n={value:t,meta:e};o(n)},c=A({filetype:e,fieldname:r.fieldname},L.from(r.meta).getOr({}));n.call(t,a,r.value,c)}))}}))},wP=function(t){return L.from(t).filter(i).getOrUndefined()},xP=function(t){return tO(t)?L.none():L.some({targets:oP.find(t.getBody()),anchorTop:wP(eO(t)),anchorBottom:wP(nO(t))})},CP=function(t){return L.from(rO(t))},SP=function(t){return{getHistory:dP,addToHistory:mP,getLinkInformation:function(){return xP(t)},getValidationHandler:function(){return CP(t)},getUrlPicker:function(e){return yP(t,e)}}},kP=function(t,e,n){var r=ou(!1),o=SI(e),i={shared:{providers:{icons:function(){return e.ui.registry.getAll().icons},menuItems:function(){return e.ui.registry.getAll().menuItems},translate:TC.translate,isDisabled:function(){return e.mode.isReadOnly()||e.ui.isDisabled()},getSetting:e.getParam.bind(e)},interpreter:function(t){return sI(t,i)},anchors:hI(e,n,o.isPositionedAtTop),header:o,getSink:function(){return ro.value(t)}},urlinput:SP(e),styleselect:NI(e),colorinput:wI(e),dialog:CI(e),isContextMenuOpen:function(){return r.get()},setContextMenuState:function(t){return r.set(t)}};return i},TP=function(t,e,n){var r=function(t,r){G([e,n],(function(e){e.broadcastEvent(t,r)}))},o=function(t,r){G([e,n],(function(e){e.broadcastOn([t],r)}))},i=function(t){return o(yh(),{target:t.target})},u=Cf(),a=ud(u,"touchstart",i),c=ud(u,"touchmove",(function(t){return r(ca(),t)})),s=ud(u,"touchend",(function(t){return r(sa(),t)})),l=ud(u,"mousedown",i),f=ud(u,"mouseup",(function(t){0===t.raw.button&&o(xh(),{target:t.target})})),d=function(t){return o(yh(),{target:ee.fromDom(t.target)})},m=function(t){0===t.button&&o(xh(),{target:ee.fromDom(t.target)})},g=function(){G(t.editorManager.get(),(function(e){t!==e&&e.fire("DismissPopups",{relatedTarget:t})}))},h=function(t){return r(la(),cd(t))},p=function(t){o(wh(),{}),r(fa(),cd(t))},v=function(){return o(wh(),{})},b=function(e){e.state&&o(yh(),{target:ee.fromDom(t.getContainer())})},y=function(t){o(yh(),{target:ee.fromDom(t.relatedTarget.getContainer())})};t.on("PostRender",(function(){t.on("click",d),t.on("tap",d),t.on("mouseup",m),t.on("mousedown",g),t.on("ScrollWindow",h),t.on("ResizeWindow",p),t.on("ResizeEditor",v),t.on("AfterProgressState",b),t.on("DismissPopups",y)})),t.on("remove",(function(){t.off("click",d),t.off("tap",d),t.off("mouseup",m),t.off("mousedown",g),t.off("ScrollWindow",h),t.off("ResizeWindow",p),t.off("ResizeEditor",v),t.off("AfterProgressState",b),t.off("DismissPopups",y),l.unbind(),a.unbind(),c.unbind(),s.unbind(),f.unbind()})),t.on("detach",(function(){Qg(e),Qg(n),e.destroy(),n.destroy()}))},OP=nv,EP=Ip,_P=w([Ki("shell",!1),Ai("makeItem"),Ki("setupItem",p),op.field("listBehaviours",[Pw])]),AP=function(){return{behaviours:mf([Pw.config({})])}},DP=Bp({name:"items",overrides:AP}),MP=w([DP]),zP=w("CustomList"),RP=function(t,e,n,r){var o=function(e,n){u(e).fold((function(){throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")}),(function(r){var o=Pw.contents(r),i=n.length,u=i-o.length,a=u>0?W(u,(function(){return t.makeItem()})):[],c=o.slice(i);G(c,(function(t){return Pw.remove(r,t)})),G(a,(function(t){return Pw.append(r,t)}));var s=Pw.contents(r);G(s,(function(r,o){t.setupItem(e,r,n[o],o)}))}))},i=t.shell?{behaviours:[Pw.config({})],components:[]}:{behaviours:[],components:e},u=function(e){return t.shell?L.some(e):Kp(e,t,"items")};return{uid:t.uid,dom:t.dom,components:i.components,behaviours:rp(t.listBehaviours,i.behaviours),apis:{setItems:o}}},NP=mv({name:zP(),configFields:_P(),partFields:MP(),factory:RP,apis:{setItems:function(t,e,n){t.setItems(e,n)}}}),BP=w([Ai("dom"),Ki("shell",!0),ep("toolbarBehaviours",[Pw])]),LP=function(){return{behaviours:mf([Pw.config({})])}},HP=w([Bp({name:"groups",overrides:LP})]),IP=function(t,e,n,r){var o=function(t,e){i(t).fold((function(){throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")}),(function(t){Pw.set(t,e)}))},i=function(e){return t.shell?L.some(e):Kp(e,t,"groups")},u=t.shell?{behaviours:[Pw.config({})],components:[]}:{behaviours:[],components:e};return{uid:t.uid,dom:t.dom,components:u.components,behaviours:rp(t.toolbarBehaviours,u.behaviours),apis:{setGroups:o},domModification:{attributes:{role:"group"}}}},PP=mv({name:"Toolbar",configFields:BP(),partFields:HP(),factory:IP,apis:{setGroups:function(t,e,n){t.setGroups(e,n)}}}),VP=p,FP=O,UP=w([]),jP=Object.freeze({__proto__:null,setup:VP,isDocked:FP,getBehaviours:UP}),WP=function(t){var e=At(Zn(t,"position"),"fixed"),n=e?L.none():yn(t);return n.orThunk((function(){var e=ee.fromTag("span");return vn(t).bind((function(t){Dr(t,e);var n=yn(e);return Br(e),n}))}))},qP=function(t){return WP(t).map(mr).getOrThunk((function(){return lr(0,0)}))},$P=uu.generate([{static:[]},{absolute:["positionCss"]},{fixed:["positionCss"]}]),GP=function(t,e){var n=t.element;is(n,e.transitionClass),as(n,e.fadeOutClass),is(n,e.fadeInClass),e.onShow(t)},KP=function(t,e){var n=t.element;is(n,e.transitionClass),as(n,e.fadeInClass),is(n,e.fadeOutClass),e.onHide(t)},XP=function(t,e){return t.ye.y},YP=function(t,e){return t.y>=e.y},JP=function(t,e){return t.bottom<=e.bottom},QP=function(t,e,n){return ot(t,(function(t){switch(t){case"bottom":return JP(e,n);case"top":return YP(e,n)}}))},ZP=function(t,e){return e.getInitialPos().map((function(e){return Yr(e.bounds.x,e.bounds.y,vr(t),ur(t))}))},tV=function(t,e,n){n.setInitialPos({style:tr(t),position:Jn(t,"position")||"static",bounds:e})},eV=function(t,e,n){return n.getInitialPos().bind((function(r){switch(n.clearInitialPos(),r.position){case"static":return L.some($P.static());case"absolute":var o=WP(t).map(Jr).getOrThunk((function(){return Jr(Hn())}));return L.some($P.absolute(Af("absolute",Ot(r.style,"left").map((function(t){return e.x-o.x})),Ot(r.style,"top").map((function(t){return e.y-o.y})),Ot(r.style,"right").map((function(t){return o.right-e.right})),Ot(r.style,"bottom").map((function(t){return o.bottom-e.bottom})))));default:return L.none()}}))},nV=function(t,e,n){return ZP(t,n).filter((function(t){return QP(n.getModes(),t,e)})).bind((function(e){return eV(t,e,n)}))},rV=function(t,e,n){var r=Jr(t);if(QP(n.getModes(),r,e))return L.none();tV(t,r,n);var o=Zr(),i=r.x-o.x,u=e.y-o.y,a=o.bottom-e.bottom,c=r.y<=e.y;return L.some($P.fixed(Af("fixed",L.some(i),c?L.some(u):L.none(),L.none(),c?L.none():L.some(a))))},oV=function(t,e,n){var r=t.element,o=At(Zn(r,"position"),"fixed");return o?nV(r,e,n):rV(r,e,n)},iV=function(t,e){var n=t.element;return ZP(n,e).bind((function(t){return eV(n,t,e)}))},uV=function(t,e,n){n.setDocked(!1),G(["left","right","top","bottom","position"],(function(e){return nr(t.element,e)})),e.onUndocked(t)},aV=function(t,e,n,r){var o="fixed"===r.position;n.setDocked(o),Mf(t.element,r);var i=o?e.onDocked:e.onUndocked;i(t)},cV=function(t,e,n,r,o){void 0===o&&(o=!1),e.contextual.each((function(e){e.lazyContext(t).each((function(i){var u=XP(i,r);if(u!==n.isVisible())if(n.setVisible(u),o&&!u)ss(t.element,[e.fadeOutClass]),e.onHide(t);else{var a=u?GP:KP;a(t,e)}}))}))},sV=function(t,e,n){var r=e.lazyViewport(t),o=n.isDocked();o&&cV(t,e,n,r),oV(t,r,n).each((function(o){o.fold((function(){return uV(t,e,n)}),(function(r){return aV(t,e,n,r)}),(function(o){cV(t,e,n,r,!0),aV(t,e,n,o)}))}))},lV=function(t,e,n){var r=t.element;n.setDocked(!1),iV(t,n).each((function(r){r.fold((function(){return uV(t,e,n)}),(function(r){return aV(t,e,n,r)}),p)})),n.setVisible(!0),e.contextual.each((function(e){ls(r,[e.fadeInClass,e.fadeOutClass,e.transitionClass]),e.onShow(t)})),fV(t,e,n)},fV=function(t,e,n){t.getSystem().isConnected()&&sV(t,e,n)},dV=function(t,e,n){n.isDocked()&&lV(t,e,n)},mV=function(t,e,n){return n.isDocked()},gV=function(t,e,n,r){return n.setModes(r)},hV=function(t,e,n){return n.getModes()},pV=Object.freeze({__proto__:null,refresh:fV,reset:dV,isDocked:mV,getModes:hV,setModes:gV}),vV=function(t,e){return _a([Fa($u(),(function(n,r){t.contextual.each((function(t){if(cs(n.element,t.transitionClass)){ls(n.element,[t.transitionClass,t.fadeInClass]);var o=e.isVisible()?t.onShown:t.onHidden;o(n)}r.stop()}))})),za(la(),(function(n,r){fV(n,t,e)})),za(fa(),(function(n,r){dV(n,t,e)}))])},bV=Object.freeze({__proto__:null,events:vV}),yV=[$i("contextual",[zi("fadeInClass"),zi("fadeOutClass"),zi("transitionClass"),Bi("lazyContext"),al("onShow"),al("onShown"),al("onHide"),al("onHidden")]),tu("lazyViewport",Zr),nu("modes",["top","bottom"],si),al("onDocked"),al("onUndocked")],wV=function(t){var e=ou(!1),n=ou(!0),r=od(),o=ou(t.modes),i=function(){return"docked: "+e.get()+", visible: "+n.get()+", modes: "+o.get().join(",")};return Tc({isDocked:e.get,setDocked:e.set,getInitialPos:r.get,setInitialPos:r.set,clearInitialPos:r.clear,isVisible:n.get,setVisible:n.set,getModes:o.get,setModes:o.set,readState:i})},xV=Object.freeze({__proto__:null,init:wV}),CV=hf({fields:yV,name:"docking",active:bV,apis:pV,state:xV}),SV=w(oc("toolbar-height-change")),kV={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},TV="tox-tinymce--toolbar-sticky-on",OV="tox-tinymce--toolbar-sticky-off",EV=function(t,e){var n=mn(e),r=n.dom.defaultView.innerHeight,o=Hr(n),i=ee.fromDom(t.elm),u=Qr(i),a=ur(i),c=u.y,s=c+a,l=mr(e),f=ur(e),d=l.top,m=d+f,g=Math.abs(d-o.top)<2,h=Math.abs(m-(o.top+r))<2;if(g&&cd){var p=c-r+a+f;Ir(o.left,p,n)}},_V=function(t,e){return U(CV.getModes(t),e)},AV=function(t){var e=function(t){return ar(t)+(parseInt(Jn(t,"margin-top"),10)||0)+(parseInt(Jn(t,"margin-bottom"),10)||0)},n=t.element;vn(n).each((function(r){var o="padding-"+CV.getModes(t)[0];if(CV.isDocked(t)){var i=vr(r);Kn(n,"width",i+"px"),Kn(r,o,e(n)+"px")}else nr(n,"width"),nr(r,o)}))},DV=function(t,e){e?(as(t,kV.fadeOutClass),ss(t,[kV.transitionClass,kV.fadeInClass])):(as(t,kV.fadeInClass),ss(t,[kV.fadeOutClass,kV.transitionClass]))},MV=function(t,e){var n=ee.fromDom(t.getContainer());e?(is(n,TV),as(n,OV)):(is(n,OV),as(n,TV))},zV=function(t,e){var n=mn(e);Of(n).filter((function(t){return!sn(e,t)})).filter((function(e){return sn(e,ee.fromDom(n.dom.body))||dn(t,e)})).each((function(){return Sf(e)}))},RV=function(t,e){return Ef(t).orThunk((function(){return e().toOptional().bind((function(t){return Ef(t.element)}))}))},NV=function(t,e,n){t.inline||(e.header.isPositionedAtTop()||t.on("ResizeEditor",(function(){n().each(CV.reset)})),t.on("ResizeWindow ResizeEditor",(function(){n().each(AV)})),t.on("SkinLoaded",(function(){n().each((function(t){CV.isDocked(t)?CV.reset(t):CV.refresh(t)}))})),t.on("FullscreenStateChanged",(function(){n().each(CV.reset)}))),t.on("AfterScrollIntoView",(function(t){n().each((function(e){CV.refresh(e);var n=e.element;Jb(n)&&EV(t,n)}))})),t.on("PostRender",(function(){MV(t,!1)}))},BV=function(t){return t().map(CV.isDocked).getOr(!1)},LV=function(){var t;return[yf.config({channels:(t={},t[SV()]={onReceive:AV},t)})]},HV=function(t,e){var n=od(),r=e.getSink,o=function(t){r().each((function(e){return t(e.element)}))},i=function(e){t.inline||AV(e),MV(t,CV.isDocked(e)),e.getSystem().broadcastOn([wh()],{}),r().each((function(t){return t.getSystem().broadcastOn([wh()],{})}))},u=t.inline?[]:LV();return M([Yw.config({}),CV.config({contextual:A({lazyContext:function(e){var n=ar(e.element),r=t.inline?t.getContentAreaContainer():t.getContainer(),o=Jr(ee.fromDom(r)),i=o.height-n,u=o.y+(_V(e,"top")?0:n);return L.some(Yr(o.x,u,o.width,i))},onShow:function(){o((function(t){return DV(t,!0)}))},onShown:function(t){o((function(t){return ls(t,[kV.transitionClass,kV.fadeInClass])})),n.get().each((function(e){zV(t.element,e),n.clear()}))},onHide:function(t){RV(t.element,r).fold(n.clear,n.set),o((function(t){return DV(t,!1)}))},onHidden:function(){o((function(t){return ls(t,[kV.transitionClass])}))}},kV),lazyViewport:function(e){var n=Zr(),r=$T(t),o=n.y+(_V(e,"top")?r:0),i=n.height-(_V(e,"bottom")?r:0);return Yr(n.x,o,n.width,i)},modes:[e.header.getDockingMode()],onDocked:i,onUndocked:i})],u,!0)},IV=Object.freeze({__proto__:null,setup:NV,isDocked:BV,getBehaviours:HV}),PV=function(t){var e=t.editor,n=t.sticky?HV:UP;return{uid:t.uid,dom:t.dom,components:t.components,behaviours:mf(n(e,t.sharedBackstage))}},VV=ti([zi("type"),Di("items",ni([ii([zi("name"),Pi("items",si)]),si]))].concat(kS)),FV=function(t){return wi("GroupToolbarButton",VV,t)},UV=[ji("text"),ji("tooltip"),ji("icon"),Bi("fetch"),tu("onSetup",(function(){return p}))],jV=ti(M([zi("type")],UV,!0)),WV=function(t){return wi("menubutton",jV,t)},qV=ti([zi("type"),ji("tooltip"),ji("icon"),ji("text"),Wi("select"),Bi("fetch"),tu("onSetup",(function(){return p})),Qi("presets","normal",["normal","color","listpreview"]),Ki("columns",1),Bi("onAction"),Bi("onItemAction")]),$V=function(t){return wi("SplitButton",qV,t)},GV=function(t,e){var n=function(t,n){var r=$(n,(function(t){var n={type:"menubutton",text:t.text,fetch:function(e){e(t.getItems())}},r=WV(n).mapError((function(t){return Si(t)})).getOrDie();return GB(r,"tox-mbtn",e.backstage,L.some("menuitem"))}));Pw.set(t,r)},r={focus:Aw.focusIn,setMenus:n};return{uid:t.uid,dom:t.dom,components:[],behaviours:mf([Pw.config({}),Fw("menubar-events",[Ua((function(e){t.onSetup(e)})),za(Hu(),(function(t,e){Is(t.element,".tox-mbtn--active").each((function(n){Ps(e.event.target,".tox-mbtn").each((function(e){sn(n,e)||t.getSystem().getByDom(n).each((function(n){t.getSystem().getByDom(e).each((function(t){HD.expand(t),HD.close(n),Yw.focus(t)}))}))}))}))})),za(pa(),(function(t,e){e.event.prevFocus.bind((function(e){return t.getSystem().getByDom(e).toOptional()})).each((function(n){e.event.newFocus.bind((function(e){return t.getSystem().getByDom(e).toOptional()})).each((function(t){HD.isOpen(n)&&(HD.expand(t),HD.close(n))}))}))}))]),Aw.config({mode:"flow",selector:".tox-mbtn",onEscape:function(e){return t.onEscape(e),L.some(!0)}}),yA.config({})]),apis:r,domModification:{attributes:{role:"menubar"}}}},KV=dv({factory:GV,name:"silver.Menubar",configFields:[Ai("dom"),Ai("uid"),Ai("onEscape"),Ai("backstage"),Ki("onSetup",p)],apis:{focus:function(t,e){t.focus(e)},setMenus:function(t,e,n){t.setMenus(e,n)}}}),XV=function(t,e){return e.getAnimationRoot.fold((function(){return t.element}),(function(e){return e(t)}))},YV=function(t){return t.dimension.property},JV=function(t,e){return t.dimension.getDimension(e)},QV=function(t,e){var n=XV(t,e);ls(n,[e.shrinkingClass,e.growingClass])},ZV=function(t,e){as(t.element,e.openClass),is(t.element,e.closedClass),Kn(t.element,YV(e),"0px"),rr(t.element)},tF=function(t,e){as(t.element,e.closedClass),is(t.element,e.openClass),nr(t.element,YV(e))},eF=function(t,e,n,r){n.setCollapsed(),Kn(t.element,YV(e),JV(e,t.element)),rr(t.element),QV(t,e),ZV(t,e),e.onStartShrink(t),e.onShrunk(t)},nF=function(t,e,n,r){var o=r.getOrThunk((function(){return JV(e,t.element)}));n.setCollapsed(),Kn(t.element,YV(e),o),rr(t.element);var i=XV(t,e);as(i,e.growingClass),is(i,e.shrinkingClass),ZV(t,e),e.onStartShrink(t)},rF=function(t,e,n){var r=JV(e,t.element),o="0px"===r?eF:nF;o(t,e,n,L.some(r))},oF=function(t,e,n){var r=XV(t,e),o=cs(r,e.shrinkingClass),i=JV(e,t.element);tF(t,e);var u=JV(e,t.element),a=function(){Kn(t.element,YV(e),i),rr(t.element)},c=function(){ZV(t,e)},s=o?a:c;s(),as(r,e.shrinkingClass),is(r,e.growingClass),tF(t,e),Kn(t.element,YV(e),u),n.setExpanded(),e.onStartGrow(t)},iF=function(t,e,n){if(n.isExpanded()){nr(t.element,YV(e));var r=JV(e,t.element);Kn(t.element,YV(e),r)}},uF=function(t,e,n){n.isExpanded()||oF(t,e,n)},aF=function(t,e,n){n.isExpanded()&&rF(t,e,n)},cF=function(t,e,n){n.isExpanded()&&eF(t,e,n)},sF=function(t,e,n){return n.isExpanded()},lF=function(t,e,n){return n.isCollapsed()},fF=function(t,e,n){var r=XV(t,e);return!0===cs(r,e.growingClass)},dF=function(t,e,n){var r=XV(t,e);return!0===cs(r,e.shrinkingClass)},mF=function(t,e,n){return fF(t,e)||dF(t,e)},gF=function(t,e,n){var r=n.isExpanded()?rF:oF;r(t,e,n)},hF=Object.freeze({__proto__:null,refresh:iF,grow:uF,shrink:aF,immediateShrink:cF,hasGrown:sF,hasShrunk:lF,isGrowing:fF,isShrinking:dF,isTransitioning:mF,toggleGrow:gF,disableTransitions:QV}),pF=function(t,e,n){var r=e.expanded;return Dc(r?{classes:[e.openClass],styles:{}}:{classes:[e.closedClass],styles:mu(e.dimension.property,"0px")})},vF=function(t,e){return _a([Fa($u(),(function(n,r){var o=r.event.raw;if(o.propertyName===t.dimension.property){QV(n,t),e.isExpanded()&&nr(n.element,t.dimension.property);var i=e.isExpanded()?t.onGrown:t.onShrunk;i(n)}}))])},bF=Object.freeze({__proto__:null,exhibit:pF,events:vF}),yF=[Ai("closedClass"),Ai("openClass"),Ai("shrinkingClass"),Ai("growingClass"),Vi("getAnimationRoot"),al("onShrunk"),al("onStartShrink"),al("onGrown"),al("onStartGrow"),Ki("expanded",!1),Di("dimension",ki("property",{width:[fl("property","width"),fl("getDimension",(function(t){return vr(t)+"px"}))],height:[fl("property","height"),fl("getDimension",(function(t){return ur(t)+"px"}))]}))],wF=function(t){var e=ou(t.expanded),n=function(){return"expanded: "+e.get()};return Tc({isExpanded:function(){return!0===e.get()},isCollapsed:function(){return!1===e.get()},setCollapsed:S(e.set,!1),setExpanded:S(e.set,!0),readState:n})},xF=Object.freeze({__proto__:null,init:wF}),CF=hf({fields:yF,name:"sliding",active:bF,apis:hF,state:xF}),SF="container",kF=[ep("slotBehaviours",[])],TF=function(t){return""},OF=function(t){var e=function(){var t=[],e=function(e,n){return t.push(e),jp(SF,TF(e),n)};return{slot:e,record:w(t)}}(),n=t(e),r=e.record(),o=$(r,(function(t){return Rp({name:t,pname:TF(t)})}));return uv(SF,kF,o,EF,n)},EF=function(t,e){var n=function(e){return Qp(t)},r=function(e,n){return Kp(e,t,n)},o=function(e,n){return function(r,o){return Kp(r,t,o).map((function(t){return e(t,o)})).getOr(n)}},i=function(t){return function(e,n){G(n,(function(n){return t(e,n)}))}},u=function(t,e){return"true"!==Un(t.element,"aria-hidden")},a=function(t,e){if(!u(t)){var n=t.element;nr(n,"display"),qn(n,"aria-hidden"),Sa(t,va(),{name:e,visible:!0})}},c=function(t,e){if(u(t)){var n=t.element;Kn(n,"display","none"),Vn(n,"aria-hidden","true"),Sa(t,va(),{name:e,visible:!1})}},s=o(u,!1),l=o(c),f=i(l),d=function(t){return f(t,n())},m=o(a),g={getSlotNames:n,getSlot:r,isShowing:s,hideSlot:l,hideAllSlots:d,showSlot:m};return{uid:t.uid,dom:t.dom,components:e,behaviours:np(t.slotBehaviours),apis:g}},_F=bt({getSlotNames:function(t,e){return t.getSlotNames(e)},getSlot:function(t,e,n){return t.getSlot(e,n)},isShowing:function(t,e,n){return t.isShowing(e,n)},hideSlot:function(t,e,n){return t.hideSlot(e,n)},hideAllSlots:function(t,e){return t.hideAllSlots(e)},showSlot:function(t,e,n){return t.showSlot(e,n)}},(function(t){return Sc(t)})),AF=A(A({},_F),{sketch:OF}),DF=ti([ji("icon"),ji("tooltip"),tu("onShow",p),tu("onHide",p),tu("onSetup",(function(){return p}))]),MF=function(t){return wi("sidebar",DF,t)},zF=function(t){var e=t.ui.registry.getAll().sidebars;G(ht(e),(function(n){var r=e[n],o=function(){return At(L.from(t.queryCommandValue("ToggleSidebar")),n)};t.ui.registry.addToggleButton(n,{icon:r.icon,tooltip:r.tooltip,onAction:function(e){t.execCommand("ToggleSidebar",!1,n),e.setActive(o())},onSetup:function(e){var n=function(){return e.setActive(o())};return t.on("ToggleSidebar",n),function(){t.off("ToggleSidebar",n)}}})}))},RF=function(t){return{element:function(){return t.element.dom}}},NF=function(t,e){var n=$(ht(e),(function(t){var n=e[t],r=xi(MF(n));return{name:t,getApi:RF,onSetup:r.onSetup,onShow:r.onShow,onHide:r.onHide}}));return $(n,(function(e){var r=ou(p);return t.slot(e.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Qk.unnamedEvents([hO(e,r),pO(e,r),za(va(),(function(t,e){var r=e.event,o=tt(n,(function(t){return t.name===r.name}));o.each((function(e){var n=r.visible?e.onShow:e.onHide;n(e.getApi(t))}))}))])})}))},BF=function(t){return AF.sketch((function(e){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:NF(e,t),slotBehaviours:Qk.unnamedEvents([Ua((function(t){return AF.hideAllSlots(t)}))])}}))},LF=function(t,e){var n=bv.getCurrent(t);n.each((function(t){return Pw.set(t,[BF(e)])}))},HF=function(t,e){var n=bv.getCurrent(t);n.each((function(t){var n=bv.getCurrent(t);n.each((function(n){CF.hasGrown(t)?AF.isShowing(n,e)?CF.shrink(t):(AF.hideAllSlots(n),AF.showSlot(n,e)):(AF.hideAllSlots(n),AF.showSlot(n,e),CF.grow(t))}))}))},IF=function(t){var e=bv.getCurrent(t);return e.bind((function(t){var e=CF.isGrowing(t)||CF.hasGrown(t);if(e){var n=bv.getCurrent(t);return n.bind((function(t){return tt(AF.getSlotNames(t),(function(e){return AF.isShowing(t,e)}))}))}return L.none()}))},PF=oc("FixSizeEvent"),VF=oc("AutoSizeEvent"),FF=function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"complementary"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:mf([yA.config({}),Yw.config({}),CF.config({dimension:{property:"width"},closedClass:"tox-sidebar--sliding-closed",openClass:"tox-sidebar--sliding-open",shrinkingClass:"tox-sidebar--sliding-shrinking",growingClass:"tox-sidebar--sliding-growing",onShrunk:function(t){var e=bv.getCurrent(t);e.each(AF.hideAllSlots),Ca(t,VF)},onGrown:function(t){Ca(t,VF)},onStartGrow:function(t){Sa(t,PF,{width:Zn(t.element,"width").getOr("")})},onStartShrink:function(t){Sa(t,PF,{width:vr(t.element)+"px"})}}),Pw.config({}),bv.config({find:function(t){var e=Pw.contents(t);return ft(e)}})])}],behaviours:mf([WR.childAt(0),Fw("sidebar-sliding-events",[za(PF,(function(t,e){Kn(t.element,"width",e.event.width)})),za(VF,(function(t,e){nr(t.element,"width")}))])])}},UF=function(t,e,n,r){Vn(t.element,"aria-busy",!0);var o=e.getRoot(t).getOr(t),i=mf([Aw.config({mode:"special",onTab:function(){return L.some(!0)},onShiftTab:function(){return L.some(!0)}}),Yw.config({})]),u=r(o,i),a=o.getSystem().build(u);Pw.append(o,_s(a)),a.hasConfigured(Aw)&&e.focus&&Aw.focusIn(a),n.isBlocked()||e.onBlock(t),n.blockWith((function(){return Pw.remove(o,a)}))},jF=function(t,e,n){qn(t.element,"aria-busy"),n.isBlocked()&&e.onUnblock(t),n.clear()},WF=Object.freeze({__proto__:null,block:UF,unblock:jF}),qF=[tu("getRoot",L.none),Zi("focus",!0),al("onBlock"),al("onUnblock")],$F=function(){var t=ed(),e=function(e){t.set({destroy:e})};return Tc({readState:t.isSet,blockWith:e,clear:t.clear,isBlocked:t.isSet})},GF=Object.freeze({__proto__:null,init:$F}),KF=hf({fields:qF,name:"blocking",apis:WF,state:GF}),XF=function(t){var e=void 0!==t.dom.attributes?t.dom.attributes:[];return Q(e,(function(t,e){var n;return"class"===e.name?t:A(A({},t),(n={},n[e.name]=e.value,n))}),{})},YF=function(t){return Array.prototype.slice.call(t.dom.classList,0)},JF=function(t){var e=ee.fromHtml(t),n=xn(e),r=XF(e),o=YF(e),i=0===n.length?{}:{innerHtml:Ga(e)};return A({tag:ae(e),classes:o,attributes:r},i)},QF=function(t){return function(e,n){return{dom:{tag:"div",attributes:{"aria-label":t.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:JF('
')}]}}},ZF=function(t){return bv.getCurrent(t).each((function(t){return Sf(t.element)}))},tU=function(t,e){var n="tabindex",r="data-mce-"+n;L.from(t.iframeElement).map(ee.fromDom).each((function(t){e?(jn(t,n).each((function(e){return Vn(t,r,e)})),Vn(t,n,-1)):(qn(t,n),jn(t,r).each((function(e){Vn(t,n,e),qn(t,r)})))}))},eU=function(t,e,n,r){var o=e.element;if(tU(t,n),n)KF.block(e,QF(r)),nr(o,"display"),qn(o,"aria-hidden"),t.hasFocus()&&ZF(e);else{var i=bv.getCurrent(e).exists((function(t){return Tf(t.element)}));KF.unblock(e),Kn(o,"display","none"),Vn(o,"aria-hidden","true"),i&&t.focus()}},nU=function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:mf([Pw.config({}),KF.config({focus:!1}),bv.config({find:function(t){return ft(t.components())}})]),components:[]}},rU=function(t){return"focusin"===t.type},oU=function(t){if(rU(t)){var e=t.composed?ft(t.composedPath()):L.from(t.target);return e.map(ee.fromDom).filter(le).exists((function(t){return cs(t,"mce-pastebin")}))}return!1},iU=function(t,e,n){var r=ou(!1),o=od(),i=function(n){r.get()&&!oU(n)&&(n.preventDefault(),ZF(e()),t.editorManager.setActive(t))};t.inline||t.on("PreInit",(function(){t.dom.bind(t.getWin(),"focusin",i),t.on("BeforeExecCommand",(function(t){"mcefocus"===t.command.toLowerCase()&&!0!==t.value&&i(t)}))}));var u=function(o){o!==r.get()&&(r.set(o),eU(t,e(),o,n.providers),t.fire("AfterProgressState",{state:o}))};t.on("ProgressState",(function(e){if(o.on(xC.clearTimeout),g(e.time)){var n=xC.setEditorTimeout(t,(function(){return u(e.state)}),e.time);o.set(n)}else u(e.state),o.clear()}))},uU=function(t,e){var n={len:0,list:[]},r=Q(t,(function(t,n){var r=e(n,t.len);return r.fold(w(t),(function(e){return{len:e.finish,list:t.list.concat([e])}}))}),n);return r.list},aU=function(t,e,n){return{within:t,extra:e,withinWidth:n}},cU=function(t,e,n){var r=uU(t,(function(t,e){var r=n(t);return L.some({element:t,start:e,finish:e+r,width:r})})),o=Y(r,(function(t){return t.finish<=e})),i=J(o,(function(t,e){return t+e.width}),0),u=r.slice(o.length);return{within:o,extra:u,withinWidth:i}},sU=function(t){return $(t,(function(t){return t.element}))},lU=function(t,e,n){var r=sU(t.concat(e));return aU(r,[],n)},fU=function(t,e,n,r){var o=sU(t).concat([n]);return aU(o,sU(e),r)},dU=function(t,e,n){return aU(sU(t),[],n)},mU=function(t,e,n){var r=cU(e,t,n);return 0===r.extra.length?L.some(r):L.none()},gU=function(t,e,n,r){var o=mU(t,e,n).getOrThunk((function(){return cU(e,t-n(r),n)})),i=o.within,u=o.extra,a=o.withinWidth;return 1===u.length&&u[0].width<=n(r)?lU(i,u,a):u.length>=1?fU(i,u,r,a):dU(i,u,a)},hU=function(t,e){var n=$(e,(function(t){return _s(t)}));PP.setGroups(t,n)},pU=function(t){return gt(t,(function(t){return Ef(t.element).bind((function(e){return t.getSystem().getByDom(e).toOptional()}))}))},vU=function(t,e,n){var r=e.builtGroups.get();if(0!==r.length){var o=Xp(t,e,"primary"),i=bD.getCoupled(t,"overflowGroup");Kn(o.element,"visibility","hidden");var u=r.concat([i]),a=pU(u);n([]),hU(o,u);var c=vr(o.element),s=gU(c,e.builtGroups.get(),(function(t){return vr(t.element)}),i);0===s.extra.length?(Pw.remove(o,i),n([])):(hU(o,s.within),n(s.extra)),nr(o.element,"visibility"),rr(o.element),a.each(Yw.focus)}},bU=w([ep("splitToolbarBehaviours",[bD]),Ei("builtGroups",(function(){return ou([])}))]),yU=w([il(["overflowToggledClass"]),Wi("getOverflowBounds"),Ai("lazySink"),Ei("overflowGroups",(function(){return ou([])}))].concat(bU())),wU=w([Rp({factory:PP,schema:BP(),name:"primary"}),Np({schema:BP(),name:"overflow"}),Np({name:"overflow-button"}),Np({name:"overflow-group"})]),xU=w((function(t,e){yr(t,Math.floor(e))})),CU=w([il(["toggledClass"]),Ai("lazySink"),Bi("fetch"),Wi("getBounds"),$i("fireDismissalEventInstead",[Ki("event",ga())]),Pd()]),SU=w([Np({name:"button",overrides:function(t){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:mf([hx.config({toggleClass:t.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),Np({factory:PP,schema:BP(),name:"toolbar",overrides:function(t){return{toolbarBehaviours:mf([Aw.config({mode:"cyclic",onEscape:function(e){return Kp(e,t,"button").each(Yw.focus),L.none()}})])}}})]),kU=function(t,e){var n=bD.getCoupled(t,"toolbarSandbox");bh.isOpen(n)?bh.close(n):bh.open(n,e.toolbar())},TU=function(t,e,n,r){var o=n.getBounds.map((function(t){return t()})),i=n.lazySink(t).getOrDie();Ig.positionWithinBounds(i,e,{anchor:{type:"hotspot",hotspot:t,layouts:r,overrides:{maxWidthFunction:xU()}}},o)},OU=function(t,e,n,r,o){PP.setGroups(e,o),TU(t,e,n,r),hx.on(t)},EU=function(t,e,n){var r=Fs(),o=function(o,i){n.fetch().get((function(o){OU(t,i,n,e.layouts,o),r.link(t.element),Aw.focusIn(i)}))},i=function(){hx.off(t),Yw.focus(t),r.unlink(t.element)};return{dom:{tag:"div",attributes:{id:r.id}},behaviours:mf([Aw.config({mode:"special",onEscape:function(t){return bh.close(t),L.some(!0)}}),bh.config({onOpen:o,onClose:i,isPartOf:function(e,n,r){return js(n,r)||js(t,r)},getAttachPoint:function(){return n.lazySink(t).getOrDie()}}),yf.config({channels:A(A({},Sh(A({isExtraPart:O},n.fireDismissalEventInstead.map((function(t){return{fireEventInstead:{event:t.event}}})).getOr({})))),Th({doReposition:function(){bh.getState(bD.getCoupled(t,"toolbarSandbox")).each((function(r){TU(t,r,n,e.layouts)}))}}))})])}},_U=function(t,e,n,r){return A(A({},SC.sketch(A(A({},r.button()),{action:function(t){kU(t,r)},buttonBehaviours:op.augment({dump:r.button().buttonBehaviours},[bD.config({others:{toolbarSandbox:function(e){return EU(e,n,t)}}})])}))),{apis:{setGroups:function(e,r){bh.getState(bD.getCoupled(e,"toolbarSandbox")).each((function(o){OU(e,o,t,n.layouts,r)}))},reposition:function(e){bh.getState(bD.getCoupled(e,"toolbarSandbox")).each((function(r){TU(e,r,t,n.layouts)}))},toggle:function(t){kU(t,r)},getToolbar:function(t){return bh.getState(bD.getCoupled(t,"toolbarSandbox"))},isOpen:function(t){return bh.isOpen(bD.getCoupled(t,"toolbarSandbox"))}}})},AU=mv({name:"FloatingToolbarButton",factory:_U,configFields:CU(),partFields:SU(),apis:{setGroups:function(t,e,n){t.setGroups(e,n)},reposition:function(t,e){t.reposition(e)},toggle:function(t,e){t.toggle(e)},getToolbar:function(t,e){return t.getToolbar(e)},isOpen:function(t,e){return t.isOpen(e)}}}),DU=w([Ai("items"),il(["itemSelector"]),ep("tgroupBehaviours",[Aw])]),MU=w([Lp({name:"items",unit:"item"})]),zU=function(t,e,n,r){return{uid:t.uid,dom:t.dom,components:e,behaviours:rp(t.tgroupBehaviours,[Aw.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}},RU=mv({name:"ToolbarGroup",configFields:DU(),partFields:MU(),factory:zU}),NU=function(t){return $(t,(function(t){return _s(t)}))},BU=function(t,e,n){vU(t,n,(function(r){n.overflowGroups.set(r),e.getOpt(t).each((function(t){AU.setGroups(t,NU(r))}))}))},LU=function(t,e,n,r){var o=kC(AU.sketch({fetch:function(){return tD.nu((function(e){e(NU(t.overflowGroups.get()))}))},layouts:{onLtr:function(){return[Ul,Fl]},onRtl:function(){return[Fl,Ul]},onBottomLtr:function(){return[Wl,jl]},onBottomRtl:function(){return[jl,Wl]}},getBounds:n.getOverflowBounds,lazySink:t.lazySink,fireDismissalEventInstead:{},markers:{toggledClass:t.markers.overflowToggledClass},parts:{button:r["overflow-button"](),toolbar:r.overflow()}}));return{uid:t.uid,dom:t.dom,components:e,behaviours:rp(t.splitToolbarBehaviours,[bD.config({others:{overflowGroup:function(){return RU.sketch(A(A({},r["overflow-group"]()),{items:[o.asSpec()]}))}}})]),apis:{setGroups:function(e,n){t.builtGroups.set($(n,e.getSystem().build)),BU(e,o,t)},refresh:function(e){return BU(e,o,t)},toggle:function(t){o.getOpt(t).each((function(t){AU.toggle(t)}))},isOpen:function(t){return o.getOpt(t).map(AU.isOpen).getOr(!1)},reposition:function(t){o.getOpt(t).each((function(t){AU.reposition(t)}))},getOverflow:function(t){return o.getOpt(t).bind(AU.getToolbar)}},domModification:{attributes:{role:"group"}}}},HU=mv({name:"SplitFloatingToolbar",configFields:yU(),partFields:wU(),factory:LU,apis:{setGroups:function(t,e,n){t.setGroups(e,n)},refresh:function(t,e){t.refresh(e)},reposition:function(t,e){t.reposition(e)},toggle:function(t,e){t.toggle(e)},isOpen:function(t,e){return t.isOpen(e)},getOverflow:function(t,e){return t.getOverflow(e)}}}),IU=w([il(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),al("onOpened"),al("onClosed")].concat(bU())),PU=w([Rp({factory:PP,schema:BP(),name:"primary"}),Rp({factory:PP,schema:BP(),name:"overflow",overrides:function(t){return{toolbarBehaviours:mf([CF.config({dimension:{property:"height"},closedClass:t.markers.closedClass,openClass:t.markers.openClass,shrinkingClass:t.markers.shrinkingClass,growingClass:t.markers.growingClass,onShrunk:function(e){Kp(e,t,"overflow-button").each((function(t){hx.off(t),Yw.focus(t)})),t.onClosed(e)},onGrown:function(e){Aw.focusIn(e),t.onOpened(e)},onStartGrow:function(e){Kp(e,t,"overflow-button").each(hx.on)}}),Aw.config({mode:"acyclic",onEscape:function(e){return Kp(e,t,"overflow-button").each(Yw.focus),L.some(!0)}})])}}}),Np({name:"overflow-button",overrides:function(t){return{buttonBehaviours:mf([hx.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),Np({name:"overflow-group"})]),VU=function(t,e){return Kp(t,e,"overflow").map(CF.hasGrown).getOr(!1)},FU=function(t,e){Kp(t,e,"overflow-button").bind((function(){return Kp(t,e,"overflow")})).each((function(n){UU(t,e),CF.toggleGrow(n)}))},UU=function(t,e){Kp(t,e,"overflow").each((function(n){vU(t,e,(function(t){var e=$(t,(function(t){return _s(t)}));PP.setGroups(n,e)})),Kp(t,e,"overflow-button").each((function(t){CF.hasGrown(n)&&hx.on(t)})),CF.refresh(n)}))},jU=function(t,e,n,r){var o="alloy.toolbar.toggle",i=function(e,n){var r=$(n,e.getSystem().build);t.builtGroups.set(r)};return{uid:t.uid,dom:t.dom,components:e,behaviours:rp(t.splitToolbarBehaviours,[bD.config({others:{overflowGroup:function(t){return RU.sketch(A(A({},r["overflow-group"]()),{items:[SC.sketch(A(A({},r["overflow-button"]()),{action:function(e){Ca(t,o)}}))]}))}}}),Fw("toolbar-toggle-events",[za(o,(function(e){FU(e,t)}))])]),apis:{setGroups:function(e,n){i(e,n),UU(e,t)},refresh:function(e){return UU(e,t)},toggle:function(e){return FU(e,t)},isOpen:function(e){return VU(e,t)}},domModification:{attributes:{role:"group"}}}},WU=mv({name:"SplitSlidingToolbar",configFields:IU(),partFields:PU(),factory:jU,apis:{setGroups:function(t,e,n){t.setGroups(e,n)},refresh:function(t,e){t.refresh(e)},toggle:function(t,e){t.toggle(e)},isOpen:function(t,e){return t.isOpen(e)}}}),qU=function(t){var e=t.title.fold((function(){return{}}),(function(t){return{attributes:{title:t}}}));return{dom:A({tag:"div",classes:["tox-toolbar__group"]},e),components:[RU.parts.items({})],items:t.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])"},tgroupBehaviours:mf([yA.config({}),Yw.config({})])}},$U=function(t){return RU.sketch(qU(t))},GU=function(t,e){var n=Ua((function(e){var n=$(t.initGroups,$U);PP.setGroups(e,n)}));return mf([mO.toolbarButton(t.providers.isDisabled),cO(),Aw.config({mode:e,onEscape:t.onEscape,selector:".tox-toolbar__group"}),Fw("toolbar-events",[n])])},KU=function(t){var e=t.cyclicKeying?"cyclic":"acyclic";return{uid:t.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":qU({title:L.none(),items:[]}),"overflow-button":YB({name:"more",icon:L.some("more-drawer"),disabled:!1,tooltip:L.some("More..."),primary:!1,borderless:!1},L.none(),t.providers)},splitToolbarBehaviours:GU(t,e)}},XU=function(t){var e=KU(t),n=4,r=HU.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return HU.sketch(A(A({},e),{lazySink:t.getSink,getOverflowBounds:function(){var e=t.moreDrawerData.lazyHeader().element,r=Qr(e),o=hn(e),i=Qr(o),u=Math.max(o.dom.scrollHeight,i.height);return Yr(r.x+n,i.y,r.width-2*n,u)},parts:A(A({},e.parts),{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:t.attributes}}}),components:[r],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))},YU=function(t){var e=WU.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),n=WU.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),r=KU(t);return WU.sketch(A(A({},r),{components:[e,n],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"},onOpened:function(t){t.getSystem().broadcastOn([SV()],{type:"opened"})},onClosed:function(t){t.getSystem().broadcastOn([SV()],{type:"closed"})}}))},JU=function(t){var e=t.cyclicKeying?"cyclic":"acyclic";return PP.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(t.type===US.scrolling?["tox-toolbar--scrolling"]:[])},components:[PP.parts.groups({})],toolbarBehaviours:GU(t,e)})},QU=function(t,e,n){var r={getSocket:function(e){return OP.getPart(e,t,"socket")},setSidebar:function(e,n){OP.getPart(e,t,"sidebar").each((function(t){return LF(t,n)}))},toggleSidebar:function(e,n){OP.getPart(e,t,"sidebar").each((function(t){return HF(t,n)}))},whichSidebar:function(e){return OP.getPart(e,t,"sidebar").bind(IF).getOrNull()},getHeader:function(e){return OP.getPart(e,t,"header")},getToolbar:function(e){return OP.getPart(e,t,"toolbar")},setToolbar:function(e,n){OP.getPart(e,t,"toolbar").each((function(t){t.getApis().setGroups(t,n)}))},setToolbars:function(e,n){OP.getPart(e,t,"multiple-toolbar").each((function(t){NP.setItems(t,n)}))},refreshToolbar:function(e){var n=OP.getPart(e,t,"toolbar");n.each((function(t){return t.getApis().refresh(t)}))},toggleToolbarDrawer:function(e){OP.getPart(e,t,"toolbar").each((function(t){Bt(t.getApis().toggle,(function(e){return e(t)}))}))},isToolbarDrawerToggled:function(e){return OP.getPart(e,t,"toolbar").bind((function(t){return L.from(t.getApis().isOpen).map((function(e){return e(t)}))})).getOr(!1)},getThrobber:function(e){return OP.getPart(e,t,"throbber")},focusToolbar:function(e){var n=OP.getPart(e,t,"toolbar").orThunk((function(){return OP.getPart(e,t,"multiple-toolbar")}));n.each((function(t){Aw.focusIn(t)}))},setMenubar:function(e,n){OP.getPart(e,t,"menubar").each((function(t){KV.setMenus(t,n)}))},focusMenubar:function(e){OP.getPart(e,t,"menubar").each((function(t){KV.focus(t)}))}};return{uid:t.uid,dom:t.dom,components:e,apis:r,behaviours:t.behaviours}},ZU=EP.optional({factory:KV,name:"menubar",schema:[Ai("backstage")]}),tj=function(t){return t.type===US.sliding?YU:t.type===US.floating?XU:JU},ej=EP.optional({factory:{sketch:function(t){return NP.sketch({uid:t.uid,dom:t.dom,listBehaviours:mf([Aw.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:function(){return JU({type:t.type,uid:oc("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:t.providers,onEscape:function(){return t.onEscape(),L.some(!0)}})},setupItem:function(t,e,n,r){PP.setGroups(e,n)},shell:!0})}},name:"multiple-toolbar",schema:[Ai("dom"),Ai("onEscape")]}),nj=EP.optional({factory:{sketch:function(t){var e=tj(t),n={type:t.type,uid:t.uid,onEscape:function(){return t.onEscape(),L.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,providers:t.providers,moreDrawerData:{lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton,lazyHeader:t.lazyHeader},attributes:t.attributes};return e(n)}},name:"toolbar",schema:[Ai("dom"),Ai("onEscape"),Ai("getSink")]}),rj=EP.optional({factory:{sketch:PV},name:"header",schema:[Ai("dom")]}),oj=EP.optional({name:"socket",schema:[Ai("dom")]}),ij=EP.optional({factory:{sketch:FF},name:"sidebar",schema:[Ai("dom")]}),uj=EP.optional({factory:{sketch:nU},name:"throbber",schema:[Ai("dom")]}),aj=mv({name:"OuterContainer",factory:QU,configFields:[Ai("dom"),Ai("behaviours")],partFields:[rj,ZU,nj,ej,oj,ij,uj],apis:{getSocket:function(t,e){return t.getSocket(e)},setSidebar:function(t,e,n){t.setSidebar(e,n)},toggleSidebar:function(t,e,n){t.toggleSidebar(e,n)},whichSidebar:function(t,e){return t.whichSidebar(e)},getHeader:function(t,e){return t.getHeader(e)},getToolbar:function(t,e){return t.getToolbar(e)},setToolbar:function(t,e,n){var r=$(n,(function(t){return $U(t)}));t.setToolbar(e,r)},setToolbars:function(t,e,n){var r=$(n,(function(t){return $(t,$U)}));t.setToolbars(e,r)},refreshToolbar:function(t,e){return t.refreshToolbar(e)},toggleToolbarDrawer:function(t,e){t.toggleToolbarDrawer(e)},isToolbarDrawerToggled:function(t,e){return t.isToolbarDrawerToggled(e)},getThrobber:function(t,e){return t.getThrobber(e)},setMenubar:function(t,e,n){t.setMenubar(e,n)},focusMenubar:function(t,e){t.focusMenubar(e)},focusToolbar:function(t,e){t.focusToolbar(e)}}}),cj="file edit view insert format tools table help",sj={file:{title:"File",items:"newdocument restoredraft | preview | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck code wordcount"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},lj=function(t,e,n){var r=ET(n).split(/[ ,]/);return{text:t.title,getItems:function(){return rt(t.items,(function(t){var n=t.toLowerCase();return 0===n.trim().length||j(r,(function(t){return t===n}))?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]}))}}},fj=function(t){return"string"===typeof t?t.split(" "):t},dj=function(t,e){var n=A(A({},sj),e.menus),r=ht(e.menus).length>0,o=void 0===e.menubar||!0===e.menubar?fj(cj):fj(!1===e.menubar?"":e.menubar),i=Y(o,(function(t){var n=Et(sj,t);return r?n||Ot(e.menus,t).exists((function(t){return Et(t,"items")})):n})),u=$(i,(function(r){var o=n[r];return lj({title:o.title,items:fj(o.items)},e,t)}));return Y(u,(function(t){var e=function(t){return"separator"!==t.type};return t.getItems().length>0&&j(t.getItems(),e)}))},mj=function(t){var e=function(){t._skinLoaded=!0,hE(t)};return function(){t.initialized?e():t.on("init",e)}},gj=function(t,e){return function(){return pE(t,{message:e})}},hj=function(t,e,n){return new uS((function(r,o){n.load(e,r,o),t.on("remove",(function(){return n.unload(e)}))}))},pj=function(t,e){var n=e+"/skin.min.css";return hj(t,n,t.ui.styleSheetLoader)},vj=function(t,e){var n=Mn(ee.fromDom(t.getElement()));if(n){var r=e+"/skin.shadowdom.min.css";return hj(t,r,dT.DOM.styleSheetLoader)}return uS.resolve()},bj=function(t,e){var n=gT(e);n&&e.contentCSS.push(n+(t?"/content.inline":"/content")+".min.css"),!1===pT(e)&&i(n)?uS.all([pj(e,n),vj(e,n)]).then(mj(e),gj(e,"Skin could not be loaded")):mj(e)()},yj=S(bj,!1),wj=S(bj,!0),xj=function(t,e){return function(n){var r=nd(),o=function(){n.setActive(t.formatter.match(e));var o=t.formatter.formatChanged(e,n.setActive);r.set(o)};return t.initialized?o():t.once("init",o),function(){t.off("init",o),r.clear()}}},Cj=function(t,e,n){return function(r){var o=function(){return n(r)},i=function(){n(r),t.on(e,o)};return t.initialized?i():t.once("init",i),function(){t.off("init",i),t.off(e,o)}}},Sj=function(t){return function(e){return function(){t.undoManager.transact((function(){t.focus(),t.execCommand("mceToggleFormat",!1,e.format)}))}}},kj=function(t,e){return function(){return t.execCommand(e)}},Tj=function(t,e,n){var r=function(t,r,i,u){var a=e.shared.providers.translate(t.title);if("separator"===t.type)return L.some({type:"separator",text:a});if("submenu"===t.type){var c=rt(t.getStyleItems(),(function(t){return o(t,r,u)}));return 0===r&&c.length<=0?L.none():L.some({type:"nestedmenuitem",text:a,disabled:c.length<=0,getSubmenuItems:function(){return rt(t.getStyleItems(),(function(t){return o(t,r,u)}))}})}return L.some(A({type:"togglemenuitem",text:a,icon:t.icon,active:t.isSelected(u),disabled:i,onAction:n.onAction(t)},t.getStylePreview().fold((function(){return{}}),(function(t){return{meta:{style:t}}}))))},o=function(t,e,o){var i="formatter"===t.type&&n.isInvalid(t);return 0===e?i?[]:r(t,e,!1,o).toArray():r(t,e,i,o).toArray()},i=function(t){var e=n.getCurrentValue(),r=n.shouldHide?0:1;return rt(t,(function(t){return o(t,r,e)}))},u=function(t,e){return function(n,r){var o=e(),u=i(o),a=qB(u,jS.CLOSE_ON_EXECUTE,t,!1);r(a)}};return{validateItems:i,getFetch:u}},Oj=function(t,e,n){var r=n.dataset,o="basic"===r.type?function(){return $(r.data,(function(t){return zI(t,n.isSelectedFor,n.getPreviewFor)}))}:r.getData;return{items:Tj(t,e,n),getStyleItems:o}},Ej=function(t,e,n){var r=Oj(t,e,n),o=r.items,i=r.getStyleItems,u=function(t){return{getComponent:w(t)}},a=Cj(t,"NodeChange",(function(t){var e=t.getComponent();n.updateText(e)}));return BB({text:n.icon.isSome()?L.none():n.text,icon:n.icon,tooltip:L.from(n.tooltip),role:L.none(),fetch:o.getFetch(e,i),onSetup:a,getApi:u,columns:1,presets:"normal",classes:n.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",e.shared)},_j=function(t){return $(t,(function(t){var e=t,n=t,r=t.split("=");return r.length>1&&(e=r[0],n=r[1]),{title:e,format:n}}))},Aj=function(t){return{type:"basic",data:t}};(function(t){t[t["SemiColon"]=0]="SemiColon",t[t["Space"]=1]="Space"})(XL||(XL={}));var Dj,Mj=function(t,e){return e===XL.SemiColon?t.replace(/;$/,"").split(";"):t.split(" ")},zj=function(t,e,n,r){var o=t.getParam(e,n,"string"),i=_j(Mj(o,r));return{type:"basic",data:i}},Rj=[{title:"Left",icon:"align-left",format:"alignleft",command:"JustifyLeft"},{title:"Center",icon:"align-center",format:"aligncenter",command:"JustifyCenter"},{title:"Right",icon:"align-right",format:"alignright",command:"JustifyRight"},{title:"Justify",icon:"align-justify",format:"alignjustify",command:"JustifyFull"}],Nj=function(t){var e=function(){return tt(Rj,(function(e){return t.formatter.match(e.format)}))},n=function(e){return function(){return t.formatter.match(e)}},r=function(t){return L.none},o=function(t){var n=e(),r=n.fold(w("left"),(function(t){return t.title.toLowerCase()}));Sa(t,NB,{icon:"align-"+r})},i=Aj(Rj),u=function(e){return function(){return tt(Rj,(function(t){return t.format===e.format})).each((function(e){return t.execCommand(e.command)}))}};return{tooltip:"Align",text:L.none(),icon:L.some("align-left"),isSelectedFor:n,getCurrentValue:L.none,getPreviewFor:r,onAction:u,updateText:o,dataset:i,shouldHide:!1,isInvalid:function(e){return!t.formatter.canApply(e.format)}}},Bj=function(t,e){return Ej(t,e,Nj(t))},Lj=function(t,e){var n=Oj(t,e,Nj(t));t.ui.registry.addNestedMenuItem("align",{text:e.shared.providers.translate("Align"),getSubmenuItems:function(){return n.items.validateItems(n.getStyleItems())}})},Hj="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",Ij=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],Pj=function(t){var e=t.split(/\s*,\s*/);return $(e,(function(t){return t.replace(/^['"]+|['"]+$/g,"")}))},Vj=function(t){var e=function(){var e=Pj(t.toLowerCase());return ot(Ij,(function(t){return e.indexOf(t.toLowerCase())>-1}))};return 0===t.indexOf("-apple-system")&&e()},Fj=function(t){var e="System Font",n=function(){var n=function(t){return t?Pj(t)[0]:""},r=t.queryCommandValue("FontName"),o=c.data,i=r?r.toLowerCase():"",u=tt(o,(function(t){var e=t.format;return e.toLowerCase()===i||n(e).toLowerCase()===n(i).toLowerCase()})).orThunk((function(){return Lt(Vj(i),{title:e,format:i})}));return{matchOpt:u,font:r}},r=function(t){return function(e){return e.exists((function(e){return e.format===t}))}},o=function(){var t=n().matchOpt;return t},i=function(t){return function(){return L.some({tag:"div",styles:-1===t.indexOf("dings")?{"font-family":t}:{}})}},u=function(e){return function(){t.undoManager.transact((function(){t.focus(),t.execCommand("FontName",!1,e.format)}))}},a=function(t){var e=n(),r=e.matchOpt,o=e.font,i=r.fold(w(o),(function(t){return t.title}));Sa(t,RB,{text:i})},c=zj(t,"font_formats",Hj,XL.SemiColon);return{tooltip:"Fonts",text:L.some(e),icon:L.none(),isSelectedFor:r,getCurrentValue:o,getPreviewFor:i,onAction:u,updateText:a,dataset:c,shouldHide:!1,isInvalid:O}},Uj=function(t,e){return Ej(t,e,Fj(t))},jj=function(t,e){var n=Oj(t,e,Fj(t));t.ui.registry.addNestedMenuItem("fontformats",{text:e.shared.providers.translate("Fonts"),getSubmenuItems:function(){return n.items.validateItems(n.getStyleItems())}})},Wj="8pt 10pt 12pt 14pt 18pt 24pt 36pt",qj={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},$j={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},Gj=function(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n},Kj=function(t,e){return/[0-9.]+px$/.test(t)?Gj(72*parseInt(t,10)/96,e||0)+"pt":Ot($j,t).getOr(t)},Xj=function(t){return Ot(qj,t).getOr("")},Yj=function(t){var e=function(){var e=L.none(),n=a.data,r=t.queryCommandValue("FontSize");if(r)for(var o=function(t){var o=Kj(r,t),i=Xj(o);e=tt(n,(function(t){return t.format===r||t.format===o||t.format===i}))},i=3;e.isNone()&&i>=0;i--)o(i);return{matchOpt:e,size:r}},n=function(t){return function(e){return e.exists((function(e){return e.format===t}))}},r=function(){var t=e().matchOpt;return t},o=w(L.none),i=function(e){return function(){t.undoManager.transact((function(){t.focus(),t.execCommand("FontSize",!1,e.format)}))}},u=function(t){var n=e(),r=n.matchOpt,o=n.size,i=r.fold(w(o),(function(t){return t.title}));Sa(t,RB,{text:i})},a=zj(t,"fontsize_formats",Wj,XL.Space);return{tooltip:"Font sizes",text:L.some("12pt"),icon:L.none(),isSelectedFor:n,getPreviewFor:o,getCurrentValue:r,onAction:i,updateText:u,dataset:a,shouldHide:!1,isInvalid:O}},Jj=function(t,e){return Ej(t,e,Yj(t))},Qj=function(t,e){var n=Oj(t,e,Yj(t));t.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return n.items.validateItems(n.getStyleItems())}})},Zj=function(t,e){var n=e(),r=$(n,(function(t){return t.format}));return L.from(t.formatter.closest(r)).bind((function(t){return tt(n,(function(e){return e.format===t}))})).orThunk((function(){return Lt(t.formatter.match("p"),{title:"Paragraph",format:"p"})}))},tW="Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre",eW=function(t){var e="Paragraph",n=function(e){return function(){return t.formatter.match(e)}},r=function(e){return function(){var n=t.formatter.get(e);return L.some({tag:n.length>0&&(n[0].inline||n[0].block)||"div",styles:t.dom.parseStyle(t.formatter.getCssText(e))})}},o=function(n){var r=Zj(t,(function(){return i.data})),o=r.fold(w(e),(function(t){return t.title}));Sa(n,RB,{text:o})},i=zj(t,"block_formats",tW,XL.SemiColon);return{tooltip:"Blocks",text:L.some(e),icon:L.none(),isSelectedFor:n,getCurrentValue:L.none,getPreviewFor:r,onAction:Sj(t),updateText:o,dataset:i,shouldHide:!1,isInvalid:function(e){return!t.formatter.canApply(e.format)}}},nW=function(t,e){return Ej(t,e,eW(t))},rW=function(t,e){var n=Oj(t,e,eW(t));t.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return n.items.validateItems(n.getStyleItems())}})},oW=function(t,e){var n="Paragraph",r=function(e){return function(){return t.formatter.match(e)}},o=function(e){return function(){var n=t.formatter.get(e);return void 0!==n?L.some({tag:n.length>0&&(n[0].inline||n[0].block)||"div",styles:t.dom.parseStyle(t.formatter.getCssText(e))}):L.none()}},i=function(e){var r=function(t){var e=t.items;return void 0!==e&&e.length>0?rt(e,r):[{title:t.title,format:t.format}]},o=rt(MI(t),r),i=Zj(t,w(o)),u=i.fold(w(n),(function(t){return t.title}));Sa(e,RB,{text:u})};return{tooltip:"Formats",text:L.some(n),icon:L.none(),isSelectedFor:r,getCurrentValue:L.none,getPreviewFor:o,onAction:Sj(t),updateText:i,shouldHide:t.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(e){return!t.formatter.canApply(e.format)},dataset:e}},iW=function(t,e){var n=A({type:"advanced"},e.styleselect);return Ej(t,e,oW(t,n))},uW=function(t,e){var n=A({type:"advanced"},e.styleselect),r=Oj(t,e,oW(t,n));t.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return r.items.validateItems(r.getStyleItems())}})},aW=function(t,e){var n=function(n,r){t.updateState.each((function(t){var o=t(n,r);e.set(o)})),t.renderComponents.each((function(t){var o=t(r,e.get()),i=$(o,n.getSystem().build);jg(n,i)}))};return _a([za(ta(),(function(e,r){var o=r;if(!o.universal){var i=t.channel;U(o.channels,i)&&n(e,o.data)}})),Ua((function(e,r){t.initialData.each((function(t){n(e,t)}))}))])},cW=Object.freeze({__proto__:null,events:aW}),sW=function(t,e,n){return n},lW=Object.freeze({__proto__:null,getState:sW}),fW=[Ai("channel"),Vi("renderComponents"),Vi("updateState"),Vi("initialData")],dW=function(){var t=ou(L.none()),e=function(){return t.set(L.none())},n=function(){return t.get().getOr("none")};return{readState:n,get:t.get,set:t.set,clear:e}},mW=Object.freeze({__proto__:null,init:dW}),gW=hf({fields:fW,name:"reflecting",active:cW,apis:lW,state:mW}),hW=w([Ai("toggleClass"),Ai("fetch"),sl("onExecute"),Ki("getHotspot",L.some),Ki("getAnchorOverrides",w({})),Pd(),sl("onItemExecute"),Vi("lazySink"),Ai("dom"),al("onOpen"),ep("splitDropdownBehaviours",[bD,Aw,Yw]),Ki("matchWidth",!1),Ki("useMinWidth",!1),Ki("eventOrder",{}),Vi("role")].concat(RD())),pW=Rp({factory:SC,schema:[Ai("dom")],name:"arrow",defaults:function(){return{buttonBehaviours:mf([Yw.revoke()])}},overrides:function(t){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(e){e.getSystem().getByUid(t.uid).each(ka)},buttonBehaviours:mf([hx.config({toggleOnExecute:!1,toggleClass:t.toggleClass})])}}}),vW=Rp({factory:SC,schema:[Ai("dom")],name:"button",defaults:function(){return{buttonBehaviours:mf([Yw.revoke()])}},overrides:function(t){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(e){e.getSystem().getByUid(t.uid).each((function(n){t.onExecute(n,e)}))}}}}),bW=w([pW,vW,Bp({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Ai("text")],name:"aria-descriptor"}),Np({schema:[ol()],name:"menu",defaults:function(t){return{onExecute:function(e,n){e.getSystem().getByUid(t.uid).each((function(r){t.onItemExecute(r,e,n)}))}}}}),wD()]),yW=function(t,e,n,r){var o,i=function(t){bv.getCurrent(t).each((function(t){rb.highlightFirst(t),Aw.focusIn(t)}))},u=function(e){var n=i;ED(t,x,e,r,n,qA.HighlightFirst).get(p)},a=function(t){return u(t),L.some(!0)},c=function(e){var n=Xp(e,t,"button");return ka(n),L.some(!0)},s=A(A({},_a([Ua((function(e,n){var r=Kp(e,t,"aria-descriptor");r.each((function(t){var n=oc("aria");Vn(t.element,"id",n),Vn(e.element,"aria-describedby",n)}))}))])),vx(L.some(u))),l={repositionMenus:function(t){hx.isOn(t)&&zD(t)}};return{uid:t.uid,dom:t.dom,components:e,apis:l,eventOrder:A(A({},t.eventOrder),(o={},o[ea()]=["disabling","toggling","alloy.base.behaviour"],o)),events:s,behaviours:rp(t.splitDropdownBehaviours,[bD.config({others:{sandbox:function(e){var n=Xp(e,t,"arrow"),r={onOpen:function(){hx.on(n),hx.on(e)},onClose:function(){hx.off(n),hx.off(e)}};return MD(t,e,r)}}}),Aw.config({mode:"special",onSpace:c,onEnter:c,onDown:a}),Yw.config({}),hx.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:t.role.getOr("button"),"aria-haspopup":!0}}}},wW=mv({name:"SplitDropdown",configFields:hW(),partFields:bW(),factory:yW,apis:{repositionMenus:function(t,e){return t.repositionMenus(e)}}}),xW=function(t){return{isDisabled:function(){return Hv.isDisabled(t)},setDisabled:function(e){return Hv.set(t,e)}}},CW=function(t){return{setActive:function(e){hx.set(t,e)},isActive:function(){return hx.isOn(t)},isDisabled:function(){return Hv.isDisabled(t)},setDisabled:function(e){return Hv.set(t,e)}}},SW=function(t,e){return t.map((function(t){return{"aria-label":e.translate(t),title:e.translate(t)}})).getOr({})},kW=oc("focus-button"),TW=function(t,e,n,r,o,i){var u;return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]),attributes:SW(n,i)},components:yO([t.map((function(t){return EB(t,i.icons)})),e.map((function(t){return AB(t,"tox-tbtn",i)}))]),eventOrder:(u={},u[Ru()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:mf([mO.toolbarButton(i.isDisabled),cO(),Fw("common-button-display-events",[za(Ru(),(function(t,e){e.event.prevent(),Ca(t,kW)}))])].concat(r.map((function(n){return gW.config({channel:n,initialData:{icon:t,text:e},renderComponents:function(t,e){return yO([t.icon.map((function(t){return EB(t,i.icons)})),t.text.map((function(t){return AB(t,"tox-tbtn",i)}))])}})})).toArray()).concat(o.getOr([])))}},OW=function(t,e,n,r){var o=e.shared;return AU.sketch({lazySink:o.getSink,fetch:function(){return tD.nu((function(e){e($(n(t.items),$U))}))},markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:TW(t.icon,t.text,t.tooltip,L.none(),L.none(),o.providers),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:r}}}})},EW=function(t,e,n){var r=ou(p),o=TW(t.icon,t.text,t.tooltip,L.none(),L.none(),n);return SC.sketch({dom:o.dom,components:o.components,eventOrder:zB,buttonBehaviours:mf([Fw("toolbar-button-events",[MB({onAction:t.onAction,getApi:e.getApi}),hO(e,r),pO(e,r)]),mO.toolbarButton((function(){return t.disabled||n.isDisabled()})),cO()].concat(e.toolbarButtonBehaviours))})},_W=function(t,e){return AW(t,e,[])},AW=function(t,e,n){return EW(t,{toolbarButtonBehaviours:[].concat(n.length>0?[Fw("toolbarButtonWith",n)]:[]),getApi:xW,onSetup:t.onSetup},e)},DW=function(t,e){return MW(t,e,[])},MW=function(t,e,n){return Co(EW(t,{toolbarButtonBehaviours:[Pw.config({}),hx.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(n.length>0?[Fw("toolbarToggleButtonWith",n)]:[]),getApi:CW,onSetup:t.onSetup},e))},zW=function(t,e,n){return function(r){return tD.nu((function(t){return e.fetch(t)})).map((function(o){return L.from(z_(Co(n_(oc("menu-value"),o,(function(n){e.onItemAction(t(r),n)}),e.columns,e.presets,jS.CLOSE_ON_EXECUTE,e.select.getOr(O),n),{movement:o_(e.columns,e.presets),menuBehaviours:Qk.unnamedEvents("auto"!==e.columns?[]:[Ua((function(t,n){Xk(t,4,lk(e.presets)).each((function(e){var n=e.numRows,r=e.numColumns;Aw.setGridSize(t,n,r)}))}))])})))}))}},RW=function(t,e){var n,r=oc("channel-update-split-dropdown-display"),o=function(t){return{isDisabled:function(){return Hv.isDisabled(t)},setDisabled:function(e){return Hv.set(t,e)},setIconFill:function(e,n){Is(t.element,'svg path[id="'+e+'"], rect[id="'+e+'"]').each((function(t){Vn(t,"fill",n)}))},setIconStroke:function(e,n){Is(t.element,'svg path[id="'+e+'"], rect[id="'+e+'"]').each((function(t){Vn(t,"stroke",n)}))},setActive:function(e){Vn(t.element,"aria-pressed",e),Is(t.element,"span").each((function(n){t.getSystem().getByDom(n).each((function(t){return hx.set(t,e)}))}))},isActive:function(){return Is(t.element,"span").exists((function(e){return t.getSystem().getByDom(e).exists(hx.isOn)}))}}},i=ou(p),u={getApi:o,onSetup:t.onSetup};return wW.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:A({"aria-pressed":!1},SW(t.tooltip,e.providers))},onExecute:function(e){t.onAction(o(e))},onItemExecute:function(t,e,n){},splitDropdownBehaviours:mf([mO.splitButton(e.providers.isDisabled),cO(),Fw("split-dropdown-events",[za(kW,Yw.focus),hO(u,i),pO(u,i)]),FD.config({})]),eventOrder:(n={},n[da()]=["alloy.base.behaviour","split-dropdown-events"],n),toggleClass:"tox-tbtn--enabled",lazySink:e.getSink,fetch:zW(o,t,e.providers),parts:{menu:pk(!1,t.columns,t.presets)},components:[wW.parts.button(TW(t.icon,t.text,L.none(),L.some(r),L.some([hx.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),e.providers)),wW.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:MC("chevron-down",e.providers.icons)},buttonBehaviours:mf([mO.splitButton(e.providers.isDisabled),cO(),NC()])}),wW.parts["aria-descriptor"]({text:e.providers.translate("To open the popup, press Shift+Enter")})]})},NW=[{name:"history",items:["undo","redo"]},{name:"styles",items:["styleselect"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],BW=function(t,e){return function(n,r,o){var i=t(n).mapError((function(t){return Si(t)})).getOrDie();return e(i,r,o)}},LW={button:BW(OS,(function(t,e){return _W(t,e.backstage.shared.providers)})),togglebutton:BW(AS,(function(t,e){return DW(t,e.backstage.shared.providers)})),menubutton:BW(WV,(function(t,e){return GB(t,"tox-tbtn",e.backstage,L.none())})),splitbutton:BW($V,(function(t,e){return RW(t,e.backstage.shared)})),grouptoolbarbutton:BW(FV,(function(t,e,n){var r,o=n.ui.registry.getAll().buttons,i=function(t){return WW(n,{buttons:o,toolbar:t,allowToolbarGroups:!1},e,L.none())},u=(r={},r[Hd]=e.backstage.shared.header.isPositionedAtTop()?Pf.TopToBottom:Pf.BottomToTop,r);switch(RT(n)){case US.floating:return OW(t,e.backstage,i,u);default:throw new Error("Toolbar groups are only supported when using floating toolbar mode")}})),styleSelectButton:function(t,e){return iW(t,e.backstage)},fontsizeSelectButton:function(t,e){return Jj(t,e.backstage)},fontSelectButton:function(t,e){return Uj(t,e.backstage)},formatButton:function(t,e){return nW(t,e.backstage)},alignMenuButton:function(t,e){return Bj(t,e.backstage)}},HW=function(t,e,n){return Ot(LW,t.type).fold((function(){return console.error("skipping button defined by",t),L.none()}),(function(r){return L.some(r(t,e,n))}))},IW={styleselect:LW.styleSelectButton,fontsizeselect:LW.fontsizeSelectButton,fontselect:LW.fontSelectButton,formatselect:LW.formatButton,align:LW.alignMenuButton},PW=function(t){var e=$(NW,(function(e){var n=Y(e.items,(function(e){return Et(t,e)||Et(IW,e)}));return{name:e.name,items:n}}));return Y(e,(function(t){return t.items.length>0}))},VW=function(t){var e=t.split("|");return $(e,(function(t){return{items:t.trim().split(" ")}}))},FW=function(t){return h(t,(function(t){return Et(t,"name")&&Et(t,"items")}))},UW=function(t){var e=t.toolbar,n=t.buttons;return!1===e?[]:void 0===e||!0===e?PW(n):i(e)?VW(e):FW(e)?e:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},jW=function(t,e,n,r,o,i){return Ot(e,n.toLowerCase()).orThunk((function(){return i.bind((function(t){return gt(t,(function(t){return Ot(e,t+n.toLowerCase())}))}))})).fold((function(){return Ot(IW,n.toLowerCase()).map((function(e){return e(t,o)})).orThunk((function(){return L.none()}))}),(function(e){return"grouptoolbarbutton"!==e.type||r?HW(e,o,t):(console.warn("Ignoring the '"+n+"' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested."),L.none())}))},WW=function(t,e,n,r){var o=UW(e),i=$(o,(function(o){var i=rt(o.items,(function(o){return 0===o.trim().length?[]:jW(t,e.buttons,o,e.allowToolbarGroups,n,r).toArray()}));return{title:L.from(t.translate(o.name)),items:i}}));return Y(i,(function(t){return t.items.length>0}))},qW=function(t,e,n,r){var o=e.outerContainer,u=n.toolbar,a=n.buttons;if(h(u,i)){var c=u.map((function(e){var o={toolbar:e,buttons:a,allowToolbarGroups:n.allowToolbarGroups};return WW(t,o,{backstage:r},L.none())}));aj.setToolbars(o,c)}else aj.setToolbar(o,WW(t,n,{backstage:r},L.none()))},$W=en(),GW=$W.os.isiOS()&&$W.os.version.major<=12,KW=function(t,e){var n=t.dom,r=t.getWin(),o=t.getDoc().documentElement,i=ou(lr(r.innerWidth,r.innerHeight)),u=ou(lr(o.offsetWidth,o.offsetHeight)),a=function(){var e=i.get();e.left===r.innerWidth&&e.top===r.innerHeight||(i.set(lr(r.innerWidth,r.innerHeight)),bE(t))},c=function(){var e=t.getDoc().documentElement,n=u.get();n.left===e.offsetWidth&&n.top===e.offsetHeight||(u.set(lr(e.offsetWidth,e.offsetHeight)),bE(t))},s=function(e){return yE(t,e)};n.bind(r,"resize",a),n.bind(r,"scroll",s);var l=ad(ee.fromDom(t.getBody()),"load",c),f=e.uiMothership.element;t.on("hide",(function(){Kn(f,"display","none")})),t.on("show",(function(){nr(f,"display")})),t.on("NodeChange",c),t.on("remove",(function(){l.unbind(),n.unbind(r,"resize",a),n.unbind(r,"scroll",s),r=null}))},XW=function(t,e,n,r,o){var i=ou(0),u=e.outerContainer;yj(t);var a=ee.fromDom(o.targetNode),c=Dn(An(a));Yg(a,e.mothership),Xg(c,e.uiMothership),t.on("PostRender",(function(){qW(t,e,n,r),i.set(t.getWin().innerWidth),aj.setMenubar(u,dj(t,n)),aj.setSidebar(u,n.sidebar),KW(t,e)}));var s=aj.getSocket(u).getOrDie("Could not find expected socket element");if(GW){Xn(s.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});var l=jC((function(){t.fire("ScrollContent")}),20),f=ud(s.element,"scroll",l.throttle);t.on("remove",f.unbind)}aO(t,e),t.addCommand("ToggleSidebar",(function(e,n){aj.toggleSidebar(u,n),t.fire("ToggleSidebar")})),t.addQueryValueHandler("ToggleSidebar",(function(){return aj.whichSidebar(u)}));var d=RT(t),m=function(){aj.refreshToolbar(e.outerContainer)};d!==US.sliding&&d!==US.floating||t.on("ResizeWindow ResizeEditor ResizeContent",(function(){var e=t.getWin().innerWidth;e!==i.get()&&(m(),i.set(e))}));var g={enable:function(){uO(e,!1)},disable:function(){uO(e,!0)},isDisabled:function(){return Hv.isDisabled(u)}};return{iframeContainer:s.element.dom,editorContainer:u.element.dom,api:g}},YW=Object.freeze({__proto__:null,render:XW}),JW=function(t){var e=/^[0-9\.]+(|px)$/i;return e.test(""+t)?L.some(parseInt(""+t,10)):L.none()},QW=function(t){return g(t)?t+"px":t},ZW=function(t,e,n){var r=e.filter((function(e){return te}));return r.or(o).getOr(t)},tq=function(t){var e=vT(t),n=wT(t),r=CT(t);return JW(e).map((function(t){return ZW(t,n,r)}))},eq=function(t){var e=tq(t);return e.getOr(vT(t))},nq=function(t){var e=bT(t),n=yT(t),r=xT(t);return JW(e).map((function(t){return ZW(t,n,r)}))},rq=function(t){var e=nq(t);return e.getOr(bT(t))},oq=function(t,e,n,r,o){var i=n.uiMothership,u=n.outerContainer,a=dT.DOM,c=UT(t),s=qT(t),l=xT(t).or(nq(t)),f=r.shared.header,d=f.isPositionedAtTop,m=RT(t),g=m===US.sliding||m===US.floating,h=ou(!1),p=function(){return h.get()&&!t.removed},v=function(t){return g?t.fold(w(0),(function(t){return t.components().length>1?ur(t.components()[1].element):0})):0},b=function(n){switch(LT(t)){case zT.auto:var r=aj.getToolbar(u),o=v(r),i=ur(n.element)-o,a=Jr(e),c=a.y>i;if(c)return"top";var s=hn(e),l=Math.max(s.dom.scrollHeight,ur(s)),f=a.bottom=n&&t.bottom-e.y>=n},xq=function(t){var e=t.getBoundingClientRect();if(e.height<=0&&e.width<=0){var n=Tn(ee.fromDom(t.startContainer),t.startOffset).element,r=fe(n)?vn(n):L.some(n);return r.filter(le).map((function(t){return t.dom.getBoundingClientRect()})).getOr(e)}return e},Cq=function(t){var e=t.selection.getRng(),n=xq(e);if(t.inline){var r=Hr();return Yr(r.left+n.left,r.top+n.top,n.width,n.height)}var o=Qr(ee.fromDom(t.getBody()));return Yr(o.x+n.left,o.y+n.top,n.width,n.height)},Sq=function(t,e){return e.filter(Ln).map(Qr).getOrThunk((function(){return Cq(t)}))},kq=function(t,e,n){var r=Math.max(t.x+n,e.x),o=Math.min(t.right-n,e.right);return{x:r,width:o-r}},Tq=function(t,e,n,r,o,i){var u=ee.fromDom(t.getContainer()),a=Is(u,".tox-editor-header").getOr(u),c=Jr(a),s=c.y>=e.bottom,l=r&&!s;if(t.inline&&l)return{y:Math.max(c.bottom+i,n.y),bottom:n.bottom};if(t.inline&&!l)return{y:n.y,bottom:Math.min(c.y-i,n.bottom)};var f="line"===o?Jr(u):e;return l?{y:Math.max(c.bottom+i,n.y),bottom:Math.min(f.bottom-i,n.bottom)}:{y:Math.max(f.y+i,n.y),bottom:Math.min(c.y-i,n.bottom)}},Oq=function(t,e,n,r){void 0===r&&(r=0);var o=Fr(window),i=Jr(ee.fromDom(t.getContentAreaContainer())),u=_T(t)||AT(t)||MT(t),a=kq(i,o,r),c=a.x,s=a.width;if(t.inline&&!u)return Yr(c,o.y,s,o.height);var l=e.header.isPositionedAtTop(),f=Tq(t,i,o,l,n,r),d=f.y,m=f.bottom;return Yr(c,d,s,m-d)},Eq=12,_q={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"],inset:["tox-pop--inset"]},Aq={maxHeightFunction:Ed(),maxWidthFunction:xU()},Dq=function(t,e){var n=t.selection.getRng(),r=Tn(ee.fromDom(n.startContainer),n.startOffset);return n.startContainer===n.endContainer&&n.startOffset===n.endOffset-1&&sn(r.element,e)},Mq=function(t,e,n){var r=Zn(t,"position");Kn(t,"position",e);var o=n(t);return r.each((function(e){return Kn(t,"position",e)})),o},zq=function(t){return"node"===t},Rq=function(t,e,n,r,o){var i=Cq(t),u=r.lastElement().exists((function(t){return sn(n,t)}));if(Dq(t,n))return u?bC:mC;if(u)return Mq(e,r.getMode(),(function(){var t=wq(i,Jr(e));return t&&!r.isReposition()?wC:bC}));var a="fixed"===r.getMode()?o.y+Hr().top:o.y,c=ur(e)+Eq;return a+c<=i.y?mC:gC},Nq=function(t,e,n,r){var o=function(e){return function(r,o,i,u,a){var c=Rq(t,u,e,n,a),s=A(A({},r),{y:a.y,height:a.height});return A(A({},c(s,o,i,u,a)),{alwaysFit:!0})}},i=function(t){return zq(r)?[o(t)]:[]},u={onLtr:function(t){return[ql,$l,jl,Fl,Wl,Ul].concat(i(t))},onRtl:function(t){return[ql,$l,Wl,Ul,jl,Fl].concat(i(t))}},a={onLtr:function(t){return[$l,Fl,Ul,jl,Wl,ql].concat(i(t))},onRtl:function(t){return[$l,Ul,Fl,Wl,jl,ql].concat(i(t))}};return e?a:u},Bq=function(t,e,n,r){return"line"===e?{bubble:zd(Eq,0,_q),layouts:{onLtr:function(){return[Gl]},onRtl:function(){return[Kl]}},overrides:Aq}:{bubble:zd(0,Eq,_q,1/Eq),layouts:Nq(t,n,r,e),overrides:Aq}},Lq=function(t,e){var n=Y(e,(function(e){return e.predicate(t.dom)})),r=X(n,(function(t){return"contexttoolbar"===t.type})),o=r.pass,i=r.fail;return{contextToolbars:o,contextForms:i}},Hq=function(t){if(t.length<=1)return t;var e=function(e){return j(t,(function(t){return t.position===e}))},n=function(e){return Y(t,(function(t){return t.position===e}))},r=e("selection"),o=e("node");if(r||o){if(o&&r){var i=n("node"),u=$(n("selection"),(function(t){return A(A({},t),{position:"node"})}));return i.concat(u)}return n(r?"selection":"node")}return n("line")},Iq=function(t){if(t.length<=1)return t;var e=function(e){return tt(t,(function(t){return t.position===e}))},n=e("selection").orThunk((function(){return e("node")})).orThunk((function(){return e("line")})).map((function(t){return t.position}));return n.fold((function(){return[]}),(function(e){return Y(t,(function(t){return t.position===e}))}))},Pq=function(t,e,n){var r=Lq(t,e);if(r.contextForms.length>0)return L.some({elem:t,toolbars:[r.contextForms[0]]});var o=Lq(t,n);if(o.contextForms.length>0)return L.some({elem:t,toolbars:[o.contextForms[0]]});if(r.contextToolbars.length>0||o.contextToolbars.length>0){var i=Hq(r.contextToolbars.concat(o.contextToolbars));return L.some({elem:t,toolbars:i})}return L.none()},Vq=function(t,e,n){return t(e)?L.none():yu(e,(function(t){if(le(t)){var e=Lq(t,n.inNodeScope),r=e.contextToolbars,o=e.contextForms,i=o.length>0?o:Iq(r);return i.length>0?L.some({elem:t,toolbars:i}):L.none()}return L.none()}),t)},Fq=function(t,e){var n=ee.fromDom(e.getBody()),r=function(t){return sn(t,n)},o=function(t){return!r(t)&&!dn(n,t)},i=ee.fromDom(e.selection.getNode());return o(i)?L.none():Pq(i,t.inNodeScope,t.inEditorScope).orThunk((function(){return Vq(r,i,t)}))},Uq=function(t,e){var n={},r=[],o=[],i={},u={},a=function(t,a){var c=xi(HS(a));n[t]=c,c.launch.map((function(n){i["form:"+t]=A(A({},a.launch),{type:"contextformtogglebutton"===n.type?"togglebutton":"button",onAction:function(){e(c)}})})),"editor"===c.scope?o.push(c):r.push(c),u[t]=c},c=function(t,e){PS(e).each((function(n){"editor"===e.scope?o.push(n):r.push(n),u[t]=n}))},s=ht(t);return G(s,(function(e){var n=t[e];"contextform"===n.type?a(e,n):"contexttoolbar"===n.type&&c(e,n)})),{forms:n,inNodeScope:r,inEditorScope:o,lookupTable:u,formNavigators:i}},jq=oc("forward-slide"),Wq=oc("backward-slide"),qq=oc("change-slide-event"),$q="tox-pop--resizing",Gq=function(t){var e=ou([]);return eC.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){e.set([]),eC.getContent(t).each((function(t){nr(t.element,"visibility")})),as(t.element,$q),nr(t.element,"width")},inlineBehaviours:mf([Fw("context-toolbar-events",[Fa($u(),(function(t,e){"width"===e.event.raw.propertyName&&(as(t.element,$q),nr(t.element,"width"))})),za(qq,(function(t,e){var n=t.element;nr(n,"width");var r=vr(n);eC.setContent(t,e.event.contents),is(n,$q);var o=vr(n);Kn(n,"width",r+"px"),eC.getContent(t).each((function(t){e.event.focus.bind((function(t){return Sf(t),Ef(n)})).orThunk((function(){return Aw.focusIn(t),Of(An(n))}))})),xC.setTimeout((function(){Kn(t.element,"width",o+"px")}),0)})),za(jq,(function(t,n){eC.getContent(t).each((function(n){e.set(e.get().concat([{bar:n,focus:Of(An(t.element))}]))})),Sa(t,qq,{contents:n.event.forwardContents,focus:L.none()})})),za(Wq,(function(t,n){dt(e.get()).each((function(n){e.set(e.get().slice(0,e.get().length-1)),Sa(t,qq,{contents:_s(n.bar),focus:n.focus})}))}))]),Aw.config({mode:"special",onEscape:function(n){return dt(e.get()).fold((function(){return t.onEscape()}),(function(t){return Ca(n,Wq),L.some(!0)}))}})]),lazySink:function(){return ro.value(t.sink)}})},Kq="tox-pop--transition",Xq=function(t,e,n,r){var o=r.backstage,i=o.shared,u=en().deviceType.isTouch,a=od(),c=od(),s=od(),l=Es(Gq({sink:n,onEscape:function(){return t.focus(),L.some(!0)}})),f=function(){var e=s.get().getOr("node"),n=zq(e)?1:0;return Oq(t,i,e,n)},d=function(){return!t.removed&&!(u()&&o.isContextMenuOpen())},m=function(t){return At(Rt(t,a.get(),sn),!0)},g=function(){if(d()){var e=f(),n=At(s.get(),"node")?Sq(t,a.get()):Cq(t);return e.height<=0||!wq(n,e)}return!0},h=function(){a.clear(),c.clear(),s.clear(),eC.hide(l)},v=function(){if(eC.isOpen(l)){var t=l.element;nr(t,"display"),g()?Kn(t,"display","none"):(c.set(0),eC.reposition(l))}},b=function(e){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[e],behaviours:mf([Aw.config({mode:"acyclic"}),Fw("pop-dialog-wrap-events",[Ua((function(e){t.shortcuts.add("ctrl+F9","focus statusbar",(function(){return Aw.focusIn(e)}))})),ja((function(e){t.shortcuts.remove("ctrl+F9")}))])])}},y=ge((function(){return Uq(e,(function(t){var e=C([t]);Sa(l,jq,{forwardContents:b(e)})}))})),w=function(e,n){return WW(t,{buttons:e,toolbar:n.items,allowToolbarGroups:!1},r,L.some(["form:"]))},x=function(t,e){return yq.buildInitGroups(t,e)},C=function(e){var n=t.ui.registry.getAll().buttons,r=y(),o=A(A({},n),r.formNavigators),u=RT(t)===US.scrolling?US.scrolling:US.default,a=nt($(e,(function(t){return"contexttoolbar"===t.type?w(o,t):x(t,i.providers)})));return JU({type:u,uid:oc("context-toolbar"),initGroups:a,onEscape:L.none,cyclicKeying:!0,providers:i.providers})},S=function(e,r){var o="node"===e?i.anchors.node(r):i.anchors.cursor(),s=Bq(t,e,u(),{lastElement:a.get,isReposition:function(){return At(c.get(),0)},getMode:function(){return Ig.getMode(n)}});return Co(o,s)},k=function(t,e){if(T.cancel(),d()){var r=C(t),o=t[0].position,i=S(o,e);s.set(o),c.set(1);var u=l.element;nr(u,"display"),m(e)||(as(u,Kq),Ig.reset(n,l)),eC.showWithinBounds(l,b(r),{anchor:i,transition:{classes:[Kq],mode:"placement"}},(function(){return L.some(f())})),e.fold(a.clear,a.set),g()&&Kn(u,"display","none")}},T=WC((function(){if(t.hasFocus()&&!t.removed)if(cs(l.element,Kq))T.throttle();else{var e=y();Fq(e,t).fold(h,(function(t){k(t.toolbars,L.some(t.elem))}))}}),17);t.on("init",(function(){t.on("remove",h),t.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",v),t.on("click keyup focus SetContent",T.throttle),t.on(lq,h),t.on(sq,(function(e){var n=y();Ot(n.lookupTable,e.toolbarKey).each((function(n){k([n],Lt(e.target!==t,e.target)),eC.getContent(l).each(Aw.focusIn)}))})),t.on("focusout",(function(e){xC.setEditorTimeout(t,(function(){Ef(n.element).isNone()&&Ef(l.element).isNone()&&h()}),0)})),t.on("SwitchMode",(function(){t.mode.isReadOnly()&&h()})),t.on("AfterProgressState",(function(e){e.state?h():t.hasFocus()&&T.throttle()})),t.on("NodeChange",(function(t){Ef(l.element).fold(T.throttle,p)}))}))},Yq=function(t){var e=[{name:"alignleft",text:"Align left",cmd:"JustifyLeft",icon:"align-left"},{name:"aligncenter",text:"Align center",cmd:"JustifyCenter",icon:"align-center"},{name:"alignright",text:"Align right",cmd:"JustifyRight",icon:"align-right"},{name:"alignjustify",text:"Justify",cmd:"JustifyFull",icon:"align-justify"}];G(e,(function(e){t.ui.registry.addToggleButton(e.name,{tooltip:e.text,icon:e.icon,onAction:kj(t,e.cmd),onSetup:xj(t,e.name)})})),t.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onAction:kj(t,"JustifyNone")})},Jq={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Qq=function(){var t="[0-9]+",e="[+-]?"+t,n="[eE]"+e,r="\\.",o=function(t){return"(?:"+t+")?"},i=["Infinity",t+r+o(t)+o(n),r+t+o(n),t+o(n)].join("|"),u="[+-]?(?:"+i+")";return new RegExp("^("+u+")(.*)$")}(),Zq=function(t,e){return j(e,(function(e){return j(Jq[e],(function(e){return t===e}))}))},t$=function(t,e){var n=L.from(Qq.exec(t));return n.bind((function(t){var n=Number(t[1]),r=t[2];return Zq(r,e)?L.some({value:n,unit:r}):L.none()}))},e$=function(t,e){return t$(t,e).map((function(t){var e=t.value,n=t.unit;return e+n}))},n$=function(t,e){var n=function(){var n=e.getOptions(t),r=e.getCurrent(t).map(e.hash),o=od();return $(n,(function(n){return{type:"togglemenuitem",text:e.display(n),onSetup:function(i){var u=function(t){t&&(o.on((function(t){return t.setActive(!1)})),o.set(i)),i.setActive(t)};u(At(r,e.hash(n)));var a=e.watcher(t,n,u);return function(){o.clear(),a()}},onAction:function(){return e.setCurrent(t,n)}}}))};t.ui.registry.addMenuButton(e.name,{tooltip:e.text,icon:e.icon,fetch:function(t){return t(n())},onSetup:e.onToolbarSetup}),t.ui.registry.addNestedMenuItem(e.name,{type:"nestedmenuitem",text:e.text,getSubmenuItems:n,onSetup:e.onMenuSetup})},r$={name:"lineheight",text:"Line height",icon:"line-height",getOptions:TT,hash:function(t){return e$(t,["fixed","relative","empty"]).getOr(t)},display:x,watcher:function(t,e,n){return t.formatter.formatChanged("lineheight",n,!1,{value:e}).unbind},getCurrent:function(t){return L.from(t.queryCommandValue("LineHeight"))},setCurrent:function(t,e){return t.execCommand("LineHeight",!1,e)}},o$=function(t){var e=L.from(OT(t));return e.map((function(e){return{name:"language",text:"Language",icon:"language",getOptions:w(e),hash:function(t){return l(t.customCode)?t.code:t.code+"/"+t.customCode},display:function(t){return t.title},watcher:function(t,e,n){return t.formatter.formatChanged("lang",n,!1,{value:e.code,customValue:e.customCode}).unbind},getCurrent:function(t){var e=ee.fromDom(t.selection.getNode());return wu(e,(function(t){return L.some(t).filter(le).bind((function(t){var e=jn(t,"lang");return e.map((function(e){var n=jn(t,"data-mce-lang").getOrUndefined();return{code:e,customCode:n,title:""}}))}))}))},setCurrent:function(t,e){return t.execCommand("Lang",!1,e)},onToolbarSetup:function(e){var n=nd();return e.setActive(t.formatter.match("lang",{},void 0,!0)),n.set(t.formatter.formatChanged("lang",e.setActive,!0)),n.clear}}}))},i$=function(t){n$(t,r$),o$(t).each((function(e){return n$(t,e)}))},u$=function(t,e){Lj(t,e),jj(t,e),uW(t,e),rW(t,e),Qj(t,e)},a$=function(t){return Cj(t,"NodeChange",(function(e){e.setDisabled(!t.queryCommandState("outdent"))}))},c$=function(t){t.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:a$(t),onAction:kj(t,"outdent")}),t.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:kj(t,"indent")})},s$=function(t){c$(t)},l$=function(t,e){return function(){t.execCommand("mceToggleFormat",!1,e)}},f$=function(t){QR.each([{name:"bold",text:"Bold",icon:"bold"},{name:"italic",text:"Italic",icon:"italic"},{name:"underline",text:"Underline",icon:"underline"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],(function(e,n){t.ui.registry.addToggleButton(e.name,{tooltip:e.text,icon:e.icon,onSetup:xj(t,e.name),onAction:l$(t,e.name)})}));for(var e=1;e<=6;e++){var n="h"+e;t.ui.registry.addToggleButton(n,{text:n.toUpperCase(),tooltip:"Heading "+e,onSetup:xj(t,n),onAction:l$(t,n)})}},d$=function(t){QR.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"help",text:"Help",action:"mceHelp",icon:"help"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"}],(function(e){t.ui.registry.addButton(e.name,{tooltip:e.text,icon:e.icon,onAction:kj(t,e.action)})}))},m$=function(t){QR.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],(function(e){t.ui.registry.addToggleButton(e.name,{tooltip:e.text,icon:e.icon,onAction:kj(t,e.action),onSetup:xj(t,e.name)})}))},g$=function(t){f$(t),d$(t),m$(t)},h$=function(t){QR.each([{name:"bold",text:"Bold",action:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",action:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",action:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",action:"Strikethrough",icon:"strike-through",shortcut:""},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript",shortcut:""},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript",shortcut:""},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting",shortcut:""},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document",shortcut:""},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"}],(function(e){t.ui.registry.addMenuItem(e.name,{text:e.text,icon:e.icon,shortcut:e.shortcut,onAction:kj(t,e.action)})})),t.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onAction:l$(t,"code")})},p$=function(t){g$(t),h$(t)},v$=function(t,e){return Cj(t,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",(function(n){n.setDisabled(t.mode.isReadOnly()||!t.undoManager[e]())}))},b$=function(t){t.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:v$(t,"hasUndo"),onAction:kj(t,"undo")}),t.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:v$(t,"hasRedo"),onAction:kj(t,"redo")})},y$=function(t){t.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",disabled:!0,onSetup:v$(t,"hasUndo"),onAction:kj(t,"undo")}),t.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",disabled:!0,onSetup:v$(t,"hasRedo"),onAction:kj(t,"redo")})},w$=function(t){b$(t),y$(t)},x$=function(t){return Cj(t,"VisualAid",(function(e){e.setActive(t.hasVisual)}))},C$=function(t){t.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:x$(t),onAction:kj(t,"mceToggleVisualAid")})},S$=function(t){t.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:kj(t,"mceToggleVisualAid")})},k$=function(t){S$(t),C$(t)},T$=function(t,e){Yq(t),p$(t),u$(t,e),w$(t),e_(t),k$(t),s$(t),i$(t)},O$=function(t,e){return{type:"makeshift",x:t,y:e}},E$=function(t,e,n){return O$(t.x+e,t.y+n)},_$=function(t){return"longpress"===t.type||0===t.type.indexOf("touch")},A$=function(t){if(_$(t)){var e=t.touches[0];return O$(e.pageX,e.pageY)}return O$(t.pageX,t.pageY)},D$=function(t){if(_$(t)){var e=t.touches[0];return O$(e.clientX,e.clientY)}return O$(t.clientX,t.clientY)},M$=function(t,e){var n=dT.DOM.getPos(t);return E$(e,n.x,n.y)},z$=function(t,e){return"contextmenu"===e.type||"longpress"===e.type?t.inline?A$(e):M$(t.getContentAreaContainer(),D$(e)):R$(t)},R$=function(t){return{type:"selection",root:ee.fromDom(t.selection.getNode())}},N$=function(t){return{type:"node",node:L.some(ee.fromDom(t.selection.getNode())),root:ee.fromDom(t.getBody())}},B$=function(t,e,n){switch(n){case"node":return N$(t);case"point":return z$(t,e);case"selection":return R$(t)}},L$=function(t,e,n,r,o,i){var u=n(),a=B$(t,e,i);qB(u,jS.CLOSE_ON_EXECUTE,r,!1).map((function(t){e.preventDefault(),eC.showMenuAt(o,{anchor:a},{menu:{markers:mk("normal")},data:t})}))},H$={onLtr:function(){return[$l,Fl,Ul,jl,Wl,ql,mC,gC,dC,lC,fC,sC]},onRtl:function(){return[$l,Ul,Fl,Wl,jl,ql,mC,gC,fC,sC,dC,lC]}},I$=12,P$={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},V$=function(t,e){var n=t.selection;if(n.isCollapsed()||e.touches.length<1)return!1;var r=e.touches[0],o=n.getRng(),i=ng(t.getWin(),km.domRange(o));return i.exists((function(t){return t.left<=r.clientX&&t.right>=r.clientX&&t.top<=r.clientY&&t.bottom>=r.clientY}))},F$=function(t){var e=t.selection.getRng(),n=function(){xC.setEditorTimeout(t,(function(){t.selection.setRng(e)}),10),i()};t.once("touchend",n);var r=function(t){t.preventDefault(),t.stopImmediatePropagation()};t.on("mousedown",r,!0);var o=function(){return i()};t.once("longpresscancel",o);var i=function(){t.off("touchend",n),t.off("longpresscancel",o),t.off("mousedown",r)}},U$=function(t,e,n){var r=B$(t,e,n),o="point"===n?I$:0;return A({bubble:zd(0,o,P$),layouts:H$,overrides:{maxWidthFunction:xU(),maxHeightFunction:Ed()}},r)},j$=function(t,e,n,r,o,i,u){var a=U$(t,e,i);qB(n,jS.CLOSE_ON_EXECUTE,r,!0).map((function(n){e.preventDefault(),eC.showMenuWithinBounds(o,{anchor:a},{menu:{markers:mk("normal"),highlightImmediately:u},data:n,type:"horizontal"},(function(){return L.some(Oq(t,r.shared,"node"===i?"node":"selection"))})),t.fire(lq)}))},W$=function(t,e,n,r,o,i){var u=en(),a=u.os.isiOS(),c=u.os.isOSX(),s=u.os.isAndroid(),l=u.deviceType.isTouch(),f=function(){return!(s||a||c&&l)},d=function(){var u=n();j$(t,e,u,r,o,i,f())};if((c||a)&&"node"!==i){var m=function(){F$(t),d()};V$(t,e)?m():(t.once("selectionchange",m),t.once("touchend",(function(){return t.off("selectionchange",m)})))}else d()},q$=function(t){return"string"===typeof t?t.split(/[ ,]/):t},$$=function(t){return t.getParam("contextmenu_never_use_native",!1,"boolean")},G$=function(t,e,n){var r=t.ui.registry.getAll().contextMenus;return L.from(t.getParam(e)).map(q$).getOrThunk((function(){return Y(q$(n),(function(t){return Et(r,t)}))}))},K$=function(t){return!1===t.getParam("contextmenu")},X$=function(t){return G$(t,"contextmenu","link linkchecker image imagetools table spellchecker configurepermanentpen")},Y$=function(t){return t.getParam("contextmenu_avoid_overlap","","string")},J$=function(t){return i(t)?"|"===t:"separator"===t.type},Q$={type:"separator"},Z$=function(t){var e=function(t){return{text:t.text,icon:t.icon,disabled:t.disabled,shortcut:t.shortcut}};if(i(t))return t;switch(t.type){case"separator":return Q$;case"submenu":return A(A({type:"nestedmenuitem"},e(t)),{getSubmenuItems:function(){var e=t.getSubmenuItems();return i(e)?e:$(e,Z$)}});default:return A(A({type:"menuitem"},e(t)),{onAction:v(t.onAction)})}},tG=function(t,e){if(0===e.length)return t;var n=dt(t).filter((function(t){return!J$(t)})),r=n.fold((function(){return[]}),(function(t){return[Q$]}));return t.concat(r).concat(e).concat([Q$])},eG=function(t,e,n){var r=Q(e,(function(e,r){return Ot(t,r.toLowerCase()).map((function(t){var r=t.update(n);if(i(r))return tG(e,r.split(" "));if(r.length>0){var o=$(r,Z$);return tG(e,o)}return e})).getOrThunk((function(){return e.concat([r])}))}),[]);return r.length>0&&J$(r[r.length-1])&&r.pop(),r},nG=function(t,e){return e.ctrlKey&&!$$(t)},rG=function(t,e){return"longpress"!==e.type&&(2!==e.button||e.target===t.getBody()&&""===e.pointerType)},oG=function(t,e){return rG(t,e)?t.selection.getStart(!0):e.target},iG=function(t,e){var n=Y$(t),r=rG(t,e)?"selection":"point";if(Gt(n)){var o=oG(t,e),i=L_(ee.fromDom(o),n);return i?"node":r}return r},uG=function(t,e,n){var r=en(),o=r.deviceType.isTouch,i=Es(eC.sketch({dom:{tag:"div"},lazySink:e,onEscape:function(){return t.focus()},onShow:function(){return n.setContextMenuState(!0)},onHide:function(){return n.setContextMenuState(!1)},fireDismissalEventInstead:{},inlineBehaviours:mf([Fw("dismissContextMenu",[za(ga(),(function(e,n){bh.close(e),t.focus()}))])])})),u=function(t){return eC.hide(i)},a=function(e){if($$(t)&&e.preventDefault(),!nG(t,e)&&!K$(t)){var r=iG(t,e),u=function(){var n=oG(t,e),r=t.ui.registry.getAll(),o=X$(t);return eG(r.contextMenus,o,n)},a=o()?W$:L$;a(t,e,u,n,i,r)}};t.on("init",(function(){var e="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(o()?"":" ResizeWindow");t.on(e,u),t.on("longpress contextmenu",a)}))},aG=uu.generate([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),cG=function(t){return function(e){return e.translate(-t.left,-t.top)}},sG=function(t){return function(e){return e.translate(t.left,t.top)}},lG=function(t){return function(e,n){return Q(t,(function(t,e){return e(t)}),lr(e,n))}},fG=function(t,e,n){return t.fold(lG([sG(n),cG(e)]),lG([cG(e)]),lG([]))},dG=function(t,e,n){return t.fold(lG([sG(n)]),lG([]),lG([sG(e)]))},mG=function(t,e,n){return t.fold(lG([]),lG([cG(n)]),lG([sG(e),cG(n)]))},gG=function(t,e,n,r,o,i){var u=dG(t,o,i),a=dG(e,o,i);return Math.abs(u.left-a.left)<=n&&Math.abs(u.top-a.top)<=r},hG=function(t,e,n,r,o,i){var u=dG(t,o,i),a=dG(e,o,i),c=Math.abs(u.left-a.left),s=Math.abs(u.top-a.top);return lr(c,s)},pG=function(t,e,n){var r=t.fold((function(t,e){return{position:L.some("absolute"),left:L.some(t+"px"),top:L.some(e+"px")}}),(function(t,e){return{position:L.some("absolute"),left:L.some(t-n.left+"px"),top:L.some(e-n.top+"px")}}),(function(t,e){return{position:L.some("fixed"),left:L.some(t+"px"),top:L.some(e+"px")}}));return A({right:L.none(),bottom:L.none()},r)},vG=function(t,e,n){return t.fold((function(t,r){return yG(t+e,r+n)}),(function(t,r){return wG(t+e,r+n)}),(function(t,r){return xG(t+e,r+n)}))},bG=function(t,e,n,r){var o=function(t,o){return function(i,u){var a=t(e,n,r);return o(i.getOr(a.left),u.getOr(a.top))}};return t.fold(o(mG,yG),o(dG,wG),o(fG,xG))},yG=aG.offset,wG=aG.absolute,xG=aG.fixed,CG=function(t,e){var n=Un(t,e);return l(n)?NaN:parseInt(n,10)},SG=function(t,e){var n=t.element,r=CG(n,e.leftAttr),o=CG(n,e.topAttr);return isNaN(r)||isNaN(o)?L.none():L.some(lr(r,o))},kG=function(t,e,n){var r=t.element;Vn(r,e.leftAttr,n.left+"px"),Vn(r,e.topAttr,n.top+"px")},TG=function(t,e){var n=t.element;qn(n,e.leftAttr),qn(n,e.topAttr)},OG=function(t,e,n,r){return SG(t,e).fold((function(){return n}),(function(t){return xG(t.left+r.left,t.top+r.top)}))},EG=function(t,e,n,r,o,i){var u=OG(t,e,n,r),a=e.mustSnap?DG(t,e,u,o,i):MG(t,e,u,o,i),c=fG(u,o,i);return kG(t,e,c),a.fold((function(){return{coord:xG(c.left,c.top),extra:L.none()}}),(function(t){return{coord:t.output,extra:t.extra}}))},_G=function(t,e){TG(t,e)},AG=function(t,e,n,r){return gt(t,(function(t){var o=t.sensor,i=gG(e,o,t.range.left,t.range.top,n,r);return i?L.some({output:bG(t.output,e,n,r),extra:t.extra}):L.none()}))},DG=function(t,e,n,r,o){var i=e.getSnapPoints(t),u=AG(i,n,r,o);return u.orThunk((function(){var t=Q(i,(function(t,e){var i=e.sensor,u=hG(n,i,e.range.left,e.range.top,r,o);return t.deltas.fold((function(){return{deltas:L.some(u),snap:L.some(e)}}),(function(n){var r=(u.left+u.top)/2,o=(n.left+n.top)/2;return r<=o?{deltas:L.some(u),snap:L.some(e)}:t}))}),{deltas:L.none(),snap:L.none()});return t.snap.map((function(t){return{output:bG(t.output,n,r,o),extra:t.extra}}))}))},MG=function(t,e,n,r,o){var i=e.getSnapPoints(t);return AG(i,n,r,o)},zG=function(t,e,n){return{coord:bG(t.output,t.output,e,n),extra:t.extra}},RG=function(t,e,n,r){var o=e.getTarget(t.element);if(e.repositionTarget){var i=mn(t.element),u=Hr(i),a=qP(o),c=zG(r,u,a),s=pG(c.coord,u,a);Yn(o,s)}},NG=Object.freeze({__proto__:null,snapTo:RG}),BG="data-initial-z-index",LG=function(t){vn(t.element).filter(le).each((function(t){jn(t,BG).fold((function(){return nr(t,"z-index")}),(function(e){return Kn(t,"z-index",e)})),qn(t,BG)}))},HG=function(t){vn(t.element).filter(le).each((function(e){Zn(e,"z-index").each((function(t){Vn(e,BG,t)})),Kn(e,"z-index",Jn(t.element,"z-index"))}))},IG=function(t,e){t.getSystem().addToGui(e),HG(e)},PG=function(t){LG(t),t.getSystem().removeFromGui(t)},VG=function(t,e,n){return t.getSystem().build(sA.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[e]},events:n}))},FG=$i("snaps",[Ai("getSnapPoints"),al("onSensor"),Ai("leftAttr"),Ai("topAttr"),Ki("lazyViewport",Zr),Ki("mustSnap",!1)]),UG=[Ki("useFixed",O),Ai("blockerClass"),Ki("getTarget",x),Ki("onDrag",p),Ki("repositionTarget",!0),Ki("onDrop",p),tu("getBounds",Zr),FG],jG=function(t){return Nt(Zn(t,"left"),Zn(t,"top"),Zn(t,"position"),(function(t,e,n){var r="fixed"===n?xG:yG;return r(parseInt(t,10),parseInt(e,10))})).getOrThunk((function(){var e=mr(t);return wG(e.left,e.top)}))},WG=function(t,e,n,r,o){var i=o.bounds,u=dG(e,n,r),a=_l(u.left,i.x,i.x+i.width-o.width),c=_l(u.top,i.y,i.y+i.height-o.height),s=wG(a,c);return e.fold((function(){var t=mG(s,n,r);return yG(t.left,t.top)}),w(s),(function(){var t=fG(s,n,r);return xG(t.left,t.top)}))},qG=function(t,e,n,r,o,i,u){var a=e.fold((function(){var t=vG(n,i.left,i.top),e=fG(t,r,o);return xG(e.left,e.top)}),(function(e){var u=EG(t,e,n,i,r,o);return u.extra.each((function(n){e.onSensor(t,n)})),u.coord}));return WG(t,a,r,o,u)},$G=function(t,e,n,r){var o=e.getTarget(t.element);if(e.repositionTarget){var i=mn(t.element),u=Hr(i),a=qP(o),c=jG(o),s=qG(t,e.snaps,c,u,a,r,n),l=pG(s,u,a);Yn(o,l)}e.onDrag(t,o,r)},GG=function(t,e){return{bounds:t.getBounds(),height:ar(e.element),width:br(e.element)}},KG=function(t,e,n,r,o){var i=n.update(r,o),u=n.getStartData().getOrThunk((function(){return GG(e,t)}));i.each((function(n){$G(t,e,u,n)}))},XG=function(t,e,n,r){e.each(PG),n.snaps.each((function(e){_G(t,e)}));var o=n.getTarget(t.element);r.reset(),n.onDrop(t,o)},YG=function(t){return function(e,n){var r=function(t){n.setStartData(GG(e,t))};return _a(M([za(la(),(function(t){n.getStartData().each((function(){return r(t)}))}))],t(e,n,r),!0))}},JG=function(t){return _a([za(Ru(),t.forceDrop),za(Lu(),t.drop),za(Nu(),(function(e,n){t.move(n.event)})),za(Bu(),t.delayDrop)])},QG=function(t){return L.from(lr(t.x,t.y))},ZG=function(t,e){return lr(e.left-t.left,e.top-t.top)},tK=Object.freeze({__proto__:null,getData:QG,getDelta:ZG}),eK=function(t,e,n){return[za(Ru(),(function(r,o){var i=o.event.raw;if(0===i.button){o.stop();var u=function(){return XG(r,L.some(s),t,e)},a=H_(u,200),c={drop:u,delayDrop:a.schedule,forceDrop:u,move:function(n){a.cancel(),KG(r,t,e,tK,n)}},s=VG(r,t.blockerClass,JG(c)),l=function(){n(r),IG(r,s)};l()}}))]},nK=M(M([],UG,!0),[fl("dragger",{handlers:YG(eK)})],!1),rK=function(t){return _a([za(Au(),t.forceDrop),za(Mu(),t.drop),za(zu(),t.drop),za(Du(),(function(e,n){t.move(n.event)}))])},oK=function(t){var e=t[0];return L.some(lr(e.clientX,e.clientY))},iK=function(t){var e=t.raw,n=e.touches;return 1===n.length?oK(n):L.none()},uK=function(t,e){return lr(e.left-t.left,e.top-t.top)},aK=Object.freeze({__proto__:null,getData:iK,getDelta:uK}),cK=function(t,e,n){var r=od(),o=function(n){XG(n,r.get(),t,e),r.clear()};return[za(Au(),(function(i,u){u.stop();var a=function(){return o(i)},c={drop:a,delayDrop:p,forceDrop:a,move:function(n){KG(i,t,e,aK,n)}},s=VG(i,t.blockerClass,rK(c));r.set(s);var l=function(){n(i),IG(i,s)};l()})),za(Du(),(function(n,r){r.stop(),KG(n,t,e,aK,r.event)})),za(Mu(),(function(t,e){e.stop(),o(t)})),za(zu(),o)]},sK=M(M([],UG,!0),[fl("dragger",{handlers:YG(cK)})],!1),lK=function(t,e,n){return M(M([],eK(t,e,n),!0),cK(t,e,n),!0)},fK=M(M([],UG,!0),[fl("dragger",{handlers:YG(lK)})],!1),dK=nK,mK=sK,gK=fK,hK=Object.freeze({__proto__:null,mouse:dK,touch:mK,mouseOrTouch:gK}),pK=function(){var t=L.none(),e=L.none(),n=function(){t=L.none(),e=L.none()},r=function(e,n){var r=t.map((function(t){return e.getDelta(t,n)}));return t=L.some(n),r},o=function(t,e){return t.getData(e).bind((function(e){return r(t,e)}))},i=function(t){e=L.some(t)},u=function(){return e},a=w({});return Tc({readState:a,reset:n,update:o,getStartData:u,setStartData:i})},vK=Object.freeze({__proto__:null,init:pK}),bK=vf({branchKey:"mode",branches:hK,name:"dragging",active:{events:function(t,e){var n=t.dragger;return n.handlers(t,e)}},extra:{snap:function(t){return{sensor:t.sensor,range:t.range,output:t.output,extra:L.from(t.extra)}}},state:vK,apis:NG}),yK=40,wK=yK/2,xK=function(t,e,n,r,o,i){return t.fold((function(){return bK.snap({sensor:wG(n-wK,r-wK),range:lr(o,i),output:wG(L.some(n),L.some(r)),extra:{td:e}})}),(function(t){var o=n-wK,i=r-wK,u=yK,a=yK,c=t.element.dom.getBoundingClientRect();return bK.snap({sensor:wG(o,i),range:lr(u,a),output:wG(L.some(n-c.width/2),L.some(r-c.height/2)),extra:{td:e}})}))},CK=function(t,e,n){var r=function(t,e){return t.exists((function(t){return sn(t,e)}))};return{getSnapPoints:t,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:function(t,o){var i=o.td;r(e.get(),i)||(e.set(i),n(i))},mustSnap:!0}},SK=function(t){return kC(SC.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:mf([bK.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:t}),FD.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}}))},kK=function(t,e){var n=ou([]),r=ou([]),o=ou(!1),i=od(),u=od(),a=function(t){var n=Qr(t);return xK(m.getOpt(e),t,n.x,n.y,n.width,n.height)},c=function(){return $(n.get(),(function(t){return a(t)}))},s=function(t){var n=Qr(t);return xK(g.getOpt(e),t,n.right,n.bottom,n.width,n.height)},l=function(){return $(r.get(),(function(t){return s(t)}))},f=CK(c,i,(function(e){u.get().each((function(n){t.fire("TableSelectorChange",{start:e,finish:n})}))})),d=CK(l,u,(function(e){i.get().each((function(n){t.fire("TableSelectorChange",{start:n,finish:e})}))})),m=SK(f),g=SK(d),h=Es(m.asSpec()),p=Es(g.asSpec()),v=function(e,n,r,o){var i=n.dom.getBoundingClientRect();nr(e.element,"display");var u=pn(ee.fromDom(t.getBody())).dom.innerHeight,a=r(i),c=o(i,u);(a||c)&&Kn(e.element,"display","none")},b=function(t,e,n,r){var o=n(e);bK.snapTo(t,o);var i=function(t){return t[r]<0},u=function(t,e){return t[r]>e};v(t,e,i,u)},y=function(t){return b(h,t,a,"top")},w=function(){return i.get().each(y)},x=function(t){return b(p,t,s,"bottom")},C=function(){return u.get().each(x)};en().deviceType.isTouch()&&(t.on("TableSelectionChange",(function(t){o.get()||(Wg(e,h),Wg(e,p),o.set(!0)),i.set(t.start),u.set(t.finish),t.otherCells.each((function(e){n.set(e.upOrLeftCells),r.set(e.downOrRightCells),y(t.start),x(t.finish)}))})),t.on("ResizeEditor ResizeWindow ScrollContent",(function(){w(),C()})),t.on("TableSelectionClear",(function(){o.get()&&(Gg(h),Gg(p),o.set(!1)),i.clear(),u.clear()})))},TK=function(t){if(1===t.nodeType){if("BR"===t.nodeName||t.getAttribute("data-mce-bogus"))return!0;if("bookmark"===t.getAttribute("data-mce-type"))return!0}return!1},OK=function(t,e,n){e.delimiter||(e.delimiter="»");var r=function(r){var o=r||[],i=$(o,(function(e,r){return SC.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{role:"button","data-index":r,"tab-index":-1,"aria-level":r+1},innerHtml:e.name},action:function(n){t.focus(),t.selection.select(e.element),t.nodeChanged()},buttonBehaviours:mf([mO.button(n.isDisabled),cO()])})})),u={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+e.delimiter+" "}};return Q(i.slice(1),(function(t,e){var n=t;return n.push(u),n.push(e),n}),[i[0]])},o=function(e){var n=[],r=e.length;while(r-- >0){var o=e[r];if(1===o.nodeType&&!TK(o)){var i=t.fire("ResolveName",{name:o.nodeName.toLowerCase(),target:o});if(i.isDefaultPrevented()||n.push({name:i.name,element:o}),i.isPropagationStopped())break}}return n};return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:mf([Aw.config({mode:"flow",selector:"div[role=button]"}),Hv.config({disabled:n.isDisabled}),cO(),yA.config({}),Pw.config({}),Fw("elementPathEvents",[Ua((function(e,n){t.shortcuts.add("alt+F11","focus statusbar elementpath",(function(){return Aw.focusIn(e)})),t.on("NodeChange",(function(t){var n=o(t.parents);n.length>0?Pw.set(e,r(n)):Pw.set(e,[])}))}))])]),components:[]}};(function(t){t[t["None"]=0]="None",t[t["Both"]=1]="Both",t[t["Vertical"]=2]="Vertical"})(Dj||(Dj={}));var EK=function(t,e,n,r,o){var i={};return i.height=ZW(r+e.top,wT(t),CT(t)),n===Dj.Both&&(i.width=ZW(o+e.left,yT(t),xT(t))),i},_K=function(t,e,n){var r=ee.fromDom(t.getContainer()),o=EK(t,e,n,ur(r),vr(r));vt(o,(function(t,e){return Kn(r,e,QW(t))})),vE(t)},AK=function(t){var e=!t.hasPlugin("autoresize"),n=t.getParam("resize",e);return!1===n?Dj.None:"both"===n?Dj.Both:Dj.Vertical},DK=function(t,e,n,r){var o=20,i=lr(n*o,r*o);return _K(t,i,e),L.some(!0)},MK=function(t,e){var n=AK(t);return n===Dj.None?L.none():L.some(LC("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:e.translate("Resize")},behaviours:[bK.config({mode:"mouse",repositionTarget:!1,onDrag:function(e,r,o){return _K(t,o,n)},blockerClass:"tox-blocker"}),Aw.config({mode:"special",onLeft:function(){return DK(t,n,-1,0)},onRight:function(){return DK(t,n,1,0)},onUp:function(){return DK(t,n,0,-1)},onDown:function(){return DK(t,n,0,1)}}),yA.config({}),Yw.config({})]},e.icons))},zK=function(t,e){var n,r=function(t,n,r){return Pw.set(t,[Ss(e.translate(["{0} "+r,n[r]]))])};return SC.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:mf([mO.button(e.isDisabled),cO(),yA.config({}),Pw.config({}),tp.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Fw("wordcount-events",[qa((function(t){var e=tp.getValue(t),n="words"===e.mode?"characters":"words";tp.setValue(t,{mode:n,count:e.count}),r(t,e.count,n)})),Ua((function(e){t.on("wordCountUpdate",(function(t){var n=tp.getValue(e).mode;tp.setValue(e,{mode:n,count:t.wordCount}),r(e,t.wordCount,n)}))}))])]),eventOrder:(n={},n[ea()]=["disabling","alloy.base.behaviour","wordcount-events"],n)})},RK=function(t,e){var n=function(){var t=TC.translate(["Powered by {0}","Tiny"]),e=''+t+"";return{dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:e}}},r=function(){var r=[];return t.getParam("elementpath",!0,"boolean")&&r.push(OK(t,{},e)),t.hasPlugin("wordcount")&&r.push(zK(t,e)),t.getParam("branding",!0,"boolean")&&r.push(n()),r.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:r}]:[]},o=function(){var n=r(),o=MK(t,e);return n.concat(o.toArray())};return{dom:{tag:"div",classes:["tox-statusbar"]},components:o()}},NK=function(t){var e,n=t.inline,r=n?cq:YW,o=qT(t)?IV:jP,i=L.none(),u=en(),a=u.browser.isIE(),c=a?["tox-platform-ie"]:[],s=u.deviceType.isTouch(),l="tox-platform-touch",f=s?[l]:[],d=HT(t),m=jT(t),g=TC.isRtl()?{attributes:{dir:"rtl"}}:{},h={attributes:(e={},e[Hd]=d?Pf.BottomToTop:Pf.TopToBottom,e)},v=function(){return i.bind(aj.getHeader)},b=function(){return o.isDocked(v)},y=function(){Kn(Q.element,"width",document.body.clientWidth+"px")},w=function(){var t=sn(Hn(),m)&&"grid"===Jn(m,"display"),e={dom:A({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c).concat(f)},g),behaviours:mf([Ig.config({useFixed:function(){return b()}})])},n={dom:{styles:{width:document.body.clientWidth+"px"}},events:_a([za(fa(),y)])};return Co(e,t?n:{})},x=Es(w()),C=function(){return ro.value(x)},S=kC({dom:{tag:"div",classes:["tox-anchorbar"]}}),k=function(){return i.bind((function(t){return S.getOpt(t)})).getOrDie("Could not find a anchor bar element")},T=function(){return i.bind((function(t){return aj.getToolbar(t)})).getOrDie("Could not find more toolbar element")},O=function(){return i.bind((function(t){return aj.getThrobber(t)})).getOrDie("Could not find throbber element")},E=kP(x,t,k),_=aj.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:E,onEscape:function(){t.focus()}}),D=RT(t),M=aj.parts.toolbar(A({dom:{tag:"div",classes:["tox-toolbar"]},getSink:C,providers:E.shared.providers,onEscape:function(){t.focus()},type:D,lazyToolbar:T,lazyHeader:function(){return v().getOrDie("Could not find header element")}},h)),z=aj.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:E.shared.providers,onEscape:function(){t.focus()},type:D}),R=aj.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),N=aj.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),B=aj.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:E}),H=t.getParam("statusbar",!0,"boolean"),I=H&&!n?L.some(RK(t,E.shared.providers)):L.none(),P={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[R,N]},V=MT(t),F=AT(t),U=_T(t),j=function(){return V?[z]:F?[M]:[]},W=aj.parts.header({dom:A({tag:"div",classes:["tox-editor-header"]},h),components:nt([U?[_]:[],j(),UT(t)?[]:[S.asSpec()]]),sticky:qT(t),editor:t,sharedBackstage:E.shared}),q=nt([d?[]:[W],n?[]:[P],d?[W]:[]]),$={dom:{tag:"div",classes:["tox-editor-container"]},components:q},G=nt([[$],n?[]:I.toArray(),[B]]),K=WT(t),X=A(A({role:"application"},TC.isRtl()?{dir:"rtl"}:{}),K?{"aria-hidden":"true"}:{}),Y=Es(aj.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(n?["tox-tinymce-inline"]:[]).concat(d?["tox-tinymce--toolbar-bottom"]:[]).concat(f).concat(c),styles:A({visibility:"hidden"},K?{opacity:"0",border:"0"}:{}),attributes:X},components:G,behaviours:mf([cO(),Hv.config({disableClass:"tox-tinymce--disabled"}),Aw.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle"})])}));i=L.some(Y),t.shortcuts.add("alt+F9","focus menubar",(function(){aj.focusMenubar(Y)})),t.shortcuts.add("alt+F10","focus toolbar",(function(){aj.focusToolbar(Y)})),t.addCommand("ToggleToolbarDrawer",(function(){aj.toggleToolbarDrawer(Y)})),t.addQueryStateHandler("ToggleToolbarDrawer",(function(){return aj.isToolbarDrawerToggled(Y)}));var J=lA(Y),Q=lA(x);TP(t,J,Q);var Z=function(){var t={broadcastAll:Q.broadcast,broadcastOn:Q.broadcastOn,register:p};return{channels:t}},tt=function(){var e=QW(eq(t)),n=QW(rq(t));return t.inline||(er("div","width",n)&&Kn(Y.element,"width",n),er("div","height",e)?Kn(Y.element,"height",e):Kn(Y.element,"height","200px")),e},et=function(){o.setup(t,E.shared,v),T$(t,E),uG(t,C,E),zF(t),iU(t,O,E.shared),bt(BT(t),(function(e,n){t.ui.registry.addGroupToolbarButton(n,e)}));var e=t.ui.registry.getAll(),n=e.buttons,i=e.menuItems,u=e.contextToolbars,a=e.sidebars,c=DT(t),s={menuItems:i,menus:KT(t),menubar:XT(t),toolbar:c.getOrThunk((function(){return YT(t)})),allowToolbarGroups:D===US.floating,buttons:n,sidebar:a};Xq(t,u,x,{backstage:E}),kK(t,x);var l=t.getElement(),f=tt(),d={mothership:J,uiMothership:Q,outerContainer:Y},m={targetNode:l,height:f};return r.render(t,d,s,E,m)};return{mothership:J,uiMothership:Q,backstage:E,renderUI:et,getUi:Z}},BK=function(t,e){var n=L.from(Un(t,"id")).fold((function(){var t=oc("dialog-describe");return Vn(e,"id",t),t}),x);Vn(t,"aria-describedby",n)},LK=function(t,e){var n=jn(t,"id").fold((function(){var t=oc("dialog-label");return Vn(e,"id",t),t}),x);Vn(t,"aria-labelledby",n)},HK=w([Ai("lazySink"),Vi("dragBlockClass"),tu("getBounds",Zr),Ki("useTabstopAt",E),Ki("eventOrder",{}),ep("modalBehaviours",[Aw]),cl("onExecute"),ll("onEscape")]),IK={sketch:x},PK=w([Bp({name:"draghandle",overrides:function(t,e){return{behaviours:mf([bK.config({mode:"mouse",getTarget:function(t){return Ls(t,'[role="dialog"]').getOr(t)},blockerClass:t.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+JSON.stringify(e,null,2)).message),getBounds:t.getDragBounds})])}}}),Rp({schema:[Ai("dom")],name:"title"}),Rp({factory:IK,schema:[Ai("dom")],name:"close"}),Rp({factory:IK,schema:[Ai("dom")],name:"body"}),Bp({factory:IK,schema:[Ai("dom")],name:"footer"}),Np({factory:{sketch:function(t,e){return A(A({},t),{dom:e.dom,components:e.components})}},schema:[Ki("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Ki("components",[])],name:"blocker"})]),VK=function(t,e,n,r){var o,i=od(),u=function(e){i.set(e);var n=t.lazySink(e).getOrDie(),o=r.blocker(),u=n.getSystem().build(A(A({},o),{components:o.components.concat([_s(e)]),behaviours:mf([Yw.config({}),Fw("dialog-blocker-events",[Fa(Iu(),(function(){Aw.focusIn(e)}))])])}));Wg(n,u),Aw.focusIn(e)},a=function(t){i.clear(),vn(t.element).each((function(e){t.getSystem().getByDom(e).each((function(t){Gg(t)}))}))},c=function(e){return Xp(e,t,"body")},s=function(e){return Xp(e,t,"footer")},l=function(t,e){KF.block(t,e)},f=function(t){KF.unblock(t)},d=oc("modal-events"),m=A(A({},t.eventOrder),(o={},o[da()]=[d].concat(t.eventOrder["alloy.system.attached"]||[]),o));return{uid:t.uid,dom:t.dom,components:e,apis:{show:u,hide:a,getBody:c,getFooter:s,setIdle:f,setBusy:l},eventOrder:m,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:rp(t.modalBehaviours,[Pw.config({}),Aw.config({mode:"cyclic",onEnter:t.onExecute,onEscape:t.onEscape,useTabstopAt:t.useTabstopAt}),KF.config({getRoot:i.get}),Fw(d,[Ua((function(e){LK(e.element,Xp(e,t,"title").element),BK(e.element,Xp(e,t,"body").element)}))])])}},FK=mv({name:"ModalDialog",configFields:HK(),partFields:PK(),factory:VK,apis:{show:function(t,e){t.show(e)},hide:function(t,e){t.hide(e)},getBody:function(t,e){return t.getBody(e)},getFooter:function(t,e){return t.getFooter(e)},setBusy:function(t,e,n){t.setBusy(e,n)},setIdle:function(t,e){t.setIdle(e)}}}),UK=ti([zi("type"),zi("name")].concat(Rk)),jK=li,WK=[Oi("name","name",To((function(){return oc("button-name")})),si),ji("icon"),Qi("align","end",["start","end"]),Zi("primary",!1),Zi("disabled",!1)],qK=M(M([],WK,!0),[zi("text")],!1),$K=M([Ri("type",["submit","cancel","custom"])],qK,!0),GK=M([Ri("type",["menu"]),ji("text"),ji("tooltip"),ji("icon"),Pi("items",UK)],WK,!0),KK=ki("type",{submit:$K,cancel:$K,custom:$K,menu:GK}),XK=[zi("type"),zi("text"),Ri("level",["info","warn","error","success"]),zi("icon"),Ki("url","")],YK=ti(XK),JK=function(t){return[zi("type"),t]},QK=[zi("type"),zi("text"),Zi("disabled",!1),Zi("primary",!1),Oi("name","name",To((function(){return oc("button-name")})),si),ji("icon"),Zi("borderless",!1)],ZK=ti(QK),tX=[zi("type"),zi("name"),zi("label"),Zi("disabled",!1)],eX=ti(tX),nX=li,rX=[zi("type"),zi("name")],oX=rX.concat([ji("label")]),iX=oX.concat([Ki("columns","auto")]),uX=ti(iX),aX=ii([zi("value"),zi("text"),zi("icon")]),cX=oX,sX=ti(cX),lX=si,fX=oX,dX=ti(fX),mX=si,gX=rX.concat([Ji("tag","textarea"),zi("scriptId"),zi("scriptUrl"),eu("settings",void 0)]),hX=rX.concat([Ji("tag","textarea"),Bi("init")]),pX=vi((function(t){return wi("customeditor.old",Zo(hX),t).orThunk((function(){return wi("customeditor.new",Zo(gX),t)}))})),vX=si,bX=oX,yX=ti(bX),wX=pi(),xX=function(t){return[zi("type"),Mi("columns"),t]},CX=[zi("type"),zi("html"),Qi("presets","presentation",["presentation","document"])],SX=ti(CX),kX=oX.concat([Zi("sandboxed",!0)]),TX=ti(kX),OX=si,EX=oX.concat([Di("currentState",ti([Ai("blob"),zi("url")]))]),_X=ti(EX),AX=oX.concat([ji("inputMode"),ji("placeholder"),Zi("maximized",!1),Zi("disabled",!1)]),DX=ti(AX),MX=si,zX=function(t){return[zi("type"),zi("label"),t]},RX=[zi("text"),zi("value")],NX=[zi("text"),Pi("items",Ti("items",(function(){return BX})))],BX=ni([ti(RX),ti(NX)]),LX=oX.concat([Pi("items",BX),Zi("disabled",!1)]),HX=ti(LX),IX=si,PX=oX.concat([Ii("items",[zi("text"),zi("value")]),Yi("size",1),Zi("disabled",!1)]),VX=ti(PX),FX=si,UX=oX.concat([Zi("constrain",!0),Zi("disabled",!1)]),jX=ti(UX),WX=ti([zi("width"),zi("height")]),qX=[zi("type"),Pi("header",si),Pi("cells",ei(si))],$X=ti(qX),GX=oX.concat([ji("placeholder"),Zi("maximized",!1),Zi("disabled",!1)]),KX=ti(GX),XX=si,YX=oX.concat([Qi("filetype","file",["image","media","file"]),Ki("disabled",!1)]),JX=ti(YX),QX=ti([zi("value"),Ki("meta",{})]),ZX=function(t){return Oi("items","items",ko(),ei(vi((function(e){return wi("Checking item of "+t,tY,e).fold((function(t){return ro.error(Si(t))}),(function(t){return ro.value(t)}))}))))},tY=Jo((function(){return hi("type",{alertbanner:YK,bar:ti(JK(ZX("bar"))),button:ZK,checkbox:eX,colorinput:sX,colorpicker:dX,dropzone:yX,grid:ti(xX(ZX("grid"))),iframe:TX,input:DX,listbox:HX,selectbox:VX,sizeinput:jX,textarea:KX,urlinput:JX,customeditor:pX,htmlpanel:SX,imagetools:_X,collection:uX,label:ti(zX(ZX("label"))),table:$X,panel:nY})})),eY=[zi("type"),Ki("classes",[]),Pi("items",tY)],nY=ti(eY),rY=[Oi("name","name",To((function(){return oc("tab-name")})),si),zi("title"),Pi("items",tY)],oY=[zi("type"),Ii("tabs",rY)],iY=ti(oY),uY=qK,aY=KK,cY=ti([zi("title"),Di("body",hi("type",{panel:nY,tabpanel:iY})),Ji("size","normal"),Pi("buttons",aY),Ki("initialData",{}),tu("onAction",p),tu("onChange",p),tu("onSubmit",p),tu("onClose",p),tu("onCancel",p),Ki("onTabChange",p)]),sY=function(t){return wi("dialog",cY,t)},lY=ti(M([Ri("type",["cancel","custom"])],uY,!0)),fY=ti([zi("title"),zi("url"),Ui("height"),Ui("width"),qi("buttons",lY),tu("onAction",p),tu("onCancel",p),tu("onClose",p),tu("onMessage",p)]),dY=function(t){return wi("dialog",fY,t)},mY=function(t){return u(t)?[t].concat(rt(Tt(t),mY)):a(t)?rt(t,mY):[]},gY=function(t){return i(t.type)&&i(t.name)},hY={checkbox:nX,colorinput:lX,colorpicker:mX,dropzone:wX,input:MX,iframe:OX,sizeinput:WX,selectbox:FX,listbox:IX,size:WX,textarea:XX,urlinput:QX,customeditor:vX,collection:aX,togglemenuitem:jK},pY=function(t){return L.from(hY[t.type])},vY=function(t){return Y(mY(t),gY)},bY=function(t){var e=vY(t),n=rt(e,(function(t){return pY(t).fold((function(){return[]}),(function(e){return[Di(t.name,e)]}))}));return ti(n)},yY=function(t){var e=xi(sY(t)),n=bY(t),r=t.initialData;return{internalDialog:e,dataValidator:n,initialData:r}},wY={open:function(t,e){var n=yY(e);return t(n.internalDialog,n.initialData,n.dataValidator)},openUrl:function(t,e){var n=xi(dY(e));return t(n)},redial:function(t){return yY(t)}},xY=function(t){var e=[],n={};return vt(t,(function(t,r){t.fold((function(){e.push(r)}),(function(t){n[r]=t}))})),e.length>0?ro.error(e):ro.value(n)},CY=function(t,e){var n=kC(RR.sketch((function(n){return{dom:{tag:"div",classes:["tox-form"].concat(t.classes)},components:$(t.items,(function(t){return aI(n,t,e)}))}})));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:mf([Aw.config({mode:"acyclic",useTabstopAt:k(vN)}),WR.memento(n),uN.memento(n,{postprocess:function(t){return xY(t).fold((function(t){return console.error(t),{}}),x)}})])}},SY=function(t,e){return{uid:t.uid,dom:t.dom,components:t.components,events:vx(t.action),behaviours:rp(t.tabButtonBehaviours,[Yw.config({}),Aw.config({mode:"execution",useSpace:!0,useEnter:!0}),tp.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}},kY=dv({name:"TabButton",configFields:[Ki("uid",void 0),Ai("value"),Oi("dom","dom",_o((function(){return{attributes:{role:"tab",id:oc("aria"),"aria-selected":"false"}}})),ui()),Vi("action"),Ki("domModification",{}),ep("tabButtonBehaviours",[Yw,Aw,tp]),Ai("view")],factory:SY}),TY=w([Ai("tabs"),Ai("dom"),Ki("clickToDismiss",!1),ep("tabbarBehaviours",[rb,Aw]),il(["tabClass","selectedClass"])]),OY=Lp({factory:kY,name:"tabs",unit:"tab",overrides:function(t){var e=function(t,e){rb.dehighlight(t,e),Sa(t,ya(),{tabbar:t,button:e})},n=function(t,e){rb.highlight(t,e),Sa(t,ba(),{tabbar:t,button:e})};return{action:function(r){var o=r.getSystem().getByUid(t.uid).getOrDie(),i=rb.isHighlighted(o,r),u=function(){return i&&t.clickToDismiss?e:i?p:n}();u(o,r)},domModification:{classes:[t.markers.tabClass]}}}}),EY=w([OY]),_Y=function(t,e,n,r){return{uid:t.uid,dom:t.dom,components:e,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:rp(t.tabbarBehaviours,[rb.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,e){Vn(e.element,"aria-selected","true")},onDehighlight:function(t,e){Vn(e.element,"aria-selected","false")}}),Aw.config({mode:"flow",getInitial:function(t){return rb.getHighlighted(t).map((function(t){return t.element}))},selector:"."+t.markers.tabClass,executeOnMove:!0})])}},AY=mv({name:"Tabbar",configFields:TY(),partFields:EY(),factory:_Y}),DY=function(t,e){return{uid:t.uid,dom:t.dom,behaviours:rp(t.tabviewBehaviours,[Pw.config({})]),domModification:{attributes:{role:"tabpanel"}}}},MY=dv({name:"Tabview",configFields:[ep("tabviewBehaviours",[Pw])],factory:DY}),zY=w([Ki("selectFirst",!0),al("onChangeTab"),al("onDismissTab"),Ki("tabs",[]),ep("tabSectionBehaviours",[])]),RY=Rp({factory:AY,schema:[Ai("dom"),Hi("markers",[Ai("tabClass"),Ai("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),NY=Rp({factory:MY,name:"tabview"}),BY=w([RY,NY]),LY=function(t,e,n,r){var o=function(e){var n=tp.getValue(e);Kp(e,t,"tabview").each((function(r){var o=tt(t.tabs,(function(t){return t.value===n}));o.each((function(n){var o=n.view();jn(e.element,"id").each((function(t){Vn(r.element,"aria-labelledby",t)})),Pw.set(r,o),t.onChangeTab(r,e,o)}))}))},i=function(e,n){Kp(e,t,"tabbar").each((function(t){n(t).each(ka)}))};return{uid:t.uid,dom:t.dom,components:e,behaviours:np(t.tabSectionBehaviours),events:_a(nt([t.selectFirst?[Ua((function(t,e){i(t,rb.getFirst)}))]:[],[za(ba(),(function(t,e){var n=e.event.button;o(n)})),za(ya(),(function(e,n){var r=n.event.button;t.onDismissTab(e,r)}))]])),apis:{getViewItems:function(e){return Kp(e,t,"tabview").map((function(t){return Pw.contents(t)})).getOr([])},showTab:function(t,e){var n=function(t){var n=rb.getCandidates(t),r=tt(n,(function(t){return tp.getValue(t)===e}));return r.filter((function(e){return!rb.isHighlighted(t,e)}))};i(t,n)}}}},HY=mv({name:"TabSection",configFields:zY(),partFields:BY(),factory:LY,apis:{getViewItems:function(t,e){return t.getViewItems(e)},showTab:function(t,e,n){t.showTab(e,n)}}}),IY=function(t,e,n){return $(t,(function(r,o){Pw.set(n,t[o].view());var i=e.dom.getBoundingClientRect();return Pw.set(n,[]),i.height}))},PY=function(t){return ft(st(t,(function(t,e){return t>e?-1:t=n.dom.offsetLeft+vr(n),s=c?Math.max(ur(n),a):a,l=parseInt(Jn(t,"margin-top"),10)||0,f=parseInt(Jn(t,"margin-bottom"),10)||0,d=ur(t)+l+f,m=d-s;return r-m},FY=function(t,e){ft(t).each((function(t){return HY.showTab(e,t.value)}))},UY=function(t,e){Kn(t,"height",e+"px"),en().browser.isIE()?nr(t,"flex-basis"):Kn(t,"flex-basis",e+"px")},jY=function(t,e,n){Ls(t,'[role="dialog"]').each((function(t){Is(t,'[role="tablist"]').each((function(r){n.get().map((function(n){return Kn(e,"height","0"),Kn(e,"flex-basis","0"),Math.min(n,VY(t,e,r))})).each((function(t){UY(e,t)}))}))}))},WY=function(t){return Is(t,'[role="tabpanel"]')},qY=function(t){var e=function(){var e=od(),n=[Ua((function(n){var r=n.element;WY(r).each((function(o){Kn(o,"visibility","hidden"),n.getSystem().getByDom(o).toOptional().each((function(n){var r=IY(t,o,n),i=PY(r);i.fold(e.clear,e.set)})),jY(r,o,e),nr(o,"visibility"),FY(t,n),xC.requestAnimationFrame((function(){jY(r,o,e)}))}))})),za(fa(),(function(t){var n=t.element;WY(n).each((function(t){jY(n,t,e)}))})),za(BA,(function(t,n){var r=t.element;WY(r).each((function(t){var n=Of(An(t));Kn(t,"visibility","hidden");var o=Zn(t,"height").map((function(t){return parseInt(t,10)}));nr(t,"height"),nr(t,"flex-basis");var i=t.dom.getBoundingClientRect().height,u=o.forall((function(t){return i>t}));u?(e.set(i),jY(r,t,e)):o.each((function(e){UY(t,e)})),nr(t,"visibility"),n.each(Sf)}))}))],r=!1;return{extraEvents:n,selectFirst:r}}(),n=function(){var t=[],e=!0;return{extraEvents:t,selectFirst:e}}();return{smartTabHeight:e,naiveTabHeight:n}},$Y="send-data-to-section",GY="send-data-to-view",KY=function(t,e){var n=ou({}),r=function(t){var e=tp.getValue(t),r=xY(e).getOr({}),o=n.get(),i=Co(o,r);n.set(i)},o=function(t){var e=n.get();tp.setValue(t,e)},i=ou(null),u=$(t.tabs,(function(t){return{value:t.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:e.shared.providers.translate(t.title)},view:function(){return[RR.sketch((function(n){return{dom:{tag:"div",classes:["tox-form"]},components:$(t.items,(function(t){return aI(n,t,e)})),formBehaviours:mf([Aw.config({mode:"acyclic",useTabstopAt:k(vN)}),Fw("TabView.form.events",[Ua(o),ja(r)]),yf.config({channels:gu([{key:$Y,value:{onReceive:r}},{key:GY,value:{onReceive:o}}])})])}}))]}}})),a=qY(u).smartTabHeight;return HY.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,e,n){var r=tp.getValue(e);Sa(t,NA,{name:r,oldName:i.get()}),i.set(r)},tabs:u,components:[HY.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[AY.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:mf([yA.config({})])}),HY.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:a.selectFirst,tabSectionBehaviours:mf([Fw("tabpanel",a.extraEvents),Aw.config({mode:"acyclic"}),bv.config({find:function(t){return ft(HY.getViewItems(t))}}),tp.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([$Y],{}),n.get()},setValue:function(t,e){n.set(e),t.getSystem().broadcastOn([GY],{})}}})])})},XY=oc("update-dialog"),YY=oc("update-title"),JY=oc("update-body"),QY=oc("update-footer"),ZY=oc("body-send-message"),tJ=function(t,e,n,r){var o=function(t){switch(t.body.type){case"tabpanel":return[KY(t.body,n)];default:return[CY(t.body,n)]}},i=function(t,e){return L.some({isTabPanel:function(){return"tabpanel"===e.body.type}})},u={"aria-live":"polite"};return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:A(A({},e.map((function(t){return{id:t}})).getOr({})),r?u:{})},components:[],behaviours:mf([WR.childAt(0),gW.config({channel:JY,updateState:i,renderComponents:o,initialData:t})])}},eJ=function(t,e,n,r){return tJ(t,L.some(e),n,r)},nJ=function(t,e){var n=tJ(t,L.none(),e,!1);return FK.parts.body(n)},rJ=function(t){var e={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[gN({dom:{tag:"iframe",attributes:{src:t.url}},behaviours:mf([yA.config({}),Yw.config({})])})]}],behaviours:mf([Aw.config({mode:"acyclic",useTabstopAt:k(vN)})])};return FK.parts.body(e)},oJ=CO.deviceType.isTouch(),iJ=function(t,e){return{dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[t,e]}},uJ=function(t,e){return FK.parts.close(SC.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close")}},action:t,buttonBehaviours:mf([yA.config({})])}))},aJ=function(){return FK.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},cJ=function(t,e){return FK.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:JF("

"+e.translate(t)+"

")}]}]})},sJ=function(t){return FK.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},lJ=function(t,e){return[sA.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),sA.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:e})]},fJ=function(t){var e,n="tox-dialog",r=n+"-wrap",o=r+"__backdrop",i=n+"__disable-scroll";return FK.sketch({lazySink:t.lazySink,onEscape:function(e){return t.onEscape(e),L.some(!0)},useTabstopAt:function(t){return!vN(t)},dom:{tag:"div",classes:[n].concat(t.extraClasses),styles:A({position:"relative"},t.extraStyles)},components:M([t.header,t.body],t.footer.toArray(),!0),parts:{blocker:{dom:JF('
'),components:[{dom:{tag:"div",classes:oJ?[o,o+"--opaque"]:[o]}}]}},dragBlockClass:r,modalBehaviours:mf(M([Yw.config({}),Fw("dialog-events",t.dialogEvents.concat([Fa(Iu(),(function(t,e){Aw.focusIn(t)}))])),Fw("scroll-lock",[Ua((function(){is(Hn(),i)})),ja((function(){as(Hn(),i)}))])],t.extraBehaviours,!0)),eventOrder:A((e={},e[ea()]=["dialog-events"],e[da()]=["scroll-lock","dialog-events","alloy.base.behaviour"],e[ma()]=["alloy.base.behaviour","dialog-events","scroll-lock"],e),t.eventOrder)})},dJ=function(t){return SC.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:[LC("close",{tag:"div",classes:["tox-icon"]},t.icons)],action:function(t){Ca(t,AA)}})},mJ=function(t,e,n){var r=function(t){return[Ss(n.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:A({},e.map((function(t){return{id:t}})).getOr({}))},components:r(t),behaviours:mf([gW.config({channel:YY,renderComponents:r})])}},gJ=function(){return{dom:JF('
')}},hJ=function(t,e,n){return sA.sketch({dom:JF('
'),components:[mJ(t,L.some(e),n),gJ(),dJ(n)],containerBehaviours:mf([bK.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return Ps(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])})},pJ=function(t,e){var n=FK.parts.title(mJ(t,L.none(),e)),r=FK.parts.draghandle(gJ()),o=FK.parts.close(dJ(e)),i=[n].concat(t.draggable?[r]:[]).concat([o]);return sA.sketch({dom:JF('
'),components:i})},vJ=function(t,e){return pJ({title:e.shared.providers.translate(t),draggable:e.dialog.isDraggableModal()},e.shared.providers)},bJ=function(t,e,n){return{dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":n.translate(t)},styles:{left:"0px",right:"0px",bottom:"0px",top:"0px",position:"absolute"}},behaviours:e,components:[{dom:JF('
')}]}},yJ=function(t,e,n){return{onClose:function(){return n.closeWindow()},onBlock:function(n){FK.setBusy(t(),(function(t,r){return bJ(n.message,r,e)}))},onUnblock:function(){FK.setIdle(t())}}},wJ=function(t,e,n,r){var o,i=function(t,e){return L.some(e)};return Es(fJ(A(A({},t),{lazySink:r.shared.getSink,extraBehaviours:M([gW.config({channel:XY,updateState:i,initialData:e}),uN.memory({})],t.extraBehaviours,!0),onEscape:function(t){Ca(t,AA)},dialogEvents:n,eventOrder:(o={},o[ta()]=[gW.name(),yf.name()],o[da()]=["scroll-lock",gW.name(),"messages","dialog-events","alloy.base.behaviour"],o[ma()]=["alloy.base.behaviour","dialog-events","messages",gW.name(),"scroll-lock"],o)})))},xJ=function(t){var e=function(t){var e=$(t.items,(function(t){var e=ou(!1);return A(A({},t),{storage:e})}));return A(A({},t),{items:e})};return $(t,(function(t){return"menu"===t.type?e(t):t}))},CJ=function(t){return Q(t,(function(t,e){if("menu"===e.type){var n=e;return Q(n.items,(function(t,e){return t[e.name]=e.storage,t}),t)}return t}),{})},SJ=function(t,e){return[Ia(Iu(),pN),t(_A,(function(t,n){e.onClose(),n.onClose()})),t(AA,(function(t,e,n,r){e.onCancel(t),Ca(r,_A)})),za(RA,(function(t,n){return e.onUnblock()})),za(zA,(function(t,n){return e.onBlock(n.event)}))]},kJ=function(t,e){var n=function(e,n){return za(e,(function(e,o){r(e,(function(r,i){n(t(),r,o.event,e)}))}))},r=function(t,e){gW.getState(t).get().each((function(n){e(n,t)}))};return M(M([],SJ(n,e),!0),[n(DA,(function(t,e,n){e.onAction(t,{name:n.name})}))],!1)},TJ=function(t,e,n){var r=function(e,n){return za(e,(function(e,r){o(e,(function(o,i){n(t(),o,r.event,e)}))}))},o=function(t,e){gW.getState(t).get().each((function(n){e(n.internalDialog,t)}))};return M(M([],SJ(r,e),!0),[r(MA,(function(t,e){return e.onSubmit(t)})),r(EA,(function(t,e,n){e.onChange(t,{name:n.name})})),r(DA,(function(t,e,r,o){var i=function(){return Aw.focusIn(o)},u=function(t){return Wn(t,"disabled")||jn(t,"aria-disabled").exists((function(t){return"true"===t}))},a=An(o.element),c=Of(a);e.onAction(t,{name:r.name,value:r.value}),Of(a).fold(i,(function(t){u(t)||c.exists((function(e){return dn(t,e)&&u(e)}))?i():n().toOptional().filter((function(e){return!dn(e.element,t)})).each(i)}))})),r(NA,(function(t,e,n){e.onTabChange(t,{newTabName:n.name,oldTabName:n.oldName})})),ja((function(e){var n=t();tp.setValue(e,n.getData())}))],!1)},OJ={initUrlDialog:kJ,initDialog:TJ},EJ=function(t,e){return rL(t,t.type,e)},_J=function(t,e,n){return tt(e,(function(t){return t.name===n})).bind((function(e){return e.memento.getOpt(t)}))},AJ=function(t,e){var n=e.map((function(t){return t.footerButtons})).getOr([]),r=X(n,(function(t){return"start"===t.align})),o=function(t,e){return sA.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:$(e,(function(t){return t.memento.asSpec()}))})},i=o("start",r.pass),u=o("end",r.fail);return[i,u]},DJ=function(t,e){var n=function(t,n){var r=$(n.buttons,(function(t){var n=kC(EJ(t,e));return{name:t.name,align:t.align,memento:n}})),o=function(t,e){return _J(t,r,e)};return L.some({lookupByName:o,footerButtons:r})};return{dom:JF(''),components:[],behaviours:mf([gW.config({channel:QY,initialData:t,updateState:n,renderComponents:AJ})])}},MJ=function(t,e){return DJ(t,e)},zJ=function(t,e){return FK.parts.footer(DJ(t,e))},RJ=function(t,e){var n=t.getRoot();if(n.getSystem().isConnected()){var r=bv.getCurrent(t.getFormWrapper()).getOr(t.getFormWrapper());return RR.getField(r,e).fold((function(){var n=t.getFooter(),o=gW.getState(n);return o.get().bind((function(t){return t.lookupByName(r,e)}))}),(function(t){return L.some(t)}))}return L.none()},NJ=function(t,e){var n=t.getRoot();return gW.getState(n).get().map((function(t){return xi(wi("data",t.dataValidator,e))})).getOr(e)},BJ=function(t,e,n){var r=function(e){var n=t.getRoot();n.getSystem().isConnected()&&e(n)},o=function(){var e=t.getRoot(),r=e.getSystem().isConnected()?t.getFormWrapper():e,o=tp.getValue(r),i=bt(n,(function(t){return t.get()}));return A(A({},o),i)},u=function(e){r((function(r){var o=h.getData(),i=A(A({},o),e),u=NJ(t,i),a=t.getFormWrapper();tp.setValue(a,u),vt(n,(function(t,e){Et(i,e)&&t.set(i[e])}))}))},a=function(e){RJ(t,e).each(Hv.disable)},c=function(e){RJ(t,e).each(Hv.enable)},s=function(e){RJ(t,e).each(Yw.focus)},l=function(t){if(!i(t))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");r((function(e){Sa(e,zA,{message:t})}))},f=function(){r((function(t){Ca(t,RA)}))},d=function(e){r((function(n){var r=t.getBody(),o=gW.getState(r);o.get().exists((function(t){return t.isTabPanel()}))&&bv.getCurrent(r).each((function(t){HY.showTab(t,e)}))}))},m=function(t){r((function(n){var r=e(t);n.getSystem().broadcastOn([XY],r),n.getSystem().broadcastOn([YY],r.internalDialog),n.getSystem().broadcastOn([JY],r.internalDialog),n.getSystem().broadcastOn([QY],r.internalDialog),h.setData(r.initialData)}))},g=function(){r((function(t){Ca(t,_A)}))},h={getData:o,setData:u,disable:a,enable:c,focus:s,block:l,unblock:f,showTab:d,redial:m,close:g};return h},LJ=function(t){switch(t){case"large":return["tox-dialog--width-lg"];case"medium":return["tox-dialog--width-md"];default:return[]}},HJ=function(t,e,n){var r=vJ(t.internalDialog.title,n),o=nJ({body:t.internalDialog.body},n),i=xJ(t.internalDialog.buttons),u=CJ(i),a=zJ({buttons:i},n),c=OJ.initDialog((function(){return m}),yJ((function(){return f}),n.shared.providers,e),n.shared.getSink),s=LJ(t.internalDialog.size),l={header:r,body:o,footer:L.some(a),extraClasses:s,extraBehaviours:[],extraStyles:{}},f=wJ(l,t,c,n),d=function(){var t=function(){var t=FK.getBody(f);return bv.getCurrent(t).getOr(t)};return{getRoot:w(f),getBody:function(){return FK.getBody(f)},getFooter:function(){return FK.getFooter(f)},getFormWrapper:t}}(),m=BJ(d,e.redial,u);return{dialog:f,instanceApi:m}},IJ=function(t,e,n,r){var o,i,u=oc("dialog-label"),a=oc("dialog-content"),c=function(t,e){return L.some(e)},s=kC(hJ({title:t.internalDialog.title,draggable:!0},u,n.shared.providers)),l=kC(eJ({body:t.internalDialog.body},a,n,r)),f=xJ(t.internalDialog.buttons),d=CJ(f),m=kC(MJ({buttons:f},n)),g=OJ.initDialog((function(){return p}),{onBlock:function(t){KF.block(h,(function(e,r){return bJ(t.message,r,n.shared.providers)}))},onUnblock:function(){KF.unblock(h)},onClose:function(){return e.closeWindow()}},n.shared.getSink),h=Es({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline"],attributes:(o={role:"dialog"},o["aria-labelledby"]=u,o["aria-describedby"]=a,o)},eventOrder:(i={},i[ta()]=[gW.name(),yf.name()],i[ea()]=["execute-on-form"],i[da()]=["reflecting","execute-on-form"],i),behaviours:mf([Aw.config({mode:"cyclic",onEscape:function(t){return Ca(t,_A),L.some(!0)},useTabstopAt:function(t){return!vN(t)&&("button"!==ae(t)||"disabled"!==Un(t,"disabled"))}}),gW.config({channel:XY,updateState:c,initialData:t}),Yw.config({}),Fw("execute-on-form",g.concat([Fa(Iu(),(function(t,e){Aw.focusIn(t)}))])),KF.config({getRoot:function(){return L.some(h)}}),Pw.config({}),uN.memory({})]),components:[s.asSpec(),l.asSpec(),m.asSpec()]}),p=BJ({getRoot:w(h),getFooter:function(){return m.get(h)},getBody:function(){return l.get(h)},getFormWrapper:function(){var t=l.get(h);return bv.getCurrent(t).getOr(t)}},e.redial,d);return{dialog:h,instanceApi:p}},PJ=tinymce.util.Tools.resolve("tinymce.util.URI"),VJ=function(t){var e=function(e){t.getSystem().isConnected()&&e(t)},n=function(t){if(!i(t))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");e((function(e){Sa(e,zA,{message:t})}))},r=function(){e((function(t){Ca(t,RA)}))},o=function(){e((function(t){Ca(t,_A)}))},u=function(t){e((function(e){e.getSystem().broadcastOn([ZY],t)}))};return{block:n,unblock:r,close:o,sendMessage:u}},FJ=["insertContent","setContent","execCommand","close","block","unblock"],UJ=function(t){return u(t)&&-1!==FJ.indexOf(t.mceAction)},jJ=function(t){return!UJ(t)&&u(t)&&Et(t,"mceAction")},WJ=function(t,e,n){switch(n.mceAction){case"insertContent":t.insertContent(n.content);break;case"setContent":t.setContent(n.content);break;case"execCommand":var r=!!s(n.ui)&&n.ui;t.execCommand(n.cmd,r,n.value);break;case"close":e.close();break;case"block":e.block(n.message);break;case"unblock":e.unblock();break}},qJ=function(t,e,n,r){var o,i=vJ(t.title,r),u=rJ(t),a=t.buttons.bind((function(t){return 0===t.length?L.none():L.some(zJ({buttons:t},r))})),c=OJ.initUrlDialog((function(){return v}),yJ((function(){return p}),r.shared.providers,e)),s=A(A({},t.height.fold((function(){return{}}),(function(t){return{height:t+"px","max-height":t+"px"}}))),t.width.fold((function(){return{}}),(function(t){return{width:t+"px","max-width":t+"px"}}))),l=t.width.isNone()&&t.height.isNone()?["tox-dialog--width-lg"]:[],f=new PJ(t.url,{base_uri:new PJ(window.location.href)}),d=f.protocol+"://"+f.host+(f.port?":"+f.port:""),m=nd(),g=[Fw("messages",[Ua((function(){var e=ud(ee.fromDom(window),"message",(function(e){if(f.isSameOrigin(new PJ(e.raw.origin))){var r=e.raw.data;UJ(r)?WJ(n,v,r):jJ(r)&&t.onMessage(v,r)}}));m.set(e)})),ja(m.clear)]),yf.config({channels:(o={},o[ZY]={onReceive:function(t,e){Is(t.element,"iframe").each((function(t){var n=t.dom.contentWindow;n.postMessage(e,d)}))}},o)})],h={header:i,body:u,footer:a,extraClasses:l,extraBehaviours:g,extraStyles:s},p=wJ(h,t,c,r),v=VJ(p);return{dialog:p,instanceApi:v}},$J=function(t){var e=t.backstage.shared,n=function(n,r){var o=function(){FK.hide(c),r()},i=kC(rL({name:"close-alert",text:"OK",primary:!0,align:"end",disabled:!1,icon:L.none()},"cancel",t.backstage)),u=aJ(),a=uJ(o,e.providers),c=Es(fJ({lazySink:function(){return e.getSink()},header:iJ(u,a),body:cJ(n,e.providers),footer:L.some(sJ(lJ([],[i.asSpec()]))),onEscape:o,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[za(AA,o)],eventOrder:{}}));FK.show(c);var s=i.get(c);Yw.focus(s)};return{open:n}},GJ=function(t){var e=t.backstage.shared,n=function(n,r){var o=function(t){FK.hide(s),r(t)},i=kC(rL({name:"yes",text:"Yes",primary:!0,align:"end",disabled:!1,icon:L.none()},"submit",t.backstage)),u=rL({name:"no",text:"No",primary:!1,align:"end",disabled:!1,icon:L.none()},"cancel",t.backstage),a=aJ(),c=uJ((function(){return o(!1)}),e.providers),s=Es(fJ({lazySink:function(){return e.getSink()},header:iJ(a,c),body:cJ(n,e.providers),footer:L.some(sJ(lJ([],[u,i.asSpec()]))),onEscape:function(){return o(!1)},extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[za(AA,(function(){return o(!1)})),za(MA,(function(){return o(!0)}))],eventOrder:{}}));FK.show(s);var l=i.get(s);Yw.focus(l)};return{open:n}},KJ=function(t,e){return xi(wi("data",e,t))},XJ=function(t){return L_(t,".tox-alert-dialog")||L_(t,".tox-confirm-dialog")},YJ=function(t,e,n){return e&&n?[]:[CV.config({contextual:{lazyContext:function(){return L.some(Jr(ee.fromDom(t.getContentAreaContainer())))},fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"]})]},JJ=function(t){var e=t.backstage,n=t.editor,r=qT(n),o=$J(t),i=GJ(t),u=function(t,n,r){return void 0!==n&&"toolbar"===n.inline?l(t,e.shared.anchors.inlineDialog(),r,n.ariaAttrs):void 0!==n&&"cursor"===n.inline?l(t,e.shared.anchors.cursor(),r,n.ariaAttrs):s(t,r)},a=function(t,e){return c(t,e)},c=function(t,r){var o=function(t){var o=qJ(t,{closeWindow:function(){FK.hide(o.dialog),r(o.instanceApi)}},n,e);return FK.show(o.dialog),o.instanceApi};return wY.openUrl(o,t)},s=function(t,n){var r=function(t,r,o){var i=r,u={dataValidator:o,initialData:i,internalDialog:t},a=HJ(u,{redial:wY.redial,closeWindow:function(){FK.hide(a.dialog),n(a.instanceApi)}},e);return FK.show(a.dialog),a.instanceApi.setData(i),a.instanceApi};return wY.open(r,t)},l=function(t,o,i,u){var a=function(t,a,c){var s=KJ(a,c),l=od(),f=e.shared.header.isPositionedAtTop(),d={dataValidator:c,initialData:s,internalDialog:t},m=function(){return l.on((function(t){eC.reposition(t),CV.refresh(t)}))},g=IJ(d,{redial:wY.redial,closeWindow:function(){l.on(eC.hide),n.off("ResizeEditor",m),l.clear(),i(g.instanceApi)}},e,u),h=Es(eC.sketch(A(A({lazySink:e.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{}},f?{}:{fireRepositionEventInstead:{}}),{inlineBehaviours:mf(M([Fw("window-manager-inline-events",[za(ga(),(function(t,e){Ca(g.dialog,AA)}))])],YJ(n,r,f),!0)),isExtraPart:function(t,e){return XJ(e)}})));return l.set(h),eC.showWithin(h,_s(g.dialog),{anchor:o},L.some(Hn())),r&&f||(CV.refresh(h),n.on("ResizeEditor",m)),g.instanceApi.setData(s),Aw.focusIn(g.dialog),g.instanceApi};return wY.open(a,t)},f=function(t,e){i.open(t,(function(t){e(t)}))},d=function(t,e){o.open(t,(function(){e()}))},m=function(t){t.close()};return{open:u,openUrl:a,alert:d,close:m,confirm:f}};function QJ(){_.add("silver",(function(t){var e=NK(t),n=e.uiMothership,r=e.backstage,o=e.renderUI,i=e.getUi;B_.register(t,r.shared);var u=JJ({editor:t,backstage:r});return{renderUI:o,getWindowManagerImpl:w(u),getNotificationManagerImpl:function(){return FC(t,{backstage:r},n)},ui:i()}}))}QJ()})()}).call(this,n("c8ba"))},"0597":function(t,e,n){"use strict";n.r(e);n("ac1f"),n("5319");var r=n("e562"),o=n.n(r);o.a.PluginManager.add("indent2em",(function(t){var e="首行缩进",n=o.a.util.Tools.resolve("tinymce.util.Tools"),r=t.getParam("indent2em_val","2em"),i=function(){var e=t.dom,o=t.selection.getSelectedBlocks(),i="";n.each(o,(function(t){if(""==i&&(i=e.getStyle(t,"text-indent")==r?"remove":"add"),"add"==i)e.setStyle(t,"text-indent",r);else{var n=e.getAttrib(t,"style");n=n.replace(/text-indent:[\s]*2em;/gi,""),e.setAttrib(t,"style",n)}}))};return t.ui.registry.addButton("indent2em",{text:'',tooltip:e,onAction:function(){i()}}),t.ui.registry.addMenuItem("indent2em",{text:e,onAction:function(){i()}}),{getMetadata:function(){return{name:e,url:"http://tinymce.ax-z.cn/more-plugins/indent2em.php"}}}}))},"07d1":function(t,e,n){n("94ce")},"09cf":function(t,e){(function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");function e(){t.add("textcolor",(function(){}))}e()})()},"0cb2":function(t,e,n){var r=n("e330"),o=n("7b0b"),i=Math.floor,u=r("".charAt),a=r("".replace),c=r("".slice),s=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,r,f,d){var m=n+t.length,g=r.length,h=l;return void 0!==f&&(f=o(f),h=s),a(d,h,(function(o,a){var s;switch(u(a,0)){case"$":return"$";case"&":return t;case"`":return c(e,0,n);case"'":return c(e,m);case"<":s=f[c(a,1,-1)];break;default:var l=+a;if(0===l)return o;if(l>g){var d=i(l/10);return 0===d?o:d<=g?void 0===r[d-1]?u(a,1):r[d-1]+u(a,1):o}s=r[l-1]}return void 0===s?"":s}))}},"0d68":function(t,e,n){n("030f")},"1f38":function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return o}));var r=function(){return"undefined"!==typeof window?window:t},o=function(){var t=r();return t&&t.tinymce?t.tinymce:null}}).call(this,n("c8ba"))},2401:function(t,e){(function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(t){var e=typeof t;return null===t?"null":"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e},n=function(t){return function(n){return e(n)===t}},r=function(t){return function(e){return typeof e===t}},o=n("string"),i=n("object"),u=n("array"),a=r("boolean"),c=r("function"),s=r("number"),l=function(){},f=function(t){return function(){return t}},d=function(t){return t},m=function(t,e){return t===e},g=function(t){return function(e){return!t(e)}},h=f(!1),p=f(!0),v=function(){return b},b=function(){var t=function(t){return t()},e=d,n={fold:function(t,e){return t()},isSome:h,isNone:p,getOr:e,getOrThunk:t,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:f(null),getOrUndefined:f(void 0),or:e,orThunk:t,map:v,each:l,bind:v,exists:h,forall:p,filter:function(){return v()},toArray:function(){return[]},toString:f("none()")};return n}(),y=function(t){var e=f(t),n=function(){return o},r=function(e){return e(t)},o={fold:function(e,n){return n(t)},isSome:p,isNone:h,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return y(e(t))},each:function(e){e(t)},bind:r,exists:r,forall:r,filter:function(e){return e(t)?o:b},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},w=function(t){return null===t||void 0===t?b:y(t)},x={some:y,none:v,from:w},C=Array.prototype.slice,S=Array.prototype.push,k=function(t,e){for(var n=t.length,r=new Array(n),o=0;o=0&&e0},nt=function(t){return!et(t)},rt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ot=function(t){return function(e){return Q(e,t)}},it=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Q(t,"edge/")&&Q(t,"chrome")&&Q(t,"safari")&&Q(t,"applewebkit")}},{name:"Chrome",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,rt],search:function(t){return Q(t,"chrome")&&!Q(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Q(t,"msie")||Q(t,"trident")}},{name:"Opera",versionRegexes:[rt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ot("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ot("firefox")},{name:"Safari",versionRegexes:[rt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Q(t,"safari")||Q(t,"mobile/"))&&Q(t,"applewebkit")}}],ut=[{name:"Windows",search:ot("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Q(t,"iphone")||Q(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ot("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:ot("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ot("linux"),versionRegexes:[]},{name:"Solaris",search:ot("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ot("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ot("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],at={browsers:f(it),oses:f(ut)},ct="Edge",st="Chrome",lt="IE",ft="Opera",dt="Firefox",mt="Safari",gt=function(){return ht({current:void 0,version:G.unknown()})},ht=function(t){var e=t.current,n=t.version,r=function(t){return function(){return e===t}};return{current:e,version:n,isEdge:r(ct),isChrome:r(st),isIE:r(lt),isOpera:r(ft),isFirefox:r(dt),isSafari:r(mt)}},pt={unknown:gt,nu:ht,edge:f(ct),chrome:f(st),ie:f(lt),opera:f(ft),firefox:f(dt),safari:f(mt)},vt="Windows",bt="iOS",yt="Android",wt="Linux",xt="OSX",Ct="Solaris",St="FreeBSD",kt="ChromeOS",Tt=function(){return Ot({current:void 0,version:G.unknown()})},Ot=function(t){var e=t.current,n=t.version,r=function(t){return function(){return e===t}};return{current:e,version:n,isWindows:r(vt),isiOS:r(bt),isAndroid:r(yt),isOSX:r(xt),isLinux:r(wt),isSolaris:r(Ct),isFreeBSD:r(St),isChromeOS:r(kt)}},Et={unknown:Tt,nu:Ot,windows:f(vt),ios:f(bt),android:f(yt),linux:f(wt),osx:f(xt),solaris:f(Ct),freebsd:f(St),chromeos:f(kt)},_t=function(t,e,n){var r=at.browsers(),o=at.oses(),i=e.bind((function(t){return K(r,t)})).orThunk((function(){return Y(r,t)})).fold(pt.unknown,pt.nu),u=J(o,t).fold(Et.unknown,Et.nu),a=F(u,i,t,n);return{browser:i,os:u,deviceType:a}},At={detect:_t},Dt=function(t){return window.matchMedia(t).matches},Mt=V((function(){return At.detect(navigator.userAgent,x.from(navigator.userAgentData),Dt)})),zt=function(){return Mt()},Rt=function(t,e,n){return 0!==(t.compareDocumentPosition(e)&n)},Nt=function(t,e){return Rt(t,e,Node.DOCUMENT_POSITION_CONTAINED_BY)},Bt=1,Lt=function(t,e){var n=e||document,r=n.createElement("div");if(r.innerHTML=t,!r.hasChildNodes()||r.childNodes.length>1)throw console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return Pt(r.childNodes[0])},Ht=function(t,e){var n=e||document,r=n.createElement(t);return Pt(r)},It=function(t,e){var n=e||document,r=n.createTextNode(t);return Pt(r)},Pt=function(t){if(null===t||void 0===t)throw new Error("Node cannot be null or undefined");return{dom:t}},Vt=function(t,e,n){return x.from(t.dom.elementFromPoint(e,n)).map(Pt)},Ft={fromHtml:Lt,fromTag:Ht,fromText:It,fromDom:Pt,fromPoint:Vt},Ut=function(t,e){var n=t.dom;if(n.nodeType!==Bt)return!1;var r=n;if(void 0!==r.matches)return r.matches(e);if(void 0!==r.msMatchesSelector)return r.msMatchesSelector(e);if(void 0!==r.webkitMatchesSelector)return r.webkitMatchesSelector(e);if(void 0!==r.mozMatchesSelector)return r.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")},jt=function(t,e){return t.dom===e.dom},Wt=function(t,e){var n=t.dom,r=e.dom;return n!==r&&n.contains(r)},qt=function(t,e){return Nt(t.dom,e.dom)},$t=function(t,e){return zt().browser.isIE()?qt(t,e):Wt(t,e)},Gt=Ut,Kt=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Xt=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Yt=tinymce.util.Tools.resolve("tinymce.util.VK"),Jt=Object.keys,Qt=function(t,e){for(var n=Jt(t),r=0,o=n.length;r0)&&r},Fe=function(t,e){return t.isChildOf(e,t.getRoot())},Ue=function(t){return t.getParam("lists_indent_on_tab",!0)},je=function(t){var e=t.getParam("forced_root_block","p");return!1===e?"":!0===e?"p":e},We=function(t){return t.getParam("forced_root_block_attrs",{})},qe=function(t,e){var n,r,o,i=t.dom,u=t.schema.getBlockElements(),a=i.createFragment(),c=je(t);if(c&&(r=i.create(c),r.tagName===c.toUpperCase()&&i.setAttribs(r,We(t)),Ie(e.firstChild,u)||a.appendChild(r)),e)while(n=e.firstChild){var s=n.nodeName;o||"SPAN"===s&&"bookmark"===n.getAttribute("data-mce-type")||(o=!0),Ie(n,u)?(a.appendChild(n),r=null):c?(r||(r=i.create(c),a.appendChild(r)),r.appendChild(n)):a.appendChild(n)}return c?o||r.appendChild(i.create("br",{"data-mce-bogus":"1"})):a.appendChild(i.create("br")),a},$e=ke.DOM,Ge=function(t,e,n){var r=function(t){Te.each(o,(function(e){t.parentNode.insertBefore(e,n.parentNode)})),$e.remove(t)},o=$e.select('span[data-mce-type="bookmark"]',e),i=qe(t,n),u=$e.createRng();u.setStartAfter(n),u.setEndAfter(e);for(var a=u.extractContents(),c=a.firstChild;c;c=c.firstChild)if("LI"===c.nodeName&&t.dom.isEmpty(c)){$e.remove(c);break}t.dom.isEmpty(a)||$e.insertAfter(a,e),$e.insertAfter(i,e),Ve(t.dom,n.parentNode)&&r(n.parentNode),$e.remove(n),Ve(t.dom,e)&&$e.remove(e)},Ke=ue("dd"),Xe=ue("dt"),Ye=function(t,e){Ke(e)?Se(e,"dt"):Xe(e)&&le(e).each((function(n){return Ge(t,n.dom,e.dom)}))},Je=function(t){Xe(t)&&Se(t,"dd")},Qe=function(t,e,n){T(n,"Indent"===e?Je:function(e){return Ye(t,e)})},Ze=function(t,e){if(_e(t))return{container:t,offset:e};var n=Kt.getNode(t,e);return _e(n)?{container:n,offset:e>=t.childNodes.length?n.data.length:0}:n.previousSibling&&_e(n.previousSibling)?{container:n.previousSibling,offset:n.previousSibling.data.length}:n.nextSibling&&_e(n.nextSibling)?{container:n.nextSibling,offset:0}:{container:t,offset:e}},tn=function(t){var e=t.cloneRange(),n=Ze(t.startContainer,t.startOffset);e.setStart(n.container,n.offset);var r=Ze(t.endContainer,t.endOffset);return e.setEnd(r.container,r.offset),e},en=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),nn=function(t,e){var n=e||t.selection.getStart(!0);return t.dom.getParent(n,"OL,UL,DL",ln(t,n))},rn=function(t,e){return t&&1===e.length&&e[0]===t},on=function(t){return O(t.querySelectorAll("ol,ul,dl"),Ae)},un=function(t){var e=nn(t),n=t.selection.getSelectedBlocks();return rn(e,n)?on(e):O(n,(function(t){return Ae(t)&&e!==t}))},an=function(t,e){var n=Te.map(e,(function(e){var n=t.dom.getParent(e,"li,dd,dt",ln(t,e));return n||e}));return en.unique(n)},cn=function(t){var e=t.selection.getSelectedBlocks();return O(an(t,e),ze)},sn=function(t){return O(cn(t),Re)},ln=function(t,e){var n=t.dom.getParents(e,"TD,TH");return n.length>0?n[0]:t.getBody()},fn=function(t,e){var n=t.dom.getParents(e,"ol,ul",ln(t,e));return L(n)},dn=function(t){var e=fn(t,t.selection.getStart()),n=O(t.selection.getSelectedBlocks(),De);return e.toArray().concat(n)},mn=function(t){var e=dn(t);return gn(t,e)},gn=function(t,e){var n=k(e,(function(e){return fn(t,e).getOr(e)}));return en.unique(n)},hn=function(t,e,n){return void 0===n&&(n=m),t.exists((function(t){return n(t,e)}))},pn=function(t,e,n){return t.isSome()&&e.isSome()?x.some(n(t.getOrDie(),e.getOrDie())):x.none()},vn=function(t,e){var n=e||document,r=n.createDocumentFragment();return T(t,(function(t){r.appendChild(t.dom)})),Ft.fromDom(r)},bn=function(t,e,n){return t.fire("ListMutation",{action:e,element:n})},yn=function(t){return void 0!==t.style&&c(t.style.getPropertyValue)},wn=function(t,e,n){if(!o(n))throw console.error("Invalid call to CSS.set. Property ",e,":: Value ",n,":: Element ",t),new Error("CSS value must be a string: "+n);yn(t)&&t.style.setProperty(e,n)},xn=function(t,e,n){var r=t.dom;wn(r,e,n)},Cn=function(t,e){pe(t.item,e.list)},Sn=function(t){for(var e=1;ee.length?zn(t,e,n):Mn(t,e,n)}),[]);return B(n).map((function(t){return t.list}))},Nn=function(t){return Gt(t,"OL,UL")},Bn=function(t){return me(t).exists(Nn)},Ln=function(t){return ge(t).exists(Nn)},Hn=function(t){return t.depth>0},In=function(t){return t.isSelected},Pn=function(t){var e=fe(t),n=Ln(t)?e.slice(0,-1):e;return k(n,xe)},Vn=function(t,e,n){return le(t).filter(ie).map((function(r){return{depth:e,dirty:!1,isSelected:n,content:Pn(t),itemAttributes:se(t),listAttributes:se(r),listType:ne(r)}}))},Fn=function(t,e){switch(t){case"Indent":e.depth++;break;case"Outdent":e.depth--;break;case"Flatten":e.depth=0}e.dirty=!0},Un=function(t,e){t.listType=e.listType,t.listAttributes=I({},e.listAttributes)},jn=function(t){t.listAttributes=ee(t.listAttributes,(function(t,e){return"start"!==e}))},Wn=function(t,e){var n=t[e].depth,r=function(t){return t.depth===n&&!t.dirty},o=function(t){return t.depth0?_r(t,r,o,e,u):Dr(t,r,e,u)},zr=ke.DOM,Rr=function(t,e){var n=e.parentNode;if("LI"===n.nodeName&&n.firstChild===e){var r=n.previousSibling;r&&"LI"===r.nodeName?(r.appendChild(e),Ve(t,n)&&zr.remove(n)):zr.setStyle(n,"listStyleType","none")}if(Ae(n)){r=n.previousSibling;r&&"LI"===r.nodeName&&r.appendChild(e)}},Nr=function(t,e){var n=Te.grep(t.select("ol,ul",e));Te.each(n,(function(e){Rr(t,e)}))},Br=function(t,e,n,r){var o=e.startContainer,i=e.startOffset;if(_e(o)&&(n?i0))return o;var u=t.schema.getNonEmptyElements();1===o.nodeType&&(o=Kt.getNode(o,i));var a=new Xt(o,r);n&&Pe(t.dom,o)&&a.next();while(o=a[n?"next":"prev2"]()){if("LI"===o.nodeName&&!o.hasChildNodes())return o;if(u[o.nodeName])return o;if(_e(o)&&o.data.length>0)return o}},Lr=function(t,e){var n=e.childNodes;return 1===n.length&&!Ae(n[0])&&t.isBlock(n[0])},Hr=function(t,e){Lr(t,e)&&t.remove(e.firstChild,!0)},Ir=function(t,e,n){var r,o=Lr(t,n)?n.firstChild:n;if(Hr(t,e),!Ve(t,e,!0))while(r=e.firstChild)o.appendChild(r)},Pr=function(t,e,n){var r,o=e.parentNode;if(Fe(t,e)&&Fe(t,n)){Ae(n.lastChild)&&(r=n.lastChild),o===n.lastChild&&Be(o.previousSibling)&&t.remove(o.previousSibling);var i=n.lastChild;i&&Be(i)&&e.hasChildNodes()&&t.remove(i),Ve(t,n,!0)&&t.$(n).empty(),Ir(t,e,n),r&&n.appendChild(r);var u=$t(Ft.fromDom(n),Ft.fromDom(e)),a=u?t.getParents(e,Ae,n):[];t.remove(e),T(a,(function(e){Ve(t,e)&&e!==t.getRoot()&&t.remove(e)}))}},Vr=function(t,e,n){t.dom.$(n).empty(),Pr(t.dom,e,n),t.selection.setCursorLocation(n,0)},Fr=function(t,e,n,r){var o=t.dom;if(o.isEmpty(r))Vr(t,n,r);else{var i=cr(e);Pr(o,n,r),t.selection.setRng(sr(i))}},Ur=function(t,e,n,r){var o=cr(e);Pr(t.dom,n,r);var i=sr(o);t.selection.setRng(i)},jr=function(t,e){var n=t.dom,r=t.selection,o=r.getStart(),i=ln(t,o),u=n.getParent(r.getStart(),"LI",i);if(u){var a=u.parentNode;if(a===t.getBody()&&Ve(n,a))return!0;var c=tn(r.getRng()),s=n.getParent(Br(t,c,e,i),"LI",i);if(s&&s!==u)return t.undoManager.transact((function(){e?Fr(t,c,s,u):Le(u)?or(t):Ur(t,c,u,s)})),!0;if(!s&&!e&&0===c.startOffset&&0===c.endOffset)return t.undoManager.transact((function(){ir(t)})),!0}return!1},Wr=function(t,e,n){var r=t.getParent(e.parentNode,t.isBlock,n);t.remove(e),r&&t.isEmpty(r)&&t.remove(r)},qr=function(t,e){var n=t.dom,r=t.selection.getStart(),o=ln(t,r),i=n.getParent(r,n.isBlock,o);if(i&&n.isEmpty(i)){var u=tn(t.selection.getRng()),a=n.getParent(Br(t,u,e,o),"LI",o);if(a)return t.undoManager.transact((function(){Wr(n,i,o),Or(n,a.parentNode),t.selection.select(a,!0),t.selection.collapse(e)})),!0}return!1},$r=function(t,e){return jr(t,e)||qr(t,e)},Gr=function(t){var e=t.selection.getStart(),n=ln(t,e),r=t.dom.getParent(e,"LI,DT,DD",n);return!!(r||cn(t).length>0)&&(t.undoManager.transact((function(){t.execCommand("Delete"),Nr(t.dom,t.getBody())})),!0)},Kr=function(t,e){return t.selection.isCollapsed()?$r(t,e):Gr(t)},Xr=function(t){t.on("keydown",(function(e){e.keyCode===Yt.BACKSPACE?Kr(t,!1)&&e.preventDefault():e.keyCode===Yt.DELETE&&Kr(t,!0)&&e.preventDefault()}))},Yr=function(t){return{backspaceDelete:function(e){Kr(t,e)}}},Jr=function(t,e){var n=nn(t);t.undoManager.transact((function(){i(e.styles)&&t.dom.setStyles(n,e.styles),i(e.attrs)&&Qt(e.attrs,(function(e,r){return t.dom.setAttrib(n,r,e)}))}))},Qr=function(t){var e=R(tt(t).split("")),n=k(e,(function(t,e){var n=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,e)*n}));return _(n,(function(t,e){return t+e}),0)},Zr=function(t){if(t--,t<0)return"";var e=t%26,n=Math.floor(t/26),r=Zr(n),o=String.fromCharCode("A".charCodeAt(0)+e);return r+o},to=function(t){return/^[A-Z]+$/.test(t)},eo=function(t){return/^[a-z]+$/.test(t)},no=function(t){return/^[0-9]+$/.test(t)},ro=function(t){return no(t)?2:to(t)?0:eo(t)?1:nt(t)?3:4},oo=function(t){switch(ro(t)){case 2:return x.some({listStyleType:x.none(),start:t});case 0:return x.some({listStyleType:x.some("upper-alpha"),start:Qr(t).toString()});case 1:return x.some({listStyleType:x.some("lower-alpha"),start:Qr(t).toString()});case 3:return x.some({listStyleType:x.none(),start:""});case 4:return x.none()}},io=function(t){var e=parseInt(t.start,10);return hn(t.listStyleType,"upper-alpha")?Zr(e):hn(t.listStyleType,"lower-alpha")?Zr(e).toLowerCase():t.start},uo=function(t){var e=nn(t);Me(e)&&t.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:io({start:t.dom.getAttrib(e,"start","1"),listStyleType:x.some(t.dom.getStyle(e,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:function(e){var n=e.getData();oo(n.start).each((function(e){t.execCommand("mceListUpdate",!1,{attrs:{start:"1"===e.start?"":e.start},styles:{"list-style-type":e.listStyleType.getOr("")}})})),e.close()}})},ao=function(t,e){return function(){var n=nn(t);return n&&n.nodeName===e}},co=function(t){t.addCommand("mceListProps",(function(){uo(t)}))},so=function(t){t.on("BeforeExecCommand",(function(e){var n=e.command.toLowerCase();"indent"===n?rr(t):"outdent"===n&&or(t)})),t.addCommand("InsertUnorderedList",(function(e,n){Mr(t,"UL",n)})),t.addCommand("InsertOrderedList",(function(e,n){Mr(t,"OL",n)})),t.addCommand("InsertDefinitionList",(function(e,n){Mr(t,"DL",n)})),t.addCommand("RemoveList",(function(){ir(t)})),co(t),t.addCommand("mceListUpdate",(function(e,n){i(n)&&Jr(t,n)})),t.addQueryStateHandler("InsertUnorderedList",ao(t,"UL")),t.addQueryStateHandler("InsertOrderedList",ao(t,"OL")),t.addQueryStateHandler("InsertDefinitionList",ao(t,"DL"))},lo=function(t){t.on("keydown",(function(e){e.keyCode!==Yt.TAB||Yt.metaKeyPressed(e)||t.undoManager.transact((function(){(e.shiftKey?or(t):rr(t))&&e.preventDefault()}))}))},fo=function(t){Ue(t)&&lo(t),Xr(t)},mo=function(t){var e=function(e){return function(){return t.execCommand(e)}};t.hasPlugin("advlist")||(t.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:e("InsertOrderedList"),onSetup:function(e){return dr(t,"OL",e.setActive)}}),t.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:e("InsertUnorderedList"),onSetup:function(e){return dr(t,"UL",e.setActive)}}))},go=function(t){var e={text:"List properties...",icon:"ordered-list",onAction:function(){return t.execCommand("mceListProps")},onSetup:function(e){return dr(t,"OL",(function(t){return e.setDisabled(!t)}))}};t.ui.registry.addMenuItem("listprops",e),t.ui.registry.addContextMenu("lists",{update:function(e){var n=nn(t,e);return Me(n)?["listprops"]:[]}})};function ho(){t.add("lists",(function(t){return!1===t.hasPlugin("rtc",!0)?(fo(t),so(t)):co(t),mo(t),go(t),Yr(t)}))}ho()})()},"2d33":function(t,e,n){n("303c")},"303c":function(t,e){(function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");function e(){t.add("colorpicker",(function(){}))}e()})()},"34de":function(t,e,n){n("09cf")},3511:function(t,e){var n=TypeError,r=9007199254740991;t.exports=function(t){if(t>r)throw n("Maximum allowed index exceeded");return t}},"36ad":function(t,e,n){},"3fdf":function(t,e,n){"use strict";n.r(e);n("d81d"),n("ac1f"),n("1276");var r=n("e562"),o=n.n(r);o.a.PluginManager.add("lineheight",(function(t){var e="设置行高",n=o.a.util.Tools.resolve("tinymce.util.Tools"),r=t.getParam("lineheight_val","1 1.5 1.6 1.75 1.8 2 3 4 5");t.on("init",(function(){t.formatter.register({lineheight:{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table",styles:{"line-height":"%value"}}})}));var i=function(e){t.formatter.apply("lineheight",{value:e}),t.fire("change",{})};return t.ui.registry.addMenuButton("lineheight",{text:'',tooltip:e,fetch:function(e){var o=t.dom,u=t.selection.getSelectedBlocks(),a=0;n.each(u,(function(t){0==a&&(a=o.getStyle(t,"line-height")?o.getStyle(t,"line-height"):0)}));var c=r.split(" ").map((function(t){var e=t,n=t;return{type:"togglemenuitem",text:e,active:a==n,onAction:function(){i(n)}}}));e(c)}}),{getMetadata:function(){return{name:e,url:"http://tinymce.ax-z.cn/more-plugins/lineheight.php"}}}}))},4237:function(t,e,n){n("be7f")},"4ea8":function(t,e,n){n("cdd9")},5126:function(t,e,n){n("3fdf")},"523a":function(t,e,n){"use strict";n("36ad")},5319:function(t,e,n){"use strict";var r=n("2ba4"),o=n("c65b"),i=n("e330"),u=n("d784"),a=n("d039"),c=n("825a"),s=n("1626"),l=n("7234"),f=n("5926"),d=n("50c4"),m=n("577e"),g=n("1d80"),h=n("8aa5"),p=n("dc4a"),v=n("0cb2"),b=n("14c3"),y=n("b622"),w=y("replace"),x=Math.max,C=Math.min,S=i([].concat),k=i([].push),T=i("".indexOf),O=i("".slice),E=function(t){return void 0===t?t:String(t)},_=function(){return"$0"==="a".replace(/./,"$0")}(),A=function(){return!!/./[w]&&""===/./[w]("a","$0")}(),D=!a((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}));u("replace",(function(t,e,n){var i=A?"$":"$0";return[function(t,n){var r=g(this),i=l(t)?void 0:p(t,w);return i?o(i,t,r,n):o(e,m(r),t,n)},function(t,o){var u=c(this),a=m(t);if("string"==typeof o&&-1===T(o,i)&&-1===T(o,"$<")){var l=n(e,u,a,o);if(l.done)return l.value}var g=s(o);g||(o=m(o));var p=u.global;if(p){var y=u.unicode;u.lastIndex=0}var w=[];while(1){var _=b(u,a);if(null===_)break;if(k(w,_),!p)break;var A=m(_[0]);""===A&&(u.lastIndex=h(a,d(u.lastIndex),y))}for(var D="",M=0,z=0;z=M&&(D+=O(a,M,N)+P,M=N+R.length)}return D+O(a,M)}]}),!D||!_||A)},"5e4c":function(t,e){(function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");function e(){t.add("contextmenu",(function(){}))}e()})()},"64d8":function(t,e,n){n("ef1f")},7193:function(t,e,n){n("ae68")},"84ec":function(t,e,n){n("2401")},"918d":function(t,e,n){"use strict";var r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tinymce"},[e("editor",{attrs:{id:"tinymce",init:t.init},model:{value:t.tinymceHtml,callback:function(e){t.tinymceHtml=e},expression:"tinymceHtml"}})],1)},o=[],i=n("bc3a"),u=n.n(i),a=n("f121"),c=n.n(a),s=n("e562"),l=n.n(s),f=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],d=function(t){return-1!==f.indexOf(t)},m=function(t,e,n){Object.keys(e).filter(d).forEach((function(r){var o=e[r];"function"===typeof o&&("onInit"===r?o(t,n):n.on(r.substring(2),(function(t){return o(t,n)})))}))},g=function(t,e){var n,r=t.$props.modelEvents?t.$props.modelEvents:null,o=Array.isArray(r)?r.join(" "):r;t.$watch("value",(function(t,r){e&&"string"===typeof t&&t!==n&&t!==r&&(e.setContent(t),n=t)})),e.on(o||"change keyup undo redo",(function(){n=e.getContent(),t.$emit("input",n)}))},h=function(t,e,n){var r=e.$props.value?e.$props.value:"",o=e.$props.initialValue?e.$props.initialValue:"";n.setContent(r||o),e.$listeners.input&&g(e,n),m(t,e.$listeners,n)},p=0,v=function(t){var e=Date.now(),n=Math.floor(1e9*Math.random());return p++,t+"_"+n+p+String(e)},b=function(t){return null!==t&&"textarea"===t.tagName.toLowerCase()},y=function(t){return"undefined"===typeof t||""===t?[]:Array.isArray(t)?t:t.split(" ")},w=function(t,e){return y(t).concat(y(e))},x=function(t,e,n,r){var o=e.createElement("script");o.type="application/javascript",o.id=t,o.addEventListener("load",r),o.src=n,e.head&&e.head.appendChild(o)},C=function(){return{listeners:[],scriptId:v("tiny-script"),scriptLoaded:!1}},S=function(t,e,n,r){t.scriptLoaded?r():(t.listeners.push(r),e.getElementById(t.scriptId)||x(t.scriptId,e,n,(function(){t.listeners.forEach((function(t){return t()})),t.scriptLoaded=!0})))},k=n("1f38"),T={apiKey:String,cloudChannel:String,id:String,init:Object,initialValue:String,inline:Boolean,modelEvents:[String,Array],plugins:[String,Array],tagName:String,toolbar:[String,Array],value:String,disabled:Boolean},O=function(){return O=Object.assign||function(t){for(var e,n=1,r=arguments.length;n')})),e}function $(){for(var t=document.getElementById("gallery").getElementsByTagName("img"),e=0;e\n
\n 假装有图\n
\n
\n \n
\n
")}]},buttons:[{type:"cancel",name:"closeButton",text:"取消"},{type:"submit",name:"submitButton",text:"保存",primary:!0}],initialData:{desdata:"".concat(L),size:{width:"".concat(P),height:"".concat(I)}},onSubmit:function(t){var e=t.getData();l.a.activeEditor.execCommand("mceInsertContent",!1,'').concat(e.desdata,'')),t.close()}}}l.a.PluginManager.add("imgdialog",(function(t){t.ui.registry.addMenuItem("imgdialog",{icon:"image",text:"图片管理",onAction:function(){L=U(t.selection.getNode()),H=F(t.selection.getNode()),I=W(t.selection.getNode()),P=j(t.selection.getNode()),V=q(["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg"]),t.windowManager.open(G()),$()}}),t.ui.registry.addContextMenu("imgdialog",{update:function(t){return t.src?"imgdialog":""}})}));var K={name:"tinymce",components:{Editor:z},props:{context:{type:String},disabled:{type:Boolean,default:!1},plugins:{type:[String,Array],default:"link lists image code table wordcount autoresize"},toolbar:{type:[String,Array],default:"undo redo | bold italic underline strikethrough | fontsizeselect lineheight | forecolor backcolor | bullist numlist | removeformat | alignleft aligncenter alignright alignjustify | indent2em blockquote | link unlink image code | tagsSplit "},menubar:{type:Boolean,default:!0}},data:function(){var t=this;return{url:c.a.Host85,tinymceHtml:this.context,init:{language_url:"cn"==sessionStorage.getItem("lang")?"/tinymce/zh_CN.js":"",language:"cn"==sessionStorage.getItem("lang")?"zh_CN":"",skin_url:"/tinymce/skins/ui/oxide",branding:!1,menubar:this.menubar,plugins:" link lists image code table wordcount autoresize tags indent2em lineheight quickbar1 quickbar2 imgdialog ",toolbar:this.toolbar,contextmenu:"link table tagsMenu ",toolbar_mode:"Sliding",image_advtab:!0,convert_urls:!1,images_upload_handler:function(e,n,r){t.handleImgUpload(e,n,r)}}}},watch:{tinymceHtml:function(t){this.$emit("tinymcehtml",t)},context:function(t){this.tinymceHtml=t}},mounted:function(){l.a.init(this.init)},methods:{handleImgUpload:function(t,e,n){var r=this,o=new FormData;o.set("files",t.blob()),u.a.post(this.url+"/commodity/add/upload",o).then((function(t){200==t.status?200==t.data.code?e(r.url+t.data.data[0]):n(t.data.msg):n(r.$i18n.t("Msg.Fail"))})).catch((function(t){n(t)}))}}},X=K,Y=(n("523a"),n("2877")),J=Object(Y["a"])(X,r,o,!1,null,null,null);e["a"]=J.exports},9434:function(t,e,n){n("e8b0")},"94ce":function(t,e){(function(){"use strict";var t=function(t){var e=typeof t;return null===t?"null":"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e},e=function(e){return function(n){return t(n)===e}},n=function(t){return function(e){return typeof e===t}},r=function(t){return function(e){return t===e}},o=e("string"),i=e("object"),u=e("array"),a=r(null),c=n("boolean"),s=r(void 0),l=function(t){return null===t||void 0===t},f=function(t){return!l(t)},d=n("function"),m=n("number"),g=function(){},h=function(t,e){return function(){for(var n=[],r=0;r-1},B=function(t,e){for(var n=0,r=t.length;n=0;n--){var r=t[n];e(r,n)}},V=function(t,e){for(var n=[],r=[],o=0,i=t.length;o=0&&e=e.length&&t.substr(n,n+e.length)===e},wt=function(t,e){return Ct(t,e)?bt(t,e.length):t},xt=function(t,e){return-1!==t.indexOf(e)},Ct=function(t,e){return yt(t,e,0)},St=function(t,e){return yt(t,e,t.length-e.length)},kt=function(t){return function(e){return e.replace(t,"")}},Tt=kt(/^\s+|\s+$/g),Ot=function(t){return t.length>0},Et=function(t){return!Ot(t)},_t=function(t){var e=parseFloat(t);return isNaN(e)?A.none():A.some(e)},At=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Dt=function(t){return function(e){return xt(e,t)}},Mt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return xt(t,"edge/")&&xt(t,"chrome")&&xt(t,"safari")&&xt(t,"applewebkit")}},{name:"Chrome",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,At],search:function(t){return xt(t,"chrome")&&!xt(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return xt(t,"msie")||xt(t,"trident")}},{name:"Opera",versionRegexes:[At,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Dt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Dt("firefox")},{name:"Safari",versionRegexes:[At,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(xt(t,"safari")||xt(t,"mobile/"))&&xt(t,"applewebkit")}}],zt=[{name:"Windows",search:Dt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return xt(t,"iphone")||xt(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Dt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Dt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Dt("linux"),versionRegexes:[]},{name:"Solaris",search:Dt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Dt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Dt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Rt={browsers:v(Mt),oses:v(zt)},Nt="Edge",Bt="Chrome",Lt="IE",Ht="Opera",It="Firefox",Pt="Safari",Vt=function(){return Ft({current:void 0,version:mt.unknown()})},Ft=function(t){var e=t.current,n=t.version,r=function(t){return function(){return e===t}};return{current:e,version:n,isEdge:r(Nt),isChrome:r(Bt),isIE:r(Lt),isOpera:r(Ht),isFirefox:r(It),isSafari:r(Pt)}},Ut={unknown:Vt,nu:Ft,edge:v(Nt),chrome:v(Bt),ie:v(Lt),opera:v(Ht),firefox:v(It),safari:v(Pt)},jt="Windows",Wt="iOS",qt="Android",$t="Linux",Gt="OSX",Kt="Solaris",Xt="FreeBSD",Yt="ChromeOS",Jt=function(){return Qt({current:void 0,version:mt.unknown()})},Qt=function(t){var e=t.current,n=t.version,r=function(t){return function(){return e===t}};return{current:e,version:n,isWindows:r(jt),isiOS:r(Wt),isAndroid:r(qt),isOSX:r(Gt),isLinux:r($t),isSolaris:r(Kt),isFreeBSD:r(Xt),isChromeOS:r(Yt)}},Zt={unknown:Jt,nu:Qt,windows:v(jt),ios:v(Wt),android:v(qt),linux:v($t),osx:v(Gt),solaris:v(Kt),freebsd:v(Xt),chromeos:v(Yt)},te=function(t,e,n){var r=Rt.browsers(),o=Rt.oses(),i=e.bind((function(t){return gt(r,t)})).orThunk((function(){return pt(r,t)})).fold(Ut.unknown,Ut.nu),u=vt(o,t).fold(Zt.unknown,Zt.nu),a=at(u,i,t,n);return{browser:i,os:u,deviceType:a}},ee={detect:te},ne=function(t){return window.matchMedia(t).matches},re=ut((function(){return ee.detect(navigator.userAgent,A.from(navigator.userAgentData),ne)})),oe=function(){return re()},ie=function(t,e,n){return 0!==(t.compareDocumentPosition(e)&n)},ue=function(t,e){return ie(t,e,Node.DOCUMENT_POSITION_CONTAINED_BY)},ae=8,ce=9,se=11,le=1,fe=3,de=function(t,e){var n=e||document,r=n.createElement("div");if(r.innerHTML=t,!r.hasChildNodes()||r.childNodes.length>1)throw console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return he(r.childNodes[0])},me=function(t,e){var n=e||document,r=n.createElement(t);return he(r)},ge=function(t,e){var n=e||document,r=n.createTextNode(t);return he(r)},he=function(t){if(null===t||void 0===t)throw new Error("Node cannot be null or undefined");return{dom:t}},pe=function(t,e,n){return A.from(t.dom.elementFromPoint(e,n)).map(he)},ve={fromHtml:de,fromTag:me,fromText:ge,fromDom:he,fromPoint:pe},be=function(t,e){var n=t.dom;if(n.nodeType!==le)return!1;var r=n;if(void 0!==r.matches)return r.matches(e);if(void 0!==r.msMatchesSelector)return r.msMatchesSelector(e);if(void 0!==r.webkitMatchesSelector)return r.webkitMatchesSelector(e);if(void 0!==r.mozMatchesSelector)return r.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")},ye=function(t){return t.nodeType!==le&&t.nodeType!==ce&&t.nodeType!==se||0===t.childElementCount},we=function(t,e){var n=void 0===e?document:e.dom;return ye(n)?[]:H(n.querySelectorAll(t),ve.fromDom)},xe=function(t,e){var n=void 0===e?document:e.dom;return ye(n)?A.none():A.from(n.querySelector(t)).map(ve.fromDom)},Ce=function(t,e){return t.dom===e.dom},Se=function(t,e){var n=t.dom,r=e.dom;return n!==r&&n.contains(r)},ke=function(t,e){return ue(t.dom,e.dom)},Te=function(t,e){return oe().browser.isIE()?ke(t,e):Se(t,e)},Oe=be,Ee=Object.keys,_e=Object.hasOwnProperty,Ae=function(t,e){for(var n=Ee(t),r=0,o=n.length;r0}))},vr=function(t,e){var n=t.dom;fr(n,e),rr(tr(t,"style").map(Tt),"")&&er(t,"style")},br=function(t,e){var n=t.dom,r=e.dom;sr(n)&&sr(r)&&(r.style.cssText=n.style.cssText)},yr=function(t,e,n){return void 0===n&&(n=0),tr(t,e).map((function(t){return parseInt(t,10)})).getOr(n)},wr=function(t,e){return yr(t,e,1)},xr=function(t){return fn("col")(t)?yr(t,"span",1)>1:wr(t,"colspan")>1},Cr=function(t){return wr(t,"rowspan")>1},Sr=function(t,e){return parseInt(gr(t,e),10)},kr=v(10),Tr=v(10),Or=function(t,e){return Er(t,e,k)},Er=function(t,e,n){return K(wn(t),(function(t){return be(t,e)?n(t)?[t]:[]:Er(t,e,n)}))},_r=function(t,e,n){if(void 0===n&&(n=S),n(e))return A.none();if(N(t,nn(e)))return A.some(e);var r=function(t){return be(t,"table")||n(t)};return qn(e,t.join(","),r)},Ar=function(t,e){return _r(["td","th"],t,e)},Dr=function(t){return Or(t,"th,td")},Mr=function(t){return be(t,"colgroup")?In(t,"col"):K(Nr(t),(function(t){return In(t,"col")}))},zr=function(t,e){return Kn(t,"table",e)},Rr=function(t){return Or(t,"tr")},Nr=function(t){return zr(t).fold(v([]),(function(t){return In(t,"colgroup")}))},Br=function(t,e){return H(t,(function(t){if("colgroup"===nn(t)){var n=H(Mr(t),(function(t){var e=yr(t,"span",1);return $e(t,1,e)}));return Xe(t,n,"colgroup")}n=H(Dr(t),(function(t){var e=yr(t,"rowspan",1),n=yr(t,"colspan",1);return $e(t,e,n)}));return Xe(t,n,e(t))}))},Lr=function(t){return hn(t).map((function(t){var e=nn(t);return je(e)?e:"tbody"})).getOr("tbody")},Hr=function(t){var e=Rr(t),n=Nr(t),r=it(it([],n,!0),e,!0);return Br(r,Lr)},Ir=function(t,e){return Br(t,(function(){return e}))},Pr=function(t,e,n){var r=t.cells,o=r.slice(0,e),i=r.slice(e),u=o.concat(n).concat(i);return Ur(t,u)},Vr=function(t,e,n){return Pr(t,e,[n])},Fr=function(t,e,n){var r=t.cells;r[e]=n},Ur=function(t,e){return Qe(t.element,e,t.section,t.isNew)},jr=function(t,e){var n=t.cells,r=H(n,e);return Qe(t.element,r,t.section,t.isNew)},Wr=function(t,e){return t.cells[e]},qr=function(t,e){return Wr(t,e).element},$r=function(t){return t.cells.length},Gr=function(t){var e=V(t,(function(t){return"colgroup"===t.section}));return{rows:e.fail,cols:e.pass}},Kr=function(t,e,n){var r=H(t.cells,n);return Qe(e(t.element),r,t.section,!0)},Xr="data-snooker-locked-cols",Yr=function(t){return tr(t,Xr).bind((function(t){return A.from(t.match(/\d+/g))})).map((function(t){return J(t,k)}))},Jr=function(t){var e=j(Gr(t).rows,(function(t,e){return I(e.cells,(function(e,n){e.isLocked&&(t[n]=!0)})),t}),{}),n=Be(e,(function(t,e){return parseInt(e,10)}));return Z(n)},Qr=function(t,e){return t+","+e},Zr=function(t,e,n){return A.from(t.access[Qr(e,n)])},to=function(t,e,n){var r=eo(t,(function(t){return n(e,t.element)}));return r.length>0?A.some(r[0]):A.none()},eo=function(t,e){var n=K(t.all,(function(t){return t.cells}));return F(n,e)},no=function(t){var e={},n=0;return I(t.cells,(function(t){var r=t.colspan;L(r,(function(o){var i=n+o;e[i]=tn(t.element,r,i)})),n+=r})),e},ro=function(t){var e={},n=[],r=et(t).map((function(t){return t.element})).bind(zr),o=r.bind(Yr).getOr({}),i=0,u=0,a=0,c=V(t,(function(t){return"colgroup"===t.section})),s=c.pass,l=c.fail;I(l,(function(t){var r=[];I(t.cells,(function(t){var n=0;while(void 0!==e[Qr(a,n)])n++;for(var i=Ve(o,n.toString()),c=Ke(t.element,t.rowspan,t.colspan,a,n,i),s=0;s0},co=function(t,e){return A.from(t.columns[e])},so={fromTable:oo,generate:ro,getAt:Zr,findItem:to,filterItems:eo,justCells:io,justColumns:uo,hasColumns:ao,getColumnAt:co},lo=function(t,e){var n=e.column,r=e.column+e.colspan-1,o=e.row,i=e.row+e.rowspan-1;return n<=t.finishCol&&r>=t.startCol&&o<=t.finishRow&&i>=t.startRow},fo=function(t,e){return e.column>=t.startCol&&e.column+e.colspan-1<=t.finishCol&&e.row>=t.startRow&&e.row+e.rowspan-1<=t.finishRow},mo=function(t,e){for(var n=!0,r=w(fo,e),o=e.startRow;o<=e.finishRow;o++)for(var i=e.startCol;i<=e.finishCol;i++)n=n&&so.getAt(t,o,i).exists(r);return n?A.some(e):A.none()},go=function(t,e){return Ze(Math.min(t.row,e.row),Math.min(t.column,e.column),Math.max(t.row+t.rowspan-1,e.row+e.rowspan-1),Math.max(t.column+t.colspan-1,e.column+e.colspan-1))},ho=function(t,e,n){var r=so.findItem(t,e,Ce),o=so.findItem(t,n,Ce);return r.bind((function(t){return o.map((function(e){return go(t,e)}))}))},po=function(t,e,n){return ho(t,e,n).bind((function(e){return mo(t,e)}))},vo=function(t,e,n,r){return so.findItem(t,e,Ce).bind((function(e){var o=n>0?e.row+e.rowspan-1:e.row,i=r>0?e.column+e.colspan-1:e.column,u=so.getAt(t,o+n,i+r);return u.map((function(t){return t.element}))}))},bo=function(t,e,n){return ho(t,e,n).map((function(e){var n=so.filterItems(t,w(lo,e));return H(n,(function(t){return t.element}))}))},yo=function(t,e){var n=function(t,e){return Te(e,t)};return so.findItem(t,e,n).map((function(t){return t.element}))},wo=function(t,e,n){return zr(t).bind((function(r){var o=ko(r);return vo(o,t,e,n)}))},xo=function(t,e,n){var r=ko(t);return bo(r,e,n)},Co=function(t,e,n,r,o){var i=ko(t),u=Ce(t,n)?A.some(e):yo(i,e),a=Ce(t,o)?A.some(r):yo(i,r);return u.bind((function(t){return a.bind((function(e){return bo(i,t,e)}))}))},So=function(t,e,n){var r=ko(t);return po(r,e,n)},ko=so.fromTable,To=function(t,e){var n=hn(t);n.each((function(n){n.dom.insertBefore(e.dom,t.dom)}))},Oo=function(t,e){var n=yn(t);n.fold((function(){var n=hn(t);n.each((function(t){_o(t,e)}))}),(function(t){To(t,e)}))},Eo=function(t,e){var n=Cn(t);n.fold((function(){_o(t,e)}),(function(n){t.dom.insertBefore(e.dom,n.dom)}))},_o=function(t,e){t.dom.appendChild(e.dom)},Ao=function(t,e,n){xn(t,n).fold((function(){_o(t,e)}),(function(t){To(t,e)}))},Do=function(t,e){To(t,e),_o(e,t)},Mo=function(t,e){I(e,(function(e){To(t,e)}))},zo=function(t,e){I(e,(function(n,r){var o=0===r?t:e[r-1];Oo(o,n)}))},Ro=function(t,e){I(e,(function(e){_o(t,e)}))},No=function(t){t.dom.textContent="",I(wn(t),(function(t){Bo(t)}))},Bo=function(t){var e=t.dom;null!==e.parentNode&&e.parentNode.removeChild(e)},Lo=function(t){var e=wn(t);e.length>0&&Mo(t,e),Bo(t)},Ho=function(t,e){var n=function(n){if(!t(n))throw new Error("Can only get "+e+" value of a "+e+" node");return r(n).getOr("")},r=function(e){return t(e)?A.from(e.dom.nodeValue):A.none()},o=function(n,r){if(!t(n))throw new Error("Can only set raw "+e+" value of a "+e+" node");n.dom.nodeValue=r};return{get:n,getOption:r,set:o}},Io=Ho(cn,"text"),Po=function(t){return Io.get(t)},Vo=function(t){return Io.getOption(t)},Fo=function(t,e){return Io.set(t,e)},Uo=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];function jo(){var t=function(t){return ve.fromDom(t.dom.cloneNode(!1))},e=function(t){return mn(t).dom},n=function(t){return!!an(t)&&("body"===nn(t)||N(Uo,nn(t)))},r=function(t){return!!an(t)&&N(["br","img","hr","input"],nn(t))},o=function(t){return an(t)&&"false"===Zn(t,"contenteditable")},i=function(t,e){return t.dom.compareDocumentPosition(e.dom)},u=function(t,e){var n=nr(t);Jn(e,n)},a=function(t){var e=nn(t);return N(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],e)},c=function(t){return an(t)?tr(t,"lang"):A.none()};return{up:v({selector:qn,closest:Kn,predicate:Fn,all:vn}),down:v({selector:Pn,predicate:Ln}),styles:v({get:gr,getRaw:pr,set:dr,remove:vr}),attrs:v({get:Zn,set:Yn,remove:er,copyTo:u}),insert:v({before:To,after:Oo,afterAll:zo,append:_o,appendAll:Ro,prepend:Eo,wrap:Do}),remove:v({unwrap:Lo,remove:Bo}),create:v({nu:ve.fromTag,clone:t,text:ve.fromText}),query:v({comparePosition:i,prevSibling:bn,nextSibling:yn}),property:v({children:wn,name:nn,parent:hn,document:e,isText:cn,isComment:un,isElement:an,isSpecial:a,getLanguage:c,getText:Po,setText:Fo,isBoundary:n,isEmptyTag:r,isNonEditable:o}),eq:Ce,is:Oe}}var Wo=function(t,e,n,r){var o=n[0],i=n.slice(1);return r(t,e,o,i)},qo=function(t,e,n){return n.length>0?Wo(t,e,n,$o):A.none()},$o=function(t,e,n,r){var o=e(t,n);return U(r,(function(n,r){var o=e(t,r);return Go(t,n,o)}),o)},Go=function(t,e,n){return e.bind((function(e){return n.filter(w(t.eq,e))}))},Ko=function(t,e){return w(t.eq,e)},Xo=function(t,e,n,r){void 0===r&&(r=S);var o=[e].concat(t.up().all(e)),i=[n].concat(t.up().all(n)),u=function(t){var e=$(t,r);return e.fold((function(){return t}),(function(e){return t.slice(0,e+1)}))},a=u(o),c=u(i),s=q(a,(function(e){return B(c,Ko(t,e))}));return{firstpath:a,secondpath:c,shared:s}},Yo=qo,Jo=Xo,Qo=jo(),Zo=function(t,e){return Yo(Qo,(function(e,n){return t(n)}),e)},ti=function(t,e,n){return Jo(Qo,t,e,n)},ei=function(t){return qn(t,"table")},ni=function(t,e,n){var r=function(t){return function(e){return void 0!==n&&n(e)||Ce(e,t)}};return Ce(t,e)?A.some({boxes:A.some([t]),start:t,finish:e}):ei(t).bind((function(o){return ei(e).bind((function(i){if(Ce(o,i))return A.some({boxes:xo(o,t,e),start:t,finish:e});if(Te(o,i)){var u=Hn(e,"td,th",r(o)),a=u.length>0?u[u.length-1]:e;return A.some({boxes:Co(o,t,o,e,i),start:t,finish:a})}if(Te(i,o)){u=Hn(t,"td,th",r(i));var c=u.length>0?u[u.length-1]:t;return A.some({boxes:Co(i,t,o,e,i),start:t,finish:c})}return ti(t,e).shared.bind((function(u){return Kn(u,"table",n).bind((function(n){var u=Hn(e,"td,th",r(n)),a=u.length>0?u[u.length-1]:e,c=Hn(t,"td,th",r(n)),s=c.length>0?c[c.length-1]:t;return A.some({boxes:Co(n,t,o,e,i),start:s,finish:a})}))}))}))}))},ri=function(t,e){var n=Pn(t,e);return n.length>0?A.some(n):A.none()},oi=function(t,e){return q(t,(function(t){return be(t,e)}))},ii=function(t,e,n){return Gn(t,e).bind((function(e){return Gn(t,n).bind((function(t){return Zo(ei,[e,t]).map((function(n){return{first:e,last:t,table:n}}))}))}))},ui=function(t,e){return qn(t,"table").bind((function(n){return Gn(n,e).bind((function(e){return ni(e,t).bind((function(t){return t.boxes.map((function(e){return{boxes:e,start:t.start,finish:t.finish}}))}))}))}))},ai=function(t,e,n,r,o){return oi(t,o).bind((function(t){return wo(t,e,n).bind((function(t){return ui(t,r)}))}))},ci=function(t,e){return ri(t,e)},si=function(t,e,n){return ii(t,e,n).bind((function(e){var n=function(e){return Ce(t,e)},r="thead,tfoot,tbody,table",o=qn(e.first,r,n),i=qn(e.last,r,n);return o.bind((function(t){return i.bind((function(n){return Ce(t,n)?So(e.table,e.first,e.last):A.none()}))}))}))},li=function(t){if(!u(t))throw new Error("cases must be an array");if(0===t.length)throw new Error("there must be at least one case");var e=[],n={};return I(t,(function(r,o){var i=Ee(r);if(1!==i.length)throw new Error("one and only one name per case");var a=i[0],c=r[a];if(void 0!==n[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!u(c))throw new Error("case arguments must be an array");e.push(a),n[a]=function(){for(var n=[],r=0;rr?e-r:0;return o};return{set:n,get:r,getOuter:o,aggregate:i,max:u}},Oi=function(){var t=oe().browser;return t.isIE()||t.isEdge()},Ei=function(t,e){return _t(t).getOr(e)},_i=function(t,e,n){return Ei(gr(t,e),n)},Ai=function(t){return gr(t,"box-sizing")},Di=function(t,e,n,r){var o=_i(t,"padding-"+n,0),i=_i(t,"padding-"+r,0),u=_i(t,"border-"+n+"-width",0),a=_i(t,"border-"+r+"-width",0);return e-o-i-u-a},Mi=function(t,e){var n=t.dom,r=n.getBoundingClientRect().height||n.offsetHeight;return"border-box"===e?r:Di(t,r,"top","bottom")},zi=function(t,e){var n=t.dom,r=n.getBoundingClientRect().width||n.offsetWidth;return"border-box"===e?r:Di(t,r,"left","right")},Ri=function(t){return Oi()?Mi(t,Ai(t)):_i(t,"height",t.dom.offsetHeight)},Ni=function(t){return Oi()?zi(t,Ai(t)):_i(t,"width",t.dom.offsetWidth)},Bi=function(t){return zi(t,"content-box")},Li=Ti("width",(function(t){return t.dom.offsetWidth})),Hi=function(t){return Li.get(t)},Ii=function(t){return Li.getOuter(t)},Pi=Bi,Vi=Ni,Fi=function(t,e){void 0===e&&(e=k);var n=t.grid,r=L(n.columns,b),o=L(n.rows,b);return H(r,(function(n){var r=function(){return K(o,(function(e){return so.getAt(t,e,n).filter((function(t){return t.column===n})).toArray()}))},i=function(t){return 1===t.colspan&&e(t.element)},u=function(){return so.getAt(t,0,n)};return Ui(r,i,u)}))},Ui=function(t,e,n){var r=t(),o=q(r,e),i=o.orThunk((function(){return A.from(r[0]).orThunk(n)}));return i.map((function(t){return t.element}))},ji=function(t){var e=t.grid,n=L(e.rows,b),r=L(e.columns,b);return H(n,(function(e){var n=function(){return K(r,(function(n){return so.getAt(t,e,n).filter((function(t){return t.row===e})).fold(v([]),(function(t){return[t]}))}))},o=function(t){return 1===t.rowspan},i=function(){return so.getAt(t,e,0)};return Ui(n,o,i)}))},Wi=function(t,e){if(e<0||e>=t.length-1)return A.none();var n=t[e].fold((function(){var n=Y(t.slice(0,e));return rt(n,(function(t,e){return t.map((function(t){return{value:t,delta:e+1}}))}))}),(function(t){return A.some({value:t,delta:0})})),r=t[e+1].fold((function(){var n=t.slice(e+1);return rt(n,(function(t,e){return t.map((function(t){return{value:t,delta:e+1}}))}))}),(function(t){return A.some({value:t,delta:1})}));return n.bind((function(t){return r.map((function(e){var n=e.delta+t.delta;return Math.abs(e.value-t.value)/n}))}))},qi=function(t,e){return function(n){return"rtl"===$i(n)?e:t}},$i=function(t){return"rtl"===gr(t,"direction")?"rtl":"ltr"},Gi=Ti("height",(function(t){var e=t.dom;return Mn(t)?e.getBoundingClientRect().height:e.offsetHeight})),Ki=function(t){return Gi.get(t)},Xi=function(t){return Gi.getOuter(t)},Yi=Ri,Ji=function(t,e){var n=function(n,r){return Ji(t+n,e+r)};return{left:t,top:e,translate:n}},Qi=Ji,Zi=function(t){var e=t.getBoundingClientRect();return Qi(e.left,e.top)},tu=function(t,e){return void 0!==t?t:void 0!==e?e:0},eu=function(t){var e=t.dom.ownerDocument,n=e.body,r=e.defaultView,o=e.documentElement;if(n===t.dom)return Qi(n.offsetLeft,n.offsetTop);var i=tu(null===r||void 0===r?void 0:r.pageYOffset,o.scrollTop),u=tu(null===r||void 0===r?void 0:r.pageXOffset,o.scrollLeft),a=tu(o.clientTop,n.clientTop),c=tu(o.clientLeft,n.clientLeft);return nu(t).translate(u-c,i-a)},nu=function(t){var e=t.dom,n=e.ownerDocument,r=n.body;return r===e?Qi(r.offsetLeft,r.offsetTop):Mn(t)?Zi(e):Qi(0,0)},ru=function(t,e){return{row:t,y:e}},ou=function(t,e){return{col:t,x:e}},iu=function(t){var e=eu(t);return e.left+Ii(t)},uu=function(t){return eu(t).left},au=function(t,e){return ou(t,uu(e))},cu=function(t,e){return ou(t,iu(e))},su=function(t){return eu(t).top},lu=function(t,e){return ru(t,su(e))},fu=function(t,e){return ru(t,su(e)+Xi(e))},du=function(t,e,n){if(0===n.length)return[];var r=H(n.slice(1),(function(e,n){return e.map((function(e){return t(n,e)}))})),o=n[n.length-1].map((function(t){return e(n.length-1,t)}));return r.concat([o])},mu=function(t){return-t},gu={delta:b,positions:function(t){return du(lu,fu,t)},edge:su},hu={delta:b,edge:uu,positions:function(t){return du(au,cu,t)}},pu={delta:mu,edge:iu,positions:function(t){return du(cu,au,t)}},vu=qi(hu,pu),bu={delta:function(t,e){return vu(e).delta(t,e)},positions:function(t,e){return vu(e).positions(t,e)},edge:function(t){return vu(t).edge(t)}},yu={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},wu=function(){var t="[0-9]+",e="[+-]?"+t,n="[eE]"+e,r="\\.",o=function(t){return"(?:"+t+")?"},i=["Infinity",t+r+o(t)+o(n),r+t+o(n),t+o(n)].join("|"),u="[+-]?(?:"+i+")";return new RegExp("^("+u+")(.*)$")}(),xu=function(t,e){return B(e,(function(e){return B(yu[e],(function(e){return t===e}))}))},Cu=function(t,e){var n=A.from(wu.exec(t));return n.bind((function(t){var n=Number(t[1]),r=t[2];return xu(r,e)?A.some({value:n,unit:r}):A.none()}))},Su=/(\d+(\.\d+)?)%/,ku=/(\d+(\.\d+)?)px|em/,Tu=fn("col"),Ou=function(t,e,n){var r=pn(t).getOrThunk((function(){return Rn(dn(t))}));return e(t)/n(r)*100},Eu=function(t,e){dr(t,"width",e+"px")},_u=function(t,e){dr(t,"width",e+"%")},Au=function(t,e){dr(t,"height",e+"px")},Du=function(t){return Yi(t)+"px"},Mu=function(t,e,n,r){var o=zr(t).map((function(t){var r=n(t);return Math.floor(e/100*r)})).getOr(e);return r(t,o),o},zu=function(t,e,n,r){var o=parseFloat(t);return St(t,"%")&&"table"!==nn(e)?Mu(e,o,n,r):o},Ru=function(t){var e=Du(t);return e?zu(e,t,Ki,Au):Ki(t)},Nu=function(t,e,n){var r=n(t),o=wr(t,e);return r/o},Bu=function(t,e){return pr(t,e).orThunk((function(){return tr(t,e).map((function(t){return t+"px"}))}))},Lu=function(t){return Bu(t,"width")},Hu=function(t){return Bu(t,"height")},Iu=function(t){return Ou(t,Hi,Pi)},Pu=function(t){return Tu(t)?Hi(t):Vi(t)},Vu=function(t){return Nu(t,"rowspan",Ru)},Fu=function(t){var e=Lu(t);return e.bind((function(t){return Cu(t,["fixed","relative","empty"])}))},Uu=function(t,e,n){dr(t,"width",e+n)},ju=function(t){return Hi(t)+"px"},Wu=function(t){return Ou(t,Hi,Pi)+"%"},qu=function(t){return Lu(t).exists((function(t){return Su.test(t)}))},$u=function(t){return Lu(t).exists((function(t){return ku.test(t)}))},Gu=function(t){return Lu(t).isNone()},Ku=v(Su),Xu=fn("col"),Yu=function(t){return Lu(t).getOrThunk((function(){return Pu(t)+"px"}))},Ju=function(t){return Hu(t).getOrThunk((function(){return Vu(t)+"px"}))},Qu=function(t){return H(so.justColumns(t),(function(t){return A.from(t.element)}))},Zu=function(t){var e=oe().browser,n=e.isChrome()||e.isFirefox();return!Xu(t)||n},ta=function(t,e,n,r,o,i){return t.filter(r).fold((function(){return i(Wi(n,e))}),(function(t){return o(t)}))},ea=function(t,e,n,r){var o=Fi(t),i=so.hasColumns(t)?Qu(t):o,u=[A.some(bu.edge(e))].concat(H(bu.positions(o,e),(function(t){return t.map((function(t){return t.x}))}))),a=x(xr);return H(i,(function(t,e){return ta(t,e,u,a,(function(t){if(Zu(t))return n(t);var i=ur(o[e],b);return ta(i,e,u,a,(function(t){return r(A.some(Hi(t)))}),r)}),r)}))},na=function(t){return t.map((function(t){return t+"px"})).getOr("")},ra=function(t,e){return ea(t,e,Yu,na)},oa=function(t,e,n){return ea(t,e,Iu,(function(t){return t.fold((function(){return n.minCellWidth()}),(function(t){return t/n.pixelWidth()*100}))}))},ia=function(t,e,n){return ea(t,e,Pu,(function(t){return t.getOrThunk(n.minCellWidth)}))},ua=function(t,e,n,r,o){var i=ji(t),u=[A.some(n.edge(e))].concat(H(n.positions(i,e),(function(t){return t.map((function(t){return t.y}))})));return H(i,(function(t,e){return ta(t,e,u,x(Cr),r,o)}))},aa=function(t,e,n){return ua(t,e,n,Vu,(function(t){return t.getOrThunk(Tr)}))},ca=function(t,e,n){return ua(t,e,n,Ju,na)},sa=function(t,e){return function(){return Mn(t)?e(t):parseFloat(pr(t,"width").getOr("0"))}},la=function(t){var e=sa(t,Hi),n=v(0),r=function(e,n){return ia(e,t,n)};return{width:e,pixelWidth:e,getWidths:r,getCellDelta:n,singleColumnWidth:v([0]),minCellWidth:n,setElementWidth:g,adjustTableWidth:g,isRelative:!0,label:"none"}},fa=function(t){var e=sa(t,(function(t){return parseFloat(Wu(t))})),n=sa(t,Hi),r=function(t){return t/n()*100},o=function(t,e){return[100-t]},i=function(){return kr()/n()*100},u=function(n){var r=e(),o=n/100*r,i=r+o;_u(t,i)},a=function(e,n){return oa(e,t,n)};return{width:e,pixelWidth:n,getWidths:a,getCellDelta:r,singleColumnWidth:o,minCellWidth:i,setElementWidth:_u,adjustTableWidth:u,isRelative:!0,label:"percent"}},da=function(t){var e=sa(t,Hi),n=b,r=function(t,e){var n=Math.max(kr(),t+e);return[n-t]},o=function(n){var r=e()+n;Eu(t,r)},i=function(e,n){return ia(e,t,n)};return{width:e,pixelWidth:e,getWidths:i,getCellDelta:n,singleColumnWidth:r,minCellWidth:kr,setElementWidth:Eu,adjustTableWidth:o,isRelative:!1,label:"pixel"}},ma=function(t,e){var n=Ku().exec(e);return null!==n?fa(t):da(t)},ga=function(t){var e=Lu(t);return e.fold((function(){return la(t)}),(function(e){return ma(t,e)}))},ha={getTableSize:ga,pixelSize:da,percentageSize:fa,noneSize:la},pa=function(t,e,n,r,o,i){return{minRow:t,minCol:e,maxRow:n,maxCol:r,allCells:o,selectedCells:i}},va=function(t,e){var n=t.grid.columns,r=t.grid.rows,o=r,i=n,u=0,a=0,c=[],s=[];return Ae(t.access,(function(t){if(c.push(t),e(t)){s.push(t);var n=t.row,r=n+t.rowspan-1,l=t.column,f=l+t.colspan-1;nu&&(u=r),la&&(a=f)}})),pa(o,i,u,a,c,s)},ba=function(t,e,n){var r=t[n].element,o=ve.fromTag("td");_o(o,ve.fromTag("br"));var i=e?_o:Eo;i(r,o)},ya=function(t,e,n,r){for(var o=e.grid.columns,i=e.grid.rows,u=0;un.maxRow||cn.maxCol)){var s=so.getAt(e,u,c).filter(r).isNone();s?ba(t,a,u):a=!0}},wa=function(t,e,n,r){Ae(n.columns,(function(t){(t.columne.maxCol)&&Bo(t.element)}));var o=F(Or(t,"tr"),(function(t){return 0===t.dom.childElementCount}));I(o,Bo),e.minCol!==e.maxCol&&e.minRow!==e.maxRow||I(Or(t,"th,td"),(function(t){er(t,"rowspan"),er(t,"colspan")})),er(t,Xr),er(t,"data-snooker-col-series");var i=ha.getTableSize(t);i.adjustTableWidth(r)},xa=function(t,e,n,r){if(0===r.minCol&&e.grid.columns===r.maxCol+1)return 0;var o=ia(e,t,n),i=j(o,(function(t,e){return t+e}),0),u=j(o.slice(r.minCol,r.maxCol+1),(function(t,e){return t+e}),0),a=u/i*n.pixelWidth(),c=a-n.pixelWidth();return n.getCellDelta(c)},Ca=function(t,e){var n=function(t){return be(t.element,e)},r=xi(t),o=Hr(r),i=ha.getTableSize(t),u=so.generate(o),a=va(u,n),c="th:not("+e+"),td:not("+e+")",s=Er(r,"th,td",(function(t){return be(t,c)}));I(s,Bo),ya(o,u,a,n);var l=so.fromTable(t),f=xa(t,l,i,a);return wa(r,a,u,f),r},Sa=" ",ka=function(t){return"img"===nn(t)?1:Vo(t).fold((function(){return wn(t).length}),(function(t){return t.length}))},Ta=function(t){return Vo(t).filter((function(t){return 0!==t.trim().length||t.indexOf(Sa)>-1})).isSome()},Oa=["img","br"],Ea=function(t){var e=Ta(t);return e||N(Oa,nn(t))},_a=function(t){return Wn(t,Ea)},Aa=function(t){return Da(t,Ea)},Da=function(t,e){var n=function(t){for(var r=wn(t),o=r.length-1;o>=0;o--){var i=r[o];if(e(i))return A.some(i);var u=n(i);if(u.isSome())return u}return A.none()};return n(t)},Ma={scope:["row","col"]},za=function(t){return function(){var e=ve.fromTag("td",t.dom);return _o(e,ve.fromTag("br",t.dom)),e}},Ra=function(t){return function(){return ve.fromTag("col",t.dom)}},Na=function(t){return function(){return ve.fromTag("colgroup",t.dom)}},Ba=function(t){return function(){return ve.fromTag("tr",t.dom)}},La=function(t,e,n){var r=Si(t,e);return Ae(n,(function(t,e){null===t?er(r,e):Yn(r,e,t)})),r},Ha=function(t){return t},Ia=function(t,e,n){var r=_a(t);return r.map((function(r){var o=n.join(","),i=Hn(r,o,(function(e){return Ce(e,t)}));return U(i,(function(t,e){var n=wi(e);return er(n,"contenteditable"),_o(t,n),n}),e)})).getOr(e)},Pa=function(t,e){Ae(Ma,(function(n,r){return tr(t,r).filter((function(t){return N(n,t)})).each((function(t){return Yn(e,r,t)}))}))},Va=function(t,e,n){var r=function(t,e){br(t.element,e),vr(e,"height"),1!==t.colspan&&vr(e,"width")},o=function(o){var i=ve.fromTag(nn(o.element),e.dom),u=n.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),a=u.length>0?Ia(o.element,i,u):i;return _o(a,ve.fromTag("br")),r(o,i),Pa(o.element,i),t(o.element,i),i},i=function(n){var o=ve.fromTag(nn(n.element),e.dom);return r(n,o),t(n.element,o),o};return{col:i,colgroup:Na(e),row:Ba(e),cell:o,replace:La,colGap:Ra(e),gap:za(e)}},Fa=function(t){return{col:Ra(t),colgroup:Na(t),row:Ba(t),cell:za(t),replace:Ha,colGap:Ra(t),gap:za(t)}},Ua=function(t,e){var n=e||document,r=n.createElement("div");return r.innerHTML=t,wn(ve.fromDom(r))},ja=function(t){return H(t,ve.fromDom)},Wa=function(t){return t.nodeName.toLowerCase()},qa=function(t){return ve.fromDom(t.getBody())},$a=function(t){return t.getBoundingClientRect().width},Ga=function(t){return t.getBoundingClientRect().height},Ka=function(t){return function(e){return Ce(e,qa(t))}},Xa=function(t){return t?t.replace(/px$/,""):""},Ya=function(t){return/^\d+(\.\d+)?$/.test(t)?t+"px":t},Ja=function(t){er(t,"data-mce-style");var e=function(t){return er(t,"data-mce-style")};I(Dr(t),e),I(Mr(t),e),I(Rr(t),e)},Qa=function(t,e){var n=t.dom.getStyle(e,"width")||t.dom.getAttrib(e,"width");return A.from(n).filter(Ot)},Za=function(t){return/^(\d+(\.\d+)?)%$/.test(t)},tc=function(t){return/^(\d+(\.\d+)?)px$/.test(t)},ec=function(t){return ve.fromDom(t.selection.getStart())},nc=function(t){return ve.fromDom(t.selection.getEnd())},rc=function(t){return mi(t.get(),v([]),b,Q)},oc=function(t){var e=function(t,e){return tr(t,e).exists((function(t){return parseInt(t,10)>1}))},n=function(t){return e(t,"rowspan")||e(t,"colspan")},r=rc(t);return r.length>0&&X(r,n)?A.some(r):A.none()},ic=function(t,e,n){return mi(e.get(),A.none,(function(e){return e.length<=1?A.none():si(t,n.firstSelectedSelector,n.lastSelectedSelector).map((function(t){return{bounds:t,cells:e}}))}),A.none)},uc="data-mce-selected",ac="td["+uc+"],th["+uc+"]",cc="["+uc+"]",sc="data-mce-first-selected",lc="td["+sc+"],th["+sc+"]",fc="data-mce-last-selected",dc="td["+fc+"],th["+fc+"]",mc=cc,gc={selected:uc,selectedSelector:ac,firstSelected:sc,firstSelectedSelector:lc,lastSelected:fc,lastSelectedSelector:dc},hc=function(t){return{element:t,mergable:A.none(),unmergable:A.none(),selection:[t]}},pc=function(t,e,n){return{element:n,mergable:ic(e,t,gc),unmergable:oc(t),selection:rc(t)}},vc=function(t,e,n){return{element:t,clipboard:e,generators:n}},bc=function(t,e,n,r){return{selection:rc(t),clipboard:n,generators:r}},yc=function(t){return zr(t).bind((function(t){return ci(t,gc.firstSelectedSelector)})).fold(v(t),(function(t){return t[0]}))},wc=function(t){return function(e,n){var r=nn(e),o="col"===r||"colgroup"===r?yc(e):e;return Kn(o,t,n)}},xc=wc("th,td,caption"),Cc=wc("th,td"),Sc=function(t){return rc(t)},kc=function(t,e){var n=Cc(t),r=n.bind((function(t){return zr(t)})).map((function(t){return Rr(t)}));return ir(n,r,(function(t,n){return F(n,(function(n){return B(ja(n.dom.cells),(function(n){return"1"===Zn(n,e)||Ce(n,t)}))}))})).getOr([])},Tc=function(t){return zr(t[0]).map((function(t){var e=Ca(t,mc);return Ja(e),[e]}))},Oc=function(t,e){return H(e,(function(e){return t.selection.serializer.serialize(e.dom,{})})).join("")},Ec=function(t){return H(t,(function(t){return t.dom.innerText})).join("")},_c=function(t,e,n){t.on("BeforeGetContent",(function(n){var r=function(e){n.preventDefault(),Tc(e).each((function(e){n.content="text"===n.format?Ec(e):Oc(t,e)}))};!0===n.selection&&mi(e.get(),g,r,g)})),t.on("BeforeSetContent",(function(r){if(!0===r.selection&&!0===r.paste){var o=Sc(e);et(o).each((function(e){zr(e).each((function(o){var i=F(Ua(r.content),(function(t){return"meta"!==nn(t)})),u=fn("table");if(1===i.length&&u(i[0])){r.preventDefault();var a=ve.fromDom(t.getDoc()),c=Fa(a),s=vc(e,i[0],c);n.pasteCells(o,s).each((function(){t.focus()}))}}))}))}}))},Ac=fi.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),Dc=ot({},Ac),Mc=function(t,e){return 0===t.length?Dc.none():1===t.length?Dc.only(0):0===e?Dc.left(0,1):e===t.length-1?Dc.right(e-1,e):e>0&&e=0?u:-u}return r}},Kc=Gc((function(t){return t<0})),Xc=Gc(k),Yc=function(){var t=function(t,e,n,r,o){var i=Kc(t,e,r,o);return $c(t,e,n+1,[i,0],qc)},e=function(t,e,n,r){var o=(100+n)/100,i=Math.max(r,(t[e]+n)/o);return H(t,(function(t,n){var r=n===e?i:t/o;return r-t}))},n=function(n,r,o,i,u,a){return a?e(n,r,i,u):t(n,r,o,i,u)},r=function(t,e,r,o,i,u,a){return n(t,r,o,i,u,a)},o=function(t,e){return t(e)},i=function(t,n,r,o,i,u){if(u)return e(t,r,o,i);var a=Kc(t,r,o,i);return qc(t.slice(0,r)).concat([a])},u=function(t,e,n,r){if(r){var o=e+n,i=o/e,u=H(t,(function(t){return t/i}));return{delta:100*i-100,newSizes:u}}return{delta:n,newSizes:t}};return{resizeTable:o,clampTableDelta:Kc,calcLeftEdgeDeltas:n,calcMiddleDeltas:r,calcRightEdgeDeltas:i,calcRedestributedWidths:u}},Jc=function(){var t=function(t,e,n,r,o){var i=r>=0?n:e,u=Xc(t,i,r,o);return $c(t,e,n+1,[u,-u],qc)},e=function(e,n,r,o,i,u){return t(e,r,o,i,u)},n=function(t,e,n){n&&t(e)},r=function(t,e,n,r,o,i){if(i)return qc(t);var u=r/t.length;return H(t,v(u))},o=function(t,e,n,r,o){if(o){if(n>=0)return n;var i=j(t,(function(t,e){return t+e-r}),0);return Math.max(-i,n)}return Kc(t,e,n,r)},i=function(t,e,n,r){return{delta:0,newSizes:t}};return{resizeTable:n,clampTableDelta:o,calcLeftEdgeDeltas:t,calcMiddleDeltas:e,calcRightEdgeDeltas:r,calcRedestributedWidths:i}},Qc=function(t,e){var n=A.from(t.dom.documentElement).map(ve.fromDom).getOr(t);return{parent:v(n),view:v(t),origin:v(Qi(0,0)),isResizable:e}},Zc=function(t,e,n){var r=function(){return eu(e)};return{parent:v(e),view:v(t),origin:r,isResizable:n}},ts=function(t,e,n){return{parent:v(e),view:v(t),origin:v(Qi(0,0)),isResizable:n}},es={only:Qc,detached:Zc,body:ts},ns=fi.generate([{invalid:["raw"]},{pixels:["value"]},{percent:["value"]}]),rs=function(t,e,n){var r=n.substring(0,n.length-t.length),o=parseFloat(r);return r===o.toString()?e(o):ns.invalid(n)},os=function(t){return St(t,"%")?rs("%",ns.percent,t):St(t,"px")?rs("px",ns.pixels,t):ns.invalid(t)},is=ot(ot({},ns),{from:os}),us=function(t,e){return H(t,(function(t){var n=is.from(t);return n.fold((function(){return t}),(function(t){var n=t/e*100;return n+"%"}),(function(t){return t+"%"}))}))},as=function(t,e,n){var r=n/e;return H(t,(function(t){var e=is.from(t);return e.fold((function(){return t}),(function(t){return t*r+"px"}),(function(t){return t/100*n+"px"}))}))},cs=function(t,e){var n=t.fold((function(){return v("")}),(function(t){var n=t/e;return v(n+"px")}),(function(){var t=100/e;return v(t+"%")}));return L(e,n)},ss=function(t,e,n){return t.fold((function(){return e}),(function(t){return as(e,n,t)}),(function(t){return us(e,n)}))},ls=function(t,e,n){var r=is.from(n),o=X(t,(function(t){return"0px"===t}))?cs(r,t.length):ss(r,t,e);return gs(o)},fs=function(t,e){return 0===t.length?e:U(t,(function(t,e){return is.from(e).fold(v(0),b,b)+t}),0)},ds=function(t,e){var n=Math.floor(t);return{value:n+e,remainder:t-n}},ms=function(t,e){return is.from(t).fold(v(t),(function(t){return t+e+"px"}),(function(t){return t+e+"%"}))},gs=function(t){if(0===t.length)return t;var e=U(t,(function(t,e){var n=is.from(e).fold((function(){return{value:e,remainder:0}}),(function(t){return ds(t,"px")}),(function(t){return{value:t+"%",remainder:0}}));return{output:[n.value].concat(t.output),remainder:t.remainder+n.remainder}}),{output:[],remainder:0}),n=e.output;return n.slice(0,n.length-1).concat([ms(n[n.length-1],Math.round(e.remainder))])},hs=is.from,ps=function(t,e,n){I(e,(function(e){var r=t.slice(e.column,e.colspan+e.column),o=fs(r,kr());dr(e.element,"width",o+n)}))},vs=function(t,e,n){I(e,(function(e,r){var o=fs([t[r]],kr());dr(e.element,"width",o+n)}))},bs=function(t,e,n,r){I(n,(function(e){var n=t.slice(e.row,e.rowspan+e.row),o=fs(n,Tr());dr(e.element,"height",o+r)})),I(e,(function(e,n){dr(e.element,"height",t[n])}))},ys=function(t){return hs(t).fold(v("px"),v("px"),v("%"))},ws=function(t,e,n){var r=so.fromTable(t),o=r.all,i=so.justCells(r),u=so.justColumns(r);e.each((function(e){var n=ys(e),o=Hi(t),a=ra(r,t),c=ls(a,o,e);so.hasColumns(r)?vs(c,u,n):ps(c,i,n),dr(t,"width",e)})),n.each((function(e){var n=ys(e),u=Ki(t),a=ca(r,t,gu),c=ls(a,u,e);bs(c,o,i,n),dr(t,"height",e)}))},xs=qu,Cs=$u,Ss=Gu,ks=function(t){var e=so.fromTable(t);return e.grid},Ts=function(t){var e=[],n=function(t){if(void 0===t)throw new Error("Event bind error: undefined handler");e.push(t)},r=function(t){e=F(e,(function(e){return e!==t}))},o=function(){for(var n=[],r=0;r0&&zs(u,n.label),r}},Ls=function(t,e){var n=F(e,(function(e){return!N(t,e)}));n.length>0&&Ds(n)},Hs=function(t){return Ns(Ls,t)},Is=Hs(["compare","extract","mutate","sink"]),Ps=Hs(["element","start","stop","destroy"]),Vs=Hs(["forceDrop","drop","move","delayDrop"]),Fs=function(){var t=A.none(),e=function(){t=A.none()},n=function(e,n){var r=t.map((function(t){return e.compare(t,n)}));return t=A.some(n),r},r=function(t,e){var r=e.extract(t);r.each((function(t){var r=n(e,t);r.each((function(t){o.trigger.move(t)}))}))},o=Os({move:Ts(["info"])});return{onEvent:r,reset:e,events:o.registry}},Us=function(){var t=Os({move:Ts(["info"])});return{onEvent:g,reset:g,events:t.registry}},js=function(){var t=Us(),e=Fs(),n=t,r=function(){n.reset(),n=e},o=function(){n.reset(),n=t},i=function(t,e){n.onEvent(t,e)},u=function(){return n===e};return{on:r,off:o,isOn:u,onEvent:i,events:e.events}},Ws=function(t,e,n){var r=!1,o=Os({start:Ts([]),stop:Ts([])}),i=js(),u=function(){m.stop(),i.isOn()&&(i.off(),o.trigger.stop())},a=Es(u,200),c=function(t){m.start(t),i.on(),o.trigger.start()},s=function(t){a.cancel(),i.onEvent(t,e)};i.events.move.bind((function(n){e.mutate(t,n.info)}));var l=function(){r=!0},f=function(){r=!1},d=function(t){return function(){for(var e=[],n=0;n0?Yn(t,e,r.join(" ")):er(t,e),!1},rl=function(t){return void 0!==t.dom.classList},ol=function(t){return tl(t,"class")},il=function(t,e){return el(t,"class",e)},ul=function(t,e){return nl(t,"class",e)},al=function(t,e){rl(t)?t.dom.classList.add(e):il(t,e)},cl=function(t){var e=rl(t)?t.dom.classList:ol(t);0===e.length&&er(t,"class")},sl=function(t,e){if(rl(t)){var n=t.dom.classList;n.remove(e)}else ul(t,e);cl(t)},ll=function(t,e){return rl(t)&&t.dom.classList.contains(e)},fl=function(t){var e=t.replace(/\./g,"-"),n=function(t){return e+"-"+t};return{resolve:n}},dl=fl("ephox-dragster"),ml=dl.resolve,gl=function(t){var e=ot({layerClass:ml("blocker")},t),n=ve.fromTag("div");Yn(n,"role","presentation"),mr(n,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),al(n,ml("blocker")),al(n,e.layerClass);var r=v(n),o=function(){Bo(n)};return{element:r,destroy:o}},hl=function(t,e){return Qi(e.left-t.left,e.top-t.top)},pl=function(t){return A.some(Qi(t.x,t.y))},vl=function(t,e){t.mutate(e.left,e.top)},bl=function(t,e){var n=gl(e),r=Qs(n.element(),"mousedown",t.forceDrop),o=Qs(n.element(),"mouseup",t.drop),i=Qs(n.element(),"mousemove",t.move),u=Qs(n.element(),"mouseout",t.delayDrop),a=function(){n.destroy(),o.unbind(),i.unbind(),u.unbind(),r.unbind()},c=function(t){_o(t,n.element())},s=function(){Bo(n.element())};return Ps({element:n.element,start:c,stop:s,destroy:a})},yl=Is({compare:hl,extract:pl,sink:bl,mutate:vl}),wl=function(t,e){void 0===e&&(e={});var n=void 0!==e.mode?e.mode:yl;return Ws(t,n,e)},xl=function(t){return Kn(t,"[contenteditable]")},Cl=function(t,e){return void 0===e&&(e=!1),!oe().browser.isIE()&&Mn(t)?t.dom.isContentEditable:xl(t).fold(v(e),(function(t){return"true"===Sl(t)}))},Sl=function(t){return t.dom.contentEditable},kl=fl("ephox-snooker"),Tl=kl.resolve,Ol=function(){var t=Os({drag:Ts(["xDelta","yDelta"])}),e=function(e,n){t.trigger.drag(e,n)};return{mutate:e,events:t.registry}},El=function(){var t=Os({drag:Ts(["xDelta","yDelta","target"])}),e=A.none(),n=Ol();n.events.drag.bind((function(n){e.each((function(e){t.trigger.drag(n.xDelta,n.yDelta,e)}))}));var r=function(t){e=A.some(t)},o=function(){return e};return{assign:r,get:o,mutate:n.mutate,events:t.registry}},_l=function(t,e,n,r,o){var i=ve.fromTag("div");return mr(i,{position:"absolute",left:e-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),Jn(i,{"data-column":t,role:"presentation"}),i},Al=function(t,e,n,r,o){var i=ve.fromTag("div");return mr(i,{position:"absolute",left:e+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),Jn(i,{"data-row":t,role:"presentation"}),i},Dl=Tl("resizer-bar"),Ml=Tl("resizer-rows"),zl=Tl("resizer-cols"),Rl=7,Nl=function(t,e){return K(t.all,(function(t,n){return e(t.element)?[n]:[]}))},Bl=function(t,e){var n=[];return L(t.grid.columns,(function(r){var o=so.getColumnAt(t,r).map((function(t){return t.element}));o.forall(e)&&n.push(r)})),F(n,(function(n){var r=so.filterItems(t,(function(t){return t.column===n}));return X(r,(function(t){return e(t.element)}))}))},Ll=function(t){var e=Pn(t.parent(),"."+Dl);I(e,Bo)},Hl=function(t,e,n){var r=t.origin();I(e,(function(e){e.each((function(e){var o=n(r,e);al(o,Dl),_o(t.parent(),o)}))}))},Il=function(t,e,n,r){Hl(t,e,(function(t,e){var o=_l(e.col,e.x-t.left,n.top-t.top,Rl,r);return al(o,zl),o}))},Pl=function(t,e,n,r){Hl(t,e,(function(t,e){var o=Al(e.row,n.left-t.left,e.y-t.top,r,Rl);return al(o,Ml),o}))},Vl=function(t,e,n,r,o){var i=eu(n),u=e.isResizable,a=r.length>0?gu.positions(r,n):[],c=a.length>0?Nl(t,u):[],s=F(a,(function(t,e){return B(c,(function(t){return e===t}))}));Pl(e,s,i,Ii(n));var l=o.length>0?bu.positions(o,n):[],f=l.length>0?Bl(t,u):[],d=F(l,(function(t,e){return B(f,(function(t){return e===t}))}));Il(e,d,i,Xi(n))},Fl=function(t,e){if(Ll(t),t.isResizable(e)){var n=so.fromTable(e),r=ji(n),o=Fi(n);Vl(n,t,e,r,o)}},Ul=function(t,e){var n=Pn(t.parent(),"."+Dl);I(n,e)},jl=function(t){Ul(t,(function(t){dr(t,"display","none")}))},Wl=function(t){Ul(t,(function(t){dr(t,"display","block")}))},ql=function(t){return ll(t,Ml)},$l=function(t){return ll(t,zl)},Gl=Tl("resizer-bar-dragging"),Kl=function(t){var e=El(),n=wl(e,{}),r=A.none(),o=function(t,e){return A.from(Zn(t,e))};e.events.drag.bind((function(t){o(t.target,"data-row").each((function(e){var n=Sr(t.target,"top");dr(t.target,"top",n+t.yDelta+"px")})),o(t.target,"data-column").each((function(e){var n=Sr(t.target,"left");dr(t.target,"left",n+t.xDelta+"px")}))}));var i=function(t,e){var n=Sr(t,e),r=yr(t,"data-initial-"+e,0);return n-r};n.events.stop.bind((function(){e.get().each((function(e){r.each((function(n){o(e,"data-row").each((function(t){var r=i(e,"top");er(e,"data-initial-top"),m.trigger.adjustHeight(n,r,parseInt(t,10))})),o(e,"data-column").each((function(t){var r=i(e,"left");er(e,"data-initial-left"),m.trigger.adjustWidth(n,r,parseInt(t,10))})),Fl(t,n)}))}))}));var u=function(r,o){m.trigger.startAdjust(),e.assign(r),Yn(r,"data-initial-"+o,Sr(r,o)),al(r,Gl),dr(r,"opacity","0.2"),n.go(t.parent())},a=Qs(t.parent(),"mousedown",(function(t){ql(t.target)&&u(t.target,"top"),$l(t.target)&&u(t.target,"left")})),c=function(e){return Ce(e,t.view())},s=function(t){return Kn(t,"table",c).filter(Cl)},l=Qs(t.view(),"mouseover",(function(e){s(e.target).fold((function(){Mn(e.target)&&Ll(t)}),(function(e){r=A.some(e),Fl(t,e)}))})),f=function(){a.unbind(),l.unbind(),n.destroy(),Ll(t)},d=function(e){Fl(t,e)},m=Os({adjustHeight:Ts(["table","delta","row"]),adjustWidth:Ts(["table","delta","column"]),startAdjust:Ts([])});return{destroy:f,refresh:d,on:n.on,off:n.off,hideBars:w(jl,t),showBars:w(Wl,t),events:m.registry}},Xl=function(t,e,n){var r=gu,o=bu,i=Kl(t),u=Os({beforeResize:Ts(["table","type"]),afterResize:Ts(["table","type"]),startDrag:Ts([])});return i.events.adjustHeight.bind((function(t){var e=t.table;u.trigger.beforeResize(e,"row");var n=r.delta(t.delta,e);Uc(e,n,t.row,r),u.trigger.afterResize(e,"row")})),i.events.startAdjust.bind((function(t){u.trigger.startDrag()})),i.events.adjustWidth.bind((function(t){var r=t.table;u.trigger.beforeResize(r,"col");var i=o.delta(t.delta,r),a=n(r);Fc(r,i,t.column,e,a),u.trigger.afterResize(r,"col")})),{on:i.on,off:i.off,hideBars:i.hideBars,showBars:i.showBars,destroy:i.destroy,events:u.registry}},Yl={create:Xl},Jl=function(t,e){return t.fire("newrow",{node:e})},Ql=function(t,e){return t.fire("newcell",{node:e})},Zl=function(t,e,n,r,o){t.fire("ObjectResizeStart",{target:e,width:n,height:r,origin:o})},tf=function(t,e,n,r,o){t.fire("ObjectResized",{target:e,width:n,height:r,origin:o})},ef=function(t,e,n,r,o){t.fire("TableSelectionChange",{cells:e,start:n,finish:r,otherCells:o})},nf=function(t){t.fire("TableSelectionClear")},rf=function(t,e,n){t.fire("TableModified",ot(ot({},n),{table:e}))},of={structure:!1,style:!0},uf={structure:!0,style:!1},af={structure:!0,style:!0},cf="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol",sf={"border-collapse":"collapse",width:"100%"},lf=L(5,(function(t){var e=t+1+"px";return{title:e,value:e}})),ff=H(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],(function(t){return{title:t,value:t.toLowerCase()}})),df=function(t){var e;if(Rf(t)){var n=t.dom,r=null!==(e=n.getParent(t.selection.getStart(),n.isBlock))&&void 0!==e?e:t.getBody(),o=Pi(ve.fromDom(r));return ot(ot({},sf),{width:o+"px"})}return Nf(t)?Ne(sf,(function(t,e){return"width"!==e})):sf},mf={border:"1"},gf="preservetable",hf=function(t){return t.getParam("table_sizing_mode","auto")},pf=function(t){return t.getParam("table_responsive_width")},vf=function(t){return t.getParam("table_border_widths",lf,"array")},bf=function(t){return t.getParam("table_border_styles",ff,"array")},yf=function(t){return t.getParam("table_default_attributes",mf,"object")},wf=function(t){return t.getParam("table_default_styles",df(t),"object")},xf=function(t){return t.getParam("table_resize_bars",!0,"boolean")},Cf=function(t){return t.getParam("table_tab_navigation",!0,"boolean")},Sf=function(t){return t.getParam("table_cell_advtab",!0,"boolean")},kf=function(t){return t.getParam("table_row_advtab",!0,"boolean")},Tf=function(t){return t.getParam("table_advtab",!0,"boolean")},Of=function(t){return t.getParam("table_appearance_options",!0,"boolean")},Ef=function(t){return t.getParam("table_grid",!0,"boolean")},_f=function(t){return t.getParam("table_style_by_css",!1,"boolean")},Af=function(t){return t.getParam("table_cell_class_list",[],"array")},Df=function(t){return t.getParam("table_row_class_list",[],"array")},Mf=function(t){return t.getParam("table_class_list",[],"array")},zf=function(t){return"relative"===hf(t)||!0===pf(t)},Rf=function(t){return"fixed"===hf(t)||!1===pf(t)},Nf=function(t){return"responsive"===hf(t)},Bf=function(t){return t.getParam("table_toolbar",cf)},Lf=function(t){return t.getParam("table_use_colgroups",!1,"boolean")},Hf=function(t){var e="section",n=t.getParam("table_header_type",e,"string"),r=["section","cells","sectionCells","auto"];return N(r,n)?n:e},If=function(t){var e=["preservetable","resizetable"],n=t.getParam("table_column_resizing",gf,"string");return q(e,(function(t){return t===n})).getOr(gf)},Pf=function(t){return"preservetable"===If(t)},Vf=function(t){return"resizetable"===If(t)},Ff=function(t){var e=t.getParam("table_clone_elements");return o(e)?A.some(e.split(/[ ,]/)):Array.isArray(e)?A.some(e):A.none()},Uf=function(t){var e=t.getParam("object_resizing",!0);return o(e)?"table"===e:e},jf=function(t){return t.getParam("table_background_color_map",[],"array")},Wf=function(t){return t.getParam("table_border_color_map",[],"array")},qf=function(t,e){return zf(t)?ha.percentageSize(e):Rf(t)?ha.pixelSize(e):ha.getTableSize(e)},$f=function(t){er(t,"width")},Gf=function(t){var e=Wu(t);ws(t,A.some(e),A.none()),$f(t)},Kf=function(t){var e=ju(t);ws(t,A.some(e),A.none()),$f(t)},Xf=function(t){vr(t,"width");var e=Mr(t),n=e.length>0?e:Dr(t);I(n,(function(t){vr(t,"width"),$f(t)})),$f(t)},Yf=Gf,Jf=Kf,Qf=Xf,Zf=function(t){var e=so.fromTable(t);so.hasColumns(e)||I(Dr(t),(function(t){var e=gr(t,"width");dr(t,"width",e),er(t,"width")}))},td=function(){var t=ve.fromTag("div");return mr(t,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),_o(zn(),t),t},ed=function(t,e){return t.inline?es.body(qa(t),td(),e):es.only(ve.fromDom(t.getDoc()),e)},nd=function(t,e){t.inline&&Bo(e.parent())},rd="bar-",od=function(t){return"false"!==Zn(t,"data-mce-resize")},id=function(t){var e,n,r=A.none(),o=A.none(),i=A.none(),u=function(t){return"TABLE"===t.nodeName},a=function(){return o},c=function(){return i.getOr(es.only(ve.fromDom(t.getBody()),od))},s=function(e){return qf(t,e)},l=function(){return Pf(t)?Jc():Yc()},f=function(t){return ks(t).columns},d=function(r,o,i){var u=St(o,"e");if(""===n&&Yf(r),i!==e&&""!==n){dr(r,"width",n);var a=l(),c=s(r),d=Pf(t)||u?f(r)-1:0;Fc(r,i-e,d,a,c)}else if(Za(n)){var m=parseFloat(n.replace("%","")),g=i*m/e;dr(r,"width",g+"%")}tc(n)&&Zf(r)},m=function(){o.each((function(t){t.destroy()})),i.each((function(e){nd(t,e)}))};return t.on("init",(function(){var e=ed(t,od);if(i=A.some(e),Uf(t)&&xf(t)){var n=l(),u=Yl.create(e,n,s);u.on(),u.events.startDrag.bind((function(e){r=A.some(t.selection.getRng())})),u.events.beforeResize.bind((function(e){var n=e.table.dom;Zl(t,n,$a(n),Ga(n),rd+e.type)})),u.events.afterResize.bind((function(e){var n=e.table,o=n.dom;Ja(n),r.each((function(e){t.selection.setRng(e),t.focus()})),tf(t,o,$a(o),Ga(o),rd+e.type),t.undoManager.add()})),o=A.some(u)}})),t.on("ObjectResizeStart",(function(r){var o=r.target;if(u(o)){var i=ve.fromDom(o);I(t.dom.select(".mce-clonedresizable"),(function(e){t.dom.addClass(e,"mce-"+If(t)+"-columns")})),!Cs(i)&&Rf(t)?Jf(i):!xs(i)&&zf(t)&&Yf(i),Ss(i)&&Ct(r.origin,rd)&&Yf(i),e=r.width,n=Nf(t)?"":Qa(t,o).getOr("")}})),t.on("ObjectResized",(function(e){var n=e.target;if(u(n)){var r=ve.fromDom(n),o=e.origin;Ct(o,"corner-")&&d(r,o,e.width),Ja(r),rf(t,r.dom,of)}})),t.on("SwitchMode",(function(){a().each((function(e){t.mode.isReadOnly()?e.hideBars():e.showBars()}))})),{lazyResize:a,lazyWire:c,destroy:m}},ud=function(t,e){return{element:t,offset:e}},ad=function(t,e,n){return t.property().isText(e)&&0===t.property().getText(e).trim().length||t.property().isComment(e)?n(e).bind((function(e){return ad(t,e,n).orThunk((function(){return A.some(e)}))})):A.none()},cd=function(t,e){if(t.property().isText(e))return t.property().getText(e).length;var n=t.property().children(e);return n.length},sd=function(t,e){var n=ad(t,e,t.query().prevSibling).getOr(e);if(t.property().isText(n))return ud(n,cd(t,n));var r=t.property().children(n);return r.length>0?sd(t,r[r.length-1]):ud(n,cd(t,n))},ld=sd,fd=jo(),dd=function(t){return ld(fd,t)},md=function(t,e){var n=wr(t,"colspan");if(1===n){var r=Fu(t);r.each((function(n){var r=n.value/2;Uu(t,r,n.unit),Uu(e,r,n.unit)}))}},gd=fn("th"),hd=function(t){return X(t,(function(t){return gd(t.element)}))},pd=function(t,e){return t&&e?"sectionCells":t?"section":"cells"},vd=function(t){var e="thead"===t.section,n=rr(bd(t.cells),"th");return e||n?{type:"header",subType:pd(e,n)}:"tfoot"===t.section?{type:"footer"}:{type:"body"}},bd=function(t){var e=F(t,(function(t){return gd(t.element)}));return 0===e.length?A.some("td"):e.length===t.length?A.some("th"):A.none()},yd=function(t){var e=H(t,(function(t){return vd(t).type})),n=N(e,"header"),r=N(e,"footer");if(n||r){var o=N(e,"body");return!n||o||r?n||o||!r?A.none():A.some("footer"):A.some("header")}return A.some("body")},wd=function(t){return rt(t.all,(function(t){var e=vd(t);return"header"===e.type?A.from(e.subType):A.none()}))},xd=function(t,e,n){return Je(n(t.element,e),!0,t.isLocked)},Cd=function(t,e){return t.section!==e?Qe(t.element,t.cells,e,t.isNew):t},Sd=function(){return{transformRow:Cd,transformCell:function(t,e,n){var r=n(t.element,e),o="td"!==nn(r)?ki(r,"td"):r;return Je(o,t.isNew,t.isLocked)}}},kd=function(){return{transformRow:Cd,transformCell:xd}},Td=function(){return{transformRow:function(t,e){var n="thead"===e?"tbody":e;return Cd(t,n)},transformCell:xd}},Od=function(){return{transformRow:b,transformCell:xd}},Ed=function(t,e){var n=so.fromTable(t),r=wd(n).getOr(e);switch(r){case"section":return Sd();case"sectionCells":return kd();case"cells":return Td()}},_d={getTableSectionType:Ed,section:Sd,sectionCells:kd,cells:Td,fallback:Od},Ad=function(t,e,n,r){n===r?er(t,e):Yn(t,e,n)},Dd=function(t,e,n){nt(In(t,e)).fold((function(){return Eo(t,n)}),(function(t){return Oo(t,n)}))},Md=function(t,e){var n=$n(t,e).getOrThunk((function(){var n=ve.fromTag(e,dn(t).dom);return"thead"===e?Dd(t,"caption,colgroup",n):"colgroup"===e?Dd(t,"caption",n):_o(t,n),n}));return No(n),n},zd=function(t,e){var n=[],r=[],o=function(t){return H(t,(function(t){t.isNew&&n.push(t.element);var e=t.element;return No(e),I(t.cells,(function(t){t.isNew&&r.push(t.element),Ad(t.element,"colspan",t.colspan,1),Ad(t.element,"rowspan",t.rowspan,1),_o(e,t.element)})),e}))},i=function(t){return K(t,(function(t){return H(t.cells,(function(t){return Ad(t.element,"span",t.colspan,1),t.element}))}))},u=function(e,n){var r=Md(t,n),u="colgroup"===n?i:o,a=u(e);Ro(r,a)},a=function(e){$n(t,e).each(Bo)},c=function(t,e){t.length>0?u(t,e):a(e)},s=[],l=[],f=[],d=[];return I(e,(function(t){switch(t.section){case"thead":s.push(t);break;case"tbody":l.push(t);break;case"tfoot":f.push(t);break;case"colgroup":d.push(t);break}})),c(d,"colgroup"),c(s,"thead"),c(l,"tbody"),c(f,"tfoot"),{newRows:n,newCells:r}},Rd=function(t){return H(t,(function(t){var e=wi(t.element);return I(t.cells,(function(t){var n=xi(t.element);Ad(n,"colspan",t.colspan,1),Ad(n,"rowspan",t.rowspan,1),_o(e,n)})),e}))},Nd=function(t,e){return H(t,(function(t){return Wr(t,e)}))},Bd=function(t,e){return t[e]},Ld=function(t,e){if(0===t.length)return 0;var n=t[0],r=$(t,(function(t){return!e(n.element,t.element)}));return r.getOr(t.length)},Hd=function(t,e,n,r){var o=Bd(t,e),i="colgroup"===o.section,u=Ld(o.cells.slice(n),r),a=i?1:Ld(Nd(t.slice(e),n),r);return{colspan:u,rowspan:a}},Id=function(t,e){var n=H(t,(function(t){return H(t.cells,S)})),r=function(t,e,r,o){for(var i=t;i0,o)},Wd=function(t,e,n,r,o){return function(i,u,a,c,s){var l=so.fromTable(u),f=A.from(null===s||void 0===s?void 0:s.section).getOrThunk(_d.fallback),d=e(l,a).map((function(e){var n=Vd(l,c),r=t(n,e,Ce,o(c),f),i=Jr(r.grid),u=Fd(r.grid);return{info:e,grid:u,cursor:r.cursor,lockedColumns:i}}));return d.bind((function(t){var e=zd(u,t.grid),o=A.from(null===s||void 0===s?void 0:s.sizing).getOrThunk((function(){return ha.getTableSize(u)})),a=A.from(null===s||void 0===s?void 0:s.resize).getOrThunk(Jc);return n(u,t.grid,t.info,{sizing:o,resize:a,section:f}),r(u),Fl(i,u),er(u,Xr),t.lockedColumns.length>0&&Yn(u,Xr,t.lockedColumns.join(",")),A.some({cursor:t.cursor,newRows:e.newRows,newCells:e.newCells})}))}},qd=function(t,e){return Ar(e.element).bind((function(n){return Ud(t,n).map((function(t){var n=ot(ot({},t),{generators:e.generators,clipboard:e.clipboard});return n}))}))},$d=function(t,e){return jd(t,e,k).map((function(t){return{cells:t,generators:e.generators,clipboard:e.clipboard}}))},Gd=function(t,e){return e.mergable},Kd=function(t,e){return e.unmergable},Xd=function(t,e){return jd(t,e,k)},Yd=function(t,e){return jd(t,e,(function(t){return!t.isLocked}))},Jd=function(t,e){return Ud(t,e).exists((function(t){return!t.isLocked}))},Qd=function(t,e){return X(e,(function(e){return Jd(t,e)}))},Zd=function(t,e){return Gd(t,e).filter((function(e){return Qd(t,e.cells)}))},tm=function(t,e){return Kd(t,e).filter((function(e){return Qd(t,e)}))},em=function(t,e,n,r){var o=Gr(t).rows;if(0===o.length)return t;for(var i=e.startRow;i<=e.finishRow;i++)for(var u=e.startCol;u<=e.finishCol;u++){var a=o[i],c=Wr(a,u).isLocked;Fr(a,u,Je(r(),!1,c))}return t},nm=function(t,e,n,r){for(var o=Gr(t).rows,i=!0,u=0;u0&&e0&&e=e.length||t.column>$r(e[0]))return sm.error("invalid start address out of table bounds, row: "+t.row+", column: "+t.column);var r=e.slice(t.row),o=r[0].cells.slice(t.column),i=$r(n[0]),u=n.length;return sm.value({rowDelta:r.length-u,colDelta:o.length-i})},fm=function(t,e){var n=$r(t[0]),r=$r(e[0]);return{rowDelta:0,colDelta:n-r}},dm=function(t,e){var n=t.length,r=e.length;return{rowDelta:n-r,colDelta:0}},mm=function(t,e,n,r){var o="colgroup"===e.section?n.col:n.cell;return L(t,(function(t){return Je(o(),!0,r(t))}))},gm=function(t,e,n,r){var o=t[t.length-1];return t.concat(L(e,(function(){var t="colgroup"===o.section?n.colgroup:n.row,e=Kr(o,t,b),i=mm(e.cells.length,e,n,(function(t){return Pe(r,t.toString())}));return Ur(e,i)})))},hm=function(t,e,n,r){return H(t,(function(t){var o=mm(e,t,n,S);return Pr(t,r,o)}))},pm=function(t,e,n){return H(t,(function(t){return j(n,(function(n,r){var o=mm(1,t,e,k)[0];return Vr(n,r,o)}),t)}))},vm=function(t,e,n){var r=e.colDelta<0?hm:b,o=e.rowDelta<0?gm:b,i=Jr(t),u=$r(t[0]),a=B(i,(function(t){return t===u-1})),c=r(t,Math.abs(e.colDelta),n,a?u-1:u),s=Jr(c);return o(c,Math.abs(e.rowDelta),n,J(s,k))},bm=function(t,e,n,r){var o=Wr(t[e],n),i=w(r,o.element),u=t[e];return t.length>1&&$r(u)>1&&(n>0&&i(qr(u,n-1))||n0&&i(qr(t[e-1],n))||e=t.column&&n<=$r(e[0])+t.column}))},Cm=function(t,e,n,r,o){var i=Jr(e),u=wm(t,e,i),a=Gr(n).rows,c=xm(u,a,i),s=lm(u,e,a);return s.map((function(t){var n=ot(ot({},t),{colDelta:t.colDelta-c.length}),i=vm(e,n,r),s=Jr(i),l=xm(u,a,s);return ym(u,i,a,r,o,l)}))},Sm=function(t,e,n,r,o){om(e,t,o,r.cell);var i=dm(n,e),u=vm(n,i,r),a=dm(e,u),c=vm(e,a,r);return H(c,(function(e,n){return Pr(e,t,u[n].cells)}))},km=function(t,e,n,r,o){im(e,t,o,r.cell);var i=Jr(e),u=fm(e,n),a=ot(ot({},u),{colDelta:u.colDelta-i.length}),c=vm(e,a,r),s=Gr(c),l=s.cols,f=s.rows,d=Jr(c),m=fm(n,e),g=ot(ot({},m),{colDelta:m.colDelta+d.length}),h=pm(n,r,d),p=vm(h,g,r);return l.concat(f.slice(0,t)).concat(p).concat(f.slice(t,f.length))},Tm=function(t,e,n,r){return Kr(t,(function(t){return r(t,n)}),e)},Om=function(t,e,n,r,o){var i=Gr(t),u=i.rows,a=i.cols,c=u.slice(0,e),s=u.slice(e),l=Tm(u[n],(function(t,n){var i=e>0&&e0&&e<$r(t)&&r(qr(t,e-1),qr(t,e)),u=Em(t,e,t.section,i,n,r,o);return Vr(t,e,u)}))},Am=function(t,e){return K(t,(function(t){var n=t.cells,r=U(e,(function(t,e){return e>=0&&e0?[Qe(t.element,r,t.section,t.isNew)]:[]}))},Dm=function(t,e,n){var r=Gr(t),o=r.rows,i=r.cols;return i.concat(o.slice(0,e)).concat(o.slice(n+1))},Mm=function(t,e,n,r){return void 0!==qr(t[e],n)&&e>0&&r(qr(t[e-1],n),qr(t[e],n))},zm=function(t,e,n){return e>0&&n(qr(t,e-1),qr(t,e))},Rm=function(t,e,n,r){return Mm(t,e,n,r)||zm(t[e],n,r)},Nm=function(t,e){var n=X(e,b)&&hd(t.cells);return n?k:function(t,n,r){var o=nn(t.element);return!("th"===o&&e[r])}},Bm=function(t,e){var n=X(e,b)&&hd(t);return n?k:function(t,n,r){var o=nn(t.element);return!("th"===o&&e[n])}},Lm=function(t,e,n,r){var o=function(t){return"row"===t?Cr(e):xr(e)},i=function(t){return o(t)?t+"group":t};if(t)return gd(e)?i(n):null;if(r&&gd(e)){var u="row"===n?"col":"row";return i(u)}return null},Hm=function(t,e){return function(n,r,o){return A.some(Lm(t,n.element,"col",e[o]))}},Im=function(t,e){return function(n,r){return A.some(Lm(t,n.element,"row",e[r]))}},Pm=function(t,e,n){return Je(n(t.element,e),!0,t.isLocked)},Vm=function(t,e,n,r,o,i,u){var a=function(t){return B(e,(function(e){return n(t.element,e.element)}))};return H(t,(function(t,e){return jr(t,(function(t,c){if(a(t)){var s=u(t,e,c)?o(t,n,r):t;return i(s,e,c).each((function(t){Qn(s.element,{scope:A.from(t)})})),s}return t}))}))},Fm=function(t,e,n){return K(t,(function(r,o){return Rm(t,o,e,n)?[]:[Wr(r,e)]}))},Um=function(t,e,n){var r=t[e];return K(r.cells,(function(r,o){return Rm(t,e,o,n)?[]:[r]}))},jm=function(t,e,n,r,o){var i=Gr(t).rows,u=K(e,(function(t){return Fm(i,t,r)})),a=H(t,(function(t){return hd(t.cells)})),c=Bm(u,a),s=Im(n,a);return Vm(t,u,r,o,Pm,s,c)},Wm=function(t,e,n,r,o,i,u){var a=Gr(t),c=a.cols,s=a.rows,l=s[e[0]],f=K(e,(function(t){return Um(s,t,o)})),d=H(l.cells,(function(t,e){return hd(Fm(s,e,o))})),m=it([],s,!0);I(e,(function(t){m[t]=u.transformRow(s[t],n)}));var g=c.concat(m),h=Nm(l,d),p=Hm(r,d);return Vm(g,f,o,i,u.transformCell,p,h)},qm=function(t,e,n,r){var o=Gr(t).rows,i=H(e,(function(t){return Wr(o[t.row],t.column)}));return Vm(t,i,n,r,Pm,A.none,k)},$m=function(t){var e=function(t,e){var n=B(t,(function(t){return t.column===e.column}));return n?t:t.concat([e])};return j(t,e,[]).sort((function(t,e){return t.column-e.column}))},Gm=fn("col"),Km=fn("colgroup"),Xm=function(t){return"tr"===nn(t)||Km(t)},Ym=function(t){var e=yr(t,"colspan",1),n=yr(t,"rowspan",1);return{element:t,colspan:e,rowspan:n}},Jm=function(t,e){void 0===e&&(e=Ym);var n=function(e){return Gm(e.element)?t.col(e):t.cell(e)},r=function(e){return Km(e.element)?t.colgroup(e):t.row(e)},o=function(t){if(Xm(t))return r({element:t});var o=n(e(t));return i=A.some({item:t,replacement:o}),o},i=A.none(),u=function(t,e){return i.fold((function(){return o(t)}),(function(n){return e(t,n.item)?n.replacement:o(t)}))};return{getOrInit:u}},Qm=function(t){return function(e){var n=[],r=function(t,e){return q(n,(function(n){return e(n.item,t)}))},o=function(r){var o="td"===t?{scope:null}:{},i=e.replace(r,t,o);return n.push({item:r,sub:i}),i},i=function(t,e){return Xm(t)||Gm(t)?t:r(t,e).fold((function(){return o(t)}),(function(n){return e(t,n.item)?n.sub:o(t)}))};return{replaceOrInit:i}}},Zm=function(t){return tr(t,"scope").map((function(t){return t.substr(0,3)}))},tg=function(t){var e=function(e){var n=Zm(e);return n.each((function(t){return Yn(e,"scope",t)})),function(){var r=t.cell({element:e,colspan:1,rowspan:1});return vr(r,"width"),vr(e,"width"),n.each((function(t){return Yn(r,"scope",t)})),r}},n=function(t){var e=function(){var e=or(H(t,Zm));if(0===e.length)return A.none();var n=e[0],r=["row","col"],o=B(e,(function(t){return t!==n&&N(r,t)}));return o?A.none():A.from(n)};return vr(t[0],"width"),e().fold((function(){return er(t[0],"scope")}),(function(e){return Yn(t[0],"scope",e+"group")})),v(t[0])};return{unmerge:e,merge:n}},eg={modification:Jm,transform:Qm,merging:tg},ng=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],rg=function(t,e){var n=t.property().name(e);return N(["ol","ul"],n)},og=function(t,e){var n=t.property().name(e);return N(ng,n)},ig=function(t,e){return N(["br","img","hr","input"],t.property().name(e))},ug=jo(),ag=function(t){return og(ug,t)},cg=function(t){return rg(ug,t)},sg=function(t){return ig(ug,t)},lg=function(t){var e=function(t){return"br"===nn(t)},n=function(t){return X(t,(function(t){return e(t)||cn(t)&&0===Po(t).trim().length}))},r=function(t){return"li"===nn(t)||Fn(t,cg).isSome()},o=function(t){return yn(t).map((function(t){return!!ag(t)||!!sg(t)&&"img"!==nn(t)})).getOr(!1)},i=function(t){return Aa(t).bind((function(n){var i=o(n);return hn(n).map((function(o){return!0===i||r(o)||e(n)||ag(o)&&!Ce(t,o)?[]:[ve.fromTag("br")]}))})).getOr([])},u=function(){var e=K(t,(function(t){var e=wn(t);return n(e)?[]:e.concat(i(t))}));return 0===e.length?[ve.fromTag("br")]:e},a=u();No(t[0]),Ro(t[0],a)},fg=function(t){return Cl(t,!0)},dg=function(t){var e=Dr(t);0===e.length&&Bo(t)},mg=function(t,e){return{grid:t,cursor:e}},gg=function(t){return rt(t,(function(t){return rt(t.cells,(function(t){var e=t.element;return cr(fg(e),e)}))}))},hg=function(t,e,n){var r,o,i=Gr(t).rows;return A.from(null===(o=null===(r=i[e])||void 0===r?void 0:r.cells[n])||void 0===o?void 0:o.element).filter(fg).orThunk((function(){return gg(i)}))},pg=function(t,e,n){var r=hg(t,e,n);return mg(t,r)},vg=function(t){var e=function(t,e){var n=B(t,(function(t){return t.row===e.row}));return n?t:t.concat([e])};return j(t,e,[]).sort((function(t,e){return t.row-e.row}))},bg=function(t,e,n,r){var o=e[0].row,i=vg(e),u=U(i,(function(t,e){var i=Om(t.grid,o,e.row+t.delta,n,r.getOrInit);return{grid:i,delta:t.delta+1}}),{grid:t,delta:0}).grid;return pg(u,o,e[0].column)},yg=function(t,e,n,r){var o=vg(e),i=o[o.length-1],u=i.row+i.rowspan,a=U(o,(function(t,e){return Om(t,u,e.row,n,r.getOrInit)}),t);return pg(a,u,e[0].column)},wg=function(t,e,n,r){var o=e.details,i=$m(o),u=i[0].column,a=U(i,(function(t,e){var o=_m(t.grid,u,e.column+t.delta,n,r.getOrInit);return{grid:o,delta:t.delta+1}}),{grid:t,delta:0}).grid;return pg(a,o[0].row,u)},xg=function(t,e,n,r){var o=e.details,i=o[o.length-1],u=i.column+i.colspan,a=$m(o),c=U(a,(function(t,e){return _m(t,u,e.column,n,r.getOrInit)}),t);return pg(c,o[0].row,u)},Cg=function(t,e,n,r){var o=$m(e),i=H(o,(function(t){return t.column})),u=jm(t,i,!0,n,r.replaceOrInit);return pg(u,e[0].row,e[0].column)},Sg=function(t,e,n,r){var o=qm(t,e,n,r.replaceOrInit);return pg(o,e[0].row,e[0].column)},kg=function(t,e,n,r){var o=$m(e),i=H(o,(function(t){return t.column})),u=jm(t,i,!1,n,r.replaceOrInit);return pg(u,e[0].row,e[0].column)},Tg=function(t,e,n,r){var o=qm(t,e,n,r.replaceOrInit);return pg(o,e[0].row,e[0].column)},Og=function(t,e){return function(n,r,o,i,u){var a=vg(r),c=H(a,(function(t){return t.row})),s=Wm(n,c,t,e,o,i.replaceOrInit,u);return pg(s,r[0].row,r[0].column)}},Eg=Og("thead",!0),_g=Og("tbody",!1),Ag=Og("tfoot",!1),Dg=function(t,e,n,r){var o=$m(e.details),i=Am(t,H(o,(function(t){return t.column}))),u=i.length>0?i[0].cells.length-1:0;return pg(i,o[0].row,Math.min(o[0].column,u))},Mg=function(t,e,n,r){var o=vg(e),i=Dm(t,o[0].row,o[o.length-1].row),u=i.length>0?i.length-1:0;return pg(i,Math.min(e[0].row,u),e[0].column)},zg=function(t,e,n,r){var o=e.cells;lg(o);var i=em(t,e.bounds,n,r.merge(o));return mg(i,A.from(o[0]))},Rg=function(t,e,n,r){var o=function(t,e){return nm(t,e,n,r.unmerge(e))},i=U(e,o,t);return mg(i,A.from(e[0]))},Ng=function(t,e,n,r){var o=function(t,e){var n=so.fromTable(t);return Pd(n,e,!0)},i=o(e.clipboard,e.generators),u=qe(e.row,e.column),a=Cm(u,t,i,e.generators,n);return a.fold((function(){return mg(t,A.some(e.element))}),(function(t){return pg(t,e.row,e.column)}))},Bg=function(t,e,n){var r=Ir(t,n.section),o=so.generate(r);return Pd(o,e,!0)},Lg=function(t,e,n,r){var o=Gr(t).rows,i=e.cells[0].column,u=o[e.cells[0].row],a=Bg(e.clipboard,e.generators,u),c=Sm(i,t,a,e.generators,n);return pg(c,e.cells[0].row,e.cells[0].column)},Hg=function(t,e,n,r){var o=Gr(t).rows,i=e.cells[e.cells.length-1].column+e.cells[e.cells.length-1].colspan,u=o[e.cells[0].row],a=Bg(e.clipboard,e.generators,u),c=Sm(i,t,a,e.generators,n);return pg(c,e.cells[0].row,e.cells[0].column)},Ig=function(t,e,n,r){var o=Gr(t).rows,i=e.cells[0].row,u=o[i],a=Bg(e.clipboard,e.generators,u),c=km(i,t,a,e.generators,n);return pg(c,e.cells[0].row,e.cells[0].column)},Pg=function(t,e,n,r){var o=Gr(t).rows,i=e.cells[e.cells.length-1].row+e.cells[e.cells.length-1].rowspan,u=o[e.cells[0].row],a=Bg(e.clipboard,e.generators,u),c=km(i,t,a,e.generators,n);return pg(c,e.cells[0].row,e.cells[0].column)},Vg=function(t,e){var n=so.fromTable(t),r=Xd(n,e);return r.bind((function(t){var e=t[t.length-1],r=t[0].column,o=e.column+e.colspan,i=G(H(n.all,(function(t){return F(t.cells,(function(t){return t.column>=r&&t.column=t.grid.columns&&e.isLocked}))},Gg=function(t,e){var n=Fi(t),r=$m(e);return j(r,(function(t,e){var r=n[e.column],o=r.map(Ii).getOr(0);return t+o}),0)},Kg=function(t){return function(e,n){return Xd(e,n).filter((function(n){var r=t?qg:$g;return!r(e,n)})).map((function(t){return{details:t,pixelDelta:Gg(e,t)}}))}},Xg=function(t,e){return Yd(t,e).map((function(e){return{details:e,pixelDelta:-Gg(t,e)}}))},Yg=function(t){return function(e,n){return $d(e,n).filter((function(n){var r=t?qg:$g;return!r(e,n.cells)}))}},Jg=eg.transform("th"),Qg=eg.transform("td"),Zg=Wd(bg,Xd,g,g,eg.modification),th=Wd(yg,Xd,g,g,eg.modification),eh=Wd(wg,Kg(!0),Wg,g,eg.modification),nh=Wd(xg,Kg(!1),Wg,g,eg.modification),rh=Wd(Dg,Xg,Wg,dg,eg.modification),oh=Wd(Mg,Xd,g,dg,eg.modification),ih=Wd(Cg,Yd,g,g,Jg),uh=Wd(kg,Yd,g,g,Qg),ah=Wd(Eg,Yd,g,g,Jg),ch=Wd(_g,Yd,g,g,Qg),sh=Wd(Ag,Yd,g,g,Qg),lh=Wd(Sg,Yd,g,g,Jg),fh=Wd(Tg,Yd,g,g,Qg),dh=Wd(zg,Zd,jg,g,eg.merging),mh=Wd(Rg,tm,jg,g,eg.merging),gh=Wd(Ng,qd,jg,g,eg.modification),hh=Wd(Lg,Yg(!0),g,g,eg.modification),ph=Wd(Hg,Yg(!1),g,g,eg.modification),vh=Wd(Ig,$d,g,g,eg.modification),bh=Wd(Pg,$d,g,g,eg.modification),yh=Vg,wh=Fg,xh=Ug,Ch=function(t,e,n){var r=function(t){return"table"===nn(qa(t))},o=function(e){return!1===r(t)||ks(e).rows>1},i=function(e){return!1===r(t)||ks(e).columns>1},u=Ff(t),a=Vf(t)?g:md,c=function(e){switch(Hf(t)){case"section":return _d.section();case"sectionCells":return _d.sectionCells();case"cells":return _d.cells();default:return _d.getTableSectionType(e,"section")}},s=function(n,r){return r.cursor.fold((function(){var r=Dr(n);return et(r).filter(Mn).map((function(r){e.clear(n);var o=t.dom.createRng();return o.selectNode(r.dom),t.selection.setRng(o),Yn(r,"data-mce-selected","1"),o}))}),(function(r){var o=dd(r),i=t.dom.createRng();return i.setStart(o.element.dom,o.offset),i.setEnd(o.element.dom,o.offset),t.selection.setRng(i),e.clear(n),A.some(i)}))},l=function(e,n,r,o,i){return function(a,l,f){void 0===f&&(f=!1),Ja(a);var d=o(),m=ve.fromDom(t.getDoc()),g=Va(r,m,u),h={sizing:qf(t,a),resize:Vf(t)?Yc():Jc(),section:c(a)};return n(a)?e(d,a,l,g,h).bind((function(e){I(e.newRows,(function(e){Jl(t,e.dom)})),I(e.newCells,(function(e){Ql(t,e.dom)}));var n=s(a,e);return Mn(a)&&(Ja(a),f||rf(t,a.dom,i)),n.map((function(t){return{rng:t,effect:i}}))})):A.none()}},f=l(oh,o,g,n,uf),d=l(rh,i,g,n,uf),m=l(Zg,k,g,n,uf),h=l(th,k,g,n,uf),p=l(eh,k,a,n,uf),v=l(nh,k,a,n,uf),b=l(dh,k,g,n,uf),y=l(mh,k,g,n,uf),w=l(hh,k,g,n,uf),x=l(ph,k,g,n,uf),C=l(vh,k,g,n,uf),S=l(bh,k,g,n,uf),T=l(gh,k,g,n,af),O=l(lh,k,g,n,uf),E=l(fh,k,g,n,uf),_=l(ih,k,g,n,uf),D=l(uh,k,g,n,uf),M=l(ah,k,g,n,uf),z=l(ch,k,g,n,uf),R=l(sh,k,g,n,uf),N=wh,B=yh,L=xh;return{deleteRow:f,deleteColumn:d,insertRowsBefore:m,insertRowsAfter:h,insertColumnsBefore:p,insertColumnsAfter:v,mergeCells:b,unmergeCells:y,pasteColsBefore:w,pasteColsAfter:x,pasteRowsBefore:C,pasteRowsAfter:S,pasteCells:T,makeCellsHeader:O,unmakeCellsHeader:E,makeColumnsHeader:_,unmakeColumnsHeader:D,makeRowsHeader:M,makeRowsBody:z,makeRowsFooter:R,getTableRowType:L,getTableCellType:N,getTableColType:B}},Sh={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},kh=function(){return ve.fromTag("th")},Th=function(){return ve.fromTag("td")},Oh=function(){return ve.fromTag("col")},Eh=function(t,e,n,r){for(var o=ve.fromTag("tr"),i=0;i0){var s=ve.fromTag("thead");_o(u,s);var l="sectionCells"===o?c:0,f=Ah(n,e,l,r);Ro(s,f)}var d=ve.fromTag("tbody");_o(u,d);var m=a?t-c:t,g=a?0:n,h=Ah(m,e,g,r);return Ro(d,h),u},Mh=function(t){return t.dom.innerHTML},zh=function(t){var e=ve.fromTag("div"),n=ve.fromDom(t.dom.cloneNode(!0));return _o(e,n),Mh(e)},Rh=function(t,e){t.selection.select(e.dom,!0),t.selection.collapse(!0)},Nh=function(t,e){Gn(e,"td,th").each(w(Rh,t))},Bh=function(t,e){I(Pn(e,"tr"),(function(e){Jl(t,e.dom),I(Pn(e,"th,td"),(function(e){Ql(t,e.dom)}))}))},Lh=function(t){return o(t)&&-1!==t.indexOf("%")},Hh=function(t,e,n,r,o){var i=wf(t),u={styles:i,attributes:yf(t),colGroups:Lf(t)};return t.undoManager.ignore((function(){var i=Dh(n,e,o,r,Hf(t),u);Yn(i,"data-mce-id","__mce");var a=zh(i);t.insertContent(a),t.addVisual()})),Gn(qa(t),'table[data-mce-id="__mce"]').map((function(e){return Rf(t)?Jf(e):Nf(t)?Qf(e):(zf(t)||Lh(i.width))&&Yf(e),Ja(e),er(e,"data-mce-id"),Bh(t,e),Nh(t,e),e.dom})).getOr(null)},Ih=function(t,e,n,r,o){void 0===r&&(r={});var i=function(t){return m(t)&&t>0};if(i(e)&&i(n)){var u=r.headerRows||0,a=r.headerColumns||0;return Hh(t,n,e,a,u)}return console.error(o),null},Ph=function(t){return function(){return t().fold((function(){return[]}),(function(t){return H(t,(function(t){return t.dom}))}))}},Vh=function(t){return function(e){var n=e.length>0?A.some(ja(e)):A.none();t(n)}},Fh=function(t){return function(e,n,r){void 0===r&&(r={});var o=Ih(t,n,e,r,"Invalid values for insertTable - rows and columns values are required to insert a table.");return t.undoManager.add(),o}},Uh=function(t,e,n,r){return{insertTable:Fh(t),setClipboardRows:Vh(e.setRows),getClipboardRows:Ph(e.getRows),setClipboardCols:Vh(e.setColumns),getClipboardCols:Ph(e.getColumns),resizeHandler:n,selectionTargets:r}},jh=function(t,e,n){var r=yr(t,e,1);1===n||r<=1?er(t,e):Yn(t,e,Math.min(n,r))},Wh=function(t,e,n){if(so.hasColumns(t)){var r=F(so.justColumns(t),(function(t){return t.column>=e&&t.column=e&&t.column0?[ot(ot({},t),{cells:e})]:[]})),a=Fd(u);return cr(a.length>0,a)})).map((function(t){return Rd(t)}))},Kh=tinymce.util.Tools.resolve("tinymce.util.Tools"),Xh=function(t,e,n){var r,o=t.select("td,th",e),i=function(e,r){for(var o=0;o0?r:void 0,allowCustomColors:!1},onAction:function(e){var r,o="remove"===e.value?"":e.value;t.execCommand("mceTableApplyCellStyle",!1,(r={},r[n]=o,r))}}]},Ep=function(t){return function(){var e=t.queryCommandValue("mceTableRowType"),n="header"===e?"body":"header";t.execCommand("mceTableRowType",!1,{type:n})}},_p=function(t){return function(){var e=t.queryCommandValue("mceTableColType"),n="th"===e?"td":"th";t.execCommand("mceTableColType",!1,{type:n})}},Ap=function(t){var e=xp(Af(t));return e.length>0?A.some({name:"class",type:"listbox",label:"Class",items:e}):A.none()},Dp=[{name:"width",type:"input",label:"Width"},{name:"height",type:"input",label:"Height"},{name:"celltype",type:"listbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"listbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"listbox",label:"Horizontal align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"listbox",label:"Vertical align",items:tp}],Mp=function(t){return Dp.concat(Ap(t).toArray())},zp=function(t,e){var n=[{text:"Select...",value:""}],r=[{name:"borderstyle",type:"listbox",label:"Border style",items:n.concat(xp(bf(t)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}],o={name:"borderwidth",type:"input",label:"Border width"},i="cell"===e?[o].concat(r):r;return{title:"Advanced",name:"advanced",items:i}},Rp=function(t){return function(e,n){var r=e.dom,o=function(e,o){t&&!o||r.setAttrib(n,e,o)},i=function(e,o){t&&!o||r.setStyle(n,e,o)},u=function(r,o){t&&!o||(""===o?e.formatter.remove(r,{value:null},n,!0):e.formatter.apply(r,{value:o},n))};return{setAttrib:o,setStyle:i,setFormat:u}}},Np={normal:Rp(!1),ifTruthy:Rp(!0)},Bp=function(t){return function(e){return Ct(e,"rgb")?t.toHex(e):e}},Lp=function(t,e){var n=ve.fromDom(e);return{borderwidth:pr(n,"border-width").getOr(""),borderstyle:pr(n,"border-style").getOr(""),bordercolor:pr(n,"border-color").map(Bp(t)).getOr(""),backgroundcolor:pr(n,"background-color").map(Bp(t)).getOr("")}},Hp=function(t){var e=t[0],n=t.slice(1);return I(n,(function(t){I(Ee(e),(function(n){Ae(t,(function(t,r){var o=e[n];""!==o&&n===r&&o!==t&&(e[n]="")}))}))})),e},Ip=function(t,e,n,r){return q(t,(function(t){return!s(n.formatter.matchNode(r,e+t))})).getOr("")},Pp=w(Ip,["left","center","right"],"align"),Vp=w(Ip,["top","middle","bottom"],"valign"),Fp=function(t,e){var n=wf(t),r=yf(t),o=function(t){return{borderstyle:Ie(n,"border-style").getOr(""),bordercolor:Bp(t)(Ie(n,"border-color").getOr("")),backgroundcolor:Bp(t)(Ie(n,"background-color").getOr(""))}},i={height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:""},u=function(){var e=n["border-width"];return _f(t)&&e?{border:e}:Ie(r,"border").fold((function(){return{}}),(function(t){return{border:t}}))},a=e?o(t.dom):{},c=function(){var t=Ie(n,"border-spacing").or(Ie(r,"cellspacing")).fold((function(){return{}}),(function(t){return{cellspacing:t}})),e=Ie(n,"border-padding").or(Ie(r,"cellpadding")).fold((function(){return{}}),(function(t){return{cellpadding:t}}));return ot(ot({},t),e)},s=ot(ot(ot(ot(ot(ot({},i),n),r),a),u()),c());return s},Up=function(t){return zr(ve.fromDom(t)).map((function(e){var n={selection:ja(t.cells)};return xh(e,n)})).getOr("")},jp=function(t,e,n){var r=function(e,n){var r=pr(ve.fromDom(n),"border-width");return _f(t)&&r.isSome()?r.getOr(""):e.getAttrib(n,"border")||Xh(t.dom,n,"border-width")||Xh(t.dom,n,"border")},o=t.dom,i=_f(t)?o.getStyle(e,"border-spacing")||o.getAttrib(e,"cellspacing"):o.getAttrib(e,"cellspacing")||o.getStyle(e,"border-spacing"),u=_f(t)?Xh(o,e,"padding")||o.getAttrib(e,"cellpadding"):o.getAttrib(e,"cellpadding")||Xh(o,e,"padding");return ot({width:o.getStyle(e,"width")||o.getAttrib(e,"width"),height:o.getStyle(e,"height")||o.getAttrib(e,"height"),cellspacing:i,cellpadding:u,border:r(o,e),caption:!!o.select("caption",e)[0],class:o.getAttrib(e,"class",""),align:Pp(t,e)},n?Lp(o,e):{})},Wp=function(t,e,n){var r=t.dom;return ot({height:r.getStyle(e,"height")||r.getAttrib(e,"height"),class:r.getAttrib(e,"class",""),type:Up(e),align:Pp(t,e)},n?Lp(r,e):{})},qp=function(t,e,n,r){var o=t.dom,i=r.getOr(e),u=function(t,e){return o.getStyle(t,e)||o.getAttrib(t,e)};return ot({width:u(i,"width"),height:u(e,"height"),scope:o.getAttrib(e,"scope"),celltype:Wa(e),class:o.getAttrib(e,"class",""),halign:Pp(t,e),valign:Vp(t,e)},n?Lp(o,e):{})},$p=function(t,e){var n=so.fromTable(t),r=so.justCells(n),o=F(r,(function(t){return B(e,(function(e){return Ce(t.element,e)}))}));return H(o,(function(t){return{element:t.element.dom,column:so.getColumnAt(n,t.column).map((function(t){return t.element.dom}))}}))},Gp=function(t,e,n){t.setAttrib("scope",n.scope),t.setAttrib("class",n.class),t.setStyle("height",Ya(n.height)),e.setStyle("width",Ya(n.width))},Kp=function(t,e){t.setFormat("tablecellbackgroundcolor",e.backgroundcolor),t.setFormat("tablecellbordercolor",e.bordercolor),t.setFormat("tablecellborderstyle",e.borderstyle),t.setFormat("tablecellborderwidth",Ya(e.borderwidth))},Xp=function(t,e,n){var r=1===e.length;I(e,(function(e){var o=e.element,i=r?Np.normal(t,o):Np.ifTruthy(t,o),u=e.column.map((function(e){return r?Np.normal(t,e):Np.ifTruthy(t,e)})).getOr(i);Gp(i,u,n),Sf(t)&&Kp(i,n),r&&(Qh(t,o),Zh(t,o)),n.halign&&Yh(t,o,n.halign),n.valign&&Jh(t,o,n.valign)}))},Yp=function(t,e){t.execCommand("mceTableCellType",!1,{type:e.celltype,no_events:!0})},Jp=function(t,e,n,r){var o=Ne(r,(function(t,e){return n[e]!==t}));He(o)>0&&e.length>=1&&zr(e[0]).each((function(n){var i=$p(n,e),u=He(Ne(o,(function(t,e){return"scope"!==e&&"celltype"!==e})))>0,a=Pe(o,"celltype");(u||Pe(o,"scope"))&&Xp(t,i,r),a&&Yp(t,r),rf(t,n.dom,{structure:a,style:u})}))},Qp=function(t,e,n,r){var o=r.getData();r.close(),t.undoManager.transact((function(){Jp(t,e,n,o),t.focus()}))},Zp=function(t,e){var n=zr(e[0]).map((function(n){return H($p(n,e),(function(e){return qp(t,e.element,Sf(t),e.column)}))}));return Hp(n.getOrDie())},tv=function(t,e){var n=Sc(e);if(0!==n.length){var r=Zp(t,n),o={type:"tabpanel",tabs:[{title:"General",name:"general",items:Mp(t)},zp(t,"cell")]},i={type:"panel",items:[{type:"grid",columns:2,items:Mp(t)}]};t.windowManager.open({title:"Cell Properties",size:"normal",body:Sf(t)?o:i,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:r,onSubmit:w(Qp,t,n,r)})}},ev=function(t){var e=xp(Df(t));return e.length>0?A.some({name:"class",type:"listbox",label:"Class",items:e}):A.none()},nv=[{type:"listbox",name:"type",label:"Row type",items:[{text:"Header",value:"header"},{text:"Body",value:"body"},{text:"Footer",value:"footer"}]},{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],rv=function(t){return nv.concat(ev(t).toArray())},ov=function(t,e){t.setAttrib("class",e.class),t.setStyle("height",Ya(e.height))},iv=function(t,e){t.setStyle("background-color",e.backgroundcolor),t.setStyle("border-color",e.bordercolor),t.setStyle("border-style",e.borderstyle)},uv=function(t,e,n,r){var o=1===e.length;I(e,(function(e){var i=o?Np.normal(t,e):Np.ifTruthy(t,e);ov(i,n),kf(t)&&iv(i,n),n.align!==r.align&&(Qh(t,e),Yh(t,e,n.align))}))},av=function(t,e){t.execCommand("mceTableRowType",!1,{type:e.type,no_events:!0})},cv=function(t,e,n,r){var o=Ne(r,(function(t,e){return n[e]!==t}));if(He(o)>0){var i=Pe(o,"type"),u=!i||He(o)>1;u&&uv(t,e,r,n),i&&av(t,r),zr(ve.fromDom(e[0])).each((function(e){return rf(t,e.dom,{structure:i,style:u})}))}},sv=function(t,e,n,r){var o=r.getData();r.close(),t.undoManager.transact((function(){cv(t,e,n,o),t.focus()}))},lv=function(t){var e=kc(ec(t),gc.selected);if(0!==e.length){var n=H(e,(function(e){return Wp(t,e.dom,kf(t))})),r=Hp(n),o={type:"tabpanel",tabs:[{title:"General",name:"general",items:rv(t)},zp(t,"row")]},i={type:"panel",items:[{type:"grid",columns:2,items:rv(t)}]};t.windowManager.open({title:"Row Properties",size:"normal",body:kf(t)?o:i,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:r,onSubmit:w(sv,t,H(e,(function(t){return t.dom})),r)})}},fv=function(t,e,n){var r=n?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],o=[{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}],i=Of(t)?[{type:"input",name:"cellspacing",label:"Cell spacing",inputMode:"numeric"},{type:"input",name:"cellpadding",label:"Cell padding",inputMode:"numeric"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],u=[{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}],a=e.length>0?[{type:"listbox",name:"class",label:"Class",items:e}]:[];return r.concat(o).concat(i).concat(u).concat(a)},dv=function(t,e,n,r){if("TD"===e.tagName||"TH"===e.tagName)o(n)?t.setStyle(e,n,r):t.setStyle(e,n);else if(e.children)for(var i=0;i0){mv(t,e,i);var a=o.select("caption",e)[0];(a&&!i.caption||!a&&i.caption)&&t.execCommand("mceTableToggleCaption"),""===i.align?Qh(t,e):Yh(t,e,i.align)}if(t.focus(),t.addVisual(),He(u)>0){var c=Pe(u,"caption"),s=!c||He(u)>1;rf(t,e,{structure:c,style:s})}}))},hv=function(t,e){var n,r=t.dom,o=Fp(t,Tf(t));!1===e?(n=r.getParent(t.selection.getStart(),"table",t.getBody()),n?o=jp(t,n,Tf(t)):Tf(t)&&(o.borderstyle="",o.bordercolor="",o.backgroundcolor="")):(o.cols="1",o.rows="1",Tf(t)&&(o.borderstyle="",o.bordercolor="",o.backgroundcolor=""));var i=xp(Mf(t));i.length>0&&o.class&&(o.class=o.class.replace(/\s*mce\-item\-table\s*/g,""));var u={type:"grid",columns:2,items:fv(t,i,e)},a=function(){return{type:"panel",items:[u]}},c=function(){return{type:"tabpanel",tabs:[{title:"General",name:"general",items:[u]},zp(t,"table")]}},s=Tf(t)?c():a();t.windowManager.open({title:"Table Properties",size:"normal",body:s,onSubmit:w(gv,t,n,o),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o})},pv=function(t){return xc(ec(t),Ka(t))},vv=function(t){return Cc(ec(t),Ka(t))},bv=function(t,e,n,r,u){var a=Ka(t),c=function(){return pv(t).each((function(e){zr(e,a).filter(x(a)).each((function(e){var n=ve.fromText("");if(Oo(e,n),Bo(e),t.dom.isEmpty(t.getBody()))t.setContent(""),t.selection.setCursorLocation();else{var r=t.dom.createRng();r.setStart(n.dom,0),r.setEnd(n.dom,0),t.selection.setRng(r),t.nodeChanged()}}))}))},s=function(e){return pv(t).each((function(n){var r=Nf(t)||Rf(t)||zf(t);r||zr(n,a).each((function(n){"relative"!==e||xs(n)?"fixed"!==e||Cs(n)?"responsive"!==e||Ss(n)||Qf(n):Jf(n):Yf(n),Ja(n),rf(t,n.dom,uf)}))}))},l=function(t){return zr(t,a)},f=function(e){return vv(t).bind((function(t){return l(t).map((function(n){return e(n,t)}))}))},d=function(e,n){f((function(e){t.formatter.toggle("tableclass",{value:n},e.dom),rf(t,e.dom,of)}))},m=function(e,n){f((function(e){var o=Sc(r),i=X(o,(function(e){return t.formatter.match("tablecellclass",{value:n},e.dom)})),u=i?t.formatter.remove:t.formatter.apply;I(o,(function(t){return u("tablecellclass",{value:n},t.dom)})),rf(t,e.dom,of)}))},h=function(){pv(t).each((function(e){zr(e,a).each((function(n){$n(n,"caption").fold((function(){var e=ve.fromTag("caption");_o(e,ve.fromText("Caption")),Ao(n,e,0),t.selection.setCursorLocation(e.dom,0)}),(function(r){fn("caption")(e)&&xe("td",n).each((function(e){return t.selection.setCursorLocation(e.dom,0)})),Bo(r)})),rf(t,n.dom,uf)}))}))},p=function(e){t.focus()},v=function(t,e){return void 0===e&&(e=!1),f((function(n,o){var i=pc(r,n,o);t(n,i,e).each(p)}))},b=function(){return f((function(e,n){var o=pc(r,e,n),i=Va(g,ve.fromDom(t.getDoc()),A.none());return Gh(e,o,i)}))},y=function(){return f((function(t,e){var n=pc(r,t,e);return $h(t,n)}))},C=function(e,n){return n().each((function(n){var o=H(n,(function(t){return xi(t)}));f((function(n,i){var u=Fa(ve.fromDom(t.getDoc())),a=bc(r,i,o,u);e(n,a).each(p)}))}))},S=function(t){return function(e,n){return Ie(n,"type").each((function(e){v(t(e),n.no_events)}))}};Ae({mceTableSplitCells:function(){return v(e.unmergeCells)},mceTableMergeCells:function(){return v(e.mergeCells)},mceTableInsertRowBefore:function(){return v(e.insertRowsBefore)},mceTableInsertRowAfter:function(){return v(e.insertRowsAfter)},mceTableInsertColBefore:function(){return v(e.insertColumnsBefore)},mceTableInsertColAfter:function(){return v(e.insertColumnsAfter)},mceTableDeleteCol:function(){return v(e.deleteColumn)},mceTableDeleteRow:function(){return v(e.deleteRow)},mceTableCutCol:function(){return y().each((function(t){u.setColumns(t),v(e.deleteColumn)}))},mceTableCutRow:function(){return b().each((function(t){u.setRows(t),v(e.deleteRow)}))},mceTableCopyCol:function(){return y().each((function(t){return u.setColumns(t)}))},mceTableCopyRow:function(){return b().each((function(t){return u.setRows(t)}))},mceTablePasteColBefore:function(){return C(e.pasteColsBefore,u.getColumns)},mceTablePasteColAfter:function(){return C(e.pasteColsAfter,u.getColumns)},mceTablePasteRowBefore:function(){return C(e.pasteRowsBefore,u.getRows)},mceTablePasteRowAfter:function(){return C(e.pasteRowsAfter,u.getRows)},mceTableDelete:c,mceTableCellToggleClass:m,mceTableToggleClass:d,mceTableToggleCaption:h,mceTableSizingMode:function(t,e){return s(e)},mceTableCellType:S((function(t){return"th"===t?e.makeCellsHeader:e.unmakeCellsHeader})),mceTableColType:S((function(t){return"th"===t?e.makeColumnsHeader:e.unmakeColumnsHeader})),mceTableRowType:S((function(t){switch(t){case"header":return e.makeRowsHeader;case"footer":return e.makeRowsFooter;default:return e.makeRowsBody}}))},(function(e,n){return t.addCommand(n,e)})),Ae({mceTableProps:w(hv,t,!1),mceTableRowProps:w(lv,t),mceTableCellProps:w(tv,t,r)},(function(e,n){return t.addCommand(n,(function(){return e()}))})),t.addCommand("mceInsertTable",(function(e,n){i(n)&&Ee(n).length>0?Ih(t,n.rows,n.columns,n.options,"Invalid values for mceInsertTable - rows and columns values are required to insert a table."):hv(t,!0)})),t.addCommand("mceTableApplyCellStyle",(function(e,n){var u=function(t){return"tablecell"+t.toLowerCase().replace("-","")};if(i(n)){var a=Sc(r);if(0!==a.length){var c=Ne(n,(function(e,n){return t.formatter.has(u(n))&&o(e)}));Fe(c)||(Ae(c,(function(e,n){I(a,(function(r){Np.normal(t,r.dom).setFormat(u(n),e)}))})),l(a[0]).each((function(e){return rf(t,e.dom,of)})))}}}))},yv=function(t,e,n){var r=Ka(t),o=function(e){return Cc(ec(t)).bind((function(t){return zr(t,r).map((function(r){var o=pc(n,r,t);return e(r,o)}))})).getOr("")};Ae({mceTableRowType:function(){return o(e.getTableRowType)},mceTableCellType:function(){return o(e.getTableCellType)},mceTableColType:function(){return o(e.getTableColType)}},(function(e,n){return t.addQueryValueHandler(n,e)}))},wv=function(){var t=bp(),e=bp();return{getRows:t.get,setRows:function(n){n.fold(t.clear,t.set),e.clear()},clearRows:t.clear,getColumns:e.get,setColumns:function(n){n.fold(e.clear,e.set),t.clear()},clearColumns:e.clear}},xv={remove_similar:!0,inherit:!1},Cv=ot({selector:"td,th"},xv),Sv={tablecellbackgroundcolor:ot({styles:{backgroundColor:"%value"}},Cv),tablecellverticalalign:ot({styles:{"vertical-align":"%value"}},Cv),tablecellbordercolor:ot({styles:{borderColor:"%value"}},Cv),tablecellclass:ot({classes:["%value"]},Cv),tableclass:ot({selector:"table",classes:["%value"]},xv),tablecellborderstyle:ot({styles:{borderStyle:"%value"}},Cv),tablecellborderwidth:ot({styles:{borderWidth:"%value"}},Cv)},kv=function(t){t.formatter.register(Sv)},Tv=fi.generate([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),Ov=function(t){return void 0===t&&(t=void 0),Tv.none(t)},Ev=ot(ot({},Tv),{none:Ov}),_v=function(t,e,n,r,o){void 0===o&&(o=k);var i=1===r;if(!i&&n<=0)return Ev.first(t[0]);if(i&&n>=t.length-1)return Ev.last(t[t.length-1]);var u=n+r,a=t[u];return o(a)?Ev.middle(e,a):_v(t,e,u,r,o)},Av=function(t,e){return zr(t,e).bind((function(e){var n=Dr(e),r=$(n,(function(e){return Ce(t,e)}));return r.map((function(t){return{index:t,all:n}}))}))},Dv=function(t,e,n){var r=Av(t,n);return r.fold((function(){return Ev.none(t)}),(function(n){return _v(n.all,t,n.index,1,e)}))},Mv=function(t,e,n){var r=Av(t,n);return r.fold((function(){return Ev.none()}),(function(n){return _v(n.all,t,n.index,-1,e)}))},zv=function(t,e,n,r){return{start:t,soffset:e,finish:n,foffset:r}},Rv={create:zv},Nv=fi.generate([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Bv=function(t,e,n,r){return t.fold(e,n,r)},Lv=function(t){return t.fold(b,b,b)},Hv=Nv.before,Iv=Nv.on,Pv=Nv.after,Vv={before:Hv,on:Iv,after:Pv,cata:Bv,getStart:Lv},Fv=fi.generate([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Uv=function(t){return Fv.exact(t.start,t.soffset,t.finish,t.foffset)},jv=function(t){return t.match({domRange:function(t){return ve.fromDom(t.startContainer)},relative:function(t,e){return Vv.getStart(t)},exact:function(t,e,n,r){return t}})},Wv=Fv.domRange,qv=Fv.relative,$v=Fv.exact,Gv=function(t){var e=jv(t);return gn(e)},Kv=Rv.create,Xv={domRange:Wv,relative:qv,exact:$v,exactFromRange:Uv,getWin:Gv,range:Kv},Yv=function(t,e){var n=t.document.createRange();return n.selectNode(e.dom),n},Jv=function(t,e){var n=t.document.createRange();return Qv(n,e),n},Qv=function(t,e){return t.selectNodeContents(e.dom)},Zv=function(t,e){e.fold((function(e){t.setStartBefore(e.dom)}),(function(e,n){t.setStart(e.dom,n)}),(function(e){t.setStartAfter(e.dom)}))},tb=function(t,e){e.fold((function(e){t.setEndBefore(e.dom)}),(function(e,n){t.setEnd(e.dom,n)}),(function(e){t.setEndAfter(e.dom)}))},eb=function(t,e,n){var r=t.document.createRange();return Zv(r,e),tb(r,n),r},nb=function(t,e,n,r,o){var i=t.document.createRange();return i.setStart(e.dom,n),i.setEnd(r.dom,o),i},rb=function(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height}},ob=function(t){var e=t.getClientRects(),n=e.length>0?e[0]:t.getBoundingClientRect();return n.width>0||n.height>0?A.some(n).map(rb):A.none()},ib=fi.generate([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ub=function(t,e,n){return e(ve.fromDom(n.startContainer),n.startOffset,ve.fromDom(n.endContainer),n.endOffset)},ab=function(t,e){return e.match({domRange:function(t){return{ltr:v(t),rtl:A.none}},relative:function(e,n){return{ltr:ut((function(){return eb(t,e,n)})),rtl:ut((function(){return A.some(eb(t,n,e))}))}},exact:function(e,n,r,o){return{ltr:ut((function(){return nb(t,e,n,r,o)})),rtl:ut((function(){return A.some(nb(t,r,o,e,n))}))}}})},cb=function(t,e){var n=e.ltr();if(n.collapsed){var r=e.rtl().filter((function(t){return!1===t.collapsed}));return r.map((function(t){return ib.rtl(ve.fromDom(t.endContainer),t.endOffset,ve.fromDom(t.startContainer),t.startOffset)})).getOrThunk((function(){return ub(t,ib.ltr,n)}))}return ub(t,ib.ltr,n)},sb=function(t,e){var n=ab(t,e);return cb(t,n)},lb=function(t,e){var n=sb(t,e);return n.match({ltr:function(e,n,r,o){var i=t.document.createRange();return i.setStart(e.dom,n),i.setEnd(r.dom,o),i},rtl:function(e,n,r,o){var i=t.document.createRange();return i.setStart(r.dom,o),i.setEnd(e.dom,n),i}})};ib.ltr,ib.rtl;var fb=function(t,e,n,r,o){if(0===o)return 0;if(e===r)return o-1;for(var i=r,u=1;ui)return u-1;i=c}}return 0},db=function(t,e,n){return e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom},mb=function(t,e,n,r,o){var i=function(n){var r=t.dom.createRange();return r.setStart(e.dom,n),r.collapse(!0),r},u=function(t){var e=i(t);return e.getBoundingClientRect()},a=Po(e).length,c=fb(u,n,r,o.right,a);return i(c)},gb=function(t,e,n,r){var o=t.dom.createRange();o.selectNode(e.dom);var i=o.getClientRects(),u=rt(i,(function(t){return db(t,n,r)?A.some(t):A.none()}));return u.map((function(o){return mb(t,e,n,r,o)}))},hb=function(t,e,n,r){var o=t.dom.createRange(),i=wn(e);return rt(i,(function(e){return o.selectNode(e.dom),db(o.getBoundingClientRect(),n,r)?pb(t,e,n,r):A.none()}))},pb=function(t,e,n,r){return cn(e)?gb(t,e,n,r):hb(t,e,n,r)},vb=function(t,e,n,r){var o=t.dom.createRange();o.selectNode(e.dom);var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return pb(t,e,u,a)},bb=!0,yb=!1,wb=function(t,e){return e-t.left0){var e=t.getRangeAt(0),n=t.getRangeAt(t.rangeCount-1);return A.some(Rv.create(ve.fromDom(e.startContainer),e.startOffset,ve.fromDom(n.endContainer),n.endOffset))}return A.none()},$b=function(t){if(null===t.anchorNode||null===t.focusNode)return qb(t);var e=ve.fromDom(t.anchorNode),n=ve.fromDom(t.focusNode);return Lb(e,t.anchorOffset,n,t.focusOffset)?A.some(Rv.create(e,t.anchorOffset,n,t.focusOffset)):qb(t)},Gb=function(t,e,n){void 0===n&&(n=!0);var r=n?Jv:Yv,o=r(t,e);Ib(t,o)},Kb=function(t){return Hb(t).filter((function(t){return t.rangeCount>0})).bind($b)},Xb=function(t){return Kb(t).map((function(t){return Xv.exact(t.start,t.soffset,t.finish,t.foffset)}))},Yb=function(t,e){var n=lb(t,e);return ob(n)},Jb=function(t,e,n){return Db(t,e,n)},Qb=function(t){Hb(t).each((function(t){return t.removeAllRanges()}))},Zb=tinymce.util.Tools.resolve("tinymce.util.VK"),ty=function(t,e,n){return ry(t,e,Dv(n,Cl))},ey=function(t,e,n){return ry(t,e,Mv(n,Cl))},ny=function(t,e){var n=Xv.exact(e,0,e,0);return Wb(n)},ry=function(t,e,n){return n.fold(A.none,A.none,(function(e,n){return _a(n).map((function(e){return ny(t,e)}))}),(function(n){return t.execCommand("mceTableInsertRowAfter"),ty(t,e,n)}))},oy=["table","li","dl"],iy=function(t,e,n){if(t.keyCode===Zb.TAB){var r=qa(e),o=function(t){var e=nn(t);return Ce(t,r)||N(oy,e)},i=e.selection.getRng(),u=ve.fromDom(t.shiftKey?i.startContainer:i.endContainer);Ar(u,o).each((function(r){t.preventDefault(),zr(r,o).each(n.clear),e.selection.collapse(t.shiftKey);var i=t.shiftKey?ey:ty,u=i(e,o,r);u.each((function(t){e.selection.setRng(t)}))}))}},uy=function(t,e){return{selection:t,kill:e}},ay={create:uy},cy=function(t,e,n,r){return{start:Vv.on(t,e),finish:Vv.on(n,r)}},sy={create:cy},ly=function(t,e){var n=lb(t,e);return Rv.create(ve.fromDom(n.startContainer),n.startOffset,ve.fromDom(n.endContainer),n.endOffset)},fy=sy.create,dy=function(t,e,n,r,o,i,u){return Ce(n,o)&&r===i?A.none():Kn(n,"td,th",e).bind((function(n){return Kn(o,"td,th",e).bind((function(r){return my(t,e,n,r,u)}))}))},my=function(t,e,n,r,o){return Ce(n,r)?A.none():ni(n,r,e).bind((function(e){var r=e.boxes.getOr([]);return r.length>1?(o(t,r,e.start,e.finish),A.some(ay.create(A.some(fy(n,0,n,ka(n))),!0))):A.none()}))},gy=function(t,e,n,r,o){var i=function(t){return o.clearBeforeUpdate(n),o.selectRange(n,t.boxes,t.start,t.finish),t.boxes};return ai(r,t,e,o.firstSelectedSelector,o.lastSelectedSelector).map(i)},hy=function(t,e){return{item:t,mode:e}},py=function(t,e,n,r){return void 0===r&&(r=vy),t.property().parent(e).map((function(t){return hy(t,r)}))},vy=function(t,e,n,r){return void 0===r&&(r=by),n.sibling(t,e).map((function(t){return hy(t,r)}))},by=function(t,e,n,r){void 0===r&&(r=by);var o=t.property().children(e),i=n.first(o);return i.map((function(t){return hy(t,r)}))},yy=[{current:py,next:vy,fallback:A.none()},{current:vy,next:by,fallback:A.some(py)},{current:by,next:by,fallback:A.some(vy)}],wy=function(t,e,n,r,o){void 0===o&&(o=yy);var i=q(o,(function(t){return t.current===n}));return i.bind((function(n){return n.current(t,e,r,n.next).orThunk((function(){return n.fallback.bind((function(n){return wy(t,e,n,r)}))}))}))},xy=function(){var t=function(t,e){return t.query().prevSibling(e)},e=function(t){return t.length>0?A.some(t[t.length-1]):A.none()};return{sibling:t,first:e}},Cy=function(){var t=function(t,e){return t.query().nextSibling(e)},e=function(t){return t.length>0?A.some(t[0]):A.none()};return{sibling:t,first:e}},Sy={left:xy,right:Cy},ky=function(t,e,n,r,o,i){var u=wy(t,e,r,o);return u.bind((function(e){return i(e.item)?A.none():n(e.item)?A.some(e.item):ky(t,e.item,n,e.mode,o,i)}))},Ty=function(t,e,n,r){return ky(t,e,n,vy,Sy.left(),r)},Oy=function(t,e,n,r){return ky(t,e,n,vy,Sy.right(),r)},Ey=function(t){return function(e){return 0===t.property().children(e).length}},_y=function(t,e,n){return Dy(t,e,Ey(t),n)},Ay=function(t,e,n){return My(t,e,Ey(t),n)},Dy=Ty,My=Oy,zy=jo(),Ry=function(t,e){return _y(zy,t,e)},Ny=function(t,e){return Ay(zy,t,e)},By=function(t,e,n){return Dy(zy,t,e,n)},Ly=function(t,e,n){return My(zy,t,e,n)},Hy=function(t,e,n){return Fn(t,e,n).isSome()},Iy=fi.generate([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),Py=function(t,e,n){var r=t.getRect(e),o=t.getRect(n);return o.right>r.left&&o.left=0&&n0?t.getRangedRect(e,n-1,e,n):A.none()},uw=function(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}},aw=function(t,e){return A.some(t.getRect(e))},cw=function(t,e,n){return an(e)?aw(t,e).map(uw):cn(e)?iw(t,e,n).map(uw):A.none()},sw=function(t,e){return an(e)?aw(t,e).map(uw):cn(e)?t.getRangedRect(e,0,e,ka(e)).map(uw):A.none()},lw=5,fw=100,dw=fi.generate([{none:[]},{retry:["caret"]}]),mw=function(t,e){return t.lefte.right},gw=function(t,e,n){return Un(e,ag).fold(S,(function(e){return sw(t,e).exists((function(t){return mw(n,t)}))}))},hw=function(t,e,n,r,o){var i=tw(o,lw);return Math.abs(n.bottom-r.bottom)<1||n.top>o.bottom?dw.retry(i):n.top===o.bottom?dw.retry(tw(o,1)):gw(t,e,o)?dw.retry(nw(i,lw,0)):dw.none()},pw=function(t,e,n,r,o){var i=ew(o,lw);return Math.abs(n.top-r.top)<1||n.bottomn.getInnerHeight()?A.some(t.point(e)-n.getInnerHeight()):t.point(e)<0?A.some(-t.point(e)):A.none()},Tw=function(t,e,n){var r=t.move(n,lw),o=xw(e,t,n,r,fw).getOr(r);return kw(t,o,e).fold((function(){return e.situsFromPoint(o.left,t.point(o))}),(function(n){return e.scrollBy(0,n),e.situsFromPoint(o.left,t.point(o)-n)}))},Ow={tryUp:w(Tw,vw),tryDown:w(Tw,bw),ieTryUp:Sw,ieTryDown:Cw,getJumpSize:v(lw)},Ew=20,_w=function(t,e,n){return t.getSelection().bind((function(r){return Qy(e,r.finish,r.foffset,n).fold((function(){return A.some(ud(r.finish,r.foffset))}),(function(o){var i=t.fromSitus(o),u=jy.verify(t,r.finish,r.foffset,i.finish,i.foffset,n.failure,e);return Zy(u)}))}))},Aw=function(t,e,n,r,o,i){return 0===i?A.none():zw(t,e,n,r,o).bind((function(u){var a=t.fromSitus(u),c=jy.verify(t,n,r,a.finish,a.foffset,o.failure,e);return jy.cata(c,(function(){return A.none()}),(function(){return A.some(u)}),(function(u){return Ce(n,u)&&0===r?Dw(t,n,r,ew,o):Aw(t,e,u,0,o,i-1)}),(function(u){return Ce(n,u)&&r===ka(u)?Dw(t,n,r,tw,o):Aw(t,e,u,ka(u),o,i-1)}))}))},Dw=function(t,e,n,r,o){return cw(t,e,n).bind((function(e){return Mw(t,o,r(e,Ow.getJumpSize()))}))},Mw=function(t,e,n){var r=oe().browser;return r.isChrome()||r.isSafari()||r.isFirefox()||r.isEdge()?e.otherRetry(t,n):r.isIE()?e.ieRetry(t,n):A.none()},zw=function(t,e,n,r,o){return cw(t,n,r).bind((function(e){return Mw(t,o,e)}))},Rw=function(t,e,n){return _w(t,e,n).bind((function(r){return Aw(t,e,r.element,r.offset,n,Ew).map(t.fromSitus)}))},Nw=function(t,e){return Hy(t,(function(t){return hn(t).exists((function(t){return Ce(t,e)}))}))},Bw=function(t,e,n,r,o){return Kn(r,"td,th",e).bind((function(r){return Kn(r,"table",e).bind((function(i){return Nw(o,i)?Rw(t,e,n).bind((function(t){return Kn(t.finish,"td,th",e).map((function(e){return{start:r,finish:e,range:t}}))})):A.none()}))}))},Lw=function(t,e,n,r,o,i){return oe().browser.isIE()?A.none():i(r,e).orThunk((function(){return Bw(t,e,n,r,o).map((function(t){var e=t.range;return ay.create(A.some(fy(e.start,e.soffset,e.finish,e.foffset)),!0)}))}))},Hw=function(t,e){return Kn(t,"tr",e).bind((function(t){return Kn(t,"table",e).bind((function(n){var r=Pn(n,"tr");return Ce(t,r[0])?By(n,(function(t){return Aa(t).isSome()}),e).map((function(t){var e=ka(t);return ay.create(A.some(fy(t,e,t,e)),!0)})):A.none()}))}))},Iw=function(t,e){return Kn(t,"tr",e).bind((function(t){return Kn(t,"table",e).bind((function(n){var r=Pn(n,"tr");return Ce(t,r[r.length-1])?Ly(n,(function(t){return _a(t).isSome()}),e).map((function(t){return ay.create(A.some(fy(t,0,t,0)),!0)})):A.none()}))}))},Pw=function(t,e,n,r,o,i,u){return Bw(t,n,r,o,i).bind((function(t){return my(e,n,t.start,t.finish,u)}))},Vw=function(t,e){return Kn(t,"td,th",e)},Fw=function(t,e,n,r){var o=bp(),i=o.clear,u=function(i){o.on((function(o){r.clearBeforeUpdate(e),Vw(i.target,n).each((function(u){ni(o,u,n).each((function(n){var o=n.boxes.getOr([]);if(1===o.length){var a=o[0],c="false"===Sl(a),s=rr(xl(i.target),a,Ce);c&&s&&(r.selectRange(e,o,a,a),t.selectContents(a))}else o.length>1&&(r.selectRange(e,o,n.start,n.finish),t.selectContents(u))}))}))}))},a=function(t){r.clear(e),Vw(t.target,n).each(o.set)},c=function(t){u(t)},s=function(t){u(t),i()};return{clearstate:i,mousedown:a,mouseover:c,mouseup:s}},Uw={traverse:yn,gather:Ny,relative:Vv.before,otherRetry:Ow.tryDown,ieRetry:Ow.ieTryDown,failure:jy.failedDown},jw={traverse:bn,gather:Ry,relative:Vv.before,otherRetry:Ow.tryUp,ieRetry:Ow.ieTryUp,failure:jy.failedUp},Ww=function(t){return function(e){return e===t}},qw=Ww(38),$w=Ww(40),Gw=function(t){return t>=37&&t<=40},Kw={isBackward:Ww(37),isForward:Ww(39)},Xw={isBackward:Ww(39),isForward:Ww(37)},Yw=function(t){var e=void 0!==t?t.dom:document,n=e.body.scrollLeft||e.documentElement.scrollLeft,r=e.body.scrollTop||e.documentElement.scrollTop;return Qi(n,r)},Jw=function(t,e,n){var r=void 0!==n?n.dom:document,o=r.defaultView;o&&o.scrollBy(t,e)},Qw=function(t){var e=function(e,n){return ve.fromPoint(ve.fromDom(t.document),e,n)},n=function(t){return t.dom.getBoundingClientRect()},r=function(e,n,r,o){var i=Xv.exact(e,n,r,o);return Yb(t,i)},o=function(){return Xb(t).map((function(e){return ly(t,e)}))},i=function(e){var n=Xv.relative(e.start,e.finish);return ly(t,n)},u=function(e,n){return Jb(t,e,n).map((function(t){return sy.create(t.start,t.soffset,t.finish,t.foffset)}))},a=function(){Qb(t)},c=function(e){void 0===e&&(e=!1),Xb(t).each((function(n){return n.fold((function(t){return t.collapse(e)}),(function(n,r){var o=e?n:r;jb(t,o,o)}),(function(n,r,o,i){var u=e?n:o,a=e?r:i;Ub(t,u,a,u,a)}))}))},s=function(e){Gb(t,e,!1)},l=function(e){Gb(t,e)},f=function(e){Ub(t,e.start,e.soffset,e.finish,e.foffset)},d=function(e,n){jb(t,e,n)},m=function(){return t.innerHeight},g=function(){var e=Yw(ve.fromDom(t.document));return e.top},h=function(e,n){Jw(e,n,ve.fromDom(t.document))};return{elementFromPoint:e,getRect:n,getRangedRect:r,getSelection:o,fromSitus:i,situsFromPoint:u,clearSelection:a,collapseSelection:c,setSelection:f,setRelativeSelection:d,selectNode:s,selectContents:l,getInnerHeight:m,getScrollY:g,scrollBy:h}},Zw=function(t,e){return{rows:t,cols:e}},tx=function(t,e,n,r){var o=Qw(t),i=Fw(o,e,n,r);return{clearstate:i.clearstate,mousedown:i.mousedown,mouseover:i.mouseover,mouseup:i.mouseup}},ex=function(t,e,n,r){var o=Qw(t),i=function(){return r.clear(e),A.none()},u=function(t,u,a,c,s,l){var f=t.raw,d=f.which,m=!0===f.shiftKey,g=ri(e,r.selectedSelector).fold((function(){return Gw(d)&&!m&&r.clearBeforeUpdate(e),$w(d)&&m?w(Pw,o,e,n,Uw,c,u,r.selectRange):qw(d)&&m?w(Pw,o,e,n,jw,c,u,r.selectRange):$w(d)?w(Lw,o,n,Uw,c,u,Iw):qw(d)?w(Lw,o,n,jw,c,u,Hw):A.none}),(function(t){var n=function(n){return function(){var i=rt(n,(function(n){return gy(n.rows,n.cols,e,t,r)}));return i.fold((function(){return ii(e,r.firstSelectedSelector,r.lastSelectedSelector).map((function(t){var n=$w(d)||l.isForward(d)?Vv.after:Vv.before;return o.setRelativeSelection(Vv.on(t.first,0),n(t.table)),r.clear(e),ay.create(A.none(),!0)}))}),(function(t){return A.some(ay.create(A.none(),!0))}))}};return $w(d)&&m?n([Zw(1,0)]):qw(d)&&m?n([Zw(-1,0)]):l.isBackward(d)&&m?n([Zw(0,-1),Zw(-1,0)]):l.isForward(d)&&m?n([Zw(0,1),Zw(1,0)]):Gw(d)&&!m?i:A.none}));return g()},a=function(t,o,i,u,a){return ri(e,r.selectedSelector).fold((function(){var c=t.raw,s=c.which,l=!0===c.shiftKey;return l&&Gw(s)?dy(e,n,o,i,u,a,r.selectRange):A.none()}),A.none)};return{keydown:u,keyup:a}},nx=function(t,e,n,r){var o=Qw(t);return function(t,i){r.clearBeforeUpdate(e),ni(t,i,n).each((function(t){var n=t.boxes.getOr([]);r.selectRange(e,n,t.start,t.finish),o.selectContents(i),o.collapseSelection()}))}},rx=function(t,e){I(e,(function(e){sl(t,e)}))},ox=function(t){return function(e){al(e,t)}},ix=function(t){return function(e){rx(e,t)}},ux=function(t){var e=ox(t.selected),n=ix([t.selected,t.lastSelected,t.firstSelected]),r=function(e){var r=Pn(e,t.selectedSelector);I(r,n)},o=function(n,o,i,u){r(n),I(o,e),al(i,t.firstSelected),al(u,t.lastSelected)};return{clearBeforeUpdate:r,clear:r,selectRange:o,selectedSelector:t.selectedSelector,firstSelectedSelector:t.firstSelectedSelector,lastSelectedSelector:t.lastSelectedSelector}},ax=function(t,e,n){var r=function(e){er(e,t.selected),er(e,t.firstSelected),er(e,t.lastSelected)},o=function(e){Yn(e,t.selected,"1")},i=function(t){u(t),n()},u=function(e){var n=Pn(e,t.selectedSelector+","+t.firstSelectedSelector+","+t.lastSelectedSelector);I(n,r)},a=function(n,r,u,a){i(n),I(r,o),Yn(u,t.firstSelected,"1"),Yn(a,t.lastSelected,"1"),e(r,u,a)};return{clearBeforeUpdate:u,clear:i,selectRange:a,selectedSelector:t.selectedSelector,firstSelectedSelector:t.firstSelectedSelector,lastSelectedSelector:t.lastSelectedSelector}},cx={byClass:ux,byAttr:ax},sx=function(t,e){var n=t.slice(0,e[e.length-1].row+1),r=Fd(n);return K(r,(function(t){var n=t.cells.slice(0,e[e.length-1].column+1);return H(n,(function(t){return t.element}))}))},lx=function(t,e){var n=t.slice(e[0].row+e[0].rowspan-1,t.length),r=Fd(n);return K(r,(function(t){var n=t.cells.slice(e[0].column+e[0].colspan-1,t.cells.length);return H(n,(function(t){return t.element}))}))},fx=function(t,e,n){var r=so.fromTable(t),o=Xd(r,e);return o.map((function(t){var e=Pd(r,n,!1),o=sx(e,t),i=lx(e,t);return{upOrLeftCells:o,downOrRightCells:i}}))},dx=tinymce.util.Tools.resolve("tinymce.Env"),mx=function(t){return!1===ll(ve.fromDom(t.target),"ephox-snooker-resizer-bar")};function gx(t,e,n){var r=function(e,r,o){n.targets().each((function(n){var i=zr(r);i.each((function(i){var u=Ff(t),a=Va(g,ve.fromDom(t.getDoc()),u),c=fx(i,n,a);ef(t,e,r,o,c)}))}))},o=function(){return nf(t)},i=cx.byAttr(gc,r,o);return t.on("init",(function(n){var r=t.getWin(),o=qa(t),u=Ka(t),a=function(){var e=t.selection,n=ve.fromDom(e.getStart()),r=ve.fromDom(e.getEnd()),u=Zo(zr,[n,r]);u.fold((function(){return i.clear(o)}),g)},c=tx(r,o,u,i),s=ex(r,o,u,i),l=nx(r,o,u,i),f=function(t){return!0===t.raw.shiftKey};t.on("TableSelectorChange",(function(t){return l(t.start,t.finish)}));var d=function(e,n){f(e)&&(n.kill&&e.kill(),n.selection.each((function(e){var n=Xv.relative(e.start,e.finish),o=lb(r,n);t.selection.setRng(o)})))},m=function(e){var n=Zs(e);if(n.raw.shiftKey&&Gw(n.raw.which)){var r=t.selection.getRng(),o=ve.fromDom(r.startContainer),i=ve.fromDom(r.endContainer);s.keyup(n,o,r.startOffset,i,r.endOffset).each((function(t){d(n,t)}))}},h=function(n){var r=Zs(n);e().each((function(t){return t.hideBars()}));var o=t.selection.getRng(),i=ve.fromDom(o.startContainer),u=ve.fromDom(o.endContainer),a=qi(Kw,Xw)(ve.fromDom(t.selection.getStart()));s.keydown(r,i,o.startOffset,u,o.endOffset,a).each((function(t){d(r,t)})),e().each((function(t){return t.showBars()}))},p=function(t){return 0===t.button},v=function(t){return void 0===t.buttons||(!(!dx.browser.isEdge()||0!==t.buttons)||0!==(1&t.buttons))},b=function(t){c.clearstate()},y=function(t){p(t)&&mx(t)&&c.mousedown(Zs(t))},w=function(t){v(t)&&mx(t)&&c.mouseover(Zs(t))},x=function(t){p(t)&&mx(t)&&c.mouseup(Zs(t))},C=function(){var t=hp(ve.fromDom(o)),e=hp(0),n=function(n){var r=ve.fromDom(n.target);if("td"===nn(r)||"th"===nn(r)){var o=t.get(),i=e.get();Ce(o,r)&&n.timeStamp-i<300&&(n.preventDefault(),l(r,r))}t.set(r),e.set(n.timeStamp)};return{touchEnd:n}},S=C();t.on("dragstart",b),t.on("mousedown",y),t.on("mouseover",w),t.on("mouseup",x),t.on("touchend",S.touchEnd),t.on("keyup",m),t.on("keydown",h),t.on("NodeChange",a)})),{clear:i.clear}}var hx=function(t,e){return $n(t,e).isSome()},px=function(t,e){var n=hp(A.none()),r=hp([]),o=A.none(),i=fn("caption"),u=function(t){return o.forall((function(e){return!e[t]}))},a=function(){return xc(ec(t),Ka(t))},c=function(){return xc(nc(t),Ka(t))},s=function(){return a().bind((function(t){return ar(ir(zr(t),c().bind(zr),(function(n,r){return Ce(n,r)?i(t)?A.some(hc(t)):A.some(pc(e,n,t)):A.none()})))}))},l=function(t){var e=zr(t.element);return e.map((function(e){var n=so.fromTable(e),r=Xd(n,t).getOr([]),o=j(r,(function(t,e){return e.isLocked&&(t.onAny=!0,0===e.column?t.onFirst=!0:e.column+e.colspan>=n.grid.columns&&(t.onLast=!0)),t}),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:Zd(n,t).isSome(),unmergeable:tm(n,t).isSome(),locked:o}}))},f=function(){n.set(ut(s)()),o=n.get().bind(l),I(r.get(),(function(t){return t()}))},d=function(t){return t(),r.set(r.get().concat([t])),function(){r.set(F(r.get(),(function(e){return e!==t})))}},m=function(t,e){return d((function(){return n.get().fold((function(){t.setDisabled(!0)}),(function(n){t.setDisabled(e(n))}))}))},g=function(t,e,r){return d((function(){return n.get().fold((function(){t.setDisabled(!0),t.setActive(!1)}),(function(n){t.setDisabled(e(n)),t.setActive(r(n))}))}))},h=function(t){return o.exists((function(e){return e.locked[t]}))},p=function(t){return m(t,(function(t){return!1}))},v=function(t){return m(t,(function(t){return i(t.element)}))},b=function(t){return function(e){return m(e,(function(e){return i(e.element)||h(t)}))}},y=function(t){return function(e){return m(e,(function(e){return i(e.element)||t().isNone()}))}},w=function(t,e){return function(n){return m(n,(function(n){return i(n.element)||t().isNone()||h(e)}))}},x=function(t){return m(t,(function(t){return u("mergeable")}))},C=function(t){return m(t,(function(t){return u("unmergeable")}))},k=function(e){return g(e,S,(function(e){var n=zr(e.element,Ka(t));return n.exists((function(t){return hx(t,"caption")}))}))},T=function(e,n){return function(r){return g(r,(function(t){return i(t.element)}),(function(){return t.queryCommandValue(e)===n}))}},O=T("mceTableRowType","header"),E=T("mceTableColType","th");return t.on("NodeChange ExecCommand TableSelectorChange",f),{onSetupTable:p,onSetupCellOrRow:v,onSetupColumn:b,onSetupPasteable:y,onSetupPasteableColumn:w,onSetupMergeable:x,onSetupUnmergeable:C,resetTargets:f,onSetupTableWithCaption:k,onSetupTableRowHeaders:O,onSetupTableColumnHeaders:E,targets:n.get}},vx=function(t,e,n,r){t.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",fetch:function(t){return t("inserttable | cell row column | advtablesort | tableprops deletetable")}});var o=function(e){return function(){return t.execCommand(e)}};t.ui.registry.addButton("tableprops",{tooltip:"Table properties",onAction:o("mceTableProps"),icon:"table",onSetup:n.onSetupTable}),t.ui.registry.addButton("tabledelete",{tooltip:"Delete table",onAction:o("mceTableDelete"),icon:"table-delete-table",onSetup:n.onSetupTable}),t.ui.registry.addButton("tablecellprops",{tooltip:"Cell properties",onAction:o("mceTableCellProps"),icon:"table-cell-properties",onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tablemergecells",{tooltip:"Merge cells",onAction:o("mceTableMergeCells"),icon:"table-merge-cells",onSetup:n.onSetupMergeable}),t.ui.registry.addButton("tablesplitcells",{tooltip:"Split cell",onAction:o("mceTableSplitCells"),icon:"table-split-cells",onSetup:n.onSetupUnmergeable}),t.ui.registry.addButton("tableinsertrowbefore",{tooltip:"Insert row before",onAction:o("mceTableInsertRowBefore"),icon:"table-insert-row-above",onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tableinsertrowafter",{tooltip:"Insert row after",onAction:o("mceTableInsertRowAfter"),icon:"table-insert-row-after",onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tabledeleterow",{tooltip:"Delete row",onAction:o("mceTableDeleteRow"),icon:"table-delete-row",onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tablerowprops",{tooltip:"Row properties",onAction:o("mceTableRowProps"),icon:"table-row-properties",onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tableinsertcolbefore",{tooltip:"Insert column before",onAction:o("mceTableInsertColBefore"),icon:"table-insert-column-before",onSetup:n.onSetupColumn("onFirst")}),t.ui.registry.addButton("tableinsertcolafter",{tooltip:"Insert column after",onAction:o("mceTableInsertColAfter"),icon:"table-insert-column-after",onSetup:n.onSetupColumn("onLast")}),t.ui.registry.addButton("tabledeletecol",{tooltip:"Delete column",onAction:o("mceTableDeleteCol"),icon:"table-delete-column",onSetup:n.onSetupColumn("onAny")}),t.ui.registry.addButton("tablecutrow",{tooltip:"Cut row",icon:"cut-row",onAction:o("mceTableCutRow"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tablecopyrow",{tooltip:"Copy row",icon:"duplicate-row",onAction:o("mceTableCopyRow"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addButton("tablepasterowbefore",{tooltip:"Paste row before",icon:"paste-row-before",onAction:o("mceTablePasteRowBefore"),onSetup:n.onSetupPasteable(r.getRows)}),t.ui.registry.addButton("tablepasterowafter",{tooltip:"Paste row after",icon:"paste-row-after",onAction:o("mceTablePasteRowAfter"),onSetup:n.onSetupPasteable(r.getRows)}),t.ui.registry.addButton("tablecutcol",{tooltip:"Cut column",icon:"cut-column",onAction:o("mceTableCutCol"),onSetup:n.onSetupColumn("onAny")}),t.ui.registry.addButton("tablecopycol",{tooltip:"Copy column",icon:"duplicate-column",onAction:o("mceTableCopyCol"),onSetup:n.onSetupColumn("onAny")}),t.ui.registry.addButton("tablepastecolbefore",{tooltip:"Paste column before",icon:"paste-column-before",onAction:o("mceTablePasteColBefore"),onSetup:n.onSetupPasteableColumn(r.getColumns,"onFirst")}),t.ui.registry.addButton("tablepastecolafter",{tooltip:"Paste column after",icon:"paste-column-after",onAction:o("mceTablePasteColAfter"),onSetup:n.onSetupPasteableColumn(r.getColumns,"onLast")}),t.ui.registry.addButton("tableinsertdialog",{tooltip:"Insert table",onAction:o("mceInsertTable"),icon:"table"});var i=kp(Mf(t));0!==i.length&&t.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:Tp(t,e,i,"tableclass",(function(e){return t.execCommand("mceTableToggleClass",!1,e)})),onSetup:n.onSetupTable});var u=kp(Af(t));0!==u.length&&t.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:Tp(t,e,u,"tablecellclass",(function(e){return t.execCommand("mceTableCellToggleClass",!1,e)})),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:Tp(t,e,tp,"tablecellverticalalign",Sp(t,"vertical-align")),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:Tp(t,e,vf(t),"tablecellborderwidth",Sp(t,"border-width")),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:Tp(t,e,bf(t),"tablecellborderstyle",Sp(t,"border-style")),onSetup:n.onSetupCellOrRow}),t.ui.registry.addToggleButton("tablecaption",{tooltip:"Table caption",onAction:o("mceTableToggleCaption"),icon:"table-caption",onSetup:n.onSetupTableWithCaption}),t.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:function(e){return e(Op(t,jf(t),"background-color"))},onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:function(e){return e(Op(t,Wf(t),"border-color"))},onSetup:n.onSetupCellOrRow}),t.ui.registry.addToggleButton("tablerowheader",{tooltip:"Row header",icon:"table-top-header",onAction:Ep(t),onSetup:n.onSetupTableRowHeaders}),t.ui.registry.addToggleButton("tablecolheader",{tooltip:"Column header",icon:"table-left-header",onAction:_p(t),onSetup:n.onSetupTableColumnHeaders})},bx=function(t){var e=function(e){return t.dom.is(e,"table")&&t.getBody().contains(e)},n=Bf(t);n.length>0&&t.ui.registry.addContextToolbar("table",{predicate:e,items:n,scope:"node",position:"node"})},yx=function(t,e,n,r){var o=function(e){return function(){return t.execCommand(e)}},i=function(e){t.execCommand("mceInsertTable",!1,{rows:e.numRows,columns:e.numColumns})},u={text:"Table properties",onSetup:n.onSetupTable,onAction:o("mceTableProps")},a={text:"Delete table",icon:"table-delete-table",onSetup:n.onSetupTable,onAction:o("mceTableDelete")};t.ui.registry.addMenuItem("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",onAction:o("mceTableInsertRowBefore"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",onAction:o("mceTableInsertRowAfter"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tabledeleterow",{text:"Delete row",icon:"table-delete-row",onAction:o("mceTableDeleteRow"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tablerowprops",{text:"Row properties",icon:"table-row-properties",onAction:o("mceTableRowProps"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tablecutrow",{text:"Cut row",icon:"cut-row",onAction:o("mceTableCutRow"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tablecopyrow",{text:"Copy row",icon:"duplicate-row",onAction:o("mceTableCopyRow"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",onAction:o("mceTablePasteRowBefore"),onSetup:n.onSetupPasteable(r.getRows)}),t.ui.registry.addMenuItem("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",onAction:o("mceTablePasteRowAfter"),onSetup:n.onSetupPasteable(r.getRows)});var c={type:"nestedmenuitem",text:"Row",getSubmenuItems:v("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")};t.ui.registry.addMenuItem("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",onAction:o("mceTableInsertColBefore"),onSetup:n.onSetupColumn("onFirst")}),t.ui.registry.addMenuItem("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",onAction:o("mceTableInsertColAfter"),onSetup:n.onSetupColumn("onLast")}),t.ui.registry.addMenuItem("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",onAction:o("mceTableDeleteCol"),onSetup:n.onSetupColumn("onAny")}),t.ui.registry.addMenuItem("tablecutcolumn",{text:"Cut column",icon:"cut-column",onAction:o("mceTableCutCol"),onSetup:n.onSetupColumn("onAny")}),t.ui.registry.addMenuItem("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",onAction:o("mceTableCopyCol"),onSetup:n.onSetupColumn("onAny")}),t.ui.registry.addMenuItem("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",onAction:o("mceTablePasteColBefore"),onSetup:n.onSetupPasteableColumn(r.getColumns,"onFirst")}),t.ui.registry.addMenuItem("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",onAction:o("mceTablePasteColAfter"),onSetup:n.onSetupPasteableColumn(r.getColumns,"onLast")});var s={type:"nestedmenuitem",text:"Column",getSubmenuItems:v("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")};t.ui.registry.addMenuItem("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",onAction:o("mceTableCellProps"),onSetup:n.onSetupCellOrRow}),t.ui.registry.addMenuItem("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",onAction:o("mceTableMergeCells"),onSetup:n.onSetupMergeable}),t.ui.registry.addMenuItem("tablesplitcells",{text:"Split cell",icon:"table-split-cells",onAction:o("mceTableSplitCells"),onSetup:n.onSetupUnmergeable});var l={type:"nestedmenuitem",text:"Cell",getSubmenuItems:v("tablecellprops tablemergecells tablesplitcells")};!1===Ef(t)?t.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:o("mceInsertTable")}):t.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"inserttable",onAction:i}]}}),t.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:o("mceInsertTable")}),t.ui.registry.addMenuItem("tableprops",u),t.ui.registry.addMenuItem("deletetable",a),t.ui.registry.addNestedMenuItem("row",c),t.ui.registry.addNestedMenuItem("column",s),t.ui.registry.addNestedMenuItem("cell",l),t.ui.registry.addContextMenu("table",{update:function(){return n.resetTargets(),n.targets().fold(v(""),(function(t){return"caption"===nn(t.element)?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable"}))}});var f=kp(Mf(t));0!==f.length&&t.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:function(){return Cp(t,e,f,"tableclass",(function(e){return t.execCommand("mceTableToggleClass",!1,e)}))},onSetup:n.onSetupTable});var d=kp(Af(t));0!==d.length&&t.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:function(){return Cp(t,e,d,"tablecellclass",(function(e){return t.execCommand("mceTableCellToggleClass",!1,e)}))},onSetup:n.onSetupCellOrRow}),t.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:function(){return Cp(t,e,tp,"tablecellverticalalign",Sp(t,"vertical-align"))},onSetup:n.onSetupCellOrRow}),t.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:function(){return Cp(t,e,vf(t),"tablecellborderwidth",Sp(t,"border-width"))},onSetup:n.onSetupCellOrRow}),t.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:function(){return Cp(t,e,bf(t),"tablecellborderstyle",Sp(t,"border-style"))},onSetup:n.onSetupCellOrRow}),t.ui.registry.addToggleMenuItem("tablecaption",{icon:"table-caption",text:"Table caption",onAction:o("mceTableToggleCaption"),onSetup:n.onSetupTableWithCaption}),t.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:function(){return Op(t,jf(t),"background-color")},onSetup:n.onSetupCellOrRow}),t.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:function(){return Op(t,Wf(t),"border-color")},onSetup:n.onSetupCellOrRow}),t.ui.registry.addToggleMenuItem("tablerowheader",{text:"Row header",icon:"table-top-header",onAction:Ep(t),onSetup:n.onSetupTableRowHeaders}),t.ui.registry.addToggleMenuItem("tablecolheader",{text:"Column header",icon:"table-left-header",onAction:_p(t),onSetup:n.onSetupTableColumnHeaders})},wx=function(t){var e=vi((function(){return qa(t)}),(function(){return Cc(ec(t),Ka(t))}),gc.selectedSelector),n=px(t,e),r=id(t),o=gx(t,r.lazyResize,n),i=Ch(t,o,r.lazyWire),u=wv();return bv(t,i,o,e,u),yv(t,i,e),_c(t,e,i),yx(t,e,n,u),vx(t,e,n,u),bx(t),t.on("PreInit",(function(){t.serializer.addTempAttr(gc.firstSelected),t.serializer.addTempAttr(gc.lastSelected),kv(t)})),Cf(t)&&t.on("keydown",(function(e){iy(e,t,o)})),t.on("remove",(function(){r.destroy()})),Uh(t,u,r,n)};function xx(){bi.add("table",wx)}xx()})()},"99af":function(t,e,n){"use strict";var r=n("23e7"),o=n("d039"),i=n("e8b5"),u=n("861d"),a=n("7b0b"),c=n("07fa"),s=n("3511"),l=n("8418"),f=n("65f0"),d=n("1dde"),m=n("b622"),g=n("2d00"),h=m("isConcatSpreadable"),p=g>=51||!o((function(){var t=[];return t[h]=!1,t.concat()[0]!==t})),v=d("concat"),b=function(t){if(!u(t))return!1;var e=t[h];return void 0!==e?!!e:i(t)},y=!p||!v;r({target:"Array",proto:!0,arity:1,forced:y},{concat:function(t){var e,n,r,o,i,u=a(this),d=f(u,0),m=0;for(e=-1,r=arguments.length;ea(t)&&(m=w+S);var k=c(t);if(k&&m>k?(m=k,g(t,!0)):g(t,!1),m!==e.get()){var T=m-e.get();if(r.setStyle(t.getContainer(),"height",m+"px"),e.set(m),u(t),o.browser.isSafari()&&o.mac){var O=t.getWin();O.scrollTo(O.pageXOffset,O.pageYOffset)}t.hasFocus()&&p(n)&&t.selection.scrollIntoView(),o.webkit&&T<0&&v(t,e,n)}}},b=function(t,e){t.on("init",(function(){var e=s(t),n=t.dom;n.setStyles(t.getDoc().documentElement,{height:"auto"}),n.setStyles(t.getBody(),{paddingLeft:e,paddingRight:e,"min-height":0})})),t.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",(function(n){v(t,e,n)})),f(t)&&t.on("init",(function(){m(t,e,20,100,(function(){m(t,e,5,1e3)}))}))},y=function(t,e){t.addCommand("mceAutoResize",(function(){v(t,e)}))};function w(){r.add("autoresize",(function(e){if(n(e.settings,"resize")||(e.settings.resize=!1),!e.inline){var r=t(0);y(e,r),b(e,r)}}))}w()})()},be7f:function(t,e){(function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.VK"),n=function(t){var e=typeof t;return null===t?"null":"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e},r=function(t){return function(e){return n(e)===t}},o=function(t){return function(e){return typeof e===t}},i=function(t){return function(e){return t===e}},u=r("string"),a=r("array"),c=i(null),s=o("boolean"),l=o("function"),f=function(){},d=function(t){return function(){return t}},m=function(t){return t},g=function(t,e){return t===e},h=d(!1),p=d(!0),v=function(){return b},b=function(){var t=function(t){return t()},e=m,n={fold:function(t,e){return t()},isSome:h,isNone:p,getOr:e,getOrThunk:t,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:d(null),getOrUndefined:d(void 0),or:e,orThunk:t,map:v,each:f,bind:v,exists:h,forall:p,filter:function(){return v()},toArray:function(){return[]},toString:d("none()")};return n}(),y=function(t){var e=d(t),n=function(){return o},r=function(e){return e(t)},o={fold:function(e,n){return n(t)},isSome:p,isNone:h,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return y(e(t))},each:function(e){e(t)},bind:r,exists:r,forall:r,filter:function(e){return e(t)?o:b},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},w=function(t){return null===t||void 0===t?b:y(t)},x={some:y,none:v,from:w},C=Array.prototype.indexOf,S=Array.prototype.push,k=function(t,e){return C.call(t,e)},T=function(t,e){return k(t,e)>-1},O=function(t,e){for(var n=t.length,r=new Array(n),o=0;o0?t.concat(n):n},u=function(t){return t.filter((function(t){return-1===$.inArray(n,t)}))},a=e?i(r):u(r);return a.length>0?o(a):""},vt=function(t){return t.replace(/\uFEFF/g,"")},bt=function(t,e){return e=e||t.selection.getNode(),St(e)?t.dom.select("a[href]",e)[0]:t.dom.getParent(e,"a[href]")},yt=function(t,e){var n=e?e.innerText||e.textContent:t.getContent({format:"text"});return vt(n)},wt=function(t){return $.grep(t,dt).length>0},xt=function(t){return mt(t,dt).length>0},Ct=function(t){var e=t.schema.getTextInlineElements(),n=function(t){return 1===t.nodeType&&!ft(t)&&!at(e,t.nodeName.toLowerCase())},r=mt(t.selection.getRng(),n);return 0===r.length},St=function(t){return t&&"FIGURE"===t.nodeName&&/\bimage\b/i.test(t.className)},kt=function(t){var e=["title","rel","class","target"];return _(e,(function(e,n){return t[n].each((function(t){e[n]=t.length>0?t:null})),e}),{href:t.href})},Tt=function(t,e){return"http"!==e&&"https"!==e||gt(t)?t:e+"://"+t},Ot=function(t,e){var n=tt({},e);if(!(V(t).length>0)&&!1===j(t)){var r=pt(n.rel,"_blank"===n.target);n.rel=r||null}return x.from(n.target).isNone()&&!1===P(t)&&(n.target=I(t)),n.href=Tt(n.href,B(t)),n},Et=function(t,e,n,r){n.each((function(t){at(e,"innerText")?e.innerText=t:e.textContent=t})),t.dom.setAttribs(e,r),t.selection.select(e)},_t=function(t,e,n,r){St(e)?Ht(t,e,r):n.fold((function(){t.execCommand("mceInsertLink",!1,r)}),(function(e){t.insertContent(t.dom.createHTML("a",r,t.dom.encode(e)))}))},At=function(t,e,n){var r=t.selection.getNode(),o=bt(t,r),i=Ot(t,kt(n));t.undoManager.transact((function(){n.href===e.href&&e.attach(),o?(t.focus(),Et(t,o,n.text,i)):_t(t,r,n.text,i)}))},Dt=function(t){var e=t.dom,n=t.selection,r=n.getBookmark(),o=n.getRng().cloneRange(),i=e.getParent(o.startContainer,"a[href]",t.getBody()),u=e.getParent(o.endContainer,"a[href]",t.getBody());i&&o.setStartBefore(i),u&&o.setEndAfter(u),n.setRng(o),t.execCommand("unlink"),n.moveToBookmark(r)},Mt=function(t){t.undoManager.transact((function(){var e=t.selection.getNode();St(e)?Lt(t,e):Dt(t),t.focus()}))},zt=function(t){var e=t.class,n=t.href,r=t.rel,o=t.target,i=t.text,u=t.title;return ut({class:e.getOrNull(),href:n,rel:r.getOrNull(),target:o.getOrNull(),text:i.getOrNull(),title:u.getOrNull()},(function(t,e){return!1===c(t)}))},Rt=function(t,e){var n=e.href;return tt(tt({},e),{href:lt.isDomSafe(n,"a",t.settings)?n:""})},Nt=function(t,e,n){var r=Rt(t,n);t.hasPlugin("rtc",!0)?t.execCommand("createlink",!1,zt(r)):At(t,e,r)},Bt=function(t){t.hasPlugin("rtc",!0)?t.execCommand("unlink"):Mt(t)},Lt=function(t,e){var n=t.dom.select("img",e)[0];if(n){var r=t.dom.getParents(n,"a[href]",e)[0];r&&(r.parentNode.insertBefore(n,r),t.dom.remove(r))}},Ht=function(t,e,n){var r=t.dom.select("img",e)[0];if(r){var o=t.dom.create("a",n);r.parentNode.insertBefore(o,r),o.appendChild(r)}},It=function(t){return ct(t,"items")},Pt=function(t,e){return M(e,(function(e){return It(e)?Pt(t,e.items):N(e.value===t,e)}))},Vt=function(t,e,n,r){var o=r[e],i=t.length>0;return void 0!==o?Pt(o,n).map((function(e){return{url:{value:e.value,meta:{text:i?t:e.text,attach:f}},text:i?t:e.text}})):x.none()},Ft=function(t,e){return"link"===e?t.link:"anchor"===e?t.anchor:x.none()},Ut=function(t,e){var n={text:t.text,title:t.title},r=function(t){return N(n.title.length<=0,x.from(t.meta.title).getOr(""))},o=function(t){return N(n.text.length<=0,x.from(t.meta.text).getOr(t.value))},i=function(t){var e=o(t.url),n=r(t.url);return e.isSome()||n.isSome()?x.some(tt(tt({},e.map((function(t){return{text:t}})).getOr({})),n.map((function(t){return{title:t}})).getOr({}))):x.none()},u=function(t,r){var o=Ft(e,r.name).getOr([]);return Vt(n.text,r.name,o,t)},a=function(t,e){var r=e.name;return"url"===r?i(t()):T(["anchor","link"],r)?u(t(),e):"text"===r||"title"===r?(n[r]=t()[r],x.none()):x.none()};return{onChange:a}},jt={init:Ut,getDelta:Vt},Wt=tinymce.util.Tools.resolve("tinymce.util.Delay"),qt=tinymce.util.Tools.resolve("tinymce.util.Promise"),$t=function(t,e,n){var r=t.selection.getRng();Wt.setEditorTimeout(t,(function(){t.windowManager.confirm(e,(function(e){t.selection.setRng(r),n(e)}))}))},Gt=function(t){var e=t.href,n=e.indexOf("@")>0&&-1===e.indexOf("/")&&-1===e.indexOf("mailto:");return n?x.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:function(t){return tt(tt({},t),{href:"mailto:"+e})}}):x.none()},Kt=function(t,e){return function(n){var r=n.href,o=1===t&&!gt(r)||0===t&&/^\s*www(\.|\d\.)/i.test(r);return o?x.some({message:"The URL you entered seems to be an external link. Do you want to add the required "+e+":// prefix?",preprocess:function(t){return tt(tt({},t),{href:e+"://"+r})}}):x.none()}},Xt=function(t,e){return M([Gt,Kt(B(t),q(t))],(function(t){return t(e)})).fold((function(){return qt.resolve(e)}),(function(n){return new qt((function(r){$t(t,n.message,(function(t){r(t?n.preprocess(e):e)}))}))}))},Yt={preprocess:Xt},Jt=function(t){var e=t.dom.select("a:not([href])"),n=D(e,(function(t){var e=t.name||t.id;return e?[{text:e,value:"#"+e}]:[]}));return n.length>0?x.some([{text:"None",value:""}].concat(n)):x.none()},Qt={getAnchors:Jt},Zt=function(t){var e=F(t);return e.length>0?Z.sanitize(e):x.none()},te={getClasses:Zt},ee=tinymce.util.Tools.resolve("tinymce.util.XHR"),ne=function(t){try{return x.some(JSON.parse(t))}catch(e){return x.none()}},re=function(t){var e=function(e){return t.convertURL(e.value||e.url,"href")},n=H(t);return new qt((function(t){u(n)?ee.send({url:n,success:function(e){return t(ne(e))},error:function(e){return t(x.none())}}):l(n)?n((function(e){return t(x.some(e))})):t(x.from(n))})).then((function(t){return t.bind(Z.sanitizeWith(e)).map((function(t){if(t.length>0){var e=[{text:"None",value:""}];return e.concat(t)}return t}))}))},oe={getLinks:re},ie=function(t,e){var n=V(t);if(n.length>0){var r=z(e,"_blank"),o=!1===j(t),i=function(t){return pt(Z.getValue(t),r)},u=o?Z.sanitizeWith(i):Z.sanitize;return u(n)}return x.none()},ue={getRels:ie},ae=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],ce=function(t){var e=P(t);return a(e)?Z.sanitize(e).orThunk((function(){return x.some(ae)})):!1===e?x.none():x.some(ae)},se={getTargets:ce},le=function(t,e,n){var r=t.getAttrib(e,n);return null!==r&&r.length>0?x.some(r):x.none()},fe=function(t,e){var n=t.dom,r=Ct(t),o=r?x.some(yt(t.selection,e)):x.none(),i=e?x.some(n.getAttrib(e,"href")):x.none(),u=e?x.from(n.getAttrib(e,"target")):x.none(),a=le(n,e,"rel"),c=le(n,e,"class"),s=le(n,e,"title");return{url:i,text:o,title:s,target:u,rel:a,linkClass:c}},de=function(t,e){return oe.getLinks(t).then((function(n){var r=fe(t,e);return{anchor:r,catalogs:{targets:se.getTargets(t),rels:ue.getRels(t,r.target),classes:te.getClasses(t),anchor:Qt.getAnchors(t),link:n},optNode:x.from(e),flags:{titleEnabled:U(t)}}}))},me={collect:de},ge=function(t,e){return function(n){var r=n.getData();if(!r.url.value)return Bt(t),void n.close();var o=function(t){return x.from(r[t]).filter((function(n){return!z(e.anchor[t],n)}))},i={href:r.url.value,text:o("text"),target:o("target"),rel:o("rel"),class:o("linkClass"),title:o("title")},u={href:r.url.value,attach:void 0!==r.url.meta&&r.url.meta.attach?r.url.meta.attach:f};Yt.preprocess(t,i).then((function(e){Nt(t,u,e)})),n.close()}},he=function(t){var e=bt(t);return me.collect(t,e)},pe=function(t,e){var n=t.anchor,r=n.url.getOr("");return{url:{value:r,meta:{original:{value:r}}},text:n.text.getOr(""),title:n.title.getOr(""),anchor:r,link:r,rel:n.rel.getOr(""),target:n.target.or(e).getOr(""),linkClass:n.linkClass.getOr("")}},ve=function(t,e,n){var r=[{name:"url",type:"urlinput",filetype:"file",label:"URL"}],o=t.anchor.text.map((function(){return{name:"text",type:"input",label:"Text to display"}})).toArray(),i=t.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],u=x.from(I(n)),a=pe(t,u),c=t.catalogs,s=jt.init(a,c),l={type:"panel",items:A([r,o,i,R([c.anchor.map(Z.createUi("anchor","Anchors")),c.rels.map(Z.createUi("rel","Rel")),c.targets.map(Z.createUi("target","Open link in...")),c.link.map(Z.createUi("link","Link list")),c.classes.map(Z.createUi("linkClass","Class"))])])};return{title:"Insert/Edit Link",size:"normal",body:l,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:a,onChange:function(t,e){var n=e.name;s.onChange(t.getData,{name:n}).each((function(e){t.setData(e)}))},onSubmit:e}},be=function(t){var e=he(t);e.then((function(e){var n=ge(t,e);return ve(e,n,t)})).then((function(e){t.windowManager.open(e)}))},ye=function(t,e){document.body.appendChild(t),t.dispatchEvent(e),document.body.removeChild(t)},we=function(t){var e=document.createElement("a");e.target="_blank",e.href=t,e.rel="noreferrer noopener";var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ye(e,n)},xe=function(t,e){return t.dom.getParent(e,"a[href]")},Ce=function(t){return xe(t,t.selection.getStart())},Se=function(t){return!0===t.altKey&&!1===t.shiftKey&&!1===t.ctrlKey&&!1===t.metaKey},ke=function(t,e){if(e){var n=ht(e);if(/^#/.test(n)){var r=t.$(n);r.length&&t.selection.scrollIntoView(r[0],!0)}else we(e.href)}},Te=function(t){return function(){be(t)}},Oe=function(t){return function(){ke(t,Ce(t))}},Ee=function(t){t.on("click",(function(n){var r=xe(t,n.target);r&&e.metaKeyPressed(n)&&(n.preventDefault(),ke(t,r))})),t.on("keydown",(function(e){var n=Ce(t);n&&13===e.keyCode&&Se(e)&&(e.preventDefault(),ke(t,n))}))},_e=function(t,e){return t.on("NodeChange",e),function(){return t.off("NodeChange",e)}},Ae=function(t){return function(e){var n=function(){return e.setActive(!t.mode.isReadOnly()&&null!==bt(t,t.selection.getNode()))};return n(),_e(t,n)}},De=function(t){return function(e){var n=function(){return e.setDisabled(null===bt(t,t.selection.getNode()))};return n(),_e(t,n)}},Me=function(t){return function(e){var n=function(e){return wt(e)||xt(t.selection.getRng())},r=t.dom.getParents(t.selection.getStart());return e.setDisabled(!n(r)),_e(t,(function(t){return e.setDisabled(!n(t.parents))}))}},ze=function(t){t.addCommand("mceLink",(function(){W(t)?t.fire("contexttoolbar-show",{toolbarKey:"quicklink"}):Te(t)()}))},Re=function(t){t.addShortcut("Meta+K","",(function(){t.execCommand("mceLink")}))},Ne=function(t){t.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",onAction:Te(t),onSetup:Ae(t)}),t.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:Oe(t),onSetup:De(t)}),t.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:function(){return Bt(t)},onSetup:Me(t)})},Be=function(t){t.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:Oe(t),onSetup:De(t)}),t.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onAction:Te(t)}),t.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:function(){return Bt(t)},onSetup:Me(t)})},Le=function(t){var e="link unlink openlink",n="link";t.ui.registry.addContextMenu("link",{update:function(r){return wt(t.dom.getParents(r,"a"))?e:n}})},He=function(t){var e=function(t){t.selection.collapse(!1)},n=function(e){var n=t.selection.getNode();return e.setDisabled(!bt(t,n)),f},r=function(e){var n=bt(t),r=Ct(t);if(!n&&r){var o=yt(t.selection,n);return x.some(o.length>0?o:e)}return x.none()};t.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Ae(t)},label:"Link",predicate:function(e){return!!bt(t,e)&&L(t)},initValue:function(){var e=bt(t);return e?ht(e):""},commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:function(e){var n=t.selection.getNode();return e.setActive(!!bt(t,n)),Ae(t)(e)},onAction:function(n){var o=n.getValue(),i=r(o),u={href:o,attach:f};Nt(t,u,{href:o,text:i,title:x.none(),rel:x.none(),target:x.none(),class:x.none()}),e(t),n.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:n,onAction:function(e){Bt(t),e.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:n,onAction:function(e){Oe(t)(),e.hide()}}]})};function Ie(){t.add("link",(function(t){Ne(t),Be(t),Le(t),He(t),Ee(t),ze(t),Re(t)}))}Ie()})()},cdd9:function(t,e){(function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(){return e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0&&e1)throw console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return W(r.childNodes[0])},U=function(t,e){var n=e||document,r=n.createElement(t);return W(r)},j=function(t,e){var n=e||document,r=n.createTextNode(t);return W(r)},W=function(t){if(null===t||void 0===t)throw new Error("Node cannot be null or undefined");return{dom:t}},q=function(t,e,n){return k.from(t.dom.elementFromPoint(e,n)).map(W)},$={fromHtml:F,fromTag:U,fromText:j,fromDom:W,fromPoint:q},G=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),K=tinymce.util.Tools.resolve("tinymce.util.Promise"),X=tinymce.util.Tools.resolve("tinymce.util.URI"),Y=tinymce.util.Tools.resolve("tinymce.util.XHR"),J=function(t){return t.getParam("image_dimensions",!0,"boolean")},Q=function(t){return t.getParam("image_advtab",!1,"boolean")},Z=function(t){return t.getParam("image_uploadtab",!0,"boolean")},tt=function(t){return t.getParam("image_prepend_url","","string")},et=function(t){return t.getParam("image_class_list")},nt=function(t){return t.getParam("image_description",!0,"boolean")},rt=function(t){return t.getParam("image_title",!1,"boolean")},ot=function(t){return t.getParam("image_caption",!1,"boolean")},it=function(t){return t.getParam("image_list",!1)},ut=function(t){return d(t.getParam("images_upload_url"))},at=function(t){return d(t.getParam("images_upload_handler"))},ct=function(t){return t.getParam("a11y_advanced_options",!1,"boolean")},st=function(t){return t.getParam("automatic_uploads",!0,"boolean")},lt=function(t,e){return Math.max(parseInt(t,10),parseInt(e,10))},ft=function(t){return new K((function(e){var n=document.createElement("img"),r=function(t){n.onload=n.onerror=null,n.parentNode&&n.parentNode.removeChild(n),e(t)};n.onload=function(){var t=lt(n.width,n.clientWidth),e=lt(n.height,n.clientHeight),o={width:t,height:e};r(K.resolve(o))},n.onerror=function(){r(K.reject("Failed to get image dimensions for: "+t))};var o=n.style;o.visibility="hidden",o.position="fixed",o.bottom=o.left="0px",o.width=o.height="auto",document.body.appendChild(n),n.src=t}))},dt=function(t){return t&&(t=t.replace(/px$/,"")),t},mt=function(t){return t.length>0&&/^[0-9]+$/.test(t)&&(t+="px"),t},gt=function(t){if(t.margin){var e=String(t.margin).split(" ");switch(e.length){case 1:t["margin-top"]=t["margin-top"]||e[0],t["margin-right"]=t["margin-right"]||e[0],t["margin-bottom"]=t["margin-bottom"]||e[0],t["margin-left"]=t["margin-left"]||e[0];break;case 2:t["margin-top"]=t["margin-top"]||e[0],t["margin-right"]=t["margin-right"]||e[1],t["margin-bottom"]=t["margin-bottom"]||e[0],t["margin-left"]=t["margin-left"]||e[1];break;case 3:t["margin-top"]=t["margin-top"]||e[0],t["margin-right"]=t["margin-right"]||e[1],t["margin-bottom"]=t["margin-bottom"]||e[2],t["margin-left"]=t["margin-left"]||e[1];break;case 4:t["margin-top"]=t["margin-top"]||e[0],t["margin-right"]=t["margin-right"]||e[1],t["margin-bottom"]=t["margin-bottom"]||e[2],t["margin-left"]=t["margin-left"]||e[3]}delete t.margin}return t},ht=function(t,e){var n=it(t);u(n)?Y.send({url:n,success:function(t){e(JSON.parse(t))}}):m(n)?n(e):e(n)},pt=function(t,e,n){var r=function(){n.onload=n.onerror=null,t.selection&&(t.selection.select(n),t.nodeChanged())};n.onload=function(){e.width||e.height||!J(t)||t.dom.setAttribs(n,{width:String(n.clientWidth),height:String(n.clientHeight)}),r()},n.onerror=r},vt=function(t){return new K((function(e,n){var r=new FileReader;r.onload=function(){e(r.result)},r.onerror=function(){n(r.error.message)},r.readAsDataURL(t)}))},bt=function(t){return"IMG"===t.nodeName&&(t.hasAttribute("data-mce-object")||t.hasAttribute("data-mce-placeholder"))},yt=function(t,e){return X.isDomSafe(e,"img",t.settings)},wt=G.DOM,xt=function(t){return t.style.marginLeft&&t.style.marginRight&&t.style.marginLeft===t.style.marginRight?dt(t.style.marginLeft):""},Ct=function(t){return t.style.marginTop&&t.style.marginBottom&&t.style.marginTop===t.style.marginBottom?dt(t.style.marginTop):""},St=function(t){return t.style.borderWidth?dt(t.style.borderWidth):""},kt=function(t,e){return t.hasAttribute(e)?t.getAttribute(e):""},Tt=function(t,e){return t.style[e]?t.style[e]:""},Ot=function(t){return null!==t.parentNode&&"FIGURE"===t.parentNode.nodeName},Et=function(t,e,n){""===n?t.removeAttribute(e):t.setAttribute(e,n)},_t=function(t){var e=wt.create("figure",{class:"image"});wt.insertAfter(e,t),e.appendChild(t),e.appendChild(wt.create("figcaption",{contentEditable:"true"},"Caption")),e.contentEditable="false"},At=function(t){var e=t.parentNode;wt.insertAfter(t,e),wt.remove(e)},Dt=function(t){Ot(t)?At(t):_t(t)},Mt=function(t,e){var n=t.getAttribute("style"),r=e(null!==n?n:"");r.length>0?(t.setAttribute("style",r),t.setAttribute("data-mce-style",r)):t.removeAttribute("style")},zt=function(t,e){return function(t,n,r){t.style[n]?(t.style[n]=mt(r),Mt(t,e)):Et(t,n,r)}},Rt=function(t,e){return t.style[e]?dt(t.style[e]):kt(t,e)},Nt=function(t,e){var n=mt(e);t.style.marginLeft=n,t.style.marginRight=n},Bt=function(t,e){var n=mt(e);t.style.marginTop=n,t.style.marginBottom=n},Lt=function(t,e){var n=mt(e);t.style.borderWidth=n},Ht=function(t,e){t.style.borderStyle=e},It=function(t){return Tt(t,"borderStyle")},Pt=function(t){return"FIGURE"===t.nodeName},Vt=function(t){return"IMG"===t.nodeName},Ft=function(t){return 0===wt.getAttrib(t,"alt").length&&"presentation"===wt.getAttrib(t,"role")},Ut=function(t){return Ft(t)?"":kt(t,"alt")},jt=function(){return{src:"",alt:"",title:"",width:"",height:"",class:"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:"",isDecorative:!1}},Wt=function(t,e){var n=document.createElement("img");return Et(n,"style",e.style),(xt(n)||""!==e.hspace)&&Nt(n,e.hspace),(Ct(n)||""!==e.vspace)&&Bt(n,e.vspace),(St(n)||""!==e.border)&&Lt(n,e.border),(It(n)||""!==e.borderStyle)&&Ht(n,e.borderStyle),t(n.getAttribute("style"))},qt=function(t,n){var r=document.createElement("img");if(Jt(t,e(e({},n),{caption:!1}),r),Kt(r,n.alt,n.isDecorative),n.caption){var o=wt.create("figure",{class:"image"});return o.appendChild(r),o.appendChild(wt.create("figcaption",{contentEditable:"true"},"Caption")),o.contentEditable="false",o}return r},$t=function(t,e){return{src:kt(e,"src"),alt:Ut(e),title:kt(e,"title"),width:Rt(e,"width"),height:Rt(e,"height"),class:kt(e,"class"),style:t(kt(e,"style")),caption:Ot(e),hspace:xt(e),vspace:Ct(e),border:St(e),borderStyle:Tt(e,"borderStyle"),isDecorative:Ft(e)}},Gt=function(t,e,n,r,o){n[r]!==e[r]&&o(t,r,n[r])},Kt=function(t,e,n){if(n){wt.setAttrib(t,"role","presentation");var r=$.fromDom(t);P(r,"alt","")}else{if(s(e)){r=$.fromDom(t);V(r,"alt")}else{r=$.fromDom(t);P(r,"alt",e)}"presentation"===wt.getAttrib(t,"role")&&wt.setAttrib(t,"role","")}},Xt=function(t,e,n){n.alt===e.alt&&n.isDecorative===e.isDecorative||Kt(t,n.alt,n.isDecorative)},Yt=function(t,e){return function(n,r,o){t(n,o),Mt(n,e)}},Jt=function(t,e,n){var r=$t(t,n);Gt(n,r,e,"caption",(function(t,e,n){return Dt(t)})),Gt(n,r,e,"src",Et),Gt(n,r,e,"title",Et),Gt(n,r,e,"width",zt("width",t)),Gt(n,r,e,"height",zt("height",t)),Gt(n,r,e,"class",Et),Gt(n,r,e,"style",Yt((function(t,e){return Et(t,"style",e)}),t)),Gt(n,r,e,"hspace",Yt(Nt,t)),Gt(n,r,e,"vspace",Yt(Bt,t)),Gt(n,r,e,"border",Yt(Lt,t)),Gt(n,r,e,"borderStyle",Yt(Ht,t)),Xt(n,r,e)},Qt=function(t,e){var n=t.dom.styles.parse(e),r=gt(n),o=t.dom.styles.parse(t.dom.styles.serialize(r));return t.dom.styles.serialize(o)},Zt=function(t){var e=t.selection.getNode(),n=t.dom.getParent(e,"figure.image");return n?t.dom.select("img",n)[0]:e&&("IMG"!==e.nodeName||bt(e))?null:e},te=function(t,e){var n=t.dom,r=D(t.schema.getTextBlockElements(),(function(e,n){return!t.schema.isValidChild(n,"figure")})),o=n.getParent(e.parentNode,(function(t){return z(r,t.nodeName)}),t.getBody());return o?n.split(o,e):e},ee=function(t){var e=Zt(t);return e?$t((function(e){return Qt(t,e)}),e):jt()},ne=function(t,e){var n=qt((function(e){return Qt(t,e)}),e);t.dom.setAttrib(n,"data-mce-id","__mcenew"),t.focus(),t.selection.setContent(n.outerHTML);var r=t.dom.select('*[data-mce-id="__mcenew"]')[0];if(t.dom.setAttrib(r,"data-mce-id",null),Pt(r)){var o=te(t,r);t.selection.select(o)}else t.selection.select(r)},re=function(t,e){t.dom.setAttrib(e,"src",e.getAttribute("src"))},oe=function(t,e){if(e){var n=t.dom.is(e.parentNode,"figure.image")?e.parentNode:e;t.dom.remove(n),t.focus(),t.nodeChanged(),t.dom.isEmpty(t.getBody())&&(t.setContent(""),t.selection.setCursorLocation())}},ie=function(t,e){var n=Zt(t);if(Jt((function(e){return Qt(t,e)}),e,n),re(t,n),Pt(n.parentNode)){var r=n.parentNode;te(t,r),t.selection.select(n.parentNode)}else t.selection.select(n),pt(t,e,n)},ue=function(t,n){var r=n.src;return e(e({},n),{src:yt(t,r)?r:""})},ae=function(t,n){var r=Zt(t);if(r){var o=$t((function(e){return Qt(t,e)}),r),i=e(e({},o),n),u=ue(t,i);i.src?ie(t,u):oe(t,r)}else n.src&&ne(t,e(e({},jt()),n))},ce=function(t,e){var n=a(t)&&a(e);return n?le(t,e):e},se=function(t){return function(){for(var e=[],n=0;n0},de=tinymce.util.Tools.resolve("tinymce.util.ImageUploader"),me=tinymce.util.Tools.resolve("tinymce.util.Tools"),ge=function(t){return u(t.value)?t.value:""},he=function(t){return u(t.text)?t.text:u(t.title)?t.title:""},pe=function(t,e){var n=[];return me.each(t,(function(t){var r=he(t);if(void 0!==t.menu){var o=pe(t.menu,e);n.push({text:r,items:o})}else{var i=e(t);n.push({text:r,value:i})}})),n},ve=function(t){return void 0===t&&(t=ge),function(e){return e?k.from(e).map((function(e){return pe(e,t)})):k.none()}},be=function(t){return ve(ge)(t)},ye=function(t){return M(t,"items")},we=function(t,e){return H(t,(function(t){return ye(t)?we(t.items,e):t.value===e?k.some(t):k.none()}))},xe=function(t,e){return t.bind((function(t){return we(t,e)}))},Ce={sanitizer:ve,sanitize:be,findEntry:xe},Se=function(t){return{title:"Advanced",name:"advanced",items:[{type:"input",label:"Style",name:"style"},{type:"grid",columns:2,items:[{type:"input",label:"Vertical space",name:"vspace",inputMode:"numeric"},{type:"input",label:"Horizontal space",name:"hspace",inputMode:"numeric"},{type:"input",label:"Border width",name:"border",inputMode:"numeric"},{type:"listbox",name:"borderstyle",label:"Border style",items:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]}},ke={makeTab:Se},Te=function(t){var e=Ce.sanitizer((function(e){return t.convertURL(e.value||e.url,"src")})),n=new K((function(n){ht(t,(function(t){n(e(t).map((function(t){return N([[{text:"None",value:""}],t])})))}))})),r=Ce.sanitize(et(t)),o=Q(t),i=Z(t),a=ut(t),c=at(t),s=ee(t),l=nt(t),f=rt(t),d=J(t),m=ot(t),g=ct(t),h=st(t),p=k.some(tt(t)).filter((function(t){return u(t)&&t.length>0}));return n.then((function(t){return{image:s,imageList:t,classList:r,hasAdvTab:o,hasUploadTab:i,hasUploadUrl:a,hasUploadHandler:c,hasDescription:l,hasImageTitle:f,hasDimensions:d,hasImageCaption:m,prependURL:p,hasAccessibilityOptions:g,automaticUploads:h}}))},Oe=function(t){var n={name:"src",type:"urlinput",filetype:"image",label:"Source"},r=t.imageList.map((function(t){return{name:"images",type:"listbox",label:"Image list",items:t}})),o={name:"alt",type:"input",label:"Alternative description",disabled:t.hasAccessibilityOptions&&t.image.isDecorative},i={name:"title",type:"input",label:"Image title"},u={name:"dimensions",type:"sizeinput"},a={type:"label",label:"Accessibility",items:[{name:"isDecorative",type:"checkbox",label:"Image is decorative"}]},c=t.classList.map((function(t){return{name:"classes",type:"listbox",label:"Class",items:t}})),s={type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]},l=function(t){return t?{type:"grid",columns:2}:{type:"panel"}};return N([[n],r.toArray(),t.hasAccessibilityOptions&&t.hasDescription?[a]:[],t.hasDescription?[o]:[],t.hasImageTitle?[i]:[],t.hasDimensions?[u]:[],[e(e({},l(t.classList.isSome()&&t.hasImageCaption)),{items:N([c.toArray(),t.hasImageCaption?[s]:[]])})]])},Ee=function(t){return{title:"General",name:"general",items:Oe(t)}},_e={makeTab:Ee,makeItems:Oe},Ae=function(t){var e=[{type:"dropzone",name:"fileinput"}];return{title:"Upload",name:"upload",items:e}},De={makeTab:Ae},Me=function(t){return{prevImage:Ce.findEntry(t.imageList,t.image.src),prevAlt:t.image.alt,open:!0}},ze=function(t){return{src:{value:t.src,meta:{}},images:t.src,alt:t.alt,title:t.title,dimensions:{width:t.width,height:t.height},classes:t.class,caption:t.caption,style:t.style,vspace:t.vspace,border:t.border,hspace:t.hspace,borderstyle:t.borderStyle,fileinput:[],isDecorative:t.isDecorative}},Re=function(t,e){return{src:t.src.value,alt:0===t.alt.length&&e?null:t.alt,title:t.title,width:t.dimensions.width,height:t.dimensions.height,class:t.classes,style:t.style,caption:t.caption,hspace:t.hspace,vspace:t.vspace,border:t.border,borderStyle:t.borderstyle,isDecorative:t.isDecorative}},Ne=function(t,e){return/^(?:[a-zA-Z]+:)?\/\//.test(e)?k.none():t.prependURL.bind((function(t){return e.substring(0,t.length)!==t?k.some(t+e):k.none()}))},Be=function(t,e){var n=e.getData();Ne(t,n.src.value).each((function(t){e.setData({src:{value:t,meta:n.src.meta}})}))},Le=function(t,e,n){t.hasDescription&&u(n.alt)&&(e.alt=n.alt),t.hasAccessibilityOptions&&(e.isDecorative=n.isDecorative||e.isDecorative||!1),t.hasImageTitle&&u(n.title)&&(e.title=n.title),t.hasDimensions&&(u(n.width)&&(e.dimensions.width=n.width),u(n.height)&&(e.dimensions.height=n.height)),u(n.class)&&Ce.findEntry(t.classList,n.class).each((function(t){e.classes=t.value})),t.hasImageCaption&&l(n.caption)&&(e.caption=n.caption),t.hasAdvTab&&(u(n.style)&&(e.style=n.style),u(n.vspace)&&(e.vspace=n.vspace),u(n.border)&&(e.border=n.border),u(n.hspace)&&(e.hspace=n.hspace),u(n.borderstyle)&&(e.borderstyle=n.borderstyle))},He=function(t,e){var n=e.getData(),r=n.src.meta;if(void 0!==r){var o=le({},n);Le(t,o,r),e.setData(o)}},Ie=function(t,e,n,r){var o=r.getData(),i=o.src.value,u=o.src.meta||{};u.width||u.height||!e.hasDimensions||(fe(i)?t.imageSize(i).then((function(t){n.open&&r.setData({dimensions:t})})).catch((function(t){return console.error(t)})):r.setData({dimensions:{width:"",height:""}}))},Pe=function(t,e,n){var r=n.getData(),o=Ce.findEntry(t.imageList,r.src.value);e.prevImage=o,n.setData({images:o.map((function(t){return t.value})).getOr("")})},Ve=function(t,e,n,r){Be(e,r),He(e,r),Ie(t,e,n,r),Pe(e,n,r)},Fe=function(t,e,n,r){var o=r.getData(),i=Ce.findEntry(e.imageList,o.images);i.each((function(t){var e=""===o.alt||n.prevImage.map((function(t){return t.text===o.alt})).getOr(!1);e?""===t.value?r.setData({src:t,alt:n.prevAlt}):r.setData({src:t,alt:t.text}):r.setData({src:t})})),n.prevImage=i,Ve(t,e,n,r)},Ue=function(t){var e=t["margin-top"]&&t["margin-bottom"]&&t["margin-top"]===t["margin-bottom"];return e?dt(String(t["margin-top"])):""},je=function(t){var e=t["margin-right"]&&t["margin-left"]&&t["margin-right"]===t["margin-left"];return e?dt(String(t["margin-right"])):""},We=function(t){return t["border-width"]?dt(String(t["border-width"])):""},qe=function(t){return t["border-style"]?String(t["border-style"]):""},$e=function(t,e,n){return e(t(e(n)))},Ge=function(t,e,n){var r=gt(t(n.style)),o=le({},n);return o.vspace=Ue(r),o.hspace=je(r),o.border=We(r),o.borderstyle=qe(r),o.style=$e(t,e,r),o},Ke=function(t,e){var n=e.getData(),r=Ge(t.parseStyle,t.serializeStyle,n);e.setData(r)},Xe=function(t,e,n){var r=le(ze(e.image),n.getData()),o=Wt(t.normalizeCss,Re(r,!1));n.setData({style:o})},Ye=function(t,e,n,r){var o=r.getData();r.block("Uploading image"),L(o.fileinput).fold((function(){r.unblock()}),(function(o){var i=URL.createObjectURL(o),u=function(){r.unblock(),URL.revokeObjectURL(i)},a=function(o){r.setData({src:{value:o,meta:{}}}),r.showTab("general"),Ve(t,e,n,r)};vt(o).then((function(n){var c=t.createBlobCache(o,i,n);e.automaticUploads?t.uploadImage(c).then((function(t){a(t.url),u()})).catch((function(e){u(),t.alertErr(e)})):(t.addToBlobCache(c),a(c.blobUri()),r.unblock())}))}))},Je=function(t,e,n){return function(r,o){"src"===o.name?Ve(t,e,n,r):"images"===o.name?Fe(t,e,n,r):"alt"===o.name?n.prevAlt=r.getData().alt:"style"===o.name?Ke(t,r):"vspace"===o.name||"hspace"===o.name||"border"===o.name||"borderstyle"===o.name?Xe(t,e,r):"fileinput"===o.name?Ye(t,e,n,r):"isDecorative"===o.name&&(r.getData().isDecorative?r.disable("alt"):r.enable("alt"))}},Qe=function(t){return function(){t.open=!1}},Ze=function(t){if(t.hasAdvTab||t.hasUploadUrl||t.hasUploadHandler){var e={type:"tabpanel",tabs:N([[_e.makeTab(t)],t.hasAdvTab?[ke.makeTab(t)]:[],t.hasUploadTab&&(t.hasUploadUrl||t.hasUploadHandler)?[De.makeTab(t)]:[]])};return e}var n={type:"panel",items:_e.makeItems(t)};return n},tn=function(t){return function(e){var n=Me(e);return{title:"Insert/Edit Image",size:"normal",body:Ze(e),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:ze(e.image),onSubmit:t.onSubmit(e),onChange:Je(t,e,n),onClose:Qe(n)}}},en=function(t){return function(e){return function(n){var r=le(ze(e.image),n.getData());t.execCommand("mceUpdateImage",!1,Re(r,e.hasAccessibilityOptions)),t.editorUpload.uploadImagesAuto(),n.close()}}},nn=function(t){return function(e){return yt(t,e)?ft(t.documentBaseURI.toAbsolute(e)).then((function(t){return{width:String(t.width),height:String(t.height)}})):K.resolve({width:"",height:""})}},rn=function(t){return function(e,n,r){return t.editorUpload.blobCache.create({blob:e,blobUri:n,name:e.name?e.name.replace(/\.[^\.]+$/,""):null,filename:e.name,base64:r.split(",")[1]})}},on=function(t){return function(e){t.editorUpload.blobCache.add(e)}},un=function(t){return function(e){t.windowManager.alert(e)}},an=function(t){return function(e){return Qt(t,e)}},cn=function(t){return function(e){return t.dom.parseStyle(e)}},sn=function(t){return function(e,n){return t.dom.serializeStyle(e,n)}},ln=function(t){return function(e){return de(t).upload([e],!1).then((function(t){return 0===t.length?K.reject("Failed to upload image"):!1===t[0].status?K.reject(t[0].error.message):t[0]}))}},fn=function(t){var e={onSubmit:en(t),imageSize:nn(t),addToBlobCache:on(t),createBlobCache:rn(t),alertErr:un(t),normalizeCss:an(t),parseStyle:cn(t),serializeStyle:sn(t),uploadImage:ln(t)},n=function(){Te(t).then(tn(e)).then(t.windowManager.open)};return{open:n}},dn=function(t){t.addCommand("mceImage",fn(t).open),t.addCommand("mceUpdateImage",(function(e,n){t.undoManager.transact((function(){return ae(t,n)}))}))},mn=function(t){var e=t.attr("class");return e&&/\bimage\b/.test(e)},gn=function(t){return function(e){var n=e.length,r=function(e){e.attr("contenteditable",t?"true":null)};while(n--){var o=e[n];mn(o)&&(o.attr("contenteditable",t?"false":null),me.each(o.getAll("figcaption"),r))}}},hn=function(t){t.on("PreInit",(function(){t.parser.addNodeFilter("figure",gn(!0)),t.serializer.addNodeFilter("figure",gn(!1))}))},pn=function(t){t.ui.registry.addToggleButton("image",{icon:"image",tooltip:"Insert/edit image",onAction:fn(t).open,onSetup:function(e){return e.setActive(d(Zt(t))),t.selection.selectorChangedWithUnbind("img:not([data-mce-object],[data-mce-placeholder]),figure.image",e.setActive).unbind}}),t.ui.registry.addMenuItem("image",{icon:"image",text:"Image...",onAction:fn(t).open}),t.ui.registry.addContextMenu("image",{update:function(t){return Pt(t)||Vt(t)&&!bt(t)?["image"]:[]}})};function vn(){t.add("image",(function(t){hn(t),pn(t),dn(t)}))}vn()})()},d81d:function(t,e,n){"use strict";var r=n("23e7"),o=n("b727").map,i=n("1dde"),u=i("map");r({target:"Array",proto:!0,forced:!u},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},e562:function(t,e,n){(function(e){(function(){"use strict";var n=function(t){if(null===t)return"null";if(void 0===t)return"undefined";var e=typeof t;return"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e},r=function(t){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(t)},o=function(t,e){var n=Array.prototype.slice.call(t);return n.sort(e)},i=function(t,e){return u((function(n,r){return t.eq(e(n),e(r))}))},u=function(t){return{eq:t}},a=u((function(t,e){return t===e})),c=a,s=function(t){return u((function(e,n){if(e.length!==n.length)return!1;for(var r=e.length,o=0;o-1},J=function(t,e){for(var n=0,r=t.length;n=0;n--){var r=t[n];e(r,n)}},et=function(t,e){for(var n=[],r=[],o=0,i=t.length;o=0&&e=e.length&&t.substr(n,n+e.length)===e},ae=function(t,e){return se(t,e)?ie(t,e.length):t},ce=function(t,e){return-1!==t.indexOf(e)},se=function(t,e){return ue(t,e,0)},le=function(t){return function(e){return e.replace(t,"")}},fe=le(/^\s+|\s+$/g),de=le(/^\s+/g),me=le(/\s+$/g),ge=function(t){return t.length>0},he=function(t){return!ge(t)},pe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ve=function(t){return function(e){return ce(e,t)}},be=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return ce(t,"edge/")&&ce(t,"chrome")&&ce(t,"safari")&&ce(t,"applewebkit")}},{name:"Chrome",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,pe],search:function(t){return ce(t,"chrome")&&!ce(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return ce(t,"msie")||ce(t,"trident")}},{name:"Opera",versionRegexes:[pe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ve("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ve("firefox")},{name:"Safari",versionRegexes:[pe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(ce(t,"safari")||ce(t,"mobile/"))&&ce(t,"applewebkit")}}],ye=[{name:"Windows",search:ve("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return ce(t,"iphone")||ce(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ve("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:ve("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ve("linux"),versionRegexes:[]},{name:"Solaris",search:ve("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ve("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ve("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],we={browsers:D(be),oses:D(ye)},xe="Edge",Ce="Chrome",Se="IE",ke="Opera",Te="Firefox",Oe="Safari",Ee=function(){return _e({current:void 0,version:te.unknown()})},_e=function(t){var e=t.current,n=t.version,r=function(t){return function(){return e===t}};return{current:e,version:n,isEdge:r(xe),isChrome:r(Ce),isIE:r(Se),isOpera:r(ke),isFirefox:r(Te),isSafari:r(Oe)}},Ae={unknown:Ee,nu:_e,edge:D(xe),chrome:D(Ce),ie:D(Se),opera:D(ke),firefox:D(Te),safari:D(Oe)},De="Windows",Me="iOS",ze="Android",Re="Linux",Ne="OSX",Be="Solaris",Le="FreeBSD",He="ChromeOS",Ie=function(){return Pe({current:void 0,version:te.unknown()})},Pe=function(t){var e=t.current,n=t.version,r=function(t){return function(){return e===t}};return{current:e,version:n,isWindows:r(De),isiOS:r(Me),isAndroid:r(ze),isOSX:r(Ne),isLinux:r(Re),isSolaris:r(Be),isFreeBSD:r(Le),isChromeOS:r(He)}},Ve={unknown:Ie,nu:Pe,windows:D(De),ios:D(Me),android:D(ze),linux:D(Re),osx:D(Ne),solaris:D(Be),freebsd:D(Le),chromeos:D(He)},Fe=function(t,e,n){var r=we.browsers(),o=we.oses(),i=e.bind((function(t){return ee(r,t)})).orThunk((function(){return re(r,t)})).fold(Ae.unknown,Ae.nu),u=oe(o,t).fold(Ve.unknown,Ve.nu),a=Kt(u,i,t,n);return{browser:i,os:u,deviceType:a}},Ue={detect:Fe},je=function(t){return window.matchMedia(t).matches},We=Gt((function(){return Ue.detect(navigator.userAgent,W.from(navigator.userAgentData),je)})),qe=function(){return We()},$e=navigator.userAgent,Ge=qe(),Ke=Ge.browser,Xe=Ge.os,Ye=Ge.deviceType,Je=/WebKit/.test($e)&&!Ke.isEdge(),Qe="FormData"in window&&"FileReader"in window&&"URL"in window&&!!URL.createObjectURL,Ze=-1!==$e.indexOf("Windows Phone"),tn={opera:Ke.isOpera(),webkit:Je,ie:!(!Ke.isIE()&&!Ke.isEdge())&&Ke.version.major,gecko:Ke.isFirefox(),mac:Xe.isOSX()||Xe.isiOS(),iOS:Ye.isiPad()||Ye.isiPhone(),android:Xe.isAndroid(),contentEditable:!0,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:!0,range:window.getSelection&&"Range"in window,documentMode:Ke.isIE()?document.documentMode||7:10,fileApi:Qe,ceFalse:!0,cacheSuffix:null,container:null,experimentalShadowDom:!1,canHaveCSP:!Ke.isIE(),desktop:Ye.isDesktop(),windowsPhone:Ze,browser:{current:Ke.current,version:Ke.version,isChrome:Ke.isChrome,isEdge:Ke.isEdge,isFirefox:Ke.isFirefox,isIE:Ke.isIE,isOpera:Ke.isOpera,isSafari:Ke.isSafari},os:{current:Xe.current,version:Xe.version,isAndroid:Xe.isAndroid,isChromeOS:Xe.isChromeOS,isFreeBSD:Xe.isFreeBSD,isiOS:Xe.isiOS,isLinux:Xe.isLinux,isOSX:Xe.isOSX,isSolaris:Xe.isSolaris,isWindows:Xe.isWindows},deviceType:{isDesktop:Ye.isDesktop,isiPad:Ye.isiPad,isiPhone:Ye.isiPhone,isPhone:Ye.isPhone,isTablet:Ye.isTablet,isTouch:Ye.isTouch,isWebView:Ye.isWebView}},en=/^\s*|\s*$/g,nn=function(t){return null===t||void 0===t?"":(""+t).replace(en,"")},rn=function(t,e){return e?!("array"!==e||!Bt(t))||typeof t===e:void 0!==t},on=function(t,e,n){var r;t=t||[],e=e||",","string"===typeof t&&(t=t.split(e)),n=n||{},r=t.length;while(r--)n[t[r]]={};return n},un=zt,an=function(t,e,n){var r,o,i,u=this,a=0;t=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(t);var c=t[3].match(/(^|\.)(\w+)$/i)[2],s=u.createNS(t[3].replace(/\.\w+$/,""),n);if(!s[c]){if("static"===t[2])return s[c]=e,void(this.onCreate&&this.onCreate(t[2],t[3],s[c]));e[c]||(e[c]=function(){},a=1),s[c]=e[c],u.extend(s[c].prototype,e),t[5]&&(r=u.resolve(t[5]).prototype,o=t[5].match(/\.(\w+)$/i)[1],i=s[c],s[c]=a?function(){return r[o].apply(this,arguments)}:function(){return this.parent=r[o],i.apply(this,arguments)},s[c].prototype[c]=s[c],u.each(r,(function(t,e){s[c].prototype[e]=r[e]})),u.each(e,(function(t,e){r[e]?s[c].prototype[e]=function(){return this.parent=r[e],t.apply(this,arguments)}:e!==c&&(s[c].prototype[e]=t)}))),u.each(e.static,(function(t,e){s[c][e]=t}))}},cn=function(t){for(var e=[],n=1;n1)throw console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return bn(r.childNodes[0])},pn=function(t,e){var n=e||document,r=n.createElement(t);return bn(r)},vn=function(t,e){var n=e||document,r=n.createTextNode(t);return bn(r)},bn=function(t){if(null===t||void 0===t)throw new Error("Node cannot be null or undefined");return{dom:t}},yn=function(t,e,n){return W.from(t.dom.elementFromPoint(e,n)).map(bn)},wn={fromHtml:hn,fromTag:pn,fromText:vn,fromDom:bn,fromPoint:yn},xn=function(t,e){var n=[],r=function(t){return n.push(t),e(t)},o=e(t);do{o=o.bind(r)}while(o.isSome());return n},Cn=function(t,e,n){return 0!==(t.compareDocumentPosition(e)&n)},Sn=function(t,e){return Cn(t,e,Node.DOCUMENT_POSITION_CONTAINED_BY)},kn=8,Tn=9,On=11,En=1,_n=3,An=function(t,e){var n=t.dom;if(n.nodeType!==En)return!1;var r=n;if(void 0!==r.matches)return r.matches(e);if(void 0!==r.msMatchesSelector)return r.msMatchesSelector(e);if(void 0!==r.webkitMatchesSelector)return r.webkitMatchesSelector(e);if(void 0!==r.mozMatchesSelector)return r.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")},Dn=function(t){return t.nodeType!==En&&t.nodeType!==Tn&&t.nodeType!==On||0===t.childElementCount},Mn=function(t,e){var n=void 0===e?document:e.dom;return Dn(n)?[]:Q(n.querySelectorAll(t),wn.fromDom)},zn=function(t,e){var n=void 0===e?document:e.dom;return Dn(n)?W.none():W.from(n.querySelector(t)).map(wn.fromDom)},Rn=function(t,e){return t.dom===e.dom},Nn=function(t,e){var n=t.dom,r=e.dom;return n!==r&&n.contains(r)},Bn=function(t,e){return Sn(t.dom,e.dom)},Ln=function(t,e){return qe().browser.isIE()?Bn(t,e):Nn(t,e)};"undefined"!==typeof window?window:Function("return this;")();var Hn=function(t){var e=t.dom.nodeName;return e.toLowerCase()},In=function(t){return t.dom.nodeType},Pn=function(t){return function(e){return In(e)===t}},Vn=function(t){return In(t)===kn||"#comment"===Hn(t)},Fn=Pn(En),Un=Pn(_n),jn=Pn(Tn),Wn=Pn(On),qn=function(t){return function(e){return Fn(e)&&Hn(e)===t}},$n=function(t){return wn.fromDom(t.dom.ownerDocument)},Gn=function(t){return jn(t)?t:$n(t)},Kn=function(t){return wn.fromDom(Gn(t).dom.documentElement)},Xn=function(t){return wn.fromDom(Gn(t).dom.defaultView)},Yn=function(t){return W.from(t.dom.parentNode).map(wn.fromDom)},Jn=function(t,e){var n=T(e)?e:I,r=t.dom,o=[];while(null!==r.parentNode&&void 0!==r.parentNode){var i=r.parentNode,u=wn.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},Qn=function(t){var e=function(e){return nt(e,(function(e){return!Rn(t,e)}))};return Yn(t).map(rr).map(e).getOr([])},Zn=function(t){return W.from(t.dom.previousSibling).map(wn.fromDom)},tr=function(t){return W.from(t.dom.nextSibling).map(wn.fromDom)},er=function(t){return ft(xn(t,Zn))},nr=function(t){return xn(t,tr)},rr=function(t){return Q(t.dom.childNodes,wn.fromDom)},or=function(t,e){var n=t.dom.childNodes;return W.from(n[e]).map(wn.fromDom)},ir=function(t){return or(t,0)},ur=function(t){return or(t,t.dom.childNodes.length-1)},ar=function(t){return t.dom.childNodes.length},cr=function(t){var e=t.dom.head;if(null===e||void 0===e)throw new Error("Head is not available yet");return wn.fromDom(e)},sr=function(t){return Wn(t)&&k(t.dom.host)},lr=T(Element.prototype.attachShadow)&&T(Node.prototype.getRootNode),fr=D(lr),dr=lr?function(t){return wn.fromDom(t.dom.getRootNode())}:Gn,mr=function(t){return sr(t)?t:cr(Gn(t))},gr=function(t){var e=dr(t);return sr(e)?W.some(e):W.none()},hr=function(t){return wn.fromDom(t.dom.host)},pr=function(t){if(fr()&&k(t.target)){var e=wn.fromDom(t.target);if(Fn(e)&&vr(e)&&t.composed&&t.composedPath){var n=t.composedPath();if(n)return pt(n)}}return W.from(t.target)},vr=function(t){return k(t.dom.shadowRoot)},br=function(t,e){var n=Yn(t);n.each((function(n){n.dom.insertBefore(e.dom,t.dom)}))},yr=function(t,e){var n=tr(t);n.fold((function(){var n=Yn(t);n.each((function(t){xr(t,e)}))}),(function(t){br(t,e)}))},wr=function(t,e){var n=ir(t);n.fold((function(){xr(t,e)}),(function(n){t.dom.insertBefore(e.dom,n.dom)}))},xr=function(t,e){t.dom.appendChild(e.dom)},Cr=function(t,e){br(t,e),xr(e,t)},Sr=function(t,e){Z(e,(function(e){br(t,e)}))},kr=function(t,e){Z(e,(function(e){xr(t,e)}))},Tr=function(t){t.dom.textContent="",Z(rr(t),(function(t){Or(t)}))},Or=function(t){var e=t.dom;null!==e.parentNode&&e.parentNode.removeChild(e)},Er=function(t){var e=rr(t);e.length>0&&Sr(t,e),Or(t)},_r=function(t){var e=Un(t)?t.dom.parentNode:t.dom;if(void 0===e||null===e||null===e.ownerDocument)return!1;var n=e.ownerDocument;return gr(wn.fromDom(e)).fold((function(){return n.body.contains(e)}),A(_r,hr))},Ar=function(t,e){var n=function(n,r){return Ar(t+n,e+r)};return{left:t,top:e,translate:n}},Dr=Ar,Mr=function(t){var e=t.getBoundingClientRect();return Dr(e.left,e.top)},zr=function(t,e){return void 0!==t?t:void 0!==e?e:0},Rr=function(t){var e=t.dom.ownerDocument,n=e.body,r=e.defaultView,o=e.documentElement;if(n===t.dom)return Dr(n.offsetLeft,n.offsetTop);var i=zr(null===r||void 0===r?void 0:r.pageYOffset,o.scrollTop),u=zr(null===r||void 0===r?void 0:r.pageXOffset,o.scrollLeft),a=zr(o.clientTop,n.clientTop),c=zr(o.clientLeft,n.clientLeft);return Nr(t).translate(u-c,i-a)},Nr=function(t){var e=t.dom,n=e.ownerDocument,r=n.body;return r===e?Dr(r.offsetLeft,r.offsetTop):_r(t)?Mr(e):Dr(0,0)},Br=function(t){var e=void 0!==t?t.dom:document,n=e.body.scrollLeft||e.documentElement.scrollLeft,r=e.body.scrollTop||e.documentElement.scrollTop;return Dr(n,r)},Lr=function(t,e,n){var r=void 0!==n?n.dom:document,o=r.defaultView;o&&o.scrollTo(t,e)},Hr=function(t,e){var n=qe().browser.isSafari();n&&T(t.dom.scrollIntoViewIfNeeded)?t.dom.scrollIntoViewIfNeeded(!1):t.dom.scrollIntoView(e)},Ir=function(t){var e=void 0===t?window:t;return qe().browser.isFirefox()?W.none():W.from(e["visualViewport"])},Pr=function(t,e,n,r){return{x:t,y:e,width:n,height:r,right:t+n,bottom:e+r}},Vr=function(t){var e=void 0===t?window:t,n=e.document,r=Br(wn.fromDom(n));return Ir(e).fold((function(){var t=e.document.documentElement,n=t.clientWidth,o=t.clientHeight;return Pr(r.left,r.top,n,o)}),(function(t){return Pr(Math.max(t.pageLeft,r.left),Math.max(t.pageTop,r.top),t.width,t.height)}))},Fr=function(t){return function(e){return!!e&&e.nodeType===t}},Ur=function(t){return!!t&&!Object.getPrototypeOf(t)},jr=Fr(1),Wr=function(t){var e=t.map((function(t){return t.toLowerCase()}));return function(t){if(t&&t.nodeName){var n=t.nodeName.toLowerCase();return Y(e,n)}return!1}},qr=function(t,e){var n=e.toLowerCase().split(" ");return function(e){if(jr(e))for(var r=0;r0}))},Ao=function(t){var e={},n=t.dom;if(ho(n))for(var r=0;r=t.length&&e(n)}};0===t.length?e([]):Z(t,(function(t,e){t.get(o(e))}))}))},Ko=function(t){return Go(t,$o.nu)},Xo=function(t){var e=function(e){return Xo(t)},n=function(e){return Xo(t)},r=function(e){return Xo(e(t))},o=function(e){return Xo(t)},i=function(e){e(t)},u=function(e){return e(t)},a=function(e,n){return n(t)},c=function(e){return e(t)},s=function(e){return e(t)},l=function(){return W.some(t)};return{isValue:P,isError:I,getOr:D(t),getOrThunk:D(t),getOrDie:D(t),or:e,orThunk:n,fold:a,map:r,mapError:o,each:i,bind:u,exists:c,forall:s,toOptional:l}},Yo=function(t){var e=function(t){return t()},n=function(){return B(String(t))()},r=M,o=function(t){return t()},i=function(e){return Yo(t)},u=function(e){return Yo(e(t))},a=function(e){return Yo(t)},c=function(e,n){return e(t)};return{isValue:I,isError:P,getOr:M,getOrThunk:e,getOrDie:n,or:r,orThunk:o,fold:c,map:i,mapError:u,each:E,bind:a,exists:I,forall:P,toOptional:W.none}},Jo=function(t,e){return t.fold((function(){return Yo(e)}),Xo)},Qo={value:Xo,error:Yo,fromOption:Jo},Zo=function(t){if(!y(t))throw new Error("cases must be an array");if(0===t.length)throw new Error("there must be at least one case");var e=[],n={};return Z(t,(function(r,o){var i=wt(r);if(1!==i.length)throw new Error("one and only one name per case");var u=i[0],a=r[u];if(void 0!==n[u])throw new Error("duplicate key detected:"+u);if("cata"===u)throw new Error("cannot have a case named cata (sorry)");if(!y(a))throw new Error("case arguments must be an array");e.push(u),n[u]=function(){for(var n=[],r=0;r0?n(r.fail.map(ei)):e(r.pass.map(ei))}))},g=function(t){var e=gn._addCacheSuffix(t);Mt(r,e).each((function(t){var n=--t.count;0===n&&(delete r[e],s(t.id))}))},h=function(t){Z(t,(function(t){g(t)}))};return{load:f,loadAll:m,unload:g,unloadAll:h,_setReferrerPolicy:a}},Ii=function(){var t=new WeakMap,e=function(e,n){var r=dr(e),o=r.dom;return W.from(t.get(o)).getOrThunk((function(){var e=Hi(o,n);return t.set(o,e),e}))};return{forElement:e}},Pi=Ii(),Vi=function(){function t(t,e){this.node=t,this.rootNode=e,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}return t.prototype.current=function(){return this.node},t.prototype.next=function(t){return this.node=this.findSibling(this.node,"firstChild","nextSibling",t),this.node},t.prototype.prev=function(t){return this.node=this.findSibling(this.node,"lastChild","previousSibling",t),this.node},t.prototype.prev2=function(t){return this.node=this.findPreviousNode(this.node,"lastChild","previousSibling",t),this.node},t.prototype.findSibling=function(t,e,n,r){var o,i;if(t){if(!r&&t[e])return t[e];if(t!==this.rootNode){if(o=t[n],o)return o;for(i=t.parentNode;i&&i!==this.rootNode;i=i.parentNode)if(o=i[n],o)return o}}},t.prototype.findPreviousNode=function(t,e,n,r){var o,i,u;if(t){if(o=t[n],this.rootNode&&o===this.rootNode)return;if(o){if(!r)for(u=o[e];u;u=u[e])if(!u[e])return u;return o}if(i=t.parentNode,i&&i!==this.rootNode)return i}},t}(),Fi=["article","aside","details","div","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","p","dl","multicol","dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"],Ui=["td","th"],ji=["thead","tbody","tfoot"],Wi=["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"],qi=["h1","h2","h3","h4","h5","h6"],$i=["li","dd","dt"],Gi=["ul","ol","dl"],Ki=["pre","script","textarea","style"],Xi=function(t){var e;return function(n){return e=e||mt(t,P),zt(e,Hn(n))}},Yi=Xi(qi),Ji=Xi(Fi),Qi=function(t){return"table"===Hn(t)},Zi=function(t){return Fn(t)&&!Ji(t)},tu=function(t){return Fn(t)&&"br"===Hn(t)},eu=Xi(Wi),nu=Xi(Gi),ru=Xi($i),ou=Xi(ji),iu=Xi(Ui),uu=Xi(Ki),au=function(t,e,n){return Oi(t,e,n).isSome()},cu="\ufeff",su=" ",lu=function(t){return t===cu},fu=function(t){return t.replace(/\uFEFF/g,"")},du=cu,mu=lu,gu=fu,hu=jr,pu=Zr,vu=function(t){return pu(t)&&(t=t.parentNode),hu(t)&&t.hasAttribute("data-mce-caret")},bu=function(t){return pu(t)&&mu(t.data)},yu=function(t){return vu(t)||bu(t)},wu=function(t){return t.firstChild!==t.lastChild||!ro(t.firstChild)},xu=function(t,e){var n=t.ownerDocument,r=n.createTextNode(du),o=t.parentNode;if(e){i=t.previousSibling;if(pu(i)){if(yu(i))return i;if(Eu(i))return i.splitText(i.data.length-1)}o.insertBefore(r,t)}else{var i=t.nextSibling;if(pu(i)){if(yu(i))return i;if(Ou(i))return i.splitText(1),i}t.nextSibling?o.insertBefore(r,t.nextSibling):o.appendChild(r)}return r},Cu=function(t){var e=t.container();return!!Zr(e)&&(e.data.charAt(t.offset())===du||t.isAtStart()&&bu(e.previousSibling))},Su=function(t){var e=t.container();return!!Zr(e)&&(e.data.charAt(t.offset()-1)===du||t.isAtEnd()&&bu(e.nextSibling))},ku=function(){var t=document.createElement("br");return t.setAttribute("data-mce-bogus","1"),t},Tu=function(t,e,n){var r=e.ownerDocument,o=r.createElement(t);o.setAttribute("data-mce-caret",n?"before":"after"),o.setAttribute("data-mce-bogus","all"),o.appendChild(ku());var i=e.parentNode;return n?i.insertBefore(o,e):e.nextSibling?i.insertBefore(o,e.nextSibling):i.appendChild(o),o},Ou=function(t){return pu(t)&&t.data[0]===du},Eu=function(t){return pu(t)&&t.data[t.data.length-1]===du},_u=function(t){var e=t.getElementsByTagName("br"),n=e[e.length-1];Kr(n)&&n.parentNode.removeChild(n)},Au=function(t){return t&&t.hasAttribute("data-mce-caret")?(_u(t),t.removeAttribute("data-mce-caret"),t.removeAttribute("data-mce-bogus"),t.removeAttribute("style"),t.removeAttribute("_moz_abspos"),t):null},Du=function(t){return vu(t.startContainer)},Mu=io,zu=uo,Ru=ro,Nu=Zr,Bu=Wr(["script","style","textarea"]),Lu=Wr(["img","input","textarea","hr","iframe","video","audio","object","embed"]),Hu=Wr(["table"]),Iu=yu,Pu=function(t){return!Iu(t)&&(Nu(t)?!Bu(t.parentNode):Lu(t)||Ru(t)||Hu(t)||Fu(t))},Vu=function(t){return jr(t)&&"true"===t.getAttribute("unselectable")},Fu=function(t){return!1===Vu(t)&&zu(t)},Uu=function(t,e){for(t=t.parentNode;t&&t!==e;t=t.parentNode){if(Fu(t))return!1;if(Mu(t))return!0}return!0},ju=function(t){return!!Fu(t)&&!0!==ot(bt(t.getElementsByTagName("*")),(function(t,e){return t||Mu(e)}),!1)},Wu=function(t){return Lu(t)||ju(t)},qu=function(t,e){return Pu(t)&&Uu(t,e)},$u=/^[ \t\r\n]*$/,Gu=function(t){return $u.test(t)},Ku=function(t,e){var n=wn.fromDom(e),r=wn.fromDom(t);return au(r,"pre,code",R(Rn,n))},Xu=function(t,e){return Zr(t)&&Gu(t.data)&&!1===Ku(t,e)},Yu=function(t){return jr(t)&&"A"===t.nodeName&&!t.hasAttribute("href")&&(t.hasAttribute("name")||t.hasAttribute("id"))},Ju=function(t,e){return Pu(t)&&!1===Xu(t,e)||Yu(t)||Qu(t)},Qu=$r("data-mce-bookmark"),Zu=$r("data-mce-bogus"),ta=Gr("data-mce-bogus","all"),ea=function(t,e){var n=0;if(Ju(t,t))return!1;var r=t.firstChild;if(!r)return!0;var o=new Vi(r,t);do{if(e){if(ta(r)){r=o.next(!0);continue}if(Zu(r)){r=o.next();continue}}if(ro(r))n++,r=o.next();else{if(Ju(r,t))return!1;r=o.next()}}while(r);return n<=1},na=function(t,e){return void 0===e&&(e=!0),ea(t.dom,e)},ra=function(t){return"span"===t.nodeName.toLowerCase()},oa=function(t,e){return k(t)&&(Ju(t,e)||Zi(wn.fromDom(t)))},ia=function(t,e){var n=new Vi(t,e).prev(!1),r=new Vi(t,e).next(!1),o=C(n)||oa(n,e),i=C(r)||oa(r,e);return o&&i},ua=function(t){return ra(t)&&"bookmark"===t.getAttribute("data-mce-type")},aa=function(t,e){return Zr(t)&&t.data.length>0&&ia(t,e)},ca=function(t){return!!jr(t)&&t.childNodes.length>0},sa=function(t){return no(t)||eo(t)},la=function(t,e,n){var r=n||e;if(jr(e)&&ua(e))return e;for(var o=e.childNodes,i=o.length-1;i>=0;i--)la(t,o[i],r);if(jr(e)){var u=e.childNodes;1===u.length&&ua(u[0])&&e.parentNode.insertBefore(u[0],e)}return sa(e)||Ju(e,r)||ca(e)||aa(e,r)||t.remove(e),e},fa=gn.makeMap,da=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ma=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ga=/[<>&\"\']/g,ha=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,pa={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},va={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},ba={"<":"<",">":">","&":"&",""":'"',"'":"'"},ya=function(t){var e=wn.fromTag("div").dom;return e.innerHTML=t,e.textContent||e.innerText||t},wa=function(t,e){var n,r,o,i={};if(t){for(t=t.split(","),e=e||10,n=0;n1?"&#"+(1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320)+65536)+";":va[t]||"&#"+t.charCodeAt(0)+";"}))},Ta=function(t,e,n){return n=n||xa,t.replace(e?da:ma,(function(t){return va[t]||n[t]||t}))},Oa=function(t,e){var n=wa(e)||xa,r=function(t,e){return t.replace(e?da:ma,(function(t){return void 0!==va[t]?va[t]:void 0!==n[t]?n[t]:t.length>1?"&#"+(1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320)+65536)+";":"&#"+t.charCodeAt(0)+";"}))},o=function(t,e){return Ta(t,e,n)},i=fa(t.replace(/\+/g,","));return i.named&&i.numeric?r:i.named?e?o:Ta:i.numeric?ka:Ca},Ea=function(t){return t.replace(ha,(function(t,e){return e?(e="x"===e.charAt(0).toLowerCase()?parseInt(e.substr(1),16):parseInt(e,10),e>65535?(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e))):pa[e]||String.fromCharCode(e)):ba[t]||xa[t]||ya(t)}))},_a={encodeRaw:Ca,encodeAllRaw:Sa,encodeNumeric:ka,encodeNamed:Ta,getEncodeFunc:Oa,decode:Ea},Aa={},Da={},Ma=gn.makeMap,za=gn.each,Ra=gn.extend,Na=gn.explode,Ba=gn.inArray,La=function(t,e){return t=gn.trim(t),t?t.split(e||" "):[]},Ha=function(t,e){var n=Ma(t," ",Ma(t.toUpperCase()," "));return Ra(n,e)},Ia=function(t){return Ha("td th li dt dd figcaption caption details summary",t.getTextBlockElements())},Pa=function(t){var e,n,r,o,i,u,a={},c=function(t,n,r){var o,i,u,c=function(t,e){var n,r,o={};for(n=0,r=t.length;n