UNPKG

tinymce

Version:

Web based JavaScript HTML WYSIWYG editor control.

5 lines • 452 kB
!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>!!o(e,t.prototype)||e.constructor?.name===t.name,o=e=>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})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,(t,o)=>e(t)===o))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},b=()=>{},v=e=>()=>e(),x=(e,t)=>(...o)=>e(t.apply(null,o)),y=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=y(!1),E=y(!0);class A{tag;value;static singletonNone=new A(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.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:A.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(e??"Called getOrDie on None")}static from(e){return g(e)?A.some(e):A.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()"}}const D=Array.prototype.slice,M=Array.prototype.indexOf,B=Array.prototype.push,F=(e,t)=>M.call(e,t),I=(e,t)=>F(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},z=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},V=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const s=D.call(e,n,n+t);o.push(s)}return o},L=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}return n},N=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},P=(e,t)=>{const o=[],n=[];for(let s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},H=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}return o},U=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,(e,n)=>{o=t(o,e,n)}),o),W=(e,t,o)=>(N(e,(e,n)=>{o=t(o,e,n)}),o),j=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),$=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.none()},G=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);B.apply(t,e[o])}return t},q=(e,t)=>G(L(e,t)),Y=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},X=e=>{const t=D.call(e,0);return t.reverse(),t},K=(e,t)=>H(e,e=>!I(t,e)),J=(e,t)=>{const o={};for(let n=0,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],Z=(e,t)=>{const o=D.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),te=e=>ee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>D.call(e),se=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},re=Object.keys,ae=Object.hasOwnProperty,ie=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},le=(e,t)=>ce(e,(e,o)=>({k:o,v:t(e,o)})),ce=(e,t)=>{const o={};return ie(e,(e,n)=>{const s=t(e,n);o[s.k]=s.v}),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,(e,s)=>{(t(e,s)?o:n)(e,s)})},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,(e,n)=>{o.push(t(e,n))}),o},pe=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n],r=e[s];if(t(r,s,e))return A.some(r)}return A.none()},he=e=>ge(e,w),fe=(e,t)=>be(e,t)?A.from(e[t]):A.none(),be=(e,t)=>ae.call(e,t),ve=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],xe=e=>{if(!l(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 N(e,(n,s)=>{const r=re(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[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(!l(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);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,o)},match:e=>{const n=re(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!Y(t,e=>I(n,e)))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}}),o},ye=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},we=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each(t=>{setTimeout(()=>{e(t)},0)})};return e(e=>{s()||(t=A.some(e),N(o,r),o=[])}),{get:n,map:e=>we(t=>{n(o=>{t(e(o))})}),isReady:s}},Se={nu:we,pure:e=>we(t=>{t(e)})},Ce=e=>{setTimeout(()=>{throw e},0)},ke=e=>{const t=t=>{e().then(t,Ce)};return{map:t=>ke(()=>e().then(t)),bind:t=>ke(()=>e().then(e=>t(e).toPromise())),anonBind:t=>ke(()=>e().then(()=>t.toPromise())),toLazy:()=>Se.nu(t),toCached:()=>{let t=null;return ke(()=>(null===t&&(t=e()),t))},toPromise:e,get:t}},Oe=e=>ke(()=>new Promise(e)),_e=e=>ke(()=>Promise.resolve(e)),Te=e=>{const t=t=>t(e),o=y(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>Ae.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:()=>A.some(e)};return s},Ee=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>Ae.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:A.none};return o},Ae={value:Te,error:Ee,fromOption:(e,t)=>e.fold(()=>Ee(t),Te)},De=e=>({...e,toCached:()=>De(e.toCached()),bindFuture:t=>De(e.bind(e=>e.fold(e=>_e(Ae.error(e)),e=>t(e)))),bindResult:t=>De(e.map(e=>e.bind(t))),mapResult:t=>De(e.map(e=>e.map(t))),mapError:t=>De(e.map(e=>e.mapError(t))),foldResult:(t,o)=>e.map(e=>e.fold(t,o)),withTimeout:(t,o)=>De(Oe(n=>{let s=!1;const r=setTimeout(()=>{s=!0,n(Ae.error(o()))},t);e.get(e=>{s||(clearTimeout(r),n(e))})}))}),Me=e=>De(Oe(e)),Be="undefined"!=typeof window?window:Function("return this;")(),Fe=(e,t,o,n)=>{const s=e+t;return s>n?o:s<o?n:s},Ie=(e,t,o)=>Math.min(Math.max(e,t),o);let Re=0;const ze=e=>{const t=(new Date).getTime(),o=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return Re++,e+"_"+o+Re+String(t)},Ve=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;n<t.length;n++){const s=t[n];for(const t in s)be(s,t)&&(o[t]=e(o[t],s[t]))}return o},Le=Ve((e,t)=>i(e)&&i(t)?Le(e,t):t),Ne=Ve((e,t)=>t),Pe=(e,t,o=S)=>e.exists(e=>o(e,t)),He=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},Ue=(e,t,o)=>e.isSome()&&t.isSome()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),We=(e,t)=>null!=e?A.some(t(e)):A.none(),je=(e,t)=>e?A.some(t):A.none(),$e=(e,t)=>((e,t)=>{let o=null!=t?t:Be;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t);xe([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Ge=e=>{const t=ye(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},qe=()=>Ge(e=>e.unbind()),Ye=()=>{const e=Ge(b);return{...e,on:t=>e.get().each(t)}},Xe=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ke=(e,t)=>Qe(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Je=(e,t,o=0,n)=>{const s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Qe=(e,t)=>Xe(e,t,0),Ze=(e,t)=>Xe(e,t,e.length-t.length),et=(bt=/^\s+|\s+$/g,e=>e.replace(bt,"")),tt=e=>e.length>0,ot=e=>!tt(e),nt=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,s)},t)}}},st=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},rt=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},at=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return rt(o.childNodes[0])},it=(e,t)=>{const o=(t||document).createElement(e);return rt(o)},lt=(e,t)=>{const o=(t||document).createTextNode(e);return rt(o)},ct=rt,dt=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold(e=>{s.setStartBefore(e.dom)},(e,t)=>{s.setStart(e.dom,t)},e=>{s.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},ut=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},mt=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),gt=xe([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),pt=(e,t,o)=>t(ct(o.startContainer),o.startOffset,ct(o.endContainer),o.endOffset),ht=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:y(e),rtl:A.none}),relative:(t,o)=>({ltr:st(()=>dt(e,t,o)),rtl:st(()=>A.some(dt(e,o,t)))}),exact:(t,o,n,s)=>({ltr:st(()=>ut(e,t,o,n,s)),rtl:st(()=>A.some(ut(e,n,s,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>gt.rtl(ct(e.endContainer),e.endOffset,ct(e.startContainer),e.startOffset)).getOrThunk(()=>pt(0,gt.ltr,o)):pt(0,gt.ltr,o)})(0,o)},ft=(e,t)=>ht(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});var bt;gt.ltr,gt.rtl;const vt=(e,t)=>{const o=e.dom;if(1!==o.nodeType)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")}},xt=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,yt=(e,t)=>{const o=void 0===t?document:t.dom;return xt(o)?A.none():A.from(o.querySelector(e)).map(ct)},wt=(e,t)=>e.dom===t.dom,St=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Ct=()=>kt(0,0),kt=(e,t)=>({major:e,minor:t}),Ot={nu:kt,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?Ct():((e,t)=>{const o=((e,t)=>{for(let o=0;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return kt(n(1),n(2))})(e,o)},unknown:Ct},_t=(e,t)=>{const o=String(t).toLowerCase();return j(e,e=>e.search(o))},Tt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Et=e=>t=>Je(t,e),At=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Je(e,"edge/")&&Je(e,"chrome")&&Je(e,"safari")&&Je(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Tt],search:e=>Je(e,"chrome")&&!Je(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Je(e,"msie")||Je(e,"trident")},{name:"Opera",versionRegexes:[Tt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Et("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Et("firefox")},{name:"Safari",versionRegexes:[Tt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Je(e,"safari")||Je(e,"mobile/"))&&Je(e,"applewebkit")}],Dt=[{name:"Windows",search:Et("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Je(e,"iphone")||Je(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Et("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Et("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Et("linux"),versionRegexes:[]},{name:"Solaris",search:Et("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Et("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Et("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Mt={browsers:y(At),oses:y(Dt)},Bt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n("Edge"),isChromium:n("Chromium"),isIE:n("IE"),isOpera:n("Opera"),isFirefox:n("Firefox"),isSafari:n("Safari")}},Ft=()=>Bt({current:void 0,version:Ot.unknown()}),It=Bt,Rt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n("Windows"),isiOS:n("iOS"),isAndroid:n("Android"),isMacOS:n("macOS"),isLinux:n("Linux"),isSolaris:n("Solaris"),isFreeBSD:n("FreeBSD"),isChromeOS:n("ChromeOS")}},zt=()=>Rt({current:void 0,version:Ot.unknown()}),Vt=Rt,Lt=e=>window.matchMedia(e).matches;let Nt=st(()=>((e,t,o)=>{const n=Mt.browsers(),s=Mt.oses(),r=t.bind(e=>((e,t)=>se(t.brands,t=>{const o=t.brand.toLowerCase();return j(e,e=>o===e.brand?.toLowerCase()).map(e=>({current:e.name,version:Ot.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>_t(e,t).map(e=>{const o=Ot.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(Ft,It),a=((e,t)=>_t(e,t).map(e=>{const o=Ot.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(s,e).fold(zt,Vt),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||!n("(any-pointer:fine)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:y(s),isiPhone:y(r),isTablet:y(l),isPhone:y(c),isTouch:y(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:y(d),isDesktop:y(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(window.navigator.userAgent,A.from(window.navigator.userAgentData),Lt));const Pt=()=>Nt(),Ht=Object.getPrototypeOf,Ut=e=>{const t=$e("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>$e(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Ht(e).constructor.name))},Wt=e=>e.dom.nodeName.toLowerCase(),jt=e=>t=>(e=>e.dom.nodeType)(t)===e,$t=e=>Gt(e)&&Ut(e.dom),Gt=jt(1),qt=jt(3),Yt=jt(9),Xt=jt(11),Kt=e=>t=>Gt(t)&&Wt(t)===e,Jt=e=>ct(e.dom.ownerDocument),Qt=e=>Yt(e)?e:Jt(e),Zt=e=>ct(Qt(e).dom.documentElement),eo=e=>ct(Qt(e).dom.defaultView),to=e=>A.from(e.dom.parentNode).map(ct),oo=e=>A.from(e.dom.parentElement).map(ct),no=e=>A.from(e.dom.offsetParent).map(ct),so=e=>A.from(e.dom.previousSibling).map(ct),ro=e=>A.from(e.dom.nextSibling).map(ct),ao=e=>L(e.dom.childNodes,ct),io=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(ct)},lo=e=>io(e,0),co=(e,t)=>({element:e,offset:t}),uo=(e,t)=>{const o=ao(e);return o.length>0&&t<o.length?co(o[t],0):co(e,t)},mo=e=>Xt(e)&&g(e.dom.host),go=e=>ct(e.dom.getRootNode()),po=e=>mo(e)?e:ct(Qt(e).dom.body),ho=e=>{const t=go(e);return mo(t)?A.some(t):A.none()},fo=e=>ct(e.dom.host),bo=e=>{const t=ct((e=>{if(g(e.target)){const t=ct(e.target);if(Gt(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return te(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=x(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},vo=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(bo(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:C(xo,e,t,r,s)}},xo=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},yo=E,wo=(e,t,o)=>((e,t,o,n)=>vo(e,t,o,n,!1))(e,t,yo,o),So=(e,t,o)=>((e,t,o,n)=>vo(e,t,o,n,!0))(e,t,yo,o),Co=bo,ko=()=>ct(document),Oo=(e,t=!1)=>e.dom.focus({preventScroll:t}),_o=e=>e.dom.blur(),To=e=>{const t=go(e).dom;return e.dom===t.activeElement},Eo=(e=ko())=>A.from(e.dom.activeElement).map(ct),Ao=e=>Eo(go(e)).filter(t=>e.dom.contains(t.dom)),Do=(e,t)=>{to(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},Mo=(e,t)=>{ro(e).fold(()=>{to(e).each(e=>{Fo(e,t)})},e=>{Do(e,t)})},Bo=(e,t)=>{lo(e).fold(()=>{Fo(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},Fo=(e,t)=>{e.dom.appendChild(t.dom)},Io=(e,t)=>{N(t,t=>{Fo(e,t)})},Ro=(e,t,o)=>{if(!(r(o)||d(o)||h(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+"")},zo=(e,t,o)=>{Ro(e.dom,t,o)},Vo=(e,t)=>{const o=e.dom;ie(t,(e,t)=>{Ro(o,t,e)})},Lo=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},No=(e,t)=>A.from(Lo(e,t)),Po=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Ho=(e,t)=>{e.dom.removeAttribute(t)},Uo=e=>{e.dom.textContent="",N(ao(e),e=>{Wo(e)})},Wo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},jo=(e,t)=>ct(e.dom.cloneNode(t)),$o=e=>e.dom.innerHTML,Go=(e,t)=>{const o=Jt(e).dom,n=ct(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,ao(ct(o))})(t,o);Io(n,s),Uo(e),Fo(e,n)},qo=e=>new Promise((t,o)=>{const n=()=>{r(),t(e)},s=[wo(e,"load",n),wo(e,"error",()=>{r(),o("Unable to load data from image: "+e.dom.src)})],r=()=>N(s,e=>e.unbind());e.dom.complete&&n()}),Yo=e=>void 0!==e.style&&p(e.style.getPropertyValue),Xo=e=>{const t=qt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ho(ct(t)).fold(()=>o.body.contains(t),(n=Xo,s=fo,e=>n(s(e))));var n,s},Ko=()=>Jo(ct(document)),Jo=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ct(t)},Qo=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Yo(e)&&e.style.setProperty(t,o)},Zo=(e,t)=>{Yo(e)&&e.style.removeProperty(t)},en=(e,t,o)=>{const n=e.dom;Qo(n,t,o)},tn=(e,t)=>{const o=e.dom;ie(t,(e,t)=>{Qo(o,t,e)})},on=(e,t)=>{const o=e.dom;ie(t,(e,t)=>{e.fold(()=>{Zo(o,t)},e=>{Qo(o,t,e)})})},nn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Xo(e)?n:sn(o,t)},sn=(e,t)=>Yo(e)?e.style.getPropertyValue(t):"",rn=(e,t)=>{const o=e.dom,n=sn(o,t);return A.from(n).filter(e=>e.length>0)},an=e=>{const t={},o=e.dom;if(Yo(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},ln=(e,t,o)=>{const n=it(e);return en(n,t,o),rn(n,t).isSome()},cn=(e,t)=>{const o=e.dom;Zo(o,t),Pe(No(e,"style").map(et),"")&&Ho(e,"style")},dn=e=>e.dom.offsetWidth,un=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=nn(o,e);return parseFloat(t)||0}return n},n=(e,t)=>W(t,(t,o)=>{const n=nn(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s},0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Yo(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},mn=un("height",e=>{const t=e.dom;return Xo(e)?t.getBoundingClientRect().height:t.offsetHeight}),gn=e=>mn.get(e),pn=e=>mn.getOuter(e),hn=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),fn=un("width",e=>{const t=e.dom;return Xo(e)?t.getBoundingClientRect().width:t.offsetWidth}),bn=e=>fn.get(e),vn=e=>fn.getOuter(e),xn=(e,t)=>({left:e,top:t,translate:(o,n)=>xn(e+o,t+n)}),yn=xn,wn=(e,t)=>void 0!==e?e:void 0!==t?t:0,Sn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return yn(o.offsetLeft,o.offsetTop);const r=wn(n?.pageYOffset,s.scrollTop),a=wn(n?.pageXOffset,s.scrollLeft),i=wn(s.clientTop,o.clientTop),l=wn(s.clientLeft,o.clientLeft);return Cn(e).translate(a-l,r-i)},Cn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?yn(o.offsetLeft,o.offsetTop):Xo(e)?(e=>{const t=e.getBoundingClientRect();return yn(t.left,t.top)})(t):yn(0,0)},kn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return yn(o,n)},On=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},_n=(e=>{const t=t=>e(t)?A.from(t.dom.nodeValue):A.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(qt),Tn=(e,t)=>o=>"rtl"===En(o)?t:e,En=e=>"rtl"===nn(e,"direction")?"rtl":"ltr",An=(e,t)=>{const o=Lo(e,t);return void 0===o||""===o?[]:o.split(" ")};var Dn=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const Mn=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=ct(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},Bn=(e,t,o)=>Dn((e,t)=>t(e),Mn,e,t,o),Fn=(e,t)=>j(e.dom.childNodes,e=>t(ct(e))).map(ct),In=(e,t,o)=>Mn(e,e=>vt(e,t),o),Rn=(e,t)=>(e=>{const o=e.dom;return o.parentNode?Fn(ct(o.parentNode),o=>!wt(e,o)&&vt(o,t)):A.none()})(e),zn=(e,t)=>Fn(e,e=>vt(e,t)),Vn=(e,t)=>yt(t,e),Ln=(e,t,o)=>Dn((e,t)=>vt(e,t),In,e,t,o),Nn=(e,t)=>{e.dom.checked=t},Pn=e=>e.dom.checked,Hn=e=>void 0!==e.dom.classList,Un=e=>An(e,"class"),Wn=(e,t)=>((e,t,o)=>{const n=An(e,t).concat([o]);return zo(e,t,n.join(" ")),!0})(e,"class",t),jn=(e,t)=>((e,t,o)=>{const n=H(An(e,t),e=>e!==o);return n.length>0?zo(e,t,n.join(" ")):Ho(e,t),!1})(e,"class",t),$n=(e,t)=>{Hn(e)?e.dom.classList.add(t):Wn(e,t)},Gn=e=>{0===(Hn(e)?e.dom.classList:Un(e)).length&&Ho(e,"class")},qn=(e,t)=>{Hn(e)?e.dom.classList.remove(t):jn(e,t),Gn(e)},Yn=(e,t)=>Hn(e)&&e.dom.classList.contains(t),Xn=(e,t)=>{N(t,t=>{$n(e,t)})},Kn=(e,t)=>{N(t,t=>{qn(e,t)})},Jn=e=>Hn(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e<t.length;e++){const n=t.item(e);null!==n&&(o[e]=n)}return o})(e):Un(e),Qn=e=>e.dom.value,Zn=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},es=(e,t,o)=>H(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=ct(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),ts=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return xt(o)?[]:L(o.querySelectorAll(e),ct)})(t,e),os=(e,t,o)=>Bn(e,t,o).isSome(),ns=(e,t,o)=>Ln(e,t,o).isSome(),ss=e=>p(e)?e:T,rs=(e,t,o)=>{let n=e.dom;const s=ss(o);for(;n.parentNode;){n=n.parentNode;const e=ct(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},as=(e,t,o)=>{const n=t(e),s=ss(o);return n.orThunk(()=>s(e)?A.none():rs(e,t,s))},is=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),ls=xe([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),cs={before:ls.before,on:ls.on,after:ls.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(w,w,w)},ds=xe([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),us={domRange:ds.domRange,relative:ds.relative,exact:ds.exact,exactFromRange:e=>ds.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>ct(e.startContainer),relative:(e,t)=>cs.getStart(e),exact:(e,t,o,n)=>e}))(e);return eo(t)},range:is},ms=(e,t)=>{const o=Wt(e);return"input"===o?cs.after(e):I(["br","img"],o)?0===t?cs.before(e):cs.after(e):cs.on(e,t)},gs=e=>A.from(e.getSelection()),ps=(e,t,o,n,s)=>{((e,t)=>{gs(e).each(e=>{e.removeAllRanges(),e.addRange(t)})})(e,ut(e,t,o,n,s))},hs=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(is(ct(t.startContainer),t.startOffset,ct(o.endContainer),o.endOffset))}return A.none()},fs=e=>{if(null===e.anchorNode||null===e.focusNode)return hs(e);{const t=ct(e.anchorNode),o=ct(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=Jt(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=wt(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(is(t,e.anchorOffset,o,e.focusOffset)):hs(e)}},bs=e=>gs(e).filter(e=>e.rangeCount>0).bind(fs),vs=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(mt):A.none()})(ft(e,t)),xs={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:[""]},ys=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),ws=(e,t)=>A.from(ys.exec(e)).bind(e=>{const o=Number(e[1]),n=e[2];return((e,t)=>R(t,t=>R(xs[t],t=>e===t)))(n,t)?A.some({value:o,unit:n}):A.none()}),Ss=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Cs=e=>{const t=void 0===e?window:e,o=t.document,n=kn(ct(o));return(e=>{const t=void 0===e?window:e;return Pt().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return Ss(n.left,n.top,o,s)},e=>Ss(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))},ks=(e,t)=>e.view(t).fold(y([]),t=>{const o=e.owner(t),n=ks(e,o);return[t].concat(n)});var Os=Object.freeze({__proto__:null,owner:e=>Jt(e),view:e=>(e.dom===document?A.none():A.from(e.dom.defaultView?.frameElement)).map(ct)});const _s=e=>{const t=ko(),o=kn(t),n=((e,t)=>{const o=t.owner(e),n=ks(t,o);return A.some(n)})(e,Os);return n.fold(C(Sn,e),t=>{const n=Cn(e),s=U(t,(e,t)=>{const o=Cn(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return yn(s.left+n.left+o.left,s.top+n.top+o.top)})},Ts=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Es=e=>{const t=Sn(e),o=vn(e),n=pn(e);return Ts(t.left,t.top,o,n)},As=e=>{const t=_s(e),o=vn(e),n=pn(e);return Ts(t.left,t.top,o,n)},Ds=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Ts(o,n,s-o,r-n)},Ms=()=>Cs(window),Bs=(e,t)=>wt(e.element,t.event.target),Fs=e=>(Pe(rn(e,"position"),"fixed")?A.none():no(e)).orThunk(()=>{const t=it("span");return to(e).bind(e=>{Fo(e,t);const o=no(t);return Wo(t),o})}),Is=e=>Fs(e).map(Sn).getOrThunk(()=>yn(0,0)),Rs=(e,t)=>{const o=A.from(Lo(e,"id")).getOrThunk(()=>{const e=ze("aria");return zo(t,"id",e),e});zo(e,"aria-describedby",o)};var zs;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(zs||(zs={}));const Vs=(e,t,o)=>e.stype===zs.Error?t(e.serror):o(e.svalue),Ls=e=>({stype:zs.Value,svalue:e}),Ns=e=>({stype:zs.Error,serror:e}),Ps=Ls,Hs=Ns,Us=Vs,Ws=e=>a(e)&&re(e).length>100?" removed due to size":JSON.stringify(e,null,2),js=(e,t)=>Hs([{path:e,getErrorInfo:t}]),$s=e=>({extract:(t,o)=>((e,t)=>e.stype===zs.Error?t(e.serror):e)(e(o),e=>((e,t)=>js(e,y(t)))(t,e)),toString:y("val")}),Gs=$s(Ps),qs=y(Gs),Ys=(e,t)=>$s(o=>{const n=typeof o;return e(o)?Ps(o):Hs(`Expected type: ${t} but got: ${n}`)}),Xs=Ys(h,"number"),Ks=Ys(r,"string"),Js=Ys(d,"boolean"),Qs=Ys(p,"function"),Zs=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=>Zs(e[t]));default:return!1}},er=$s(e=>Zs(e)?Ps(e):Hs("Expected value to be acceptable for sending via postMessage")),tr=e=>({tag:"defaultedThunk",process:e}),or=e=>tr(y(e)),nr=e=>({tag:"mergeWithThunk",process:e}),sr=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),rr=(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)}},ar=e=>{const t=(e=>{const t=[],o=[];return N(e,e=>{Vs(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,x(Hs,G)(o)):Ps(t.values);var o},ir=(e,t,o,n)=>n(fe(e,t).getOrThunk(()=>o(e))),lr=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold(()=>Ps(A.none()),e=>((e,t)=>e.stype===zs.Value?{stype:zs.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold(()=>((e,t,o)=>js(e,()=>'Could not find valid *required* value for "'+t+'" in '+Ws(o)))(e,o,t),n))(t,o,n,r);case"defaultedThunk":return ir(o,n,e.process,r);case"option":return((e,t,o)=>o(fe(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(fe(e,t).map(t=>!0===t?o(e):t)))(o,n,e.process,a);case"mergeWithThunk":return ir(o,n,y({}),t=>{const n=Le(e.process(o),t);return r(n)})}},cr=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),dr=e=>re(me(e,g)),ur=e=>{const t=mr(e),o=U(e,(e,t)=>rr(t,t=>Le(e,{[t]:!0}),y(e)),{});return{extract:(e,n)=>{const s=d(n)?[]:dr(n),r=H(s,e=>!ve(o,e));return 0===r.length?t.extract(e,n):((e,t)=>js(e,()=>"There are unsupported fields: ["+t.join(", ")+"] specified"))(e,r)},toString:t.toString}},mr=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)rr(r,(o,r,a,i)=>{const l=lr(a,e,t,o,i);Us(l,e=>{s.push(...e)},e=>{n[r]=e})},(e,o)=>{n[e]=o(t)});return s.length>0?Hs(s):Ps(n)})(t,o,e),toString:()=>{const t=L(e,e=>rr(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"}}),gr=e=>({extract:(t,o)=>{const n=L(o,(o,n)=>e.extract(t.concat(["["+n+"]"]),o));return ar(n)},toString:()=>"array("+e.toString()+")"}),pr=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===zs.Value)return{stype:zs.Value,svalue:o(e.svalue)};s.push(e)}return ar(s)},toString:()=>"oneOf("+L(e,e=>e.toString()).join(", ")+")"}},hr=(e,t)=>({extract:(o,n)=>{const s=re(n),r=((t,o)=>gr($s(e)).extract(t,o))(o,s);return((e,t)=>e.stype===zs.Value?t(e.svalue):e)(r,e=>{const s=L(e,e=>sr(e,e,{tag:"required",process:{}},t));return mr(s).extract(o,n)})},toString:()=>"setOf("+t.toString()+")"}),fr=x(gr,mr),br=(e,t)=>({extract:(o,n)=>fe(n,e).fold(()=>((e,t)=>js(e,()=>'Choice schema did not contain choice key: "'+t+'"'))(o,e),e=>((e,t,o,n)=>fe(o,n).fold(()=>((e,t,o)=>js(e,()=>'The chosen schema: "'+o+'" did not exist in branches: '+Ws(t)))(e,o,n),o=>o.extract(e.concat(["branch: "+n]),t)))(o,n,t,e)),toString:()=>"chooseOn("+e+"). Possible values: "+re(t)}),vr=e=>$s(t=>e(t).fold(Hs,Ps)),xr=(e,t)=>hr(t=>e(t).fold(Ns,Ls),t),yr=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===zs.Error?{stype:zs.Error,serror:t(e.serror)}:e)(t.extract([e],o),e=>({input:o,errors:e})))(e,t,o),Vs(n,Ae.error,Ae.value);var n},wr=e=>e.fold(e=>{throw new Error(Cr(e))},w),Sr=(e,t,o)=>wr(yr(e,t,o)),Cr=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:y("... (only showing first ten failures)")}]):e;return L(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())})(e.errors).join("\n")+"\n\nInput object: "+Ws(e.input),kr=(e,t)=>br(e,le(t,mr)),Or=(e,t)=>((e,t)=>{const o=st(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),_r=sr,Tr=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Er=e=>vr(t=>I(e,t)?Ae.value(t):Ae.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),Ar=e=>_r(e,e,{tag:"required",process:{}},qs()),Dr=(e,t)=>_r(e,e,{tag:"required",process:{}},t),Mr=e=>Dr(e,Xs),Br=e=>Dr(e,Ks),Fr=(e,t)=>_r(e,e,{tag:"required",process:{}},Er(t)),Ir=e=>Dr(e,Qs),Rr=(e,t)=>_r(e,e,{tag:"required",process:{}},mr(t)),zr=(e,t)=>_r(e,e,{tag:"required",process:{}},fr(t)),Vr=(e,t)=>_r(e,e,{tag:"required",process:{}},gr(t)),Lr=e=>_r(e,e,{tag:"option",process:{}},qs()),Nr=(e,t)=>_r(e,e,{tag:"option",process:{}},t),Pr=e=>Nr(e,Xs),Hr=e=>Nr(e,Ks),Ur=(e,t)=>Nr(e,Er(t)),Wr=e=>Nr(e,Qs),jr=(e,t)=>Nr(e,gr(t)),$r=(e,t)=>Nr(e,mr(t)),Gr=(e,t)=>_r(e,e,or(t),qs()),qr=(e,t,o)=>_r(e,e,or(t),o),Yr=(e,t)=>qr(e,t,Xs),Xr=(e,t)=>qr(e,t,Ks),Kr=(e,t,o)=>qr(e,t,Er(o)),Jr=(e,t)=>qr(e,t,Js),Qr=(e,t)=>qr(e,t,Qs),Zr=(e,t,o)=>qr(e,t,gr(o)),ea=(e,t,o)=>qr(e,t,mr(o)),ta=(e,t)=>((e,t)=>({[e]:t}))(e,t),oa=e=>(e=>{const t={};return N(e,e=>{t[e.key]=e.value}),t})(e),na=y,sa=na("touchstart"),ra=na("touchmove"),aa=na("touchend"),ia=na("touchcancel"),la=na("mousedown"),ca=na("mousemove"),da=na("mouseout"),ua=na("mouseup"),ma=na("mouseover"),ga=na("focusin"),pa=na("focusout"),ha=na("keydown"),fa=na("keyup"),ba=na("input"),va=na("change"),xa=na("click"),ya=na("dblclick"),wa=na("transitioncancel"),Sa=na("transitionend"),Ca=na("transitionstart"),ka=na("selectstart"),Oa=na("pointerdown"),_a=na("pointermove"),Ta=na("pointerup"),Ea=na("lostpointercapture"),Aa=e=>y("alloy."+e),Da={tap:Aa("tap")},Ma=Aa("focus"),Ba=Aa("blur.post"),Fa=Aa("paste.post"),Ia=Aa("receive"),Ra=Aa("execute"),za=Aa("focus.item"),Va=Da.tap,La=Aa("longpress"),Na=Aa("sandbox.close"),Pa=Aa("typeahead.cancel"),Ha=Aa("system.init"),Ua=Aa("system.touchmove"),Wa=Aa("system.touchend"),ja=Aa("system.scroll"),$a=Aa("system.resize"),Ga=Aa("system.attached"),qa=Aa("system.detached"),Ya=Aa("system.dismissRequested"),Xa=Aa("system.repositionRequested"),Ka=Aa("focusmanager.shifted"),Ja=Aa("slotcontainer.visibility"),Qa=Aa("system.external.element.scroll"),Za=Aa("change.tab"),ei=Aa("dismiss.tab"),ti=Aa("highlight"),oi=Aa("dehighlight"),ni=e=>(e=>{if(mo(e))return"#shadow-root";{const t=(e=>jo(e,!1))(e);return(e=>{const t=it("div"),o=ct(e.dom.cloneNode(!0));return Fo(t,o),$o(t)})(t)}})(e);var si;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(si||(si={}));const ri=ye({}),ai=["alloy/data/Fields","alloy/debugging/Debugging"],ii=(e,t,o)=>((e,t,o)=>{switch(fe(ri.get(),e).orThunk(()=>{const t=re(ri.get());return se(t,t=>e.indexOf(t)>-1?A.some(ri.get()[t]):A.none())}).getOr(si.NORMAL)){case si.NORMAL:return o(li());case si.LOGGING:{const n=((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 s=(new Date).getTime();I(["mousemove","mouseover","mouseout",Ha()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:L(o,e=>I(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ni(e.target)+")":e.outcome)})}}})(e,t),s=o(n);return n.write(),s}case si.STOP:return!0}})(e,t,o),li=y({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),ci=y([Ar("menu"),Ar("selectedMenu")]),di=y([Ar("item"),Ar("selectedItem")]);y(mr(di().concat(ci())));const ui=y(mr(di())),mi=Rr("initSize",[Ar("numColumns"),Ar("numRows")]),gi=()=>Rr("markers",[Ar("backgroundMenu")].concat(ci()).concat(di())),pi=e=>Rr("markers",L(e,Ar)),hi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");j(t,e=>e.indexOf("alloy")>0&&!R(ai,t=>e.indexOf(t)>-1)).getOr("unknown")}})(),_r(t,t,o,vr(e=>Ae.value((...t)=>e.apply(void 0,t))))),fi=e=>hi(0,e,or(b)),bi=e=>hi(0,e,or(A.none)),vi=e=>hi(0,e,{tag:"required",process:{}}),xi=e=>hi(0,e,{tag:"required",process:{}}),yi=(e,t)=>Tr(e,y(t)),wi=e=>Tr(e,w),Si=y(mi),Ci=e=>L(e,e=>Ze(e,"/*")?e.substring(0,e.length-2):e),ki=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Ci(r)}),e},Oi=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout(()=>{e.apply(null,n),o=null},t)}}},_i=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])};var Ti;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(Ti||(Ti={}));const Ei="placeholder",Ai=xe([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Di=e=>be(e,"uiType"),Mi=(e,t,o,n)=>((e,t,o,n)=>Di(o)&&o.uiType===Ei?((e,t,o,n)=>e.exists(e=>e!==o.owner)?Ai.single(!0,y(o)):fe(n,o.name).fold(()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+re(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))},e=>e.replace()))(e,0,o,n):Ai.single(!1,y(o)))(e,0,o,n).fold((s,r)=>{const a=Di(o)?r(t,o.config,o.validated):r(t),i=fe(a,"components").getOr([]),l=q(i,o=>Mi(e,t,o,n));return[{...a,components:l}]},(e,n)=>{if(Di(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)}),Bi=Ai.single,Fi=Ai.multiple,Ii=y(Ei),Ri=xe([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),zi=Gr("factory",{sketch:w}),Vi=Gr("schema",[]),Li=Ar("name"),Ni=_r("pname","pname",tr(e=>"<alloy."+ze(e.name)+">"),qs()),Pi=Tr("schema",()=>[Lr("preprocess")]),Hi=Gr("defaults",y({})),Ui=Gr("overrides",y({})),Wi=mr([zi,Vi,Li,Ni,Hi,Ui]),ji=mr([zi,Vi,Li,Hi,Ui]),$i=mr([zi,Vi,Li,Ni,Hi,Ui]),Gi=mr([zi,Pi,Li,Ar("unit"),Ni,Hi,Ui]),qi=e=>e.fold(A.some,A.none,A.some,A.some),Yi=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},Xi=(e,t)=>o=>{const n=Sr("Converting part type",t,o);return e(n)},Ki=Xi(Ri.required,Wi),Ji=Xi(Ri.external,ji),Qi=Xi(Ri.optional,$i),Zi=Xi(Ri.group,Gi),el=y("entirety");var tl=Object.freeze({__proto__:null,asCommon:e=>e.fold(w,w,w,w),asNamedPart:qi,external:Ji,group:Zi,name:Yi,optional:Qi,original:el,required:Ki});const ol=(e,t,o,n)=>Le(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),nl=(e,t)=>{const o={};return N(t,t=>{qi(t).each(t=>{const n=sl(e,t.pname);o[t.name]=o=>{const s=Sr("Part: "+t.name+" in "+e,mr(t.schema),o);return{...n,config:o,validated:s}}})}),o},sl=(e,t)=>({uiType:Ii(),owner:e,name:t}),rl=(e,t,o)=>({uiType:Ii(),owner:e,name:t,config:o,validated:{}}),al=e=>q(e,e=>e.fold(A.none,A.some,A.none,A.none).map(e=>Rr(e.name,e.schema.concat([wi(el())]))).toArray()),il=e=>L(e,Yi),ll=(e,t,o)=>((e,t,o)=>{const n={},s={};return N(o,e=>{e.fold(e=>{n[e.pname]=Bi(!0,(t,o,n)=>e.factory.sketch(ol(t,e,o,n)))},e=>{const o=t.parts[e.name];s[e.name]=y(e.factory.sketch(ol(t,e,o[el()]),o))},e=>{n[e.pname]=Bi(!1,(t,o,n)=>e.factory.sketch(ol(t,e,o,n)))},e=>{n[e.pname]=Fi(!0,(t,o,n)=>{const s=t[e.name];return L(s,o=>e.factory.sketch(Le(e.defaults(t,o,n),o,e.overrides(t,o))))})})}),{internals:y(n),externals:y(s)}})(0,t,o),cl=(e,t,o)=>((e,t,o,n)=>{const s=le(n,(e,t)=>((e,t)=>{let o=!1;return{name:y(e),required:()=>t.fold((e,t)=>e,(e,t)=>e),used:()=>o,replace:()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t}}})(t,e)),r=((e,t,o,n)=>q(o,o=>Mi(e,t,o,n)))(e,t,o,s);return ie(s,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))}),r})(A.some(e),t,t.components,o),dl=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},ul=(e,t,o)=>dl(e,t,o).getOrDie("Could not find part: "+o),ml=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return N(o,e=>{n[e]=y(r.getByUid(s[e]))}),n},gl=(e,t)=>{const o=e.getSystem();return le(t.partUids,(e,t)=>y(o.getByUid(e)))},pl=e=>re(e.partUids),hl=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return N(o,e=>{n[e]=y(r.getByUid(s[e]).getOrDie())}),n},fl=(e,t)=>{const o=il(t);return oa(L(o,t=>({key:t,value:e+"-"+t})))},bl=e=>_r("partUids","partUids",nr(t=>fl(t.uid,e)),qs());var vl=Object.freeze({__proto__:null,components:cl,defaultUids:fl,defaultUidsSchema:bl,generate:nl,generateOne:rl,getAllPartNames:pl,getAllParts:gl,getPart:dl,getPartOrDie:ul,getParts:ml,getPartsOrDie:hl,names:il,schemas:al,substitutes:ll});const xl=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],yl=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>fe(o,e).getOr([]),i=(e,t,o)=>{const n=K(xl,o);return{offset:yn(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(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},wl=()=>yl(0,0,{}),Sl=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),Cl=xe([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),kl=Cl.southeast,Ol=Cl.southwest,_l=Cl.northeast,Tl=Cl.northwest,El=Cl.south,Al=Cl.north,Dl=Cl.east,Ml=Cl.west,Bl=(e,t)=>J(["left","right","top","bottom"],o=>fe(t,o).map(t=>((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}})(e,t))),Fl="layout",Il=e=>e.x,Rl=(e,t)=>e.x+e.width/2-t.width/2,zl=(e,t)=>e.x+e.width-t.width,Vl=(e,t)=>e.y-t.height,Ll=e=>e.y+e.height,Nl=(e,t)=>e.y+e.height/2-t.height/2,Pl=(e,t,o)=>Sl(Il(e),Ll(e),o.southeast(),kl(),"southeast",Bl(e,{left:1,top:3}),Fl),Hl=(e,t,o)=>Sl(zl(e,t),Ll(e),o.southwest(),Ol(),"southwest",Bl(e,{right:0,top:3}),Fl),Ul=(e,t,o)=>Sl(Il(e),Vl(e,t),o.northeast(),_l(),"northeast",Bl(e,{left:1,bottom:2}),Fl),Wl=(e,t,o)=>Sl(zl(e,t),Vl(e,t),o.northwest(),Tl(),"northwest",Bl(e,{right:0,bottom:2}),Fl),jl=(e,t,o)=>Sl(Rl(e,t),Vl(e,t),o.north(),Al(),"north",Bl(e,{bottom:2}),Fl),$l=(e,t,o)=>Sl(Rl(e,t),Ll(e),o.south(),El(),"south",Bl(e,{top:3}),Fl),Gl=(e,t,o)=>Sl((e=>e.x+e.width)(e),Nl(e,t),o.east(),Dl(),"east",Bl(e,{left:0}),Fl),ql=(e,t,o)=>Sl(((e,t)=>e.x-t.width)(e,t),Nl(e,t),o.west(),Ml(),"west",Bl(e,{right:1}),Fl),Yl=()=>[Pl,Hl,Ul,Wl,$l,jl,Gl,ql],Xl=()=>[Hl,Pl,Wl,Ul,$l,jl,Gl,ql],Kl=()=>[Ul,Wl,Pl,Hl,jl,$l],Jl=()=>[Wl,Ul,Hl,Pl,jl,$l],Ql=()=>[Pl,Hl,Ul,Wl,$l,jl],Zl=()=>[Hl,Pl,Wl,Ul,$l,jl],ec="data-alloy-placement",tc=e=>No(e,ec),oc="layout-inset",nc=e=>e.x,sc=(e,t)=>e.x+e.width/2-t.width/2,rc=(e,t)=>e.x+e.width-t.width,ac=e=>e.y,ic=(e,t)=>e.y+e.height-t.height,lc=(e,t)=>e.y+e.height/2-t.height/2,cc=(e,t,o)=>Sl(rc(e,t),ic(e,t),o.insetSouthwest(),Tl(),"southwest",Bl(e,{right:0,bottom:3}),oc),dc=(e,t,o)=>Sl(nc(e),ic(e,t),o.insetSoutheast(),_l(),"southeast",Bl(e,{left:1,bottom:3}),oc),uc=(e,t,o)=>Sl(rc(e,t),ac(e),o.insetNorthwest(),Ol(),"northwest",Bl(e,{right:0,top:2}),oc),mc=(e,t,o)=>Sl(nc(e),ac(e),o.insetNortheast(),kl(),"northeast",Bl(e,{left:1,top:2}),oc),gc=(e,t,o)=>Sl(sc(e,t),ac(e),o.insetNorth(),El(),"north",Bl(e,{top:2}),oc),pc=(e,t,o)=>Sl(sc(e,t),ic(e,t),o.insetSouth(),Al(),"south",Bl(e,{bottom:3}),oc),hc=(e,t,o)=>Sl(rc(e,t),lc(e,t),o.insetEast(),Ml(),"east",Bl(e,{right:0}),oc),fc=(e,t,o)=>Sl(nc(e),lc(e,t),o.insetWest(),Dl(),"west",Bl(e,{left:1}),oc),bc=e=>{switch(e){case"north":return gc;case"northeast":return mc;case"northwest":return uc;case"south":return pc;case"southeast":return dc;case"southwest":return cc;case"east":return hc;case"west":return fc}},vc=(e,t,o,n,s)=>tc(n).map(bc).getOr(gc)(e,t,o,n,s),xc=e=>{switch(e){case"north":return pc;case"northeast":return dc;case"northwest":return cc;case"south":return gc;case"southeast":return mc;case"southwest":return uc;case"east":return fc;case"west":return hc}},yc=(e,t,o,n,s)=>tc(n).map(xc).getOr(gc)(e,t,o,n,s),wc=(e,t)=>{((e,t)=>{const o=mn.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);en(e,"max-height",o+"px")})(e,Math.floor(t))},Sc=y((e,t)=>{wc(e,t),tn(e,{"overflow-x":"hidden","overflow-y":"auto"})}),Cc=y((e,t)=>{wc(e,t)}),kc=y((e,t)=>{((e,t)=>{const o=fn.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);en(e,"max-width",o+"px")})(e,Math.floor(t))});var Oc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Oc||(Oc={}));const _c="data-alloy-vertical-dir",Tc=e=>os(e,e=>Gt(e)&&Lo(e,"data-alloy-vertical-dir")===Oc.BottomToTop);var Ec;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Ec||(Ec={}));const Ac={init:()=>Dc({readState:y("No State required")})},Dc=e=>e,Mc={can:E,abort:T,run:b},Bc=e=>{if(!ve(e,"can")&&!ve(e,"abort")&&!ve(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Mc,...e}},Fc=(e,t)=>{Vc(e,e.element,t,{})},Ic=(e,t,o)=>{Vc(e,e.element,t,o)},Rc=e=>{Fc(e,Ra())},zc=(e,t,o)=>{Vc(e,t,o,{})},Vc=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Lc=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Nc=e=>oa(e),Pc=(e,t)=>({key:e,value:Bc({abort:t})}),Hc=e=>({key:e,value:Bc({run:(e,t)=>{t.event.prevent()}})}),Uc=(e,t)=>({key:e,value:Bc({run:t})}),Wc=(e,t,o)=>({key:e,value:Bc({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),jc=e=>t=>({key:e,value:Bc({run:(e,o)=>{Bs(e,o)&&t(e,o)}})}),$c=(e,t,o)=>((e,t)=>Uc(e,(o,n)=>{o.getSystem().getByUid(t).each(t=>{Lc(t,t.element,e,n)})}))(e,t.partUids[o]),Gc=(e,t)=>Uc(e,(e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk(()=>as(n.target,t=>e.getSystem().getByDom(t).toOptional(),T).getOr(e));t(e,s,o)}),qc=e=>Uc(e,(e,t)=>{t.cut()}),Yc=e=>Uc(e,(e,t)=>{t.stop()}),Xc=(e,t)=>jc(e)(t),Kc=jc(Ga()),Jc=jc(qa()),Qc=jc(Ha()),Zc=(e=>t=>Uc(e,t))(Ra()),ed=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),td=(e,t,o)=>Qc((n,s)=>{o(n,e,t)}),od=e=>({key:e,value:void 0}),nd=(e,t,o,n,s,r,a)=>{const i=e=>ve(e,o)?e[o]():A.none(),l=le(s,(e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Ci(a.slice(0,1).concat(a.slice(3)))}),e})((n,...s)=>{const r=[n].concat(s);return n.config({name:y(e)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)},e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))})},o,t))(o,e,t)),c={...le(r,(e,t)=>ki(e,t)),...l,revoke:C(od,o),config:t=>{const n=Sr(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:st(()=>Sr(o+"-config",e,t)),initialConfig:t,state:a}}},schema:y(t),exhibit:(e,t)=>Ue(i(e),fe(n,"exhibit"),(e,o)=>o(t,e.config,e.state)).getOrThunk(()=>ed({})),name:y(o),handlers:e=>i(e).map(e=>fe(n,"events").getOr(()=>({}))(e.config,e.state)).getOr({})};return c},sd=e=>oa(e),rd=ur([Ar("fields"),Ar("name"),Gr("active",{}),Gr("apis",{}),Gr("state",Ac),Gr("extra",{})]),ad=e=>{const t=Sr("Creating behaviour: "+e.name,rd,e);return((e,t,o,n,s,r)=>{const a=ur(e),i=$r(t,[(l=e,Nr("config",ur(l)))]);var l;return nd(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},id=ur([Ar("branchKey"),Ar("branches"),Ar("name"),Gr("active",{}),Gr("apis",{}),Gr("state",Ac),Gr("extra",{})]),ld=e=>{const t=Sr("Creating behaviour: "+e.name,id,e);return((e,t,o,n,s,r)=>{const a=e,i=$r(t,[Nr("config",e)]);return nd(a,i,t,o,n,s,r)})(kr(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},cd=y(void 0),dd=(e,t)=>{const o=((e,t)=>{const o=Nc(t);return ad({fields:[Ar("enabled")],name:e,active:{events:y(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:y({}),initialConfig:{},state:Ac}}},ud=(e,t)=>{t.ignore||(Oo(e.element),t.onFocus(e))};var md=Object.freeze({__proto__:null,blur:(e,t)=>{t.ignore||_o(e.element)},focus:ud,isFocused:e=>To(e.element)}),gd=Object.freeze({__proto__:null,events:e=>Nc([Uc(Ma(),(t,o)=>{ud(t,e),o.stop()})].concat(e.stopMousedown?[Uc(la(),(e,t)=>{t.event.prevent()})]:[])),exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return ed(o)}}),pd=[fi("onFocus"),Gr("stopMousedown",!1),Gr("ignore",!1)];const hd=ad({fields:pd,name:"focusing",active:gd,apis:md}),fd=[8],bd=[9],vd=[13],xd=[27],yd=[32],wd=[37],Sd=[38],Cd=[39],kd=[40],Od=y("tooltipping.close.all"),_d=y("dismiss.popups"),Td=y("reposition.popups"),Ed=y("mouse.released"),Ad=(e,t,o)=>{const n=X(e.slice(0,t)),s=X(e.slice(t+1));return j(n.concat(s),o)},Dd=(e,t,o)=>{const n=X(e.slice(0,t));return j(n,o)},Md=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return j(s.concat(n),o)},Bd=(e,t,o)=>{const n=e.slice(t+1);return j(n,o)},Fd=e=>t=>{const o=t.raw;return I(e,o.which)},Id=e=>t=>Y(e,e=>e(t)),Rd=e=>!0===e.raw.shiftKey,zd=e=>!0===e.raw.ctrlKey,Vd=k(Rd),Ld=(e,t)=>({matches:e,classification:t}),Nd=(e,t,o,n)=>{const s=ts(e.element,"."+t.highlightClass);N(s,o=>{R(n,e=>wt(e.element,o))||(qn(o,t.highlightClass),e.getSystem().getByDom(o).each(o=>{t.onDehighlight(e,o),Fc(o,oi())}))})},Pd=(e,t,o,n)=>{Nd(e,t,0,[n]),Hd(e,t,o,n)||($n(n.element,t.highlightClass),t.onHighlight(e,n),Fc(n,ti()))},Hd=(e,t,o,n)=>Yn(n.element,t.highlightClass),Ud=(e,t,o)=>Vn(e.element,"."+t.itemClass).bind(t=>e.getSystem().getByDom(t).toOptional()),Wd=(e,t,o)=>{const n=ts(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind(t=>e.getSystem().getByDom(t).toOptional())},jd=(e,t,o,n)=>{const s=ts(e.element,"."+t.itemClass);return $(s,e=>Yn(e,t.highlightClass)).bind(t=>{const o=Fe(t,n,0,s.length-1);return e.getSystem().getByDom(s[o]).toOptional()})},$d=(e,t,o)=>{const n=ts(e.element,"."+t.itemClass);return He(L(n,t=>e.getSystem().getByDom(t).toOptional()))};var Gd=Object.freeze({__proto__:null,dehighlight:(e,t,o,n)=>{Hd(e,t,o,n)&&(qn(n.element,t.highlightClass),t.onDehighlight(e,n),Fc(n,oi()))},dehighlightAll:(e,t,o)=>Nd(e,t,0,[]),getCandidates:$d,getFirst:Ud,getHighlighted:(e,t,o)=>Vn(e.element,"."+t.highlightClass).bind(t=>e.getSystem().getByDom(t).toOptional()),getLast:Wd,getNext:(e,t,o)=>jd(e,t,0,1),getPrevious:(e,t,o)=>jd(e,t,0,-1),highlight:Pd,highlightAt:(e,t,o,n)=>{((e,t,o,n)=>{const s=ts(e.element,"."+t.itemClass);return A.from(s[n]).fold(()=>Ae.error(new Error("No element found with index "+n)),e.getSystem().getByDom)})(e,t,0,n).fold(e=>{throw e},n=>{Pd(e,t,o,n)})},highlightBy:(e,t,o,n)=>{const s=$d(e,t);j(s,n).each(n=>{Pd(e,t,o,n)})},highlightFirst:(e,t,o)=>{Ud(e,t).each(n=>{Pd(e,t,o,n)})},highlightLast:(e,t,o)=>{Wd(e,t).each(n=>{Pd(e,t,o,n)})},isHighlighted:Hd}),qd=[Ar("highlightClass"),Ar("itemClass"),fi("onHighlight"),fi("onDehighlight")];const Yd=ad({fields:qd,name:"highlighting",apis:Gd}),Xd=(e,t,o)=>{t.exists(e=>o.exists(t=>wt(t,e)))||Ic(e,Ka(),{prevFocus:t,newFocus:o})},Kd=()=>{const e=e=>Ao(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const s=e(t);Xd(t,n,s)}}},Jd=()=>{const e=e=>Yd.getHighlighted(e).map(e=>e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(b,e=>{Yd.highlight(t,e)});const s=e(t);Xd(t,n,s)}}},Qd=(e,t,o,n,s)=>{const r=(e,t,o,n,s)=>{return(r=o(e,t,n,s),a=t.event,j(r,e=>e.matches(a)).map(e=>e.classification)).bind(o=>o(e,t,n,s));var r,a},a={schema:()=>e.concat([Gr("focusManager",Kd()),qr("focusInside","onFocus",vr(e=>I(["onFocus","onEnterOrSpace","onApi"],e)?Ae.value(e):Ae.error("Invalid value for focusInside"))),yi("handler",a),yi("state",t),yi("sendFocusIn",s)]),processKey:r,toEvents:(e,t)=>{const a=e.focusInside!==Ti.OnFocusMode?A.none():s(e).map(o=>Uc(Ma(),(n,s)=>{o(n,e,t),s.stop()})),i=[Uc(ha(),(n,a)=>{r(n,a,o,e,t).fold(()=>{((o,n)=>{const r=Fd(yd.concat(vd))(n.event);e.focusInside===Ti.OnEnterOrSpaceMode&&r&&Bs(o,n)&&s(e).each(s=>{s(o,e,t),n.stop()})})(n,a)},e=>{a.stop()})}),Uc(fa(),(o,s)=>{r(o,s,n,e,t).each(e=>{s.stop()})})];return Nc(a.toArray().concat(i))}};return a},Zd=e=>{const t=[Lr("onEscape"),Lr("onEnter"),Gr("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Gr("firstTabstop",0),Gr("useTabstopAt",E),Lr("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind(e=>Ln(t,e)).getOr(t);return gn(o)>0},n=(e,t)=>t.focusManager.get(e).bind(e=>Ln(e,t.selector)),s=(e,t,n)=>{((e,t)=>{const n=ts(e.element,t.selector),s=H(n,e=>o(t,e));return A.from(s[t.firstTabstop])})(e,t).each(o=>{t.focusManager.set(e,o)})},r=(e,t,s,r)=>{const a=H(ts(e.element,s.selector),e=>o(s,e));return n(e,s).bind(t=>$(a,C(wt,t)).bind(t=>((e,t,n,s,r)=>r(t,n,e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(s,e)).fold(()=>s.cyclic?A.some(!0):A.none(),t=>(s.focusManager.set(e,t),A.some(!0))))(e,a,t,s,r)))},a=(e,t,o)=>{const n=o.cyclic?Ad:Dd;return r(e,0,o,n)},i=(e,t,o)=>{const n=o.cyclic?Md:Bd;return r(e,0,o,n)},l=y([Ld(Id([Rd,Fd(bd)]),a),Ld(Fd(bd),i),Ld(Id([Vd,Fd(vd)]),(e,t,o)=>o.onEnter.bind(o=>o(e,t)))]),c=y([Ld(Fd(xd),(e,t,o)=>(e.getSystem().broadcastOn([Od()],{closedTooltip:()=>{t.stop()}}),t.isStopped()?A.none():o.onEscape.bind(o=>o(e,t)))),Ld(Fd(bd),(e,t,o)=>n(e,o).filter(e=>!o.useTabstopAt(e)).bind(n=>((e=>(e=>to(e))(e).bind(lo).exists(t=>wt(t,e)))(n)?a:i)(e,t,o)))]);return Qd(t,Ac.init,l,c,()=>A.some(s))};var eu=Zd(Tr("cyclic",T)),tu=Zd(Tr("cyclic",E));const ou=e=>Kt("input")(e)&&"radio"!==Lo(e,"type")||Kt("textarea")(e),nu=(e,t,o)=>ou(o)&&Fd(yd)(t.event)?A.none():((e,t,o)=>(zc(e,o,Ra()),A.some(!0)))(e,0,o),su=(e,t)=>A.some(!0),ru=[Gr("execute",nu),Gr("useSpace",!1),Gr("useEnter",!0),Gr("useControlEnter",!1),Gr("useDown",!1)],au=(e,t,o)=>o.execute(e,t,e.element);var iu=Qd(ru,Ac.init,(e,t,o,n)=>{const s=o.useSpace&&!ou(e.element)?yd:[],r=o.useEnter?vd:[],a=o.useDown?kd:[],i=s.concat(r).concat(a);return[Ld(Fd(i),au)].concat(o.useControlEnter?[Ld(Id([zd,Fd(vd)]),au)]:[])},(e,t,o,n)=>o.useSpace&&!ou(e.element)?[Ld(Fd(yd),su)]:[],()=>A.none());const lu=()=>{const e=Ye();return Dc({readState:()=>e.get().map(e=>({numRows:String(e.numRows),numColumns:String(e.numColumns)})).getOr({numRows:"?",numColumns:"?"}),setGridSize:(t,o)=>{e.set({numRows:t,numColumns:o})},getNumRows:()=>e.get().map(e=>e.numRows),getNumColumns:()=>e.get().map(e=>e.numColumns)})};var cu=Object.freeze({__proto__:null,flatgrid:lu,init:e=>e.state(e)});const du=e=>(t,o,n,s)=>{const r=e(t.element);return pu(r,t,o,n,s)},uu=(e,t)=>{const o=Tn(e,t);return du(o)},mu=(e,t)=>{const o=Tn(t,e);return du(o)},gu=e=>(t,o,n,s)=>pu(e,t,o,n,s),pu=(e,t,o,n,s)=>n.focusManager.get(t).bind(o=>e(t.element,o,n,s)).map(e=>(n.focusManager.set(t,e),!0)),hu=gu,fu=gu,bu=gu,vu=(e,t,o)=>{const n=ts(e,o);return(e=>$(e,e=>wt(e,t)).map(t=>({index:t,candidates:e})))(H(n,hn))},xu=(e,t)=>$(e,e=>wt(t,e)),yu=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind(t=>{const n=t.row*o+t.column;return n>=0&&n<e.length?A.some(e[n]):A.none()}),wu=(e,t,o,n,s)=>yu(e,t,n,(t,r)=>{const a=t===o-1?e.length-t*n:n,i=Fe(r,s,0,a-1);return A.some({row:t,column:i})}),Su=(e,t,o,n,s)=>yu(e,t,n,(t,r)=>{const a=Fe(t,s,0,o-1),i=a===o-1?e.length-a*n:n,l=Ie(r,0,i-1);return A.some({row:a,column:l})}),Cu=[Ar("selector"),Gr("execute",nu),bi("onEscape"),Gr("captureTab",!1),Si()],ku=(e,t,o)=>{Vn(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},Ou=e=>(t,o,n,s)=>vu(t,o,n.selector).bind(t=>e(t.candidates,t.index,s.getNumRows().getOr(n.initSize.numRows),s.getNumColumns().getOr(n.initSize.numColumns))),_u=(e,t,o)=>o.captureTab?A.some(!0):A.none(),Tu=Ou((e,t,o,n)=>wu(e,t,o,n,-1)),Eu=Ou((e,t,o,n)=>wu(e,t,o,n,1)),Au=Ou((e,t,o,n)=>Su(e,t,o,n,-1)),Du=Ou((e,t,o,n)=>Su(e,t,o,n,1)),Mu=y([Ld(Fd(wd),uu(Tu,Eu)),Ld(Fd(Cd),mu(Tu,Eu)),Ld(Fd(Sd),hu(Au)),Ld(Fd(kd),fu(Du)),Ld(Id([Rd,Fd(bd)]),_u),Ld(Id([Vd,Fd(bd)]),_u),Ld(Fd(yd.concat(vd)),(e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind(e=>Ln(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)))]),Bu=y([Ld(Fd(xd),(e,t,o)=>o.onEscape(e,t)),Ld(Fd(yd),su)]);var Fu=Qd(Cu,lu,Mu,Bu,()=>A.some(ku));const Iu=(e,t,o,n,s)=>{const r=(e,t,o)=>s(e,t,n,0,o.length-1,o[t],t=>{return n=o[t],"button"===Wt(n)&&"disabled"===Lo(n,"disabled")?r(e,t,o):A.from(o[t]);var n});return vu(e,o,t).bind(e=>{const t=e.index,o=e.candidates;return r(t,t,o)})},Ru=(e,t,o,n)=>Iu(e,t,o,n,(e,t,o,n,s,r,a)=>{const i=Ie(t+o,n,s);return i===e?A.from(r):a(i)}),zu=(e,t,o,n)=>Iu(e,t,o,n,(e,t,o,n,s,r,a)=>{const i=Fe(t,o,n,s);return i===e?A.none():a(i)}),Vu=[Ar("selector"),Gr("getInitial",A.none),Gr("execute",nu),bi("onEscape"),Gr("executeOnMove",!1),Gr("allowVertical",!0),Gr("allowHorizontal",!0),Gr("cycles",!0)],Lu=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind(e=>Ln(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)),Nu=(e,t,o)=>{t.getInitial(e).orThunk(()=>Vn(e.element,t.selector)).each(o=>{t.focusManager.set(e,o)})},Pu=(e,t,o)=>(o.cycles?zu:Ru)(e,o.selector,t,-1),Hu=(e,t,o)=>(o.cycles?zu:Ru)(e,o.selector,t,1),Uu=e=>(t,o,n,s)=>e(t,o,n,s).bind(()=>n.executeOnMove?Lu(t,o,n):A.some(!0)),Wu=y([Ld(Fd(yd),su),Ld(Fd(xd),(e,t,o)=>o.onEscape(e,t))]);var ju=Qd(Vu,Ac.init,(e,t,o,n)=>{const s=[...o.allowHorizontal?wd:[]].concat(o.allowVertical?Sd:[]),r=[...o.allowHorizontal?Cd:[]].concat(o.allowVertical?kd:[]);return[Ld(Fd(s),Uu(uu(Pu,Hu))),Ld(Fd(r),Uu(mu(Pu,Hu))),Ld(Fd(vd),Lu),Ld(Fd(yd),Lu)]},Wu,()=>A.some(Nu));const $u=(e,t,o)=>A.from(e[t]).bind(e=>A.from(e[o]).map(e=>({rowIndex:t,columnIndex:o,cell:e}))),Gu=(e,t,o,n)=>{const s=e[t].length,r=Fe(o,n,0,s-1);return $u(e,t,r)},qu=(e,t,o,n)=>{const s=Fe(o,n,0,e.length-1),r=e[s].length,a=Ie(t,0,r-1);return $u(e,s,a)},Yu=(e,t,o,n)=>{const s=e[t].length,r=Ie(o+n,0,s-1);return $u(e,t,r)},Xu=(e,t,o,n)=>{const s=Ie(o+n,0,e.length-1),r=e[s].length,a=Ie(t,0,r-1);return $u(e,s,a)},Ku=[Rr("selectors",[Ar("row"),Ar("cell")]),Gr("cycles",!0),Gr("previousSelector",A.none),Gr("execute",nu)],Ju=(e,t,o)=>{t.previousSelector(e).orThunk(()=>{const o=t.selectors;return Vn(e.element,o.cell)}).each(o=>{t.focusManager.set(e,o)})},Qu=(e,t)=>(o,n,s)=>{const r=s.cycles?e:t;return Ln(n,s.selectors.row).bind(e=>{const t=ts(e,s.selectors.cell);return xu(t,n).bind(t=>{const n=ts(o,s.selectors.row);return xu(n,e).bind(e=>{const o=((e,t)=>L(e,e=>ts(e,t.selectors.cell)))(n,s);return r(o,e,t).map(e=>e.cell)})})})},Zu=Qu((e,t,o)=>Gu(e,t,o,-1),(e,t,o)=>Yu(e,t,o,-1)),em=Qu((e,t,o)=>Gu(e,t,o,1),(e,t,o)=>Yu(e,t,o,1)),tm=Qu((e,t,o)=>qu(e,o,t,-1),(e,t,o)=>Xu(e,o,t,-1)),om=Qu((e,t,o)=>qu(e,o,t,1),(e,t,o)=>Xu(e,o,t,1)),nm=y([Ld(Fd(wd),uu(Zu,em)),Ld(Fd(Cd),mu(Zu,em)),Ld(Fd(Sd),hu(tm)),Ld(Fd(kd),fu(om)),Ld(Fd(yd.concat(vd)),(e,t,o)=>Ao(e.element).bind(n=>o.execute(e,t,n)))]),sm=y([Ld(Fd(yd),su)]);var rm=Qd(Ku,Ac.init,nm,sm,()=>A.some(Ju));const am=[Ar("selector"),Gr("execute",nu)],im=(e,t,o)=>o.focusManager.get(e).bind(n=>o.execute(e,t,n)),lm=(e,t,o)=>{Vn(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},cm=y([Ld(Fd(Sd),bu((e,t,o)=>zu(e,o.selector,t,-1))),Ld(Fd(kd),bu((e,t,o)=>zu(e,o.selector,t,1))),Ld(Fd(vd),im),Ld(Fd(yd),im)]),dm=y([Ld(Fd(yd),su)]);var um=Qd(am,Ac.init,cm,dm,()=>A.some(lm));const mm=[bi("onSpace"),bi("onEnter"),bi("onShiftEnter"),bi("onLeft"),bi("onRight"),bi("onTab"),bi("onShiftTab"),bi("onUp"),bi("onDown"),bi("onEscape"),Gr("stopSpaceKeyup",!1),Lr("focusIn")];var gm=Qd(mm,Ac.init,(e,t,o)=>[Ld(Fd(yd),o.onSpace),Ld(Id([Vd,Fd(vd)]),o.onEnter),Ld(Id([Rd,Fd(vd)]),o.onShiftEnter),Ld(Id([Rd,Fd(bd)]),o.onShiftTab),Ld(Id([Vd,Fd(bd)]),o.onTab),Ld(Fd(Sd),o.onUp),Ld(Fd(kd),o.onDown),Ld(Fd(wd),o.onLeft),Ld(Fd(Cd),o.onRight),Ld(Fd(yd),o.onSpace)],(e,t,o)=>[...o.stopSpaceKeyup?[Ld(Fd(yd),su)]:[],Ld(Fd(xd),o.onEscape)],e=>e.focusIn);const pm=eu.schema(),hm=tu.schema(),fm=ju.schema(),bm=Fu.schema(),vm=rm.schema(),xm=iu.schema(),ym=um.schema(),wm=gm.schema(),Sm=ld({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:pm,cyclic:hm,execution:xm,flatgrid:bm,flow:fm,matrix:vm,menu:ym,special:wm}),name:"keying",active:{events:(e,t)=>e.handler.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,s)=>{(e=>ve(e,"setGridSize"))(o)?o.setGridSize(n,s):console.error("Layout does not support setGridSize")}},state:cu}),Cm=ze("alloy-premade"),km=e=>(Object.defineProperty(e.element.dom,Cm,{value:e.uid,writable:!0}),ta(Cm,e)),Om=e=>fe(e,Cm),_m=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Ci(r.slice(1))}),e})((t,...o)=>e(t.getApis(),t,...o),e),Tm=e=>e.getSystem().isConnected(),Em=e=>{Fc(e,qa());const t=e.components();N(t,Em)},Am=e=>{const t=e.components();N(t,Am),Fc(e,Ga())},Dm=(e,t)=>{e.getSystem().addToWorld(t),Xo(e.element)&&Am(t)},Mm=e=>{Em(e),e.getSystem().removeFromWorld(e)},Bm=(e,t)=>{Fo(e.element,t.element)},Fm=(e,t)=>{Im(e,t,Fo)},Im=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),Xo(e.element)&&Am(t),e.syncComponents()},Rm=e=>{Em(e),Wo(e.element),e.getSystem().removeFromWorld(e)},zm=e=>{const t=to(e.element).bind(t=>e.getSystem().getByDom(t).toOptional());Rm(e),t.each(e=>{e.syncComponents()})},Vm=e=>{const t=e.components();N(t,Rm),Uo(e.element),e.syncComponents()},Lm=(e,t)=>{Pm(e,t,Fo)},Nm=(e,t)=>{Pm(e,t,Mo)},Pm=(e,t,o)=>{o(e,t.element);const n=ao(t.element);N(n,e=>{t.getByDom(e).each(Am)})},Hm=e=>{const t=ao(e.element);N(t,t=>{e.getByDom(t).each(Em)}),Wo(e.element)},Um=(e,t,o)=>{o.fold(()=>Fo(e,t),e=>{wt(e,t)||(Do(e,t),Wo(e))})},Wm=(e,t,o)=>{const n=L(t,o),s=ao(e);return N(s.slice(n.length),Wo),n},jm=(e,t,o,n)=>{const s=io(e,t),r=n(o,s),a=((e,t,o)=>io(e,t).map(e=>{if(o.exists(t=>!wt(t,e))){const t=o.map(Wt).getOr("span"),n=it(t);return Do(e,n),n}return e}))(e,t,s);return Um(e,r.element,a),r},$m=(e,t)=>{const o=go(t),n=Eo(o).bind(e=>{const o=t=>wt(e,t);return o(t)?A.some(t):((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const s=ct(e.childNodes[n]);if(t(s))return A.some(s);const r=o(e.childNodes[n]);if(r.isSome())return r}return A.none()};return o(e.dom)})(t,o)}),s=e(t);return n.each(e=>{Eo(o).filter(t=>wt(t,e)).fold(()=>{Oo(e)},b)}),s},Gm=(e,t)=>{$m(()=>{((e,t,o)=>{const n=e.components();(e=>{N(e.components(),e=>Wo(e.element)),Uo(e.element),e.syncComponents()})(e);const s=o(t),r=K(n,s);N(r,t=>{Em(t),e.getSystem().removeFromWorld(t)}),N(s,t=>{Tm(t)?Bm(e,t):(e.getSystem().addToWorld(t),Bm(e,t),Xo(e.element)&&Am(t))}),e.syncComponents()})(e,t,()=>L(t,e.getSystem().build))},e.element)},qm=(e,t)=>{$m(()=>{((o,n)=>{const s=o.components(),r=q(n,e=>Om(e).toArray());N(s,e=>{I(r,e)||Mm(e)});const a=((e,t,o)=>Wm(e,t,(t,n)=>jm(e,n,t,o)))(e.element,t,e.getSystem().buildOrPatch),i=K(s,a);N(i,e=>{Tm(e)&&Mm(e)}),N(a,e=>{Tm(e)||Dm(o,e)}),o.syncComponents()})(e,t)},e.element)},Ym=(e,t,o,n)=>{Mm(t);const s=jm(e.element,o,n,e.getSystem().buildOrPatch);Dm(e,s),e.syncComponents()},Xm=(e,t,o)=>{const n=e.getSystem().build(o);Im(e,n,t)},Km=(e,t,o,n)=>{zm(t),Xm(e,(e,t)=>((e,t,o)=>{io(e,o).fold(()=>{Fo(e,t)},e=>{Do(e,t)})})(e,t,o),n)},Jm=(e,t)=>e.components(),Qm=(e,t,o,n,s)=>{const r=Jm(e);return A.from(r[n]).map(o=>(s.fold(()=>zm(o),s=>{(t.reuseDom?Ym:Km)(e,o,n,s)}),o))};var Zm=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Xm(e,Fo,n)},contents:Jm,prepend:(e,t,o,n)=>{Xm(e,Bo,n)},remove:(e,t,o,n)=>{const s=Jm(e),r=j(s,e=>wt(n.element,e.element));r.each(zm)},replaceAt:Qm,replaceBy:(e,t,o,n,s)=>{const r=Jm(e);return $(r,n).bind(o=>Qm(e,t,0,o,s))},set:(e,t,o,n)=>(t.reuseDom?qm:Gm)(e,n)});const eg=ad({fields:[Jr("reuseDom",!0)],name:"replacing",apis:Zm}),tg=Nc([(e=>({key:e,value:Bc({can:(e,t)=>{const o=t.event,n=o.originator,s=o.target;return!((e,t,o)=>wt(t,e.element)&&!wt(t,o))(e,n,s)||(console.warn(Ma()+" did not get interpreted by the desired target. \nOriginator: "+ni(n)+"\nTarget: "+ni(s)+"\nCheck the "+Ma()+" event handlers"),!1)}})}))(Ma())]);var og=Object.freeze({__proto__:null,events:tg});const ng=y("alloy-id-"),sg=y("data-alloy-id"),rg=ng(),ag=sg(),ig=(e,t)=>{Object.defineProperty(e.dom,ag,{value:t,writable:!0})},lg=e=>{const t=Gt(e)?e.dom[ag]:null;return A.from(t)},cg=e=>ze(e),dg=w,ug=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ni(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:y("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:T}},mg=ug(),gg=(e,t)=>{const o={};return ie(e,(e,n)=>{ie(e,(e,s)=>{const r=fe(o,s).getOr([]);o[s]=r.concat([t(n,e)])})}),o},pg=e=>e.cHandler,hg=(e,t)=>({name:e,handler:t}),fg=(e,t)=>{const o={};return N(e,e=>{o[e.name()]=e.handlers(t)}),o},bg=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const s=Z(o,(o,s)=>{const r=o[t],a=s[t],i=n.indexOf(r),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+r+".\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<l?-1:l<i?1:0});return Ae.value(s)}catch(e){return Ae.error([e])}})("Event: "+o,"name",e,n).map(e=>(e=>{const t=(e=>(...t)=>W(e,(e,o)=>e&&(e=>e.can)(o).apply(void 0,t),!0))(e),o=(e=>(...t)=>W(e,(e,o)=>e||(e=>e.abort)(o).apply(void 0,t),!1))(e);return{can:t,abort:o,run:(...t)=>{N(e,e=>{e.run.apply(void 0,t)})}}})(L(e,e=>e.handler))):((e,t)=>Ae.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(L(t,e=>e.name),null,2)]))(o,e)},vg=(e,t)=>((e,t)=>{const o=(e=>{const t=[],o=[];return N(e,e=>{e.fold(e=>{t.push(e)},e=>{o.push(e)})}),{errors:t,values:o}})(e);return o.errors.length>0?(n=o.errors,Ae.error(G(n))):((e,t)=>0===e.length?Ae.value(t):Ae.value(Le(t,Ne.apply(void 0,e))))(o.values,t);var n})(ge(e,(e,o)=>(1===e.length?Ae.value(e[0].handler):bg(e,t,o)).map(n=>{const s=(e=>{const t=(e=>p(e)?{can:E,abort:T,run:e}:e)(e);return(e,o,...n)=>{const s=[e,o].concat(n);t.abort.apply(void 0,s)?o.stop():t.can.apply(void 0,s)&&t.run.apply(void 0,s)}})(n),r=e.length>1?H(t[o],t=>R(e,e=>e.name===t)).join(" > "):e[0].name;return ta(o,((e,t)=>({handler:e,purpose:t}))(s,r))})),{}),xg="alloy.base.behaviour",yg=mr([_r("dom","dom",{tag:"required",process:{}},mr([Ar("tag"),Gr("styles",{}),Gr("classes",[]),Gr("attributes",{}),Lr("value"),Lr("innerHtml")])),Ar("components"),Ar("uid"),Gr("events",{}),Gr("apis",{}),_r("eventOrder","eventOrder",(Bg={[Ra()]:["disabling",xg,"toggling","typeaheadevents"],[Ma()]:[xg,"focusing","keying"],[Ha()]:[xg,"disabling","toggling","representing","tooltipping"],[ba()]:[xg,"representing","streaming","invalidating"],[qa()]:[xg,"representing","item-events","toolbar-button-events","tooltipping"],[la()]:["focusing",xg,"item-type-events"],[sa()]:["focusing",xg,"item-type-events"],[ma()]:["item-type-events","tooltipping"],[Ia()]:["receiving","reflecting","tooltipping"]},nr(y(Bg))),qs()),Lr("domModification")]),wg=e=>e.events,Sg=(e,t)=>{const o=re(e),n=re(t),s=K(n,o),r=(e=>{const o={},n={};return ue(e,(e,o)=>!be(t,o)||e!==t[o],de(o),de(n)),{t:o,f:n}})(e).t;return{toRemove:s,toSet:r}},Cg=(e,t)=>{const o=t.filter(t=>Wt(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>be(e.dom,Cm))(t)).bind(t=>((e,t)=>{try{const o=((e,t)=>{const{class:o,style:n,...s}=(e=>W(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}))(t),{toSet:r,toRemove:a}=Sg(e.attributes,s),i=an(t),{toSet:l,toRemove:c}=Sg(e.styles,i),d=Jn(t),u=K(d,e.classes),m=K(e.classes,d);return N(a,e=>Ho(t,e)),Vo(t,r),Xn(t,m),Kn(t,u),N(c,e=>cn(t,e)),tn(t,l),e.innerHtml.fold(()=>{const o=e.domChildren;((e,t)=>{Wm(e,t,(t,o)=>{const n=io(e,o);return Um(e,t,n),t})})(t,o)},e=>{Go(t,e)}),(()=>{const o=t,n=e.value.getOrUndefined();n!==Qn(o)&&Zn(o,n??"")})(),t})(e,t);return A.some(o)}catch{return A.none()}})(e,t)).getOrThunk(()=>(e=>{const t=it(e.tag);Vo(t,e.attributes),Xn(t,e.classes),tn(t,e.styles),e.innerHtml.each(e=>Go(t,e));const o=e.domChildren;return Io(t,o),e.value.each(e=>{Zn(t,e)}),t})(e));return ig(o,e.uid),o},kg=e=>{const t=(e=>{const t=fe(e,"behaviours").getOr({});return q(re(t),e=>{const o=t[e];return g(o)?[o.me]:[]})})(e);return((e,t)=>((e,t)=>{const o=L(t,e=>$r(e.name(),[Ar("config"),Gr("state",Ac)])),n=yr("component.behaviours",mr(o),e.behaviours).fold(t=>{throw new Error(Cr(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))},w);return{list:t,data:le(n,e=>{const t=e.map(e=>({config:e.config,state:e.state.init(e.config)}));return y(t)})}})(e,t))(e,t)},Og=(e,t)=>{const o=()=>m,n=ye(mg),s=wr((e=>yr("custom.definition",yg,e))(e)),r=kg(e),a=(e=>e.list)(r),i=(e=>e.data)(r),l=((e,t,o)=>{const n={...(s=e).dom,uid:s.uid,domChildren:L(s.components,e=>e.element)};var s;const r=(e=>e.domModification.fold(()=>ed({}),ed))(e),a={"alloy.base.modification":r},i=t.length>0?((e,t,o,n)=>{const s={...t};N(o,t=>{s[t.name()]=t.exhibit(e,n)});const r=gg(s,(e,t)=>({name:e,modification:t})),a=e=>U(e,(e,t)=>({...t.modification,...e}),{}),i=U(r.classes,(e,t)=>t.modification.concat(e),[]),l=a(r.attributes),c=a(r.styles);return ed({classes:i,attributes:l,styles:c})})(o,a,t,n):r;return l=n,c=i,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(s,a,i),c=Cg(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":wg(e)};return((e,t,o,n)=>{const s=((e,t,o)=>{const n={...o,...fg(t,e)};return gg(n,hg)})(e,o,n);return vg(s,t)})(o,e.eventOrder,t,n).getOrDie()})(s,a,i),u=ye(s.components),m={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(i[e.name()]),spec:e,readState:e=>i[e]().map(e=>e.state.readState()).getOr("not enabled"),getApis:()=>s.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(ug(o))},element:c,syncComponents:()=>{const e=ao(c),t=q(e,e=>n.get().getByDom(e).fold(()=>[],Q));u.set(t)},components:u.get,events:d};return m},_g=e=>{const t=lt(e);return Tg({element:t})},Tg=e=>{const t=Sr("external.component",ur([Ar("element"),Lr("uid")]),e),o=ye(ug()),n=t.uid.getOrThunk(()=>cg("external"));ig(t.element,n);const s={uid:n,getSystem:o.get,config:A.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(ug(()=>s))},getApis:()=>({}),element:t.element,spec:e,readState:y("No state"),syncComponents:b,components:y([]),events:{}};return km(s)},Eg=cg,Ag=(e,t)=>Om(e).getOrThunk(()=>((e,t)=>{const{events:o,...n}=dg(e),s=((e,t)=>{const o=fe(e,"components").getOr([]);return t.fold(()=>L(o,Dg),e=>L(o,(t,o)=>Ag(t,io(e,o))))})(n,t),r={...n,events:{...og,...o},components:s};return Ae.value(Og(r,t))})((e=>be(e,"uid"))(e)?e:{uid:Eg(""),...e},t).getOrDie()),Dg=e=>Ag(e,A.none()),Mg=km;var Bg,Fg=Object.freeze({__proto__:null,block:(e,t,o,n)=>{zo(e.element,"aria-busy",!0);const s=t.getRoot(e).getOr(e),r=sd([Sm.config({mode:"special",onTab:()=>A.some(!0),onShiftTab:()=>A.some(!0)}),hd.config({})]),a=n(s,r),i=s.getSystem().build(a);eg.append(s,Mg(i)),i.hasConfigured(Sm)&&t.focus&&Sm.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith(()=>eg.remove(s,i))},isBlocked:(e,t,o)=>o.isBlocked(),unblock:(e,t,o)=>{Ho(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()}}),Ig=[Qr("getRoot",A.none),Jr("focus",!0),fi("onBlock"),fi("onUnblock")];const Rg=ad({fields:Ig,name:"blocking",apis:Fg,state:Object.freeze({__proto__:null,init:()=>{const e=Ge(e=>e.destroy());return Dc({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})});var zg=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const Vg=[Ar("find")],Lg=ad({fields:Vg,name:"composing",apis:zg});var Ng=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),Pg=[Dr("others",xr(Ae.value,qs()))],Hg=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===re(t.others).length)throw new Error("Cannot find any known coupled components");return fe(e,o)},o=y({});return Dc({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk(()=>(fe(o.others,n).getOrDie("No information found for coupled component: "+n),A.none())),getOrCreate:(o,n,s)=>t(n,s).getOrThunk(()=>{const t=fe(n.others,s).getOrDie("No information found for coupled component: "+s)(o),r=o.getSystem().build(t);return e[s]=r,r})})}});const Ug=ad({fields:Pg,name:"coupling",apis:Ng,state:Hg}),Wg=["input","button","textarea","select"],jg=(e,t,o)=>{(t.disabled()?Kg:Jg)(e,t)},$g=(e,t)=>!0===t.useNative&&I(Wg,Wt(e.element)),Gg=e=>{zo(e.element,"disabled","disabled")},qg=e=>{Ho(e.element,"disabled")},Yg=e=>{zo(e.element,"aria-disabled","true")},Xg=e=>{zo(e.element,"aria-disabled","false")},Kg=(e,t,o)=>{t.disableClass.each(t=>{$n(e.element,t)}),($g(e,t)?Gg:Yg)(e),t.onDisabled(e)},Jg=(e,t,o)=>{t.disableClass.each(t=>{qn(e.element,t)}),($g(e,t)?qg:Xg)(e),t.onEnabled(e)},Qg=(e,t)=>$g(e,t)?(e=>Po(e.element,"disabled"))(e):(e=>"true"===Lo(e.element,"aria-disabled"))(e);var Zg=Object.freeze({__proto__:null,disable:Kg,enable:Jg,isDisabled:Qg,onLoad:jg,set:(e,t,o,n)=>{(n?Kg:Jg)(e,t)}}),ep=Object.freeze({__proto__:null,events:(e,t)=>Nc([Pc(Ra(),(t,o)=>Qg(t,e)),td(e,t,jg)]),exhibit:(e,t)=>ed({classes:t.disabled()?t.disableClass.toArray():[]})}),tp=[Qr("disabled",T),Gr("useNative",!0),Lr("disableClass"),fi("onDisabled"),fi("onEnabled")];const op=ad({fields:tp,name:"disabling",active:ep,apis:Zg}),np=(e,t,o,n,s)=>{const r=e=>e+"px";return{position:e,left:t.map(r),top:o.map(r),right:n.map(r),bottom:s.map(r)}},sp=(e,t)=>{on(e,(e=>({...e,position:A.some(e.position)}))(t))},rp=(e,t)=>{const o=e.element;$n(o,t.transitionClass),qn(o,t.fadeOutClass),$n(o,t.fadeInClass),t.onShow(e)},ap=(e,t)=>{const o=e.element;$n(o,t.transitionClass),qn(o,t.fadeInClass),$n(o,t.fadeOutClass),t.onHide(e)},ip=(e,t)=>e.y>=t.y,lp=(e,t)=>e.bottom<=t.bottom,cp=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),dp=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),up=e=>e.box.x-e.win.x,mp=(e,t,o)=>o.getInitialPos().map(o=>{const n=((e,t)=>{const o=t.optScrollEnv.fold(y(e.bounds.y),t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop));return yn(e.bounds.x,o)})(o,t);return{box:Ts(n.left,n.top,bn(e),gn(e)),location:o.location}}),gp=(e,t,o,n,s)=>{const r=((e,t)=>{const o=t.optScrollEnv.fold(y(e.y),t=>e.y+t.currentScrollTop-t.scrollElmTop);return yn(e.x,o)})(t,o),a=Ts(r.left,r.top,t.width,t.height);n.setInitialPos({style:an(e),position:nn(e,"position")||"static",bounds:a,location:s.location})},pp=(e,t,o)=>o.getInitialPos().bind(n=>{switch(o.clearInitialPos(),n.position){case"static":return A.some({morph:"static"});case"absolute":const o=Fs(e).getOr(Ko()),s=Es(o),r=o.dom.scrollTop??0;return A.some({morph:"absolute",positionCss:np("absolute",fe(n.style,"left").map(e=>t.x-s.x),fe(n.style,"top").map(e=>t.y-s.y+r),fe(n.style,"right").map(e=>s.right-t.right),fe(n.style,"bottom").map(e=>s.bottom-t.bottom))});default:return A.none()}}),hp=e=>{switch(e.location){case"top":return A.some({morph:"fixed",positionCss:np("fixed",A.some(e.leftX),A.some(e.topY),A.none(),A.none())});case"bottom":return A.some({morph:"fixed",positionCss:np("fixed",A.some(e.leftX),A.none(),A.none(),A.some(e.bottomY))});default:return A.none()}},fp=(e,t,o)=>{const n=e.element;return Pe(rn(n,"position"),"fixed")?((e,t,o)=>((e,t,o)=>mp(e,t,o).filter(({box:e})=>((e,t,o)=>Y(e,e=>{switch(e){case"bottom":return lp(t,o.bounds);case"top":return ip(t,o.bounds)}}))(o.getModes(),e,t)).bind(({box:t})=>pp(e,t,o)))(e,t,o).orThunk(()=>t.optScrollEnv.bind(n=>mp(e,t,o)).bind(({box:e,location:o})=>{const n=Ms(),s=up({win:n,box:e}),r="top"===o?cp(n,s,t):dp(n,s,t);return hp(r)})))(n,t,o):((e,t,o)=>{const n=Es(e),s=Ms(),r=((e,t,o)=>{const n=t.win,s=t.box,r=up(t);return se(e,e=>{switch(e){case"bottom":return lp(s,o.bounds)?A.none():A.some(dp(n,r,o));case"top":return ip(s,o.bounds)?A.none():A.some(cp(n,r,o));default:return A.none()}}).getOr({location:"no-dock"})})(o.getModes(),{win:s,box:n},t);return"top"===r.location||"bottom"===r.location?(gp(e,n,t,o,r),hp(r)):A.none()})(n,t,o)},bp=(e,t,o)=>{o.setDocked(!1),N(["left","right","top","bottom","position"],t=>cn(e.element,t)),t.onUndocked(e)},vp=(e,t,o,n)=>{const s="fixed"===n.position;o.setDocked(s),sp(e.element,n),(s?t.onDocked:t.onUndocked)(e)},xp=(e,t,o,n,s=!1)=>{t.contextual.each(t=>{t.lazyContext(e).each(r=>{const a=((e,t)=>e.y<t.bottom&&e.bottom>t.y)(r,n.bounds);a!==o.isVisible()&&(o.setVisible(a),s&&!a?(Xn(e.element,[t.fadeOutClass]),t.onHide(e)):(a?rp:ap)(e,t))})})},yp=(e,t,o,n,s)=>{xp(e,t,o,n,!0),vp(e,t,o,s.positionCss)},wp=(e,t,o)=>{e.getSystem().isConnected()&&((e,t,o)=>{const n=t.lazyViewport(e);xp(e,t,o,n),fp(e,n,o).each(s=>{((e,t,o,n,s)=>{switch(s.morph){case"static":return bp(e,t,o);case"absolute":return vp(e,t,o,s.positionCss);case"fixed":yp(e,t,o,n,s)}})(e,t,o,n,s)})})(e,t,o)},Sp=(e,t,o)=>{o.isDocked()&&((e,t,o)=>{const n=e.element;o.setDocked(!1);const s=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return mp(n,t,o).bind(({box:e})=>pp(n,e,o))})(e,s,o).each(n=>{switch(n.morph){case"static":bp(e,t,o);break;case"absolute":vp(e,t,o,n.positionCss)}}),o.setVisible(!0),t.contextual.each(t=>{Kn(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)}),wp(e,t,o)})(e,t,o)},Cp=e=>(t,o,n)=>{const s=o.lazyViewport(t);((e,t,o,n)=>{const s=Es(e),r=Ms(),a=n(r,up({win:r,box:s}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,s)=>{n.getInitialPos().fold(()=>gp(e,t,o,n,s),()=>b)})(e,s,t,o,a),hp(a)):A.none()})(t.element,s,n,e).each(e=>{yp(t,o,n,s,e)})},kp=Cp(cp),Op=Cp(dp);var _p=Object.freeze({__proto__:null,forceDockToBottom:Op,forceDockToTop:kp,getModes:(e,t,o)=>o.getModes(),isDocked:(e,t,o)=>o.isDocked(),refresh:wp,reset:Sp,setModes:(e,t,o,n)=>o.setModes(n)}),Tp=Object.freeze({__proto__:null,events:(e,t)=>Nc([Xc(Sa(),(o,n)=>{e.contextual.each(e=>{Yn(o.element,e.transitionClass)&&(Kn(o.element,[e.transitionClass,e.fadeInClass]),(t.isVisible()?e.onShown:e.onHidden)(o)),n.stop()})}),Uc(ja(),(o,n)=>{wp(o,e,t)}),Uc(Qa(),(o,n)=>{wp(o,e,t)}),Uc($a(),(o,n)=>{Sp(o,e,t)})])}),Ep=[$r("contextual",[Br("fadeInClass"),Br("fadeOutClass"),Br("transitionClass"),Ir("lazyContext"),fi("onShow"),fi("onShown"),fi("onHide"),fi("onHidden")]),Qr("lazyViewport",()=>({bounds:Ms(),optScrollEnv:A.none()})),Zr("modes",["top","bottom"],Ks),fi("onDocked"),fi("onUndocked")];const Ap=ad({fields:Ep,name:"docking",active:Tp,apis:_p,state:Object.freeze({__proto__:null,init:e=>{const t=ye(!1),o=ye(!0),n=Ye(),s=ye(e.modes);return Dc({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:s.get,setModes:s.set,readState:()=>`docked:  ${t.get()}, visible: ${o.get()}, modes: ${s.get().join(",")}`})}})}),Dp=xe([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),Mp=e=>t=>t.translate(-e.left,-e.top),Bp=e=>t=>t.translate(e.left,e.top),Fp=e=>(t,o)=>W(e,(e,t)=>t(e),yn(t,o)),Ip=(e,t,o)=>e.fold(Fp([Bp(o),Mp(t)]),Fp([Mp(t)]),Fp([])),Rp=(e,t,o)=>e.fold(Fp([Bp(o)]),Fp([]),Fp([Bp(t)])),zp=(e,t,o)=>e.fold(Fp([]),Fp([Mp(o)]),Fp([Bp(t),Mp(o)])),Vp=(e,t,o)=>{const n=e.fold((e,t)=>({position:A.some("absolute"),left:A.some(e+"px"),top:A.some(t+"px")}),(e,t)=>({position:A.some("absolute"),left:A.some(e-o.left+"px"),top:A.some(t-o.top+"px")}),(e,t)=>({position:A.some("fixed"),left:A.some(e+"px"),top:A.some(t+"px")}));return{right:A.none(),bottom:A.none(),...n}},Lp=(e,t,o,n)=>{const s=(e,s)=>(r,a)=>{const i=e(t,o,n);return s(r.getOr(i.left),a.getOr(i.top))};return e.fold(s(zp,Np),s(Rp,Pp),s(Ip,Hp))},Np=Dp.offset,Pp=Dp.absolute,Hp=Dp.fixed,Up=(e,t)=>{const o=Lo(e,t);return u(o)?NaN:parseInt(o,10)},Wp=(e,t,o,n,s,r)=>{const a=((e,t,o,n)=>((e,t)=>{const o=e.element,n=Up(o,t.leftAttr),s=Up(o,t.topAttr);return isNaN(n)||isNaN(s)?A.none():A.some(yn(n,s))})(e,t).fold(()=>o,e=>Hp(e.left+n.left,e.top+n.top)))(e,t,o,n),i=t.mustSnap?$p(e,t,a,s,r):Gp(e,t,a,s,r),l=Ip(a,s,r);return((e,t,o)=>{const n=e.element;zo(n,t.leftAttr,o.left+"px"),zo(n,t.topAttr,o.top+"px")})(e,t,l),i.fold(()=>({coord:Hp(l.left,l.top),extra:A.none()}),e=>({coord:e.output,extra:e.extra}))},jp=(e,t,o,n)=>se(e,e=>{const s=e.sensor,r=((e,t,o,n,s,r)=>{const a=Rp(e,s,r),i=Rp(t,s,r);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,s,e.range.left,e.range.top,o,n);return r?A.some({output:Lp(e.output,t,o,n),extra:e.extra}):A.none()}),$p=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return jp(r,o,n,s).orThunk(()=>{const e=W(r,(e,t)=>{const r=t.sensor,a=((e,t,o,n,s,r)=>{const a=Rp(e,s,r),i=Rp(t,s,r),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return yn(l,c)})(o,r,t.range.left,t.range.top,n,s);return e.deltas.fold(()=>({deltas:A.some(a),snap:A.some(t)}),o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:A.some(a),snap:A.some(t)}:e)},{deltas:A.none(),snap:A.none()});return e.snap.map(e=>({output:Lp(e.output,o,n,s),extra:e.extra}))})},Gp=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return jp(r,o,n,s)};var qp=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const t=Jt(e.element),o=kn(t),r=Is(s),a=((e,t,o)=>({coord:Lp(e.output,e.output,t,o),extra:e.extra}))(n,o,r),i=Vp(a.coord,0,r);on(s,i)}}});const Yp=(e,t)=>ea(e,{},L(t,t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,_r(o,o,{tag:"option",process:{}},$s(e=>Hs("The field: "+o+" is forbidden. "+n)));var o,n}).concat([Tr("dump",w)])),Xp=e=>e.dump,Kp=(e,t)=>({...sd(t),...e.dump}),Jp=Yp,Qp=Kp,Zp=(e,t,o,n,s)=>{const r=((e,t)=>(e.length>0?[Rr("parts",e)]:[]).concat([Ar("uid"),Gr("dom",{}),Gr("components",[]),wi("originalSpec"),Gr("debug.sketcher",{})]).concat(t))(n,s);return Sr(e+" [SpecSchema]",ur(r.concat(t)),o)},eh=(e,t,o,n,s)=>{const r=th(s),a=al(o),i=bl(o),l=Zp(e,t,r,a,[i]),c=ll(0,l,o);return n(l,cl(e,l,c.internals()),r,c.externals())},th=e=>(e=>be(e,"uid"))(e)?e:{...e,uid:cg("uid")},oh=ur([Ar("name"),Ar("factory"),Ar("configFields"),Gr("apis",{}),Gr("extraApis",{})]),nh=ur([Ar("name"),Ar("factory"),Ar("configFields"),Ar("partFields"),Gr("apis",{}),Gr("extraApis",{})]),sh=e=>{const t=Sr("Sketcher for "+e.name,oh,e),o=le(t.apis,_m),n=le(t.extraApis,(e,t)=>ki(e,t));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const s=th(n);return o(Zp(e,t,s,[],[]),s)})(t.name,t.configFields,t.factory,e),...o,...n}},rh=e=>{const t=Sr("Sketcher for "+e.name,nh,e),o=nl(t.name,t.partFields),n=le(t.apis,_m),s=le(t.extraApis,(e,t)=>ki(e,t));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>eh(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...s}},ah=sh({name:"Container",factory:e=>{const{attributes:t,...o}=e.dom;return{uid:e.uid,dom:{tag:"div",attributes:{role:"presentation",...t},...o},components:e.components,behaviours:Xp(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Gr("components",[]),Yp("containerBehaviours",[]),Gr("events",{}),Gr("domModification",{}),Gr("eventOrder",{})]}),ih="data-initial-z-index",lh=(e,t)=>{e.getSystem().addToGui(t),(e=>{to(e.element).filter(Gt).each(t=>{rn(t,"z-index").each(e=>{zo(t,ih,e)}),en(t,"z-index",nn(e.element,"z-index"))})})(t)},ch=e=>{(e=>{to(e.element).filter(Gt).each(e=>{No(e,ih).fold(()=>cn(e,"z-index"),t=>en(e,"z-index",t)),Ho(e,ih)})})(e),e.getSystem().removeFromGui(e)},dh=(e,t,o)=>e.getSystem().build(ah.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var uh=$r("snaps",[Ar("getSnapPoints"),fi("onSensor"),Ar("leftAttr"),Ar("topAttr"),Gr("lazyViewport",Ms),Gr("mustSnap",!1)]);const mh=[Gr("useFixed",T),Gr("getTarget",w),Gr("onDragStart",b),Gr("onDrag",b),Gr("repositionTarget",!0),Gr("onDrop",b),Qr("getBounds",Ms),uh],gh=e=>{return(t=rn(e,"left"),o=rn(e,"top"),n=rn(e,"position"),t.isSome()&&o.isSome()&&n.isSome()?A.some(((e,t,o)=>("fixed"===o?Hp:Np)(parseInt(e,10),parseInt(t,10)))(t.getOrDie(),o.getOrDie(),n.getOrDie())):A.none()).getOrThunk(()=>{const t=Sn(e);return Pp(t.left,t.top)});var t,o,n},ph=(e,t)=>({bounds:e.getBounds(),height:pn(t.element),width:vn(t.element)}),hh=(e,t,o,n,s)=>{const r=o.update(n,s),a=o.getStartData().getOrThunk(()=>ph(t,e));r.each(o=>{((e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const r=Jt(e.element),a=kn(r),i=Is(s),l=gh(s),c=((e,t,o,n,s,r,a)=>((e,t,o,n,s)=>{const r=s.bounds,a=Rp(t,o,n),i=Ie(a.left,r.x,r.x+r.width-s.width),l=Ie(a.top,r.y,r.y+r.height-s.height),c=Pp(i,l);return t.fold(()=>{const e=zp(c,o,n);return Np(e.left,e.top)},y(c),()=>{const e=Ip(c,o,n);return Hp(e.left,e.top)})})(0,t.fold(()=>{const e=(t=o,a=r.left,i=r.top,t.fold((e,t)=>Np(e+a,t+i),(e,t)=>Pp(e+a,t+i),(e,t)=>Hp(e+a,t+i)));var t,a,i;const l=Ip(e,n,s);return Hp(l.left,l.top)},t=>{const a=Wp(e,t,o,r,n,s);return a.extra.each(o=>{t.onSensor(e,o)}),a.coord}),n,s,a))(e,t.snaps,l,a,i,n,o),d=Vp(c,0,i);on(s,d)}t.onDrag(e,s,n)})(e,t,a,o)})},fh=(e,t,o,n)=>{t.each(ch),o.snaps.each(t=>{((e,t)=>{((e,t)=>{const o=e.element;Ho(o,t.leftAttr),Ho(o,t.topAttr)})(e,t)})(e,t)});const s=o.getTarget(e.element);n.reset(),o.onDrop(e,s)},bh=e=>(t,o)=>{const n=e=>{const n=o.getStartData().isSome();if(o.setStartData(ph(t,e)),!n){const o=t.getTarget(e.element);t.onDragStart(e,o)}};return Nc([Uc(ja(),e=>{o.getStartData().each(()=>n(e))}),...e(t,o,n)])};var vh=Object.freeze({__proto__:null,getData:e=>A.from(yn(e.x,e.y)),getDelta:(e,t)=>yn(t.left-e.left,t.top-e.top)});const xh=(e,t,o)=>[Uc(la(),(n,s)=>{if(0!==s.event.raw.button)return;s.stop();const r=()=>fh(n,A.some(l),e,t),a=Oi(r,200),i={drop:r,delayDrop:a.schedule,forceDrop:r,move:o=>{a.cancel(),hh(n,e,t,vh,o)}},l=dh(n,e.blockerClass,(e=>Nc([Uc(la(),e.forceDrop),Uc(ua(),e.drop),Uc(ca(),(t,o)=>{e.move(o.event)}),Uc(da(),e.delayDrop)]))(i));o(n),lh(n,l)})],yh=[...mh,Ar("blockerClass"),yi("dragger",{handlers:bh(xh)})];var wh=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return A.some(yn(t.clientX,t.clientY))})(t):A.none()},getDelta:(e,t)=>yn(t.left-e.left,t.top-e.top)});const Sh=(e,t,o)=>{const n=Ye(),s=o=>{fh(o,n.get(),e,t),n.clear()};return[Uc(sa(),(r,a)=>{a.stop();const i=()=>s(r),l={drop:i,delayDrop:b,forceDrop:i,move:o=>{hh(r,e,t,wh,o)}},c=dh(r,e.blockerClass,(e=>Nc([Uc(sa(),e.forceDrop),Uc(aa(),e.drop),Uc(ia(),e.drop),Uc(ra(),(t,o)=>{e.move(o.event)})]))(l));n.set(c),o(r),lh(r,c)}),Uc(ra(),(o,n)=>{n.stop(),hh(o,e,t,wh,n.event)}),Uc(aa(),(e,t)=>{t.stop(),s(e)}),Uc(ia(),s)]},Ch=[...mh,Ar("blockerClass"),yi("dragger",{handlers:bh(Sh)})],kh=[...mh,Ar("blockerClass"),yi("dragger",{handlers:bh((e,t,o)=>[...xh(e,t,o),...Sh(e,t,o)])})];var Oh=Object.freeze({__proto__:null,getData:e=>A.from(yn(e.x,e.y)),getDelta:(e,t)=>yn(t.left-e.left,t.top-e.top)});const _h=yh,Th=Ch,Eh=kh,Ah=[...mh,yi("dragger",{handlers:bh((e,t,o)=>[Uc(Oa(),(e,n)=>{const s=n.event.raw;0===s.button&&t.getStartData().isNone()&&(n.stop(),e.element.dom.setPointerCapture(s.pointerId),t.setActivePointerId(s.pointerId),o(e))}),Uc(_a(),(o,n)=>{const s=n.event.raw.pointerId;Ue(t.getStartData(),t.getActivePointerId(),(r,a)=>{s===a&&hh(o,e,t,Oh,n.event)})}),Uc(Ta(),(o,n)=>{const s=n.event.raw.pointerId;Ue(t.getStartData(),t.getActivePointerId(),(n,r)=>{s===r&&(o.element.dom.releasePointerCapture(s),fh(o,A.none(),e,t))})}),Uc(Ea(),o=>{t.getStartData().each(()=>{fh(o,A.none(),e,t)})})])})];var Dh=Object.freeze({__proto__:null,mouse:_h,mouseOrTouch:Eh,pointer:Ah,touch:Th}),Mh=Object.freeze({__proto__:null,init:()=>{const e=Ye(),t=Ye(),o=Ye(),n=y({});return Dc({readState:n,reset:()=>{e.clear(),t.clear(),o.clear()},update:(t,o)=>t.getData(o).bind(o=>((t,o)=>{const n=e.get().map(e=>t.getDelta(e,o));return e.set(o),n})(t,o)),getStartData:()=>t.get(),setStartData:e=>{t.set(e)},setActivePointerId:e=>{o.set(e)},getActivePointerId:()=>o.get()})}});const Bh=ld({branchKey:"mode",branches:Dh,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:A.from(e.extra)})},state:Mh,apis:qp}),Fh=["input","textarea"],Ih=e=>{const t=Wt(e);return I(Fh,t)},Rh=(e,t)=>{const o=t.getRoot(e).getOr(e.element);qn(o,t.invalidClass),t.notify.each(t=>{Ih(e.element)&&zo(e.element,"aria-invalid",!1),t.getContainer(e).each(e=>{Go(e,t.validHtml)}),t.onValid(e)})},zh=(e,t,o,n)=>{const s=t.getRoot(e).getOr(e.element);$n(s,t.invalidClass),t.notify.each(t=>{Ih(e.element)&&zo(e.element,"aria-invalid",!0),t.getContainer(e).each(e=>{Go(e,n)}),t.onInvalid(e,n)})},Vh=(e,t,o)=>t.validator.fold(()=>_e(Ae.value(!0)),t=>t.validate(e)),Lh=(e,t,o)=>(t.notify.each(t=>{t.onValidate(e)}),Vh(e,t).map(o=>e.getSystem().isConnected()?o.fold(o=>(zh(e,t,0,o),Ae.error(o)),o=>(Rh(e,t),Ae.value(o))):Ae.error("No longer in system")));var Nh=Object.freeze({__proto__:null,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return Yn(o,t.invalidClass)},markInvalid:zh,markValid:Rh,query:Vh,run:Lh}),Ph=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map(t=>Nc([Uc(t.onEvent,t=>{Lh(t,e).get(w)})].concat(t.validateOnLoad?[Kc(t=>{Lh(t,e).get(b)})]:[]))).getOr({})}),Hh=[Ar("invalidClass"),Gr("getRoot",A.none),$r("notify",[Gr("aria","alert"),Gr("getContainer",A.none),Gr("validHtml",""),fi("onValid"),fi("onInvalid"),fi("onValidate")]),$r("validator",[Ar("validate"),Gr("onEvent","input"),Gr("validateOnLoad",!0)])];const Uh=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Wh=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var jh=Object.freeze({__proto__:null,getState:(e,t,o)=>o,getValue:(e,t,o)=>t.store.manager.getValue(e,t,o),onLoad:Uh,onUnload:Wh,setValue:(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)}}),$h=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[Kc((o,n)=>{Uh(o,e,t)}),Jc((o,n)=>{Wh(o,e,t)})]:[td(e,t,Uh)];return Nc(o)}});const Gh=()=>{const e=ye(null);return Dc({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},qh=()=>{const e=ye({}),t=ye({});return Dc({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>fe(e.get(),o).orThunk(()=>fe(t.get(),o)),update:o=>{const n=e.get(),s=t.get(),r={},a={};N(o,e=>{r[e.value]=e,fe(e,"meta").each(t=>{fe(t,"text").each(t=>{a[t]=e})})}),e.set({...n,...r}),t.set({...s,...a})},clear:()=>{e.set({}),t.set({})}})};var Yh=Object.freeze({__proto__:null,dataset:qh,init:e=>e.store.manager.state(e),manual:()=>Dc({readState:b}),memory:Gh});const Xh=(e,t,o,n)=>{const s=t.store;o.update([n]),s.setValue(e,n),t.onSetValue(e,n)};var Kh=[Lr("initialValue"),Ar("getFallbackEntry"),Ar("getDataKey"),Ar("setValue"),yi("manager",{setValue:Xh,getValue:(e,t,o)=>{const n=t.store,s=n.getDataKey(e);return o.lookup(s).getOrThunk(()=>n.getFallbackEntry(s))},onLoad:(e,t,o)=>{t.store.initialValue.each(n=>{Xh(e,t,o,n)})},onUnload:(e,t,o)=>{o.clear()},state:qh})],Jh=[Ar("getValue"),Gr("setValue",b),Lr("initialValue"),yi("manager",{setValue:(e,t,o,n)=>{t.store.setValue(e,n),t.onSetValue(e,n)},getValue:(e,t,o)=>t.store.getValue(e),onLoad:(e,t,o)=>{t.store.initialValue.each(o=>{t.store.setValue(e,o)})},onUnload:b,state:Ac.init})],Qh=[Lr("initialValue"),yi("manager",{setValue:(e,t,o,n)=>{o.set(n),t.onSetValue(e,n)},getValue:(e,t,o)=>o.get(),onLoad:(e,t,o)=>{t.store.initialValue.each(e=>{o.isNotSet()&&o.set(e)})},onUnload:(e,t,o)=>{o.clear()},state:Gh})],Zh=[qr("store",{mode:"memory"},kr("mode",{memory:Qh,manual:Jh,dataset:Kh})),fi("onSetValue"),Gr("resetOnDom",!1)];const ef=ad({fields:Zh,name:"representing",active:$h,apis:jh,extra:{setValueFrom:(e,t)=>{const o=ef.getValue(t);ef.setValue(e,o)}},state:Yh}),tf=ad({fields:Hh,name:"invalidating",active:Ph,apis:Nh,extra:{validation:e=>t=>{const o=ef.getValue(t);return _e(e(o))}}});var of=Object.freeze({__proto__:null,exhibit:(e,t)=>ed({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const nf=xe([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),sf=(e,t,o,n,s,r)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=s-(i+a.width),d=r-(l+a.height),u=A.some(i),m=A.some(l),g=A.some(c),p=A.some(d),h=A.none();return t.direction.fold(()=>np(e,u,m,h,h),()=>np(e,h,m,g,h),()=>np(e,u,h,h,p),()=>np(e,h,h,g,p),()=>np(e,u,m,h,h),()=>np(e,u,h,h,p),()=>np(e,u,m,h,h),()=>np(e,h,m,g,h))},rf=(e,t)=>e.fold(()=>{const e=t.rect;return np("absolute",A.some(e.x),A.some(e.y),A.none(),A.none())},(e,o,n,s)=>sf("absolute",t,e,o,n,s),(e,o,n,s)=>sf("fixed",t,e,o,n,s)),af=(e,t)=>{const o=C(_s,t),n=e.fold(o,o,()=>{const e=kn();return _s(t).translate(-e.left,-e.top)}),s=vn(t),r=pn(t);return Ts(n.left,n.top,s,r)},lf=(e,t)=>t.fold(()=>e.fold(Ms,Ms,Ts),t=>e.fold(y(t),y(t),()=>{const o=cf(e,t.x,t.y);return Ts(o.left,o.top,t.width,t.height)})),cf=(e,t,o)=>{const n=yn(t,o);return e.fold(y(n),y(n),()=>{const e=kn();return n.translate(-e.left,-e.top)})};nf.none;const df=nf.relative,uf=nf.fixed,mf=xe([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),gf=(e,t,o,n)=>{const s=e.bubble,r=s.offset,a=((e,t,o)=>{const n=(n,s)=>t[n].map(t=>{const r="top"===n||"bottom"===n,a=r?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,s)+a;return r?Ie(i,e.y,e.bottom):Ie(i,e.x,e.right)}).getOr(s),s=n("left",e.x),r=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Ts(s,r,a-s,i-r)})(n,e.restriction,r),i=e.x+r.left,l=e.y+r.top,c=Ts(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=s&&i>=n&&i<=r,sizeInBounds:l<=s&&l>=o&&c<=r&&c>=n,visibleW:Math.min(d,a>=o?s-a:l-o),visibleH:Math.min(u,i>=n?r-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,s-l),u=Math.max(n,r-c),m=Ie(a,o,d),g=Ie(i,n,u),p=Math.min(m+l,s)-m,h=Math.min(g+c,r)-g;return Ts(m,g,p,h)})(c,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:v}=((e,t,o)=>{const n=y(t.bottom-o.y),s=y(o.bottom-t.y),r=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,s,s,n),a=y(t.right-o.x),i=y(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,i,i,a);return{maxWidth:l,maxHeight:r}})(e.direction,h,n),x={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:s.classesOn,off:s.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?mf.fit(x):mf.nofit(x,m,g,f)},pf=["top","bottom","right","left"],hf="data-alloy-transition-timer",ff=(e,t,o,n,s,a)=>{const i=((e,t,o)=>o.exists(o=>{const n=e.mode;return"all"===n||o[n]!==t[n]}))(n,s,a);if(i||((e,t)=>((e,t)=>Y(t,t=>Yn(e,t)))(e,t.classes))(e,n)){en(e,"position",o.position);const a=af(t,e),l=rf(t,{...s,rect:a}),c=J(pf,e=>l[e]);((e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,(t,n)=>!((e,t,o=S)=>Ue(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o))).isSome()})(o,c)&&(on(e,c),i&&((e,t)=>{Xn(e,t.classes),No(e,hf).each(t=>{clearTimeout(parseInt(t,10)),Ho(e,hf)}),((e,t)=>{const o=qe(),n=qe();let s;const a=t=>{const o=t.raw.pseudoElement??"";return wt(t.target,e)&&ot(o)&&I(pf,t.raw.propertyName)},i=r=>{if(m(r)||a(r)){o.clear(),n.clear();const a=r?.raw.type;(m(a)||a===Sa())&&(clearTimeout(s),Ho(e,hf),Kn(e,t.classes))}},l=wo(e,Ca(),t=>{a(t)&&(l.unbind(),o.set(wo(e,Sa(),i)),n.set(wo(e,wa(),i)))}),c=(e=>{const t=t=>{const o=nn(e,t).split(/\s*,\s*/);return H(o,tt)},o=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Ze(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),s=t("transition-duration");return W(s,(e,t,s)=>{const r=o(n[s])+o(t);return Math.max(e,r)},0)})(e);window.requestAnimationFrame(()=>{s=setTimeout(i,c+17),zo(e,hf,s)})})(e,t)})(e,n),dn(e))}else Kn(e,n.classes)},bf=(e,t,o)=>void 0===e[t]?o:e[t],vf=(e,t,o,n)=>{const s=((e,t,o,n)=>{cn(t,"max-height"),cn(t,"max-width");const s=(r=t,{width:Math.ceil(vn(r)),height:pn(r)});var r;return((e,t,o,n,s,r)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,s,e,r),g=gf(m,a,i,r);return g.fold(y(g),(e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:mf.nofit(l,c,d,u))};return W(t,(e,t)=>{const o=C(l,t);return e.fold(y(e),o)},mf.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:kl(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(w,w)})(t,n.preference,e,s,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=rf(o.origin,t);o.transition.each(s=>{ff(e,o.origin,n,s,t,o.lastPlacement)}),sp(e,n)})(t,s,n),((e,t)=>{((e,t)=>{zo(e,ec,t)})(e,t.placement)})(t,s),((e,t)=>{const o=t.classes;Kn(e,o.off),Xn(e,o.on)})(t,s),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,s,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,s,n),{layout:s.layout,placement:s.placement}},xf=w,yf=()=>$r("layouts",[Ar("onLtr"),Ar("onRtl"),Lr("onBottomLtr"),Lr("onBottomRtl")]),wf=(e,t,o,n,s,r,a)=>{const i=a.map(Tc).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(s):l.getOr(o),u=i?t.layouts.bind(t=>t.onBottomRtl.map(t=>t(e))).or(c).getOr(r):c.getOr(n);return Tn(d,u)(e)};var Sf=[Ar("hotspot"),Lr("bubble"),Gr("overrides",{}),yf(),yi("placement",(e,t,o)=>{const n=t.hotspot,s=af(o,n.element),r=wf(e.element,t,Ql(),Zl(),Kl(),Jl(),A.some(t.hotspot.element));return A.some(xf({anchorBox:s,bubble:t.bubble.getOr(wl()),overrides:t.overrides,layouts:r}))})],Cf=[Ar("x"),Ar("y"),Gr("height",0),Gr("width",0),Gr("bubble",wl()),Gr("overrides",{}),yf(),yi("placement",(e,t,o)=>{const n=cf(o,t.x,t.y),s=Ts(n.left,n.top,t.width,t.height),r=wf(e.element,t,Yl(),Xl(),Yl(),Xl(),A.none());return A.some(xf({anchorBox:s,bubble:t.bubble,overrides:t.overrides,layouts:r}))})];const kf=xe([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Of=e=>e.fold(w,(e,t,o)=>e.translate(-t,-o)),_f=e=>e.fold(w,w),Tf=e=>W(e,(e,t)=>e.translate(t.left,t.top),yn(0,0)),Ef=e=>{const t=L(e,_f);return Tf(t)},Af=kf.screen,Df=kf.absolute,Mf=(e,t,o)=>{const n=Jt(e.element),s=kn(n),r=((e,t,o)=>{const n=eo(o.root).dom;return A.from(n.frameElement).map(ct).filter(t=>{const o=Jt(t),n=Jt(e.element);return wt(o,n)}).map(Sn)})(e,0,o).getOr(s);return Df(r,s.left,s.top)},Bf=(e,t,o,n)=>{const s=Af(yn(e,t));return A.some(((e,t,o)=>({point:e,width:t,height:o}))(s,o,n))},Ff=(e,t,o,n,s)=>e.map(e=>{const r=[t,e.point],a=(i=()=>Ef(r),l=()=>Ef(r),c=()=>(e=>{const t=L(e,Of);return Tf(t)})(r),n.fold(i,l,c));var i,l,c;const d=(p=a.left,h=a.top,f=e.width,b=e.height,{x:p,y:h,width:f,height:b}),u=o.showAbove?Kl():Ql(),m=o.showAbove?Jl():Zl(),g=wf(s,o,u,m,u,m,A.none());var p,h,f,b;return xf({anchorBox:d,bubble:o.bubble.getOr(wl()),overrides:o.overrides,layouts:g})});var If=[Ar("node"),Ar("root"),Lr("bubble"),yf(),Gr("overrides",{}),Gr("showAbove",!1),yi("placement",(e,t,o)=>{const n=Mf(e,0,t);return t.node.filter(Xo).bind(s=>{const r=s.dom.getBoundingClientRect(),a=Bf(r.left,r.top,r.width,r.height),i=t.node.getOr(e.element);return Ff(a,n,t,o,i)})})];const Rf=(e,t)=>({element:e,offset:t}),zf=(e,t)=>qt(e)?Rf(e,t):((e,t)=>{const o=ao(e);if(0===o.length)return Rf(e,t);if(t<o.length)return Rf(o[t],0);{const e=o[o.length-1],t=qt(e)?(e=>_n.get(e))(e).length:ao(e).length;return Rf(e,t)}})(e,t),Vf=e=>void 0!==e.foffset,Lf=(e,t)=>t.getSelection.getOrThunk(()=>()=>bs(e))().map(e=>{if(Vf(e)){const t=zf(e.start,e.soffset),o=zf(e.finish,e.foffset);return us.range(t.element,t.offset,o.element,o.offset)}return e});var Nf=[Lr("getSelection"),Ar("root"),Lr("bubble"),yf(),Gr("overrides",{}),Gr("showAbove",!1),yi("placement",(e,t,o)=>{const n=eo(t.root).dom,s=Mf(e,0,t),r=Lf(n,t).bind(e=>{if(Vf(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?A.some(t).map(mt):A.none()})(ft(e,t)))(n,us.exactFromRange(e)).orThunk(()=>{const t=lt("\ufeff"),o=bs(n);Do(e.start,t);const s=vs(n,us.exact(t,0,t,1));return Wo(t),o.each(e=>((e,t,o,n,s)=>{const r=((e,t,o,n)=>{const s=ms(e,t),r=ms(o,n);return us.relative(s,r)})(t,o,n,s);((e,t)=>{ht(e,t).match({ltr:(t,o,n,s)=>{ps(e,t,o,n,s)},rtl:(t,o,n,s)=>{gs(e).each(r=>{if(r.setBaseAndExtent)r.setBaseAndExtent(t.dom,o,n.dom,s);else if(r.extend)try{((e,t,o,n,s,r)=>{t.collapse(o.dom,n),t.extend(s.dom,r)})(0,r,t,o,n,s)}catch{ps(e,n,s,t,o)}else ps(e,n,s,t,o)})}})})(e,r)})(n,e.start,e.soffset,e.finish,e.foffset)),s});return t.bind(e=>Bf(e.left,e.top,e.width,e.height))}{const t=le(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 Bf(o.left,o.top,o.right-o.left,o.bottom-o.top)}}),a=Lf(n,t).bind(e=>Vf(e)?Gt(e.start)?A.some(e.start):oo(e.start):A.some(e.firstCell)).getOr(e.element);return Ff(r,s,t,o,a)})];const Pf="link-layout",Hf=e=>e.x+e.width,Uf=(e,t)=>e.x-t.width,Wf=(e,t)=>e.y-t.height+e.height,jf=e=>e.y,$f=(e,t,o)=>Sl(Hf(e),jf(e),o.southeast(),kl(),"southeast",Bl(e,{left:0,top:2}),Pf),Gf=(e,t,o)=>Sl(Uf(e,t),jf(e),o.southwest(),Ol(),"southwest",Bl(e,{right:1,top:2}),Pf),qf=(e,t,o)=>Sl(Hf(e),Wf(e,t),o.northeast(),_l(),"northeast",Bl(e,{left:0,bottom:3}),Pf),Yf=(e,t,o)=>Sl(Uf(e,t),Wf(e,t),o.northwest(),Tl(),"northwest",Bl(e,{right:1,bottom:3}),Pf),Xf=()=>[$f,Gf,qf,Yf],Kf=()=>[Gf,$f,Yf,qf];var Jf=[Ar("item"),yf(),Gr("overrides",{}),yi("placement",(e,t,o)=>{const n=af(o,t.item.element),s=wf(e.element,t,Xf(),Kf(),Xf(),Kf(),A.none());return A.some(xf({anchorBox:n,bubble:wl(),overrides:t.overrides,layouts:s}))})],Qf=kr("type",{selection:Nf,node:If,hotspot:Sf,submenu:Jf,makeshift:Cf});const Zf=[Vr("classes",Ks),Kr("mode","all",["all","layout","placement"])],eb=[Gr("useFixed",T),Lr("getBounds")],tb=[Dr("anchor",Qf),$r("transition",Zf)],ob=(e,t,o,n,s,r)=>{const a=Sr("placement.info",mr(tb),s),i=a.anchor,l=n.element,c=o.get(n.uid);$m(()=>{en(l,"position","fixed");const s=rn(l,"visibility");en(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return uf(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Sn(e.element),o=e.element.dom.getBoundingClientRect();return df(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each(e=>{const s=r.orThunk(()=>t.getBounds.map(_)),i=((e,t,o,n,s,r)=>((e,t,o,n,s,r,a,i)=>{const l=bf(a,"maxHeightFunction",Sc()),c=bf(a,"maxWidthFunction",b),d=e.anchorBox,u=e.origin,m={bounds:lf(u,r),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:s,transition:i};return vf(d,t,o,m)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),n.element,t.bubble,t.layouts,s,o,t.overrides,r))(d,e,s,n,c,a.transition);o.set(n.uid,i)}),s.fold(()=>{cn(l,"visibility")},e=>{en(l,"visibility",e)}),rn(l,"left").isNone()&&rn(l,"top").isNone()&&rn(l,"right").isNone()&&rn(l,"bottom").isNone()&&Pe(rn(l,"position"),"fixed")&&cn(l,"position")},l)};var nb=Object.freeze({__proto__:null,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",position:(e,t,o,n,s)=>{const r=A.none();ob(e,t,o,n,s,r)},positionWithinBounds:ob,reset:(e,t,o,n)=>{const s=n.element;N(["position","left","right","top","bottom"],e=>cn(s,e)),(e=>{Ho(e,ec)})(s),o.clear(n.uid)}});const sb=ad({fields:eb,name:"positioning",active:of,apis:nb,state:Object.freeze({__proto__:null,init:()=>{let e={};return Dc({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>fe(e,t)})}})});var rb=Object.freeze({__proto__:null,events:e=>Nc([Uc(Ia(),(t,o)=>{const n=e.channels,s=re(n),r=o,a=((e,t)=>t.universal?e:H(e,e=>I(t.channels,e)))(s,r);N(a,e=>{const o=n[e],s=o.schema,a=Sr("channel["+e+"] data\nReceiver: "+ni(t.element),s,r.data);o.onReceive(t,a)})})])}),ab=[Dr("channels",xr(Ae.value,ur([vi("onReceive"),Gr("schema",qs())])))];const ib=ad({fields:ab,name:"receiving",active:rb});var lb=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each(e=>{const s=e(o,n);t.set(s)}),e.renderComponents.each(s=>{const r=s(n,t.get());(e.reuseDom?qm:Gm)(o,r)})};return Nc([Uc(Ia(),(t,n)=>{const s=n;if(!s.universal){const n=e.channel;I(s.channels,n)&&o(t,s.data)}}),Kc((t,n)=>{e.initialData.each(e=>{o(t,e)})})])}}),cb=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),db=[Ar("channel"),Lr("renderComponents"),Lr("updateState"),Lr("initialData"),Jr("reuseDom",!0)];const ub=ad({fields:db,name:"reflecting",active:lb,apis:cb,state:Object.freeze({__proto__:null,init:()=>{const e=ye(A.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(A.none())}}})}),mb=e=>{const t=e.getAccumulatedDelta(),o=e.getBounds();return{width:Ie(Math.round(e.getOriginalWidth()+t.left),o.minWidth.getOr(0),o.maxWidth.getOr(Number.MAX_VALUE)),height:Ie(Math.round(e.getOriginalHeight()+t.top),o.minHeight.getOr(0),o.maxHeight.getOr(Number.MAX_VALUE))}};var gb=Object.freeze({__proto__:null,moveBy:(e,t,o,n)=>o.isActive()?(o.drag(n),A.some(mb(o))):A.none(),start:(e,t,o,n,s,r)=>{o.start(n,s,r)},stop:(e,t,o)=>o.isActive()?(o.stop(),A.some(mb(o))):A.none()}),pb=Object.freeze({__proto__:null,init:()=>{const e=ye(0),t=ye(0),o=ye(yn(0,0)),n=ye(!1),s=ye({minWidth:A.none(),maxWidth:A.none(),minHeight:A.none(),maxHeight:A.none()});return Dc({start:(r,a,i={})=>{e.set(r),t.set(a),o.set(yn(0,0)),s.set({minWidth:A.from(i.minWidth),maxWidth:A.from(i.maxWidth),minHeight:A.from(i.minHeight),maxHeight:A.from(i.maxHeight)}),n.set(!0)},stop:()=>{n.set(!1)},isActive:()=>n.get(),drag:e=>{const t=o.get().translate(e.left,e.top);return o.set(t),t},getAccumulatedDelta:()=>o.get(),getOriginalWidth:()=>e.get(),getOriginalHeight:()=>t.get(),getBounds:()=>s.get(),readState:()=>({originalWidth:e.get(),originalHeight:t.get(),accumulatedDelta:o.get(),active:n.get(),bounds:s.get()})})}});const hb=ad({fields:[],name:"resizing",apis:gb,state:pb}),fb=(e,t,o,n)=>{o.get().each(t=>{Vm(e)});const s=t.getAttachPoint(e);Fm(s,e);const r=e.getSystem().build(n);return Fm(e,r),o.set(r),r},bb=(e,t,o,n)=>{const s=fb(e,t,o,n);return t.onOpen(e,s),s},vb=(e,t,o)=>{o.get().each(n=>{Vm(e),zm(e),t.onClose(e,n),o.clear()})},xb=(e,t,o)=>o.isOpen(),yb=(e,t,o)=>{const n=t.getAttachPoint(e);en(e.element,"position",sb.getMode(n)),((e,t,o)=>{rn(e.element,t).fold(()=>{Ho(e.element,o)},t=>{zo(e.element,o,t)}),en(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},wb=(e,t,o)=>{(e=>R(["top","left","right","bottom"],t=>rn(e,t).isSome()))(e.element)||cn(e.element,"position"),((e,t,o)=>{No(e.element,o).fold(()=>cn(e.element,t),o=>en(e.element,t,o))})(e,"visibility",t.cloakVisibilityAttr)};var Sb=Object.freeze({__proto__:null,cloak:yb,close:vb,decloak:wb,getState:(e,t,o)=>o.get(),isOpen:xb,isPartOf:(e,t,o,n)=>xb(0,0,o)&&o.get().exists(o=>t.isPartOf(e,o,n)),open:bb,openWhileCloaked:(e,t,o,n,s)=>{yb(e,t),bb(e,t,o,n),s(),wb(e,t)},setContent:(e,t,o,n)=>o.get().map(()=>fb(e,t,o,n))}),Cb=Object.freeze({__proto__:null,events:(e,t)=>Nc([Uc(Na(),(o,n)=>{vb(o,e,t)})])}),kb=[fi("onOpen"),fi("onClose"),Ar("isPartOf"),Ar("getAttachPoint"),Gr("cloakVisibilityAttr","data-precloak-visibility")],Ob=Object.freeze({__proto__:null,init:()=>{const e=Ye(),t=y("not-implemented");return Dc({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const _b=ad({fields:kb,name:"sandboxing",active:Cb,apis:Sb,state:Ob}),Tb=(e,t)=>t.getAnimationRoot.fold(()=>e.element,t=>t(e)),Eb=e=>e.dimension.property,Ab=(e,t)=>e.dimension.getDimension(t),Db=(e,t)=>{const o=Tb(e,t);Kn(o,[t.shrinkingClass,t.growingClass])},Mb=(e,t)=>{qn(e.element,t.openClass),$n(e.element,t.closedClass),en(e.element,Eb(t),"0px"),dn(e.element)},Bb=(e,t)=>{qn(e.element,t.closedClass),$n(e.element,t.openClass),cn(e.element,Eb(t))},Fb=(e,t,o,n)=>{o.setCollapsed(),en(e.element,Eb(t),Ab(t,e.element)),Db(e,t),Mb(e,t),t.onStartShrink(e),t.onShrunk(e)},Ib=(e,t,o,n)=>{const s=n.getOrThunk(()=>Ab(t,e.element));o.setCollapsed(),en(e.element,Eb(t),s),dn(e.element);const r=Tb(e,t);qn(r,t.growingClass),$n(r,t.shrinkingClass),Mb(e,t),t.onStartShrink(e)},Rb=(e,t,o)=>{const n=Ab(t,e.element);("0px"===n?Fb:Ib)(e,t,o,A.some(n))},zb=(e,t,o)=>{const n=Tb(e,t),s=Yn(n,t.shrinkingClass),r=Ab(t,e.element);Bb(e,t);const a=Ab(t,e.element);(s?()=>{en(e.element,Eb(t),r),dn(e.element)}:()=>{Mb(e,t)})(),qn(n,t.shrinkingClass),$n(n,t.growingClass),Bb(e,t),en(e.element,Eb(t),a),o.setExpanded(),t.onStartGrow(e)},Vb=(e,t,o)=>{const n=Tb(e,t);return!0===Yn(n,t.growingClass)},Lb=(e,t,o)=>{const n=Tb(e,t);return!0===Yn(n,t.shrinkingClass)};var Nb=Object.freeze({__proto__:null,disableTransitions:Db,grow:(e,t,o)=>{o.isExpanded()||zb(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),immediateGrow:(e,t,o)=>{o.isExpanded()||(Bb(e,t),en(e.element,Eb(t),Ab(t,e.element)),Db(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))},immediateShrink:(e,t,o)=>{o.isExpanded()&&Fb(e,t,o)},isGrowing:Vb,isShrinking:Lb,isTransitioning:(e,t,o)=>Vb(e,t)||Lb(e,t),refresh:(e,t,o)=>{if(o.isExpanded()){cn(e.element,Eb(t));const o=Ab(t,e.element);en(e.element,Eb(t),o)}},shrink:(e,t,o)=>{o.isExpanded()&&Rb(e,t,o)},toggleGrow:(e,t,o)=>{(o.isExpanded()?Rb:zb)(e,t,o)}}),Pb=Object.freeze({__proto__:null,events:(e,t)=>Nc([Xc(Sa(),(o,n)=>{n.event.raw.propertyName===e.dimension.property&&(Db(o,e),t.isExpanded()&&cn(o.element,e.dimension.property),(t.isExpanded()?e.onGrown:e.onShrunk)(o))})]),exhibit:(e,t,o)=>{const n=t.expanded;return ed(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:ta(t.dimension.property,"0px")})}}),Hb=[Ar("closedClass"),Ar("openClass"),Ar("shrinkingClass"),Ar("growingClass"),Lr("getAnimationRoot"),fi("onShrunk"),fi("onStartShrink"),fi("onGrown"),fi("onStartGrow"),Gr("expanded",!1),Dr("dimension",kr("property",{width:[yi("property","width"),yi("getDimension",e=>bn(e)+"px")],height:[yi("property","height"),yi("getDimension",e=>gn(e)+"px")]}))];const Ub=ad({fields:Hb,name:"sliding",active:Pb,apis:Nb,state:Object.freeze({__proto__:null,init:e=>{const t=ye(e.expanded);return Dc({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:C(t.set,!1),setExpanded:C(t.set,!0),readState:()=>"expanded: "+t.get()})}})});var Wb=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Nc([Uc(e.event,o),Jc(()=>t.cancel())].concat(e.cancelEvent.map(e=>[Uc(e,()=>t.cancel())]).getOr([])))}});const jb=e=>{const t=ye(null);return Dc({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var $b=Object.freeze({__proto__:null,init:e=>e.stream.streams.state(e),throttle:jb}),Gb=[Dr("stream",kr("mode",{throttle:[Ar("delay"),Gr("stopEvent",!0),yi("streams",{setup:(e,t)=>{const o=e.stream,n=nt(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:jb})]})),Gr("event","input"),Lr("cancelEvent"),vi("onStream")];const qb=ad({fields:Gb,name:"streaming",active:Wb,state:$b});var Yb=Object.freeze({__proto__:null,exhibit:(e,t)=>ed({attributes:oa([{key:t.tabAttr,value:"true"}])})}),Xb=[Gr("tabAttr","data-alloy-tabstop")];const Kb=ad({fields:Xb,name:"tabstopping",active:Yb}),Jb=(e,t,o,n)=>{const s=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each(t=>{o.get()?$n(e.element,t):qn(e.element,t)})})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),s!==n&&t.onToggled(e,n)},Qb=(e,t,o)=>{Jb(e,t,o,!o.get())},Zb=(e,t,o)=>{Jb(e,t,o,t.selected)};var ev=Object.freeze({__proto__:null,isOn:(e,t,o)=>o.get(),off:(e,t,o)=>{Jb(e,t,o,!1)},on:(e,t,o)=>{Jb(e,t,o,!0)},onLoad:Zb,set:Jb,toggle:Qb}),tv=Object.freeze({__proto__:null,events:(e,t)=>{const o=(n=e,s=t,r=Qb,Zc(e=>{r(e,n,s)}));var n,s,r;const a=td(e,t,Zb);return Nc(G([e.toggleOnExecute?[o]:[],[a]]))},exhibit:()=>ed({})});const ov=(e,t,o)=>{zo(e.element,"aria-expanded",o)};var nv=[Gr("selected",!1),Lr("toggleClass"),Gr("toggleOnExecute",!0),fi("onToggled"),qr("aria",{mode:"none"},kr("mode",{pressed:[Gr("syncWithExpanded",!1),yi("update",(e,t,o)=>{zo(e.element,"aria-pressed",o),t.syncWithExpanded&&ov(e,0,o)})],checked:[yi("update",(e,t,o)=>{zo(e.element,"aria-checked",o)})],expanded:[yi("update",ov)],selected:[yi("update",(e,t,o)=>{zo(e.element,"aria-selected",o)})],none:[yi("update",b)]}))];const sv=ad({fields:nv,name:"toggling",active:tv,apis:ev,state:(rv=!1,{init:()=>{const e=ye(rv);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(rv),readState:()=>e.get()}}})});var rv;const av=ze("tooltip.exclusive"),iv=ze("tooltip.show"),lv=ze("tooltip.hide"),cv=ze("tooltip.immediateHide"),dv=ze("tooltip.immediateShow"),uv=(e,t,o)=>{e.getSystem().broadcastOn([av],{})};var mv=Object.freeze({__proto__:null,hideAllExclusive:uv,immediateOpenClose:(e,t,o,n)=>Fc(e,n?dv:cv),isEnabled:(e,t,o)=>o.isEnabled(),setComponents:(e,t,o,n)=>{o.getTooltip().each(e=>{e.getSystem().isConnected()&&eg.set(e,n)})},setEnabled:(e,t,o,n)=>o.setEnabled(n)}),gv=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each(n=>{n.getSystem().isConnected()&&(zm(n),e.onHide(o,n),t.clearTooltip())}),t.clearTimer()},n=o=>{if(!t.isShowing()&&t.isEnabled()){uv(o);const n=e.lazySink(o).getOrDie(),s=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Nc("normal"===e.mode?[Uc(ma(),e=>{Fc(o,iv)}),Uc(da(),e=>{Fc(o,lv)})]:[]),behaviours:sd([eg.config({})])});t.setTooltip(s),Fm(n,s),e.onShow(o,s),sb.position(n,s,{anchor:e.anchor(o)})}},s=o=>{t.getTooltip().each(t=>{const n=e.lazySink(o).getOrDie();sb.position(n,t,{anchor:e.anchor(o)})})};return Nc(G([[Qc(t=>{e.onSetup(t)}),Uc(iv,o=>{t.resetTimer(()=>{n(o)},e.delayForShow())}),Uc(lv,n=>{t.resetTimer(()=>{o(n)},e.delayForHide())}),Uc(dv,e=>{t.resetTimer(()=>{n(e)},0)}),Uc(cv,e=>{t.resetTimer(()=>{o(e)},0)}),Uc(Ia(),(e,n)=>{const s=n;s.universal||(I(s.channels,av)||I(s.channels,Od()))&&(s.data.closedTooltip&&t.isShowing()&&s.data.closedTooltip(),o(e))}),Jc(e=>{o(e)})],(()=>{switch(e.mode){case"normal":return[Uc(ga(),e=>{Fc(e,dv)}),Uc(Ba(),e=>{Fc(e,cv)}),Uc(ma(),e=>{Fc(e,iv)}),Uc(da(),e=>{Fc(e,lv)})];case"follow-highlight":return[Uc(ti(),(e,t)=>{Fc(e,iv)}),Uc(oi(),e=>{Fc(e,lv)})];case"children-normal":return[Uc(ga(),(o,n)=>{Ao(o.element).each(r=>{vt(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Fc(o,dv)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),Uc(Ba(),e=>{Ao(e.element).fold(()=>{Fc(e,cv)},b)}),Uc(ma(),o=>{Vn(o.element,"[data-mce-tooltip]:hover").each(n=>{t.getTooltip().fold(()=>{Fc(o,iv)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),Uc(da(),e=>{Vn(e.element,"[data-mce-tooltip]:hover").fold(()=>{Fc(e,lv)},b)})];default:return[Uc(ga(),(o,n)=>{Ao(o.element).each(r=>{vt(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Fc(o,dv)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),Uc(Ba(),e=>{Ao(e.element).fold(()=>{Fc(e,cv)},b)})]}})()]))}}),pv=[Ar("lazySink"),Ar("tooltipDom"),Gr("exclusive",!0),Gr("tooltipComponents",[]),Qr("delayForShow",y(300)),Qr("delayForHide",y(100)),Qr("onSetup",b),Kr("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),Gr("anchor",e=>({type:"hotspot",hotspot:e,layouts:{onLtr:y([$l,jl,Pl,Ul,Hl,Wl]),onRtl:y([$l,jl,Pl,Ul,Hl,Wl])},bubble:yl(0,-2,{})})),fi("onHide"),fi("onShow")],hv=Object.freeze({__proto__:null,init:()=>{const e=ye(!0),t=Ye(),o=Ye(),n=()=>{t.on(clearTimeout)},s=y("not-implemented");return Dc({getTooltip:o.get,isShowing:o.isSet,setTooltip:o.set,clearTooltip:o.clear,clearTimer:n,resetTimer:(e,o)=>{n(),t.set(setTimeout(e,o))},readState:s,isEnabled:()=>e.get(),setEnabled:t=>e.set(t)})}});const fv=ad({fields:pv,name:"tooltipping",active:gv,state:hv,apis:mv}),bv=ad({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Nc([Pc(ka(),E)]),exhibit:()=>ed({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),vv=e=>{const t=at(e),o=ao(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return W(t,(e,t)=>"class"===t.name?e:{...e,[t.name]:t.value},{})})(t),s=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),r=0===o.length?{}:{innerHtml:$o(t)};return{tag:Wt(t),classes:s,attributes:n,...r}},xv=e=>{const t=(e=>void 0!==e.uid)(e)&&ve(e,"uid")?e.uid:cg("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}},yv=vl,wv=tl,Sv=(e,t)=>{const o={stopBackspace:!0,...t},n=(e=>{const t=Ye(),o=ye(!1),n=Oi(t=>{e.triggerEvent(La(),t),o.set(!0)},400),s=oa([{key:sa(),value:e=>(_i(e).each(s=>{n.cancel();const r={x:s.clientX,y:s.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(r)}),A.none())},{key:ra(),value:e=>(n.cancel(),_i(e).each(e=>{t.on(o=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(e,o)&&t.clear()})}),A.none())},{key:aa(),value:s=>(n.cancel(),t.get().filter(e=>wt(e.target,s.target)).map(t=>o.get()?(s.prevent(),!1):e.triggerEvent(Va(),s)))}]);return{fireIfReady:(e,t)=>fe(s,t).bind(t=>t(e))}})(o),s=L(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click","dblclick","pointerdown","pointermove","pointerup","lostpointercapture"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),t=>wo(e,t,e=>{n.fireIfReady(e,t).each(t=>{t&&e.kill()}),o.triggerEvent(t,e)&&e.kill()})),r=Ye(),a=wo(e,"paste",e=>{n.fireIfReady(e,"paste").each(t=>{t&&e.kill()}),o.triggerEvent("paste",e)&&e.kill(),r.set(setTimeout(()=>{o.triggerEvent(Fa(),e)},0))}),i=wo(e,"keydown",e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===fd[0]&&!I(["input","textarea"],Wt(e.target))&&!ns(e.target,'[contenteditable="true"]'))(e)&&e.prevent()}),l=wo(e,"focusin",e=>{o.triggerEvent("focusin",e)&&e.kill()}),c=Ye(),d=wo(e,"focusout",e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout(()=>{o.triggerEvent(Ba(),e)},0))});return{unbind:()=>{N(s,e=>{e.unbind()}),i.unbind(),l.unbind(),d.unbind(),a.unbind(),r.on(clearTimeout),c.on(clearTimeout)}}},Cv=(e,t)=>{const o=fe(e,"target").getOr(t);return ye(o)},kv=xe([{stopped:[]},{resume:["element"]},{complete:[]}]),Ov=(e,t,o,n,s,r)=>{const a=e(t,n),i=((e,t)=>{const o=ye(!1),n=ye(!1);return{stop:()=>{o.set(!0)},cut:()=>{n.set(!0)},isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}})(o,s);return a.fold(()=>(r.logEventNoHandlers(t,n),kv.complete()),e=>{const o=e.descHandler;return pg(o)(i),i.isStopped()?(r.logEventStopped(t,e.element,o.purpose),kv.stopped()):i.isCut()?(r.logEventCut(t,e.element,o.purpose),kv.complete()):to(e.element).fold(()=>(r.logNoParent(t,e.element,o.purpose),kv.complete()),n=>(r.logEventResponse(t,e.element,o.purpose),kv.resume(n)))})},_v=(e,t,o,n,s,r)=>Ov(e,t,o,n,s,r).fold(E,n=>_v(e,t,o,n,s,r),T),Tv=(e,t,o,n,s)=>{const r=Cv(o,n);return _v(e,t,o,n,r,s)},Ev=()=>{const e=(()=>{const e={};return{registerId:(t,o,n)=>{ie(n,(n,s)=>{const r=void 0!==e[s]?e[s]:{};r[o]=((e,t)=>({cHandler:C.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(n,t),e[s]=r})},unregisterId:t=>{ie(e,(e,o)=>{be(e,t)&&delete e[t]})},filterByType:t=>fe(e,t).map(e=>ge(e,(e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))).getOr([]),find:(t,o,n)=>fe(e,o).bind(e=>as(n,t=>((e,t)=>lg(t).bind(t=>fe(e,t)).map(e=>((e,t)=>({element:e,descHandler:t}))(t,e)))(e,t),t))}})(),t={},o=o=>{lg(o.element).each(o=>{delete t[o],e.unregisterId(o)})};return{find:(t,o,n)=>e.find(t,o,n),filter:t=>e.filterByType(t),register:n=>{const s=(e=>{const t=e.element;return lg(t).getOrThunk(()=>((e,t)=>{const o=ze(rg+"uid-");return ig(t,o),o})(0,e.element))})(n);ve(t,s)&&((e,n)=>{const s=t[n];if(s!==e)throw new Error('The tagId "'+n+'" is already used by: '+ni(s.element)+"\nCannot use it for: "+ni(e.element)+"\nThe conflicting element is"+(Xo(s.element)?" ":" not ")+"already in the DOM");o(e)})(n,s);const r=[n];e.registerId(r,s,n.events),t[s]=n},unregister:o,getById:e=>fe(t,e)}},Av=e=>{const t=t=>to(e.element).fold(E,e=>wt(t,e)),o=Ev(),n=(e,n)=>o.find(t,e,n),s=Sv(e.element,{triggerEvent:(e,t)=>ii(e,t.target,o=>((e,t,o,n)=>Tv(e,t,o,o.target,n))(n,e,t,o))}),r={debugInfo:y("real"),triggerEvent:(e,t,o)=>{ii(e,t,s=>Tv(n,e,o,t,s))},triggerFocus:(e,t)=>{lg(e).fold(()=>{Oo(e)},o=>{ii(Ma(),e,o=>(((e,t,o,n,s)=>{const r=Cv(o,n);Ov(e,t,o,n,r,s)})(n,Ma(),{originator:t,kill:b,prevent:b,target:e},e,o),!1))})},triggerEscape:(e,t)=>{r.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>h(e),build:Dg,buildOrPatch:Ag,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{u(e)},broadcastOn:(e,t)=>{m(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:E},a=e=>{e.connect(r),qt(e.element)||(o.register(e),N(e.components(),a),r.triggerEvent(Ha(),e.element,{target:e.element}))},i=e=>{qt(e.element)||(N(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{Fm(e,t)},c=e=>{zm(e)},d=e=>{const t=o.filter(Ia());N(t,t=>{const o=t.descHandler;pg(o)(e)})},u=e=>{d({universal:!0,data:e})},m=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>((e,t)=>{const o=(e=>{const t=ye(!1);return{stop:()=>{t.set(!0)},cut:b,isStopped:t.get,isCut:T,event:e,setSource:O("Cannot set source of a broadcasted event"),getSource:O("Cannot get source of a broadcasted event")}})(t);return N(e,e=>{const t=e.descHandler;pg(t)(o)}),o.isStopped()})(o.filter(e),t),p=e=>o.getById(e).fold(()=>Ae.error(new Error('Could not find component with uid: "'+e+'" in system.')),Ae.value),h=e=>{const t=lg(e).getOr("not found");return p(t)};return a(e),{root:e,element:e.element,destroy:()=>{s.unbind(),Wo(e.element)},add:l,remove:c,getByUid:p,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:u,broadcastOn:m,broadcastEvent:g}},Dv=()=>{const e=(e,t)=>{t.stop(),Rc(e)};return[Uc(xa(),e),Uc(Va(),e),qc(sa()),qc(la())]},Mv=e=>Nc(G([e.map(e=>Zc((t,o)=>{e(t),o.stop()})).toArray(),Dv()])),Bv=sh({name:"Button",factory:e=>{const t=Mv(e.action),o=e.dom.tag,n=t=>fe(e.dom,"attributes").bind(e=>fe(e,t));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:Qp(e.buttonBehaviours,[hd.config({}),Sm.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===o?{type:n("type").getOr("button"),...n("role").map(e=>({role:e})).getOr({})}:{role:e.role.getOr(n("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[Gr("uid",void 0),Ar("dom"),Gr("components",[]),Jp("buttonBehaviours",[hd,Sm]),Lr("action"),Lr("role"),Gr("eventOrder",{})]}),Fv=y([Gr("shell",!1),Ar("makeItem"),Gr("setupItem",b),Jp("listBehaviours",[eg])]),Iv=Qi({name:"items",overrides:()=>({behaviours:sd([eg.config({})])})}),Rv=y([Iv]),zv=rh({name:y("CustomList")(),configFields:Fv(),partFields:Rv(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[eg.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Kp(e.listBehaviours,s.behaviours),apis:{setItems:(t,o)=>{var n;(n=t,e.shell?A.some(n):dl(n,e,"items")).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 s=eg.contents(n),r=o.length,a=r-s.length,i=a>0?z(a,()=>e.makeItem()):[],l=s.slice(r);N(l,e=>eg.remove(n,e)),N(i,e=>eg.append(n,e));const c=eg.contents(n);N(c,(n,s)=>{e.setupItem(t,n,o[s],s)})})}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),Vv="aria-controls",Lv=()=>{const e=ze(Vv);return{id:e,link:t=>{zo(t,Vv,e)},unlink:e=>{Ho(e,Vv)}}},Nv=(e,t)=>os(t,t=>wt(t,e.element),T)||((e,t)=>(e=>Bn(e,e=>{if(!Gt(e))return!1;const t=Lo(e,"id");return void 0!==t&&t.indexOf(Vv)>-1}).bind(e=>{const t=Lo(e,"id"),o=go(e);return Vn(o,`[${Vv}="${t}"]`)}))(t).exists(t=>Nv(e,t)))(e,t),Pv="alloy.item-hover",Hv="alloy.item-focus",Uv="alloy.item-toggled",Wv=e=>{(Ao(e.element).isNone()||hd.isFocused(e))&&(hd.isFocused(e)||hd.focus(e),Ic(e,Pv,{item:e}))},jv=e=>{Ic(e,Hv,{item:e})},$v=y(Pv),Gv=y(Hv),qv=y(Uv),Yv=e=>e.role.fold(()=>e.toggling.map(e=>e.exclusive?"menuitemradio":"menuitemcheckbox").getOr("menuitem"),w),Xv=[Ar("data"),Ar("components"),Ar("dom"),Gr("hasSubmenu",!1),Lr("toggling"),Lr("role"),Jp("itemBehaviours",[sv,hd,Sm,ef]),Gr("ignoreFocus",!1),Gr("domModification",{}),yi("builder",e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:Yv(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Qp(e.itemBehaviours,[e.toggling.fold(sv.revoke,t=>sv.config(((e,t)=>({aria:{mode:t?"selected":"checked"},...me(e,(e,t)=>"exclusive"!==t),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{Ic(e,Uv,{item:e,state:t})})(t,o)}}))(t,e.role.exists(e=>"option"===e)))),hd.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{jv(e)}}),Sm.config({mode:"execution"}),ef.config({store:{mode:"memory",initialValue:e.data}}),dd("item-type-events",[...Dv(),Uc(ma(),Wv),Uc(za(),hd.focus)])]),components:e.components,eventOrder:e.eventOrder})),Gr("eventOrder",{})],Kv=[Ar("dom"),Ar("components"),yi("builder",e=>({dom:e.dom,components:e.components,events:Nc([Yc(za())])}))],Jv=y("item-widget"),Qv=y([Ki({name:"widget",overrides:e=>({behaviours:sd([ef.config({store:{mode:"manual",getValue:t=>e.data,setValue:b}})])})})]),Zv=[Ar("uid"),Ar("data"),Ar("components"),Ar("dom"),Gr("autofocus",!1),Gr("ignoreFocus",!1),Jp("widgetBehaviours",[ef,hd,Sm]),Gr("domModification",{}),bl(Qv()),yi("builder",e=>{const t=ll(Jv(),e,Qv()),o=cl(Jv(),e,t.internals()),n=t=>dl(t,e,"widget").map(e=>(Sm.focusIn(e),e)),s=(t,o)=>ou(o.event.target)?A.none():e.autofocus?(o.setSource(t.element),A.none()):A.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Nc([Zc((e,t)=>{n(e).each(e=>{t.stop()})}),Uc(ma(),Wv),Uc(za(),(t,o)=>{e.autofocus?n(t):hd.focus(t)})]),behaviours:Qp(e.widgetBehaviours,[ef.config({store:{mode:"memory",initialValue:e.data}}),hd.config({ignore:e.ignoreFocus,onFocus:e=>{jv(e)}}),Sm.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:cd(),onLeft:s,onRight:s,onEscape:(t,o)=>hd.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),A.none()):A.none():(hd.focus(t),A.some(!0))})])}})],ex=kr("type",{widget:Zv,item:Xv,separator:Kv}),tx=y([Zi({factory:{sketch:e=>{const t=Sr("menu.spec item",ex,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>be(t,"uid")?t:{...t,uid:cg("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),ox=y([Hr("role"),Ar("value"),Ar("items"),Ar("dom"),Ar("components"),Gr("eventOrder",{}),Yp("menuBehaviours",[Yd,ef,Lg,Sm]),qr("movement",{mode:"menu"},kr("mode",{grid:[Si(),yi("config",(e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager}))],matrix:[yi("config",(e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager})),Ar("rowSelector"),Gr("previousSelector",A.none)],menu:[yi("config",(e,t)=>({mode:"menu",selector:"."+e.markers.item,focusManager:e.focusManager}))]})),Dr("markers",ui()),Gr("fakeFocus",!1),Gr("focusManager",Kd()),fi("onHighlight"),fi("onDehighlight"),Gr("showMenuRole",!0)]),nx=y("alloy.menu-focus"),sx=rh({name:"Menu",configFields:ox(),partFields:tx(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Kp(e.menuBehaviours,[Yd.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),ef.config({store:{mode:"memory",initialValue:e.value}}),Lg.config({find:A.some}),Sm.config(e.movement.config(e,e.movement))]),events:Nc([Uc(Gv(),(e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each(o=>{Yd.highlight(e,o),t.stop(),Ic(e,nx(),{menu:e,item:o})})}),Uc($v(),(e,t)=>{const o=t.event.item;Yd.highlight(e,o)}),Uc(qv(),(e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===Lo(o.element,"role")&&((e,t)=>{const o=ts(e.element,'[role="menuitemradio"][aria-checked="true"]');N(o,o=>{wt(o,t.element)||e.getSystem().getByDom(o).each(e=>{sv.off(e)})})})(e,o)})]),components:t,eventOrder:e.eventOrder,...e.showMenuRole?{domModification:{attributes:{role:e.role.getOr("menu")}}}:{}})}),rx=(e,t,o,n)=>fe(o,n).bind(n=>fe(e,n).bind(n=>{const s=rx(e,t,o,n);return A.some([n].concat(s))})).getOr([]),ax=e=>"prepared"===e.type?A.some(e.menu):A.none(),ix=()=>{const e=ye({}),t=ye({}),o=ye({}),n=Ye(),s=ye({}),r=e=>a(e).bind(ax),a=e=>fe(t.get(),e),i=t=>fe(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(r,a,i,l)=>{n.set(r),e.set(i),t.set(a),s.set(l);const c=((e,t)=>{const o={};ie(e,(e,t)=>{N(e,e=>{o[e]=t})});const n=t,s=ce(t,(e,t)=>({k:e,v:t})),r=le(s,(e,t)=>[t].concat(rx(o,n,s,t)));return le(o,e=>fe(r,e).getOr([e]))})(l,i);o.set(c)},expand:t=>fe(e.get(),t).map(e=>{const n=fe(o.get(),t).getOr([]);return[e].concat(n)}),refresh:e=>fe(o.get(),e),collapse:e=>fe(o.get(),e).bind(e=>e.length>1?A.some(e.slice(1)):A.none()),lookupMenu:a,lookupItem:i,otherMenus:e=>{const t=s.get();return K(re(t),e)},getPrimary:()=>n.get().bind(r),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(t,s)=>{const a=H(i(t).toArray(),e=>r(e).isSome());return fe(o.get(),t).bind(t=>{const o=X(a.concat(t));return(e=>{const t=[];for(let o=0;o<e.length;o++){const n=e[o];if(!n.isSome())return A.none();t.push(n.getOrDie())}return A.some(t)})(q(o,(t,a)=>((t,o,n)=>r(t).bind(s=>(t=>pe(e.get(),(e,o)=>e===t))(t).bind(e=>o(e).map(e=>({triggeredMenu:s,triggeringItem:e,triggeringPath:n})))))(t,s,o.slice(0,a+1)).fold(()=>Pe(n.get(),t)?[]:[A.none()],e=>[A.some(e)])))})}}},lx=ax,cx=ze("tiered-menu-item-highlight"),dx=ze("tiered-menu-item-dehighlight"),ux=y("collapse-item"),mx=sh({name:"TieredMenu",configFields:[xi("onExecute"),xi("onEscape"),bi("onTab"),bi("onShiftTab"),vi("onOpenMenu"),vi("onOpenSubmenu"),fi("onRepositionMenu"),fi("onCollapseMenu"),Gr("highlightOnOpen",Ec.HighlightMenuAndItem),Rr("data",[Ar("primary"),Ar("menus"),Ar("expansions")]),Gr("fakeFocus",!1),fi("onHighlightItem"),fi("onDehighlightItem"),fi("onHover"),gi(),Ar("dom"),Gr("navigateOnHover",!0),Gr("stayInDom",!1),Yp("tmenuBehaviours",[Sm,Yd,Lg,eg]),Gr("eventOrder",{})],apis:{collapseMenu:(e,t)=>{e.collapseMenu(t)},highlightPrimary:(e,t)=>{e.highlightPrimary(t)},repositionMenus:(e,t)=>{e.repositionMenus(t)}},factory:(e,t)=>{const o=Ye(),n=ix(),s=e=>ef.getValue(e).value,r=t=>le(e.data.menus,(e,t)=>q(e.items,e=>"separator"===e.type?[]:[e.data.value])),a=Yd.highlight,i=(t,o)=>{a(t,o),Yd.getHighlighted(o).orThunk(()=>Yd.getFirst(o)).each(n=>{e.fakeFocus?Yd.highlight(o,n):zc(t,n.element,za())})},l=(e,t)=>He(L(t,t=>e.lookupMenu(t).bind(e=>"prepared"===e.type?A.some(e.menu):A.none()))),c=(t,o,n)=>{const s=l(o,o.otherMenus(n));N(s,o=>{Kn(o.element,[e.markers.backgroundMenu]),e.stayInDom||eg.remove(t,o)})},d=(t,n)=>{const r=(t=>o.get().getOrThunk(()=>{const n={},r=ts(t.element,`.${e.markers.item}`),a=H(r,e=>"true"===Lo(e,"aria-haspopup"));return N(a,e=>{t.getSystem().getByDom(e).each(e=>{const t=s(e);n[t]=e})}),o.set(n),n}))(t);ie(r,(e,t)=>{const o=I(n,t);zo(e.element,"aria-expanded",o)})},u=(t,o,n)=>A.from(n[0]).bind(s=>o.lookupMenu(s).bind(s=>{if("notbuilt"===s.type)return A.none();{const r=s.menu,a=l(o,n.slice(1));return N(a,t=>{$n(t.element,e.markers.backgroundMenu)}),Xo(r.element)||eg.append(t,Mg(r)),Kn(r.element,[e.markers.backgroundMenu]),i(t,r),c(t,o,n),A.some(r)}}));let m;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(m||(m={}));const g=(t,o,r=m.HighlightSubmenu)=>{if(o.hasConfigured(op)&&op.isDisabled(o))return A.some(o);{const a=s(o);return n.expand(a).bind(s=>(d(t,s),A.from(s[0]).bind(a=>n.lookupMenu(a).bind(i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const s=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,s),s}return o.menu})(t,a,i);return Xo(l.element)||eg.append(t,Mg(l)),e.onOpenSubmenu(t,o,l,X(s)),r===m.HighlightSubmenu?(Yd.highlightFirst(l),u(t,n,s)):(Yd.dehighlightAll(l),A.some(o))}))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind(s=>(d(t,s),u(t,n,s).map(n=>(e.onCollapseMenu(t,o,n),n))))},h=t=>(o,n)=>Ln(n.getSource(),`.${e.markers.item}`).bind(e=>o.getSystem().getByDom(e).toOptional().bind(e=>t(o,e).map(E))),f=Nc([Uc(nx(),(e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each(()=>{const o=t.event.menu;Yd.highlight(e,o);const r=s(t.event.item);n.refresh(r).each(t=>c(e,n,t))})}),Zc((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each(o=>{0===s(o).indexOf("collapse-item")&&p(t,o),g(t,o,m.HighlightSubmenu).fold(()=>{e.onExecute(t,o)},b)})}),Kc((t,o)=>{(t=>{const o=((t,o,n)=>le(n,(n,s)=>{const r=()=>sx.sketch({...n,value:s,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{Ic(e,cx,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{Ic(e,dx,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?Jd():Kd()});return s===o?{type:"prepared",menu:t.getSystem().build(r())}:{type:"notbuilt",nbMenu:r}}))(t,e.data.primary,e.data.menus),s=r();return n.setContents(e.data.primary,o,e.data.expansions,s),n.getPrimary()})(t).each(o=>{eg.append(t,Mg(o)),e.onOpenMenu(t,o),e.highlightOnOpen===Ec.HighlightMenuAndItem?i(t,o):e.highlightOnOpen===Ec.HighlightJustMenu&&a(t,o)})}),Uc(cx,(t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)}),Uc(dx,(t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)}),...e.navigateOnHover?[Uc($v(),(t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind(t=>(d(e,t),u(e,n,t)))})(t,r),g(t,r,m.HighlightParent),e.onHover(t,r)})]:[]]),v=e=>Yd.getHighlighted(e).bind(Yd.getHighlighted),x={collapseMenu:e=>{v(e).each(t=>{p(e,t)})},highlightPrimary:e=>{n.getPrimary().each(t=>{i(e,t)})},repositionMenus:t=>{const o=n.getPrimary().bind(e=>v(t).bind(e=>{const t=s(e),o=he(n.getMenus()),r=He(L(o,lx));return n.getTriggeringPath(t,e=>((e,t,o)=>se(t,e=>{if(!e.getSystem().isConnected())return A.none();const t=Yd.getCandidates(e);return j(t,e=>s(e)===o)}))(0,r,e))}).map(t=>({primary:e,triggeringPath:t})));o.fold(()=>{(e=>A.from(e.components()[0]).filter(e=>"menu"===Lo(e.element,"role")))(t).each(o=>{e.onRepositionMenu(t,o,[])})},({primary:o,triggeringPath:n})=>{e.onRepositionMenu(t,o,n)})}};return{uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Kp(e.tmenuBehaviours,[Sm.config({mode:"special",onRight:h((e,t)=>ou(t.element)?A.none():g(e,t,m.HighlightSubmenu)),onLeft:h((e,t)=>ou(t.element)?A.none():p(e,t)),onEscape:h((t,o)=>p(t,o).orThunk(()=>e.onEscape(t,o).map(()=>t))),onTab:e.onTab,onShiftTab:e.onShiftTab,focusIn:(e,t)=>{n.getPrimary().each(t=>{zc(e,t.element,za())})}}),Yd.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),Lg.config({find:e=>Yd.getHighlighted(e)}),eg.config({})]),eventOrder:e.eventOrder,apis:x,events:f}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:ta(e,t),expansions:{}}),collapseItem:e=>({value:ze(ux()),meta:{text:e}})}}),gx=y("sink"),px=y(Qi({name:gx(),overrides:y({dom:{tag:"div"},behaviours:sd([sb.config({useFixed:E})]),events:Nc([qc(ha()),qc(la()),qc(xa())])})})),hx=ur([Gr("isExtraPart",T),$r("fireEventInstead",[Gr("event",Ya())])]),fx=e=>{const t=Sr("Dismissal",hx,e);return{[_d()]:{schema:ur([Ar("target")]),onReceive:(e,o)=>{_b.isOpen(e)&&(_b.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold(()=>_b.close(e),t=>Fc(e,t.event)))}}}},bx=ur([$r("fireEventInstead",[Gr("event",Xa())]),Ir("doReposition")]),vx=e=>{const t=Sr("Reposition",bx,e);return{[Td()]:{onReceive:e=>{_b.isOpen(e)&&t.fireEventInstead.fold(()=>t.doReposition(e),t=>Fc(e,t.event))}}}},xx=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",s=e.getAnchorOverrides();return e.layouts.fold(()=>({type:n,hotspot:o,overrides:s}),e=>({type:n,hotspot:o,overrides:s,layouts:e}))},yx=(e,t,o,n,s,r,a)=>{const i=((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=Cx(n,e),c=(e,t)=>(hd.focus(n),Ic(n,"keydown",{raw:t.event.raw}),_b.close(s),A.some(!0));return i.map(t=>t.bind(t=>{const i=t.menus[t.primary];return A.from(i).each(t=>{e.listRole.each(e=>{t.role=e})}),A.from(mx.sketch({...r.menu(),uid:cg(""),data:t,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();sb.position(n,t,{anchor:o}),_b.decloak(s)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();sb.position(n,o,{anchor:{type:"submenu",item:t}}),_b.decloak(s)},onRepositionMenu:(e,t,n)=>{const s=l().getOrDie();sb.position(s,t,{anchor:o}),N(n,e=>{sb.position(s,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})})},onEscape:()=>(hd.focus(n),_b.close(s),A.some(!0)),onTab:c,onShiftTab:c}))}))})(e,t,xx(e,o),o,n,s,a);return i.map(e=>(e.fold(()=>{_b.isOpen(n)&&_b.close(n)},e=>{_b.cloak(n),_b.open(n,e),r(n)}),n))},wx=(e,t,o,n,s,r,a)=>(_b.close(n),_e(n)),Sx=(e,t,o,n,s,r)=>{const a=Ug.getCoupled(o,"sandbox");return(_b.isOpen(a)?wx:yx)(e,t,o,a,n,s,r)},Cx=(e,t)=>e.getSystem().getByUid(t.uid+"-"+gx()).map(e=>()=>Ae.value(e)).getOrThunk(()=>t.lazySink.fold(()=>()=>Ae.error(new Error("No internal sink is specified, nor could an external sink be found")),t=>()=>t(e))),kx=e=>{_b.getState(e).each(e=>{mx.repositionMenus(e)})},Ox=(e,t,o)=>{const n=Lv(),s=Cx(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id}},behaviours:Qp(e.sandboxBehaviours,[ef.config({store:{mode:"memory",initialValue:t}}),_b.config({onOpen:(s,r)=>{const a=xx(e,t);n.link(t.element),e.matchWidth&&((e,t,o)=>{const n=Lg.getCurrent(t).getOr(t),s=bn(e.element);o?en(n.element,"min-width",s+"px"):((e,t)=>{fn.set(e,t)})(n.element,s)})(a.hotspot,r,e.useMinWidth),e.onOpen(a,s,r),void 0!==o&&void 0!==o.onOpen&&o.onOpen(s,r),mx.repositionMenus(r)},onClose:(e,r)=>{n.unlink(t.element),s().getOr(r).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Nv(o,n)||Nv(t,n),getAttachPoint:()=>s().getOrDie()}),Lg.config({find:e=>_b.getState(e).bind(e=>Lg.getCurrent(e))}),ib.config({channels:{...fx({isExtraPart:T}),...vx({doReposition:kx})}})])}},_x=()=>[Gr("sandboxClasses",[]),Jp("sandboxBehaviours",[Lg,ib,_b,ef])],Tx=y([Ar("dom"),Ar("fetch"),fi("onOpen"),bi("onExecute"),Gr("getHotspot",A.some),Gr("getAnchorOverrides",y({})),yf(),Yp("dropdownBehaviours",[sv,Ug,Sm,hd]),Ar("toggleClass"),Gr("eventOrder",{}),Lr("lazySink"),Gr("matchWidth",!1),Gr("useMinWidth",!1),Lr("role"),Lr("listRole")].concat(_x())),Ex=y([Ji({schema:[gi(),Gr("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),px()]),Ax=rh({name:"Dropdown",configFields:Tx(),partFields:Ex(),factory:(e,t,o,n)=>{const s=e=>{_b.getState(e).each(e=>{mx.highlightPrimary(e)})},r=(t,o,s)=>Sx(e,w,t,n,o,s),a={expand:e=>{sv.isOn(e)||r(e,b,Ec.HighlightNone).get(b)},open:e=>{sv.isOn(e)||r(e,b,Ec.HighlightMenuAndItem).get(b)},refetch:t=>Ug.getExistingCoupled(t,"sandbox").fold(()=>r(t,b,Ec.HighlightMenuAndItem).map(b),o=>yx(e,w,t,o,n,b,Ec.HighlightMenuAndItem).map(b)),isOpen:sv.isOn,close:e=>{sv.isOn(e)&&r(e,b,Ec.HighlightMenuAndItem).get(b)},repositionMenus:e=>{sv.isOn(e)&&(e=>{const t=Ug.getCoupled(e,"sandbox");kx(t)})(e)}},i=(e,t)=>(Rc(e),A.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Kp(e.dropdownBehaviours,[sv.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),Ug.config({others:{sandbox:t=>Ox(e,t,{onOpen:()=>sv.on(t),onClose:()=>sv.off(t)})}}),Sm.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(Ax.isOpen(e)){const t=Ug.getCoupled(e,"sandbox");s(t)}else Ax.open(e);return A.some(!0)},onEscape:(e,t)=>Ax.isOpen(e)?(Ax.close(e),A.some(!0)):A.none()}),hd.config({})]),events:Mv(A.some(e=>{r(e,s,Ec.HighlightMenuAndItem).get(b)})),eventOrder:{...e.eventOrder,[Ra()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":e.listRole.getOr("true"),...e.role.fold(()=>({}),e=>({role:e})),..."button"===e.dom.tag?{type:fe(e.dom,"attributes").bind(e=>fe(e,"type")).getOr("button")}:{}}}}},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)}}),Dx="form",Mx=[Yp("formBehaviours",[ef])],Bx=e=>"<alloy.field."+e+">",Fx=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Kp(e.formBehaviours,[ef.config({store:{mode:"manual",getValue:t=>{const o=gl(t,e);return le(o,(e,t)=>e().bind(e=>{return o=Lg.getCurrent(e),n=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ni(e.element)),o.fold(()=>Ae.error(n),Ae.value);var o,n}).map(ef.getValue))},setValue:(t,o)=>{ie(o,(o,n)=>{dl(t,e,n).each(e=>{Lg.getCurrent(e).each(e=>{ef.setValue(e,o)})})})}}})]),apis:{getField:(t,o)=>dl(t,e,o).bind(Lg.getCurrent)}}),Ix={getField:_m((e,t,o)=>e.getField(t,o)),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),rl(Dx,Bx(t),o)),record:y(e)}})(),o=e(t),n=t.record(),s=L(n,e=>Ki({name:e,pname:Bx(e)}));return eh(Dx,Mx,s,Fx,o)}},Rx=y([Ar("dom"),Gr("shell",!0),Yp("toolbarBehaviours",[eg])]),zx=y([Qi({name:"groups",overrides:()=>({behaviours:sd([eg.config({})])})})]),Vx=rh({name:"Toolbar",configFields:Rx(),partFields:zx(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[eg.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Kp(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(t,o)=>{var n;(n=t,e.shell?A.some(n):dl(n,e,"groups")).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=>{eg.set(e,o)})},refresh:b},domModification:{attributes:{role:"toolbar"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),Lx=y([pi(["toggledClass"]),Ar("lazySink"),Ir("fetch"),Wr("getBounds"),$r("fireDismissalEventInstead",[Gr("event",Ya())]),yf(),fi("onToggled")]),Nx=y([Ji({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:sd([sv.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Ji({factory:Vx,schema:Rx(),name:"toolbar",overrides:e=>({toolbarBehaviours:sd([Sm.config({mode:"cyclic",onEscape:t=>(dl(t,e,"button").each(hd.focus),A.none())})])})})]),Px=Ye(),Hx=(e,t)=>{const o=Ug.getCoupled(e,"toolbarSandbox");_b.isOpen(o)?_b.close(o):_b.open(o,t.toolbar())},Ux=(e,t,o,n)=>{const s=o.getBounds.map(e=>e()),r=o.lazySink(e).getOrDie();sb.positionWithinBounds(r,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:kc()}}},s)},Wx=(e,t,o,n,s)=>{Vx.setGroups(t,s),Ux(e,t,o,n),sv.on(e)},jx=rh({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Bv.sketch({...n.button(),action:e=>{Hx(e,n)},buttonBehaviours:Qp({dump:n.button().buttonBehaviours},[Ug.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Lv();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:sd([Sm.config({mode:"special",onEscape:e=>(_b.close(e),A.some(!0))}),_b.config({onOpen:(s,r)=>{const a=Px.get().getOr(!1);o.fetch().get(s=>{Wx(e,r,o,t.layouts,s),n.link(e.element),a||Sm.focusIn(r)})},onClose:()=>{sv.off(e),Px.get().getOr(!1)||hd.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Nv(o,n)||Nv(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),ib.config({channels:{...fx({isExtraPart:T,...o.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...vx({doReposition:()=>{_b.getState(Ug.getCoupled(e,"toolbarSandbox")).each(n=>{Ux(e,n,o,t.layouts)})}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{_b.getState(Ug.getCoupled(t,"toolbarSandbox")).each(s=>{Wx(t,s,e,o.layouts,n)})},reposition:t=>{_b.getState(Ug.getCoupled(t,"toolbarSandbox")).each(n=>{Ux(t,n,e,o.layouts)})},toggle:e=>{Hx(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{Px.set(!0),Hx(e,t),Px.clear()})(e,n)},getToolbar:e=>_b.getState(Ug.getCoupled(e,"toolbarSandbox")),isOpen:e=>_b.isOpen(Ug.getCoupled(e,"toolbarSandbox"))}}),configFields:Lx(),partFields:Nx(),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)}}),$x=y([Gr("prefix","form-field"),Yp("fieldBehaviours",[Lg,ef])]),Gx=y([Qi({schema:[Ar("dom")],name:"label"}),Qi({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[Ar("text")],name:"aria-descriptor"}),Ki({factory:{sketch:e=>{const t=((e,t)=>{const o={};return ie(e,(e,n)=>{I(t,n)||(o[n]=e)}),o})(e,["factory"]);return e.factory.sketch(t)}},schema:[Ar("factory")],name:"field"})]),qx=rh({name:"FormField",configFields:$x(),partFields:Gx(),factory:(e,t,o,n)=>{const s=Kp(e.fieldBehaviours,[Lg.config({find:t=>dl(t,e,"field")}),ef.config({store:{mode:"manual",getValue:e=>Lg.getCurrent(e).bind(ef.getValue),setValue:(e,t)=>{Lg.getCurrent(e).each(e=>{ef.setValue(e,t)})}}})]),r=Nc([Kc((t,o)=>{const n=ml(t,e,["label","field","aria-descriptor"]);n.field().each(t=>{const o=ze(e.prefix);n.label().each(e=>{zo(e.element,"for",o),zo(t.element,"id",o)}),n["aria-descriptor"]().each(o=>{const n=ze(e.prefix);zo(o.element,"id",n),zo(t.element,"aria-describedby",n)})})})]),a={getField:t=>dl(t,e,"field"),getLabel:t=>dl(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:s,events:r,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}}),Yx=y([Gr("field1Name","field1"),Gr("field2Name","field2"),vi("onLockedChange"),pi(["lockClass"]),Gr("locked",!1),Jp("coupledFieldBehaviours",[Lg,ef]),Qr("onInput",b)]),Xx=(e,t)=>Ki({factory:qx,name:e,overrides:e=>({fieldBehaviours:sd([dd("coupled-input-behaviour",[Uc(ba(),o=>{((e,t,o)=>dl(e,t,o).bind(Lg.getCurrent))(o,e,t).each(t=>{dl(o,e,"lock").each(n=>{sv.isOn(n)&&e.onLockedChange(o,t,n),e.onInput(o)})})})])])})}),Kx=y([Xx("field1","field2"),Xx("field2","field1"),Ki({factory:Bv,schema:[Ar("dom")],name:"lock",overrides:e=>({buttonBehaviours:sd([sv.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),Jx=rh({name:"FormCoupledInputs",configFields:Yx(),partFields:Kx(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Qp(e.coupledFieldBehaviours,[Lg.config({find:A.some}),ef.config({store:{mode:"manual",getValue:t=>{const o=hl(t,e,["field1","field2"]);return{[e.field1Name]:ef.getValue(o.field1()),[e.field2Name]:ef.getValue(o.field2())}},setValue:(t,o)=>{const n=hl(t,e,["field1","field2"]);ve(o,e.field1Name)&&ef.setValue(n.field1(),o[e.field1Name]),ve(o,e.field2Name)&&ef.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>dl(t,e,"field1"),getField2:t=>dl(t,e,"field2"),getLock:t=>dl(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),Qx=sh({name:"HtmlSelect",configFields:[Ar("options"),Yp("selectBehaviours",[hd,ef]),Gr("selectClasses",[]),Gr("selectAttributes",{}),Lr("data")],factory:(e,t)=>{const o=L(e.options,e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}})),n=e.data.map(e=>ta("initialValue",e)).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Kp(e.selectBehaviours,[hd.config({}),ef.config({store:{mode:"manual",getValue:e=>Qn(e.element),setValue:(t,o)=>{const n=te(e.options);j(e.options,e=>e.value===o).isSome()?Zn(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each(e=>Zn(t.element,e.value))},...n}})])}}}),Zx=sh({name:"InlineView",configFields:[Ar("lazySink"),fi("onShow"),fi("onHide"),Wr("onEscape"),Yp("inlineBehaviours",[_b,ef,ib]),$r("fireDismissalEventInstead",[Gr("event",Ya())]),$r("fireRepositionEventInstead",[Gr("event",Xa())]),Gr("getRelated",A.none),Gr("isExtraPart",T),Gr("eventOrder",A.none)],factory:(e,t)=>{const o=(t,o,n,s)=>{const r=e.lazySink(t).getOrDie();_b.openWhileCloaked(t,o,()=>sb.positionWithinBounds(r,t,n,s())),ef.setValue(t,A.some({mode:"position",config:n,getBounds:s}))},n=(t,o,n,s)=>{const r=((e,t,o,n,s)=>{const r=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>Ql(),onRtl:()=>Zl()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return mx.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(_b.close(t),e.onEscape.map(e=>e(t)),A.some(!0)),onExecute:()=>A.some(!0),onOpenMenu:(e,t)=>{sb.positionWithinBounds(r().getOrDie(),t,o,s())},onOpenSubmenu:(e,t,o,n)=>{const s=r().getOrDie();sb.position(s,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=r().getOrDie();sb.positionWithinBounds(a,t,o,s()),N(n,e=>{const t=i(e.triggeringPath);sb.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})})}})})(e,t,o,n,s);_b.open(t,r),ef.setValue(t,A.some({mode:"menu",menu:r}))},s=t=>{_b.isOpen(t)&&ef.getValue(t).each(o=>{switch(o.mode){case"menu":_b.getState(t).each(mx.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();sb.positionWithinBounds(n,t,o.config,o.getBounds())}})},r={setContent:(e,t)=>{_b.setContent(e,t)},showAt:(e,t,n)=>{const s=A.none;o(e,t,n,s)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,A.none)},showMenuWithinBounds:n,hide:e=>{_b.isOpen(e)&&(ef.setValue(e,A.none()),_b.close(e))},getContent:e=>_b.getState(e),reposition:s,isOpen:_b.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Kp(e.inlineBehaviours,[_b.config({isPartOf:(t,o,n)=>Nv(o,n)||((t,o)=>e.getRelated(t).exists(e=>Nv(e,o)))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),ef.config({store:{mode:"memory",initialValue:A.none()}}),ib.config({channels:{...fx({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...vx({...e.fireRepositionEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({}),doReposition:s})}})]),eventOrder:e.eventOrder,apis:r}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,s)=>{e.showWithinBounds(t,o,n,s)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,s)=>{e.showMenuWithinBounds(t,o,n,s)},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)}}}),ey=y([Xr("type","text"),Lr("data"),Gr("inputAttributes",{}),Gr("inputStyles",{}),Gr("tag","input"),Gr("inputClasses",[]),fi("onSetValue"),Qr("fromInputValue",w),Qr("toInputValue",w),Gr("styles",{}),Gr("eventOrder",{}),Yp("inputBehaviours",[ef,hd]),Gr("selectOnFocus",!0)]),ty=e=>sd([hd.config({onFocus:e.selectOnFocus?t=>{const o=t.element,n=Qn(o);"range"!==e.type&&o.dom.setSelectionRange(0,n.length)}:b})]),oy=e=>({...ty(e),...Kp(e.inputBehaviours,[ef.config({store:{mode:"manual",...e.data.map(e=>({initialValue:e})).getOr({}),getValue:t=>e.fromInputValue(Qn(t.element)),setValue:(t,o)=>{Qn(t.element)!==o&&Zn(t.element,e.toInputValue(o))}},onSetValue:e.onSetValue})])}),ny=e=>({tag:e.tag,attributes:{type:e.type,...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),sy=sh({name:"Input",configFields:ey(),factory:(e,t)=>({uid:e.uid,dom:ny(e),components:[],behaviours:oy(e),eventOrder:e.eventOrder})}),ry=nl(Jv(),Qv()),ay=y([Ar("lazySink"),Lr("dragBlockClass"),Qr("getBounds",Ms),Gr("useTabstopAt",E),Gr("firstTabstop",0),Gr("eventOrder",{}),Kr("role","dialog",["dialog","alertdialog"]),Yp("modalBehaviours",[Sm]),bi("onExecute"),xi("onEscape")]),iy={sketch:w},ly=y([Qi({name:"draghandle",overrides:(e,t)=>({behaviours:sd([Bh.config({mode:"mouse",getTarget:e=>In(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})])})}),Ki({schema:[Ar("dom")],name:"title"}),Ki({factory:iy,schema:[Ar("dom")],name:"close"}),Ki({factory:iy,schema:[Ar("dom")],name:"body"}),Qi({factory:iy,schema:[Ar("dom")],name:"footer"}),Ji({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[Gr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Gr("components",[])],name:"blocker"})]),cy=rh({name:"ModalDialog",configFields:ay(),partFields:ly(),factory:(e,t,o,n)=>{const s=Ye(),r=ze("modal-events"),a={...e.eventOrder,[Ga()]:[r].concat(e.eventOrder["alloy.system.attached"]||[])},i=Pt();return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{s.set(t);const o=e.lazySink(t).getOrDie(),r=n.blocker(),a=o.getSystem().build({...r,components:r.components.concat([Mg(t)]),behaviours:sd([hd.config({}),dd("dialog-blocker-events",[Xc(ga(),()=>{Rg.isBlocked(t)||Sm.focusIn(t)})])])});Fm(o,a),Sm.focusIn(t)},hide:e=>{s.clear(),to(e.element).each(t=>{e.getSystem().getByDom(t).each(e=>{zm(e)})})},getBody:t=>ul(t,e,"body"),getFooter:t=>dl(t,e,"footer"),setIdle:e=>{Rg.unblock(e)},setBusy:(e,t)=>{Rg.block(e,t)}},eventOrder:a,domModification:{attributes:{role:e.role,"aria-modal":"true"}},behaviours:Kp(e.modalBehaviours,[eg.config({}),Sm.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),Rg.config({getRoot:s.get}),dd(r,[Kc(t=>{const o=ul(t,e,"title").element,n=(e=>e.dom.textContent)(o);g(n)&&""!==n&&(i.os.isMacOS()?zo(t.element,"aria-label",n):((e,t)=>{const o=No(e,"id").fold(()=>{const e=ze("dialog-label");return zo(t,"id",e),e},w);zo(e,"aria-labelledby",o)})(t.element,o))})])])}},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)}}}),dy=Qi({schema:[Ar("dom")],name:"label"}),uy=e=>Qi({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold(()=>({}),e=>({events:Nc([Wc(sa(),(t,o,n)=>e(t,n),[t]),Wc(la(),(t,o,n)=>e(t,n),[t]),Wc(ca(),(t,o,n)=>{n.mouseIsDown.get()&&e(t,n)},[t])])}))}),my=uy("top-left"),gy=uy("top"),py=uy("top-right"),hy=uy("right"),fy=uy("bottom-right"),by=uy("bottom"),vy=uy("bottom-left"),xy=uy("left"),yy=Ki({name:"thumb",defaults:y({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Nc([$c(sa(),e,"spectrum"),$c(ra(),e,"spectrum"),$c(aa(),e,"spectrum"),$c(la(),e,"spectrum"),$c(ca(),e,"spectrum"),$c(ua(),e,"spectrum")])})}),wy=e=>Rd(e.event),Sy=Ki({schema:[Tr("mouseIsDown",()=>ye(!1))],name:"spectrum",overrides:e=>{const t=e.model.manager,o=(o,n)=>t.getValueFromEvent(n).map(n=>t.setValueFrom(o,e,n));return{behaviours:sd([Sm.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,wy(n)),onRight:(o,n)=>t.onRight(o,e,wy(n)),onUp:(o,n)=>t.onUp(o,e,wy(n)),onDown:(o,n)=>t.onDown(o,e,wy(n))}),Kb.config({}),hd.config({})]),events:Nc([Uc(sa(),o),Uc(ra(),o),Uc(la(),o),Uc(ca(),(t,n)=>{e.mouseIsDown.get()&&o(t,n)})])}}});var Cy=[dy,xy,hy,gy,by,my,py,vy,fy,yy,Sy];const ky=y("slider.change.value"),Oy=e=>{const t=e.event.raw;if((e=>-1!==e.type.indexOf("touch"))(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?A.some(e.touches[0]).map(e=>yn(e.clientX,e.clientY)):A.none()}{const e=t;return void 0!==e.clientX?A.some(e).map(e=>yn(e.clientX,e.clientY)):A.none()}},_y=e=>e.model.minX,Ty=e=>e.model.minY,Ey=e=>e.model.minX-1,Ay=e=>e.model.minY-1,Dy=e=>e.model.maxX,My=e=>e.model.maxY,By=e=>e.model.maxX+1,Fy=e=>e.model.maxY+1,Iy=(e,t,o)=>t(e)-o(e),Ry=e=>Iy(e,Dy,_y),zy=e=>Iy(e,My,Ty),Vy=e=>Ry(e)/2,Ly=e=>zy(e)/2,Ny=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,Py=e=>e.snapToGrid,Hy=e=>e.snapStart,Uy=e=>e.rounded,Wy=(e,t)=>void 0!==e[t+"-edge"],jy=e=>Wy(e,"left"),$y=e=>Wy(e,"right"),Gy=e=>Wy(e,"top"),qy=e=>Wy(e,"bottom"),Yy=e=>e.model.value.get(),Xy=(e,t)=>({x:e,y:t}),Ky=(e,t)=>{Ic(e,ky(),{value:t})},Jy=(e,t,o,n)=>e<t?e:e>o?o:e===t?t-1:Math.max(t,e-n),Qy=(e,t,o,n)=>e>o?e:e<t?t:e===o?o+1:Math.min(o,e+n),Zy=(e,t,o)=>Math.max(t,Math.min(o,e)),ew=e=>{const{min:t,max:o,range:n,value:s,step:r,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:m,screenRange:g}=e,p=c?t-1:t,h=d?o+1:o;if(s<u)return p;if(s>m)return h;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(s,u,m),c=Zy(e/g*n+t,p,h);return a&&c>=t&&c<=o?((e,t,o,n,s)=>s.fold(()=>{const s=e-t,r=Math.round(s/n)*n;return Zy(t+r,t-1,o+1)},t=>{const s=(e-t)%n,r=Math.round(s/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+r)*n;return Math.max(t,l)}))(c,t,o,r,i):l?Math.round(c):c}},tw=e=>{const{min:t,max:o,range:n,value:s,hasMinEdge:r,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return s<t?r?0:c:s>o?a?i:d:(s-t)/n*l},ow="top",nw="right",sw="bottom",rw="left",aw=e=>e.element.dom.getBoundingClientRect(),iw=(e,t)=>e[t],lw=e=>{const t=aw(e);return iw(t,rw)},cw=e=>{const t=aw(e);return iw(t,nw)},dw=e=>{const t=aw(e);return iw(t,ow)},uw=e=>{const t=aw(e);return iw(t,sw)},mw=e=>{const t=aw(e);return iw(t,"width")},gw=e=>{const t=aw(e);return iw(t,"height")},pw=(e,t,o)=>(e+t)/2-o,hw=(e,t)=>{const o=aw(e),n=aw(t),s=iw(o,rw),r=iw(o,nw),a=iw(n,rw);return pw(s,r,a)},fw=(e,t)=>{const o=aw(e),n=aw(t),s=iw(o,ow),r=iw(o,sw),a=iw(n,ow);return pw(s,r,a)},bw=(e,t)=>{Ic(e,ky(),{value:t})},vw=(e,t,o)=>{const n={min:_y(t),max:Dy(t),range:Ry(t),value:o,step:Ny(t),snap:Py(t),snapStart:Hy(t),rounded:Uy(t),hasMinEdge:jy(t),hasMaxEdge:$y(t),minBound:lw(e),maxBound:cw(e),screenRange:mw(e)};return ew(n)},xw=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?Qy:Jy)(Yy(o),_y(o),Dy(o),Ny(o,n));return bw(t,s),A.some(s)})(e,t,o,n).map(E),yw=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=mw(e),a=n.bind(t=>A.some(hw(t,e))).getOr(0),i=s.bind(t=>A.some(hw(t,e))).getOr(r),l={min:_y(t),max:Dy(t),range:Ry(t),value:o,hasMinEdge:jy(t),hasMaxEdge:$y(t),minBound:lw(e),maxBound:cw(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return tw(l)})(t,r,o,n,s);return lw(t)-lw(e)+a},ww=xw(-1),Sw=xw(1),Cw=A.none,kw=A.none,Ow={"top-left":A.none(),top:A.none(),"top-right":A.none(),right:A.some((e,t)=>{Ky(e,By(t))}),"bottom-right":A.none(),bottom:A.none(),"bottom-left":A.none(),left:A.some((e,t)=>{Ky(e,Ey(t))})};var _w=Object.freeze({__proto__:null,edgeActions:Ow,findPositionOfValue:yw,findValueOfOffset:vw,getValueFromEvent:e=>Oy(e).map(e=>e.left),onDown:kw,onLeft:ww,onRight:Sw,onUp:Cw,setPositionFromValue:(e,t,o,n)=>{const s=Yy(o),r=yw(e,n.getSpectrum(e),s,n.getLeftEdge(e),n.getRightEdge(e),o),a=bn(t.element)/2;en(t.element,"left",r-a+"px")},setToMax:(e,t)=>{const o=Dy(t);bw(e,o)},setToMin:(e,t)=>{const o=_y(t);bw(e,o)},setValueFrom:(e,t,o)=>{const n=vw(e,t,o);return bw(e,n),n}});const Tw=(e,t)=>{Ic(e,ky(),{value:t})},Ew=(e,t,o)=>{const n={min:Ty(t),max:My(t),range:zy(t),value:o,step:Ny(t),snap:Py(t),snapStart:Hy(t),rounded:Uy(t),hasMinEdge:Gy(t),hasMaxEdge:qy(t),minBound:dw(e),maxBound:uw(e),screenRange:gw(e)};return ew(n)},Aw=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?Qy:Jy)(Yy(o),Ty(o),My(o),Ny(o,n));return Tw(t,s),A.some(s)})(e,t,o,n).map(E),Dw=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=gw(e),a=n.bind(t=>A.some(fw(t,e))).getOr(0),i=s.bind(t=>A.some(fw(t,e))).getOr(r),l={min:Ty(t),max:My(t),range:zy(t),value:o,hasMinEdge:Gy(t),hasMaxEdge:qy(t),minBound:dw(e),maxBound:uw(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return tw(l)})(t,r,o,n,s);return dw(t)-dw(e)+a},Mw=A.none,Bw=A.none,Fw=Aw(-1),Iw=Aw(1),Rw={"top-left":A.none(),top:A.some((e,t)=>{Ky(e,Ay(t))}),"top-right":A.none(),right:A.none(),"bottom-right":A.none(),bottom:A.some((e,t)=>{Ky(e,Fy(t))}),"bottom-left":A.none(),left:A.none()};var zw=Object.freeze({__proto__:null,edgeActions:Rw,findPositionOfValue:Dw,findValueOfOffset:Ew,getValueFromEvent:e=>Oy(e).map(e=>e.top),onDown:Iw,onLeft:Mw,onRight:Bw,onUp:Fw,setPositionFromValue:(e,t,o,n)=>{const s=Yy(o),r=Dw(e,n.getSpectrum(e),s,n.getTopEdge(e),n.getBottomEdge(e),o),a=gn(t.element)/2;en(t.element,"top",r-a+"px")},setToMax:(e,t)=>{const o=My(t);Tw(e,o)},setToMin:(e,t)=>{const o=Ty(t);Tw(e,o)},setValueFrom:(e,t,o)=>{const n=Ew(e,t,o);return Tw(e,n),n}});const Vw=(e,t)=>{Ic(e,ky(),{value:t})},Lw=(e,t)=>({x:e,y:t}),Nw=(e,t)=>(o,n,s)=>((e,t,o,n,s)=>{const r=e>0?Qy:Jy,a=t?Yy(n).x:r(Yy(n).x,_y(n),Dy(n),Ny(n,s)),i=t?r(Yy(n).y,Ty(n),My(n),Ny(n,s)):Yy(n).y;return Vw(o,Lw(a,i)),A.some(a)})(e,t,o,n,s).map(E),Pw=Nw(-1,!1),Hw=Nw(1,!1),Uw=Nw(-1,!0),Ww=Nw(1,!0),jw={"top-left":A.some((e,t)=>{Ky(e,Xy(Ey(t),Ay(t)))}),top:A.some((e,t)=>{Ky(e,Xy(Vy(t),Ay(t)))}),"top-right":A.some((e,t)=>{Ky(e,Xy(By(t),Ay(t)))}),right:A.some((e,t)=>{Ky(e,Xy(By(t),Ly(t)))}),"bottom-right":A.some((e,t)=>{Ky(e,Xy(By(t),Fy(t)))}),bottom:A.some((e,t)=>{Ky(e,Xy(Vy(t),Fy(t)))}),"bottom-left":A.some((e,t)=>{Ky(e,Xy(Ey(t),Fy(t)))}),left:A.some((e,t)=>{Ky(e,Xy(Ey(t),Ly(t)))})};var $w=Object.freeze({__proto__:null,edgeActions:jw,getValueFromEvent:e=>Oy(e),onDown:Ww,onLeft:Pw,onRight:Hw,onUp:Uw,setPositionFromValue:(e,t,o,n)=>{const s=Yy(o),r=yw(e,n.getSpectrum(e),s.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=Dw(e,n.getSpectrum(e),s.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=bn(t.element)/2,l=gn(t.element)/2;en(t.element,"left",r-i+"px"),en(t.element,"top",a-l+"px")},setToMax:(e,t)=>{const o=Dy(t),n=My(t);Vw(e,Lw(o,n))},setToMin:(e,t)=>{const o=_y(t),n=Ty(t);Vw(e,Lw(o,n))},setValueFrom:(e,t,o)=>{const n=vw(e,t,o.left),s=Ew(e,t,o.top),r=Lw(n,s);return Vw(e,r),r}});const Gw=rh({name:"Slider",configFields:[Gr("stepSize",1),Gr("speedMultiplier",10),Gr("onChange",b),Gr("onChoose",b),Gr("onInit",b),Gr("onDragStart",b),Gr("onDragEnd",b),Gr("snapToGrid",!1),Gr("rounded",!0),Lr("snapStart"),Dr("model",kr("mode",{x:[Gr("minX",0),Gr("maxX",100),Tr("value",e=>ye(e.mode.minX)),Ar("getInitialValue"),yi("manager",_w)],y:[Gr("minY",0),Gr("maxY",100),Tr("value",e=>ye(e.mode.minY)),Ar("getInitialValue"),yi("manager",zw)],xy:[Gr("minX",0),Gr("maxX",100),Gr("minY",0),Gr("maxY",100),Tr("value",e=>ye({x:e.mode.minX,y:e.mode.minY})),Ar("getInitialValue"),yi("manager",$w)]})),Yp("sliderBehaviours",[Sm,ef]),Tr("mouseIsDown",()=>ye(!1))],partFields:Cy,factory:(e,t,o,n)=>{const s=t=>ul(t,e,"thumb"),r=t=>ul(t,e,"spectrum"),a=t=>dl(t,e,"left-edge"),i=t=>dl(t,e,"right-edge"),l=t=>dl(t,e,"top-edge"),c=t=>dl(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:r})},g=(e,t)=>{d.value.set(t);const o=s(e);m(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&dl(t,e,"thumb").each(o=>{const n=d.value.get();e.onChoose(t,o,n)})},h=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,s(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,s(t)),p(t)},b=t=>{dl(t,e,"spectrum").map(Sm.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Kp(e.sliderBehaviours,[Sm.config({mode:"special",focusIn:b}),ef.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),ib.config({channels:{[Ed()]:{onReceive:p}}})]),events:Nc([Uc(ky(),(t,o)=>{((t,o)=>{g(t,o);const n=s(t);e.onChange(t,n,o),A.some(!0)})(t,o.event.value)}),Kc((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=s(t);m(t,a);const i=r(t);e.onInit(t,a,i,d.value.get())}),Uc(sa(),h),Uc(aa(),f),Uc(la(),(e,t)=>{b(e),h(e,t)}),Uc(ua(),f)]),apis:{resetToMin:t=>{u.setToMin(t,e)},resetToMax:t=>{u.setToMax(t,e)},setValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},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)}}}),qw="container",Yw=[Yp("slotBehaviours",[])],Xw=e=>"<alloy.field."+e+">",Kw=(e,t)=>{const o=t=>pl(e),n=(t,o)=>(n,s)=>dl(n,e,s).map(e=>t(e,s)).getOr(o),s=(e,t)=>"true"!==Lo(e.element,"aria-hidden"),r=n(s,!1),a=n((e,t)=>{if(s(e)){const o=e.element;en(o,"display","none"),zo(o,"aria-hidden","true"),Ic(e,Ja(),{name:t,visible:!1})}}),i=(e=>(t,o)=>{N(o,o=>e(t,o))})(a),l=n((e,t)=>{if(!s(e)){const o=e.element;cn(o,"display"),Ho(o,"aria-hidden"),Ic(e,Ja(),{name:t,visible:!0})}}),c={getSlotNames:o,getSlot:(t,o)=>dl(t,e,o),isShowing:r,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:Xp(e.slotBehaviours),apis:c}},Jw=le({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=>_m(e)),Qw={...Jw,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),rl(qw,Xw(t),o)),record:y(e)}})(),o=e(t),n=t.record(),s=L(n,e=>Ki({name:e,pname:Xw(e)}));return eh(qw,Yw,s,Kw,o)}},Zw=(e,t,o)=>({within:e,extra:t,withinWidth:o}),eS=(e,t,o)=>{const n=W(e,(e,t)=>((e,t)=>{const n=o(e);return A.some({element:e,start:t,finish:t+n,width:n})})(t,e.len).fold(y(e),t=>({len:t.finish,list:e.list.concat([t])})),{len:0,list:[]}).list,s=H(n,e=>e.finish<=t),r=U(s,(e,t)=>e+t.width,0);return{within:s,extra:n.slice(s.length),withinWidth:r}},tS=e=>L(e,e=>e.element),oS=(e,t)=>{const o=L(t,e=>Mg(e));Vx.setGroups(e,o)},nS=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const s=ul(e,t,"primary"),r=Ug.getCoupled(e,"overflowGroup");en(s.element,"visibility","hidden");const a=n.concat([r]),i=se(a,e=>Ao(e.element).bind(t=>e.getSystem().getByDom(t).toOptional()));o([]),oS(s,a);const l=((e,t,o,n)=>{const s=((e,t,o)=>{const n=eS(t,e,o);return 0===n.extra.length?A.some(n):A.none()})(e,t,o).getOrThunk(()=>eS(t,e-o(n),o)),r=s.within,a=s.extra,i=s.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=tS(e.concat(t));return Zw(n,[],o)})(r,a,i):a.length>=1?((e,t,o,n)=>{const s=tS(e).concat([o]);return Zw(s,tS(t),n)})(r,a,n,i):((e,t,o)=>Zw(tS(e),[],o))(r,0,i)})(bn(s.element),t.builtGroups.get(),e=>Math.ceil(e.element.dom.getBoundingClientRect().width),r);0===l.extra.length?(eg.remove(s,r),o([])):(oS(s,l.within),o(l.extra)),cn(s.element,"visibility"),dn(s.element),i.each(hd.focus)},sS=y([Yp("splitToolbarBehaviours",[Ug]),Tr("builtGroups",()=>ye([]))]),rS=y([pi(["overflowToggledClass"]),Wr("getOverflowBounds"),Ar("lazySink"),Tr("overflowGroups",()=>ye([])),fi("onOpened"),fi("onClosed")].concat(sS())),aS=y([Ki({factory:Vx,schema:Rx(),name:"primary"}),Ji({schema:Rx(),name:"overflow"}),Ji({name:"overflow-button"}),Ji({name:"overflow-group"})]),iS=y([Ar("items"),pi(["itemSelector"]),Yp("tgroupBehaviours",[Sm])]),lS=y([Zi({name:"items",unit:"item"})]),cS=rh({name:"ToolbarGroup",configFields:iS(),partFields:lS(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Kp(e.tgroupBehaviours,[Sm.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"group"}}})}),dS=e=>L(e,e=>Mg(e)),uS=(e,t,o)=>{nS(e,o,n=>{o.overflowGroups.set(n),t.getOpt(e).each(e=>{jx.setGroups(e,dS(n))})})},mS=rh({name:"SplitFloatingToolbar",configFields:rS(),partFields:aS(),factory:(e,t,o,n)=>{const s=xv(jx.sketch({fetch:()=>Oe(t=>{t(dS(e.overflowGroups.get()))}),layouts:{onLtr:()=>[Hl,Pl],onRtl:()=>[Pl,Hl],onBottomLtr:()=>[Wl,Ul],onBottomRtl:()=>[Ul,Wl]},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:Kp(e.splitToolbarBehaviours,[Ug.config({others:{overflowGroup:()=>cS.sketch({...n["overflow-group"](),items:[s.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(L(o,t.getSystem().build)),uS(t,s,e)},refresh:t=>uS(t,s,e),toggle:e=>{s.getOpt(e).each(e=>{jx.toggle(e)})},toggleWithoutFocusing:e=>{s.getOpt(e).each(jx.toggleWithoutFocusing)},isOpen:e=>s.getOpt(e).map(jx.isOpen).getOr(!1),reposition:e=>{s.getOpt(e).each(e=>{jx.reposition(e)})},getOverflow:e=>s.getOpt(e).bind(jx.getToolbar)},domModification:{attributes:{role:"group"}}}},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)}}),gS=y([pi(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),fi("onOpened"),fi("onClosed")].concat(sS())),pS=y([Ki({factory:Vx,schema:Rx(),name:"primary"}),Ki({factory:Vx,schema:Rx(),name:"overflow",overrides:e=>({toolbarBehaviours:sd([Ub.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{dl(t,e,"overflow-button").each(e=>{sv.off(e)}),e.onClosed(t)},onGrown:t=>{e.onOpened(t)},onStartGrow:t=>{dl(t,e,"overflow-button").each(sv.on)}}),Sm.config({mode:"acyclic",onEscape:t=>(dl(t,e,"overflow-button").each(hd.focus),A.some(!0))})])})}),Ji({name:"overflow-button",overrides:e=>({buttonBehaviours:sd([sv.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])})}),Ji({name:"overflow-group"})]),hS=(e,t,o)=>{dl(e,t,"overflow-button").each(n=>{dl(e,t,"overflow").each(s=>{if(fS(e,t),Ub.hasShrunk(s)){const e=t.onOpened;t.onOpened=n=>{o||Sm.focusIn(s),e(n),t.onOpened=e}}else{const e=t.onClosed;t.onClosed=s=>{o||hd.focus(n),e(s),t.onClosed=e}}Ub.toggleGrow(s)})})},fS=(e,t)=>{dl(e,t,"overflow").each(o=>{nS(e,t,e=>{const t=L(e,e=>Mg(e));Vx.setGroups(o,t)}),dl(e,t,"overflow-button").each(e=>{Ub.hasGrown(o)&&sv.on(e)}),Ub.refresh(o)})},bS=rh({name:"SplitSlidingToolbar",configFields:gS(),partFields:pS(),factory:(e,t,o,n)=>{const s="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:Kp(e.splitToolbarBehaviours,[Ug.config({others:{overflowGroup:e=>cS.sketch({...n["overflow-group"](),items:[Bv.sketch({...n["overflow-button"](),action:t=>{Fc(e,s)}})]})}}),dd("toolbar-toggle-events",[Uc(s,t=>{hS(t,e,!1)})])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=L(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),fS(t,e)},refresh:t=>fS(t,e),toggle:t=>{hS(t,e,!1)},toggleWithoutFocusing:t=>{hS(t,e,!0)},isOpen:t=>((e,t)=>dl(e,t,"overflow").map(Ub.hasGrown).getOr(!1))(t,e)},domModification:{attributes:{role:"group"}}}},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)}}),vS=sh({name:"TabButton",configFields:[Gr("uid",void 0),Ar("value"),_r("dom","dom",nr(()=>({attributes:{role:"tab",id:ze("aria"),"aria-selected":"false"}})),qs()),Lr("action"),Gr("domModification",{}),Yp("tabButtonBehaviours",[hd,Sm,ef]),Ar("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:Mv(e.action),behaviours:Kp(e.tabButtonBehaviours,[hd.config({}),Sm.config({mode:"execution",useSpace:!0,useEnter:!0}),ef.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),xS=y([Ar("tabs"),Ar("dom"),Gr("clickToDismiss",!1),Yp("tabbarBehaviours",[Yd,Sm]),pi(["tabClass","selectedClass"])]),yS=Zi({factory:vS,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Yd.dehighlight(e,t),Ic(e,ei(),{tabbar:e,button:t})},o=(e,t)=>{Yd.highlight(e,t),Ic(e,Za(),{tabbar:e,button:t})};return{action:n=>{const s=n.getSystem().getByUid(e.uid).getOrDie(),r=Yd.isHighlighted(s,n);(r&&e.clickToDismiss?t:r?b:o)(s,n)},domModification:{classes:[e.markers.tabClass]}}}}),wS=y([yS]),SS=rh({name:"Tabbar",configFields:xS(),partFields:wS(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Kp(e.tabbarBehaviours,[Yd.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{zo(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{zo(t.element,"aria-selected","false")}}),Sm.config({mode:"flow",getInitial:e=>Yd.getHighlighted(e).map(e=>e.element),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),CS=sh({name:"Tabview",configFields:[Yp("tabviewBehaviours",[eg])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:Kp(e.tabviewBehaviours,[eg.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),kS=y([Gr("selectFirst",!0),fi("onChangeTab"),fi("onDismissTab"),Gr("tabs",[]),Yp("tabSectionBehaviours",[])]),OS=Ki({factory:SS,schema:[Ar("dom"),Rr("markers",[Ar("tabClass"),Ar("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),_S=Ki({factory:CS,name:"tabview"}),TS=y([OS,_S]),ES=rh({name:"TabSection",configFields:kS(),partFields:TS(),factory:(e,t,o,n)=>{const s=(t,o)=>{dl(t,e,"tabbar").each(e=>{o(e).each(Rc)})};return{uid:e.uid,dom:e.dom,components:t,behaviours:Xp(e.tabSectionBehaviours),events:Nc(G([e.selectFirst?[Kc((e,t)=>{s(e,Yd.getFirst)})]:[],[Uc(Za(),(t,o)=>{(t=>{const o=ef.getValue(t);dl(t,e,"tabview").each(n=>{j(e.tabs,e=>e.value===o).each(o=>{const s=o.view();No(t.element,"id").each(e=>{zo(n.element,"aria-labelledby",e)}),eg.set(n,s),e.onChangeTab(n,t,s)})})})(o.event.button)}),Uc(ei(),(t,o)=>{const n=o.event.button;e.onDismissTab(t,n)})]])),apis:{getViewItems:t=>dl(t,e,"tabview").map(e=>eg.contents(e)).getOr([]),showTab:(e,t)=>{s(e,e=>{const o=Yd.getCandidates(e);return j(o,e=>ef.getValue(e)===t).filter(t=>!Yd.isHighlighted(e,t))})}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),AS=(e,t,o)=>{const n=ef.getValue(o);ef.setValue(t,n),MS(t)},DS=(e,t)=>{const o=e.element,n=Qn(o),s=o.dom;"number"!==Lo(o,"type")&&t(s,n)},MS=e=>{DS(e,(e,t)=>e.setSelectionRange(t.length,t.length))},BS=y("alloy.typeahead.itemexecute"),FS=y([Lr("lazySink"),Ar("fetch"),Gr("minChars",5),Gr("responseTime",1e3),fi("onOpen"),Gr("getHotspot",A.some),Gr("getAnchorOverrides",y({})),Gr("layouts",A.none()),Gr("eventOrder",{}),ea("model",{},[Gr("getDisplayText",e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value),Gr("selectsOver",!0),Gr("populateFromBrowse",!0)]),fi("onSetValue"),bi("onExecute"),fi("onItemExecute"),Gr("inputClasses",[]),Gr("inputAttributes",{}),Gr("inputStyles",{}),Gr("matchWidth",!0),Gr("useMinWidth",!1),Gr("dismissOnBlur",!0),pi(["openClass"]),Lr("initialData"),Lr("listRole"),Yp("typeaheadBehaviours",[hd,ef,qb,Sm,sv,Ug]),Tr("lazyTypeaheadComp",()=>ye(A.none)),Tr("previewing",()=>ye(!0))].concat(ey()).concat(_x())),IS=y([Ji({schema:[gi()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each(t=>{((e,t,o)=>{if(e.selectsOver){const n=ef.getValue(t),s=e.getDisplayText(n),r=ef.getValue(o);return 0===e.getDisplayText(r).indexOf(s)?A.some(()=>{AS(0,t,o),((e,t)=>{DS(e,(e,o)=>e.setSelectionRange(t,o.length))})(t,s.length)}):A.none()}return A.none()})(e.model,t,n).fold(()=>{e.model.selectsOver?(Yd.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&&AS(e.model,t,n),No(n.element,"id").each(e=>zo(t.element,"aria-activedescendant",e))})},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map(e=>(Ic(e,BS(),{item:o}),!0)),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&AS(e.model,t,o)})}})})]),RS=rh({name:"Typeahead",configFields:FS(),partFields:IS(),factory:(e,t,o,n)=>{const s=(t,o,s)=>{e.previewing.set(!1);const r=Ug.getCoupled(t,"sandbox");if(_b.isOpen(r))Lg.getCurrent(r).each(e=>{Yd.getHighlighted(e).fold(()=>{s(e)},()=>{Lc(r,e.element,"keydown",o)})});else{const o=e=>{Lg.getCurrent(e).each(s)};yx(e,a(t),t,r,n,o,Ec.HighlightMenuAndItem).get(b)}},r=ty(e),a=e=>t=>t.map(t=>{const o=he(t.menus),n=q(o,e=>H(e.items,e=>"item"===e.type));return ef.getState(e).update(L(n,e=>e.data)),t}),i=e=>Lg.getCurrent(e),l="typeaheadevents",c=[hd.config({}),ef.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>Qn(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{Zn(t.element,e.model.getDisplayText(o))},...e.initialData.map(e=>ta("initialValue",e)).getOr({})}}),qb.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const s=Ug.getCoupled(t,"sandbox");if(hd.isFocused(t)&&Qn(t.element).length>=e.minChars){const o=i(s).bind(e=>Yd.getHighlighted(e).map(ef.getValue));e.previewing.set(!0);const r=t=>{i(s).each(t=>{o.fold(()=>{e.model.selectsOver&&Yd.highlightFirst(t)},e=>{Yd.highlightBy(t,t=>ef.getValue(t).value===e.value),Yd.getHighlighted(t).orThunk(()=>(Yd.highlightFirst(t),A.none()))})})};yx(e,a(t),t,s,n,r,Ec.HighlightJustMenu).get(b)}},cancelEvent:Pa()}),Sm.config({mode:"special",onDown:(e,t)=>(s(e,t,Yd.highlightFirst),A.some(!0)),onEscape:e=>{const t=Ug.getCoupled(e,"sandbox");return _b.isOpen(t)?(_b.close(t),A.some(!0)):A.none()},onUp:(e,t)=>(s(e,t,Yd.highlightLast),A.some(!0)),onEnter:t=>{const o=Ug.getCoupled(t,"sandbox"),n=_b.isOpen(o);if(n&&!e.previewing.get())return i(o).bind(e=>Yd.getHighlighted(e)).map(e=>(Ic(t,BS(),{item:e}),!0));{const s=ef.getValue(t);return Fc(t,Pa()),e.onExecute(o,t,s),n&&_b.close(o),A.some(!0)}}}),sv.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),Ug.config({others:{sandbox:t=>Ox(e,t,{onOpen:()=>sv.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each(e=>Ho(e.element,"aria-activedescendant")),sv.off(t)}})}}),dd(l,[Kc(t=>{e.lazyTypeaheadComp.set(A.some(t))}),Jc(t=>{e.lazyTypeaheadComp.set(A.none())}),Zc(t=>{const o=b;Sx(e,a(t),t,n,o,Ec.HighlightMenuAndItem).get(b)}),Uc(BS(),(t,o)=>{const n=Ug.getCoupled(t,"sandbox");AS(e.model,t,o.event.item),Fc(t,Pa()),e.onItemExecute(t,n,o.event.item,ef.getValue(t)),_b.close(n),MS(t)})].concat(e.dismissOnBlur?[Uc(Ba(),e=>{const t=Ug.getCoupled(e,"sandbox");Ao(t.element).isNone()&&_b.close(t)})]:[]))],d={[qa()]:[ef.name(),qb.name(),l],...e.eventOrder};return{uid:e.uid,dom:ny(Le(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...r,...Kp(e.typeaheadBehaviours,c)},eventOrder:d}}});var zS=tinymce.util.Tools.resolve("tinymce.ThemeManager"),VS=tinymce.util.Tools.resolve("tinymce.util.Delay"),LS=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),NS=tinymce.util.Tools.resolve("tinymce.EditorManager"),PS=tinymce.util.Tools.resolve("tinymce.Env");const HS={default:"wrap",floating:"floating",sliding:"sliding",scrolling:"scrolling"},US={auto:"auto",top:"top",bottom:"bottom"},WS=e=>t=>t.options.get(e),jS=e=>t=>A.from(e(t)),$S=e=>{const t=PS.deviceType.isPhone(),o=PS.deviceType.isTablet()||t,n=e.options.register,s=e=>r(e)||!1===e,a=e=>r(e)||h(e);n("skin",{processor:e=>r(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:a,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:a,default:LS.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=>r(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||r(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),z(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:US.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:s,default:"#top"}),n("anchor_bottom",{processor:s,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||d(e),default:!PS.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("sidebar_width",{processor:"number",default:440}),n("sidebar_min_width",{processor:"number",default:300}),n("sidebar_max_width",{processor:"number",default:800}),n("view_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},GS=WS("readonly"),qS=WS("disabled"),YS=WS("height"),XS=WS("width"),KS=jS(WS("min_width")),JS=jS(WS("min_height")),QS=jS(WS("max_width")),ZS=jS(WS("max_height")),eC=jS(WS("style_formats")),tC=WS("style_formats_merge"),oC=WS("style_formats_autohide"),nC=WS("content_langs"),sC=WS("removed_menuitems"),rC=WS("toolbar_mode"),aC=WS("toolbar_groups"),iC=WS("toolbar_location"),lC=WS("fixed_toolbar_container"),cC=WS("fixed_toolbar_container_target"),dC=WS("toolbar_persist"),uC=WS("toolbar_sticky_offset"),mC=WS("menubar"),gC=WS("toolbar"),pC=WS("file_picker_callback"),hC=WS("file_picker_validator_handler"),fC=WS("font_size_input_default_unit"),bC=WS("file_picker_types"),vC=WS("typeahead_urls"),xC=WS("anchor_top"),yC=WS("anchor_bottom"),wC=WS("draggable_modal"),SC=WS("statusbar"),CC=WS("elementpath"),kC=WS("branding"),OC=WS("resize"),_C=WS("paste_as_text"),TC=WS("sidebar_show"),EC=WS("sidebar_width"),AC=WS("sidebar_min_width"),DC=WS("sidebar_max_width"),MC=WS("view_show"),BC=WS("promotion"),FC=WS("help_accessibility"),IC=WS("default_font_stack"),RC=WS("skin"),zC=e=>!1===e.options.get("skin"),VC=e=>!1!==e.options.get("menubar"),LC=e=>{const t=e.options.get("skin_url");if(zC(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return NS.baseURL+"/skins/ui/"+t}},NC=e=>e.options.get("line_height_formats").split(" "),PC=e=>{const t=gC(e),o=r(t),n=l(t)&&t.length>0;return!UC(e)&&(n||o||!0===t)},HC=e=>{const t=z(9,t=>e.options.get("toolbar"+(t+1))),o=H(t,r);return je(o.length>0,o)},UC=e=>HC(e).fold(()=>{const t=gC(e);return f(t,r)&&t.length>0},E),WC=e=>iC(e)===US.bottom,jC=e=>{if(!e.inline)return A.none();const t=lC(e)??"";if(t.length>0)return Vn(Ko(),t);const o=cC(e);return g(o)?A.some(ct(o)):A.none()},$C=e=>e.inline&&jC(e).isSome(),GC=e=>jC(e).getOrThunk(()=>po(go(ct(e.getElement())))),qC=e=>e.inline&&!VC(e)&&!PC(e)&&!UC(e),YC=e=>(e.options.get("toolbar_sticky")||e.inline)&&!$C(e)&&!qC(e),XC=e=>!$C(e)&&"split"===e.options.get("ui_mode"),KC=e=>{const t=e.options.get("menu");return le(t,e=>({...e,items:e.items}))};var JC=Object.freeze({__proto__:null,ToolbarLocation:US,ToolbarMode:HS,getAnchorBottom:yC,getAnchorTop:xC,getContentLanguages:nC,getDefaultFontStack:IC,getFilePickerCallback:pC,getFilePickerTypes:bC,getFilePickerValidatorHandler:hC,getFontSizeInputDefaultUnit:fC,getHeightOption:YS,getLineHeightFormats:NC,getMaxHeightOption:ZS,getMaxWidthOption:QS,getMenubar:mC,getMenus:KC,getMinHeightOption:JS,getMinWidthOption:KS,getMultipleToolbarsOption:HC,getPasteAsText:_C,getRemovedMenuItems:sC,getResize:OC,getSidebarMaxWidth:DC,getSidebarMinWidth:AC,getSidebarShow:TC,getSidebarWidth:EC,getSkin:RC,getSkinUrl:LC,getStickyToolbarOffset:uC,getToolbar:gC,getToolbarGroups:aC,getToolbarLocation:iC,getToolbarMode:rC,getUiContainer:GC,getUserStyleFormats:eC,getViewShow:MC,getWidthOption:XS,isDisabled:qS,isDistractionFree:qC,isDraggableModal:wC,isMenubarEnabled:VC,isMultipleToolbars:UC,isReadOnly:GS,isSkinDisabled:zC,isSplitUiMode:XC,isStickyToolbar:YC,isToolbarEnabled:PC,isToolbarLocationBottom:WC,isToolbarPersist:dC,promotionEnabled:BC,register:$S,shouldAutoHideStyleFormats:oC,shouldMergeStyleFormats:tC,useBranding:kC,useElementPath:CC,useFixedContainer:$C,useHelpAccessibility:FC,useStatusBar:SC,useTypeaheadUrls:vC});const QC=["visible","hidden","clip"],ZC=e=>et(e).length>0&&!I(QC,e),ek=e=>{if($t(e)){const t=nn(e,"overflow-x"),o=nn(e,"overflow-y");return ZC(t)||ZC(o)}return!1},tk=e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen(),ok=(e,t)=>XC(e)?((e,t)=>{const o=es(t,ek),n=0===o.length?ho(t).map(fo).map(e=>es(e,ek)).getOr([]):o;return te(n).map(t=>({element:t,others:n.slice(1),isFullscreen:()=>tk(e)}))})(e,t):A.none(),nk=e=>{const t=[...L(e.others,Es),Ms()];return e.isFullscreen()?Ms():((e,t)=>W(t,(e,t)=>Ds(e,t),e))(Es(e.element),t)};
/*! @license DOMPurify 3.5.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.5.0/LICENSE */
function sk(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
function rk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,s,r,a,i=[],l=!0,c=!1;try{if(r=(o=o.call(e)).next,0===t);else for(;!(l=(n=r.call(o)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=o.return&&(a=o.return(),Object(a)!==a))return}finally{if(c)throw s}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sk(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?sk(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const ak=Object.entries,ik=Object.keys,lk=Object.setPrototypeOf,ck=Object.isFrozen,dk=Object.getPrototypeOf,uk=Object.getOwnPropertyDescriptor;let mk=Object.freeze,gk=Object.seal,pk=Object.create,hk="undefined"!=typeof Reflect&&Reflect,fk=hk.apply,bk=hk.construct;mk||(mk=function(e){return e}),gk||(gk=function(e){return e}),fk||(fk=function(e,t){for(var o=arguments.length,n=new Array(o>2?o-2:0),s=2;s<o;s++)n[s-2]=arguments[s];return e.apply(t,n)}),bk||(bk=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];return new e(...o)});const vk=qk(Array.prototype.forEach),xk=qk(Array.prototype.lastIndexOf),yk=qk(Array.prototype.pop),wk=qk(Array.prototype.push),Sk=qk(Array.prototype.slice),Ck=qk(Array.prototype.splice),kk=Array.isArray,Ok=Yk(Set),_k=qk(Set.prototype.add),Tk=qk(Set.prototype.has),Ek=qk(Set.prototype.delete),Ak=Yk(Map),Dk=qk(Map.prototype.get),Mk=qk(Map.prototype.set),Bk=qk(String.prototype.toLowerCase),Fk=qk(String.prototype.toString),Ik=qk(String.prototype.match),Rk=qk(String.prototype.replace),zk=qk(String.prototype.indexOf),Vk=qk(String.prototype.trim),Lk=qk(Number.prototype.toString),Nk=qk(Boolean.prototype.toString),Pk="undefined"==typeof BigInt?null:qk(BigInt.prototype.toString),Hk="undefined"==typeof Symbol?null:qk(Symbol.prototype.toString),Uk=qk(Object.prototype.hasOwnProperty),Wk=qk(Object.prototype.toString),jk=RegExp.prototype.test,$k=function(e,t){return e instanceof RegExp&&(e.lastIndex=0),fk(jk,e,[t])},Gk=Yk(TypeError);function qk(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];return fk(e,t,n)}}function Yk(e){return function(){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return bk(e,o)}}function Xk(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Bk;if(lk&&lk(e,null),!kk(t))return e;let n=t.length;for(;n--;){let s=t[n];if("string"==typeof s){const e=o(s);e!==s&&(ck(t)||(t[n]=e),s=e)}e[s]=!0}return e}function Kk(e){for(let t=0;t<e.length;t++)Uk(e,t)||(e[t]=null);return e}function Jk(e){const t=pk(null);for(const n of ak(e)){var o=rk(n,2);const s=o[0],r=o[1];Uk(e,s)&&(kk(r)?t[s]=Kk(r):r&&"object"==typeof r&&r.constructor===Object?t[s]=Jk(r):t[s]=r)}return t}function Qk(e){const t=pk(null),o=ik(e);let n=o.length;for(;n--;)t[o[n]]=e[o[n]];return t}function Zk(e,t){for(;null!==e;){const o=uk(e,t);if(o){if(o.get)return qk(o.get);if("function"==typeof o.value)return qk(o.value)}e=dk(e)}return function(){return null}}const eO=mk(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tO=mk(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),oO=mk(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nO=mk(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sO=mk(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rO=mk(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),aO=mk(["#text"]),iO=mk(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),lO=mk(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),cO=mk(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),dO=mk(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),uO=gk(/{{[\w\W]*|^[\w\W]*}}/g),mO=gk(/<%[\w\W]*|^[\w\W]*%>/g),gO=gk(/\${[\w\W]*/g),pO=gk(/{{|}}|\${|<%|%>/),hO=gk(/[^\t\n\f\r ]/),fO=gk(/\u0000/g),bO=gk(/^data-[\-\w.\u00B7-\uFFFF]+$/),vO=gk(/^aria-[\-\w]+$/),xO=gk(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yO=gk(/^(?:\w+script|data):/i),wO=gk(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),SO=gk(/^html$/i),CO=gk(/^[a-z][.\w]*(-[.\w]+)+$/i),kO=gk(/<[/\w!]/g),OO=gk(/<[/\w]/g),_O=gk(/<[/\w]|^-?>|--!?>|<!-$/g),TO=gk(/<\/no(script|embed|frames)/i),EO=gk(/\/>/i),AO=gk(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),DO=gk(/^[\r\n\t ]+/),MO=mk(Xk({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),BO=mk(Xk({},["textarea","title"])),FO=mk(Xk({},["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","meta","param","source","track","wbr"])),IO=function(){return"undefined"==typeof window?null:window},RO=function(e,t,o,n){return Uk(e,t)&&kk(e[t])?Xk(n.base?Qk(n.base):{},e[t],n.transform):o},zO=function(e,t,o){const n=Uk(e,t)?e[t]:void 0;return n&&"object"==typeof n?Jk(n):o};var VO=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:IO();const o=t=>e(t);if(o.version="3.5.0",o.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return o.isSupported=!1,o;let n=t.document;const s=n,r=s.currentScript,a=t.HTMLTemplateElement,i=t.Node,l=t.Element,c=t.NodeFilter,d=t.DOMParser,u=t.trustedTypes,m=l.prototype,g=Zk(m,"cloneNode"),p=Zk(m,"remove"),h=Zk(m,"removeChild"),f=Zk(m,"removeAttributeNode"),b=Zk(m,"nextSibling"),v=Zk(m,"childNodes"),x=Zk(m,"parentNode"),y=Zk(m,"shadowRoot"),w=Zk(m,"attributes"),S=i&&i.prototype?Zk(i.prototype,"nodeType"):null,C=i&&i.prototype?Zk(i.prototype,"nodeName"):null,k=i&&i.prototype?Zk(i.prototype,"ownerDocument"):null,O=function(e){return S?S(e):e.nodeType},_=function(e){return C?C(e):e.nodeName},T=function(e){for(;null!==e;){const t=uk(e,"namespaceURI");if(t)return t.get?qk(t.get):null;e=dk(e)}return null}(m),E=function(e){return T?T(e):e.namespaceURI};if("function"==typeof a){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let A,D,M="",B=!1,F=0;const I=function(){if(F>0)throw Gk('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},R=function(e){I(),F++;try{return A.createHTML(e)}finally{F--}},z=function(e){return A&&ye?R(e):e},V=n,L=V.implementation,N=V.createNodeIterator,P=V.createDocumentFragment,H=V.getElementsByTagName,U=s.importNode;let W={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof ak&&"function"==typeof x&&L&&void 0!==L.createHTMLDocument;const j=uO,$=mO,G=gO,q=bO,Y=vO,X=yO,K=wO,J=CO;let Q=xO,Z=null;const ee=Xk({},[...eO,...tO,...oO,...sO,...aO]);let te=null;const oe=Xk({},[...iO,...lO,...cO,...dO]);let ne=null,se=null,re=null;const ae=Object.seal(pk(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ie=!0,le=!0,ce=!1,de=!0,ue=!1,me=!0,ge=!1,pe=!1,he=null,fe=null,be=!1,ve=!1,xe=!1,ye=!1,we=!0,Se=!1;const Ce="user-content-";let ke=!0,Oe=!1,_e=null,Te=null,Ee=!1,Ae=null;const De=Xk({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Me=null;const Be=Xk({},["audio","video","img","source","image","track"]);let Fe=null;const Ie=Xk({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Re="http://www.w3.org/1998/Math/MathML",ze="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let Le=Ve,Ne=!1,Pe=null;const He=Xk({},[Re,ze,Ve],Fk),Ue=mk(Xk({},["mi","mo","mn","ms","mtext"]));let We=null;const je=mk(Xk({},["annotation-xml"]));let $e=null;const Ge=mk(pk(null)),qe=Xk({},["title","style","font","a","script"]);let Ye=null;const Xe=["application/xhtml+xml","text/html"];let Ke=null,Je=null,Qe=null;const Ze=n.createElement("form"),et=function(e){return e instanceof RegExp||e instanceof Function},tt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e&&"object"==typeof e||(e={}),e=Jk(e),Ye=-1===Xe.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ke="application/xhtml+xml"===Ye?Fk:Bk,Z=RO(e,"ALLOWED_TAGS",ee,{transform:Ke}),te=RO(e,"ALLOWED_ATTR",oe,{transform:Ke}),Pe=RO(e,"ALLOWED_NAMESPACES",He,{transform:Fk}),Fe=RO(e,"ADD_URI_SAFE_ATTR",Ie,{transform:Ke,base:Ie}),Me=RO(e,"ADD_DATA_URI_TAGS",Be,{transform:Ke,base:Be}),Ae=RO(e,"FORBID_CONTENTS",De,{transform:Ke}),se=RO(e,"FORBID_TAGS",pk(null),{transform:Ke}),re=RO(e,"FORBID_ATTR",pk(null),{transform:Ke}),Ee=!!Uk(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Jk(e.USE_PROFILES):e.USE_PROFILES),ie=!1!==e.ALLOW_ARIA_ATTR,le=!1!==e.ALLOW_DATA_ATTR,ce=e.ALLOW_UNKNOWN_PROTOCOLS||!1,de=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ue=e.SAFE_FOR_TEMPLATES||!1,me=!1!==e.SAFE_FOR_XML,ge=e.WHOLE_DOCUMENT||!1,ve=e.RETURN_DOM||!1,xe=e.RETURN_DOM_FRAGMENT||!1,ye=e.RETURN_TRUSTED_TYPE||!1,be=e.FORCE_BODY||!1,we=!1!==e.SANITIZE_DOM,Se=e.SANITIZE_NAMED_PROPS||!1,ke=!1!==e.KEEP_CONTENT,Oe=e.IN_PLACE||!1,Q=function(e){if(!e)return!1;try{return $k(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:xO,Le="string"==typeof e.NAMESPACE?e.NAMESPACE:Ve,We=zO(e,"MATHML_TEXT_INTEGRATION_POINTS",Ue),$e=zO(e,"HTML_INTEGRATION_POINTS",je);const t=zO(e,"CUSTOM_ELEMENT_HANDLING",Ge);if(ne=pk(null),Uk(t,"tagNameCheck")&&et(t.tagNameCheck)&&(ne.tagNameCheck=t.tagNameCheck),Uk(t,"attributeNameCheck")&&et(t.attributeNameCheck)&&(ne.attributeNameCheck=t.attributeNameCheck),Uk(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(ne.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),gk(ne),ue&&(le=!1),xe&&(ve=!0),Ee&&((Uk(e,"ALLOWED_TAGS")||Uk(e,"ALLOWED_ATTR"))&&"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),Z=Xk({},aO),te=pk(null),!0===Ee.html&&(Xk(Z,eO),Xk(te,iO)),!0===Ee.svg&&(Xk(Z,tO),Xk(te,lO),Xk(te,dO)),!0===Ee.svgFilters&&(Xk(Z,oO),Xk(te,lO),Xk(te,dO)),!0===Ee.mathMl&&(Xk(Z,sO),Xk(te,cO),Xk(te,dO))),ae.tagCheck=null,ae.attributeCheck=null,Uk(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?ae.tagCheck=e.ADD_TAGS:kk(e.ADD_TAGS)&&(Z===ee&&(Z=Qk(Z)),Xk(Z,e.ADD_TAGS,Ke))),Uk(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?ae.attributeCheck=e.ADD_ATTR:kk(e.ADD_ATTR)&&(te===oe&&(te=Qk(te)),Xk(te,e.ADD_ATTR,Ke))),Uk(e,"ADD_FORBID_CONTENTS")&&kk(e.ADD_FORBID_CONTENTS)&&(Ae===De&&(Ae=Qk(Ae)),Xk(Ae,e.ADD_FORBID_CONTENTS,Ke)),ke&&(Z["#text"]=!0),ge&&Xk(Z,["html","head","body"]),Z.table&&(Z.tbody=!0,delete se.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Gk('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Gk('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=A;A=e.TRUSTED_TYPES_POLICY;try{M=R("")}catch(e){throw A=t,e}}else null===e.TRUSTED_TYPES_POLICY?(A=void 0,M=""):(void 0===A&&(B||(D=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 s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(u,r),B=!0),A=D),A&&"string"==typeof M&&(M=R("")));Je=mk(e)},ot=Xk({},[...tO,...oO,...nO]),nt=Xk({},[...sO,...rO]),st=function(e){wk(o.removed,{element:e}),pt(e);try{x(e).removeChild(e)}catch(t){if(p(e),!x(e))throw Gk("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},rt=function(e,t,o){try{f(e,t)}catch(t){try{e.removeAttribute(o)}catch(e){}}},at=function(e,t,n){if(!n)try{n=t.getAttributeNode(e)}catch(e){n=null}if(wk(o.removed,{attribute:n||null,from:t}),n)rt(t,n,e);else try{t.removeAttribute(e)}catch(e){}if("is"===e)if(ve||xe)try{st(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},it=function(e,t){const o=w(e);if(o)for(let n=o.length-1;n>=0;--n){const s=o[n],r=s&&s.name;"string"!=typeof r||t&&te[Ke(r)]||rt(e,s,r)}},lt=function(e,t){let o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=[e];for(;n.length>0;){const e=n.pop();if(!1===t(e))continue;if(o&&1===O(e)){const t=y(e);kt(t)&&n.push(t)}const s=v(e);if(s)for(let e=s.length-1;e>=0;--e)n.push(s[e])}},ct=function(e){lt(e,e=>{1===O(e)&&it(e,!0)})},dt=function(e){const t=[];return lt(e,e=>{t.push(e)},!0),t},ut=function(e,t){let n=!1;return vk(o.removed,t=>{t.element&&(n=n||t.element===e,ct(t.element))}),function(e,t){const o=Ok();vk(dt(e),e=>{1===O(e)&&_k(o,e)}),vk(t,e=>{1!==O(e)||Tk(o,e)||it(e,!0)})}(e,t),n},mt=function(e,t){!function(e){ct(e);const t=v(e);t&&vk(Sk(t),t=>{try{h(e,t)}catch(e){}}),1===O(e)&&it(e,!1)}(e),ut(e,t)},gt=function(e,t,o,n){const s=bt(e);let r;for(;r=s.nextNode();)Tk(n,r)&&!Tk(_e,r)&&(t&&_t(W.uponSanitizeShadowNode,r,null),Vt(r,o))},pt=function(e){_e&&(Ek(_e,e),void 0===Dk(Te,e)&&Mk(Te,e,0))},ht=function(e,t){return!!me&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},ft=function(e){let t=null,o=null;if(be)e="<remove></remove>"+e;else{const t=Ik(e,DO);o=t&&t[0]}"application/xhtml+xml"===Ye&&Le===Ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const s=A?R(e):e;if(Le===Ve)try{t=(new d).parseFromString(s,Ye)}catch(e){}if(!t||!t.documentElement){t=L.createDocument(Le,"template",null);try{t.documentElement.innerHTML=Ne?M:s}catch(e){}}const r=t.body||t.documentElement;return e&&o&&r.insertBefore(n.createTextNode(o),r.childNodes[0]||null),Le===Ve?H.call(t,ge?"html":"body")[0]:ge?t.documentElement:r},bt=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const o=k?k(e):e.ownerDocument;return N.call(o||e,e,(t?0:c.SHOW_ELEMENT)|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},vt=function(e){return e=Rk(e,j," "),e=Rk(e,$," "),Rk(e,G," ")},xt=function(e){var t;wt(e);const o=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");o&&vk(o,e=>{kt(e.content)&&xt(e.content)})},yt=Xk({},["caption","colgroup","col","thead","tbody","tfoot","tr","td","th","style","script","template"]),wt=function(e){!function(e){var t;if("application/xhtml+xml"===Ye)return;const o=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"table,tbody,thead,tfoot,tr,colgroup");o&&0!==o.length&&vk(o,t=>{vk(Sk(v(t)),o=>{const n=O(o);if(!(3===n?$k(hO,o.data):1===n&&!yt[Bk(_(o))]))return;let s=t;for(;s&&"table"!==Bk(_(s));)s=s===e?null:x(s);const r=s&&s!==e?x(s):null;if(r)try{r.insertBefore(o,s)}catch(e){}})})}(e),e.normalize();const t=bt(e,!0);let o=null,n=t.nextNode();for(;n;){let e=n.data;if($k(fO,e)&&(e=Rk(e,fO,""),n.data=e),$k(pO,e)&&(e=vt(e),n.data=e),e&&3===O(n)){if(o){const t=o.data,n=t[t.length-1]+e[0];$k(pO,n)&&(o.data=vt(t+e[0]))}o=n}n=t.nextNode()}},St=function(e){const t=C?C(e):null;return"string"==typeof t&&"form"===Ke(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==w(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.removeAttributeNode||"function"!=typeof e.getAttributeNode||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==S(e)||e.childNodes!==v(e))},Ct=function(e){if(!S||"object"!=typeof e||null===e)return null;try{const t=S(e);return"number"==typeof t?t:null}catch(e){return null}},kt=function(e){return 11===Ct(e)},Ot=function(e){return null!==Ct(e)};function _t(e,t,n){0!==e.length&&vk(e,e=>{e.call(o,t,n,Je)})}const Tt=function(e,t){if(e instanceof RegExp)return $k(e,t);if(e instanceof Function){for(var o=arguments.length,n=new Array(o>2?o-2:0),s=2;s<o;s++)n[s-2]=arguments[s];return Boolean(e(t,...n))}return!1},Et=function(e,t,o,n){return 0===e.length?t:t===o||t===n?Qk(t):t},At=function(e,t){return e!==t&&null===x(e)&&(Oe&&ct(e),pt(e),!0)},Dt=function(e,t){if(function(e){if(!_e)return;_k(_e,e);const t=Dk(Te,e);if(void 0!==t){if(t>=8)throw Gk("the tree kept changing during in-place sanitization; refusing to return it");Mk(Te,e,t+1)}}(e),_t(W.beforeSanitizeElements,e,null),At(e,t))return!0;if(St(e))return st(e),!0;const n=Ke(_(e)),s=O(e);if(Z=Et(W.uponSanitizeElement,Z,ee,he),_t(W.uponSanitizeElement,e,{tagName:n,allowedTags:Z}),At(e,t))return!0;if(function(e,t,o){return!!(me&&1===o&&e.hasChildNodes()&&!Ot(e.firstElementChild)&&$k(kO,e.textContent)&&$k(kO,e.innerHTML))||!(!me||1!==o||!function(e,t){const o=Boolean(FO[t]),n=Boolean(MO[t]);return!!(o||n||BO[t])&&E(e)===Ve&&(o?e.hasChildNodes():!!Ot(e.firstElementChild)||n&&"string"==typeof e.textContent&&$k(kO,e.textContent))}(e,t))||7===o||!(!me||8!==o||!$k(_O,e.data))}(e,n,s))return st(e),!0;if((se[n]||!(ae.tagCheck instanceof Function&&ae.tagCheck(n))&&!Z[n])&&function(e,t,o){if(!se[t]&&Ft(t)&&Tt(ne.tagNameCheck,t))return!1;if(ke&&!Ae[t]&&!Ae[Bk(t)]){const t=x(e),n=v(e);if(n&&t)for(let s=n.length-1;s>=0;--s){const r=e===o?g(n[s],!0):n[s];t.insertBefore(r,b(e))}}return st(e),!0}(e,n,t))return!0;if(1===s&&!function(e){const t=E(e),o=Bk(_(e)),n=x(e);let s=Le,r="template";return n&&1===O(n)&&(s=E(n),r=Bk(_(n))),!!Pe[t]&&(t===ze?function(e,t,o){return t===Ve?"svg"===e:t===Re?"svg"===e&&("annotation-xml"===o||We[o]):Boolean(ot[e])}(o,s,r):t===Re?function(e,t,o){return t===Ve?"math"===e:t===ze?"math"===e&&$e[o]:Boolean(nt[e])}(o,s,r):t===Ve?function(e,t,o){return!(t===ze&&!$e[o])&&!(t===Re&&!We[o])&&!nt[e]&&(qe[e]||!ot[e])}(o,s,r):"application/xhtml+xml"===Ye)}(e))return st(e),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&$k(TO,e.innerHTML))return st(e),!0;if(ue&&3===s){const t=e.textContent,n=vt(t);t!==n&&(wk(o.removed,{element:e.cloneNode()}),e.textContent=n)}return _t(W.afterSanitizeElements,e,null),At(e,t)},Mt=function(e,t,o){if(re[t])return!1;if(ht(t,e))return!1;if(we&&("id"===t||"name"===t)&&(o in n||o in Ze))return!1;const s=te[t]||ae.attributeCheck instanceof Function&&ae.attributeCheck(t,e);if(le&&$k(q,t))return!0;if(ie&&$k(Y,t))return!0;if(!s)return Ft(e)&&Tt(ne.tagNameCheck,e)&&Tt(ne.attributeNameCheck,t,e)||"is"===t&&ne.allowCustomizedBuiltInElements&&Tt(ne.tagNameCheck,o);if(Fe[t])return!0;const r=Rk(o,K,"");return!(!$k(Q,r)&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==zk(o,"data:")||!Me[e])&&(!ce||$k(X,r))&&o)},Bt=Xk({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ft=function(e){return!Bt[Bk(e)]&&$k(J,e)},It=function(e,t,o,n){if(A&&"object"==typeof u&&"function"==typeof u.getAttributeType&&!o)switch(u.getAttributeType(e,t)){case"TrustedHTML":return R(n);case"TrustedScriptURL":return function(e){I(),F++;try{return A.createScriptURL(e)}finally{F--}}(n)}return n},Rt=function(e,t,o,n){try{return o?e.setAttributeNS(o,t,n):e.setAttribute(t,n),!St(e)||(st(e),!1)}catch(o){return at(t,e),!1}},zt=function(e,t){return!(!me||!$k(AO,t))||"attributename"===Bk(e)&&-1!==zk(t,"href")},Vt=function(e,t){Dt(e,t),function(e,t){if(_t(W.beforeSanitizeAttributes,e,null),At(e,t))return;const n=1===O(s=e)?w(s):null;var s;if(!n||St(e))return;te=Et(W.uponSanitizeAttribute,te,oe,fe);const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:te,forceKeepAttr:void 0};let a=n.length;const i=Ke(_(e));for(;a--;){const t=n[a];if(!t)continue;const s=t.name,l=t.namespaceURI,c=t.value,d=Ke(s),u=c;let m="value"===s?u:Vk(u),g=!1;r.attrName=d,r.attrValue=m,r.keepAttr=!0,r.forceKeepAttr=void 0,_t(W.uponSanitizeAttribute,e,r),m=r.attrValue,!Se||"id"!==d&&"name"!==d||0===zk(m,Ce)||(at(s,e,t),m=Ce+m,g=!0),zt(s,m)?at(s,e,t):r.forceKeepAttr||(!r.keepAttr||!de&&$k(EO,m)?at(s,e,t):(ue&&(m=vt(m)),Mt(i,d,m)?(m=It(i,d,l,m),m!==u&&Rt(e,s,l,m)&&g&&yk(o.removed)):at(s,e,t)))}_t(W.afterSanitizeAttributes,e,null),At(e,t)}(e,t),kt(e.content)&&Lt(e.content)},Lt=function(e){let t=null;const o=bt(e);for(_t(W.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)if(_t(W.uponSanitizeShadowNode,t,null),Vt(t,e),1===O(t)){const e=y(t);kt(e)&&(Nt(e),Lt(e))}ue&&wt(e),_t(W.afterSanitizeShadowDOM,e,null)},Nt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){Lt(e.shadow);continue}const o=e.node,n=1===O(o),s=v(o);if(s)for(let e=s.length-1;e>=0;--e)t.push({node:s[e],shadow:null});if(n){const e=C?C(o):null;if("string"==typeof e&&"template"===Ke(e)){const e=o.content;kt(e)&&t.push({node:e,shadow:null})}}if(n){const e=y(o);kt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Qe,r=Z,a=te,i=o.removed;Qe=null;try{return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,a=null,i=null;if(Ne=!e,Ne&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ot(e)&&(e=function(e){switch(typeof e){case"string":return e;case"number":return Lk(e);case"boolean":return Nk(e);case"bigint":return Pk?Pk(e):"0";case"symbol":return Hk?Hk(e):"Symbol()";case"undefined":default:return Wk(e);case"function":case"object":{if(null===e)return Wk(e);const t=e,o=Zk(t,"toString");if("function"==typeof o){const e=o(t);return"string"==typeof e?e:Wk(e)}return Wk(e)}}}(e),"string"!=typeof e))throw Gk("dirty is not a string, aborting");if(!o.isSupported)return e;pe?(Z=he,te=fe):tt(t),Qe=Je,o.removed=[];const l=Oe&&"string"!=typeof e&&Ot(e);let c=[];const d=_e,u=Te;if(l){me&&lt(e,e=>{const t=O(e);if(7===t||8===t&&$k(OO,e.data)){try{p(e)}catch(e){}return!1}if(1===t){const t=e,o=Ke(_(e));try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&ht("for",o)&&t.removeAttribute("for")}catch(e){}}return!0}),c=dt(e);const t=_(e);if("string"==typeof t){const o=Ke(t);if(!Z[o]||se[o])throw mt(e,c),Gk("root node is forbidden and cannot be sanitized in-place")}if(St(e))throw mt(e,c),Gk("root node is clobbered and cannot be sanitized in-place");_e=Ok(),Te=Ak()}else if(Ot(e))n=ft("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),Nt(n);else{if(!ve&&!ue&&!ge&&-1===e.indexOf("<"))return z(e);if(n=ft(e),!n)return ve?null:ye?M:""}n&&be&&st(n.firstChild);const m=l?e:n;try{l&&Nt(e);const t=bt(m);for(;a=t.nextNode();)Vt(a,m);l&&function(e,t){const o=_e;let n=null;const s=()=>(n||(n=Ok(),vk(t,e=>{_k(n,e)})),n);for(let t=0;;t++){const n=dt(e),r=[e];let a=!1;if(vk(n,e=>{11===O(e)?wk(r,e):a||Tk(o,e)||(a=Tk(s(),e))}),!a)return;if(t>=8)throw Gk("the tree kept changing during in-place sanitization; refusing to return it");vk(r,(t,o)=>{gt(t,o>0,e,s())})}}(e,c)}catch(t){throw l&&mt(e,c),t}finally{_e=d,Te=u}if(l){if(ut(e,c))throw Gk("a node selected for removal could not be safely returned; refusing to sanitize in place");return ue&&xt(e),e}if(ve){if(ue&&xt(n),xe)for(i=P.call(n.ownerDocument);n.firstChild;)i.appendChild(n.firstChild);else i=n;return(te.shadowroot||te.shadowrootmode)&&(i=U.call(s,i,!0)),i}ue&&wt(n);let g=ge?n.outerHTML:n.innerHTML;return ge&&Z["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&$k(SO,n.ownerDocument.doctype.name)&&(g="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+g),z(g)}(e,t)}finally{Qe=n,n&&(pe||tt(n),Z=r,te=a,o.removed=i)}},o.setConfig=function(){tt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),pe=!0,he=Z,fe=te},o.clearConfig=function(){Je=null,pe=!1,he=null,fe=null,A=D,M=""},o.isValidAttribute=function(e,t,o){Je||tt({});const n=Ke(e),s=Ke(t);return("string"!=typeof o||!(zt(t,o)||!de&&$k(EO,o)))&&Mt(n,s,o)},o.addHook=function(e,t){"function"==typeof t&&Uk(W,e)&&wk(W[e],t)},o.removeHook=function(e,t){if(Uk(W,e)){if(void 0!==t){const o=xk(W[e],t);return-1===o?void 0:Ck(W[e],o,1)[0]}return yk(W[e])}},o.removeHooks=function(e){Uk(W,e)&&(W[e]=[])},o.removeAllHooks=function(){W={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();const LO=e=>VO().sanitize(e);var NO=tinymce.util.Tools.resolve("tinymce.util.I18n");const PO={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-disc":!0,"list-bull-default":!0,"list-bull-square":!0},HO="temporary-placeholder",UO=e=>()=>fe(e,HO).getOr("!not found!"),WO=(e,t)=>{const o=e.toLowerCase();if(NO.isRtl()){const e=((e,t)=>Ze(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},jO=(e,t)=>fe(t,WO(e,t)),$O=(e,t)=>{const o=t();return jO(e,o).getOrThunk(UO(o))},GO=()=>dd("add-focusable",[Kc(e=>{zn(e.element,"svg").each(e=>zo(e,"focusable","false"))})]),qO=(e,t,o,n)=>{const s=(e=>!!NO.isRtl()&&be(PO,e))(t)?["tox-icon--flip"]:[],r=fe(o,WO(t,o)).or(n).getOrThunk(UO(o));return{dom:{tag:e.tag,attributes:e.attributes??{},classes:e.classes.concat(s),innerHtml:r},behaviours:sd([...e.behaviours??[],GO()]),eventOrder:e.eventOrder??{}}},YO=(e,t,o,n=A.none())=>qO(t,e,o(),n),XO={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},KO=sh({name:"Notification",factory:e=>{const t=ze("notification-text"),o=xv({dom:vv(`<p id=${t}>${LO(e.backstageProvider.translate(e.text))}</p>`),behaviours:sd([eg.config({})])}),n=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),s=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=xv({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},s(0)],behaviours:sd([eg.config({})])}),a={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each(e=>{eg.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(t)]},s(t)])})},updateText:(e,t)=>{if(e.getSystem().isConnected()){const n=o.get(e);eg.set(n,[_g(t)])}}},i=G([e.icon.toArray(),[e.level],A.from(XO[e.level]).toArray()]),l=xv(Bv.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":e.backstageProvider.translate("Close")}},components:[YO("close",{tag:"span",classes:["tox-icon"]},e.iconProvider)],buttonBehaviours:sd([Kb.config({}),fv.config({...e.backstageProvider.tooltips.getConfig({tooltipText:e.backstageProvider.translate("Close")})})]),action:t=>{e.onAction(t)}})),c=((e,t,o)=>{const n=o(),s=j(e,e=>be(n,WO(e,n)));return qO({tag:"div",classes:["tox-notification__icon"]},s.getOr(HO),n,A.none())})(i,0,e.iconProvider),d=[c,{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:sd([eg.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":t},classes:["tox-notification","tox-notification--in",`tox-notification--${e.level}`]},behaviours:sd([Kb.config({}),hd.config({}),Sm.config({mode:"special",onEscape:t=>(e.onAction(t),A.some(!0))})]),components:d.concat(e.progress?[r.asSpec()]:[]).concat([l.asSpec()]),apis:a}},configFields:[Kr("level","info",["success","error","warning","warn","info"]),Ar("progress"),Lr("icon"),Ar("onAction"),Ar("text"),Ar("iconProvider"),Ar("backstageProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var JO=(e,t,o,n)=>{const s=t.backstage.shared,r=()=>ct(""===e.queryCommandValue("ToggleView")?e.getContentAreaContainer():e.getContainer()),a=()=>{const e=Es(r());return A.some(e)},i=e=>{a().each(t=>{N(e,e=>{cn(e.element,"width"),bn(e.element)>t.width&&en(e.element,"width",t.width+"px")})})};return{open:(t,l,c)=>{const d=()=>{n.on(t=>{l();const o=c();(e=>{eg.remove(e,u),m()})(t),((t,o)=>{0===ao(t.element).length?((t,o)=>{Zx.hide(t),n.clear(),o&&e.focus()})(t,o):((e,t)=>{t&&Sm.focusIn(e)})(t,o)})(t,o)})},u=Dg(KO.sketch({text:t.text,level:I(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:d,iconProvider:s.providers.icons,backstageProvider:s.providers}));if(n.isSet()){const e=Mg(u);n.on(t=>{eg.append(t,e),Zx.reposition(t),u.hasConfigured(Ap)&&Ap.refresh(t),i(t.components())})}else{const t=Dg(Zx.sketch({dom:{tag:"div",classes:["tox-notifications-container"],attributes:{"aria-label":"Notifications",role:"region"}},lazySink:s.getSink,fireDismissalEventInstead:{},...s.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}},inlineBehaviours:sd([Sm.config({mode:"cyclic",selector:".tox-notification, .tox-notification a, .tox-notification button"}),eg.config({}),...YC(e)&&s.header.isPositionedAtTop()?[]:[Ap.config({contextual:{lazyContext:()=>A.some(Es(r())),fadeInClass:"tox-notification-container-dock-fadein",fadeOutClass:"tox-notification-container-dock-fadeout",transitionClass:"tox-notification-container-dock-transition"},modes:["top"],lazyViewport:t=>ok(e,t.element).map(e=>({bounds:nk(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Sn(e.element).top})})).getOrThunk(()=>({bounds:Ms(),optScrollEnv:A.none()}))})]])})),i=Mg(u),l={maxHeightFunction:Cc()},c={...s.anchors.banner(),overrides:l};n.set(t),o.add(t),Zx.showWithinBounds(t,i,{anchor:c},a)}h(t.timeout)&&t.timeout>0&&VS.setEditorTimeout(e,()=>{d()},t.timeout);const m=()=>{n.on(e=>{Zx.reposition(e),e.hasConfigured(Ap)&&Ap.refresh(e),i(e.components())})};return{close:d,reposition:m,text:e=>{KO.updateText(u,e)},settings:t,getEl:()=>u.element.dom,progressBar:{value:e=>{KO.updateProgress(u,e)}}}},close:e=>{e.close()},getArgs:e=>e.settings}};var QO;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(QO||(QO={}));var ZO=QO;const e_="tox-menu-nav__js",t_="tox-collection__item",o_="tox-swatch",n_={normal:e_,color:o_},s_="tox-collection__item--enabled",r_="tox-collection__item-icon",a_="tox-collection__item-label",i_="tox-collection__item-caret",l_="tox-collection__item--active",c_="tox-collection__item-container",d_="tox-collection__item-container--row",u_=e=>fe(n_,e).getOr(e_),m_=e=>"color"===e?"tox-swatches":"tox-menu",g_=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:m_(e),tieredMenu:"tox-tiered-menu"}),p_=e=>{const t=g_(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:u_(e)}},h_=(e,t,o)=>{const n=g_(o);return{tag:"div",classes:G([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},f_=[sx.parts.items({})],b_=(e,t,o)=>{const n=g_(o);return{dom:{tag:"div",classes:G([[n.tieredMenu]])},markers:p_(o)}},v_=ze("refetch-trigger-event"),x_=ze("redirect-menu-item-interaction"),y_="tox-menu__searcher",w_=e=>Vn(e.element,`.${y_}`).bind(t=>e.getSystem().getByDom(t).toOptional()),S_=w_,C_=e=>({fetchPattern:ef.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),k_=e=>{const t=(e,t)=>(t.cut(),A.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return Ic(e,x_,o),A.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[t_]},components:[sy.sketch({inputClasses:[y_,"tox-textfield"],inputAttributes:{...e.placeholder.map(t=>({placeholder:e.i18n(t)})).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:sd([dd(n,[Uc(ba(),e=>{Fc(e,v_)}),Uc(ha(),(e,t)=>{"Escape"===t.event.raw.key&&t.stop()})]),Sm.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,Sm.name()]}})]}},O_="tox-collection--results__js",__=e=>e.dom?{...e,dom:{...e.dom,attributes:{...e.dom.attributes??{},id:ze("aria-item-search-result-id"),"aria-selected":"false"}}}:e,T_="Use arrow keys to navigate.",E_=(e,t)=>o=>{const n=V(o,t);return L(n,t=>({dom:e,components:t}))},A_=(e,t)=>{const o=[];let n=[];return N(e,(e,s)=>{t(e,s)?(n.length>0&&o.push(n),n=[],(be(e.dom,"innerHtml")||e.components&&e.components.length>0)&&n.push(e)):n.push(e)}),n.length>0&&o.push(n),L(o,e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e}))},D_=(e,t,o)=>sx.parts.items({preprocess:n=>{const s=L(n,o);return"auto"!==e&&e>1?E_({tag:"div",classes:["tox-collection__group"]},e)(s):A_(s,(e,o)=>"separator"===t[o].type)}}),M_=(e,t,o=!0)=>{return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{...(n=t,R(n,e=>"widget"===e.type)?{"aria-label":NO.translate(T_)}:{})}},components:[D_(e,t,w)]};var n},B_=e=>R(e,e=>"icon"in e&&void 0!==e.icon),F_=e=>(console.error(Cr(e)),console.log(e),A.none()),I_=(e,t,o,n,s)=>{const r=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[sx.parts.items({preprocess:e=>A_(e,(e,t)=>"separator"===a[t].type)})]});var a;return{value:e,dom:r.dom,components:r.components,items:o}},R_=(e,t,o,n,s)=>{if("color"===s.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"],attributes:{"aria-label":NO.translate(T_)}},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[sx.parts.items({preprocess:"auto"!==e?E_({tag:"div",classes:["tox-swatches__row"]},e):w})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("imageselector"===s.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-image-selector-menu"]},components:[{dom:{tag:"div",classes:["tox-image-selector"]},components:[sx.parts.items({preprocess:"auto"!==e?E_({tag:"div",classes:["tox-image-selector__row"]},e):w})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType&&"auto"===n){const t=M_(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType||"searchable"===s.menuType){const t="searchable"!==s.menuType?M_(n,o):"search-with-field"===s.searchMode.searchMode?((e,t,o)=>{const n=ze("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[k_({i18n:NO.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],O_],attributes:{id:n}},components:[D_(e,t,__)]}]}})(n,o,s.searchMode):((e,t)=>{const o=ze("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",O_].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:o}},components:[D_(e,t,__)]}})(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===s.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[sx.parts.items({preprocess:E_({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:h_(t,n,s.menuType),components:f_,items:o}},z_=Br("type"),V_=Br("name"),L_=Br("label"),N_=Br("text"),P_=Br("title"),H_=Br("icon"),U_=Br("url"),W_=Br("value"),j_=Ir("fetch"),$_=Ir("getSubmenuItems"),G_=Ir("onAction"),q_=Ir("onItemAction"),Y_=Qr("onSetup",()=>b),X_=Hr("name"),K_=Hr("text"),J_=Hr("role"),Q_=Hr("icon"),Z_=Hr("tooltip"),eT=Hr("chevronTooltip"),tT=Hr("label"),oT=Hr("shortcut"),nT=Wr("select"),sT=Wr("onDoubleClick"),rT=Jr("active",!1),aT=Jr("borderless",!1),iT=Jr("enabled",!0),lT=Jr("primary",!1),cT=e=>Gr("columns",e),dT=Gr("meta",{}),uT=Qr("onAction",b),mT=e=>Xr("type",e),gT=e=>_r("name","name",tr(()=>ze(`${e}-name`)),Ks),pT=[z_,N_,Fr("level",["info","warn","error","success"]),H_,Gr("url","")],hT=mr(pT),fT=[z_,N_,iT,gT("button"),Q_,aT,Ur("buttonType",["primary","secondary","toolbar"]),lT,Xr("context","mode:design")],bT=mr(fT),vT=[z_,V_],xT=vT.concat([tT]),yT=vT.concat([L_,iT,Xr("context","mode:design")]),wT=mr(yT),ST=Js,CT=xT.concat([cT("auto"),Xr("context","mode:design")]),kT=mr(CT),OT=fr([W_,N_,H_]),_T=xT.concat([Xr("storageKey","default"),Xr("context","mode:design")]),TT=mr(_T),ET=Ks,AT=mr(xT),DT=Ks,MT=vT.concat([Xr("tag","textarea"),Br("scriptId"),Br("scriptUrl"),Wr("onFocus"),qr("settings",void 0,er)]),BT=vT.concat([Xr("tag","textarea"),Ir("init")]),FT=vr(e=>yr("customeditor.old",ur(BT),e).orThunk(()=>yr("customeditor.new",ur(MT),e))),IT=Ks,RT=[iT,K_,J_,oT,_r("value","value",tr(()=>ze("menuitem-value")),qs()),dT,Xr("context","mode:design")];const zT=mr([z_,V_].concat(RT)),VT=Js,LT=[gT("button"),Q_,Kr("align","end",["start","end"]),lT,iT,Ur("buttonType",["primary","secondary"]),Xr("context","mode:design")],NT=[...LT,N_],PT=[Fr("type",["submit","cancel","custom"]),...NT],HT=[Fr("type",["menu"]),K_,Z_,Q_,Vr("items",zT),...LT],UT=[...LT,Fr("type",["togglebutton"]),Z_,Q_,K_,Jr("active",!1)],WT=kr("type",{submit:PT,cancel:PT,custom:PT,menu:HT,togglebutton:UT}),jT=xT.concat([Xr("context","mode:design"),Hr("dropAreaLabel"),Hr("buttonLabel"),Hr("allowedFileTypes"),jr("allowedFileExtensions",Ks),Qr("onInvalidFiles",()=>Promise.resolve())]),$T=mr(jT),GT=gr(Gs),qT=e=>[z_,Mr("columns"),e],YT=[z_,Br("html"),Kr("presets","presentation",["presentation","document"]),Qr("onInit",b),Jr("stretched",!1)],XT=mr(YT),KT=xT.concat([Jr("border",!1),Jr("sandboxed",!0),Jr("streamContent",!1),Jr("transparent",!0)]),JT=mr(KT),QT=Ks,ZT=mr(vT.concat([Hr("height")])),eE=mr([Br("url"),Pr("zoom"),Pr("cachedWidth"),Pr("cachedHeight")]),tE=xT.concat([Hr("inputMode"),Hr("placeholder"),Jr("maximized",!1),iT,Xr("context","mode:design")]),oE=mr(tE),nE=Ks,sE=e=>[z_,L_,e,Kr("align","start",["start","center","end"]),Hr("for")],rE=[N_,W_],aE=[N_,Vr("items",Or(0,()=>iE))],iE=pr([mr(rE),mr(aE)]),lE=xT.concat([Vr("items",iE),iT,Xr("context","mode:design")]),cE=mr(lE),dE=Ks,uE=xT.concat([zr("items",[N_,W_]),Yr("size",1),iT,Xr("context","mode:design")]),mE=mr(uE),gE=Ks,pE=xT.concat([Jr("constrain",!0),iT,Xr("context","mode:design")]),hE=mr(pE),fE=mr([Br("width"),Br("height")]),bE=vT.concat([L_,Yr("min",0),Yr("max",0)]),vE=mr(bE),xE=Xs,yE=[z_,Vr("header",Ks),Vr("cells",gr(Ks))],wE=mr(yE),SE=xT.concat([Hr("placeholder"),Jr("maximized",!1),iT,Xr("context","mode:design"),Nr("spellcheck",Js)]);const CE=mr(SE),kE=Ks,OE=[Xr("buttonType","default"),Hr("text"),Hr("tooltip"),Hr("icon"),qr("search",!1,pr([Js,mr([Hr("placeholder")])],e=>d(e)?e?A.some({placeholder:A.none()}):A.none():A.some(e))),Ir("fetch"),Qr("onSetup",()=>b),Xr("context","mode:design")],_E=mr([z_,...OE]),TE=e=>yr("menubutton",_E,e),EE=[Fr("type",["directory","leaf"]),P_,Br("id"),Nr("menu",_E),Hr("customStateIcon"),Hr("customStateIconTooltip")],AE=mr(EE),DE=EE.concat([Vr("children",Or(0,()=>br("type",{directory:ME,leaf:AE})))]),ME=mr(DE),BE=br("type",{directory:ME,leaf:AE}),FE=[z_,Vr("items",BE),Wr("onLeafAction"),Wr("onToggleExpand"),Zr("defaultExpandedIds",[],Ks),Hr("defaultSelectedId")],IE=mr(FE),RE=xT.concat([Kr("filetype","file",["image","media","file"]),iT,Hr("picker_text"),Xr("context","mode:design")]),zE=mr(RE),VE=mr([W_,dT]),LE=e=>_r("items","items",{tag:"required",process:{}},gr(vr(t=>yr(`Checking item of ${e}`,NE,t).fold(e=>Ae.error(Cr(e)),e=>Ae.value(e))))),NE=cr(()=>{return br("type",{alertbanner:hT,bar:mr((e=LE("bar"),[z_,e])),button:bT,checkbox:wT,colorinput:TT,colorpicker:AT,dropzone:$T,grid:mr(qT(LE("grid"))),iframe:JT,input:oE,listbox:cE,selectbox:mE,sizeinput:hE,slider:vE,textarea:CE,urlinput:zE,customeditor:FT,htmlpanel:XT,imagepreview:ZT,collection:kT,label:mr(sE(LE("label"))),table:wE,tree:IE,panel:HE});var e}),PE=[z_,Gr("classes",[]),Vr("items",NE)],HE=mr(PE),UE=[gT("tab"),P_,Vr("items",NE)],WE=[z_,zr("tabs",UE),Jr("dynamicHeight",!1)],jE=mr(WE),$E=NT,GE=WT,qE=mr([Br("title"),Dr("body",br("type",{panel:HE,tabpanel:jE})),Xr("size","normal"),Zr("buttons",[],GE),Gr("initialData",{}),Qr("onAction",b),Qr("onChange",b),Qr("onSubmit",b),Qr("onClose",b),Qr("onCancel",b),Qr("onTabChange",b)]),YE=mr([Fr("type",["cancel","custom"]),...$E]),XE=mr([Br("title"),Br("url"),Pr("height"),Pr("width"),jr("buttons",YE),Qr("onAction",b),Qr("onCancel",b),Qr("onClose",b),Qr("onMessage",b)]),KE=e=>a(e)?[e].concat(q(he(e),KE)):l(e)?q(e,KE):[],JE=e=>r(e.type)&&r(e.name),QE={checkbox:ST,colorinput:ET,colorpicker:DT,dropzone:GT,input:nE,iframe:QT,imagepreview:eE,selectbox:gE,sizeinput:fE,slider:xE,listbox:dE,size:fE,textarea:kE,urlinput:VE,customeditor:IT,collection:OT,togglemenuitem:VT},ZE=e=>{const t=(e=>H(KE(e),JE))(e),o=q(t,e=>(e=>A.from(QE[e.type]))(e).fold(()=>[],t=>[Dr(e.name,t)]));return mr(o)},eA=e=>({internalDialog:wr(yr("dialog",qE,e)),dataValidator:ZE(e),initialData:e.initialData??{}}),tA={open:(e,t)=>{const o=eA(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(wr(yr("dialog",XE,t))),redial:e=>eA(e)},oA=mr([z_,K_]),nA=mr([mT("autocompleteitem"),rT,iT,dT,W_,K_,Q_]),sA=[iT,Z_,Q_,K_,Y_,Xr("context","mode:design")],rA=mr([z_,G_,oT].concat(sA)),aA=e=>yr("toolbarbutton",rA,e),iA=[rT].concat(sA),lA=mr(iA.concat([z_,G_,sT,oT])),cA=e=>yr("ToggleButton",lA,e),dA=[Qr("predicate",T),Kr("scope","node",["node","editor"]),Kr("position","selection",["node","selection","line"])],uA=sA.concat([mT("contextformbutton"),Xr("align","end"),lT,G_,Tr("original",w)]),mA=iA.concat([mT("contextformbutton"),Xr("align","end"),lT,G_,Tr("original",w)]),gA=sA.concat([mT("contextformbutton")]),pA=iA.concat([mT("contextformtogglebutton")]),hA=[tT,Vr("commands",kr("type",{contextformbutton:uA,contextformtogglebutton:mA})),Nr("launch",kr("type",{contextformbutton:gA,contextformtogglebutton:pA})),Qr("onInput",b),Qr("onSetup",b)],fA=[...dA,...hA,Fr("type",["contextform"]),Qr("initValue",y("")),Hr("placeholder")],bA=[...dA,...hA,Fr("type",["contextsliderform"]),Qr("initValue",y(0)),Qr("min",y(0)),Qr("max",y(100))],vA=[...dA,...hA,Fr("type",["contextsizeinputform"]),Qr("initValue",y({width:"",height:""}))],xA=kr("type",{contextform:fA,contextsliderform:bA,contextsizeinputform:vA}),yA=sA.concat([mT("contexttoolbarbutton")]),wA=mr([mT("contexttoolbar"),$r("launch",yA),Dr("items",pr([Ks,fr([Hr("name"),Hr("label"),Vr("items",Ks)])]))].concat(dA)),SA=e=>({name:e.name.getOrUndefined(),label:e.label.getOrUndefined(),items:e.items}),CA=[z_,Br("src"),Hr("alt"),Zr("classes",[],Ks)],kA=mr(CA),OA=[z_,N_,X_,Zr("classes",["tox-collection__item-label"],Ks)],_A=mr(OA),TA=cr(()=>br("type",{cardimage:kA,cardtext:_A,cardcontainer:EA})),EA=mr([z_,Xr("direction","horizontal"),Xr("align","left"),Xr("valign","middle"),Vr("items",TA)]),AA=mr([z_,tT,Vr("items",TA),Y_,uT].concat(RT)),DA=mr([z_,rT,Q_,tT].concat(RT)),MA=[z_,Br("fancytype"),uT],BA=[Gr("initData",{})].concat(MA),FA=[Wr("select"),ea("initData",{},[Jr("allowCustomColors",!0),Xr("storageKey","default"),jr("colors",qs())])].concat(MA),IA=[Wr("select"),Rr("initData",[Mr("columns"),Zr("items",[],qs())])].concat(MA),RA=kr("fancytype",{inserttable:BA,colorswatch:FA,imageselect:IA}),zA=mr([z_,rT,U_,tT,Z_].concat(RT)),VA=mr([z_,rT,H_,L_,Z_,W_].concat(RT)),LA=mr([z_,Y_,uT,Q_].concat(RT)),NA=mr([z_,$_,Y_,Q_].concat(RT)),PA=mr([z_,Q_,rT,Y_,G_].concat(RT)),HA=mr([Q_,Z_,Jr("resizable",!1),Qr("onShow",b),Qr("onHide",b),Y_]),UA=mr([z_,Dr("items",pr([fr([V_,Vr("items",Ks)]),Ks]))].concat(sA)),WA=mr([z_,Z_,eT,Q_,K_,nT,j_,Y_,Kr("presets","normal",["normal","color","listpreview"]),cT(1),G_,q_,Xr("context","mode:design")]),jA=[K_,Q_,Hr("tooltip"),Kr("buttonType","secondary",["primary","secondary"]),Jr("borderless",!1),Ir("onAction"),Xr("context","mode:design")],$A={button:[...jA,N_,Fr("type",["button"])],togglebutton:[...jA,Jr("active",!1),Fr("type",["togglebutton"])]},GA=[Fr("type",["group"]),Zr("buttons",[],kr("type",$A))],qA=kr("type",{...$A,group:GA}),YA=mr([Zr("buttons",[],qA),Jr("keepToolbar",!1),Ir("onShow"),Ir("onHide")]),XA=(e,t,o)=>{const n=ts(e.element,"."+o);if(n.length>0){const e=$(n,e=>{const o=e.dom.getBoundingClientRect().top,s=n[0].dom.getBoundingClientRect().top;return Math.abs(o-s)>t}).getOr(n.length);return A.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return A.none()},KA=e=>((e,t)=>sd([dd(e,t)]))(ze("unnamed-events"),e),JA=e=>op.config({disabled:e,disableClass:"tox-collection__item--state-disabled"}),QA=e=>op.config({disabled:e}),ZA=e=>op.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),eD=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},tD=(e,t)=>Kc(o=>{p(e.onBeforeSetup)&&e.onBeforeSetup(o),eD(e,o)(o=>{const n=e.onSetup(o);p(n)&&t.set(n)})}),oD=(e,t)=>Jc(o=>eD(e,o)(t.get())),nD=(e,t,o)=>Jc(n=>(o.set(ef.getValue(n)),eD(e,n)(t.get()))),sD="silver.uistate",rD="setDisabled",aD="init",iD=["switchmode",aD],lD=(e,t)=>{const o=e.mainUi.outerContainer,n=[e.mainUi.mothership,...e.uiMotherships];t===rD&&N(n,e=>{e.broadcastOn([_d()],{target:o.element})}),N(n,e=>{e.broadcastOn([sD],t)})},cD=(e,t)=>{e.on("init SwitchMode",e=>{lD(t,e.type)}),e.on("DisabledStateChange",o=>{if(!o.isDefaultPrevented()){const n=o.state?rD:aD;lD(t,n),o.state||e.nodeChanged()}}),e.on("NodeChange",o=>{const n=e.ui.isEnabled()?o.type:rD;lD(t,n)}),GS(e)&&e.mode.set("readonly")},dD=e=>ib.config({channels:{[sD]:{onReceive:(t,o)=>{if(o===rD||"setEnabled"===o)return void op.set(t,o===rD);const{contextType:n,shouldDisable:s}=e();("mode"!==n||I(iD,o))&&op.set(t,s)}}}}),uD=(e,t)=>Zc((o,n)=>{eD(e,o)(e.onAction),e.triggersSubmenu||t!==ZO.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Fc(o,Na()),n.stop())}),mD={[Ra()]:["disabling","alloy.base.behaviour","toggling","item-events"]},gD=He,pD=(e,t,o,n)=>{const s=ye(b);return{type:"item",dom:t.dom,components:gD(t.optComponents),data:e.data,eventOrder:mD,hasSubmenu:e.triggersSubmenu,itemBehaviours:sd([dd("item-events",[uD(e,o),tD(e,s),oD(e,s)]),JA(()=>!e.enabled||n.checkUiComponentContext(e.context).shouldDisable),dD(()=>n.checkUiComponentContext(e.context)),eg.config({})].concat(e.itemBehaviours))}},hD=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),fD=(e,t)=>{const o=it("div");return $n(o,"tox-image-selector-loading-spinner"),{dom:{tag:e.tag,attributes:e.attributes??{},classes:e.classes},components:[{dom:{tag:"div",classes:["tox-image-selector-image-wrapper"]},components:[{dom:{tag:"img",attributes:{src:t},classes:["tox-image-selector-image-img"]}}]},...e.checkMark.toArray()],behaviours:sd([...e.behaviours??[],dd("render-image-events",[Kc(e=>{var t;t=e.element,$n(t,"tox-image-selector-loading-spinner-wrapper"),Fo(t,o),Vn(e.element,"img").each(t=>{qo(t).catch(e=>{console.error(e)}).finally(()=>{(e=>{qn(e,"tox-image-selector-loading-spinner-wrapper"),Wo(o)})(e.element)})})})])])}},bD=e=>{const t=PS.os.isMacOS()||PS.os.isiOS(),o=t?{alt:"\u2325",ctrl:"\u2303",shift:"\u21e7",meta:"\u2318",access:"\u2303\u2325"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),s=L(n,e=>{const t=e.toLowerCase().trim();return be(o,t)?o[t]:e});return t?s.join(""):s.join("+")},vD=(e,t,o=[r_])=>YO(e,{tag:"div",classes:o},t),xD=e=>({dom:{tag:"div",classes:[a_]},components:[_g(NO.translate(e))]}),yD=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),wD=(e,t)=>({dom:{tag:"div",classes:[a_]},components:[{dom:{tag:e.tag,styles:e.styles},components:[_g(NO.translate(t))]}]}),SD=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[_g(bD(e))]}),CD=e=>vD("checkmark",e,["tox-collection__item-checkmark"]),kD=(e,t)=>{const o=e.map(e=>({attributes:{id:ze("menu-item"),"aria-label":NO.translate(e)}})).getOr({});return{tag:"div",classes:[e_,t_].concat(t),...o}},OD=e=>({dom:{tag:"label"},components:[_g(e)]}),_D=(e,t,o,n=A.none())=>"color"===e.presets?((e,t,o)=>{const n=e.value,s=e.iconContent.map(e=>((e,t,o)=>{const n=t();return jO(e,n).or(o).getOrThunk(UO(n))})(e,t.icons,o)),r=e.ariaLabel.map(e=>({"aria-label":t.translate(e),"data-mce-name":e})).getOr({});return{dom:(()=>{const e=o_,t=s.getOr(""),o={tag:"div",attributes:r,classes:[e]};return"custom"===n?{...o,tag:"button",classes:[...o.classes,"tox-swatches__picker-btn"],innerHtml:t}:"remove"===n?{...o,classes:[...o.classes,"tox-swatch--remove"],innerHtml:t}:g(n)?{...o,attributes:{...o.attributes,"data-mce-color":n},styles:{"background-color":n},innerHtml:t}:o})(),optComponents:[]}})(e,t,n):"img"===e.presets?(e=>{var t,o;return{dom:kD(e.ariaLabel,["tox-collection__item-image-selector"]),optComponents:[A.some((t=e.iconContent.getOrDie(),o={tag:"div",classes:["tox-collection__item-image"],checkMark:e.checkMark},fD(o,t))),e.labelContent.map(OD)]}})(e):((e,t,o,n)=>{const s={tag:"div",classes:[r_]},r=o?e.iconContent.map(e=>YO(e,s,t.icons,n)).orThunk(()=>A.some({dom:s})):A.none(),a=e.checkMark,i=A.from(e.meta).fold(()=>xD,e=>be(e,"style")?C(wD,e.style):xD),l=e.htmlContent.fold(()=>e.textContent.map(i),e=>A.some(yD(e,[a_])));return{dom:kD(e.ariaLabel,[]),optComponents:[r,l,e.shortcutContent.map(SD),a,e.caret,e.labelContent.map(OD)]}})(e,t,o,n),TD=(e,t,o)=>fe(e,"tooltipWorker").map(e=>[fv.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:Cc}}),mode:"follow-highlight",onShow:(t,o)=>{e(e=>{fv.setComponents(t,[Tg({element:ct(e)})])})}})]).getOrThunk(()=>o.map(e=>[fv.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})]).getOr([])),ED=(e,t)=>{const o=(e=>LS.DOM.encode(e))(NO.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,e=>`<span class="tox-autocompleter-highlight">${e}</span>`)}return o},AD=(e,t,o,n,s,r,a,i=!0)=>{const l=_D({presets:o,textContent:t?e.text:A.none(),htmlContent:A.none(),labelContent:e.label,ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:A.none(),checkMark:t?A.some(CD(a.icons)):A.none(),caret:A.none(),value:e.value},a,i),c=e.text.filter(y(!t)).map(e=>fv.config(a.tooltips.getConfig({tooltipText:a.translate(e)})));return Le(pD({context:e.context,data:hD(e),enabled:e.enabled,getApi:e=>({setActive:t=>{sv.set(e,t)},isActive:()=>sv.isOn(e),isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(s),b),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,r,a),{toggling:{toggleClass:s_,toggleOnExecute:!1,selected:e.active,exclusive:!0}})},DD=e=>({type:"separator",dom:{tag:"div",classes:[t_,"tox-collection__group-heading"]},components:e.text.map(_g).toArray()}),MD=e=>({value:RD(e)}),BD=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,FD=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,ID=e=>BD.test(e)||FD.test(e),RD=e=>Ke(e,"#").toUpperCase(),zD=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},VD=e=>{const t=zD(e.red)+zD(e.green)+zD(e.blue);return MD(t)},LD=(e,t,o)=>({hue:e,saturation:t,value:o}),ND=e=>{let t=0,o=0,n=0;const s=e.red/255,r=e.green/255,a=e.blue/255,i=Math.min(s,Math.min(r,a)),l=Math.max(s,Math.max(r,a));return i===l?(n=i,LD(0,0,100*n)):(t=s===i?3:a===i?1:5,t=60*(t-(s===i?r-a:a===i?s-r:a-s)/(l-i)),o=(l-i)/l,n=l,LD(Math.round(t),Math.round(100*o),Math.round(100*n)))},PD=Math.min,HD=Math.max,UD=Math.round,WD=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,jD=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,$D=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),GD=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},qD=e=>{let t,o,n;const s=(e.hue||0)%360;let r=e.saturation/100,a=e.value/100;if(r=HD(0,PD(r,1)),a=HD(0,PD(a,1)),0===r)return t=o=n=UD(255*a),$D(t,o,n,1);const i=s/60,l=a*r,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=UD(255*(t+d)),o=UD(255*(o+d)),n=UD(255*(n+d)),$D(t,o,n,1)},YD=e=>{const t=(e=>{const t=(e=>{const t=e.value.replace(BD,(e,t,o,n)=>t+t+o+o+n+n);return{value:t}})(e),o=FD.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o})(e),o=parseInt(t[1],16),n=parseInt(t[2],16),s=parseInt(t[3],16);return $D(o,n,s,1)},XD=(e,t,o,n)=>{const s=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return $D(s,r,a,i)},KD=e=>{const t=WD.exec(e);if(null!==t)return A.some(XD(t[1],t[2],t[3],"1"));const o=jD.exec(e);return null!==o?A.some(XD(o[1],o[2],o[3],o[4])):A.none()},JD=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,QD=$D(255,0,0,1),ZD=e=>VD(qD(e)),eM=(e,t)=>{e.dispatch("ResizeContent",t)},tM=(e,t)=>{e.dispatch("TextColorChange",t)},oM=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),nM=e=>{e.dispatch("ToggleSidebar")},sM=e=>{e.dispatch("ContextToolbarClose")},rM=(e,t)=>()=>{e(),t()},aM=(e,t=E)=>lM(e,"NodeChange",o=>{o.setEnabled(e.selection.isEditable()&&t())}),iM=(e,t)=>o=>{const n=aM(e)(o),s=((e,t)=>o=>{const n=qe(),s=()=>{o.setActive(e.formatter.match(t));const s=e.formatter.formatChanged(t,o.setActive);n.set(s)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),n.clear()}})(e,t)(o);return()=>{n(),s()}},lM=(e,t,o)=>n=>{const s=()=>o(n),r=()=>{o(n),e.on(t,s)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),e.off(t,s)}},cM=e=>t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)})},dM=(e,t)=>()=>e.execCommand(t);var uM=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const mM={},gM=e=>fe(mM,e).getOrThunk(()=>{const t=`tinymce-custom-colors-${e}`,o=uM.getItem(t);if(m(o)){const e=uM.getItem("tinymce-custom-colors");uM.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=uM.getItem(e),n=r(o)?JSON.parse(o):[],s=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{s.splice(e,1)};return{add:o=>{((e,t)=>{const o=F(e,t);return-1===o?A.none():A.some(o)})(s,o).each(i),s.unshift(o),s.length>t&&s.pop(),uM.setItem(e,JSON.stringify(s))},state:()=>s.slice(0)}})(t,10);return mM[e]=n,n}),pM=(e,t)=>{gM(e).add(t)},hM="forecolor",fM="hilitecolor",bM=e=>{const t=[];for(let o=0;o<e.length;o+=2)t.push({text:e[o+1],value:e[o],icon:"checkmark",type:"choiceitem"});return t},vM=e=>t=>t.options.get(e),xM="#000000",yM=(e,t)=>t===hM&&e.options.isSet("color_map_foreground")?vM("color_map_foreground")(e):t===fM&&e.options.isSet("color_map_background")?vM("color_map_background")(e):e.options.isSet("color_map_raw")?vM("color_map_raw")(e):vM("color_map")(e),wM=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(yM(e,t).length))),SM=(e,t)=>{const o=vM("color_cols")(e),n=wM(e,t);return o===wM(e)?n:o},CM=(e,t="default")=>Math.round(t===hM?vM("color_cols_foreground")(e):t===fM?vM("color_cols_background")(e):vM("color_cols")(e)),kM=vM("custom_colors"),OM=vM("color_default_foreground"),_M=vM("color_default_background"),TM=(e,t)=>{const o=ct(e.selection.getStart()),n="hilitecolor"===t?as(o,e=>{if(Gt(e)){const t=nn(e,"background-color");return je((e=>KD(e).exists(e=>0!==e.alpha))(t),t)}return A.none()}).getOr("rgba(0, 0, 0, 0)"):nn(o,"color");return KD(n).map(e=>"#"+VD(e).value)},EM=e=>{const t="choiceitem",o={type:t,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"};return e?[o,{type:t,text:"Custom color",icon:"color-picker",value:"custom"}]:[o]},AM=(e,t,o,n)=>{"custom"===o?LM(e)(o=>{o.each(o=>{pM(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)})},TM(e,t).getOr(xM)):"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},DM=(e,t,o)=>e.concat((e=>L(gM(e).state(),e=>({type:"choiceitem",text:e,icon:"checkmark",value:e})))(t).concat(EM(o))),MM=(e,t,o)=>n=>{n(DM(e,t,o))},BM=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},FM=(e,t)=>{e.setTooltip(t)},IM=(e,t)=>o=>{const n=TM(e,t);return Pe(n,o.toUpperCase())},RM=(e,t,o)=>{if(ot(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",s=DM(yM(e,t),t,!1),r=j(s,e=>e.value===o).getOr({text:""}).text;return e.translate([n,e.translate(r)])},zM=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:RM(e,o,n.get()),chevronTooltip:"forecolor"===t?"Text color menu":"Background color menu",presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:IM(e,o),columns:CM(e,o),fetch:MM(yM(e,o),o,kM(e)),onAction:t=>{AM(e,o,n.get(),b)},onItemAction:(s,r)=>{AM(e,o,r,o=>{n.set(o),tM(e,{name:t,color:o})})},onSetup:s=>{BM(s,t,n.get());const r=n=>{n.name===t&&(BM(s,n.name,n.color),FM(s,RM(e,o,n.color)))};return e.on("TextColorChange",r),rM(aM(e)(s),()=>{e.off("TextColorChange",r)})}})},VM=(e,t,o,n,s)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(FM(n,RM(e,o,s.get())),BM(n,t,s.get()),aM(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:IM(e,o),initData:{storageKey:o},onAction:n=>{AM(e,o,n.value,o=>{s.set(o),tM(e,{name:t,color:o})})}}]})},LM=e=>(t,o)=>{let n=!1;const s={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:s,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const s=o.getData().colorpicker;n?(t(A.from(s)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",s]))},onClose:b,onCancel:()=>{t(A.none())}})},NM=(e,t,o,n,s,r,a,i)=>{const l=B_(t),c=PM(t,o,n,"color"!==s?"normal":"color",r,a,i);return R_(e,l,c,n,{menuType:s})},PM=(e,t,o,n,s,r,a)=>He(L(e,i=>{return"choiceitem"===i.type?(l=i,yr("choicemenuitem",DA,l)).fold(F_,i=>A.some(AD(i,1===o,n,t,r(i.value),s,a,B_(e)))):"imageitem"===i.type?(e=>yr("imagemenuitem",zA,e))(i).fold(F_,e=>A.some(((e,t,o,n,s)=>{const r=_D({presets:"img",textContent:A.none(),htmlContent:A.none(),ariaLabel:e.tooltip,iconContent:A.some(e.url),labelContent:e.label,shortcutContent:A.none(),checkMark:A.some(CD(s.icons)),caret:A.none(),value:e.value},s,!0),a=e.tooltip.map(e=>fv.config(s.tooltips.getConfig({tooltipText:s.translate(e)})));return Le(pD({context:e.context,data:hD(e),enabled:e.enabled,getApi:e=>({setActive:t=>{sv.set(e,t)},isActive:()=>sv.isOn(e),isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t)}),onAction:o=>{t(e.value),o.setActive(!0)},onSetup:e=>(e.setActive(o),b),triggersSubmenu:!1,itemBehaviours:[...a.toArray()]},r,n,s),{toggling:{toggleClass:s_,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(e,t,r(e.value),s,a))):"resetimage"===i.type?(e=>yr("resetimageitem",VA,e))(i).fold(F_,i=>A.some(AD({...i,text:i.tooltip,icon:A.some(i.icon),label:A.some(i.label)},1===o,n,t,r(i.value),s,a,B_(e)))):A.none();var l})),HM=(e,t)=>{const o=p_(t);return 1===e?{mode:"menu"}:"auto"===e?{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+{color:"tox-swatches__row",imageselector:"tox-image-selector__row",listpreview:"tox-collection__group",normal:"tox-collection__group"}[t],previousSelector:e=>"color"===t?Vn(e.element,"[aria-checked=true]"):A.none()}},UM=ze("cell-over"),WM=ze("cell-execute"),jM=(e,t,o)=>{const n=o=>Ic(o,WM,{row:e,col:t}),s=(e,t)=>{t.stop(),n(e)};return Dg({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:sd([dd("insert-table-picker-cell",[Uc(ma(),hd.focus),Uc(Ra(),n),Uc(xa(),s),Uc(Va(),s)]),sv.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),hd.config({onFocus:o=>Ic(o,UM,{row:e,col:t})})])})},$M=e=>q(e,e=>L(e,Mg)),GM=(e,t)=>_g(`${t}x${e}`),qM={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=(e=>{const t=[];for(let o=0;o<10;o++){const n=[];for(let t=0;t<10;t++){const s=e(o+1,t+1);n.push(jM(o,t,s))}t.push(n)}return t})(o),s=GM(0,0),r=xv({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[s],behaviours:sd([eg.config({})])});return{type:"widget",data:{value:ze("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ry.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:$M(n).concat(r.asSpec()),behaviours:sd([dd("insert-table-picker",[Kc(e=>{eg.set(r.get(e),[s])}),Gc(UM,(e,t,o)=>{const{row:s,col:a}=o.event;((e,t,o)=>{for(let n=0;n<10;n++)for(let s=0;s<10;s++)sv.set(e[n][s],n<=t&&s<=o)})(n,s,a),eg.set(r.get(e),[GM(s+1,a+1)])}),Gc(WM,(t,o,n)=>{const{row:s,col:r}=n.event;Fc(t,Na()),e.onAction({numRows:s+1,numColumns:r+1})})]),Sm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=((e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold(()=>DM(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o),e=>e.concat(EM(o)))})(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),s="color",r=NM(ze("menu-value"),o,t=>{e.onAction({value:t})},n,s,ZO.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),a={...r,markers:p_(s),movement:HM(n,s),showMenuRole:!1};return{type:"widget",data:{value:ze("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ry.widget(sx.sketch(a))]}},imageselect:(e,t)=>{const o="imageselector",n=e.initData.columns,s=NM(ze("menu-value"),e.initData.items,t=>{e.onAction({value:t})},n,o,ZO.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),r={...s,markers:p_(o),movement:HM(n,o),showMenuRole:!1};return{type:"widget",data:{value:ze("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem","tox-collection--toolbar"]},autofocus:!0,components:[ry.widget(sx.sketch(r))]}}},YM=(e,t)=>L(e,e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":d_,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[c_,o,n,(()=>{switch(e.valign){case"top":return"tox-collection__item-container--valign-top";case"middle":return"tox-collection__item-container--valign-middle";case"bottom":return"tox-collection__item-container--valign-bottom"}})()]},components:t}})(e,YM(e.items,t));case"cardimage":return((e,t,o)=>({dom:{tag:"img",classes:t,attributes:{src:e,alt:o.getOr("")}}}))(e.src,e.classes,e.alt);case"cardtext":const o=e.name.exists(e=>I(t.cardText.highlightOn,e)),n=o?A.from(t.cardText.matchText).getOr(""):"";return yD(ED(e.text,n),e.classes)}}),XM=(e,t,o)=>{S_(e).each(e=>{var n;((e,t)=>{No(t.element,"id").each(t=>zo(e.element,"aria-activedescendant",t))})(e,o),(Yn((n=t).element,O_)?A.some(n.element):Vn(n.element,"."+O_)).each(t=>{No(t,"id").each(t=>zo(e.element,"aria-controls",t))})}),zo(o.element,"aria-selected","true")},KM=(e,t,o)=>{zo(o.element,"aria-selected","false")},JM=e=>Ug.getExistingCoupled(e,"sandbox").bind(w_).map(C_).map(e=>e.fetchPattern).getOr("");var QM;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(QM||(QM={}));const ZM=(e,t,o,n,s)=>{const r=o.shared.providers,a=e=>s?{...e,shortcut:A.none(),icon:e.text.isSome()?A.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,yr("menuitem",LA,i)).fold(F_,e=>A.some(((e,t,o,n=!0)=>{const s=_D({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),labelContent:A.none(),ariaLabel:e.text,caret:A.none(),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return pD({context:e.context,data:hD(e),getApi:e=>({isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o)})(a(e),t,r,n)));case"nestedmenuitem":return(e=>yr("nestedmenuitem",NA,e))(e).fold(F_,e=>A.some(((e,t,o,n=!0,s=!1)=>{const r=s?(a=o.icons,vD("chevron-down",a,[i_])):(e=>vD("chevron-right",e,[i_]))(o.icons);var a;const i=_D({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,labelContent:A.none(),caret:A.some(r),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return pD({context:e.context,data:hD(e),getApi:e=>({isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t),setIconFill:(t,o)=>{Vn(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{zo(e,"fill",o)})},setTooltip:t=>{const n=o.translate(t);zo(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:b,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)})(a(e),t,r,n,s)));case"togglemenuitem":return(e=>yr("togglemenuitem",PA,e))(e).fold(F_,e=>A.some(((e,t,o,n=!0)=>{const s=_D({iconContent:e.icon,textContent:e.text,htmlContent:A.none(),labelContent:A.none(),ariaLabel:e.text,checkMark:A.some(CD(o.icons)),caret:A.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return Le(pD({context:e.context,data:hD(e),enabled:e.enabled,getApi:e=>({setActive:t=>{sv.set(e,t)},isActive:()=>sv.isOn(e),isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o),{toggling:{toggleClass:s_,toggleOnExecute:!1,selected:e.active},role:e.role.getOrUndefined()})})(a(e),t,r,n)));case"separator":return(e=>yr("separatormenuitem",oA,e))(e).fold(F_,e=>A.some(DD(e)));case"fancymenuitem":return(e=>yr("fancymenuitem",RA,e))(e).fold(F_,e=>((e,t)=>fe(qM,e.fancytype).map(o=>o(e,t)))(e,o));default:return console.error("Unknown item in general menu",e),A.none()}var i},eB=(e,t,o,n,s,r)=>{const a=B_(t),i=He(L(t,e=>{const t=e=>ZM(e,o,n,(e=>s?!be(e,"text"):a)(e),s);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?t({...e,enabled:!1}):t(e)})),l=(e=>"no-search"===e.searchMode?{menuType:"normal"}:{menuType:"searchable",searchMode:e})(r);return(s?I_:R_)(e,a,i,1,l)},tB=e=>mx.singleData(e.value,e),oB=e=>is(ct(e.startContainer),e.startOffset,ct(e.endContainer),e.endOffset),nB=(e,t)=>{const o=ze("autocompleter"),n=ye(!1),s=ye(!1),r=Ye(),a=Dg(Zx.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:sd([dd("dismissAutocompleter",[Uc(Ya(),()=>u()),Uc(ti(),(t,o)=>{No(o.event.target,"id").each(t=>zo(ct(e.getBody()),"aria-activedescendant",t))})])]),lazySink:t.getSink})),i=()=>Zx.isOpen(a),l=s.get,c=()=>{if(i()){Zx.hide(a),e.dom.remove(o,!1);const t=ct(e.getBody());No(t,"aria-owns").filter(e=>e===o).each(()=>{Ho(t,"aria-owns"),Ho(t,"aria-activedescendant")})}},d=()=>Zx.getContent(a).bind(e=>ee(e.components(),0)),u=()=>e.execCommand("mceAutocompleterClose"),m=s=>{const i=(o=>{const s=se(o,e=>A.from(e.columns)).getOr(1);return q(o,o=>((e,t,o,n,s,r,a)=>{const i=1===n,l=!i||B_(e);return He(L(e,e=>{switch(e.type){case"separator":return(n=e,yr("Autocompleter.Separator",oA,n)).fold(F_,e=>A.some(DD(e)));case"cardmenuitem":return(e=>yr("cardmenuitem",AA,e))(e).fold(F_,e=>A.some(((e,t,o,n)=>{const s={dom:kD(e.label,[]),optComponents:[A.some({dom:{tag:"div",classes:[c_,d_]},components:YM(e.items,n)})]};return pD({context:"mode:design",data:hD({text:A.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!op.isDisabled(e),setEnabled:t=>{op.set(e,!t),N(ts(e.element,"*"),o=>{e.getSystem().getByDom(o).each(e=>{e.hasConfigured(op)&&op.set(e,!t)})})}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:A.from(n.itemBehaviours).getOr([])},s,t,o.providers)})({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},s,r,{itemBehaviours:TD(e.meta,r,A.none()),cardText:{matchText:t,highlightOn:a}})));default:return(e=>yr("Autocompleter.Item",nA,e))(e).fold(F_,e=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=_D({presets:"normal",textContent:A.none(),htmlContent:o?e.text.map(e=>ED(e,t)):A.none(),ariaLabel:e.text,labelContent:A.none(),iconContent:e.icon,shortcutContent:A.none(),checkMark:A.none(),caret:A.none(),value:e.value},a.providers,i,e.icon),c=e.text.filter(e=>!o&&""!==e);return pD({context:"mode:design",data:hD(e),enabled:e.enabled,getApi:y({}),onAction:t=>s(e.value,e.meta),onSetup:y(b),triggersSubmenu:!1,itemBehaviours:TD(e,a,c)},l,r,a.providers)})(e,t,i,0,o,s,r,l)))}var n}))})(o.items,o.matchText,(t,s)=>{const a={hide:()=>u(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),r.get().each(e=>{n.set(!0),o.onAction(a,e,t,s),n.set(!1)})},s,ZO.BUBBLE_TO_SANDBOX,t,o.highlightOn))})(s);i.length>0?(((t,o)=>{const n=se(t,e=>A.from(e.columns)).getOr(1);Zx.showMenuAt(a,{anchor:{type:"selection",getSelection:()=>r.get().map(oB),root:ct(e.getBody())}},((e,t,o,n)=>{const s=HM(t,n),r=p_(n);return{data:tB({...e,movement:s,menuBehaviours:KA("auto"!==t?[]:[Kc((e,t)=>{XA(e,4,r.item).each(({numColumns:t,numRows:o})=>{Sm.setGridSize(e,o,t)})})])}),menu:{markers:p_(n),fakeFocus:o===QM.ContentFocus}}})(R_("autocompleter-value",!0,o,n,{menuType:"normal"}),n,QM.ContentFocus,"normal")),d().each(Yd.highlightFirst)})(s,i),zo(ct(e.getBody()),"aria-owns",o),e.inline||g()):c()},g=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),s=(e=>jo(e,!0))(a.element);tn(s,{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,s.dom),Vn(s,'[role="menu"]').each(e=>{cn(e,"position"),cn(e,"max-height")})};e.on("AutocompleterStart",({lookupData:e})=>{s.set(!0),n.set(!1),m(e)}),e.on("AutocompleterUpdate",({lookupData:e})=>m(e)),e.on("AutocompleterUpdateActiveRange",({range:e})=>r.set(e)),e.on("AutocompleterEnd",()=>{c(),s.set(!1),n.set(!1),r.clear()});((e,t)=>{const o=(e,t)=>{Ic(e,ha(),{raw:t})},n=()=>e.getMenu().bind(Yd.getHighlighted);t.on("keydown",t=>{const s=t.which;e.isActive()&&(e.isMenuOpen()?13===s?(n().each(Rc),t.preventDefault()):40===s?(n().fold(()=>{e.getMenu().each(Yd.highlightFirst)},e=>{o(e,t)}),t.preventDefault(),t.stopImmediatePropagation()):37!==s&&38!==s&&39!==s||n().each(e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()}):13!==s&&38!==s&&40!==s||e.cancelIfNecessary())}),t.on("NodeChange",()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()})})({cancelIfNecessary:u,isMenuOpen:i,isActive:l,isProcessingAction:n.get,getMenu:d},e)};var sB=tinymce.util.Tools.resolve("tinymce.html.Entities");const rB=(e,t,o,n)=>{const s=aB(e,t,o,n);return qx.sketch(s)},aB=(e,t,o,n)=>({dom:iB(o),components:e.toArray().concat([t]),fieldBehaviours:sd(n)}),iB=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),lB=(e,t)=>qx.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[_g(t.translate(e))]}),cB=ze("form-component-change"),dB=ze("form-component-input"),uB=ze("form-close"),mB=ze("form-cancel"),gB=ze("form-action"),pB=ze("form-submit"),hB=ze("form-block"),fB=ze("form-unblock"),bB=ze("form-tabchange"),vB=ze("form-resize"),xB=(e,t,o)=>{const n=e.label.map(e=>lB(e,t)),s=t.icons(),r=e=>(t,o)=>{Ln(o.event.target,"[data-collection-item-value]").each(n=>{e(t,o,n,Lo(n,"data-collection-item-value"))})},a=r((o,n,s,r)=>{n.stop(),t.checkUiComponentContext("mode:design").shouldDisable||t.isDisabled()||Ic(o,gB,{name:e.name,value:r})}),i=[Uc(ma(),r((e,t,o)=>{Oo(o,!0)})),Uc(xa(),a),Uc(Va(),a),Uc(ga(),r((e,t,o)=>{Vn(e.element,"."+l_).each(e=>{qn(e,l_)}),$n(o,l_)})),Uc(pa(),r(e=>{Vn(e.element,"."+l_).each(e=>{qn(e,l_),_o(e)})})),Zc(r((t,o,n,s)=>{Ic(t,gB,{name:e.name,value:s})}))],l=(e,t)=>L(ts(e.element,".tox-collection__item"),t),c=qx.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:w},behaviours:sd([op.config({disabled:()=>t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{l(e,e=>{$n(e,"tox-collection__item--state-disabled"),zo(e,"aria-disabled",!0)})},onEnabled:e=>{l(e,e=>{qn(e,"tox-collection__item--state-disabled"),Ho(e,"aria-disabled")})}}),dD(()=>t.checkUiComponentContext(e.context)),eg.config({}),fv.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{Vn(e.element,"."+l_+"[data-mce-tooltip]").each(o=>{No(o,"data-mce-tooltip").each(o=>{fv.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:Vn(e.element,"."+l_).orThunk(()=>yt(".tox-collection__item")),root:e.element,layouts:{onLtr:y([$l,jl,Pl,Ul,Hl,Wl]),onRtl:y([$l,jl,Pl,Ul,Hl,Wl])},bubble:yl(0,-2,{})})}),ef.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(o,n)=>{((o,n)=>{const r=t.checkUiComponentContext("mode:design").shouldDisable||t.isDisabled()?" tox-collection__item--state-disabled":"",a=L(n,t=>{const o=NO.translate(t.text),n=1===e.columns?`<div class="tox-collection__item-label">${o}</div>`:"",a=`<div class="tox-collection__item-icon">${(e=>s[e]??e)(t.icon)}</div>`,i={_:" "," - ":" ","-":" "},l=o.replace(/\_| \- |\-/g,e=>i[e]);return`<div data-mce-tooltip="${l}" class="tox-collection__item${r}" tabindex="-1" data-collection-item-value="${sB.encodeAllRaw(t.value)}" aria-label="${l}">${a}${n}</div>`}),i="auto"!==e.columns&&e.columns>1?V(a,e.columns):[a],l=L(i,e=>`<div class="tox-collection__group">${e.join("")}</div>`);Go(o.element,l.join(""))})(o,n),"auto"===e.columns&&XA(o,5,"tox-collection__item").each(({numRows:e,numColumns:t})=>{Sm.setGridSize(o,e,t)}),Fc(o,vB)}}),Kb.config({}),Sm.config((d=e.columns,1===d?{mode:"menu",selector:".tox-collection__item"}:"auto"===d?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${t_}`}})),dd("collection-events",i)]),eventOrder:{[Ra()]:["disabling","alloy.base.behaviour","collection-events"],[ga()]:["collection-events","tooltipping"]}});var d;return rB(n,c,["tox-form__group--collection"],[])},yB=ze("color-input-change"),wB=ze("color-swatch-change"),SB=ze("color-picker-cancel"),CB=()=>Lg.config({find:A.some}),kB=e=>Lg.config({find:t=>io(t.element,e).bind(e=>t.getSystem().getByDom(e).toOptional())}),OB=mr([Gr("preprocess",w),Gr("postprocess",w)]),_B=(e,t)=>{const o=Sr("RepresentingConfigs.memento processors",OB,t);return ef.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),s=ef.getValue(n);return o.postprocess(s)},setValue:(t,n)=>{const s=o.preprocess(n),r=e.get(t);ef.setValue(r,s)}}})},TB=(e,t,o)=>ef.config({store:{mode:"manual",...e.map(e=>({initialValue:e})).getOr({}),getValue:t,setValue:o}}),EB=(e,t,o)=>TB(e,e=>t(e.element),(e,t)=>o(e.element,t)),AB=e=>ef.config({store:{mode:"memory",initialValue:e}}),DB=ze("rgb-hex-update"),MB=ze("slider-update"),BB=ze("palette-update"),FB=ze("valid-input"),IB=ze("invalid-input"),RB=ze("validating-input"),zB="colorcustom.rgb.",VB={isEnabled:E,setEnabled:b,immediatelyShow:b,immediatelyHide:b},LB=(e,t,o,n,s,r)=>{const a=(e,t)=>{const o=t.get();e!==o.isEnabled()&&(o.setEnabled(e),e?o.immediatelyShow():o.immediatelyHide())},i=(o,n,s)=>tf.config({invalidClass:t("invalid"),notify:{onValidate:e=>{Ic(e,RB,{type:o})},onValid:e=>{a(!1,s),Ic(e,FB,{type:o,value:ef.getValue(e)})},onInvalid:e=>{a(!0,s),Ic(e,IB,{type:o,value:ef.getValue(e)})}},validator:{validate:t=>{const o=ef.getValue(t),s=n(o)?Ae.value(!0):Ae.error(e("aria.input.invalid"));return _e(s)},validateOnLoad:!1}}),l=(o,n,a,l,c)=>{const d=ye(VB),u=e(zB+"range"),m=qx.parts.label({dom:{tag:"label"},components:[_g(a)]}),g=qx.parts.field({data:c,factory:sy,inputAttributes:{type:"text","aria-label":l,..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:sd([i(n,o,d),Kb.config({}),fv.config({...s({tooltipText:"",onSetup:e=>{d.set({isEnabled:()=>fv.isEnabled(e),setEnabled:t=>fv.setEnabled(e,t),immediatelyShow:()=>fv.immediateOpenClose(e,!0),immediatelyHide:()=>fv.immediateOpenClose(e,!1)}),fv.setEnabled(e,!1)},onShow:(o,s)=>{fv.setComponents(o,[{dom:{tag:"p",classes:[t("rgb-warning-note")]},components:[_g(e("hex"===n?"colorcustom.rgb.invalidHex":"colorcustom.rgb.invalid"))]}])}})})]),onSetValue:e=>{tf.isInvalid(e)&&tf.run(e).get(b)}}),p=ze("aria-invalid"),h=xv(r("invalid",A.some(p),"warning")),f=[m,g,xv({dom:{tag:"div",classes:[t("invalid-icon")]},components:[h.asSpec()]}).asSpec()],v="hex"!==n?[qx.parts["aria-descriptor"]({text:u})]:[],x=f.concat(v);return{dom:{tag:"div",attributes:{role:"presentation"},classes:[t("rgb-container")]},components:x}},c=(e,t)=>{const o=t.red,n=t.green,s=t.blue;ef.setValue(e,{red:o,green:n,blue:s})},d=xv({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),u=(e,t)=>{d.getOpt(e).each(e=>{en(e.element,"background-color","#"+t.value)})},m=sh({factory:()=>{const s={red:ye(A.some(255)),green:ye(A.some(255)),blue:ye(A.some(255)),hex:ye(A.some("ffffff"))},r=e=>s[e].get(),a=(e,t)=>{s[e].set(t)},i=e=>{const t=e.red,o=e.green,n=e.blue;a("red",A.some(t)),a("green",A.some(o)),a("blue",A.some(n))},m=(e,t)=>{const o=t.event;"hex"!==o.type?a(o.type,A.none()):n(e)},g=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=MD(t);a("hex",A.some(n.value));const s=YD(n);c(e,s),i(s),Ic(e,DB,{hex:n}),u(e,n)})(e,n.value):((e,t,o)=>{const n=parseInt(o,10);a(t,A.some(n)),r("red").bind(e=>r("green").bind(t=>r("blue").map(o=>$D(e,t,o,1)))).each(t=>{const o=((e,t)=>{const o=VD(t);return Ix.getField(e,"hex").each(t=>{hd.isFocused(t)||ef.setValue(e,{hex:o.value})}),o})(e,t);Ic(e,DB,{hex:o}),u(e,o)})})(e,n.type,n.value)},p=t=>({label:e(zB+t+".label"),description:e(zB+t+".description")}),h=p("red"),f=p("green"),b=p("blue"),v=p("hex");return Le(Ix.sketch(o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",qx.sketch(l(GD,"red",h.label,h.description,255))),o.field("green",qx.sketch(l(GD,"green",f.label,f.description,255))),o.field("blue",qx.sketch(l(GD,"blue",b.label,b.description,255))),o.field("hex",qx.sketch(l(ID,"hex",v.label,v.description,"ffffff"))),d.asSpec()],formBehaviours:sd([tf.config({invalidClass:t("form-invalid")}),dd("rgb-form-events",[Uc(FB,g),Uc(IB,m),Uc(RB,m)])])})),{apis:{updateHex:(e,t)=>{ef.setValue(e,{hex:t.value}),((e,t)=>{const o=YD(t);c(e,o),i(o)})(e,t),u(e,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return m},NB=(e,t,o,n)=>{const s=sh({name:"ColourPicker",configFields:[Ar("dom"),Gr("onValidHex",b),Gr("onInvalidHex",b)],factory:s=>{const r=LB(e,t,s.onValidHex,s.onInvalidHex,o,n),a=((e,t)=>{const o=Gw.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=Gw.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:`<div class=${t("sv-palette-inner-thumb")} role="presentation"></div>`}}),s=(e,t)=>{const{width:o,height:n}=e,s=e.getContext("2d");if(null===s)return;s.fillStyle=t,s.fillRect(0,0,o,n);const r=s.createLinearGradient(0,0,o,0);r.addColorStop(0,"rgba(255,255,255,1)"),r.addColorStop(1,"rgba(255,255,255,0)"),s.fillStyle=r,s.fillRect(0,0,o,n);const a=s.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=a,s.fillRect(0,0,o,n)},r=sh({factory:r=>{const a=y({x:0,y:0}),i=sd([Lg.config({find:A.some}),hd.config({})]);return Gw.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:(t,o,n)=>{h(n)||zo(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),Ic(t,BB,{value:n})},onInit:(e,t,o,n)=>{s(o.element.dom,JD(QD))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=LD(t,100,100),r=qD(n);s(o,JD(r))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=ND(YD(o));Gw.setValue(t,{x:n.saturation,y:100-n.value}),zo(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}});return r})(e,t),i={paletteRgba:ye(QD),paletteHue:ye(0)},l=xv(((e,t)=>{const o=Gw.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=Gw.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return Gw.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:y(0)},components:[o,n],sliderBehaviours:sd([hd.config({})]),onChange:(e,t,o)=>{zo(e.element,"aria-valuenow",Math.floor(360-3.6*o)),Ic(e,MB,{value:o})}})})(0,t)),c=xv(a.sketch({})),d=xv(r.sketch({})),u=(e,t,o)=>{c.getOpt(e).each(e=>{a.setHue(e,o)})},m=(e,t)=>{d.getOpt(e).each(e=>{r.updateHex(e,t)})},g=(e,t,o)=>{l.getOpt(e).each(e=>{Gw.setValue(e,(e=>100-e/360*100)(o))})},p=(e,t)=>{c.getOpt(e).each(e=>{a.setThumb(e,t)})},f=(e,t,o,n)=>{((e,t)=>{const o=YD(e);i.paletteRgba.set(o),i.paletteHue.set(t)})(t,o),N(n,n=>{n(e,t,o)})};return{uid:s.uid,dom:s.dom,components:[c.asSpec(),l.asSpec(),d.asSpec()],behaviours:sd([dd("colour-picker-events",[Uc(DB,(()=>{const e=[u,g,p];return(t,o)=>{const n=o.event.hex,s=(e=>ND(YD(e)))(n);f(t,n,s.hue,e)}})()),Uc(BB,(()=>{const e=[m];return(t,o)=>{const n=o.event.value,s=i.paletteHue.get(),r=LD(s,n.x,100-n.y),a=ZD(r);f(t,a,s,e)}})()),Uc(MB,(()=>{const e=[u,m];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),s=i.paletteRgba.get(),r=ND(s),a=LD(n,r.saturation,r.value),l=ZD(a);f(t,l,n,e)}})())]),Lg.config({find:e=>d.getOpt(e)}),Sm.config({mode:"acyclic"})])}}});return s},PB={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red channel","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green channel","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue channel","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","colorcustom.rgb.invalid":"Numbers only, 0 to 255","colorcustom.rgb.invalidHex":"Hexadecimal only, 000000 to FFFFFF","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var HB=tinymce.util.Tools.resolve("tinymce.Resource");const UB=e=>be(e,"init");var WB=tinymce.util.Tools.resolve("tinymce.util.Tools");const jB=ze("browse.files.event"),$B=(e,t,o)=>{const n=(e,t)=>{t.stop()},s=e=>(t,o)=>{N(e,e=>{e(t,o)})},r=xv({dom:{tag:"input",attributes:{type:"file",accept:e.allowedFileTypes.getOr("image/*")},styles:{display:"none"}},behaviours:sd([dd("input-file-events",[qc(xa()),qc(Va())])])}),a=e.label.map(e=>lB(e,t)),i=qx.parts.field({factory:Bv,dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[_g(t.translate(e.buttonLabel.getOr("Browse for an image"))),r.asSpec()],action:e=>{r.get(e).element.dom.click()},buttonBehaviours:sd([CB(),AB(o.getOr([])),Kb.config({}),QA(()=>t.checkUiComponentContext(e.context).shouldDisable),dD(()=>t.checkUiComponentContext(e.context))])}),l={dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:sd([op.config({disabled:()=>t.checkUiComponentContext(e.context).shouldDisable}),dD(()=>t.checkUiComponentContext(e.context)),sv.config({toggleClass:"dragenter",toggleOnExecute:!1}),dd("dropzone-events",[Uc("dragenter",s([n,sv.toggle])),Uc("dragleave",s([n,sv.toggle])),Uc("dragover",n),Uc("drop",s([n,(e,t)=>{if(!op.isDisabled(e)){const o=t.event.raw;Ic(e,jB,{files:o.dataTransfer?.files})}}])),Uc(va(),(e,t)=>{const o=t.event.raw.target;Ic(e,jB,{files:o.files})})])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[_g(t.translate(e.dropAreaLabel.getOr("Drop an image here")))]},i]}]};return rB(a,l,["tox-form__group--stretched"],[dd("handle-files",[Uc(jB,(o,n)=>{qx.getField(o).each(o=>{((o,n)=>{if(n){const s=((e,t,o)=>{const n=WB.explode(t.getOption("images_file_types"));return H(ne(e),e=>o.fold(()=>R(n,t=>Ze(e.name.toLowerCase(),`.${t.toLowerCase()}`)),t=>R(t,t=>Ze(e.name.toLowerCase(),`.${t.toLowerCase()}`))))})(n,t,e.allowedFileExtensions);ef.setValue(o,s),Ic(o,cB,{name:e.name}),0===s.length&&e.onInvalidFiles().finally(()=>{o.element.dom.focus()}).catch(b)}})(o,n.event.files)})})])])},GB=ze("alloy-fake-before-tabstop"),qB=ze("alloy-fake-after-tabstop"),YB=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:sd([hd.config({ignore:!0}),Kb.config({})])}),XB=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[YB([GB]),t,YB([qB])],behaviours:sd([kB(1)])}),KB=(e,t)=>{Ic(e,ha(),{raw:{which:9,shiftKey:t}})},JB=(e,t)=>{const o=t.element;Yn(o,GB)?KB(e,!0):Yn(o,qB)&&KB(e,!1)},QB=e=>ns(e,["."+GB,"."+qB].join(","),T),ZB=ze("update-dialog"),eF=ze("update-title"),tF=ze("update-body"),oF=ze("update-footer"),nF=ze("body-send-message"),sF=ze("dialog-focus-shifted"),rF=Pt().browser,aF=rF.isSafari(),iF=rF.isFirefox(),lF=aF||iF,cF=rF.isChromium(),dF=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,uF=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),mF=(e,t,o)=>{const n=e.dom;A.from(n.contentDocument).fold(o,e=>{let o=0;const s=((e,t)=>{const o=e.body;return A.from(!/^<!DOCTYPE (html|HTML)/.test(t)&&(!cF&&!aF||g(o)&&(0!==o.scrollTop||Math.abs(o.scrollHeight-o.clientHeight)>1))?o:e.documentElement)})(e,t).map(e=>(o=e.scrollTop,e)).forall(dF),r=()=>{const e=n.contentWindow;g(e)&&(s?uF(e,"bottom"):!s&&lF&&0!==o&&uF(e,o))};aF&&n.addEventListener("load",r,{once:!0}),e.open(),e.write(t),e.close(),aF||r()})},gF=je(lF,aF?500:200).map(e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...s)=>{n=s,c(o)&&(o=setTimeout(()=>{const t=n;o=null,n=null,e.apply(null,t)},t))}}})(mF,e)),pF=ze("toolbar.button.execute"),hF=ze("common-button-display-events"),fF={[Ra()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[Ga()]:["toolbar-button-events",hF],[qa()]:["toolbar-button-events","dropdown-events","tooltipping"],[la()]:["focusing","alloy.base.behaviour",hF]},bF=e=>en(e.element,"width",nn(e.element,"width")),vF=(e,t,o)=>YO(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),xF=(e,t)=>vF(e,t,[]),yF=(e,t)=>vF(e,t,[eg.config({})]),wF=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[_g(o.translate(e))],behaviours:sd([eg.config({})])}),SF=ze("update-menu-text"),CF=ze("update-menu-icon"),kF=ze("update-tooltip-text"),OF=(e,t,o,n)=>{const s=ye(b),r=ye(e.tooltip),a=e.text.map(e=>xv(wF(e,t,o.providers))),i=e.icon.map(e=>xv(yF(e,o.providers.icons))),l=(e,t)=>{const o=ef.getValue(e);return hd.focus(o),Ic(o,"keydown",{raw:t.event.raw}),Ax.close(o),A.some(!0)},c=e.role.fold(()=>({}),e=>({role:e})),d=A.from(e.listRole).map(e=>({listRole:e})).getOr({}),u=e.ariaLabel.fold(()=>({}),e=>({"aria-label":o.providers.translate(e)})),m=YO("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),p=ze("common-button-display-events"),h="dropdown-events",f=xv(Ax.sketch({...e.uid?{uid:e.uid}:{},...c,...d,dom:{tag:"button",classes:[t,`${t}--select`].concat(L(e.classes,e=>`${t}--${e}`)),attributes:{...u,...g(n)?{"data-mce-name":n}:{}}},components:gD([i.map(e=>e.asSpec()),a.map(e=>e.asSpec()),A.some(m)]),matchWidth:!0,useMinWidth:e.useMinWidth??!0,sandboxClasses:e.sandboxClasses??[],onOpen:(t,o,n)=>{e.searchable&&(e=>{S_(e).each(e=>hd.focus(e))})(n)},dropdownBehaviours:sd([...e.dropdownBehaviours,QA(()=>e.disabled||o.providers.checkUiComponentContext(e.context).shouldDisable),dD(()=>o.providers.checkUiComponentContext(e.context)),bv.config({}),eg.config({}),...e.tooltip.map(t=>fv.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(t),onShow:t=>{if(Ue(r.get(),e.tooltip,(e,t)=>t!==e).getOr(!1)){const e=o.providers.translate(r.get().getOr(""));fv.setComponents(t,o.providers.tooltips.getComponents({tooltipText:e}))}}}))).toArray(),dd(h,[tD(e,s),oD(e,s)]),dd(p,[Kc((t,o)=>{"listbox"!==e.listRole&&bF(t)})]),dd("update-dropdown-width-variable",[Uc($a(),(e,t)=>Ax.close(e))]),dd("menubutton-update-display-text",[Uc(SF,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{eg.set(e,[_g(o.providers.translate(t.event.text))])})}),Uc(CF,(e,t)=>{i.bind(t=>t.getOpt(e)).each(e=>{eg.set(e,[yF(t.event.icon,o.providers.icons)])})}),Uc(kF,(e,t)=>{const n=o.providers.translate(t.event.text);zo(e.element,"aria-label",n),r.set(A.some(t.event.text))})])]),eventOrder:Le(fF,{[la()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[Ga()]:["toolbar-button-events",fv.name(),h,p]}),sandboxBehaviours:sd([Sm.config({mode:"special",onLeft:l,onRight:l}),dd("dropdown-sandbox-events",[Uc(v_,(e,t)=>{(e=>{const t=ef.getValue(e),o=w_(e).map(C_);Ax.refetch(t).get(()=>{const e=Ug.getCoupled(t,"sandbox");o.each(t=>w_(e).each(e=>((e,t)=>{ef.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))})})(e),t.stop()}),Uc(x_,(e,t)=>{((e,t)=>{(e=>_b.getState(e).bind(Yd.getHighlighted).bind(Yd.getHighlighted))(e).each(o=>{((e,t,o,n)=>{const s={...n,target:t};e.getSystem().triggerEvent(o,t,s)})(e,o.element,t.event.eventType,t.event.interactionEvent)})})(e,t),t.stop()})])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...b_(0,e.columns,e.presets),fakeFocus:e.searchable,..."listbox"===e.listRole?{}:{onHighlightItem:XM,onCollapseMenu:(e,t,o)=>{Yd.getHighlighted(o).each(t=>{XM(e,o,t)})},onDehighlightItem:KM}}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Sc()(e,t-10)}}),fetch:t=>Oe(C(e.fetch,t))}));return f.asSpec()},_F=e=>"separator"===e.type,TF={type:"separator"},EF=(e,t)=>{const o=((e,t)=>{const o=W(e,(e,o)=>(e=>r(e))(o)?""===o?e:"|"===o?e.length>0&&!_F(e[e.length-1])?e.concat([TF]):e:be(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o]),[]);return o.length>0&&_F(o[o.length-1])&&o.pop(),o})(r(e)?e.split(" "):e,t);return U(o,(e,o)=>{if((e=>be(e,"getSubmenuItems"))(o)){const n=(e=>{const t=fe(e,"value").getOrThunk(()=>ze("generated-menu-item"));return Le({value:t},e)})(o),s=((e,t)=>{const o=e.getSubmenuItems(),n=EF(o,t);return{item:e,menus:Le(n.menus,{[e.value]:n.items}),expansions:Le(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:Le(e.menus,s.menus),items:[s.item,...e.items],expansions:Le(e.expansions,s.expansions)}}return{...e,items:[o,...e.items]}},{menus:{},expansions:{},items:[]})},AF=(e,t,o,n)=>{const s=ze("primary-menu"),r=EF(e,o.shared.providers.menuItems());if(0===r.items.length)return A.none();const a=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-field",placeholder:e.placeholder})))(n),i=eB(s,r.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-results"})))(n),c=le(r.menus,(e,n)=>eB(n,e,t,o,!1,l)),d=Le(c,ta(s,i));return A.from(mx.tieredData(s,d,r.expansions))},DF=e=>!be(e,"items"),MF="data-value",BF=(e,t,o,n,s)=>L(o,o=>DF(o)?{type:"togglemenuitem",...s?{}:{role:"option"},text:o.text,value:o.value,active:o.value===n,onAction:()=>{ef.setValue(e,o.value),Ic(e,cB,{name:t}),hd.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>BF(e,t,o.items,n,s)}),FF=(e,t)=>se(e,e=>DF(e)?je(e.value===t,e):FF(e.items,t)),IF=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};let o=e.value.toFixed((n=e.unit)in t?t[n]:1);var n;return-1!==o.indexOf(".")&&(o=o.replace(/\.?0*$/,"")),o+e.unit},RF=e=>{const t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(e);if(null!==t){const e=parseFloat(t[1]),o=t[2];return Ae.value({value:e,unit:o})}return Ae.error(e)},zF=(e,t)=>{const o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},n=e=>be(o,e);return e.unit===t?A.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?A.some(e.value):A.some(e.value/o[e.unit]*o[t]):A.none()},VF=e=>A.none(),LF=(e,t)=>{const o=RF(e).toOptional(),n=RF(t).toOptional();return Ue(o,n,(e,t)=>zF(e,t.unit).map(e=>t.value/e).map(e=>{return o=e,n=t.unit,e=>zF(e,n).map(e=>({value:e*o,unit:n}));var o,n}).getOr(VF)).getOr(VF)},NF=(e,t)=>{const o=e.label.map(e=>lB(e,t)),n=[op.config({disabled:()=>e.disabled||t.checkUiComponentContext(e.context).shouldDisable}),dD(()=>t.checkUiComponentContext(e.context)),Sm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Fc(e,pB),A.some(!0))}),dd("textfield-change",[Uc(ba(),(t,o)=>{Ic(t,cB,{name:e.name})}),Uc(Fa(),(t,o)=>{Ic(t,cB,{name:e.name})})]),Kb.config({})],s=e.validation.map(e=>tf.config({getRoot:e=>oo(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=ef.getValue(t),n=e.validator(o);return _e(!0===n?Ae.value(o):Ae.error(n))},validateOnLoad:e.validateOnLoad}})).toArray(),r=e.placeholder.fold(y({}),e=>({placeholder:t.translate(e)})),a=e.inputMode.fold(y({}),e=>({inputmode:e})),i={...e.spellcheck.fold(y({}),e=>({spellcheck:e})),...r,...a,"data-mce-name":e.name},l=qx.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map(e=>({data:e})).getOr({}),inputAttributes:i,inputClasses:[e.classname],inputBehaviours:sd(G([n,s])),selectOnFocus:!1,factory:sy}),c=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[l]}:l,d=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),u=[op.config({disabled:()=>e.disabled||t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{qx.getField(e).each(op.disable)},onEnabled:e=>{qx.getField(e).each(op.enable)}}),dD(()=>t.checkUiComponentContext(e.context))];return rB(o,c,d,u)},PF=e=>({isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t),setActive:t=>{const o=e.element;t?($n(o,"tox-tbtn--enabled"),zo(o,"aria-pressed",!0)):(qn(o,"tox-tbtn--enabled"),Ho(o,"aria-pressed"))},isActive:()=>Yn(e.element,"tox-tbtn--enabled"),setTooltip:t=>{Ic(e,kF,{text:t})},setText:t=>{Ic(e,SF,{text:t})},setIcon:t=>Ic(e,CF,{icon:t})}),HF=(e,t,o,n,s=!0,r)=>{const a="bordered"===e.buttonType?["bordered"]:[];return OF({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const s={pattern:e.search.isSome()?JM(t):""};e.fetch(t=>{n(AF(t,ZO.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))},s,PF(t))},onSetup:e.onSetup,getApi:e=>PF(e),columns:1,presets:"normal",classes:a,dropdownBehaviours:[...s?[Kb.config({})]:[]],context:e.context},t,o.shared,r)},UF=(e,t,o)=>{const n=e=>n=>{const s=!n.isActive();n.setActive(s),e.storage.set(s),o.shared.getSink().each(o=>{t().getOpt(o).each(t=>{Oo(t.element),Ic(t,gB,{name:e.name,value:e.storage.get()})})})},s=e=>t=>{t.setActive(e.storage.get())};return t=>{t(L(e,e=>{const t=e.text.fold(()=>({}),e=>({text:e}));return{type:e.type,active:!1,...t,context:e.context,onAction:n(e),onSetup:s(e)}}))}},WF=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[_g(e)]}),jF=(e,t,o)=>{e.customStateIcon.each(n=>t.push(qF(n,o.shared.providers.icons,e.customStateIconTooltip.fold(()=>[],e=>[fv.config(o.shared.providers.tooltips.getConfig({tooltipText:e}))]),["tox-icon-custom-state"])))},$F=ze("leaf-label-event-id"),GF=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:s,backstage:r})=>{const a=e.menu.map(e=>HF(e,"tox-mbtn",r,A.none(),o)),i=[WF(e.title)];return jF(e,i,r),a.each(e=>i.push(e)),Bv.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:{[ha()]:[$F,"keying"]},buttonBehaviours:sd([...o?[Kb.config({})]:[],sv.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),ib.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?sv.on:sv.off)(t)}}}}),dd($F,[Kc((t,o)=>{s.each(o=>{(o===e.id?sv.on:sv.off)(t)})}),Uc(ha(),(e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(In(e.element,".tox-tree--directory").each(t=>{e.getSystem().getByDom(t).each(e=>{zn(t,".tox-tree--directory__label").each(t=>{e.getSystem().getByDom(t).each(hd.focus)})})}),t.stop()):n&&t.stop()})])])})},qF=(e,t,o,n,s)=>YO(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"].concat(n||[]),behaviours:o,attributes:s},t),YF=ze("directory-label-event-id"),XF=({directory:e,visible:t,noChildren:o,backstage:n})=>{const s=e.menu.map(e=>HF(e,"tox-mbtn",n,A.none())),r=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(a=n.shared.providers.icons,qF("chevron-right",a,[]))]},WF(e.title)];var a;jF(e,r,n),s.each(e=>{r.push(e)});const i=t=>{In(t.element,".tox-tree--directory").each(o=>{t.getSystem().getByDom(o).each(o=>{const n=!sv.isOn(o);sv.toggle(o),Ic(t,"expand-tree-node",{expanded:n,node:e.id})})})};return Bv.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:r,action:i,eventOrder:{[ha()]:[YF,"keying"]},buttonBehaviours:sd([...t?[Kb.config({})]:[],dd(YF,[Uc(ha(),(e,t)=>{const n="ArrowRight"===t.event.raw.code,s="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||s)&&In(e.element,".tox-tree--directory").each(o=>{e.getSystem().getByDom(o).each(o=>{!sv.isOn(o)&&n||sv.isOn(o)&&s?(i(e),t.stop()):s&&!sv.isOn(o)&&(In(o.element,".tox-tree--directory").each(e=>{zn(e,".tox-tree--directory__label").each(e=>{o.getSystem().getByDom(e).each(hd.focus)})}),t.stop())})})})])])})},KF=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:s,selectedId:r,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map(e=>"leaf"===e.type?GF({leaf:e,selectedId:r,onLeafAction:t,visible:o,treeId:n,backstage:a}):QF({directory:e,expandedIds:s,selectedId:r,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a})),behaviours:sd([Ub.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}),eg.config({})])}),JF=ze("directory-event-id"),QF=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:s,expandedIds:r,selectedId:a})=>{const{children:i}=e,l=ye(r),c=r.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[XF({directory:e,visible:o,noChildren:0===e.children.length,backstage:s}),KF({children:i,expandedIds:r,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:s})],behaviours:sd([dd(JF,[Kc((e,t)=>{sv.set(e,c)}),Uc("expand-tree-node",(e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter(e=>e!==n))})]),sv.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const r=e.components()[1],c=(d=o,i.map(e=>"leaf"===e.type?GF({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:s}):QF({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:s})));var d;o?Ub.grow(r):Ub.shrink(r),eg.set(r,c)}})])}},ZF=ze("tree-event-id"),eI=(e,t,o=[],n,s,r,a)=>{const i=t.fold(()=>({}),e=>({action:e})),l={buttonBehaviours:sd([JA(()=>!e.enabled||a.checkUiComponentContext(e.context).shouldDisable),dD(()=>a.checkUiComponentContext(e.context)),Kb.config({}),...r.map(e=>fv.config(a.tooltips.getConfig({tooltipText:a.translate(e)}))).toArray(),dd("button press",[Hc("click")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...i},c=Le(l,{dom:n});return Le(c,{components:s})},tI=(e,t,o,n=[],s)=>{const r={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map(e=>({"aria-label":o.translate(e)})).getOr({}),"data-mce-name":s}},a=e.icon.map(e=>xF(e,o.icons)),i=gD([a]);return eI(e,t,n,r,i,e.tooltip,o)},oI=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},nI=(e,t,o,n=[],s=[])=>{const r=o.translate(e.text),a=e.icon.map(e=>xF(e,o.icons)),i=[a.getOrThunk(()=>_g(r))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...oI(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...s],attributes:{"aria-label":r,"data-mce-name":e.text}},d=e.icon.map(y(r));return eI(e,t,n,c,i,d,o)},sI=(e,t,o,n=[],s=[])=>{const r=nI(e,A.some(t),o,n,s);return Bv.sketch(r)},rI=(e,t)=>o=>{"custom"===t?Ic(o,gB,{name:e,value:{}}):"submit"===t?Fc(o,pB):"cancel"===t?Fc(o,mB):console.error("Unknown button type: ",t)},aI=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>r,n=e,s={...e,buttonType:"default",type:"menubutton",search:A.none(),onSetup:t=>(t.setEnabled(e.enabled),b),fetch:UF(n.items,t,o)},r=xv(HF(s,"tox-tbtn",o,A.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return r.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=rI(e.name,t),s={...e,context:"cancel"===t?"any":e.context,borderless:!1};return sI(s,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{const n=e.icon.map(e=>yF(e,t.icons)).map(xv),s=e.buttonType.getOr(e.primary?"primary":"secondary"),r={...e,name:e.name??"",tooltip:e.tooltip,enabled:e.enabled??!1},a=r.tooltip.or(e.text).map(e=>({"aria-label":t.translate(e)})).getOr({}),i=oI(s??"secondary"),l=e.icon.isSome()&&e.text.isSome(),c={tag:"button",classes:[...i.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...l?["tox-button--icon-and-text"]:[]],attributes:{...a,...g(o)?{"data-mce-name":o}:{}}},d=t.translate(e.text.getOr("")),u=_g(d),m=[...gD([n.map(e=>e.asSpec())]),...e.text.isSome()?[u]:[]],p=eI(r,A.some(o=>{Ic(o,gB,{name:e.name,value:{setIcon:e=>{n.map(n=>n.getOpt(o).each(o=>{eg.set(o,[yF(e,t.icons)])}))}}})}),[],c,m,e.tooltip,t);return Bv.sketch(p)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},iI={type:"separator"},lI=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:b}),cI=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:b}),dI=(e,t)=>(e=>L(e,lI))(((e,t)=>H(t,t=>t.type===e))(e,t)),uI=e=>dI("header",e.targets),mI=e=>dI("anchor",e.targets),gI=e=>A.from(e.anchorTop).map(e=>cI("<top>",e)).toArray(),pI=e=>A.from(e.anchorBottom).map(e=>cI("<bottom>",e)).toArray(),hI=(e,t)=>{const o=e.toLowerCase();return H(t,e=>{const t=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,n=e.value??"";return Je(t.toLowerCase(),o)||Je(n.toLowerCase(),o)})},fI=ze("aria-invalid"),bI=e=>(t,o,n,s,r)=>fe(o,"name").fold(()=>e(o,s,A.none(),r),a=>t.field(a,e(o,s,fe(n,a),r))),vI={bar:bI((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:L(e.items,t.interpreter)}))(e,t.shared)),collection:bI((e,t,o)=>xB(e,t.shared.providers,o)),alertbanner:bI((e,t)=>((e,t)=>{const o=$O(e.icon,t.icons);return ah.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?[Bv.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>Ic(t,gB,{name:"alert-banner",value:e.url}),buttonBehaviours:sd([GO()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers)),input:bI((e,t,o)=>((e,t,o)=>NF({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:A.none(),maximized:e.maximized,data:o,context:e.context,spellcheck:A.none()},t))(e,t.shared.providers,o)),textarea:bI((e,t,o)=>((e,t,o)=>NF({name:e.name,multiline:!0,label:e.label,inputMode:A.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:A.none(),maximized:e.maximized,data:o,context:e.context,spellcheck:e.spellcheck},t))(e,t.shared.providers,o)),label:bI((e,t,o,n)=>((e,t,o)=>{const n="tox-label",s="center"===e.align?[`${n}--center`]:[],r="end"===e.align?[`${n}--end`]:[],a=xv({dom:{tag:"label",classes:[n,...s,...r]},components:[_g(t.providers.translate(e.label))]}),i=L(e.items,t.interpreter);return{dom:{tag:"div",classes:["tox-form__group"]},components:[a.asSpec(),...i],behaviours:sd([CB(),eg.config({}),(l=A.none(),EB(l,$o,Go)),Sm.config({mode:"acyclic"}),dd("label",[Kc(t=>{e.for.each(e=>{o(e).each(e=>{a.getOpt(t).each(t=>{const o=Lo(e.element,"id")??ze("form-field");zo(e.element,"id",o),zo(t.element,"for",o)})})})})])])};var l})(e,t.shared,n)),iframe:(vR=(e,t,o)=>((e,t,o)=>{const n="tox-dialog__iframe",s=e.transparent?[]:[`${n}--opaque`],r=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=((e,t)=>{const o=ye(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,s=()=>zo(o,"srcdoc",n);t?gF.fold(y(mF),e=>e.throttle)(o,n,s):s()}o.set(n)}}})(o,e.streamContent),l=e.label.map(e=>lB(e,t)),c=qx.parts.field({factory:{sketch:e=>XB(A.from(r),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...s]},behaviours:sd([Kb.config({}),hd.config({}),TB(o,i.getValue,i.setValue),ib.config({channels:{[sF]:{onReceive:(e,t)=>{t.newFocus.each(t=>{oo(e.element).each(o=>{(wt(e.element,t)?$n:qn)(o,"tox-navobj-bordered-focus")})})}}}})])})}});return rB(l,c,["tox-form__group--stretched"],[])})(e,t.shared.providers,o),(e,t,o,n,s)=>{const r=Le(t,{source:"dynamic"});return bI(vR)(e,r,o,n,s)}),button:bI((e,t)=>((e,t)=>{const o=rI(e.name,"custom");return n=A.none(),s=qx.parts.field({factory:Bv,...nI(e,A.some(o),t,[AB(""),CB()])}),rB(n,s,[],[]);var n,s})(e,t.shared.providers)),checkbox:bI((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),A.some(!0)),s=qx.parts.field({factory:{sketch:w},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:sd([CB(),op.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{oo(e.element).each(e=>$n(e,"tox-checkbox--disabled"))},onEnabled:e=>{oo(e.element).each(e=>qn(e,"tox-checkbox--disabled"))}}),Kb.config({}),hd.config({}),EB(o,Pn,Nn),Sm.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),dd("checkbox-events",[Uc(va(),(t,o)=>{Ic(t,cB,{name:e.name})})])])}),r=qx.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[_g(t.translate(e.label))],behaviours:sd([bv.config({})])}),a=e=>YO("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=xv({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return qx.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[s,i.asSpec(),r],fieldBehaviours:sd([op.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable}),dD(()=>t.checkUiComponentContext(e.context))])})})(e,t.shared.providers,o)),colorinput:bI((e,t,o)=>((e,t,o,n)=>{const s=qx.parts.field({factory:sy,inputClasses:["tox-textfield"],data:n,onSetValue:e=>tf.run(e).get(b),inputBehaviours:sd([op.config({disabled:()=>t.providers.isDisabled()||t.providers.checkUiComponentContext(e.context).shouldDisable}),dD(()=>t.providers.checkUiComponentContext(e.context)),Kb.config({}),tf.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>oo(e.element),notify:{onValid:e=>{const t=ef.getValue(e);Ic(e,yB,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=ef.getValue(e);if(0===t.length)return _e(Ae.value(!0));{const e=it("span");en(e,"background-color",t);const o=rn(e,"background-color").fold(()=>Ae.error("blah"),e=>Ae.value(t));return _e(o)}}}})]),selectOnFocus:!1}),r=e.label.map(e=>lB(e,t.providers)),a=(e,t)=>{Ic(e,wB,{value:t})},i=xv(((e,t)=>Ax.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:sd([QA(()=>t.providers.isDisabled()||t.providers.checkUiComponentContext(e.context).shouldDisable),dD(()=>t.providers.checkUiComponentContext(e.context)),bv.config({}),Kb.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>Oe(t=>e.fetch(t)).map(n=>A.from(tB(Le(NM(ze("menu-value"),n,t=>{e.onItemAction(o,t)},e.columns,e.presets,ZO.CLOSE_ON_EXECUTE,T,t.providers),{movement:HM(e.columns,e.presets)})))),parts:{menu:b_(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Hl,Pl,$l],onLtr:()=>[Pl,Hl,$l]},components:[],fetch:MM(o.getColors(e.storageKey),e.storageKey,o.hasCustomColors()),columns:o.getColorCols(e.storageKey),presets:"color",onItemAction:(t,n)=>{i.getOpt(t).each(t=>{"custom"===n?o.colorPicker(o=>{o.fold(()=>Fc(t,SB),o=>{a(t,o),pM(e.storageKey,o)})},"#ffffff"):a(t,"remove"===n?"":n)})},context:e.context},t));return qx.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:r.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[s,i.asSpec()]}]),fieldBehaviours:sd([dd("form-field-events",[Uc(yB,(t,o)=>{i.getOpt(t).each(e=>{en(e.element,"background-color",o.event.color)}),Ic(t,cB,{name:e.name})}),Uc(wB,(e,t)=>{qx.getField(e).each(o=>{ef.setValue(o,t.event.value),Lg.getCurrent(e).each(hd.focus)})}),Uc(SB,(e,t)=>{qx.getField(e).each(t=>{Lg.getCurrent(e).each(hd.focus)})})])])})})(e,t.shared,t.colorinput,o)),colorpicker:bI((e,t,o)=>((e,t,o)=>{const n=e=>"tox-"+e,s=NB((e=>t=>r(t)?e.translate(PB[t]):e.translate(t))(t),n,t.tooltips.getConfig,(e,o,n=e,s=e)=>YO(n,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:t.translate(s),"aria-live":"polite",...o.fold(()=>({}),e=>({id:e}))}},t.icons)),a=xv(s.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{Ic(e,gB,{name:"hex-valid",value:!0})},onInvalidHex:e=>{Ic(e,gB,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:sd([TB(o,e=>{const t=a.get(e);return Lg.getCurrent(t).bind(e=>ef.getValue(e).hex).map(e=>"#"+Ke(e,"#")).getOr("")},(e,t)=>{const o=A.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind(e=>ee(e,1)),n=a.get(e);Lg.getCurrent(n).fold(()=>{console.log("Can not find form")},e=>{ef.setValue(e,{hex:o.getOr("")}),Ix.getField(e,"hex").each(e=>{Fc(e,ba())})})}),CB()])}})(0,t.shared.providers,o)),dropzone:bI((e,t,o)=>$B(e,t.shared.providers,o)),grid:bI((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:L(e.items,t.interpreter)}))(e,t.shared)),listbox:bI((e,t,o)=>((e,t,o)=>{const n=R(e.items,e=>!DF(e)),s=t.shared.providers,r=o.bind(t=>FF(e.items,t)).orThunk(()=>te(e.items).filter(DF)),a=e.label.map(e=>lB(e,s)),i=qx.parts.field({dom:{},factory:{sketch:o=>OF({context:e.context,uid:o.uid,text:r.map(e=>e.text),icon:A.none(),tooltip:A.none(),role:je(!n,"combobox"),...n?{}:{listRole:"listbox"},ariaLabel:e.label,fetch:(o,s)=>{const r=BF(o,e.name,e.items,ef.getValue(o),n);s(AF(r,ZO.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:A.none()}))},onSetup:y(b),getApi:y({}),columns:1,presets:"normal",classes:[],useMinWidth:!1,sandboxClasses:["tox-listbox__menu"],dropdownBehaviours:[Kb.config({}),TB(r.map(e=>e.value),e=>Lo(e.element,MF),(t,o)=>{FF(e.items,o).each(e=>{zo(t.element,MF,e.value),Ic(t,SF,{text:e.text})})})]},"tox-listbox",t.shared)}}),l={dom:{tag:"div",classes:["tox-listboxfield"]},components:[i]};return qx.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([a.toArray(),[l]]),fieldBehaviours:sd([op.config({disabled:()=>!e.enabled||s.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{qx.getField(e).each(op.disable)},onEnabled:e=>{qx.getField(e).each(op.enable)}})])})})(e,t,o)),selectbox:bI((e,t,o)=>((e,t,o)=>{const n=L(e.items,e=>({text:t.translate(e.text),value:e.value})),s=e.label.map(e=>lB(e,t)),r=qx.parts.field({dom:{},...o.map(e=>({data:e})).getOr({}),selectAttributes:{size:e.size},options:n,factory:Qx,selectBehaviours:sd([op.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable}),Kb.config({}),dd("selectbox-change",[Uc(va(),(t,o)=>{Ic(t,cB,{name:e.name})})])])}),a=e.size>1?A.none():A.some(YO("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:G([[r],a.toArray()])};return qx.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([s.toArray(),[i]]),fieldBehaviours:sd([op.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{qx.getField(e).each(op.disable)},onEnabled:e=>{qx.getField(e).each(op.enable)}}),dD(()=>t.checkUiComponentContext(e.context))])})})(e,t.shared.providers,o)),sizeinput:bI((e,t)=>((e,t)=>{let o=VF;const n=ze("ratio-event"),s=e=>YO(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),r=()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable,a=dD(()=>t.checkUiComponentContext(e.context)),i=e.label.getOr("Constrain proportions"),l=t.translate(i),c=Jx.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":l,"data-mce-name":i}},components:[s("lock"),s("unlock")],buttonBehaviours:sd([op.config({disabled:r}),a,Kb.config({}),fv.config(t.tooltips.getConfig({tooltipText:l}))])}),d=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),u=t=>qx.parts.field({factory:sy,inputClasses:["tox-textfield"],inputBehaviours:sd([op.config({disabled:r}),a,Kb.config({}),dd("size-input-events",[Uc(ga(),(e,o)=>{Ic(e,n,{isField1:t})}),Uc(va(),(t,o)=>{Ic(t,cB,{name:e.name})})])]),selectOnFocus:!1}),m=e=>({dom:{tag:"label",classes:["tox-label"]},components:[_g(t.translate(e))]}),g=Jx.parts.field1(d([qx.parts.label(m("Width")),u(!0)])),p=Jx.parts.field2(d([qx.parts.label(m("Height")),u(!1)]));return Jx.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[g,p,d([m("\xa0"),c])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{RF(ef.getValue(e)).each(e=>{o(e).each(e=>{ef.setValue(t,IF(e))})})},coupledFieldBehaviours:sd([op.config({disabled:r,onDisabled:e=>{Jx.getField1(e).bind(qx.getField).each(op.disable),Jx.getField2(e).bind(qx.getField).each(op.disable),Jx.getLock(e).each(op.disable)},onEnabled:e=>{Jx.getField1(e).bind(qx.getField).each(op.enable),Jx.getField2(e).bind(qx.getField).each(op.enable),Jx.getLock(e).each(op.enable)}}),dD(()=>t.checkUiComponentContext("mode:design")),dd("size-input-events2",[Uc(n,(e,t)=>{const n=t.event.isField1,s=n?Jx.getField1(e):Jx.getField2(e),r=n?Jx.getField2(e):Jx.getField1(e),a=s.map(ef.getValue).getOr(""),i=r.map(ef.getValue).getOr("");o=LF(a,i)})])])})})(e,t.shared.providers)),slider:bI((e,t,o)=>((e,t,o)=>{const n=Gw.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[_g(t.translate(e.label))]}),s=Gw.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),r=Gw.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Gw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:y(o.getOrThunk(()=>(Math.abs(e.max)-Math.abs(e.min))/2))},components:[n,s,r],sliderBehaviours:sd([CB(),hd.config({})]),onChoose:(t,o,n)=>{Ic(t,cB,{name:e.name,value:n})},onChange:(t,o,n)=>{Ic(t,cB,{name:e.name,value:n})}})})(e,t.shared.providers,o)),urlinput:bI((e,t,o)=>((e,t,o,n)=>{const s=t.shared.providers,r=t=>{const n=ef.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:{inputmode:"url",autocapitalize:"none",autocorrect:"off",spellcheck:"false"},minChars:0,responseTime:0,fetch:n=>{const s=((e,t,o)=>{const n=ef.getValue(t),s=n?.meta?.text??n.value;return o.getLinkInformation().fold(()=>[],t=>{const n=hI(s,(e=>L(e,e=>cI(e,e)))(o.getHistory(e)));return"file"===e?(r=[n,hI(s,uI(t)),hI(s,G([gI(t),mI(t),pI(t)]))],W(r,(e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(iI,t),[])):n;var r})})(e.filetype,n,o),r=AF(s,ZO.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:A.none()});return _e(r)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(tf)&&tf.run(e).get(b)},typeaheadBehaviours:sd([...o.getValidationHandler().map(t=>tf.config({getRoot:e=>oo(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each(e=>{zo(e.element,"title",s.translate(t))})}},validator:{validate:o=>{const n=ef.getValue(o);return Me(s=>{t({type:e.filetype,url:n.value},e=>{if("invalid"===e.status){zo(o.element,"aria-errormessage",fI);const t=Ae.error(e.message);s(t)}else{Ho(o.element,"aria-errormessage");const t=Ae.value(e.message);s(t)}})})},validateOnLoad:!1}})).toArray(),op.config({disabled:()=>!e.enabled||s.checkUiComponentContext(e.context).shouldDisable}),Kb.config({}),dd("urlinput-events",[Uc(ba(),t=>{const o=Qn(t.element),n=o.trim();n!==o&&Zn(t.element,n),"file"===e.filetype&&Ic(t,cB,{name:e.name})}),Uc(va(),t=>{Ic(t,cB,{name:e.name}),r(t)}),Uc(Fa(),t=>{Ic(t,cB,{name:e.name}),r(t)})])]),eventOrder:{[ba()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value.trim(),selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:b_(0,0,"normal")},onExecute:(e,t,o)=>{Ic(t,pB,{})},onItemExecute:(t,o,n,s)=>{r(t),Ic(t,cB,{name:e.name})}},i=qx.parts.field({...a,factory:RS}),l=e.label.map(e=>lB(e,s)),c=xv(((e,t,o=e,n=e)=>YO(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:s.translate(n),"aria-live":"polite",...t.fold(()=>({}),e=>({id:e}))}},s.icons))("invalid",A.some(fI),"warning")),d=xv({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),m=ze("browser.url.event"),g=xv({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:sd([op.config({disabled:()=>!e.enabled||s.checkUiComponentContext(e.context).shouldDisable})])}),p=xv(sI({context:e.context,name:e.name,icon:A.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:A.none(),borderless:!0},e=>Fc(e,m),s,[],["tox-browse-url"]));return qx.sketch({dom:iB([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:G([[g.asSpec()],u.map(()=>p.asSpec()).toArray()])}]),fieldBehaviours:sd([op.config({disabled:()=>!e.enabled||s.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{qx.getField(e).each(op.disable),p.getOpt(e).each(op.disable)},onEnabled:e=>{qx.getField(e).each(op.enable),p.getOpt(e).each(op.enable)}}),dD(()=>s.checkUiComponentContext(e.context)),dd("url-input-events",[Uc(m,t=>{Lg.getCurrent(t).each(o=>{const n=ef.getValue(o),s={fieldname:e.name,...n};u.each(n=>{n(s).get(n=>{ef.setValue(o,n),Ic(t,cB,{name:e.name})})})})})])])})})(e,t,t.urlinput,o)),customeditor:bI(e=>{const t=Ye(),o=xv({dom:{tag:e.tag}}),n=Ye(),s=!UB(e)&&e.onFocus.isSome()?[hd.config({onFocus:t=>{e.onFocus.each(e=>{e(t.element.dom)})}}),Kb.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:sd([dd("custom-editor-events",[Kc(s=>{o.getOpt(s).each(o=>{(UB(e)?e.init(o.element.dom):HB.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)})})})]),TB(A.none(),()=>t.get().fold(()=>n.get().getOr(""),e=>e.getValue()),(e,o)=>{t.get().fold(()=>n.set(o),e=>e.setValue(o))}),CB()].concat(s)),components:[o.asSpec()]}}),htmlpanel:bI((e,t)=>((e,t)=>{const o=["tox-form__group",...e.stretched?["tox-form__group--stretched"]:[]],n=dd("htmlpanel",[Kc(t=>{e.onInit(t.element.dom)})]);return"presentation"===e.presets?ah.sketch({dom:{tag:"div",classes:o,innerHtml:e.html},containerBehaviours:sd([fv.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{Vn(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Ao(e.element)).each(o=>{No(o,"data-mce-tooltip").each(o=>{fv.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-normal",anchor:e=>({type:"node",node:Vn(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Ao(e.element).filter(e=>No(e,"data-mce-tooltip").isSome())),root:e.element,layouts:{onLtr:y([$l,jl,Pl,Ul,Hl,Wl]),onRtl:y([$l,jl,Pl,Ul,Hl,Wl])},bubble:yl(0,-2,{})})}),n])}):ah.sketch({dom:{tag:"div",classes:o,innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:sd([Kb.config({}),hd.config({}),n])})})(e,t.shared.providers)),imagepreview:bI((e,t,o)=>((e,t)=>{const o=ye(t.getOr({url:""})),n=xv({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map(e=>({src:e.url})).getOr({})}}),s=xv({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),r={};e.height.each(e=>r.height=e);const a=t.map(e=>({url:e.url,zoom:A.from(e.zoom),cachedWidth:A.from(e.cachedWidth),cachedHeight:A.from(e.cachedHeight)}));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:r,attributes:{role:"presentation"}},components:[s.asSpec()],behaviours:sd([CB(),TB(a,()=>o.get(),(e,t)=>{const r={url:t.url};t.zoom.each(e=>r.zoom=e),t.cachedWidth.each(e=>r.cachedWidth=e),t.cachedHeight.each(e=>r.cachedHeight=e),o.set(r);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=r;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=bn(e),s=gn(e);return Math.min(n/t,s/o,1)})(e.element,t,o);r.zoom=n}const a=((e,t,o,n,s)=>{const r=o*s,a=n*s,i=Math.max(0,e/2-r/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:r.toString()+"px",height:a.toString()+"px"}})(bn(e.element),gn(e.element),t,o,r.zoom);s.getOpt(e).each(e=>{tn(e.element,a)})}};n.getOpt(e).each(o=>{const n=o.element;t.url!==Lo(n,"src")&&(zo(n,"src",t.url),qn(e.element,"tox-imagepreview__loaded")),a(),qo(n).then(t=>{e.getSystem().isConnected()&&($n(e.element,"tox-imagepreview__loaded"),r.cachedWidth=t.dom.naturalWidth,r.cachedHeight=t.dom.naturalHeight,a())})})})])}})(e,o)),table:bI((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"td",innerHtml:t.translate(e)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(s=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:L(s,e=>({dom:{tag:"th",innerHtml:t.translate(e)}}))}]}),(n=e.cells,{dom:{tag:"tbody"},components:L(n,e=>({dom:{tag:"tr"},components:L(e,o)}))})],behaviours:sd([Kb.config({}),hd.config({})])};var n,s})(e,t.shared.providers)),tree:bI((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(b),n=e.onToggleExpand.getOr(b),s=e.defaultExpandedIds,r=ye(s),a=ye(e.defaultSelectedId),i=ze("tree-id"),l=(n,s)=>e.items.map(e=>"leaf"===e.type?GF({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):QF({directory:e,selectedId:n,onLeafAction:o,expandedIds:s,labelTabstopping:!0,treeId:i,backstage:t}));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),r.get()),behaviours:sd([Sm.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),dd(ZF,[Uc("expand-tree-node",(e,t)=>{const{expanded:o,node:s}=t.event;r.set(o?[...r.get(),s]:r.get().filter(e=>e!==s)),n(r.get(),{expanded:o,node:s})})]),ib.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(A.some(t.value)),eg.set(e,l(A.some(t.value),r.get()))}}}}),eg.config({})])}})(e,t)),panel:bI((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:L(e.items,t.shared.interpreter)}))(e,t))},xI={field:(e,t)=>t,record:y([])},yI=(e,t,o,n,s)=>{const r=Le(n,{shared:{interpreter:t=>wI(e,t,o,r,s)}});return wI(e,t,o,r,s)},wI=(e,t,o,n,s)=>fe(vI,t.type).fold(()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t),r=>r(e,t,o,n,s)),SI=(e,t,o,n)=>wI(xI,e,t,o,n),CI={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},kI=(e,t,o)=>{const n={maxHeightFunction:Cc()};return()=>o()?{type:"node",root:po(go(e())),node:A.from(e()),bubble:yl(12,12,CI),layouts:{onRtl:()=>[mc],onLtr:()=>[uc]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:yl(-12,12,CI),layouts:{onRtl:()=>[Pl,Hl,$l],onLtr:()=>[Hl,Pl,$l]},overrides:n}},OI=(e,t,o,n)=>{const s={maxHeightFunction:Cc()};return()=>n()?{type:"node",root:po(go(t())),node:A.from(t()),bubble:yl(12,12,CI),layouts:{onRtl:()=>[gc],onLtr:()=>[gc]},overrides:s}:e?{type:"node",root:po(go(t())),node:A.from(t()),bubble:yl(0,-pn(t()),CI),layouts:{onRtl:()=>[jl],onLtr:()=>[jl]},overrides:s}:{type:"hotspot",hotspot:o(),bubble:yl(0,0,CI),layouts:{onRtl:()=>[jl],onLtr:()=>[jl]},overrides:s}},_I=(e,t,o)=>()=>o()?{type:"node",root:po(go(e())),node:A.from(e()),layouts:{onRtl:()=>[gc],onLtr:()=>[gc]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[$l],onLtr:()=>[$l]}},TI=(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:ct(e),lastCell:ct(t)};return A.some(n)}return A.some(us.range(ct(t.startContainer),t.startOffset,ct(t.endContainer),t.endOffset))}}),EI=e=>t=>({type:"node",root:e(),node:t}),AI=(e,t,o,n)=>{const s=$C(e),r=()=>ct(e.getBody()),a=()=>ct(e.getContentAreaContainer()),i=()=>s||!n();return{inlineDialog:kI(a,t,i),inlineBottomDialog:OI(e.inline,a,o,i),banner:_I(a,t,i),cursor:TI(e,r),node:EI(r)}},DI=e=>(t,o)=>{LM(e)(t,o)},MI=e=>()=>kM(e),BI=e=>t=>yM(e,t),FI=e=>t=>CM(e,t),II=e=>()=>wC(e),RI=e=>ve(e,"items"),zI=e=>ve(e,"format"),VI=[{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"}]}],LI=e=>W(e,(e,t)=>{if(be(t,"items")){const o=LI(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(be(t,"inline")||(e=>be(e,"block"))(t)||(e=>be(e,"selector"))(t)){const o=`custom-${r(t.name)?t.name:t.title.toLowerCase()}`;return{customFormats:e.customFormats.concat([{name:o,format:t}]),formats:e.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}},{customFormats:[],formats:[]}),NI=e=>eC(e).map(t=>{const o=((e,t)=>{const o=LI(t),n=t=>{N(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})(e,t);return tC(e)?VI.concat(o):o}).getOr(VI),PI=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),HI=(e,t,o,n)=>{const s=t=>L(t,t=>RI(t)?(e=>{const t=s(e.items);return{...e,type:"submenu",getStyleItems:y(t)}})(t):zI(t)?(e=>PI(e,o,n))(t):(e=>{const t=re(e);return 1===t.length&&I(t,"title")})(t)?{...t,type:"separator"}:(t=>{const s=r(t.name)?t.name:ze(t.title),a=`custom-${s}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(s,i),i})(t));return s(t)},UI=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[_g(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:y(300),exclusive:!0,lazySink:e,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:o(n),onShow:(e,o)=>{t++,n.onShow&&n.onShow(e,o)},onHide:(e,o)=>{t--,n.onHide&&n.onHide(e,o)},onSetup:n.onSetup}),getComponents:o}},WI=WB.trim,jI=e=>t=>{if((e=>g(e)&&1===e.nodeType)(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},$I=jI("true"),GI=jI("false"),qI=(e,t,o,n,s)=>({type:e,title:t,url:o,level:n,attach:s}),YI=e=>e.innerText||e.textContent,XI=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&JI(e),KI=e=>e&&/^(H[1-6])$/.test(e.nodeName),JI=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return $I(t)}return!1})(e)&&!GI(e),QI=e=>KI(e)&&JI(e),ZI=e=>{const t=(e=>e.id?e.id:ze("h"))(e);return qI("header",YI(e)??"","#"+t,(e=>KI(e)?parseInt(e.nodeName.substr(1),10):0)(e),()=>{e.id=t})},eR=e=>{const t=e.id||e.name,o=YI(e);return qI("anchor",o||"#"+t,"#"+t,0,b)},tR=e=>WI(e.title).length>0,oR=e=>{const t=(e=>{const t=L(ts(ct(e),"h1,h2,h3,h4,h5,h6,a:not([href])"),e=>e.dom);return t})(e);return H((e=>L(H(e,QI),ZI))(t).concat((e=>L(H(e,XI),eR))(t)),tR)},nR="tinymce-url-history",sR=e=>r(e)&&/^https?/.test(e),rR=e=>a(e)&&pe(e,e=>{return!(l(t=e)&&t.length<=5&&Y(t,sR));var t}).isNone(),aR=()=>{const e=uM.getItem(nR);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+nR+" was not valid JSON",e),{};throw e}return rR(t)?t:(console.log("Local storage "+nR+" was not valid format",t),{})},iR=e=>{const t=aR();return fe(t,e).getOr([])},lR=(e,t)=>{if(!sR(e))return;const o=aR(),n=fe(o,t).getOr([]),s=H(n,t=>t!==e);o[t]=[e].concat(s).slice(0,5),(e=>{if(!rR(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));uM.setItem(nR,JSON.stringify(e))})(o)},cR=e=>!!e,dR=e=>le(WB.makeMap(e,/[, ]/),cR),uR=e=>A.from(pC(e)),mR=e=>A.from(e).filter(r).getOrUndefined(),gR=e=>({getHistory:iR,addToHistory:lR,getLinkInformation:()=>(e=>vC(e)?A.some({targets:oR(e.getBody()),anchorTop:mR(xC(e)),anchorBottom:mR(yC(e))}):A.none())(e),getValidationHandler:()=>(e=>A.from(hC(e)))(e),getUrlPicker:t=>((e,t)=>((e,t)=>{const o=(e=>{const t=A.from(bC(e)).filter(cR).map(dR);return uR(e).fold(T,e=>t.fold(E,e=>re(e).length>0&&e))})(e);return d(o)?o?uR(e):A.none():o[t]?uR(e):A.none()})(e,t).map(o=>n=>Oe(s=>{const i={filetype:t,fieldname:n.fieldname,...A.from(n.meta).getOr({})};o.call(e,(e,t)=>{if(!r(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");s({value:e,meta:t})},n.value,i)})))(e,t)}),pR={skipFocus:"ToggleToolbarDrawer skipFocus is deprecated see migration guide: https://www.tiny.cloud/docs/tinymce/latest/migration-from-7x/"},hR=b,fR=T,bR=y([]);var vR,xR=Object.freeze({__proto__:null,getBehaviours:bR,isDocked:fR,setup:hR});const yR=y(ze("toolbar-height-change")),wR={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},SR="tox-tinymce--toolbar-sticky-on",CR="tox-tinymce--toolbar-sticky-off",kR=(e,t)=>I(Ap.getModes(e),t),OR=e=>{const t=e.element;oo(t).each(o=>{const n="padding-"+Ap.getModes(e)[0];if(Ap.isDocked(e)){const e=bn(o);en(t,"width",e+"px"),en(o,n,(e=>pn(e)+(parseInt(nn(e,"margin-top"),10)||0)+(parseInt(nn(e,"margin-bottom"),10)||0))(t)+"px")}else cn(t,"width"),cn(o,n)})},_R=(e,t)=>{t?(qn(e,wR.fadeOutClass),Xn(e,[wR.transitionClass,wR.fadeInClass])):(qn(e,wR.fadeInClass),Xn(e,[wR.fadeOutClass,wR.transitionClass]))},TR=(e,t)=>{const o=ct(e.getContainer());t?($n(o,SR),qn(o,CR)):($n(o,CR),qn(o,SR))},ER=(e,t)=>{const o=Ye(),n=t.getSink,s=e=>{n().each(t=>e(t.element))},r=t=>{e.inline||OR(t),TR(e,Ap.isDocked(t)),t.getSystem().broadcastOn([Td()],{}),n().each(e=>e.getSystem().broadcastOn([Td()],{}))},a=e.inline?[]:[ib.config({channels:{[yR()]:{onReceive:OR}}})];return[hd.config({}),Ap.config({contextual:{lazyContext:t=>{const o=pn(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return A.from(n).map(n=>{const s=Es(ct(n));return ok(e,t.element).fold(()=>{const e=s.height-o,n=s.y+(kR(t,"top")?0:o);return Ts(s.x,n,s.width,e)},e=>{const n=Ds(s,nk(e)),r=kR(t,"top")?n.y:n.y+o;return Ts(n.x,r,n.width,n.height-o)})})},onShow:()=>{s(e=>_R(e,!0))},onShown:e=>{s(e=>Kn(e,[wR.transitionClass,wR.fadeInClass])),o.get().each(t=>{((e,t)=>{const o=Jt(t);Eo(o).filter(e=>!wt(t,e)).filter(t=>wt(t,ct(o.dom.body))||St(e,t)).each(()=>Oo(t))})(e.element,t),o.clear()})},onHide:e=>{((e,t)=>Ao(e).orThunk(()=>t().toOptional().bind(e=>Ao(e.element))))(e.element,n).fold(o.clear,o.set),s(e=>_R(e,!1))},onHidden:()=>{s(e=>Kn(e,[wR.transitionClass]))},...wR},lazyViewport:t=>ok(e,t.element).fold(()=>{const o=Ms(),n=uC(e),s=o.y+(kR(t,"top")&&!tk(e)?n:0),r=o.height-(kR(t,"bottom")?n:0);return{bounds:Ts(o.x,s,o.width,r),optScrollEnv:A.none()}},e=>({bounds:nk(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Sn(e.element).top})})),modes:[t.header.getDockingMode()],onDocked:r,onUndocked:r}),...a]};var AR=Object.freeze({__proto__:null,getBehaviours:ER,isDocked:e=>e().map(Ap.isDocked).getOr(!1),setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",()=>{o().each(Ap.reset)}),e.on("ResizeWindow ResizeEditor",()=>{o().each(OR)}),e.on("SkinLoaded",()=>{o().each(e=>{Ap.isDocked(e)?Ap.reset(e):Ap.refresh(e)})}),e.on("FullscreenStateChanged",()=>{o().each(Ap.reset)})),e.on("AfterScrollIntoView",e=>{o().each(t=>{Ap.refresh(t);const o=t.element;hn(o)&&((e,t)=>{const o=Jt(t),n=eo(t).dom.innerHeight,s=kn(o),r=ct(e.elm),a=As(r),i=gn(r),l=a.y,c=l+i,d=Sn(t),u=gn(t),m=d.top,g=m+u,p=Math.abs(m-s.top)<2,h=Math.abs(g-(s.top+n))<2;if(p&&l<g)On(s.left,l-u,o);else if(h&&c>m){const e=l-n+i+u;On(s.left,e,o)}})(e,o)})}),e.on("PostRender",()=>{TR(e,!1)})}}),DR=sh({factory:(e,t)=>{const o={focus:Sm.focusIn,setMenus:(e,o)=>{const n=L(o,e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())},context:"any"},n=TE(o).mapError(e=>Cr(e)).getOrDie();return HF(n,"tox-mbtn",t.backstage,A.some("menuitem"))});eg.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:sd([eg.config({}),dd("menubar-events",[Kc(t=>{e.onSetup(t)}),Uc(ma(),(e,t)=>{Vn(e.element,".tox-mbtn--active").each(o=>{Ln(t.event.target,".tox-mbtn").each(t=>{wt(o,t)||e.getSystem().getByDom(o).each(o=>{e.getSystem().getByDom(t).each(e=>{Ax.expand(e),Ax.close(o),hd.focus(e)})})})})}),Uc(Ka(),(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=>{Ax.isOpen(o)&&(Ax.expand(e),Ax.close(o))})})})]),Sm.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),A.some(!0))}),Kb.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[Ar("dom"),Ar("uid"),Ar("onEscape"),Ar("backstage"),Gr("onSetup",b)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const MR=e=>/^[0-9\.]+(|px)$/i.test(""+e)?A.some(parseInt(""+e,10)):A.none(),BR=e=>h(e)?e+"px":e,FR=(e,t,o)=>{const n=t.filter(t=>e<t),s=o.filter(t=>e>t);return n.or(s).getOr(e)},IR="--tox-private-requested-sidebar-width",RR="--tox-private-resolved-sidebar-width",zR=e=>In(e.element,".tox-sidebar"),VR=(e,t)=>{const{minWidth:o,maxWidth:n}=e,s=ye(-1);return{dom:{tag:"div",classes:["tox-sidebar__resize-handle"]},behaviours:sd([Bh.config({mode:"pointer",repositionTarget:!1,onDragStart:e=>{zR(e).each(r=>{const a=bn(r),i=Ue((e=>In(e.element,".tox-sidebar-wrap"))(e),(e=>MR(nn(e,"--tox-private-min-editing-area-width")))(r),(e,t)=>Math.floor(bn(e))-t).getOr(n),l=Math.min(n,i);l>=o&&(s.set("ltr"===En(e.element)?-1:1),hb.start(e,a,gn(r),{minWidth:o,maxWidth:l}),t.dispatch("SidebarResizeStart"))})},onDrag:(e,t,o)=>{hb.moveBy(e,yn(s.get()*o.left,0)).each(({width:t})=>{zR(e).each(e=>((e,t)=>{en(e,IR,BR(t))})(e,t))})},onDrop:e=>{hb.stop(e).each(({width:e})=>{((e,t)=>{e.dispatch("SidebarResized",{width:t})})(t,e)})}}),hb.config({})])}},LR=e=>({element:()=>e.element.dom}),NR=(e,t)=>{const o=L(re(t),e=>{const o=t[e],n=wr((e=>yr("sidebar",HA,e))(o));return{name:e,getApi:LR,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide,resizable:n.resizable}});return L(o,t=>{const n=ye(b);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:KA([tD(t,n),oD(t,n),Uc(Ja(),(e,t)=>{const n=t.event,s=j(o,e=>e.name===n.name);s.each(t=>{Ic(e,GR,n.visible?{visible:!0,resizable:t.resizable}:{visible:!1}),(n.visible?t.onShow:t.onHide)(t.getApi(e))})})])})})},PR=(e,t,o)=>Qw.sketch(n=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:[VR(t,o),...NR(n,e)],slotBehaviours:KA([Kc(e=>Qw.hideAllSlots(e))])})),HR=(e,t)=>{zo(e,"role",t)},UR=e=>{Lg.getCurrent(e).each(t=>{Ub.immediateShrink(t),HR(e.element,"presentation")})},WR=e=>Lg.getCurrent(e).bind(e=>Ub.isGrowing(e)||Ub.hasGrown(e)?Lg.getCurrent(e).bind(e=>j(Qw.getSlotNames(e),t=>Qw.isShowing(e,t))):A.none()),jR=ze("FixSizeEvent"),$R=ze("AutoSizeEvent"),GR=ze("SidebarContentChanged"),qR=e=>Lg.getCurrent(e).each(e=>Oo(e.element,!0)),YR=(e,t,o)=>{const n=ye(!1),s=Ye(),r=o=>{var s;n.get()&&(!(e=>"focusin"===e.type)(s=o)||!(s.composed?te(s.composedPath()):A.from(s.target)).map(ct).filter(Gt).exists(e=>Yn(e,"mce-pastebin")))&&(o.preventDefault(),qR(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",()=>{e.dom.bind(e.getWin(),"focusin",r),e.on("BeforeExecCommand",e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&r(e)})});const a=s=>{s!==n.get()&&(n.set(s),((e,t,o,n)=>{const s=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;A.from(e.iframeElement).map(ct).each(e=>{t?(No(e,o).each(t=>zo(e,n,t)),zo(e,o,-1)):(Ho(e,o),No(e,n).each(t=>{zo(e,o,t),Ho(e,n)}))})})(e,o),o)Rg.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:vv('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}))(n)),cn(s,"display"),Ho(s,"aria-hidden"),e.hasFocus()&&qR(t);else{const o=Lg.getCurrent(t).exists(e=>To(e.element));Rg.unblock(t),en(s,"display","none"),zo(s,"aria-hidden","true"),o&&e.focus()}})(e,t(),s,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,s))};e.on("ProgressState",t=>{if(s.on(clearTimeout),h(t.time)){const o=VS.setEditorTimeout(e,()=>a(t.state),t.time);s.set(o)}else a(t.state),s.clear()})},XR=e=>{const t=e.label.or(e.title).fold(()=>({}),e=>({attributes:{"aria-label":e}}));return{dom:{tag:"div",classes:["tox-toolbar__group"].concat(e.label.isSome()?["tox-toolbar__group_with_label"]:[]),...t},components:[...e.label.map(e=>({dom:{tag:"span",classes:["tox-label","tox-label--context-toolbar"]},components:[_g(e)]})).toArray(),cS.parts.items({})],items:e.items,markers:{itemSelector:".tox-tbtn:not([disabled]), .tox-toolbar-nav-item:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:sd([Kb.config({}),hd.config({ignore:!0})])}},KR=e=>cS.sketch(XR(e)),JR=(e,t)=>{const o=Kc(t=>{const o=L(e.initGroups,KR);Vx.setGroups(t,o)});return sd([ZA(()=>e.providers.checkUiComponentContext("any").shouldDisable),dD(()=>e.providers.checkUiComponentContext("any")),Sm.config({mode:t,onEscape:e.onEscape,visibilitySelector:".tox-toolbar__overflow",selector:".tox-toolbar__group"}),dd("toolbar-events",[o])])},QR=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":XR({title:A.none(),label:A.none(),items:[]}),"overflow-button":tI({context:"any",icon:A.some("more-drawer"),enabled:!0,tooltip:A.some("Reveal or hide additional toolbar items")},A.none(),e.providers,[],"overflow-button")},splitToolbarBehaviours:JR(e,t)}},ZR=e=>{const t=QR(e),o=mS.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return mS.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=As(t),n=Zt(t),s=As(n),r=Math.max(n.dom.scrollHeight,s.height);return Ts(o.x+4,s.y,o.width-8,r)},parts:{...t.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:e.attributes}}},components:[o],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>e.onToggled(t,!0),onClosed:t=>e.onToggled(t,!1)})},ez=e=>{const t=bS.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=bS.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=QR(e);return bS.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([yR()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([yR()],{type:"closed"}),e.onToggled(t,!1)}})},tz=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return Vx.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===HS.scrolling?["tox-toolbar--scrolling"]:[])},components:[Vx.parts.groups({})],toolbarBehaviours:JR(e,t)})},oz=(e,t)=>((e,t)=>{const o="togglebutton"===e.type,n=e.icon.map(e=>yF(e,t.icons)).map(xv),s={...e,name:o?e.text.getOr(e.icon.getOr("")):e.text??e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:A.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},r=oI(e.buttonType??"secondary"),a=o?e.text.map(t.translate):A.some(t.translate(e.text)),i=a.map(_g),l=s.tooltip.or(a).map(e=>({"aria-label":t.translate(e)})).getOr({}),c=n.map(e=>e.asSpec()),d=gD([c,i]),u=e.icon.isSome()&&i.isSome(),m={tag:"button",classes:r.concat(...e.icon.isSome()&&!u?["tox-button--icon"]:[]).concat(...u?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:l},g=eI(s,A.some(s=>{const r=e=>{n.map(o=>o.getOpt(s).each(o=>{eg.set(o,[yF(e,t.icons)])}))};return o?e.onAction({setIcon:r,setActive:e=>{const t=s.element;e?($n(t,"tox-button--enabled"),zo(t,"aria-pressed",!0)):(qn(t,"tox-button--enabled"),Ho(t,"aria-pressed"))},isActive:()=>Yn(s.element,"tox-button--enabled"),focus:()=>Oo(s.element)}):"button"===e.type?e.onAction({setIcon:r}):void 0}),[],m,d,e.tooltip,t);return Bv.sketch(g)})(e,t),nz=Pt().deviceType,sz=nz.isPhone(),rz=nz.isTablet();var az=rh({name:"silver.View",configFields:[Ar("viewConfig")],partFields:[Qi({factory:{sketch:e=>{let t=!1;const o=L(e.buttons,o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:L(e.buttons,e=>oz(e,t))}))(o,e.providers)):oz(o,e.providers));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...sz||rz?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:sd([hd.config({}),Sm.config({mode:"flow",selector:"button, .tox-button",focusInside:Ti.OnEnterOrSpaceMode})]),components:t?o:[ah.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),ah.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[Ar("buttons"),Ar("providers")],name:"header"}),Qi({factory:{sketch:e=>({uid:e.uid,behaviours:sd([hd.config({}),Kb.config({})]),dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const s={getPane:t=>yv.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,behaviours:sd([hd.config({}),Sm.config({mode:"cyclic",focusInside:Ti.OnEnterOrSpaceMode})]),apis:s}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const iz=(e,t,o)=>ge(t,(t,n)=>{const s=wr(yr("view",YA,t));return e.slot(n,az.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:s,components:[...s.buttons.length>0?[az.parts.header({buttons:s.buttons,providers:o})]:[],az.parts.pane({})]}))}),lz=(e,t)=>Qw.sketch(o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:iz(o,e,t),slotBehaviours:KA([Kc(e=>Qw.hideAllSlots(e))])})),cz=e=>j(Qw.getSlotNames(e),t=>Qw.isShowing(e,t)),dz=(e,t,o)=>{Qw.getSlot(e,t).each(e=>{az.getPane(e).each(t=>{var n;o(e)((n=t.element.dom,{getContainer:y(n)}))})})};var uz=sh({factory:(e,t)=>{let o={};const n={setViews:(e,n)=>{o=n,eg.set(e,[lz(n,t.backstage.shared.providers)])},whichView:e=>Lg.getCurrent(e).bind(cz),toggleView:(e,t,n,s)=>Lg.getCurrent(e).exists(r=>{const a=cz(r),i=a.exists(e=>s===e),l=Qw.getSlot(r,s).isSome();return l&&(Qw.hideAllSlots(r),i?((e=>{const t=e.element;en(t,"display","none"),zo(t,"aria-hidden","true")})(e),t()):(n(!0===o[s]?.keepToolbar),(e=>{const t=e.element;cn(t,"display"),Ho(t,"aria-hidden")})(e),Qw.showSlot(r,s),((e,t)=>{dz(e,t,az.getOnShow)})(r,s)),a.each(e=>((e,t)=>dz(e,t,az.getOnHide))(r,e))),l})};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:sd([eg.config({}),Lg.config({find:e=>{const t=eg.contents(e);return te(t)}})]),apis:n}},name:"silver.ViewWrapper",configFields:[Ar("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,s)=>e.toggleView(t,o,n,s),whichView:(e,t)=>e.whichView(t)}});const mz="tox-editor-container--keep-toolbar",gz=(e,t)=>{t?(en(e,"display","none"),zo(e,"aria-hidden","true")):(cn(e,"display"),Ho(e,"aria-hidden"))},pz=wv.optional({factory:DR,name:"menubar",schema:[Ar("backstage")]}),hz=wv.optional({factory:{sketch:e=>zv.sketch({uid:e.uid,dom:e.dom,listBehaviours:sd([Sm.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>tz({type:e.type,uid:ze("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),A.some(!0))}),setupItem:(e,t,o,n)=>{Vx.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[Ar("dom"),Ar("onEscape")]}),fz=wv.optional({factory:{sketch:e=>{const t=(e=>e.type===HS.sliding?ez:e.type===HS.floating?ZR:tz)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),A.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})}},name:"toolbar",schema:[Ar("dom"),Ar("onEscape"),Ar("getSink")]}),bz=wv.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?ER:bR;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:sd(o(t,e.sharedBackstage))}}},name:"header",schema:[Ar("dom")]}),vz=wv.optional({factory:{sketch:e=>{const t=e.promotionLink?[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/tinymce-upgrade-to-cloud/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:"\u{1f49d} Get all features"}}]:[];return{uid:e.uid,dom:e.dom,components:t}}},name:"promotion",schema:[Ar("dom"),Ar("promotionLink")]}),xz=wv.optional({name:"socket",schema:[Ar("dom")]}),yz=wv.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-sidebar"],styles:{[IR]:BR(e.configuredSidebarWidth)},attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:sd([Kb.config({}),hd.config({}),Ub.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=>{Lg.getCurrent(e).each(Qw.hideAllSlots),Fc(e,$R)},onGrown:e=>{Fc(e,$R)},onStartGrow:e=>{Ic(e,jR,{width:rn(e.element,"width").getOr("")})},onStartShrink:e=>{Ic(e,jR,{width:bn(e.element)+"px"})}}),eg.config({}),Lg.config({find:e=>{const t=eg.contents(e);return te(t)}})])}],behaviours:sd([kB(0),dd("sidebar-sliding-events",[Uc(jR,(e,t)=>{en(e.element,"width",t.event.width),en(e.element,RR,t.event.width)}),Uc($R,(e,t)=>{cn(e.element,"width"),cn(e.element,RR)})])])})},name:"sidebar",schema:[Ar("dom"),Ar("configuredSidebarWidth")]}),wz=wv.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:sd([eg.config({}),Rg.config({focus:!1}),Lg.config({find:e=>te(e.components())})]),components:[]})},name:"throbber",schema:[Ar("dom")]}),Sz=wv.optional({factory:uz,name:"viewWrapper",schema:[Ar("backstage")]}),Cz=wv.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var kz=rh({name:"OuterContainer",factory:(e,t,o)=>{let n=!1,s=!0;const a=(e,t)=>{Rn(e,".tox-statusbar").each(e=>{gz(e,t)})},i=(e,t)=>{Vn(e,".tox-sidebar-wrap").each(e=>{gz(e,t)})},l={getSocket:t=>yv.getPart(t,e,"socket"),setSidebar:(t,o,n,s,a)=>{yv.getPart(t,e,"sidebar").each(e=>((e,t,o,n,s)=>{Lg.getCurrent(e).each(a=>{eg.set(a,[PR(t,n,s)]);const i=o?.toLowerCase();r(i)&&be(t,i)&&Lg.getCurrent(a).each(t=>{Qw.showSlot(t,i),Ub.immediateGrow(a),cn(a.element,"width"),HR(e.element,"region")})})})(e,o,n,s,a))},toggleSidebar:(t,o)=>{yv.getPart(t,e,"sidebar").each(e=>((e,t)=>{Lg.getCurrent(e).each(o=>{Lg.getCurrent(o).each(n=>{Ub.hasGrown(o)?Qw.isShowing(n,t)?(Ub.shrink(o),HR(e.element,"presentation")):(Qw.hideAllSlots(n),Qw.showSlot(n,t),HR(e.element,"region")):(Qw.hideAllSlots(n),Qw.showSlot(n,t),Ub.grow(o),HR(e.element,"region"))})})})(e,o))},whichSidebar:t=>yv.getPart(t,e,"sidebar").bind(WR).getOrNull(),getHeader:t=>yv.getPart(t,e,"header"),getToolbar:t=>yv.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{yv.getPart(t,e,"toolbar").each(e=>{const t=L(o,KR);e.getApis().setGroups(e,t)})},setToolbars:(t,o)=>{yv.getPart(t,e,"multiple-toolbar").each(e=>{const t=L(o,e=>L(e,KR));zv.setItems(e,t)})},refreshToolbar:t=>{yv.getPart(t,e,"toolbar").each(e=>e.getApis().refresh(e))},toggleToolbarDrawer:t=>{yv.getPart(t,e,"toolbar").each(e=>{We(e.getApis().toggle,t=>t(e))})},toggleToolbarDrawerWithoutFocusing:t=>{yv.getPart(t,e,"toolbar").each(e=>{We(e.getApis().toggleWithoutFocusing,t=>t(e))})},isToolbarDrawerToggled:t=>yv.getPart(t,e,"toolbar").bind(e=>A.from(e.getApis().isOpen).map(t=>t(e))).getOr(!1),getThrobber:t=>yv.getPart(t,e,"throbber"),focusToolbar:t=>{yv.getPart(t,e,"toolbar").orThunk(()=>yv.getPart(t,e,"multiple-toolbar")).each(e=>{Sm.focusIn(e)})},setMenubar:(t,o)=>{yv.getPart(t,e,"menubar").each(e=>{DR.setMenus(e,o)})},focusMenubar:t=>{yv.getPart(t,e,"menubar").each(e=>{DR.focus(e)})},setViews:(t,o,n)=>{yv.getPart(t,e,"viewWrapper").each(e=>{uz.setViews(e,o)});const s=n?.toLowerCase();r(s)&&be(o,s)&&l.toggleView(t,s,!1)},toggleView:(t,o,n)=>yv.getPart(t,e,"viewWrapper").exists(e=>uz.toggleView(e,()=>l.showMainView(t,n),e=>l.hideMainView(t,e),o)),whichView:t=>yv.getPart(t,e,"viewWrapper").bind(uz.whichView).getOrNull(),hideMainView:(t,o)=>{const r=o&&!s&&n;o?n=!1:s&&(n=l.isToolbarDrawerToggled(t),n&&l.toggleToolbarDrawer(t)),s=o,yv.getPart(t,e,"editorContainer").each(n=>{const s=n.element;a(s,!o),o?(yv.getPart(t,e,"sidebar").each(UR),$n(s,mz),gz(s,!1),i(s,!0)):(qn(s,mz),i(s,!1),gz(s,!0))}),r&&l.toggleToolbarDrawerWithoutFocusing(t)},showMainView:(t,o)=>{n&&(o?l.toggleToolbarDrawerWithoutFocusing(t):l.toggleToolbarDrawer(t),n=!1),s=!0,yv.getPart(t,e,"editorContainer").each(e=>{const t=e.element;qn(t,mz),i(t,!1),a(t,!1),gz(t,!1)})}};return{uid:e.uid,dom:e.dom,components:t,apis:l,behaviours:e.behaviours}},configFields:[Ar("dom"),Ar("behaviours")],partFields:[bz,pz,fz,hz,xz,yz,vz,wz,Sz,Cz],apis:{getSocket:(e,t)=>e.getSocket(t),setSidebar:(e,t,o,n,s,r)=>{e.setSidebar(t,o,n,s,r)},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,n)=>{e.setViews(t,o,n)},toggleView:(e,t,o,n)=>e.toggleView(t,o,n),whichView:(e,t)=>e.whichView(t)}});const Oz={file:{title:"File",items:"newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code suggestededits revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image video link media addcomment pageembed inserttemplate codesample inserttable accordion math | 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:"tinymceai-chat tinymceai-review tinymceai-quickactions 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"}},_z=e=>e.split(" "),Tz=(e,t)=>{const o={...Oz,...t.menus},n=re(t.menus).length>0,s=void 0===t.menubar||!0===t.menubar?_z("file edit view insert format tools table help"):_z(!1===t.menubar?"":t.menubar),a=H(s,e=>{const o=be(Oz,e);return n?o||fe(t.menus,e).exists(e=>be(e,"items")):o}),i=L(a,n=>{const s=o[n];return((e,t,o)=>{const n=sC(o).split(/[ ,]/);return{text:e.title,getItems:()=>q(e.items,e=>{const o=e.toLowerCase();return 0===o.trim().length||R(n,e=>e===o)?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]})}})({title:s.title,items:_z(s.items)},t,e)});return H(i,e=>e.getItems().length>0&&R(e.getItems(),e=>r(e)||"separator"!==e.type))},Ez=(e,t,o)=>(e.on("remove",()=>o.unload(t)),o.load(t)),Az=(e,t,o,n)=>(e.on("remove",()=>n.unloadRawCss(t)),n.loadRawCss(t,o)),Dz=e=>A.from(tinymce.Resource.get(e)).filter(r),Mz=(e,t,o="")=>{const n=(e=>{const t=RC(e);return t?A.from(t):A.none()})(e).map(e=>((e,t)=>"ui/"+e+"/"+t)(e,`${t}.css`)),s=n.bind(Dz);return Ue(n,s,(e,t)=>({_kind:"load-raw",key:e,css:t})).getOrThunk(()=>{const n=e.editorManager.suffix;return{_kind:"load-stylesheet",url:o+`/${t}${n}.css`}})},Bz=(e,t)=>{const o=e.ui.styleSheetLoader,n=Mz(e,"skin",t);switch(n._kind){case"load-raw":const{key:t,css:s}=n;return Az(e,t,s,o),Promise.resolve();case"load-stylesheet":const{url:r}=n;return Ez(e,r,o);default:return Promise.resolve()}},Fz=(e,t)=>{var o;if(o=ct(e.getElement()),!ho(o).isSome())return Promise.resolve();{const o=LS.DOM.styleSheetLoader,n=Mz(e,"skin.shadowdom",t);switch(n._kind){case"load-raw":const{key:t,css:s}=n;return Az(e,t,s,o),Promise.resolve();case"load-stylesheet":const{url:r}=n;return Ez(e,r,o);default:return Promise.resolve()}}},Iz=(e,t)=>(async(e,t)=>{const o=LC(t);if(await((e,t,o)=>{const n=Mz(e,t?"content.inline":"content",o);if(!o)return Promise.resolve();switch(n._kind){case"load-raw":const{key:t}=n;return e.contentCSS.push(t),Promise.resolve();case"load-stylesheet":const{url:o}=n;return e.contentCSS.push(o),Promise.resolve();default:return Promise.resolve()}})(t,e,o),!zC(t)&&r(o))return Promise.all([Bz(t,o),Fz(t,o)]).then()})(e,t).then((e=>{const t=()=>{e._skinLoaded=!0,(e=>{e.dispatch("SkinLoaded")})(e)};return()=>{e.initialized?t():e.on("init",t)}})(t),(e=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:"Skin could not be loaded"}))(t)),Rz=C(Iz,!1),zz=C(Iz,!0),Vz=e=>({isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t),setText:t=>Ic(e,SF,{text:t}),setIcon:t=>Ic(e,CF,{icon:t})}),Lz=e=>({setActive:t=>{sv.set(e,t)},isActive:()=>sv.isOn(e),isEnabled:()=>!op.isDisabled(e),setEnabled:t=>op.set(e,!t),setText:t=>Ic(e,SF,{text:t}),setIcon:t=>Ic(e,CF,{icon:t})}),Nz=(e,t)=>e.map(e=>({"aria-label":t.translate(e)})).getOr({}),Pz=ze("focus-button"),Hz=(e,t,o,n,s,r,a)=>{const i=t.map(e=>xv(wF(e,"tox-tbtn",s))),l=e.map(e=>xv(yF(e,s.icons)));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:{...Nz(o,s),...g(a)?{"data-mce-name":a}:{}}},components:gD([l.map(e=>e.asSpec()),i.map(e=>e.asSpec())]),eventOrder:{[la()]:["focusing","alloy.base.behaviour",hF],[Ga()]:[hF,"toolbar-group-button-events"],[qa()]:[hF,"toolbar-group-button-events","tooltipping"]},buttonBehaviours:sd([ZA(()=>s.checkUiComponentContext(r).shouldDisable),dD(()=>s.checkUiComponentContext(r)),dd(hF,[Kc((e,t)=>bF(e)),Uc(SF,(e,t)=>{i.bind(t=>t.getOpt(e)).each(e=>{eg.set(e,[_g(s.translate(t.event.text))])})}),Uc(CF,(e,t)=>{l.bind(t=>t.getOpt(e)).each(e=>{eg.set(e,[yF(t.event.icon,s.icons)])})}),Uc(la(),(e,t)=>{t.event.prevent(),Fc(e,Pz)})])].concat(n.getOr([])))}},Uz=(e,t,o,n)=>{const s=ye(b),r=Hz(e.icon,e.text,e.tooltip,A.none(),o,e.context,n);return Bv.sketch({dom:r.dom,components:r.components,eventOrder:fF,buttonBehaviours:{...sd([dd("toolbar-button-events",[(a={onAction:e.onAction,getApi:t.getApi},Zc((e,t)=>{eD(a,e)(t=>{Ic(e,pF,{buttonApi:t}),a.onAction(t)})})),tD(t,s),oD(t,s)]),...e.tooltip.map(t=>fv.config(o.tooltips.getConfig({tooltipText:o.translate(t)+e.shortcut.map(e=>` (${bD(e)})`).getOr("")}))).toArray(),ZA(()=>!e.enabled||o.checkUiComponentContext(e.context).shouldDisable),dD(()=>o.checkUiComponentContext(e.context))].concat(t.toolbarButtonBehaviours)),[hF]:r.buttonBehaviours?.[hF]}});var a},Wz=(e,t,o,n)=>Uz(e,{toolbarButtonBehaviours:o.length>0?[dd("toolbarButtonWith",o)]:[],getApi:Vz,onSetup:e.onSetup},t,n),jz=(e,t,o,n)=>Uz(e,{toolbarButtonBehaviours:[eg.config({}),sv.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[dd("toolbarToggleButtonWith",o)]:[]).concat(e.onDoubleClick.map(e=>dd("toolbarToggleButtonDoubleClick",[Uc(ya(),t=>{op.isDisabled(t)||e(Lz(t))})])).toArray()),getApi:Lz,onSetup:e.onSetup},t,n),$z=(e,t,o)=>n=>Oe(e=>t.fetch(e)).map(s=>A.from(tB(Le(NM(ze("menu-value"),s,o=>{t.onItemAction(e(n),o)},t.columns,t.presets,ZO.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:HM(t.columns,t.presets),menuBehaviours:KA("auto"!==t.columns?[]:[Kc((e,o)=>{XA(e,4,u_(t.presets)).each(({numRows:t,numColumns:o})=>{Sm.setGridSize(e,t,o)})})])})))),Gz=e=>{Zx.getContent(e).each(e=>{Vn(e.element,".tox-toolbar-slider__input,.tox-toolbar-textfield").fold(()=>Sm.focusIn(e),Oo)})},qz=ze("forward-slide"),Yz=ze("backward-slide"),Xz=ze("change-slide-event"),Kz="tox-pop--resizing",Jz=(e,t,o)=>ot(o)?e.translate(t):e.translate([t,e.translate(o)]),Qz=(e,t)=>{const o=(o,s,r,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return A.some({type:"separator",text:i});if("submenu"===o.type){const e=q(o.getStyleItems(),e=>n(e,s,a));return 0===s&&e.length<=0?A.none():A.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>q(o.getStyleItems(),e=>n(e,s,a))})}return A.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!r,onAction:t.onAction(o),...o.getStylePreview().fold(()=>({}),e=>({meta:{style:e}}))})},n=(e,n,s)=>{const r="formatter"===e.type&&t.isInvalid(e);return 0===n?r?[]:o(e,n,!1,s).toArray():o(e,n,r,s).toArray()},s=e=>{const o=t.getCurrentValue(),s=t.shouldHide?0:1;return q(e,e=>n(e,s,o))};return{validateItems:s,getFetch:(e,t)=>(o,n)=>{const r=t(),a=s(r);n(AF(a,ZO.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:A.none()}))}}},Zz=(e,t)=>{const o=t.dataset,n="basic"===o.type?()=>L(o.data,e=>PI(e,t.isSelectedFor,t.getPreviewFor)):o.getData;return{items:Qz(e,t),getStyleItems:n}},eV=(e,t,o,n,s,r)=>{const{items:a,getStyleItems:i}=Zz(t,o),l=ye(o.tooltip);return OF({context:"mode:design",text:o.icon.isSome()?A.none():o.text,icon:o.icon,ariaLabel:A.some(o.tooltip),tooltip:A.none(),role:A.none(),fetch:a.getFetch(t,i),onSetup:t=>{const r=o=>t.setTooltip(Jz(e,n(o.value),o.value));return e.on(s,r),rM(lM(e,"NodeChange",t=>{const n=t.getComponent();o.updateText(n),op.set(t.getComponent(),!e.selection.isEditable()||0===i().length)})(t),()=>e.off(s,r))},getApi:e=>({getComponent:y(e),setTooltip:o=>{const n=t.shared.providers.translate(o);zo(e.element,"aria-label",n),l.set(o)}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[fv.config({...t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(o.tooltip),onShow:e=>{if(o.tooltip!==l.get()){const o=t.shared.providers.translate(l.get());fv.setComponents(e,t.shared.providers.tooltips.getComponents({tooltipText:o}))}}})})]},"tox-tbtn",t.shared,r)};var tV;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(tV||(tV={}));const oV=(e,t,o)=>{const n=(s=((e,t)=>t===tV.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o),L(s,e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}}));var s;return{type:"basic",data:n}},nV=y("Alignment {0}"),sV="left",rV=[{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"}],aV=e=>{const t={type:"basic",data:rV};return{tooltip:Jz(e,nV(),sV),text:A.none(),icon:A.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:e=>A.none,onAction:t=>()=>j(rV,e=>e.format===t.format).each(t=>e.execCommand(t.command)),updateText:t=>{const o=j(rV,t=>e.formatter.match(t.format)).fold(y(sV),e=>e.title.toLowerCase());Ic(t,CF,{icon:`align-${o}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:o})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},iV=(e,t)=>{const o=t(),n=L(o,e=>e.format);return A.from(e.formatter.closest(n)).bind(e=>j(o,t=>t.format===e))},lV=y("Block {0}"),cV="Paragraph",dV=e=>{const t=oV(e,"block_formats",tV.SemiColon);return{tooltip:Jz(e,lV(),cV),text:A.some(cV),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:cM(e),updateText:o=>{const n=iV(e,()=>t.data).fold(y(cV),e=>e.title);Ic(o,SF,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},uV=y("Font {0}"),mV="System Font",gV=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],pV=e=>{const t=e.split(/\s*,\s*/);return L(t,e=>e.replace(/^['"]+|['"]+$/g,""))},hV=(e,t)=>t.length>0&&Y(t,t=>e.indexOf(t.toLowerCase())>-1),fV=e=>{const t=()=>{const t=e=>e?pV(e)[0]:"",n=e.queryCommandValue("FontName"),s=o.data,r=n?n.toLowerCase():"",a=IC(e),i=j(s,e=>{const o=e.format;return o.toLowerCase()===r||t(o).toLowerCase()===t(r).toLowerCase()}).orThunk(()=>je(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=pV(e.toLowerCase());return hV(o,gV)||hV(o,t)}return!1})(r,a),{title:mV,format:r}));return{matchOpt:i,font:n}},o=oV(e,"font_family_formats",tV.SemiColon);return{tooltip:Jz(e,uV(),mV),text:A.some(mV),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>A.some({tag:"div",styles:-1===e.indexOf("dings")?{"font-family":e}:{}}),onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontName",!1,t.format)})},updateText:o=>{const{matchOpt:n,font:s}=t(),r=n.fold(y(s),e=>e.title);Ic(o,SF,{text:r}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:r})},dataset:o,shouldHide:!1,isInvalid:T}};var bV=tinymce.util.Tools.resolve("tinymce.util.VK");const vV=y("Font size {0}"),xV="12pt",yV={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},wV={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},SV=(e,t)=>/[0-9.]+px$/.test(e)?((e,t)=>{const o=Math.pow(10,t);return Math.round(e*o)/o})(72*parseInt(e,10)/96,t||0)+"pt":fe(wV,e).getOr(e),CV=e=>fe(yV,e).getOr(""),kV=e=>{const t=()=>{let t=A.none();const o=n.data,s=e.queryCommandValue("FontSize");if(s)for(let e=3;t.isNone()&&e>=0;e--){const n=SV(s,e),r=CV(n);t=j(o,e=>e.format===s||e.format===n||e.format===r)}return{matchOpt:t,size:s}},o=y(A.none),n=oV(e,"font_size_formats",tV.Space);return{tooltip:Jz(e,vV(),xV),text:A.some(xV),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getPreviewFor:o,getCurrentValue:()=>{const{matchOpt:e}=t();return e},onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontSize",!1,t.format)})},updateText:o=>{const{matchOpt:n,size:s}=t(),r=n.fold(y(s),e=>e.title);Ic(o,SF,{text:r}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:r})},dataset:n,shouldHide:!1,isInvalid:T}},OV=e=>ot(e)?"Formats":"Format {0}",_V=(e,t)=>{const o="Formats";return{tooltip:Jz(e,OV(""),""),text:A.some(o),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:cM(e),updateText:t=>{const n=e=>RI(e)?q(e.items,n):zI(e)?[{title:e.title,format:e.format}]:[],s=q(NI(e),n),r=iV(e,y(s)).fold(y({title:o,tooltipLabel:""}),e=>({title:e.title,tooltipLabel:e.title}));Ic(t,SF,{text:r.title}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:r.tooltipLabel})},shouldHide:oC(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},TV=[{name:"history",items:["undo","redo"]},{name:"ai",items:["tinymceai-chat","tinymceai-review","tinymceai-quickactions","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"]}],EV=(e,t)=>(o,n,s,r)=>{const a=e(o).mapError(e=>Cr(e)).getOrDie();return t(a,n,s,r)},AV={button:EV(aA,(e,t,o,n)=>((e,t,o)=>Wz(e,t,[],o))(e,t.shared.providers,n)),togglebutton:EV(cA,(e,t,o,n)=>((e,t,o)=>jz(e,t,[],o))(e,t.shared.providers,n)),menubutton:EV(TE,(e,t,o,n)=>HF(e,"tox-tbtn",t,A.none(),!1,n)),splitbutton:EV(e=>yr("SplitButton",WA,e),(e,t,o,n)=>((e,t,o)=>{const n=ye(b),s=ye(e.tooltip.getOr("")),r=((e,t,o)=>n=>{const s=n.getSystem(),r=n.element,a=()=>{const e=Yn(r,"tox-split-button__chevron");return{mainOpt:e?so(r).bind(e=>s.getByDom(e).toOptional()):A.some(n),chevronOpt:e?A.some(n):ro(r).bind(e=>s.getByDom(e).toOptional().filter(e=>Yn(e.element,"tox-split-button__chevron")))}},i=e=>{const{mainOpt:t,chevronOpt:o}=a();t.each(e),o.each(e)};return{isEnabled:()=>{const{mainOpt:e}=a();return e.exists(e=>!op.isDisabled(e))},setEnabled:e=>i(t=>op.set(t,!e)),setText:e=>{const{mainOpt:t}=a();t.each(t=>Ic(t,SF,{text:e}))},setIcon:e=>{const{mainOpt:t}=a();t.each(t=>Ic(t,CF,{icon:e}))},setIconFill:(e,t)=>i(o=>{Vn(o.element,`svg path[class="${e}"], rect[class="${e}"]`).each(e=>{zo(e,"fill",t)})}),isActive:()=>{const{mainOpt:e}=a();return e.exists(e=>sv.isOn(e))},setActive:e=>{const{mainOpt:t}=a();t.each(t=>sv.set(t,e))},setTooltip:n=>{e.set(n);const{mainOpt:s,chevronOpt:r}=a();s.each(e=>zo(e.element,"aria-label",t.providers.translate(n)));const i=o.chevronTooltip.map(e=>t.providers.translate(e)).getOr(t.providers.translate(n));r.each(e=>zo(e.element,"aria-label",i))}}})(s,t,e),a=ze("tox-split-menu"),i=ye(!1),l=()=>e.tooltip.map(e=>t.providers.translate(e)).getOr(t.providers.translate("Text color")),c=()=>e.chevronTooltip.map(e=>t.providers.translate(e)).getOrThunk(()=>{const e=l();return t.providers.translate(["{0} menu",e])}),d=(e,t)=>{i.set(e),zo(t.element,"aria-expanded",String(e))},u=Ax.sketch({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:$O("chevron-down",t.providers.icons),attributes:{"aria-label":c(),...g(o)?{"data-mce-name":o+"-chevron"}:{},"aria-haspopup":"menu","aria-expanded":String(i.get()),"aria-controls":a}},components:[],toggleClass:"tox-tbtn--enabled",dropdownBehaviours:sd([dd("split-dropdown-events",[Kc((e,t)=>bF(e)),tD({getApi:r,onSetup:e.onSetup},n),Uc("alloy-dropdown-open",e=>d(!0,e)),Uc("alloy-dropdown-close",e=>d(!1,e))]),ZA(()=>t.providers.checkUiComponentContext(e.context).shouldDisable),dD(()=>t.providers.checkUiComponentContext(e.context)),bv.config({}),fv.config(t.providers.tooltips.getConfig({tooltipText:c(),onShow:o=>{if(s.get()!==e.tooltip.getOr("")){const n=e.chevronTooltip.map(e=>t.providers.translate(e)).getOr(`${t.providers.translate(s.get())} menu`);fv.setComponents(o,t.providers.tooltips.getComponents({tooltipText:n}))}}}))]),lazySink:t.getSink,fetch:$z(r,e,t.providers),getHotspot:e=>so(e.element).bind(t=>e.getSystem().getByDom(t).toOptional()),onOpen:(e,t,o)=>{Yd.highlightBy(o,e=>Yn(e.element,"tox-collection__item--active")),Yd.getHighlighted(o).each(Sm.focusIn)},parts:{menu:{...b_(0,e.columns,e.presets),dom:{...b_(0,e.columns,e.presets).dom,tag:"div",attributes:{id:a}}}}}),m=Hz(e.icon,e.text,A.none(),A.some([sv.config({toggleClass:"tox-tbtn--enabled",aria:"color"===e.presets?{mode:"none"}:{mode:"pressed"},toggleOnExecute:!1}),...e.tooltip.isSome()?[fv.config(t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e.tooltip.getOr("")),onShow:o=>{if(s.get()!==e.tooltip.getOr("")){const e=t.providers.translate(s.get());fv.setComponents(o,t.providers.tooltips.getComponents({tooltipText:e}))}}}))]:[]]),t.providers,e.context,o),p=Bv.sketch({dom:{...m.dom,classes:["tox-tbtn","tox-split-button__main"].concat(e.text.isSome()?["tox-tbtn--select"]:[]),attributes:{"aria-label":l(),...g(o)?{"data-mce-name":o}:{}}},components:m.components,eventOrder:m.eventOrder,buttonBehaviours:m.buttonBehaviours,action:t=>{if(e.onAction){const o=r(t);o.isEnabled()&&e.onAction(o)}}});return[p,u]})(e,t.shared,n)),grouptoolbarbutton:EV(e=>yr("GroupToolbarButton",UA,e),(e,t,o,n)=>{const s=o.ui.registry.getAll().buttons,r={[_c]:t.shared.header.isPositionedAtTop()?Oc.TopToBottom:Oc.BottomToTop};if(rC(o)===HS.floating)return((e,t,o,n,s)=>{const r=t.shared,a=ye(b),i={toolbarButtonBehaviours:[],getApi:Vz,onSetup:e.onSetup},l=[dd("toolbar-group-button-events",[tD(i,a),oD(i,a)]),...e.tooltip.map(e=>fv.config(t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(e)}))).toArray()];return jx.sketch({lazySink:r.getSink,fetch:()=>Oe(t=>{t(L(o(e.items),KR))}),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:Hz(e.icon,e.text,e.tooltip,A.some(l),r.providers,e.context,s),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,e=>MV(o,{buttons:s,toolbar:e,allowToolbarGroups:!1},t,A.none()),r,n);throw new Error("Toolbar groups are only supported when using floating toolbar mode")})},DV={styles:(e,t)=>{const o={type:"advanced",...t.styles};return eV(e,t,_V(e,o),OV,"StylesTextUpdate","styles")},fontsize:(e,t)=>eV(e,t,kV(e),vV,"FontSizeTextUpdate","fontsize"),fontsizeinput:(e,t)=>((e,t,o,n)=>{let s=A.none();const r=lM(e,"NodeChange SwitchMode DisabledStateChange",t=>{const n=t.getComponent();s=A.some(n),o.updateInputValue(n),op.set(n,!e.selection.isEditable()||qS(e))}),a=e=>({getComponent:y(e)}),i=ye(b),l=ze("custom-number-input-events"),c=(e,t,n)=>{const r=s.map(e=>ef.getValue(e)).getOr(""),a=o.getNewValue(r,e),i=r.length-`${a}`.length,l=s.map(e=>e.element.dom.selectionStart-i),c=s.map(e=>e.element.dom.selectionEnd-i);o.onAction(a,n),s.each(e=>{ef.setValue(e,a),t&&(l.each(t=>e.element.dom.selectionStart=t),c.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=>oo(e.element).fold(A.none,e=>(Oo(e),A.some(!0))),p=e=>To(e.element)?(lo(e.element).each(e=>Oo(e)),A.some(!0)):A.none(),h=(o,n,s,r)=>{const i=ye(b),l=t.shared.providers.translate(s),c=ze("altExecuting"),d=lM(e,"NodeChange SwitchMode DisabledStateChange",t=>{op.set(t.getComponent(),!e.selection.isEditable()||qS(e))}),u=e=>{op.isDisabled(e)||o(!0)};return Bv.sketch({dom:{tag:"button",attributes:{"aria-label":l,"data-mce-name":n},classes:r.concat(n)},components:[xF(n,t.shared.providers.icons)],buttonBehaviours:sd([op.config({}),fv.config(t.shared.providers.tooltips.getConfig({tooltipText:l})),dd(c,[tD({onSetup:d,getApi:a},i),oD({getApi:a},i),Uc(ha(),(e,t)=>{t.event.raw.keyCode!==bV.SPACEBAR&&t.event.raw.keyCode!==bV.ENTER||op.isDisabled(e)||o(!1)}),Uc(xa(),u),Uc(aa(),u)])]),eventOrder:{[ha()]:[c,"keying"],[xa()]:[c,"alloy.base.behaviour"],[aa()]:[c,"alloy.base.behaviour"],[Ga()]:["alloy.base.behaviour",c,"tooltipping"],[qa()]:[c,"tooltipping"]}})},f=xv(h(e=>d(!1,e),"minus","Decrease font size",[])),v=xv(h(e=>u(!1,e),"plus","Increase font size",[])),x=xv({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[sy.sketch({inputBehaviours:sd([op.config({}),dd(l,[tD({onSetup:r,getApi:a},i),oD({getApi:a},i)]),dd("input-update-display-text",[Uc(SF,(e,t)=>{ef.setValue(e,t.event.text)}),Uc(pa(),e=>{o.onAction(ef.getValue(e))}),Uc(va(),e=>{o.onAction(ef.getValue(e))})]),Sm.config({mode:"special",onEnter:e=>(c(w,!0,!0),A.some(!0)),onEscape:m,onUp:e=>(u(!0,!1),A.some(!0)),onDown:e=>(d(!0,!1),A.some(!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})],behaviours:sd([hd.config({}),Sm.config({mode:"special",onEnter:p,onSpace:p,onEscape:m}),dd("input-wrapper-events",[Uc(ma(),e=>{N([f,v],t=>{const o=ct(t.get(e).element.dom);To(o)&&_o(o)})})])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...g(n)?{"data-mce-name":n}:{}}},components:[f.asSpec(),x.asSpec(),v.asSpec()],behaviours:sd([hd.config({}),Sm.config({mode:"flow",focusInside:Ti.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>To(e.element)?A.none():(Oo(e.element),A.some(!0))})])}})(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>Ic(e,SF,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{ws(o,["unsupportedLength","empty"]);const s=t(),r=ws(o,["unsupportedLength","empty"]).or(ws(s,["unsupportedLength","empty"])),a=r.map(e=>e.value).getOr(16),i=fC(e),l=r.map(e=>e.unit).filter(e=>""!==e).getOr(i),c=n(a,(e=>({em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e]??{step:1}))(l).step),d=`${(e=>e>=0)(c)?c:a}${l}`;return d!==s&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e),"fontsizeinput"),fontfamily:(e,t)=>eV(e,t,fV(e),uV,"FontFamilyTextUpdate","fontfamily"),blocks:(e,t)=>eV(e,t,dV(e),lV,"BlocksTextUpdate","blocks"),align:(e,t)=>eV(e,t,aV(e),nV,"AlignTextUpdate","align"),navigateback:(e,t)=>{const o=wr(aA({type:"button",icon:"chevron-left",tooltip:"Back",onAction:b}));return Wz(o,t.shared.providers,[Uc(pF,e=>{Fc(e,Yz)})])}},MV=(e,t,o,n)=>{const s=(e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=L(TV,t=>{const o=H(t.items,t=>be(e,t)||be(DV,t));return{name:t.name,items:o}});return H(t,e=>e.items.length>0)})(o):r(t)?(e=>{const t=e.split("|");return L(t,e=>({items:e.trim().split(" ")}))})(t):(e=>f(e,e=>(be(e,"name")||be(e,"label"))&&be(e,"items")))(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])})(t),a=L(s,s=>{const r=q(s.items,s=>0===s.trim().length?[]:((e,t,o,n,s,r)=>fe(t,o.toLowerCase()).orThunk(()=>r.bind(e=>se(e,e=>fe(t,e+o.toLowerCase())))).fold(()=>fe(DV,o.toLowerCase()).map(t=>t(e,s)),t=>"grouptoolbarbutton"!==t.type||n?((e,t,o,n)=>fe(AV,e.type).fold(()=>(console.error("skipping button defined by",e),A.none()),s=>A.some(s(e,t,o,n))))(t,s,e,o.toLowerCase()):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),A.none())))(e,t.buttons,s,t.allowToolbarGroups,o,n).map(e=>Array.isArray(e)?e:[e]).getOr([]));return{title:A.from(e.translate(s.name)),label:je(void 0!==s.label,e.translate(s.label)),items:r}});return H(a,e=>e.items.length>0)},BV=(e,t,o,n)=>{const s=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,r)){const t=a.map(t=>{const s={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return MV(e,s,n,A.none())});kz.setToolbars(s,t)}else kz.setToolbar(s,MV(e,o,n,A.none()))},FV=Pt(),IV=FV.os.isiOS()&&FV.os.version.major<=12;var RV=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=t,i=ye(0),l=r.outerContainer;Rz(e);const d=ct(s.targetNode),u=po(go(d));Nm(d,r.mothership),((e,t,o)=>{XC(e)&&Nm(o.mainUi.mothership.element,o.popupUi.mothership),Lm(t,o.dialogUi.mothership)})(e,u,t),e.on("PostRender",()=>{kz.setSidebar(l,o.sidebar,TC(e),{minWidth:AC(e),maxWidth:DC(e)},e),kz.setViews(l,o.views,MC(e))},!0),e.on("SkinLoaded",()=>{BV(e,t,o,n),i.set(e.getWin().innerWidth),kz.setMenubar(l,Tz(e,o)),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let s=e.getWin();const r=e.getDoc().documentElement,a=ye(yn(s.innerWidth,s.innerHeight)),i=ye(yn(r.offsetWidth,r.offsetHeight)),l=()=>{const t=a.get();t.left===s.innerWidth&&t.top===s.innerHeight||(a.set(yn(s.innerWidth,s.innerHeight)),eM(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(yn(t.offsetWidth,t.offsetHeight)),eM(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(s,"resize",l),n.bind(s,"scroll",d);const u=So(ct(e.getBody()),"load",c);e.on("hide",()=>{N(o,e=>{en(e.element,"display","none")})}),e.on("show",()=>{N(o,e=>{cn(e.element,"display")})}),e.on("NodeChange",c),e.on("remove",()=>{u.unbind(),n.unbind(s,"resize",l),n.unbind(s,"scroll",d),s=null})})(e,t)});const m=kz.getSocket(l).getOrDie("Could not find expected socket element");if(IV){tn(m.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=(e=>{let t=null;return{cancel:()=>{c(t)||(clearTimeout(t),t=null)},throttle:(...o)=>{c(t)&&(t=setTimeout(()=>{t=null,e.apply(null,o)},20))}}})(()=>{e.dispatch("ScrollContent")}),o=wo(m.element,"scroll",t.throttle);e.on("remove",o.unbind)}cD(e,t),e.addCommand("ToggleSidebar",(t,o)=>{kz.toggleSidebar(l,o),nM(e)}),e.addQueryValueHandler("ToggleSidebar",()=>kz.whichSidebar(l)??""),e.addCommand("ToggleView",(t,o,n)=>{const s=!0===n?.skip_focus,i=kz.whichSidebar(l);if(kz.toggleView(l,o,s)){const t=l.element;r.mothership.broadcastOn([_d()],{target:t}),N(a,e=>{e.broadcastOn([_d()],{target:t})}),c(kz.whichView(l))&&(s||e.focus({scrollToSelection:!1}),e.nodeChanged(),kz.refreshToolbar(l)),i!==kz.whichSidebar(l)&&nM(e),(e=>{e.dispatch("ToggleView")})(e)}}),e.addQueryValueHandler("ToggleView",()=>kz.whichView(l)??"");const g=rC(e);g!==HS.sliding&&g!==HS.floating||e.on("ResizeWindow ResizeEditor ResizeContent",()=>{const o=e.getWin().innerWidth;o!==i.get()&&(kz.refreshToolbar(t.mainUi.outerContainer),i.set(o))});const p={setEnabled:e=>{lD(t,e?"setEnabled":"setDisabled")},isEnabled:()=>!op.isDisabled(l)};return{iframeContainer:m.element.dom,editorContainer:l.element.dom,api:p}}});const zV=e=>{const t=XS(e),o=KS(e),n=QS(e);return MR(t).map(e=>FR(e,o,n))},{ToolbarLocation:VV,ToolbarMode:LV}=JC,NV=(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=o,i=LS.DOM,l=$C(e),c=YC(e),d=QS(e).or(zV(e)),u=n.shared.header,m=u.isPositionedAtTop,g=rC(e),p=g===LV.sliding||g===LV.floating,h=ye(!1),f=()=>h.get()&&!e.removed,b=e=>p?e.fold(y(0),e=>e.components().length>1?gn(e.components()[1].element):0):0,v=()=>{N(a,e=>{e.broadcastOn([Td()],{})})},x=o=>{if(!f())return;l||s.on(e=>{const o=d.getOrThunk(()=>Cs().width-Cn(t).left-10);en(e.element,"max-width",o+"px")});const n=kn(),a=!(l||l||!(Sn(r.outerContainer.element).left+vn(r.outerContainer.element)>=window.innerWidth-40||rn(r.outerContainer.element,"width").isSome())||(en(r.outerContainer.element,"position","absolute"),en(r.outerContainer.element,"left","0px"),cn(r.outerContainer.element,"width"),0));if(p&&kz.refreshToolbar(r.outerContainer),!l){const o=kn(),i=je(n.left!==o.left,n);((o,n)=>{s.on(s=>{const a=kz.getToolbar(r.outerContainer),i=b(a),l=Es(t),c=((e,t)=>XC(e)?Fs(t):A.none())(e,r.outerContainer.element),d=c.fold(()=>l.x,e=>{const t=Es(e);return wt(e,Ko())?l.x:l.x-t.x}),u=je(o,Math.ceil(r.outerContainer.element.dom.getBoundingClientRect().width)).filter(e=>e>150).map(e=>{const t=n.getOr(kn()),o=window.innerWidth-(d-t.left),s=Math.max(Math.min(e,o),150);return o<e&&en(r.outerContainer.element,"width",s+"px"),{width:s+"px"}}).getOr({width:"max-content"}),g={position:"absolute",left:Math.round(d)+"px",top:Math.round(c.fold(()=>m()?Math.max(l.y-gn(s.element)+i,0):l.bottom,e=>{const t=Es(e),o=e.dom.scrollTop??0,n=wt(e,Ko())?Math.max(l.y-gn(s.element)+i,0):l.y-t.y+o-gn(s.element)+i;return m()?n:l.bottom}))+"px"};tn(r.outerContainer.element,{...g,...u})})})(a,i),i.each(e=>{On(e.left,o.top)})}c&&s.on(o),v()},w=()=>!(l||!c||!f())&&s.get().exists(o=>{const n=u.getDockingMode(),a=(o=>{switch(iC(e)){case VV.auto:const e=kz.getToolbar(r.outerContainer),n=b(e),s=gn(o.element)-n,a=Es(t);if(a.y>s)return"top";{const e=Zt(t),o=Math.max(e.dom.scrollHeight,gn(e));return a.bottom<o-s||Ms().bottom<a.bottom-s?"bottom":"top"}case VV.bottom:return"bottom";case VV.top:default:return"top"}})(o);return a!==n&&(i=a,s.on(e=>{Ap.setModes(e,[i]),u.setDockingMode(i);const t=m()?Oc.TopToBottom:Oc.BottomToTop;zo(e.element,_c,t)}),!0);var i});return{isVisible:f,isPositionedAtTop:m,show:()=>{h.set(!0),en(r.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),N(a,e=>{cn(e.element,"display")}),w(),XC(e)?x(e=>Ap.isDocked(e)?Ap.reset(e):Ap.refresh(e)):x(Ap.refresh)},hide:()=>{h.set(!1),en(r.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),N(a,e=>{en(e.element,"display","none")})},update:x,updateMode:()=>{w()&&x(Ap.reset)},repositionPopups:v}},PV=(e,t)=>{const o=Es(e);return{pos:t?o.y:o.bottom,bounds:o}};var HV=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r}=t,a=Ye(),i=ct(s.targetNode),l=NV(e,i,t,n,a),c=dC(e);zz(e);const d=()=>{if(a.isSet())return void l.show();a.set(kz.getHeader(r.outerContainer).getOrDie());const s=GC(e);XC(e)?(Nm(i,r.mothership),Nm(i,t.popupUi.mothership)):Lm(s,r.mothership),Lm(s,t.dialogUi.mothership);const d=()=>{BV(e,t,o,n),kz.setMenubar(r.outerContainer,Tz(e,o)),l.show(),((e,t,o,n)=>{const s=ye(PV(t,o.isPositionedAtTop())),r=n=>{const{pos:r,bounds:a}=PV(t,o.isPositionedAtTop()),{pos:i,bounds:l}=s.get(),c=a.height!==l.height||a.width!==l.width;s.set({pos:r,bounds:a}),c&&eM(e,n),o.isVisible()&&(i!==r?o.update(Ap.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",()=>o.update(Ap.reset)),e.on("NodeChange keydown",e=>{requestAnimationFrame(()=>r(e))});let a=0;const i=nt(()=>o.update(Ap.refresh),33);e.on("ScrollWindow",()=>{const e=kn().left;e!==a&&(a=e,i.throttle()),o.updateMode()}),XC(e)&&e.on("ElementScroll",e=>{o.update(Ap.refresh)});const l=qe();l.set(So(ct(e.getBody()),"load",e=>r(e.raw))),e.on("remove",()=>{l.clear()})})(e,i,l,c),e.nodeChanged()};c?e.once("SkinLoaded",d):d()};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()}),cD(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{lD(t,e?"setEnabled":"setDisabled")},isEnabled:()=>!op.isDisabled(r.outerContainer)};return{editorContainer:r.outerContainer.element.dom,api:u}}});const UV="contexttoolbar-hide",WV=(e,t,o)=>({setInputEnabled:t=>{!t&&o&&Oo(o),op.set(e,!t)},isInputEnabled:()=>!op.isDisabled(e),hide:()=>{Fc(e,Na())},back:()=>{Fc(e,Yz)},getValue:()=>t.get().getOrThunk(()=>ef.getValue(e)),setValue:o=>{e.getSystem().isConnected()?ef.setValue(e,o):t.set(o)}}),jV=(e,t,o)=>{const n=to(e.element).bind(t=>e.getSystem().getByDom(t).toOptional());return WV(n.getOr(e),t,o)},$V=(e,t,o)=>Uc(pF,(n,s)=>{const r=e.get(n),a=WV(r,o,n.element);t.onAction(a,s.event.buttonApi)}),GV=(e,t,o,n)=>{const s=L(t,t=>xv(((e,t,o,n)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o,n)=>{const{primary:s,...r}=t.original,a=wr(cA({...r,type:"togglebutton",onAction:b}));return jz(a,o,[$V(e,t,n)])})(e,t,o,n):((e,t,o,n)=>{const{primary:s,...r}=t.original,a=wr(aA({...r,type:"button",onAction:b}));return Wz(a,o,[$V(e,t,n)])})(e,t,o,n))(e,t,o,n)));return{asSpecs:()=>L(s,e=>e.asSpec()),findPrimary:e=>se(t,(t,o)=>t.primary?A.from(s[o]).bind(t=>t.getOpt(e)).filter(k(op.isDisabled)):A.none())}},qV=(e,t,o,n)=>{const{width:s,height:r}=e.initValue();let a=VF;const i=ze("ratio-event"),l=e=>WV(e,n),c=e=>YO(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),d=()=>!1,u=e.label.getOr("Constrain proportions"),m=t.translate(u),g=Jx.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-lock-context-form-size-input","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":m,"data-mce-name":u}},components:[c("lock"),c("unlock")],buttonBehaviours:sd([op.config({disabled:d}),Kb.config({}),fv.config(t.tooltips.getConfig({tooltipText:m}))])}),p=e=>({dom:{tag:"div",classes:["tox-context-form__group"]},components:e}),h=e=>In(e.element,"div.tox-focusable-wrapper").fold(A.none,e=>(Oo(e),A.some(!0))),f=e=>qx.parts.field({factory:sy,inputClasses:["tox-textfield","tox-toolbar-textfield","tox-textfield-size"],data:e?s:r,inputBehaviours:sd([op.config({disabled:d}),Kb.config({}),dd("size-input-toolbar-events",[Uc(ga(),(t,o)=>{Ic(t,i,{isField1:e})})]),Sm.config({mode:"special",onEnter:o,onEscape:h})]),selectOnFocus:!1}),v=e=>({dom:{tag:"label",classes:["tox-label"]},components:[_g(t.translate(e))]}),x=e=>({dom:{tag:"div",classes:["tox-focusable-wrapper","tox-toolbar-nav-item"]},components:[e],behaviours:sd([Kb.config({}),hd.config({}),Sm.config({mode:"special",onEnter:e=>Vn(e.element,"input").fold(A.none,e=>(Oo(e),A.some(!0)))})])}),y=x(Jx.parts.field1(p([qx.parts.label(v("Width:")),f(!0)]))),w=x(Jx.parts.field2(p([qx.parts.label(v("Height:")),f(!1)]))),S=ye(b),C=[tD({onBeforeSetup:e=>Vn(e.element,"input").each(Oo),onSetup:e.onSetup,getApi:l},S),nD({getApi:l},S,n)];return Jx.sketch({dom:{tag:"div",classes:["tox-context-form__group"]},components:[y,p([g]),w],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,o)=>{RF(ef.getValue(e)).each(e=>{a(e).each(e=>{ef.setValue(t,IF(e))})})},onInput:e=>Fc(e,dB),coupledFieldBehaviours:sd([hd.config({}),Sm.config({mode:"flow",focusInside:Ti.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-focusable-wrapper"}),op.config({disabled:d,onDisabled:e=>{Jx.getField1(e).bind(qx.getField).each(op.disable),Jx.getField2(e).bind(qx.getField).each(op.disable),Jx.getLock(e).each(op.disable)},onEnabled:e=>{Jx.getField1(e).bind(qx.getField).each(op.enable),Jx.getField2(e).bind(qx.getField).each(op.enable),Jx.getLock(e).each(op.enable)}}),dD(()=>t.checkUiComponentContext("mode:design")),dd("size-input-toolbar-events2",[Uc(i,(e,t)=>{const o=t.event.isField1,n=o?Jx.getField1(e):Jx.getField2(e),s=o?Jx.getField2(e):Jx.getField1(e),r=n.map(ef.getValue).getOr(""),i=s.map(ef.getValue).getOr("");a=LF(r,i)}),Uc(dB,t=>e.onInput(l(t))),...C])])})},YV=(e,t,o)=>qx.sketch({dom:{tag:"div",classes:["tox-context-form__group"]},components:[...e.toArray(),t],fieldBehaviours:sd([op.config({disabled:()=>o.checkUiComponentContext("mode:design").shouldDisable,onDisabled:e=>{(e=>{Ao(e.element).each(e=>{In(e,'[tabindex="-1"]').each(e=>{Oo(e)})})})(e),qx.getField(e).each(op.disable)},onEnabled:e=>{qx.getField(e).each(op.enable)}})])}),XV=(e,t,o,n)=>{const s=ye(b),r=e=>jV(e,n),a=e.label.map(e=>qx.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[_g(t.translate(e))]})),i=qx.parts.field({factory:sy,type:"range",inputClasses:["tox-toolbar-slider__input","tox-toolbar-nav-item"],inputAttributes:{min:String(e.min()),max:String(e.max())},data:e.initValue().toString(),fromInputValue:t=>(e=>{const t=parseFloat(e);return isNaN(t)?A.none():A.some(t)})(t).getOr(e.min()),toInputValue:e=>String(e),inputBehaviours:sd([op.config({disabled:()=>t.checkUiComponentContext("mode:design").shouldDisable}),dD(()=>t.checkUiComponentContext("mode:design")),Sm.config({mode:"special",onEnter:o,onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())}),dd("slider-events",[tD({onSetup:e.onSetup,getApi:r,onBeforeSetup:Sm.focusIn},s),nD({getApi:r},s,n),Uc(ba(),t=>{e.onInput(r(t))})])])});return YV(a,i,t)},KV=(e,t,o,n)=>{const s=ye(b),r=e=>jV(e,n),a=e.label.map(e=>qx.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[_g(t.translate(e))]})),i={...e.placeholder.map(e=>({placeholder:t.translate(e)})).getOr({})},l=qx.parts.field({factory:sy,inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-item"],inputAttributes:i,data:e.initValue(),selectOnFocus:!0,inputBehaviours:sd([op.config({disabled:()=>t.checkUiComponentContext("mode:design").shouldDisable}),dD(()=>t.checkUiComponentContext("mode:design")),Sm.config({mode:"special",onEnter:o,onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())}),dd("input-events",[tD({onSetup:e.onSetup,getApi:e=>In(e.element,".tox-toolbar").bind(e=>Vn(e,"button:enabled")).fold(()=>jV(e,n),t=>jV(e,n,t)),onBeforeSetup:Sm.focusIn},s),nD({getApi:r},s,n),Uc(ba(),t=>{e.onInput(r(t))})])])});return YV(a,l,t)},JV=(e,t,o)=>{const n=Ye(),s=xv(e(o,e=>a.findPrimary(e).orThunk(()=>i.findPrimary(e)).map(e=>(Rc(e),!0)),n)),r=P(t.commands,e=>"start"===e.align),a=GV(s,r.pass,o,n),i=GV(s,r.fail,o,n);return H([{title:A.none(),label:A.none(),items:a.asSpecs()},{title:A.none(),label:A.none(),items:[s.asSpec()]},{title:A.none(),label:A.none(),items:i.asSpecs()}],e=>e.items.length>0)},QV=(e,t)=>{switch(e.type){case"contextform":return JV(C(KV,e),e,t);case"contextsliderform":return JV(C(XV,e),e,t);case"contextsizeinputform":return JV(C(qV,e),e,t)}},ZV=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,eL=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=uo(ct(e.startContainer),e.startOffset).element;return(qt(o)?to(o):A.some(o)).filter(Gt).map(e=>e.dom.getBoundingClientRect()).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=kn();return Ts(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=As(ct(e.getBody()));return Ts(o.x+t.left,o.y+t.top,t.width,t.height)}},tL=(e,t,o,n=0)=>{const s=Cs(window),r=Es(ct(e.getContentAreaContainer())),a=VC(e)||PC(e)||UC(e),{x:i,width:l}=((e,t)=>{const o=Math.max(e.x,t.x);return{x:o,width:Math.min(e.right,t.right)-o}})(r,s);if(e.inline&&!a)return Ts(i,s.y,l,s.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,s,r)=>{const a=ct(e.getContainer()),i=Vn(a,".tox-editor-header").getOr(a),l=Es(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+r,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-r,o.bottom)};const u="line"===s?Es(a):t;return d?{y:Math.max(l.bottom+r,o.y),bottom:Math.min(u.bottom-r,o.bottom)}:{y:Math.max(u.y+r,o.y),bottom:Math.min(l.y-r,o.bottom)}})(e,r,s,a,o,n);return Ts(i,c,l,d-c)}},oL={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"]},nL={maxHeightFunction:Cc(),maxWidthFunction:kc()},sL=e=>"node"===e,rL=(e,t,o,n,s)=>{const r=eL(e),a=n.lastElement().exists(e=>wt(o,e));return((e,t)=>{const o=e.selection.getRng(),n=uo(ct(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&wt(n.element,t)})(e,o)?a?vc:gc:a?((e,o)=>{const s=rn(e,"position");en(e,"position",o);const a=ZV(r,Es(t),-20)&&!n.isReposition()?yc:vc;return s.each(t=>en(e,"position",t)),a})(t,n.getMode()):("fixed"===n.getMode()?s.y+kn().top:s.y)+(gn(t)+12)<=r.y?gc:pc},aL=(e,t,o,n)=>{const s=t=>(n,s,r,a,i)=>({...rL(e,a,t,o,i)({...n,y:i.y,height:i.height},s,r,a,i),alwaysFit:!0}),r=e=>sL(n)?[s(e)]:[];return t?{onLtr:e=>[$l,Pl,Hl,Ul,Wl,jl].concat(r(e)),onRtl:e=>[$l,Hl,Pl,Wl,Ul,jl].concat(r(e))}:{onLtr:e=>[jl,$l,Ul,Pl,Wl,Hl].concat(r(e)),onRtl:e=>[jl,$l,Wl,Hl,Ul,Pl].concat(r(e))}},iL=(e,t)=>{const o=H(t,t=>t.predicate(e.dom)),{pass:n,fail:s}=P(o,e=>"contexttoolbar"===e.type);return{contextToolbars:n,contextForms:s}},lL=(e,t)=>{const o={},n=[],s=[],r={},a={},i=re(e);return N(i,i=>{const l=e[i];"contextform"===l.type||"contextsliderform"===l.type||"contextsizeinputform"===l.type?((e,i)=>{const l=wr(yr("ContextForm",xA,i));o[e]=l,l.launch.map(o=>{r["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}}),"editor"===l.scope?s.push(l):n.push(l),a[e]=l})(i,l):"contexttoolbar"===l.type&&((e,o)=>{var i;(i=o,yr("ContextToolbar",wA,i)).each(i=>{i.launch.isSome()&&(r["toolbar:"+e]={...o.launch,type:"button",onAction:()=>{t(i)}}),"editor"===o.scope?s.push(i):n.push(i),a[e]=i})})(i,l)}),{forms:o,inNodeScope:n,inEditorScope:s,lookupTable:a,formNavigators:r}},cL="tox-pop--transition",dL=(e,t,o,n)=>{const s=n.backstage,a=s.shared,i=Pt().deviceType.isTouch,l=Ye(),c=Ye(),d=Ye(),u=(e=>{const t=ye([]),o=Zx.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),Zx.getContent(e).each(e=>{cn(e.element,"visibility")}),qn(e.element,Kz),cn(e.element,"width")},onHide:()=>{t.set([]),e.onHide()},inlineBehaviours:sd([dd("context-toolbar-events",[Xc(Sa(),(e,t)=>{"width"===t.event.raw.propertyName&&(qn(e.element,Kz),cn(e.element,"width"))}),Uc(Xz,(t,o)=>{const n=t.element;cn(n,"width");const s=bn(n),r=Ao(t.element).isSome();cn(n,"left"),cn(n,"right"),cn(n,"max-width"),Zx.setContent(t,o.event.contents),$n(n,Kz);const a=bn(n);en(n,"transition","none"),Zx.reposition(t),cn(n,"transition"),en(n,"width",s+"px"),o.event.focus.fold(()=>{r&&Gz(t)},o=>{Eo(go(t.element)).fold(()=>Oo(o),t=>{wt(t,o)||e.focusElement(o)})}),setTimeout(()=>{en(t.element,"width",a+"px")},0)}),Uc(qz,(e,o)=>{Zx.getContent(e).each(o=>{t.set(t.get().concat([{bar:o,focus:Eo(go(e.element))}]))}),Ic(e,Xz,{contents:o.event.forwardContents,focus:A.none()})}),Uc(Yz,(o,n)=>{e.onBack(),oe(t.get()).each(e=>{t.set(t.get().slice(0,t.get().length-1)),Ic(o,Xz,{contents:Mg(e.bar),focus:e.focus})})})]),Sm.config({mode:"special",onEscape:o=>oe(t.get()).fold(()=>e.onEscape(),e=>(Fc(o,Yz),A.some(!0)))})]),lazySink:()=>Ae.value(e.sink)});return{sketch:o,inSubtoolbar:()=>t.get().length>0}})({sink:o,onEscape:()=>(e.focus(),sM(e),A.some(!0)),onHide:()=>{sM(e)},onBack:()=>{(e=>{e.dispatch("ContextFormSlideBack")})(e)},focusElement:t=>{e.getBody().contains(t.dom)?e.focus():Oo(t)}}),m=Dg(u.sketch),g=()=>{const t=d.get().getOr("node"),o=sL(t)?1:0;return tL(e,a,t,o)},p=()=>!(e.removed||i()&&s.isContextMenuOpen()),h=()=>{if(p()){const t=g(),o=Pe(d.get(),"node")?((e,t)=>t.filter(e=>Xo(e)&&$t(e)).map(As).getOrThunk(()=>eL(e)))(e,l.get()):eL(e);return t.height<=0||!ZV(o,t,.01)}return!0},f=()=>{l.clear(),c.clear(),d.clear(),Zx.hide(m)},v=()=>{if(Zx.isOpen(m)){const e=m.element;cn(e,"display"),h()?en(e,"display","none"):(c.set(0),Zx.reposition(m))}},x=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:sd([Sm.config({mode:"acyclic"}),dd("pop-dialog-wrap-events",[Kc(t=>{e.shortcuts.add("ctrl+F9","focus statusbar",()=>Sm.focusIn(t))}),Jc(t=>{e.shortcuts.remove("ctrl+F9")})])])}),y=e=>{const t=S([e]);Ic(m,qz,{forwardContents:x(t)})},w=st(()=>lL(t,y)),S=t=>{const{buttons:o}=e.ui.registry.getAll(),s={...o,...w().formNavigators},i=rC(e)===HS.scrolling?HS.scrolling:HS.default,l=G(L(t,t=>{return"contexttoolbar"===t.type?((t,o)=>MV(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,A.some(["form:","toolbar:"])))(s,(o=t,{...o,launch:o.launch.getOrUndefined(),items:r(o.items)?o.items:L(o.items,SA)})):((e,t)=>QV(e,t))(t,a.providers);var o}));return tz({type:i,uid:ze("context-toolbar"),initGroups:l,onEscape:A.none,cyclicKeying:!0,providers:a.providers})},C=(t,n)=>{if(_.cancel(),!p())return;const s=S(t),r=t[0].position,u=((t,n)=>{const s="node"===t?a.anchors.node(n):a.anchors.cursor(),r=((e,t,o,n)=>"line"===t?{bubble:yl(12,0,oL),layouts:{onLtr:()=>[Gl,ql],onRtl:()=>[ql,Gl]},overrides:nL}:{bubble:yl(0,12,oL,1/12),layouts:aL(e,o,n,t),overrides:nL})(e,t,i(),{lastElement:l.get,isReposition:()=>Pe(c.get(),0),getMode:()=>sb.getMode(o)});return Le(s,r)})(r,n);d.set(r),c.set(1);const f=m.element;cn(f,"display"),(e=>Pe(Ue(e,l.get(),wt),!0))(n)||(qn(f,cL),sb.reset(o,m)),Zx.showWithinBounds(m,x(s),{anchor:u,transition:{classes:[cL],mode:"placement"}},()=>A.some(g())),n.fold(l.clear,l.set),h()&&en(f,"display","none")},k=()=>{en(m.element,"transition","none"),v(),cn(m.element,"transition")};let O=!1;const _=nt(()=>{!e.hasFocus()||e.removed||O||(Yn(m.element,cL)?_.throttle():((e,t)=>{const o=ct(t.getBody()),n=e=>wt(e,o),s=ct(t.selection.getNode());return(e=>!n(e)&&!St(o,e))(s)?A.none():((e,t,o)=>{const n=iL(e,t);if(n.contextForms.length>0)return A.some({elem:e,toolbars:[n.contextForms[0]]});{const t=iL(e,o);if(t.contextForms.length>0)return A.some({elem:e,toolbars:[t.contextForms[0]]});if(n.contextToolbars.length>0||t.contextToolbars.length>0){const o=(e=>{if(e.length<=1)return e;{const t=t=>R(e,e=>e.position===t),o=t=>H(e,e=>e.position===t),n=t("selection"),s=t("node");if(n||s){if(s&&n){const e=o("node"),t=L(o("selection"),e=>({...e,position:"node"}));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return A.some({elem:e,toolbars:o})}return A.none()}})(s,e.inNodeScope,e.inEditorScope).orThunk(()=>((e,t,o)=>e(t)?A.none():rs(t,e=>{if(Gt(e)){const{contextToolbars:t,contextForms:n}=iL(e,o.inNodeScope),s=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>j(e,e=>e.position===t);return t("selection").orThunk(()=>t("node")).orThunk(()=>t("line")).map(e=>e.position).fold(()=>[],t=>H(e,e=>e.position===t))}})(t);return s.length>0?A.some({elem:e,toolbars:s}):A.none()}return A.none()},e))(n,s,e))})(w(),e).fold(f,e=>{C(e.toolbars,A.some(e.elem))}))},17);e.on("init",()=>{e.on("remove",f),e.on("ScrollContent ScrollWindow longpress",v),e.on("ObjectResized ResizeEditor",k),e.on("click focus SetContent",_.throttle),e.on("keyup",e=>{var t;((t=e.keyCode)!==bV.ENTER&&t!==bV.SPACEBAR||!u.inSubtoolbar())&&_.throttle()}),e.on(UV,f),e.on("contexttoolbar-show",t=>{const o=w();fe(o.lookupTable,t.toolbarKey).each(o=>{C([o],je(t.target!==e,t.target)),Gz(m)})}),e.on("focusout",t=>{VS.setEditorTimeout(e,()=>{Ao(o.element).isNone()&&Ao(m.element).isNone()&&!e.hasFocus()&&f()},0)}),e.on("SwitchMode",()=>{e.mode.isReadOnly()&&f()}),e.on("DisabledStateChange",e=>{e.state&&f()}),e.on("ExecCommand",({command:e})=>{"toggleview"===e.toLowerCase()&&f()}),e.on("AfterProgressState",t=>{t.state?f():e.hasFocus()&&_.throttle()}),e.on("dragstart",()=>{O=!0}),e.on("dragend drop",()=>{O=!1}),e.on("NodeChange",e=>{u.inSubtoolbar()?k():Ao(m.element).fold(_.throttle,b)})})},uL=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),s=Ye();return L(o,o=>({type:"togglemenuitem",text:t.display(o),onSetup:r=>{const a=e=>{e&&(s.on(e=>e.setActive(!1)),s.set(r)),r.setActive(e)};a(Pe(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{s.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})},mL=e=>{uL(e,(e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:NC,hash:e=>(e=>ws(e,["fixed","relative","empty"]).map(({value:e,unit:t})=>e+t))(e).getOr(e),display:w,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>A.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:aM(e),onMenuSetup:aM(e)}))(e)),(e=>A.from(nC(e)).map(t=>({name:"language",text:"Language",icon:"language",getOptions:y(t),hash:e=>u(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:t.customCode??null}).unbind,getCurrent:e=>{const t=ct(e.selection.getNode());return as(t,e=>A.some(e).filter(Gt).bind(e=>No(e,"lang").map(t=>({code:t,customCode:No(e,"data-mce-lang").getOrUndefined(),title:""}))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=qe();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),rM(o.clear,aM(e)(t))},onMenuSetup:aM(e)})))(e).each(t=>uL(e,t))},gL=e=>lM(e,"NodeChange",t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())}),pL=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),rM(()=>e.off("PastePlainTextToggle",n),aM(e)(o))},hL=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},fL=e=>{(e=>{(e=>{WB.each([{name:"bold",text:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",icon:"underline",shortcut:"Meta+U"},{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:iM(e,t.name),onAction:hL(e,t.name),shortcut:t.shortcut})});for(let t=1;t<=6;t++){const o="h"+t,n=`Access+${t}`;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:iM(e,o),onAction:hL(e,o),shortcut:n})}})(e),(e=>{WB.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy",context:"any"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0",context:"any"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A",context:"any"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P",context:"any"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:dM(e,t.action),shortcut:t.shortcut,context:t.context})}),WB.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:aM(e),onAction:dM(e,t.action)})})})(e),(e=>{WB.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:dM(e,t.action),onSetup:iM(e,t.name)})})})(e)})(e),(e=>{WB.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C",context:"any"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A",context:"any"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P",context:"any"}],t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:dM(e,t.action),context:t.context})}),WB.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:aM(e),onAction:dM(e,t.action)})}),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:aM(e),onAction:hL(e,"code")})})(e)},bL=(e,t)=>lM(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())}),vL=e=>lM(e,"VisualAid",t=>{t.setActive(e.hasVisual)}),xL=(e,t)=>{(e=>{N([{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"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:dM(e,t.cmd),onSetup:iM(e,t.name)})}),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:aM(e),onAction:dM(e,"JustifyNone")})})(e),fL(e),((e,t)=>{((e,t)=>{const o=Zz(t,aV(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:aM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=Zz(t,fV(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:aM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=Zz(t,_V(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:aM(e,()=>n.getStyleItems().length>0),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=Zz(t,dV(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:aM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=Zz(t,kV(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:aM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)})(e,t),(e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:bL(e,"hasUndo"),onAction:dM(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:bL(e,"hasRedo"),onAction:dM(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:bL(e,"hasUndo"),onAction:dM(e,"undo"),shortcut:"Meta+Z"}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:bL(e,"hasRedo"),onAction:dM(e,"redo"),shortcut:"Meta+Y"})})(e)})(e),(e=>{(e=>{e.addCommand("mceApplyTextcolor",(t,o)=>{((e,t,o)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.apply(t,{value:o}),e.nodeChanged()})})(e,t,o)}),e.addCommand("mceRemoveTextcolor",t=>{((e,t)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.remove(t,{value:null},void 0,!0),e.nodeChanged()})})(e,t)})})(e);const t=OM(e),o=_M(e),n=ye(t),s=ye(o);zM(e,"forecolor","forecolor",n),zM(e,"backcolor","hilitecolor",s),VM(e,"forecolor","forecolor","Text color",n),VM(e,"backcolor","hilitecolor","Background color",s)})(e),(e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:dM(e,"mceToggleVisualAid"),context:"any"})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:vL(e),onAction:dM(e,"mceToggleVisualAid"),context:"any"})})(e)})(e),(e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:gL(e),onAction:dM(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:aM(e,()=>e.queryCommandState("indent")),onAction:dM(e,"indent")})})(e)})(e),mL(e),(e=>{const t=ye(_C(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:pL(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:pL(e,t)})})(e),(e=>{e.ui.registry.addContext("editable",()=>e.selection.isEditable()),e.ui.registry.addContext("mode",t=>e.mode.get()===t),e.ui.registry.addContext("any",E),e.ui.registry.addContext("formatting",t=>e.formatter.canApply(t)),e.ui.registry.addContext("insert",t=>e.schema.isValidChild(e.selection.getNode().tagName,t))})(e)},yL=e=>r(e)?e.split(/[ ,]/):e,wL=e=>t=>t.options.get(e),SL=wL("contextmenu_never_use_native"),CL=wL("contextmenu_avoid_overlap"),kL=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:H(o,e=>be(t,e))},OL=(e,t)=>({type:"makeshift",x:e,y:t}),_L=e=>"longpress"===e.type||0===e.type.indexOf("touch"),TL=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(_L(e)){const t=e.touches[0];return OL(t.pageX,t.pageY)}return OL(e.pageX,e.pageY)})(t):((e,t)=>{const o=LS.DOM.getPos(e);return((e,t,o)=>OL(e.x+t,e.y+o))(t,o.x,o.y)})(e.getContentAreaContainer(),(e=>{if(_L(e)){const t=e.touches[0];return OL(t.clientX,t.clientY)}return OL(e.clientX,e.clientY)})(t)):EL(e),EL=e=>({type:"selection",root:ct(e.selection.getNode())}),AL=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:A.some(ct(e.selection.getNode())),root:ct(e.getBody())}))(e);case"point":return TL(e,t);case"selection":return EL(e)}},DL=(e,t,o,n,s,r)=>{const a=o(),i=AL(e,t,r);AF(a,ZO.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:A.none()}).map(e=>{t.preventDefault(),Zx.showMenuAt(s,{anchor:i},{menu:{markers:p_("normal")},data:e})})},ML={onLtr:()=>[$l,Pl,Hl,Ul,Wl,jl,gc,pc,mc,dc,uc,cc],onRtl:()=>[$l,Hl,Pl,Wl,Ul,jl,gc,pc,uc,cc,mc,dc]},BL={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"]},FL=(e,t,o,n,s,r)=>{const a=Pt(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),u=()=>{const a=o();((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>{const n=AL(e,t,o);return{bubble:yl(0,"point"===o?12:0,BL),layouts:ML,overrides:{maxWidthFunction:kc(),maxHeightFunction:Cc()},...n}})(e,t,r);AF(o,ZO.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:A.none()}).map(o=>{t.preventDefault();const l=a?Ec.HighlightMenuAndItem:Ec.HighlightNone;Zx.showMenuWithinBounds(s,{anchor:i},{menu:{markers:p_("normal"),highlightOnOpen:l},data:o,type:"horizontal"},()=>A.some(tL(e,n.shared,"node"===r?"node":"selection"))),e.dispatch(UV)})})(e,t,a,n,s,r,!(c||i||l&&d))};if((l||i)&&"node"!==r){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{VS.setEditorTimeout(e,()=>{e.selection.setRng(t)},10),r()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const s=()=>r();e.once("longpresscancel",s);const r=()=>{e.off("touchend",o),e.off("longpresscancel",s),e.off("mousedown",n)}})(e),u()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],s=o.getRng();return vs(e.getWin(),us.domRange(s)).exists(e=>e.left<=n.clientX&&e.right>=n.clientX&&e.top<=n.clientY&&e.bottom>=n.clientY)}})(e,t)?o():(e.once("selectionchange",o),e.once("touchend",()=>e.off("selectionchange",o)))}else u()},IL=e=>r(e)?"|"===e:"separator"===e.type,RL={type:"separator"},zL=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(r(e))return e;switch(e.type){case"separator":return RL;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return r(t)?t:L(t,zL)}};default:const o=e;return{type:"menuitem",...t(o),onAction:v(o.onAction)}}},VL=(e,t)=>{if(0===t.length)return e;const o=oe(e).filter(e=>!IL(e)).fold(()=>[],e=>[RL]);return e.concat(o).concat(t).concat([RL])},LL=(e,t)=>!(e=>"longpress"===e.type||be(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),NL=(e,t)=>LL(e,t)?e.selection.getStart(!0):t.target,PL=(e,t,o)=>{const n=Pt().deviceType.isTouch,s=Dg(Zx.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:sd([dd("dismissContextMenu",[Uc(Ya(),(t,o)=>{_b.close(t),e.focus()})])])})),a=()=>Zx.hide(s),i=t=>{if(SL(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!SL(e))(e,t)||(e=>0===kL(e).length)(e))return;const a=((e,t)=>{const o=CL(e),n=LL(e,t)?"selection":"point";if(tt(o)){const s=NL(e,t);return ns(ct(s),o)?"node":n}return n})(e,t);(n()?FL:DL)(e,t,()=>{const o=NL(e,t),n=e.ui.registry.getAll(),s=kL(e);return((e,t,o)=>{const n=W(t,(t,n)=>fe(e,n.toLowerCase()).map(e=>{const n=e.update(o);if(r(n)&&tt(et(n)))return VL(t,n.split(" "));if(l(n)&&n.length>0){const e=L(n,zL);return VL(t,e)}return t}).getOrThunk(()=>t.concat([n])),[]);return n.length>0&&IL(n[n.length-1])&&n.pop(),n})(n.contextMenus,s,o)},o,s,a)};e.on("init",()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)})},HL=(e,t,o,n,s,r)=>e.fold(()=>Bh.snap({sensor:Pp(o-20,n-20),range:yn(s,r),output:Pp(A.some(o),A.some(n)),extra:{td:t}}),e=>{const s=o-20,r=n-20,a=e.element.dom.getBoundingClientRect();return Bh.snap({sensor:Pp(s,r),range:yn(40,40),output:Pp(A.some(o-a.width/2),A.some(n-a.height/2)),extra:{td:t}})}),UL=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const s=n.td;((e,t)=>e.exists(e=>wt(e,t)))(t.get(),s)||(t.set(s),o(s))},mustSnap:!0}),WL=e=>xv(Bv.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:sd([Bh.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),bv.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),jL=(e,t)=>{const o=ye([]),n=ye([]),s=ye(!1),r=Ye(),a=Ye(),i=e=>{const o=As(e);return HL(u.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=As(e);return HL(m.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=UL(()=>L(o.get(),e=>i(e)),r,t=>{a.get().each(o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})})}),d=UL(()=>L(n.get(),e=>l(e)),a,t=>{r.get().each(o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})})}),u=WL(c),m=WL(d),g=Dg(u.asSpec()),p=Dg(m.asSpec()),h=(t,o,n,s)=>{const r=n(o);Bh.snapTo(t,r),((t,o)=>{const n=o.dom.getBoundingClientRect();cn(t.element,"display");const r=eo(ct(e.getBody())).dom.innerHeight,a=n[s]<0,i=((e,t)=>e[s]>t)(n,r);(a||i)&&en(t.element,"display","none")})(t,o)},f=e=>h(g,e,i,"top"),b=e=>h(p,e,l,"bottom");if(Pt().deviceType.isTouch()){const i=e=>L(e,ct);e.on("TableSelectionChange",e=>{s.get()||(Fm(t,g),Fm(t,p),s.set(!0));const l=ct(e.start),c=ct(e.finish);r.set(l),a.set(c),A.from(e.otherCells).each(e=>{o.set(i(e.upOrLeftCells)),n.set(i(e.downOrRightCells)),f(l),b(c)})}),e.on("ResizeEditor ResizeWindow ScrollContent",()=>{r.get().each(f),a.get().each(b)}),e.on("TableSelectionClear",()=>{s.get()&&(zm(g),zm(p),s.set(!1)),r.clear(),a.clear()})}},$L=e=>"BR"===e.nodeName||!!e.getAttribute("data-mce-bogus")||"bookmark"===e.getAttribute("data-mce-type"),GL=(e,t,o)=>{const n=t.delimiter??"\u203a",s=()=>""!==e.queryCommandValue("ToggleView"),r=()=>o.isDisabled()||s(),a=()=>{const e=o.checkUiComponentContext("any");return{contextType:e.contextType,shouldDisable:e.shouldDisable||s()}};return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"group","aria-label":o.translate("Element Path")}},behaviours:sd([Sm.config({mode:"flow",selector:"div[role=button]"}),op.config({disabled:r}),dD(a),Kb.config({}),eg.config({}),dd("elementPathEvents",[Kc((t,s)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",()=>Sm.focusIn(t)),e.on("NodeChange",s=>{const i=(t=>{const o=[];let n=t.length;for(;n-- >0;){const s=t[n];if(1===s.nodeType&&!$L(s)){const t=oM(e,s);if(t.isDefaultPrevented()||o.push({name:t.name,element:s}),t.isPropagationStopped())break}}return o})(s.parents),l=i.length>0?W(i,(t,s,i)=>{const l=((t,n,s)=>Bv.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":s}},components:[_g(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:sd([fv.config({...o.tooltips.getConfig({tooltipText:o.translate(["Select the {0} element",n.nodeName.toLowerCase()]),onShow:(e,t)=>{Rs(e.element,t.element)},onHide:e=>{var t;t=e.element,Ho(t,"aria-describedby")}})}),QA(r),dD(a)])}))(s.name,s.element,i);return 0===i?t.concat([l]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[_g(` ${n} `)]},l])},[]):[];eg.set(t,l)}),e.on("ToggleView",()=>{const e=r();op.set(t,e),N(eg.contents(t),t=>{t.hasConfigured(op)&&op.set(t,e)})})})])]),components:[]}};var qL;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(qL||(qL={}));const YL=e=>{const t=ct(e.getContainer());return{height:gn(t),width:bn(t)}},XL=(e,t,o)=>{const n=ct(e.getContainer()),s=((e,t,o,n)=>{const s=FR(n.height+t.top,JS(e),ZS(e));return o===qL.Both?{height:s,width:FR(n.width+t.left,KS(e),QS(e))}:{height:s}})(e,t,o,YL(e));return ie(s,(e,t)=>{h(e)&&en(n,t,BR(e))}),(e=>{e.dispatch("ResizeEditor")})(e),s},KL=(e,t,o,n,s)=>{zo(e.element,"aria-valuetext",((e,t)=>t===qL.Both?NO.translate(["Editor's height: {0} pixels, Editor's width: {1} pixels",e.height,e.width]):NO.translate(["Editor's height: {0} pixels",e.height]))(t,o)),o===qL.Vertical&&(zo(e.element,"aria-valuenow",t.height),zo(e.element,"aria-valuemin",n.getOr(0)),zo(e.element,"aria-valuemax",s.getOr(t.height+20)))},JL=(e,t,o,n,s,r,a)=>{const i=yn(20*n,20*s),l=XL(e,i,o);return KL(t,l,o,r,a),A.some(!0)},QL=(e,t)=>{const o=()=>{const o=[],n=FC(e),s=CC(e),r=kC(e)||e.hasPlugin("wordcount");return s&&o.push(GL(e,{},t)),n&&o.push((()=>{const e=bD("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[_g(NO.translate(["Press {0} for help",e]))]}})()),r&&o.push((()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>eg.set(e,[_g(t.translate(["{0} "+n,o[n]]))]);return Bv.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:sd([QA(t.isDisabled),dD(()=>t.checkUiComponentContext("any")),Kb.config({}),eg.config({}),ef.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),dd("wordcount-events",[Zc(e=>{const t=ef.getValue(e),n="words"===t.mode?"characters":"words";ef.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)}),Kc(t=>{e.on("wordCountUpdate",e=>{const{mode:n}=ef.getValue(t);ef.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)})})])]),eventOrder:{[Ra()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),kC(e)&&o.push({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=v7",rel:"noopener",target:"_blank","aria-label":e.translate(["Build with {0}","TinyMCE"])},innerHtml:e.translate(["Build with {0}",'<svg height="16" viewBox="0 0 80 16" width="80" xmlns="http://www.w3.org/2000/svg"><g opacity=".8"><path d="m80 3.537v-2.202h-7.976v11.585h7.976v-2.25h-5.474v-2.621h4.812v-2.069h-4.812v-2.443zm-10.647 6.929c-.493.217-1.13.337-1.864.337s-1.276-.156-1.805-.47a3.732 3.732 0 0 1 -1.3-1.298c-.324-.554-.48-1.191-.48-1.877s.156-1.335.48-1.877a3.635 3.635 0 0 1 1.3-1.299 3.466 3.466 0 0 1 1.805-.481c.65 0 .914.06 1.263.18.36.12.698.277.986.47.289.192.578.384.842.6l.12.085v-2.586l-.023-.024c-.385-.35-.855-.614-1.384-.818-.53-.205-1.155-.313-1.877-.313-.721 0-1.6.144-2.333.445a5.773 5.773 0 0 0 -1.937 1.251 5.929 5.929 0 0 0 -1.324 1.9c-.324.735-.48 1.565-.48 2.455s.156 1.72.48 2.454c.325.734.758 1.383 1.324 1.913.553.53 1.215.938 1.937 1.25a6.286 6.286 0 0 0 2.333.434c.819 0 1.384-.108 1.961-.313.59-.216 1.083-.505 1.468-.866l.024-.024v-2.49l-.12.096c-.41.337-.878.626-1.396.866zm-14.869-4.15-4.8-5.04-.024-.025h-.902v11.67h2.502v-6.847l2.827 3.08.385.409.397-.41 2.791-3.067v6.845h2.502v-11.679h-.902l-4.788 5.052z"/><path clip-rule="evenodd" d="m15.543 5.137c0-3.032-2.466-5.113-4.957-5.137-.36 0-.745.024-1.094.096-.157.024-3.85.758-3.85.758-3.032.602-4.62 2.466-4.704 4.788-.024.89-.024 4.27-.024 4.27.036 3.165 2.406 5.138 5.017 5.126.337 0 1.119-.109 1.287-.145.144-.024.385-.084.746-.144.661-.12 1.684-.325 3.067-.602 2.37-.409 4.103-2.009 4.44-4.33.156-1.023.084-4.692.084-4.692zm-3.213 3.308-2.346.457v2.31l-5.859 1.143v-5.75l2.346-.458v3.441l3.513-.686v-3.44l-3.513.685v-2.297l5.859-1.143v5.75zm20.09-3.296-.083-1.023h-2.13v8.794h2.346v-4.884c0-1.107.95-1.985 2.057-1.997 1.095 0 1.901.89 1.901 1.997v4.884h2.346v-5.245c-.012-2.105-1.588-3.777-3.67-3.765a3.764 3.764 0 0 0 -2.778 1.25l.012-.011zm-6.014-4.102 2.346-.458v2.298l-2.346.457z" fill-rule="evenodd"/><path d="m28.752 4.126h-2.346v8.794h2.346z"/><path clip-rule="evenodd" d="m43.777 15.483 4.043-11.357h-2.418l-1.54 4.355-.445 1.324-.36-1.324-1.54-4.355h-2.418l3.151 8.794-1.083 3.08zm-21.028-5.51c0 .722.541 1.034.878 1.034s.638-.048.95-.144l.518 1.708c-.217.145-.879.518-2.13.518a2.565 2.565 0 0 1 -2.562-2.587c-.024-1.082-.024-2.49 0-4.21h-1.54v-2.142h1.54v-1.912l2.346-.458v2.37h2.201v2.142h-2.2v3.693-.012z" fill-rule="evenodd"/></g></svg>\n'.trim()])},behaviours:sd([hd.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}})()),o.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...(()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(n){const o="tox-statusbar__text-container-3-cols";return r||s?r&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[r&&!s?t:e]})()]},components:o}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const n=o(),s=((e,t)=>{const o=(e=>{const t=OC(e);return!1===t?qL.None:"both"===t?qL.Both:qL.Vertical})(e);if(o===qL.None)return A.none();const n=JS(e),s=ZS(e),r=o===qL.Both?NO.translate("Press the arrow keys to resize the editor."):NO.translate("Press the Up and Down arrow keys to resize the editor."),a=o===qL.Both?"tox-statusbar__resize-cursor-both":"tox-statusbar__resize-cursor-default";return A.some(YO("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle",a],attributes:{"aria-label":t.translate(r),"data-mce-name":"resize-handle",role:"separator"},behaviours:[Bh.config({mode:"pointer",repositionTarget:!1,onDragStart:e=>{fv.immediateOpenClose(e,!1),fv.setEnabled(e,!1)},onDrag:(t,r,a)=>{const i=XL(e,a,o);KL(t,i,o,n,s)},onDrop:e=>{fv.setEnabled(e,!0)}}),Sm.config({mode:"special",onLeft:t=>JL(e,t,o,-1,0,n,s),onRight:t=>JL(e,t,o,1,0,n,s),onUp:t=>JL(e,t,o,0,-1,n,s),onDown:t=>JL(e,t,o,0,1,n,s)}),Kb.config({}),hd.config({}),fv.config(t.tooltips.getConfig({tooltipText:t.translate("Resize")})),dd("set-aria-valuetext",[Kc(t=>{const r=()=>{KL(t,YL(e),o,n,s)};e._skinLoaded?r():e.once("SkinLoaded",r)})])],eventOrder:{[Ga()]:["add-focusable","set-aria-valuetext"]}},t.icons))})(e,t);return n.concat(s.toArray())})()}},ZL=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),eN=(e,t)=>{const o=e.inline,n=o?HV:RV,s=YC(e)?AR:xR,r=(()=>{const e=Ye(),t=Ye(),o=Ye();return{dialogUi:e,popupUi:t,mainUi:o,getUiMotherships:()=>{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=>wt(e.element,t.element)?[e]:[e,t]))},lazyGetInOuterOrDie:(e,t)=>()=>o.get().bind(e=>t(e.outerContainer)).getOrDie(`Could not find ${e} element in OuterContainer`)}})(),a=Ye(),i=Ye(),l=Ye(),c=Pt().deviceType.isTouch()?["tox-platform-touch"]:[],d=WC(e),u=rC(e),m=xv({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=xv({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),p=()=>r.mainUi.get().map(e=>e.outerContainer).bind(kz.getHeader),h=r.lazyGetInOuterOrDie("anchor bar",m.getOpt),f=r.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),b=r.lazyGetInOuterOrDie("toolbar",kz.getToolbar),v=r.lazyGetInOuterOrDie("throbber",kz.getThrobber),x=((e,t,o,n)=>{const s=ye(!1),r=(e=>{const t=ye(WC(e)?"bottom":"top");return{isPositionedAtTop:()=>"top"===t.get(),getDockingMode:t.get,setDockingMode:t.set}})(t),a={icons:()=>t.ui.registry.getAll().icons,menuItems:()=>t.ui.registry.getAll().menuItems,translate:NO.translate,isDisabled:()=>!t.ui.isEnabled(),getOption:t.options.get,tooltips:UI(e.dialog),checkUiComponentContext:e=>{if(qS(t))return{contextType:"disabled",shouldDisable:!0};const[o,n=""]=e.split(":"),s=t.ui.registry.getAll().contexts;return{contextType:o,shouldDisable:!fe(s,o).fold(()=>fe(s,"mode").map(e=>e("design")).getOr(!1),e=>"!"===n.charAt(0)?!e(n.slice(1)):e(n))}}},i=gR(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},n=ye([]),s=ye([]),r=ye(!1);return e.on("PreInit",s=>{const r=NI(e),a=HI(e,r,t,o);n.set(a)}),e.on("addStyleModifications",n=>{const a=HI(e,n.items,t,o);s.set(a),r.set(n.replace)}),{getData:()=>{const e=r.get()?[]:n.get(),t=s.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:DI(e),hasCustomColors:MI(e),getColors:BI(e),getColorCols:FI(e)}))(t),d=(e=>({isDraggableModal:II(e)}))(t),u={shared:{providers:a,anchors:AI(t,o,n,r.isPositionedAtTop),header:r},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>s.get(),setContextMenuState:e=>s.set(e)},m=e=>A.none(),g={...u,shared:{...u.shared,interpreter:e=>SI(e,{},g,m),getSink:e.popup}},p={...u,shared:{...u.shared,interpreter:e=>SI(e,{},p,m),getSink:e.dialog}};return{popup:g,dialog:p}})({popup:()=>Ae.fromOption(r.popupUi.get().map(e=>e.sink),"(popup) UI has not been rendered"),dialog:()=>Ae.fromOption(r.dialogUi.get().map(e=>e.sink),"UI has not been rendered")},e,h,f),y=()=>{const t=(()=>{const t={attributes:{[_c]:d?Oc.BottomToTop:Oc.TopToBottom}},o=kz.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:x.popup,onEscape:()=>{e.focus()}}),n=kz.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:x.popup.shared.getSink,providers:x.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:u,lazyToolbar:b,lazyHeader:()=>p().getOrDie("Could not find header element"),...t}),s=kz.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:x.popup.shared.providers,onEscape:()=>{e.focus()},type:u}),r=UC(e),a=PC(e),i=VC(e),l=BC(e),c=r||a||i,g=[(h=l,kz.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]},promotionLink:h})),o];var h;return kz.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(c?[]:["tox-editor-header--empty"]),...t},components:G([i?g:[],r?[s]:a?[n]:[],$C(e)?[]:[m.asSpec()]]),sticky:YC(e),editor:e,sharedBackstage:x.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[kz.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),kz.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]},configuredSidebarWidth:EC(e)})],behaviours:KA([Uc(GR,(e,t)=>{(t.event.visible&&t.event.resizable?$n:qn)(e.element,"tox-sidebar-wrap--resizable")})])},s=kz.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:x.popup}),r=kz.parts.viewWrapper({backstage:x.popup}),i=SC(e)&&!o?A.some(QL(e,x.popup.shared.providers)):A.none(),l=G([d?[]:[t],o?[]:[n],d?[t]:[]]),h=kz.parts.editorContainer({components:G([l,o?[]:[g.asSpec()]])}),f=qC(e),v={role:"application",...NO.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},y=Dg(kz.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(o?["tox-tinymce-inline"]:[]).concat(d?["tox-tinymce--toolbar-bottom"]:[]).concat(c),styles:{visibility:"hidden",...f?{opacity:"0",border:"0"}:{}},attributes:v},components:[h,...o?[]:[r,...i.toArray()],s],behaviours:sd([dD(()=>x.popup.shared.providers.checkUiComponentContext("any")),op.config({disableClass:"tox-tinymce--disabled"}),Sm.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"})])})),w=Av(y);return a.set(w),{mothership:w,outerContainer:y}},w=t=>{const o=BR((e=>(e=>{const t=((e,t)=>{if("number"==typeof t)return A.from(t);const o=/^([0-9.]+)(pt|em|px)$/.exec(t.trim());if(o){const t=o[2],n=Number.parseFloat(o[1]);if(Number.isNaN(n)||n<0)return A.none();if("em"===t)return A.from(n*Number.parseFloat(window.getComputedStyle(e.dom).fontSize));if("pt"===t)return A.from(.75*n);if("px"===t)return A.from(n)}return A.none()})(ct(e.targetElm),YS(e)),o=JS(e),n=ZS(e);return t.map(e=>FR(e,o,n))})(e).getOr(YS(e)))(e)),n=BR((e=>zV(e).getOr(XS(e)))(e));return e.inline||(ln("div","width",n)&&en(t.element,"width",n),ln("div","height",o)?en(t.element,"height",o):en(t.element,"height","400px")),o},S=t=>{const{mainUi:o,popupUi:r,uiMotherships:a}=t;le(aC(e),(t,o)=>{e.ui.registry.addGroupToolbarButton(o,t)});const{buttons:i,menuItems:l,contextToolbars:c,sidebars:d,views:m}=e.ui.registry.getAll(),g=HC(e),h={menuItems:l,menus:KC(e),menubar:mC(e),toolbar:g.getOrThunk(()=>gC(e)),allowToolbarGroups:u===HS.floating,buttons:i,sidebar:d,views:m};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",()=>{kz.focusMenubar(f)}),e.addShortcut("alt+F10","focus toolbar",()=>{kz.focusToolbar(f)}),e.addCommand("ToggleToolbarDrawer",(e,t,o)=>{t?.skipFocus?(console.warn(pR.skipFocus,(new Error).stack),kz.toggleToolbarDrawerWithoutFocusing(f)):o?.skip_focus?kz.toggleToolbarDrawerWithoutFocusing(f):kz.toggleToolbarDrawer(f)}),e.addQueryStateHandler("ToggleToolbarDrawer",()=>kz.isToolbarDrawerToggled(f)),e.on("blur",()=>{rC(e)===HS.floating&&kz.isToolbarDrawerToggled(f)&&kz.toggleToolbarDrawerWithoutFocusing(f)}),((e,t,o)=>{const n=(e,n)=>{N([t,...o],t=>{t.broadcastEvent(e,n)})},s=(e,n)=>{N([t,...o],t=>{t.broadcastOn([e],n)})},r=e=>s(_d(),{target:e.target}),a=e=>{s(Od(),{closedTooltip:()=>{e.preventDefault()}})},i=ko(),l=wo(i,"touchstart",r),c=wo(i,"touchmove",e=>n(Ua(),e)),d=wo(i,"touchend",e=>n(Wa(),e)),u=wo(i,"mousedown",r),m=wo(i,"mouseup",e=>{0===e.raw.button&&s(Ed(),{target:e.target})}),g=e=>s(_d(),{target:ct(e.target)}),p=e=>{0===e.button&&s(Ed(),{target:ct(e.target)})},h=()=>{N(e.editorManager.get(),t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})})},f=e=>n(ja(),Co(e)),b=e=>{s(Td(),{}),n($a(),Co(e))},v=go(ct(e.getElement())),x=So(v,"scroll",o=>{requestAnimationFrame(()=>{if(null!=e.getContainer()){const s=ok(e,t.element).map(e=>[e.element,...e.others]).getOr([]);R(s,e=>wt(e,o.target))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Qa(),o))}})}),y=()=>s(Td(),{}),w=t=>{t.state&&s(_d(),{target:ct(e.getContainer())})},S=e=>{s(_d(),{target:ct(e.relatedTarget.getContainer())})},C=t=>e.dispatch("focusin",t),k=t=>e.dispatch("focusout",t);e.on("PostRender",()=>{e.on("click",g),e.on("tap",g),e.on("mouseup",p),e.on("mousedown",h),e.on("ScrollWindow",f),e.on("ResizeWindow",b),e.on("ResizeEditor",y),e.on("AfterProgressState",w),e.on("DismissPopups",S),e.on("CloseActiveTooltips",a),N([t,...o],e=>{e.element.dom.addEventListener("focusin",C),e.element.dom.addEventListener("focusout",k)})}),e.on("remove",()=>{e.off("click",g),e.off("tap",g),e.off("mouseup",p),e.off("mousedown",h),e.off("ScrollWindow",f),e.off("ResizeWindow",b),e.off("ResizeEditor",y),e.off("AfterProgressState",w),e.off("DismissPopups",S),e.off("CloseActiveTooltips",a),N([t,...o],e=>{e.element.dom.removeEventListener("focusin",C),e.element.dom.removeEventListener("focusout",k)}),u.unbind(),l.unbind(),c.unbind(),d.unbind(),m.unbind(),x.unbind()}),e.on("detach",()=>{N([t,...o],Hm),N([t,...o],e=>e.destroy())})})(e,o.mothership,a),s.setup(e,x.popup.shared,p),xL(e,x.popup),PL(e,x.popup.shared.getSink,x.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();N(re(t),o=>{const n=t[o],s=()=>Pe(A.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o,{skip_focus:!0}),t.setActive(s())},onSetup:t=>{t.setActive(s());const o=()=>t.setActive(s());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}},context:"any"})})})(e),YR(e,v,x.popup.shared),dL(e,c,r.sink,{backstage:x.popup}),jL(e,r.sink);const b={targetNode:e.getElement(),height:w(o.outerContainer)};return n.render(e,t,h,x.popup,b)};return{popups:{backstage:x.popup,getMothership:()=>ZL("popups",l)},dialogs:{backstage:x.dialog,getMothership:()=>ZL("dialogs",i)},renderUI:()=>{const o=y(),n=(()=>{const t=GC(e),o=wt(Ko(),t)&&"grid"===nn(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...NO.isRtl()?{dir:"rtl"}:{}}},behaviours:sd([sb.config({useFixed:()=>s.isDocked(p),getBounds:()=>r.dialogUi.get().bind(({sink:e})=>{const t=go(e.element);return mo(t)?A.some(Es(fo(t))):A.none()}).getOr(Ms())})])},a={dom:{styles:{width:document.body.clientWidth+"px"}},events:Nc([Uc($a(),e=>{en(e.element,"width",document.body.clientWidth+"px")})])},l=Dg(Le(n,o?a:{})),d=Av(l);return i.set(d),{sink:l,mothership:d}})(),a=XC(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...NO.isRtl()?{dir:"rtl"}:{}}},behaviours:sd([sb.config({useFixed:()=>s.isDocked(p),getBounds:()=>t.getPopupSinkBounds()})])},o=Dg(e),n=Av(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(n);r.dialogUi.set(n),r.popupUi.set(a),r.mainUi.set(o);const d={popupUi:a,dialogUi:n,mainUi:o,uiMotherships:r.getUiMotherships()};return S(d)}}},tN=e=>{const t=[],o={};return ie(e,(e,n)=>{e.fold(()=>{t.push(n)},e=>{o[n]=e})}),t.length>0?Ae.error(t):Ae.value(o)},oN=(e,t,o,n)=>{const s=xv(Ix.sketch(s=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:L(e.items,e=>yI(s,e,t,o,n))})));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[s.asSpec()]}],behaviours:sd([Sm.config({mode:"acyclic",useTabstopAt:k(QB)}),(r=s,Lg.config({find:r.getOpt})),_B(s,{postprocess:e=>tN(e).fold(e=>(console.error(e),{}),w)}),dd("dialog-body-panel",[Uc(ga(),(e,t)=>{e.getSystem().broadcastOn([sF],{newFocus:A.some(t.event.target)})})])])};var r},nN=(e,t)=>{en(e,"height",t+"px"),en(e,"flex-basis",t+"px")},sN=(e,t,o)=>{In(e,'[role="dialog"]').each(e=>{Vn(e,'[role="tablist"]').each(n=>{o.get().map(o=>(en(t,"height","0"),en(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=Zt(e).dom,s=In(e,".tox-dialog-wrap").getOr(e);let r;r="fixed"===nn(s,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=gn(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+bn(o)?Math.max(gn(o),a):a,l=parseInt(nn(e,"margin-top"),10)||0,c=parseInt(nn(e,"margin-bottom"),10)||0;return r-(gn(e)+l+c-i)})(e,t,n)))).each(e=>{nN(t,e)})})})},rN=e=>Vn(e,'[role="tabpanel"]'),aN="send-data-to-section",iN="send-data-to-view",lN=(e,t,o,n)=>{const s=ye({}),r=e=>{const t=ef.getValue(e),o=tN(t).getOr({}),n=s.get(),r=Le(n,o);s.set(r)},a=e=>{const t=s.get();ef.setValue(e,t)},i=ye(null),l=L(e.tabs,e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[_g(o.shared.providers.translate(e.title))],view:()=>[Ix.sketch(s=>({dom:{tag:"div",classes:["tox-form"]},components:L(e.items,e=>yI(s,e,t,o,n)),formBehaviours:sd([Sm.config({mode:"acyclic",useTabstopAt:k(QB)}),dd("TabView.form.events",[Kc(a),Jc(r)]),ib.config({channels:oa([{key:aN,value:{onReceive:r}},{key:iN,value:{onReceive:a}}])})])}))]})),c=e.dynamicHeight?{extraEvents:[],selectFirst:!0}:(e=>{const t=Ye(),o=[Kc(o=>{const n=o.element;rN(n).each(s=>{en(s,"visibility","hidden"),o.getSystem().getByDom(s).toOptional().each(o=>{const n=((e,t,o)=>L(e,(n,s)=>{eg.set(o,e[s].view());const r=t.dom.getBoundingClientRect();return eg.set(o,[]),r.height}))(e,s,o),r=(e=>te(Z(e,(e,t)=>e>t?-1:e<t?1:0)))(n);r.fold(t.clear,t.set)}),sN(n,s,t),cn(s,"visibility"),((e,t)=>{te(e).each(e=>ES.showTab(t,e.value))})(e,o),requestAnimationFrame(()=>{sN(n,s,t)})})}),Uc($a(),e=>{const o=e.element;rN(o).each(e=>{sN(o,e,t)})}),Uc(vB,(e,o)=>{const n=e.element;rN(n).each(e=>{const o=Eo(go(e));en(e,"visibility","hidden");const s=rn(e,"height").map(e=>parseInt(e,10));cn(e,"height"),cn(e,"flex-basis");const r=e.dom.getBoundingClientRect().height;s.forall(e=>r>e)?(t.set(r),sN(n,e,t)):s.each(t=>{nN(e,t)}),cn(e,"visibility"),o.each(Oo)})})];return{extraEvents:o,selectFirst:!1}})(l);return ES.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=ef.getValue(t);Ic(e,bB,{name:n,oldName:i.get()}),i.set(n)},tabs:l,components:[ES.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[SS.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:sd([Kb.config({})])}),ES.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:c.selectFirst,tabSectionBehaviours:sd([dd("tabpanel",c.extraEvents),Sm.config({mode:"acyclic"}),Lg.config({find:e=>te(ES.getViewItems(e))}),TB(A.none(),e=>(e.getSystem().broadcastOn([aN],{}),s.get()),(e,t)=>{s.set(t),e.getSystem().broadcastOn([iN],{})})])})},cN=(e,t,o,n,s,r)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map(e=>({id:e})).getOr({}),...s?{"aria-live":"polite"}:{}}},components:[],behaviours:sd([kB(0),ub.config({channel:`${tF}-${t}`,updateState:(e,t)=>A.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[lN(t,e.initialData,n,r)]:[oN(t,e.initialData,n,r)]},initialData:e})])}),dN=PS.deviceType.isTouch(),uN=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),mN=(e,t)=>cy.parts.close(Bv.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:sd([Kb.config({})])})),gN=()=>cy.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),pN=(e,t)=>cy.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:vv(`<p>${LO(t.translate(e))}</p>`)}]}]}),hN=e=>cy.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),fN=(e,t)=>[ah.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),ah.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],bN=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",s=t+"__disable-scroll";return cy.sketch({role:e.role,lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),A.some(!0)),useTabstopAt:e=>!QB(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:vv(`<div class="${o}"></div>`),components:[{dom:{tag:"div",classes:dN?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:sd([hd.config({}),dd("dialog-events",e.dialogEvents.concat([Xc(ga(),(e,t)=>{Rg.isBlocked(e)||Sm.focusIn(e)}),Uc(Ka(),(e,t)=>{e.getSystem().broadcastOn([sF],{newFocus:t.event.newFocus})})])),dd("scroll-lock",[Kc(()=>{$n(Ko(),s)}),Jc(()=>{qn(Ko(),s)})]),...e.extraBehaviours]),eventOrder:{[Ra()]:["dialog-events"],[Ga()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[qa()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},vN=e=>Bv.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),"data-mce-name":"close"}},buttonBehaviours:sd([Kb.config({}),fv.config(e.tooltips.getConfig({tooltipText:e.translate("Close")}))]),components:[YO("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Fc(e,mB)}}),xN=(e,t,o,n)=>({dom:{tag:"h1",classes:["tox-dialog__title"],attributes:{...o.map(e=>({id:e})).getOr({})}},components:[],behaviours:sd([ub.config({channel:`${eF}-${t}`,initialData:e,renderComponents:e=>[_g(n.translate(e.title))]})])}),yN=()=>({dom:vv('<div class="tox-dialog__draghandle"></div>')}),wN=(e,t,o)=>((e,t,o)=>{const n=cy.parts.title(xN(e,t,A.none(),o)),s=cy.parts.draghandle(yN()),r=cy.parts.close(vN(o)),a=[n].concat(e.draggable?[s]:[]).concat([r]);return ah.sketch({dom:vv('<div class="tox-dialog__header"></div>'),components:a})})({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),SN=(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:vv('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}),CN=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=Vn(e().element,".tox-dialog__header").map(e=>gn(e));cy.setBusy(e(),(e,s)=>SN(o.message,s,t,n))},onUnblock:()=>{cy.setIdle(e())}}),kN="tox-dialog--fullscreen",ON="tox-dialog--width-lg",_N="tox-dialog--width-md",TN=e=>{switch(e){case"large":return A.some(ON);case"medium":return A.some(_N);default:return A.none()}},EN=(e,t)=>{const o=ct(t.element.dom);Yn(o,kN)||(Kn(o,[ON,_N]),TN(e).each(e=>$n(o,e)))},AN=(e,t)=>{const o=ct(e.element.dom),n=Jn(o),s=j(n,e=>e===ON||e===_N).or(TN(t));((e,t)=>{N(t,t=>{((e,t)=>{const o=Hn(e)?e.dom.classList.toggle(t):((e,t)=>I(Un(e),t)?jn(e,t):Wn(e,t))(e,t);Gn(e)})(e,t)})})(o,[kN,...s.toArray()])},DN=(e,t,o)=>Dg(bN({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[AB({}),...e.extraBehaviours],onEscape:e=>{Fc(e,mB)},dialogEvents:t,eventOrder:{[Ia()]:[ub.name(),ib.name()],[Ga()]:["scroll-lock",ub.name(),"messages","dialog-events","alloy.base.behaviour"],[qa()]:["alloy.base.behaviour","dialog-events","messages",ub.name(),"scroll-lock"]}})),MN=(e,t={})=>L(e,e=>"menu"===e.type?(e=>{const o=L(e.items,e=>{const o=fe(t,e.name).getOr(ye(!1));return{...e,storage:o}});return{...e,items:o}})(e):e),BN=e=>W(e,(e,t)=>"menu"===t.type?W(t.items,(e,t)=>(e[t.name]=t.storage,e),e):e,{}),FN=(e,t)=>{const o=()=>t.getSystem().isConnected()?Sm.focusIn(t):void 0,n=e=>Po(e,"disabled")||No(e,"aria-disabled").exists(e=>"true"===e),s=go(t.element),r=Eo(s);Eo(s).fold(o,t=>{n(t)||r.exists(e=>St(t,e)&&n(e))?o():e().toOptional().filter(e=>!St(e.element,t)).each(o)})},IN=(e,t,o)=>[Gc(ga(),JB),e(uB,(e,o,n,s)=>{To(s.element)&&Eo(go(s.element)).each(_o),t.onClose(),o.onClose()}),e(mB,(e,t,o,n)=>{t.onCancel(e),Fc(n,uB)}),Uc(fB,(e,n)=>{t.onUnblock(),FN(o,e)}),Uc(hB,(e,o)=>t.onBlock(o.event))],RN=(e,t,o)=>{const n=(t,o)=>Uc(t,(t,n)=>{s(t,(s,r)=>{o(e(),s,n.event,t)})}),s=(e,t)=>{ub.getState(e).get().each(o=>{t(o.internalDialog,e)})};return[...IN(n,t,o),n(pB,(e,t)=>t.onSubmit(e)),n(cB,(e,t,o)=>{t.onChange(e,{name:o.name})}),n(gB,(e,t,n,s)=>{t.onAction(e,{name:n.name,value:n.value}),FN(o,s)}),n(bB,(e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})}),Jc(t=>{const o=e();ef.setValue(t,o.getData())})]},zN=(e,t)=>{const o=t.map(e=>e.footerButtons).getOr([]),n=P(o,e=>"start"===e.align),s=(e,t)=>ah.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:L(t,e=>e.memento.asSpec())});return[s("start",n.pass),s("end",n.fail)]},VN=(e,t,o)=>({dom:vv('<div class="tox-dialog__footer"></div>'),components:[],behaviours:sd([ub.config({channel:`${oF}-${t}`,initialData:e,updateState:(e,t)=>{const n=L(t.buttons,e=>{const t=xv(((e,t)=>aI(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}});return A.some({lookupByName:t=>((e,t,o)=>j(t,e=>e.name===o).bind(t=>t.memento.getOpt(e)))(e,n,t),footerButtons:n})},renderComponents:zN})])}),LN=(e,t,o)=>cy.parts.footer(VN(e,t,o)),NN=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=Lg.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return Ix.getField(o,t).orThunk(()=>{const o=e.getFooter().bind(e=>ub.getState(e).get());return o.bind(e=>e.lookupByName(t))})}return A.none()},PN=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},s={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...ef.getValue(n),...le(o,e=>e.get())}},setData:t=>{n(n=>{const r=s.getData(),a=Le(r,t),i=((e,t)=>{const o=e.getRoot();return ub.getState(o).get().map(e=>wr(yr("data",e.dataValidator,t))).getOr(t)})(e,a),l=e.getFormWrapper();ef.setValue(l,i),ie(o,(e,t)=>{be(a,t)&&e.set(a[t])})})},setEnabled:(t,o)=>{NN(e,t).each(o?op.enable:op.disable)},focus:t=>{NN(e,t).each(hd.focus)},block:e=>{if(!r(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(t=>{Ic(t,hB,{message:e})})},unblock:()=>{n(e=>{Fc(e,fB)})},showTab:t=>{n(o=>{const n=e.getBody();ub.getState(n).get().exists(e=>e.isTabPanel())&&Lg.getCurrent(n).each(e=>{ES.showTab(e,t)})})},redial:r=>{n(n=>{const a=e.getId(),i=t(r),l=MN(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${ZB}-${a}`],i),n.getSystem().broadcastOn([`${eF}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${tF}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${oF}-${a}`],{...i.internalDialog,buttons:l}),s.setData(i.initialData)})},close:()=>{n(e=>{Fc(e,uB)})},toggleFullscreen:e.toggleFullscreen};return s},HN=(e,t,o,n=!1,s)=>{const r=ze("dialog"),a=ze("dialog-label"),i=ze("dialog-content"),l=e.internalDialog,c=ye(l.size),d=TN(c.get()).toArray(),u=xv(((e,t,o,n)=>ah.sketch({dom:vv('<div class="tox-dialog__header"></div>'),components:[xN(e,t,A.some(o),n),yN(),vN(n)],containerBehaviours:sd([Bh.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>Ln(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"},onDrag:(e,t)=>{e.getSystem().broadcastOn([Td()],{target:t})}})])}))({title:l.title,draggable:!0},r,a,o.shared.providers)),m=xv(((e,t,o,n,s,r)=>cN(e,t,A.some(o),n,s,r))({body:l.body,initialData:l.initialData},r,i,o,n,e=>NN(x,e))),g=MN(l.buttons),p=BN(g),h=je(0!==g.length,xv(((e,t,o)=>VN(e,t,o))({buttons:g},r,o))),f=RN(()=>w,{onBlock:e=>{Rg.block(v,(t,n)=>{const s=u.getOpt(v).map(e=>gn(e.element));return SN(e.message,n,o.shared.providers,s)})},onUnblock:()=>{Rg.unblock(v)},onClose:()=>t.closeWindow()},o.shared.getSink),b=Pt().os,v=Dg({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog",...b.isMacOS()?{"aria-label":l.title}:{"aria-labelledby":a}}},eventOrder:{[Ia()]:[ub.name(),ib.name()],[Ra()]:["execute-on-form"],[Ga()]:["reflecting","execute-on-form"]},behaviours:sd([Sm.config({mode:"cyclic",onEscape:e=>(Fc(e,uB),A.some(!0)),useTabstopAt:e=>!QB(e)&&("button"!==Wt(e)||"disabled"!==Lo(e,"disabled")),firstTabstop:1}),ub.config({channel:`${ZB}-${r}`,updateState:(e,t)=>(c.set(t.internalDialog.size),EN(t.internalDialog.size,e),s(),A.some(t)),initialData:e}),hd.config({}),dd("execute-on-form",f.concat([Xc(ga(),(e,t)=>{Sm.focusIn(e)}),Uc(Ka(),(e,t)=>{e.getSystem().broadcastOn([sF],{newFocus:t.event.newFocus})})])),Rg.config({getRoot:()=>A.some(v)}),eg.config({}),AB({})]),components:[u.asSpec(),m.asSpec(),...h.map(e=>e.asSpec()).toArray()]}),x={getId:y(r),getRoot:y(v),getFooter:()=>h.map(e=>e.get(v)),getBody:()=>m.get(v),getFormWrapper:()=>{const e=m.get(v);return Lg.getCurrent(e).getOr(e)},toggleFullscreen:()=>{AN(v,c.get())}},w=PN(x,t.redial,p);return{dialog:v,instanceApi:w}};var UN=tinymce.util.Tools.resolve("tinymce.util.URI");const WN=["insertContent","setContent","execCommand","close","block","unblock"],jN=e=>a(e)&&-1!==WN.indexOf(e.mceAction),$N=(e,t,o,n)=>{const s=ze("dialog"),i=wN(e.title,s,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[XB(A.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:sd([Kb.config({}),hd.config({})])})]}],behaviours:sd([Sm.config({mode:"acyclic",useTabstopAt:k(QB)})])};return cy.parts.body(t)})(e),c=e.buttons.bind(e=>0===e.length?A.none():A.some(LN({buttons:e},s,n))),u=((e,t,o)=>{const n=(e,t)=>Uc(e,(e,o)=>{s(e,(n,s)=>{t(y,n,o.event,e)})}),s=(e,t)=>{ub.getState(e).get().each(o=>{t(o,e)})};return[...IN(n,t,o),n(gB,(e,t,o)=>{t.onAction(e,{name:o.name})})]})(0,CN(()=>x,n.shared.providers,t),n.shared.getSink),m={...e.height.fold(()=>({}),e=>({height:e+"px","max-height":e+"px"})),...e.width.fold(()=>({}),e=>({width:e+"px","max-width":e+"px"}))},p=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],h=new UN(e.url,{base_uri:new UN(window.location.href)}),f=`${h.protocol}://${h.host}${h.port?":"+h.port:""}`,b=qe(),v=[ub.config({channel:`${ZB}-${s}`,updateState:(e,t)=>A.some(t),initialData:e}),dd("messages",[Kc(()=>{const t=wo(ct(window),"message",t=>{if(h.isSameOrigin(new UN(t.raw.origin))){const n=t.raw.data;jN(n)?((e,t,o)=>{switch(o.mceAction){case"insertContent":e.insertContent(o.content);break;case"setContent":e.setContent(o.content);break;case"execCommand":const n=!!d(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()}})(o,y,n):(e=>!jN(e)&&a(e)&&be(e,"mceAction"))(n)&&e.onMessage(y,n)}});b.set(t)}),Jc(b.clear)]),ib.config({channels:{[nF]:{onReceive:(e,t)=>{Vn(e.element,"iframe").each(e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)})}}}})],x=DN({id:s,header:i,body:l,footer:c,extraClasses:p,extraBehaviours:v,extraStyles:m},u,n),y=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!r(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(t=>{Ic(t,hB,{message:e})})},unblock:()=>{t(e=>{Fc(e,fB)})},close:()=>{t(e=>{Fc(e,uB)})},sendMessage:e=>{t(t=>{t.getSystem().broadcastOn([nF],e)})}}})(x);return{dialog:x,instanceApi:y}},GN=(e,t)=>wr(yr("data",t,e)),qN=e=>ns(e,".tox-alert-dialog")||ns(e,".tox-confirm-dialog"),YN=(e,t,o,n)=>t&&o?[]:[Ap.config({contextual:{lazyContext:()=>A.some(Es(ct(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition",onHide:n},modes:["top"],lazyViewport:t=>ok(e,t.element).map(e=>({bounds:nk(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Sn(e.element).top})})).getOrThunk(()=>({bounds:Ms(),optScrollEnv:A.none()}))})],XN=e=>{const t=e.editor,o=YC(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const s=()=>{cy.hide(l),n()},r=xv(aI({context:"any",name:"close-alert",text:"OK",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"cancel",e)),a=gN(),i=mN(s,t.providers),l=Dg(bN({role:"alertdialog",lazySink:()=>t.getSink(),header:uN(a,i),body:pN(o,t.providers),footer:A.some(hN(fN([],[r.asSpec()]))),onEscape:s,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Uc(mB,s),Kc(e=>{const t=cy.getBody(e);Rs(e.element,t.element)})],eventOrder:{}}));cy.show(l);const c=r.get(l);hd.focus(c)}}})(e.backstages.dialog),s=(e=>{const t=e.shared;return{open:(o,n)=>{const s=e=>{cy.hide(c),n(e)},r=xv(aI({context:"any",name:"yes",text:"Yes",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"submit",e)),a=aI({context:"any",name:"no",text:"No",primary:!1,buttonType:A.some("secondary"),align:"end",enabled:!0,icon:A.none()},"cancel",e),i=gN(),l=mN(()=>s(!1),t.providers),c=Dg(bN({role:"alertdialog",lazySink:()=>t.getSink(),header:uN(i,l),body:pN(o,t.providers),footer:A.some(hN(fN([],[a,r.asSpec()]))),onEscape:()=>s(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Uc(mB,()=>s(!1)),Uc(pB,()=>s(!0)),Kc(e=>{const t=cy.getBody(e);Rs(e.element,t.element)})],eventOrder:{}}));cy.show(c);const d=r.get(c);hd.focus(d)}}})(e.backstages.dialog),r=(t,o)=>tA.open((t,n,s)=>{const r=n,a=((e,t,o)=>{const n=ze("dialog"),s=e.internalDialog,r=wN(s.title,n,o),a=ye(s.size),i=TN(a.get()).toArray(),l=((e,t,o,n)=>{const s=cN(e,t,A.none(),o,!1,n);return cy.parts.body(s)})({body:s.body,initialData:s.initialData},n,o,e=>NN(h,e)),c=MN(s.buttons),d=BN(c),u=je(0!==c.length,LN({buttons:c},n,o)),m=RN(()=>f,CN(()=>p,o.shared.providers,t),o.shared.getSink),g={id:n,header:r,body:l,footer:u,extraClasses:i,extraBehaviours:[ub.config({channel:`${ZB}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),EN(t.internalDialog.size,e),A.some(t)),initialData:e})],extraStyles:{}},p=DN(g,m,o),h={getId:y(n),getRoot:y(p),getBody:()=>cy.getBody(p),getFooter:()=>cy.getFooter(p),getFormWrapper:()=>{const e=cy.getBody(p);return Lg.getCurrent(e).getOr(e)},toggleFullscreen:()=>{AN(p,a.get())}},f=PN(h,t.redial,d);return{dialog:p,instanceApi:f}})({dataValidator:s,initialData:r,internalDialog:t},{redial:tA.redial,closeWindow:()=>{cy.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return cy.show(a.dialog),a.instanceApi.setData(r),a.instanceApi},t),a=(n,s,r,a)=>tA.open((n,i,l)=>{const c=GN(i,l),d=Ye(),u=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>d.on(e=>{Zx.reposition(e),o&&u||Ap.refresh(e)}),g=HN({dataValidator:l,initialData:c,internalDialog:n},{redial:tA.redial,closeWindow:()=>{d.on(Zx.hide),t.off("ResizeEditor",m),t.off("ScrollWindow",p),d.clear(),r(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,m),p=()=>g.dialog.getSystem().broadcastOn([Td()],{target:g.dialog.element}),h=Dg(Zx.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},fireRepositionEventInstead:{},inlineBehaviours:sd([dd("window-manager-inline-events",[Uc(Ya(),(e,t)=>{Fc(g.dialog,mB)}),Uc(Xa(),()=>{u&&m()})]),...YN(t,o,u,()=>g.dialog.getSystem().broadcastOn([_d()],{target:g.dialog.element}))]),isExtraPart:(e,t)=>qN(t)}));return d.set(h),Zx.showWithinBounds(h,Mg(g.dialog),{anchor:s},()=>{const e=t.inline?Ko():ct(t.getContainer()),o=Es(e);return A.some(o)}),o&&u||(Ap.refresh(h),t.on("ResizeEditor",m)),t.on("ScrollWindow",p),g.instanceApi.setData(c),Sm.focusIn(g.dialog),g.instanceApi},n),i=(o,n,s,r)=>tA.open((o,a,i)=>{const l=GN(a,i),c=Ye(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>c.on(e=>{Zx.reposition(e),Ap.refresh(e)}),m=HN({dataValidator:i,initialData:l,internalDialog:o},{redial:tA.redial,closeWindow:()=>{c.on(Zx.hide),t.off("ResizeEditor ScrollWindow ElementScroll",u),c.clear(),s(m.instanceApi)}},e.backstages.popup,r.ariaAttrs,u),g=Dg(Zx.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:r.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:sd([dd("window-manager-inline-events",[Uc(Ya(),(e,t)=>{Fc(m.dialog,mB)})]),Ap.config({contextual:{lazyContext:()=>A.some(Es(ct(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>ok(t,e.element).map(e=>({bounds:nk(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Sn(e.element).top})})).getOrThunk(()=>({bounds:Ms(),optScrollEnv:A.none()}))})]),isExtraPart:(e,t)=>qN(t)}));return c.set(g),Zx.showWithinBounds(g,Mg(m.dialog),{anchor:n},()=>e.backstages.popup.shared.getSink().toOptional().bind(e=>{const o=ok(t,e.element).map(e=>nk(e)).getOr(Ms()),n=Es(ct(t.getContentAreaContainer())),s=Ds(n,o);return A.some(Ts(s.x,s.y,s.width,s.height-15))})),Ap.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",u),m.instanceApi.setData(l),Sm.focusIn(m.dialog),m.instanceApi},o);return{open:(t,o,n)=>{if(!u(o)){if("toolbar"===o.inline)return a(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return a(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return r(t,n)},openUrl:(o,n)=>((o,n)=>tA.openUrl(o=>{const s=$N(o,{closeWindow:()=>{cy.hide(s.dialog),n(s.instanceApi)}},t,e.backstages.dialog);return cy.show(s.dialog),s.instanceApi},o))(o,n),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{s.open(e,t)}}},KN=e=>{$S(e),(e=>{const t=e.options.register,o=e=>{return f(e,r)?{value:(t=e,bM(t.map((e,t)=>t%2==0?"#"+(e=>{return(t=e,ID(t)?A.some({value:RD(t)}):A.none()).orThunk(()=>KD(e).map(VD)).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,s=n[0],r=n[1],a=n[2],i=n[3];return VD($D(s,r,a,i))});var t})(e).value:e))),valid:!0}:{valid:!1,message:"Must be an array of strings."};var t},n=e=>h(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_raw",{processor:e=>f(e,r)?{value:bM(e),valid:!0}:{valid:!1,message:"Must be an array of strings."}}),t("color_map_background",{processor:o}),t("color_map_foreground",{processor:o}),t("color_cols",{processor:n,default:wM(e)}),t("color_cols_foreground",{processor:n,default:SM(e,hM)}),t("color_cols_background",{processor:n,default:SM(e,fM)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:xM}),t("color_default_background",{processor:"string",default:xM})})(e),(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}:r(e)||f(e,r)?{value:yL(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)};zS.add("silver",e=>{KN(e);let t=()=>Ms();const{dialogs:o,popups:n,renderUI:s}=eN(e,{getPopupSinkBounds:()=>t()});nB(e,n.backstage.shared);const r=XN({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}}),a=Ye();return{renderUI:()=>{const o=s();return ok(e,n.getMothership().element).each(e=>{t=()=>nk(e)}),o},getWindowManagerImpl:y(r),getNotificationManagerImpl:()=>JO(e,{backstage:n.backstage},n.getMothership(),a),getPromotionElement:()=>Vn(ct(e.getContainer()),".tox-promotion").map(e=>e.dom).getOrNull(),getSinkElement:e=>"dialog"===e?o.getMothership().element.dom:n.getMothership().element.dom}})}();