/*! * build: vue-admin-beautiful * vue-admin-beautiful author: chuzhixin 1204505056@qq.com * vue-admin-beautiful QQ Group(QQ群): 972435319、1139183756 * time: 2024-10-10 11:14:28 */ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2aaffe1a"],{"030f":function(e,t){(function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,(e,t)=>t.isPrototypeOf(e))?"string":o},n=e=>t=>o(t)===e,r=e=>t=>typeof t===e,s=e=>t=>e===t,a=(o,n)=>l(o)&&t(o,n,(t,o)=>e(t)===o),i=n("string"),l=n("object"),c=e=>a(e,Object),d=n("array"),u=s(null),m=r("boolean"),g=s(void 0),p=e=>null===e||void 0===e,f=e=>!p(e),h=r("function"),b=r("number"),v=(e,t)=>{if(d(e)){for(let o=0,n=e.length;o{},x=e=>()=>e(),w=(e,t)=>(...o)=>e(t.apply(null,o)),C=(e,t)=>o=>e(t(o)),S=e=>()=>e,k=e=>e,_=(e,t)=>e===t;function E(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const O=e=>t=>!e(t),T=e=>()=>{throw new Error(e)},D=e=>e(),A=S(!1),N=S(!0);class R{constructor(e,t){this.tag=e,this.value=t}static some(e){return new R(!0,e)}static none(){return R.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?R.some(e(this.value)):R.none()}bind(e){return this.tag?e(this.value):R.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:R.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!==e&&void 0!==e?e:"Called getOrDie on None")}static from(e){return f(e)?R.some(e):R.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}R.singletonNone=new R(!1);const B=Array.prototype.slice,M=Array.prototype.indexOf,I=Array.prototype.push,P=(e,t)=>M.call(e,t),L=(e,t)=>{const o=P(e,t);return-1===o?R.none():R.some(o)},F=(e,t)=>P(e,t)>-1,z=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{for(let o=e.length-1;o>=0;o--){const n=e[o];t(n,o)}},$=(e,t)=>{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(W(e,(e,n)=>{o=t(o,e,n)}),o),K=(e,t,o)=>(j(e,(e,n)=>{o=t(o,e,n)}),o),Y=(e,t,o)=>{for(let n=0,r=e.length;nY(e,t,A),J=(e,t)=>{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oZ(V(e,t)),ee=(e,t)=>{for(let o=0,n=e.length;o{const t=B.call(e,0);return t.reverse(),t},oe=(e,t)=>G(e,e=>!F(t,e)),ne=(e,t)=>{const o={};for(let n=0,r=e.length;n[e],se=(e,t)=>{const o=B.call(e,0);return o.sort(t),o},ae=(e,t)=>t>=0&&tae(e,0),le=e=>ae(e,e.length-1),ce=h(Array.from)?Array.from:e=>B.call(e),de=(e,t)=>{for(let o=0;o{const o=ue(e);for(let n=0,r=o.length;nfe(e,(e,o)=>({k:o,v:t(e,o)})),fe=(e,t)=>{const o={};return ge(e,(e,n)=>{const r=t(e,n);o[r.k]=r.v}),o},he=e=>(t,o)=>{e[o]=t},be=(e,t,o,n)=>{ge(e,(e,r)=>{(t(e,r)?o:n)(e,r)})},ve=(e,t)=>{const o={},n={};return be(e,t,he(o),he(n)),{t:o,f:n}},ye=(e,t)=>{const o={};return be(e,t,he(o),y),o},xe=(e,t)=>{const o=[];return ge(e,(e,n)=>{o.push(t(e,n))}),o},we=(e,t)=>{const o=ue(e);for(let n=0,r=o.length;nxe(e,k),Se=(e,t)=>ke(e,t)?R.from(e[t]):R.none(),ke=(e,t)=>me.call(e,t),_e=(e,t)=>ke(e,t)&&void 0!==e[t]&&null!==e[t],Ee=(e,t,o=_)=>e.exists(e=>o(e,t)),Oe=(e,t,o=_)=>Ae(e,t,o).getOr(e.isNone()&&t.isNone()),Te=e=>{const t=[],o=e=>{t.push(e)};for(let n=0;n{const t=[];for(let o=0;oe.isSome()&&t.isSome()?R.some(o(e.getOrDie(),t.getOrDie())):R.none(),Ne=(e,t,o,n)=>e.isSome()&&t.isSome()&&o.isSome()?R.some(n(e.getOrDie(),t.getOrDie(),o.getOrDie())):R.none(),Re=(e,t)=>void 0!==e&&null!==e?R.some(t(e)):R.none(),Be=(e,t)=>e?R.some(t):R.none(),Me=(e,t)=>e+t,Ie=(e,t)=>e.substring(t),Pe=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Le=(e,t)=>Ue(e,t)?Ie(e,t.length):e,Fe=(e,t)=>He(e,t)?e:Me(e,t),ze=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!g(n)||r+t.length<=n)},Ue=(e,t)=>Pe(e,t,0),He=(e,t)=>Pe(e,t,e.length-t.length),Ve=e=>t=>t.replace(e,""),je=Ve(/^\s+|\s+$/g),We=e=>e.length>0,$e=e=>!We(e),Ge=e=>void 0!==e.style&&h(e.style.getPropertyValue),qe=(e,t)=>{const o=t||document,n=o.createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return Xe(n.childNodes[0])},Ke=(e,t)=>{const o=t||document,n=o.createElement(e);return Xe(n)},Ye=(e,t)=>{const o=t||document,n=o.createTextNode(e);return Xe(n)},Xe=e=>{if(null===e||void 0===e)throw new Error("Node cannot be null or undefined");return{dom:e}},Je=(e,t,o)=>R.from(e.dom.elementFromPoint(t,o)).map(Xe),Ze={fromHtml:qe,fromTag:Ke,fromText:Ye,fromDom:Xe,fromPoint:Je},Qe="undefined"!==typeof window?window:Function("return this;")(),et=(e,t)=>{let o=void 0!==t&&null!==t?t:Qe;for(let n=0;n{const o=e.split(".");return et(o,t)},ot=(e,t)=>tt(e,t),nt=(e,t)=>{const o=ot(e,t);if(void 0===o||null===o)throw new Error(e+" not available on this browser");return o},rt=Object.getPrototypeOf,st=e=>nt("HTMLElement",e),at=e=>{const t=tt("ownerDocument.defaultView",e);return l(e)&&(st(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(rt(e).constructor.name))},it=9,lt=11,ct=1,dt=3,ut=e=>{const t=e.dom.nodeName;return t.toLowerCase()},mt=e=>e.dom.nodeType,gt=e=>t=>mt(t)===e,pt=e=>ft(e)&&at(e.dom),ft=gt(ct),ht=gt(dt),bt=gt(it),vt=gt(lt),yt=e=>t=>ft(t)&&ut(t)===e,xt=(e,t)=>{const o=e.dom;if(o.nodeType!==ct)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},wt=e=>e.nodeType!==ct&&e.nodeType!==it&&e.nodeType!==lt||0===e.childElementCount,Ct=(e,t)=>{const o=void 0===t?document:t.dom;return wt(o)?[]:V(o.querySelectorAll(e),Ze.fromDom)},St=(e,t)=>{const o=void 0===t?document:t.dom;return wt(o)?R.none():R.from(o.querySelector(e)).map(Ze.fromDom)},kt=(e,t)=>e.dom===t.dom,_t=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Et=e=>Ze.fromDom(e.dom.ownerDocument),Ot=e=>bt(e)?e:Et(e),Tt=e=>Ze.fromDom(Ot(e).dom.documentElement),Dt=e=>Ze.fromDom(Ot(e).dom.defaultView),At=e=>R.from(e.dom.parentNode).map(Ze.fromDom),Nt=e=>At(e),Rt=e=>R.from(e.dom.parentElement).map(Ze.fromDom),Bt=(e,t)=>{const o=h(t)?t:A;let n=e.dom;const r=[];while(null!==n.parentNode&&void 0!==n.parentNode){const e=n.parentNode,t=Ze.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},Mt=e=>R.from(e.dom.offsetParent).map(Ze.fromDom),It=e=>R.from(e.dom.nextSibling).map(Ze.fromDom),Pt=e=>V(e.dom.childNodes,Ze.fromDom),Lt=(e,t)=>{const o=e.dom.childNodes;return R.from(o[t]).map(Ze.fromDom)},Ft=e=>Lt(e,0),zt=(e,t)=>({element:e,offset:t}),Ut=(e,t)=>{const o=Pt(e);return o.length>0&&tvt(e)&&f(e.dom.host),Vt=h(Element.prototype.attachShadow)&&h(Node.prototype.getRootNode),jt=S(Vt),Wt=Vt?e=>Ze.fromDom(e.dom.getRootNode()):Ot,$t=e=>Ht(e)?e:Ze.fromDom(Ot(e).dom.body),Gt=e=>qt(e).isSome(),qt=e=>{const t=Wt(e);return Ht(t)?R.some(t):R.none()},Kt=e=>Ze.fromDom(e.dom.host),Yt=e=>{if(jt()&&f(e.target)){const t=Ze.fromDom(e.target);if(ft(t)&&Xt(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return ie(t)}}return R.from(e.target)},Xt=e=>f(e.dom.shadowRoot),Jt=e=>{const t=ht(e)?e.dom.parentNode:e.dom;if(void 0===t||null===t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return qt(Ze.fromDom(t)).fold(()=>o.body.contains(t),C(Jt,Kt))},Zt=()=>Qt(Ze.fromDom(document)),Qt=e=>{const t=e.dom.body;if(null===t||void 0===t)throw new Error("Body is not available yet");return Ze.fromDom(t)},eo=(e,t,o)=>{if(!(i(o)||m(o)||b(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},to=(e,t,o)=>{eo(e.dom,t,o)},oo=(e,t)=>{const o=e.dom;ge(t,(e,t)=>{eo(o,t,e)})},no=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},ro=(e,t)=>R.from(no(e,t)),so=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},ao=(e,t)=>{e.dom.removeAttribute(t)},io=e=>K(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}),lo=(e,t,o)=>{if(!i(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ge(e)&&e.style.setProperty(t,o)},co=(e,t)=>{Ge(e)&&e.style.removeProperty(t)},uo=(e,t,o)=>{const n=e.dom;lo(n,t,o)},mo=(e,t)=>{const o=e.dom;ge(t,(e,t)=>{lo(o,t,e)})},go=(e,t)=>{const o=e.dom;ge(t,(e,t)=>{e.fold(()=>{co(o,t)},e=>{lo(o,t,e)})})},po=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o),r=n.getPropertyValue(t);return""!==r||Jt(e)?r:fo(o,t)},fo=(e,t)=>Ge(e)?e.style.getPropertyValue(t):"",ho=(e,t)=>{const o=e.dom,n=fo(o,t);return R.from(n).filter(e=>e.length>0)},bo=e=>{const t={},o=e.dom;if(Ge(o))for(let n=0;n{const n=Ze.fromTag(e);uo(n,t,o);const r=ho(n,t);return r.isSome()},yo=(e,t)=>{const o=e.dom;co(o,t),Ee(ro(e,"style").map(je),"")&&ao(e,"style")},xo=e=>e.dom.offsetWidth,wo=(e,t)=>{const o=(t,o)=>{if(!b(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Ge(n)&&(n.style[e]=o+"px")},n=o=>{const n=t(o);if(n<=0||null===n){const t=po(o,e);return parseFloat(t)||0}return n},r=n,s=(e,t)=>K(t,(t,o)=>{const n=po(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r},0),a=(e,t,o)=>{const n=s(e,o),r=t>n?t-n:0;return r};return{set:o,get:n,getOuter:r,aggregate:s,max:a}},Co=wo("height",e=>{const t=e.dom;return Jt(e)?t.getBoundingClientRect().height:t.offsetHeight}),So=e=>Co.get(e),ko=e=>Co.getOuter(e),_o=(e,t)=>{const o=["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"],n=Co.max(e,t,o);uo(e,"max-height",n+"px")},Eo=(e,t)=>{const o=(o,n)=>Eo(e+o,t+n);return{left:e,top:t,translate:o}},Oo=Eo,To=e=>{const t=e.getBoundingClientRect();return Oo(t.left,t.top)},Do=(e,t)=>void 0!==e?e:void 0!==t?t:0,Ao=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Oo(o.offsetLeft,o.offsetTop);const s=Do(null===n||void 0===n?void 0:n.pageYOffset,r.scrollTop),a=Do(null===n||void 0===n?void 0:n.pageXOffset,r.scrollLeft),i=Do(r.clientTop,o.clientTop),l=Do(r.clientLeft,o.clientLeft);return No(e).translate(a-l,s-i)},No=e=>{const t=e.dom,o=t.ownerDocument,n=o.body;return n===t?Oo(n.offsetLeft,n.offsetTop):Jt(e)?To(t):Oo(0,0)},Ro=wo("width",e=>e.dom.offsetWidth),Bo=(e,t)=>Ro.set(e,t),Mo=e=>Ro.get(e),Io=e=>Ro.getOuter(e),Po=(e,t)=>{const o=["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"],n=Ro.max(e,t,o);uo(e,"max-width",n+"px")},Lo=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},Fo=(e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:S(r),isiPhone:S(s),isTablet:S(l),isPhone:S(c),isTouch:S(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:S(d),isDesktop:S(u)}},zo=(e,t)=>{for(let o=0;o{const o=zo(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return jo(n(1),n(2))},Ho=(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?Vo():Uo(e,o)},Vo=()=>jo(0,0),jo=(e,t)=>({major:e,minor:t}),Wo={nu:jo,detect:Ho,unknown:Vo},$o=(e,t)=>de(t.brands,t=>{const o=t.brand.toLowerCase();return X(e,e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())}).map(e=>({current:e.name,version:Wo.nu(parseInt(t.version,10),0)}))}),Go=(e,t)=>{const o=String(t).toLowerCase();return X(e,e=>e.search(o))},qo=(e,t)=>Go(e,t).map(e=>{const o=Wo.detect(e.versionRegexes,t);return{current:e.name,version:o}}),Ko=(e,t)=>Go(e,t).map(e=>{const o=Wo.detect(e.versionRegexes,t);return{current:e.name,version:o}}),Yo=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Xo=e=>t=>ze(t,e),Jo=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>ze(e,"edge/")&&ze(e,"chrome")&&ze(e,"safari")&&ze(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Yo],search:e=>ze(e,"chrome")&&!ze(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>ze(e,"msie")||ze(e,"trident")},{name:"Opera",versionRegexes:[Yo,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Xo("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Xo("firefox")},{name:"Safari",versionRegexes:[Yo,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(ze(e,"safari")||ze(e,"mobile/"))&&ze(e,"applewebkit")}],Zo=[{name:"Windows",search:Xo("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>ze(e,"iphone")||ze(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Xo("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Xo("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Xo("linux"),versionRegexes:[]},{name:"Solaris",search:Xo("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Xo("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Xo("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Qo={browsers:S(Jo),oses:S(Zo)},en="Edge",tn="Chromium",on="IE",nn="Opera",rn="Firefox",sn="Safari",an=()=>ln({current:void 0,version:Wo.unknown()}),ln=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(en),isChromium:n(tn),isIE:n(on),isOpera:n(nn),isFirefox:n(rn),isSafari:n(sn)}},cn={unknown:an,nu:ln,edge:S(en),chromium:S(tn),ie:S(on),opera:S(nn),firefox:S(rn),safari:S(sn)},dn="Windows",un="iOS",mn="Android",gn="Linux",pn="macOS",fn="Solaris",hn="FreeBSD",bn="ChromeOS",vn=()=>yn({current:void 0,version:Wo.unknown()}),yn=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(dn),isiOS:n(un),isAndroid:n(mn),isMacOS:n(pn),isLinux:n(gn),isSolaris:n(fn),isFreeBSD:n(hn),isChromeOS:n(bn)}},xn={unknown:vn,nu:yn,windows:S(dn),ios:S(un),android:S(mn),linux:S(gn),macos:S(pn),solaris:S(fn),freebsd:S(hn),chromeos:S(bn)},wn=(e,t,o)=>{const n=Qo.browsers(),r=Qo.oses(),s=t.bind(e=>$o(n,e)).orThunk(()=>qo(n,e)).fold(cn.unknown,cn.nu),a=Ko(r,e).fold(xn.unknown,xn.nu),i=Fo(a,s,e,o);return{browser:s,os:a,deviceType:i}},Cn={detect:wn},Sn=e=>window.matchMedia(e).matches;let kn=Lo(()=>Cn.detect(navigator.userAgent,R.from(navigator.userAgentData),Sn));const _n=()=>kn(),En=(e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}),On=e=>{const t=Ze.fromDom(Yt(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=w(n,o);return En(t,e.clientX,e.clientY,o,n,r,e)},Tn=(e,t)=>o=>{e(o)&&t(On(o))},Dn=(e,t,o,n,r)=>{const s=Tn(o,n);return e.dom.addEventListener(t,s,r),{unbind:E(Rn,e,t,s,r)}},An=(e,t,o,n)=>Dn(e,t,o,n,!1),Nn=(e,t,o,n)=>Dn(e,t,o,n,!0),Rn=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Bn=(e,t)=>{const o=At(e);o.each(o=>{o.dom.insertBefore(t.dom,e.dom)})},Mn=(e,t)=>{const o=It(e);o.fold(()=>{const o=At(e);o.each(e=>{Pn(e,t)})},e=>{Bn(e,t)})},In=(e,t)=>{const o=Ft(e);o.fold(()=>{Pn(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},Pn=(e,t)=>{e.dom.appendChild(t.dom)},Ln=(e,t,o)=>{Lt(e,o).fold(()=>{Pn(e,t)},e=>{Bn(e,t)})},Fn=(e,t)=>{j(t,t=>{Pn(e,t)})},zn=e=>{e.dom.textContent="",j(Pt(e),e=>{Un(e)})},Un=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Hn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Oo(o,n)},Vn=(e,t,o)=>{const n=void 0!==o?o.dom:document,r=n.defaultView;r&&r.scrollTo(e,t)},jn=e=>{const t=void 0===e?window:e;return _n().browser.isFirefox()?R.none():R.from(t.visualViewport)},Wn=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),$n=e=>{const t=void 0===e?window:e,o=t.document,n=Hn(Ze.fromDom(o));return jn(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Wn(n.left,n.top,o,r)},e=>Wn(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))},Gn=()=>Ze.fromDom(document),qn=(e,t)=>{const o=e.view(t);return o.fold(S([]),t=>{const o=e.owner(t),n=qn(e,o);return[t].concat(n)})},Kn=(e,t)=>{const o=t.owner(e),n=qn(t,o);return R.some(n)},Yn=e=>{var t;const o=e.dom===document?R.none():R.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement);return o.map(Ze.fromDom)},Xn=e=>Et(e);var Jn=Object.freeze({__proto__:null,view:Yn,owner:Xn});const Zn=e=>{const t=Gn(),o=Hn(t),n=Kn(e,Jn);return n.fold(E(Ao,e),t=>{const n=No(e),r=q(t,(e,t)=>{const o=No(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return Oo(r.left+n.left+o.left,r.top+n.top+o.top)})},Qn=(e,t,o)=>({point:e,width:t,height:o}),er=(e,t,o,n)=>({x:e,y:t,width:o,height:n}),tr=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),or=e=>{const t=Ao(e),o=Io(e),n=ko(e);return tr(t.left,t.top,o,n)},nr=e=>{const t=Zn(e),o=Io(e),n=ko(e);return tr(t.left,t.top,o,n)},rr=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),r=Math.min(e.right,t.right),s=Math.min(e.bottom,t.bottom),a=r-o,i=s-n;return tr(o,n,a,i)},sr=(e,t)=>K(t,(e,t)=>rr(e,t),e),ar=()=>$n(window);var ir=tinymce.util.Tools.resolve("tinymce.ThemeManager");const lr=e=>{const t=t=>t(e),o=S(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:N,isError:A,map:t=>ur.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>R.some(e)};return r},cr=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:A,isError:N,map:t,mapError:t=>ur.error(t(e)),bind:t,exists:A,forall:N,getOr:k,or:k,getOrThunk:D,orThunk:D,getOrDie:T(String(e)),each:y,toOptional:R.none};return o},dr=(e,t)=>e.fold(()=>cr(t),lr),ur={value:lr,error:cr,fromOption:dr};var mr;(function(e){e[e["Error"]=0]="Error",e[e["Value"]=1]="Value"})(mr||(mr={}));const gr=(e,t,o)=>e.stype===mr.Error?t(e.serror):o(e.svalue),pr=e=>{const t=[],o=[];return j(e,e=>{gr(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}},fr=(e,t)=>e.stype===mr.Error?{stype:mr.Error,serror:t(e.serror)}:e,hr=(e,t)=>e.stype===mr.Value?{stype:mr.Value,svalue:t(e.svalue)}:e,br=(e,t)=>e.stype===mr.Value?t(e.svalue):e,vr=(e,t)=>e.stype===mr.Error?t(e.serror):e,yr=e=>({stype:mr.Value,svalue:e}),xr=e=>({stype:mr.Error,serror:e}),wr=e=>gr(e,ur.error,ur.value),Cr=e=>e.fold(xr,yr),Sr={fromResult:Cr,toResult:wr,svalue:yr,partition:pr,serror:xr,bind:br,bindError:vr,map:hr,mapError:fr,fold:gr},kr=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),_r=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Er=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},Or=(e,t)=>t,Tr=(e,t)=>{const o=c(e)&&c(t);return o?Ar(e,t):t},Dr=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;n({tag:"required",process:{}}),Br=e=>({tag:"defaultedThunk",process:e}),Mr=e=>Br(S(e)),Ir=()=>({tag:"option",process:{}}),Pr=e=>({tag:"mergeWithThunk",process:e}),Lr=e=>Pr(S(e)),Fr=(e,t)=>e.length>0?Sr.svalue(Ar(t,Nr.apply(void 0,e))):Sr.svalue(t),zr=e=>w(Sr.serror,Z)(e),Ur=(e,t)=>{const o=Sr.partition(e);return o.errors.length>0?zr(o.errors):Fr(o.values,t)},Hr=e=>{const t=Sr.partition(e);return t.errors.length>0?zr(t.errors):Sr.svalue(t.values)},Vr={consolidateObj:Ur,consolidateArr:Hr},jr=e=>l(e)&&ue(e).length>100?" removed due to size":JSON.stringify(e,null,2),Wr=e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:S("... (only showing first ten failures)")}]):e;return V(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())},$r=(e,t)=>Sr.serror([{path:e,getErrorInfo:t}]),Gr=(e,t,o)=>$r(e,()=>'Could not find valid *required* value for "'+t+'" in '+jr(o)),qr=(e,t)=>$r(e,()=>'Choice schema did not contain choice key: "'+t+'"'),Kr=(e,t,o)=>$r(e,()=>'The chosen schema: "'+o+'" did not exist in branches: '+jr(t)),Yr=(e,t)=>$r(e,()=>"There are unsupported fields: ["+t.join(", ")+"] specified"),Xr=(e,t)=>$r(e,S(t)),Jr=e=>{const t=(t,o)=>Sr.bindError(e(o),e=>Xr(t,e)),o=S("val");return{extract:t,toString:o}},Zr=Jr(Sr.svalue),Qr=(e,t,o,n)=>Se(t,o).fold(()=>Gr(e,o,t),n),es=(e,t,o,n)=>{const r=Se(e,t).getOrThunk(()=>o(e));return n(r)},ts=(e,t,o)=>o(Se(e,t)),os=(e,t,o,n)=>{const r=Se(e,t).map(t=>!0===t?o(e):t);return n(r)},ns=(e,t,o,n,r)=>{const s=e=>r.extract(t.concat([n]),e),a=e=>e.fold(()=>Sr.svalue(R.none()),e=>{const o=r.extract(t.concat([n]),e);return Sr.map(o,R.some)});switch(e.tag){case"required":return Qr(t,o,n,s);case"defaultedThunk":return es(o,n,e.process,s);case"option":return ts(o,n,a);case"defaultedOptionThunk":return os(o,n,e.process,a);case"mergeWithThunk":return es(o,n,S({}),t=>{const n=Ar(e.process(o),t);return s(n)})}},rs=(e,t,o)=>{const n={},r=[];for(const s of o)Er(s,(o,s,a,i)=>{const l=ns(a,e,t,o,i);Sr.fold(l,e=>{r.push(...e)},e=>{n[s]=e})},(e,o)=>{n[e]=o(t)});return r.length>0?Sr.serror(r):Sr.svalue(n)},ss=e=>{const t=(t,o)=>e().extract(t,o),o=()=>e().toString();return{extract:t,toString:o}},as=e=>ue(ye(e,f)),is=e=>{const t=ls(e),o=q(e,(e,t)=>Er(t,t=>Ar(e,{[t]:!0}),S(e)),{}),n=(e,n)=>{const r=m(n)?[]:as(n),s=G(r,e=>!_e(o,e));return 0===s.length?t.extract(e,n):Yr(e,s)};return{extract:n,toString:t.toString}},ls=e=>{const t=(t,o)=>rs(t,o,e),o=()=>{const t=V(e,e=>Er(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"};return{extract:t,toString:o}},cs=e=>{const t=(t,o)=>{const n=V(o,(o,n)=>e.extract(t.concat(["["+n+"]"]),o));return Vr.consolidateArr(n)},o=()=>"array("+e.toString()+")";return{extract:t,toString:o}},ds=(e,t)=>{const o=void 0!==t?t:k,n=(t,n)=>{const r=[];for(const s of e){const e=s.extract(t,n);if(e.stype===mr.Value)return{stype:mr.Value,svalue:o(e.svalue)};r.push(e)}return Vr.consolidateArr(r)},r=()=>"oneOf("+V(e,e=>e.toString()).join(", ")+")";return{extract:n,toString:r}},us=(e,t)=>{const o=(t,o)=>cs(Jr(e)).extract(t,o),n=(e,n)=>{const r=ue(n),s=o(e,r);return Sr.bind(s,o=>{const r=V(o,e=>kr(e,e,Rr(),t));return ls(r).extract(e,n)})},r=()=>"setOf("+t.toString()+")";return{extract:n,toString:r}},ms=(e,t)=>{const o=Lo(t),n=(e,t)=>o().extract(e,t),r=()=>o().toString();return{extract:n,toString:r}},gs=w(cs,ls),ps=S(Zr),fs=(e,t)=>Jr(o=>{const n=typeof o;return e(o)?Sr.svalue(o):Sr.serror(`Expected type: ${t} but got: ${n}`)}),hs=fs(b,"number"),bs=fs(i,"string"),vs=fs(m,"boolean"),ys=fs(h,"function"),xs=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every(t=>xs(e[t]));default:return!1}},ws=Jr(e=>xs(e)?Sr.svalue(e):Sr.serror("Expected value to be acceptable for sending via postMessage")),Cs=(e,t,o,n)=>{const r=Se(o,n);return r.fold(()=>Kr(e,o,n),o=>o.extract(e.concat(["branch: "+n]),t))},Ss=(e,t)=>{const o=(o,n)=>{const r=Se(n,e);return r.fold(()=>qr(o,e),e=>Cs(o,n,t,e))},n=()=>"chooseOn("+e+"). Possible values: "+ue(t);return{extract:o,toString:n}},ks=()=>cs(Zr),_s=e=>Jr(t=>e(t).fold(Sr.serror,Sr.svalue)),Es=(e,t)=>us(t=>Sr.fromResult(e(t)),t),Os=(e,t,o)=>{const n=t.extract([e],o);return Sr.mapError(n,e=>({input:o,errors:e}))},Ts=(e,t,o)=>Sr.toResult(Os(e,t,o)),Ds=e=>e.fold(e=>{throw new Error(Ns(e))},k),As=(e,t,o)=>Ds(Ts(e,t,o)),Ns=e=>"Errors: \n"+Wr(e.errors).join("\n")+"\n\nInput object: "+jr(e.input),Rs=(e,t)=>Ss(e,pe(t,ls)),Bs=(e,t)=>ms(e,t),Ms=kr,Is=_r,Ps=e=>_s(t=>F(e,t)?ur.value(t):ur.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),Ls=e=>Ms(e,e,Rr(),ps()),Fs=(e,t)=>Ms(e,e,Rr(),t),zs=e=>Fs(e,hs),Us=e=>Fs(e,bs),Hs=(e,t)=>Ms(e,e,Rr(),Ps(t)),Vs=e=>Fs(e,vs),js=e=>Fs(e,ys),Ws=(e,t)=>Ms(e,e,Ir(),Jr(o=>Sr.serror("The field: "+e+" is forbidden. "+t))),$s=(e,t)=>Ms(e,e,Rr(),ls(t)),Gs=(e,t)=>Ms(e,e,Rr(),gs(t)),qs=(e,t)=>Ms(e,e,Rr(),cs(t)),Ks=e=>Ms(e,e,Ir(),ps()),Ys=(e,t)=>Ms(e,e,Ir(),t),Xs=e=>Ys(e,hs),Js=e=>Ys(e,bs),Zs=(e,t)=>Ys(e,Ps(t)),Qs=e=>Ys(e,ys),ea=(e,t)=>Ys(e,cs(t)),ta=(e,t)=>Ys(e,ls(t)),oa=(e,t)=>Ys(e,is(t)),na=(e,t)=>Ms(e,e,Mr(t),ps()),ra=(e,t,o)=>Ms(e,e,Mr(t),o),sa=(e,t)=>ra(e,t,hs),aa=(e,t)=>ra(e,t,bs),ia=(e,t,o)=>ra(e,t,Ps(o)),la=(e,t)=>ra(e,t,vs),ca=(e,t)=>ra(e,t,ys),da=(e,t)=>ra(e,t,ws),ua=(e,t,o)=>ra(e,t,cs(o)),ma=(e,t,o)=>ra(e,t,ls(o)),ga=e=>{let t=e;const o=()=>t,n=e=>{t=e};return{get:o,set:n}},pa=e=>{if(!d(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return j(e,(n,r)=>{const s=ue(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!d(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+n);const s=e=>{const n=ue(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));const r=ee(t,e=>F(n,e));if(!r)throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)};return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);const n=t[r];return n.apply(null,o)},match:s,log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}}),o},fa={generate:pa};fa.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const ha=e=>{const t=[],o=[];return j(e,e=>{e.fold(e=>{t.push(e)},e=>{o.push(e)})}),{errors:t,values:o}},ba=(e,t)=>{const o={};return ge(e,(e,n)=>{F(t,n)||(o[n]=e)}),o},va=(e,t)=>({[e]:t}),ya=e=>{const t={};return j(e,e=>{t[e.key]=e.value}),t},xa=(e,t)=>ba(e,t),wa=(e,t)=>va(e,t),Ca=e=>ya(e),Sa=(e,t)=>0===e.length?ur.value(t):ur.value(Ar(t,Nr.apply(void 0,e))),ka=e=>ur.error(Z(e)),_a=(e,t)=>{const o=ha(e);return o.errors.length>0?ka(o.errors):Sa(o.values,t)},Ea=e=>h(e)?e:A,Oa=(e,t,o)=>{let n=e.dom;const r=Ea(o);while(n.parentNode){n=n.parentNode;const e=Ze.fromDom(n),o=t(e);if(o.isSome())return o;if(r(e))break}return R.none()},Ta=(e,t,o)=>{const n=t(e),r=Ea(o);return n.orThunk(()=>r(e)?R.none():Oa(e,t,r))},Da=(e,t)=>kt(e.element,t.event.target),Aa={can:N,abort:A,run:y},Na=e=>{if(!_e(e,"can")&&!_e(e,"abort")&&!_e(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Aa,...e}},Ra=(e,t)=>(...o)=>K(e,(e,n)=>e&&t(n).apply(void 0,o),!0),Ba=(e,t)=>(...o)=>K(e,(e,n)=>e||t(n).apply(void 0,o),!1),Ma=e=>h(e)?{can:N,abort:A,run:e}:e,Ia=e=>{const t=Ra(e,e=>e.can),o=Ba(e,e=>e.abort),n=(...t)=>{j(e,e=>{e.run.apply(void 0,t)})};return{can:t,abort:o,run:n}},Pa=S,La=Pa("touchstart"),Fa=Pa("touchmove"),za=Pa("touchend"),Ua=Pa("touchcancel"),Ha=Pa("mousedown"),Va=Pa("mousemove"),ja=Pa("mouseout"),Wa=Pa("mouseup"),$a=Pa("mouseover"),Ga=Pa("focusin"),qa=Pa("focusout"),Ka=Pa("keydown"),Ya=Pa("keyup"),Xa=Pa("input"),Ja=Pa("change"),Za=Pa("click"),Qa=Pa("transitioncancel"),ei=Pa("transitionend"),ti=Pa("transitionstart"),oi=Pa("selectstart"),ni=e=>S("alloy."+e),ri={tap:ni("tap")},si=ni("focus"),ai=ni("blur.post"),ii=ni("paste.post"),li=ni("receive"),ci=ni("execute"),di=ni("focus.item"),ui=ri.tap,mi=ni("longpress"),gi=ni("sandbox.close"),pi=ni("typeahead.cancel"),fi=ni("system.init"),hi=ni("system.touchmove"),bi=ni("system.touchend"),vi=ni("system.scroll"),yi=ni("system.resize"),xi=ni("system.attached"),wi=ni("system.detached"),Ci=ni("system.dismissRequested"),Si=ni("system.repositionRequested"),ki=ni("focusmanager.shifted"),_i=ni("slotcontainer.visibility"),Ei=ni("system.external.element.scroll"),Oi=ni("change.tab"),Ti=ni("dismiss.tab"),Di=ni("highlight"),Ai=ni("dehighlight"),Ni=(e,t)=>{Ii(e,e.element,t,{})},Ri=(e,t,o)=>{Ii(e,e.element,t,o)},Bi=e=>{Ni(e,ci())},Mi=(e,t,o)=>{Ii(e,t,o,{})},Ii=(e,t,o,n)=>{const r={target:t,...n};e.getSystem().triggerEvent(o,t,r)},Pi=(e,t,o,n)=>{const r={...n,target:t};e.getSystem().triggerEvent(o,t,r)},Li=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Fi=e=>Ca(e),zi=(e,t)=>({key:e,value:Na({abort:t})}),Ui=(e,t)=>({key:e,value:Na({can:t})}),Hi=e=>({key:e,value:Na({run:(e,t)=>{t.event.prevent()}})}),Vi=(e,t)=>({key:e,value:Na({run:t})}),ji=(e,t,o)=>({key:e,value:Na({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),Wi=e=>t=>Vi(e,t),$i=e=>t=>({key:e,value:Na({run:(e,o)=>{Da(e,o)&&t(e,o)}})}),Gi=(e,t)=>Vi(e,(o,n)=>{o.getSystem().getByUid(t).each(t=>{Li(t,t.element,e,n)})}),qi=(e,t,o)=>{const n=t.partUids[o];return Gi(e,n)},Ki=(e,t)=>Vi(e,(e,o)=>{const n=o.event,r=e.getSystem().getByDom(n.target).getOrThunk(()=>{const t=Ta(n.target,t=>e.getSystem().getByDom(t).toOptional(),A);return t.getOr(e)});t(e,r,o)}),Yi=e=>Vi(e,(e,t)=>{t.cut()}),Xi=e=>Vi(e,(e,t)=>{t.stop()}),Ji=(e,t)=>$i(e)(t),Zi=$i(xi()),Qi=$i(wi()),el=$i(fi()),tl=Wi(ci()),ol=(e,t)=>{const o=t||document,n=o.createElement("div");return n.innerHTML=e,Pt(Ze.fromDom(n))},nl=e=>e.dom.innerHTML,rl=(e,t)=>{const o=Et(e),n=o.dom,r=Ze.fromDom(n.createDocumentFragment()),s=ol(t,n);Fn(r,s),zn(e),Pn(e,r)},sl=e=>{const t=Ze.fromTag("div"),o=Ze.fromDom(e.dom.cloneNode(!0));return Pn(t,o),nl(t)},al=(e,t)=>Ze.fromDom(e.dom.cloneNode(t)),il=e=>al(e,!1),ll=e=>al(e,!0),cl=e=>{if(Ht(e))return"#shadow-root";{const t=il(e);return sl(t)}},dl=e=>cl(e),ul=(e,t,o)=>kt(t,e.element)&&!kt(t,o),ml=Fi([Ui(si(),(e,t)=>{const o=t.event,n=o.originator,r=o.target;return!ul(e,n,r)||(console.warn(si()+" did not get interpreted by the desired target. \nOriginator: "+dl(n)+"\nTarget: "+dl(r)+"\nCheck the "+si()+" event handlers"),!1)})]);var gl=Object.freeze({__proto__:null,events:ml});let pl=0;const fl=e=>{const t=new Date,o=t.getTime(),n=Math.floor(1e9*Math.random());return pl++,e+"_"+n+pl+String(o)},hl=S("alloy-id-"),bl=S("data-alloy-id"),vl=hl(),yl=bl(),xl=(e,t)=>{const o=fl(vl+e);return wl(t,o),o},wl=(e,t)=>{Object.defineProperty(e.dom,yl,{value:t,writable:!0})},Cl=e=>{const t=ft(e)?e.dom[yl]:null;return R.from(t)},Sl=e=>fl(e),kl=k,_l=e=>{const t=t=>"The component must be in a context to execute: "+t+(e?"\n"+dl(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:S("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),build:o("build"),buildOrPatch:o("buildOrPatch"),addToWorld:o("addToWorld"),removeFromWorld:o("removeFromWorld"),addToGui:o("addToGui"),removeFromGui:o("removeFromGui"),getByUid:o("getByUid"),getByDom:o("getByDom"),isConnected:A}},El=_l(),Ol=(e,t,o)=>{const n=o.toString(),r=n.indexOf(")")+1,s=n.indexOf("("),a=n.substring(s+1,r-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Tl(a.slice(0,1).concat(a.slice(3)))}),e},Tl=e=>V(e,e=>He(e,"/*")?e.substring(0,e.length-"/*".length):e),Dl=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Tl(s)}),e},Al=(e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Tl(s.slice(1))}),e},Nl=fl("alloy-premade"),Rl=e=>(Object.defineProperty(e.element.dom,Nl,{value:e.uid,writable:!0}),wa(Nl,e)),Bl=e=>ke(e.dom,Nl),Ml=e=>Se(e,Nl),Il=e=>Al((t,...o)=>e(t.getApis(),t,...o),e),Pl={init:()=>Ll({readState:S("No State required")})},Ll=e=>e,Fl=(e,t)=>{const o=V(t,e=>ta(e.name(),[Ls("config"),na("state",Pl)])),n=Ts("component.behaviours",ls(o),e.behaviours).fold(t=>{throw new Error(Ns(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))},k);return{list:t,data:pe(n,e=>{const t=e.map(e=>({config:e.config,state:e.state.init(e.config)}));return S(t)})}},zl=e=>e.list,Ul=e=>e.data,Hl=(e,t)=>{const o={};return ge(e,(e,n)=>{ge(e,(e,r)=>{const s=Se(o,r).getOr([]);o[r]=s.concat([t(n,e)])})}),o},Vl=e=>({classes:g(e.classes)?[]:e.classes,attributes:g(e.attributes)?{}:e.attributes,styles:g(e.styles)?{}:e.styles}),jl=(e,t)=>({...e,attributes:{...e.attributes,...t.attributes},styles:{...e.styles,...t.styles},classes:e.classes.concat(t.classes)}),Wl=(e,t,o,n)=>{const r={...t};j(o,t=>{r[t.name()]=t.exhibit(e,n)});const s=Hl(r,(e,t)=>({name:e,modification:t})),a=e=>q(e,(e,t)=>({...t.modification,...e}),{}),i=q(s.classes,(e,t)=>t.modification.concat(e),[]),l=a(s.attributes),c=a(s.styles);return Vl({classes:i,attributes:l,styles:c})},$l=(e,t,o,n)=>{try{const r=se(o,(o,r)=>{const s=o[t],a=r[t],i=n.indexOf(s),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i({handler:e,purpose:t}),ql=(e,t)=>({cHandler:e,purpose:t}),Kl=(e,t)=>ql(E.apply(void 0,[e.handler].concat(t)),e.purpose),Yl=e=>e.cHandler,Xl=(e,t)=>({name:e,handler:t}),Jl=(e,t)=>{const o={};return j(e,e=>{o[e.name()]=e.handlers(t)}),o},Zl=(e,t,o)=>{const n={...o,...Jl(t,e)};return Hl(n,Xl)},Ql=(e,t,o,n)=>{const r=Zl(e,o,n);return nc(r,t)},ec=e=>{const t=Ma(e);return(e,o,...n)=>{const r=[e,o].concat(n);t.abort.apply(void 0,r)?o.stop():t.can.apply(void 0,r)&&t.run.apply(void 0,r)}},tc=(e,t)=>ur.error(["The event ("+e+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(V(t,e=>e.name),null,2)]),oc=(e,t,o)=>{const n=t[o];return n?$l("Event: "+o,"name",e,n).map(e=>{const t=V(e,e=>e.handler);return Ia(t)}):tc(o,e)},nc=(e,t)=>{const o=xe(e,(e,o)=>{const n=1===e.length?ur.value(e[0].handler):oc(e,t,o);return n.map(n=>{const r=ec(n),s=e.length>1?G(t[o],t=>z(e,e=>e.name===t)).join(" > "):e[0].name;return wa(o,Gl(r,s))})});return _a(o,{})},rc="alloy.base.behaviour",sc=ls([Ms("dom","dom",Rr(),ls([Ls("tag"),na("styles",{}),na("classes",[]),na("attributes",{}),Ks("value"),Ks("innerHtml")])),Ls("components"),Ls("uid"),na("events",{}),na("apis",{}),Ms("eventOrder","eventOrder",Lr({[ci()]:["disabling",rc,"toggling","typeaheadevents"],[si()]:[rc,"focusing","keying"],[fi()]:[rc,"disabling","toggling","representing"],[Xa()]:[rc,"representing","streaming","invalidating"],[wi()]:[rc,"representing","item-events","tooltipping"],[Ha()]:["focusing",rc,"item-type-events"],[La()]:["focusing",rc,"item-type-events"],[$a()]:["item-type-events","tooltipping"],[li()]:["receiving","reflecting","tooltipping"]}),ps()),Ks("domModification")]),ac=e=>Ts("custom.definition",sc,e),ic=e=>({...e.dom,uid:e.uid,domChildren:V(e.components,e=>e.element)}),lc=e=>e.domModification.fold(()=>Vl({}),Vl),cc=e=>e.events,dc=(e,t)=>{const o=no(e,t);return void 0===o||""===o?[]:o.split(" ")},uc=(e,t,o)=>{const n=dc(e,t),r=n.concat([o]);return to(e,t,r.join(" ")),!0},mc=(e,t,o)=>{const n=G(dc(e,t),e=>e!==o);return n.length>0?to(e,t,n.join(" ")):ao(e,t),!1},gc=e=>void 0!==e.dom.classList,pc=e=>dc(e,"class"),fc=(e,t)=>uc(e,"class",t),hc=(e,t)=>mc(e,"class",t),bc=(e,t)=>F(pc(e),t)?hc(e,t):fc(e,t),vc=(e,t)=>{gc(e)?e.dom.classList.add(t):fc(e,t)},yc=e=>{const t=gc(e)?e.dom.classList:pc(e);0===t.length&&ao(e,"class")},xc=(e,t)=>{if(gc(e)){const o=e.dom.classList;o.remove(t)}else hc(e,t);yc(e)},wc=(e,t)=>{const o=gc(e)?e.dom.classList.toggle(t):bc(e,t);return yc(e),o},Cc=(e,t)=>gc(e)&&e.dom.classList.contains(t),Sc=(e,t)=>{j(t,t=>{vc(e,t)})},kc=(e,t)=>{j(t,t=>{xc(e,t)})},_c=(e,t)=>{j(t,t=>{wc(e,t)})},Ec=(e,t)=>ee(t,t=>Cc(e,t)),Oc=e=>{const t=e.dom.classList,o=new Array(t.length);for(let n=0;ngc(e)?Oc(e):pc(e),Dc=e=>e.dom.value,Ac=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},Nc=(e,t,o)=>{const n=Lt(e,t);return n.map(e=>{const t=o.exists(t=>!kt(t,e));if(t){const t=o.map(ut).getOr("span"),n=Ze.fromTag(t);return Bn(e,n),n}return e})},Rc=(e,t,o)=>{o.fold(()=>Pn(e,t),e=>{kt(e,t)||(Bn(e,t),Un(e))})},Bc=(e,t,o)=>{const n=V(t,o),r=Pt(e);return j(r.slice(n.length),Un),n},Mc=(e,t,o,n)=>{const r=Lt(e,t),s=n(o,r),a=Nc(e,t,r);return Rc(e,s.element,a),s},Ic=(e,t,o)=>Bc(e,t,(t,n)=>Mc(e,n,t,o)),Pc=(e,t)=>Bc(e,t,(t,o)=>{const n=Lt(e,o);return Rc(e,t,n),t}),Lc=(e,t)=>{const o=ue(e),n=ue(t),r=oe(n,o),s=ve(e,(e,o)=>!ke(t,o)||e!==t[o]).t;return{toRemove:r,toSet:s}},Fc=(e,t)=>{const{class:o,style:n,...r}=io(t),{toSet:s,toRemove:a}=Lc(e.attributes,r),i=()=>{j(a,e=>ao(t,e)),oo(t,s)},l=bo(t),{toSet:c,toRemove:d}=Lc(e.styles,l),u=()=>{j(d,e=>yo(t,e)),mo(t,c)},m=Tc(t),g=oe(m,e.classes),p=oe(e.classes,m),f=()=>{Sc(t,p),kc(t,g)},h=e=>{rl(t,e)},b=()=>{const o=e.domChildren;Pc(t,o)},v=()=>{const o=t,n=e.value.getOrUndefined();n!==Dc(o)&&Ac(o,null!==n&&void 0!==n?n:"")};return i(),f(),u(),e.innerHtml.fold(b,h),v(),t},zc=e=>{const t=Ze.fromTag(e.tag);oo(t,e.attributes),Sc(t,e.classes),mo(t,e.styles),e.innerHtml.each(e=>rl(t,e));const o=e.domChildren;return Fn(t,o),e.value.each(e=>{Ac(t,e)}),t},Uc=(e,t)=>{try{const o=Fc(e,t);return R.some(o)}catch(o){return R.none()}},Hc=e=>e.innerHtml.isSome()&&e.domChildren.length>0,Vc=(e,t)=>{const o=t=>ut(t)===e.tag&&!Hc(e)&&!Bl(t),n=t.filter(o).bind(t=>Uc(e,t)).getOrThunk(()=>zc(e));return wl(n,e.uid),n},jc=e=>{const t=Se(e,"behaviours").getOr({});return Q(ue(t),e=>{const o=t[e];return f(o)?[o.me]:[]})},Wc=(e,t)=>Fl(e,t),$c=e=>{const t=jc(e);return Wc(e,t)},Gc=(e,t,o)=>{const n=ic(e),r=lc(e),s={"alloy.base.modification":r},a=t.length>0?Wl(o,s,t,n):r;return jl(n,a)},qc=(e,t,o)=>{const n={"alloy.base.behaviour":cc(e)};return Ql(o,e.eventOrder,t,n).getOrDie()},Kc=(e,t)=>{const o=()=>x,n=ga(El),r=Ds(ac(e)),s=$c(e),a=zl(s),i=Ul(s),l=Gc(r,a,i),c=Vc(l,t),d=qc(r,a,i),u=ga(r.components),m=e=>{n.set(e)},g=()=>{n.set(_l(o))},p=()=>{const e=Pt(c),t=Q(e,e=>n.get().getByDom(e).fold(()=>[],re));u.set(t)},f=t=>{const o=i,n=h(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))};return n()},b=e=>h(i[e.name()]),v=()=>r.apis,y=e=>i[e]().map(e=>e.state.readState()).getOr("not enabled"),x={uid:e.uid,getSystem:n.get,config:f,hasConfigured:b,spec:e,readState:y,getApis:v,connect:m,disconnect:g,element:c,syncComponents:p,components:u.get,events:d};return x},Yc=(e,t)=>{const o=Se(e,"components").getOr([]);return t.fold(()=>V(o,od),e=>V(o,(t,o)=>td(t,Lt(e,o))))},Xc=(e,t)=>{const{events:o,...n}=kl(e),r=Yc(n,t),s={...n,events:{...gl,...o},components:r};return ur.value(Kc(s,t))},Jc=e=>{const t=Ze.fromText(e);return Zc({element:t})},Zc=e=>{const t=As("external.component",is([Ls("element"),Ks("uid")]),e),o=ga(_l()),n=e=>{o.set(e)},r=()=>{o.set(_l(()=>a))},s=t.uid.getOrThunk(()=>Sl("external"));wl(t.element,s);const a={uid:s,getSystem:o.get,config:R.none,hasConfigured:A,connect:n,disconnect:r,getApis:()=>({}),element:t.element,spec:e,readState:S("No state"),syncComponents:y,components:S([]),events:{}};return Rl(a)},Qc=Sl,ed=e=>ke(e,"uid"),td=(e,t)=>Ml(e).getOrThunk(()=>{const o=ed(e)?e:{uid:Qc(""),...e};return Xc(o,t).getOrDie()}),od=e=>td(e,R.none()),nd=Rl;var rd=(e,t,o,n,r)=>e(o,n)?R.some(o):h(r)&&r(o)?R.none():t(o,n,r);const sd=(e,t,o)=>{let n=e.dom;const r=h(o)?o:A;while(n.parentNode){n=n.parentNode;const e=Ze.fromDom(n);if(t(e))return R.some(e);if(r(e))break}return R.none()},ad=(e,t,o)=>{const n=(e,t)=>t(e);return rd(n,sd,e,t,o)},id=(e,t)=>{const o=e=>t(Ze.fromDom(e)),n=X(e.dom.childNodes,o);return n.map(Ze.fromDom)},ld=(e,t)=>{const o=e=>{for(let n=0;nad(e,t,o).isSome(),dd=(e,t,o)=>sd(e,e=>xt(e,t),o),ud=(e,t)=>id(e,e=>xt(e,t)),md=(e,t)=>St(t,e),gd=(e,t,o)=>{const n=(e,t)=>xt(e,t);return rd(n,dd,e,t,o)},pd="aria-controls",fd=e=>{const t=ad(e,e=>{if(!ft(e))return!1;const t=no(e,"id");return void 0!==t&&t.indexOf(pd)>-1});return t.bind(e=>{const t=no(e,"id"),o=Wt(e);return md(o,`[${pd}="${t}"]`)})},hd=()=>{const e=fl(pd),t=t=>{to(t,pd,e)},o=e=>{ao(e,pd)};return{id:e,link:t,unlink:o}},bd=(e,t)=>fd(t).exists(t=>vd(e,t)),vd=(e,t)=>cd(t,t=>kt(t,e.element),A)||bd(e,t),yd="unknown";var xd;(function(e){e[e["STOP"]=0]="STOP",e[e["NORMAL"]=1]="NORMAL",e[e["LOGGING"]=2]="LOGGING"})(xd||(xd={}));const wd=ga({}),Cd=(e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const r=(new Date).getTime();F(["mousemove","mouseover","mouseout",fi()],e)||console.log(e,{event:e,time:r-n,target:t.dom,sequence:V(o,e=>F(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+dl(e.target)+")":e.outcome)})}}},Sd=(e,t,o)=>{const n=Se(wd.get(),e).orThunk(()=>{const t=ue(wd.get());return de(t,t=>e.indexOf(t)>-1?R.some(wd.get()[t]):R.none())}).getOr(xd.NORMAL);switch(n){case xd.NORMAL:return o(Td());case xd.LOGGING:{const n=Cd(e,t),r=o(n);return n.write(),r}case xd.STOP:return!0}},kd=["alloy/data/Fields","alloy/debugging/Debugging"],_d=()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");return X(t,e=>e.indexOf("alloy")>0&&!z(kd,t=>e.indexOf(t)>-1)).getOr(yd)}return yd},Ed={logEventCut:y,logEventStopped:y,logNoParent:y,logEventNoHandlers:y,logEventResponse:y,write:y},Od=(e,t,o)=>Sd(e,t,o),Td=S(Ed),Dd=S([Ls("menu"),Ls("selectedMenu")]),Ad=S([Ls("item"),Ls("selectedItem")]);S(ls(Ad().concat(Dd())));const Nd=S(ls(Ad())),Rd=$s("initSize",[Ls("numColumns"),Ls("numRows")]),Bd=()=>Fs("markers",Nd()),Md=()=>$s("markers",[Ls("backgroundMenu")].concat(Dd()).concat(Ad())),Id=e=>$s("markers",V(e,Ls)),Pd=(e,t,o)=>(_d(),Ms(t,t,o,_s(e=>ur.value((...t)=>e.apply(void 0,t))))),Ld=e=>Pd("onHandler",e,Mr(y)),Fd=e=>Pd("onKeyboardHandler",e,Mr(R.none)),zd=e=>Pd("onHandler",e,Rr()),Ud=e=>Pd("onKeyboardHandler",e,Rr()),Hd=(e,t)=>Is(e,S(t)),Vd=e=>Is(e,k),jd=S(Rd),Wd=(e,t,o,n,r,s,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:r,restriction:s,label:`${a}-${r}`,alwaysFit:i}),$d=fa.generate([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Gd=(e,t,o,n,r,s,a,i,l)=>e.fold(t,o,n,r,s,a,i,l),qd=(e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o),Kd=(e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n),Yd=$d.southeast,Xd=$d.southwest,Jd=$d.northeast,Zd=$d.northwest,Qd=$d.south,eu=$d.north,tu=$d.east,ou=$d.west,nu=(e,t,o,n)=>{const r=e+t;return r>n?o:rMath.min(Math.max(e,t),o),su=(e,t)=>{switch(t){case 1:return e.x;case 0:return e.x+e.width;case 2:return e.y;case 3:return e.y+e.height}},au=(e,t)=>ne(["left","right","top","bottom"],o=>Se(t,o).map(t=>su(e,t))),iu=(e,t,o)=>{const n=(n,r)=>t[n].map(t=>{const s="top"===n||"bottom"===n,a=s?o.top:o.left,i="left"===n||"top"===n?Math.max:Math.min,l=i(t,r)+a;return s?ru(l,e.y,e.bottom):ru(l,e.x,e.right)}).getOr(r),r=n("left",e.x),s=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return tr(r,s,a-r,i-s)},lu="layout",cu=e=>e.x,du=(e,t)=>e.x+e.width/2-t.width/2,uu=(e,t)=>e.x+e.width-t.width,mu=(e,t)=>e.y-t.height,gu=e=>e.y+e.height,pu=(e,t)=>e.y+e.height/2-t.height/2,fu=e=>e.x+e.width,hu=(e,t)=>e.x-t.width,bu=(e,t,o)=>Wd(cu(e),gu(e),o.southeast(),Yd(),"southeast",au(e,{left:1,top:3}),lu),vu=(e,t,o)=>Wd(uu(e,t),gu(e),o.southwest(),Xd(),"southwest",au(e,{right:0,top:3}),lu),yu=(e,t,o)=>Wd(cu(e),mu(e,t),o.northeast(),Jd(),"northeast",au(e,{left:1,bottom:2}),lu),xu=(e,t,o)=>Wd(uu(e,t),mu(e,t),o.northwest(),Zd(),"northwest",au(e,{right:0,bottom:2}),lu),wu=(e,t,o)=>Wd(du(e,t),mu(e,t),o.north(),eu(),"north",au(e,{bottom:2}),lu),Cu=(e,t,o)=>Wd(du(e,t),gu(e),o.south(),Qd(),"south",au(e,{top:3}),lu),Su=(e,t,o)=>Wd(fu(e),pu(e,t),o.east(),tu(),"east",au(e,{left:0}),lu),ku=(e,t,o)=>Wd(hu(e,t),pu(e,t),o.west(),ou(),"west",au(e,{right:1}),lu),_u=()=>[bu,vu,yu,xu,Cu,wu,Su,ku],Eu=()=>[vu,bu,xu,yu,Cu,wu,Su,ku],Ou=()=>[yu,xu,bu,vu,wu,Cu],Tu=()=>[xu,yu,vu,bu,wu,Cu],Du=()=>[bu,vu,yu,xu,Cu,wu],Au=()=>[vu,bu,xu,yu,Cu,wu],Nu=(e,t)=>t.universal?e:G(e,e=>F(t.channels,e)),Ru=e=>Fi([Vi(li(),(t,o)=>{const n=e.channels,r=ue(n),s=o,a=Nu(r,s);j(a,e=>{const o=n[e],r=o.schema,a=As("channel["+e+"] data\nReceiver: "+dl(t.element),r,s.data);o.onReceive(t,a)})})]);var Bu=Object.freeze({__proto__:null,events:Ru}),Mu=[Fs("channels",Es(ur.value,is([zd("onReceive"),na("schema",ps())])))];const Iu=(e,t,o)=>tl(n=>{o(n,e,t)}),Pu=(e,t,o)=>el((n,r)=>{o(n,e,t)}),Lu=(e,t,o,n,r,s)=>{const a=is(e),i=ta(t,[oa("config",e)]);return Hu(a,i,t,o,n,r,s)},Fu=(e,t,o,n,r,s)=>{const a=e,i=ta(t,[Ys("config",e)]);return Hu(a,i,t,o,n,r,s)},zu=(e,t,o)=>{const n=(n,...r)=>{const s=[n].concat(r);return n.config({name:S(e)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)},e=>{const o=Array.prototype.slice.call(s,1);return t.apply(void 0,[n,e.config,e.state].concat(o))})};return Ol(n,o,t)},Uu=e=>({key:e,value:void 0}),Hu=(e,t,o,n,r,s,a)=>{const i=e=>_e(e,o)?e[o]():R.none(),l=pe(r,(e,t)=>zu(o,e,t)),c=pe(s,(e,t)=>Dl(e,t)),d={...c,...l,revoke:E(Uu,o),config:t=>{const n=As(o+"-config",e,t);return{key:o,value:{config:n,me:d,configAsRaw:Lo(()=>As(o+"-config",e,t)),initialConfig:t,state:a}}},schema:S(t),exhibit:(e,t)=>Ae(i(e),Se(n,"exhibit"),(e,o)=>o(t,e.config,e.state)).getOrThunk(()=>Vl({})),name:S(o),handlers:e=>i(e).map(e=>{const t=Se(n,"events").getOr(()=>({}));return t(e.config,e.state)}).getOr({})};return d},Vu=e=>Ca(e),ju=is([Ls("fields"),Ls("name"),na("active",{}),na("apis",{}),na("state",Pl),na("extra",{})]),Wu=e=>{const t=As("Creating behaviour: "+e.name,ju,e);return Lu(t.fields,t.name,t.active,t.apis,t.extra,t.state)},$u=is([Ls("branchKey"),Ls("branches"),Ls("name"),na("active",{}),na("apis",{}),na("state",Pl),na("extra",{})]),Gu=e=>{const t=As("Creating behaviour: "+e.name,$u,e);return Fu(Rs(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},qu=S(void 0),Ku=Wu({fields:Mu,name:"receiving",active:Bu}),Yu=(e,t)=>Vl({classes:[],styles:t.useFixed()?{}:{position:"relative"}});var Xu=Object.freeze({__proto__:null,exhibit:Yu});const Ju=(e,t=!1)=>e.dom.focus({preventScroll:t}),Zu=e=>e.dom.blur(),Qu=e=>{const t=Wt(e).dom;return e.dom===t.activeElement},em=(e=Gn())=>R.from(e.dom.activeElement).map(Ze.fromDom),tm=e=>em(Wt(e)).filter(t=>e.dom.contains(t.dom)),om=(e,t)=>{const o=Wt(t),n=em(o).bind(e=>{const o=t=>kt(e,t);return o(t)?R.some(t):ld(t,o)}),r=e(t);return n.each(e=>{em(o).filter(t=>kt(t,e)).fold(()=>{Ju(e)},y)}),r},nm=(e,t,o,n,r)=>{const s=e=>e+"px";return{position:e,left:t.map(s),top:o.map(s),right:n.map(s),bottom:r.map(s)}},rm=e=>({...e,position:R.some(e.position)}),sm=(e,t)=>{go(e,rm(t))},am=fa.generate([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),im=(e,t,o,n,r,s)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=a.width,d=a.height,u=r-(i+c),m=s-(l+d),g=R.some(i),p=R.some(l),f=R.some(u),h=R.some(m),b=R.none();return Gd(t.direction,()=>nm(e,g,p,b,b),()=>nm(e,b,p,f,b),()=>nm(e,g,b,b,h),()=>nm(e,b,b,f,h),()=>nm(e,g,p,b,b),()=>nm(e,g,b,b,h),()=>nm(e,g,p,b,b),()=>nm(e,b,p,f,b))},lm=(e,t)=>e.fold(()=>{const e=t.rect;return nm("absolute",R.some(e.x),R.some(e.y),R.none(),R.none())},(e,o,n,r)=>im("absolute",t,e,o,n,r),(e,o,n,r)=>im("fixed",t,e,o,n,r)),cm=(e,t)=>{const o=E(Zn,t),n=e.fold(o,o,()=>{const e=Hn();return Zn(t).translate(-e.left,-e.top)}),r=Io(t),s=ko(t);return tr(n.left,n.top,r,s)},dm=(e,t)=>t.fold(()=>e.fold(ar,ar,tr),t=>e.fold(S(t),S(t),()=>{const o=um(e,t.x,t.y);return tr(o.left,o.top,t.width,t.height)})),um=(e,t,o)=>{const n=Oo(t,o),r=()=>{const e=Hn();return n.translate(-e.left,-e.top)};return e.fold(S(n),S(n),r)},mm=(e,t,o,n)=>e.fold(t,o,n);am.none;const gm=am.relative,pm=am.fixed,fm=(e,t)=>({anchorBox:e,origin:t}),hm=(e,t)=>fm(e,t),bm="data-alloy-placement",vm=(e,t)=>{to(e,bm,t)},ym=e=>ro(e,bm),xm=e=>ao(e,bm),wm=fa.generate([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),Cm=(e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e,m=a>=o&&a<=r,g=i>=n&&i<=s,p=m&&g,f=l<=r&&l>=o,h=c<=s&&c>=n,b=f&&h,v=Math.min(d,a>=o?r-a:l-o),y=Math.min(u,i>=n?s-i:c-n);return{originInBounds:p,sizeInBounds:b,visibleW:v,visibleH:y}},Sm=(e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,r-l),u=Math.max(n,s-c),m=ru(a,o,d),g=ru(i,n,u),p=Math.min(m+l,r)-m,f=Math.min(g+c,s)-g;return tr(m,g,p,f)},km=(e,t,o)=>{const n=S(t.bottom-o.y),r=S(o.bottom-t.y),s=qd(e,r,r,n),a=S(t.right-o.x),i=S(o.right-t.x),l=Kd(e,i,i,a);return{maxWidth:l,maxHeight:s}},_m=(e,t,o,n)=>{const r=e.bubble,s=r.offset,a=iu(n,e.restriction,s),i=e.x+s.left,l=e.y+s.top,c=tr(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=Cm(c,a),p=d&&u,f=p?c:Sm(c,a),h=f.width>0&&f.height>0,{maxWidth:b,maxHeight:v}=km(e.direction,f,n),y={rect:f,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:r.classesOn,off:r.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?wm.fit(y):wm.nofit(y,m,g,h)},Em=(e,t,o,n,r,s)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,r,e,s),g=_m(m,a,i,s);return g.fold(S(g),(e,t,o,n)=>{const r=u===n?o>d||t>c:!u&&n;return r?g:wm.nofit(l,c,d,u)})},c=K(t,(e,t)=>{const o=E(l,t);return e.fold(S(e),o)},wm.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Yd(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1));return c.fold(k,k)},Om=e=>{const t=ga(R.none()),o=()=>t.get().each(e),n=()=>{o(),t.set(R.none())},r=()=>t.get().isSome(),s=()=>t.get(),a=e=>{o(),t.set(R.some(e))};return{clear:n,isSet:r,get:s,set:a}},Tm=()=>Om(e=>e.destroy()),Dm=()=>Om(e=>e.unbind()),Am=()=>{const e=Om(y),t=t=>e.get().each(t);return{...e,on:t}},Nm=N,Rm=(e,t,o)=>An(e,t,Nm,o),Bm=(e,t,o)=>Nn(e,t,Nm,o),Mm=On,Im=["top","bottom","right","left"],Pm="data-alloy-transition-timer",Lm=(e,t)=>Ec(e,t.classes),Fm=(e,t,o)=>o.exists(o=>{const n=e.mode;return"all"===n||o[n]!==t[n]}),zm=(e,t)=>{const o=e=>parseFloat(e).toFixed(3);return we(t,(t,n)=>{const r=e[n].map(o),s=t.map(o);return!Oe(r,s)}).isSome()},Um=e=>{const t=t=>{const o=po(e,t),n=o.split(/\s*,\s*/);return G(n,We)},o=e=>{if(i(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return He(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),r=t("transition-duration");return K(r,(e,t,r)=>{const s=o(n[r])+o(t);return Math.max(e,s)},0)},Hm=(e,t)=>{const o=Dm(),n=Dm();let r;const s=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return kt(t.target,e)&&$e(n)&&F(Im,t.raw.propertyName)},a=a=>{if(p(a)||s(a)){o.clear(),n.clear();const s=null===a||void 0===a?void 0:a.raw.type;(p(s)||s===ei())&&(clearTimeout(r),ao(e,Pm),kc(e,t.classes))}},i=Rm(e,ti(),t=>{s(t)&&(i.unbind(),o.set(Rm(e,ei(),a)),n.set(Rm(e,Qa(),a)))}),l=Um(e);requestAnimationFrame(()=>{r=setTimeout(a,l+17),to(e,Pm,r)})},Vm=(e,t)=>{Sc(e,t.classes),ro(e,Pm).each(t=>{clearTimeout(parseInt(t,10)),ao(e,Pm)}),Hm(e,t)},jm=(e,t,o,n,r,s)=>{const a=Fm(n,r,s);if(a||Lm(e,n)){uo(e,"position",o.position);const s=cm(t,e),i=lm(t,{...r,rect:s}),l=ne(Im,e=>i[e]);zm(o,l)&&(go(e,l),a&&Vm(e,n),xo(e))}else kc(e,n.classes)},Wm=e=>({width:Io(e),height:ko(e)}),$m=(e,t,o,n)=>{yo(t,"max-height"),yo(t,"max-width");const r=Wm(t);return Em(t,n.preference,e,r,o,n.bounds)},Gm=(e,t)=>{const o=t.classes;kc(e,o.off),Sc(e,o.on)},qm=(e,t,o)=>{const n=o.maxHeightFunction;n(e,t.maxHeight)},Km=(e,t,o)=>{const n=o.maxWidthFunction;n(e,t.maxWidth)},Ym=(e,t,o)=>{const n=lm(o.origin,t);o.transition.each(r=>{jm(e,o.origin,n,r,t,o.lastPlacement)}),sm(e,n)},Xm=(e,t)=>{vm(e,t.placement)},Jm=(e,t)=>{_o(e,Math.floor(t))},Zm=S((e,t)=>{Jm(e,t),mo(e,{"overflow-x":"hidden","overflow-y":"auto"})}),Qm=S((e,t)=>{Jm(e,t)}),eg=(e,t,o)=>void 0===e[t]?o:e[t],tg=(e,t,o,n,r,s,a,i)=>{const l=eg(a,"maxHeightFunction",Zm()),c=eg(a,"maxWidthFunction",y),d=e.anchorBox,u=e.origin,m={bounds:dm(u,s),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:r,transition:i};return og(d,t,o,m)},og=(e,t,o,n)=>{const r=$m(e,t,o,n);return Ym(t,r,n),Xm(t,r),Gm(t,r),qm(t,r,n),Km(t,r,n),{layout:r.layout,placement:r.placement}},ng=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],rg=(e,t,o,n=1)=>{const r=e*n,s=t*n,a=e=>Se(o,e).getOr([]),i=(e,t,o)=>{const n=oe(ng,o);return{offset:Oo(e,t),classesOn:Q(o,a),classesOff:Q(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(r,s,["top","alignLeft","inset"]),insetNorthwest:()=>i(-r,s,["top","alignRight","inset"]),insetNorth:()=>i(-r/2,s,["top","alignCentre","inset"]),insetSoutheast:()=>i(r,-s,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-r,-s,["bottom","alignRight","inset"]),insetSouth:()=>i(-r/2,-s,["bottom","alignCentre","inset"]),insetEast:()=>i(-r,-s/2,["valignCentre","right","inset"]),insetWest:()=>i(r,-s/2,["valignCentre","left","inset"])}},sg=()=>rg(0,0,{}),ag=k,ig=(e,t)=>o=>"rtl"===lg(o)?t:e,lg=e=>"rtl"===po(e,"direction")?"rtl":"ltr";var cg;(function(e){e["TopToBottom"]="toptobottom",e["BottomToTop"]="bottomtotop"})(cg||(cg={}));const dg="data-alloy-vertical-dir",ug=e=>cd(e,e=>ft(e)&&no(e,"data-alloy-vertical-dir")===cg.BottomToTop),mg=()=>ta("layouts",[Ls("onLtr"),Ls("onRtl"),Ks("onBottomLtr"),Ks("onBottomRtl")]),gg=(e,t,o,n,r,s,a)=>{const i=a.map(ug).getOr(!1),l=t.layouts.map(t=>t.onLtr(e)),c=t.layouts.map(t=>t.onRtl(e)),d=i?t.layouts.bind(t=>t.onBottomLtr.map(t=>t(e))).or(l).getOr(r):l.getOr(o),u=i?t.layouts.bind(t=>t.onBottomRtl.map(t=>t(e))).or(c).getOr(s):c.getOr(n),m=ig(d,u);return m(e)},pg=(e,t,o)=>{const n=t.hotspot,r=cm(o,n.element),s=gg(e.element,t,Du(),Au(),Ou(),Tu(),R.some(t.hotspot.element));return R.some(ag({anchorBox:r,bubble:t.bubble.getOr(sg()),overrides:t.overrides,layouts:s}))};var fg=[Ls("hotspot"),Ks("bubble"),na("overrides",{}),mg(),Hd("placement",pg)];const hg=(e,t,o)=>{const n=um(o,t.x,t.y),r=tr(n.left,n.top,t.width,t.height),s=gg(e.element,t,_u(),Eu(),_u(),Eu(),R.none());return R.some(ag({anchorBox:r,bubble:t.bubble,overrides:t.overrides,layouts:s}))};var bg=[Ls("x"),Ls("y"),na("height",0),na("width",0),na("bubble",sg()),na("overrides",{}),mg(),Hd("placement",hg)];const vg=fa.generate([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),yg=e=>e.fold(k,(e,t,o)=>e.translate(-t,-o)),xg=e=>e.fold(k,k),wg=e=>K(e,(e,t)=>e.translate(t.left,t.top),Oo(0,0)),Cg=e=>{const t=V(e,yg);return wg(t)},Sg=e=>{const t=V(e,xg);return wg(t)},kg=vg.screen,_g=vg.absolute,Eg=(e,t,o)=>{const n=Dt(o.root).dom,r=t=>{const o=Et(t),n=Et(e.element);return kt(o,n)};return R.from(n.frameElement).map(Ze.fromDom).filter(r).map(Ao)},Og=(e,t,o)=>{const n=Et(e.element),r=Hn(n),s=Eg(e,t,o).getOr(r);return _g(s,r.left,r.top)},Tg=(e,t,o,n)=>{const r=kg(Oo(e,t));return R.some(Qn(r,o,n))},Dg=(e,t,o,n,r)=>e.map(e=>{const s=[t,e.point],a=mm(n,()=>Sg(s),()=>Sg(s),()=>Cg(s)),i=er(a.left,a.top,e.width,e.height),l=o.showAbove?Ou():Du(),c=o.showAbove?Tu():Au(),d=gg(r,o,l,c,l,c,R.none());return ag({anchorBox:i,bubble:o.bubble.getOr(sg()),overrides:o.overrides,layouts:d})}),Ag=(e,t,o)=>{const n=Og(e,o,t);return t.node.filter(Jt).bind(r=>{const s=r.dom.getBoundingClientRect(),a=Tg(s.left,s.top,s.width,s.height),i=t.node.getOr(e.element);return Dg(a,n,t,o,i)})};var Ng=[Ls("node"),Ls("root"),Ks("bubble"),mg(),na("overrides",{}),na("showAbove",!1),Hd("placement",Ag)];const Rg="\ufeff",Bg=" ",Mg=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Ig={create:Mg},Pg=fa.generate([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Lg=(e,t,o,n)=>e.fold(t,o,n),Fg=e=>e.fold(k,k,k),zg=Pg.before,Ug=Pg.on,Hg=Pg.after,Vg={before:zg,on:Ug,after:Hg,cata:Lg,getStart:Fg},jg=fa.generate([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Wg=e=>jg.exact(e.start,e.soffset,e.finish,e.foffset),$g=e=>e.match({domRange:e=>Ze.fromDom(e.startContainer),relative:(e,t)=>Vg.getStart(e),exact:(e,t,o,n)=>e}),Gg=jg.domRange,qg=jg.relative,Kg=jg.exact,Yg=e=>{const t=$g(e);return Dt(t)},Xg=Ig.create,Jg={domRange:Gg,relative:qg,exact:Kg,exactFromRange:Wg,getWin:Yg,range:Xg},Zg=(e,t)=>{t.fold(t=>{e.setStartBefore(t.dom)},(t,o)=>{e.setStart(t.dom,o)},t=>{e.setStartAfter(t.dom)})},Qg=(e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})},ep=(e,t,o)=>{const n=e.document.createRange();return Zg(n,t),Qg(n,o),n},tp=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},op=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),np=e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?R.some(o).map(op):R.none()},rp=e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?R.some(t).map(op):R.none()},sp=fa.generate([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ap=(e,t,o)=>t(Ze.fromDom(o.startContainer),o.startOffset,Ze.fromDom(o.endContainer),o.endOffset),ip=(e,t)=>t.match({domRange:e=>({ltr:S(e),rtl:R.none}),relative:(t,o)=>({ltr:Lo(()=>ep(e,t,o)),rtl:Lo(()=>R.some(ep(e,o,t)))}),exact:(t,o,n,r)=>({ltr:Lo(()=>tp(e,t,o,n,r)),rtl:Lo(()=>R.some(tp(e,n,r,t,o)))})}),lp=(e,t)=>{const o=t.ltr();if(o.collapsed){const n=t.rtl().filter(e=>!1===e.collapsed);return n.map(e=>sp.rtl(Ze.fromDom(e.endContainer),e.endOffset,Ze.fromDom(e.startContainer),e.startOffset)).getOrThunk(()=>ap(e,sp.ltr,o))}return ap(e,sp.ltr,o)},cp=(e,t)=>{const o=ip(e,t);return lp(e,o)},dp=(e,t)=>{const o=cp(e,t);return o.match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}})};sp.ltr,sp.rtl;const up=(e,t,o)=>G(Bt(e,o),t),mp=(e,t)=>Ct(t,e),gp=(e,t,o,n)=>{const r=Et(e),s=r.dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s},pp=(e,t,o,n)=>{const r=gp(e,t,o,n),s=kt(e,o)&&t===n;return r.collapsed&&!s},fp=e=>R.from(e.getSelection()),hp=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return R.some(Ig.create(Ze.fromDom(t.startContainer),t.startOffset,Ze.fromDom(o.endContainer),o.endOffset))}return R.none()},bp=e=>{if(null===e.anchorNode||null===e.focusNode)return hp(e);{const t=Ze.fromDom(e.anchorNode),o=Ze.fromDom(e.focusNode);return pp(t,e.anchorOffset,o,e.focusOffset)?R.some(Ig.create(t,e.anchorOffset,o,e.focusOffset)):hp(e)}},vp=e=>fp(e).filter(e=>e.rangeCount>0).bind(bp),yp=(e,t)=>{const o=dp(e,t);return np(o)},xp=(e,t)=>{const o=dp(e,t);return rp(o)},wp=(e,t)=>{const o=o=>{if(!e(o))throw new Error("Can only get "+t+" value of a "+t+" node");return n(o).getOr("")},n=t=>e(t)?R.from(t.dom.nodeValue):R.none(),r=(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n};return{get:o,getOption:n,set:r}},Cp=wp(ht,"text"),Sp=e=>Cp.get(e),kp=(e,t)=>({element:e,offset:t}),_p=(e,t)=>{const o=Pt(e);if(0===o.length)return kp(e,t);if(tht(e)?kp(e,t):_p(e,t),Op=e=>void 0!==e.foffset,Tp=(e,t)=>{const o=t.getSelection.getOrThunk(()=>()=>vp(e));return o().map(e=>{if(Op(e)){const t=Ep(e.start,e.soffset),o=Ep(e.finish,e.foffset);return Jg.range(t.element,t.offset,o.element,o.offset)}return e})},Dp=(e,t,o)=>{const n=Dt(t.root).dom,r=Og(e,o,t),s=Tp(n,t).bind(e=>{if(Op(e)){const t=xp(n,Jg.exactFromRange(e)).orThunk(()=>{const t=Ze.fromText(Rg);Bn(e.start,t);const o=yp(n,Jg.exact(t,0,t,1));return Un(t),o});return t.bind(e=>Tg(e.left,e.top,e.width,e.height))}{const t=pe(e,e=>e.dom.getBoundingClientRect()),o={left:Math.min(t.firstCell.left,t.lastCell.left),right:Math.max(t.firstCell.right,t.lastCell.right),top:Math.min(t.firstCell.top,t.lastCell.top),bottom:Math.max(t.firstCell.bottom,t.lastCell.bottom)};return Tg(o.left,o.top,o.right-o.left,o.bottom-o.top)}}),a=Tp(n,t).bind(e=>Op(e)?ft(e.start)?R.some(e.start):Rt(e.start):R.some(e.firstCell)),i=a.getOr(e.element);return Dg(s,r,t,o,i)};var Ap=[Ks("getSelection"),Ls("root"),Ks("bubble"),mg(),na("overrides",{}),na("showAbove",!1),Hd("placement",Dp)];const Np="link-layout",Rp=e=>e.x+e.width,Bp=(e,t)=>e.x-t.width,Mp=(e,t)=>e.y-t.height+e.height,Ip=e=>e.y,Pp=(e,t,o)=>Wd(Rp(e),Ip(e),o.southeast(),Yd(),"southeast",au(e,{left:0,top:2}),Np),Lp=(e,t,o)=>Wd(Bp(e,t),Ip(e),o.southwest(),Xd(),"southwest",au(e,{right:1,top:2}),Np),Fp=(e,t,o)=>Wd(Rp(e),Mp(e,t),o.northeast(),Jd(),"northeast",au(e,{left:0,bottom:3}),Np),zp=(e,t,o)=>Wd(Bp(e,t),Mp(e,t),o.northwest(),Zd(),"northwest",au(e,{right:1,bottom:3}),Np),Up=()=>[Pp,Lp,Fp,zp],Hp=()=>[Lp,Pp,zp,Fp],Vp=(e,t,o)=>{const n=cm(o,t.item.element),r=gg(e.element,t,Up(),Hp(),Up(),Hp(),R.none());return R.some(ag({anchorBox:n,bubble:sg(),overrides:t.overrides,layouts:r}))};var jp=[Ls("item"),mg(),na("overrides",{}),Hd("placement",Vp)],Wp=Rs("type",{selection:Ap,node:Ng,hotspot:fg,submenu:jp,makeshift:bg});const $p=[qs("classes",bs),ia("mode","all",["all","layout","placement"])],Gp=[na("useFixed",A),Ks("getBounds")],qp=[Fs("anchor",Wp),ta("transition",$p)],Kp=()=>{const e=document.documentElement;return pm(0,0,e.clientWidth,e.clientHeight)},Yp=e=>{const t=Ao(e.element),o=e.element.dom.getBoundingClientRect();return gm(t.left,t.top,o.width,o.height)},Xp=(e,t,o,n,r,s)=>{const a=hm(t.anchorBox,e);return tg(a,n.element,t.bubble,t.layouts,r,o,t.overrides,s)},Jp=(e,t,o,n,r)=>{const s=R.none();Zp(e,t,o,n,r,s)},Zp=(e,t,o,n,r,s)=>{const a=As("placement.info",ls(qp),r),i=a.anchor,l=n.element,c=o.get(n.uid);om(()=>{uo(l,"position","fixed");const r=ho(l,"visibility");uo(l,"visibility","hidden");const d=t.useFixed()?Kp():Yp(e);i.placement(e,i,d).each(e=>{const r=s.orThunk(()=>t.getBounds.map(D)),i=Xp(d,e,r,n,c,a.transition);o.set(n.uid,i)}),r.fold(()=>{yo(l,"visibility")},e=>{uo(l,"visibility",e)}),ho(l,"left").isNone()&&ho(l,"top").isNone()&&ho(l,"right").isNone()&&ho(l,"bottom").isNone()&&Ee(ho(l,"position"),"fixed")&&yo(l,"position")},l)},Qp=(e,t,o)=>t.useFixed()?"fixed":"absolute",ef=(e,t,o,n)=>{const r=n.element;j(["position","left","right","top","bottom"],e=>yo(r,e)),xm(r),o.clear(n.uid)};var tf=Object.freeze({__proto__:null,position:Jp,positionWithinBounds:Zp,getMode:Qp,reset:ef});const of=()=>{let e={};const t=(t,o)=>{e[t]=o},o=t=>Se(e,t),n=t=>{f(t)?delete e[t]:e={}};return Ll({readState:()=>e,clear:n,set:t,get:o})};var nf=Object.freeze({__proto__:null,init:of});const rf=Wu({fields:Gp,name:"positioning",active:Xu,apis:tf,state:nf}),sf=e=>e.getSystem().isConnected(),af=e=>{Ni(e,wi());const t=e.components();j(t,af)},lf=e=>{const t=e.components();j(t,lf),Ni(e,xi())},cf=(e,t)=>{e.getSystem().addToWorld(t),Jt(e.element)&&lf(t)},df=e=>{af(e),e.getSystem().removeFromWorld(e)},uf=(e,t)=>{Pn(e.element,t.element)},mf=e=>{j(e.components(),e=>Un(e.element)),zn(e.element),e.syncComponents()},gf=(e,t,o)=>{const n=e.components();mf(e);const r=o(t),s=oe(n,r);j(s,t=>{af(t),e.getSystem().removeFromWorld(t)}),j(r,t=>{sf(t)?uf(e,t):(e.getSystem().addToWorld(t),uf(e,t),Jt(e.element)&&lf(t))}),e.syncComponents()},pf=(e,t,o)=>{const n=e.components(),r=Q(t,e=>Ml(e).toArray());j(n,e=>{F(r,e)||df(e)});const s=o(t),a=oe(n,s);j(a,e=>{sf(e)&&df(e)}),j(s,t=>{sf(t)||cf(e,t)}),e.syncComponents()},ff=(e,t)=>{hf(e,t,Pn)},hf=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),Jt(e.element)&&lf(t),e.syncComponents()},bf=e=>{af(e),Un(e.element),e.getSystem().removeFromWorld(e)},vf=e=>{const t=At(e.element).bind(t=>e.getSystem().getByDom(t).toOptional());bf(e),t.each(e=>{e.syncComponents()})},yf=e=>{const t=e.components();j(t,bf),zn(e.element),e.syncComponents()},xf=(e,t)=>{Cf(e,t,Pn)},wf=(e,t)=>{Cf(e,t,Mn)},Cf=(e,t,o)=>{o(e,t.element);const n=Pt(t.element);j(n,e=>{t.getByDom(e).each(lf)})},Sf=e=>{const t=Pt(e.element);j(t,t=>{e.getByDom(t).each(af)}),Un(e.element)},kf=(e,t,o,n)=>{o.get().each(t=>{yf(e)});const r=t.getAttachPoint(e);ff(r,e);const s=e.getSystem().build(n);return ff(e,s),o.set(s),s},_f=(e,t,o,n)=>{const r=kf(e,t,o,n);return t.onOpen(e,r),r},Ef=(e,t,o,n)=>o.get().map(()=>kf(e,t,o,n)),Of=(e,t,o,n,r)=>{Mf(e,t),_f(e,t,o,n),r(),Pf(e,t)},Tf=(e,t,o)=>{o.get().each(n=>{yf(e),vf(e),t.onClose(e,n),o.clear()})},Df=(e,t,o)=>o.isOpen(),Af=(e,t,o,n)=>Df(e,t,o)&&o.get().exists(o=>t.isPartOf(e,o,n)),Nf=(e,t,o)=>o.get(),Rf=(e,t,o,n)=>{ho(e.element,t).fold(()=>{ao(e.element,o)},t=>{to(e.element,o,t)}),uo(e.element,t,n)},Bf=(e,t,o)=>{ro(e.element,o).fold(()=>yo(e.element,t),o=>uo(e.element,t,o))},Mf=(e,t,o)=>{const n=t.getAttachPoint(e);uo(e.element,"position",rf.getMode(n)),Rf(e,"visibility",t.cloakVisibilityAttr,"hidden")},If=e=>z(["top","left","right","bottom"],t=>ho(e,t).isSome()),Pf=(e,t,o)=>{If(e.element)||yo(e.element,"position"),Bf(e,"visibility",t.cloakVisibilityAttr)};var Lf=Object.freeze({__proto__:null,cloak:Mf,decloak:Pf,open:_f,openWhileCloaked:Of,close:Tf,isOpen:Df,isPartOf:Af,getState:Nf,setContent:Ef});const Ff=(e,t)=>Fi([Vi(gi(),(o,n)=>{Tf(o,e,t)})]);var zf=Object.freeze({__proto__:null,events:Ff}),Uf=[Ld("onOpen"),Ld("onClose"),Ls("isPartOf"),Ls("getAttachPoint"),na("cloakVisibilityAttr","data-precloak-visibility")];const Hf=()=>{const e=Am(),t=S("not-implemented");return Ll({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})};var Vf=Object.freeze({__proto__:null,init:Hf});const jf=Wu({fields:Uf,name:"sandboxing",active:zf,apis:Lf,state:Vf}),Wf=S("dismiss.popups"),$f=S("reposition.popups"),Gf=S("mouse.released"),qf=is([na("isExtraPart",A),ta("fireEventInstead",[na("event",Ci())])]),Kf=e=>{const t=As("Dismissal",qf,e);return{[Wf()]:{schema:is([Ls("target")]),onReceive:(e,o)=>{if(jf.isOpen(e)){const n=jf.isPartOf(e,o.target)||t.isExtraPart(e,o.target);n||t.fireEventInstead.fold(()=>jf.close(e),t=>Ni(e,t.event))}}}}},Yf=is([ta("fireEventInstead",[na("event",Si())]),js("doReposition")]),Xf=e=>{const t=As("Reposition",Yf,e);return{[$f()]:{onReceive:e=>{jf.isOpen(e)&&t.fireEventInstead.fold(()=>t.doReposition(e),t=>Ni(e,t.event))}}}},Jf=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Zf=(e,t,o)=>{t.store.manager.onUnload(e,t,o)},Qf=(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)},eh=(e,t,o)=>t.store.manager.getValue(e,t,o),th=(e,t,o)=>o;var oh=Object.freeze({__proto__:null,onLoad:Jf,onUnload:Zf,setValue:Qf,getValue:eh,getState:th});const nh=(e,t)=>{const o=e.resetOnDom?[Zi((o,n)=>{Jf(o,e,t)}),Qi((o,n)=>{Zf(o,e,t)})]:[Pu(e,t,Jf)];return Fi(o)};var rh=Object.freeze({__proto__:null,events:nh});const sh=()=>{const e=ga(null),t=()=>({mode:"memory",value:e.get()}),o=()=>null===e.get(),n=()=>{e.set(null)};return Ll({set:e.set,get:e.get,isNotSet:o,clear:n,readState:t})},ah=()=>{const e=y;return Ll({readState:e})},ih=()=>{const e=ga({}),t=ga({}),o=()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),n=()=>{e.set({}),t.set({})},r=o=>Se(e.get(),o).orThunk(()=>Se(t.get(),o)),s=o=>{const n=e.get(),r=t.get(),s={},a={};j(o,e=>{s[e.value]=e,Se(e,"meta").each(t=>{Se(t,"text").each(t=>{a[t]=e})})}),e.set({...n,...s}),t.set({...r,...a})};return Ll({readState:o,lookup:r,update:s,clear:n})},lh=e=>e.store.manager.state(e);var ch=Object.freeze({__proto__:null,memory:sh,dataset:ih,manual:ah,init:lh});const dh=(e,t,o,n)=>{const r=t.store;o.update([n]),r.setValue(e,n),t.onSetValue(e,n)},uh=(e,t,o)=>{const n=t.store,r=n.getDataKey(e);return o.lookup(r).getOrThunk(()=>n.getFallbackEntry(r))},mh=(e,t,o)=>{const n=t.store;n.initialValue.each(n=>{dh(e,t,o,n)})},gh=(e,t,o)=>{o.clear()};var ph=[Ks("initialValue"),Ls("getFallbackEntry"),Ls("getDataKey"),Ls("setValue"),Hd("manager",{setValue:dh,getValue:uh,onLoad:mh,onUnload:gh,state:ih})];const fh=(e,t,o)=>t.store.getValue(e),hh=(e,t,o,n)=>{t.store.setValue(e,n),t.onSetValue(e,n)},bh=(e,t,o)=>{t.store.initialValue.each(o=>{t.store.setValue(e,o)})};var vh=[Ls("getValue"),na("setValue",y),Ks("initialValue"),Hd("manager",{setValue:hh,getValue:fh,onLoad:bh,onUnload:y,state:Pl.init})];const yh=(e,t,o,n)=>{o.set(n),t.onSetValue(e,n)},xh=(e,t,o)=>o.get(),wh=(e,t,o)=>{t.store.initialValue.each(e=>{o.isNotSet()&&o.set(e)})},Ch=(e,t,o)=>{o.clear()};var Sh=[Ks("initialValue"),Hd("manager",{setValue:yh,getValue:xh,onLoad:wh,onUnload:Ch,state:sh})],kh=[ra("store",{mode:"memory"},Rs("mode",{memory:Sh,manual:vh,dataset:ph})),Ld("onSetValue"),na("resetOnDom",!1)];const _h=Wu({fields:kh,name:"representing",active:rh,apis:oh,extra:{setValueFrom:(e,t)=>{const o=_h.getValue(t);_h.setValue(e,o)}},state:ch}),Eh=(e,t)=>ma(e,{},V(t,t=>Ws(t.name(),"Cannot configure "+t.name()+" for "+e)).concat([Is("dump",k)])),Oh=e=>e.dump,Th=(e,t)=>({...Vu(t),...e.dump}),Dh={field:Eh,augment:Th,get:Oh},Ah="placeholder",Nh=fa.generate([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Rh=e=>ke(e,"uiType"),Bh=(e,t,o,n)=>e.exists(e=>e!==o.owner)?Nh.single(!0,S(o)):Se(n,o.name).fold(()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+ue(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))},e=>e.replace()),Mh=(e,t,o,n)=>Rh(o)&&o.uiType===Ah?Bh(e,t,o,n):Nh.single(!1,S(o)),Ih=(e,t,o,n)=>{const r=Mh(e,t,o,n);return r.fold((r,s)=>{const a=Rh(o)?s(t,o.config,o.validated):s(t),i=Se(a,"components").getOr([]),l=Q(i,o=>Ih(e,t,o,n));return[{...a,components:l}]},(e,n)=>{if(Rh(o)){const e=n(t,o.config,o.validated),r=o.validated.preprocess.getOr(k);return r(e)}return n(t)})},Ph=(e,t,o,n)=>Q(o,o=>Ih(e,t,o,n)),Lh=(e,t)=>{let o=!1;const n=()=>o,r=()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t},s=()=>t.fold((e,t)=>e,(e,t)=>e);return{name:S(e),required:s,used:n,replace:r}},Fh=(e,t,o,n)=>{const r=pe(n,(e,t)=>Lh(t,e)),s=Ph(e,t,o,r);return ge(r,o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))}),s},zh=Nh.single,Uh=Nh.multiple,Hh=S(Ah),Vh=fa.generate([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),jh=na("factory",{sketch:k}),Wh=na("schema",[]),$h=Ls("name"),Gh=Ms("pname","pname",Br(e=>""),ps()),qh=Is("schema",()=>[Ks("preprocess")]),Kh=na("defaults",S({})),Yh=na("overrides",S({})),Xh=ls([jh,Wh,$h,Gh,Kh,Yh]),Jh=ls([jh,Wh,$h,Kh,Yh]),Zh=ls([jh,Wh,$h,Gh,Kh,Yh]),Qh=ls([jh,qh,$h,Ls("unit"),Gh,Kh,Yh]),eb=e=>e.fold(R.some,R.none,R.some,R.some),tb=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},ob=e=>e.fold(k,k,k,k),nb=(e,t)=>o=>{const n=As("Converting part type",t,o);return e(n)},rb=nb(Vh.required,Xh),sb=nb(Vh.external,Jh),ab=nb(Vh.optional,Zh),ib=nb(Vh.group,Qh),lb=S("entirety");var cb=Object.freeze({__proto__:null,required:rb,external:sb,optional:ab,group:ib,asNamedPart:eb,name:tb,asCommon:ob,original:lb});const db=(e,t,o,n)=>Ar(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),ub=(e,t,o)=>{const n={},r={};return j(o,e=>{e.fold(e=>{n[e.pname]=zh(!0,(t,o,n)=>e.factory.sketch(db(t,e,o,n)))},e=>{const o=t.parts[e.name];r[e.name]=S(e.factory.sketch(db(t,e,o[lb()]),o))},e=>{n[e.pname]=zh(!1,(t,o,n)=>e.factory.sketch(db(t,e,o,n)))},e=>{n[e.pname]=Uh(!0,(t,o,n)=>{const r=t[e.name];return V(r,o=>e.factory.sketch(Ar(e.defaults(t,o,n),o,e.overrides(t,o))))})})}),{internals:S(n),externals:S(r)}},mb=(e,t)=>{const o={};return j(t,t=>{eb(t).each(t=>{const n=gb(e,t.pname);o[t.name]=o=>{const r=As("Part: "+t.name+" in "+e,ls(t.schema),o);return{...n,config:o,validated:r}}})}),o},gb=(e,t)=>({uiType:Hh(),owner:e,name:t}),pb=(e,t,o)=>({uiType:Hh(),owner:e,name:t,config:o,validated:{}}),fb=e=>Q(e,e=>e.fold(R.none,R.some,R.none,R.none).map(e=>$s(e.name,e.schema.concat([Vd(lb())]))).toArray()),hb=e=>V(e,tb),bb=(e,t,o)=>ub(e,t,o),vb=(e,t,o)=>Fh(R.some(e),t,t.components,o),yb=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},xb=(e,t,o)=>yb(e,t,o).getOrDie("Could not find part: "+o),wb=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return j(o,e=>{n[e]=S(s.getByUid(r[e]))}),n},Cb=(e,t)=>{const o=e.getSystem();return pe(t.partUids,(e,t)=>S(o.getByUid(e)))},Sb=e=>ue(e.partUids),kb=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return j(o,e=>{n[e]=S(s.getByUid(r[e]).getOrDie())}),n},_b=(e,t)=>{const o=hb(t);return Ca(V(o,t=>({key:t,value:e+"-"+t})))},Eb=e=>Ms("partUids","partUids",Pr(t=>_b(t.uid,e)),ps());var Ob=Object.freeze({__proto__:null,generate:mb,generateOne:pb,schemas:fb,names:hb,substitutes:bb,components:vb,defaultUids:_b,defaultUidsSchema:Eb,getAllParts:Cb,getAllPartNames:Sb,getPart:yb,getPartOrDie:xb,getParts:wb,getPartsOrDie:kb});const Tb=(e,t)=>{const o=e.length>0?[$s("parts",e)]:[];return o.concat([Ls("uid"),na("dom",{}),na("components",[]),Vd("originalSpec"),na("debug.sketcher",{})]).concat(t)},Db=(e,t,o,n,r)=>{const s=Tb(n,r);return As(e+" [SpecSchema]",is(s.concat(t)),o)},Ab=(e,t,o,n)=>{const r=Bb(n),s=Db(e,t,r,[],[]);return o(s,r)},Nb=(e,t,o,n,r)=>{const s=Bb(r),a=fb(o),i=Eb(o),l=Db(e,t,s,a,[i]),c=bb(e,l,o),d=vb(e,l,c.internals());return n(l,d,s,c.externals())},Rb=e=>ke(e,"uid"),Bb=e=>Rb(e)?e:{...e,uid:Sl("uid")},Mb=e=>void 0!==e.uid,Ib=is([Ls("name"),Ls("factory"),Ls("configFields"),na("apis",{}),na("extraApis",{})]),Pb=is([Ls("name"),Ls("factory"),Ls("configFields"),Ls("partFields"),na("apis",{}),na("extraApis",{})]),Lb=e=>{const t=As("Sketcher for "+e.name,Ib,e),o=e=>Ab(t.name,t.configFields,t.factory,e),n=pe(t.apis,Il),r=pe(t.extraApis,(e,t)=>Dl(e,t));return{name:t.name,configFields:t.configFields,sketch:o,...n,...r}},Fb=e=>{const t=As("Sketcher for "+e.name,Pb,e),o=e=>Nb(t.name,t.configFields,t.partFields,t.factory,e),n=mb(t.name,t.partFields),r=pe(t.apis,Il),s=pe(t.extraApis,(e,t)=>Dl(e,t));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:o,parts:n,...r,...s}},zb=e=>yt("input")(e)&&"radio"!==no(e,"type")||yt("textarea")(e),Ub=(e,t,o)=>t.find(e);var Hb=Object.freeze({__proto__:null,getCurrent:Ub});const Vb=[Ls("find")],jb=Wu({fields:Vb,name:"composing",apis:Hb}),Wb=["input","button","textarea","select"],$b=(e,t,o)=>{const n=t.disabled()?Qb:ev;n(e,t)},Gb=(e,t)=>!0===t.useNative&&F(Wb,ut(e.element)),qb=e=>so(e.element,"disabled"),Kb=e=>{to(e.element,"disabled","disabled")},Yb=e=>{ao(e.element,"disabled")},Xb=e=>"true"===no(e.element,"aria-disabled"),Jb=e=>{to(e.element,"aria-disabled","true")},Zb=e=>{to(e.element,"aria-disabled","false")},Qb=(e,t,o)=>{t.disableClass.each(t=>{vc(e.element,t)});const n=Gb(e,t)?Kb:Jb;n(e),t.onDisabled(e)},ev=(e,t,o)=>{t.disableClass.each(t=>{xc(e.element,t)});const n=Gb(e,t)?Yb:Zb;n(e),t.onEnabled(e)},tv=(e,t)=>Gb(e,t)?qb(e):Xb(e),ov=(e,t,o,n)=>{const r=n?Qb:ev;r(e,t)};var nv=Object.freeze({__proto__:null,enable:ev,disable:Qb,isDisabled:tv,onLoad:$b,set:ov});const rv=(e,t)=>Vl({classes:t.disabled()?t.disableClass.toArray():[]}),sv=(e,t)=>Fi([zi(ci(),(t,o)=>tv(t,e)),Pu(e,t,$b)]);var av=Object.freeze({__proto__:null,exhibit:rv,events:sv}),iv=[ca("disabled",A),na("useNative",!0),Ks("disableClass"),Ld("onDisabled"),Ld("onEnabled")];const lv=Wu({fields:iv,name:"disabling",active:av,apis:nv}),cv=(e,t,o,n)=>{const r=mp(e.element,"."+t.highlightClass);j(r,o=>{const r=z(n,e=>kt(e.element,o));r||(xc(o,t.highlightClass),e.getSystem().getByDom(o).each(o=>{t.onDehighlight(e,o),Ni(o,Ai())}))})},dv=(e,t,o)=>cv(e,t,o,[]),uv=(e,t,o,n)=>{bv(e,t,o,n)&&(xc(n.element,t.highlightClass),t.onDehighlight(e,n),Ni(n,Ai()))},mv=(e,t,o,n)=>{cv(e,t,o,[n]),bv(e,t,o,n)||(vc(n.element,t.highlightClass),t.onHighlight(e,n),Ni(n,Di()))},gv=(e,t,o)=>{xv(e,t).each(n=>{mv(e,t,o,n)})},pv=(e,t,o)=>{wv(e,t).each(n=>{mv(e,t,o,n)})},fv=(e,t,o,n)=>{yv(e,t,o,n).fold(e=>{throw e},n=>{mv(e,t,o,n)})},hv=(e,t,o,n)=>{const r=_v(e,t),s=X(r,n);s.each(n=>{mv(e,t,o,n)})},bv=(e,t,o,n)=>Cc(n.element,t.highlightClass),vv=(e,t,o)=>md(e.element,"."+t.highlightClass).bind(t=>e.getSystem().getByDom(t).toOptional()),yv=(e,t,o,n)=>{const r=mp(e.element,"."+t.itemClass);return R.from(r[n]).fold(()=>ur.error(new Error("No element found with index "+n)),e.getSystem().getByDom)},xv=(e,t,o)=>md(e.element,"."+t.itemClass).bind(t=>e.getSystem().getByDom(t).toOptional()),wv=(e,t,o)=>{const n=mp(e.element,"."+t.itemClass),r=n.length>0?R.some(n[n.length-1]):R.none();return r.bind(t=>e.getSystem().getByDom(t).toOptional())},Cv=(e,t,o,n)=>{const r=mp(e.element,"."+t.itemClass),s=J(r,e=>Cc(e,t.highlightClass));return s.bind(t=>{const o=nu(t,n,0,r.length-1);return e.getSystem().getByDom(r[o]).toOptional()})},Sv=(e,t,o)=>Cv(e,t,o,-1),kv=(e,t,o)=>Cv(e,t,o,1),_v=(e,t,o)=>{const n=mp(e.element,"."+t.itemClass);return Te(V(n,t=>e.getSystem().getByDom(t).toOptional()))};var Ev=Object.freeze({__proto__:null,dehighlightAll:dv,dehighlight:uv,highlight:mv,highlightFirst:gv,highlightLast:pv,highlightAt:fv,highlightBy:hv,isHighlighted:bv,getHighlighted:vv,getFirst:xv,getLast:wv,getPrevious:Sv,getNext:kv,getCandidates:_v}),Ov=[Ls("highlightClass"),Ls("itemClass"),Ld("onHighlight"),Ld("onDehighlight")];const Tv=Wu({fields:Ov,name:"highlighting",apis:Ev}),Dv=[8],Av=[9],Nv=[13],Rv=[27],Bv=[32],Mv=[37],Iv=[38],Pv=[39],Lv=[40],Fv=(e,t,o)=>{const n=te(e.slice(0,t)),r=te(e.slice(t+1));return X(n.concat(r),o)},zv=(e,t,o)=>{const n=te(e.slice(0,t));return X(n,o)},Uv=(e,t,o)=>{const n=e.slice(0,t),r=e.slice(t+1);return X(r.concat(n),o)},Hv=(e,t,o)=>{const n=e.slice(t+1);return X(n,o)},Vv=e=>t=>{const o=t.raw;return F(e,o.which)},jv=e=>t=>ee(e,e=>e(t)),Wv=e=>{const t=e.raw;return!0===t.shiftKey},$v=e=>{const t=e.raw;return!0===t.ctrlKey},Gv=O(Wv),qv=(e,t)=>({matches:e,classification:t}),Kv=(e,t)=>{const o=X(e,e=>e.matches(t));return o.map(e=>e.classification)},Yv=(e,t,o)=>{const n=t.exists(e=>o.exists(t=>kt(t,e)));n||Ri(e,ki(),{prevFocus:t,newFocus:o})},Xv=()=>{const e=e=>tm(e.element),t=(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const r=e(t);Yv(t,n,r)};return{get:e,set:t}},Jv=()=>{const e=e=>Tv.getHighlighted(e).map(e=>e.element),t=(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(y,e=>{Tv.highlight(t,e)});const r=e(t);Yv(t,n,r)};return{get:e,set:t}};var Zv;(function(e){e["OnFocusMode"]="onFocus",e["OnEnterOrSpaceMode"]="onEnterOrSpace",e["OnApiMode"]="onApi"})(Zv||(Zv={}));const Qv=(e,t,o,n,r)=>{const s=()=>e.concat([na("focusManager",Xv()),ra("focusInside","onFocus",_s(e=>F(["onFocus","onEnterOrSpace","onApi"],e)?ur.value(e):ur.error("Invalid value for focusInside"))),Hd("handler",l),Hd("state",t),Hd("sendFocusIn",r)]),a=(e,t,o,n,r)=>{const s=o(e,t,n,r);return Kv(s,t.event).bind(o=>o(e,t,n,r))},i=(e,t)=>{const s=e.focusInside!==Zv.OnFocusMode?R.none():r(e).map(o=>Vi(si(),(n,r)=>{o(n,e,t),r.stop()})),i=(o,n)=>{const s=Vv(Bv.concat(Nv))(n.event);e.focusInside===Zv.OnEnterOrSpaceMode&&s&&Da(o,n)&&r(e).each(r=>{r(o,e,t),n.stop()})},l=[Vi(Ka(),(n,r)=>{a(n,r,o,e,t).fold(()=>{i(n,r)},e=>{r.stop()})}),Vi(Ya(),(o,r)=>{a(o,r,n,e,t).each(e=>{r.stop()})})];return Fi(s.toArray().concat(l))},l={schema:s,processKey:a,toEvents:i};return l},ey=e=>{const t=[Ks("onEscape"),Ks("onEnter"),na("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),na("firstTabstop",0),na("useTabstopAt",N),Ks("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind(e=>gd(t,e)).getOr(t);return So(o)>0},n=(e,t)=>{const n=mp(e.element,t.selector),r=G(n,e=>o(t,e));return R.from(r[t.firstTabstop])},r=(e,t)=>t.focusManager.get(e).bind(e=>gd(e,t.selector)),s=(e,t)=>o(e,t)&&e.useTabstopAt(t),a=(e,t,o)=>{n(e,t).each(o=>{t.focusManager.set(e,o)})},i=(e,t,o,n,r)=>r(t,o,e=>s(n,e)).fold(()=>n.cyclic?R.some(!0):R.none(),t=>(n.focusManager.set(e,t),R.some(!0))),l=(e,t,o,n)=>{const s=mp(e.element,o.selector);return r(e,o).bind(t=>{const r=J(s,E(kt,t));return r.bind(t=>i(e,s,t,o,n))})},c=(e,t,o)=>{const n=o.cyclic?Fv:zv;return l(e,t,o,n)},d=(e,t,o)=>{const n=o.cyclic?Uv:Hv;return l(e,t,o,n)},u=e=>Nt(e).bind(Ft).exists(t=>kt(t,e)),m=(e,t,o)=>r(e,o).filter(e=>!o.useTabstopAt(e)).bind(n=>(u(n)?c:d)(e,t,o)),g=(e,t,o)=>o.onEnter.bind(o=>o(e,t)),p=(e,t,o)=>o.onEscape.bind(o=>o(e,t)),f=S([qv(jv([Wv,Vv(Av)]),c),qv(Vv(Av),d),qv(jv([Gv,Vv(Nv)]),g)]),h=S([qv(Vv(Rv),p),qv(Vv(Av),m)]);return Qv(t,Pl.init,f,h,()=>R.some(a))};var ty=ey(Is("cyclic",A)),oy=ey(Is("cyclic",N));const ny=(e,t,o)=>(Mi(e,o,ci()),R.some(!0)),ry=(e,t,o)=>{const n=zb(o)&&Vv(Bv)(t.event);return n?R.none():ny(e,t,o)},sy=(e,t)=>R.some(!0),ay=[na("execute",ry),na("useSpace",!1),na("useEnter",!0),na("useControlEnter",!1),na("useDown",!1)],iy=(e,t,o)=>o.execute(e,t,e.element),ly=(e,t,o,n)=>{const r=o.useSpace&&!zb(e.element)?Bv:[],s=o.useEnter?Nv:[],a=o.useDown?Lv:[],i=r.concat(s).concat(a);return[qv(Vv(i),iy)].concat(o.useControlEnter?[qv(jv([$v,Vv(Nv)]),iy)]:[])},cy=(e,t,o,n)=>o.useSpace&&!zb(e.element)?[qv(Vv(Bv),sy)]:[];var dy=Qv(ay,Pl.init,ly,cy,()=>R.none());const uy=()=>{const e=Am(),t=(t,o)=>{e.set({numRows:t,numColumns:o})},o=()=>e.get().map(e=>e.numRows),n=()=>e.get().map(e=>e.numColumns);return Ll({readState:()=>e.get().map(e=>({numRows:String(e.numRows),numColumns:String(e.numColumns)})).getOr({numRows:"?",numColumns:"?"}),setGridSize:t,getNumRows:o,getNumColumns:n})},my=e=>e.state(e);var gy=Object.freeze({__proto__:null,flatgrid:uy,init:my});const py=e=>(t,o,n,r)=>{const s=e(t.element);return vy(s,t,o,n,r)},fy=(e,t)=>{const o=ig(e,t);return py(o)},hy=(e,t)=>{const o=ig(t,e);return py(o)},by=e=>(t,o,n,r)=>vy(e,t,o,n,r),vy=(e,t,o,n,r)=>{const s=n.focusManager.get(t).bind(o=>e(t.element,o,n,r));return s.map(e=>(n.focusManager.set(t,e),!0))},yy=by,xy=by,wy=by,Cy=e=>e.offsetWidth<=0&&e.offsetHeight<=0,Sy=e=>!Cy(e.dom),ky=(e,t)=>J(e,t).map(t=>({index:t,candidates:e})),_y=(e,t,o)=>{const n=e=>kt(e,t),r=mp(e,o),s=G(r,Sy);return ky(s,n)},Ey=(e,t)=>J(e,e=>kt(t,e)),Oy=(e,t,o,n)=>{const r=Math.floor(t/o),s=t%o;return n(r,s).bind(t=>{const n=t.row*o+t.column;return n>=0&&nOy(e,t,n,(t,s)=>{const a=t===o-1,i=a?e.length-t*n:n,l=nu(s,r,0,i-1);return R.some({row:t,column:l})}),Dy=(e,t,o,n,r)=>Oy(e,t,n,(t,s)=>{const a=nu(t,r,0,o-1),i=a===o-1,l=i?e.length-a*n:n,c=ru(s,0,l-1);return R.some({row:a,column:c})}),Ay=(e,t,o,n)=>Ty(e,t,o,n,1),Ny=(e,t,o,n)=>Ty(e,t,o,n,-1),Ry=(e,t,o,n)=>Dy(e,t,o,n,-1),By=(e,t,o,n)=>Dy(e,t,o,n,1),My=[Ls("selector"),na("execute",ry),Fd("onEscape"),na("captureTab",!1),jd()],Iy=(e,t,o)=>{md(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},Py=(e,t)=>t.focusManager.get(e).bind(e=>gd(e,t.selector)),Ly=(e,t,o,n)=>Py(e,o).bind(n=>o.execute(e,t,n)),Fy=e=>(t,o,n,r)=>_y(t,o,n.selector).bind(t=>e(t.candidates,t.index,r.getNumRows().getOr(n.initSize.numRows),r.getNumColumns().getOr(n.initSize.numColumns))),zy=(e,t,o)=>o.captureTab?R.some(!0):R.none(),Uy=(e,t,o)=>o.onEscape(e,t),Hy=Fy(Ny),Vy=Fy(Ay),jy=Fy(Ry),Wy=Fy(By),$y=S([qv(Vv(Mv),fy(Hy,Vy)),qv(Vv(Pv),hy(Hy,Vy)),qv(Vv(Iv),yy(jy)),qv(Vv(Lv),xy(Wy)),qv(jv([Wv,Vv(Av)]),zy),qv(jv([Gv,Vv(Av)]),zy),qv(Vv(Bv.concat(Nv)),Ly)]),Gy=S([qv(Vv(Rv),Uy),qv(Vv(Bv),sy)]);var qy=Qv(My,uy,$y,Gy,()=>R.some(Iy));const Ky=(e,t,o,n,r)=>{const s=e=>"button"===ut(e)&&"disabled"===no(e,"disabled"),a=(e,t,o)=>r(e,t,n,0,o.length-1,o[t],t=>s(o[t])?a(e,t,o):R.from(o[t]));return _y(e,o,t).bind(e=>{const t=e.index,o=e.candidates;return a(t,t,o)})},Yy=(e,t,o,n)=>Ky(e,t,o,n,(e,t,o,n,r,s,a)=>{const i=ru(t+o,n,r);return i===e?R.from(s):a(i)}),Xy=(e,t,o,n)=>Ky(e,t,o,n,(e,t,o,n,r,s,a)=>{const i=nu(t,o,n,r);return i===e?R.none():a(i)}),Jy=[Ls("selector"),na("getInitial",R.none),na("execute",ry),Fd("onEscape"),na("executeOnMove",!1),na("allowVertical",!0),na("allowHorizontal",!0),na("cycles",!0)],Zy=(e,t)=>t.focusManager.get(e).bind(e=>gd(e,t.selector)),Qy=(e,t,o)=>Zy(e,o).bind(n=>o.execute(e,t,n)),ex=(e,t,o)=>{t.getInitial(e).orThunk(()=>md(e.element,t.selector)).each(o=>{t.focusManager.set(e,o)})},tx=(e,t,o)=>(o.cycles?Xy:Yy)(e,o.selector,t,-1),ox=(e,t,o)=>(o.cycles?Xy:Yy)(e,o.selector,t,1),nx=e=>(t,o,n,r)=>e(t,o,n,r).bind(()=>n.executeOnMove?Qy(t,o,n):R.some(!0)),rx=(e,t,o)=>o.onEscape(e,t),sx=(e,t,o,n)=>{const r=[...o.allowHorizontal?Mv:[]].concat(o.allowVertical?Iv:[]),s=[...o.allowHorizontal?Pv:[]].concat(o.allowVertical?Lv:[]);return[qv(Vv(r),nx(fy(tx,ox))),qv(Vv(s),nx(hy(tx,ox))),qv(Vv(Nv),Qy),qv(Vv(Bv),Qy)]},ax=S([qv(Vv(Bv),sy),qv(Vv(Rv),rx)]);var ix=Qv(Jy,Pl.init,sx,ax,()=>R.some(ex));const lx=(e,t,o)=>R.from(e[t]).bind(e=>R.from(e[o]).map(e=>({rowIndex:t,columnIndex:o,cell:e}))),cx=(e,t,o,n)=>{const r=e[t],s=r.length,a=nu(o,n,0,s-1);return lx(e,t,a)},dx=(e,t,o,n)=>{const r=nu(o,n,0,e.length-1),s=e[r].length,a=ru(t,0,s-1);return lx(e,r,a)},ux=(e,t,o,n)=>{const r=e[t],s=r.length,a=ru(o+n,0,s-1);return lx(e,t,a)},mx=(e,t,o,n)=>{const r=ru(o+n,0,e.length-1),s=e[r].length,a=ru(t,0,s-1);return lx(e,r,a)},gx=(e,t,o)=>cx(e,t,o,1),px=(e,t,o)=>cx(e,t,o,-1),fx=(e,t,o)=>dx(e,o,t,-1),hx=(e,t,o)=>dx(e,o,t,1),bx=(e,t,o)=>ux(e,t,o,-1),vx=(e,t,o)=>ux(e,t,o,1),yx=(e,t,o)=>mx(e,o,t,-1),xx=(e,t,o)=>mx(e,o,t,1),wx=[$s("selectors",[Ls("row"),Ls("cell")]),na("cycles",!0),na("previousSelector",R.none),na("execute",ry)],Cx=(e,t,o)=>{const n=t.previousSelector(e).orThunk(()=>{const o=t.selectors;return md(e.element,o.cell)});n.each(o=>{t.focusManager.set(e,o)})},Sx=(e,t,o)=>tm(e.element).bind(n=>o.execute(e,t,n)),kx=(e,t)=>V(e,e=>mp(e,t.selectors.cell)),_x=(e,t)=>(o,n,r)=>{const s=r.cycles?e:t;return gd(n,r.selectors.row).bind(e=>{const t=mp(e,r.selectors.cell);return Ey(t,n).bind(t=>{const n=mp(o,r.selectors.row);return Ey(n,e).bind(e=>{const o=kx(n,r);return s(o,e,t).map(e=>e.cell)})})})},Ex=_x(px,bx),Ox=_x(gx,vx),Tx=_x(fx,yx),Dx=_x(hx,xx),Ax=S([qv(Vv(Mv),fy(Ex,Ox)),qv(Vv(Pv),hy(Ex,Ox)),qv(Vv(Iv),yy(Tx)),qv(Vv(Lv),xy(Dx)),qv(Vv(Bv.concat(Nv)),Sx)]),Nx=S([qv(Vv(Bv),sy)]);var Rx=Qv(wx,Pl.init,Ax,Nx,()=>R.some(Cx));const Bx=[Ls("selector"),na("execute",ry),na("moveOnTab",!1)],Mx=(e,t,o)=>o.focusManager.get(e).bind(n=>o.execute(e,t,n)),Ix=(e,t,o)=>{md(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},Px=(e,t,o)=>Xy(e,o.selector,t,-1),Lx=(e,t,o)=>Xy(e,o.selector,t,1),Fx=(e,t,o,n)=>o.moveOnTab?wy(Px)(e,t,o,n):R.none(),zx=(e,t,o,n)=>o.moveOnTab?wy(Lx)(e,t,o,n):R.none(),Ux=S([qv(Vv(Iv),wy(Px)),qv(Vv(Lv),wy(Lx)),qv(jv([Wv,Vv(Av)]),Fx),qv(jv([Gv,Vv(Av)]),zx),qv(Vv(Nv),Mx),qv(Vv(Bv),Mx)]),Hx=S([qv(Vv(Bv),sy)]);var Vx=Qv(Bx,Pl.init,Ux,Hx,()=>R.some(Ix));const jx=[Fd("onSpace"),Fd("onEnter"),Fd("onShiftEnter"),Fd("onLeft"),Fd("onRight"),Fd("onTab"),Fd("onShiftTab"),Fd("onUp"),Fd("onDown"),Fd("onEscape"),na("stopSpaceKeyup",!1),Ks("focusIn")],Wx=(e,t,o)=>[qv(Vv(Bv),o.onSpace),qv(jv([Gv,Vv(Nv)]),o.onEnter),qv(jv([Wv,Vv(Nv)]),o.onShiftEnter),qv(jv([Wv,Vv(Av)]),o.onShiftTab),qv(jv([Gv,Vv(Av)]),o.onTab),qv(Vv(Iv),o.onUp),qv(Vv(Lv),o.onDown),qv(Vv(Mv),o.onLeft),qv(Vv(Pv),o.onRight),qv(Vv(Bv),o.onSpace)],$x=(e,t,o)=>[...o.stopSpaceKeyup?[qv(Vv(Bv),sy)]:[],qv(Vv(Rv),o.onEscape)];var Gx=Qv(jx,Pl.init,Wx,$x,e=>e.focusIn);const qx=ty.schema(),Kx=oy.schema(),Yx=ix.schema(),Xx=qy.schema(),Jx=Rx.schema(),Zx=dy.schema(),Qx=Vx.schema(),ew=Gx.schema();var tw=Object.freeze({__proto__:null,acyclic:qx,cyclic:Kx,flow:Yx,flatgrid:Xx,matrix:Jx,execution:Zx,menu:Qx,special:ew});const ow=e=>_e(e,"setGridSize"),nw=Gu({branchKey:"mode",branches:tw,name:"keying",active:{events:(e,t)=>{const o=e.handler;return o.toEvents(e,t)}},apis:{focusIn:(e,t,o)=>{t.sendFocusIn(t).fold(()=>{e.getSystem().triggerFocus(e.element,e.element)},n=>{n(e,t,o)})},setGridSize:(e,t,o,n,r)=>{ow(o)?o.setGridSize(n,r):console.error("Layout does not support setGridSize")}},state:gy}),rw=(e,t)=>{om(()=>{gf(e,t,()=>V(t,e.getSystem().build))},e.element)},sw=(e,t)=>{om(()=>{pf(e,t,()=>Ic(e.element,t,e.getSystem().buildOrPatch))},e.element)},aw=(e,t,o,n)=>{df(t);const r=Mc(e.element,o,n,e.getSystem().buildOrPatch);cf(e,r),e.syncComponents()},iw=(e,t,o)=>{const n=e.getSystem().build(o);hf(e,n,t)},lw=(e,t,o,n)=>{vf(t),iw(e,(e,t)=>Ln(e,t,o),n)},cw=(e,t,o,n)=>{const r=t.reuseDom?sw:rw;return r(e,n)},dw=(e,t,o,n)=>{iw(e,Pn,n)},uw=(e,t,o,n)=>{iw(e,In,n)},mw=(e,t,o,n)=>{const r=gw(e),s=X(r,e=>kt(n.element,e.element));s.each(vf)},gw=(e,t)=>e.components(),pw=(e,t,o,n,r)=>{const s=gw(e);return R.from(s[n]).map(o=>(r.fold(()=>vf(o),r=>{const s=t.reuseDom?aw:lw;s(e,o,n,r)}),o))},fw=(e,t,o,n,r)=>{const s=gw(e);return J(s,n).bind(n=>pw(e,t,o,n,r))};var hw=Object.freeze({__proto__:null,append:dw,prepend:uw,remove:mw,replaceAt:pw,replaceBy:fw,set:cw,contents:gw});const bw=Wu({fields:[la("reuseDom",!0)],name:"replacing",apis:hw}),vw=(e,t)=>{const o=Fi(t);return Wu({fields:[Ls("enabled")],name:e,active:{events:S(o)}})},yw=(e,t)=>{const o=vw(e,t);return{key:e,value:{config:{},me:o,configAsRaw:S({}),initialConfig:{},state:Pl}}},xw=(e,t)=>{t.ignore||(Ju(e.element),t.onFocus(e))},ww=(e,t)=>{t.ignore||Zu(e.element)},Cw=e=>Qu(e.element);var Sw=Object.freeze({__proto__:null,focus:xw,blur:ww,isFocused:Cw});const kw=(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return Vl(o)},_w=e=>Fi([Vi(si(),(t,o)=>{xw(t,e),o.stop()})].concat(e.stopMousedown?[Vi(Ha(),(e,t)=>{t.event.prevent()})]:[]));var Ew=Object.freeze({__proto__:null,exhibit:kw,events:_w}),Ow=[Ld("onFocus"),na("stopMousedown",!1),na("ignore",!1)];const Tw=Wu({fields:Ow,name:"focusing",active:Ew,apis:Sw}),Dw=e=>{const t=()=>{const t=ga(e),o=()=>t.get(),n=e=>t.set(e),r=()=>t.set(e),s=()=>t.get();return{get:o,set:n,clear:r,readState:s}};return{init:t}},Aw=(e,t,o)=>{const n=t.aria;n.update(e,n,o.get())},Nw=(e,t,o)=>{t.toggleClass.each(t=>{o.get()?vc(e.element,t):xc(e.element,t)})},Rw=(e,t,o,n)=>{const r=o.get();o.set(n),Nw(e,t,o),Aw(e,t,o),r!==n&&t.onToggled(e,n)},Bw=(e,t,o)=>{Rw(e,t,o,!o.get())},Mw=(e,t,o)=>{Rw(e,t,o,!0)},Iw=(e,t,o)=>{Rw(e,t,o,!1)},Pw=(e,t,o)=>o.get(),Lw=(e,t,o)=>{Rw(e,t,o,t.selected)};var Fw=Object.freeze({__proto__:null,onLoad:Lw,toggle:Bw,isOn:Pw,on:Mw,off:Iw,set:Rw});const zw=()=>Vl({}),Uw=(e,t)=>{const o=Iu(e,t,Bw),n=Pu(e,t,Lw);return Fi(Z([e.toggleOnExecute?[o]:[],[n]]))};var Hw=Object.freeze({__proto__:null,exhibit:zw,events:Uw});const Vw=(e,t,o)=>{to(e.element,"aria-pressed",o),t.syncWithExpanded&&$w(e,t,o)},jw=(e,t,o)=>{to(e.element,"aria-selected",o)},Ww=(e,t,o)=>{to(e.element,"aria-checked",o)},$w=(e,t,o)=>{to(e.element,"aria-expanded",o)};var Gw=[na("selected",!1),Ks("toggleClass"),na("toggleOnExecute",!0),Ld("onToggled"),ra("aria",{mode:"none"},Rs("mode",{pressed:[na("syncWithExpanded",!1),Hd("update",Vw)],checked:[Hd("update",Ww)],expanded:[Hd("update",$w)],selected:[Hd("update",jw)],none:[Hd("update",y)]}))];const qw=Wu({fields:Gw,name:"toggling",active:Hw,apis:Fw,state:Dw(!1)}),Kw=()=>{const e=(e,t)=>{t.stop(),Bi(e)};return[Vi(Za(),e),Vi(ui(),e),Yi(La()),Yi(Ha())]},Yw=e=>{const t=e=>tl((t,o)=>{e(t),o.stop()});return Fi(Z([e.map(t).toArray(),Kw()]))},Xw="alloy.item-hover",Jw="alloy.item-focus",Zw="alloy.item-toggled",Qw=e=>{(tm(e.element).isNone()||Tw.isFocused(e))&&(Tw.isFocused(e)||Tw.focus(e),Ri(e,Xw,{item:e}))},eC=e=>{Ri(e,Jw,{item:e})},tC=(e,t)=>{Ri(e,Zw,{item:e,state:t})},oC=S(Xw),nC=S(Jw),rC=S(Zw),sC=e=>e.toggling.map(e=>e.exclusive?"menuitemradio":"menuitemcheckbox").getOr("menuitem"),aC=e=>({aria:{mode:"checked"},...ye(e,(e,t)=>"exclusive"!==t),onToggled:(t,o)=>{h(e.onToggled)&&e.onToggled(t,o),tC(t,o)}}),iC=e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:sC(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Dh.augment(e.itemBehaviours,[e.toggling.fold(qw.revoke,e=>qw.config(aC(e))),Tw.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{eC(e)}}),nw.config({mode:"execution"}),_h.config({store:{mode:"memory",initialValue:e.data}}),yw("item-type-events",[...Kw(),Vi($a(),Qw),Vi(di(),Tw.focus)])]),components:e.components,eventOrder:e.eventOrder}),lC=[Ls("data"),Ls("components"),Ls("dom"),na("hasSubmenu",!1),Ks("toggling"),Dh.field("itemBehaviours",[qw,Tw,nw,_h]),na("ignoreFocus",!1),na("domModification",{}),Hd("builder",iC),na("eventOrder",{})],cC=e=>({dom:e.dom,components:e.components,events:Fi([Xi(di())])}),dC=[Ls("dom"),Ls("components"),Hd("builder",cC)],uC=S("item-widget"),mC=S([rb({name:"widget",overrides:e=>({behaviours:Vu([_h.config({store:{mode:"manual",getValue:t=>e.data,setValue:y}})])})})]),gC=e=>{const t=bb(uC(),e,mC()),o=vb(uC(),e,t.internals()),n=t=>yb(t,e,"widget").map(e=>(nw.focusIn(e),e)),r=(t,o)=>zb(o.event.target)?R.none():(()=>e.autofocus?(o.setSource(t.element),R.none()):R.none())();return{dom:e.dom,components:o,domModification:e.domModification,events:Fi([tl((e,t)=>{n(e).each(e=>{t.stop()})}),Vi($a(),Qw),Vi(di(),(t,o)=>{e.autofocus?n(t):Tw.focus(t)})]),behaviours:Dh.augment(e.widgetBehaviours,[_h.config({store:{mode:"memory",initialValue:e.data}}),Tw.config({ignore:e.ignoreFocus,onFocus:e=>{eC(e)}}),nw.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:qu(),onLeft:r,onRight:r,onEscape:(t,o)=>Tw.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),R.none()):R.none():(Tw.focus(t),R.some(!0))})])}},pC=[Ls("uid"),Ls("data"),Ls("components"),Ls("dom"),na("autofocus",!1),na("ignoreFocus",!1),Dh.field("widgetBehaviours",[_h,Tw,nw]),na("domModification",{}),Eb(mC()),Hd("builder",gC)],fC=Rs("type",{widget:pC,item:lC,separator:dC}),hC=(e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager}),bC=(e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}),vC=(e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager}),yC=S([ib({factory:{sketch:e=>{const t=As("menu.spec item",fC,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>ke(t,"uid")?t:{...t,uid:Sl("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),xC=S([Ls("value"),Ls("items"),Ls("dom"),Ls("components"),na("eventOrder",{}),Eh("menuBehaviours",[Tv,_h,jb,nw]),ra("movement",{mode:"menu",moveOnTab:!0},Rs("mode",{grid:[jd(),Hd("config",hC)],matrix:[Hd("config",bC),Ls("rowSelector"),na("previousSelector",R.none)],menu:[na("moveOnTab",!0),Hd("config",vC)]})),Bd(),na("fakeFocus",!1),na("focusManager",Xv()),Ld("onHighlight"),Ld("onDehighlight")]),wC=S("alloy.menu-focus"),CC=(e,t)=>{const o=mp(e.element,'[role="menuitemradio"][aria-checked="true"]');j(o,o=>{kt(o,t.element)||e.getSystem().getByDom(o).each(e=>{qw.off(e)})})},SC=(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Th(e.menuBehaviours,[Tv.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),_h.config({store:{mode:"memory",initialValue:e.value}}),jb.config({find:R.some}),nw.config(e.movement.config(e,e.movement))]),events:Fi([Vi(nC(),(e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each(o=>{Tv.highlight(e,o),t.stop(),Ri(e,wC(),{menu:e,item:o})})}),Vi(oC(),(e,t)=>{const o=t.event.item;Tv.highlight(e,o)}),Vi(rC(),(e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===no(o.element,"role")&&CC(e,o)})]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}}),kC=Fb({name:"Menu",configFields:xC(),partFields:yC(),factory:SC}),_C=e=>fe(e,(e,t)=>({k:e,v:t})),EC=(e,t,o,n)=>Se(o,n).bind(n=>Se(e,n).bind(n=>{const r=EC(e,t,o,n);return R.some([n].concat(r))})).getOr([]),OC=(e,t)=>{const o={};ge(e,(e,t)=>{j(e,e=>{o[e]=t})});const n=t,r=_C(t),s=pe(r,(e,t)=>[t].concat(EC(o,n,r,t)));return pe(o,e=>Se(s,e).getOr([e]))},TC=()=>{const e=ga({}),t=ga({}),o=ga({}),n=Am(),r=ga({}),s=()=>{e.set({}),t.set({}),o.set({}),n.clear()},a=()=>n.get().isNone(),i=(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},l=(s,a,i,l)=>{n.set(s),e.set(i),t.set(a),r.set(l);const c=OC(l,i);o.set(c)},c=t=>we(e.get(),(e,o)=>e===t),d=(e,t,o)=>f(e).bind(n=>c(e).bind(e=>t(e).map(e=>({triggeredMenu:n,triggeringItem:e,triggeringPath:o})))),u=(e,t)=>{const r=G(b(e).toArray(),e=>f(e).isSome());return Se(o.get(),e).bind(e=>{const o=te(r.concat(e)),s=Q(o,(e,r)=>d(e,t,o.slice(0,r+1)).fold(()=>Ee(n.get(),e)?[]:[R.none()],e=>[R.some(e)]));return De(s)})},m=t=>Se(e.get(),t).map(e=>{const n=Se(o.get(),t).getOr([]);return[e].concat(n)}),g=e=>Se(o.get(),e).bind(e=>e.length>1?R.some(e.slice(1)):R.none()),p=e=>Se(o.get(),e),f=e=>h(e).bind(DC),h=e=>Se(t.get(),e),b=t=>Se(e.get(),t),v=e=>{const t=r.get();return oe(ue(t),e)},y=()=>n.get().bind(f),x=()=>t.get();return{setMenuBuilt:i,setContents:l,expand:m,refresh:p,collapse:g,lookupMenu:h,lookupItem:b,otherMenus:v,getPrimary:y,getMenus:x,clear:s,isClear:a,getTriggeringPath:u}},DC=e=>"prepared"===e.type?R.some(e.menu):R.none(),AC={init:TC,extractPreparedMenu:DC},NC=fl("tiered-menu-item-highlight"),RC=fl("tiered-menu-item-dehighlight");var BC;(function(e){e[e["HighlightMenuAndItem"]=0]="HighlightMenuAndItem",e[e["HighlightJustMenu"]=1]="HighlightJustMenu",e[e["HighlightNone"]=2]="HighlightNone"})(BC||(BC={}));const MC=(e,t)=>{const o=Am(),n=(t,o,n)=>pe(n,(n,r)=>{const s=()=>kC.sketch({...n,value:r,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{const o={menuComp:e,itemComp:t};Ri(e,NC,o)},onDehighlight:(e,t)=>{const o={menuComp:e,itemComp:t};Ri(e,RC,o)},focusManager:e.fakeFocus?Jv():Xv()});return r===o?{type:"prepared",menu:t.getSystem().build(s())}:{type:"notbuilt",nbMenu:s}}),r=AC.init(),s=t=>{const o=n(t,e.data.primary,e.data.menus),s=l();return r.setContents(e.data.primary,o,e.data.expansions,s),r.getPrimary()},a=e=>_h.getValue(e).value,i=(e,t,o)=>de(t,e=>{if(!e.getSystem().isConnected())return R.none();const t=Tv.getCandidates(e);return X(t,e=>a(e)===o)}),l=t=>pe(e.data.menus,(e,t)=>Q(e.items,e=>"separator"===e.type?[]:[e.data.value])),c=Tv.highlight,d=(t,o)=>{c(t,o),Tv.getHighlighted(o).orThunk(()=>Tv.getFirst(o)).each(n=>{e.fakeFocus?Tv.highlight(o,n):Mi(t,n.element,di())})},u=(e,t)=>Te(V(t,t=>e.lookupMenu(t).bind(e=>"prepared"===e.type?R.some(e.menu):R.none()))),m=(t,o,n)=>{const r=u(o,o.otherMenus(n));j(r,o=>{kc(o.element,[e.markers.backgroundMenu]),e.stayInDom||bw.remove(t,o)})},g=t=>o.get().getOrThunk(()=>{const n={},r=mp(t.element,"."+e.markers.item),s=G(r,e=>"true"===no(e,"aria-haspopup"));return j(s,e=>{t.getSystem().getByDom(e).each(e=>{const t=a(e);n[t]=e})}),o.set(n),n}),p=(e,t)=>{const o=g(e);ge(o,(e,o)=>{const n=F(t,o);to(e.element,"aria-expanded",n)})},f=(t,o,n)=>R.from(n[0]).bind(r=>o.lookupMenu(r).bind(r=>{if("notbuilt"===r.type)return R.none();{const s=r.menu,a=u(o,n.slice(1));return j(a,t=>{vc(t.element,e.markers.backgroundMenu)}),Jt(s.element)||bw.append(t,nd(s)),kc(s.element,[e.markers.backgroundMenu]),d(t,s),m(t,o,n),R.some(s)}}));let h;(function(e){e[e["HighlightSubmenu"]=0]="HighlightSubmenu",e[e["HighlightParent"]=1]="HighlightParent"})(h||(h={}));const b=(e,t,o)=>{if("notbuilt"===o.type){const n=e.getSystem().build(o.nbMenu());return r.setMenuBuilt(t,n),n}return o.menu},v=(t,o,n=h.HighlightSubmenu)=>{if(o.hasConfigured(lv)&&lv.isDisabled(o))return R.some(o);{const s=a(o);return r.expand(s).bind(s=>(p(t,s),R.from(s[0]).bind(a=>r.lookupMenu(a).bind(i=>{const l=b(t,a,i);return Jt(l.element)||bw.append(t,nd(l)),e.onOpenSubmenu(t,o,l,te(s)),n===h.HighlightSubmenu?(Tv.highlightFirst(l),f(t,r,s)):(Tv.dehighlightAll(l),R.some(o))}))))}},x=(t,o)=>{const n=a(o);return r.collapse(n).bind(n=>(p(t,n),f(t,r,n).map(n=>(e.onCollapseMenu(t,o,n),n))))},w=(e,t)=>{const o=a(t);return r.refresh(o).bind(t=>(p(e,t),f(e,r,t)))},C=(e,t)=>zb(t.element)?R.none():v(e,t,h.HighlightSubmenu),S=(e,t)=>zb(t.element)?R.none():x(e,t),k=(t,o)=>x(t,o).orThunk(()=>e.onEscape(t,o).map(()=>t)),_=t=>(o,n)=>gd(n.getSource(),"."+e.markers.item).bind(e=>o.getSystem().getByDom(e).toOptional().bind(e=>t(o,e).map(N))),E=Fi([Vi(wC(),(e,t)=>{const o=t.event.item;r.lookupItem(a(o)).each(()=>{const o=t.event.menu;Tv.highlight(e,o);const n=a(t.event.item);r.refresh(n).each(t=>m(e,r,t))})}),tl((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each(o=>{const n=a(o);0===n.indexOf("collapse-item")&&x(t,o),v(t,o,h.HighlightSubmenu).fold(()=>{e.onExecute(t,o)},y)})}),Zi((t,o)=>{s(t).each(o=>{bw.append(t,nd(o)),e.onOpenMenu(t,o),e.highlightOnOpen===BC.HighlightMenuAndItem?d(t,o):e.highlightOnOpen===BC.HighlightJustMenu&&c(t,o)})}),Vi(NC,(t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)}),Vi(RC,(t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)}),...e.navigateOnHover?[Vi(oC(),(t,o)=>{const n=o.event.item;w(t,n),v(t,n,h.HighlightParent),e.onHover(t,n)})]:[]]),O=e=>Tv.getHighlighted(e).bind(Tv.getHighlighted),T=e=>{O(e).each(t=>{x(e,t)})},D=e=>{r.getPrimary().each(t=>{d(e,t)})},A=e=>R.from(e.components()[0]).filter(e=>"menu"===no(e.element,"role")),B=t=>{const o=r.getPrimary().bind(e=>O(t).bind(e=>{const o=a(e),n=Ce(r.getMenus()),s=Te(V(n,AC.extractPreparedMenu));return r.getTriggeringPath(o,e=>i(t,s,e))}).map(t=>({primary:e,triggeringPath:t})));o.fold(()=>{A(t).each(o=>{e.onRepositionMenu(t,o,[])})},({primary:o,triggeringPath:n})=>{e.onRepositionMenu(t,o,n)})},M={collapseMenu:T,highlightPrimary:D,repositionMenus:B};return{uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Th(e.tmenuBehaviours,[nw.config({mode:"special",onRight:_(C),onLeft:_(S),onEscape:_(k),focusIn:(e,t)=>{r.getPrimary().each(t=>{Mi(e,t.element,di())})}}),Tv.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),jb.config({find:e=>Tv.getHighlighted(e)}),bw.config({})]),eventOrder:e.eventOrder,apis:M,events:E}},IC=S("collapse-item"),PC=(e,t,o)=>({primary:e,menus:t,expansions:o}),LC=(e,t)=>({primary:e,menus:wa(e,t),expansions:{}}),FC=e=>({value:fl(IC()),meta:{text:e}}),zC=Lb({name:"TieredMenu",configFields:[Ud("onExecute"),Ud("onEscape"),zd("onOpenMenu"),zd("onOpenSubmenu"),Ld("onRepositionMenu"),Ld("onCollapseMenu"),na("highlightOnOpen",BC.HighlightMenuAndItem),$s("data",[Ls("primary"),Ls("menus"),Ls("expansions")]),na("fakeFocus",!1),Ld("onHighlightItem"),Ld("onDehighlightItem"),Ld("onHover"),Md(),Ls("dom"),na("navigateOnHover",!0),na("stayInDom",!1),Eh("tmenuBehaviours",[nw,Tv,jb,bw]),na("eventOrder",{})],apis:{collapseMenu:(e,t)=>{e.collapseMenu(t)},highlightPrimary:(e,t)=>{e.highlightPrimary(t)},repositionMenus:(e,t)=>{e.repositionMenus(t)}},factory:MC,extraApis:{tieredData:PC,singleData:LC,collapseItem:FC}}),UC=(e,t,o,n,r)=>{const s=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>Du(),onRtl:()=>Au()}}:{},i=e=>2===e.length,l=e=>i(e)?a:{};return zC.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(jf.close(t),e.onEscape.map(e=>e(t)),R.some(!0)),onExecute:()=>R.some(!0),onOpenMenu:(e,t)=>{rf.positionWithinBounds(s().getOrDie(),t,o,r())},onOpenSubmenu:(e,t,o,n)=>{const r=s().getOrDie();rf.position(r,o,{anchor:{type:"submenu",item:t,...l(n)}})},onRepositionMenu:(e,t,n)=>{const a=s().getOrDie();rf.positionWithinBounds(a,t,o,r()),j(n,e=>{const t=l(e.triggeringPath);rf.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})})}})},HC=(e,t)=>{const o=(t,o)=>{const n=e.getRelated(t);return n.exists(e=>vd(e,o))},n=(e,t)=>{jf.setContent(e,t)},r=(e,t,o)=>{const n=R.none;s(e,t,o,n)},s=(t,o,n,r)=>{const s=e.lazySink(t).getOrDie();jf.openWhileCloaked(t,o,()=>rf.positionWithinBounds(s,t,n,r())),_h.setValue(t,R.some({mode:"position",config:n,getBounds:r}))},a=(e,t,o)=>{i(e,t,o,R.none)},i=(t,o,n,r)=>{const s=UC(e,t,o,n,r);jf.open(t,s),_h.setValue(t,R.some({mode:"menu",menu:s}))},l=e=>{jf.isOpen(e)&&(_h.setValue(e,R.none()),jf.close(e))},c=e=>jf.getState(e),d=t=>{jf.isOpen(t)&&_h.getValue(t).each(o=>{switch(o.mode){case"menu":jf.getState(t).each(zC.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();rf.positionWithinBounds(n,t,o.config,o.getBounds());break}})},u={setContent:n,showAt:r,showWithinBounds:s,showMenuAt:a,showMenuWithinBounds:i,hide:l,getContent:c,reposition:d,isOpen:jf.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Th(e.inlineBehaviours,[jf.config({isPartOf:(e,t,n)=>vd(t,n)||o(e,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),_h.config({store:{mode:"memory",initialValue:R.none()}}),Ku.config({channels:{...Kf({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...Xf({...e.fireRepositionEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({}),doReposition:d})}})]),eventOrder:e.eventOrder,apis:u}},VC=Lb({name:"InlineView",configFields:[Ls("lazySink"),Ld("onShow"),Ld("onHide"),Qs("onEscape"),Eh("inlineBehaviours",[jf,_h,Ku]),ta("fireDismissalEventInstead",[na("event",Ci())]),ta("fireRepositionEventInstead",[na("event",Si())]),na("getRelated",R.none),na("isExtraPart",A),na("eventOrder",R.none)],factory:HC,apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,r)=>{e.showWithinBounds(t,o,n,r)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,r)=>{e.showMenuWithinBounds(t,o,n,r)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var jC=tinymce.util.Tools.resolve("tinymce.util.Delay");const WC=e=>{const t=Yw(e.action),o=e.dom.tag,n=t=>Se(e.dom,"attributes").bind(e=>Se(e,t)),r=()=>{if("button"===o){const e=n("type").getOr("button"),t=n("role").map(e=>({role:e})).getOr({});return{type:e,...t}}{const t=e.role.getOr(n("role").getOr("button"));return{role:t}}};return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:Dh.augment(e.buttonBehaviours,[Tw.config({}),nw.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:r()},eventOrder:e.eventOrder}},$C=Lb({name:"Button",factory:WC,configFields:[na("uid",void 0),Ls("dom"),na("components",[]),Dh.field("buttonBehaviours",[Tw,nw]),Ks("action"),Ks("role"),na("eventOrder",{})]}),GC=e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return K(t,(e,t)=>"class"===t.name?e:{...e,[t.name]:t.value},{})},qC=e=>Array.prototype.slice.call(e.dom.classList,0),KC=e=>{const t=Ze.fromHtml(e),o=Pt(t),n=GC(t),r=qC(t),s=0===o.length?{}:{innerHtml:nl(t)};return{tag:ut(t),classes:r,attributes:n,...s}},YC=e=>{const t=Mb(e)&&_e(e,"uid")?e.uid:Sl("memento"),o=e=>e.getSystem().getByUid(t).getOrDie(),n=e=>e.getSystem().getByUid(t).toOptional(),r=()=>({...e,uid:t});return{get:o,getOpt:n,asSpec:r}},{entries:XC,setPrototypeOf:JC,isFrozen:ZC,getPrototypeOf:QC,getOwnPropertyDescriptor:eS}=Object;let{freeze:tS,seal:oS,create:nS}=Object,{apply:rS,construct:sS}="undefined"!==typeof Reflect&&Reflect;rS||(rS=function(e,t,o){return e.apply(t,o)}),tS||(tS=function(e){return e}),oS||(oS=function(e){return e}),sS||(sS=function(e,t){return new e(...t)});const aS=bS(Array.prototype.forEach),iS=bS(Array.prototype.pop),lS=bS(Array.prototype.push),cS=bS(String.prototype.toLowerCase),dS=bS(String.prototype.toString),uS=bS(String.prototype.match),mS=bS(String.prototype.replace),gS=bS(String.prototype.indexOf),pS=bS(String.prototype.trim),fS=bS(RegExp.prototype.test),hS=vS(TypeError);function bS(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r/gm),IS=oS(/\${[\w\W]*}/gm),PS=oS(/^data-[\-\w.\u00B7-\uFFFF]/),LS=oS(/^aria-[\-\w]+$/),FS=oS(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zS=oS(/^(?:\w+script|data):/i),US=oS(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),HS=oS(/^html$/i);var VS=Object.freeze({__proto__:null,MUSTACHE_EXPR:BS,ERB_EXPR:MS,TMPLIT_EXPR:IS,DATA_ATTR:PS,ARIA_ATTR:LS,IS_ALLOWED_URI:FS,IS_SCRIPT_OR_DATA:zS,ATTR_WHITESPACE:US,DOCTYPE_NAME:HS});const jS=()=>"undefined"===typeof window?null:window,WS=function(e,t){if("object"!==typeof e||"function"!==typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML(e){return e},createScriptURL(e){return e}})}catch(s){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function $S(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:jS();const t=e=>$S(e);if(t.version="3.0.5",t.removed=[],!e||!e.document||9!==e.document.nodeType)return t.isSupported=!1,t;const o=e.document,n=o.currentScript;let{document:r}=e;const{DocumentFragment:s,HTMLTemplateElement:a,Node:i,Element:l,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:m,trustedTypes:g}=e,p=l.prototype,f=wS(p,"cloneNode"),h=wS(p,"nextSibling"),b=wS(p,"childNodes"),v=wS(p,"parentNode");if("function"===typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let y,x="";const{implementation:w,createNodeIterator:C,createDocumentFragment:S,getElementsByTagName:k}=r,{importNode:_}=o;let E={};t.isSupported="function"===typeof XC&&"function"===typeof v&&w&&void 0!==w.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:T,TMPLIT_EXPR:D,DATA_ATTR:A,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:B}=VS;let{IS_ALLOWED_URI:M}=VS,I=null;const P=yS({},[...CS,...SS,...kS,...ES,...TS]);let L=null;const F=yS({},[...DS,...AS,...NS,...RS]);let z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),U=null,H=null,V=!0,j=!0,W=!1,$=!0,G=!1,q=!1,K=!1,Y=!1,X=!1,J=!1,Z=!1,Q=!0,ee=!1;const te="user-content-";let oe=!0,ne=!1,re={},se=null;const ae=yS({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=yS({},["audio","video","img","source","image","track"]);let ce=null;const de=yS({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let pe=ge,fe=!1,he=null;const be=yS({},[ue,me,ge],dS);let ve;const ye=["application/xhtml+xml","text/html"],xe="text/html";let we,Ce=null;const Se=r.createElement("form"),ke=function(e){return e instanceof RegExp||e instanceof Function},_e=function(e){if(!Ce||Ce!==e){if(e&&"object"===typeof e||(e={}),e=xS(e),ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?xe:e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===ve?dS:cS,I="ALLOWED_TAGS"in e?yS({},e.ALLOWED_TAGS,we):P,L="ALLOWED_ATTR"in e?yS({},e.ALLOWED_ATTR,we):F,he="ALLOWED_NAMESPACES"in e?yS({},e.ALLOWED_NAMESPACES,dS):be,ce="ADD_URI_SAFE_ATTR"in e?yS(xS(de),e.ADD_URI_SAFE_ATTR,we):de,ie="ADD_DATA_URI_TAGS"in e?yS(xS(le),e.ADD_DATA_URI_TAGS,we):le,se="FORBID_CONTENTS"in e?yS({},e.FORBID_CONTENTS,we):ae,U="FORBID_TAGS"in e?yS({},e.FORBID_TAGS,we):{},H="FORBID_ATTR"in e?yS({},e.FORBID_ATTR,we):{},re="USE_PROFILES"in e&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,G=e.SAFE_FOR_TEMPLATES||!1,q=e.WHOLE_DOCUMENT||!1,X=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Z=e.RETURN_TRUSTED_TYPE||!1,Y=e.FORCE_BODY||!1,Q=!1!==e.SANITIZE_DOM,ee=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,M=e.ALLOWED_URI_REGEXP||FS,pe=e.NAMESPACE||ge,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"===typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(j=!1),J&&(X=!0),re&&(I=yS({},[...TS]),L=[],!0===re.html&&(yS(I,CS),yS(L,DS)),!0===re.svg&&(yS(I,SS),yS(L,AS),yS(L,RS)),!0===re.svgFilters&&(yS(I,kS),yS(L,AS),yS(L,RS)),!0===re.mathMl&&(yS(I,ES),yS(L,NS),yS(L,RS))),e.ADD_TAGS&&(I===P&&(I=xS(I)),yS(I,e.ADD_TAGS,we)),e.ADD_ATTR&&(L===F&&(L=xS(L)),yS(L,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&yS(ce,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===ae&&(se=xS(se)),yS(se,e.FORBID_CONTENTS,we)),oe&&(I["#text"]=!0),q&&yS(I,["html","head","body"]),I.table&&(yS(I,["tbody"]),delete U.tbody),e.TRUSTED_TYPES_POLICY){if("function"!==typeof e.TRUSTED_TYPES_POLICY.createHTML)throw hS('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!==typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw hS('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=e.TRUSTED_TYPES_POLICY,x=y.createHTML("")}else void 0===y&&(y=WS(g,n)),null!==y&&"string"===typeof x&&(x=y.createHTML(""));tS&&tS(e),Ce=e}},Ee=yS({},["mi","mo","mn","ms","mtext"]),Oe=yS({},["foreignobject","desc","title","annotation-xml"]),Te=yS({},["title","style","font","a","script"]),De=yS({},SS);yS(De,kS),yS(De,_S);const Ae=yS({},ES);yS(Ae,OS);const Ne=function(e){let t=v(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});const o=cS(e.tagName),n=cS(t.tagName);return!!he[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ge?"svg"===o:t.namespaceURI===ue?"svg"===o&&("annotation-xml"===n||Ee[n]):Boolean(De[o]):e.namespaceURI===ue?t.namespaceURI===ge?"math"===o:t.namespaceURI===me?"math"===o&&Oe[n]:Boolean(Ae[o]):e.namespaceURI===ge?!(t.namespaceURI===me&&!Oe[n])&&(!(t.namespaceURI===ue&&!Ee[n])&&(!Ae[o]&&(Te[o]||!De[o]))):!("application/xhtml+xml"!==ve||!he[e.namespaceURI]))},Re=function(e){lS(t.removed,{element:e});try{e.parentNode.removeChild(e)}catch(o){e.remove()}},Be=function(e,o){try{lS(t.removed,{attribute:o.getAttributeNode(e),from:o})}catch(n){lS(t.removed,{attribute:null,from:o})}if(o.removeAttribute(e),"is"===e&&!L[e])if(X||J)try{Re(o)}catch(n){}else try{o.setAttribute(e,"")}catch(n){}},Me=function(e){let t,o;if(Y)e=""+e;else{const t=uS(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ve&&pe===ge&&(e=''+e+"");const n=y?y.createHTML(e):e;if(pe===ge)try{t=(new m).parseFromString(n,ve)}catch(a){}if(!t||!t.documentElement){t=w.createDocument(pe,"template",null);try{t.documentElement.innerHTML=fe?x:n}catch(a){}}const s=t.body||t.documentElement;return e&&o&&s.insertBefore(r.createTextNode(o),s.childNodes[0]||null),pe===ge?k.call(t,q?"html":"body")[0]:q?t.documentElement:s},Ie=function(e){return C.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Pe=function(e){return e instanceof u&&("string"!==typeof e.nodeName||"string"!==typeof e.textContent||"function"!==typeof e.removeChild||!(e.attributes instanceof d)||"function"!==typeof e.removeAttribute||"function"!==typeof e.setAttribute||"string"!==typeof e.namespaceURI||"function"!==typeof e.insertBefore||"function"!==typeof e.hasChildNodes)},Le=function(e){return"object"===typeof i?e instanceof i:e&&"object"===typeof e&&"number"===typeof e.nodeType&&"string"===typeof e.nodeName},Fe=function(e,o,n){E[e]&&aS(E[e],e=>{e.call(t,o,n,Ce)})},ze=function(e){let o;if(Fe("beforeSanitizeElements",e,null),Pe(e))return Re(e),!0;const n=we(e.nodeName);if(Fe("uponSanitizeElement",e,{tagName:n,allowedTags:I}),e.hasChildNodes()&&!Le(e.firstElementChild)&&(!Le(e.content)||!Le(e.content.firstElementChild))&&fS(/<[/\w]/g,e.innerHTML)&&fS(/<[/\w]/g,e.textContent))return Re(e),!0;if(!I[n]||U[n]){if(!U[n]&&He(n)){if(z.tagNameCheck instanceof RegExp&&fS(z.tagNameCheck,n))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(n))return!1}if(oe&&!se[n]){const t=v(e)||e.parentNode,o=b(e)||e.childNodes;if(o&&t){const n=o.length;for(let r=n-1;r>=0;--r)t.insertBefore(f(o[r],!0),h(e))}}return Re(e),!0}return e instanceof l&&!Ne(e)?(Re(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!fS(/<\/no(script|embed|frames)/i,e.innerHTML)?(G&&3===e.nodeType&&(o=e.textContent,o=mS(o,O," "),o=mS(o,T," "),o=mS(o,D," "),e.textContent!==o&&(lS(t.removed,{element:e.cloneNode()}),e.textContent=o)),Fe("afterSanitizeElements",e,null),!1):(Re(e),!0)},Ue=function(e,t,o){if(Q&&("id"===t||"name"===t)&&(o in r||o in Se))return!1;if(j&&!H[t]&&fS(A,t));else if(V&&fS(N,t));else if(!L[t]||H[t]){if(!(He(e)&&(z.tagNameCheck instanceof RegExp&&fS(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&fS(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&fS(z.tagNameCheck,o)||z.tagNameCheck instanceof Function&&z.tagNameCheck(o))))return!1}else if(ce[t]);else if(fS(M,mS(o,B,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==gS(o,"data:")||!ie[e]){if(W&&!fS(R,mS(o,B,"")));else if(o)return!1}else;return!0},He=function(e){return e.indexOf("-")>0},Ve=function(e){let t,o,n,r;Fe("beforeSanitizeAttributes",e,null);const{attributes:s}=e;if(!s)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L};r=s.length;while(r--){t=s[r];const{name:l,namespaceURI:c}=t;o="value"===l?t.value:pS(t.value);const d=o;if(n=we(l),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Fe("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){Be(l,e);continue}if(!$&&fS(/\/>/i,o)){Be(l,e);continue}G&&(o=mS(o,O," "),o=mS(o,T," "),o=mS(o,D," "));const u=we(e.nodeName);if(Ue(u,n,o)){if(!ee||"id"!==n&&"name"!==n||(Be(l,e),o=te+o),y&&"object"===typeof g&&"function"===typeof g.getAttributeType)if(c);else switch(g.getAttributeType(u,n)){case"TrustedHTML":o=y.createHTML(o);break;case"TrustedScriptURL":o=y.createScriptURL(o);break}if(o!==d)try{c?e.setAttributeNS(c,l,o):e.setAttribute(l,o)}catch(i){Be(l,e)}}else Be(l,e)}Fe("afterSanitizeAttributes",e,null)},je=function e(t){let o;const n=Ie(t);Fe("beforeSanitizeShadowDOM",t,null);while(o=n.nextNode())Fe("uponSanitizeShadowNode",o,null),ze(o)||(o.content instanceof s&&e(o.content),Ve(o));Fe("afterSanitizeShadowDOM",t,null)};return t.sanitize=function(e){let n,r,a,l,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(fe=!e,fe&&(e="\x3c!--\x3e"),"string"!==typeof e&&!Le(e)){if("function"!==typeof e.toString)throw hS("toString is not a function");if(e=e.toString(),"string"!==typeof e)throw hS("dirty is not a string, aborting")}if(!t.isSupported)return e;if(K||_e(c),t.removed=[],"string"===typeof e&&(ne=!1),ne){if(e.nodeName){const t=we(e.nodeName);if(!I[t]||U[t])throw hS("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof i)n=Me("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r);else{if(!X&&!G&&!q&&-1===e.indexOf("<"))return y&&Z?y.createHTML(e):e;if(n=Me(e),!n)return X?null:Z?x:""}n&&Y&&Re(n.firstChild);const d=Ie(ne?e:n);while(a=d.nextNode())ze(a)||(a.content instanceof s&&je(a.content),Ve(a));if(ne)return e;if(X){if(J){l=S.call(n.ownerDocument);while(n.firstChild)l.appendChild(n.firstChild)}else l=n;return(L.shadowroot||L.shadowrootmode)&&(l=_.call(o,l,!0)),l}let u=q?n.outerHTML:n.innerHTML;return q&&I["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&fS(HS,n.ownerDocument.doctype.name)&&(u="\n"+u),G&&(u=mS(u,O," "),u=mS(u,T," "),u=mS(u,D," ")),y&&Z?y.createHTML(u):u},t.setConfig=function(e){_e(e),K=!0},t.clearConfig=function(){Ce=null,K=!1},t.isValidAttribute=function(e,t,o){Ce||_e({});const n=we(e),r=we(t);return Ue(n,r,o)},t.addHook=function(e,t){"function"===typeof t&&(E[e]=E[e]||[],lS(E[e],t))},t.removeHook=function(e){if(E[e])return iS(E[e])},t.removeHooks=function(e){E[e]&&(E[e]=[])},t.removeAllHooks=function(){E={}},t}var GS=$S();const qS=e=>GS().sanitize(e);var KS=tinymce.util.Tools.resolve("tinymce.util.I18n");const YS={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},XS="temporary-placeholder",JS=e=>()=>Se(e,XS).getOr("!not found!"),ZS=(e,t)=>{const o=e.toLowerCase();if(KS.isRtl()){const e=Fe(o,"-rtl");return ke(t,e)?e:o}return o},QS=(e,t)=>Se(t,ZS(e,t)),ek=(e,t)=>{const o=t();return QS(e,o).getOrThunk(JS(o))},tk=(e,t,o)=>{const n=t();return QS(e,n).or(o).getOrThunk(JS(n))},ok=e=>!!KS.isRtl()&&ke(YS,e),nk=()=>yw("add-focusable",[Zi(e=>{ud(e.element,"svg").each(e=>to(e,"focusable","false"))})]),rk=(e,t,o,n)=>{var r,s;const a=ok(t)?["tox-icon--flip"]:[],i=Se(o,ZS(t,o)).or(n).getOrThunk(JS(o));return{dom:{tag:e.tag,attributes:null!==(r=e.attributes)&&void 0!==r?r:{},classes:e.classes.concat(a),innerHtml:i},behaviours:Vu([...null!==(s=e.behaviours)&&void 0!==s?s:[],nk()])}},sk=(e,t,o,n=R.none())=>rk(t,e,o(),n),ak=(e,t,o)=>{const n=o(),r=X(e,e=>ke(n,ZS(e,n)));return rk(t,r.getOr(XS),n,R.none())},ik={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},lk=e=>{const t=YC({dom:KC(`

${qS(e.translationProvider(e.text))}

`),behaviours:Vu([bw.config({})])}),o=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:e+"%"}}}),n=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:e+"%"}}),r=YC({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(0)]},n(0)],behaviours:Vu([bw.config({})])}),s=(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each(e=>{bw.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(t)]},n(t)])})},a=(e,o)=>{if(e.getSystem().isConnected()){const n=t.get(e);bw.set(n,[Jc(o)])}},i={updateProgress:s,updateText:a},l=Z([e.icon.toArray(),e.level.toArray(),e.level.bind(e=>R.from(ik[e])).toArray()]),c=YC($C.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[sk("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":e.translationProvider("Close")}},e.iconProvider)],action:t=>{e.onAction(t)}})),d=ak(l,{tag:"div",classes:["tox-notification__icon"]},e.iconProvider),u={dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:Vu([bw.config({})])},m=[d,u];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert"},classes:e.level.map(e=>["tox-notification","tox-notification--in","tox-notification--"+e]).getOr(["tox-notification","tox-notification--in"])},behaviours:Vu([Tw.config({}),yw("notification-events",[Vi(Ga(),e=>{c.getOpt(e).each(Tw.focus)})])]),components:m.concat(e.progress?[r.asSpec()]:[]).concat(e.closeButton?[c.asSpec()]:[]),apis:i}},ck=Lb({name:"Notification",factory:lk,configFields:[Ks("level"),Ls("progress"),Ks("icon"),Ls("onAction"),Ls("text"),Ls("iconProvider"),Ls("translationProvider"),la("closeButton",!0)],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var dk,uk,mk=(e,t,o)=>{const n=t.backstage.shared,r=()=>{const t=or(Ze.fromDom(e.getContentAreaContainer())),o=ar(),n=ru(o.x,t.x,t.right),r=ru(o.y,t.y,t.bottom),s=Math.max(t.right,o.right),a=Math.max(t.bottom,o.bottom);return R.some(tr(n,r,s-n,a-r))},s=(t,s)=>{const a=()=>{s(),VC.hide(l)},i=od(ck.sketch({text:t.text,level:F(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,closeButton:t.closeButton,onAction:a,iconProvider:n.providers.icons,translationProvider:n.providers.translate})),l=od(VC.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:n.getSink,fireDismissalEventInstead:{},...n.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}}}));o.add(l),b(t.timeout)&&t.timeout>0&&jC.setEditorTimeout(e,()=>{a()},t.timeout);const c=()=>{const t=nd(i),o={maxHeightFunction:Qm()},s=e.notificationManager.getNotifications();if(s[0]===d){const e={...n.anchors.banner(),overrides:o};VC.showWithinBounds(l,t,{anchor:e},r)}else L(s,d).each(e=>{const n=s[e-1].getEl(),a={type:"node",root:Zt(),node:R.some(Ze.fromDom(n)),overrides:o,layouts:{onRtl:()=>[Cu],onLtr:()=>[Cu]}};VC.showWithinBounds(l,t,{anchor:a},r)})},d={close:a,reposition:c,text:e=>{ck.updateText(i,e)},settings:t,getEl:()=>i.element.dom,progressBar:{value:e=>{ck.updateProgress(i,e)}}};return d},a=e=>{e.close()},i=e=>e.settings;return{open:s,close:a,getArgs:i}},gk=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),pk=tinymce.util.Tools.resolve("tinymce.EditorManager"),fk=tinymce.util.Tools.resolve("tinymce.Env");(function(e){e["default"]="wrap",e["floating"]="floating",e["sliding"]="sliding",e["scrolling"]="scrolling"})(dk||(dk={})),function(e){e["auto"]="auto",e["top"]="top",e["bottom"]="bottom"}(uk||(uk={}));const hk=e=>t=>t.options.get(e),bk=e=>t=>R.from(e(t)),vk=e=>{const t=fk.deviceType.isPhone(),o=fk.deviceType.isTablet()||t,n=e.options.register,r=e=>i(e)||!1===e,s=e=>i(e)||b(e);n("skin",{processor:e=>i(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:s,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:s,default:gk.DOM.getStyle(e.getElement(),"width")}),n("min_height",{processor:"number",default:100}),n("min_width",{processor:"number"}),n("max_height",{processor:"number"}),n("max_width",{processor:"number"}),n("style_formats",{processor:"object[]"}),n("style_formats_merge",{processor:"boolean",default:!1}),n("style_formats_autohide",{processor:"boolean",default:!1}),n("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),n("font_family_formats",{processor:"string",default:"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"}),n("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),n("font_size_input_default_unit",{processor:"string",default:"pt"}),n("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),n("content_langs",{processor:"object[]"}),n("removed_menuitems",{processor:"string",default:""}),n("menubar",{processor:e=>i(e)||m(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>m(e)||i(e)||d(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),U(9,e=>{n("toolbar"+(e+1),{processor:"string"})}),n("toolbar_mode",{processor:"string",default:o?"scrolling":"floating"}),n("toolbar_groups",{processor:"object",default:{}}),n("toolbar_location",{processor:"string",default:uk.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:r,default:"#top"}),n("anchor_bottom",{processor:r,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("promotion",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||m(e),default:!fk.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},yk=hk("readonly"),xk=hk("height"),wk=hk("width"),Ck=bk(hk("min_width")),Sk=bk(hk("min_height")),kk=bk(hk("max_width")),_k=bk(hk("max_height")),Ek=bk(hk("style_formats")),Ok=hk("style_formats_merge"),Tk=hk("style_formats_autohide"),Dk=hk("content_langs"),Ak=hk("removed_menuitems"),Nk=hk("toolbar_mode"),Rk=hk("toolbar_groups"),Bk=hk("toolbar_location"),Mk=hk("fixed_toolbar_container"),Ik=hk("fixed_toolbar_container_target"),Pk=hk("toolbar_persist"),Lk=hk("toolbar_sticky_offset"),Fk=hk("menubar"),zk=hk("toolbar"),Uk=hk("file_picker_callback"),Hk=hk("file_picker_validator_handler"),Vk=hk("font_size_input_default_unit"),jk=hk("file_picker_types"),Wk=hk("typeahead_urls"),$k=hk("anchor_top"),Gk=hk("anchor_bottom"),qk=hk("draggable_modal"),Kk=hk("statusbar"),Yk=hk("elementpath"),Xk=hk("branding"),Jk=hk("resize"),Zk=hk("paste_as_text"),Qk=hk("sidebar_show"),e_=hk("promotion"),t_=hk("help_accessibility"),o_=hk("default_font_stack"),n_=e=>!1===e.options.get("skin"),r_=e=>!1!==e.options.get("menubar"),s_=e=>{const t=e.options.get("skin_url");if(n_(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return pk.baseURL+"/skins/ui/"+t}},a_=e=>R.from(e.options.get("skin_url")),i_=e=>e.options.get("line_height_formats").split(" "),l_=e=>{const t=zk(e),o=i(t),n=d(t)&&t.length>0;return!d_(e)&&(n||o||!0===t)},c_=e=>{const t=U(9,t=>e.options.get("toolbar"+(t+1))),o=G(t,i);return Be(o.length>0,o)},d_=e=>c_(e).fold(()=>{const t=zk(e);return v(t,i)&&t.length>0},N),u_=e=>Bk(e)===uk.bottom,m_=e=>{var t;if(!e.inline)return R.none();const o=null!==(t=Mk(e))&&void 0!==t?t:"";if(o.length>0)return md(Zt(),o);const n=Ik(e);return f(n)?R.some(Ze.fromDom(n)):R.none()},g_=e=>e.inline&&m_(e).isSome(),p_=e=>{const t=m_(e);return t.getOrThunk(()=>$t(Wt(Ze.fromDom(e.getElement()))))},f_=e=>e.inline&&!r_(e)&&!l_(e)&&!d_(e),h_=e=>{const t=e.options.get("toolbar_sticky");return(t||e.inline)&&!g_(e)&&!f_(e)},b_=e=>!g_(e)&&"split"===e.options.get("ui_mode"),v_=e=>{const t=e.options.get("menu");return pe(t,e=>({...e,items:e.items}))};var y_=Object.freeze({__proto__:null,get ToolbarMode(){return dk},get ToolbarLocation(){return uk},register:vk,getSkinUrl:s_,getSkinUrlOption:a_,isReadOnly:yk,isSkinDisabled:n_,getHeightOption:xk,getWidthOption:wk,getMinWidthOption:Ck,getMinHeightOption:Sk,getMaxWidthOption:kk,getMaxHeightOption:_k,getUserStyleFormats:Ek,shouldMergeStyleFormats:Ok,shouldAutoHideStyleFormats:Tk,getLineHeightFormats:i_,getContentLanguages:Dk,getRemovedMenuItems:Ak,isMenubarEnabled:r_,isMultipleToolbars:d_,isToolbarEnabled:l_,isToolbarPersist:Pk,getMultipleToolbarsOption:c_,getUiContainer:p_,useFixedContainer:g_,isSplitUiMode:b_,getToolbarMode:Nk,isDraggableModal:qk,isDistractionFree:f_,isStickyToolbar:h_,getStickyToolbarOffset:Lk,getToolbarLocation:Bk,isToolbarLocationBottom:u_,getToolbarGroups:Rk,getMenus:v_,getMenubar:Fk,getToolbar:zk,getFilePickerCallback:Uk,getFilePickerTypes:jk,useTypeaheadUrls:Wk,getAnchorTop:$k,getAnchorBottom:Gk,getFilePickerValidatorHandler:Hk,getFontSizeInputDefaultUnit:Vk,useStatusBar:Kk,useElementPath:Yk,promotionEnabled:e_,useBranding:Xk,getResize:Jk,getPasteAsText:Zk,getSidebarShow:Qk,useHelpAccessibility:t_,getDefaultFontStack:o_});const x_="[data-mce-autocompleter]",w_=e=>gd(e,x_),C_=e=>md(e,x_),S_=(e,t)=>{const o=(e,t)=>{Ri(e,Ka(),{raw:t})},n=()=>e.getMenu().bind(Tv.getHighlighted);t.on("keydown",t=>{const r=t.which;e.isActive()&&(e.isMenuOpen()?13===r?(n().each(Bi),t.preventDefault()):40===r?(n().fold(()=>{e.getMenu().each(Tv.highlightFirst)},e=>{o(e,t)}),t.preventDefault(),t.stopImmediatePropagation()):37!==r&&38!==r&&39!==r||n().each(e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()}):13!==r&&38!==r&&40!==r||e.cancelIfNecessary())}),t.on("NodeChange",t=>{e.isActive()&&!e.isProcessingAction()&&w_(Ze.fromDom(t.element)).isNone()&&e.cancelIfNecessary()})},k_={setup:S_};var __;(function(e){e[e["CLOSE_ON_EXECUTE"]=0]="CLOSE_ON_EXECUTE",e[e["BUBBLE_TO_SANDBOX"]=1]="BUBBLE_TO_SANDBOX"})(__||(__={}));var E_=__;const O_="tox-menu-nav__js",T_="tox-collection__item",D_="tox-swatch",A_={normal:O_,color:D_},N_="tox-collection__item--enabled",R_="tox-collection__group-heading",B_="tox-collection__item-icon",M_="tox-collection__item-label",I_="tox-collection__item-accessory",P_="tox-collection__item-caret",L_="tox-collection__item-checkmark",F_="tox-collection__item--active",z_="tox-collection__item-container",U_="tox-collection__item-container--column",H_="tox-collection__item-container--row",V_="tox-collection__item-container--align-right",j_="tox-collection__item-container--align-left",W_="tox-collection__item-container--valign-top",$_="tox-collection__item-container--valign-middle",G_="tox-collection__item-container--valign-bottom",q_=e=>Se(A_,e).getOr(O_),K_=e=>"color"===e?"tox-swatches":"tox-menu",Y_=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:K_(e),tieredMenu:"tox-tiered-menu"}),X_=e=>{const t=Y_(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:q_(e)}},J_=(e,t,o)=>{const n=Y_(o);return{tag:"div",classes:Z([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},Z_=[kC.parts.items({})],Q_=(e,t,o)=>{const n=Y_(o),r={tag:"div",classes:Z([[n.tieredMenu]])};return{dom:r,markers:X_(o)}},eE=S([Ks("data"),na("inputAttributes",{}),na("inputStyles",{}),na("tag","input"),na("inputClasses",[]),Ld("onSetValue"),na("styles",{}),na("eventOrder",{}),Eh("inputBehaviours",[_h,Tw]),na("selectOnFocus",!0)]),tE=e=>Vu([Tw.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=Dc(t);t.dom.setSelectionRange(0,o.length)}:y})]),oE=e=>({...tE(e),...Th(e.inputBehaviours,[_h.config({store:{mode:"manual",...e.data.map(e=>({initialValue:e})).getOr({}),getValue:e=>Dc(e.element),setValue:(e,t)=>{const o=Dc(e.element);o!==t&&Ac(e.element,t)}},onSetValue:e.onSetValue})])}),nE=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),rE=(e,t)=>({uid:e.uid,dom:nE(e),components:[],behaviours:oE(e),eventOrder:e.eventOrder}),sE=Lb({name:"Input",configFields:eE(),factory:rE}),aE=fl("refetch-trigger-event"),iE=fl("redirect-menu-item-interaction"),lE="tox-menu__searcher",cE=e=>md(e.element,"."+lE).bind(t=>e.getSystem().getByDom(t).toOptional()),dE=cE,uE=(e,t)=>{_h.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd},mE=e=>{const t=_h.getValue(e),o=e.element.dom.selectionStart,n=e.element.dom.selectionEnd;return{fetchPattern:t,selectionStart:o,selectionEnd:n}},gE=(e,t)=>{ro(t.element,"id").each(t=>to(e.element,"aria-activedescendant",t))},pE=e=>{const t=(e,t)=>(t.cut(),R.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return Ri(e,iE,o),R.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[T_]},components:[sE.sketch({inputClasses:[lE,"tox-textfield"],inputAttributes:{...e.placeholder.map(t=>({placeholder:e.i18n(t)})).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:Vu([yw(n,[Vi(Xa(),e=>{Ni(e,aE)}),Vi(Ka(),(e,t)=>{"Escape"===t.event.raw.key&&t.stop()})]),nw.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,nw.name()]}})]}},fE="tox-collection--results__js",hE=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:fl("aria-item-search-result-id"),"aria-selected":"false"}}}:e},bE=(e,t)=>o=>{const n=H(o,t);return V(n,t=>({dom:e,components:t}))},vE=e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[kC.parts.items({preprocess:"auto"!==e?bE({tag:"div",classes:["tox-swatches__row"]},e):k})]}]}),yE=e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[kC.parts.items({preprocess:bE({tag:"div",classes:["tox-collection__group"]},e)})]}),xE=(e,t)=>{const o=[];let n=[];return j(e,(e,r)=>{t(e,r)?(n.length>0&&o.push(n),n=[],(ke(e.dom,"innerHtml")||e.components&&e.components.length>0)&&n.push(e)):n.push(e)}),n.length>0&&o.push(n),V(o,e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e}))},wE=(e,t,o)=>kC.parts.items({preprocess:n=>{const r=V(n,o);return"auto"!==e&&e>1?bE({tag:"div",classes:["tox-collection__group"]},e)(r):xE(r,(e,o)=>"separator"===t[o].type)}}),CE=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[wE(e,t,k)]}),SE=(e,t,o=!0)=>{const n=fl("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",fE].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:n}},components:[wE(e,t,hE)]}},kE=(e,t,o)=>{const n=fl("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[pE({i18n:KS.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],fE],attributes:{id:n}},components:[wE(e,t,hE)]}]}},_E=(e,t=!0)=>({dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[kC.parts.items({preprocess:t=>xE(t,(t,o)=>"separator"===e[o].type)})]}),EE=e=>z(e,e=>"icon"in e&&void 0!==e.icon),OE=e=>(console.error(Ns(e)),console.log(e),R.none()),TE=(e,t,o,n,r)=>{const s=_E(o);return{value:e,dom:s.dom,components:s.components,items:o}},DE=(e,t,o,n,r)=>{const s=()=>"searchable"!==r.menuType?CE(n,o):"search-with-field"===r.searchMode.searchMode?kE(n,o,r.searchMode):SE(n,o);if("color"===r.menuType){const t=vE(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType&&"auto"===n){const t=CE(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType||"searchable"===r.menuType){const t=s();return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===r.menuType&&"auto"!==n){const t=yE(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:J_(t,n,r.menuType),components:Z_,items:o}},AE=Us("type"),NE=Us("name"),RE=Us("label"),BE=Us("text"),ME=Us("title"),IE=Us("icon"),PE=Us("value"),LE=js("fetch"),FE=js("getSubmenuItems"),zE=js("onAction"),UE=js("onItemAction"),HE=ca("onSetup",()=>y),VE=Js("name"),jE=Js("text"),WE=Js("icon"),$E=Js("tooltip"),GE=Js("label"),qE=Js("shortcut"),KE=Qs("select"),YE=la("active",!1),XE=la("borderless",!1),JE=la("enabled",!0),ZE=la("primary",!1),QE=e=>na("columns",e),eO=na("meta",{}),tO=ca("onAction",y),oO=e=>aa("type",e),nO=e=>Ms("name","name",Br(()=>fl(e+"-name")),bs),rO=e=>Ms("value","value",Br(()=>fl(e+"-value")),ps()),sO=ls([AE,jE]),aO=e=>Ts("separatormenuitem",sO,e),iO=ls([oO("autocompleteitem"),YE,JE,eO,PE,jE,WE]),lO=e=>Ts("Autocompleter.Separator",sO,e),cO=e=>Ts("Autocompleter.Item",iO,e),dO=[JE,$E,WE,jE,HE],uO=ls([AE,zE].concat(dO)),mO=e=>Ts("toolbarbutton",uO,e),gO=[YE].concat(dO),pO=ls(gO.concat([AE,zE])),fO=e=>Ts("ToggleButton",pO,e),hO=[ca("predicate",A),ia("scope","node",["node","editor"]),ia("position","selection",["node","selection","line"])],bO=dO.concat([oO("contextformbutton"),ZE,zE,Is("original",k)]),vO=gO.concat([oO("contextformbutton"),ZE,zE,Is("original",k)]),yO=dO.concat([oO("contextformbutton")]),xO=gO.concat([oO("contextformtogglebutton")]),wO=Rs("type",{contextformbutton:bO,contextformtogglebutton:vO}),CO=ls([oO("contextform"),ca("initValue",S("")),GE,qs("commands",wO),Ys("launch",Rs("type",{contextformbutton:yO,contextformtogglebutton:xO}))].concat(hO)),SO=e=>Ts("ContextForm",CO,e),kO=ls([oO("contexttoolbar"),Us("items")].concat(hO)),_O=e=>Ts("ContextToolbar",kO,e),EO=[AE,Us("src"),Js("alt"),ua("classes",[],bs)],OO=ls(EO),TO=[AE,BE,VE,ua("classes",["tox-collection__item-label"],bs)],DO=ls(TO),AO=ss(()=>Ss("type",{cardimage:OO,cardtext:DO,cardcontainer:NO})),NO=ls([AE,aa("direction","horizontal"),aa("align","left"),aa("valign","middle"),qs("items",AO)]),RO=[JE,jE,qE,rO("menuitem"),eO],BO=ls([AE,GE,qs("items",AO),HE,tO].concat(RO)),MO=e=>Ts("cardmenuitem",BO,e),IO=ls([AE,YE,WE].concat(RO)),PO=e=>Ts("choicemenuitem",IO,e),LO=[AE,Us("fancytype"),tO],FO=[na("initData",{})].concat(LO),zO=[Qs("select"),ma("initData",{},[la("allowCustomColors",!0),aa("storageKey","default"),ea("colors",ps())])].concat(LO),UO=Rs("fancytype",{inserttable:FO,colorswatch:zO}),HO=e=>Ts("fancymenuitem",UO,e),VO=ls([AE,HE,tO,WE].concat(RO)),jO=e=>Ts("menuitem",VO,e),WO=ls([AE,FE,HE,WE].concat(RO)),$O=e=>Ts("nestedmenuitem",WO,e),GO=ls([AE,WE,YE,HE,zE].concat(RO)),qO=e=>Ts("togglemenuitem",GO,e),KO=(e,t,o)=>{const n=mp(e.element,"."+o);if(n.length>0){const e=J(n,e=>{const o=e.dom.getBoundingClientRect().top,r=n[0].dom.getBoundingClientRect().top;return Math.abs(o-r)>t}).getOr(n.length);return R.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return R.none()},YO=(e,t)=>Vu([yw(e,t)]),XO=e=>YO(fl("unnamed-events"),e),JO={namedEvents:YO,unnamedEvents:XO},ZO=fl("tooltip.exclusive"),QO=fl("tooltip.show"),eT=fl("tooltip.hide"),tT=(e,t,o)=>{e.getSystem().broadcastOn([ZO],{})},oT=(e,t,o,n)=>{o.getTooltip().each(e=>{e.getSystem().isConnected()&&bw.set(e,n)})};var nT=Object.freeze({__proto__:null,hideAllExclusive:tT,setComponents:oT});const rT=(e,t)=>{const o=o=>{t.getTooltip().each(n=>{vf(n),e.onHide(o,n),t.clearTooltip()}),t.clearTimer()},n=o=>{if(!t.isShowing()){tT(o);const n=e.lazySink(o).getOrDie(),r=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Fi("normal"===e.mode?[Vi($a(),e=>{Ni(o,QO)}),Vi(ja(),e=>{Ni(o,eT)})]:[]),behaviours:Vu([bw.config({})])});t.setTooltip(r),ff(n,r),e.onShow(o,r),rf.position(n,r,{anchor:e.anchor(o)})}};return Fi(Z([[Vi(QO,o=>{t.resetTimer(()=>{n(o)},e.delay)}),Vi(eT,n=>{t.resetTimer(()=>{o(n)},e.delay)}),Vi(li(),(e,t)=>{const n=t;n.universal||F(n.channels,ZO)&&o(e)}),Qi(e=>{o(e)})],"normal"===e.mode?[Vi(Ga(),e=>{Ni(e,QO)}),Vi(ai(),e=>{Ni(e,eT)}),Vi($a(),e=>{Ni(e,QO)}),Vi(ja(),e=>{Ni(e,eT)})]:[Vi(Di(),(e,t)=>{Ni(e,QO)}),Vi(Ai(),e=>{Ni(e,eT)})]]))};var sT=Object.freeze({__proto__:null,events:rT}),aT=[Ls("lazySink"),Ls("tooltipDom"),na("exclusive",!0),na("tooltipComponents",[]),na("delay",300),ia("mode","normal",["normal","follow-highlight"]),na("anchor",e=>({type:"hotspot",hotspot:e,layouts:{onLtr:S([Cu,wu,bu,yu,vu,xu]),onRtl:S([Cu,wu,bu,yu,vu,xu])}})),Ld("onHide"),Ld("onShow")];const iT=()=>{const e=Am(),t=Am(),o=()=>{e.on(clearTimeout)},n=(t,n)=>{o(),e.set(setTimeout(t,n))},r=S("not-implemented");return Ll({getTooltip:t.get,isShowing:t.isSet,setTooltip:t.set,clearTooltip:t.clear,clearTimer:o,resetTimer:n,readState:r})};var lT=Object.freeze({__proto__:null,init:iT});const cT=Wu({fields:aT,name:"tooltipping",active:sT,state:lT,apis:nT}),dT=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),uT="silver.readonly",mT=ls([Vs("readonly")]),gT=(e,t)=>{const o=e.mainUi.outerContainer,n=o.element,r=[e.mainUi.mothership,...e.uiMotherships];t&&j(r,e=>{e.broadcastOn([Wf()],{target:n})}),j(r,e=>{e.broadcastOn([uT],{readonly:t})})},pT=(e,t)=>{e.on("init",()=>{e.mode.isReadOnly()&&gT(t,!0)}),e.on("SwitchMode",()=>gT(t,e.mode.isReadOnly())),yk(e)&&e.mode.set("readonly")},fT=()=>Ku.config({channels:{[uT]:{schema:mT,onReceive:(e,t)=>{lv.set(e,t.readonly)}}}}),hT=e=>lv.config({disabled:e,disableClass:"tox-collection__item--state-disabled"}),bT=e=>lv.config({disabled:e}),vT=e=>lv.config({disabled:e,disableClass:"tox-tbtn--disabled"}),yT=e=>lv.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),xT={item:hT,button:bT,splitButton:vT,toolbarButton:yT},wT=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},CT=(e,t)=>Zi(o=>{const n=wT(e,o);n(o=>{const n=e.onSetup(o);h(n)&&t.set(n)})}),ST=(e,t)=>Qi(o=>wT(e,o)(t.get())),kT=(e,t)=>tl((o,n)=>{wT(e,o)(e.onAction),e.triggersSubmenu||t!==E_.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Ni(o,gi()),n.stop())}),_T={[ci()]:["disabling","alloy.base.behaviour","toggling","item-events"]},ET=Te,OT=(e,t,o,n)=>{const r=ga(y);return{type:"item",dom:t.dom,components:ET(t.optComponents),data:e.data,eventOrder:_T,hasSubmenu:e.triggersSubmenu,itemBehaviours:Vu([yw("item-events",[kT(e,o),CT(e,r),ST(e,r)]),xT.item(()=>!e.enabled||n.isDisabled()),fT(),bw.config({})].concat(e.itemBehaviours))}},TT=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),DT=e=>{const t=fk.os.isMacOS()||fk.os.isiOS(),o={alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"},n={meta:"Ctrl",access:"Shift+Alt"},r=t?o:n,s=e.split("+"),a=V(s,e=>{const t=e.toLowerCase().trim();return ke(r,t)?r[t]:e});return t?a.join(""):a.join("+")},AT=(e,t,o=[B_])=>sk(e,{tag:"div",classes:o},t),NT=e=>({dom:{tag:"div",classes:[M_]},components:[Jc(KS.translate(e))]}),RT=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),BT=(e,t)=>({dom:{tag:"div",classes:[M_]},components:[{dom:{tag:e.tag,styles:e.styles},components:[Jc(KS.translate(t))]}]}),MT=e=>({dom:{tag:"div",classes:[I_]},components:[Jc(DT(e))]}),IT=e=>AT("checkmark",e,[L_]),PT=e=>AT("chevron-right",e,[P_]),LT=e=>AT("chevron-down",e,[P_]),FT=(e,t)=>{const o="vertical"===e.direction?U_:H_,n="left"===e.align?j_:V_,r=()=>{switch(e.valign){case"top":return W_;case"middle":return $_;case"bottom":return G_}};return{dom:{tag:"div",classes:[z_,o,n,r()]},components:t}},zT=(e,t,o)=>({dom:{tag:"img",classes:t,attributes:{src:e,alt:o.getOr("")}}}),UT=(e,t,o)=>{const n="custom",r="remove",s=e.ariaLabel,a=e.value,i=e.iconContent.map(e=>tk(e,t.icons,o)),l=()=>{const e=D_,o=i.getOr(""),l=s.map(e=>({title:t.translate(e)})).getOr({}),c={tag:"div",attributes:l,classes:[e]};return a===n?{...c,tag:"button",classes:[...c.classes,"tox-swatches__picker-btn"],innerHtml:o}:a===r?{...c,classes:[...c.classes,"tox-swatch--remove"],innerHtml:o}:f(a)?{...c,attributes:{...c.attributes,"data-mce-color":a},styles:{"background-color":a},innerHtml:o}:c};return{dom:l(),optComponents:[]}},HT=e=>{const t=e.map(e=>({attributes:{title:KS.translate(e),id:fl("menu-item")}})).getOr({});return{tag:"div",classes:[O_,T_],...t}},VT=(e,t,o,n)=>{const r={tag:"div",classes:[B_]},s=e=>sk(e,r,t.icons,n),a=()=>R.some({dom:r}),i=o?e.iconContent.map(s).orThunk(a):R.none(),l=e.checkMark,c=R.from(e.meta).fold(()=>NT,e=>ke(e,"style")?E(BT,e.style):NT),d=e.htmlContent.fold(()=>e.textContent.map(c),e=>R.some(RT(e,[M_]))),u={dom:HT(e.ariaLabel),optComponents:[i,d,e.shortcutContent.map(MT),l,e.caret]};return u},jT=(e,t,o,n=R.none())=>"color"===e.presets?UT(e,t,n):VT(e,t,o,n),WT=(e,t)=>Se(e,"tooltipWorker").map(e=>[cT.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:Qm}}),mode:"follow-highlight",onShow:(t,o)=>{e(e=>{cT.setComponents(t,[Zc({element:Ze.fromDom(e)})])})}})]).getOr([]),$T=e=>gk.DOM.encode(e),GT=(e,t)=>{const o=KS.translate(e),n=$T(o);if(t.length>0){const e=new RegExp(dT(t),"gi");return n.replace(e,e=>`${e}`)}return n},qT=(e,t,o,n,r,s,a,i=!0)=>{const l=jT({presets:n,textContent:R.none(),htmlContent:o?e.text.map(e=>GT(e,t)):R.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:R.none(),checkMark:R.none(),caret:R.none(),value:e.value},a.providers,i,e.icon);return OT({data:TT(e),enabled:e.enabled,getApi:S({}),onAction:t=>r(e.value,e.meta),onSetup:S(y),triggersSubmenu:!1,itemBehaviours:WT(e.meta,a)},l,s,a.providers)},KT=(e,t)=>V(e,e=>{switch(e.type){case"cardcontainer":return FT(e,KT(e.items,t));case"cardimage":return zT(e.src,e.classes,e.alt);case"cardtext":const o=e.name.exists(e=>F(t.cardText.highlightOn,e)),n=o?R.from(t.cardText.matchText).getOr(""):"";return RT(GT(e.text,n),e.classes)}}),YT=(e,t,o,n)=>{const r=e=>({isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>{lv.set(e,!t),j(mp(e.element,"*"),o=>{e.getSystem().getByDom(o).each(e=>{e.hasConfigured(lv)&&lv.set(e,!t)})})}}),s={dom:HT(e.label),optComponents:[R.some({dom:{tag:"div",classes:[z_,H_]},components:KT(e.items,n)})]};return OT({data:TT({text:R.none(),...e}),enabled:e.enabled,getApi:r,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:R.from(n.itemBehaviours).getOr([])},s,t,o.providers)},XT=(e,t,o,n,r,s,a,i=!0)=>{const l=e=>({setActive:t=>{qw.set(e,t)},isActive:()=>qw.isOn(e),isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t)}),c=jT({presets:o,textContent:t?e.text:R.none(),htmlContent:R.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:R.none(),checkMark:t?R.some(IT(a.icons)):R.none(),caret:R.none(),value:e.value},a,i);return Ar(OT({data:TT(e),enabled:e.enabled,getApi:l,onAction:t=>n(e.value),onSetup:e=>(e.setActive(r),y),triggersSubmenu:!1,itemBehaviours:[]},c,s,a),{toggling:{toggleClass:N_,toggleOnExecute:!1,selected:e.active,exclusive:!0}})},JT=mb(uC(),mC()),ZT=e=>({value:oD(e)}),QT=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,eD=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,tD=e=>QT.test(e)||eD.test(e),oD=e=>Le(e,"#").toUpperCase(),nD=e=>tD(e)?R.some({value:oD(e)}):R.none(),rD=e=>{const t=e.value.replace(QT,(e,t,o,n)=>t+t+o+o+n+n);return{value:t}},sD=e=>{const t=rD(e),o=eD.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o},aD=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},iD=e=>{const t=aD(e.red)+aD(e.green)+aD(e.blue);return ZT(t)},lD=Math.min,cD=Math.max,dD=Math.round,uD=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,mD=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,gD=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),pD=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},fD=e=>{let t,o,n;const r=(e.hue||0)%360;let s=e.saturation/100,a=e.value/100;if(s=cD(0,lD(s,1)),a=cD(0,lD(a,1)),0===s)return t=o=n=dD(255*a),gD(t,o,n,1);const i=r/60,l=a*s,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=dD(255*(t+d)),o=dD(255*(o+d)),n=dD(255*(n+d)),gD(t,o,n,1)},hD=e=>{const t=sD(e),o=parseInt(t[1],16),n=parseInt(t[2],16),r=parseInt(t[3],16);return gD(o,n,r,1)},bD=(e,t,o,n)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return gD(r,s,a,i)},vD=e=>{if("transparent"===e)return R.some(gD(0,0,0,0));const t=uD.exec(e);if(null!==t)return R.some(bD(t[1],t[2],t[3],"1"));const o=mD.exec(e);return null!==o?R.some(bD(o[1],o[2],o[3],o[4])):R.none()},yD=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,xD=gD(255,0,0,1),wD=e=>{e.dispatch("SkinLoaded")},CD=(e,t)=>{e.dispatch("SkinLoadError",t)},SD=e=>{e.dispatch("ResizeEditor")},kD=(e,t)=>{e.dispatch("ResizeContent",t)},_D=(e,t)=>{e.dispatch("ScrollContent",t)},ED=(e,t)=>{e.dispatch("TextColorChange",t)},OD=(e,t)=>{e.dispatch("AfterProgressState",{state:t})},TD=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),DD=(e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})},AD=(e,t)=>{e.dispatch("StylesTextUpdate",t)},ND=(e,t)=>{e.dispatch("AlignTextUpdate",t)},RD=(e,t)=>{e.dispatch("FontSizeTextUpdate",t)},BD=(e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)},MD=(e,t)=>{e.dispatch("BlocksTextUpdate",t)},ID=(e,t)=>{e.dispatch("FontFamilyTextUpdate",t)},PD=(e,t)=>()=>{e(),t()},LD=e=>UD(e,"NodeChange",t=>{t.setEnabled(e.selection.isEditable())}),FD=(e,t)=>o=>{const n=Dm(),r=()=>{o.setActive(e.formatter.match(t));const r=e.formatter.formatChanged(t,o.setActive);n.set(r)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),n.clear()}},zD=(e,t)=>o=>{const n=LD(e)(o),r=FD(e,t)(o);return()=>{n(),r()}},UD=(e,t,o)=>n=>{const r=()=>o(n),s=()=>{o(n),e.on(t,r)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),e.off(t,r)}},HD=e=>t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)})},VD=(e,t)=>()=>e.execCommand(t);var jD=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const WD={},$D=(e,t=10)=>{const o=jD.getItem(e),n=i(o)?JSON.parse(o):[],r=e=>{const o=t-e.length;return o<0?e.slice(0,t):e},s=r(n),a=o=>{L(s,o).each(l),s.unshift(o),s.length>t&&s.pop(),jD.setItem(e,JSON.stringify(s))},l=e=>{s.splice(e,1)},c=()=>s.slice(0);return{add:a,state:c}},GD=e=>Se(WD,e).getOrThunk(()=>{const t="tinymce-custom-colors-"+e,o=jD.getItem(t);if(p(o)){const e=jD.getItem("tinymce-custom-colors");jD.setItem(t,f(e)?e:"[]")}const n=$D(t,10);return WD[e]=n,n}),qD=e=>V(GD(e).state(),e=>({type:"choiceitem",text:e,icon:"checkmark",value:e})),KD=(e,t)=>{GD(e).add(t)},YD=(e,t,o)=>({hue:e,saturation:t,value:o}),XD=e=>{let t=0,o=0,n=0;const r=e.red/255,s=e.green/255,a=e.blue/255,i=Math.min(r,Math.min(s,a)),l=Math.max(r,Math.max(s,a));if(i===l)return n=i,YD(0,0,100*n);const c=r===i?s-a:a===i?r-s:a-r;return t=r===i?3:a===i?1:5,t=60*(t-c/(l-i)),o=(l-i)/l,n=l,YD(Math.round(t),Math.round(100*o),Math.round(100*n))},JD=e=>XD(hD(e)),ZD=e=>iD(fD(e)),QD=e=>nD(e).orThunk(()=>vD(e).map(iD)).getOrThunk(()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,r=n[0],s=n[1],a=n[2],i=n[3];return iD(gD(r,s,a,i))}),eA="forecolor",tA="hilitecolor",oA=5,nA=e=>{const t=[];for(let o=0;ot=>t.options.get(e),sA="#000000",aA=e=>{const t=e.options.register,o=e=>v(e,i)?{value:nA(e),valid:!0}:{valid:!1,message:"Must be an array of strings."},n=e=>b(e)&&e>0?{value:e,valid:!0}:{valid:!1,message:"Must be a positive number."};t("color_map",{processor:o,default:["#BFEDD2","Light Green","#FBEEB8","Light Yellow","#F8CAC6","Light Red","#ECCAFA","Light Purple","#C2E0F4","Light Blue","#2DC26B","Green","#F1C40F","Yellow","#E03E2D","Red","#B96AD9","Purple","#3598DB","Blue","#169179","Dark Turquoise","#E67E23","Orange","#BA372A","Dark Red","#843FA1","Dark Purple","#236FA1","Dark Blue","#ECF0F1","Light Gray","#CED4D9","Medium Gray","#95A5A6","Gray","#7E8C8D","Dark Gray","#34495E","Navy Blue","#000000","Black","#ffffff","White"]}),t("color_map_background",{processor:o}),t("color_map_foreground",{processor:o}),t("color_cols",{processor:n,default:lA(e)}),t("color_cols_foreground",{processor:n,default:cA(e,eA)}),t("color_cols_background",{processor:n,default:cA(e,tA)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:sA}),t("color_default_background",{processor:"string",default:sA})},iA=(e,t)=>t===eA&&e.options.isSet("color_map_foreground")?rA("color_map_foreground")(e):t===tA&&e.options.isSet("color_map_background")?rA("color_map_background")(e):rA("color_map")(e),lA=(e,t="default")=>Math.max(oA,Math.ceil(Math.sqrt(iA(e,t).length))),cA=(e,t)=>{const o=rA("color_cols")(e),n=lA(e,t);return o===lA(e)?n:o},dA=(e,t="default")=>{const o=()=>t===eA?rA("color_cols_foreground")(e):t===tA?rA("color_cols_background")(e):rA("color_cols")(e);return Math.round(o())},uA=rA("custom_colors"),mA=rA("color_default_foreground"),gA=rA("color_default_background"),pA="rgba(0, 0, 0, 0)",fA=e=>vD(e).exists(e=>0!==e.alpha),hA=e=>Ta(e,e=>{if(ft(e)){const t=po(e,"background-color");return Be(fA(t),t)}return R.none()}).getOr(pA),bA=(e,t)=>{const o=Ze.fromDom(e.selection.getStart()),n="hilitecolor"===t?hA(o):po(o,"color");return vD(n).map(e=>"#"+iD(e).value)},vA=(e,t,o)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.apply(t,{value:o}),e.nodeChanged()})},yA=(e,t)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.remove(t,{value:null},void 0,!0),e.nodeChanged()})},xA=e=>{e.addCommand("mceApplyTextcolor",(t,o)=>{vA(e,t,o)}),e.addCommand("mceRemoveTextcolor",t=>{yA(e,t)})},wA=e=>{const t="choiceitem",o={type:t,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},n={type:t,text:"Custom color",icon:"color-picker",value:"custom"};return e?[o,n]:[o]},CA=(e,t,o,n)=>{if("custom"===o){const o=NA(e);o(o=>{o.each(o=>{KD(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)})},bA(e,t).getOr(sA))}else"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},SA=(e,t,o)=>e.concat(qD(t).concat(wA(o))),kA=(e,t,o)=>n=>{n(SA(e,t,o))},_A=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},EA=(e,t)=>{e.setTooltip(t)},OA=(e,t)=>o=>{const n=bA(e,t);return Ee(n,o.toUpperCase())},TA=(e,t,o)=>{if($e(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",r=SA(iA(e,t),t,!1),s=X(r,e=>e.value===o).getOr({text:""}).text;return e.translate([n,e.translate(s)])},DA=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:TA(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:OA(e,o),columns:dA(e,o),fetch:kA(iA(e,o),o,uA(e)),onAction:t=>{CA(e,o,n.get(),y)},onItemAction:(r,s)=>{CA(e,o,s,o=>{n.set(o),ED(e,{name:t,color:o})})},onSetup:r=>{_A(r,t,n.get());const s=n=>{n.name===t&&(_A(r,n.name,n.color),EA(r,TA(e,o,n.color)))};return e.on("TextColorChange",s),PD(LD(e)(r),()=>{e.off("TextColorChange",s)})}})},AA=(e,t,o,n,r)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(EA(n,TA(e,o,r.get())),_A(n,t,r.get()),LD(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:OA(e,o),initData:{storageKey:o},onAction:n=>{CA(e,o,n.value,o=>{r.set(o),ED(e,{name:t,color:o})})}}]})},NA=e=>(t,o)=>{let n=!1;const r=o=>{const r=o.getData(),s=r.colorpicker;n?(t(R.from(s)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",s]))},s=(e,t)=>{"hex-valid"===t.name&&(n=t.value)},a={colorpicker:o};e.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:a,onAction:s,onSubmit:r,onClose:y,onCancel:()=>{t(R.none())}})},RA=e=>{xA(e);const t=mA(e),o=gA(e),n=ga(t),r=ga(o);DA(e,"forecolor","forecolor",n),DA(e,"backcolor","hilitecolor",r),AA(e,"forecolor","forecolor","Text color",n),AA(e,"backcolor","hilitecolor","Background color",r)},BA=(e,t,o,n,r,s,a,i)=>{const l=EE(t),c="color"!==r?"normal":"color",d=MA(t,o,n,c,s,a,i),u={menuType:r};return DE(e,l,d,n,u)},MA=(e,t,o,n,r,s,a)=>Te(V(e,i=>"choiceitem"===i.type?PO(i).fold(OE,i=>R.some(XT(i,1===o,n,t,s(i.value),r,a,EE(e)))):R.none())),IA=(e,t)=>{const o=X_(t);if(1===e)return{mode:"menu",moveOnTab:!0};if("auto"===e)return{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}};{const e="color"===t?"tox-swatches__row":"tox-collection__group";return{mode:"matrix",rowSelector:"."+e,previousSelector:e=>"color"===t?md(e.element,"[aria-checked=true]"):R.none()}}},PA=(e,t)=>1===e?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===e?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===t?".tox-swatches__row":".tox-collection__group",cell:"color"===t?"."+D_:"."+T_}},LA=(e,t)=>{const o=FA(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),r="color",s=BA(fl("menu-value"),o,t=>{e.onAction({value:t})},n,r,E_.CLOSE_ON_EXECUTE,e.select.getOr(A),t.shared.providers),a={...s,markers:X_(r),movement:IA(n,r)};return{type:"widget",data:{value:fl("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[JT.widget(kC.sketch(a))]}},FA=(e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold(()=>SA(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o),e=>e.concat(wA(o)))},zA=fl("cell-over"),UA=fl("cell-execute"),HA=e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]),VA=(e,t,o)=>{const n=o=>Ri(o,zA,{row:e,col:t}),r=o=>Ri(o,UA,{row:e,col:t}),s=(e,t)=>{t.stop(),r(e)};return od({dom:{tag:"div",attributes:{role:"button",["aria-label"]:o}},behaviours:Vu([yw("insert-table-picker-cell",[Vi($a(),Tw.focus),Vi(ci(),r),Vi(Za(),s),Vi(ui(),s)]),qw.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Tw.config({onFocus:n})])})},jA=(e,t,o)=>{const n=[];for(let r=0;r{for(let s=0;sQ(e,e=>V(e,nd)),GA=(e,t)=>Jc(`${t}x${e}`),qA=(e,t)=>{const o=10,n=10,r=HA(t),s=jA(r,o,n),a=GA(0,0),i=YC({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[a],behaviours:Vu([bw.config({})])});return{type:"widget",data:{value:fl("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[JT.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:$A(s).concat(i.asSpec()),behaviours:Vu([yw("insert-table-picker",[Zi(e=>{bw.set(i.get(e),[a])}),Ki(zA,(e,t,r)=>{const{row:a,col:l}=r.event;WA(s,a,l,o,n),bw.set(i.get(e),[GA(a+1,l+1)])}),Ki(UA,(t,o,n)=>{const{row:r,col:s}=n.event;e.onAction({numRows:r+1,numColumns:s+1}),Ni(t,gi())})]),nw.config({initSize:{numRows:o,numColumns:n},mode:"flatgrid",selector:'[role="button"]'})])})]}},KA={inserttable:qA,colorswatch:LA},YA=(e,t)=>Se(KA,e.fancytype).map(o=>o(e,t)),XA=(e,t,o,n=!0,r=!1)=>{const s=r?LT(o.icons):PT(o.icons),a=e=>({isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t),setIconFill:(t,o)=>{md(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{to(e,"fill",o)})},setTooltip:t=>{const n=o.translate(t);oo(e.element,{"aria-label":n,title:n})}}),i=jT({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:R.none(),ariaLabel:e.text,caret:R.some(s),checkMark:R.none(),shortcutContent:e.shortcut},o,n);return OT({data:TT(e),getApi:a,enabled:e.enabled,onAction:y,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)},JA=(e,t,o,n=!0)=>{const r=e=>({isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t)}),s=jT({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:R.none(),ariaLabel:e.text,caret:R.none(),checkMark:R.none(),shortcutContent:e.shortcut},o,n);return OT({data:TT(e),getApi:r,enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o)},ZA=e=>({type:"separator",dom:{tag:"div",classes:[T_,R_]},components:e.text.map(Jc).toArray()}),QA=(e,t,o,n=!0)=>{const r=e=>({setActive:t=>{qw.set(e,t)},isActive:()=>qw.isOn(e),isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t)}),s=jT({iconContent:e.icon,textContent:e.text,htmlContent:R.none(),ariaLabel:e.text,checkMark:R.some(IT(o.icons)),caret:R.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return Ar(OT({data:TT(e),enabled:e.enabled,getApi:r,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o),{toggling:{toggleClass:N_,toggleOnExecute:!1,selected:e.active}})},eN=qT,tN=ZA,oN=JA,nN=XA,rN=QA,sN=YA,aN=YT,iN=(e,t,o,n)=>o.getOrCreate(e,t,n),lN=(e,t,o,n)=>o.getExisting(e,t,n);var cN=Object.freeze({__proto__:null,getCoupled:iN,getExistingCoupled:lN}),dN=[Fs("others",Es(ur.value,ps()))];const uN=()=>{const e={},t=(t,o)=>{const n=ue(t.others);if(0===n.length)throw new Error("Cannot find any known coupled components");return Se(e,o)},o=(o,n,r)=>t(n,r).getOrThunk(()=>{const t=Se(n.others,r).getOrDie("No information found for coupled component: "+r),s=t(o),a=o.getSystem().build(s);return e[r]=a,a}),n=(e,o,n)=>t(o,n).orThunk(()=>(Se(o.others,n).getOrDie("No information found for coupled component: "+n),R.none())),r=S({});return Ll({readState:r,getExisting:n,getOrCreate:o})};var mN=Object.freeze({__proto__:null,init:uN});const gN=Wu({fields:dN,name:"coupling",apis:cN,state:mN}),pN=e=>{let t=R.none(),o=[];const n=e=>pN(t=>{r(o=>{t(e(o))})}),r=e=>{a()?l(e):o.push(e)},s=e=>{a()||(t=R.some(e),i(o),o=[])},a=()=>t.isSome(),i=e=>{j(e,l)},l=e=>{t.each(t=>{setTimeout(()=>{e(t)},0)})};return e(s),{get:r,map:n,isReady:a}},fN=e=>pN(t=>{t(e)}),hN={nu:pN,pure:fN},bN=e=>{setTimeout(()=>{throw e},0)},vN=e=>{const t=t=>{e().then(t,bN)},o=t=>vN(()=>e().then(t)),n=t=>vN(()=>e().then(e=>t(e).toPromise())),r=t=>vN(()=>e().then(()=>t.toPromise())),s=()=>hN.nu(t),a=()=>{let t=null;return vN(()=>(null===t&&(t=e()),t))},i=e;return{map:o,bind:n,anonBind:r,toLazy:s,toCached:a,toPromise:i,get:t}},yN=e=>vN(()=>new Promise(e)),xN=e=>vN(()=>Promise.resolve(e)),wN={nu:yN,pure:xN},CN=S("sink"),SN=S(ab({name:CN(),overrides:S({dom:{tag:"div"},behaviours:Vu([rf.config({useFixed:N})]),events:Fi([Yi(Ka()),Yi(Ha()),Yi(Za())])})})),kN=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",r=e.getAnchorOverrides();return e.layouts.fold(()=>({type:n,hotspot:o,overrides:r}),e=>({type:n,hotspot:o,overrides:r,layouts:e}))},_N=(e,t,o)=>{const n=e.fetch;return n(o).map(t)},EN=(e,t,o,n,r,s,a)=>{const i=_N(e,t,n),l=NN(n,e);return i.map(e=>e.bind(e=>R.from(zC.sketch({...s.menu(),uid:Sl(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();rf.position(n,t,{anchor:o}),jf.decloak(r)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();rf.position(n,o,{anchor:{type:"submenu",item:t}}),jf.decloak(r)},onRepositionMenu:(e,t,n)=>{const r=l().getOrDie();rf.position(r,t,{anchor:o}),j(n,e=>{rf.position(r,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})})},onEscape:()=>(Tw.focus(n),jf.close(r),R.some(!0))}))))},ON=(e,t,o,n,r,s,a)=>{const i=kN(e,o),l=EN(e,t,i,o,n,r,a);return l.map(e=>(e.fold(()=>{jf.isOpen(n)&&jf.close(n)},e=>{jf.cloak(n),jf.open(n,e),s(n)}),n))},TN=(e,t,o,n,r,s,a)=>(jf.close(n),wN.pure(n)),DN=(e,t,o,n,r,s)=>{const a=gN.getCoupled(o,"sandbox"),i=jf.isOpen(a),l=i?TN:ON;return l(e,t,o,a,n,r,s)},AN=(e,t,o)=>{const n=jb.getCurrent(t).getOr(t),r=Mo(e.element);o?uo(n.element,"min-width",r+"px"):Bo(n.element,r)},NN=(e,t)=>e.getSystem().getByUid(t.uid+"-"+CN()).map(e=>()=>ur.value(e)).getOrThunk(()=>t.lazySink.fold(()=>()=>ur.error(new Error("No internal sink is specified, nor could an external sink be found")),t=>()=>t(e))),RN=e=>{jf.getState(e).each(e=>{zC.repositionMenus(e)})},BN=(e,t,o)=>{const n=hd(),r=(r,s)=>{const a=kN(e,t);n.link(t.element),e.matchWidth&&AN(a.hotspot,s,e.useMinWidth),e.onOpen(a,r,s),void 0!==o&&void 0!==o.onOpen&&o.onOpen(r,s)},s=(e,r)=>{n.unlink(t.element),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},a=NN(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:Dh.augment(e.sandboxBehaviours,[_h.config({store:{mode:"memory",initialValue:t}}),jf.config({onOpen:r,onClose:s,isPartOf:(e,o,n)=>vd(o,n)||vd(t,n),getAttachPoint:()=>a().getOrDie()}),jb.config({find:e=>jf.getState(e).bind(e=>jb.getCurrent(e))}),Ku.config({channels:{...Kf({isExtraPart:A}),...Xf({doReposition:RN})}})])}},MN=e=>{const t=gN.getCoupled(e,"sandbox");RN(t)},IN=()=>[na("sandboxClasses",[]),Dh.field("sandboxBehaviours",[jb,Ku,jf,_h])],PN=S([Ls("dom"),Ls("fetch"),Ld("onOpen"),Fd("onExecute"),na("getHotspot",R.some),na("getAnchorOverrides",S({})),mg(),Eh("dropdownBehaviours",[qw,gN,nw,Tw]),Ls("toggleClass"),na("eventOrder",{}),Ks("lazySink"),na("matchWidth",!1),na("useMinWidth",!1),Ks("role")].concat(IN())),LN=S([sb({schema:[Md(),na("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),SN()]),FN=(e,t,o,n)=>{const r=t=>Se(e.dom,"attributes").bind(e=>Se(e,t)),s=e=>{jf.getState(e).each(e=>{zC.highlightPrimary(e)})},a=(t,o,r)=>DN(e,k,t,n,o,r),i=e=>{const t=s;a(e,t,BC.HighlightMenuAndItem).get(y)},l={expand:e=>{qw.isOn(e)||a(e,y,BC.HighlightNone).get(y)},open:e=>{qw.isOn(e)||a(e,y,BC.HighlightMenuAndItem).get(y)},refetch:t=>{const o=gN.getExistingCoupled(t,"sandbox");return o.fold(()=>a(t,y,BC.HighlightMenuAndItem).map(y),o=>ON(e,k,t,o,n,y,BC.HighlightMenuAndItem).map(y))},isOpen:qw.isOn,close:e=>{qw.isOn(e)&&a(e,y,BC.HighlightMenuAndItem).get(y)},repositionMenus:e=>{qw.isOn(e)&&MN(e)}},c=(e,t)=>(Bi(e),R.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Th(e.dropdownBehaviours,[qw.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),gN.config({others:{sandbox:t=>BN(e,t,{onOpen:()=>qw.on(t),onClose:()=>qw.off(t)})}}),nw.config({mode:"special",onSpace:c,onEnter:c,onDown:(e,t)=>{if(zN.isOpen(e)){const t=gN.getCoupled(e,"sandbox");s(t)}else zN.open(e);return R.some(!0)},onEscape:(e,t)=>zN.isOpen(e)?(zN.close(e),R.some(!0)):R.none()}),Tw.config({})]),events:Yw(R.some(i)),eventOrder:{...e.eventOrder,[ci()]:["disabling","toggling","alloy.base.behaviour"]},apis:l,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold(()=>({}),e=>({role:e})),..."button"===e.dom.tag?{type:r("type").getOr("button")}:{}}}}},zN=Fb({name:"Dropdown",configFields:PN(),partFields:LN(),factory:FN,apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),UN=e=>{switch(e.searchMode){case"no-search":return{menuType:"normal"};default:return{menuType:"searchable",searchMode:e}}},HN=e=>{const t=_h.getValue(e),o=cE(e).map(mE);zN.refetch(t).get(()=>{const e=gN.getCoupled(t,"sandbox");o.each(t=>cE(e).each(e=>uE(e,t)))})},VN=(e,t)=>{jN(e).each(o=>{Pi(e,o.element,t.event.eventType,t.event.interactionEvent)})},jN=e=>jf.getState(e).bind(Tv.getHighlighted).bind(Tv.getHighlighted),WN=e=>Cc(e.element,fE)?R.some(e.element):md(e.element,"."+fE),$N=(e,t,o)=>{dE(e).each(e=>{gE(e,o);const n=WN(t);n.each(t=>{ro(t,"id").each(t=>to(e.element,"aria-controls",t))})}),to(o.element,"aria-selected","true")},GN=(e,t,o)=>{to(o.element,"aria-selected","false")},qN=e=>{dE(e).each(e=>Tw.focus(e))},KN=e=>{const t=gN.getExistingCoupled(e,"sandbox");return t.bind(cE).map(mE).map(e=>e.fetchPattern).getOr("")};var YN;(function(e){e[e["ContentFocus"]=0]="ContentFocus",e[e["UiFocus"]=1]="UiFocus"})(YN||(YN={}));const XN=(e,t,o,n,r)=>{const s=o.shared.providers,a=e=>r?{...e,shortcut:R.none(),icon:e.text.isSome()?R.none():e.icon}:e;switch(e.type){case"menuitem":return jO(e).fold(OE,e=>R.some(oN(a(e),t,s,n)));case"nestedmenuitem":return $O(e).fold(OE,e=>R.some(nN(a(e),t,s,n,r)));case"togglemenuitem":return qO(e).fold(OE,e=>R.some(rN(a(e),t,s,n)));case"separator":return aO(e).fold(OE,e=>R.some(tN(e)));case"fancymenuitem":return HO(e).fold(OE,e=>sN(e,o));default:return console.error("Unknown item in general menu",e),R.none()}},JN=(e,t,o,n,r,s,a)=>{const i=1===n,l=!i||EE(e);return Te(V(e,e=>{switch(e.type){case"separator":return lO(e).fold(OE,e=>R.some(tN(e)));case"cardmenuitem":return MO(e).fold(OE,e=>R.some(aN({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},r,s,{itemBehaviours:WT(e.meta,s),cardText:{matchText:t,highlightOn:a}})));case"autocompleteitem":default:return cO(e).fold(OE,e=>R.some(eN(e,t,i,"normal",o,r,s,l)))}}))},ZN=(e,t,o,n,r,s)=>{const a=EE(t),i=Te(V(t,e=>{const t=e=>r?!ke(e,"text"):a,s=e=>XN(e,o,n,t(e),r);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?s({...e,enabled:!1}):s(e)})),l=UN(s),c=r?TE:DE;return c(e,a,i,1,l)},QN=e=>zC.singleData(e.value,e),eR=(e,t,o,n)=>{const r=IA(t,n),s=X_(n);return{data:QN({...e,movement:r,menuBehaviours:JO.unnamedEvents("auto"!==t?[]:[Zi((e,t)=>{KO(e,4,s.item).each(({numColumns:t,numRows:o})=>{nw.setGridSize(e,o,t)})})])}),menu:{markers:X_(n),fakeFocus:o===YN.ContentFocus}}},tR=(e,t)=>w_(Ze.fromDom(t.startContainer)).map(t=>{const o=e.createRng();return o.selectNode(t.dom),o}),oR=(e,t)=>{const o=fl("autocompleter"),n=ga(!1),r=ga(!1),s=od(VC.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:Vu([yw("dismissAutocompleter",[Vi(Ci(),()=>d()),Vi(Di(),(t,o)=>{ro(o.event.target,"id").each(t=>to(Ze.fromDom(e.getBody()),"aria-activedescendant",t))})])]),lazySink:t.getSink})),a=()=>VC.isOpen(s),i=r.get,l=()=>{if(a()){VC.hide(s),e.dom.remove(o,!1);const t=Ze.fromDom(e.getBody());ro(t,"aria-owns").filter(e=>e===o).each(()=>{ao(t,"aria-owns"),ao(t,"aria-activedescendant")})}},c=()=>VC.getContent(s).bind(e=>ae(e.components(),0)),d=()=>e.execCommand("mceAutocompleterClose"),u=o=>{const r=de(o,e=>R.from(e.columns)).getOr(1);return Q(o,o=>{const s=o.items;return JN(s,o.matchText,(t,r)=>{const s=e.selection.getRng();tR(e.dom,s).each(s=>{const a={hide:()=>d(),reload:t=>{l(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};n.set(!0),o.onAction(a,s,t,r),n.set(!1)})},r,E_.BUBBLE_TO_SANDBOX,t,o.highlightOn)})},m=(t,o)=>{C_(Ze.fromDom(e.getBody())).each(n=>{const r=de(t,e=>R.from(e.columns)).getOr(1);VC.showMenuAt(s,{anchor:{type:"node",root:Ze.fromDom(e.getBody()),node:R.from(n)}},eR(DE("autocompleter-value",!0,o,r,{menuType:"normal"}),r,YN.ContentFocus,"normal"))}),c().each(Tv.highlightFirst)},g=t=>{const n=u(t);n.length>0?(m(t,n),to(Ze.fromDom(e.getBody()),"aria-owns",o),e.inline||p()):l()},p=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),r=ll(s.element);mo(r,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:n.offsetTop+"px",left:n.offsetLeft+"px"}),e.dom.add(t,r.dom),md(r,'[role="menu"]').each(e=>{yo(e,"position"),yo(e,"max-height")})};e.on("AutocompleterStart",({lookupData:e})=>{r.set(!0),n.set(!1),g(e)}),e.on("AutocompleterUpdate",({lookupData:e})=>g(e)),e.on("AutocompleterEnd",()=>{l(),r.set(!1),n.set(!1)});const f={cancelIfNecessary:d,isMenuOpen:a,isActive:i,isProcessingAction:n.get,getMenu:c};k_.setup(f,e)},nR={register:oR},rR=["visible","hidden","clip"],sR=e=>je(e).length>0&&!F(rR,e),aR=e=>{if(pt(e)){const t=po(e,"overflow-x"),o=po(e,"overflow-y");return sR(t)||sR(o)}return!1},iR=e=>{const t=up(e,aR),o=0===t.length?qt(e).map(Kt).map(e=>up(e,aR)).getOr([]):t;return ie(o).map(e=>({element:e,others:o.slice(1)}))},lR=(e,t)=>b_(e)?iR(t):R.none(),cR=e=>{const t=[...V(e.others,or),ar()];return sr(or(e.element),t)},dR=(e,t,o)=>gd(e,t,o).isSome(),uR=(e,t)=>{let o=null;const n=(...n)=>{o=setTimeout(()=>{e.apply(null,n),o=null},t)},r=()=>{null!==o&&(clearTimeout(o),o=null)};return{cancel:r,schedule:n}},mR=5,gR=400,pR=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?R.none():R.some(t.touches[0])},fR=(e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>mR||n>mR},hR=e=>{const t=Am(),o=ga(!1),n=uR(t=>{e.triggerEvent(mi(),t),o.set(!0)},gR),r=e=>(pR(e).each(r=>{n.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(s)}),R.none()),s=e=>(n.cancel(),pR(e).each(e=>{t.on(o=>{fR(e,o)&&t.clear()})}),R.none()),a=r=>{n.cancel();const s=e=>kt(e.target,r.target);return t.get().filter(s).map(t=>o.get()?(r.prevent(),!1):e.triggerEvent(ui(),r))},i=Ca([{key:La(),value:r},{key:Fa(),value:s},{key:za(),value:a}]),l=(e,t)=>Se(i,t).bind(t=>t(e));return{fireIfReady:l}},bR=e=>{const t=e.raw;return t.which===Dv[0]&&!F(["input","textarea"],ut(e.target))&&!dR(e.target,'[contenteditable="true"]')},vR=(e,t)=>{const o={stopBackspace:!0,...t},n=["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"],r=hR(o),s=V(n.concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),t=>Rm(e,t,e=>{r.fireIfReady(e,t).each(t=>{t&&e.kill()});const n=o.triggerEvent(t,e);n&&e.kill()})),a=Am(),i=Rm(e,"paste",e=>{r.fireIfReady(e,"paste").each(t=>{t&&e.kill()});const t=o.triggerEvent("paste",e);t&&e.kill(),a.set(setTimeout(()=>{o.triggerEvent(ii(),e)},0))}),l=Rm(e,"keydown",e=>{const t=o.triggerEvent("keydown",e);t?e.kill():o.stopBackspace&&bR(e)&&e.prevent()}),c=Rm(e,"focusin",e=>{const t=o.triggerEvent("focusin",e);t&&e.kill()}),d=Am(),u=Rm(e,"focusout",e=>{const t=o.triggerEvent("focusout",e);t&&e.kill(),d.set(setTimeout(()=>{o.triggerEvent(ai(),e)},0))}),m=()=>{j(s,e=>{e.unbind()}),l.unbind(),c.unbind(),u.unbind(),i.unbind(),a.on(clearTimeout),d.on(clearTimeout)};return{unbind:m}},yR=(e,t)=>{const o=Se(e,"target").getOr(t);return ga(o)},xR=(e,t)=>{const o=ga(!1),n=ga(!1),r=()=>{o.set(!0)},s=()=>{n.set(!0)};return{stop:r,cut:s,isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}},wR=e=>{const t=ga(!1),o=()=>{t.set(!0)};return{stop:o,cut:y,isStopped:t.get,isCut:A,event:e,setSource:T("Cannot set source of a broadcasted event"),getSource:T("Cannot get source of a broadcasted event")}},CR=fa.generate([{stopped:[]},{resume:["element"]},{complete:[]}]),SR=(e,t,o,n,r,s)=>{const a=e(t,n),i=xR(o,r);return a.fold(()=>(s.logEventNoHandlers(t,n),CR.complete()),e=>{const o=e.descHandler,n=Yl(o);return n(i),i.isStopped()?(s.logEventStopped(t,e.element,o.purpose),CR.stopped()):i.isCut()?(s.logEventCut(t,e.element,o.purpose),CR.complete()):At(e.element).fold(()=>(s.logNoParent(t,e.element,o.purpose),CR.complete()),n=>(s.logEventResponse(t,e.element,o.purpose),CR.resume(n)))})},kR=(e,t,o,n,r,s)=>SR(e,t,o,n,r,s).fold(N,n=>kR(e,t,o,n,r,s),A),_R=(e,t,o,n,r)=>{const s=yR(o,n);return SR(e,t,o,n,s,r)},ER=(e,t,o)=>{const n=wR(t);return j(e,e=>{const t=e.descHandler,o=Yl(t);o(n)}),n.isStopped()},OR=(e,t,o,n)=>TR(e,t,o,o.target,n),TR=(e,t,o,n,r)=>{const s=yR(o,n);return kR(e,t,o,n,s,r)},DR=(e,t)=>({element:e,descHandler:t}),AR=(e,t)=>({id:e,descHandler:t}),NR=()=>{const e={},t=(t,o,n)=>{ge(n,(n,r)=>{const s=void 0!==e[r]?e[r]:{};s[o]=Kl(n,t),e[r]=s})},o=(e,t)=>Cl(t).bind(t=>Se(e,t)).map(e=>DR(t,e)),n=t=>Se(e,t).map(e=>xe(e,(e,t)=>AR(t,e))).getOr([]),r=(t,n,r)=>Se(e,n).bind(e=>Ta(r,t=>o(e,t),t)),s=t=>{ge(e,(e,o)=>{ke(e,t)&&delete e[t]})};return{registerId:t,unregisterId:s,filterByType:n,find:r}},RR=()=>{const e=NR(),t={},o=e=>{const t=e.element;return Cl(t).getOrThunk(()=>xl("uid-",e.element))},n=(e,o)=>{const n=t[o];if(n!==e)throw new Error('The tagId "'+o+'" is already used by: '+dl(n.element)+"\nCannot use it for: "+dl(e.element)+"\nThe conflicting element is"+(Jt(n.element)?" ":" not ")+"already in the DOM");s(e)},r=r=>{const s=o(r);_e(t,s)&&n(r,s);const a=[r];e.registerId(a,s,r.events),t[s]=r},s=o=>{Cl(o.element).each(o=>{delete t[o],e.unregisterId(o)})},a=t=>e.filterByType(t),i=(t,o,n)=>e.find(t,o,n),l=e=>Se(t,e);return{find:i,filter:a,register:r,unregister:s,getById:l}},BR=e=>{const{attributes:t,...o}=e.dom;return{uid:e.uid,dom:{tag:"div",attributes:{role:"presentation",...t},...o},components:e.components,behaviours:Oh(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},MR=Lb({name:"Container",factory:BR,configFields:[na("components",[]),Eh("containerBehaviours",[]),na("events",{}),na("domModification",{}),na("eventOrder",{})]}),IR=e=>{const t=t=>At(e.element).fold(N,e=>kt(t,e)),o=RR(),n=(e,n)=>o.find(t,e,n),r=vR(e.element,{triggerEvent:(e,t)=>Od(e,t.target,o=>OR(n,e,t,o))}),s={debugInfo:S("real"),triggerEvent:(e,t,o)=>{Od(e,t,r=>TR(n,e,o,t,r))},triggerFocus:(e,t)=>{Cl(e).fold(()=>{Ju(e)},o=>{Od(si(),e,o=>(_R(n,si(),{originator:t,kill:y,prevent:y,target:e},e,o),!1))})},triggerEscape:(e,t)=>{s.triggerEvent("keydown",e.element,t.event)},getByUid:e=>f(e),getByDom:e=>h(e),build:od,buildOrPatch:td,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{m(e)},broadcastOn:(e,t)=>{g(e,t)},broadcastEvent:(e,t)=>{p(e,t)},isConnected:N},a=e=>{e.connect(s),ht(e.element)||(o.register(e),j(e.components(),a),s.triggerEvent(fi(),e.element,{target:e.element}))},i=e=>{ht(e.element)||(j(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{ff(e,t)},c=e=>{vf(e)},d=()=>{r.unbind(),Un(e.element)},u=e=>{const t=o.filter(li());j(t,t=>{const o=t.descHandler,n=Yl(o);n(e)})},m=e=>{u({universal:!0,data:e})},g=(e,t)=>{u({universal:!1,channels:e,data:t})},p=(e,t)=>{const n=o.filter(e);return ER(n,t)},f=e=>o.getById(e).fold(()=>ur.error(new Error('Could not find component with uid: "'+e+'" in system.')),ur.value),h=e=>{const t=Cl(e).getOr("not found");return f(t)};return a(e),{root:e,element:e.element,destroy:d,add:l,remove:c,getByUid:f,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:m,broadcastOn:g,broadcastEvent:p}},PR=(e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:V(e.items,t.interpreter)}),LR=S([na("prefix","form-field"),Eh("fieldBehaviours",[jb,_h])]),FR=S([ab({schema:[Ls("dom")],name:"label"}),ab({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[Ls("text")],name:"aria-descriptor"}),rb({factory:{sketch:e=>{const t=xa(e,["factory"]);return e.factory.sketch(t)}},schema:[Ls("factory")],name:"field"})]),zR=(e,t,o,n)=>{const r=Th(e.fieldBehaviours,[jb.config({find:t=>yb(t,e,"field")}),_h.config({store:{mode:"manual",getValue:e=>jb.getCurrent(e).bind(_h.getValue),setValue:(e,t)=>{jb.getCurrent(e).each(e=>{_h.setValue(e,t)})}}})]),s=Fi([Zi((t,o)=>{const n=wb(t,e,["label","field","aria-descriptor"]);n.field().each(t=>{const o=fl(e.prefix);n.label().each(e=>{to(e.element,"for",o),to(t.element,"id",o)}),n["aria-descriptor"]().each(o=>{const n=fl(e.prefix);to(o.element,"id",n),to(t.element,"aria-describedby",n)})})})]),a={getField:t=>yb(t,e,"field"),getLabel:t=>yb(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:r,events:s,apis:a}},UR=Fb({name:"FormField",configFields:LR(),partFields:FR(),factory:zR,apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}}),HR=(e,t)=>Vl({attributes:Ca([{key:t.tabAttr,value:"true"}])});var VR=Object.freeze({__proto__:null,exhibit:HR}),jR=[na("tabAttr","data-alloy-tabstop")];const WR=Wu({fields:jR,name:"tabstopping",active:VR});var $R=tinymce.util.Tools.resolve("tinymce.html.Entities");const GR=(e,t,o,n)=>{const r=KR(e,t,o,n);return UR.sketch(r)},qR=(e,t)=>GR(e,t,[],[]),KR=(e,t,o,n)=>({dom:XR(o),components:e.toArray().concat([t]),fieldBehaviours:Vu(n)}),YR=()=>XR([]),XR=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),JR=(e,t)=>UR.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Jc(t.translate(e))]}),ZR=fl("form-component-change"),QR=fl("form-close"),eB=fl("form-cancel"),tB=fl("form-action"),oB=fl("form-submit"),nB=fl("form-block"),rB=fl("form-unblock"),sB=fl("form-tabchange"),aB=fl("form-resize"),iB=(e,t,o)=>{const n=e.label.map(e=>JR(e,t)),r=t.icons(),s=e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e},a=e=>(t,o)=>{gd(o.event.target,"[data-collection-item-value]").each(n=>{e(t,o,n,no(n,"data-collection-item-value"))})},i=(o,n)=>{const r=V(n,o=>{const n=KS.translate(o.text),r=1===e.columns?`
${n}
`:"",a=`
${s(o.icon)}
`,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,e=>i[e]),c=t.isDisabled()?" tox-collection__item--state-disabled":"";return`
${a}${r}
`}),a="auto"!==e.columns&&e.columns>1?H(r,e.columns):[r],i=V(a,e=>`
${e.join("")}
`);rl(o.element,i.join(""))},l=a((o,n,r,s)=>{n.stop(),t.isDisabled()||Ri(o,tB,{name:e.name,value:s})}),c=[Vi($a(),a((e,t,o)=>{Ju(o)})),Vi(Za(),l),Vi(ui(),l),Vi(Ga(),a((e,t,o)=>{md(e.element,"."+F_).each(e=>{xc(e,F_)}),vc(o,F_)})),Vi(qa(),a(e=>{md(e.element,"."+F_).each(e=>{xc(e,F_)})})),tl(a((t,o,n,r)=>{Ri(t,tB,{name:e.name,value:r})}))],d=(e,t)=>V(mp(e.element,".tox-collection__item"),t),u=UR.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:k},behaviours:Vu([lv.config({disabled:t.isDisabled,onDisabled:e=>{d(e,e=>{vc(e,"tox-collection__item--state-disabled"),to(e,"aria-disabled",!0)})},onEnabled:e=>{d(e,e=>{xc(e,"tox-collection__item--state-disabled"),ao(e,"aria-disabled")})}}),fT(),bw.config({}),_h.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(t,o)=>{i(t,o),"auto"===e.columns&&KO(t,5,"tox-collection__item").each(({numRows:e,numColumns:o})=>{nw.setGridSize(t,e,o)}),Ni(t,aB)}}),WR.config({}),nw.config(PA(e.columns,"normal")),yw("collection-events",c)]),eventOrder:{[ci()]:["disabling","alloy.base.behaviour","collection-events"]}}),m=["tox-form__group--collection"];return GR(n,u,m,[])},lB=["input","textarea"],cB=e=>{const t=ut(e);return F(lB,t)},dB=(e,t)=>{const o=t.getRoot(e).getOr(e.element);xc(o,t.invalidClass),t.notify.each(t=>{cB(e.element)&&to(e.element,"aria-invalid",!1),t.getContainer(e).each(e=>{rl(e,t.validHtml)}),t.onValid(e)})},uB=(e,t,o,n)=>{const r=t.getRoot(e).getOr(e.element);vc(r,t.invalidClass),t.notify.each(t=>{cB(e.element)&&to(e.element,"aria-invalid",!0),t.getContainer(e).each(e=>{rl(e,n)}),t.onInvalid(e,n)})},mB=(e,t,o)=>t.validator.fold(()=>wN.pure(ur.value(!0)),t=>t.validate(e)),gB=(e,t,o)=>(t.notify.each(t=>{t.onValidate(e)}),mB(e,t).map(n=>e.getSystem().isConnected()?n.fold(n=>(uB(e,t,o,n),ur.error(n)),o=>(dB(e,t),ur.value(o))):ur.error("No longer in system"))),pB=(e,t)=>{const o=t.getRoot(e).getOr(e.element);return Cc(o,t.invalidClass)};var fB=Object.freeze({__proto__:null,markValid:dB,markInvalid:uB,query:mB,run:gB,isInvalid:pB});const hB=(e,t)=>e.validator.map(o=>Fi([Vi(o.onEvent,o=>{gB(o,e,t).get(k)})].concat(o.validateOnLoad?[Zi(o=>{gB(o,e,t).get(y)})]:[]))).getOr({});var bB=Object.freeze({__proto__:null,events:hB}),vB=[Ls("invalidClass"),na("getRoot",R.none),ta("notify",[na("aria","alert"),na("getContainer",R.none),na("validHtml",""),Ld("onValid"),Ld("onInvalid"),Ld("onValidate")]),ta("validator",[Ls("validate"),na("onEvent","input"),na("validateOnLoad",!0)])];const yB=Wu({fields:vB,name:"invalidating",active:bB,apis:fB,extra:{validation:e=>t=>{const o=_h.getValue(t);return wN.pure(e(o))}}}),xB=()=>Vl({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}}),wB=()=>Fi([zi(oi(),N)]);var CB=Object.freeze({__proto__:null,events:wB,exhibit:xB});const SB=Wu({fields:[],name:"unselecting",active:CB}),kB=(e,t)=>zN.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:Vu([xT.button(t.providers.isDisabled),fT(),SB.config({}),WR.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>wN.nu(t=>e.fetch(t)).map(n=>R.from(QN(Ar(BA(fl("menu-value"),n,t=>{e.onItemAction(o,t)},e.columns,e.presets,E_.CLOSE_ON_EXECUTE,A,t.providers),{movement:IA(e.columns,e.presets)})))),parts:{menu:Q_(!1,1,e.presets)}}),_B=fl("color-input-change"),EB=fl("color-swatch-change"),OB=fl("color-picker-cancel"),TB=(e,t,o,n)=>{const r=UR.parts.field({factory:sE,inputClasses:["tox-textfield"],data:n,onSetValue:e=>yB.run(e).get(y),inputBehaviours:Vu([lv.config({disabled:t.providers.isDisabled}),fT(),WR.config({}),yB.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>Rt(e.element),notify:{onValid:e=>{const t=_h.getValue(e);Ri(e,_B,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=_h.getValue(e);if(0===t.length)return wN.pure(ur.value(!0));{const e=Ze.fromTag("span");uo(e,"background-color",t);const o=ho(e,"background-color").fold(()=>ur.error("blah"),e=>ur.value(t));return wN.pure(o)}}}})]),selectOnFocus:!1}),s=e.label.map(e=>JR(e,t.providers)),a=(e,t)=>{Ri(e,EB,{value:t})},i=(t,n)=>{l.getOpt(t).each(t=>{"custom"===n?o.colorPicker(o=>{o.fold(()=>Ni(t,OB),o=>{a(t,o),KD(e.storageKey,o)})},"#ffffff"):a(t,"remove"===n?"":n)})},l=YC(kB({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[vu,bu,Cu],onLtr:()=>[bu,vu,Cu]},components:[],fetch:kA(o.getColors(e.storageKey),e.storageKey,o.hasCustomColors()),columns:o.getColorCols(e.storageKey),presets:"color",onItemAction:i},t));return UR.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:s.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[r,l.asSpec()]}]),fieldBehaviours:Vu([yw("form-field-events",[Vi(_B,(t,o)=>{l.getOpt(t).each(e=>{uo(e.element,"background-color",o.event.color)}),Ri(t,ZR,{name:e.name})}),Vi(EB,(e,t)=>{UR.getField(e).each(o=>{_h.setValue(o,t.event.value),jb.getCurrent(e).each(Tw.focus)})}),Vi(OB,(e,t)=>{UR.getField(e).each(t=>{jb.getCurrent(e).each(Tw.focus)})})])])})},DB=ab({schema:[Ls("dom")],name:"label"}),AB=e=>ab({name:e+"-edge",overrides:t=>{const o=t.model.manager.edgeActions[e];return o.fold(()=>({}),e=>({events:Fi([ji(La(),(t,o,n)=>e(t,n),[t]),ji(Ha(),(t,o,n)=>e(t,n),[t]),ji(Va(),(t,o,n)=>{n.mouseIsDown.get()&&e(t,n)},[t])])}))}}),NB=AB("top-left"),RB=AB("top"),BB=AB("top-right"),MB=AB("right"),IB=AB("bottom-right"),PB=AB("bottom"),LB=AB("bottom-left"),FB=AB("left"),zB=rb({name:"thumb",defaults:S({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Fi([qi(La(),e,"spectrum"),qi(Fa(),e,"spectrum"),qi(za(),e,"spectrum"),qi(Ha(),e,"spectrum"),qi(Va(),e,"spectrum"),qi(Wa(),e,"spectrum")])})}),UB=e=>Wv(e.event),HB=rb({schema:[Is("mouseIsDown",()=>ga(!1))],name:"spectrum",overrides:e=>{const t=e.model,o=t.manager,n=(t,n)=>o.getValueFromEvent(n).map(n=>o.setValueFrom(t,e,n));return{behaviours:Vu([nw.config({mode:"special",onLeft:(t,n)=>o.onLeft(t,e,UB(n)),onRight:(t,n)=>o.onRight(t,e,UB(n)),onUp:(t,n)=>o.onUp(t,e,UB(n)),onDown:(t,n)=>o.onDown(t,e,UB(n))}),WR.config({}),Tw.config({})]),events:Fi([Vi(La(),n),Vi(Fa(),n),Vi(Ha(),n),Vi(Va(),(t,o)=>{e.mouseIsDown.get()&&n(t,o)})])}}});var VB=[DB,FB,MB,RB,PB,NB,BB,LB,IB,zB,HB];const jB="slider.change.value",WB=S(jB),$B=e=>-1!==e.type.indexOf("touch"),GB=e=>{const t=e.event.raw;if($B(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?R.some(e.touches[0]).map(e=>Oo(e.clientX,e.clientY)):R.none()}{const e=t;return void 0!==e.clientX?R.some(e).map(e=>Oo(e.clientX,e.clientY)):R.none()}},qB="top",KB="right",YB="bottom",XB="left",JB=e=>e.model.minX,ZB=e=>e.model.minY,QB=e=>e.model.minX-1,eM=e=>e.model.minY-1,tM=e=>e.model.maxX,oM=e=>e.model.maxY,nM=e=>e.model.maxX+1,rM=e=>e.model.maxY+1,sM=(e,t,o)=>t(e)-o(e),aM=e=>sM(e,tM,JB),iM=e=>sM(e,oM,ZB),lM=e=>aM(e)/2,cM=e=>iM(e)/2,dM=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,uM=e=>e.snapToGrid,mM=e=>e.snapStart,gM=e=>e.rounded,pM=(e,t)=>void 0!==e[t+"-edge"],fM=e=>pM(e,XB),hM=e=>pM(e,KB),bM=e=>pM(e,qB),vM=e=>pM(e,YB),yM=e=>e.model.value.get(),xM=(e,t)=>({x:e,y:t}),wM=(e,t)=>{Ri(e,WB(),{value:t})},CM=(e,t)=>{wM(e,xM(QB(t),eM(t)))},SM=(e,t)=>{wM(e,eM(t))},kM=(e,t)=>{wM(e,xM(lM(t),eM(t)))},_M=(e,t)=>{wM(e,xM(nM(t),eM(t)))},EM=(e,t)=>{wM(e,nM(t))},OM=(e,t)=>{wM(e,xM(nM(t),cM(t)))},TM=(e,t)=>{wM(e,xM(nM(t),rM(t)))},DM=(e,t)=>{wM(e,rM(t))},AM=(e,t)=>{wM(e,xM(lM(t),rM(t)))},NM=(e,t)=>{wM(e,xM(QB(t),rM(t)))},RM=(e,t)=>{wM(e,QB(t))},BM=(e,t)=>{wM(e,xM(QB(t),cM(t)))},MM=(e,t,o,n)=>eo?o:e===t?t-1:Math.max(t,e-n),IM=(e,t,o,n)=>e>o?e:eMath.max(t,Math.min(o,e)),LM=(e,t,o,n,r)=>r.fold(()=>{const r=e-t,s=Math.round(r/n)*n;return PM(t+s,t-1,o+1)},t=>{const r=(e-t)%n,s=Math.round(r/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=Math.min(i,a+s),c=t+l*n;return Math.max(t,c)}),FM=(e,t,o)=>Math.min(o,Math.max(e,t))-t,zM=e=>{const{min:t,max:o,range:n,value:r,step:s,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:m,screenRange:g}=e,p=c?t-1:t,f=d?o+1:o;if(rm)return f;{const e=FM(r,u,m),c=PM(e/g*n+t,p,f);return a&&c>=t&&c<=o?LM(c,t,o,s,i):l?Math.round(c):c}},UM=e=>{const{min:t,max:o,range:n,value:r,hasMinEdge:s,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return ro?a?i:d:(r-t)/n*l},HM="top",VM="right",jM="bottom",WM="left",$M="width",GM="height",qM=e=>e.element.dom.getBoundingClientRect(),KM=(e,t)=>e[t],YM=e=>{const t=qM(e);return KM(t,WM)},XM=e=>{const t=qM(e);return KM(t,VM)},JM=e=>{const t=qM(e);return KM(t,HM)},ZM=e=>{const t=qM(e);return KM(t,jM)},QM=e=>{const t=qM(e);return KM(t,$M)},eI=e=>{const t=qM(e);return KM(t,GM)},tI=(e,t,o)=>(e+t)/2-o,oI=(e,t)=>{const o=qM(e),n=qM(t),r=KM(o,WM),s=KM(o,VM),a=KM(n,WM);return tI(r,s,a)},nI=(e,t)=>{const o=qM(e),n=qM(t),r=KM(o,HM),s=KM(o,jM),a=KM(n,HM);return tI(r,s,a)},rI=(e,t)=>{Ri(e,WB(),{value:t})},sI=(e,t,o)=>{const n={min:JB(t),max:tM(t),range:aM(t),value:o,step:dM(t),snap:uM(t),snapStart:mM(t),rounded:gM(t),hasMinEdge:fM(t),hasMaxEdge:hM(t),minBound:YM(e),maxBound:XM(e),screenRange:QM(e)};return zM(n)},aI=(e,t,o)=>{const n=sI(e,t,o),r=n;return rI(e,r),n},iI=(e,t)=>{const o=JB(t);rI(e,o)},lI=(e,t)=>{const o=tM(t);rI(e,o)},cI=(e,t,o,n)=>{const r=e>0?IM:MM,s=r(yM(o),JB(o),tM(o),dM(o,n));return rI(t,s),R.some(s)},dI=e=>(t,o,n)=>cI(e,t,o,n).map(N),uI=e=>{const t=GB(e);return t.map(e=>e.left)},mI=(e,t,o,n,r)=>{const s=0,a=QM(e),i=n.bind(t=>R.some(oI(t,e))).getOr(s),l=r.bind(t=>R.some(oI(t,e))).getOr(a),c={min:JB(t),max:tM(t),range:aM(t),value:o,hasMinEdge:fM(t),hasMaxEdge:hM(t),minBound:YM(e),minOffset:s,maxBound:XM(e),maxOffset:a,centerMinEdge:i,centerMaxEdge:l};return UM(c)},gI=(e,t,o,n,r,s)=>{const a=mI(t,s,o,n,r);return YM(t)-YM(e)+a},pI=(e,t,o,n)=>{const r=yM(o),s=gI(e,n.getSpectrum(e),r,n.getLeftEdge(e),n.getRightEdge(e),o),a=Mo(t.element)/2;uo(t.element,"left",s-a+"px")},fI=dI(-1),hI=dI(1),bI=R.none,vI=R.none,yI={"top-left":R.none(),top:R.none(),"top-right":R.none(),right:R.some(EM),"bottom-right":R.none(),bottom:R.none(),"bottom-left":R.none(),left:R.some(RM)};var xI=Object.freeze({__proto__:null,setValueFrom:aI,setToMin:iI,setToMax:lI,findValueOfOffset:sI,getValueFromEvent:uI,findPositionOfValue:gI,setPositionFromValue:pI,onLeft:fI,onRight:hI,onUp:bI,onDown:vI,edgeActions:yI});const wI=(e,t)=>{Ri(e,WB(),{value:t})},CI=(e,t,o)=>{const n={min:ZB(t),max:oM(t),range:iM(t),value:o,step:dM(t),snap:uM(t),snapStart:mM(t),rounded:gM(t),hasMinEdge:bM(t),hasMaxEdge:vM(t),minBound:JM(e),maxBound:ZM(e),screenRange:eI(e)};return zM(n)},SI=(e,t,o)=>{const n=CI(e,t,o),r=n;return wI(e,r),n},kI=(e,t)=>{const o=ZB(t);wI(e,o)},_I=(e,t)=>{const o=oM(t);wI(e,o)},EI=(e,t,o,n)=>{const r=e>0?IM:MM,s=r(yM(o),ZB(o),oM(o),dM(o,n));return wI(t,s),R.some(s)},OI=e=>(t,o,n)=>EI(e,t,o,n).map(N),TI=e=>{const t=GB(e);return t.map(e=>e.top)},DI=(e,t,o,n,r)=>{const s=0,a=eI(e),i=n.bind(t=>R.some(nI(t,e))).getOr(s),l=r.bind(t=>R.some(nI(t,e))).getOr(a),c={min:ZB(t),max:oM(t),range:iM(t),value:o,hasMinEdge:bM(t),hasMaxEdge:vM(t),minBound:JM(e),minOffset:s,maxBound:ZM(e),maxOffset:a,centerMinEdge:i,centerMaxEdge:l};return UM(c)},AI=(e,t,o,n,r,s)=>{const a=DI(t,s,o,n,r);return JM(t)-JM(e)+a},NI=(e,t,o,n)=>{const r=yM(o),s=AI(e,n.getSpectrum(e),r,n.getTopEdge(e),n.getBottomEdge(e),o),a=So(t.element)/2;uo(t.element,"top",s-a+"px")},RI=R.none,BI=R.none,MI=OI(-1),II=OI(1),PI={"top-left":R.none(),top:R.some(SM),"top-right":R.none(),right:R.none(),"bottom-right":R.none(),bottom:R.some(DM),"bottom-left":R.none(),left:R.none()};var LI=Object.freeze({__proto__:null,setValueFrom:SI,setToMin:kI,setToMax:_I,findValueOfOffset:CI,getValueFromEvent:TI,findPositionOfValue:AI,setPositionFromValue:NI,onLeft:RI,onRight:BI,onUp:MI,onDown:II,edgeActions:PI});const FI=(e,t)=>{Ri(e,WB(),{value:t})},zI=(e,t)=>({x:e,y:t}),UI=(e,t,o)=>{const n=sI(e,t,o.left),r=CI(e,t,o.top),s=zI(n,r);return FI(e,s),s},HI=(e,t,o,n,r)=>{const s=e>0?IM:MM,a=t?yM(n).x:s(yM(n).x,JB(n),tM(n),dM(n,r)),i=t?s(yM(n).y,ZB(n),oM(n),dM(n,r)):yM(n).y;return FI(o,zI(a,i)),R.some(a)},VI=(e,t)=>(o,n,r)=>HI(e,t,o,n,r).map(N),jI=(e,t)=>{const o=JB(t),n=ZB(t);FI(e,zI(o,n))},WI=(e,t)=>{const o=tM(t),n=oM(t);FI(e,zI(o,n))},$I=e=>GB(e),GI=(e,t,o,n)=>{const r=yM(o),s=gI(e,n.getSpectrum(e),r.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=AI(e,n.getSpectrum(e),r.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Mo(t.element)/2,l=So(t.element)/2;uo(t.element,"left",s-i+"px"),uo(t.element,"top",a-l+"px")},qI=VI(-1,!1),KI=VI(1,!1),YI=VI(-1,!0),XI=VI(1,!0),JI={"top-left":R.some(CM),top:R.some(kM),"top-right":R.some(_M),right:R.some(OM),"bottom-right":R.some(TM),bottom:R.some(AM),"bottom-left":R.some(NM),left:R.some(BM)};var ZI=Object.freeze({__proto__:null,setValueFrom:UI,setToMin:jI,setToMax:WI,getValueFromEvent:$I,setPositionFromValue:GI,onLeft:qI,onRight:KI,onUp:YI,onDown:XI,edgeActions:JI});const QI=[na("stepSize",1),na("speedMultiplier",10),na("onChange",y),na("onChoose",y),na("onInit",y),na("onDragStart",y),na("onDragEnd",y),na("snapToGrid",!1),na("rounded",!0),Ks("snapStart"),Fs("model",Rs("mode",{x:[na("minX",0),na("maxX",100),Is("value",e=>ga(e.mode.minX)),Ls("getInitialValue"),Hd("manager",xI)],y:[na("minY",0),na("maxY",100),Is("value",e=>ga(e.mode.minY)),Ls("getInitialValue"),Hd("manager",LI)],xy:[na("minX",0),na("maxX",100),na("minY",0),na("maxY",100),Is("value",e=>ga({x:e.mode.minX,y:e.mode.minY})),Ls("getInitialValue"),Hd("manager",ZI)]})),Eh("sliderBehaviours",[nw,_h]),Is("mouseIsDown",()=>ga(!1))],eP=(e,t,o,n)=>{const r=t=>xb(t,e,"thumb"),s=t=>xb(t,e,"spectrum"),a=t=>yb(t,e,"left-edge"),i=t=>yb(t,e,"right-edge"),l=t=>yb(t,e,"top-edge"),c=t=>yb(t,e,"bottom-edge"),d=e.model,u=d.manager,m=(t,o)=>{u.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:s})},g=(e,t)=>{d.value.set(t);const o=r(e);m(e,o)},p=(t,o)=>{g(t,o);const n=r(t);return e.onChange(t,n,o),R.some(!0)},f=t=>{u.setToMin(t,e)},h=t=>{u.setToMax(t,e)},b=t=>{const o=()=>{yb(t,e,"thumb").each(o=>{const n=d.value.get();e.onChoose(t,o,n)})},n=e.mouseIsDown.get();e.mouseIsDown.set(!1),n&&o()},v=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,r(t))},y=(t,o)=>{o.stop(),e.onDragEnd(t,r(t)),b(t)},x=t=>{yb(t,e,"spectrum").map(nw.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Th(e.sliderBehaviours,[nw.config({mode:"special",focusIn:x}),_h.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),Ku.config({channels:{[Gf()]:{onReceive:b}}})]),events:Fi([Vi(WB(),(e,t)=>{p(e,t.event.value)}),Zi((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=r(t);m(t,a);const i=s(t);e.onInit(t,a,i,d.value.get())}),Vi(La(),v),Vi(za(),y),Vi(Ha(),(e,t)=>{x(e),v(e,t)}),Vi(Wa(),y)]),apis:{resetToMin:f,resetToMax:h,setValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},tP=Fb({name:"Slider",configFields:QI,partFields:VB,factory:eP,apis:{setValue:(e,t,o)=>{e.setValue(t,o)},resetToMin:(e,t)=>{e.resetToMin(t)},resetToMax:(e,t)=>{e.resetToMax(t)},refresh:(e,t)=>{e.refresh(t)}}}),oP=fl("rgb-hex-update"),nP=fl("slider-update"),rP=fl("palette-update"),sP=(e,t)=>{const o=tP.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=tP.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return tP.sketch({dom:{tag:"div",classes:[t("hue-slider")],attributes:{role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":120}},rounded:!1,model:{mode:"y",getInitialValue:S(0)},components:[o,n],sliderBehaviours:Vu([Tw.config({})]),onChange:(e,t,o)=>{to(e.element,"aria-valuenow",Math.floor(360-3.6*o)),Ri(e,nP,{value:o})}})},aP="form",iP=[Eh("formBehaviours",[_h])],lP=e=>"",cP=e=>{const t=(()=>{const e=[],t=(t,o)=>(e.push(t),pb(aP,lP(t),o));return{field:t,record:S(e)}})(),o=e(t),n=t.record(),r=V(n,e=>rb({name:e,pname:lP(e)}));return Nb(aP,iP,r,uP,o)},dP=(e,t)=>e.fold(()=>ur.error(t),ur.value),uP=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Th(e.formBehaviours,[_h.config({store:{mode:"manual",getValue:t=>{const o=Cb(t,e);return pe(o,(e,t)=>e().bind(e=>{const o=jb.getCurrent(e);return dP(o,new Error(`Cannot find a current component to extract the value from for form part '${t}': `+dl(e.element)))}).map(_h.getValue))},setValue:(t,o)=>{ge(o,(o,n)=>{yb(t,e,n).each(e=>{jb.getCurrent(e).each(e=>{_h.setValue(e,o)})})})}}})]),apis:{getField:(t,o)=>yb(t,e,o).bind(jb.getCurrent)}}),mP={getField:Il((e,t,o)=>e.getField(t,o)),sketch:cP},gP=fl("valid-input"),pP=fl("invalid-input"),fP=fl("validating-input"),hP="colorcustom.rgb.",bP=(e,t,o,n)=>{const r=(o,n)=>yB.config({invalidClass:t("invalid"),notify:{onValidate:e=>{Ri(e,fP,{type:o})},onValid:e=>{Ri(e,gP,{type:o,value:_h.getValue(e)})},onInvalid:e=>{Ri(e,pP,{type:o,value:_h.getValue(e)})}},validator:{validate:t=>{const o=_h.getValue(t),r=n(o)?ur.value(!0):ur.error(e("aria.input.invalid"));return wN.pure(r)},validateOnLoad:!1}}),s=(o,n,s,a,i)=>{const l=e(hP+"range"),c=UR.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[Jc(s)]}),d=UR.parts.field({data:i,factory:sE,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:Vu([r(n,o),WR.config({})]),onSetValue:e=>{if(yB.isInvalid(e)){const t=yB.run(e);t.get(y)}}}),u=[c,d],m="hex"!==n?[UR.parts["aria-descriptor"]({text:l})]:[],g=u.concat(m);return{dom:{tag:"div",attributes:{role:"presentation"}},components:g}},a=(e,t)=>{const o=iD(t);return mP.getField(e,"hex").each(t=>{Tw.isFocused(t)||_h.setValue(e,{hex:o.value})}),o},i=(e,t)=>{const o=t.red,n=t.green,r=t.blue;_h.setValue(e,{red:o,green:n,blue:r})},l=YC({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),c=(e,t)=>{l.getOpt(e).each(e=>{uo(e.element,"background-color","#"+t.value)})},d=()=>{const r={red:ga(R.some(255)),green:ga(R.some(255)),blue:ga(R.some(255)),hex:ga(R.some("ffffff"))},d=(e,t)=>{const o=hD(t);i(e,o),p(o)},u=e=>r[e].get(),m=(e,t)=>{r[e].set(t)},g=()=>u("red").bind(e=>u("green").bind(t=>u("blue").map(o=>gD(e,t,o,1)))),p=e=>{const t=e.red,o=e.green,n=e.blue;m("red",R.some(t)),m("green",R.some(o)),m("blue",R.some(n))},f=(e,t)=>{const o=t.event;"hex"!==o.type?m(o.type,R.none()):n(e)},h=(e,t)=>{o(e);const n=ZT(t);m("hex",R.some(n.value));const r=hD(n);i(e,r),p(r),Ri(e,oP,{hex:n}),c(e,n)},b=(e,t,o)=>{const n=parseInt(o,10);m(t,R.some(n)),g().each(t=>{const o=a(e,t);Ri(e,oP,{hex:o}),c(e,o)})},v=e=>"hex"===e.type,y=(e,t)=>{const o=t.event;v(o)?h(e,o.value):b(e,o.type,o.value)},x=t=>({label:e(hP+t+".label"),description:e(hP+t+".description")}),w=x("red"),C=x("green"),S=x("blue"),k=x("hex");return Ar(mP.sketch(o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",UR.sketch(s(pD,"red",w.label,w.description,255))),o.field("green",UR.sketch(s(pD,"green",C.label,C.description,255))),o.field("blue",UR.sketch(s(pD,"blue",S.label,S.description,255))),o.field("hex",UR.sketch(s(tD,"hex",k.label,k.description,"ffffff"))),l.asSpec()],formBehaviours:Vu([yB.config({invalidClass:t("form-invalid")}),yw("rgb-form-events",[Vi(gP,y),Vi(pP,f),Vi(fP,f)])])})),{apis:{updateHex:(e,t)=>{_h.setValue(e,{hex:t.value}),d(e,t),c(e,t)}}})},u=Lb({factory:d,name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return u},vP=(e,t)=>{const o=tP.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=tP.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:``}}),r=(e,t)=>{const{width:o,height:n}=e,r=e.getContext("2d");if(null===r)return;r.fillStyle=t,r.fillRect(0,0,o,n);const s=r.createLinearGradient(0,0,o,0);s.addColorStop(0,"rgba(255,255,255,1)"),s.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=s,r.fillRect(0,0,o,n);const a=r.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=a,r.fillRect(0,0,o,n)},s=(e,t)=>{const o=e.components()[0].element.dom,n=YD(t,100,100),s=fD(n);r(o,yD(s))},a=(t,o)=>{const n=XD(hD(o));tP.setValue(t,{x:n.saturation,y:100-n.value}),to(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))},i=s=>{const a=S({x:0,y:0}),i=(t,o,n)=>{b(n)||to(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),Ri(t,rP,{value:n})},l=(e,t,o,n)=>{r(o.element.dom,yD(xD))},c=Vu([jb.config({find:R.some}),Tw.config({})]);return tP.sketch({dom:{tag:"div",attributes:{role:"slider","aria-valuetext":e(["Saturation {0}%, Brightness {1}%",0,0])},classes:[t("sv-palette")]},model:{mode:"xy",getInitialValue:a},rounded:!1,components:[o,n],onChange:i,onInit:l,sliderBehaviours:c})},l=Lb({factory:i,name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{s(t,o)},setThumb:(e,t,o)=>{a(t,o)}},extraApis:{}});return l},yP=(e,t)=>{const o=o=>{const n=bP(e,t,o.onValidHex,o.onInvalidHex),r=vP(e,t),s=e=>(100-e)/100*360,a=e=>100-e/360*100,i={paletteRgba:ga(xD),paletteHue:ga(0)},l=YC(sP(e,t)),c=YC(r.sketch({})),d=YC(n.sketch({})),u=(e,t,o)=>{c.getOpt(e).each(e=>{r.setHue(e,o)})},m=(e,t)=>{d.getOpt(e).each(e=>{n.updateHex(e,t)})},g=(e,t,o)=>{l.getOpt(e).each(e=>{tP.setValue(e,a(o))})},p=(e,t)=>{c.getOpt(e).each(e=>{r.setThumb(e,t)})},f=(e,t)=>{const o=hD(e);i.paletteRgba.set(o),i.paletteHue.set(t)},h=(e,t,o,n)=>{f(t,o),j(n,n=>{n(e,t,o)})},b=()=>{const e=[m];return(t,o)=>{const n=o.event.value,r=i.paletteHue.get(),s=YD(r,n.x,100-n.y),a=ZD(s);h(t,a,r,e)}},v=()=>{const e=[u,m];return(t,o)=>{const n=s(o.event.value),r=i.paletteRgba.get(),a=XD(r),l=YD(n,a.saturation,a.value),c=ZD(l);h(t,c,n,e)}},y=()=>{const e=[u,g,p];return(t,o)=>{const n=o.event.hex,r=JD(n);h(t,n,r.hue,e)}};return{uid:o.uid,dom:o.dom,components:[c.asSpec(),l.asSpec(),d.asSpec()],behaviours:Vu([yw("colour-picker-events",[Vi(oP,y()),Vi(rP,b()),Vi(nP,v())]),jb.config({find:e=>d.getOpt(e)}),nw.config({mode:"acyclic"})])}},n=Lb({name:"ColourPicker",configFields:[Ls("dom"),na("onValidHex",y),na("onInvalidHex",y)],factory:o});return n},xP=()=>jb.config({find:R.some}),wP=e=>jb.config({find:e.getOpt}),CP=e=>jb.config({find:t=>Lt(t.element,e).bind(e=>t.getSystem().getByDom(e).toOptional())}),SP={self:xP,memento:wP,childAt:CP},kP=ls([na("preprocess",k),na("postprocess",k)]),_P=(e,t)=>{const o=As("RepresentingConfigs.memento processors",kP,t);return _h.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),r=_h.getValue(n);return o.postprocess(r)},setValue:(t,n)=>{const r=o.preprocess(n),s=e.get(t);_h.setValue(s,r)}}})},EP=(e,t,o)=>_h.config({store:{mode:"manual",...e.map(e=>({initialValue:e})).getOr({}),getValue:t,setValue:o}}),OP=(e,t,o)=>EP(e,e=>t(e.element),(e,t)=>o(e.element,t)),TP=e=>OP(e,nl,rl),DP=e=>_h.config({store:{mode:"memory",initialValue:e}}),AP={"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","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"},NP=e=>t=>i(t)?e.translate(AP[t]):e.translate(t),RP=(e,t,o)=>{const n=e=>"tox-"+e,r=yP(NP(t),n),s=e=>{Ri(e,tB,{name:"hex-valid",value:!0})},a=e=>{Ri(e,tB,{name:"hex-valid",value:!1})},i=YC(r.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:s,onInvalidHex:a}));return{dom:{tag:"div"},components:[i.asSpec()],behaviours:Vu([EP(o,e=>{const t=i.get(e),o=jb.getCurrent(t),n=o.bind(e=>{const t=_h.getValue(e);return t.hex});return n.map(e=>"#"+Le(e,"#")).getOr("")},(e,t)=>{const o=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/,n=R.from(o.exec(t)).bind(e=>ae(e,1)),r=i.get(e),s=jb.getCurrent(r);s.fold(()=>{console.log("Can not find form")},e=>{_h.setValue(e,{hex:n.getOr("")}),mP.getField(e,"hex").each(e=>{Ni(e,Xa())})})}),SP.self()])}};var BP=tinymce.util.Tools.resolve("tinymce.Resource");const MP=e=>ke(e,"init"),IP=e=>{const t=Am(),o=YC({dom:{tag:e.tag}}),n=Am();return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:Vu([yw("custom-editor-events",[Zi(r=>{o.getOpt(r).each(o=>{(MP(e)?e.init(o.element.dom):BP.load(e.scriptId,e.scriptUrl).then(t=>t(o.element.dom,e.settings))).then(e=>{n.on(t=>{e.setValue(t)}),n.clear(),t.set(e)})})})]),EP(R.none(),()=>t.get().fold(()=>n.get().getOr(""),e=>e.getValue()),(e,o)=>{t.get().fold(()=>n.set(o),e=>e.setValue(o))}),SP.self()]),components:[o.asSpec()]}};var PP=tinymce.util.Tools.resolve("tinymce.util.Tools");const LP=(e,t)=>{const o=PP.explode(t.getOption("images_file_types")),n=e=>z(o,t=>He(e.name.toLowerCase(),"."+t.toLowerCase()));return G(ce(e),n)},FP=(e,t,o)=>{const n=(e,t)=>{t.stop()},r=e=>(t,o)=>{j(e,e=>{e(t,o)})},s=(e,t)=>{var o;if(!lv.isDisabled(e)){const n=t.event.raw;i(e,null===(o=n.dataTransfer)||void 0===o?void 0:o.files)}},a=(e,t)=>{const o=t.event.raw.target;i(e,o.files)},i=(o,n)=>{n&&(_h.setValue(o,LP(n,t)),Ri(o,ZR,{name:e.name}))},l=YC({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:Vu([yw("input-file-events",[Yi(Za()),Yi(ui())])])}),c=e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Vu([DP(o.getOr([])),SP.self(),lv.config({}),qw.config({toggleClass:"dragenter",toggleOnExecute:!1}),yw("dropzone-events",[Vi("dragenter",r([n,qw.toggle])),Vi("dragleave",r([n,qw.toggle])),Vi("dragover",n),Vi("drop",r([n,s])),Vi(Ja(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[Jc(t.translate("Drop an image here"))]},$C.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[Jc(t.translate("Browse for an image")),l.asSpec()],action:e=>{const t=l.get(e);t.element.dom.click()},buttonBehaviours:Vu([WR.config({}),xT.button(t.isDisabled),fT()])})]}]}),d=e.label.map(e=>JR(e,t)),u=UR.parts.field({factory:{sketch:c}});return GR(d,u,["tox-form__group--stretched"],[])},zP=(e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:V(e.items,t.interpreter)}),UP=(e,t)=>{let o=null,n=null;const r=()=>{u(o)||(clearTimeout(o),o=null,n=null)},s=(...r)=>{n=r,u(o)&&(o=setTimeout(()=>{const t=n;o=null,n=null,e.apply(null,t)},t))};return{cancel:r,throttle:s}},HP=(e,t)=>{let o=null;const n=()=>{u(o)||(clearTimeout(o),o=null)},r=(...n)=>{u(o)&&(o=setTimeout(()=>{o=null,e.apply(null,n)},t))};return{cancel:n,throttle:r}},VP=(e,t)=>{let o=null;const n=()=>{u(o)||(clearTimeout(o),o=null)},r=(...r)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,r)},t)};return{cancel:n,throttle:r}},jP=fl("alloy-fake-before-tabstop"),WP=fl("alloy-fake-after-tabstop"),$P=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:Vu([Tw.config({ignore:!0}),WR.config({})])}),GP=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[$P([jP]),t,$P([WP])],behaviours:Vu([SP.childAt(1)])}),qP=(e,t)=>{Ri(e,Ka(),{raw:{which:9,shiftKey:t}})},KP=(e,t)=>{const o=t.element;Cc(o,jP)?qP(e,!0):Cc(o,WP)&&qP(e,!1)},YP=e=>dR(e,["."+jP,"."+WP].join(","),A),XP=fl("update-dialog"),JP=fl("update-title"),ZP=fl("update-body"),QP=fl("update-footer"),eL=fl("body-send-message"),tL=fl("dialog-focus-shifted"),oL=_n().browser,nL=oL.isSafari(),rL=oL.isFirefox(),sL=nL||rL,aL=oL.isChromium(),iL=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,lL=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),cL=(e,t)=>{const o=e.body;return R.from(!/^1))?o:e.documentElement)},dL=(e,t,o)=>{const n=e.dom;R.from(n.contentDocument).fold(o,e=>{let o=0;const r=cL(e,t).map(e=>(o=e.scrollTop,e)).forall(iL),s=()=>{const e=n.contentWindow;f(e)&&(r?lL(e,"bottom"):!r&&sL&&0!==o&&lL(e,o))};nL&&n.addEventListener("load",s,{once:!0}),e.open(),e.write(t),e.close(),nL||s()})},uL=Be(sL,nL?500:200),mL=uL.map(e=>UP(dL,e)),gL=(e,t)=>{const o=ga(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,r=()=>to(o,"srcdoc",n);t?mL.fold(S(dL),e=>e.throttle)(o,n,r):r()}o.set(n)}}},pL=(e,t,o)=>{const n="tox-dialog__iframe",r=e.transparent?[]:[n+"--opaque"],s=e.border?["tox-navobj-bordered"]:[],a={...e.label.map(e=>({title:e})).getOr({}),...o.map(e=>({srcdoc:e})).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=gL(o,e.streamContent),l=e.label.map(e=>JR(e,t)),c=e=>GP(R.from(s),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...r]},behaviours:Vu([WR.config({}),Tw.config({}),EP(o,i.getValue,i.setValue),Ku.config({channels:{[tL]:{onReceive:(e,t)=>{t.newFocus.each(t=>{Rt(e.element).each(o=>{const n=kt(e.element,t)?vc:xc;n(o,"tox-navobj-bordered-focus")})})}}}})])}),d=UR.parts.field({factory:{sketch:c}});return GR(l,d,["tox-form__group--stretched"],[])},fL=e=>new Promise((t,o)=>{const n=()=>{s(),t(e)},r=[Rm(e,"load",n),Rm(e,"error",()=>{s(),o("Unable to load data from image: "+e.dom.src)})],s=()=>j(r,e=>e.unbind());e.dom.complete&&n()}),hL=(e,t,o,n,r)=>{const s=o*r,a=n*r,i=Math.max(0,e/2-s/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:s.toString()+"px",height:a.toString()+"px"}},bL=(e,t,o)=>{const n=Mo(e),r=So(e);return Math.min(n/t,r/o,1)},vL=(e,t)=>{const o=ga(t.getOr({url:""})),n=YC({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map(e=>({src:e.url})).getOr({})}}),r=YC({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),s=(e,t)=>{const s={url:t.url};t.zoom.each(e=>s.zoom=e),t.cachedWidth.each(e=>s.cachedWidth=e),t.cachedHeight.each(e=>s.cachedHeight=e),o.set(s);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=s;if(!g(t)&&!g(o)){if(g(n)){const n=bL(e.element,t,o);s.zoom=n}const a=hL(Mo(e.element),So(e.element),t,o,s.zoom);r.getOpt(e).each(e=>{mo(e.element,a)})}};n.getOpt(e).each(o=>{const n=o.element;t.url!==no(n,"src")&&(to(n,"src",t.url),xc(e.element,"tox-imagepreview__loaded")),a(),fL(n).then(t=>{e.getSystem().isConnected()&&(vc(e.element,"tox-imagepreview__loaded"),s.cachedWidth=t.dom.naturalWidth,s.cachedHeight=t.dom.naturalHeight,a())})})},a={};e.height.each(e=>a.height=e);const i=t.map(e=>({url:e.url,zoom:R.from(e.zoom),cachedWidth:R.from(e.cachedWidth),cachedHeight:R.from(e.cachedHeight)}));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:a,attributes:{role:"presentation"}},components:[r.asSpec()],behaviours:Vu([SP.self(),EP(i,()=>o.get(),s)])}},yL=(e,t)=>{const o="tox-label",n="center"===e.align?[o+"--center"]:[],r="end"===e.align?[o+"--end"]:[],s={dom:{tag:"label",classes:[o,...n,...r]},components:[Jc(t.providers.translate(e.label))]},a=V(e.items,t.interpreter);return{dom:{tag:"div",classes:["tox-form__group"]},components:[s,...a],behaviours:Vu([SP.self(),bw.config({}),TP(R.none()),nw.config({mode:"acyclic"})])}},xL=fl("toolbar.button.execute"),wL=e=>tl((t,o)=>{wT(e,t)(o=>{Ri(t,xL,{buttonApi:o}),e.onAction(o)})}),CL=fl("common-button-display-events"),SL={[ci()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events"],[xi()]:["toolbar-button-events",CL],[Ha()]:["focusing","alloy.base.behaviour",CL]},kL=e=>uo(e.element,"width",po(e.element,"width")),_L=(e,t,o)=>sk(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),EL=(e,t)=>_L(e,t,[]),OL=(e,t)=>_L(e,t,[bw.config({})]),TL=(e,t,o)=>({dom:{tag:"span",classes:[t+"__select-label"]},components:[Jc(o.translate(e))],behaviours:Vu([bw.config({})])}),DL=fl("update-menu-text"),AL=fl("update-menu-icon"),NL=(e,t,o)=>{const n=ga(y),r=e.text.map(e=>YC(TL(e,t,o.providers))),s=e.icon.map(e=>YC(OL(e,o.providers.icons))),a=(e,t)=>{const o=_h.getValue(e);return Tw.focus(o),Ri(o,"keydown",{raw:t.event.raw}),zN.close(o),R.some(!0)},i=e.role.fold(()=>({}),e=>({role:e})),l=e.tooltip.fold(()=>({}),e=>{const t=o.providers.translate(e);return{title:t,"aria-label":t}}),c=sk("chevron-down",{tag:"div",classes:[t+"__select-chevron"]},o.providers.icons),d=fl("common-button-display-events"),u=YC(zN.sketch({...e.uid?{uid:e.uid}:{},...i,dom:{tag:"button",classes:[t,t+"--select"].concat(V(e.classes,e=>`${t}--${e}`)),attributes:{...l}},components:ET([s.map(e=>e.asSpec()),r.map(e=>e.asSpec()),R.some(c)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&qN(n)},dropdownBehaviours:Vu([...e.dropdownBehaviours,xT.button(()=>e.disabled||o.providers.isDisabled()),fT(),SB.config({}),bw.config({}),yw("dropdown-events",[CT(e,n),ST(e,n)]),yw(d,[Zi((e,t)=>kL(e))]),yw("menubutton-update-display-text",[Vi(DL,(e,t)=>{r.bind(t=>t.getOpt(e)).each(e=>{bw.set(e,[Jc(o.providers.translate(t.event.text))])})}),Vi(AL,(e,t)=>{s.bind(t=>t.getOpt(e)).each(e=>{bw.set(e,[OL(t.event.icon,o.providers.icons)])})})])]),eventOrder:Ar(SL,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[xi()]:["toolbar-button-events","dropdown-events",d]}),sandboxBehaviours:Vu([nw.config({mode:"special",onLeft:a,onRight:a}),yw("dropdown-sandbox-events",[Vi(aE,(e,t)=>{HN(e),t.stop()}),Vi(iE,(e,t)=>{VN(e,t),t.stop()})])]),lazySink:o.getSink,toggleClass:t+"--active",parts:{menu:{...Q_(!1,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:$N,onCollapseMenu:(e,t,o)=>{Tv.getHighlighted(o).each(t=>{$N(e,o,t)})},onDehighlightItem:GN}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Zm()(e,t-10)}}),fetch:t=>wN.nu(E(e.fetch,t))}));return u.asSpec()},RL=e=>i(e),BL=e=>"separator"===e.type,ML=e=>ke(e,"getSubmenuItems"),IL={type:"separator"},PL=(e,t)=>{const o=K(e,(e,o)=>RL(o)?""===o?e:"|"===o?e.length>0&&!BL(e[e.length-1])?e.concat([IL]):e:ke(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o]),[]);return o.length>0&&BL(o[o.length-1])&&o.pop(),o},LL=(e,t)=>{const o=e.getSubmenuItems(),n=zL(o,t),r=Ar(n.menus,{[e.value]:n.items}),s=Ar(n.expansions,{[e.value]:e.value});return{item:e,menus:r,expansions:s}},FL=e=>{const t=Se(e,"value").getOrThunk(()=>fl("generated-menu-item"));return Ar({value:t},e)},zL=(e,t)=>{const o=PL(i(e)?e.split(" "):e,t);return q(o,(e,o)=>{if(ML(o)){const n=FL(o),r=LL(n,t);return{menus:Ar(e.menus,r.menus),items:[r.item,...e.items],expansions:Ar(e.expansions,r.expansions)}}return{...e,items:[o,...e.items]}},{menus:{},expansions:{},items:[]})},UL=e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-field",placeholder:e.placeholder})),HL=e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-results"})),VL=(e,t,o,n)=>{const r=fl("primary-menu"),s=zL(e,o.shared.providers.menuItems());if(0===s.items.length)return R.none();const a=UL(n),i=ZN(r,s.items,t,o,n.isHorizontalMenu,a),l=HL(n),c=pe(s.menus,(e,n)=>ZN(n,e,t,o,!1,l)),d=Ar(c,wa(r,i));return R.from(zC.tieredData(r,d,s.expansions))},jL=e=>!ke(e,"items"),WL="data-value",$L=(e,t,o,n)=>V(o,o=>jL(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{_h.setValue(e,o.value),Ri(e,ZR,{name:t}),Tw.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>$L(e,t,o.items,n)}),GL=(e,t)=>de(e,e=>jL(e)?Be(e.value===t,e):GL(e.items,t)),qL=(e,t,o)=>{const n=t.shared.providers,r=o.bind(t=>GL(e.items,t)).orThunk(()=>ie(e.items).filter(jL)),s=e.label.map(e=>JR(e,n)),a=UR.parts.field({dom:{},factory:{sketch:o=>NL({uid:o.uid,text:r.map(e=>e.text),icon:R.none(),tooltip:e.label,role:R.none(),fetch:(o,n)=>{const r=$L(o,e.name,e.items,_h.getValue(o));n(VL(r,E_.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:R.none()}))},onSetup:S(y),getApi:S({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[WR.config({}),EP(r.map(e=>e.value),e=>no(e.element,WL),(t,o)=>{GL(e.items,o).each(e=>{to(t.element,WL,e.value),Ri(t,DL,{text:e.text})})})]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return UR.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:Z([s.toArray(),[i]]),fieldBehaviours:Vu([lv.config({disabled:S(!e.enabled),onDisabled:e=>{UR.getField(e).each(lv.disable)},onEnabled:e=>{UR.getField(e).each(lv.enable)}})])})},KL=(e,t)=>({dom:{tag:"div",classes:e.classes},components:V(e.items,t.shared.interpreter)}),YL=(e,t)=>{const o=V(e.options,e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}})),n=e.data.map(e=>wa("initialValue",e)).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Th(e.selectBehaviours,[Tw.config({}),_h.config({store:{mode:"manual",getValue:e=>Dc(e.element),setValue:(t,o)=>{const n=ie(e.options),r=X(e.options,e=>e.value===o);r.isSome()?Ac(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each(e=>Ac(t.element,e.value))},...n}})])}},XL=Lb({name:"HtmlSelect",configFields:[Ls("options"),Eh("selectBehaviours",[Tw,_h]),na("selectClasses",[]),na("selectAttributes",{}),Ks("data")],factory:YL}),JL=(e,t,o)=>{const n=V(e.items,e=>({text:t.translate(e.text),value:e.value})),r=e.label.map(e=>JR(e,t)),s=UR.parts.field({dom:{},...o.map(e=>({data:e})).getOr({}),selectAttributes:{size:e.size},options:n,factory:XL,selectBehaviours:Vu([lv.config({disabled:()=>!e.enabled||t.isDisabled()}),WR.config({}),yw("selectbox-change",[Vi(Ja(),(t,o)=>{Ri(t,ZR,{name:e.name})})])])}),a=e.size>1?R.none():R.some(sk("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:Z([[s],a.toArray()])};return UR.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:Z([r.toArray(),[i]]),fieldBehaviours:Vu([lv.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{UR.getField(e).each(lv.disable)},onEnabled:e=>{UR.getField(e).each(lv.enable)}}),fT()])})},ZL=S([na("field1Name","field1"),na("field2Name","field2"),zd("onLockedChange"),Id(["lockClass"]),na("locked",!1),Dh.field("coupledFieldBehaviours",[jb,_h])]),QL=(e,t,o)=>yb(e,t,o).bind(jb.getCurrent),eF=(e,t)=>rb({factory:UR,name:e,overrides:e=>({fieldBehaviours:Vu([yw("coupled-input-behaviour",[Vi(Xa(),o=>{QL(o,e,t).each(t=>{yb(o,e,"lock").each(n=>{qw.isOn(n)&&e.onLockedChange(o,t,n)})})})])])})}),tF=S([eF("field1","field2"),eF("field2","field1"),rb({factory:$C,schema:[Ls("dom")],name:"lock",overrides:e=>({buttonBehaviours:Vu([qw.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),oF=(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Dh.augment(e.coupledFieldBehaviours,[jb.config({find:R.some}),_h.config({store:{mode:"manual",getValue:t=>{const o=kb(t,e,["field1","field2"]);return{[e.field1Name]:_h.getValue(o.field1()),[e.field2Name]:_h.getValue(o.field2())}},setValue:(t,o)=>{const n=kb(t,e,["field1","field2"]);_e(o,e.field1Name)&&_h.setValue(n.field1(),o[e.field1Name]),_e(o,e.field2Name)&&_h.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>yb(t,e,"field1"),getField2:t=>yb(t,e,"field2"),getLock:t=>yb(t,e,"lock")}}),nF=Fb({name:"FormCoupledInputs",configFields:ZL(),partFields:tF(),factory:oF,apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),rF=e=>{const t={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4},o=e=>e in t?t[e]:1;let n=e.value.toFixed(o(e.unit));return-1!==n.indexOf(".")&&(n=n.replace(/\.?0*$/,"")),n+e.unit},sF=e=>{const t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/,o=t.exec(e);if(null!==o){const e=parseFloat(o[1]),t=o[2];return ur.value({value:e,unit:t})}return ur.error(e)},aF=(e,t)=>{const o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},n=e=>ke(o,e);return e.unit===t?R.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?R.some(e.value):R.some(e.value/o[e.unit]*o[t]):R.none()},iF=e=>R.none(),lF=(e,t)=>o=>aF(o,t).map(o=>({value:o*e,unit:t})),cF=(e,t)=>{const o=sF(e).toOptional(),n=sF(t).toOptional();return Ae(o,n,(e,t)=>aF(e,t.unit).map(e=>t.value/e).map(e=>lF(e,t.unit)).getOr(iF)).getOr(iF)},dF=(e,t)=>{let o=iF;const n=fl("ratio-event"),r=e=>sk(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),s=nF.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:t.translate(e.label.getOr("Constrain proportions"))}},components:[r("lock"),r("unlock")],buttonBehaviours:Vu([lv.config({disabled:()=>!e.enabled||t.isDisabled()}),fT(),WR.config({})])}),a=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),i=o=>UR.parts.field({factory:sE,inputClasses:["tox-textfield"],inputBehaviours:Vu([lv.config({disabled:()=>!e.enabled||t.isDisabled()}),fT(),WR.config({}),yw("size-input-events",[Vi(Ga(),(e,t)=>{Ri(e,n,{isField1:o})}),Vi(Ja(),(t,o)=>{Ri(t,ZR,{name:e.name})})])]),selectOnFocus:!1}),l=e=>({dom:{tag:"label",classes:["tox-label"]},components:[Jc(t.translate(e))]}),c=nF.parts.field1(a([UR.parts.label(l("Width")),i(!0)])),d=nF.parts.field2(a([UR.parts.label(l("Height")),i(!1)]));return nF.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,d,a([l(Bg),s])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{sF(_h.getValue(e)).each(e=>{o(e).each(e=>{_h.setValue(t,rF(e))})})},coupledFieldBehaviours:Vu([lv.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{nF.getField1(e).bind(UR.getField).each(lv.disable),nF.getField2(e).bind(UR.getField).each(lv.disable),nF.getLock(e).each(lv.disable)},onEnabled:e=>{nF.getField1(e).bind(UR.getField).each(lv.enable),nF.getField2(e).bind(UR.getField).each(lv.enable),nF.getLock(e).each(lv.enable)}}),fT(),yw("size-input-events2",[Vi(n,(e,t)=>{const n=t.event.isField1,r=n?nF.getField1(e):nF.getField2(e),s=n?nF.getField2(e):nF.getField1(e),a=r.map(_h.getValue).getOr(""),i=s.map(_h.getValue).getOr("");o=cF(a,i)})])])})},uF=(e,t,o)=>{const n=tP.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Jc(t.translate(e.label))]}),r=tP.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),s=tP.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return tP.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:S(o.getOrThunk(()=>(Math.abs(e.max)-Math.abs(e.min))/2))},components:[n,r,s],sliderBehaviours:Vu([SP.self(),Tw.config({})]),onChoose:(t,o,n)=>{Ri(t,ZR,{name:e.name,value:n})}})},mF=(e,t)=>{const o=e=>({dom:{tag:"th",innerHtml:t.translate(e)}}),n=e=>({dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:V(e,o)}]}),r=e=>({dom:{tag:"td",innerHtml:t.translate(e)}}),s=e=>({dom:{tag:"tr"},components:V(e,r)}),a=e=>({dom:{tag:"tbody"},components:V(e,s)});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[n(e.header),a(e.cells)],behaviours:Vu([WR.config({}),Tw.config({})])}},gF=(e,t)=>{const o=e.label.map(e=>JR(e,t)),n=[lv.config({disabled:()=>e.disabled||t.isDisabled()}),fT(),nw.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Ni(e,oB),R.some(!0))}),yw("textfield-change",[Vi(Xa(),(t,o)=>{Ri(t,ZR,{name:e.name})}),Vi(ii(),(t,o)=>{Ri(t,ZR,{name:e.name})})]),WR.config({})],r=e.validation.map(e=>yB.config({getRoot:e=>Rt(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=_h.getValue(t),n=e.validator(o);return wN.pure(!0===n?ur.value(o):ur.error(n))},validateOnLoad:e.validateOnLoad}})).toArray(),s=e.placeholder.fold(S({}),e=>({placeholder:t.translate(e)})),a=e.inputMode.fold(S({}),e=>({inputmode:e})),i={...s,...a},l=UR.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map(e=>({data:e})).getOr({}),inputAttributes:i,inputClasses:[e.classname],inputBehaviours:Vu(Z([n,r])),selectOnFocus:!1,factory:sE}),c=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[l]}:l,d=e.flex?["tox-form__group--stretched"]:[],u=d.concat(e.maximized?["tox-form-group--maximize"]:[]),m=[lv.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{UR.getField(e).each(lv.disable)},onEnabled:e=>{UR.getField(e).each(lv.enable)}}),fT()];return GR(o,c,u,m)},pF=(e,t,o)=>gF({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:R.none(),maximized:e.maximized,data:o},t),fF=(e,t,o)=>gF({name:e.name,multiline:!0,label:e.label,inputMode:R.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:R.none(),maximized:e.maximized,data:o},t),hF=(e,t)=>t.getAnimationRoot.fold(()=>e.element,t=>t(e)),bF=e=>e.dimension.property,vF=(e,t)=>e.dimension.getDimension(t),yF=(e,t)=>{const o=hF(e,t);kc(o,[t.shrinkingClass,t.growingClass])},xF=(e,t)=>{xc(e.element,t.openClass),vc(e.element,t.closedClass),uo(e.element,bF(t),"0px"),xo(e.element)},wF=(e,t)=>{xc(e.element,t.closedClass),vc(e.element,t.openClass),yo(e.element,bF(t))},CF=(e,t,o,n)=>{o.setCollapsed(),uo(e.element,bF(t),vF(t,e.element)),yF(e,t),xF(e,t),t.onStartShrink(e),t.onShrunk(e)},SF=(e,t,o,n)=>{const r=n.getOrThunk(()=>vF(t,e.element));o.setCollapsed(),uo(e.element,bF(t),r),xo(e.element);const s=hF(e,t);xc(s,t.growingClass),vc(s,t.shrinkingClass),xF(e,t),t.onStartShrink(e)},kF=(e,t,o)=>{const n=vF(t,e.element),r="0px"===n?CF:SF;r(e,t,o,R.some(n))},_F=(e,t,o)=>{const n=hF(e,t),r=Cc(n,t.shrinkingClass),s=vF(t,e.element);wF(e,t);const a=vF(t,e.element),i=()=>{uo(e.element,bF(t),s),xo(e.element)},l=()=>{xF(e,t)},c=r?i:l;c(),xc(n,t.shrinkingClass),vc(n,t.growingClass),wF(e,t),uo(e.element,bF(t),a),o.setExpanded(),t.onStartGrow(e)},EF=(e,t,o)=>{if(o.isExpanded()){yo(e.element,bF(t));const o=vF(t,e.element);uo(e.element,bF(t),o)}},OF=(e,t,o)=>{o.isExpanded()||_F(e,t,o)},TF=(e,t,o)=>{o.isExpanded()&&kF(e,t,o)},DF=(e,t,o)=>{o.isExpanded()&&CF(e,t,o)},AF=(e,t,o)=>o.isExpanded(),NF=(e,t,o)=>o.isCollapsed(),RF=(e,t,o)=>{const n=hF(e,t);return!0===Cc(n,t.growingClass)},BF=(e,t,o)=>{const n=hF(e,t);return!0===Cc(n,t.shrinkingClass)},MF=(e,t,o)=>RF(e,t)||BF(e,t),IF=(e,t,o)=>{const n=o.isExpanded()?kF:_F;n(e,t,o)},PF=(e,t,o)=>{o.isExpanded()||(wF(e,t),uo(e.element,bF(t),vF(t,e.element)),yF(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))};var LF=Object.freeze({__proto__:null,refresh:EF,grow:OF,shrink:TF,immediateShrink:DF,hasGrown:AF,hasShrunk:NF,isGrowing:RF,isShrinking:BF,isTransitioning:MF,toggleGrow:IF,disableTransitions:yF,immediateGrow:PF});const FF=(e,t,o)=>{const n=t.expanded;return Vl(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:wa(t.dimension.property,"0px")})},zF=(e,t)=>Fi([Ji(ei(),(o,n)=>{const r=n.event.raw;if(r.propertyName===e.dimension.property){yF(o,e),t.isExpanded()&&yo(o.element,e.dimension.property);const n=t.isExpanded()?e.onGrown:e.onShrunk;n(o)}})]);var UF=Object.freeze({__proto__:null,exhibit:FF,events:zF}),HF=[Ls("closedClass"),Ls("openClass"),Ls("shrinkingClass"),Ls("growingClass"),Ks("getAnimationRoot"),Ld("onShrunk"),Ld("onStartShrink"),Ld("onGrown"),Ld("onStartGrow"),na("expanded",!1),Fs("dimension",Rs("property",{width:[Hd("property","width"),Hd("getDimension",e=>Mo(e)+"px")],height:[Hd("property","height"),Hd("getDimension",e=>So(e)+"px")]}))];const VF=e=>{const t=ga(e.expanded),o=()=>"expanded: "+t.get();return Ll({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:E(t.set,!1),setExpanded:E(t.set,!0),readState:o})};var jF=Object.freeze({__proto__:null,init:VF});const WF=Wu({fields:HF,name:"sliding",active:UF,apis:LF,state:jF}),$F=e=>({isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t),setActive:t=>{const o=e.element;t?(vc(o,"tox-tbtn--enabled"),to(o,"aria-pressed",!0)):(xc(o,"tox-tbtn--enabled"),ao(o,"aria-pressed"))},isActive:()=>Cc(e.element,"tox-tbtn--enabled"),setText:t=>{Ri(e,DL,{text:t})},setIcon:t=>Ri(e,AL,{icon:t})}),GF=(e,t,o,n,r=!0)=>NL({text:e.text,icon:e.icon,tooltip:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const r={pattern:e.search.isSome()?KN(t):""};e.fetch(t=>{n(VL(t,E_.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))},r,$F(t))},onSetup:e.onSetup,getApi:$F,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...r?[WR.config({})]:[]]},t,o.shared),qF=(e,t,o)=>{const n=e=>n=>{const r=!n.isActive();n.setActive(r),e.storage.set(r),o.shared.getSink().each(o=>{t().getOpt(o).each(t=>{Ju(t.element),Ri(t,tB,{name:e.name,value:e.storage.get()})})})},r=e=>t=>{t.setActive(e.storage.get())};return t=>{t(V(e,e=>{const t=e.text.fold(()=>({}),e=>({text:e}));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:r(e)}}))}},KF=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{title:e,"aria-label":e}},components:[Jc(e)]}),YF=fl("leaf-label-event-id"),XF=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:r,backstage:s})=>{const a=e.menu.map(e=>GF(e,"tox-mbtn",s,R.none(),o)),i=[KF(e.title)];return a.each(e=>i.push(e)),$C.sketch({dom:{tag:"div",classes:["tox-tree--leaf__label","tox-trbtn"].concat(o?["tox-tree--leaf__label--visible"]:[])},components:i,role:"treeitem",action:o=>{t(e.id),o.getSystem().broadcastOn(["update-active-item-"+n],{value:e.id})},eventOrder:{[Ka()]:[YF,"keying"]},buttonBehaviours:Vu([...o?[WR.config({})]:[],qw.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),Ku.config({channels:{["update-active-item-"+n]:{onReceive:(t,o)=>{(o.value===e.id?qw.on:qw.off)(t)}}}}),yw(YF,[Zi((t,o)=>{r.each(o=>{const n=o===e.id?qw.on:qw.off;n(t)})}),Vi(Ka(),(e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(dd(e.element,".tox-tree--directory").each(t=>{e.getSystem().getByDom(t).each(e=>{ud(t,".tox-tree--directory__label").each(t=>{e.getSystem().getByDom(t).each(Tw.focus)})})}),t.stop()):n&&t.stop()})])])})},JF=(e,t,o)=>sk(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:o},t),ZF=(e,t)=>JF(e,t,[]),QF=fl("directory-label-event-id"),ez=({directory:e,visible:t,noChildren:o,backstage:n})=>{const r=e.menu.map(e=>GF(e,"tox-mbtn",n,R.none())),s=[{dom:{tag:"div",classes:["tox-chevron"]},components:[ZF("chevron-right",n.shared.providers.icons)]},KF(e.title)];r.each(e=>{s.push(e)});const a=t=>{dd(t.element,".tox-tree--directory").each(o=>{t.getSystem().getByDom(o).each(o=>{const n=!qw.isOn(o);qw.toggle(o),Ri(t,"expand-tree-node",{expanded:n,node:e.id})})})};return $C.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:s,action:a,eventOrder:{[Ka()]:[QF,"keying"]},buttonBehaviours:Vu([...t?[WR.config({})]:[],yw(QF,[Vi(Ka(),(e,t)=>{const n="ArrowRight"===t.event.raw.code,r="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||r)&&dd(e.element,".tox-tree--directory").each(o=>{e.getSystem().getByDom(o).each(o=>{!qw.isOn(o)&&n||qw.isOn(o)&&r?(a(e),t.stop()):r&&!qw.isOn(o)&&(dd(o.element,".tox-tree--directory").each(e=>{ud(e,".tox-tree--directory__label").each(e=>{o.getSystem().getByDom(e).each(Tw.focus)})}),t.stop())})})})])])})},tz=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:r,selectedId:s,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map(e=>"leaf"===e.type?XF({leaf:e,selectedId:s,onLeafAction:t,visible:o,treeId:n,backstage:a}):nz({directory:e,expandedIds:r,selectedId:s,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a})),behaviours:Vu([WF.config({dimension:{property:"height"},closedClass:"tox-tree--directory__children--closed",openClass:"tox-tree--directory__children--open",growingClass:"tox-tree--directory__children--growing",shrinkingClass:"tox-tree--directory__children--shrinking",expanded:o}),bw.config({})])}),oz=fl("directory-event-id"),nz=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:r,expandedIds:s,selectedId:a})=>{const{children:i}=e,l=ga(s),c=e=>i.map(o=>"leaf"===o.type?XF({leaf:o,selectedId:a,onLeafAction:t,visible:e,treeId:n,backstage:r}):nz({directory:o,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:e,treeId:n,backstage:r})),d=s.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[ez({directory:e,visible:o,noChildren:0===e.children.length,backstage:r}),tz({children:i,expandedIds:s,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:r})],behaviours:Vu([yw(oz,[Zi((e,t)=>{qw.set(e,d)}),Vi("expand-tree-node",(e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter(e=>e!==n))})]),qw.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,t)=>{const o=e.components()[1],n=c(t);t?WF.grow(o):WF.shrink(o),bw.set(o,n)}})])}},rz=fl("tree-event-id"),sz=(e,t)=>{const o=e.onLeafAction.getOr(y),n=e.onToggleExpand.getOr(y),r=e.defaultExpandedIds,s=ga(r),a=ga(e.defaultSelectedId),i=fl("tree-id"),l=(n,r)=>e.items.map(e=>"leaf"===e.type?XF({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):nz({directory:e,selectedId:n,onLeafAction:o,expandedIds:r,labelTabstopping:!0,treeId:i,backstage:t}));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),s.get()),behaviours:Vu([nw.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),yw(rz,[Vi("expand-tree-node",(e,t)=>{const{expanded:o,node:r}=t.event;s.set(o?[...s.get(),r]:s.get().filter(e=>e!==r)),n(s.get(),{expanded:o,node:r})})]),Ku.config({channels:{["update-active-item-"+i]:{onReceive:(e,t)=>{a.set(R.some(t.value)),bw.set(e,l(R.some(t.value),s.get()))}}}}),bw.config({})])}},az=(e,t)=>{const o=e.stream.streams,n=o.setup(e,t);return Fi([Vi(e.event,n),Qi(()=>t.cancel())].concat(e.cancelEvent.map(e=>[Vi(e,()=>t.cancel())]).getOr([])))};var iz=Object.freeze({__proto__:null,events:az});const lz=e=>{const t=ga(null),o=()=>({timer:null!==t.get()?"set":"unset"}),n=e=>{t.set(e)},r=()=>{const e=t.get();null!==e&&e.cancel()};return Ll({readState:o,setTimer:n,cancel:r})},cz=e=>e.stream.streams.state(e);var dz=Object.freeze({__proto__:null,throttle:lz,init:cz});const uz=(e,t)=>{const o=e.stream,n=VP(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}};var mz=[Fs("stream",Rs("mode",{throttle:[Ls("delay"),na("stopEvent",!0),Hd("streams",{setup:uz,state:lz})]})),na("event","input"),Ks("cancelEvent"),zd("onStream")];const gz=Wu({fields:mz,name:"streaming",active:iz,state:dz}),pz=(e,t,o)=>{const n=_h.getValue(o);_h.setValue(t,n),hz(t)},fz=(e,t)=>{const o=e.element,n=Dc(o),r=o.dom;"number"!==no(o,"type")&&t(r,n)},hz=e=>{fz(e,(e,t)=>e.setSelectionRange(t.length,t.length))},bz=(e,t)=>{fz(e,(e,o)=>e.setSelectionRange(t,o.length))},vz=(e,t,o)=>{if(e.selectsOver){const n=_h.getValue(t),r=e.getDisplayText(n),s=_h.getValue(o),a=e.getDisplayText(s);return 0===a.indexOf(r)?R.some(()=>{pz(e,t,o),bz(t,r.length)}):R.none()}return R.none()},yz=S("alloy.typeahead.itemexecute"),xz=(e,t,o,n)=>{const r=(t,o,r)=>{e.previewing.set(!1);const s=gN.getCoupled(t,"sandbox");if(jf.isOpen(s))jb.getCurrent(s).each(e=>{Tv.getHighlighted(e).fold(()=>{r(e)},()=>{Li(s,e.element,"keydown",o)})});else{const o=e=>{jb.getCurrent(e).each(r)};ON(e,a(t),t,s,n,o,BC.HighlightMenuAndItem).get(y)}},s=tE(e),a=e=>t=>t.map(t=>{const o=Ce(t.menus),n=Q(o,e=>G(e.items,e=>"item"===e.type)),r=_h.getState(e);return r.update(V(n,e=>e.data)),t}),i=e=>jb.getCurrent(e),l="typeaheadevents",c=[Tw.config({}),_h.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>Dc(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{Ac(t.element,e.model.getDisplayText(o))},...e.initialData.map(e=>wa("initialValue",e)).getOr({})}}),gz.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const r=gN.getCoupled(t,"sandbox"),s=Tw.isFocused(t);if(s&&Dc(t.element).length>=e.minChars){const o=i(r).bind(e=>Tv.getHighlighted(e).map(_h.getValue));e.previewing.set(!0);const s=t=>{i(r).each(t=>{o.fold(()=>{e.model.selectsOver&&Tv.highlightFirst(t)},e=>{Tv.highlightBy(t,t=>{const o=_h.getValue(t);return o.value===e.value}),Tv.getHighlighted(t).orThunk(()=>(Tv.highlightFirst(t),R.none()))})})};ON(e,a(t),t,r,n,s,BC.HighlightJustMenu).get(y)}},cancelEvent:pi()}),nw.config({mode:"special",onDown:(e,t)=>(r(e,t,Tv.highlightFirst),R.some(!0)),onEscape:e=>{const t=gN.getCoupled(e,"sandbox");return jf.isOpen(t)?(jf.close(t),R.some(!0)):R.none()},onUp:(e,t)=>(r(e,t,Tv.highlightLast),R.some(!0)),onEnter:t=>{const o=gN.getCoupled(t,"sandbox"),n=jf.isOpen(o);if(n&&!e.previewing.get())return i(o).bind(e=>Tv.getHighlighted(e)).map(e=>(Ri(t,yz(),{item:e}),!0));{const r=_h.getValue(t);return Ni(t,pi()),e.onExecute(o,t,r),n&&jf.close(o),R.some(!0)}}}),qw.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),gN.config({others:{sandbox:t=>BN(e,t,{onOpen:()=>qw.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each(e=>ao(e.element,"aria-activedescendant")),qw.off(t)}})}}),yw(l,[Zi(t=>{e.lazyTypeaheadComp.set(R.some(t))}),Qi(t=>{e.lazyTypeaheadComp.set(R.none())}),tl(t=>{const o=y;DN(e,a(t),t,n,o,BC.HighlightMenuAndItem).get(y)}),Vi(yz(),(t,o)=>{const n=gN.getCoupled(t,"sandbox");pz(e.model,t,o.event.item),Ni(t,pi()),e.onItemExecute(t,n,o.event.item,_h.getValue(t)),jf.close(n),hz(t)})].concat(e.dismissOnBlur?[Vi(ai(),e=>{const t=gN.getCoupled(e,"sandbox");tm(t.element).isNone()&&jf.close(t)})]:[]))],d={[wi()]:[_h.name(),gz.name(),l],...e.eventOrder};return{uid:e.uid,dom:nE(Ar(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...s,...Th(e.typeaheadBehaviours,c)},eventOrder:d}},wz=S([Ks("lazySink"),Ls("fetch"),na("minChars",5),na("responseTime",1e3),Ld("onOpen"),na("getHotspot",R.some),na("getAnchorOverrides",S({})),na("layouts",R.none()),na("eventOrder",{}),ma("model",{},[na("getDisplayText",e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value),na("selectsOver",!0),na("populateFromBrowse",!0)]),Ld("onSetValue"),Fd("onExecute"),Ld("onItemExecute"),na("inputClasses",[]),na("inputAttributes",{}),na("inputStyles",{}),na("matchWidth",!0),na("useMinWidth",!1),na("dismissOnBlur",!0),Id(["openClass"]),Ks("initialData"),Eh("typeaheadBehaviours",[Tw,_h,gz,nw,qw,gN]),Is("lazyTypeaheadComp",()=>ga(R.none)),Is("previewing",()=>ga(!0))].concat(eE()).concat(IN())),Cz=S([sb({schema:[Md()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each(t=>{vz(e.model,t,n).fold(()=>{e.model.selectsOver?(Tv.dehighlight(o,n),e.previewing.set(!0)):e.previewing.set(!1)},t=>{t(),e.previewing.set(!1)})}):e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&pz(e.model,t,n),ro(n.element,"id").each(e=>to(t.element,"aria-activedescendant",e))})},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map(e=>(Ri(e,yz(),{item:o}),!0)),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&pz(e.model,t,o)})}})})]),Sz=Fb({name:"Typeahead",configFields:wz(),partFields:Cz(),factory:xz}),kz=e=>{const t=()=>kz(e.toCached()),o=t=>kz(e.bind(e=>e.fold(e=>wN.pure(ur.error(e)),e=>t(e)))),n=t=>kz(e.map(e=>e.bind(t))),r=t=>kz(e.map(e=>e.map(t))),s=t=>kz(e.map(e=>e.mapError(t))),a=(t,o)=>e.map(e=>e.fold(t,o)),i=(t,o)=>kz(wN.nu(n=>{let r=!1;const s=setTimeout(()=>{r=!0,n(ur.error(o()))},t);e.get(e=>{r||(clearTimeout(s),n(e))})}));return{...e,toCached:t,bindFuture:o,bindResult:n,mapResult:r,mapError:s,foldResult:a,withTimeout:i}},_z=e=>kz(wN.nu(e)),Ez=e=>kz(wN.pure(ur.value(e))),Oz=e=>kz(wN.pure(ur.error(e))),Tz=e=>kz(wN.pure(e)),Dz=e=>kz(e.map(ur.value)),Az=e=>_z(t=>{e.then(e=>{t(ur.value(e))},e=>{t(ur.error(e))})}),Nz={nu:_z,wrap:kz,pure:Ez,value:Ez,error:Oz,fromResult:Tz,fromFuture:Dz,fromPromise:Az},Rz=(e,t,o=[],n,r,s)=>{const a=t.fold(()=>({}),e=>({action:e})),i={buttonBehaviours:Vu([xT.button(()=>!e.enabled||s.isDisabled()),fT(),WR.config({}),yw("button press",[Hi("click"),Hi("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...a},l=Ar(i,{dom:n});return Ar(l,{components:r})},Bz=(e,t,o,n=[])=>{const r=e.tooltip.map(e=>({"aria-label":o.translate(e),title:o.translate(e)})).getOr({}),s={tag:"button",classes:["tox-tbtn"],attributes:r},a=e.icon.map(e=>EL(e,o.icons)),i=ET([a]);return Rz(e,t,n,s,i,o)},Mz=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];case"secondary":default:return["tox-button","tox-button--secondary"]}},Iz=(e,t,o,n=[],r=[])=>{const s=o.translate(e.text),a=e.icon.map(e=>EL(e,o.icons)),i=[a.getOrThunk(()=>Jc(s))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c=Mz(l),d=[...c,...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...r],u={tag:"button",classes:d,attributes:{title:s}};return Rz(e,t,n,u,i,o)},Pz=(e,t,o,n=[],r=[])=>{const s=Iz(e,R.some(t),o,n,r);return $C.sketch(s)},Lz=(e,t)=>o=>{"custom"===t?Ri(o,tB,{name:e,value:{}}):"submit"===t?Ni(o,oB):"cancel"===t?Ni(o,eB):console.error("Unknown button type: ",t)},Fz=(e,t)=>"menu"===t,zz=(e,t)=>"custom"===t||"cancel"===t||"submit"===t,Uz=(e,t)=>"togglebutton"===t,Hz=(e,t)=>{var o,n;const r=e.icon.map(e=>OL(e,t.icons)).map(YC),s=o=>{Ri(o,tB,{name:e.name,value:{setIcon:e=>{r.map(n=>n.getOpt(o).each(o=>{bw.set(o,[OL(e,t.icons)])}))}}})},a=e.buttonType.getOr(e.primary?"primary":"secondary"),i={...e,name:null!==(o=e.name)&&void 0!==o?o:"",primary:"primary"===a,tooltip:R.from(e.tooltip),enabled:null!==(n=e.enabled)&&void 0!==n&&n,borderless:!1},l=i.tooltip.map(e=>({"aria-label":t.translate(e),title:t.translate(e)})).getOr({}),c=Mz(null!==a&&void 0!==a?a:"secondary"),d=e.icon.isSome()&&e.text.isSome(),u={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:l},m=[],g=t.translate(e.text.getOr("")),p=Jc(g),f=ET([r.map(e=>e.asSpec())]),h=[...f,...e.text.isSome()?[p]:[]],b=Rz(i,R.some(s),m,u,h,t);return $C.sketch(b)},Vz=(e,t,o)=>{if(Fz(e,t)){const t=()=>s,n=e,r={...e,type:"menubutton",search:R.none(),onSetup:t=>(t.setEnabled(e.enabled),y),fetch:qF(n.items,t,o)},s=YC(GF(r,"tox-tbtn",o,R.none()));return s.asSpec()}if(zz(e,t)){const n=Lz(e.name,t),r={...e,borderless:!1};return Pz(r,n,o.shared.providers,[])}if(Uz(e,t))return Hz(e,o.shared.providers);throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},jz=(e,t)=>{const o=Lz(e.name,"custom");return qR(R.none(),UR.parts.field({factory:$C,...Iz(e,R.some(o),t,[DP(""),SP.self()])}))},Wz={type:"separator"},$z=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:y}),Gz=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:y}),qz=e=>V(e,$z),Kz=(e,t)=>G(t,t=>t.type===e),Yz=(e,t)=>qz(Kz(e,t)),Xz=e=>Yz("header",e.targets),Jz=e=>Yz("anchor",e.targets),Zz=e=>R.from(e.anchorTop).map(e=>Gz("",e)).toArray(),Qz=e=>R.from(e.anchorBottom).map(e=>Gz("",e)).toArray(),eU=e=>V(e,e=>Gz(e,e)),tU=e=>K(e,(e,t)=>{const o=0===e.length||0===t.length;return o?e.concat(t):e.concat(Wz,t)},[]),oU=(e,t)=>{const o=e.toLowerCase();return G(t,e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,r=null!==(t=e.value)&&void 0!==t?t:"";return ze(n.toLowerCase(),o)||ze(r.toLowerCase(),o)})},nU=(e,t,o)=>{var n,r;const s=_h.getValue(t),a=null!==(r=null===(n=null===s||void 0===s?void 0:s.meta)||void 0===n?void 0:n.text)&&void 0!==r?r:s.value,i=o.getLinkInformation();return i.fold(()=>[],t=>{const n=oU(a,eU(o.getHistory(e)));return"file"===e?tU([n,oU(a,Xz(t)),oU(a,Z([Zz(t),Jz(t),Qz(t)]))]):n})},rU=fl("aria-invalid"),sU=(e,t,o,n)=>{const r=t.shared.providers,s=t=>{const n=_h.getValue(t);o.addToHistory(n.value,e.filetype)},a={...n.map(e=>({initialData:e})).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":rU,type:"url"},minChars:0,responseTime:0,fetch:n=>{const r=nU(e.filetype,n,o),s=VL(r,E_.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:R.none()});return wN.pure(s)},getHotspot:e=>p.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(yB)&&yB.run(e).get(y)},typeaheadBehaviours:Vu([...o.getValidationHandler().map(t=>yB.config({getRoot:e=>Rt(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{d.getOpt(e).each(e=>{to(e.element,"title",r.translate(t))})}},validator:{validate:o=>{const n=_h.getValue(o);return Nz.nu(o=>{t({type:e.filetype,url:n.value},e=>{if("invalid"===e.status){const t=ur.error(e.message);o(t)}else{const t=ur.value(e.message);o(t)}})})},validateOnLoad:!1}})).toArray(),lv.config({disabled:()=>!e.enabled||r.isDisabled()}),WR.config({}),yw("urlinput-events",[Vi(Xa(),t=>{const o=Dc(t.element),n=o.trim();n!==o&&Ac(t.element,n),"file"===e.filetype&&Ri(t,ZR,{name:e.name})}),Vi(Ja(),t=>{Ri(t,ZR,{name:e.name}),s(t)}),Vi(ii(),t=>{Ri(t,ZR,{name:e.name}),s(t)})])]),eventOrder:{[Xa()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:Q_(!1,1,"normal")},onExecute:(e,t,o)=>{Ri(t,oB,{})},onItemExecute:(t,o,n,r)=>{s(t),Ri(t,ZR,{name:e.name})}},i=UR.parts.field({...a,factory:Sz}),l=e.label.map(e=>JR(e,r)),c=(e,t,o=e,n=e)=>sk(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:r.translate(n),"aria-live":"polite",...t.fold(()=>({}),e=>({id:e}))}},r.icons),d=YC(c("invalid",R.some(rU),"warning")),u=YC({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),m=o.getUrlPicker(e.filetype),g=fl("browser.url.event"),p=YC({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,u.asSpec()],behaviours:Vu([lv.config({disabled:()=>!e.enabled||r.isDisabled()})])}),f=YC(Pz({name:e.name,icon:R.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:R.none(),borderless:!0},e=>Ni(e,g),r,[],["tox-browse-url"])),h=()=>({dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:Z([[p.asSpec()],m.map(()=>f.asSpec()).toArray()])}),b=t=>{jb.getCurrent(t).each(o=>{const n=_h.getValue(o),r={fieldname:e.name,...n};m.each(n=>{n(r).get(n=>{_h.setValue(o,n),Ri(t,ZR,{name:e.name})})})})};return UR.sketch({dom:YR(),components:l.toArray().concat([h()]),fieldBehaviours:Vu([lv.config({disabled:()=>!e.enabled||r.isDisabled(),onDisabled:e=>{UR.getField(e).each(lv.disable),f.getOpt(e).each(lv.disable)},onEnabled:e=>{UR.getField(e).each(lv.enable),f.getOpt(e).each(lv.enable)}}),fT(),yw("url-input-events",[Vi(g,b)])])})},aU=(e,t)=>{const o=ek(e.icon,t.icons);return MR.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in","tox-notification--"+e.level]},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:e.url?void 0:o},components:e.url?[$C.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>Ri(t,tB,{name:"alert-banner",value:e.url}),buttonBehaviours:Vu([nk()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})},iU=(e,t)=>{e.dom.checked=t},lU=e=>e.dom.checked,cU=(e,t,o)=>{const n=e=>(e.element.dom.click(),R.some(!0)),r=UR.parts.field({factory:{sketch:k},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:Vu([SP.self(),lv.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{Rt(e.element).each(e=>vc(e,"tox-checkbox--disabled"))},onEnabled:e=>{Rt(e.element).each(e=>xc(e,"tox-checkbox--disabled"))}}),WR.config({}),Tw.config({}),OP(o,lU,iU),nw.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),yw("checkbox-events",[Vi(Ja(),(t,o)=>{Ri(t,ZR,{name:e.name})})])])}),s=UR.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[Jc(t.translate(e.label))],behaviours:Vu([SB.config({})])}),a=e=>{const o="checked"===e?"selected":"unselected";return sk(o,{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons)},i=YC({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return UR.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[r,i.asSpec(),s],fieldBehaviours:Vu([lv.config({disabled:()=>!e.enabled||t.isDisabled()}),fT()])})},dU=e=>"presentation"===e.presets?MR.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html}}):MR.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:Vu([WR.config({}),Tw.config({})])}),uU=e=>(t,o,n,r)=>Se(o,"name").fold(()=>e(o,r,R.none()),s=>t.field(s,e(o,r,Se(n,s)))),mU=e=>(t,o,n,r)=>{const s=Ar(o,{source:"dynamic"});return uU(e)(t,s,n,r)},gU={bar:uU((e,t)=>PR(e,t.shared)),collection:uU((e,t,o)=>iB(e,t.shared.providers,o)),alertbanner:uU((e,t)=>aU(e,t.shared.providers)),input:uU((e,t,o)=>pF(e,t.shared.providers,o)),textarea:uU((e,t,o)=>fF(e,t.shared.providers,o)),label:uU((e,t)=>yL(e,t.shared)),iframe:mU((e,t,o)=>pL(e,t.shared.providers,o)),button:uU((e,t)=>jz(e,t.shared.providers)),checkbox:uU((e,t,o)=>cU(e,t.shared.providers,o)),colorinput:uU((e,t,o)=>TB(e,t.shared,t.colorinput,o)),colorpicker:uU((e,t,o)=>RP(e,t.shared.providers,o)),dropzone:uU((e,t,o)=>FP(e,t.shared.providers,o)),grid:uU((e,t)=>zP(e,t.shared)),listbox:uU((e,t,o)=>qL(e,t,o)),selectbox:uU((e,t,o)=>JL(e,t.shared.providers,o)),sizeinput:uU((e,t)=>dF(e,t.shared.providers)),slider:uU((e,t,o)=>uF(e,t.shared.providers,o)),urlinput:uU((e,t,o)=>sU(e,t,t.urlinput,o)),customeditor:uU(IP),htmlpanel:uU(dU),imagepreview:uU((e,t,o)=>vL(e,o)),table:uU((e,t)=>mF(e,t.shared.providers)),tree:uU((e,t)=>sz(e,t)),panel:uU((e,t)=>KL(e,t))},pU={field:(e,t)=>t,record:S([])},fU=(e,t,o,n)=>{const r=Ar(n,{shared:{interpreter:t=>hU(e,t,o,r)}});return hU(e,t,o,r)},hU=(e,t,o,n)=>Se(gU,t.type).fold(()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t),r=>r(e,t,o,n)),bU=(e,t,o)=>hU(pU,e,t,o),vU="layout-inset",yU=e=>e.x,xU=(e,t)=>e.x+e.width/2-t.width/2,wU=(e,t)=>e.x+e.width-t.width,CU=e=>e.y,SU=(e,t)=>e.y+e.height-t.height,kU=(e,t)=>e.y+e.height/2-t.height/2,_U=(e,t,o)=>Wd(wU(e,t),SU(e,t),o.insetSouthwest(),Zd(),"southwest",au(e,{right:0,bottom:3}),vU),EU=(e,t,o)=>Wd(yU(e),SU(e,t),o.insetSoutheast(),Jd(),"southeast",au(e,{left:1,bottom:3}),vU),OU=(e,t,o)=>Wd(wU(e,t),CU(e),o.insetNorthwest(),Xd(),"northwest",au(e,{right:0,top:2}),vU),TU=(e,t,o)=>Wd(yU(e),CU(e),o.insetNortheast(),Yd(),"northeast",au(e,{left:1,top:2}),vU),DU=(e,t,o)=>Wd(xU(e,t),CU(e),o.insetNorth(),Qd(),"north",au(e,{top:2}),vU),AU=(e,t,o)=>Wd(xU(e,t),SU(e,t),o.insetSouth(),eu(),"south",au(e,{bottom:3}),vU),NU=(e,t,o)=>Wd(wU(e,t),kU(e,t),o.insetEast(),ou(),"east",au(e,{right:0}),vU),RU=(e,t,o)=>Wd(yU(e),kU(e,t),o.insetWest(),tu(),"west",au(e,{left:1}),vU),BU=e=>{switch(e){case"north":return DU;case"northeast":return TU;case"northwest":return OU;case"south":return AU;case"southeast":return EU;case"southwest":return _U;case"east":return NU;case"west":return RU}},MU=(e,t,o,n,r)=>{const s=ym(n).map(BU).getOr(DU);return s(e,t,o,n,r)},IU=e=>{switch(e){case"north":return AU;case"northeast":return EU;case"northwest":return _U;case"south":return DU;case"southeast":return TU;case"southwest":return OU;case"east":return RU;case"west":return NU}},PU=(e,t,o,n,r)=>{const s=ym(n).map(IU).getOr(DU);return s(e,t,o,n,r)},LU={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},FU=(e,t,o)=>{const n=12,r={maxHeightFunction:Qm()},s=()=>({type:"node",root:$t(Wt(e())),node:R.from(e()),bubble:rg(n,n,LU),layouts:{onRtl:()=>[TU],onLtr:()=>[OU]},overrides:r}),a=()=>({type:"hotspot",hotspot:t(),bubble:rg(-n,n,LU),layouts:{onRtl:()=>[bu,vu,Cu],onLtr:()=>[vu,bu,Cu]},overrides:r});return()=>o()?s():a()},zU=(e,t,o,n)=>{const r=12,s={maxHeightFunction:Qm()},a=()=>({type:"node",root:$t(Wt(t())),node:R.from(t()),bubble:rg(r,r,LU),layouts:{onRtl:()=>[DU],onLtr:()=>[DU]},overrides:s}),i=()=>e?{type:"node",root:$t(Wt(t())),node:R.from(t()),bubble:rg(0,-ko(t()),LU),layouts:{onRtl:()=>[wu],onLtr:()=>[wu]},overrides:s}:{type:"hotspot",hotspot:o(),bubble:rg(0,0,LU),layouts:{onRtl:()=>[wu],onLtr:()=>[wu]},overrides:s};return()=>n()?a():i()},UU=(e,t,o)=>{const n=()=>({type:"node",root:$t(Wt(e())),node:R.from(e()),layouts:{onRtl:()=>[DU],onLtr:()=>[DU]}}),r=()=>({type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[Cu],onLtr:()=>[Cu]}});return()=>o()?n():r()},HU=(e,t)=>()=>({type:"selection",root:t(),getSelection:()=>{const t=e.selection.getRng(),o=e.model.table.getSelectedCells();if(o.length>1){const e=o[0],t=o[o.length-1],n={firstCell:Ze.fromDom(e),lastCell:Ze.fromDom(t)};return R.some(n)}return R.some(Jg.range(Ze.fromDom(t.startContainer),t.startOffset,Ze.fromDom(t.endContainer),t.endOffset))}}),VU=e=>t=>({type:"node",root:e(),node:t}),jU=(e,t,o,n)=>{const r=g_(e),s=()=>Ze.fromDom(e.getBody()),a=()=>Ze.fromDom(e.getContentAreaContainer()),i=()=>r||!n();return{inlineDialog:FU(a,t,i),inlineBottomDialog:zU(e.inline,a,o,i),banner:UU(a,t,i),cursor:HU(e,s),node:VU(s)}},WU=e=>(t,o)=>{const n=NA(e);n(t,o)},$U=e=>()=>uA(e),GU=e=>t=>iA(e,t),qU=e=>t=>dA(e,t),KU=e=>({colorPicker:WU(e),hasCustomColors:$U(e),getColors:GU(e),getColorCols:qU(e)}),YU=e=>()=>qk(e),XU=e=>({isDraggableModal:YU(e)}),JU=e=>{const t=ga(u_(e)?"bottom":"top");return{isPositionedAtTop:()=>"top"===t.get(),getDockingMode:t.get,setDockingMode:t.set}},ZU=e=>_e(e,"items"),QU=e=>_e(e,"format"),eH=[{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"}]}],tH=e=>ke(e,"items"),oH=e=>ke(e,"block"),nH=e=>ke(e,"inline"),rH=e=>ke(e,"selector"),sH=e=>K(e,(e,t)=>{if(tH(t)){const o=sH(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(nH(t)||oH(t)||rH(t)){const o=i(t.name)?t.name:t.title.toLowerCase(),n="custom-"+o;return{customFormats:e.customFormats.concat([{name:n,format:t}]),formats:e.formats.concat([{title:t.title,format:n,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}},{customFormats:[],formats:[]}),aH=(e,t)=>{const o=sH(t),n=t=>{j(t,t=>{e.formatter.has(t.name)||e.formatter.register(t.name,t.format)})};return e.formatter?n(o.customFormats):e.on("init",()=>{n(o.customFormats)}),o.formats},iH=e=>Ek(e).map(t=>{const o=aH(e,t);return Ok(e)?eH.concat(o):o}).getOr(eH),lH=e=>{const t=ue(e);return 1===t.length&&F(t,"title")},cH=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),dH=(e,t,o,n)=>{const r=e=>cH(e,o,n),s=e=>{const t=l(e.items);return{...e,type:"submenu",getStyleItems:S(t)}},a=t=>{const r=i(t.name)?t.name:fl(t.title),s="custom-"+r,a={...t,type:"formatter",format:s,isSelected:o(s),getStylePreview:n(s)};return e.formatter.register(r,a),a},l=e=>V(e,e=>ZU(e)?s(e):QU(e)?r(e):lH(e)?{...e,type:"separator"}:a(e));return l(t)},uH=e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?R.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):R.none()},n=ga([]),r=ga([]),s=ga(!1);e.on("PreInit",r=>{const s=iH(e),a=dH(e,s,t,o);n.set(a)}),e.on("addStyleModifications",n=>{const a=dH(e,n.items,t,o);r.set(a),s.set(n.replace)});const a=()=>{const e=s.get()?[]:n.get(),t=r.get();return e.concat(t)};return{getData:a}},mH=e=>f(e)&&1===e.nodeType,gH=PP.trim,pH=e=>t=>{if(mH(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},fH=pH("true"),hH=pH("false"),bH=(e,t,o,n,r)=>({type:e,title:t,url:o,level:n,attach:r}),vH=e=>{let t=e;while(t=t.parentNode){const e=t.contentEditable;if(e&&"inherit"!==e)return fH(t)}return!1},yH=(e,t)=>V(mp(Ze.fromDom(t),e),e=>e.dom),xH=e=>e.innerText||e.textContent,wH=e=>e.id?e.id:fl("h"),CH=e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name),SH=e=>CH(e)&&_H(e),kH=e=>e&&/^(H[1-6])$/.test(e.nodeName),_H=e=>vH(e)&&!hH(e),EH=e=>kH(e)&&_H(e),OH=e=>kH(e)?parseInt(e.nodeName.substr(1),10):0,TH=e=>{var t;const o=wH(e),n=()=>{e.id=o};return bH("header",null!==(t=xH(e))&&void 0!==t?t:"","#"+o,OH(e),n)},DH=e=>{const t=e.id||e.name,o=xH(e);return bH("anchor",o||"#"+t,"#"+t,0,y)},AH=e=>V(G(e,EH),TH),NH=e=>V(G(e,SH),DH),RH=e=>{const t=yH("h1,h2,h3,h4,h5,h6,a:not([href])",e);return t},BH=e=>gH(e.title).length>0,MH=e=>{const t=RH(e);return G(AH(t).concat(NH(t)),BH)},IH={find:MH},PH="tinymce-url-history",LH=5,FH=e=>i(e)&&/^https?/.test(e),zH=e=>d(e)&&e.length<=LH&&ee(e,FH),UH=e=>l(e)&&we(e,e=>!zH(e)).isNone(),HH=()=>{const e=jD.getItem(PH);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(o){if(o instanceof SyntaxError)return console.log("Local storage "+PH+" was not valid JSON",o),{};throw o}return UH(t)?t:(console.log("Local storage "+PH+" was not valid format",t),{})},VH=e=>{if(!UH(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));jD.setItem(PH,JSON.stringify(e))},jH=e=>{const t=HH();return Se(t,e).getOr([])},WH=(e,t)=>{if(!FH(e))return;const o=HH(),n=Se(o,t).getOr([]),r=G(n,t=>t!==e);o[t]=[e].concat(r).slice(0,LH),VH(o)},$H=e=>!!e,GH=e=>pe(PP.makeMap(e,/[, ]/),$H),qH=e=>R.from(Uk(e)),KH=e=>{const t=R.from(jk(e)).filter($H).map(GH);return qH(e).fold(A,e=>t.fold(N,e=>ue(e).length>0&&e))},YH=(e,t)=>{const o=KH(e);return m(o)?o?qH(e):R.none():o[t]?qH(e):R.none()},XH=(e,t)=>YH(e,t).map(o=>n=>wN.nu(r=>{const s=(e,t)=>{if(!i(e))throw new Error("Expected value to be string");if(void 0!==t&&!l(t))throw new Error("Expected meta to be a object");const o={value:e,meta:t};r(o)},a={filetype:t,fieldname:n.fieldname,...R.from(n.meta).getOr({})};o.call(e,s,n.value,a)})),JH=e=>R.from(e).filter(i).getOrUndefined(),ZH=e=>Wk(e)?R.some({targets:IH.find(e.getBody()),anchorTop:JH($k(e)),anchorBottom:JH(Gk(e))}):R.none(),QH=e=>R.from(Hk(e)),eV=e=>({getHistory:jH,addToHistory:WH,getLinkInformation:()=>ZH(e),getValidationHandler:()=>QH(e),getUrlPicker:t=>XH(e,t)}),tV=(e,t,o,n)=>{const r=ga(!1),s=JU(t),a={icons:()=>t.ui.registry.getAll().icons,menuItems:()=>t.ui.registry.getAll().menuItems,translate:KS.translate,isDisabled:()=>t.mode.isReadOnly()||!t.ui.isEnabled(),getOption:t.options.get},i=eV(t),l=uH(t),c=KU(t),d=XU(t),u=()=>r.get(),m=e=>r.set(e),g={shared:{providers:a,anchors:jU(t,o,n,s.isPositionedAtTop),header:s},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:u,setContextMenuState:m},p={...g,shared:{...g.shared,interpreter:e=>bU(e,{},p),getSink:e.popup}},f={...g,shared:{...g.shared,interpreter:e=>bU(e,{},f),getSink:e.dialog}};return{popup:p,dialog:f}},oV=(e,t,o)=>{const n=(e,n)=>{j([t,...o],t=>{t.broadcastEvent(e,n)})},r=(e,n)=>{j([t,...o],t=>{t.broadcastOn([e],n)})},s=e=>r(Wf(),{target:e.target}),a=Gn(),i=Rm(a,"touchstart",s),l=Rm(a,"touchmove",e=>n(hi(),e)),c=Rm(a,"touchend",e=>n(bi(),e)),d=Rm(a,"mousedown",s),u=Rm(a,"mouseup",e=>{0===e.raw.button&&r(Gf(),{target:e.target})}),m=e=>r(Wf(),{target:Ze.fromDom(e.target)}),g=e=>{0===e.button&&r(Gf(),{target:Ze.fromDom(e.target)})},p=()=>{j(e.editorManager.get(),t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})})},f=e=>n(vi(),Mm(e)),h=e=>{r($f(),{}),n(yi(),Mm(e))},b=Wt(Ze.fromDom(e.getElement())),v=Bm(b,"scroll",o=>{requestAnimationFrame(()=>{const r=e.getContainer();if(void 0!==r&&null!==r){const r=lR(e,t.element),s=r.map(e=>[e.element,...e.others]).getOr([]);z(s,e=>kt(e,o.target))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Ei(),o))}})}),y=()=>r($f(),{}),x=t=>{t.state&&r(Wf(),{target:Ze.fromDom(e.getContainer())})},w=e=>{r(Wf(),{target:Ze.fromDom(e.relatedTarget.getContainer())})};e.on("PostRender",()=>{e.on("click",m),e.on("tap",m),e.on("mouseup",g),e.on("mousedown",p),e.on("ScrollWindow",f),e.on("ResizeWindow",h),e.on("ResizeEditor",y),e.on("AfterProgressState",x),e.on("DismissPopups",w)}),e.on("remove",()=>{e.off("click",m),e.off("tap",m),e.off("mouseup",g),e.off("mousedown",p),e.off("ScrollWindow",f),e.off("ResizeWindow",h),e.off("ResizeEditor",y),e.off("AfterProgressState",x),e.off("DismissPopups",w),d.unbind(),i.unbind(),l.unbind(),c.unbind(),u.unbind(),v.unbind()}),e.on("detach",()=>{j([t,...o],Sf),j([t,...o],e=>e.destroy())})},nV=Ob,rV=cb,sV=S([na("shell",!1),Ls("makeItem"),na("setupItem",y),Dh.field("listBehaviours",[bw])]),aV=()=>({behaviours:Vu([bw.config({})])}),iV=ab({name:"items",overrides:aV}),lV=S([iV]),cV=S("CustomList"),dV=(e,t,o,n)=>{const r=(t,o)=>{a(t).fold(()=>{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")},n=>{const r=bw.contents(n),s=o.length,a=s-r.length,i=a>0?U(a,()=>e.makeItem()):[],l=r.slice(s);j(l,e=>bw.remove(n,e)),j(i,e=>bw.append(n,e));const c=bw.contents(n);j(c,(n,r)=>{e.setupItem(t,n,o[r],r)})})},s=e.shell?{behaviours:[bw.config({})],components:[]}:{behaviours:[],components:t},a=t=>e.shell?R.some(t):yb(t,e,"items");return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Th(e.listBehaviours,s.behaviours),apis:{setItems:r}}},uV=Fb({name:cV(),configFields:sV(),partFields:lV(),factory:dV,apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),mV=S([Ls("dom"),na("shell",!0),Eh("toolbarBehaviours",[bw])]),gV=()=>({behaviours:Vu([bw.config({})])}),pV=S([ab({name:"groups",overrides:gV})]),fV=(e,t,o,n)=>{const r=(e,t)=>{s(e).fold(()=>{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")},e=>{bw.set(e,t)})},s=t=>e.shell?R.some(t):yb(t,e,"groups"),a=e.shell?{behaviours:[bw.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:a.components,behaviours:Th(e.toolbarBehaviours,a.behaviours),apis:{setGroups:r,refresh:y},domModification:{attributes:{role:"group"}}}},hV=Fb({name:"Toolbar",configFields:mV(),partFields:pV(),factory:fV,apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),bV=y,vV=A,yV=S([]);var xV=Object.freeze({__proto__:null,setup:bV,isDocked:vV,getBehaviours:yV});const wV=e=>{const t=Ee(ho(e,"position"),"fixed"),o=t?R.none():Mt(e);return o.orThunk(()=>{const t=Ze.fromTag("span");return At(e).bind(e=>{Pn(e,t);const o=Mt(t);return Un(t),o})})},CV=e=>wV(e).map(Ao).getOrThunk(()=>Oo(0,0)),SV=(e,t)=>{const o=e.element;vc(o,t.transitionClass),xc(o,t.fadeOutClass),vc(o,t.fadeInClass),t.onShow(e)},kV=(e,t)=>{const o=e.element;vc(o,t.transitionClass),xc(o,t.fadeInClass),vc(o,t.fadeOutClass),t.onHide(e)},_V=(e,t)=>e.yt.y,EV=(e,t)=>e.y>=t.y,OV=(e,t)=>e.bottom<=t.bottom,TV=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),DV=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),AV=e=>e.box.x-e.win.x,NV=(e,t,o)=>{const n=t.win,r=t.box,s=AV(t);return de(e,e=>{switch(e){case"bottom":return OV(r,o.bounds)?R.none():R.some(DV(n,s,o));case"top":return EV(r,o.bounds)?R.none():R.some(TV(n,s,o));default:return R.none()}}).getOr({location:"no-dock"})},RV=(e,t,o)=>ee(e,e=>{switch(e){case"bottom":return OV(t,o.bounds);case"top":return EV(t,o.bounds)}}),BV=(e,t)=>{const o=t.optScrollEnv.fold(S(e.bounds.y),t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop));return Oo(e.bounds.x,o)},MV=(e,t)=>{const o=t.optScrollEnv.fold(S(e.y),t=>e.y+t.currentScrollTop-t.scrollElmTop);return Oo(e.x,o)},IV=(e,t,o)=>o.getInitialPos().map(o=>{const n=BV(o,t);return{box:tr(n.left,n.top,Mo(e),So(e)),location:o.location}}),PV=(e,t,o,n,r)=>{const s=MV(t,o),a=tr(s.left,s.top,t.width,t.height);n.setInitialPos({style:bo(e),position:po(e,"position")||"static",bounds:a,location:r.location})},LV=(e,t,o,n,r)=>{n.getInitialPos().fold(()=>PV(e,t,o,n,r),()=>y)},FV=(e,t,o)=>o.getInitialPos().bind(n=>{var r;switch(o.clearInitialPos(),n.position){case"static":return R.some({morph:"static"});case"absolute":const o=wV(e).getOr(Zt()),s=or(o),a=null!==(r=o.dom.scrollTop)&&void 0!==r?r:0;return R.some({morph:"absolute",positionCss:nm("absolute",Se(n.style,"left").map(e=>t.x-s.x),Se(n.style,"top").map(e=>t.y-s.y+a),Se(n.style,"right").map(e=>s.right-t.right),Se(n.style,"bottom").map(e=>s.bottom-t.bottom))});default:return R.none()}}),zV=(e,t,o)=>IV(e,t,o).filter(({box:e})=>RV(o.getModes(),e,t)).bind(({box:t})=>FV(e,t,o)),UV=e=>{switch(e.location){case"top":return R.some({morph:"fixed",positionCss:nm("fixed",R.some(e.leftX),R.some(e.topY),R.none(),R.none())});case"bottom":return R.some({morph:"fixed",positionCss:nm("fixed",R.some(e.leftX),R.none(),R.none(),R.some(e.bottomY))});default:return R.none()}},HV=(e,t,o)=>{const n=or(e),r=ar(),s=NV(o.getModes(),{win:r,box:n},t);return"top"===s.location||"bottom"===s.location?(PV(e,n,t,o,s),UV(s)):R.none()},VV=(e,t,o)=>zV(e,t,o).orThunk(()=>t.optScrollEnv.bind(n=>IV(e,t,o)).bind(({box:e,location:o})=>{const n=ar(),r=AV({win:n,box:e}),s="top"===o?TV(n,r,t):DV(n,r,t);return UV(s)})),jV=(e,t,o)=>{const n=e.element,r=Ee(ho(n,"position"),"fixed");return r?VV(n,t,o):HV(n,t,o)},WV=(e,t,o)=>{const n=e.element;return IV(n,t,o).bind(({box:e})=>FV(n,e,o))},$V=(e,t,o,n)=>{const r=or(e),s=ar(),a=AV({win:s,box:r}),i=n(s,a,t);return"bottom"===i.location||"top"===i.location?(LV(e,r,t,o,i),UV(i)):R.none()},GV=(e,t,o)=>{o.setDocked(!1),j(["left","right","top","bottom","position"],t=>yo(e.element,t)),t.onUndocked(e)},qV=(e,t,o,n)=>{const r="fixed"===n.position;o.setDocked(r),sm(e.element,n);const s=r?t.onDocked:t.onUndocked;s(e)},KV=(e,t,o,n,r=!1)=>{t.contextual.each(t=>{t.lazyContext(e).each(s=>{const a=_V(s,n.bounds);if(a!==o.isVisible())if(o.setVisible(a),r&&!a)Sc(e.element,[t.fadeOutClass]),t.onHide(e);else{const o=a?SV:kV;o(e,t)}})})},YV=(e,t,o,n,r)=>{KV(e,t,o,n,!0),qV(e,t,o,r.positionCss)},XV=(e,t,o,n,r)=>{switch(r.morph){case"static":return GV(e,t,o);case"absolute":return qV(e,t,o,r.positionCss);case"fixed":return YV(e,t,o,n,r)}},JV=(e,t,o)=>{const n=t.lazyViewport(e);KV(e,t,o,n),jV(e,n,o).each(r=>{XV(e,t,o,n,r)})},ZV=(e,t,o)=>{const n=e.element;o.setDocked(!1);const r=t.lazyViewport(e);WV(e,r,o).each(n=>{switch(n.morph){case"static":GV(e,t,o);break;case"absolute":qV(e,t,o,n.positionCss);break}}),o.setVisible(!0),t.contextual.each(t=>{kc(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)}),QV(e,t,o)},QV=(e,t,o)=>{e.getSystem().isConnected()&&JV(e,t,o)},ej=(e,t,o)=>{o.isDocked()&&ZV(e,t,o)},tj=e=>(t,o,n)=>{const r=o.lazyViewport(t),s=$V(t.element,r,n,e);s.each(e=>{YV(t,o,n,r,e)})},oj=tj(TV),nj=tj(DV),rj=(e,t,o)=>o.isDocked(),sj=(e,t,o,n)=>o.setModes(n),aj=(e,t,o)=>o.getModes();var ij=Object.freeze({__proto__:null,refresh:QV,reset:ej,isDocked:rj,getModes:aj,setModes:sj,forceDockToTop:oj,forceDockToBottom:nj});const lj=(e,t)=>Fi([Ji(ei(),(o,n)=>{e.contextual.each(e=>{if(Cc(o.element,e.transitionClass)){kc(o.element,[e.transitionClass,e.fadeInClass]);const n=t.isVisible()?e.onShown:e.onHidden;n(o)}n.stop()})}),Vi(vi(),(o,n)=>{QV(o,e,t)}),Vi(Ei(),(o,n)=>{QV(o,e,t)}),Vi(yi(),(o,n)=>{ej(o,e,t)})]);var cj=Object.freeze({__proto__:null,events:lj}),dj=[ta("contextual",[Us("fadeInClass"),Us("fadeOutClass"),Us("transitionClass"),js("lazyContext"),Ld("onShow"),Ld("onShown"),Ld("onHide"),Ld("onHidden")]),ca("lazyViewport",()=>({bounds:ar(),optScrollEnv:R.none()})),ua("modes",["top","bottom"],bs),Ld("onDocked"),Ld("onUndocked")];const uj=e=>{const t=ga(!1),o=ga(!0),n=Am(),r=ga(e.modes),s=()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${r.get().join(",")}`;return Ll({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:r.get,setModes:r.set,readState:s})};var mj=Object.freeze({__proto__:null,init:uj});const gj=Wu({fields:dj,name:"docking",active:cj,apis:ij,state:mj}),pj=S(fl("toolbar-height-change")),fj={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},hj="tox-tinymce--toolbar-sticky-on",bj="tox-tinymce--toolbar-sticky-off",vj=(e,t)=>{const o=Et(t),n=Dt(t),r=n.dom.innerHeight,s=Hn(o),a=Ze.fromDom(e.elm),i=nr(a),l=So(a),c=i.y,d=c+l,u=Ao(t),m=So(t),g=u.top,p=g+m,f=Math.abs(g-s.top)<2,h=Math.abs(p-(s.top+r))<2;if(f&&cg){const e=c-r+l+m;Vn(s.left,e,o)}},yj=(e,t)=>F(gj.getModes(e),t),xj=e=>{const t=e=>ko(e)+(parseInt(po(e,"margin-top"),10)||0)+(parseInt(po(e,"margin-bottom"),10)||0),o=e.element;Rt(o).each(n=>{const r="padding-"+gj.getModes(e)[0];if(gj.isDocked(e)){const e=Mo(n);uo(o,"width",e+"px"),uo(n,r,t(o)+"px")}else yo(o,"width"),yo(n,r)})},wj=(e,t)=>{t?(xc(e,fj.fadeOutClass),Sc(e,[fj.transitionClass,fj.fadeInClass])):(xc(e,fj.fadeInClass),Sc(e,[fj.fadeOutClass,fj.transitionClass]))},Cj=(e,t)=>{const o=Ze.fromDom(e.getContainer());t?(vc(o,hj),xc(o,bj)):(vc(o,bj),xc(o,hj))},Sj=(e,t)=>{const o=Et(t);em(o).filter(e=>!kt(t,e)).filter(t=>kt(t,Ze.fromDom(o.dom.body))||_t(e,t)).each(()=>Ju(t))},kj=(e,t)=>tm(e).orThunk(()=>t().toOptional().bind(e=>tm(e.element))),_j=(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",()=>{o().each(gj.reset)}),e.on("ResizeWindow ResizeEditor",()=>{o().each(xj)}),e.on("SkinLoaded",()=>{o().each(e=>{gj.isDocked(e)?gj.reset(e):gj.refresh(e)})}),e.on("FullscreenStateChanged",()=>{o().each(gj.reset)})),e.on("AfterScrollIntoView",e=>{o().each(t=>{gj.refresh(t);const o=t.element;Sy(o)&&vj(e,o)})}),e.on("PostRender",()=>{Cj(e,!1)})},Ej=e=>e().map(gj.isDocked).getOr(!1),Oj=()=>[Ku.config({channels:{[pj()]:{onReceive:xj}}})],Tj=(e,t)=>{const o=Am(),n=t.getSink,r=e=>{n().each(t=>e(t.element))},s=t=>{e.inline||xj(t),Cj(e,gj.isDocked(t)),t.getSystem().broadcastOn([$f()],{}),n().each(e=>e.getSystem().broadcastOn([$f()],{}))},a=e.inline?[]:Oj();return[Tw.config({}),gj.config({contextual:{lazyContext:t=>{const o=ko(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return R.from(n).map(n=>{const r=or(Ze.fromDom(n)),s=lR(e,t.element);return s.fold(()=>{const e=r.height-o,n=r.y+(yj(t,"top")?0:o);return tr(r.x,n,r.width,e)},e=>{const n=rr(r,cR(e)),s=yj(t,"top")?n.y:n.y+o;return tr(n.x,s,n.width,n.height-o)})})},onShow:()=>{r(e=>wj(e,!0))},onShown:e=>{r(e=>kc(e,[fj.transitionClass,fj.fadeInClass])),o.get().each(t=>{Sj(e.element,t),o.clear()})},onHide:e=>{kj(e.element,n).fold(o.clear,o.set),r(e=>wj(e,!1))},onHidden:()=>{r(e=>kc(e,[fj.transitionClass]))},...fj},lazyViewport:t=>{const o=lR(e,t.element);return o.fold(()=>{const o=ar(),n=Lk(e),r=o.y+(yj(t,"top")?n:0),s=o.height-(yj(t,"bottom")?n:0);return{bounds:tr(o.x,r,o.width,s),optScrollEnv:R.none()}},e=>{const t=cR(e);return{bounds:t,optScrollEnv:R.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Ao(e.element).top})}})},modes:[t.header.getDockingMode()],onDocked:s,onUndocked:s}),...a]};var Dj=Object.freeze({__proto__:null,setup:_j,isDocked:Ej,getBehaviours:Tj});const Aj=e=>{const t=e.editor,o=e.sticky?Tj:yV;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:Vu(o(t,e.sharedBackstage))}},Nj=ls([AE,Fs("items",ds([gs([NE,qs("items",bs)]),bs]))].concat(dO)),Rj=e=>Ts("GroupToolbarButton",Nj,e),Bj=[Js("text"),Js("tooltip"),Js("icon"),ra("search",!1,ds([vs,ls([Js("placeholder")])],e=>m(e)?e?R.some({placeholder:R.none()}):R.none():R.some(e))),js("fetch"),ca("onSetup",()=>y)],Mj=ls([AE,...Bj]),Ij=e=>Ts("menubutton",Mj,e),Pj=ls([AE,$E,WE,jE,KE,LE,HE,ia("presets","normal",["normal","color","listpreview"]),QE(1),zE,UE]),Lj=e=>Ts("SplitButton",Pj,e),Fj=(e,t)=>{const o=(e,o)=>{const n=V(o,e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=Ij(o).mapError(e=>Ns(e)).getOrDie();return GF(n,"tox-mbtn",t.backstage,R.some("menuitem"))});bw.set(e,n)},n={focus:nw.focusIn,setMenus:o};return{uid:e.uid,dom:e.dom,components:[],behaviours:Vu([bw.config({}),yw("menubar-events",[Zi(t=>{e.onSetup(t)}),Vi($a(),(e,t)=>{md(e.element,".tox-mbtn--active").each(o=>{gd(t.event.target,".tox-mbtn").each(t=>{kt(o,t)||e.getSystem().getByDom(o).each(o=>{e.getSystem().getByDom(t).each(e=>{zN.expand(e),zN.close(o),Tw.focus(e)})})})})}),Vi(ki(),(e,t)=>{t.event.prevFocus.bind(t=>e.getSystem().getByDom(t).toOptional()).each(o=>{t.event.newFocus.bind(t=>e.getSystem().getByDom(t).toOptional()).each(e=>{zN.isOpen(o)&&(zN.expand(e),zN.close(o))})})})]),nw.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),R.some(!0))}),WR.config({})]),apis:n,domModification:{attributes:{role:"menubar"}}}};var zj=Lb({factory:Fj,name:"silver.Menubar",configFields:[Ls("dom"),Ls("uid"),Ls("onEscape"),Ls("backstage"),na("onSetup",y)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const Uj="⚡️Upgrade",Hj="https://www.tiny.cloud/tinymce-self-hosted-premium-features/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",Vj=e=>({uid:e.uid,dom:e.dom,components:[{dom:{tag:"a",attributes:{href:Hj,rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:Uj}}]}),jj="container",Wj=[Eh("slotBehaviours",[])],$j=e=>"",Gj=e=>{const t=(()=>{const e=[],t=(t,o)=>(e.push(t),pb(jj,$j(t),o));return{slot:t,record:S(e)}})(),o=e(t),n=t.record(),r=V(n,e=>rb({name:e,pname:$j(e)}));return Nb(jj,Wj,r,qj,o)},qj=(e,t)=>{const o=t=>Sb(e),n=(t,o)=>yb(t,e,o),r=(t,o)=>(n,r)=>yb(n,e,r).map(e=>t(e,r)).getOr(o),s=e=>(t,o)=>{j(o,o=>e(t,o))},a=(e,t)=>"true"!==no(e.element,"aria-hidden"),i=(e,t)=>{if(!a(e)){const o=e.element;yo(o,"display"),ao(o,"aria-hidden"),Ri(e,_i(),{name:t,visible:!0})}},l=(e,t)=>{if(a(e)){const o=e.element;uo(o,"display","none"),to(o,"aria-hidden","true"),Ri(e,_i(),{name:t,visible:!1})}},c=r(a,!1),d=r(l),u=s(d),m=e=>u(e,o()),g=r(i),p={getSlotNames:o,getSlot:n,isShowing:c,hideSlot:d,hideAllSlots:m,showSlot:g};return{uid:e.uid,dom:e.dom,components:t,behaviours:Oh(e.slotBehaviours),apis:p}},Kj=pe({getSlotNames:(e,t)=>e.getSlotNames(t),getSlot:(e,t,o)=>e.getSlot(t,o),isShowing:(e,t,o)=>e.isShowing(t,o),hideSlot:(e,t,o)=>e.hideSlot(t,o),hideAllSlots:(e,t)=>e.hideAllSlots(t),showSlot:(e,t,o)=>e.showSlot(t,o)},e=>Il(e)),Yj={...Kj,sketch:Gj},Xj=ls([WE,$E,ca("onShow",y),ca("onHide",y),HE]),Jj=e=>Ts("sidebar",Xj,e),Zj=e=>{const{sidebars:t}=e.ui.registry.getAll();j(ue(t),o=>{const n=t[o],r=()=>Ee(R.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(r())},onSetup:t=>{t.setActive(r());const o=()=>t.setActive(r());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})})},Qj=e=>({element:()=>e.element.dom}),eW=(e,t)=>{const o=V(ue(t),e=>{const o=t[e],n=Ds(Jj(o));return{name:e,getApi:Qj,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}});return V(o,t=>{const n=ga(y);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:JO.unnamedEvents([CT(t,n),ST(t,n),Vi(_i(),(e,t)=>{const n=t.event,r=X(o,e=>e.name===n.name);r.each(t=>{const o=n.visible?t.onShow:t.onHide;o(t.getApi(e))})})])})})},tW=e=>Yj.sketch(t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:eW(t,e),slotBehaviours:JO.unnamedEvents([Zi(e=>Yj.hideAllSlots(e))])})),oW=(e,t,o)=>{const n=jb.getCurrent(e);n.each(n=>{bw.set(n,[tW(t)]);const r=null===o||void 0===o?void 0:o.toLowerCase();i(r)&&ke(t,r)&&jb.getCurrent(n).each(t=>{Yj.showSlot(t,r),WF.immediateGrow(n),yo(n.element,"width"),nW(e.element,"region")})})},nW=(e,t)=>{to(e,"role",t)},rW=(e,t)=>{const o=jb.getCurrent(e);o.each(o=>{const n=jb.getCurrent(o);n.each(n=>{WF.hasGrown(o)?Yj.isShowing(n,t)?(WF.shrink(o),nW(e.element,"presentation")):(Yj.hideAllSlots(n),Yj.showSlot(n,t),nW(e.element,"region")):(Yj.hideAllSlots(n),Yj.showSlot(n,t),WF.grow(o),nW(e.element,"region"))})})},sW=e=>{const t=jb.getCurrent(e);return t.bind(e=>{const t=WF.isGrowing(e)||WF.hasGrown(e);if(t){const t=jb.getCurrent(e);return t.bind(e=>X(Yj.getSlotNames(e),t=>Yj.isShowing(e,t)))}return R.none()})},aW=fl("FixSizeEvent"),iW=fl("AutoSizeEvent"),lW=e=>({uid:e.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:Vu([WR.config({}),Tw.config({}),WF.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:e=>{const t=jb.getCurrent(e);t.each(Yj.hideAllSlots),Ni(e,iW)},onGrown:e=>{Ni(e,iW)},onStartGrow:e=>{Ri(e,aW,{width:ho(e.element,"width").getOr("")})},onStartShrink:e=>{Ri(e,aW,{width:Mo(e.element)+"px"})}}),bw.config({}),jb.config({find:e=>{const t=bw.contents(e);return ie(t)}})])}],behaviours:Vu([SP.childAt(0),yw("sidebar-sliding-events",[Vi(aW,(e,t)=>{uo(e.element,"width",t.event.width)}),Vi(iW,(e,t)=>{yo(e.element,"width")})])])}),cW=(e,t,o,n)=>{to(e.element,"aria-busy",!0);const r=t.getRoot(e).getOr(e),s=Vu([nw.config({mode:"special",onTab:()=>R.some(!0),onShiftTab:()=>R.some(!0)}),Tw.config({})]),a=n(r,s),i=r.getSystem().build(a);bw.append(r,nd(i)),i.hasConfigured(nw)&&t.focus&&nw.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith(()=>bw.remove(r,i))},dW=(e,t,o)=>{ao(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},uW=(e,t,o)=>o.isBlocked();var mW=Object.freeze({__proto__:null,block:cW,unblock:dW,isBlocked:uW}),gW=[ca("getRoot",R.none),la("focus",!0),Ld("onBlock"),Ld("onUnblock")];const pW=()=>{const e=Tm(),t=t=>{e.set({destroy:t})};return Ll({readState:e.isSet,blockWith:t,clear:e.clear,isBlocked:e.isSet})};var fW=Object.freeze({__proto__:null,init:pW});const hW=Wu({fields:gW,name:"blocking",apis:mW,state:fW}),bW=e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:KC('
')}]}),vW=e=>jb.getCurrent(e).each(e=>Ju(e.element,!0)),yW=(e,t)=>{const o="tabindex",n="data-mce-"+o;R.from(e.iframeElement).map(Ze.fromDom).each(e=>{t?(ro(e,o).each(t=>to(e,n,t)),to(e,o,-1)):(ao(e,o),ro(e,n).each(t=>{to(e,o,t),ao(e,n)}))})},xW=(e,t,o,n)=>{const r=t.element;if(yW(e,o),o)hW.block(t,bW(n)),yo(r,"display"),ao(r,"aria-hidden"),e.hasFocus()&&vW(t);else{const o=jb.getCurrent(t).exists(e=>Qu(e.element));hW.unblock(t),uo(r,"display","none"),to(r,"aria-hidden","true"),o&&e.focus()}},wW=e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:Vu([bw.config({}),hW.config({focus:!1}),jb.config({find:e=>ie(e.components())})]),components:[]}),CW=e=>"focusin"===e.type,SW=e=>{if(CW(e)){const t=e.composed?ie(e.composedPath()):R.from(e.target);return t.map(Ze.fromDom).filter(ft).exists(e=>Cc(e,"mce-pastebin"))}return!1},kW=(e,t,o)=>{const n=ga(!1),r=Am(),s=o=>{n.get()&&!SW(o)&&(o.preventDefault(),vW(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",()=>{e.dom.bind(e.getWin(),"focusin",s),e.on("BeforeExecCommand",e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&s(e)})});const a=r=>{r!==n.get()&&(n.set(r),xW(e,t(),r,o.providers),OD(e,r))};e.on("ProgressState",t=>{if(r.on(clearTimeout),b(t.time)){const o=jC.setEditorTimeout(e,()=>a(t.state),t.time);r.set(o)}else a(t.state),r.clear()})},_W=(e,t)=>{const o={len:0,list:[]},n=K(e,(e,o)=>{const n=t(o,e.len);return n.fold(S(e),t=>({len:t.finish,list:e.list.concat([t])}))},o);return n.list},EW=(e,t,o)=>({within:e,extra:t,withinWidth:o}),OW=(e,t,o)=>{const n=_W(e,(e,t)=>{const n=o(e);return R.some({element:e,start:t,finish:t+n,width:n})}),r=G(n,e=>e.finish<=t),s=q(r,(e,t)=>e+t.width,0),a=n.slice(r.length);return{within:r,extra:a,withinWidth:s}},TW=e=>V(e,e=>e.element),DW=(e,t,o)=>{const n=TW(e.concat(t));return EW(n,[],o)},AW=(e,t,o,n)=>{const r=TW(e).concat([o]);return EW(r,TW(t),n)},NW=(e,t,o)=>EW(TW(e),[],o),RW=(e,t,o)=>{const n=OW(t,e,o);return 0===n.extra.length?R.some(n):R.none()},BW=(e,t,o,n)=>{const r=RW(e,t,o).getOrThunk(()=>OW(t,e-o(n),o)),s=r.within,a=r.extra,i=r.withinWidth;return 1===a.length&&a[0].width<=o(n)?DW(s,a,i):a.length>=1?AW(s,a,n,i):NW(s,a,i)},MW=(e,t)=>{const o=V(t,e=>nd(e));hV.setGroups(e,o)},IW=e=>de(e,e=>tm(e.element).bind(t=>e.getSystem().getByDom(t).toOptional())),PW=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const r=xb(e,t,"primary"),s=gN.getCoupled(e,"overflowGroup");uo(r.element,"visibility","hidden");const a=n.concat([s]),i=IW(a);o([]),MW(r,a);const l=Mo(r.element),c=BW(l,t.builtGroups.get(),e=>Mo(e.element),s);0===c.extra.length?(bw.remove(r,s),o([])):(MW(r,c.within),o(c.extra)),yo(r.element,"visibility"),xo(r.element),i.each(Tw.focus)},LW=S([Eh("splitToolbarBehaviours",[gN]),Is("builtGroups",()=>ga([]))]),FW=S([Id(["overflowToggledClass"]),Qs("getOverflowBounds"),Ls("lazySink"),Is("overflowGroups",()=>ga([])),Ld("onOpened"),Ld("onClosed")].concat(LW())),zW=S([rb({factory:hV,schema:mV(),name:"primary"}),sb({schema:mV(),name:"overflow"}),sb({name:"overflow-button"}),sb({name:"overflow-group"})]),UW=S((e,t)=>{Po(e,Math.floor(t))}),HW=S([Id(["toggledClass"]),Ls("lazySink"),js("fetch"),Qs("getBounds"),ta("fireDismissalEventInstead",[na("event",Ci())]),mg(),Ld("onToggled")]),VW=S([sb({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:Vu([qw.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),sb({factory:hV,schema:mV(),name:"toolbar",overrides:e=>({toolbarBehaviours:Vu([nw.config({mode:"cyclic",onEscape:t=>(yb(t,e,"button").each(Tw.focus),R.none())})])})})]),jW=Am(),WW=(e,t)=>{jW.set(!0),$W(e,t),jW.clear()},$W=(e,t)=>{const o=gN.getCoupled(e,"toolbarSandbox");jf.isOpen(o)?jf.close(o):jf.open(o,t.toolbar())},GW=(e,t,o,n)=>{const r=o.getBounds.map(e=>e()),s=o.lazySink(e).getOrDie();rf.positionWithinBounds(s,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:UW()}}},r)},qW=(e,t,o,n,r)=>{hV.setGroups(t,r),GW(e,t,o,n),qw.on(e)},KW=(e,t,o)=>{const n=hd(),r=(r,s)=>{const a=jW.get().getOr(!1);o.fetch().get(r=>{qW(e,s,o,t.layouts,r),n.link(e.element),a||nw.focusIn(s)})},s=()=>{qw.off(e),jW.get().getOr(!1)||Tw.focus(e),n.unlink(e.element)};return{dom:{tag:"div",attributes:{id:n.id}},behaviours:Vu([nw.config({mode:"special",onEscape:e=>(jf.close(e),R.some(!0))}),jf.config({onOpen:r,onClose:s,isPartOf:(t,o,n)=>vd(o,n)||vd(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),Ku.config({channels:{...Kf({isExtraPart:A,...o.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...Xf({doReposition:()=>{jf.getState(gN.getCoupled(e,"toolbarSandbox")).each(n=>{GW(e,n,o,t.layouts)})}})}})])}},YW=(e,t,o,n)=>({...$C.sketch({...n.button(),action:e=>{$W(e,n)},buttonBehaviours:Dh.augment({dump:n.button().buttonBehaviours},[gN.config({others:{toolbarSandbox:t=>KW(t,o,e)}})])}),apis:{setGroups:(t,n)=>{jf.getState(gN.getCoupled(t,"toolbarSandbox")).each(r=>{qW(t,r,e,o.layouts,n)})},reposition:t=>{jf.getState(gN.getCoupled(t,"toolbarSandbox")).each(n=>{GW(t,n,e,o.layouts)})},toggle:e=>{$W(e,n)},toggleWithoutFocusing:e=>{WW(e,n)},getToolbar:e=>jf.getState(gN.getCoupled(e,"toolbarSandbox")),isOpen:e=>jf.isOpen(gN.getCoupled(e,"toolbarSandbox"))}}),XW=Fb({name:"FloatingToolbarButton",factory:YW,configFields:HW(),partFields:VW(),apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggleWithoutFocusing(t)},getToolbar:(e,t)=>e.getToolbar(t),isOpen:(e,t)=>e.isOpen(t)}}),JW=S([Ls("items"),Id(["itemSelector"]),Eh("tgroupBehaviours",[nw])]),ZW=S([ib({name:"items",unit:"item"})]),QW=(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Th(e.tgroupBehaviours,[nw.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}),e$=Fb({name:"ToolbarGroup",configFields:JW(),partFields:ZW(),factory:QW}),t$=e=>V(e,e=>nd(e)),o$=(e,t,o)=>{PW(e,o,n=>{o.overflowGroups.set(n),t.getOpt(e).each(e=>{XW.setGroups(e,t$(n))})})},n$=(e,t,o,n)=>{const r=YC(XW.sketch({fetch:()=>wN.nu(t=>{t(t$(e.overflowGroups.get()))}),layouts:{onLtr:()=>[vu,bu],onRtl:()=>[bu,vu],onBottomLtr:()=>[xu,yu],onBottomRtl:()=>[yu,xu]},getBounds:o.getOverflowBounds,lazySink:e.lazySink,fireDismissalEventInstead:{},markers:{toggledClass:e.markers.overflowToggledClass},parts:{button:n["overflow-button"](),toolbar:n.overflow()},onToggled:(t,o)=>e[o?"onOpened":"onClosed"](t)}));return{uid:e.uid,dom:e.dom,components:t,behaviours:Th(e.splitToolbarBehaviours,[gN.config({others:{overflowGroup:()=>e$.sketch({...n["overflow-group"](),items:[r.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(V(o,t.getSystem().build)),o$(t,r,e)},refresh:t=>o$(t,r,e),toggle:e=>{r.getOpt(e).each(e=>{XW.toggle(e)})},toggleWithoutFocusing:e=>{r.getOpt(e).each(XW.toggleWithoutFocusing)},isOpen:e=>r.getOpt(e).map(XW.isOpen).getOr(!1),reposition:e=>{r.getOpt(e).each(e=>{XW.reposition(e)})},getOverflow:e=>r.getOpt(e).bind(XW.getToolbar)},domModification:{attributes:{role:"group"}}}},r$=Fb({name:"SplitFloatingToolbar",configFields:FW(),partFields:zW(),factory:n$,apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t),getOverflow:(e,t)=>e.getOverflow(t)}}),s$=S([Id(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),Ld("onOpened"),Ld("onClosed")].concat(LW())),a$=S([rb({factory:hV,schema:mV(),name:"primary"}),rb({factory:hV,schema:mV(),name:"overflow",overrides:e=>({toolbarBehaviours:Vu([WF.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{yb(t,e,"overflow-button").each(e=>{qw.off(e),Tw.focus(e)}),e.onClosed(t)},onGrown:t=>{nw.focusIn(t),e.onOpened(t)},onStartGrow:t=>{yb(t,e,"overflow-button").each(qw.on)}}),nw.config({mode:"acyclic",onEscape:t=>(yb(t,e,"overflow-button").each(Tw.focus),R.some(!0))})])})}),sb({name:"overflow-button",overrides:e=>({buttonBehaviours:Vu([qw.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])})}),sb({name:"overflow-group"})]),i$=(e,t)=>yb(e,t,"overflow").map(WF.hasGrown).getOr(!1),l$=(e,t)=>{yb(e,t,"overflow-button").bind(()=>yb(e,t,"overflow")).each(o=>{c$(e,t),WF.toggleGrow(o)})},c$=(e,t)=>{yb(e,t,"overflow").each(o=>{PW(e,t,e=>{const t=V(e,e=>nd(e));hV.setGroups(o,t)}),yb(e,t,"overflow-button").each(e=>{WF.hasGrown(o)&&qw.on(e)}),WF.refresh(o)})},d$=(e,t,o,n)=>{const r="alloy.toolbar.toggle",s=(t,o)=>{const n=V(o,t.getSystem().build);e.builtGroups.set(n)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Th(e.splitToolbarBehaviours,[gN.config({others:{overflowGroup:e=>e$.sketch({...n["overflow-group"](),items:[$C.sketch({...n["overflow-button"](),action:t=>{Ni(e,r)}})]})}}),yw("toolbar-toggle-events",[Vi(r,t=>{l$(t,e)})])]),apis:{setGroups:(t,o)=>{s(t,o),c$(t,e)},refresh:t=>c$(t,e),toggle:t=>l$(t,e),isOpen:t=>i$(t,e)},domModification:{attributes:{role:"group"}}}},u$=Fb({name:"SplitSlidingToolbar",configFields:s$(),partFields:a$(),factory:d$,apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},toggle:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t)}}),m$=e=>{const t=e.title.fold(()=>({}),e=>({attributes:{title:e}}));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[e$.parts.items({})],items:e.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:Vu([WR.config({}),Tw.config({})])}},g$=e=>e$.sketch(m$(e)),p$=(e,t)=>{const o=Zi(t=>{const o=V(e.initGroups,g$);hV.setGroups(t,o)});return Vu([xT.toolbarButton(e.providers.isDisabled),fT(),nw.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),yw("toolbar-events",[o])])},f$=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":m$({title:R.none(),items:[]}),"overflow-button":Bz({name:"more",icon:R.some("more-drawer"),enabled:!0,tooltip:R.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:R.none(),borderless:!1},R.none(),e.providers)},splitToolbarBehaviours:p$(e,t)}},h$=e=>{const t=f$(e),o=4,n=r$.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return r$.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,n=nr(t),r=Tt(t),s=nr(r),a=Math.max(r.dom.scrollHeight,s.height);return tr(n.x+o,s.y,n.width-2*o,a)},parts:{...t.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:e.attributes}}},components:[n],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>e.onToggled(t,!0),onClosed:t=>e.onToggled(t,!1)})},b$=e=>{const t=u$.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=u$.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=f$(e);return u$.sketch({...n,components:[t,o],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:t=>{t.getSystem().broadcastOn([pj()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([pj()],{type:"closed"}),e.onToggled(t,!1)}})},v$=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return hV.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===dk.scrolling?["tox-toolbar--scrolling"]:[])},components:[hV.parts.groups({})],toolbarBehaviours:p$(e,t)})},y$=[jE,WE,Js("tooltip"),ia("buttonType","secondary",["primary","secondary"]),la("borderless",!1),js("onAction")],x$=[...y$,BE,Hs("type",["button"])],w$=[...y$,la("active",!1),Hs("type",["togglebutton"])],C$={button:x$,togglebutton:w$},S$=[Hs("type",["group"]),ua("buttons",[],Rs("type",C$))],k$=Rs("type",{...C$,group:S$}),_$=ls([ua("buttons",[],k$),js("onShow"),js("onHide")]),E$=e=>Ts("view",_$,e),O$=(e,t)=>{var o,n;const r="togglebutton"===e.type,s=e.icon.map(e=>OL(e,t.icons)).map(YC),a=()=>o=>{const n=e=>{s.map(n=>n.getOpt(o).each(o=>{bw.set(o,[OL(e,t.icons)])}))},a=e=>{const t=o.element;e?(vc(t,"tox-button--enabled"),to(t,"aria-pressed",!0)):(xc(t,"tox-button--enabled"),ao(t,"aria-pressed"))},i=()=>Cc(o.element,"tox-button--enabled");return r?e.onAction({setIcon:n,setActive:a,isActive:i}):"button"===e.type?e.onAction({setIcon:n}):void 0},i=a(),l={...e,name:r?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:R.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},c=Mz(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),d=r?e.text.map(t.translate):R.some(t.translate(e.text)),u=d.map(Jc),m=l.tooltip.or(d).map(e=>({"aria-label":t.translate(e),title:t.translate(e)})).getOr({}),g=s.map(e=>e.asSpec()),p=ET([g,u]),f=e.icon.isSome()&&u.isSome(),h={tag:"button",classes:c.concat(...e.icon.isSome()&&!f?["tox-button--icon"]:[]).concat(...f?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:m},b=[],v=Rz(l,R.some(i),b,h,p,t);return $C.sketch(v)},T$=(e,t)=>O$(e,t),D$=(e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:V(e.buttons,e=>T$(e,t))}),A$=_n().deviceType,N$=A$.isPhone(),R$=A$.isTablet(),B$=e=>{let t=!1;const o=V(e.buttons,o=>"group"===o.type?(t=!0,D$(o,e.providers)):T$(o,e.providers));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...N$||R$?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:Vu([Tw.config({}),nw.config({mode:"flow",selector:"button, .tox-button",focusInside:Zv.OnEnterOrSpaceMode})]),components:t?o:[MR.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),MR.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}},M$=e=>({uid:e.uid,dom:{tag:"div",classes:["tox-view__pane"]}}),I$=(e,t,o,n)=>{const r={getPane:t=>nV.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,apis:r}};var P$=Fb({name:"silver.View",configFields:[Ls("viewConfig")],partFields:[ab({factory:{sketch:B$},schema:[Ls("buttons"),Ls("providers")],name:"header"}),ab({factory:{sketch:M$},schema:[],name:"pane"})],factory:I$,apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const L$=(e,t,o)=>xe(t,(t,n)=>{const r=Ds(E$(t));return e.slot(n,P$.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:r,components:[...r.buttons.length>0?[P$.parts.header({buttons:r.buttons,providers:o})]:[],P$.parts.pane({})]}))}),F$=(e,t)=>Yj.sketch(o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:L$(o,e,t),slotBehaviours:JO.unnamedEvents([Zi(e=>Yj.hideAllSlots(e))])})),z$=e=>X(Yj.getSlotNames(e),t=>Yj.isShowing(e,t)),U$=e=>{const t=e.element;uo(t,"display","none"),to(t,"aria-hidden","true")},H$=e=>{const t=e.element;yo(t,"display"),ao(t,"aria-hidden")},V$=e=>({getContainer:S(e)}),j$=(e,t,o)=>{Yj.getSlot(e,t).each(e=>{P$.getPane(e).each(t=>{const n=o(e);n(V$(t.element.dom))})})},W$=(e,t)=>j$(e,t,P$.getOnShow),$$=(e,t)=>j$(e,t,P$.getOnHide),G$=(e,t)=>{const o=(e,o)=>{bw.set(e,[F$(o,t.backstage.shared.providers)])},n=e=>jb.getCurrent(e).bind(z$),r=(e,t,o,n)=>jb.getCurrent(e).exists(r=>{const s=z$(r),a=s.exists(e=>n===e),i=Yj.getSlot(r,n).isSome();return i&&(Yj.hideAllSlots(r),a?(U$(e),t()):(o(),H$(e),Yj.showSlot(r,n),W$(r,n)),s.each(e=>$$(r,e))),i}),s={setViews:o,whichView:n,toggleView:r};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:Vu([bw.config({}),jb.config({find:e=>{const t=bw.contents(e);return ie(t)}})]),apis:s}};var q$=Lb({factory:G$,name:"silver.ViewWrapper",configFields:[Ls("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,r)=>e.toggleView(t,o,n,r),whichView:(e,t)=>e.whichView(t)}});const K$=(e,t,o)=>{let n=!1;const r={getSocket:t=>nV.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{nV.getPart(t,e,"sidebar").each(e=>oW(e,o,n))},toggleSidebar:(t,o)=>{nV.getPart(t,e,"sidebar").each(e=>rW(e,o))},whichSidebar:t=>nV.getPart(t,e,"sidebar").bind(sW).getOrNull(),getHeader:t=>nV.getPart(t,e,"header"),getToolbar:t=>nV.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{nV.getPart(t,e,"toolbar").each(e=>{const t=V(o,g$);e.getApis().setGroups(e,t)})},setToolbars:(t,o)=>{nV.getPart(t,e,"multiple-toolbar").each(e=>{const t=V(o,e=>V(e,g$));uV.setItems(e,t)})},refreshToolbar:t=>{const o=nV.getPart(t,e,"toolbar");o.each(e=>e.getApis().refresh(e))},toggleToolbarDrawer:t=>{nV.getPart(t,e,"toolbar").each(e=>{Re(e.getApis().toggle,t=>t(e))})},toggleToolbarDrawerWithoutFocusing:t=>{nV.getPart(t,e,"toolbar").each(e=>{Re(e.getApis().toggleWithoutFocusing,t=>t(e))})},isToolbarDrawerToggled:t=>nV.getPart(t,e,"toolbar").bind(e=>R.from(e.getApis().isOpen).map(t=>t(e))).getOr(!1),getThrobber:t=>nV.getPart(t,e,"throbber"),focusToolbar:t=>{const o=nV.getPart(t,e,"toolbar").orThunk(()=>nV.getPart(t,e,"multiple-toolbar"));o.each(e=>{nw.focusIn(e)})},setMenubar:(t,o)=>{nV.getPart(t,e,"menubar").each(e=>{zj.setMenus(e,o)})},focusMenubar:t=>{nV.getPart(t,e,"menubar").each(e=>{zj.focus(e)})},setViews:(t,o)=>{nV.getPart(t,e,"viewWrapper").each(e=>{q$.setViews(e,o)})},toggleView:(t,o)=>nV.getPart(t,e,"viewWrapper").exists(e=>q$.toggleView(e,()=>r.showMainView(t),()=>r.hideMainView(t),o)),whichView:t=>nV.getPart(t,e,"viewWrapper").bind(q$.whichView).getOrNull(),hideMainView:t=>{n=r.isToolbarDrawerToggled(t),n&&r.toggleToolbarDrawer(t),nV.getPart(t,e,"editorContainer").each(e=>{const t=e.element;uo(t,"display","none"),to(t,"aria-hidden","true")})},showMainView:t=>{n&&r.toggleToolbarDrawer(t),nV.getPart(t,e,"editorContainer").each(e=>{const t=e.element;yo(t,"display"),ao(t,"aria-hidden")})}};return{uid:e.uid,dom:e.dom,components:t,apis:r,behaviours:e.behaviours}},Y$=rV.optional({factory:zj,name:"menubar",schema:[Ls("backstage")]}),X$=e=>e.type===dk.sliding?b$:e.type===dk.floating?h$:v$,J$=rV.optional({factory:{sketch:e=>uV.sketch({uid:e.uid,dom:e.dom,listBehaviours:Vu([nw.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>v$({type:e.type,uid:fl("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),R.some(!0))}),setupItem:(e,t,o,n)=>{hV.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[Ls("dom"),Ls("onEscape")]}),Z$=rV.optional({factory:{sketch:e=>{const t=X$(e),o={type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),R.some(!0)),onToggled:(t,o)=>e.onToolbarToggled(o),cyclicKeying:!1,initGroups:[],getSink:e.getSink,providers:e.providers,moreDrawerData:{lazyToolbar:e.lazyToolbar,lazyMoreButton:e.lazyMoreButton,lazyHeader:e.lazyHeader},attributes:e.attributes};return t(o)}},name:"toolbar",schema:[Ls("dom"),Ls("onEscape"),Ls("getSink")]}),Q$=rV.optional({factory:{sketch:Aj},name:"header",schema:[Ls("dom")]}),eG=rV.optional({factory:{sketch:Vj},name:"promotion",schema:[Ls("dom")]}),tG=rV.optional({name:"socket",schema:[Ls("dom")]}),oG=rV.optional({factory:{sketch:lW},name:"sidebar",schema:[Ls("dom")]}),nG=rV.optional({factory:{sketch:wW},name:"throbber",schema:[Ls("dom")]}),rG=rV.optional({factory:q$,name:"viewWrapper",schema:[Ls("backstage")]}),sG=e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components}),aG=rV.optional({factory:{sketch:sG},name:"editorContainer",schema:[]});var iG=Fb({name:"OuterContainer",factory:K$,configFields:[Ls("dom"),Ls("behaviours")],partFields:[Q$,Y$,Z$,J$,tG,oG,eG,nG,rG,aG],apis:{getSocket:(e,t)=>e.getSocket(t),setSidebar:(e,t,o,n)=>{e.setSidebar(t,o,n)},toggleSidebar:(e,t,o)=>{e.toggleSidebar(t,o)},whichSidebar:(e,t)=>e.whichSidebar(t),getHeader:(e,t)=>e.getHeader(t),getToolbar:(e,t)=>e.getToolbar(t),setToolbar:(e,t,o)=>{e.setToolbar(t,o)},setToolbars:(e,t,o)=>{e.setToolbars(t,o)},refreshToolbar:(e,t)=>e.refreshToolbar(t),toggleToolbarDrawer:(e,t)=>{e.toggleToolbarDrawer(t)},toggleToolbarDrawerWithoutFocusing:(e,t)=>{e.toggleToolbarDrawerWithoutFocusing(t)},isToolbarDrawerToggled:(e,t)=>e.isToolbarDrawerToggled(t),getThrobber:(e,t)=>e.getThrobber(t),setMenubar:(e,t,o)=>{e.setMenubar(t,o)},focusMenubar:(e,t)=>{e.focusMenubar(t)},focusToolbar:(e,t)=>{e.focusToolbar(t)},setViews:(e,t,o)=>{e.setViews(t,o)},toggleView:(e,t,o)=>e.toggleView(t,o),whichView:(e,t)=>e.whichView(t)}});const lG="file edit view insert format tools table help",cG={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 inserttemplate codesample inserttable accordion | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"aidialog aishortcuts | spellchecker spellcheckerlanguage | autocorrect capitalization | a11ycheck code typography wordcount addtemplate"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},dG=(e,t,o)=>{const n=Ak(o).split(/[ ,]/);return{text:e.title,getItems:()=>Q(e.items,e=>{const o=e.toLowerCase();return 0===o.trim().length||z(n,e=>e===o)?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]})}},uG=e=>e.split(" "),mG=(e,t)=>{const o={...cG,...t.menus},n=ue(t.menus).length>0,r=void 0===t.menubar||!0===t.menubar?uG(lG):uG(!1===t.menubar?"":t.menubar),s=G(r,e=>{const o=ke(cG,e);return n?o||Se(t.menus,e).exists(e=>ke(e,"items")):o}),a=V(s,n=>{const r=o[n];return dG({title:r.title,items:uG(r.items)},t,e)});return G(a,e=>{const t=e=>i(e)||"separator"!==e.type;return e.getItems().length>0&&z(e.getItems(),t)})},gG=e=>{const t=()=>{e._skinLoaded=!0,wD(e)};return()=>{e.initialized?t():e.on("init",t)}},pG=(e,t)=>()=>CD(e,{message:t}),fG=(e,t,o)=>(e.on("remove",()=>o.unload(t)),o.load(t)),hG=(e,t,o,n)=>(e.on("remove",()=>n.unloadRawCss(t)),n.loadRawCss(t,o)),bG=async(e,t)=>{const o=a_(e).getOr("default"),n="ui/"+o+"/skin.css",r=tinymce.Resource.get(n);if(i(r))return Promise.resolve(hG(e,n,r,e.ui.styleSheetLoader));{const o=t+"/skin.min.css";return fG(e,o,e.ui.styleSheetLoader)}},vG=async(e,t)=>{const o=Gt(Ze.fromDom(e.getElement()));if(o){const o=a_(e).getOr("default"),n="ui/"+o+"/skin.shadowdom.css",r=tinymce.Resource.get(n);if(i(r))return hG(e,n,r,gk.DOM.styleSheetLoader),Promise.resolve();{const o=t+"/skin.shadowdom.min.css";return fG(e,o,gk.DOM.styleSheetLoader)}}},yG=async(e,t)=>{a_(t).fold(()=>{const o=s_(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")},o=>{const n="ui/"+o+(e?"/content.inline":"/content")+".css",r=tinymce.Resource.get(n);if(i(r))hG(t,n,r,t.ui.styleSheetLoader);else{const o=s_(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}});const o=s_(t);if(!n_(t)&&i(o))return Promise.all([bG(t,o),vG(t,o)]).then()},xG=(e,t)=>yG(e,t).then(gG(t),pG(t,"Skin could not be loaded")),wG=E(xG,!1),CG=E(xG,!0),SG=(e,t,o)=>e.translate([t,e.translate(o)]),kG=(e,t)=>{const o=(o,r,s,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return R.some({type:"separator",text:i});if("submenu"===o.type){const e=Q(o.getStyleItems(),e=>n(e,r,a));return 0===r&&e.length<=0?R.none():R.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>Q(o.getStyleItems(),e=>n(e,r,a))})}return R.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!s,onAction:t.onAction(o),...o.getStylePreview().fold(()=>({}),e=>({meta:{style:e}}))})},n=(e,n,r)=>{const s="formatter"===e.type&&t.isInvalid(e);return 0===n?s?[]:o(e,n,!1,r).toArray():o(e,n,s,r).toArray()},r=e=>{const o=t.getCurrentValue(),r=t.shouldHide?0:1;return Q(e,e=>n(e,r,o))},s=(e,t)=>(o,n)=>{const s=t(),a=r(s),i=VL(a,E_.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:R.none()});n(i)};return{validateItems:r,getFetch:s}},_G=(e,t,o)=>{const n=o.dataset,r="basic"===n.type?()=>V(n.data,e=>cH(e,o.isSelectedFor,o.getPreviewFor)):n.getData;return{items:kG(t,o),getStyleItems:r}},EG=(e,t,o,n,r)=>{const{items:s,getStyleItems:a}=_G(e,t,o),i=e=>({getComponent:S(e),setTooltip:o=>{const n=t.shared.providers.translate(o);oo(e.element,{"aria-label":n,title:n})}}),l=t=>{const s=o=>t.setTooltip(SG(e,n,o.value));return e.on(r,s),PD(UD(e,"NodeChange",t=>{const n=t.getComponent();o.updateText(n),lv.set(t.getComponent(),!e.selection.isEditable())})(t),()=>e.off(r,s))};return NL({text:o.icon.isSome()?R.none():o.text,icon:o.icon,tooltip:R.from(o.tooltip),role:R.none(),fetch:s.getFetch(t,a),onSetup:l,getApi:i,columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)},OG=e=>V(e,e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}}),TG=e=>({type:"basic",data:e});var DG;(function(e){e[e["SemiColon"]=0]="SemiColon",e[e["Space"]=1]="Space"})(DG||(DG={}));const AG=(e,t)=>t===DG.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "),NG=(e,t,o)=>{const n=e.options.get(t),r=OG(AG(n,o));return{type:"basic",data:r}},RG="Align",BG="Alignment {0}",MG="left",IG=[{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"}],PG=e=>{const t=()=>X(IG,t=>e.formatter.match(t.format)),o=t=>()=>e.formatter.match(t),n=e=>R.none,r=o=>{const n=t(),r=n.fold(S(MG),e=>e.title.toLowerCase());Ri(o,AL,{icon:"align-"+r}),ND(e,{value:r})},s=TG(IG),a=t=>()=>X(IG,e=>e.format===t.format).each(t=>e.execCommand(t.command));return{tooltip:SG(e,BG,MG),text:R.none(),icon:R.some("align-left"),isSelectedFor:o,getCurrentValue:R.none,getPreviewFor:n,onAction:a,updateText:r,dataset:s,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},LG=(e,t)=>EG(e,t,PG(e),BG,"AlignTextUpdate"),FG=(e,t)=>{const o=_G(e,t,PG(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate(RG),onSetup:LD(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})},zG=(e,t)=>{const o=t(),n=V(o,e=>e.format);return R.from(e.formatter.closest(n)).bind(e=>X(o,t=>t.format===e)).orThunk(()=>Be(e.formatter.match("p"),{title:"Paragraph",format:"p"}))},UG="Blocks",HG="Block {0}",VG="Paragraph",jG=e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return o?R.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):R.none()},n=t=>{const o=zG(e,()=>r.data),n=o.fold(S(VG),e=>e.title);Ri(t,DL,{text:n}),MD(e,{value:n})},r=NG(e,"block_formats",DG.SemiColon);return{tooltip:SG(e,HG,VG),text:R.some(VG),icon:R.none(),isSelectedFor:t,getCurrentValue:R.none,getPreviewFor:o,onAction:HD(e),updateText:n,dataset:r,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},WG=(e,t)=>EG(e,t,jG(e),HG,"BlocksTextUpdate"),$G=(e,t)=>{const o=_G(e,t,jG(e));e.ui.registry.addNestedMenuItem("blocks",{text:UG,onSetup:LD(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})},GG="Fonts",qG="Font {0}",KG="System Font",YG=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],XG=e=>{const t=e.split(/\s*,\s*/);return V(t,e=>e.replace(/^['"]+|['"]+$/g,""))},JG=(e,t)=>t.length>0&&ee(t,t=>e.indexOf(t.toLowerCase())>-1),ZG=(e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=XG(e.toLowerCase());return JG(o,YG)||JG(o,t)}return!1},QG=e=>{const t=()=>{const t=e=>e?XG(e)[0]:"",o=e.queryCommandValue("FontName"),n=i.data,r=o?o.toLowerCase():"",s=o_(e),a=X(n,e=>{const o=e.format;return o.toLowerCase()===r||t(o).toLowerCase()===t(r).toLowerCase()}).orThunk(()=>Be(ZG(r,s),{title:KG,format:r}));return{matchOpt:a,font:o}},o=e=>t=>t.exists(t=>t.format===e),n=()=>{const{matchOpt:e}=t();return e},r=e=>()=>R.some({tag:"div",styles:-1===e.indexOf("dings")?{"font-family":e}:{}}),s=t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontName",!1,t.format)})},a=o=>{const{matchOpt:n,font:r}=t(),s=n.fold(S(r),e=>e.title);Ri(o,DL,{text:s}),ID(e,{value:s})},i=NG(e,"font_family_formats",DG.SemiColon);return{tooltip:SG(e,qG,KG),text:R.some(KG),icon:R.none(),isSelectedFor:o,getCurrentValue:n,getPreviewFor:r,onAction:s,updateText:a,dataset:i,shouldHide:!1,isInvalid:A}},eq=(e,t)=>EG(e,t,QG(e),qG,"FontFamilyTextUpdate"),tq=(e,t)=>{const o=_G(e,t,QG(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate(GG),onSetup:LD(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})},oq={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:[""]},nq=(()=>{const e="[0-9]+",t="[+-]?"+e,o="[eE]"+t,n="\\.",r=e=>`(?:${e})?`,s=["Infinity",e+n+r(e)+r(o),n+e+r(o),e+r(o)].join("|"),a=`[+-]?(?:${s})`;return new RegExp(`^(${a})(.*)$`)})(),rq=(e,t)=>z(t,t=>z(oq[t],t=>e===t)),sq=(e,t)=>{const o=R.from(nq.exec(e));return o.bind(e=>{const o=Number(e[1]),n=e[2];return rq(n,t)?R.some({value:o,unit:n}):R.none()})},aq=(e,t)=>sq(e,t).map(({value:e,unit:t})=>e+t),iq={tab:S(9),escape:S(27),enter:S(13),backspace:S(8),delete:S(46),left:S(37),up:S(38),right:S(39),down:S(40),space:S(32),home:S(36),end:S(35),pageUp:S(33),pageDown:S(34)},lq=(e,t,o)=>{let n=R.none();const r=e=>e.map(e=>_h.getValue(e)).getOr(""),s=UD(e,"NodeChange SwitchMode",t=>{const r=t.getComponent();n=R.some(r),o.updateInputValue(r),lv.set(r,!e.selection.isEditable())}),a=e=>({getComponent:S(e)}),i=ga(y),l=fl("custom-number-input-events"),c=(e,t,s)=>{const a=r(n),i=o.getNewValue(a,e),l=a.length-(""+i).length,c=n.map(e=>e.element.dom.selectionStart-l),d=n.map(e=>e.element.dom.selectionEnd-l);o.onAction(i,s),n.each(e=>{_h.setValue(e,i),t&&(c.each(t=>e.element.dom.selectionStart=t),d.each(t=>e.element.dom.selectionEnd=t))})},d=(e,t)=>c((e,t)=>e-t,e,t),u=(e,t)=>c((e,t)=>e+t,e,t),m=e=>Rt(e.element).fold(R.none,e=>(Ju(e),R.some(!0))),g=e=>Qu(e.element)?(Ft(e.element).each(e=>Ju(e)),R.some(!0)):R.none(),p=(o,n,r,s)=>{const i=ga(y),l=t.shared.providers.translate(r),c=fl("altExecuting"),d=UD(e,"NodeChange SwitchMode",t=>{lv.set(t.getComponent(),!e.selection.isEditable())}),u=e=>{lv.isDisabled(e)||o(!0)};return $C.sketch({dom:{tag:"button",attributes:{title:l,"aria-label":l},classes:s.concat(n)},components:[EL(n,t.shared.providers.icons)],buttonBehaviours:Vu([lv.config({}),yw(c,[CT({onSetup:d,getApi:a},i),ST({getApi:a},i),Vi(Ka(),(e,t)=>{t.event.raw.keyCode!==iq.space()&&t.event.raw.keyCode!==iq.enter()||lv.isDisabled(e)||o(!1)}),Vi(Za(),u),Vi(za(),u)])]),eventOrder:{[Ka()]:[c,"keying"],[Za()]:[c,"alloy.base.behaviour"],[za()]:[c,"alloy.base.behaviour"]}})},f=YC(p(e=>d(!1,e),"minus","Decrease font size",[])),h=YC(p(e=>u(!1,e),"plus","Increase font size",[])),b=YC({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[sE.sketch({inputBehaviours:Vu([lv.config({}),yw(l,[CT({onSetup:s,getApi:a},i),ST({getApi:a},i)]),yw("input-update-display-text",[Vi(DL,(e,t)=>{_h.setValue(e,t.event.text)}),Vi(qa(),e=>{o.onAction(_h.getValue(e))}),Vi(Ja(),e=>{o.onAction(_h.getValue(e))})]),nw.config({mode:"special",onEnter:e=>(c(k,!0,!0),R.some(!0)),onEscape:m,onUp:e=>(u(!0,!1),R.some(!0)),onDown:e=>(d(!0,!1),R.some(!0)),onLeft:(e,t)=>(t.cut(),R.none()),onRight:(e,t)=>(t.cut(),R.none())})])})],behaviours:Vu([Tw.config({}),nw.config({mode:"special",onEnter:g,onSpace:g,onEscape:m}),yw("input-wrapper-events",[Vi($a(),e=>{j([f,h],t=>{const o=Ze.fromDom(t.get(e).element.dom);Qu(o)&&Zu(o)})})])])});return{dom:{tag:"div",classes:["tox-number-input"]},components:[f.asSpec(),b.asSpec(),h.asSpec()],behaviours:Vu([Tw.config({}),nw.config({mode:"flow",focusInside:Zv.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>Qu(e.element)?R.none():(Ju(e.element),R.some(!0))})])}},cq="Font sizes",dq="Font size {0}",uq="12pt",mq={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},gq={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},pq=(e,t)=>{const o=Math.pow(10,t);return Math.round(e*o)/o},fq=(e,t)=>/[0-9.]+px$/.test(e)?pq(72*parseInt(e,10)/96,t||0)+"pt":Se(gq,e).getOr(e),hq=e=>Se(mq,e).getOr(""),bq=e=>{const t=()=>{let t=R.none();const o=i.data,n=e.queryCommandValue("FontSize");if(n)for(let e=3;t.isNone()&&e>=0;e--){const r=fq(n,e),s=hq(r);t=X(o,e=>e.format===n||e.format===r||e.format===s)}return{matchOpt:t,size:n}},o=e=>t=>t.exists(t=>t.format===e),n=()=>{const{matchOpt:e}=t();return e},r=S(R.none),s=t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontSize",!1,t.format)})},a=o=>{const{matchOpt:n,size:r}=t(),s=n.fold(S(r),e=>e.title);Ri(o,DL,{text:s}),RD(e,{value:s})},i=NG(e,"font_size_formats",DG.Space);return{tooltip:SG(e,dq,uq),text:R.some(uq),icon:R.none(),isSelectedFor:o,getPreviewFor:r,getCurrentValue:n,onAction:s,updateText:a,dataset:i,shouldHide:!1,isInvalid:A}},vq=(e,t)=>EG(e,t,bq(e),dq,"FontSizeTextUpdate"),yq=e=>{var t;const o={step:1},n={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}};return null!==(t=n[e])&&void 0!==t?t:o},xq=16,wq=e=>e>=0,Cq=e=>{const t=()=>e.queryCommandValue("FontSize"),o=e=>Ri(e,DL,{text:t()});return{updateInputValue:o,onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{sq(o,["unsupportedLength","empty"]);const r=t(),s=sq(o,["unsupportedLength","empty"]).or(sq(r,["unsupportedLength","empty"])),a=s.map(e=>e.value).getOr(xq),i=Vk(e),l=s.map(e=>e.unit).filter(e=>""!==e).getOr(i),c=n(a,yq(l).step),d=`${wq(c)?c:a}${l}`;return d!==r&&BD(e,{value:d}),d}}},Sq=(e,t)=>lq(e,t,Cq(e)),kq=(e,t)=>{const o=_G(e,t,bq(e));e.ui.registry.addNestedMenuItem("fontsize",{text:cq,onSetup:LD(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})},_q="Formats",Eq="Format {0}",Oq=(e,t)=>{const o="Paragraph",n=t=>()=>e.formatter.match(t),r=t=>()=>{const o=e.formatter.get(t);return void 0!==o?R.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):R.none()},s=t=>{const n=e=>ZU(e)?Q(e.items,n):QU(e)?[{title:e.title,format:e.format}]:[],r=Q(iH(e),n),s=zG(e,S(r)),a=s.fold(S(o),e=>e.title);Ri(t,DL,{text:a}),AD(e,{value:a})};return{tooltip:SG(e,Eq,o),text:R.some(o),icon:R.none(),isSelectedFor:n,getCurrentValue:R.none,getPreviewFor:r,onAction:HD(e),updateText:s,shouldHide:Tk(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},Tq=(e,t)=>{const o={type:"advanced",...t.styles};return EG(e,t,Oq(e,o),Eq,"StylesTextUpdate")},Dq=(e,t)=>{const o={type:"advanced",...t.styles},n=_G(e,t,Oq(e,o));e.ui.registry.addNestedMenuItem("styles",{text:_q,onSetup:LD(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})},Aq=S([Ls("toggleClass"),Ls("fetch"),zd("onExecute"),na("getHotspot",R.some),na("getAnchorOverrides",S({})),mg(),zd("onItemExecute"),Ks("lazySink"),Ls("dom"),Ld("onOpen"),Eh("splitDropdownBehaviours",[gN,nw,Tw]),na("matchWidth",!1),na("useMinWidth",!1),na("eventOrder",{}),Ks("role")].concat(IN())),Nq=rb({factory:$C,schema:[Ls("dom")],name:"arrow",defaults:()=>({buttonBehaviours:Vu([Tw.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(Bi)},buttonBehaviours:Vu([qw.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),Rq=rb({factory:$C,schema:[Ls("dom")],name:"button",defaults:()=>({buttonBehaviours:Vu([Tw.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(o=>{e.onExecute(o,t)})}})}),Bq=S([Nq,Rq,ab({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[Ls("text")],name:"aria-descriptor"}),sb({schema:[Md()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each(n=>{e.onItemExecute(n,t,o)})}})}),SN()]),Mq=(e,t,o,n)=>{const r=e=>{jb.getCurrent(e).each(e=>{Tv.highlightFirst(e),nw.focusIn(e)})},s=t=>{const o=r;DN(e,k,t,n,o,BC.HighlightMenuAndItem).get(y)},a=e=>(s(e),R.some(!0)),i=t=>{const o=xb(t,e,"button");return Bi(o),R.some(!0)},l={...Fi([Zi((t,o)=>{const n=yb(t,e,"aria-descriptor");n.each(e=>{const o=fl("aria");to(e.element,"id",o),to(t.element,"aria-describedby",o)})})]),...Yw(R.some(s))},c={repositionMenus:e=>{qw.isOn(e)&&MN(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:c,eventOrder:{...e.eventOrder,[ci()]:["disabling","toggling","alloy.base.behaviour"]},events:l,behaviours:Th(e.splitDropdownBehaviours,[gN.config({others:{sandbox:t=>{const o=xb(t,e,"arrow"),n={onOpen:()=>{qw.on(o),qw.on(t)},onClose:()=>{qw.off(o),qw.off(t)}};return BN(e,t,n)}}}),nw.config({mode:"special",onSpace:i,onEnter:i,onDown:a}),Tw.config({}),qw.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},Iq=Fb({name:"SplitDropdown",configFields:Aq(),partFields:Bq(),factory:Mq,apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),Pq=e=>({isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t),setText:t=>Ri(e,DL,{text:t}),setIcon:t=>Ri(e,AL,{icon:t})}),Lq=e=>({setActive:t=>{qw.set(e,t)},isActive:()=>qw.isOn(e),isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t),setText:t=>Ri(e,DL,{text:t}),setIcon:t=>Ri(e,AL,{icon:t})}),Fq=(e,t)=>e.map(e=>({"aria-label":t.translate(e),title:t.translate(e)})).getOr({}),zq=fl("focus-button"),Uq=(e,t,o,n,r)=>{const s=t.map(e=>YC(TL(e,"tox-tbtn",r))),a=e.map(e=>YC(OL(e,r.icons)));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:Fq(o,r)},components:ET([a.map(e=>e.asSpec()),s.map(e=>e.asSpec())]),eventOrder:{[Ha()]:["focusing","alloy.base.behaviour",CL],[xi()]:[CL,"toolbar-group-button-events"]},buttonBehaviours:Vu([xT.toolbarButton(r.isDisabled),fT(),yw(CL,[Zi((e,t)=>kL(e)),Vi(DL,(e,t)=>{s.bind(t=>t.getOpt(e)).each(e=>{bw.set(e,[Jc(r.translate(t.event.text))])})}),Vi(AL,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{bw.set(e,[OL(t.event.icon,r.icons)])})}),Vi(Ha(),(e,t)=>{t.event.prevent(),Ni(e,zq)})])].concat(n.getOr([])))}},Hq=(e,t,o,n)=>{const r=t.shared,s=ga(y),a={toolbarButtonBehaviours:[],getApi:Pq,onSetup:e.onSetup},i=[yw("toolbar-group-button-events",[CT(a,s),ST(a,s)])];return XW.sketch({lazySink:r.getSink,fetch:()=>wN.nu(t=>{t(V(o(e.items),g$))}),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:Uq(e.icon,e.text,e.tooltip,R.some(i),r.providers),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})},Vq=(e,t,o)=>{var n;const r=ga(y),s=Uq(e.icon,e.text,e.tooltip,R.none(),o);return $C.sketch({dom:s.dom,components:s.components,eventOrder:SL,buttonBehaviours:{...Vu([yw("toolbar-button-events",[wL({onAction:e.onAction,getApi:t.getApi}),CT(t,r),ST(t,r)]),xT.toolbarButton(()=>!e.enabled||o.isDisabled()),fT()].concat(t.toolbarButtonBehaviours)),[CL]:null===(n=s.buttonBehaviours)||void 0===n?void 0:n[CL]}})},jq=(e,t)=>Wq(e,t,[]),Wq=(e,t,o)=>Vq(e,{toolbarButtonBehaviours:o.length>0?[yw("toolbarButtonWith",o)]:[],getApi:Pq,onSetup:e.onSetup},t),$q=(e,t)=>Gq(e,t,[]),Gq=(e,t,o)=>Vq(e,{toolbarButtonBehaviours:[bw.config({}),qw.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[yw("toolbarToggleButtonWith",o)]:[]),getApi:Lq,onSetup:e.onSetup},t),qq=(e,t,o)=>n=>wN.nu(e=>t.fetch(e)).map(r=>R.from(QN(Ar(BA(fl("menu-value"),r,o=>{t.onItemAction(e(n),o)},t.columns,t.presets,E_.CLOSE_ON_EXECUTE,t.select.getOr(A),o),{movement:IA(t.columns,t.presets),menuBehaviours:JO.unnamedEvents("auto"!==t.columns?[]:[Zi((e,o)=>{KO(e,4,q_(t.presets)).each(({numRows:t,numColumns:o})=>{nw.setGridSize(e,t,o)})})])})))),Kq=(e,t)=>{const o=e=>({isEnabled:()=>!lv.isDisabled(e),setEnabled:t=>lv.set(e,!t),setIconFill:(t,o)=>{md(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{to(e,"fill",o)})},setActive:t=>{to(e.element,"aria-pressed",t),md(e.element,"span").each(o=>{e.getSystem().getByDom(o).each(e=>qw.set(e,t))})},isActive:()=>md(e.element,"span").exists(t=>e.getSystem().getByDom(t).exists(qw.isOn)),setText:t=>md(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Ri(e,DL,{text:t}))),setIcon:t=>md(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Ri(e,AL,{icon:t}))),setTooltip:o=>{const n=t.providers.translate(o);oo(e.element,{"aria-label":n,title:n})}}),n=ga(y),r={getApi:o,onSetup:e.onSetup};return Iq.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...Fq(e.tooltip,t.providers)}},onExecute:t=>{const n=o(t);n.isEnabled()&&e.onAction(n)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:Vu([xT.splitButton(t.providers.isDisabled),fT(),yw("split-dropdown-events",[Zi((e,t)=>kL(e)),Vi(zq,Tw.focus),CT(r,n),ST(r,n)]),SB.config({})]),eventOrder:{[xi()]:["alloy.base.behaviour","split-dropdown-events"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:qq(o,e,t.providers),parts:{menu:Q_(!1,e.columns,e.presets)},components:[Iq.parts.button(Uq(e.icon,e.text,R.none(),R.some([qw.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),Iq.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:ek("chevron-down",t.providers.icons)},buttonBehaviours:Vu([xT.splitButton(t.providers.isDisabled),fT(),nk()])}),Iq.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},Yq=[{name:"history",items:["undo","redo"]},{name:"ai",items:["aidialog","aishortcuts"]},{name:"styles",items:["styles"]},{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"]}],Xq=(e,t)=>(o,n,r)=>{const s=e(o).mapError(e=>Ns(e)).getOrDie();return t(s,n,r)},Jq={button:Xq(mO,(e,t)=>jq(e,t.shared.providers)),togglebutton:Xq(fO,(e,t)=>$q(e,t.shared.providers)),menubutton:Xq(Ij,(e,t)=>GF(e,"tox-tbtn",t,R.none(),!1)),splitbutton:Xq(Lj,(e,t)=>Kq(e,t.shared)),grouptoolbarbutton:Xq(Rj,(e,t,o)=>{const n=o.ui.registry.getAll().buttons,r=e=>sK(o,{buttons:n,toolbar:e,allowToolbarGroups:!1},t,R.none()),s={[dg]:t.shared.header.isPositionedAtTop()?cg.TopToBottom:cg.BottomToTop};switch(Nk(o)){case dk.floating:return Hq(e,t,r,s);default:throw new Error("Toolbar groups are only supported when using floating toolbar mode")}})},Zq=(e,t,o)=>Se(Jq,e.type).fold(()=>(console.error("skipping button defined by",e),R.none()),n=>R.some(n(e,t,o))),Qq={styles:Tq,fontsize:vq,fontsizeinput:Sq,fontfamily:eq,blocks:WG,align:LG},eK=e=>{const t=V(Yq,t=>{const o=G(t.items,t=>ke(e,t)||ke(Qq,t));return{name:t.name,items:o}});return G(t,e=>e.items.length>0)},tK=e=>{const t=e.split("|");return V(t,e=>({items:e.trim().split(" ")}))},oK=e=>v(e,e=>ke(e,"name")&&ke(e,"items")),nK=e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?eK(o):i(t)?tK(t):oK(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},rK=(e,t,o,n,r,s)=>Se(t,o.toLowerCase()).orThunk(()=>s.bind(e=>de(e,e=>Se(t,e+o.toLowerCase())))).fold(()=>Se(Qq,o.toLowerCase()).map(t=>t(e,r)),t=>"grouptoolbarbutton"!==t.type||n?Zq(t,r,e):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),R.none())),sK=(e,t,o,n)=>{const r=nK(t),s=V(r,r=>{const s=Q(r.items,r=>0===r.trim().length?[]:rK(e,t.buttons,r,t.allowToolbarGroups,o,n).toArray());return{title:R.from(e.translate(r.name)),items:s}});return G(s,e=>e.items.length>0)},aK=(e,t,o,n)=>{const r=t.mainUi.outerContainer,s=o.toolbar,a=o.buttons;if(v(s,i)){const t=s.map(t=>{const r={toolbar:t,buttons:a,allowToolbarGroups:o.allowToolbarGroups};return sK(e,r,n,R.none())});iG.setToolbars(r,t)}else iG.setToolbar(r,sK(e,o,n,R.none()))},iK=_n(),lK=iK.os.isiOS()&&iK.os.version.major<=12,cK=(e,t)=>{const{uiMotherships:o}=t,n=e.dom;let r=e.getWin();const s=e.getDoc().documentElement,a=ga(Oo(r.innerWidth,r.innerHeight)),i=ga(Oo(s.offsetWidth,s.offsetHeight)),l=()=>{const t=a.get();t.left===r.innerWidth&&t.top===r.innerHeight||(a.set(Oo(r.innerWidth,r.innerHeight)),kD(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(Oo(t.offsetWidth,t.offsetHeight)),kD(e))},d=t=>{_D(e,t)};n.bind(r,"resize",l),n.bind(r,"scroll",d);const u=Bm(Ze.fromDom(e.getBody()),"load",c);e.on("hide",()=>{j(o,e=>{uo(e.element,"display","none")})}),e.on("show",()=>{j(o,e=>{yo(e.element,"display")})}),e.on("NodeChange",c),e.on("remove",()=>{u.unbind(),n.unbind(r,"resize",l),n.unbind(r,"scroll",d),r=null})},dK=(e,t,o)=>{b_(e)&&wf(o.mainUi.mothership.element,o.popupUi.mothership),xf(t,o.dialogUi.mothership)},uK=(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=t,i=ga(0),l=s.outerContainer;wG(e);const c=Ze.fromDom(r.targetNode),d=$t(Wt(c));wf(c,s.mothership),dK(e,d,t),e.on("SkinLoaded",()=>{iG.setSidebar(l,o.sidebar,Qk(e)),aK(e,t,o,n),i.set(e.getWin().innerWidth),iG.setMenubar(l,mG(e,o)),iG.setViews(l,o.views),cK(e,t)});const m=iG.getSocket(l).getOrDie("Could not find expected socket element");if(lK){mo(m.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=HP(()=>{e.dispatch("ScrollContent")},20),o=Rm(m.element,"scroll",t.throttle);e.on("remove",o.unbind)}pT(e,t),e.addCommand("ToggleSidebar",(t,o)=>{iG.toggleSidebar(l,o),e.dispatch("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",()=>{var e;return null!==(e=iG.whichSidebar(l))&&void 0!==e?e:""}),e.addCommand("ToggleView",(t,o)=>{if(iG.toggleView(l,o)){const t=l.element;s.mothership.broadcastOn([Wf()],{target:t}),j(a,e=>{e.broadcastOn([Wf()],{target:t})}),u(iG.whichView(l))&&(e.focus(),e.nodeChanged(),iG.refreshToolbar(l))}}),e.addQueryValueHandler("ToggleView",()=>{var e;return null!==(e=iG.whichView(l))&&void 0!==e?e:""});const g=Nk(e),p=()=>{iG.refreshToolbar(t.mainUi.outerContainer)};g!==dk.sliding&&g!==dk.floating||e.on("ResizeWindow ResizeEditor ResizeContent",()=>{const t=e.getWin().innerWidth;t!==i.get()&&(p(),i.set(t))});const f={setEnabled:e=>{gT(t,!e)},isEnabled:()=>!lv.isDisabled(l)};return{iframeContainer:m.element.dom,editorContainer:l.element.dom,api:f}};var mK=Object.freeze({__proto__:null,render:uK});const gK=e=>{const t=/^[0-9\.]+(|px)$/i;return t.test(""+e)?R.some(parseInt(""+e,10)):R.none()},pK=e=>b(e)?e+"px":e,fK=(e,t,o)=>{const n=t.filter(t=>ee>t);return n.or(r).getOr(e)},hK=e=>{const t=xk(e),o=Sk(e),n=_k(e);return gK(t).map(e=>fK(e,o,n))},bK=e=>{const t=hK(e);return t.getOr(xk(e))},vK=e=>{const t=wk(e),o=Ck(e),n=kk(e);return gK(t).map(e=>fK(e,o,n))},yK=e=>{const t=vK(e);return t.getOr(wk(e))},{ToolbarLocation:xK,ToolbarMode:wK}=y_,CK=40,SK=(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=o,i=gk.DOM,l=g_(e),c=h_(e),d=kk(e).or(vK(e)),u=n.shared.header,m=u.isPositionedAtTop,g=Nk(e),p=g===wK.sliding||g===wK.floating,f=ga(!1),h=()=>f.get()&&!e.removed,b=e=>p?e.fold(S(0),e=>e.components().length>1?So(e.components()[1].element):0):0,v=o=>{switch(Bk(e)){case xK.auto:const e=iG.getToolbar(s.outerContainer),n=b(e),r=So(o.element)-n,a=or(t),i=a.y>r;if(i)return"top";{const e=Tt(t),o=Math.max(e.dom.scrollHeight,So(e)),n=a.bottom{r.on(t=>{gj.setModes(t,[e]),u.setDockingMode(e);const o=m()?cg.TopToBottom:cg.BottomToTop;to(t.element,dg,o)})},x=()=>{r.on(e=>{const o=d.getOrThunk(()=>{const e=gK(po(Zt(),"margin-left")).getOr(0);return Mo(Zt())-Ao(t).left+e});uo(e.element,"max-width",o+"px")})},w=o=>{r.on(n=>{const r=iG.getToolbar(s.outerContainer),a=b(r),i=or(t),{top:l,left:c}=C(e,s.outerContainer.element).fold(()=>({top:m()?Math.max(i.y-So(n.element)+a,0):i.bottom,left:i.x}),e=>{var t;const o=or(e),r=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,s=kt(e,Zt()),l=s?Math.max(i.y-So(n.element)+a,0):i.y-o.y+r-So(n.element)+a;return{top:m()?l:i.bottom,left:s?i.x:i.x-o.x}}),d={position:"absolute",left:Math.round(c)+"px",top:Math.round(l)+"px"},u=o.map(e=>{const t=Hn(),o=150,n=window.innerWidth-(c-t.left),r=Math.max(Math.min(e,n),o);return{width:r+"px"}}).getOr({});mo(s.outerContainer.element,{...d,...u})})},C=(e,t)=>b_(e)?wV(t):R.none(),k=()=>{j(a,e=>{e.broadcastOn([$f()],{})})},_=()=>{if(l)return R.none();{const e=Ao(s.outerContainer.element).left+Io(s.outerContainer.element);if(e>=window.innerWidth-CK||ho(s.outerContainer.element,"width").isSome()){uo(s.outerContainer.element,"position","absolute"),uo(s.outerContainer.element,"left","0px"),yo(s.outerContainer.element,"width");const e=Io(s.outerContainer.element);return R.some(e)}return R.none()}},E=e=>{if(!h())return;l||x();const t=l?R.none():_();p&&iG.refreshToolbar(s.outerContainer),l||w(t),c&&r.on(e),k()},O=()=>!(l||!c||!h())&&r.get().exists(e=>{const t=u.getDockingMode(),o=v(e);return o!==t&&(y(o),!0)}),T=()=>{f.set(!0),uo(s.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),j(a,e=>{yo(e.element,"display")}),O(),b_(e)?E(e=>gj.isDocked(e)?gj.reset(e):gj.refresh(e)):E(gj.refresh)},D=()=>{f.set(!1),uo(s.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),j(a,e=>{uo(e.element,"display","none")})},A=()=>{const e=O();e&&E(gj.reset)};return{isVisible:h,isPositionedAtTop:m,show:T,hide:D,update:E,updateMode:A,repositionPopups:k}},kK=(e,t)=>{const o=or(e);return{pos:t?o.y:o.bottom,bounds:o}},_K=(e,t,o,n)=>{const r=ga(kK(t,o.isPositionedAtTop())),s=n=>{const{pos:s,bounds:a}=kK(t,o.isPositionedAtTop()),{pos:i,bounds:l}=r.get(),c=a.height!==l.height||a.width!==l.width;r.set({pos:s,bounds:a}),c&&kD(e,n),o.isVisible()&&(i!==s?o.update(gj.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",()=>o.update(gj.reset)),e.on("NodeChange keydown",e=>{requestAnimationFrame(()=>s(e))});let a=0;const i=VP(()=>o.update(gj.refresh),33);e.on("ScrollWindow",()=>{const e=Hn().left;e!==a&&(a=e,i.throttle()),o.updateMode()}),b_(e)&&e.on("ElementScroll",e=>{o.update(gj.refresh)});const l=Dm();l.set(Bm(Ze.fromDom(e.getBody()),"load",e=>s(e.raw))),e.on("remove",()=>{l.clear()})},EK=(e,t,o,n,r)=>{const{mainUi:s}=t,a=Am(),i=Ze.fromDom(r.targetNode),l=SK(e,i,t,n,a),c=Pk(e);CG(e);const d=()=>{if(a.isSet())return void l.show();a.set(iG.getHeader(s.outerContainer).getOrDie());const r=p_(e);b_(e)?(wf(i,s.mothership),wf(i,t.popupUi.mothership)):xf(r,s.mothership),xf(r,t.dialogUi.mothership),aK(e,t,o,n),iG.setMenubar(s.outerContainer,mG(e,o)),l.show(),_K(e,i,l,c),e.nodeChanged()};e.on("show",d),e.on("hide",l.hide),c||(e.on("focus",d),e.on("blur",l.hide)),e.on("init",()=>{(e.hasFocus()||c)&&d()}),pT(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{gT(t,!e)},isEnabled:()=>!lv.isDisabled(s.outerContainer)};return{editorContainer:s.outerContainer.element.dom,api:u}};var OK=Object.freeze({__proto__:null,render:EK});const TK=()=>{const e=Am(),t=Am(),o=Am(),n=(e,t)=>()=>o.get().bind(e=>t(e.outerContainer)).getOrDie(`Could not find ${e} element in OuterContainer`),r=()=>{const o=e.get().map(e=>e.mothership),n=t.get().map(e=>e.mothership);return o.fold(()=>n.toArray(),e=>n.fold(()=>[e],t=>kt(e.element,t.element)?[e]:[e,t]))};return{dialogUi:e,popupUi:t,mainUi:o,getUiMotherships:r,lazyGetInOuterOrDie:n}},DK="contexttoolbar-show",AK="contexttoolbar-hide",NK=e=>({hide:()=>Ni(e,gi()),getValue:()=>_h.getValue(e)}),RK=(e,t)=>Vi(xL,(o,n)=>{const r=e.get(o),s=NK(r);t.onAction(s,n.event.buttonApi)}),BK=(e,t,o)=>{const{primary:n,...r}=t.original,s=Ds(mO({...r,type:"button",onAction:y}));return Wq(s,o,[RK(e,t)])},MK=(e,t,o)=>{const{primary:n,...r}=t.original,s=Ds(fO({...r,type:"togglebutton",onAction:y}));return Gq(s,o,[RK(e,t)])},IK=e=>"contextformtogglebutton"===e.type,PK=(e,t,o)=>IK(t)?MK(e,t,o):BK(e,t,o),LK=(e,t,o)=>{const n=V(t,t=>YC(PK(e,t,o))),r=()=>V(n,e=>e.asSpec()),s=e=>de(t,(t,o)=>t.primary?R.from(n[o]).bind(t=>t.getOpt(e)).filter(O(lv.isDisabled)):R.none());return{asSpecs:r,findPrimary:s}},FK=(e,t)=>{const o=e.label.fold(()=>({}),e=>({"aria-label":e})),n=YC(sE.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:Vu([nw.config({mode:"special",onEnter:e=>r.findPrimary(e).map(e=>(Bi(e),!0)),onLeft:(e,t)=>(t.cut(),R.none()),onRight:(e,t)=>(t.cut(),R.none())})])})),r=LK(n,e.commands,t);return[{title:R.none(),items:[n.asSpec()]},{title:R.none(),items:r.asSpecs()}]},zK=(e,t,o)=>v$({type:e,uid:fl("context-toolbar"),initGroups:FK(t,o),onEscape:R.none,cyclicKeying:!0,providers:o}),UK={renderContextForm:zK,buildInitGroups:FK},HK=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,VK=e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=Ut(Ze.fromDom(e.startContainer),e.startOffset).element,n=ht(o)?At(o):R.some(o);return n.filter(ft).map(e=>e.dom.getBoundingClientRect()).getOr(t)}return t},jK=e=>{const t=e.selection.getRng(),o=VK(t);if(e.inline){const e=Hn();return tr(e.left+o.left,e.top+o.top,o.width,o.height)}{const t=nr(Ze.fromDom(e.getBody()));return tr(t.x+o.left,t.y+o.top,o.width,o.height)}},WK=(e,t)=>t.filter(e=>Jt(e)&&pt(e)).map(nr).getOrThunk(()=>jK(e)),$K=(e,t,o)=>{const n=Math.max(e.x+o,t.x),r=Math.min(e.right-o,t.right);return{x:n,width:r-n}},GK=(e,t,o,n,r,s)=>{const a=Ze.fromDom(e.getContainer()),i=md(a,".tox-editor-header").getOr(a),l=or(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+s,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-s,o.bottom)};const u="line"===r?or(a):t;return d?{y:Math.max(l.bottom+s,o.y),bottom:Math.min(u.bottom-s,o.bottom)}:{y:Math.max(u.y+s,o.y),bottom:Math.min(l.y-s,o.bottom)}},qK=(e,t,o,n=0)=>{const r=$n(window),s=or(Ze.fromDom(e.getContentAreaContainer())),a=r_(e)||l_(e)||d_(e),{x:i,width:l}=$K(s,r,n);if(e.inline&&!a)return tr(i,r.y,l,r.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=GK(e,s,r,a,o,n);return tr(i,c,l,d-c)}},KK=12,YK={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"]},XK={maxHeightFunction:Qm(),maxWidthFunction:UW()},JK=(e,t)=>{const o=e.selection.getRng(),n=Ut(Ze.fromDom(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&kt(n.element,t)},ZK=(e,t,o)=>{const n=ho(e,"position");uo(e,"position",t);const r=o(e);return n.each(t=>uo(e,"position",t)),r},QK=e=>"node"===e,eY=(e,t,o,n,r)=>{const s=jK(e),a=n.lastElement().exists(e=>kt(o,e));if(JK(e,o))return a?MU:DU;if(a)return ZK(t,n.getMode(),()=>{const e=HK(s,or(t),-20);return e&&!n.isReposition()?PU:MU});{const e="fixed"===n.getMode()?r.y+Hn().top:r.y,o=So(t)+KK;return e+o<=s.y?DU:AU}},tY=(e,t,o,n)=>{const r=t=>(n,r,s,a,i)=>{const l=eY(e,a,t,o,i),c={...n,y:i.y,height:i.height};return{...l(c,r,s,a,i),alwaysFit:!0}},s=e=>QK(n)?[r(e)]:[],a={onLtr:e=>[wu,Cu,yu,bu,xu,vu].concat(s(e)),onRtl:e=>[wu,Cu,xu,vu,yu,bu].concat(s(e))},i={onLtr:e=>[Cu,bu,vu,yu,xu,wu].concat(s(e)),onRtl:e=>[Cu,vu,bu,xu,yu,wu].concat(s(e))};return t?i:a},oY=(e,t,o,n)=>"line"===t?{bubble:rg(KK,0,YK),layouts:{onLtr:()=>[Su],onRtl:()=>[ku]},overrides:XK}:{bubble:rg(0,KK,YK,1/KK),layouts:tY(e,o,n,t),overrides:XK},nY=(e,t)=>{const o=G(t,t=>t.predicate(e.dom)),{pass:n,fail:r}=$(o,e=>"contexttoolbar"===e.type);return{contextToolbars:n,contextForms:r}},rY=e=>{if(e.length<=1)return e;{const t=t=>z(e,e=>e.position===t),o=t=>G(e,e=>e.position===t),n=t("selection"),r=t("node");if(n||r){if(r&&n){const e=o("node"),t=V(o("selection"),e=>({...e,position:"node"}));return e.concat(t)}return o(n?"selection":"node")}return o("line")}},sY=e=>{if(e.length<=1)return e;{const t=t=>X(e,e=>e.position===t),o=t("selection").orThunk(()=>t("node")).orThunk(()=>t("line")).map(e=>e.position);return o.fold(()=>[],t=>G(e,e=>e.position===t))}},aY=(e,t,o)=>{const n=nY(e,t);if(n.contextForms.length>0)return R.some({elem:e,toolbars:[n.contextForms[0]]});{const t=nY(e,o);if(t.contextForms.length>0)return R.some({elem:e,toolbars:[t.contextForms[0]]});if(n.contextToolbars.length>0||t.contextToolbars.length>0){const o=rY(n.contextToolbars.concat(t.contextToolbars));return R.some({elem:e,toolbars:o})}return R.none()}},iY=(e,t,o)=>e(t)?R.none():Oa(t,e=>{if(ft(e)){const{contextToolbars:t,contextForms:n}=nY(e,o.inNodeScope),r=n.length>0?n:sY(t);return r.length>0?R.some({elem:e,toolbars:r}):R.none()}return R.none()},e),lY=(e,t)=>{const o=Ze.fromDom(t.getBody()),n=e=>kt(e,o),r=e=>!n(e)&&!_t(o,e),s=Ze.fromDom(t.selection.getNode());return r(s)?R.none():aY(s,e.inNodeScope,e.inEditorScope).orThunk(()=>iY(n,s,e))},cY=(e,t)=>{const o={},n=[],r=[],s={},a={},i=(e,i)=>{const l=Ds(SO(i));o[e]=l,l.launch.map(o=>{s["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}}),"editor"===l.scope?r.push(l):n.push(l),a[e]=l},l=(e,t)=>{_O(t).each(o=>{"editor"===t.scope?r.push(o):n.push(o),a[e]=o})},c=ue(e);return j(c,t=>{const o=e[t];"contextform"===o.type?i(t,o):"contexttoolbar"===o.type&&l(t,o)}),{forms:o,inNodeScope:n,inEditorScope:r,lookupTable:a,formNavigators:s}},dY=fl("forward-slide"),uY=fl("backward-slide"),mY=fl("change-slide-event"),gY="tox-pop--resizing",pY=e=>{const t=ga([]);return VC.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),VC.getContent(e).each(e=>{yo(e.element,"visibility")}),xc(e.element,gY),yo(e.element,"width")},inlineBehaviours:Vu([yw("context-toolbar-events",[Ji(ei(),(e,t)=>{"width"===t.event.raw.propertyName&&(xc(e.element,gY),yo(e.element,"width"))}),Vi(mY,(e,t)=>{const o=e.element;yo(o,"width");const n=Mo(o);VC.setContent(e,t.event.contents),vc(o,gY);const r=Mo(o);uo(o,"width",n+"px"),VC.getContent(e).each(e=>{t.event.focus.bind(e=>(Ju(e),tm(o))).orThunk(()=>(nw.focusIn(e),em(Wt(o))))}),setTimeout(()=>{uo(e.element,"width",r+"px")},0)}),Vi(dY,(e,o)=>{VC.getContent(e).each(o=>{t.set(t.get().concat([{bar:o,focus:em(Wt(e.element))}]))}),Ri(e,mY,{contents:o.event.forwardContents,focus:R.none()})}),Vi(uY,(e,o)=>{le(t.get()).each(o=>{t.set(t.get().slice(0,t.get().length-1)),Ri(e,mY,{contents:nd(o.bar),focus:o.focus})})})]),nw.config({mode:"special",onEscape:o=>le(t.get()).fold(()=>e.onEscape(),e=>(Ni(o,uY),R.some(!0)))})]),lazySink:()=>ur.value(e.sink)})},fY="tox-pop--transition",hY=(e,t,o,n)=>{const r=n.backstage,s=r.shared,a=_n().deviceType.isTouch,i=Am(),l=Am(),c=Am(),d=od(pY({sink:o,onEscape:()=>(e.focus(),R.some(!0))})),u=()=>{const t=c.get().getOr("node"),o=QK(t)?1:0;return qK(e,s,t,o)},m=()=>!e.removed&&!(a()&&r.isContextMenuOpen()),g=e=>Ee(Ae(e,i.get(),kt),!0),p=()=>{if(m()){const t=u(),o=Ee(c.get(),"node")?WK(e,i.get()):jK(e);return t.height<=0||!HK(o,t,.01)}return!0},f=()=>{i.clear(),l.clear(),c.clear(),VC.hide(d)},h=()=>{if(VC.isOpen(d)){const e=d.element;yo(e,"display"),p()?uo(e,"display","none"):(l.set(0),VC.reposition(d))}},b=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:Vu([nw.config({mode:"acyclic"}),yw("pop-dialog-wrap-events",[Zi(t=>{e.shortcuts.add("ctrl+F9","focus statusbar",()=>nw.focusIn(t))}),Qi(t=>{e.shortcuts.remove("ctrl+F9")})])])}),v=Lo(()=>cY(t,e=>{const t=C([e]);Ri(d,dY,{forwardContents:b(t)})})),x=(t,o)=>sK(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,R.some(["form:"])),w=(e,t)=>UK.buildInitGroups(e,t),C=t=>{const{buttons:o}=e.ui.registry.getAll(),n=v(),r={...o,...n.formNavigators},a=Nk(e)===dk.scrolling?dk.scrolling:dk.default,i=Z(V(t,e=>"contexttoolbar"===e.type?x(r,e):w(e,s.providers)));return v$({type:a,uid:fl("context-toolbar"),initGroups:i,onEscape:R.none,cyclicKeying:!0,providers:s.providers})},S=(t,n)=>{const r="node"===t?s.anchors.node(n):s.anchors.cursor(),c=oY(e,t,a(),{lastElement:i.get,isReposition:()=>Ee(l.get(),0),getMode:()=>rf.getMode(o)});return Ar(r,c)},k=(e,t)=>{if(E.cancel(),!m())return;const n=C(e),r=e[0].position,s=S(r,t);c.set(r),l.set(1);const a=d.element;yo(a,"display"),g(t)||(xc(a,fY),rf.reset(o,d)),VC.showWithinBounds(d,b(n),{anchor:s,transition:{classes:[fY],mode:"placement"}},()=>R.some(u())),t.fold(i.clear,i.set),p()&&uo(a,"display","none")};let _=!1;const E=VP(()=>{if(e.hasFocus()&&!e.removed&&!_)if(Cc(d.element,fY))E.throttle();else{const t=v();lY(t,e).fold(f,e=>{k(e.toolbars,R.some(e.elem))})}},17);e.on("init",()=>{e.on("remove",f),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",h),e.on("click keyup focus SetContent",E.throttle),e.on(AK,f),e.on(DK,t=>{const o=v();Se(o.lookupTable,t.toolbarKey).each(o=>{k([o],Be(t.target!==e,t.target)),VC.getContent(d).each(nw.focusIn)})}),e.on("focusout",t=>{jC.setEditorTimeout(e,()=>{tm(o.element).isNone()&&tm(d.element).isNone()&&f()},0)}),e.on("SwitchMode",()=>{e.mode.isReadOnly()&&f()}),e.on("AfterProgressState",t=>{t.state?f():e.hasFocus()&&E.throttle()}),e.on("dragstart",()=>{_=!0}),e.on("dragend drop",()=>{_=!1}),e.on("NodeChange",e=>{tm(d.element).fold(E.throttle,y)})})},bY=e=>{const t=[{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"}];j(t,t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:VD(e,t.cmd),onSetup:zD(e,t.name)})}),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:LD(e),onAction:VD(e,"JustifyNone")})},vY=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),r=Am();return V(o,o=>({type:"togglemenuitem",text:t.display(o),onSetup:s=>{const a=e=>{e&&(r.on(e=>e.setActive(!1)),r.set(s)),s.setActive(e)};a(Ee(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{r.clear(),i()}},onAction:()=>t.setCurrent(e,o)}))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},yY=e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:i_,hash:e=>aq(e,["fixed","relative","empty"]).getOr(e),display:k,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>R.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:LD(e),onMenuSetup:LD(e)}),xY=e=>{const t=R.from(Dk(e));return t.map(t=>({name:"language",text:"Language",icon:"language",getOptions:S(t),hash:e=>g(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>{var n;return e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:null!==(n=t.customCode)&&void 0!==n?n:null}).unbind},getCurrent:e=>{const t=Ze.fromDom(e.selection.getNode());return Ta(t,e=>R.some(e).filter(ft).bind(e=>{const t=ro(e,"lang");return t.map(t=>{const o=ro(e,"data-mce-lang").getOrUndefined();return{code:t,customCode:o,title:""}})}))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=Dm();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),PD(o.clear,LD(e)(t))},onMenuSetup:LD(e)}))},wY=e=>{vY(e,yY(e)),xY(e).each(t=>vY(e,t))},CY=(e,t)=>{FG(e,t),tq(e,t),Dq(e,t),$G(e,t),kq(e,t)},SY=e=>UD(e,"NodeChange",t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())}),kY=e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:SY(e),onAction:VD(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:LD(e),onAction:VD(e,"indent")})},_Y=e=>{kY(e)},EY=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),PD(()=>e.off("PastePlainTextToggle",n),LD(e)(o))},OY=e=>{const t=ga(Zk(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:EY(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:EY(e,t)})},TY=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},DY=e=>{PP.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"}],(t,o)=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:zD(e,t.name),onAction:TY(e,t.name)})});for(let t=1;t<=6;t++){const o="h"+t;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:zD(e,o),onAction:TY(e,o)})}},AY=e=>{PP.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{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:"print",text:"Print",action:"mcePrint",icon:"print"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:VD(e,t.action)})}),PP.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:LD(e),onAction:VD(e,t.action)})})},NY=e=>{PP.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:VD(e,t.action),onSetup:zD(e,t.name)})})},RY=e=>{DY(e),AY(e),NY(e)},BY=e=>{PP.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:VD(e,t.action)})}),PP.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"},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onSetup:LD(e),onAction:VD(e,t.action)})}),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:LD(e),onAction:TY(e,"code")})},MY=e=>{RY(e),BY(e)},IY=(e,t)=>UD(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())}),PY=e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:IY(e,"hasUndo"),onAction:VD(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:IY(e,"hasRedo"),onAction:VD(e,"redo")})},LY=e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:IY(e,"hasUndo"),onAction:VD(e,"undo")}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:IY(e,"hasRedo"),onAction:VD(e,"redo")})},FY=e=>{PY(e),LY(e)},zY=e=>UD(e,"VisualAid",t=>{t.setActive(e.hasVisual)}),UY=e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:zY(e),onAction:VD(e,"mceToggleVisualAid")})},HY=e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:VD(e,"mceToggleVisualAid")})},VY=e=>{HY(e),UY(e)},jY=(e,t)=>{bY(e),MY(e),CY(e,t),FY(e),RA(e),VY(e),_Y(e),wY(e),OY(e)},WY=e=>i(e)?e.split(/[ ,]/):e,$Y=e=>t=>t.options.get(e),GY=e=>{const t=e.options.register;t("contextmenu_avoid_overlap",{processor:"string",default:""}),t("contextmenu_never_use_native",{processor:"boolean",default:!1}),t("contextmenu",{processor:e=>!1===e?{value:[],valid:!0}:i(e)||v(e,i)?{value:WY(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})},qY=$Y("contextmenu_never_use_native"),KY=$Y("contextmenu_avoid_overlap"),YY=e=>0===XY(e).length,XY=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:G(o,e=>ke(t,e))},JY=(e,t)=>({type:"makeshift",x:e,y:t}),ZY=(e,t,o)=>JY(e.x+t,e.y+o),QY=e=>"longpress"===e.type||0===e.type.indexOf("touch"),eX=e=>{if(QY(e)){const t=e.touches[0];return JY(t.pageX,t.pageY)}return JY(e.pageX,e.pageY)},tX=e=>{if(QY(e)){const t=e.touches[0];return JY(t.clientX,t.clientY)}return JY(e.clientX,e.clientY)},oX=(e,t)=>{const o=gk.DOM.getPos(e);return ZY(t,o.x,o.y)},nX=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?eX(t):oX(e.getContentAreaContainer(),tX(t)):rX(e),rX=e=>({type:"selection",root:Ze.fromDom(e.selection.getNode())}),sX=e=>({type:"node",node:R.some(Ze.fromDom(e.selection.getNode())),root:Ze.fromDom(e.getBody())}),aX=(e,t,o)=>{switch(o){case"node":return sX(e);case"point":return nX(e,t);case"selection":return rX(e)}},iX=(e,t,o,n,r,s)=>{const a=o(),i=aX(e,t,s);VL(a,E_.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:R.none()}).map(e=>{t.preventDefault(),VC.showMenuAt(r,{anchor:i},{menu:{markers:X_("normal")},data:e})})},lX={onLtr:()=>[Cu,bu,vu,yu,xu,wu,DU,AU,TU,EU,OU,_U],onRtl:()=>[Cu,vu,bu,xu,yu,wu,DU,AU,OU,_U,TU,EU]},cX=12,dX={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"]},uX=(e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],r=o.getRng(),s=yp(e.getWin(),Jg.domRange(r));return s.exists(e=>e.left<=n.clientX&&e.right>=n.clientX&&e.top<=n.clientY&&e.bottom>=n.clientY)}},mX=e=>{const t=e.selection.getRng(),o=()=>{jC.setEditorTimeout(e,()=>{e.selection.setRng(t)},10),s()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const r=()=>s();e.once("longpresscancel",r);const s=()=>{e.off("touchend",o),e.off("longpresscancel",r),e.off("mousedown",n)}},gX=(e,t,o)=>{const n=aX(e,t,o),r="point"===o?cX:0;return{bubble:rg(0,r,dX),layouts:lX,overrides:{maxWidthFunction:UW(),maxHeightFunction:Qm()},...n}},pX=(e,t,o,n,r,s,a)=>{const i=gX(e,t,s);VL(o,E_.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:R.none()}).map(o=>{t.preventDefault();const l=a?BC.HighlightMenuAndItem:BC.HighlightNone;VC.showMenuWithinBounds(r,{anchor:i},{menu:{markers:X_("normal"),highlightOnOpen:l},data:o,type:"horizontal"},()=>R.some(qK(e,n.shared,"node"===s?"node":"selection"))),e.dispatch(AK)})},fX=(e,t,o,n,r,s)=>{const a=_n(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),u=()=>!(c||i||l&&d),m=()=>{const a=o();pX(e,t,a,n,r,s,u())};if((l||i)&&"node"!==s){const o=()=>{mX(e),m()};uX(e,t)?o():(e.once("selectionchange",o),e.once("touchend",()=>e.off("selectionchange",o)))}else m()},hX=e=>i(e)?"|"===e:"separator"===e.type,bX={type:"separator"},vX=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(i(e))return e;switch(e.type){case"separator":return bX;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return i(t)?t:V(t,vX)}};default:const o=e;return{type:"menuitem",...t(o),onAction:x(o.onAction)}}},yX=(e,t)=>{if(0===t.length)return e;const o=le(e).filter(e=>!hX(e)),n=o.fold(()=>[],e=>[bX]);return e.concat(n).concat(t).concat([bX])},xX=(e,t,o)=>{const n=K(t,(t,n)=>Se(e,n.toLowerCase()).map(e=>{const n=e.update(o);if(i(n)&&We(je(n)))return yX(t,n.split(" "));if(d(n)&&n.length>0){const e=V(n,vX);return yX(t,e)}return t}).getOrThunk(()=>t.concat([n])),[]);return n.length>0&&hX(n[n.length-1])&&n.pop(),n},wX=(e,t)=>t.ctrlKey&&!qY(e),CX=e=>"longpress"===e.type||ke(e,"touches"),SX=(e,t)=>!CX(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),kX=(e,t)=>SX(e,t)?e.selection.getStart(!0):t.target,_X=(e,t)=>{const o=KY(e),n=SX(e,t)?"selection":"point";if(We(o)){const r=kX(e,t),s=dR(Ze.fromDom(r),o);return s?"node":n}return n},EX=(e,t,o)=>{const n=_n(),r=n.deviceType.isTouch,s=od(VC.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:Vu([yw("dismissContextMenu",[Vi(Ci(),(t,o)=>{jf.close(t),e.focus()})])])})),a=()=>VC.hide(s),i=t=>{if(qY(e)&&t.preventDefault(),wX(e,t)||YY(e))return;const n=_X(e,t),a=()=>{const o=kX(e,t),n=e.ui.registry.getAll(),r=XY(e);return xX(n.contextMenus,r,o)},i=r()?fX:iX;i(e,t,a,o,s,n)};e.on("init",()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(r()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)})},OX=fa.generate([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),TX=e=>t=>t.translate(-e.left,-e.top),DX=e=>t=>t.translate(e.left,e.top),AX=e=>(t,o)=>K(e,(e,t)=>t(e),Oo(t,o)),NX=(e,t,o)=>e.fold(AX([DX(o),TX(t)]),AX([TX(t)]),AX([])),RX=(e,t,o)=>e.fold(AX([DX(o)]),AX([]),AX([DX(t)])),BX=(e,t,o)=>e.fold(AX([]),AX([TX(o)]),AX([DX(t),TX(o)])),MX=(e,t,o,n,r,s)=>{const a=RX(e,r,s),i=RX(t,r,s);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n},IX=(e,t,o,n,r,s)=>{const a=RX(e,r,s),i=RX(t,r,s),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return Oo(l,c)},PX=(e,t,o)=>{const n=e.fold((e,t)=>({position:R.some("absolute"),left:R.some(e+"px"),top:R.some(t+"px")}),(e,t)=>({position:R.some("absolute"),left:R.some(e-o.left+"px"),top:R.some(t-o.top+"px")}),(e,t)=>({position:R.some("fixed"),left:R.some(e+"px"),top:R.some(t+"px")}));return{right:R.none(),bottom:R.none(),...n}},LX=(e,t,o)=>e.fold((e,n)=>zX(e+t,n+o),(e,n)=>UX(e+t,n+o),(e,n)=>HX(e+t,n+o)),FX=(e,t,o,n)=>{const r=(e,r)=>(s,a)=>{const i=e(t,o,n);return r(s.getOr(i.left),a.getOr(i.top))};return e.fold(r(BX,zX),r(RX,UX),r(NX,HX))},zX=OX.offset,UX=OX.absolute,HX=OX.fixed,VX=(e,t)=>{const o=no(e,t);return g(o)?NaN:parseInt(o,10)},jX=(e,t)=>{const o=e.element,n=VX(o,t.leftAttr),r=VX(o,t.topAttr);return isNaN(n)||isNaN(r)?R.none():R.some(Oo(n,r))},WX=(e,t,o)=>{const n=e.element;to(n,t.leftAttr,o.left+"px"),to(n,t.topAttr,o.top+"px")},$X=(e,t)=>{const o=e.element;ao(o,t.leftAttr),ao(o,t.topAttr)},GX=(e,t,o,n)=>jX(e,t).fold(()=>o,e=>HX(e.left+n.left,e.top+n.top)),qX=(e,t,o,n,r,s)=>{const a=GX(e,t,o,n),i=t.mustSnap?XX(e,t,a,r,s):JX(e,t,a,r,s),l=NX(a,r,s);return WX(e,t,l),i.fold(()=>({coord:HX(l.left,l.top),extra:R.none()}),e=>({coord:e.output,extra:e.extra}))},KX=(e,t)=>{$X(e,t)},YX=(e,t,o,n)=>de(e,e=>{const r=e.sensor,s=MX(t,r,e.range.left,e.range.top,o,n);return s?R.some({output:FX(e.output,t,o,n),extra:e.extra}):R.none()}),XX=(e,t,o,n,r)=>{const s=t.getSnapPoints(e),a=YX(s,o,n,r);return a.orThunk(()=>{const e=K(s,(e,t)=>{const s=t.sensor,a=IX(o,s,t.range.left,t.range.top,n,r);return e.deltas.fold(()=>({deltas:R.some(a),snap:R.some(t)}),o=>{const n=(a.left+a.top)/2,r=(o.left+o.top)/2;return n<=r?{deltas:R.some(a),snap:R.some(t)}:e})},{deltas:R.none(),snap:R.none()});return e.snap.map(e=>({output:FX(e.output,o,n,r),extra:e.extra}))})},JX=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return YX(s,o,n,r)},ZX=(e,t,o)=>({coord:FX(e.output,e.output,t,o),extra:e.extra}),QX=(e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const t=Et(e.element),o=Hn(t),s=CV(r),a=ZX(n,o,s),i=PX(a.coord,o,s);go(r,i)}};var eJ=Object.freeze({__proto__:null,snapTo:QX});const tJ="data-initial-z-index",oJ=e=>{At(e.element).filter(ft).each(e=>{ro(e,tJ).fold(()=>yo(e,"z-index"),t=>uo(e,"z-index",t)),ao(e,tJ)})},nJ=e=>{At(e.element).filter(ft).each(t=>{ho(t,"z-index").each(e=>{to(t,tJ,e)}),uo(t,"z-index",po(e.element,"z-index"))})},rJ=(e,t)=>{e.getSystem().addToGui(t),nJ(t)},sJ=e=>{oJ(e),e.getSystem().removeFromGui(e)},aJ=(e,t,o)=>e.getSystem().build(MR.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var iJ=ta("snaps",[Ls("getSnapPoints"),Ld("onSensor"),Ls("leftAttr"),Ls("topAttr"),na("lazyViewport",ar),na("mustSnap",!1)]);const lJ=[na("useFixed",A),Ls("blockerClass"),na("getTarget",k),na("onDrag",y),na("repositionTarget",!0),na("onDrop",y),ca("getBounds",ar),iJ],cJ=e=>Ne(ho(e,"left"),ho(e,"top"),ho(e,"position"),(e,t,o)=>{const n="fixed"===o?HX:zX;return n(parseInt(e,10),parseInt(t,10))}).getOrThunk(()=>{const t=Ao(e);return UX(t.left,t.top)}),dJ=(e,t,o,n,r)=>{const s=r.bounds,a=RX(t,o,n),i=ru(a.left,s.x,s.x+s.width-r.width),l=ru(a.top,s.y,s.y+s.height-r.height),c=UX(i,l);return t.fold(()=>{const e=BX(c,o,n);return zX(e.left,e.top)},S(c),()=>{const e=NX(c,o,n);return HX(e.left,e.top)})},uJ=(e,t,o,n,r,s,a)=>{const i=t.fold(()=>{const e=LX(o,s.left,s.top),t=NX(e,n,r);return HX(t.left,t.top)},t=>{const a=qX(e,t,o,s,n,r);return a.extra.each(o=>{t.onSensor(e,o)}),a.coord});return dJ(e,i,n,r,a)},mJ=(e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const s=Et(e.element),a=Hn(s),i=CV(r),l=cJ(r),c=uJ(e,t.snaps,l,a,i,n,o),d=PX(c,a,i);go(r,d)}t.onDrag(e,r,n)},gJ=(e,t)=>({bounds:e.getBounds(),height:ko(t.element),width:Io(t.element)}),pJ=(e,t,o,n,r)=>{const s=o.update(n,r),a=o.getStartData().getOrThunk(()=>gJ(t,e));s.each(o=>{mJ(e,t,a,o)})},fJ=(e,t,o,n)=>{t.each(sJ),o.snaps.each(t=>{KX(e,t)});const r=o.getTarget(e.element);n.reset(),o.onDrop(e,r)},hJ=e=>(t,o)=>{const n=e=>{o.setStartData(gJ(t,e))};return Fi([Vi(vi(),e=>{o.getStartData().each(()=>n(e))}),...e(t,o,n)])},bJ=e=>Fi([Vi(Ha(),e.forceDrop),Vi(Wa(),e.drop),Vi(Va(),(t,o)=>{e.move(o.event)}),Vi(ja(),e.delayDrop)]),vJ=e=>R.from(Oo(e.x,e.y)),yJ=(e,t)=>Oo(t.left-e.left,t.top-e.top);var xJ=Object.freeze({__proto__:null,getData:vJ,getDelta:yJ});const wJ=(e,t,o)=>[Vi(Ha(),(n,r)=>{const s=r.event.raw;if(0!==s.button)return;r.stop();const a=()=>fJ(n,R.some(c),e,t),i=uR(a,200),l={drop:a,delayDrop:i.schedule,forceDrop:a,move:o=>{i.cancel(),pJ(n,e,t,xJ,o)}},c=aJ(n,e.blockerClass,bJ(l)),d=()=>{o(n),rJ(n,c)};d()})],CJ=[...lJ,Hd("dragger",{handlers:hJ(wJ)})],SJ=e=>Fi([Vi(La(),e.forceDrop),Vi(za(),e.drop),Vi(Ua(),e.drop),Vi(Fa(),(t,o)=>{e.move(o.event)})]),kJ=e=>{const t=e[0];return R.some(Oo(t.clientX,t.clientY))},_J=e=>{const t=e.raw,o=t.touches;return 1===o.length?kJ(o):R.none()},EJ=(e,t)=>Oo(t.left-e.left,t.top-e.top);var OJ=Object.freeze({__proto__:null,getData:_J,getDelta:EJ});const TJ=(e,t,o)=>{const n=Am(),r=o=>{fJ(o,n.get(),e,t),n.clear()};return[Vi(La(),(s,a)=>{a.stop();const i=()=>r(s),l={drop:i,delayDrop:y,forceDrop:i,move:o=>{pJ(s,e,t,OJ,o)}},c=aJ(s,e.blockerClass,SJ(l));n.set(c);const d=()=>{o(s),rJ(s,c)};d()}),Vi(Fa(),(o,n)=>{n.stop(),pJ(o,e,t,OJ,n.event)}),Vi(za(),(e,t)=>{t.stop(),r(e)}),Vi(Ua(),r)]},DJ=[...lJ,Hd("dragger",{handlers:hJ(TJ)})],AJ=(e,t,o)=>[...wJ(e,t,o),...TJ(e,t,o)],NJ=[...lJ,Hd("dragger",{handlers:hJ(AJ)})],RJ=CJ,BJ=DJ,MJ=NJ;var IJ=Object.freeze({__proto__:null,mouse:RJ,touch:BJ,mouseOrTouch:MJ});const PJ=()=>{let e=R.none(),t=R.none();const o=()=>{e=R.none(),t=R.none()},n=(t,o)=>{const n=e.map(e=>t.getDelta(e,o));return e=R.some(o),n},r=(e,t)=>e.getData(t).bind(t=>n(e,t)),s=e=>{t=R.some(e)},a=()=>t,i=S({});return Ll({readState:i,reset:o,update:r,getStartData:a,setStartData:s})};var LJ=Object.freeze({__proto__:null,init:PJ});const FJ=Gu({branchKey:"mode",branches:IJ,name:"dragging",active:{events:(e,t)=>{const o=e.dragger;return o.handlers(e,t)}},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:R.from(e.extra)})},state:LJ,apis:eJ}),zJ=40,UJ=zJ/2,HJ=(e,t,o,n,r,s)=>e.fold(()=>FJ.snap({sensor:UX(o-UJ,n-UJ),range:Oo(r,s),output:UX(R.some(o),R.some(n)),extra:{td:t}}),e=>{const r=o-UJ,s=n-UJ,a=zJ,i=zJ,l=e.element.dom.getBoundingClientRect();return FJ.snap({sensor:UX(r,s),range:Oo(a,i),output:UX(R.some(o-l.width/2),R.some(n-l.height/2)),extra:{td:t}})}),VJ=(e,t,o)=>{const n=(e,t)=>e.exists(e=>kt(e,t));return{getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,r)=>{const s=r.td;n(t.get(),s)||(t.set(s),o(s))},mustSnap:!0}},jJ=e=>YC($C.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:Vu([FJ.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),SB.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),WJ=(e,t)=>{const o=ga([]),n=ga([]),r=ga(!1),s=Am(),a=Am(),i=e=>{const o=nr(e);return HJ(g.getOpt(t),e,o.x,o.y,o.width,o.height)},l=()=>V(o.get(),e=>i(e)),c=e=>{const o=nr(e);return HJ(p.getOpt(t),e,o.right,o.bottom,o.width,o.height)},d=()=>V(n.get(),e=>c(e)),u=VJ(l,s,t=>{a.get().each(o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})})}),m=VJ(d,a,t=>{s.get().each(o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})})}),g=jJ(u),p=jJ(m),f=od(g.asSpec()),h=od(p.asSpec()),b=(t,o,n,r)=>{const s=o.dom.getBoundingClientRect();yo(t.element,"display");const a=Dt(Ze.fromDom(e.getBody())).dom.innerHeight,i=n(s),l=r(s,a);(i||l)&&uo(t.element,"display","none")},v=(e,t,o,n)=>{const r=o(t);FJ.snapTo(e,r);const s=e=>e[n]<0,a=(e,t)=>e[n]>t;b(e,t,s,a)},y=e=>v(f,e,i,"top"),x=()=>s.get().each(y),w=e=>v(h,e,c,"bottom"),C=()=>a.get().each(w);_n().deviceType.isTouch()&&(e.on("TableSelectionChange",e=>{r.get()||(ff(t,f),ff(t,h),r.set(!0)),s.set(e.start),a.set(e.finish),e.otherCells.each(t=>{o.set(t.upOrLeftCells),n.set(t.downOrRightCells),y(e.start),w(e.finish)})}),e.on("ResizeEditor ResizeWindow ScrollContent",()=>{x(),C()}),e.on("TableSelectionClear",()=>{r.get()&&(vf(f),vf(h),r.set(!1)),s.clear(),a.clear()}))};var $J='\n \n\n';const GJ=e=>"BR"===e.nodeName||!!e.getAttribute("data-mce-bogus")||"bookmark"===e.getAttribute("data-mce-type"),qJ=(e,t,o)=>{var n;const r=null!==(n=t.delimiter)&&void 0!==n?n:"›",s=(t,n,r)=>$C.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":r,"aria-level":r+1}},components:[Jc(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:Vu([xT.button(o.isDisabled),fT()])}),a=()=>({dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Jc(` ${r} `)]}),i=e=>K(e,(e,t,o)=>{const n=s(t.name,t.element,o);return 0===o?e.concat([n]):e.concat([a(),n])},[]),l=t=>{const o=[];let n=t.length;while(n-- >0){const r=t[n];if(1===r.nodeType&&!GJ(r)){const t=TD(e,r);if(t.isDefaultPrevented()||o.push({name:t.name,element:r}),t.isPropagationStopped())break}}return o};return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Vu([nw.config({mode:"flow",selector:"div[role=button]"}),lv.config({disabled:o.isDisabled}),fT(),WR.config({}),bw.config({}),yw("elementPathEvents",[Zi((t,o)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",()=>nw.focusIn(t)),e.on("NodeChange",e=>{const o=l(e.parents),n=o.length>0?i(o):[];bw.set(t,n)})})])]),components:[]}};var KJ;(function(e){e[e["None"]=0]="None",e[e["Both"]=1]="Both",e[e["Vertical"]=2]="Vertical"})(KJ||(KJ={}));const YJ=(e,t,o,n,r)=>{const s={height:fK(n+t.top,Sk(e),_k(e))};return o===KJ.Both&&(s.width=fK(r+t.left,Ck(e),kk(e))),s},XJ=(e,t,o)=>{const n=Ze.fromDom(e.getContainer()),r=YJ(e,t,o,So(n),Mo(n));ge(r,(e,t)=>{b(e)&&uo(n,t,pK(e))}),SD(e)},JJ=e=>{const t=Jk(e);return!1===t?KJ.None:"both"===t?KJ.Both:KJ.Vertical},ZJ=(e,t,o,n)=>{const r=20,s=Oo(o*r,n*r);return XJ(e,s,t),R.some(!0)},QJ=(e,t)=>{const o=JJ(e);if(o===KJ.None)return R.none();const n=o===KJ.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return R.some(sk("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize"),"aria-label":t.translate(n)},behaviours:[FJ.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,r)=>XJ(e,r,o),blockerClass:"tox-blocker"}),nw.config({mode:"special",onLeft:()=>ZJ(e,o,-1,0),onRight:()=>ZJ(e,o,1,0),onUp:()=>ZJ(e,o,0,-1),onDown:()=>ZJ(e,o,0,1)}),WR.config({}),Tw.config({})]},t.icons))},eZ=(e,t)=>{const o=(e,o,n)=>bw.set(e,[Jc(t.translate(["{0} "+n,o[n]]))]);return $C.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Vu([xT.button(t.isDisabled),fT(),WR.config({}),bw.config({}),_h.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),yw("wordcount-events",[tl(e=>{const t=_h.getValue(e),n="words"===t.mode?"characters":"words";_h.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)}),Zi(t=>{e.on("wordCountUpdate",e=>{const{mode:n}=_h.getValue(t);_h.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)})})])]),eventOrder:{[ci()]:["disabling","alloy.base.behaviour","wordcount-events"]}})},tZ=(e,t)=>{const o=()=>({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v6",rel:"noopener",target:"_blank","aria-label":KS.translate(["Powered by {0}","Tiny"])},innerHtml:$J.trim()},behaviours:Vu([Tw.config({})])}]}),n=()=>{const e=DT("Alt+0"),t="Press {0} for help";return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Jc(KS.translate([t,e]))]}},r=()=>{const n=[];return e.hasPlugin("wordcount")&&n.push(eZ(e,t)),Xk(e)&&n.push(o()),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:n}},s=()=>{const o=[],s=t_(e),a=Yk(e),i=Xk(e)||e.hasPlugin("wordcount"),l=()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end",o="tox-statusbar__text-container--space-around";if(s){const n="tox-statusbar__text-container-3-cols";return i||a?i&&!a?[n,t]:[n,e]:[n,o]}return[i&&!a?t:e]};return a&&o.push(qJ(e,{},t)),s&&o.push(n()),i&&o.push(r()),o.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...l()]},components:o}]:[]},a=()=>{const o=s(),n=QJ(e,t);return o.concat(n.toArray())};return{dom:{tag:"div",classes:["tox-statusbar"]},components:a()}},oZ=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),nZ=(e,t)=>{const o=e.inline,n=o?OK:mK,r=h_(e)?Dj:xV,s=TK(),a=Am(),i=Am(),l=Am(),c=_n(),d=c.deviceType.isTouch(),u="tox-platform-touch",m=d?[u]:[],g=u_(e),p=Nk(e),f=YC({dom:{tag:"div",classes:["tox-anchorbar"]}}),h=YC({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),b=()=>s.mainUi.get().map(e=>e.outerContainer).bind(iG.getHeader),v=()=>ur.fromOption(s.dialogUi.get().map(e=>e.sink),"UI has not been rendered"),y=()=>ur.fromOption(s.popupUi.get().map(e=>e.sink),"(popup) UI has not been rendered"),x=s.lazyGetInOuterOrDie("anchor bar",f.getOpt),w=s.lazyGetInOuterOrDie("bottom anchor bar",h.getOpt),C=s.lazyGetInOuterOrDie("toolbar",iG.getToolbar),S=s.lazyGetInOuterOrDie("throbber",iG.getThrobber),k=tV({popup:y,dialog:v},e,x,w),_=()=>{const t={attributes:{[dg]:g?cg.BottomToTop:cg.TopToBottom}},o=iG.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:k.popup,onEscape:()=>{e.focus()}}),n=iG.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:k.popup.shared.getSink,providers:k.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{DD(e,t)},type:p,lazyToolbar:C,lazyHeader:()=>b().getOrDie("Could not find header element"),...t}),r=iG.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:k.popup.shared.providers,onEscape:()=>{e.focus()},type:p}),s=d_(e),a=l_(e),i=r_(e),l=e_(e),c=E(),d=s||a||i,u=()=>s?[r]:a?[n]:[],m=l?[c,o]:[o];return iG.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(d?[]:["tox-editor-header--empty"]),...t},components:Z([i?m:[],u(),g_(e)?[]:[f.asSpec()]]),sticky:h_(e),editor:e,sharedBackstage:k.popup.shared})},E=()=>iG.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]}}),O=()=>{const e=iG.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),t=iG.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}});return{dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[e,t]}},T=()=>{const t=p_(e),o=kt(Zt(),t)&&"grid"===po(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(m),attributes:{...KS.isRtl()?{dir:"rtl"}:{}}},behaviours:Vu([rf.config({useFixed:()=>r.isDocked(b)})])},s={dom:{styles:{width:document.body.clientWidth+"px"}},events:Fi([Vi(yi(),e=>{uo(e.element,"width",document.body.clientWidth+"px")})])},a=od(Ar(n,o?s:{})),l=IR(a);return i.set(l),{sink:a,mothership:l}},D=()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(m),attributes:{...KS.isRtl()?{dir:"rtl"}:{}}},behaviours:Vu([rf.config({useFixed:()=>r.isDocked(b),getBounds:()=>t.getPopupSinkBounds()})])},o=od(e),n=IR(o);return l.set(n),{sink:o,mothership:n}},A=()=>{const t=_(),n=O(),r=iG.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:k.popup}),s=iG.parts.viewWrapper({backstage:k.popup}),i=Kk(e)&&!o?R.some(tZ(e,k.popup.shared.providers)):R.none(),l=Z([g?[]:[t],o?[]:[n],g?[t]:[]]),c=iG.parts.editorContainer({components:Z([l,o?[]:[h.asSpec(),...i.toArray()]])}),d=f_(e),u={role:"application",...KS.isRtl()?{dir:"rtl"}:{},...d?{"aria-hidden":"true"}:{}},p=od(iG.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(o?["tox-tinymce-inline"]:[]).concat(g?["tox-tinymce--toolbar-bottom"]:[]).concat(m),styles:{visibility:"hidden",...d?{opacity:"0",border:"0"}:{}},attributes:u},components:[c,...o?[]:[s],r],behaviours:Vu([fT(),lv.config({disableClass:"tox-tinymce--disabled"}),nw.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"})])})),f=IR(p);return a.set(f),{mothership:f,outerContainer:p}},N=t=>{const o=pK(bK(e)),n=pK(yK(e));return e.inline||(vo("div","width",n)&&uo(t.element,"width",n),vo("div","height",o)?uo(t.element,"height",o):uo(t.element,"height","400px")),o},B=t=>{e.addShortcut("alt+F9","focus menubar",()=>{iG.focusMenubar(t)}),e.addShortcut("alt+F10","focus toolbar",()=>{iG.focusToolbar(t)}),e.addCommand("ToggleToolbarDrawer",(e,o)=>{(null===o||void 0===o?void 0:o.skipFocus)?iG.toggleToolbarDrawerWithoutFocusing(t):iG.toggleToolbarDrawer(t)}),e.addQueryStateHandler("ToggleToolbarDrawer",()=>iG.isToolbarDrawerToggled(t))},M=t=>{const{mainUi:o,popupUi:s,uiMotherships:a}=t;pe(Rk(e),(t,o)=>{e.ui.registry.addGroupToolbarButton(o,t)});const{buttons:i,menuItems:l,contextToolbars:c,sidebars:d,views:u}=e.ui.registry.getAll(),m=c_(e),g={menuItems:l,menus:v_(e),menubar:Fk(e),toolbar:m.getOrThunk(()=>zk(e)),allowToolbarGroups:p===dk.floating,buttons:i,sidebar:d,views:u};B(o.outerContainer),oV(e,o.mothership,a),r.setup(e,k.popup.shared,b),jY(e,k.popup),EX(e,k.popup.shared.getSink,k.popup),Zj(e),kW(e,S,k.popup.shared),hY(e,c,s.sink,{backstage:k.popup}),WJ(e,s.sink);const f=e.getElement(),h=N(o.outerContainer),v={targetNode:f,height:h};return n.render(e,t,g,k.popup,v)},I=e=>(l.set(e.mothership),e),P=()=>{const t=A(),o=T(),n=b_(e)?D():I(o);s.dialogUi.set(o),s.popupUi.set(n),s.mainUi.set(t);const r={popupUi:n,dialogUi:o,mainUi:t,uiMotherships:s.getUiMotherships()};return M(r)};return{popups:{backstage:k.popup,getMothership:()=>oZ("popups",l)},dialogs:{backstage:k.dialog,getMothership:()=>oZ("dialogs",i)},renderUI:P}},rZ=(e,t)=>{const o=ro(e,"id").fold(()=>{const e=fl("dialog-label");return to(t,"id",e),e},k);to(e,"aria-labelledby",o)},sZ=S([Ls("lazySink"),Ks("dragBlockClass"),ca("getBounds",ar),na("useTabstopAt",N),na("firstTabstop",0),na("eventOrder",{}),Eh("modalBehaviours",[nw]),Fd("onExecute"),Ud("onEscape")]),aZ={sketch:k},iZ=S([ab({name:"draghandle",overrides:(e,t)=>({behaviours:Vu([FJ.config({mode:"mouse",getTarget:e=>dd(e,'[role="dialog"]').getOr(e),blockerClass:e.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+JSON.stringify(t,null,2)).message),getBounds:e.getDragBounds})])})}),rb({schema:[Ls("dom")],name:"title"}),rb({factory:aZ,schema:[Ls("dom")],name:"close"}),rb({factory:aZ,schema:[Ls("dom")],name:"body"}),ab({factory:aZ,schema:[Ls("dom")],name:"footer"}),sb({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[na("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),na("components",[])],name:"blocker"})]),lZ=(e,t,o,n)=>{const r=Am(),s=t=>{r.set(t);const o=e.lazySink(t).getOrDie(),s=n.blocker(),a=o.getSystem().build({...s,components:s.components.concat([nd(t)]),behaviours:Vu([Tw.config({}),yw("dialog-blocker-events",[Ji(Ga(),()=>{hW.isBlocked(t)?y():nw.focusIn(t)})])])});ff(o,a),nw.focusIn(t)},a=e=>{r.clear(),At(e.element).each(t=>{e.getSystem().getByDom(t).each(e=>{vf(e)})})},i=t=>xb(t,e,"body"),l=t=>yb(t,e,"footer"),c=(e,t)=>{hW.block(e,t)},d=e=>{hW.unblock(e)},u=fl("modal-events"),m={...e.eventOrder,[xi()]:[u].concat(e.eventOrder["alloy.system.attached"]||[])};return{uid:e.uid,dom:e.dom,components:t,apis:{show:s,hide:a,getBody:i,getFooter:l,setIdle:d,setBusy:c},eventOrder:m,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Th(e.modalBehaviours,[bw.config({}),nw.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),hW.config({getRoot:r.get}),yw(u,[Zi(t=>{rZ(t.element,xb(t,e,"title").element)})])])}},cZ=Fb({name:"ModalDialog",configFields:sZ(),partFields:iZ(),factory:lZ,apis:{show:(e,t)=>{e.show(t)},hide:(e,t)=>{e.hide(t)},getBody:(e,t)=>e.getBody(t),getFooter:(e,t)=>e.getFooter(t),setBusy:(e,t,o)=>{e.setBusy(t,o)},setIdle:(e,t)=>{e.setIdle(t)}}}),dZ=ls([AE,NE].concat(RO)),uZ=vs,mZ=[nO("button"),WE,ia("align","end",["start","end"]),ZE,JE,Zs("buttonType",["primary","secondary"])],gZ=[...mZ,BE],pZ=[Hs("type",["submit","cancel","custom"]),...gZ],fZ=[Hs("type",["menu"]),jE,$E,WE,qs("items",dZ),...mZ],hZ=[...mZ,Hs("type",["togglebutton"]),Us("tooltip"),WE,jE,la("active",!1)],bZ=Rs("type",{submit:pZ,cancel:pZ,custom:pZ,menu:fZ,togglebutton:hZ}),vZ=[AE,BE,Hs("level",["info","warn","error","success"]),IE,na("url","")],yZ=ls(vZ),xZ=e=>[AE,e],wZ=[AE,BE,JE,nO("button"),WE,XE,Zs("buttonType",["primary","secondary","toolbar"]),ZE],CZ=ls(wZ),SZ=[AE,NE],kZ=SZ.concat([GE]),_Z=SZ.concat([RE,JE]),EZ=ls(_Z),OZ=vs,TZ=kZ.concat([QE("auto")]),DZ=ls(TZ),AZ=gs([PE,BE,IE]),NZ=kZ.concat([aa("storageKey","default")]),RZ=ls(NZ),BZ=bs,MZ=kZ,IZ=ls(MZ),PZ=bs,LZ=SZ.concat([aa("tag","textarea"),Us("scriptId"),Us("scriptUrl"),da("settings",void 0)]),FZ=SZ.concat([aa("tag","textarea"),js("init")]),zZ=_s(e=>Ts("customeditor.old",is(FZ),e).orThunk(()=>Ts("customeditor.new",is(LZ),e))),UZ=bs,HZ=kZ,VZ=ls(HZ),jZ=ks(),WZ=e=>[AE,zs("columns"),e],$Z=[AE,Us("html"),ia("presets","presentation",["presentation","document"])],GZ=ls($Z),qZ=kZ.concat([la("border",!1),la("sandboxed",!0),la("streamContent",!1),la("transparent",!0)]),KZ=ls(qZ),YZ=bs,XZ=ls(SZ.concat([Js("height")])),JZ=ls([Us("url"),Xs("zoom"),Xs("cachedWidth"),Xs("cachedHeight")]),ZZ=kZ.concat([Js("inputMode"),Js("placeholder"),la("maximized",!1),JE]),QZ=ls(ZZ),eQ=bs,tQ=e=>[AE,RE,e,ia("align","start",["start","center","end"])],oQ=[BE,PE],nQ=[BE,qs("items",Bs("items",()=>rQ))],rQ=ds([ls(oQ),ls(nQ)]),sQ=kZ.concat([qs("items",rQ),JE]),aQ=ls(sQ),iQ=bs,lQ=kZ.concat([Gs("items",[BE,PE]),sa("size",1),JE]),cQ=ls(lQ),dQ=bs,uQ=kZ.concat([la("constrain",!0),JE]),mQ=ls(uQ),gQ=ls([Us("width"),Us("height")]),pQ=SZ.concat([RE,sa("min",0),sa("max",0)]),fQ=ls(pQ),hQ=hs,bQ=[AE,qs("header",bs),qs("cells",cs(bs))],vQ=ls(bQ),yQ=kZ.concat([Js("placeholder"),la("maximized",!1),JE]),xQ=ls(yQ),wQ=bs,CQ=[Hs("type",["directory","leaf"]),ME,Us("id"),Ys("menu",Mj)],SQ=CQ,kQ=ls(SQ),_Q=CQ.concat([qs("children",Bs("children",()=>Ss("type",{directory:EQ,leaf:kQ})))]),EQ=ls(_Q),OQ=Ss("type",{directory:EQ,leaf:kQ}),TQ=[AE,qs("items",OQ),Qs("onLeafAction"),Qs("onToggleExpand"),ua("defaultExpandedIds",[],bs),Js("defaultSelectedId")],DQ=ls(TQ),AQ=kZ.concat([ia("filetype","file",["image","media","file"]),JE,Js("picker_text")]),NQ=ls(AQ),RQ=ls([PE,eO]),BQ=e=>Ms("items","items",Rr(),cs(_s(t=>Ts("Checking item of "+e,MQ,t).fold(e=>ur.error(Ns(e)),e=>ur.value(e))))),MQ=ss(()=>Ss("type",{alertbanner:yZ,bar:ls(xZ(BQ("bar"))),button:CZ,checkbox:EZ,colorinput:RZ,colorpicker:IZ,dropzone:VZ,grid:ls(WZ(BQ("grid"))),iframe:KZ,input:QZ,listbox:aQ,selectbox:cQ,sizeinput:mQ,slider:fQ,textarea:xQ,urlinput:NQ,customeditor:zZ,htmlpanel:GZ,imagepreview:XZ,collection:DZ,label:ls(tQ(BQ("label"))),table:vQ,tree:DQ,panel:PQ})),IQ=[AE,na("classes",[]),qs("items",MQ)],PQ=ls(IQ),LQ=[nO("tab"),ME,qs("items",MQ)],FQ=[AE,Gs("tabs",LQ)],zQ=ls(FQ),UQ=gZ,HQ=bZ,VQ=ls([Us("title"),Fs("body",Ss("type",{panel:PQ,tabpanel:zQ})),aa("size","normal"),ua("buttons",[],HQ),na("initialData",{}),ca("onAction",y),ca("onChange",y),ca("onSubmit",y),ca("onClose",y),ca("onCancel",y),ca("onTabChange",y)]),jQ=e=>Ts("dialog",VQ,e),WQ=ls([Hs("type",["cancel","custom"]),...UQ]),$Q=ls([Us("title"),Us("url"),Xs("height"),Xs("width"),ea("buttons",WQ),ca("onAction",y),ca("onCancel",y),ca("onClose",y),ca("onMessage",y)]),GQ=e=>Ts("dialog",$Q,e),qQ=e=>l(e)?[e].concat(Q(Ce(e),qQ)):d(e)?Q(e,qQ):[],KQ=e=>i(e.type)&&i(e.name),YQ={checkbox:OZ,colorinput:BZ,colorpicker:PZ,dropzone:jZ,input:eQ,iframe:YZ,imagepreview:JZ,selectbox:dQ,sizeinput:gQ,slider:hQ,listbox:iQ,size:gQ,textarea:wQ,urlinput:RQ,customeditor:UZ,collection:AZ,togglemenuitem:uZ},XQ=e=>R.from(YQ[e.type]),JQ=e=>G(qQ(e),KQ),ZQ=e=>{const t=JQ(e),o=Q(t,e=>XQ(e).fold(()=>[],t=>[Fs(e.name,t)]));return ls(o)},QQ=e=>{var t;const o=Ds(jQ(e)),n=ZQ(e),r=null!==(t=e.initialData)&&void 0!==t?t:{};return{internalDialog:o,dataValidator:n,initialData:r}},e0={open:(e,t)=>{const o=QQ(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>{const o=Ds(GQ(t));return e(o)},redial:e=>QQ(e)},t0=(e,t)=>{const o=(o,n)=>{e.updateState.each(e=>{const r=e(o,n);t.set(r)}),e.renderComponents.each(r=>{const s=r(n,t.get()),a=e.reuseDom?sw:rw;a(o,s)})};return Fi([Vi(li(),(t,n)=>{const r=n;if(!r.universal){const n=e.channel;F(r.channels,n)&&o(t,r.data)}}),Zi((t,n)=>{e.initialData.each(e=>{o(t,e)})})])};var o0=Object.freeze({__proto__:null,events:t0});const n0=(e,t,o)=>o;var r0=Object.freeze({__proto__:null,getState:n0}),s0=[Ls("channel"),Ks("renderComponents"),Ks("updateState"),Ks("initialData"),la("reuseDom",!0)];const a0=()=>{const e=ga(R.none()),t=()=>e.set(R.none()),o=()=>e.get().getOr("none");return{readState:o,get:e.get,set:e.set,clear:t}};var i0=Object.freeze({__proto__:null,init:a0});const l0=Wu({fields:s0,name:"reflecting",active:o0,apis:r0,state:i0}),c0=e=>{const t=[],o={};return ge(e,(e,n)=>{e.fold(()=>{t.push(n)},e=>{o[n]=e})}),t.length>0?ur.error(t):ur.value(o)},d0=(e,t,o)=>{const n=YC(mP.sketch(n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:V(e.items,e=>fU(n,e,t,o))})));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:Vu([nw.config({mode:"acyclic",useTabstopAt:O(YP)}),SP.memento(n),_P(n,{postprocess:e=>c0(e).fold(e=>(console.error(e),{}),k)}),yw("dialog-body-panel",[Vi(Ga(),(e,t)=>{e.getSystem().broadcastOn([tL],{newFocus:R.some(t.event.target)})})])])}},u0=(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:Yw(e.action),behaviours:Th(e.tabButtonBehaviours,[Tw.config({}),nw.config({mode:"execution",useSpace:!0,useEnter:!0}),_h.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification}),m0=Lb({name:"TabButton",configFields:[na("uid",void 0),Ls("value"),Ms("dom","dom",Pr(()=>({attributes:{role:"tab",id:fl("aria"),"aria-selected":"false"}})),ps()),Ks("action"),na("domModification",{}),Eh("tabButtonBehaviours",[Tw,nw,_h]),Ls("view")],factory:u0}),g0=S([Ls("tabs"),Ls("dom"),na("clickToDismiss",!1),Eh("tabbarBehaviours",[Tv,nw]),Id(["tabClass","selectedClass"])]),p0=ib({factory:m0,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Tv.dehighlight(e,t),Ri(e,Ti(),{tabbar:e,button:t})},o=(e,t)=>{Tv.highlight(e,t),Ri(e,Oi(),{tabbar:e,button:t})};return{action:n=>{const r=n.getSystem().getByUid(e.uid).getOrDie(),s=Tv.isHighlighted(r,n),a=(()=>s&&e.clickToDismiss?t:s?y:o)();a(r,n)},domModification:{classes:[e.markers.tabClass]}}}}),f0=S([p0]),h0=(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Th(e.tabbarBehaviours,[Tv.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{to(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{to(t.element,"aria-selected","false")}}),nw.config({mode:"flow",getInitial:e=>Tv.getHighlighted(e).map(e=>e.element),selector:"."+e.markers.tabClass,executeOnMove:!0})])}),b0=Fb({name:"Tabbar",configFields:g0(),partFields:f0(),factory:h0}),v0=(e,t)=>({uid:e.uid,dom:e.dom,behaviours:Th(e.tabviewBehaviours,[bw.config({})]),domModification:{attributes:{role:"tabpanel"}}}),y0=Lb({name:"Tabview",configFields:[Eh("tabviewBehaviours",[bw])],factory:v0}),x0=S([na("selectFirst",!0),Ld("onChangeTab"),Ld("onDismissTab"),na("tabs",[]),Eh("tabSectionBehaviours",[])]),w0=rb({factory:b0,schema:[Ls("dom"),$s("markers",[Ls("tabClass"),Ls("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),C0=rb({factory:y0,name:"tabview"}),S0=S([w0,C0]),k0=(e,t,o,n)=>{const r=t=>{const o=_h.getValue(t);yb(t,e,"tabview").each(n=>{const r=X(e.tabs,e=>e.value===o);r.each(o=>{const r=o.view();ro(t.element,"id").each(e=>{to(n.element,"aria-labelledby",e)}),bw.set(n,r),e.onChangeTab(n,t,r)})})},s=(t,o)=>{yb(t,e,"tabbar").each(e=>{o(e).each(Bi)})};return{uid:e.uid,dom:e.dom,components:t,behaviours:Oh(e.tabSectionBehaviours),events:Fi(Z([e.selectFirst?[Zi((e,t)=>{s(e,Tv.getFirst)})]:[],[Vi(Oi(),(e,t)=>{const o=t.event.button;r(o)}),Vi(Ti(),(t,o)=>{const n=o.event.button;e.onDismissTab(t,n)})]])),apis:{getViewItems:t=>yb(t,e,"tabview").map(e=>bw.contents(e)).getOr([]),showTab:(e,t)=>{const o=e=>{const o=Tv.getCandidates(e),n=X(o,e=>_h.getValue(e)===t);return n.filter(t=>!Tv.isHighlighted(e,t))};s(e,o)}}}},_0=Fb({name:"TabSection",configFields:x0(),partFields:S0(),factory:k0,apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),E0=(e,t,o)=>V(e,(n,r)=>{bw.set(o,e[r].view());const s=t.dom.getBoundingClientRect();return bw.set(o,[]),s.height}),O0=e=>ie(se(e,(e,t)=>e>t?-1:e{const n=Tt(e).dom,r=dd(e,".tox-dialog-wrap").getOr(e),s="fixed"===po(r,"position");let a;a=s?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const i=So(t),l=t.dom.offsetLeft>=o.dom.offsetLeft+Mo(o),c=l?Math.max(So(o),i):i,d=parseInt(po(e,"margin-top"),10)||0,u=parseInt(po(e,"margin-bottom"),10)||0,m=So(e)+d+u,g=m-c;return a-g},D0=(e,t)=>{ie(e).each(e=>_0.showTab(t,e.value))},A0=(e,t)=>{uo(e,"height",t+"px"),uo(e,"flex-basis",t+"px")},N0=(e,t,o)=>{dd(e,'[role="dialog"]').each(e=>{md(e,'[role="tablist"]').each(n=>{o.get().map(o=>(uo(t,"height","0"),uo(t,"flex-basis","0"),Math.min(o,T0(e,t,n)))).each(e=>{A0(t,e)})})})},R0=e=>md(e,'[role="tabpanel"]'),B0=e=>{const t=Am(),o=[Zi(o=>{const n=o.element;R0(n).each(r=>{uo(r,"visibility","hidden"),o.getSystem().getByDom(r).toOptional().each(o=>{const n=E0(e,r,o),s=O0(n);s.fold(t.clear,t.set)}),N0(n,r,t),yo(r,"visibility"),D0(e,o),requestAnimationFrame(()=>{N0(n,r,t)})})}),Vi(yi(),e=>{const o=e.element;R0(o).each(e=>{N0(o,e,t)})}),Vi(aB,(e,o)=>{const n=e.element;R0(n).each(e=>{const o=em(Wt(e));uo(e,"visibility","hidden");const r=ho(e,"height").map(e=>parseInt(e,10));yo(e,"height"),yo(e,"flex-basis");const s=e.dom.getBoundingClientRect().height,a=r.forall(e=>s>e);a?(t.set(s),N0(n,e,t)):r.each(t=>{A0(e,t)}),yo(e,"visibility"),o.each(Ju)})})],n=!1;return{extraEvents:o,selectFirst:n}},M0="send-data-to-section",I0="send-data-to-view",P0=(e,t,o)=>{const n=ga({}),r=e=>{const t=_h.getValue(e),o=c0(t).getOr({}),r=n.get(),s=Ar(r,o);n.set(s)},s=e=>{const t=n.get();_h.setValue(e,t)},a=ga(null),i=V(e.tabs,e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[Jc(o.shared.providers.translate(e.title))],view:()=>[mP.sketch(n=>({dom:{tag:"div",classes:["tox-form"]},components:V(e.items,e=>fU(n,e,t,o)),formBehaviours:Vu([nw.config({mode:"acyclic",useTabstopAt:O(YP)}),yw("TabView.form.events",[Zi(s),Qi(r)]),Ku.config({channels:Ca([{key:M0,value:{onReceive:r}},{key:I0,value:{onReceive:s}}])})])}))]})),l=B0(i);return _0.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=_h.getValue(t);Ri(e,sB,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[_0.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[b0.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:Vu([WR.config({})])}),_0.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:Vu([yw("tabpanel",l.extraEvents),nw.config({mode:"acyclic"}),jb.config({find:e=>ie(_0.getViewItems(e))}),EP(R.none(),e=>(e.getSystem().broadcastOn([M0],{}),n.get()),(e,t)=>{n.set(t),e.getSystem().broadcastOn([I0],{})})])})},L0=(e,t,o,n,r)=>{const s=e=>{const t=e.body;switch(t.type){case"tabpanel":return[P0(t,e.initialData,n)];default:return[d0(t,e.initialData,n)]}},a=(e,t)=>R.some({isTabPanel:()=>"tabpanel"===t.body.type}),i={"aria-live":"polite"};return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map(e=>({id:e})).getOr({}),...r?i:{}}},components:[],behaviours:Vu([SP.childAt(0),l0.config({channel:`${ZP}-${t}`,updateState:a,renderComponents:s,initialData:e})])}},F0=(e,t,o,n,r)=>L0(e,t,R.some(o),n,r),z0=(e,t,o)=>{const n=L0(e,t,R.none(),o,!1);return cZ.parts.body(n)},U0=e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[GP(R.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:Vu([WR.config({}),Tw.config({})])})]}],behaviours:Vu([nw.config({mode:"acyclic",useTabstopAt:O(YP)})])};return cZ.parts.body(t)},H0=fk.deviceType.isTouch(),V0=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),j0=(e,t)=>cZ.parts.close($C.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:Vu([WR.config({})])})),W0=()=>cZ.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),$0=(e,t)=>cZ.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:KC(`

${qS(t.translate(e))}

`)}]}]}),G0=e=>cZ.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),q0=(e,t)=>[MR.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),MR.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],K0=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",r=t+"__disable-scroll";return cZ.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),R.some(!0)),useTabstopAt:e=>!YP(e),firstTabstop:e.firstTabstop,dom:{tag:"div",classes:[t].concat(e.extraClasses),styles:{position:"relative",...e.extraStyles}},components:[e.header,e.body,...e.footer.toArray()],parts:{blocker:{dom:KC(`
`),components:[{dom:{tag:"div",classes:H0?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:Vu([Tw.config({}),yw("dialog-events",e.dialogEvents.concat([Ji(Ga(),(e,t)=>{hW.isBlocked(e)?y():nw.focusIn(e)}),Vi(ki(),(e,t)=>{e.getSystem().broadcastOn([tL],{newFocus:t.event.newFocus})})])),yw("scroll-lock",[Zi(()=>{vc(Zt(),r)}),Qi(()=>{xc(Zt(),r)})]),...e.extraBehaviours]),eventOrder:{[ci()]:["dialog-events"],[xi()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[wi()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},Y0=e=>$C.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),title:e.translate("Close")}},buttonBehaviours:Vu([WR.config({})]),components:[sk("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Ni(e,eB)}}),X0=(e,t,o,n)=>{const r=e=>[Jc(n.translate(e.title))];return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...o.map(e=>({id:e})).getOr({})}},components:[],behaviours:Vu([l0.config({channel:`${JP}-${t}`,initialData:e,renderComponents:r})])}},J0=()=>({dom:KC('
')}),Z0=(e,t,o,n)=>MR.sketch({dom:KC('
'),components:[X0(e,t,R.some(o),n),J0(),Y0(n)],containerBehaviours:Vu([FJ.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>gd(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}),Q0=(e,t,o)=>{const n=cZ.parts.title(X0(e,t,R.none(),o)),r=cZ.parts.draghandle(J0()),s=cZ.parts.close(Y0(o)),a=[n].concat(e.draggable?[r]:[]).concat([s]);return MR.sketch({dom:KC('
'),components:a})},e1=(e,t,o)=>Q0({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),t1=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":o.translate(e)},styles:{left:"0px",right:"0px",bottom:"0px",top:n.getOr(0)+"px",position:"absolute"}},behaviours:t,components:[{dom:KC('
')}]}),o1=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=md(e().element,".tox-dialog__header").map(e=>So(e));cZ.setBusy(e(),(e,r)=>t1(o.message,r,t,n))},onUnblock:()=>{cZ.setIdle(e())}}),n1="tox-dialog--fullscreen",r1="tox-dialog--width-lg",s1="tox-dialog--width-md",a1=e=>{switch(e){case"large":return R.some(r1);case"medium":return R.some(s1);default:return R.none()}},i1=(e,t)=>{const o=Ze.fromDom(t.element.dom);Cc(o,n1)||(kc(o,[r1,s1]),a1(e).each(e=>vc(o,e)))},l1=(e,t)=>{const o=Ze.fromDom(e.element.dom),n=Tc(o),r=X(n,e=>e===r1||e===s1).or(a1(t));_c(o,[n1,...r.toArray()])},c1=(e,t,o)=>od(K0({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[DP({}),...e.extraBehaviours],onEscape:e=>{Ni(e,eB)},dialogEvents:t,eventOrder:{[li()]:[l0.name(),Ku.name()],[xi()]:["scroll-lock",l0.name(),"messages","dialog-events","alloy.base.behaviour"],[wi()]:["alloy.base.behaviour","dialog-events","messages",l0.name(),"scroll-lock"]}})),d1=(e,t={})=>{const o=e=>{const o=V(e.items,e=>{const o=Se(t,e.name).getOr(ga(!1));return{...e,storage:o}});return{...e,items:o}};return V(e,e=>"menu"===e.type?o(e):e)},u1=e=>K(e,(e,t)=>{if("menu"===t.type){const o=t;return K(o.items,(e,t)=>(e[t.name]=t.storage,e),e)}return e},{}),m1=(e,t)=>[Ki(Ga(),KP),e(QR,(e,o,n,r)=>{em(Wt(r.element)).fold(y,Zu),t.onClose(),o.onClose()}),e(eB,(e,t,o,n)=>{t.onCancel(e),Ni(n,QR)}),Vi(rB,(e,o)=>t.onUnblock()),Vi(nB,(e,o)=>t.onBlock(o.event))],g1=(e,t)=>{const o=(t,o)=>Vi(t,(t,r)=>{n(t,(n,s)=>{o(e(),n,r.event,t)})}),n=(e,t)=>{l0.getState(e).get().each(o=>{t(o,e)})};return[...m1(o,t),o(tB,(e,t,o)=>{t.onAction(e,{name:o.name})})]},p1=(e,t,o)=>{const n=(t,o)=>Vi(t,(t,n)=>{r(t,(r,s)=>{o(e(),r,n.event,t)})}),r=(e,t)=>{l0.getState(e).get().each(o=>{t(o.internalDialog,e)})};return[...m1(n,t),n(oB,(e,t)=>t.onSubmit(e)),n(ZR,(e,t,o)=>{t.onChange(e,{name:o.name})}),n(tB,(e,t,n,r)=>{const s=()=>r.getSystem().isConnected()?nw.focusIn(r):void 0,a=e=>so(e,"disabled")||ro(e,"aria-disabled").exists(e=>"true"===e),i=Wt(r.element),l=em(i);t.onAction(e,{name:n.name,value:n.value}),em(i).fold(s,e=>{a(e)||l.exists(t=>_t(e,t)&&a(t))?s():o().toOptional().filter(t=>!_t(t.element,e)).each(s)})}),n(sB,(e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})}),Qi(t=>{const o=e();_h.setValue(t,o.getData())})]},f1=(e,t)=>Vz(e,e.type,t),h1=(e,t,o)=>X(t,e=>e.name===o).bind(t=>t.memento.getOpt(e)),b1=(e,t)=>{const o=t.map(e=>e.footerButtons).getOr([]),n=$(o,e=>"start"===e.align),r=(e,t)=>MR.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+e]},components:V(t,e=>e.memento.asSpec())}),s=r("start",n.pass),a=r("end",n.fail);return[s,a]},v1=(e,t,o)=>{const n=(e,t)=>{const n=V(t.buttons,e=>{const t=YC(f1(e,o));return{name:e.name,align:e.align,memento:t}}),r=t=>h1(e,n,t);return R.some({lookupByName:r,footerButtons:n})};return{dom:KC(''),components:[],behaviours:Vu([l0.config({channel:`${QP}-${t}`,initialData:e,updateState:n,renderComponents:b1})])}},y1=(e,t,o)=>v1(e,t,o),x1=(e,t,o)=>cZ.parts.footer(v1(e,t,o)),w1=(e,t)=>{const o=e.getRoot();if(o.getSystem().isConnected()){const o=jb.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return mP.getField(o,t).orThunk(()=>{const o=e.getFooter(),n=o.bind(e=>l0.getState(e).get());return n.bind(e=>e.lookupByName(t))})}return R.none()},C1=(e,t)=>{const o=e.getRoot();return l0.getState(o).get().map(e=>Ds(Ts("data",e.dataValidator,t))).getOr(t)},S1=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},r=()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t,r=_h.getValue(n),s=pe(o,e=>e.get());return{...r,...s}},s=t=>{n(n=>{const r=p.getData(),s=Ar(r,t),a=C1(e,s),i=e.getFormWrapper();_h.setValue(i,a),ge(o,(e,t)=>{ke(s,t)&&e.set(s[t])})})},a=(t,o)=>{w1(e,t).each(o?lv.enable:lv.disable)},l=t=>{w1(e,t).each(Tw.focus)},c=e=>{if(!i(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(t=>{Ri(t,nB,{message:e})})},d=()=>{n(e=>{Ni(e,rB)})},u=t=>{n(o=>{const n=e.getBody(),r=l0.getState(n);r.get().exists(e=>e.isTabPanel())&&jb.getCurrent(n).each(e=>{_0.showTab(e,t)})})},m=r=>{n(n=>{const s=e.getId(),a=t(r),i=d1(a.internalDialog.buttons,o);n.getSystem().broadcastOn([`${XP}-${s}`],a),n.getSystem().broadcastOn([`${JP}-${s}`],a.internalDialog),n.getSystem().broadcastOn([`${ZP}-${s}`],a.internalDialog),n.getSystem().broadcastOn([`${QP}-${s}`],{...a.internalDialog,buttons:i}),p.setData(a.initialData)})},g=()=>{n(e=>{Ni(e,QR)})},p={getData:r,setData:s,setEnabled:a,focus:l,block:c,unblock:d,showTab:u,redial:m,close:g,toggleFullscreen:e.toggleFullscreen};return p},k1=(e,t,o)=>{const n=fl("dialog"),r=e.internalDialog,s=e1(r.title,n,o),a=ga(r.size),i=a1(a.get()).toArray(),l=(e,t)=>(a.set(t.internalDialog.size),i1(t.internalDialog.size,e),R.some(t)),c=z0({body:r.body,initialData:r.initialData},n,o),d=d1(r.buttons),u=u1(d),m=Be(0!==d.length,x1({buttons:d},n,o)),g=p1(()=>b,o1(()=>f,o.shared.providers,t),o.shared.getSink),p={id:n,header:s,body:c,footer:m,extraClasses:i,extraBehaviours:[l0.config({channel:`${XP}-${n}`,updateState:l,initialData:e})],extraStyles:{}},f=c1(p,g,o),h=(()=>{const e=()=>{const e=cZ.getBody(f);return jb.getCurrent(e).getOr(e)},t=()=>{l1(f,a.get())};return{getId:S(n),getRoot:S(f),getBody:()=>cZ.getBody(f),getFooter:()=>cZ.getFooter(f),getFormWrapper:e,toggleFullscreen:t}})(),b=S1(h,t.redial,u);return{dialog:f,instanceApi:b}},_1=(e,t,o,n=!1,r)=>{const s=fl("dialog"),a=fl("dialog-label"),i=fl("dialog-content"),l=e.internalDialog,c=ga(l.size),d=a1(c.get()).toArray(),u=(e,t)=>(c.set(t.internalDialog.size),i1(t.internalDialog.size,e),r(),R.some(t)),m=YC(Z0({title:l.title,draggable:!0},s,a,o.shared.providers)),g=YC(F0({body:l.body,initialData:l.initialData},s,i,o,n)),p=d1(l.buttons),f=u1(p),h=Be(0!==p.length,YC(y1({buttons:p},s,o))),b=p1(()=>w,{onBlock:e=>{hW.block(y,(t,n)=>{const r=m.getOpt(y).map(e=>So(e.element));return t1(e.message,n,o.shared.providers,r)})},onUnblock:()=>{hW.unblock(y)},onClose:()=>t.closeWindow()},o.shared.getSink),v="tox-dialog-inline",y=od({dom:{tag:"div",classes:["tox-dialog",v,...d],attributes:{role:"dialog",["aria-labelledby"]:a}},eventOrder:{[li()]:[l0.name(),Ku.name()],[ci()]:["execute-on-form"],[xi()]:["reflecting","execute-on-form"]},behaviours:Vu([nw.config({mode:"cyclic",onEscape:e=>(Ni(e,QR),R.some(!0)),useTabstopAt:e=>!YP(e)&&("button"!==ut(e)||"disabled"!==no(e,"disabled")),firstTabstop:1}),l0.config({channel:`${XP}-${s}`,updateState:u,initialData:e}),Tw.config({}),yw("execute-on-form",b.concat([Ji(Ga(),(e,t)=>{nw.focusIn(e)}),Vi(ki(),(e,t)=>{e.getSystem().broadcastOn([tL],{newFocus:t.event.newFocus})})])),hW.config({getRoot:()=>R.some(y)}),bw.config({}),DP({})]),components:[m.asSpec(),g.asSpec(),...h.map(e=>e.asSpec()).toArray()]}),x=()=>{l1(y,c.get())},w=S1({getId:S(s),getRoot:S(y),getFooter:()=>h.map(e=>e.get(y)),getBody:()=>g.get(y),getFormWrapper:()=>{const e=g.get(y);return jb.getCurrent(e).getOr(e)},toggleFullscreen:x},t.redial,f);return{dialog:y,instanceApi:w}};var E1=tinymce.util.Tools.resolve("tinymce.util.URI");const O1=e=>{const t=t=>{e.getSystem().isConnected()&&t(e)},o=e=>{if(!i(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(t=>{Ri(t,nB,{message:e})})},n=()=>{t(e=>{Ni(e,rB)})},r=()=>{t(e=>{Ni(e,QR)})},s=e=>{t(t=>{t.getSystem().broadcastOn([eL],e)})};return{block:o,unblock:n,close:r,sendMessage:s}},T1=["insertContent","setContent","execCommand","close","block","unblock"],D1=e=>l(e)&&-1!==T1.indexOf(e.mceAction),A1=e=>!D1(e)&&l(e)&&ke(e,"mceAction"),N1=(e,t,o)=>{switch(o.mceAction){case"insertContent":e.insertContent(o.content);break;case"setContent":e.setContent(o.content);break;case"execCommand":const n=!!m(o.ui)&&o.ui;e.execCommand(o.cmd,n,o.value);break;case"close":t.close();break;case"block":t.block(o.message);break;case"unblock":t.unblock();break}},R1=(e,t,o,n)=>{const r=fl("dialog"),s=e1(e.title,r,n),a=U0(e),i=e.buttons.bind(e=>0===e.length?R.none():R.some(x1({buttons:e},r,n))),l=g1(()=>y,o1(()=>v,n.shared.providers,t)),c={...e.height.fold(()=>({}),e=>({height:e+"px","max-height":e+"px"})),...e.width.fold(()=>({}),e=>({width:e+"px","max-width":e+"px"}))},d=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],u=new E1(e.url,{base_uri:new E1(window.location.href)}),m=`${u.protocol}://${u.host}${u.port?":"+u.port:""}`,g=Dm(),p=(e,t)=>R.some(t),h=[l0.config({channel:`${XP}-${r}`,updateState:p,initialData:e}),yw("messages",[Zi(()=>{const t=Rm(Ze.fromDom(window),"message",t=>{if(u.isSameOrigin(new E1(t.raw.origin))){const n=t.raw.data;D1(n)?N1(o,y,n):A1(n)&&e.onMessage(y,n)}});g.set(t)}),Qi(g.clear)]),Ku.config({channels:{[eL]:{onReceive:(e,t)=>{md(e.element,"iframe").each(e=>{const o=e.dom.contentWindow;f(o)&&o.postMessage(t,m)})}}}})],b={id:r,header:s,body:a,footer:i,extraClasses:d,extraBehaviours:h,extraStyles:c},v=c1(b,l,n),y=O1(v);return{dialog:v,instanceApi:y}},B1=e=>{const t=e.shared,o=(o,n)=>{const r=()=>{cZ.hide(l),n()},s=YC(Vz({name:"close-alert",text:"OK",primary:!0,buttonType:R.some("primary"),align:"end",enabled:!0,icon:R.none()},"cancel",e)),a=W0(),i=j0(r,t.providers),l=od(K0({lazySink:()=>t.getSink(),header:V0(a,i),body:$0(o,t.providers),footer:R.some(G0(q0([],[s.asSpec()]))),onEscape:r,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Vi(eB,r)],eventOrder:{}}));cZ.show(l);const c=s.get(l);Tw.focus(c)};return{open:o}},M1=e=>{const t=e.shared,o=(o,n)=>{const r=e=>{cZ.hide(c),n(e)},s=YC(Vz({name:"yes",text:"Yes",primary:!0,buttonType:R.some("primary"),align:"end",enabled:!0,icon:R.none()},"submit",e)),a=Vz({name:"no",text:"No",primary:!1,buttonType:R.some("secondary"),align:"end",enabled:!0,icon:R.none()},"cancel",e),i=W0(),l=j0(()=>r(!1),t.providers),c=od(K0({lazySink:()=>t.getSink(),header:V0(i,l),body:$0(o,t.providers),footer:R.some(G0(q0([],[a,s.asSpec()]))),onEscape:()=>r(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Vi(eB,()=>r(!1)),Vi(oB,()=>r(!0))],eventOrder:{}}));cZ.show(c);const d=s.get(c);Tw.focus(d)};return{open:o}},I1=(e,t)=>Ds(Ts("data",t,e)),P1=e=>dR(e,".tox-alert-dialog")||dR(e,".tox-confirm-dialog"),L1=(e,t,o)=>t&&o?[]:[gj.config({contextual:{lazyContext:()=>R.some(or(Ze.fromDom(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>{const o=lR(e,t.element);return o.map(e=>{const t=cR(e);return{bounds:t,optScrollEnv:R.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Ao(e.element).top})}}).getOrThunk(()=>({bounds:ar(),optScrollEnv:R.none()}))}})],F1=e=>{const t=e.editor,o=h_(t),n=B1(e.backstages.dialog),r=M1(e.backstages.dialog),s=(t,o,n)=>{if(!g(o)){if("toolbar"===o.inline)return c(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return d(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return c(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return l(t,n)},a=(e,t)=>i(e,t),i=(o,n)=>{const r=o=>{const r=R1(o,{closeWindow:()=>{cZ.hide(r.dialog),n(r.instanceApi)}},t,e.backstages.dialog);return cZ.show(r.dialog),r.instanceApi};return e0.openUrl(r,o)},l=(t,o)=>{const n=(t,n,r)=>{const s=n,a={dataValidator:r,initialData:s,internalDialog:t},i=k1(a,{redial:e0.redial,closeWindow:()=>{cZ.hide(i.dialog),o(i.instanceApi)}},e.backstages.dialog);return cZ.show(i.dialog),i.instanceApi.setData(s),i.instanceApi};return e0.open(n,t)},c=(n,r,s,a)=>{const i=(n,i,l)=>{const c=I1(i,l),d=Am(),u=e.backstages.popup.shared.header.isPositionedAtTop(),m={dataValidator:l,initialData:c,internalDialog:n},g=()=>d.on(e=>{VC.reposition(e),o&&u||gj.refresh(e)}),p=_1(m,{redial:e0.redial,closeWindow:()=>{d.on(VC.hide),t.off("ResizeEditor",g),d.clear(),s(p.instanceApi)}},e.backstages.popup,a.ariaAttrs,g),f=od(VC.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...u?{}:{fireRepositionEventInstead:{}},inlineBehaviours:Vu([yw("window-manager-inline-events",[Vi(Ci(),(e,t)=>{Ni(p.dialog,eB)})]),...L1(t,o,u)]),isExtraPart:(e,t)=>P1(t)}));d.set(f);const h=()=>{const e=t.inline?Zt():Ze.fromDom(t.getContainer()),o=or(e);return R.some(o)};return VC.showWithinBounds(f,nd(p.dialog),{anchor:r},h),o&&u||(gj.refresh(f),t.on("ResizeEditor",g)),p.instanceApi.setData(c),nw.focusIn(p.dialog),p.instanceApi};return e0.open(i,n)},d=(o,n,r,s)=>{const a=(o,a,i)=>{const l=I1(a,i),c=Am(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u={dataValidator:i,initialData:l,internalDialog:o},m=()=>c.on(e=>{VC.reposition(e),gj.refresh(e)}),g=_1(u,{redial:e0.redial,closeWindow:()=>{c.on(VC.hide),t.off("ResizeEditor ScrollWindow ElementScroll",m),c.clear(),r(g.instanceApi)}},e.backstages.popup,s.ariaAttrs,m),p=od(VC.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:s.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:Vu([yw("window-manager-inline-events",[Vi(Ci(),(e,t)=>{Ni(g.dialog,eB)})]),gj.config({contextual:{lazyContext:()=>R.some(or(Ze.fromDom(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>{const o=lR(t,e.element);return o.map(e=>{const t=cR(e);return{bounds:t,optScrollEnv:R.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Ao(e.element).top})}}).getOrThunk(()=>({bounds:ar(),optScrollEnv:R.none()}))}})]),isExtraPart:(e,t)=>P1(t)}));c.set(p);const f=()=>e.backstages.popup.shared.getSink().toOptional().bind(e=>{const o=lR(t,e.element),n=15,r=o.map(e=>cR(e)).getOr(ar()),s=or(Ze.fromDom(t.getContentAreaContainer())),a=rr(s,r);return R.some(tr(a.x,a.y,a.width,a.height-n))});return VC.showWithinBounds(p,nd(g.dialog),{anchor:n},f),gj.refresh(p),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",m),g.instanceApi.setData(l),nw.focusIn(g.dialog),g.instanceApi};return e0.open(a,o)},u=(e,t)=>{r.open(e,t)},m=(e,t)=>{n.open(e,t)},p=e=>{e.close()};return{open:s,openUrl:a,alert:m,close:p,confirm:u}},z1=e=>{vk(e),aA(e),GY(e)};var U1=()=>{ir.add("silver",e=>{z1(e);let t=()=>ar();const{dialogs:o,popups:n,renderUI:r}=nZ(e,{getPopupSinkBounds:()=>t()}),s=()=>{const o=r(),s=lR(e,n.getMothership().element);return s.each(e=>{t=()=>cR(e)}),o};nR.register(e,n.backstage.shared);const a=F1({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}}),i=()=>mk(e,{backstage:n.backstage},n.getMothership());return{renderUI:s,getWindowManagerImpl:S(a),getNotificationManagerImpl:i}})};U1()})()},"0a9d":function(e,t,o){o("69a4")},"0d68":function(e,t,o){o("030f")},4237:function(e,t,o){o("be7f")},"4ea8":function(e,t,o){o("cdd9")},"64d8":function(e,t,o){o("ef1f")},"69a4":function(e,t){(function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=e=>t=>t.options.get(e),r=n("content_style"),s=n("content_css_cors"),a=n("body_class"),i=n("body_id"),l=e=>{var n;let l="";const c=e.dom.encode,d=null!==(n=r(e))&&void 0!==n?n:"";l+='';const u=s(e)?' crossorigin="anonymous"':"";o.each(e.contentCSS,t=>{l+='"}),d&&(l+='");const m=i(e),g=a(e),p=t.os.isMacOS()||t.os.isiOS()?"e.metaKey":"e.ctrlKey && !e.altKey",f='