diff --git a/package.json b/package.json index 77b485bf57..465b182ada 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "flatpickr": "^4.6.13", "keymaster": "^1.6.2", "sortablejs": "^1.15.2", - "tinymce": "^6.8.3" + "tinymce": "^7.0.0" }, "devDependencies": { "@babel/core": "^7.24.0", diff --git a/vendor/javascript/tinymce.min.js b/vendor/javascript/tinymce.min.js index 6a7a1c880d..638f0d907d 100644 --- a/vendor/javascript/tinymce.min.js +++ b/vendor/javascript/tinymce.min.js @@ -1 +1 @@ -function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,o={exports:{}};t=o,function(){var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},o=function(e){return{eq:e}},n=o((function(e,t){return e===t})),r=function(e){return o((function(t,o){if(t.length!==o.length)return!1;for(var n=t.length,r=0;r{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},d=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&c(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,m=e=>t=>typeof t===e,u=e=>t=>e===t,g=(e,t)=>p(e)&&c(e,t,((e,t)=>l(e)===t)),h=d("string"),p=d("object"),f=e=>g(e,Object),v=d("array"),b=u(null),y=m("boolean"),w=u(void 0),x=e=>null==e,C=e=>!x(e),S=m("function"),k=m("number"),_=(e,t)=>{if(v(e)){for(let o=0,n=e.length;o{},T=(e,t)=>(...o)=>e(t.apply(null,o)),O=(e,t)=>o=>e(t(o)),D=e=>()=>e,A=e=>e,M=(e,t)=>e===t;function N(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const R=e=>t=>!e(t),B=e=>()=>{throw new Error(e)},L=e=>e(),H=e=>{e()},I=D(!1),P=D(!0);class F{constructor(e,t){this.tag=e,this.value=t}static some(e){return new F(!0,e)}static none(){return F.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?F.some(e(this.value)):F.none()}bind(e){return this.tag?e(this.value):F.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:F.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return C(e)?F.some(e):F.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()"}}F.singletonNone=new F(!1);const z=Array.prototype.slice,V=Array.prototype.indexOf,Z=Array.prototype.push,U=(e,t)=>V.call(e,t),j=(e,t)=>U(e,t)>-1,W=(e,t)=>{for(let o=0,n=e.length;o{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{for(let o=e.length-1;o>=0;o--)t(e[o],o)},K=(e,t)=>{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(G(e,((e,n)=>{o=t(o,e,n)})),o),J=(e,t,o)=>(q(e,((e,n)=>{o=t(o,e,n)})),o),Q=(e,t,o)=>{for(let n=0,r=e.length;nQ(e,t,I),te=(e,t)=>{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;ooe($(e,t)),re=(e,t)=>{for(let o=0,n=e.length;o{const t=z.call(e,0);return t.reverse(),t},ae=(e,t)=>Y(e,(e=>!j(t,e))),ie=(e,t)=>{const o={};for(let n=0,r=e.length;n{const o=z.call(e,0);return o.sort(t),o},ce=(e,t)=>t>=0&&tce(e,0),me=e=>ce(e,e.length-1),ue=S(Array.from)?Array.from:e=>z.call(e),ge=(e,t)=>{for(let o=0;o{const o=he(e);for(let n=0,r=o.length;nbe(e,((e,o)=>({k:o,v:t(e,o)}))),be=(e,t)=>{const o={};return fe(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},ye=e=>(t,o)=>{e[o]=t},we=(e,t,o,n)=>{fe(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))},xe=(e,t)=>{const o={};return we(e,t,ye(o),E),o},Ce=(e,t)=>{const o=[];return fe(e,((e,n)=>{o.push(t(e,n))})),o},Se=e=>Ce(e,A),ke=(e,t)=>_e(e,t)?F.from(e[t]):F.none(),_e=(e,t)=>pe.call(e,t),Ee=(e,t)=>_e(e,t)&&void 0!==e[t]&&null!==e[t],Te=e=>{const t={};return q(e,(e=>{t[e]={}})),he(t)},Oe=e=>void 0!==e.length,De=Array.isArray,Ae=(e,t,o)=>{if(!e)return!1;if(o=o||e,Oe(e)){for(let n=0,r=e.length;n{const o=[];return Ae(e,((n,r)=>{o.push(t(n,r,e))})),o},Ne=(e,t)=>{const o=[];return Ae(e,((n,r)=>{t&&!t(n,r,e)||o.push(n)})),o},Re=(e,t,o,n)=>{let r=w(o)?e[0]:o;for(let o=0;o{for(let n=0,r=e.length;ne[e.length-1],He=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},Ie=()=>Pe(0,0),Pe=(e,t)=>({major:e,minor:t}),Fe={nu:Pe,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?Ie():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return Pe(n(1),n(2))})(e,o)},unknown:Ie},ze=(e,t)=>{const o=String(t).toLowerCase();return ee(e,(e=>e.search(o)))},Ve=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ze=(e,t)=>je(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Ue=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!w(n)||r+t.length<=n)},je=(e,t)=>Ve(e,t,0),We=(e,t)=>Ve(e,t,e.length-t.length),$e=e=>t=>t.replace(e,""),qe=$e(/^\s+|\s+$/g),Ge=$e(/^\s+/g),Ke=$e(/\s+$/g),Ye=e=>e.length>0,Xe=e=>!Ye(e),Je=(e,t=10)=>{const o=parseInt(e,t);return isNaN(o)?F.none():F.some(o)},Qe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,et=e=>t=>Ue(t,e),tt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Ue(e,"edge/")&&Ue(e,"chrome")&&Ue(e,"safari")&&Ue(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Qe],search:e=>Ue(e,"chrome")&&!Ue(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Ue(e,"msie")||Ue(e,"trident")},{name:"Opera",versionRegexes:[Qe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:et("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:et("firefox")},{name:"Safari",versionRegexes:[Qe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Ue(e,"safari")||Ue(e,"mobile/"))&&Ue(e,"applewebkit")}],ot=[{name:"Windows",search:et("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Ue(e,"iphone")||Ue(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]+).*/]}],nt={browsers:D(tt),oses:D(ot)},rt="Edge",st="Chromium",at="Opera",it="Firefox",lt="Safari",ct=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(rt),isChromium:n(st),isIE:n("IE"),isOpera:n(at),isFirefox:n(it),isSafari:n(lt)}},dt={unknown:()=>ct({current:void 0,version:Fe.unknown()}),nu:ct,edge:D(rt),chromium:D(st),ie:D("IE"),opera:D(at),firefox:D(it),safari:D(lt)},mt="Windows",ut="Android",gt="Linux",ht="macOS",pt="Solaris",ft="FreeBSD",vt="ChromeOS",bt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(mt),isiOS:n("iOS"),isAndroid:n(ut),isMacOS:n(ht),isLinux:n(gt),isSolaris:n(pt),isFreeBSD:n(ft),isChromeOS:n(vt)}},yt={unknown:()=>bt({current:void 0,version:Fe.unknown()}),nu:bt,windows:D(mt),ios:D("iOS"),android:D(ut),linux:D(gt),macos:D(ht),solaris:D(pt),freebsd:D(ft),chromeos:D(vt)},wt=(e,t,o)=>{const n=nt.browsers(),r=nt.oses(),s=t.bind((e=>((e,t)=>ge(t.brands,(t=>{const o=t.brand.toLowerCase();return ee(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Fe.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>ze(e,t).map((e=>{const o=Fe.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(dt.unknown,dt.nu),a=((e,t)=>ze(e,t).map((e=>{const o=Fe.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(yt.unknown,yt.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:D(r),isiPhone:D(s),isTablet:D(l),isPhone:D(c),isTouch:D(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:D(d),isDesktop:D(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},xt=e=>window.matchMedia(e).matches;let Ct=He((()=>wt(navigator.userAgent,F.from(navigator.userAgentData),xt)));const St=()=>Ct(),kt=navigator.userAgent,_t=St(),Et=_t.browser,Tt=_t.os,Ot=_t.deviceType,Dt=-1!==kt.indexOf("Windows Phone"),At={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:Et.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!Et.isIE(),windowsPhone:Dt,browser:{current:Et.current,version:Et.version,isChromium:Et.isChromium,isEdge:Et.isEdge,isFirefox:Et.isFirefox,isIE:Et.isIE,isOpera:Et.isOpera,isSafari:Et.isSafari},os:{current:Tt.current,version:Tt.version,isAndroid:Tt.isAndroid,isChromeOS:Tt.isChromeOS,isFreeBSD:Tt.isFreeBSD,isiOS:Tt.isiOS,isLinux:Tt.isLinux,isMacOS:Tt.isMacOS,isSolaris:Tt.isSolaris,isWindows:Tt.isWindows},deviceType:{isDesktop:Ot.isDesktop,isiPad:Ot.isiPad,isiPhone:Ot.isiPhone,isPhone:Ot.isPhone,isTablet:Ot.isTablet,isTouch:Ot.isTouch,isWebView:Ot.isWebView}},Mt=/^\s*|\s*$/g,Nt=e=>x(e)?"":(""+e).replace(Mt,""),Rt=function(e,t,o,n){n=n||this,e&&(o&&(e=e[o]),Ae(e,((e,r)=>!1!==t.call(n,e,r,o)&&(Rt(e,t,o,n),!0))))},Bt={trim:Nt,isArray:De,is:(e,t)=>t?!("array"!==t||!De(e))||typeof e===t:void 0!==e,toArray:e=>{if(De(e))return e;{const t=[];for(let o=0,n=e.length;o{const n=h(e)?e.split(t||","):e||[];let r=n.length;for(;r--;)o[n[r]]={};return o},each:Ae,map:Me,grep:Ne,inArray:(e,t)=>{if(e)for(let o=0,n=e.length;o{for(let o=0;o{const o=e.split(".");for(let e=0,n=o.length;ev(e)?e:""===e?[]:Me(e.split(t||","),Nt),_addCacheSuffix:e=>{const t=At.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Lt=(e,t,o=M)=>e.exists((e=>o(e,t))),Ht=(e,t,o=M)=>It(e,t,o).getOr(e.isNone()&&t.isNone()),It=(e,t,o)=>e.isSome()&&t.isSome()?F.some(o(e.getOrDie(),t.getOrDie())):F.none(),Pt=(e,t)=>e?F.some(t):F.none(),Ft="undefined"!=typeof window?window:Function("return this;")(),zt=(e,t)=>((e,t)=>{let o=null!=t?t:Ft;for(let t=0;t{const o=((e,t)=>zt(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},Zt=Object.getPrototypeOf,Ut=e=>{const t=zt("ownerDocument.defaultView",e);return p(e)&&((e=>Vt("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Zt(e).constructor.name))},jt=e=>e.dom.nodeName.toLowerCase(),Wt=e=>e.dom.nodeType,$t=e=>t=>Wt(t)===e,qt=e=>Gt(e)&&Ut(e.dom),Gt=$t(1),Kt=$t(3),Yt=$t(9),Xt=$t(11),Jt=e=>t=>Gt(t)&&jt(t)===e,Qt=(e,t,o)=>{if(!(h(o)||y(o)||k(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+"")},eo=(e,t,o)=>{Qt(e.dom,t,o)},to=(e,t)=>{const o=e.dom;fe(t,((e,t)=>{Qt(o,t,e)}))},oo=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},no=(e,t)=>F.from(oo(e,t)),ro=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},so=(e,t)=>{e.dom.removeAttribute(t)},ao=e=>J(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),io=(e,t)=>{const o=oo(e,t);return void 0===o||""===o?[]:o.split(" ")},lo=e=>void 0!==e.dom.classList,co=e=>io(e,"class"),mo=(e,t)=>((e,t,o)=>{const n=io(e,t).concat([o]);return eo(e,t,n.join(" ")),!0})(e,"class",t),uo=(e,t)=>((e,t,o)=>{const n=Y(io(e,t),(e=>e!==o));return n.length>0?eo(e,t,n.join(" ")):so(e,t),!1})(e,"class",t),go=(e,t)=>{lo(e)?e.dom.classList.add(t):mo(e,t)},ho=e=>{0===(lo(e)?e.dom.classList:co(e)).length&&so(e,"class")},po=(e,t)=>{lo(e)?e.dom.classList.remove(t):uo(e,t),ho(e)},fo=(e,t)=>{const o=lo(e)?e.dom.classList.toggle(t):((e,t)=>j(co(e),t)?uo(e,t):mo(e,t))(e,t);return ho(e),o},vo=(e,t)=>lo(e)&&e.dom.classList.contains(t),bo=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},yo={fromHtml:(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 bo(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return bo(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return bo(o)},fromDom:bo,fromPoint:(e,t,o)=>F.from(e.dom.elementFromPoint(t,o)).map(bo)},wo=(e,t)=>{const o=[],n=e=>(o.push(e),t(e));let r=t(e);do{r=r.bind(n)}while(r.isSome());return o},xo=(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")}},Co=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,So=(e,t)=>e.dom===t.dom,ko=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},_o=e=>yo.fromDom(e.dom.ownerDocument),Eo=e=>Yt(e)?e:_o(e),To=e=>yo.fromDom(Eo(e).dom.defaultView),Oo=e=>F.from(e.dom.parentNode).map(yo.fromDom),Do=e=>F.from(e.dom.parentElement).map(yo.fromDom),Ao=(e,t)=>{const o=S(t)?t:I;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=yo.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},Mo=e=>F.from(e.dom.previousSibling).map(yo.fromDom),No=e=>F.from(e.dom.nextSibling).map(yo.fromDom),Ro=e=>se(wo(e,Mo)),Bo=e=>wo(e,No),Lo=e=>$(e.dom.childNodes,yo.fromDom),Ho=(e,t)=>{const o=e.dom.childNodes;return F.from(o[t]).map(yo.fromDom)},Io=e=>Ho(e,0),Po=e=>Ho(e,e.dom.childNodes.length-1),Fo=e=>e.dom.childNodes.length,zo=e=>Xt(e)&&C(e.dom.host),Vo=S(Element.prototype.attachShadow)&&S(Node.prototype.getRootNode),Zo=D(Vo),Uo=Vo?e=>yo.fromDom(e.dom.getRootNode()):Eo,jo=e=>zo(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return yo.fromDom(t)})(Eo(e)),Wo=e=>yo.fromDom(e.dom.host),$o=e=>{if(Zo()&&C(e.target)){const t=yo.fromDom(e.target);if(Gt(t)&&qo(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return de(t)}}return F.from(e.target)},qo=e=>C(e.dom.shadowRoot),Go=e=>{const t=Kt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=Uo(e);return zo(t)?F.some(t):F.none()})(yo.fromDom(t)).fold((()=>o.body.contains(t)),O(Go,Wo))};var Ko=(e,t,o,n,r)=>e(o,n)?F.some(o):S(r)&&r(o)?F.none():t(o,n,r);const Yo=(e,t,o)=>{let n=e.dom;const r=S(o)?o:I;for(;n.parentNode;){n=n.parentNode;const e=yo.fromDom(n);if(t(e))return F.some(e);if(r(e))break}return F.none()},Xo=(e,t,o)=>Ko(((e,t)=>t(e)),Yo,e,t,o),Jo=(e,t)=>ee(e.dom.childNodes,(e=>t(yo.fromDom(e)))).map(yo.fromDom),Qo=(e,t)=>{const o=e=>{for(let n=0;nYo(e,(e=>xo(e,t)),o),tn=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Co(o)?F.none():F.from(o.querySelector(e)).map(yo.fromDom)})(t,e),on=(e,t,o)=>Ko(((e,t)=>xo(e,t)),en,e,t,o),nn=(e,t=!1)=>{return Go(e)?e.dom.isContentEditable:(o=e,on(o,"[contenteditable]")).fold(D(t),(e=>"true"===rn(e)));var o},rn=e=>e.dom.contentEditable,sn=e=>void 0!==e.style&&S(e.style.getPropertyValue),an=(e,t,o)=>{if(!h(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);sn(e)&&e.style.setProperty(t,o)},ln=(e,t,o)=>{const n=e.dom;an(n,t,o)},cn=(e,t)=>{const o=e.dom;fe(t,((e,t)=>{an(o,t,e)}))},dn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Go(e)?n:mn(o,t)},mn=(e,t)=>sn(e)?e.style.getPropertyValue(t):"",un=(e,t)=>{const o=e.dom,n=mn(o,t);return F.from(n).filter((e=>e.length>0))},gn=e=>{const t={},o=e.dom;if(sn(o))for(let e=0;e{((e,t)=>{sn(e)&&e.style.removeProperty(t)})(e.dom,t),Lt(no(e,"style").map(qe),"")&&so(e,"style")},pn=(e,t)=>{Oo(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},fn=(e,t)=>{No(e).fold((()=>{Oo(e).each((e=>{bn(e,t)}))}),(e=>{pn(e,t)}))},vn=(e,t)=>{Io(e).fold((()=>{bn(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},bn=(e,t)=>{e.dom.appendChild(t.dom)},yn=(e,t)=>{pn(e,t),bn(t,e)},wn=(e,t)=>{q(t,(t=>{bn(e,t)}))},xn=e=>{e.dom.textContent="",q(Lo(e),(e=>{Cn(e)}))},Cn=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Sn=e=>{const t=Lo(e);var o,n;t.length>0&&(o=e,q(n=t,((e,t)=>{const r=0===t?o:n[t-1];fn(r,e)}))),Cn(e)},kn=e=>$(e,yo.fromDom),_n=e=>e.dom.innerHTML,En=(e,t)=>{const o=_o(e).dom,n=yo.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Lo(yo.fromDom(o))})(t,o);wn(n,r),xn(e),bn(e,n)},Tn=(e,t)=>o=>{e(o)&&t((e=>{const t=yo.fromDom($o(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=T(n,o);return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)})(o))},On=(e,t,o,n)=>((e,t,o,n,r)=>{const s=Tn(o,n);return e.dom.addEventListener(t,s,r),{unbind:N(Dn,e,t,s,r)}})(e,t,o,n,!1),Dn=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},An=(e,t)=>({left:e,top:t,translate:(o,n)=>An(e+o,t+n)}),Mn=An,Nn=(e,t)=>void 0!==e?e:void 0!==t?t:0,Rn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Mn(o.offsetLeft,o.offsetTop):Go(e)?(e=>{const t=e.getBoundingClientRect();return Mn(t.left,t.top)})(t):Mn(0,0)},Bn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Mn(o,n)},Ln=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},Hn=(e,t)=>{St().browser.isSafari()&&S(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},In=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Pn=e=>{const t=void 0===e?window:e,o=t.document,n=Bn(yo.fromDom(o));return(e=>{const t=void 0===e?window:e;return St().browser.isFirefox()?F.none():F.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return In(n.left,n.top,o,r)}),(e=>In(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},Fn=(e,t)=>{let o=[];return q(Lo(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(Fn(e,t))})),o},zn=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Co(o)?[]:$(o.querySelectorAll(e),yo.fromDom)})(t,e),Vn=(e,t,o)=>en(e,t,o).isSome();class Zn{constructor(e,t){this.node=e,this.rootNode=t,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(e){return this.node=this.findSibling(this.node,"firstChild","nextSibling",e),this.node}prev(e){return this.node=this.findSibling(this.node,"lastChild","previousSibling",e),this.node}prev2(e){return this.node=this.findPreviousNode(this.node,e),this.node}findSibling(e,t,o,n){if(e){if(!n&&e[t])return e[t];if(e!==this.rootNode){let t=e[o];if(t)return t;for(let n=e.parentNode;n&&n!==this.rootNode;n=n.parentNode)if(t=n[o],t)return t}}}findPreviousNode(e,t){if(e){const o=e.previousSibling;if(this.rootNode&&o===this.rootNode)return;if(o){if(!t)for(let e=o.lastChild;e;e=e.lastChild)if(!e.lastChild)return e;return o}const n=e.parentNode;if(n&&n!==this.rootNode)return n}}}const Un=e=>t=>!!t&&t.nodeType===e,jn=e=>!!e&&!Object.getPrototypeOf(e),Wn=Un(1),$n=e=>Wn(e)&&qt(yo.fromDom(e)),qn=e=>{const t=e.toLowerCase();return e=>C(e)&&e.nodeName.toLowerCase()===t},Gn=e=>{const t=e.map((e=>e.toLowerCase()));return e=>{if(e&&e.nodeName){const o=e.nodeName.toLowerCase();return j(t,o)}return!1}},Kn=(e,t)=>{const o=t.toLowerCase().split(" ");return t=>{if(Wn(t)){const n=t.ownerDocument.defaultView;if(n)for(let r=0;rt=>Wn(t)&&t.hasAttribute(e),Xn=e=>Wn(e)&&e.hasAttribute("data-mce-bogus"),Jn=e=>Wn(e)&&"TABLE"===e.tagName,Qn=e=>t=>{if($n(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},er=Gn(["textarea","input"]),tr=Un(3),or=Un(4),nr=Un(7),rr=Un(8),sr=Un(9),ar=Un(11),ir=qn("br"),lr=qn("img"),cr=Qn("true"),dr=Qn("false"),mr=Gn(["td","th"]),ur=Gn(["td","th","caption"]),gr=Gn(["video","audio","object","embed"]),hr=qn("li"),pr=qn("details"),fr=qn("summary"),vr="\ufeff",br=" ",yr=e=>e===vr,wr=((e,t)=>{const o=t=>e(t)?F.from(t.dom.nodeValue):F.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})(Kt,"text"),xr=e=>wr.get(e),Cr=e=>wr.getOption(e),Sr=e=>{let t;return o=>(t=t||ie(e,P),_e(t,jt(o)))},kr=e=>Gt(e)&&"br"===jt(e),_r=Sr(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),Er=Sr(["ul","ol","dl"]),Tr=Sr(["li","dd","dt"]),Or=Sr(["thead","tbody","tfoot"]),Dr=Sr(["td","th"]),Ar=Sr(["pre","script","textarea","style"]),Mr=e=>{const t=zn(e,"br"),o=Y((e=>{const t=[];let o=e.dom;for(;o;)t.push(yo.fromDom(o)),o=o.lastChild;return t})(e).slice(-1),kr);t.length===o.length&&q(o,Cn)},Nr=()=>{const e=yo.fromTag("br");return eo(e,"data-mce-bogus","1"),e},Rr=e=>{xn(e),bn(e,Nr())},Br=vr,Lr=yr,Hr=e=>e.replace(/\uFEFF/g,""),Ir=Wn,Pr=tr,Fr=e=>(Pr(e)&&(e=e.parentNode),Ir(e)&&e.hasAttribute("data-mce-caret")),zr=e=>Pr(e)&&Lr(e.data),Vr=e=>Fr(e)||zr(e),Zr=e=>e.firstChild!==e.lastChild||!ir(e.firstChild),Ur=e=>{const t=e.container();return!!tr(t)&&(t.data.charAt(e.offset())===Br||e.isAtStart()&&zr(t.previousSibling))},jr=e=>{const t=e.container();return!!tr(t)&&(t.data.charAt(e.offset()-1)===Br||e.isAtEnd()&&zr(t.nextSibling))},Wr=e=>Pr(e)&&e.data[0]===Br,$r=e=>Pr(e)&&e.data[e.data.length-1]===Br,qr=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{var t;const o=e.getElementsByTagName("br"),n=o[o.length-1];Xn(n)&&(null===(t=n.parentNode)||void 0===t||t.removeChild(n))})(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,Gr=e=>Fr(e.startContainer),Kr=cr,Yr=dr,Xr=ir,Jr=tr,Qr=Gn(["script","style","textarea"]),es=Gn(["img","input","textarea","hr","iframe","video","audio","object","embed"]),ts=Gn(["table"]),os=Vr,ns=e=>!os(e)&&(Jr(e)?!Qr(e.parentNode):es(e)||Xr(e)||ts(e)||rs(e)),rs=e=>!(e=>Wn(e)&&"true"===e.getAttribute("unselectable"))(e)&&Yr(e),ss=(e,t)=>ns(e)&&((e,t)=>{for(let o=e.parentNode;o&&o!==t;o=o.parentNode){if(rs(o))return!1;if(Kr(o))return!0}return!0})(e,t),as=/^[ \t\r\n]*$/,is=e=>as.test(e),ls=e=>{for(const t of e)if(!yr(t))return!1;return!0},cs=e=>"\n"===e||"\r"===e,ds=(e,t=4,o=!0,n=!0)=>{const r=((e,t)=>t<=0?"":new Array(t+1).join(e))(" ",t),s=e.replace(/\t/g,r),a=J(s,((e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||t===br?e.pcIsSpace||""===e.str&&o||e.str.length===s.length-1&&n||((e,t)=>t=0&&cs(e[t]))(s,e.str.length+1)?{pcIsSpace:!1,str:e.str+br}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:cs(t),str:e.str+t}),{pcIsSpace:!1,str:""});return a.str},ms=(e,t)=>tr(e)&&is(e.data)&&!((e,t)=>{const o=yo.fromDom(t),n=yo.fromDom(e);return Vn(n,"pre,code",N(So,o))})(e,t),us=(e,t)=>ns(e)&&!ms(e,t)||(e=>Wn(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(e)||gs(e),gs=Yn("data-mce-bookmark"),hs=Yn("data-mce-bogus"),ps=(fs="data-mce-bogus",vs="all",e=>Wn(e)&&e.getAttribute(fs)===vs);var fs,vs;const bs=e=>Do(yo.fromDom(e)).exists((e=>!nn(e))),ys=(e,t=!0)=>((e,t)=>{let o=0;if(us(e,e))return!1;{let n=e.firstChild;if(!n)return!0;const r=new Zn(n,e);do{if(t){if(ps(n)){n=r.next(!0);continue}if(hs(n)){n=r.next();continue}}if(cr(n)&&bs(n))return!1;if(ir(n))o++,n=r.next();else{if(us(n,e))return!1;n=r.next()}}while(n);return o<=1}})(e.dom,t),ws=e=>"svg"===e.toLowerCase(),xs=e=>ws(e.nodeName),Cs=e=>"svg"===(null==e?void 0:e.nodeName)?"svg":"html",Ss=["svg"],ks="data-mce-block",_s=e=>$((e=>Y(he(e),(e=>!/[A-Z]/.test(e))))(e),(e=>`${e}:`+$(Ss,(t=>`not(${t} ${e})`)).join(":"))).join(","),Es=(e,t)=>C(t.querySelector(e))?(t.setAttribute(ks,"true"),"inline-boundary"===t.getAttribute("data-mce-selected")&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(ks),!1),Ts=(e,t)=>{const o=_s(e.getTransparentElements()),n=_s(e.getBlockElements());return Y(t.querySelectorAll(o),(e=>Es(n,e)))},Os=(e,t)=>{var o;const n=t?"lastChild":"firstChild";for(let t=e[n];t;t=t[n])if(ys(yo.fromDom(t)))return void(null===(o=t.parentNode)||void 0===o||o.removeChild(t))},Ds=(e,t,o)=>{const n=e.getBlockElements(),r=yo.fromDom(t),s=e=>jt(e)in n,a=e=>So(e,r);q(kn(o),(t=>{Yo(t,s,a).each((o=>{const n=((e,t)=>Y(Lo(e),t))(t,(t=>s(t)&&!e.isValidChild(jt(o),jt(t))));if(n.length>0){const t=Do(o);q(n,(e=>{Yo(e,s,a).each((t=>{((e,t)=>{const o=document.createRange(),n=e.parentNode;if(n){o.setStartBefore(e),o.setEndBefore(t);const r=o.extractContents();Os(r,!0),o.setStartAfter(t),o.setEndAfter(e);const s=o.extractContents();Os(s,!1),ys(yo.fromDom(r))||n.insertBefore(r,e),ys(yo.fromDom(t))||n.insertBefore(t,e),ys(yo.fromDom(s))||n.insertBefore(s,e),n.removeChild(e)}})(t.dom,e.dom)}))})),t.each((t=>Ts(e,t.dom)))}}))}))},As=(e,t)=>{const o=Ts(e,t);Ds(e,t,o),((e,t,o)=>{q([...o,...Ls(e,t)?[t]:[]],(t=>q(zn(yo.fromDom(t),t.nodeName.toLowerCase()),(t=>{Hs(e,t.dom)&&Sn(t)}))))})(e,t,o)},Ms=(e,t)=>{if(Bs(e,t)){const o=_s(e.getBlockElements());Es(o,t)}},Ns=e=>e.hasAttribute(ks),Rs=(e,t)=>_e(e.getTransparentElements(),t),Bs=(e,t)=>Wn(t)&&Rs(e,t.nodeName),Ls=(e,t)=>Bs(e,t)&&Ns(t),Hs=(e,t)=>Bs(e,t)&&!Ns(t),Is=(e,t)=>1===t.type&&Rs(e,t.name)&&h(t.attr(ks)),Ps=St().browser,Fs=e=>ee(e,Gt),zs=(e,t)=>e.children&&j(e.children,t),Vs=(e,t,o)=>{let n=0,r=0;const s=e.ownerDocument;if(o=o||e,t){if(o===e&&t.getBoundingClientRect&&"static"===dn(yo.fromDom(e),"position")){const o=t.getBoundingClientRect();return n=o.left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentElement.clientLeft,r=o.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop,{x:n,y:r}}let a=t;for(;a&&a!==o&&a.nodeType&&!zs(a,o);){const e=a;n+=e.offsetLeft||0,r+=e.offsetTop||0,a=e.offsetParent}for(a=t.parentNode;a&&a!==o&&a.nodeType&&!zs(a,o);)n-=a.scrollLeft||0,r-=a.scrollTop||0,a=a.parentNode;r+=(e=>Ps.isFirefox()&&"table"===jt(e)?Fs(Lo(e)).filter((e=>"caption"===jt(e))).bind((e=>Fs(Bo(e)).map((t=>{const o=t.dom.offsetTop,n=e.dom.offsetTop,r=e.dom.offsetHeight;return o<=n?-r:0})))).getOr(0):0)(yo.fromDom(t))}return{x:n,y:r}},Zs=(e,t={})=>{let o=0;const n={},r=yo.fromDom(e),s=Eo(r),a=e=>{bn(jo(r),e)},i=e=>{const t=jo(r);tn(t,"#"+e).each(Cn)},l=e=>ke(n,e).getOrThunk((()=>({id:"mce-u"+o++,passed:[],failed:[],count:0}))),c=e=>new Promise(((o,r)=>{let i;const c=Bt._addCacheSuffix(e),d=l(c);n[c]=d,d.count++;const m=(e,t)=>{q(e,H),d.status=t,d.passed=[],d.failed=[],i&&(i.onload=null,i.onerror=null,i=null)},u=()=>m(d.passed,2),g=()=>m(d.failed,3);if(o&&d.passed.push(o),r&&d.failed.push(r),1===d.status)return;if(2===d.status)return void u();if(3===d.status)return void g();d.status=1;const h=yo.fromTag("link",s.dom);to(h,{rel:"stylesheet",type:"text/css",id:d.id}),t.contentCssCors&&eo(h,"crossOrigin","anonymous"),t.referrerPolicy&&eo(h,"referrerpolicy",t.referrerPolicy),i=h.dom,i.onload=u,i.onerror=g,a(h),eo(h,"href",c)})),d=e=>{const t=Bt._addCacheSuffix(e);ke(n,t).each((e=>{0==--e.count&&(delete n[t],i(e.id))}))};return{load:c,loadRawCss:(e,t)=>{const o=l(e);n[e]=o,o.count++;const r=yo.fromTag("style",s.dom);to(r,{rel:"stylesheet",type:"text/css",id:o.id}),r.dom.innerHTML=t,a(r)},loadAll:e=>Promise.allSettled($(e,(e=>c(e).then(D(e))))).then((e=>{const t=K(e,(e=>"fulfilled"===e.status));return t.fail.length>0?Promise.reject($(t.fail,(e=>e.reason))):$(t.pass,(e=>e.value))})),unload:d,unloadRawCss:e=>{ke(n,e).each((t=>{0==--t.count&&(delete n[e],i(t.id))}))},unloadAll:e=>{q(e,(e=>{d(e)}))},_setReferrerPolicy:e=>{t.referrerPolicy=e},_setContentCssCors:e=>{t.contentCssCors=e}}},Us=(()=>{const e=new WeakMap;return{forElement:(t,o)=>{const n=Uo(t).dom;return F.from(e.get(n)).getOrThunk((()=>{const t=Zs(n,o);return e.set(n,t),t}))}}})(),js=(e,t,o)=>C(e)&&(us(e,t)||o.isInline(e.nodeName.toLowerCase())),Ws=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),$s=(e,t,o)=>tr(e)&&e.data.length>0&&((e,t,o)=>{const n=new Zn(e,t).prev(!1),r=new Zn(e,t).next(!1),s=w(n)||js(n,t,o),a=w(r)||js(r,t,o);return s&&a})(e,t,o),qs=(e,t,o,n)=>{var r;const s=n||t;if(Wn(t)&&Ws(t))return t;const a=t.childNodes;for(let t=a.length-1;t>=0;t--)qs(e,a[t],o,s);if(Wn(t)){const e=t.childNodes;1===e.length&&Ws(e[0])&&(null===(r=t.parentNode)||void 0===r||r.insertBefore(e[0],t))}return(e=>ar(e)||sr(e))(t)||us(t,s)||(e=>!!Wn(e)&&e.childNodes.length>0)(t)||$s(t,s,o)||e.remove(t),t},Gs=Bt.makeMap,Ks=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ys=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xs=/[<>&\"\']/g,Js=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,Qs={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},ea={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},ta={"<":"<",">":">","&":"&",""":'"',"'":"'"},oa=(e,t)=>{const o={};if(e){const n=e.split(",");t=t||10;for(let e=0;ee.replace(t?Ks:Ys,(e=>ea[e]||e)),sa=(e,t)=>e.replace(t?Ks:Ys,(e=>e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":ea[e]||"&#"+e.charCodeAt(0)+";")),aa=(e,t,o)=>{const n=o||na;return e.replace(t?Ks:Ys,(e=>ea[e]||n[e]||e))},ia={encodeRaw:ra,encodeAllRaw:e=>(""+e).replace(Xs,(e=>ea[e]||e)),encodeNumeric:sa,encodeNamed:aa,getEncodeFunc:(e,t)=>{const o=oa(t)||na,n=(e,t)=>e.replace(t?Ks:Ys,(e=>void 0!==ea[e]?ea[e]:void 0!==o[e]?o[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";")),r=(e,t)=>aa(e,t,o),s=Gs(e.replace(/\+/g,","));return s.named&&s.numeric?n:s.named?t?r:aa:s.numeric?sa:ra},decode:e=>e.replace(Js,((e,t)=>t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):Qs[t]||String.fromCharCode(t):ta[e]||na[e]||(e=>{const t=yo.fromTag("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e)))},la=(e,t)=>(e=Bt.trim(e))?e.split(t||" "):[],ca=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),da=(e,t)=>{const o=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return ne(la(t,","),(t=>{const n=o.exec(t);if(n){const t=n[1],o=n[2],r=n[3],s=n[4],a=n[5],i={attributes:{},attributesOrder:[]};if(e.each((e=>((e,t)=>{fe(e.attributes,((e,o)=>{t.attributes[o]=e})),t.attributesOrder.push(...e.attributesOrder)})(e,i))),"#"===t?i.paddEmpty=!0:"-"===t&&(i.removeEmpty=!0),"!"===s&&(i.removeEmptyAttrs=!0),a&&((e,t)=>{const o=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,n=/[*?+]/,{attributes:r,attributesOrder:s}=t;q(la(e,"|"),(e=>{const a=o.exec(e);if(a){const e={},o=a[1],i=a[2].replace(/[\\:]:/g,":"),l=a[3],c=a[4];if("!"===o&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(i),e.required=!0),"-"===o)return delete r[i],void s.splice(Bt.inArray(s,i),1);if(l&&("="===l?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:i,value:c}),e.defaultValue=c):"~"===l?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:i,value:c}),e.forcedValue=c):"<"===l&&(e.validValues=Bt.makeMap(c,"?"))),n.test(i)){const o=e;t.attributePatterns=t.attributePatterns||[],o.pattern=ca(i),t.attributePatterns.push(o)}else r[i]||s.push(i),r[i]=e}}))})(a,i),r&&(i.outputName=o),"@"===o){if(!e.isNone())return[];e=F.some(i)}return[r?{name:o,element:i,aliasName:r}:{name:o,element:i}]}return[]}))},ma={},ua=Bt.makeMap,ga=Bt.each,ha=Bt.extend,pa=Bt.explode,fa=(e,t={})=>{const o=ua(e," ",ua(e.toUpperCase()," "));return ha(o,t)},va=e=>fa("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),ba=(e,t)=>{if(e){const o={};return h(e)&&(e={"*":e}),ga(e,((e,n)=>{o[n]=o[n.toUpperCase()]="map"===t?ua(e,/[, ]/):pa(e,/[, ]/)})),o}},ya=(e={})=>{var t;const o={},n={};let r=[];const s={},a={},i=(t,o,n)=>{const r=e[t];if(r)return ua(r,/[, ]/,ua(r.toUpperCase(),/[, ]/));{let e=ma[t];return e||(e=fa(o,n),ma[t]=e),e}},l=null!==(t=e.schema)&&void 0!==t?t:"html5",c=(e=>{const{globalAttributes:t,phrasingContent:o,flowContent:n}=(e=>{let t,o,n;t="id accesskey class dir lang style tabindex title role",o="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",n="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(t+=" contenteditable contextmenu draggable dropzone hidden spellcheck translate",o+=" article aside details dialog figure main header footer hgroup section nav a ins del canvas map",n+=" audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),"html5-strict"!==e&&(t+=" xml:lang",n=[n,"acronym applet basefont big font strike tt"].join(" "),o=[o,"center dir isindex noframes"].join(" "));const r=[o,n].join(" ");return{globalAttributes:t,blockContent:o,phrasingContent:n,flowContent:r}})(e),r={},s=(e,t,o)=>{r[e]={attributes:ie(t,D({})),attributesOrder:t,children:ie(o,D({}))}},a=(e,o="",n="")=>{const r=la(n),a=la(e);let i=a.length;const l=la([t,o].join(" "));for(;i--;)s(a[i],l.slice(),r)},i=(e,t)=>{const o=la(e),n=la(t);let s=o.length;for(;s--;){const e=r[o[s]];for(let t=0,o=n.length;t{a(e,"",o)})),q(la("center dir isindex noframes"),(e=>{a(e,"",n)}))),a("html","manifest","head body"),a("head","","base command link meta noscript script style title"),a("title hr noscript br"),a("base","href target"),a("link","href rel media hreflang type sizes hreflang"),a("meta","name http-equiv content charset"),a("style","media type scoped"),a("script","src async defer type charset"),a("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",n),a("dd div","",n),a("address dt caption","","html4"===e?o:n),a("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",o),a("blockquote","cite",n),a("ol","reversed start type","li"),a("ul","","li"),a("li","value",n),a("dl","","dt dd"),a("a","href target rel media hreflang type","html4"===e?o:n),a("q","cite",o),a("ins del","cite datetime",n),a("img","src sizes srcset alt usemap ismap width height"),a("iframe","src name width height",n),a("embed","src type width height"),a("object","data type typemustmatch name usemap form width height",[n,"param"].join(" ")),a("param","name value"),a("map","name",[n,"area"].join(" ")),a("area","alt coords shape href target rel media hreflang type"),a("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),a("colgroup","span","col"),a("col","span"),a("tbody thead tfoot","","tr"),a("tr","","td th"),a("td","colspan rowspan headers",n),a("th","colspan rowspan headers scope abbr",n),a("form","accept-charset action autocomplete enctype method name novalidate target",n),a("fieldset","disabled form name",[n,"legend"].join(" ")),a("label","form for",o),a("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),a("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?n:o),a("select","disabled form multiple name required size","option optgroup"),a("optgroup","disabled label","option"),a("option","disabled label selected value"),a("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),a("menu","type label",[n,"li"].join(" ")),a("noscript","",n),"html4"!==e&&(a("wbr"),a("ruby","",[o,"rt rp"].join(" ")),a("figcaption","",n),a("mark rt rp bdi","",o),a("summary","",[o,"h1 h2 h3 h4 h5 h6"].join(" ")),a("canvas","width height",n),a("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[n,"track source"].join(" ")),a("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[n,"track source"].join(" ")),a("picture","","img source"),a("source","src srcset type media sizes"),a("track","kind src srclang label default"),a("datalist","",[o,"option"].join(" ")),a("article section nav aside main header footer","",n),a("hgroup","","h1 h2 h3 h4 h5 h6"),a("figure","",[n,"figcaption"].join(" ")),a("time","datetime",o),a("dialog","open",n),a("command","type label icon disabled checked radiogroup command"),a("output","for form name",o),a("progress","value max",o),a("meter","value min max low high optimum",o),a("details","open",[n,"summary"].join(" ")),a("keygen","autofocus challenge disabled form keytype name"),s("svg","id tabindex lang xml:space class style x y width height viewBox preserveAspectRatio zoomAndPan transform".split(" "),[])),"html5-strict"!==e&&(i("script","language xml:space"),i("style","xml:space"),i("object","declare classid code codebase codetype archive standby align border hspace vspace"),i("embed","align name hspace vspace"),i("param","valuetype type"),i("a","charset name rev shape coords"),i("br","clear"),i("applet","codebase archive code object alt name width height align hspace vspace"),i("img","name longdesc align border hspace vspace"),i("iframe","longdesc frameborder marginwidth marginheight scrolling align"),i("font basefont","size color face"),i("input","usemap align"),i("select"),i("textarea"),i("h1 h2 h3 h4 h5 h6 div p legend caption","align"),i("ul","type compact"),i("li","type"),i("ol dl menu dir","compact"),i("pre","width xml:space"),i("hr","align noshade size width"),i("isindex","prompt"),i("table","summary width frame rules cellspacing cellpadding align bgcolor"),i("col","width align char charoff valign"),i("colgroup","width align char charoff valign"),i("thead","align char charoff valign"),i("tr","align char charoff valign bgcolor"),i("th","axis align char charoff valign nowrap bgcolor width height"),i("form","accept"),i("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),i("tfoot","align char charoff valign"),i("tbody","align char charoff valign"),i("area","nohref"),i("body","background bgcolor text link vlink alink")),"html4"!==e&&(i("input button select textarea","autofocus"),i("input textarea","placeholder"),i("a","download"),i("link script img","crossorigin"),i("img","loading"),i("iframe","sandbox seamless allow allowfullscreen loading")),"html4"!==e&&q([r.video,r.audio],(e=>{delete e.children.audio,delete e.children.video})),q(la("a form meter progress dfn"),(e=>{r[e]&&delete r[e].children[e]})),delete r.caption.children.table,delete r.script,r})(l);!1===e.verify_html&&(e.valid_elements="*[*]");const d=ba(e.valid_styles),m=ba(e.invalid_styles,"map"),u=ba(e.valid_classes,"map"),g=i("whitespace_elements","pre script noscript style textarea video audio iframe object code"),h=i("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),p=i("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),f=i("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),v="td th iframe video audio object script code",b=i("non_empty_elements",v+" pre svg",p),y=i("move_caret_before_on_enter_elements",v+" table",p),w="h1 h2 h3 h4 h5 h6",x=i("text_block_elements",w+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),C=i("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary html body multicol listing",x),S=i("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),k=i("transparent_elements","a ins del canvas map"),_=i("wrap_block_elements","pre "+w);ga("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),(e=>{a[e]=new RegExp("]*>","gi")}));const E=e=>{const t=F.from(o["@"]),n=/[*?+]/;q(da(t,null!=e?e:""),(({name:e,element:t,aliasName:s})=>{if(s&&(o[s]=t),n.test(e)){const o=t;o.pattern=ca(e),r.push(o)}else o[e]=t}))},T=e=>{r=[],q(he(o),(e=>{delete o[e]})),E(e)},O=e=>{delete ma.text_block_elements,delete ma.block_elements,q((e=>{const t=/^(~)?(.+)$/;return ne(la(e,","),(e=>{const o=t.exec(e);if(o){const e="~"===o[1];return[{inline:e,cloneName:e?"span":"div",name:o[2]}]}return[]}))})(null!=e?e:""),(({inline:e,name:t,cloneName:r})=>{if(n[t]=n[r],s[t]=r,b[t.toUpperCase()]={},b[t]={},e||(C[t.toUpperCase()]={},C[t]={}),!o[t]){let e=o[r];e=ha({},e),delete e.removeEmptyAttrs,delete e.removeEmpty,o[t]=e}fe(n,((e,o)=>{e[r]&&(n[o]=e=ha({},n[o]),e[t]=e[r])}))}))},A=e=>{q((e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;return ne(la(e,","),(e=>{const o=t.exec(e);if(o){const e=o[1],t=e?(e=>"-"===e?"remove":"add")(e):"replace";return[{operation:t,name:o[2],validChildren:la(o[3],"|")}]}return[]}))})(null!=e?e:""),(({operation:e,name:t,validChildren:o})=>{const r="replace"===e?{"#comment":{}}:n[t];q(o,(t=>{"remove"===e?delete r[t]:r[t]={}})),n[t]=r}))},M=e=>{const t=o[e];if(t)return t;let n=r.length;for(;n--;){const t=r[n];if(t.pattern.test(e))return t}};e.valid_elements?(T(e.valid_elements),ga(c,((e,t)=>{n[t]=e.children}))):(ga(c,((e,t)=>{o[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},n[t]=e.children})),ga(la("strong/b em/i"),(e=>{const t=la(e,"/");o[t[1]].outputName=t[0]})),ga(S,((t,n)=>{o[n]&&(e.padd_empty_block_inline_children&&(o[n].paddInEmptyBlock=!0),o[n].removeEmpty=!0)})),ga(la("ol ul blockquote a table tbody"),(e=>{o[e]&&(o[e].removeEmpty=!0)})),ga(la("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),(e=>{o[e]&&(o[e].paddEmpty=!0)})),ga(la("span"),(e=>{o[e].removeEmptyAttrs=!0}))),delete o.svg,O(e.custom_elements),A(e.valid_children),E(e.extended_valid_elements),A("+ol[ul|ol],+ul[ul|ol]"),ga({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},((e,t)=>{o[t]&&(o[t].parentsRequired=la(e))})),e.invalid_elements&&ga(pa(e.invalid_elements),(e=>{o[e]&&delete o[e]})),M("span")||E("span[!data-mce-type|*]");const N=D(d),R=D(m),B=D(u),L=D(f),H=D(C),I=D(x),P=D(S),z=D(Object.seal(p)),V=D(h),Z=D(b),U=D(y),j=D(g),W=D(k),$=D(_),G=D(Object.seal(a)),K=(e,t)=>{const o=M(e);if(o){if(!t)return!0;{if(o.attributes[t])return!0;const e=o.attributePatterns;if(e){let o=e.length;for(;o--;)if(e[o].pattern.test(t))return!0}}}return!1},Y=e=>_e(H(),e),X=e=>!je(e,"#")&&K(e)&&!Y(e),J=D(s);return{type:l,children:n,elements:o,getValidStyles:N,getValidClasses:B,getBlockElements:H,getInvalidStyles:R,getVoidElements:z,getTextBlockElements:I,getTextInlineElements:P,getBoolAttrs:L,getElementRule:M,getSelfClosingElements:V,getNonEmptyElements:Z,getMoveCaretBeforeOnEnterElements:U,getWhitespaceElements:j,getTransparentElements:W,getSpecialElements:G,isValidChild:(e,t)=>{const o=n[e.toLowerCase()];return!(!o||!o[t.toLowerCase()])},isValid:K,isBlock:Y,isInline:X,isWrapper:e=>_e($(),e)||X(e),getCustomElements:J,addValidElements:E,setValidElements:T,addCustomElements:O,addValidChildren:A}},wa=e=>Ze(e,"#").toUpperCase(),xa=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Ca=e=>(e=>({value:wa(e)}))(xa(e.red)+xa(e.green)+xa(e.blue)),Sa=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,ka=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,_a=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),Ea=(e,t,o,n)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return _a(r,s,a,i)},Ta=e=>{if("transparent"===e)return F.some(_a(0,0,0,0));const t=Sa.exec(e);if(null!==t)return F.some(Ea(t[1],t[2],t[3],"1"));const o=ka.exec(e);return null!==o?F.some(Ea(o[1],o[2],o[3],o[4])):F.none()},Oa=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Da=e=>Ta(e).map(Ca).map((e=>"#"+e.value)).getOr(e),Aa=(e={},t)=>{const o=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,n=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/,s={};let a,i;const l=vr;t&&(a=t.getValidStyles(),i=t.getInvalidStyles());const c="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(let e=0;e{const a={};let i=!1;const c=e.url_converter,m=e.url_converter_scope||d,u=(e,t,o)=>{const n=a[e+"-top"+t];if(!n)return;const r=a[e+"-right"+t];if(!r)return;const s=a[e+"-bottom"+t];if(!s)return;const i=a[e+"-left"+t];if(!i)return;const l=[n,r,s,i];let c=l.length-1;for(;c--&&l[c]===l[c+1];);c>-1&&o||(a[e+t]=-1===c?l[0]:l.join(" "),delete a[e+"-top"+t],delete a[e+"-right"+t],delete a[e+"-bottom"+t],delete a[e+"-left"+t])},g=e=>{const t=a[e];if(!t)return;const o=t.indexOf(",")>-1?[t]:t.split(" ");let n=o.length;for(;n--;)if(o[n]!==o[0])return!1;return a[e]=o[0],!0},p=e=>(i=!0,s[e]),f=(e,t)=>(i&&(e=e.replace(/\uFEFF[0-9]/g,(e=>s[e]))),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),v=e=>String.fromCharCode(parseInt(e.slice(1),16)),b=e=>e.replace(/\\[0-9a-f]+/gi,v),y=(t,o,n,r,s,a)=>{if(s=s||a)return"'"+(s=f(s)).replace(/\'/g,"\\'")+"'";if(o=f(o||n||r||""),!e.allow_script_urls){const t=o.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(t))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(t))return""}return c&&(o=c.call(m,o,"style")),"url('"+o.replace(/\'/g,"\\'")+"')"};if(t){let s;for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,p).replace(/\"[^\"]+\"|\'[^\']+\'/g,(e=>e.replace(/[;:]/g,p)));s=n.exec(t);){n.lastIndex=s.index+s[0].length;let t=s[1].replace(r,"").toLowerCase(),c=s[2].replace(r,"");if(t&&c){if(t=b(t),c=b(c),-1!==t.indexOf(l)||-1!==t.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===t||/expression\s*\(|\/\*|\*\//.test(c)))continue;"font-weight"===t&&"700"===c?c="bold":"color"!==t&&"background-color"!==t||(c=c.toLowerCase()),h(e.force_hex_color)&&"off"!==e.force_hex_color&&Ta(c).each((t=>{"always"!==e.force_hex_color&&1!==t.alpha||(c=Da(Oa(t)))})),c=c.replace(o,y),a[t]=i?f(c,!0):c}}u("border","",!0),u("border","-width"),u("border","-color"),u("border","-style"),u("padding",""),u("margin",""),w="border",C="border-style",S="border-color",g(x="border-width")&&g(C)&&g(S)&&(a[w]=a[x]+" "+a[C]+" "+a[S],delete a[x],delete a[C],delete a[S]),"medium none"===a.border&&delete a.border,"none"===a["border-image"]&&delete a["border-image"]}var w,x,C,S;return a},serialize:(e,t)=>{let o="";const n=(t,n)=>{const r=n[t];if(r)for(let t=0,n=r.length;t0?" ":"")+n+": "+s+";")}};return t&&a?(n("*",a),n(t,a)):fe(e,((e,n)=>{e&&((e,t)=>{if(!i||!t)return!0;let o=i["*"];return!(o&&o[e]||(o=i[t],o&&o[e]))})(n,t)&&(o+=(o.length>0?" ":"")+n+": "+e+";")})),o}};return d},Ma={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},Na=e=>x(e.preventDefault)||(e=>e instanceof Event||S(e.initEvent))(e),Ra=(e,t)=>{const o=null!=t?t:{};for(const t in e)_e(Ma,t)||(o[t]=e[t]);return C(e.composedPath)&&(o.composedPath=()=>e.composedPath()),C(e.getModifierState)&&(o.getModifierState=t=>e.getModifierState(t)),C(e.getTargetRanges)&&(o.getTargetRanges=()=>e.getTargetRanges()),o},Ba=(e,t,o,n)=>{var r;const s=Ra(t,n);return s.type=e,x(s.target)&&(s.target=null!==(r=s.srcElement)&&void 0!==r?r:o),Na(t)&&(s.preventDefault=()=>{s.defaultPrevented=!0,s.isDefaultPrevented=P,S(t.preventDefault)&&t.preventDefault()},s.stopPropagation=()=>{s.cancelBubble=!0,s.isPropagationStopped=P,S(t.stopPropagation)&&t.stopPropagation()},s.stopImmediatePropagation=()=>{s.isImmediatePropagationStopped=P,s.stopPropagation()},(e=>e.isDefaultPrevented===P||e.isDefaultPrevented===I)(s)||(s.isDefaultPrevented=!0===s.defaultPrevented?P:I,s.isPropagationStopped=!0===s.cancelBubble?P:I,s.isImmediatePropagationStopped=I)),s},La=/^(?:mouse|contextmenu)|click/,Ha=(e,t,o,n)=>{e.addEventListener(t,o,n||!1)},Ia=(e,t,o,n)=>{e.removeEventListener(t,o,n||!1)},Pa=(e,t)=>{const o=Ba(e.type,e,document,t);if((e=>C(e)&&La.test(e.type))(e)&&w(e.pageX)&&!w(e.clientX)){const t=o.target.ownerDocument||document,n=t.documentElement,r=t.body,s=o;s.pageX=e.clientX+(n&&n.scrollLeft||r&&r.scrollLeft||0)-(n&&n.clientLeft||r&&r.clientLeft||0),s.pageY=e.clientY+(n&&n.scrollTop||r&&r.scrollTop||0)-(n&&n.clientTop||r&&r.clientTop||0)}return o},Fa=(e,t,o)=>{const n=e.document,r={type:"ready"};if(o.domLoaded)return void t(r);const s=()=>{Ia(e,"DOMContentLoaded",s),Ia(e,"load",s),o.domLoaded||(o.domLoaded=!0,t(r)),e=null};"complete"===n.readyState||"interactive"===n.readyState&&n.body?s():Ha(e,"DOMContentLoaded",s),o.domLoaded||Ha(e,"load",s)};class za{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando="mce-data-"+(+new Date).toString(32),this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(e,t,o,n){const r=this;let s;const a=window,i=e=>{r.executeHandlers(Pa(e||a.event),l)};if(!e||tr(e)||rr(e))return o;let l;e[r.expando]?l=e[r.expando]:(l=r.count++,e[r.expando]=l,r.events[l]={}),n=n||e;const c=t.split(" ");let d=c.length;for(;d--;){let t=c[d],m=i,u=!1,g=!1;"DOMContentLoaded"===t&&(t="ready"),r.domLoaded&&"ready"===t&&"complete"===e.readyState?o.call(n,Pa({type:t})):(r.hasFocusIn||"focusin"!==t&&"focusout"!==t||(u=!0,g="focusin"===t?"focus":"blur",m=e=>{const t=Pa(e||a.event);t.type="focus"===t.type?"focusin":"focusout",r.executeHandlers(t,l)}),s=r.events[l][t],s?"ready"===t&&r.domLoaded?o(Pa({type:t})):s.push({func:o,scope:n}):(r.events[l][t]=s=[{func:o,scope:n}],s.fakeName=g,s.capture=u,s.nativeHandler=m,"ready"===t?Fa(e,m,r):Ha(e,g||t,m,u)))}return e=s=null,o}unbind(e,t,o){if(!e||tr(e)||rr(e))return this;const n=e[this.expando];if(n){let r=this.events[n];if(t){const n=t.split(" ");let s=n.length;for(;s--;){const t=n[s],a=r[t];if(a){if(o){let e=a.length;for(;e--;)if(a[e].func===o){const o=a.nativeHandler,n=a.fakeName,s=a.capture,i=a.slice(0,e).concat(a.slice(e+1));i.nativeHandler=o,i.fakeName=n,i.capture=s,r[t]=i}}o&&0!==a.length||(delete r[t],Ia(e,a.fakeName||t,a.nativeHandler,a.capture))}}}else fe(r,((t,o)=>{Ia(e,t.fakeName||o,t.nativeHandler,t.capture)})),r={};for(const e in r)if(_e(r,e))return this;delete this.events[n];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,o){return this.dispatch(e,t,o)}dispatch(e,t,o){if(!e||tr(e)||rr(e))return this;const n=Pa({type:t,target:e},o);do{const t=e[this.expando];t&&this.executeHandlers(n,t),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!n.isPropagationStopped());return this}clean(e){if(!e||tr(e)||rr(e))return this;if(e[this.expando]&&this.unbind(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName){this.unbind(e);const t=e.getElementsByTagName("*");let o=t.length;for(;o--;)(e=t[o])[this.expando]&&this.unbind(e)}return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const o=this.events[t],n=o&&o[e.type];if(n)for(let t=0,o=n.length;t{x(o)||""===o?so(e,t):eo(e,t,o)},$a=e=>e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),qa=(e,t)=>{let o=0;if(e)for(let n=e.nodeType,r=e.previousSibling;r;r=r.previousSibling){const e=r.nodeType;(!t||!tr(r)||e!==n&&r.data.length)&&(o++,n=e)}return o},Ga=(e,t)=>{const o=oo(t,"style"),n=e.serialize(e.parse(o),jt(t));Wa(t,Ua,n)},Ka=(e,t,o)=>{const n=$a(t);x(o)||""===o?hn(e,n):ln(e,n,((e,t)=>k(e)?_e(ja,t)?e+"":e+"px":e)(o,n))},Ya=(e,t={})=>{const o={},n=window,r={};let s=0;const a=Us.forElement(yo.fromDom(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),i=[],l=t.schema?t.schema:ya({}),c=Aa({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope,force_hex_color:t.force_hex_color},t.schema),d=t.ownEvents?new za:za.Event,m=l.getBlockElements(),u=t=>t&&e&&h(t)?e.getElementById(t):t,g=e=>{const t=u(e);return C(t)?yo.fromDom(t):null},p=(e,t,o="")=>{let n;const r=g(e);if(C(r)&&Gt(r)){const e=G[t];n=e&&e.get?e.get(r.dom,t):oo(r,t)}return C(n)?n:o},f=e=>{const t=u(e);return x(t)?[]:t.attributes},b=(e,o,n)=>{M(e,(e=>{if(Wn(e)){const r=yo.fromDom(e),s=""===n?null:n,a=oo(r,o),i=G[o];i&&i.set?i.set(r.dom,s,o):Wa(r,o,s),a!==s&&t.onSetAttrib&&t.onSetAttrib({attrElm:r.dom,attrName:o,attrValue:s})}}))},y=()=>t.root_element||e.body,w=(t,o)=>Vs(e.body,u(t),o),k=(e,t,o)=>{const n=u(e);var r;if(!x(n)&&($n(n)||Wn(r=n)&&"http://www.w3.org/2000/svg"===r.namespaceURI))return o?dn(yo.fromDom(n),$a(t)):("float"===(t=t.replace(/-(\D)/g,((e,t)=>t.toUpperCase())))&&(t="cssFloat"),n.style?n.style[t]:void 0)},_=e=>{const t=u(e);if(!t)return{w:0,h:0};let o=k(t,"width"),n=k(t,"height");return o&&-1!==o.indexOf("px")||(o="0"),n&&-1!==n.indexOf("px")||(n="0"),{w:parseInt(o,10)||t.offsetWidth||t.clientWidth,h:parseInt(n,10)||t.offsetHeight||t.clientHeight}},T=(e,t)=>{if(!e)return!1;const o=v(e)?e:[e];return W(o,(e=>xo(yo.fromDom(e),t)))},O=(e,t,o,n)=>{const r=[];let s=u(e);n=void 0===n;const a=o||("BODY"!==y().nodeName?y().parentNode:null);if(h(t))if("*"===t)t=Wn;else{const e=t;t=t=>T(t,e)}for(;s&&!(s===a||x(s.nodeType)||sr(s)||ar(s));){if(!t||t(s)){if(!n)return[s];r.push(s)}s=s.parentNode}return n?r:null},A=(e,t,o)=>{let n=t;if(e){h(t)&&(n=e=>T(e,t));for(let t=e[o];t;t=t[o])if(S(n)&&n(t))return t}return null},M=function(e,t,o){const n=null!=o?o:this;if(v(e)){const o=[];return Va(e,((e,r)=>{const s=u(e);s&&o.push(t.call(n,s,r))})),o}{const o=u(e);return!!o&&t.call(n,o)}},N=(e,t)=>{M(e,(e=>{fe(t,((t,o)=>{b(e,o,t)}))}))},R=(e,t)=>{M(e,(e=>{const o=yo.fromDom(e);En(o,t)}))},B=(t,o,n,r,s)=>M(t,(t=>{const a=h(o)?e.createElement(o):o;return C(n)&&N(a,n),r&&(!h(r)&&r.nodeType?a.appendChild(r):h(r)&&R(a,r)),s?a:t.appendChild(a)})),L=(t,o,n)=>B(e.createElement(t),t,o,n,!0),H=ia.encodeAllRaw,I=(e,t)=>M(e,(e=>{const o=yo.fromDom(e);return t&&q(Lo(o),(e=>{Kt(e)&&0===e.dom.length?Cn(e):pn(o,e)})),Cn(o),o.dom})),P=(e,t,o)=>{M(e,(e=>{if(Wn(e)){const n=yo.fromDom(e),r=t.split(" ");q(r,(e=>{C(o)?(o?go:po)(n,e):fo(n,e)}))}}))},F=(e,t,o)=>M(t,(n=>{var r;const s=v(t)?e.cloneNode(!0):e;return o&&Va(Za(n.childNodes),(e=>{s.appendChild(e)})),null===(r=n.parentNode)||void 0===r||r.replaceChild(s,n),n})),z=e=>{if(Wn(e)){const t="a"===e.nodeName.toLowerCase()&&!p(e,"href")&&p(e,"id");if(p(e,"name")||p(e,"data-mce-bookmark")||t)return!0}return!1},V=()=>e.createRange(),Z=(o,r,s,a)=>{if(v(o)){let e=o.length;const t=[];for(;e--;)t[e]=Z(o[e],r,s,a);return t}return!t.collect||o!==e&&o!==n||i.push([o,r,s,a]),d.bind(o,r,s,a||$)},U=(t,o,r)=>{if(v(t)){let e=t.length;const n=[];for(;e--;)n[e]=U(t[e],o,r);return n}if(i.length>0&&(t===e||t===n)){let e=i.length;for(;e--;){const[n,s,a]=i[e];t!==n||o&&o!==s||r&&r!==a||d.unbind(n,s,a)}}return d.unbind(t,o,r)},j=e=>{if(e&&$n(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},$={doc:e,settings:t,win:n,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:a,boundEvents:i,styles:c,schema:l,events:d,isBlock:e=>h(e)?_e(m,e):Wn(e)&&(_e(m,e.nodeName)||Ls(l,e)),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:y,getViewPort:e=>{const t=Pn(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=u(e),o=w(t),n=_(t);return{x:o.x,y:o.y,w:n.w,h:n.h}},getSize:_,getParent:(e,t,o)=>{const n=O(e,t,o,!1);return n&&n.length>0?n[0]:null},getParents:O,get:u,getNext:(e,t)=>A(e,t,"nextSibling"),getPrev:(e,t)=>A(e,t,"previousSibling"),select:(o,n)=>{var r,s;const a=null!==(s=null!==(r=u(n))&&void 0!==r?r:t.root_element)&&void 0!==s?s:e;return S(a.querySelectorAll)?ue(a.querySelectorAll(o)):[]},is:T,add:B,create:L,createHTML:(e,t,o="")=>{let n="<"+e;for(const e in t)Ee(t,e)&&(n+=" "+e+'="'+H(t[e])+'"');return Xe(o)&&_e(l.getVoidElements(),e)?n+" />":n+">"+o+""},createFragment:t=>{const o=e.createElement("div"),n=e.createDocumentFragment();let r;for(n.appendChild(o),t&&(o.innerHTML=t);r=o.firstChild;)n.appendChild(r);return n.removeChild(o),n},remove:I,setStyle:(e,o,n)=>{M(e,(e=>{const r=yo.fromDom(e);Ka(r,o,n),t.update_styles&&Ga(c,r)}))},getStyle:k,setStyles:(e,o)=>{M(e,(e=>{const n=yo.fromDom(e);fe(o,((e,t)=>{Ka(n,t,e)})),t.update_styles&&Ga(c,n)}))},removeAllAttribs:e=>M(e,(e=>{const t=e.attributes;for(let o=t.length-1;o>=0;o--)e.removeAttributeNode(t.item(o))})),setAttrib:b,setAttribs:N,getAttrib:p,getPos:w,parseStyle:e=>c.parse(e),serializeStyle:(e,t)=>c.serialize(e,t),addStyle:t=>{if($!==Ya.DOM&&e===document){if(o[t])return;o[t]=!0}let n=e.getElementById("mceDefaultStyles");if(!n){n=e.createElement("style"),n.id="mceDefaultStyles",n.type="text/css";const t=e.head;t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),q(e.split(","),(e=>{r[e]=!0,a.load(e).catch(E)}))},addClass:(e,t)=>{P(e,t,!0)},removeClass:(e,t)=>{P(e,t,!1)},hasClass:(e,t)=>{const o=g(e),n=t.split(" ");return C(o)&&re(n,(e=>vo(o,e)))},toggleClass:P,show:e=>{M(e,(e=>hn(yo.fromDom(e),"display")))},hide:e=>{M(e,(e=>ln(yo.fromDom(e),"display","none")))},isHidden:e=>{const t=g(e);return C(t)&&Lt(un(t,"display"),"none")},uniqueId:e=>(e||"mce_")+s++,setHTML:R,getOuterHTML:e=>{const t=g(e);return C(t)?Wn(t.dom)?t.dom.outerHTML:(e=>{const t=yo.fromTag("div"),o=yo.fromDom(e.dom.cloneNode(!0));return bn(t,o),_n(t)})(t):""},setOuterHTML:(e,t)=>{M(e,(e=>{Wn(e)&&(e.outerHTML=t)}))},decode:ia.decode,encode:H,insertAfter:(e,t)=>{const o=u(t);return M(e,(e=>{const t=null==o?void 0:o.parentNode,n=null==o?void 0:o.nextSibling;return t&&(n?t.insertBefore(e,n):t.appendChild(e)),e}))},replace:F,rename:(e,t)=>{if(e.nodeName!==t.toUpperCase()){const o=L(t);return Va(f(e),(t=>{b(o,t.nodeName,p(e,t.nodeName))})),F(o,e,!0),o}return e},findCommonAncestor:(e,t)=>{let o=e;for(;o;){let e=t;for(;e&&o!==e;)e=e.parentNode;if(o===e)break;o=o.parentNode}return!o&&e.ownerDocument?e.ownerDocument.documentElement:o},run:M,getAttribs:f,isEmpty:(e,t,o)=>{let n=0;if(z(e))return!1;const r=e.firstChild;if(r){const s=new Zn(r,e),a=l?l.getWhitespaceElements():{},i=t||(l?l.getNonEmptyElements():null);let c=r;do{if(Wn(c)){const e=c.getAttribute("data-mce-bogus");if(e){c=s.next("all"===e);continue}const t=c.nodeName.toLowerCase();if(i&&i[t]){if("br"===t){n++,c=s.next();continue}return!1}if(z(c))return!1}if(rr(c))return!1;if(tr(c)&&!is(c.data)&&(!(null==o?void 0:o.includeZwsp)||!ls(c.data)))return!1;if(tr(c)&&c.parentNode&&a[c.parentNode.nodeName]&&is(c.data))return!1;c=s.next()}while(c)}return n<=1},createRng:V,nodeIndex:qa,split:(e,t,o)=>{let n,r,s=V();if(e&&t&&e.parentNode&&t.parentNode){const a=e.parentNode;return s.setStart(a,qa(e)),s.setEnd(t.parentNode,qa(t)),n=s.extractContents(),s=V(),s.setStart(t.parentNode,qa(t)+1),s.setEnd(a,qa(e)+1),r=s.extractContents(),a.insertBefore(qs($,n,l),e),o?a.insertBefore(o,e):a.insertBefore(t,e),a.insertBefore(qs($,r,l),e),I(e),o||t}},bind:Z,unbind:U,fire:(e,t,o)=>d.dispatch(e,t,o),dispatch:(e,t,o)=>d.dispatch(e,t,o),getContentEditable:j,getContentEditableParent:e=>{const t=y();let o=null;for(let n=e;n&&n!==t&&(o=j(n),null===o);n=n.parentNode);return o},isEditable:e=>{if(C(e)){const t=Wn(e)?e:e.parentElement;return C(t)&&$n(t)&&nn(yo.fromDom(t))}return!1},destroy:()=>{if(i.length>0){let e=i.length;for(;e--;){const[t,o,n]=i[e];d.unbind(t,o,n)}}fe(r,((e,t)=>{a.unload(t),delete r[t]}))},isChildOf:(e,t)=>e===t||t.contains(e),dumpRng:e=>"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},G=((e,t,o)=>{const n=t.keep_values,r={set:(e,n,r)=>{const s=yo.fromDom(e);S(t.url_converter)&&C(n)&&(n=t.url_converter.call(t.url_converter_scope||o(),String(n),r,e)),Wa(s,"data-mce-"+r,n),Wa(s,r,n)},get:(e,t)=>{const o=yo.fromDom(e);return oo(o,"data-mce-"+t)||oo(o,t)}},s={style:{set:(t,o)=>{const r=yo.fromDom(t);n&&Wa(r,Ua,o),so(r,"style"),h(o)&&cn(r,e.parse(o))},get:t=>{const o=yo.fromDom(t),n=oo(o,Ua)||oo(o,"style");return e.serialize(e.parse(n),jt(o))}}};return n&&(s.href=s.src=r),s})(c,t,D($));return $};Ya.DOM=Ya(document),Ya.nodeIndex=qa;const Xa=Ya.DOM;class Ja{constructor(e={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=e}_setReferrerPolicy(e){this.settings.referrerPolicy=e}loadScript(e){return new Promise(((t,o)=>{const n=Xa;let r;const s=()=>{n.remove(a),r&&(r.onerror=r.onload=r=null)},a=n.uniqueId();r=document.createElement("script"),r.id=a,r.type="text/javascript",r.src=Bt._addCacheSuffix(e),this.settings.referrerPolicy&&n.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{s(),t()},r.onerror=()=>{s(),o("Failed to load script: "+e)},(document.getElementsByTagName("head")[0]||document.body).appendChild(r)}))}isDone(e){return 2===this.states[e]}markDone(e){this.states[e]=2}add(e){const t=this;return t.queue.push(e),void 0===t.states[e]&&(t.states[e]=0),new Promise(((o,n)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:o,reject:n})}))}load(e){return this.add(e)}remove(e){delete this.states[e],delete this.scriptLoadedCallbacks[e]}loadQueue(){const e=this.queue;return this.queue=[],this.loadScripts(e)}loadScripts(e){const t=this,o=(e,o)=>{ke(t.scriptLoadedCallbacks,o).each((t=>{q(t,(t=>t[e](o)))})),delete t.scriptLoadedCallbacks[o]},n=e=>{const t=Y(e,(e=>"rejected"===e.status));return t.length>0?Promise.reject(ne(t,(({reason:e})=>v(e)?e:[e]))):Promise.resolve()},r=e=>Promise.allSettled($(e,(e=>2===t.states[e]?(o("resolve",e),Promise.resolve()):3===t.states[e]?(o("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then((()=>{t.states[e]=2,o("resolve",e);const s=t.queue;return s.length>0?(t.queue=[],r(s).then(n)):Promise.resolve()}),(()=>(t.states[e]=3,o("reject",e),Promise.reject(e)))))))),s=e=>(t.loading=!0,r(e).then((e=>{t.loading=!1;const o=t.queueLoadedCallbacks.shift();return F.from(o).each(H),n(e)}))),a=Te(e);return t.loading?new Promise(((e,o)=>{t.queueLoadedCallbacks.push((()=>{s(a).then(e,o)}))})):s(a)}}Ja.ScriptLoader=new Ja;const Qa=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},ei={},ti=Qa("en"),oi=()=>ke(ei,ti.get()),ni={getData:()=>ve(ei,(e=>({...e}))),setCode:e=>{e&&ti.set(e)},getCode:()=>ti.get(),add:(e,t)=>{let o=ei[e];o||(ei[e]=o={});const n=$(he(t),(e=>e.toLowerCase()));fe(t,((e,r)=>{const s=r.toLowerCase();s!==r&&((e,t)=>{const o=e.indexOf(t);return-1!==o&&e.indexOf(t,o+1)>o})(n,s)?(_e(t,s)||(o[s]=e),o[r]=e):o[s]=e}))},translate:e=>{const t=oi().getOr({}),o=e=>S(e)?Object.prototype.toString.call(e):n(e)?"":""+e,n=e=>""===e||null==e,r=e=>{const n=o(e);return _e(t,n)?o(t[n]):ke(t,n.toLowerCase()).map(o).getOr(n)},s=e=>e.replace(/{context:\w+}$/,"");if(n(e))return"";if(p(a=e)&&_e(a,"raw"))return o(e.raw);var a;if((e=>v(e)&&e.length>1)(e)){const t=e.slice(1);return s(r(e[0]).replace(/\{([0-9]+)\}/g,((e,n)=>_e(t,n)?o(t[n]):e)))}return s(r(e))},isRtl:()=>oi().bind((e=>ke(e,"_dir"))).exists((e=>"rtl"===e)),hasCode:e=>_e(ei,e)},ri=()=>{const e=[],t={},o={},n=[],r=(e,t)=>{const o=Y(n,(o=>o.name===e&&o.state===t));q(o,(e=>e.resolve()))},s=e=>_e(t,e),a=(e,o)=>{const n=ni.getCode();!n||o&&-1===(","+(o||"")+",").indexOf(","+n+",")||Ja.ScriptLoader.add(t[e]+"/langs/"+n+".js")},i=(e,t="added")=>"added"===t&&(e=>_e(o,e))(e)||"loaded"===t&&s(e)?Promise.resolve():new Promise((o=>{n.push({name:e,state:t,resolve:o})}));return{items:e,urls:t,lookup:o,get:e=>{if(o[e])return o[e].instance},requireLangPack:(e,t)=>{!1!==ri.languageLoad&&(s(e)?a(e,t):i(e,"loaded").then((()=>a(e,t))))},add:(t,n)=>(e.push(n),o[t]={instance:n},r(t,"added"),n),remove:e=>{delete t[e],delete o[e]},createUrl:(e,t)=>h(t)?h(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,n)=>{if(t[e])return Promise.resolve();let s=h(n)?n:n.prefix+n.resource+n.suffix;0!==s.indexOf("/")&&-1===s.indexOf("://")&&(s=ri.baseURL+"/"+s),t[e]=s.substring(0,s.lastIndexOf("/"));const a=()=>(r(e,"loaded"),Promise.resolve());return o[e]?a():Ja.ScriptLoader.add(s).then(a)},waitFor:i}};ri.languageLoad=!0,ri.baseURL="",ri.PluginManager=ri(),ri.ThemeManager=ri(),ri.ModelManager=ri();const si=e=>{const t=Qa(F.none()),o=()=>t.get().each((e=>clearInterval(e)));return{clear:()=>{o(),t.set(F.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:n=>{o(),t.set(F.some(setInterval(n,e)))}}},ai=()=>{const e=(e=>{const t=Qa(F.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(F.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(F.some(e))}}})(E);return{...e,on:t=>e.get().each(t)}},ii=(e,t)=>{let o=null;return{cancel:()=>{b(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{b(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}},li=(e,t)=>{let o=null;const n=()=>{b(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}},ci=D("mce-annotation"),di=D("data-mce-annotation"),mi=D("data-mce-annotation-uid"),ui=D("data-mce-annotation-active"),gi=D("data-mce-annotation-classes"),hi=D("data-mce-annotation-attrs"),pi=e=>t=>So(t,e),fi=(e,t)=>{const o=e.selection.getRng(),n=yo.fromDom(o.startContainer),r=yo.fromDom(e.getBody()),s=t.fold((()=>"."+ci()),(e=>`[${di()}="${e}"]`)),a=Ho(n,o.startOffset).getOr(n);return on(a,s,pi(r)).bind((t=>no(t,`${mi()}`).bind((o=>no(t,`${di()}`).map((t=>{const n=bi(e,o);return{uid:o,name:t,elements:n}}))))))},vi=(e,t)=>ro(e,"data-mce-bogus")||Vn(e,'[data-mce-bogus="all"]',pi(t)),bi=(e,t)=>{const o=yo.fromDom(e.getBody()),n=zn(o,`[${mi()}="${t}"]`);return Y(n,(e=>!vi(e,o)))},yi=(e,t)=>{const o=yo.fromDom(e.getBody()),n=zn(o,`[${di()}="${t}"]`),r={};return q(n,(e=>{if(!vi(e,o)){const t=oo(e,mi()),o=ke(r,t).getOr([]);r[t]=o.concat([e])}})),r},wi=(e,t)=>{const o=Qa({}),n=()=>({listeners:[],previous:ai()}),r=(e,t)=>{s(e,(e=>(t(e),e)))},s=(e,t)=>{const r=o.get(),s=t(ke(r,e).getOrThunk(n));r[e]=s,o.set(r)},a=(t,o)=>{q(bi(e,t),(e=>{o?eo(e,ui(),"true"):so(e,ui())}))},i=li((()=>{const o=le(t.getNames());q(o,(t=>{s(t,(o=>{const n=o.previous.get();return fi(e,F.some(t)).fold((()=>{n.each((e=>{(e=>{r(e,(t=>{q(t.listeners,(t=>t(!1,e)))}))})(t),o.previous.clear(),a(e,!1)}))}),(({uid:e,name:t,elements:s})=>{Lt(n,e)||(n.each((e=>a(e,!1))),((e,t,o)=>{r(e,(n=>{q(n.listeners,(n=>n(!0,e,{uid:t,nodes:$(o,(e=>e.dom))})))}))})(t,e,s),o.previous.set(e),a(e,!0))})),{previous:o.previous,listeners:o.listeners}}))}))}),30);return e.on("remove",(()=>{i.cancel()})),e.on("NodeChange",(()=>{i.throttle()})),{addListener:(e,t)=>{s(e,(e=>({previous:e.previous,listeners:e.listeners.concat([t])})))}}};let xi=0;const Ci=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return xi++,e+"_"+o+xi+String(t)},Si=(e,t)=>yo.fromDom(e.dom.cloneNode(t)),ki=e=>Si(e,!1),_i=e=>Si(e,!0),Ei=(e,t)=>{const o=((e,t)=>{const o=yo.fromTag(t),n=ao(e);return to(o,n),o})(e,t);fn(e,o);const n=Lo(e);return wn(o,n),Cn(e),o},Ti=(e,t,o=I)=>{const n=new Zn(e,t),r=e=>{let t;do{t=n[e]()}while(t&&!tr(t)&&!o(t));return F.from(t).filter(tr)};return{current:()=>F.from(n.current()).filter(tr),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},Oi=(e,t)=>{const o=t||(t=>e.isBlock(t)||ir(t)||dr(t)),n=(e,t,o,r)=>{if(tr(e)){const o=r(e,t,e.data);if(-1!==o)return F.some({container:e,offset:o})}return o().bind((e=>n(e.container,e.offset,o,r)))};return{backwards:(t,r,s,a)=>{const i=Ti(t,null!=a?a:e.getRoot(),o);return n(t,r,(()=>i.prev().map((e=>({container:e,offset:e.length})))),s).getOrNull()},forwards:(t,r,s,a)=>{const i=Ti(t,null!=a?a:e.getRoot(),o);return n(t,r,(()=>i.next().map((e=>({container:e,offset:0})))),s).getOrNull()}}},Di=Math.round,Ai=e=>e?{left:Di(e.left),top:Di(e.top),bottom:Di(e.bottom),right:Di(e.right),width:Di(e.width),height:Di(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},Mi=(e,t)=>(e=Ai(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),Ni=(e,t,o)=>e>=0&&e<=Math.min(t.height,o.height)/2,Ri=(e,t)=>{const o=Math.min(t.height/2,e.height/2);return e.bottom-ot.bottom)&&Ni(t.top-e.bottom,e,t)},Bi=(e,t)=>e.top>t.bottom||!(e.bottom{const n=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(o,e.top+e.height),e.top);return Math.sqrt((t-n)*(t-n)+(o-r)*(o-r))},Hi=e=>{const t=e.startContainer,o=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===o+1?t.childNodes[o]:null},Ii=(e,t)=>{if(Wn(e)&&e.hasChildNodes()){const o=e.childNodes,n=((e,t,o)=>Math.min(Math.max(e,t),o))(t,0,o.length-1);return o[n]}return e},Pi=new RegExp("[̀-ͯ҃-҇҈-҉֑-ֽֿׁ-ׂׄ-ׇׅؐ-ًؚ-ٰٟۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣣ-ंऺ़ु-ै्॑-ॗॢ-ॣঁ়াু-ৄ্ৗৢ-ৣਁ-ਂ਼ੁ-ੂੇ-ੈੋ-੍ੑੰ-ੱੵઁ-ં઼ુ-ૅે-ૈ્ૢ-ૣଁ଼ାିୁ-ୄ୍ୖୗୢ-ୣஂாீ்ௗఀా-ీె-ైొ-్ౕ-ౖౢ-ౣಁ಼ಿೂೆೌ-್ೕ-ೖೢ-ೣഁാു-ൄ്ൗൢ-ൣ්ාි-ුූෟัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-ཱ༹༙༵༷-ཾྀ-྄྆-྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္-်ွ-ှၘ-ၙၞ-ၠၱ-ၴႂႅ-ႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳ឴-឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧ-ᤨᤲ᤹-᤻ᨗ-ᨘᨛᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼᪰-᪽᪾ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀ-ᮁᮢ-ᮥᮨ-ᮩ᮫-ᮭ᯦ᯨ-ᯩᯭᯯ-ᯱᰬ-ᰳᰶ-᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᳸-᳹᷀-᷵᷼-᷿‌-‍⃐-⃜⃝-⃠⃡⃢-⃤⃥-⃰⳯-⵿⳱ⷠ-〪ⷿ-〭〮-゙〯-゚꙯꙰-꙲ꙴ-꙽ꚞ-ꚟ꛰-꛱ꠂ꠆ꠋꠥ-ꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꧥꨩ-ꨮꨱ-ꨲꨵ-ꨶꩃꩌꩼꪰꪲ-ꪴꪷ-ꪸꪾ-꪿꫁ꫬ-ꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-゙︯-゚]"),Fi=e=>h(e)&&e.charCodeAt(0)>=768&&Pi.test(e),zi=Wn,Vi=ns,Zi=Kn("display","block table"),Ui=Kn("float","left right"),ji=((...e)=>t=>{for(let o=0;ot<0&&Wn(e)&&e.hasChildNodes()?void 0:Ii(e,t),Yi=e=>e?e.createRange():Ya.DOM.createRng(),Xi=e=>h(e)&&/[\r\n\t ]/.test(e),Ji=e=>!!e.setStart&&!!e.setEnd,Qi=e=>{const t=e.startContainer,o=e.startOffset;if(Xi(e.toString())&&Wi(t.parentNode)&&tr(t)){const e=t.data;if(Xi(e[o-1])||Xi(e[o+1]))return!0}return!1},el=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,tl=e=>{var t;let o;const n=e.getClientRects();return o=n.length>0?Ai(n[0]):Ai(e.getBoundingClientRect()),!Ji(e)&&qi(e)&&el(o)?(e=>{const t=e.ownerDocument,o=Yi(t),n=t.createTextNode(br),r=e.parentNode;r.insertBefore(n,e),o.setStart(n,0),o.setEnd(n,1);const s=Ai(o.getBoundingClientRect());return r.removeChild(n),s})(e):el(o)&&Ji(e)&&null!==(t=(e=>{const t=e.startContainer,o=e.endContainer,n=e.startOffset,r=e.endOffset;if(t===o&&tr(o)&&0===n&&1===r){const t=e.cloneRange();return t.setEndAfter(o),tl(t)}return null})(e))&&void 0!==t?t:o},ol=(e,t)=>{const o=Mi(e,t);return o.width=1,o.right=o.left+1,o},nl=e=>{const t=[],o=e=>{var o,n;0!==e.height&&(t.length>0&&(o=e,n=t[t.length-1],o.left===n.left&&o.top===n.top&&o.bottom===n.bottom&&o.right===n.right)||t.push(e))},n=(e,t)=>{const n=Yi(e.ownerDocument);if(t0&&(n.setStart(e,t-1),n.setEnd(e,t),Qi(n)||o(ol(tl(n),!1))),t{const n=()=>(o||(o=nl(rl(e,t))),o);return{container:D(e),offset:D(t),toRange:()=>{const o=Yi(e.ownerDocument);return o.setStart(e,t),o.setEnd(e,t),o},getClientRects:n,isVisible:()=>n().length>0,isAtStart:()=>($i(e),0===t),isAtEnd:()=>$i(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:o=>o&&e===o.container()&&t===o.offset(),getNode:o=>Ki(e,o?t-1:t)}};rl.fromRangeStart=e=>rl(e.startContainer,e.startOffset),rl.fromRangeEnd=e=>rl(e.endContainer,e.endOffset),rl.after=e=>rl(e.parentNode,Gi(e)+1),rl.before=e=>rl(e.parentNode,Gi(e)),rl.isAbove=(e,t)=>It(de(t.getClientRects()),me(e.getClientRects()),Ri).getOr(!1),rl.isBelow=(e,t)=>It(me(t.getClientRects()),de(e.getClientRects()),Bi).getOr(!1),rl.isAtStart=e=>!!e&&e.isAtStart(),rl.isAtEnd=e=>!!e&&e.isAtEnd(),rl.isTextPosition=e=>!!e&&tr(e.container()),rl.isElementPosition=e=>!rl.isTextPosition(e);const sl=(e,t)=>{tr(t)&&0===t.data.length&&e.remove(t)},al=(e,t,o)=>{ar(o)?((e,t,o)=>{const n=F.from(o.firstChild),r=F.from(o.lastChild);t.insertNode(o),n.each((t=>sl(e,t.previousSibling))),r.each((t=>sl(e,t.nextSibling)))})(e,t,o):((e,t,o)=>{t.insertNode(o),sl(e,o.previousSibling),sl(e,o.nextSibling)})(e,t,o)},il=tr,ll=Xn,cl=Ya.nodeIndex,dl=e=>{const t=e.parentNode;return ll(t)?dl(t):t},ml=e=>e?Re(e.childNodes,((e,t)=>(ll(t)&&"BR"!==t.nodeName?e=e.concat(ml(t)):e.push(t),e)),[]):[],ul=e=>t=>e===t,gl=e=>(il(e)?"text()":e.nodeName.toLowerCase())+"["+(e=>{let t,o;t=ml(dl(e)),o=Be(t,ul(e),e),t=t.slice(0,o+1);const n=Re(t,((e,o,n)=>(il(o)&&il(t[n-1])&&e++,e)),0);return t=Ne(t,Gn([e.nodeName])),o=Be(t,ul(e),e),o-n})(e)+"]",hl=(e,t)=>{let o,n=[],r=t.container(),s=t.offset();if(il(r))o=((e,t)=>{let o=e;for(;(o=o.previousSibling)&&il(o);)t+=o.data.length;return t})(r,s);else{const e=r.childNodes;s>=e.length?(o="after",s=e.length-1):o="before",r=e[s]}n.push(gl(r));let a=((e,t,o)=>{const n=[];for(let r=t.parentNode;r&&r!==e&&(!o||!o(r));r=r.parentNode)n.push(r);return n})(e,r);return a=Ne(a,R(Xn)),n=n.concat(Me(a,(e=>gl(e)))),n.reverse().join("/")+","+o},pl=(e,t)=>{if(!t)return null;const o=t.split(","),n=o[0].split("/"),r=o.length>1?o[1]:"before",s=Re(n,((e,t)=>{const o=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return o?("text()"===o[1]&&(o[1]="#text"),((e,t,o)=>{let n=ml(e);return n=Ne(n,((e,t)=>!il(e)||!il(n[t-1]))),n=Ne(n,Gn([t])),n[o]})(e,o[1],parseInt(o[2],10))):null}),e);if(!s)return null;if(!il(s)&&s.parentNode){let e;return e="after"===r?cl(s)+1:cl(s),rl(s.parentNode,e)}return((e,t)=>{let o=e,n=0;for(;il(o);){const r=o.data.length;if(t>=n&&t<=n+r){e=o,t-=n;break}if(!il(o.nextSibling)){e=o,t=r;break}n+=r,o=o.nextSibling}return il(e)&&t>e.data.length&&(t=e.data.length),rl(e,t)})(s,parseInt(r,10))},fl=dr,vl=(e,t,o,n,r)=>{const s=r?n.startContainer:n.endContainer;let a=r?n.startOffset:n.endOffset;const i=[],l=e.getRoot();if(tr(s))i.push(o?((e,t,o)=>{let n=e(t.data.slice(0,o)).length;for(let o=t.previousSibling;o&&tr(o);o=o.previousSibling)n+=e(o.data).length;return n})(t,s,a):a);else{let t=0;const n=s.childNodes;a>=n.length&&n.length&&(t=1,a=Math.max(0,n.length-1)),i.push(e.nodeIndex(n[a],o)+t)}for(let t=s;t&&t!==l;t=t.parentNode)i.push(e.nodeIndex(t,o));return i},bl=(e,t,o)=>{let n=0;return Bt.each(e.select(t),(e=>"all"===e.getAttribute("data-mce-bogus")?void 0:e!==o&&void n++)),n},yl=(e,t)=>{let o=t?e.startContainer:e.endContainer,n=t?e.startOffset:e.endOffset;if(Wn(o)&&"TR"===o.nodeName){const r=o.childNodes;o=r[Math.min(t?n:n-1,r.length-1)],o&&(n=t?0:o.childNodes.length,t?e.setStart(o,n):e.setEnd(o,n))}},wl=e=>(yl(e,!0),yl(e,!1),e),xl=(e,t)=>{if(Wn(e)&&(e=Ii(e,t),fl(e)))return e;if(Vr(e)){tr(e)&&Fr(e)&&(e=e.parentNode);let t=e.previousSibling;if(fl(t))return t;if(t=e.nextSibling,fl(t))return t}},Cl=(e,t,o)=>{const n=o.getNode(),r=o.getRng();if("IMG"===n.nodeName||fl(n)){const e=n.nodeName;return{name:e,index:bl(o.dom,e,n)}}const s=(e=>xl(e.startContainer,e.startOffset)||xl(e.endContainer,e.endOffset))(r);if(s){const e=s.tagName;return{name:e,index:bl(o.dom,e,s)}}return((e,t,o,n)=>{const r=t.dom,s=vl(r,e,o,n,!0),a=t.isForward(),i=Gr(n)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:s,forward:a,...i}:{start:s,end:vl(r,e,o,n,!1),forward:a,...i}})(e,o,t,r)},Sl=(e,t,o)=>{const n={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return o?e.create("span",n,""):e.create("span",n)},kl=(e,t)=>{const o=e.dom;let n=e.getRng();const r=o.uniqueId(),s=e.isCollapsed(),a=e.getNode(),i=a.nodeName,l=e.isForward();if("IMG"===i)return{name:i,index:bl(o,i,a)};const c=wl(n.cloneRange());if(!s){c.collapse(!1);const e=Sl(o,r+"_end",t);al(o,c,e)}n=wl(n),n.collapse(!0);const d=Sl(o,r+"_start",t);return al(o,n,d),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},_l=(e,t,o=!1)=>2===t?Cl(Hr,o,e):3===t?(e=>{const t=e.getRng();return{start:hl(e.dom.getRoot(),rl.fromRangeStart(t)),end:hl(e.dom.getRoot(),rl.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):kl(e,!1),El=N(Cl,A,!0),Tl=e=>{const t=t=>t(e),o=D(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:P,isError:I,map:t=>Dl.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:()=>F.some(e)};return r},Ol=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:I,isError:P,map:t,mapError:t=>Dl.error(t(e)),bind:t,exists:I,forall:P,getOr:A,or:A,getOrThunk:L,orThunk:L,getOrDie:B(String(e)),each:E,toOptional:F.none};return o},Dl={value:Tl,error:Ol,fromOption:(e,t)=>e.fold((()=>Ol(t)),Tl)},Al=e=>{if(!v(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 q(e,((n,r)=>{const s=he(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!v(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[r].apply(null,o)},match:e=>{const n=he(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!re(t,(e=>j(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};Al([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Ml=e=>"inline-command"===e.type||"inline-format"===e.type,Nl=e=>"block-command"===e.type||"block-format"===e.type,Rl=e=>{const t=t=>Dl.error({message:t,pattern:e}),o=(o,n,r)=>{if(void 0!==e.format){let r;if(v(e.format)){if(!re(e.format,h))return t(o+" pattern has non-string items in the `format` array");r=e.format}else{if(!h(e.format))return t(o+" pattern has non-string `format` parameter");r=[e.format]}return Dl.value(n(r))}return void 0!==e.cmd?h(e.cmd)?Dl.value(r(e.cmd,e.value)):t(o+" pattern has non-string `cmd` parameter"):t(o+" pattern is missing both `format` and `cmd` parameters")};if(!p(e))return t("Raw pattern is not an object");if(!h(e.start))return t("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!h(e.end))return t("Inline pattern has non-string `end` parameter");if(0===e.start.length&&0===e.end.length)return t("Inline pattern has empty `start` and `end` parameters");let n=e.start,r=e.end;return 0===r.length&&(r=n,n=""),o("Inline",(e=>({type:"inline-format",start:n,end:r,format:e})),((e,t)=>({type:"inline-command",start:n,end:r,cmd:e,value:t})))}return void 0!==e.replacement?h(e.replacement)?0===e.start.length?t("Replacement pattern has empty `start` parameter"):Dl.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):t("Replacement pattern has non-string `replacement` parameter"):0===e.start.length?t("Block pattern has empty `start` parameter"):o("Block",(t=>({type:"block-format",start:e.start,format:t[0]})),((t,o)=>({type:"block-command",start:e.start,cmd:t,value:o})))},Bl=e=>Y(e,Nl),Ll=e=>Y(e,Ml),Hl=e=>{const t=(e=>{const t=[],o=[];return q(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{o.push(e)}))})),{errors:t,values:o}})($(e,Rl));return q(t.errors,(e=>console.error(e.message,e.pattern))),t.values},Il=St().deviceType,Pl=Il.isTouch(),Fl=Ya.DOM,zl=e=>g(e,RegExp),Vl=e=>t=>t.options.get(e),Zl=e=>h(e)||p(e),Ul=(e,t="")=>o=>{const n=h(o);if(n){if(-1!==o.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return J(t,((e,t)=>{const o=t.split("="),n=o[0],r=o.length>1?o[1]:n;return e[qe(n)]=qe(r),e}),{})})(o);return{value:ke(r,e.id).getOr(t),valid:n}}return{value:o,valid:n}}return{valid:!1,message:"Must be a string."}},jl=Vl("iframe_attrs"),Wl=Vl("doctype"),$l=Vl("document_base_url"),ql=Vl("body_id"),Gl=Vl("body_class"),Kl=Vl("content_security_policy"),Yl=Vl("br_in_pre"),Xl=Vl("forced_root_block"),Jl=Vl("forced_root_block_attrs"),Ql=Vl("newline_behavior"),ec=Vl("br_newline_selector"),tc=Vl("no_newline_selector"),oc=Vl("keep_styles"),nc=Vl("end_container_on_empty_block"),rc=Vl("automatic_uploads"),sc=Vl("images_reuse_filename"),ac=Vl("images_replace_blob_uris"),ic=Vl("icons"),lc=Vl("icons_url"),cc=Vl("images_upload_url"),dc=Vl("images_upload_base_path"),mc=Vl("images_upload_credentials"),uc=Vl("images_upload_handler"),gc=Vl("content_css_cors"),hc=Vl("referrer_policy"),pc=Vl("language"),fc=Vl("language_url"),vc=Vl("indent_use_margin"),bc=Vl("indentation"),yc=Vl("content_css"),wc=Vl("content_style"),xc=Vl("font_css"),Cc=Vl("directionality"),Sc=Vl("inline_boundaries_selector"),kc=Vl("object_resizing"),_c=Vl("resize_img_proportional"),Ec=Vl("placeholder"),Tc=Vl("event_root"),Oc=Vl("service_message"),Dc=Vl("theme"),Ac=Vl("theme_url"),Mc=Vl("model"),Nc=Vl("model_url"),Rc=Vl("inline_boundaries"),Bc=Vl("formats"),Lc=Vl("preview_styles"),Hc=Vl("format_empty_lines"),Ic=Vl("format_noneditable_selector"),Pc=Vl("custom_ui_selector"),Fc=Vl("inline"),zc=Vl("hidden_input"),Vc=Vl("submit_patch"),Zc=Vl("add_form_submit_trigger"),Uc=Vl("add_unload_trigger"),jc=Vl("custom_undo_redo_levels"),Wc=Vl("disable_nodechange"),$c=Vl("readonly"),qc=Vl("editable_root"),Gc=Vl("content_css_cors"),Kc=Vl("plugins"),Yc=Vl("external_plugins"),Xc=Vl("block_unsupported_drop"),Jc=Vl("visual"),Qc=Vl("visual_table_class"),ed=Vl("visual_anchor_class"),td=Vl("iframe_aria_text"),od=Vl("setup"),nd=Vl("init_instance_callback"),rd=Vl("urlconverter_callback"),sd=Vl("auto_focus"),ad=Vl("browser_spellcheck"),id=Vl("protect"),ld=Vl("paste_block_drop"),cd=Vl("paste_data_images"),dd=Vl("paste_preprocess"),md=Vl("paste_postprocess"),ud=Vl("newdocument_content"),gd=Vl("paste_webkit_styles"),hd=Vl("paste_remove_styles_if_webkit"),pd=Vl("paste_merge_formats"),fd=Vl("smart_paste"),vd=Vl("paste_as_text"),bd=Vl("paste_tab_spaces"),yd=Vl("allow_html_data_urls"),wd=Vl("text_patterns"),xd=Vl("text_patterns_lookup"),Cd=Vl("noneditable_class"),Sd=Vl("editable_class"),kd=Vl("noneditable_regexp"),_d=Vl("preserve_cdata"),Ed=Vl("highlight_on_focus"),Td=Vl("xss_sanitization"),Od=Vl("init_content_sync"),Dd=e=>Bt.explode(e.options.get("images_file_types")),Ad=Vl("table_tab_navigation"),Md=Vl("details_initial_state"),Nd=Vl("details_serialized_state"),Rd=Vl("force_hex_color"),Bd=Vl("sandbox_iframes"),Ld=Wn,Hd=tr,Id=e=>{const t=e.parentNode;t&&t.removeChild(e)},Pd=e=>{const t=Hr(e);return{count:e.length-t.length,text:t}},Fd=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(Br));)e.deleteData(t,1)},zd=(e,t)=>(jd(e),t),Vd=(e,t)=>{const o=t.container(),n=((e,t)=>{const o=U(e,t);return-1===o?F.none():F.some(o)})(ue(o.childNodes),e).map((e=>eHd(e)&&t.container()===e?((e,t)=>{const o=Pd(e.data.substr(0,t.offset())),n=Pd(e.data.substr(t.offset()));return(o.text+n.text).length>0?(Fd(e),rl(e,t.offset()-o.count)):t})(e,t):zd(e,t),Ud=(e,t)=>rl.isTextPosition(t)?Zd(e,t):((e,t)=>t.container()===e.parentNode?Vd(e,t):zd(e,t))(e,t),jd=e=>{Ld(e)&&Vr(e)&&(Zr(e)?e.removeAttribute("data-mce-caret"):Id(e)),Hd(e)&&(Fd(e),0===e.data.length&&Id(e))},Wd=dr,$d=gr,qd=mr,Gd=(e,t,o)=>{const n=Mi(t.getBoundingClientRect(),o);let r,s;if("BODY"===e.tagName){const t=e.ownerDocument.documentElement;r=e.scrollLeft||t.scrollLeft,s=e.scrollTop||t.scrollTop}else{const t=e.getBoundingClientRect();r=e.scrollLeft-t.left,s=e.scrollTop-t.top}n.left+=r,n.right+=r,n.top+=s,n.bottom+=s,n.width=1;let a=t.offsetWidth-t.clientWidth;return a>0&&(o&&(a*=-1),n.left+=a,n.right+=a),n},Kd=(e,t,o,n)=>{const r=ai();let s,a;const i=Xl(e),l=e.dom,c=()=>{(e=>{var t,o;const n=zn(yo.fromDom(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e{l.remove(e.caret),r.clear()})),s&&(clearInterval(s),s=void 0)},d=()=>{s=setInterval((()=>{r.on((e=>{n()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")}))}),500)};return{show:(e,n)=>{let s;if(c(),qd(n))return null;if(!o(n))return a=((e,t)=>{var o;const n=(null!==(o=e.ownerDocument)&&void 0!==o?o:document).createTextNode(Br),r=e.parentNode;if(t){const t=e.previousSibling;if(Pr(t)){if(Vr(t))return t;if($r(t))return t.splitText(t.data.length-1)}null==r||r.insertBefore(n,e)}else{const t=e.nextSibling;if(Pr(t)){if(Vr(t))return t;if(Wr(t))return t.splitText(1),t}e.nextSibling?null==r||r.insertBefore(n,e.nextSibling):null==r||r.appendChild(n)}return n})(n,e),s=n.ownerDocument.createRange(),Xd(a.nextSibling)?(s.setStart(a,0),s.setEnd(a,0)):(s.setStart(a,1),s.setEnd(a,1)),s;{const o=((e,t,o)=>{var n;const r=(null!==(n=t.ownerDocument)&&void 0!==n?n:document).createElement(e);r.setAttribute("data-mce-caret",o?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(Nr().dom);const s=t.parentNode;return o?null==s||s.insertBefore(r,t):t.nextSibling?null==s||s.insertBefore(r,t.nextSibling):null==s||s.appendChild(r),r})(i,n,e),c=Gd(t,n,e);l.setStyle(o,"top",c.top),a=o;const m=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(m,{...c}),l.add(t,m),r.set({caret:m,element:n,before:e}),e&&l.addClass(m,"mce-visual-caret-before"),d(),s=n.ownerDocument.createRange(),s.setStart(o,0),s.setEnd(o,0)}return s},hide:c,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{r.on((e=>{const o=Gd(t,e.element,e.before);l.setStyles(e.caret,{...o})}))},destroy:()=>clearInterval(s)}},Yd=()=>At.browser.isFirefox(),Xd=e=>Wd(e)||$d(e),Jd=e=>(Xd(e)||Jn(e)&&Yd())&&Do(yo.fromDom(e)).exists(nn),Qd=cr,em=dr,tm=gr,om=Kn("display","block table table-cell table-caption list-item"),nm=Vr,rm=Fr,sm=Wn,am=tr,im=ns,lm=e=>e>0,cm=e=>e<0,dm=(e,t)=>{let o;for(;o=e(t);)if(!rm(o))return o;return null},mm=(e,t,o,n,r)=>{const s=new Zn(e,n),a=em(e)||rm(e);let i;if(cm(t)){if(a&&(i=dm(s.prev.bind(s),!0),o(i)))return i;for(;i=dm(s.prev.bind(s),r);)if(o(i))return i}if(lm(t)){if(a&&(i=dm(s.next.bind(s),!0),o(i)))return i;for(;i=dm(s.next.bind(s),r);)if(o(i))return i}return null},um=(e,t)=>{for(;e&&e!==t;){if(om(e))return e;e=e.parentNode}return null},gm=(e,t,o)=>um(e.container(),o)===um(t.container(),o),hm=(e,t)=>{if(!t)return F.none();const o=t.container(),n=t.offset();return sm(o)?F.from(o.childNodes[n+e]):F.none()},pm=(e,t)=>{var o;const n=(null!==(o=t.ownerDocument)&&void 0!==o?o:document).createRange();return e?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),n},fm=(e,t,o)=>um(t,e)===um(o,e),vm=(e,t,o)=>{const n=e?"previousSibling":"nextSibling";let r=o;for(;r&&r!==t;){let e=r[n];if(e&&nm(e)&&(e=e[n]),em(e)||tm(e)){if(fm(t,e,r))return e;break}if(im(e))break;r=r.parentNode}return null},bm=N(pm,!0),ym=N(pm,!1),wm=(e,t,o)=>{let n;const r=N(vm,!0,t),s=N(vm,!1,t),a=o.startContainer,i=o.startOffset;if(Fr(a)){const e=am(a)?a.parentNode:a,t=e.getAttribute("data-mce-caret");if("before"===t&&(n=e.nextSibling,Jd(n)))return bm(n);if("after"===t&&(n=e.previousSibling,Jd(n)))return ym(n)}if(!o.collapsed)return o;if(tr(a)){if(nm(a)){if(1===e){if(n=s(a),n)return bm(n);if(n=r(a),n)return ym(n)}if(-1===e){if(n=r(a),n)return ym(n);if(n=s(a),n)return bm(n)}return o}if($r(a)&&i>=a.data.length-1)return 1===e&&(n=s(a),n)?bm(n):o;if(Wr(a)&&i<=1)return-1===e&&(n=r(a),n)?ym(n):o;if(i===a.data.length)return n=s(a),n?bm(n):o;if(0===i)return n=r(a),n?ym(n):o}return o},xm=(e,t)=>hm(e?0:-1,t).filter(em),Cm=(e,t,o)=>{const n=wm(e,t,o);return-1===e?rl.fromRangeStart(n):rl.fromRangeEnd(n)},Sm=e=>F.from(e.getNode()).map(yo.fromDom),km=(e,t)=>{let o=t;for(;o=e(o);)if(o.isVisible())return o;return o},_m=(e,t)=>{const o=gm(e,t);return!(o||!ir(e.getNode()))||o};var Em;!function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"}(Em||(Em={}));const Tm=dr,Om=tr,Dm=Wn,Am=ir,Mm=ns,Nm=e=>es(e)||(e=>!!rs(e)&&!J(ue(e.getElementsByTagName("*")),((e,t)=>e||Kr(t)),!1))(e),Rm=ss,Bm=(e,t)=>e.hasChildNodes()&&t{if(lm(e)){if(Mm(t.previousSibling)&&!Om(t.previousSibling))return rl.before(t);if(Om(t))return rl(t,0)}if(cm(e)){if(Mm(t.nextSibling)&&!Om(t.nextSibling))return rl.after(t);if(Om(t))return rl(t,t.data.length)}return cm(e)?Am(t)?rl.before(t):rl.after(t):rl.before(t)},Hm=(e,t,o)=>{let n,r,s,a;if(!Dm(o)||!t)return null;if(t.isEqual(rl.after(o))&&o.lastChild){if(a=rl.after(o.lastChild),cm(e)&&Mm(o.lastChild)&&Dm(o.lastChild))return Am(o.lastChild)?rl.before(o.lastChild):a}else a=t;const i=a.container();let l=a.offset();if(Om(i)){if(cm(e)&&l>0)return rl(i,--l);if(lm(e)&&l0&&(r=Bm(i,l-1),Mm(r)))return!Nm(r)&&(s=mm(r,e,Rm,r),s)?Om(s)?rl(s,s.data.length):rl.after(s):Om(r)?rl(r,r.data.length):rl.before(r);if(lm(e)&&l{const o=t.nextSibling;return o&&Mm(o)?Om(o)?rl(o,0):rl.before(o):Hm(Em.Forwards,rl.after(t),e)})(o,r):!Nm(r)&&(s=mm(r,e,Rm,r),s)?Om(s)?rl(s,0):rl.before(s):Om(r)?rl(r,0):rl.after(r);n=r||a.getNode()}if(n&&(lm(e)&&a.isAtEnd()||cm(e)&&a.isAtStart())&&(n=mm(n,e,P,o,!0),Rm(n,o)))return Lm(e,n);r=n?mm(n,e,Rm,o):n;const c=Le(Y(((e,t)=>{const o=[];let n=e;for(;n&&n!==t;)o.push(n),n=n.parentNode;return o})(i,o),Tm));return!c||r&&c.contains(r)?r?Lm(e,r):null:(a=lm(e)?rl.after(c):rl.before(c),a)},Im=e=>({next:t=>Hm(Em.Forwards,t,e),prev:t=>Hm(Em.Backwards,t,e)}),Pm=e=>rl.isTextPosition(e)?0===e.offset():ns(e.getNode()),Fm=e=>{if(rl.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return ns(e.getNode(!0))},zm=(e,t)=>!rl.isTextPosition(e)&&!rl.isTextPosition(t)&&e.getNode()===t.getNode(!0),Vm=(e,t,o)=>{return e?!zm(t,o)&&(n=t,!(!rl.isTextPosition(n)&&ir(n.getNode())))&&Fm(t)&&Pm(o):!zm(o,t)&&Pm(t)&&Fm(o);var n},Zm=(e,t,o)=>{const n=Im(t);return F.from(e?n.next(o):n.prev(o))},Um=(e,t,o)=>Zm(e,t,o).bind((n=>gm(o,n,t)&&Vm(e,o,n)?Zm(e,t,n):F.some(n))),jm=(e,t,o,n)=>Um(e,t,o).bind((o=>n(o)?jm(e,t,o,n):F.some(o))),Wm=(e,t)=>{const o=e?t.firstChild:t.lastChild;return tr(o)?F.some(rl(o,e?0:o.data.length)):o?ns(o)?F.some(e?rl.before(o):ir(n=o)?rl.before(n):rl.after(n)):((e,t,o)=>{const n=e?rl.before(o):rl.after(o);return Zm(e,t,n)})(e,t,o):F.none();var n},$m=N(Zm,!0),qm=N(Zm,!1),Gm=N(Wm,!0),Km=N(Wm,!1),Ym="_mce_caret",Xm=e=>Wn(e)&&e.id===Ym,Jm=(e,t)=>{let o=t;for(;o&&o!==e;){if(Xm(o))return o;o=o.parentNode}return null},Qm=e=>_e(e,"name"),eu=e=>Bt.isArray(e.start),tu=e=>!(!Qm(e)&&y(e.forward))||e.forward,ou=(e,t)=>(Wn(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='
'),t),nu=(e,t)=>Km(e).fold(I,(e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0))),ru=(e,t,o)=>!(!(e=>!e.hasChildNodes())(t)||!Jm(e,t)||(((e,t)=>{var o;const n=(null!==(o=e.ownerDocument)&&void 0!==o?o:document).createTextNode(Br);e.appendChild(n),t.setStart(n,0),t.setEnd(n,0)})(t,o),0)),su=(e,t,o,n)=>{const r=o[t?"start":"end"],s=e.getRoot();if(r){let e=s,o=r[0];for(let t=r.length-1;e&&t>=1;t--){const o=e.childNodes;if(ru(s,e,n))return!0;if(r[t]>o.length-1)return!!ru(s,e,n)||nu(e,n);e=o[r[t]]}tr(e)&&(o=Math.min(r[0],e.data.length)),Wn(e)&&(o=Math.min(r[0],e.childNodes.length)),t?n.setStart(e,o):n.setEnd(e,o)}return!0},au=e=>tr(e)&&e.data.length>0,iu=(e,t,o)=>{const n=e.get(o.id+"_"+t),r=null==n?void 0:n.parentNode,s=o.keep;if(n&&r){let a,i;if("start"===t?s?n.hasChildNodes()?(a=n.firstChild,i=1):au(n.nextSibling)?(a=n.nextSibling,i=0):au(n.previousSibling)?(a=n.previousSibling,i=n.previousSibling.data.length):(a=r,i=e.nodeIndex(n)+1):(a=r,i=e.nodeIndex(n)):s?n.hasChildNodes()?(a=n.firstChild,i=1):au(n.previousSibling)?(a=n.previousSibling,i=n.previousSibling.data.length):(a=r,i=e.nodeIndex(n)):(a=r,i=e.nodeIndex(n)),!s){const r=n.previousSibling,s=n.nextSibling;let l;for(Bt.each(Bt.grep(n.childNodes),(e=>{tr(e)&&(e.data=e.data.replace(/\uFEFF/g,""))}));l=e.get(o.id+"_"+t);)e.remove(l,!0);if(tr(s)&&tr(r)&&!At.browser.isOpera()){const t=r.data.length;r.appendData(s.data),e.remove(s),a=r,i=t}}return F.some(rl(a,i))}return F.none()},lu=(e,t)=>{const o=e.dom;if(t){if(eu(t))return((e,t)=>{const o=e.createRng();return su(e,!0,t,o)&&su(e,!1,t,o)?F.some({range:o,forward:tu(t)}):F.none()})(o,t);if((e=>h(e.start))(t))return((e,t)=>{const o=F.from(pl(e.getRoot(),t.start)),n=F.from(pl(e.getRoot(),t.end));return It(o,n,((o,n)=>{const r=e.createRng();return r.setStart(o.container(),o.offset()),r.setEnd(n.container(),n.offset()),{range:r,forward:tu(t)}}))})(o,t);if((e=>_e(e,"id"))(t))return((e,t)=>{const o=iu(e,"start",t),n=iu(e,"end",t);return It(o,n.or(o),((o,n)=>{const r=e.createRng();return r.setStart(ou(e,o.container()),o.offset()),r.setEnd(ou(e,n.container()),n.offset()),{range:r,forward:tu(t)}}))})(o,t);if(Qm(t))return((e,t)=>F.from(e.select(t.name)[t.index]).map((t=>{const o=e.createRng();return o.selectNode(t),{range:o,forward:!0}})))(o,t);if((e=>_e(e,"rng"))(t))return F.some({range:t.rng,forward:tu(t)})}return F.none()},cu=(e,t,o)=>_l(e,t,o),du=(e,t)=>{lu(e,t).each((({range:t,forward:o})=>{e.setRng(t,o)}))},mu=e=>Wn(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),uu=(gu=br,e=>gu===e);var gu;const hu=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),pu=e=>!hu(e)&&!uu(e)&&!yr(e),fu=e=>{const t=[];if(e)for(let o=0;oY((e=>ne(e,(e=>{const t=Hi(e);return t?[yo.fromDom(t)]:[]})))(e),Dr),bu=(e,t)=>{const o=zn(t,"td[data-mce-selected],th[data-mce-selected]");return o.length>0?o:vu(e)},yu=e=>bu(fu(e.selection.getSel()),yo.fromDom(e.getBody())),wu=(e,t)=>en(e,"table",t),xu=e=>Io(e).fold(D([e]),(t=>[e].concat(xu(t)))),Cu=e=>Po(e).fold(D([e]),(t=>"br"===jt(t)?Mo(t).map((t=>[e].concat(Cu(t)))).getOr([]):[e].concat(Cu(t)))),Su=(e,t)=>It((e=>{const t=e.startContainer,o=e.startOffset;return tr(t)?0===o?F.some(yo.fromDom(t)):F.none():F.from(t.childNodes[o]).map(yo.fromDom)})(t),(e=>{const t=e.endContainer,o=e.endOffset;return tr(t)?o===t.data.length?F.some(yo.fromDom(t)):F.none():F.from(t.childNodes[o-1]).map(yo.fromDom)})(t),((t,o)=>{const n=ee(xu(e),N(So,t)),r=ee(Cu(e),N(So,o));return n.isSome()&&r.isSome()})).getOr(!1),ku=(e,t,o,n)=>{const r=o,s=new Zn(o,r),a=xe(e.schema.getMoveCaretBeforeOnEnterElements(),((e,t)=>!j(["td","th","table"],t.toLowerCase())));let i=o;do{if(tr(i)&&0!==Bt.trim(i.data).length)return void(n?t.setStart(i,0):t.setEnd(i,i.data.length));if(a[i.nodeName])return void(n?t.setStartBefore(i):"BR"===i.nodeName?t.setEndBefore(i):t.setEndAfter(i))}while(i=n?s.next():s.prev());"BODY"===r.nodeName&&(n?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},_u=e=>{const t=e.selection.getSel();return C(t)&&t.rangeCount>0},Eu=(e,t)=>{const o=yu(e);o.length>0?q(o,(o=>{const n=o.dom,r=e.dom.createRng();r.setStartBefore(n),r.setEndAfter(n),t(r,!0)})):t(e.selection.getRng(),!1)},Tu=(e,t,o)=>{const n=kl(e,t);o(n),e.moveToBookmark(n)},Ou=e=>k(null==e?void 0:e.nodeType),Du=e=>Wn(e)&&!mu(e)&&!Xm(e)&&!Xn(e),Au=(e,t,o)=>{const{selection:n,dom:r}=e,s=n.getNode(),a=dr(s);Tu(n,!0,(()=>{t()})),a&&dr(s)&&r.isChildOf(s,e.getBody())?e.selection.select(s):o(n.getStart())&&Mu(r,n)},Mu=(e,t)=>{var o,n;const r=t.getRng(),{startContainer:s,startOffset:a}=r;if(!((e,t)=>{if(Du(t)&&!/^(TD|TH)$/.test(t.nodeName)){const o=e.getAttrib(t,"data-mce-selected"),n=parseInt(o,10);return!isNaN(n)&&n>0}return!1})(e,t.getNode())&&Wn(s)){const i=s.childNodes,l=e.getRoot();let c;if(a{if(e){const n=t?"nextSibling":"previousSibling";for(e=o?e:e[n];e;e=e[n])if(Wn(e)||!Lu(e))return e}},Ru=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Ls(e,t),Bu=(e,t,o)=>e.schema.isValidChild(t,o),Lu=(e,t=!1)=>{if(C(e)&&tr(e)){const o=t?e.data.replace(/ /g," "):e.data;return is(o)}return!1},Hu=(e,t)=>{const o=e.dom;return Du(t)&&"false"===o.getContentEditable(t)&&((e,t)=>{const o="[data-mce-cef-wrappable]",n=Ic(e),r=Xe(n)?o:`${o},${n}`;return xo(yo.fromDom(t),r)})(e,t)&&0===o.select('[contenteditable="true"]',t).length},Iu=(e,t)=>S(e)?e(t):(C(t)&&(e=e.replace(/%(\w+)/g,((e,o)=>t[o]||e))),e),Pu=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),Fu=(e,t)=>{if(x(e))return null;{let o=String(e);return"color"!==t&&"backgroundColor"!==t||(o=Da(o)),"fontWeight"===t&&700===e&&(o="bold"),"fontFamily"===t&&(o=o.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),o}},zu=(e,t,o)=>{const n=e.getStyle(t,o);return Fu(n,o)},Vu=(e,t)=>{let o;return e.getParent(t,(t=>!!Wn(t)&&(o=e.getStyle(t,"text-decoration"),!!o&&"none"!==o))),o},Zu=(e,t,o)=>e.getParents(t,o,e.getRoot()),Uu=(e,t,o)=>{const n=e.formatter.get(t);return C(n)&&W(n,o)},ju=(e,t,o)=>{const n=["inline","block","selector","attributes","styles","classes"],r=e=>xe(e,((e,t)=>W(n,(e=>e===t))));return Uu(e,t,(t=>{const n=r(t);return Uu(e,o,(e=>{const t=r(e);return((e,t,o=i)=>a(o).eq(e,t))(n,t)}))}))},Wu=e=>Ee(e,"block"),$u=e=>Ee(e,"selector"),qu=e=>Ee(e,"inline"),Gu=e=>$u(e)&&!1!==e.expand&&!qu(e),Ku=e=>(e=>{const t=[];let o=e;for(;o;){if(tr(o)&&o.data!==Br||o.childNodes.length>1)return[];Wn(o)&&t.push(o),o=o.firstChild}return t})(e).length>0,Yu=e=>Xm(e.dom)&&Ku(e.dom),Xu=mu,Ju=Zu,Qu=Lu,eg=Ru,tg=(e,t)=>{let o=t;for(;o;){if(Wn(o)&&e.getContentEditable(o))return"false"===e.getContentEditable(o)?o:t;o=o.parentNode}return t},og=(e,t,o,n)=>{const r=t.data;if(e){for(let e=o;e>0;e--)if(n(r.charAt(e-1)))return e}else for(let e=o;eog(e,t,o,(e=>uu(e)||hu(e))),rg=(e,t,o)=>og(e,t,o,pu),sg=(e,t,o,n,r,s)=>{let a;const i=e.getParent(o,e.isBlock)||t,l=(t,o,n)=>{const s=Oi(e),l=r?s.backwards:s.forwards;return F.from(l(t,o,((e,t)=>Xu(e.parentNode)?-1:(a=e,n(r,e,t))),i))};return l(o,n,ng).bind((e=>s?l(e.container,e.offset+(r?-1:0),rg):F.some(e))).orThunk((()=>a?F.some({container:a,offset:r?0:a.length}):F.none()))},ag=(e,t,o,n,r)=>{const s=n[r];tr(n)&&Xe(n.data)&&s&&(n=s);const a=Ju(e,n);for(let n=0;n{var r;let s=o;const a=e.getRoot(),i=t[0];if(Wu(i)&&(s=i.wrapper?null:e.getParent(o,i.block,a)),!s){const t=null!==(r=e.getParent(o,"LI,TD,TH,SUMMARY"))&&void 0!==r?r:a;s=e.getParent(tr(o)?o.parentNode:o,(t=>t!==a&&eg(e.schema,t)),t)}if(s&&Wu(i)&&i.wrapper&&(s=Ju(e,s,"ul,ol").reverse()[0]||s),!s)for(s=o;s&&s[n]&&!e.isBlock(s[n])&&(s=s[n],!Pu(s,"br")););return s||o},lg=(e,t,o,n)=>{const r=o.parentNode;return!C(o[n])&&(!(r!==t&&!x(r)&&!e.isBlock(r))||lg(e,t,r,n))},cg=(e,t,o,n,r)=>{let s=o;const a=r?"previousSibling":"nextSibling",i=e.getRoot();if(tr(o)&&!Qu(o)&&(r?n>0:nXu(e.parentNode)||Xu(e),mg=(e,t,o,n=!1)=>{let{startContainer:r,startOffset:s,endContainer:a,endOffset:i}=t;const l=o[0];return Wn(r)&&r.hasChildNodes()&&(r=Ii(r,s),tr(r)&&(s=0)),Wn(a)&&a.hasChildNodes()&&(a=Ii(a,t.collapsed?i:i-1),tr(a)&&(i=a.data.length)),r=tg(e,r),a=tg(e,a),dg(r)&&(r=Xu(r)?r:r.parentNode,r=t.collapsed?r.previousSibling||r:r.nextSibling||r,tr(r)&&(s=t.collapsed?r.length:0)),dg(a)&&(a=Xu(a)?a:a.parentNode,a=t.collapsed?a.nextSibling||a:a.previousSibling||a,tr(a)&&(i=t.collapsed?0:a.length)),t.collapsed&&(sg(e,e.getRoot(),r,s,!0,n).each((({container:e,offset:t})=>{r=e,s=t})),sg(e,e.getRoot(),a,i,!1,n).each((({container:e,offset:t})=>{a=e,i=t}))),(qu(l)||l.block_expand)&&(qu(l)&&tr(r)&&0!==s||(r=cg(e,o,r,s,!0)),qu(l)&&tr(a)&&i!==a.data.length||(a=cg(e,o,a,i,!1))),Gu(l)&&(r=ag(e,o,t,r,"previousSibling"),a=ag(e,o,t,a,"nextSibling")),(Wu(l)||$u(l))&&(r=ig(e,o,r,"previousSibling"),a=ig(e,o,a,"nextSibling"),Wu(l)&&(e.isBlock(r)||(r=cg(e,o,r,s,!0)),e.isBlock(a)||(a=cg(e,o,a,i,!1)))),Wn(r)&&r.parentNode&&(s=e.nodeIndex(r),r=r.parentNode),Wn(a)&&a.parentNode&&(i=e.nodeIndex(a)+1,a=a.parentNode),{startContainer:r,startOffset:s,endContainer:a,endOffset:i}},ug=(e,t,o)=>{var n;const r=t.startOffset,s=Ii(t.startContainer,r),a=t.endOffset,i=Ii(t.endContainer,a-1),l=e=>{const t=e[0];tr(t)&&t===s&&r>=t.data.length&&e.splice(0,1);const o=e[e.length-1];return 0===a&&e.length>0&&o===i&&tr(o)&&e.splice(e.length-1,1),e},c=(e,t,o)=>{const n=[];for(;e&&e!==o;e=e[t])n.push(e);return n},d=(t,o)=>e.getParent(t,(e=>e.parentNode===o),o),m=(e,t,n)=>{const r=n?"nextSibling":"previousSibling";for(let s=e,a=s.parentNode;s&&s!==t;s=a){a=s.parentNode;const t=c(s===e?s:s[r],r);t.length&&(n||t.reverse(),o(l(t)))}};if(s===i)return o(l([s]));const u=null!==(n=e.findCommonAncestor(s,i))&&void 0!==n?n:e.getRoot();if(e.isChildOf(s,i))return m(s,u,!0);if(e.isChildOf(i,s))return m(i,u);const g=d(s,u)||s,h=d(i,u)||i;m(s,g,!0);const p=c(g===s?g:g.nextSibling,"nextSibling",h===i?h.nextSibling:h);p.length&&o(l(p)),m(i,h)},gg=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],hg=(e,t,o,n)=>Oo(t).fold((()=>"skipping"),(r=>"br"===n||(e=>Kt(e)&&xr(e)===Br)(t)?"valid":(e=>Gt(e)&&vo(e,ci()))(t)?"existing":Xm(t.dom)?"caret":W(gg,(e=>xo(t,e)))?"valid-block":Bu(e,o,n)&&Bu(e,jt(r),o)?"valid":"invalid-child")),pg=(e,t,o,n,r,s)=>{const{uid:a=t,...i}=o;go(e,ci()),eo(e,`${mi()}`,a),eo(e,`${di()}`,n);const{attributes:l={},classes:c=[]}=r(a,i);if(to(e,l),((e,t)=>{q(t,(t=>{go(e,t)}))})(e,c),s){c.length>0&&eo(e,`${gi()}`,c.join(","));const t=he(l);t.length>0&&eo(e,`${hi()}`,t.join(","))}},fg=e=>{po(e,ci()),so(e,`${mi()}`),so(e,`${di()}`),so(e,`${ui()}`);const t=no(e,`${hi()}`).map((e=>e.split(","))).getOr([]),o=no(e,`${gi()}`).map((e=>e.split(","))).getOr([]);var n;q(t,(t=>so(e,t))),n=e,q(o,(e=>{po(n,e)})),so(e,`${gi()}`),so(e,`${hi()}`)},vg=(e,t,o,n,r)=>{const s=yo.fromTag("span",e);return pg(s,t,o,n,r,!1),s},bg=(e,t,o,n,r,s)=>{const a=[],i=vg(e.getDoc(),o,s,n,r),l=ai(),c=()=>{l.clear()},d=e=>{q(e,m)},m=t=>{switch(hg(e,t,"span",jt(t))){case"invalid-child":{c();const e=Lo(t);d(e),c();break}case"valid-block":c(),pg(t,o,s,n,r,!0);break;case"valid":{const e=l.get().getOrThunk((()=>{const e=ki(i);return a.push(e),l.set(e),e}));yn(t,e);break}}};return ug(e.dom,t,(e=>{c(),(e=>{const t=$(e,yo.fromDom);d(t)})(e)})),a},yg=(e,t,o,n)=>{e.undoManager.transact((()=>{const r=e.selection,s=r.getRng(),a=yu(e).length>0,i=Ci("mce-annotation");if(s.collapsed&&!a&&((e,t)=>{const o=mg(e.dom,t,[{inline:"span"}]);t.setStart(o.startContainer,o.startOffset),t.setEnd(o.endContainer,o.endOffset),e.selection.setRng(t)})(e,s),r.getRng().collapsed&&!a){const s=vg(e.getDoc(),i,n,t,o.decorate);En(s,br),r.getRng().insertNode(s.dom),r.select(s.dom)}else Tu(r,!1,(()=>{Eu(e,(r=>{bg(e,r,i,t,o.decorate,n)}))}))}))},wg=e=>{const t=(()=>{const e={};return{register:(t,o)=>{e[t]={name:t,settings:o}},lookup:t=>ke(e,t).map((e=>e.settings)),getNames:()=>he(e)}})();((e,t)=>{const o=di(),n=e=>F.from(e.attr(o)).bind(t.lookup),r=e=>{var t,o;e.attr(mi(),null),e.attr(di(),null),e.attr(ui(),null);const n=F.from(e.attr(hi())).map((e=>e.split(","))).getOr([]),r=F.from(e.attr(gi())).map((e=>e.split(","))).getOr([]);q(n,(t=>e.attr(t,null)));const s=null!==(o=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==o?o:[],a=ae(s,[ci()].concat(r));e.attr("class",a.length>0?a.join(" "):null),e.attr(gi(),null),e.attr(hi(),null)};e.serializer.addTempAttr(ui()),e.serializer.addAttributeFilter(o,(e=>{for(const t of e)n(t).each((e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))}))}))})(e,t);const o=wi(e,t),n=Jt("span"),r=e=>{q(e,(e=>{n(e)?Sn(e):fg(e)}))};return{register:(e,o)=>{t.register(e,o)},annotate:(o,n)=>{t.lookup(o).each((t=>{yg(e,o,t,n)}))},annotationChanged:(e,t)=>{o.addListener(e,t)},remove:t=>{fi(e,F.some(t)).each((({elements:t})=>{const o=e.selection.getBookmark();r(t),e.selection.moveToBookmark(o)}))},removeAll:t=>{const o=e.selection.getBookmark();fe(yi(e,t),((e,t)=>{r(e)})),e.selection.moveToBookmark(o)},getAll:t=>{const o=yi(e,t);return ve(o,(e=>$(e,(e=>e.dom))))}}},xg=e=>({getBookmark:N(cu,e),moveToBookmark:N(du,e)});xg.isBookmarkNode=mu;const Cg=(e,t,o)=>!o.collapsed&&W(o.getClientRects(),(o=>((e,t,o)=>t>=e.left&&t<=e.right&&o>=e.top&&o<=e.bottom)(o,e,t))),Sg=(e,t,o)=>{e.dispatch(t,o)},kg=(e,t,o,n)=>{e.dispatch("FormatApply",{format:t,node:o,vars:n})},_g=(e,t,o,n)=>{e.dispatch("FormatRemove",{format:t,node:o,vars:n})},Eg=(e,t)=>e.dispatch("SetContent",t),Tg=(e,t)=>e.dispatch("GetContent",t),Og=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),Dg={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||Dg.metaKeyPressed(e),metaKeyPressed:e=>At.os.isMacOS()||At.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},Ag="data-mce-selected",Mg=Math.abs,Ng=Math.round,Rg={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},Bg=(e,t)=>{const o=t.dom,n=t.getDoc(),r=document,s=t.getBody();let a,i,l,c,d,m,u,g,h,p,f,v,b,y,w;const x=e=>C(e)&&(lr(e)||o.is(e,"figure.image")),S=e=>gr(e)||o.hasClass(e,"mce-preview-object"),k=e=>{const o=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const o=e.touches[0];return x(e.target)&&!Cg(o.clientX,o.clientY,t)}return x(e.target)&&!Cg(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(o)},_=e=>o.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?[e,e.firstElementChild]:o.is(e,"figure.image")?[e.querySelector("img")]:[e],E=e=>{const n=kc(t);return!!n&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(o.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?xo(yo.fromDom(e.firstElementChild),n):xo(yo.fromDom(e),n))},T=(e,n,r)=>{if(C(r)){const s=_(e);q(s,(e=>{e.style[n]||!t.schema.isValid(e.nodeName.toLowerCase(),n)?o.setStyle(e,n,r):o.setAttrib(e,n,""+r)}))}},O=(e,t,o)=>{T(e,"width",t),T(e,"height",o)},D=e=>{let n,r,d,C,k;n=e.screenX-m,r=e.screenY-u,v=n*c[2]+g,b=r*c[3]+h,v=v<5?5:v,b=b<5?5:b,d=(x(a)||S(a))&&!1!==_c(t)?!Dg.modifierPressed(e):Dg.modifierPressed(e),d&&(Mg(n)>Mg(r)?(b=Ng(v*p),v=Ng(b/p)):(v=Ng(b/p),b=Ng(v*p))),O(i,v,b),C=c.startPos.x+n,k=c.startPos.y+r,C=C>0?C:0,k=k>0?k:0,o.setStyles(l,{left:C,top:k,display:"block"}),l.innerHTML=v+" × "+b,c[2]<0&&i.clientWidth<=v&&o.setStyle(i,"left",void 0+(g-v)),c[3]<0&&i.clientHeight<=b&&o.setStyle(i,"top",void 0+(h-b)),n=s.scrollWidth-y,r=s.scrollHeight-w,n+r!==0&&o.setStyles(l,{left:C-n,top:k-r}),f||(((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(t,a,g,h,"corner-"+c.name),f=!0)},A=()=>{const e=f;f=!1,e&&(T(a,"width",v),T(a,"height",b)),o.unbind(n,"mousemove",D),o.unbind(n,"mouseup",A),r!==n&&(o.unbind(r,"mousemove",D),o.unbind(r,"mouseup",A)),o.remove(i),o.remove(l),o.remove(d),M(a),e&&(((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(t,a,v,b,"corner-"+c.name),o.setAttrib(a,"style",o.getAttrib(a,"style"))),t.nodeChanged()},M=e=>{H();const f=o.getPos(e,s),x=f.x,C=f.y,k=e.getBoundingClientRect(),T=k.width||k.right-k.left,M=k.height||k.bottom-k.top;a!==e&&(R(),a=e,v=b=0);const N=t.dispatch("ObjectSelected",{target:e});E(e)&&!N.isDefaultPrevented()?fe(Rg,((e,t)=>{const f=f=>{const v=_(a)[0];var b;m=f.screenX,u=f.screenY,g=v.clientWidth,h=v.clientHeight,p=h/g,c=e,c.name=t,c.startPos={x:T*e[0]+x,y:M*e[1]+C},y=s.scrollWidth,w=s.scrollHeight,d=o.add(s,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),o.setStyles(d,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),i=S(b=a)?o.create("img",{src:At.transparentSrc}):b.cloneNode(!0),o.addClass(i,"mce-clonedresizable"),o.setAttrib(i,"data-mce-bogus","all"),i.contentEditable="false",o.setStyles(i,{left:x,top:C,margin:0}),O(i,T,M),i.removeAttribute(Ag),s.appendChild(i),o.bind(n,"mousemove",D),o.bind(n,"mouseup",A),r!==n&&(o.bind(r,"mousemove",D),o.bind(r,"mouseup",A)),l=o.add(s,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},g+" × "+h)};let v=o.get("mceResizeHandle"+t);v&&o.remove(v),v=o.add(s,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),o.bind(v,"mousedown",(e=>{e.stopImmediatePropagation(),e.preventDefault(),f(e)})),e.elm=v,o.setStyles(v,{left:T*e[0]+x-v.offsetWidth/2,top:M*e[1]+C-v.offsetHeight/2})})):R(!1)},N=ii(M,0),R=(e=!0)=>{N.cancel(),H(),a&&e&&a.removeAttribute(Ag),fe(Rg,((e,t)=>{const n=o.get("mceResizeHandle"+t);n&&(o.unbind(n),o.remove(n))}))},B=(e,t)=>o.isChildOf(e,t),L=n=>{if(f||t.removed||t.composing)return;const r="mousedown"===n.type?n.target:e.getNode(),a=on(yo.fromDom(r),"table,img,figure.image,hr,video,span.mce-preview-object,details").map((e=>e.dom)).filter((e=>o.isEditable(e.parentElement)||"IMG"===e.nodeName&&o.isEditable(e))).getOrUndefined(),i=C(a)?o.getAttrib(a,Ag,"1"):"1";if(q(o.select(`img[${Ag}],hr[${Ag}]`),(e=>{e.removeAttribute(Ag)})),C(a)&&B(a,s)&&t.hasFocus()){I();const t=e.getStart(!0);if(B(t,a)&&B(e.getEnd(!0),a))return o.setAttrib(a,Ag,i),void N.throttle(a)}R()},H=()=>{fe(Rg,(e=>{e.elm&&(o.unbind(e.elm),delete e.elm)}))},I=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch(e){}};return t.on("init",(()=>{I(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",L),t.on("keyup compositionend",(e=>{a&&"TABLE"===a.nodeName&&L(e)})),t.on("hide blur",R),t.on("contextmenu longpress",k,!0)})),t.on("remove",H),{isResizable:E,showResizeRect:M,hideResizeRect:R,updateResizeRect:L,destroy:()=>{N.cancel(),a=i=d=null}}},Lg=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.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},Hg=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},Ig=Al([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Pg=(e,t,o)=>t(yo.fromDom(o.startContainer),o.startOffset,yo.fromDom(o.endContainer),o.endOffset),Fg=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:D(e),rtl:F.none}),relative:(t,o)=>({ltr:He((()=>Lg(e,t,o))),rtl:He((()=>F.some(Lg(e,o,t))))}),exact:(t,o,n,r)=>({ltr:He((()=>Hg(e,t,o,n,r))),rtl:He((()=>F.some(Hg(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>Ig.rtl(yo.fromDom(e.endContainer),e.endOffset,yo.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Pg(0,Ig.ltr,o))):Pg(0,Ig.ltr,o)})(0,o)};Ig.ltr,Ig.rtl;const zg=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Vg=(e,t,o)=>{var n,r;return F.from(null===(r=(n=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(n,t,o)).bind((t=>{if(null===t.offsetNode)return F.none();const o=e.dom.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),F.some(o)}))},Zg=(e,t,o)=>{var n,r;return F.from(null===(r=(n=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(n,t,o))},Ug=document.caretPositionFromPoint?Vg:document.caretRangeFromPoint?Zg:F.none,jg=Al([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Wg={before:jg.before,on:jg.on,after:jg.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(A,A,A)},$g=Al([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),qg={domRange:$g.domRange,relative:$g.relative,exact:$g.exact,exactFromRange:e=>$g.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>yo.fromDom(e.startContainer),relative:(e,t)=>Wg.getStart(e),exact:(e,t,o,n)=>e}))(e);return To(t)},range:zg},Gg=(e,t)=>{const o=jt(e);return"input"===o?Wg.after(e):j(["br","img"],o)?0===t?Wg.before(e):Wg.after(e):Wg.on(e,t)},Kg=(e,t)=>{const o=e.fold(Wg.before,Gg,Wg.after),n=t.fold(Wg.before,Gg,Wg.after);return qg.relative(o,n)},Yg=(e,t,o,n)=>{const r=Gg(e,t),s=Gg(o,n);return qg.relative(r,s)},Xg=(e,t)=>{const o=(t||document).createDocumentFragment();return q(e,(e=>{o.appendChild(e.dom)})),yo.fromDom(o)},Jg=e=>{const t=qg.getWin(e).dom,o=(e,o,n,r)=>Hg(t,e,o,n,r),n=(e=>e.match({domRange:e=>{const t=yo.fromDom(e.startContainer),o=yo.fromDom(e.endContainer);return Yg(t,e.startOffset,o,e.endOffset)},relative:Kg,exact:Yg}))(e);return Fg(t,n).match({ltr:o,rtl:o})},Qg=(e,t,o)=>((e,t,o)=>{const n=yo.fromDom(e.document);return Ug(n,t,o).map((e=>zg(yo.fromDom(e.startContainer),e.startOffset,yo.fromDom(e.endContainer),e.endOffset)))})(e,t,o),eh=(e,t,o)=>{const n=To(yo.fromDom(o));return Qg(n.dom,e,t).map((e=>{const t=o.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t})).getOrUndefined()},th=(e,t)=>C(e)&&C(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,oh=(e,t,o)=>null!==((e,t,o)=>{let n=e;for(;n&&n!==t;){if(o(n))return n;n=n.parentNode}return null})(e,t,o),nh=(e,t,o)=>oh(e,t,(e=>e.nodeName===o)),rh=(e,t)=>Vr(e)&&!oh(e,t,Xm),sh=(e,t,o)=>{const n=t.parentNode;if(n){const r=new Zn(t,e.getParent(n,e.isBlock)||e.getRoot());let s;for(;s=r[o?"prev":"next"]();)if(ir(s))return!0}return!1},ah=(e,t,o,n,r)=>{const s=e.getRoot(),a=e.schema.getNonEmptyElements(),i=r.parentNode;let l,c;if(!i)return F.none();const d=e.getParent(i,e.isBlock)||s;if(n&&ir(r)&&t&&e.isEmpty(d))return F.some(rl(i,e.nodeIndex(r)));const m=new Zn(r,d);for(;c=m[n?"prev":"next"]();){if("false"===e.getContentEditableParent(c)||rh(c,s))return F.none();if(tr(c)&&c.data.length>0)return nh(c,s,"A")?F.none():F.some(rl(c,n?c.data.length:0));if(e.isBlock(c)||a[c.nodeName.toLowerCase()])return F.none();l=c}return rr(l)?F.none():o&&l?F.some(rl(l,0)):F.none()},ih=(e,t,o,n)=>{const r=e.getRoot();let s,a=!1,i=o?n.startContainer:n.endContainer,l=o?n.startOffset:n.endOffset;const c=Wn(i)&&l===i.childNodes.length,d=e.schema.getNonEmptyElements();let m=o;if(Vr(i))return F.none();if(Wn(i)&&l>i.childNodes.length-1&&(m=!1),sr(i)&&(i=r,l=0),i===r){if(m&&(s=i.childNodes[l>0?l-1:0],s)){if(Vr(s))return F.none();if(d[s.nodeName]||Jn(s))return F.none()}if(i.hasChildNodes()){if(l=Math.min(!m&&l>0?l-1:l,i.childNodes.length-1),i=i.childNodes[l],l=tr(i)&&c?i.data.length:0,!t&&i===r.lastChild&&Jn(i))return F.none();if(((e,t)=>{let o=t;for(;o&&o!==e;){if(dr(o))return!0;o=o.parentNode}return!1})(r,i)||Vr(i))return F.none();if(pr(i))return F.none();if(i.hasChildNodes()&&!Jn(i)){s=i;const t=new Zn(i,r);do{if(dr(s)||Vr(s)){a=!1;break}if(tr(s)&&s.data.length>0){l=m?0:s.data.length,i=s,a=!0;break}if(d[s.nodeName.toLowerCase()]&&!ur(s)){l=e.nodeIndex(s),i=s.parentNode,m||l++,a=!0;break}}while(s=m?t.next():t.prev())}}}return t&&(tr(i)&&0===l&&ah(e,c,t,!0,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),Wn(i)&&(s=i.childNodes[l],s||(s=i.childNodes[l-1]),!s||!ir(s)||((e,t)=>{var o;return(null===(o=e.previousSibling)||void 0===o?void 0:o.nodeName)===t})(s,"A")||sh(e,s,!1)||sh(e,s,!0)||ah(e,c,t,!0,s).each((e=>{i=e.container(),l=e.offset(),a=!0})))),m&&!t&&tr(i)&&l===i.data.length&&ah(e,c,t,!1,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),a&&i?F.some(rl(i,l)):F.none()},lh=(e,t)=>{const o=t.collapsed,n=t.cloneRange(),r=rl.fromRangeStart(t);return ih(e,o,!0,n).each((e=>{o&&rl.isAbove(r,e)||n.setStart(e.container(),e.offset())})),o||ih(e,o,!1,n).each((e=>{n.setEnd(e.container(),e.offset())})),o&&n.collapse(!0),th(t,n)?F.none():F.some(n)},ch=(e,t)=>e.splitText(t),dh=e=>{let t=e.startContainer,o=e.startOffset,n=e.endContainer,r=e.endOffset;if(t===n&&tr(t)){if(o>0&&oo){r-=o;const e=ch(n,r).previousSibling;t=n=e,r=e.data.length,o=0}else r=0}else if(tr(t)&&o>0&&o0&&r({walk:(t,o)=>ug(e,t,o),split:dh,expand:(t,o={type:"word"})=>{if("word"===o.type){const o=mg(e,t,[{inline:"span"}]),n=e.createRng();return n.setStart(o.startContainer,o.startOffset),n.setEnd(o.endContainer,o.endOffset),n}return t},normalize:t=>lh(e,t).fold(I,(e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0)))});mh.compareRanges=th,mh.getCaretRangeFromPoint=eh,mh.getSelectedNode=Hi,mh.getNode=Ii;const uh=((e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=dn(o,e);return parseFloat(t)||0}return n},n=(e,t)=>J(t,((t,o)=>{const n=dn(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!k(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;sn(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}})("height",(e=>{const t=e.dom;return Go(e)?t.getBoundingClientRect().height:t.offsetHeight})),gh=()=>yo.fromDom(document),hh=(e,t)=>e.view(t).fold(D([]),(t=>{const o=e.owner(t),n=hh(e,o);return[t].concat(n)}));var ph=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?F.none():F.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(yo.fromDom)},owner:e=>Eo(e)});const fh=e=>{const t=gh(),o=Bn(t),n=((e,t)=>{const o=t.owner(e);return hh(t,o)})(e,ph),r=Rn(e),s=X(n,((e,t)=>{const o=Rn(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return Mn(s.left+r.left+o.left,s.top+r.top+o.top)},vh=e=>"textarea"===jt(e),bh=(e,t)=>{const o=(e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Mn(o.offsetLeft,o.offsetTop);const s=Nn(null==n?void 0:n.pageYOffset,r.scrollTop),a=Nn(null==n?void 0:n.pageXOffset,r.scrollLeft),i=Nn(r.clientTop,o.clientTop),l=Nn(r.clientLeft,o.clientLeft);return Rn(e).translate(a-l,s-i)})(e),n=(e=>uh.get(e))(e);return{element:e,bottom:o.top+n,height:n,pos:o,cleanup:t}},yh=(e,t)=>{const o=((e,t)=>{const o=Lo(e);if(0===o.length||vh(e))return{element:e,offset:t};if(t\ufeff');return pn(o.element,n),bh(n,(()=>Cn(n)))},wh=(e,t,o,n)=>{kh(e,((r,s)=>Ch(e,t,o,n)),o)},xh=(e,t,o,n,r)=>{const s={elm:n.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,s)||(o(e,t,Bn(t).top,n,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,s))},Ch=(e,t,o,n)=>{const r=yo.fromDom(e.getBody()),s=yo.fromDom(e.getDoc());r.dom.offsetWidth;const a=yh(yo.fromDom(o.startContainer),o.startOffset);xh(e,s,t,a,n),a.cleanup()},Sh=(e,t,o,n)=>{const r=yo.fromDom(e.getDoc());xh(e,r,o,(e=>bh(yo.fromDom(e),E))(t),n)},kh=(e,t,o)=>{const n=o.startContainer,r=o.startOffset,s=o.endContainer,a=o.endOffset;t(yo.fromDom(n),yo.fromDom(s));const i=e.dom.createRng();i.setStart(n,r),i.setEnd(s,a),e.selection.setRng(o)},_h=(e,t,o,n,r)=>{const s=t.pos;if(n)Ln(s.left,s.top,r);else{const n=s.top-o+t.height;Ln(-e.getBody().getBoundingClientRect().left,n,r)}},Eh=(e,t,o,n,r,s)=>{const a=n+o,i=r.pos.top,l=r.bottom,c=l-i>=n;ia?_h(e,r,n,c?!1!==s:!0===s,t):l>a&&!c&&_h(e,r,n,!0===s,t)},Th=(e,t,o,n,r)=>{const s=To(t).dom.innerHeight;Eh(e,t,o,s,n,r)},Oh=(e,t,o,n,r)=>{const s=To(t).dom.innerHeight;Eh(e,t,o,s,n,r);const a=fh(n.element),i=Pn(window);a.topi.bottom&&Hn(n.element,!0===r)},Dh=(e,t,o)=>wh(e,Th,t,o),Ah=(e,t,o)=>Sh(e,t,Th,o),Mh=(e,t,o)=>wh(e,Oh,t,o),Nh=(e,t,o)=>Sh(e,t,Oh,o),Rh=(e,t,o)=>{(e.inline?Dh:Mh)(e,t,o)},Bh=(e,t=!1)=>e.dom.focus({preventScroll:t}),Lh=e=>{const t=Uo(e).dom;return e.dom===t.activeElement},Hh=(e=gh())=>F.from(e.dom.activeElement).map(yo.fromDom),Ih=(e,t)=>{const o=Kt(t)?xr(t).length:Lo(t).length+1;return e>o?o:e<0?0:e},Ph=e=>qg.range(e.start,Ih(e.soffset,e.start),e.finish,Ih(e.foffset,e.finish)),Fh=(e,t)=>!jn(t.dom)&&(ko(e,t)||So(e,t)),zh=e=>t=>Fh(e,t.start)&&Fh(e,t.finish),Vh=e=>qg.range(yo.fromDom(e.startContainer),e.startOffset,yo.fromDom(e.endContainer),e.endOffset),Zh=e=>(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?F.from(t.getRangeAt(0)):F.none()).map(Vh)})(To(e).dom).filter(zh(e)),Uh=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),F.some(t)}catch(e){return F.none()}},jh=e=>{const t=(e=>e.inline||At.browser.isFirefox())(e)?Zh(yo.fromDom(e.getBody())):F.none();e.bookmark=t.isSome()?t:e.bookmark},Wh=e=>(e.bookmark?e.bookmark:F.none()).bind((t=>((e,t)=>F.from(t).filter(zh(e)).map(Ph))(yo.fromDom(e.getBody()),t))).bind(Uh),$h={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},qh={setEditorTimeout:(e,t,o)=>((e,t)=>(k(t)||(t=0),setTimeout(e,t)))((()=>{e.removed||t()}),o),setEditorInterval:(e,t,o)=>{const n=((e,t)=>(k(t)||(t=0),setInterval(e,t)))((()=>{e.removed?clearInterval(n):t()}),o);return n}},Gh=e=>{const t=ii((()=>{jh(e)}),0);e.on("init",(()=>{e.inline&&((e,t)=>{const o=()=>{t.throttle()};Ya.DOM.bind(document,"mouseup",o),e.on("remove",(()=>{Ya.DOM.unbind(document,"mouseup",o)}))})(e,t),((e,t)=>{((e,t)=>{e.on("mouseup touchend",(e=>{t.throttle()}))})(e,t),e.on("keyup NodeChange AfterSetSelectionRange",(t=>{(e=>"nodechange"===e.type&&e.selectionChange)(t)||jh(e)}))})(e,t)})),e.on("remove",(()=>{t.cancel()}))};let Kh;const Yh=Ya.DOM,Xh=e=>{const t=e.classList;return void 0!==t&&(t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"))},Jh=(e,t)=>{const o=Pc(e),n=Yh.getParent(t,(t=>(e=>Wn(e)&&$h.isEditorUIElement(e))(t)||!!o&&e.dom.is(t,o)));return null!==n},Qh=e=>{try{const t=Uo(yo.fromDom(e.getElement()));return Hh(t).fold((()=>document.body),(e=>e.dom))}catch(e){return document.body}},ep=(e,t)=>{const o=t.editor;Gh(o);const n=(e,t)=>{Ed(e)&&!0!==e.inline&&t(yo.fromDom(e.getContainer()),"tox-edit-focus")};o.on("focusin",(()=>{const t=e.focusedEditor;Xh(Qh(o))&&n(o,go),t!==o&&(t&&t.dispatch("blur",{focusedEditor:o}),e.setActive(o),e.focusedEditor=o,o.dispatch("focus",{blurredEditor:t}),o.focus(!0))})),o.on("focusout",(()=>{qh.setEditorTimeout(o,(()=>{const t=e.focusedEditor;Xh(Qh(o))&&t===o||n(o,po),Jh(o,Qh(o))||t!==o||(o.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)}))})),Kh||(Kh=t=>{const o=e.activeEditor;o&&$o(t).each((t=>{const n=t;n.ownerDocument===document&&(n===document.body||Jh(o,n)||e.focusedEditor!==o||(o.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))}))},Yh.bind(document,"focusin",Kh))},tp=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&Kh&&(Yh.unbind(document,"focusin",Kh),Kh=null)},op=(e,t)=>(e=>e.collapsed?F.from(Ii(e.startContainer,e.startOffset)).map(yo.fromDom):F.none())(t).bind((t=>Or(t)?F.some(t):ko(e,t)?F.none():F.some(e))),np=(e,t)=>{op(yo.fromDom(e.getBody()),t).bind((e=>Gm(e.dom))).fold((()=>{e.selection.normalize()}),(t=>e.selection.setRng(t.toRange())))},rp=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},sp=e=>{return Lh(e)||(t=e,Hh(Uo(t)).filter((e=>t.dom.contains(e.dom)))).isSome();var t},ap=e=>e.inline?(e=>{const t=e.getBody();return t&&sp(yo.fromDom(t))})(e):(e=>C(e.iframeElement)&&Lh(yo.fromDom(e.iframeElement)))(e),ip=e=>ap(e)||(e=>{const t=Uo(yo.fromDom(e.getElement()));return Hh(t).filter((t=>!Xh(t.dom)&&Jh(e,t.dom))).isSome()})(e),lp=e=>e.editorManager.setActive(e),cp=(e,t)=>{e.removed||(t?lp(e):(e=>{const t=e.selection,o=e.getBody();let n=t.getRng();e.quirks.refreshContentEditable(),C(e.bookmark)&&!ap(e)&&Wh(e).each((t=>{e.selection.setRng(t),n=t}));const r=((e,t)=>e.dom.getParent(t,(t=>"true"===e.dom.getContentEditable(t))))(e,t.getNode());if(r&&e.dom.isChildOf(r,o))return rp(r),np(e,n),void lp(e);e.inline||(At.browser.isOpera()||rp(o),e.getWin().focus()),(At.browser.isFirefox()||e.inline)&&(rp(o),np(e,n)),lp(e)})(e))},dp=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),mp=(e,t,o,n,r)=>{const s=o?t.startContainer:t.endContainer,a=o?t.startOffset:t.endOffset;return F.from(s).map(yo.fromDom).map((e=>n&&t.collapsed?e:Ho(e,r(e,a)).getOr(e))).bind((e=>Gt(e)?F.some(e):Oo(e).filter(Gt))).map((e=>e.dom)).getOr(e)},up=(e,t,o=!1)=>mp(e,t,!0,o,((e,t)=>Math.min(Fo(e),t))),gp=(e,t,o=!1)=>mp(e,t,!1,o,((e,t)=>t>0?t-1:t)),hp=(e,t)=>{const o=e;for(;e&&tr(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||o},pp=(e,t)=>$(t,(t=>{const o=e.dispatch("GetSelectionRange",{range:t});return o.range!==t?o.range:t})),fp=["img","br"],vp=e=>{const t=Cr(e).filter((e=>0!==e.trim().length||e.indexOf(br)>-1)).isSome();return t||j(fp,jt(e))||(e=>qt(e)&&"false"===oo(e,"contenteditable"))(e)},bp=(e,t)=>{const o=e=>{const n=Lo(e);for(let e=n.length-1;e>=0;e--){const r=n[e];if(t(r))return F.some(r);const s=o(r);if(s.isSome())return s}return F.none()};return o(e)},yp="[data-mce-autocompleter]",wp=(e,t)=>{if(xp(yo.fromDom(e.getBody())).isNone()){const n=yo.fromHtml('',e.getDoc());bn(n,yo.fromDom(t.extractContents())),t.insertNode(n.dom),Oo(n).each((e=>e.dom.normalize())),(o=n,bp(o,vp)).map((t=>{e.selection.setCursorLocation(t.dom,(e=>"img"===jt(e)?1:Cr(e).fold((()=>Lo(e).length),(e=>e.length)))(t))}))}var o},xp=e=>tn(e,yp),Cp={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},Sp=(e,t,o)=>{const n=o?"lastChild":"firstChild",r=o?"prev":"next";if(e[n])return e[n];if(e!==t){let o=e[r];if(o)return o;for(let n=e.parent;n&&n!==t;n=n.parent)if(o=n[r],o)return o}},kp=e=>{var t;const o=null!==(t=e.value)&&void 0!==t?t:"";if(!is(o))return!1;const n=e.parent;return!n||"span"===n.name&&!n.attr("style")||!/^[ ]+$/.test(o)},_p=e=>{const t="a"===e.name&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class Ep{static create(e,t){const o=new Ep(e,Cp[e]||1);return t&&fe(t,((e,t)=>{o.attr(t,e)})),o}constructor(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}replace(e){const t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t}attr(e,t){const o=this;if(!h(e))return C(e)&&fe(e,((e,t)=>{o.attr(t,e)})),o;const n=o.attributes;if(n){if(void 0!==t){if(null===t){if(e in n.map){delete n.map[e];let t=n.length;for(;t--;)if(n[t].name===e)return n.splice(t,1),o}return o}if(e in n.map){let o=n.length;for(;o--;)if(n[o].name===e){n[o].value=t;break}}else n.push({name:e,value:t});return n.map[e]=t,o}return n.map[e]}}clone(){const e=this,t=new Ep(e.name,e.type),o=e.attributes;if(o){const e=[];e.map={};for(let t=0,n=o.length;th(e.nodeValue)&&e.nodeValue.includes(Br),Dp=e=>(0===e.length?"":`${$(e,(e=>`[${e}]`)).join(",")},`)+'[data-mce-bogus="all"]',Ap=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,(e=>Op(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)),Mp=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>{if(Op(e)){const t=e.parentNode;return t&&_e(Tp,t.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_SKIP})),Np=e=>null!==Ap(e).nextNode(),Rp=e=>null!==Mp(e).nextNode(),Bp=(e,t)=>null!==t.querySelector(Dp(e)),Lp=(e,t)=>{q(((e,t)=>t.querySelectorAll(Dp(e)))(e,t),(t=>{const o=yo.fromDom(t);"all"===oo(o,"data-mce-bogus")?Cn(o):q(e,(e=>{ro(o,e)&&so(o,e)}))}))},Hp=e=>{let t=e.nextNode();for(;null!==t;)t.nodeValue=null,t=e.nextNode()},Ip=T(Hp,Ap),Pp=T(Hp,Mp),Fp=(e,t)=>{const o=[{condition:N(Bp,t),action:N(Lp,t)},{condition:Np,action:Ip},{condition:Rp,action:Pp}];let n=e,r=!1;return q(o,(({condition:t,action:o})=>{t(n)&&(r||(n=e.cloneNode(!0),r=!0),o(n))})),n},zp=e=>{const t=zn(e,"[data-mce-bogus]");q(t,(e=>{"all"===oo(e,"data-mce-bogus")?Cn(e):kr(e)?(pn(e,yo.fromText(vr)),Cn(e)):Sn(e)}))},Vp=e=>{const t=zn(e,"input");q(t,(e=>{so(e,"name")}))},Zp=(e,t)=>{const o=e.getDoc(),n=Uo(yo.fromDom(e.getBody())),r=yo.fromTag("div",o);eo(r,"data-mce-bogus","all"),cn(r,{position:"fixed",left:"-9999999px",top:"0"}),En(r,t.innerHTML),zp(r),Vp(r);const s=(e=>zo(e)?e:yo.fromDom(Eo(e).dom.body))(n);bn(s,r);const a=Hr(r.dom.innerText);return Cn(r),a},Up=(e,t,o)=>{let n;return n="raw"===t.format?Bt.trim(Hr(Fp(o,e.serializer.getTempAttrs()).innerHTML)):"text"===t.format?Zp(e,o):"tree"===t.format?e.serializer.serialize(o,t):((e,t)=>{const o=Xl(e),n=new RegExp(`^(<${o}[^>]*>( | |\\s| |
|)<\\/${o}>[\r\n]*|
[\r\n]*)$`);return t.replace(n,"")})(e,e.serializer.serialize(o,t)),"text"!==t.format&&!Ar(yo.fromDom(o))&&h(n)?Bt.trim(n):n},jp=Bt.makeMap,Wp=e=>{const t=[],o=(e=e||{}).indent,n=jp(e.indent_before||""),r=jp(e.indent_after||""),s=ia.getEncodeFunc(e.entity_encoding||"raw",e.entities),a="xhtml"!==e.element_format;return{start:(e,i,l)=>{if(o&&n[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}if(t.push("<",e),i)for(let e=0,o=i.length;e":" />",l&&o&&r[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}},end:e=>{let n;t.push(""),o&&r[e]&&t.length>0&&(n=t[t.length-1],n.length>0&&"\n"!==n&&t.push("\n"))},text:(e,o)=>{e.length>0&&(t[t.length]=o?e:s(e))},cdata:e=>{t.push("")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,n)=>{n?t.push(""):t.push(""),o&&t.push("\n")},doctype:e=>{t.push("",o?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},$p=(e={},t=ya())=>{const o=Wp(e);return e.validate=!("validate"in e)||e.validate,{serialize:n=>{const r=e.validate,s={3:e=>{var t;o.text(null!==(t=e.value)&&void 0!==t?t:"",e.raw)},8:e=>{var t;o.comment(null!==(t=e.value)&&void 0!==t?t:"")},7:e=>{o.pi(e.name,e.value)},10:e=>{var t;o.doctype(null!==(t=e.value)&&void 0!==t?t:"")},4:e=>{var t;o.cdata(null!==(t=e.value)&&void 0!==t?t:"")},11:e=>{let t=e;if(t=t.firstChild)do{a(t)}while(t=t.next)}};o.reset();const a=e=>{var n;const i=s[e.type];if(i)i(e);else{const s=e.name,i=s in t.getVoidElements();let l=e.attributes;if(r&&l&&l.length>1){const o=[];o.map={};const n=t.getElementRule(e.name);if(n){for(let e=0,t=n.attributesOrder.length;e{qp.add(e)}));const Gp=["font","text-decoration","text-emphasis"],Kp=(e,t)=>he(e.parseStyle(e.getAttrib(t,"style"))),Yp=(e,t)=>re(Kp(e,t),(e=>!(e=>qp.has(e))(e))),Xp=(e,t,o)=>{const n=Kp(e,t),r=Kp(e,o),s=n=>{var r,s;const a=null!==(r=e.getStyle(t,n))&&void 0!==r?r:"",i=null!==(s=e.getStyle(o,n))&&void 0!==s?s:"";return Ye(a)&&Ye(i)&&a!==i};return W(n,(e=>{const t=t=>W(t,(t=>t===e));if(!t(r)&&t(Gp)){const e=Y(r,(e=>W(Gp,(t=>je(e,t)))));return W(e,s)}return s(e)}))},Jp=(e,t,o)=>F.from(o.container()).filter(tr).exists((n=>{const r=e?0:-1;return t(n.data.charAt(o.offset()+r))})),Qp=N(Jp,!0,hu),ef=N(Jp,!1,hu),tf=e=>{const t=e.container();return tr(t)&&(0===t.data.length||Lr(t.data)&&xg.isBookmarkNode(t.parentNode))},of=(e,t)=>o=>hm(e?0:-1,o).filter(t).isSome(),nf=e=>lr(e)&&"block"===dn(yo.fromDom(e),"display"),rf=e=>dr(e)&&!(e=>Wn(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),sf=of(!0,nf),af=of(!1,nf),lf=of(!0,gr),cf=of(!1,gr),df=of(!0,Jn),mf=of(!1,Jn),uf=of(!0,rf),gf=of(!1,rf),hf=(e,t)=>((e,t,o)=>ko(t,e)?Ao(e,(e=>o(e)||So(e,t))).slice(0,-1):[])(e,t,I),pf=(e,t)=>[e].concat(hf(e,t)),ff=(e,t,o)=>jm(e,t,o,tf),vf=(e,t,o)=>ee(pf(yo.fromDom(t.container()),e),(e=>t=>e.isBlock(jt(t)))(o)),bf=(e,t,o,n)=>ff(e,t.dom,o).forall((e=>vf(t,o,n).fold((()=>!gm(e,o,t.dom)),(n=>!gm(e,o,t.dom)&&ko(n,yo.fromDom(e.container())))))),yf=(e,t,o,n)=>vf(t,o,n).fold((()=>ff(e,t.dom,o).forall((e=>!gm(e,o,t.dom)))),(t=>ff(e,t.dom,o).isNone())),wf=N(yf,!1),xf=N(yf,!0),Cf=N(bf,!1),Sf=N(bf,!0),kf=e=>Sm(e).exists(kr),_f=(e,t,o,n)=>{const r=Y(pf(yo.fromDom(o.container()),t),(e=>n.isBlock(jt(e)))),s=de(r).getOr(t);return Zm(e,s.dom,o).filter(kf)},Ef=(e,t,o)=>Sm(t).exists(kr)||_f(!0,e,t,o).isSome(),Tf=(e,t,o)=>(e=>F.from(e.getNode(!0)).map(yo.fromDom))(t).exists(kr)||_f(!1,e,t,o).isSome(),Of=N(_f,!1),Df=N(_f,!0),Af=e=>rl.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),Mf=(e,t,o)=>{const n=Y(pf(yo.fromDom(t.container()),e),(e=>o.isBlock(jt(e))));return de(n).getOr(e)},Nf=(e,t,o)=>Af(t)?ef(t):ef(t)||qm(Mf(e,t,o).dom,t).exists(ef),Rf=(e,t,o)=>Af(t)?Qp(t):Qp(t)||$m(Mf(e,t,o).dom,t).exists(Qp),Bf=e=>Sm(e).bind((e=>Xo(e,Gt))).exists((e=>(e=>j(["pre","pre-wrap"],e))(dn(e,"white-space")))),Lf=(e,t,o)=>((e,t)=>qm(e.dom,t).isNone())(e,t)||((e,t)=>$m(e.dom,t).isNone())(e,t)||wf(e,t,o)||xf(e,t,o)||Tf(e,t,o)||Ef(e,t,o),Hf=(e,t)=>o=>{return n=new Zn(o,e)[t](),C(n)&&dr(n)&&om(n);var n},If=(e,t,o)=>!Bf(t)&&(Lf(e,t,o)||Nf(e,t,o)||Rf(e,t,o)),Pf=(e,t,o)=>!Bf(t)&&(wf(e,t,o)||Cf(e,t,o)||Tf(e,t,o)||Nf(e,t,o)||((e,t)=>{const o=qm(e.dom,t).getOr(t),n=Hf(e.dom,"prev");return t.isAtStart()&&(n(t.container())||n(o.container()))})(e,t)),Ff=(e,t,o)=>!Bf(t)&&(xf(e,t,o)||Sf(e,t,o)||Ef(e,t,o)||Rf(e,t,o)||((e,t)=>{const o=$m(e.dom,t).getOr(t),n=Hf(e.dom,"next");return t.isAtEnd()&&(n(t.container())||n(o.container()))})(e,t)),zf=(e,t,o)=>Pf(e,t,o)||Ff(e,(e=>{const t=e.container(),o=e.offset();return tr(t)&&ouu(e.charAt(t)),Zf=(e,t)=>hu(e.charAt(t)),Uf=(e,t,o,n)=>{const r=t.data,s=rl(t,0);return o||!Vf(r,0)||zf(e,s,n)?!!(o&&Zf(r,0)&&Pf(e,s,n))&&(t.data=br+r.slice(1),!0):(t.data=" "+r.slice(1),!0)},jf=e=>{const t=e.data,o=(e=>{const t=e.split("");return $(t,((e,o)=>uu(e)&&o>0&&o{const r=t.data,s=rl(t,r.length-1);return o||!Vf(r,r.length-1)||zf(e,s,n)?!!(o&&Zf(r,r.length-1)&&Ff(e,s,n))&&(t.data=r.slice(0,-1)+br,!0):(t.data=r.slice(0,-1)+" ",!0)},$f=(e,t,o)=>{const n=t.container();if(!tr(n))return F.none();if((e=>{const t=e.container();return tr(t)&&Ue(t.data,br)})(t)){const r=Uf(e,n,!1,o)||jf(n)||Wf(e,n,!1,o);return Pt(r,t)}if(zf(e,t,o)){const r=Uf(e,n,!0,o)||Wf(e,n,!0,o);return Pt(r,t)}return F.none()},qf=(e,t,o,n)=>{if(0===o)return;const r=yo.fromDom(e),s=Yo(r,(e=>n.isBlock(jt(e)))).getOr(r),a=e.data.slice(t,t+o),i=t+o>=e.data.length&&Ff(s,rl(e,e.data.length),n),l=0===t&&Pf(s,rl(e,0),n);e.replaceData(t,o,ds(a,4,l,i))},Gf=(e,t,o)=>{const n=e.data.slice(t),r=n.length-Ge(n).length;qf(e,t,r,o)},Kf=(e,t,o)=>{const n=e.data.slice(0,t),r=n.length-Ke(n).length;qf(e,t-r,r,o)},Yf=(e,t,o,n,r=!0)=>{const s=Ke(e.data).length,a=r?e:t,i=r?t:e;return r?a.appendData(i.data):a.insertData(0,i.data),Cn(yo.fromDom(i)),n&&Gf(a,s,o),a},Xf=(e,t)=>((e,t)=>{const o=e.container(),n=e.offset();return!rl.isTextPosition(e)&&o===t.parentNode&&n>rl.before(t).offset()})(t,e)?rl(t.container(),t.offset()-1):t,Jf=e=>{return ns(e.previousSibling)?F.some((t=e.previousSibling,tr(t)?rl(t,t.data.length):rl.after(t))):e.previousSibling?Km(e.previousSibling):F.none();var t},Qf=e=>{return ns(e.nextSibling)?F.some((t=e.nextSibling,tr(t)?rl(t,0):rl.before(t))):e.nextSibling?Gm(e.nextSibling):F.none();var t},ev=(e,t)=>Jf(t).orThunk((()=>Qf(t))).orThunk((()=>((e,t)=>F.from(t.previousSibling?t.previousSibling:t.parentNode).bind((t=>qm(e,rl.before(t)))).orThunk((()=>$m(e,rl.after(t)))))(e,t))),tv=(e,t)=>Qf(t).orThunk((()=>Jf(t))).orThunk((()=>((e,t)=>$m(e,rl.after(t)).orThunk((()=>qm(e,rl.before(t)))))(e,t))),ov=(e,t,o)=>((e,t,o)=>e?tv(t,o):ev(t,o))(e,t,o).map(N(Xf,o)),nv=(e,t,o)=>{o.fold((()=>{e.focus()}),(o=>{e.selection.setRng(o.toRange(),t)}))},rv=(e,t)=>t&&_e(e.schema.getBlockElements(),jt(t)),sv=(e,t,o,n)=>{const r=Mo(e).filter(Kt),s=No(e).filter(Kt);return Cn(e),(a=r,i=s,l=t,c=(e,t,r)=>{const s=e.dom,a=t.dom,i=s.data.length;return Yf(s,a,o,n),r.container()===a?rl(s,i):r},a.isSome()&&i.isSome()&&l.isSome()?F.some(c(a.getOrDie(),i.getOrDie(),l.getOrDie())):F.none()).orThunk((()=>(n&&(r.each((e=>Kf(e.dom,e.dom.length,o))),s.each((e=>Gf(e.dom,0,o)))),t)));var a,i,l,c},av=(e,t,o,n=!0,r=!1)=>{const s=ov(t,e.getBody(),o.dom),a=Yo(o,N(rv,e),(i=e.getBody(),e=>e.dom===i));var i;const l=sv(o,s,e.schema,((e,t)=>_e(e.schema.getTextInlineElements(),jt(t)))(e,o));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):a.bind((e=>((e,t)=>{if(ys(e)){const o=yo.fromHtml('
');return t?q(Lo(e),(e=>{Yu(e)||Cn(e)})):xn(e),bn(e,o),F.some(rl.before(o.dom))}return F.none()})(e,r))).fold((()=>{n&&nv(e,t,l)}),(o=>{n&&nv(e,t,F.some(o))}))},iv=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,lv=(e,t)=>xo(yo.fromDom(t),Sc(e))&&!Ls(e.schema,t)&&e.dom.isEditable(t),cv=e=>{var t;return"rtl"===Ya.DOM.getStyle(e,"direction",!0)||(e=>iv.test(e))(null!==(t=e.textContent)&&void 0!==t?t:"")},dv=(e,t,o)=>{const n=((e,t,o)=>Y(Ya.DOM.getParents(o.container(),"*",t),e))(e,t,o);return F.from(n[n.length-1])},mv=(e,t)=>{const o=t.container(),n=t.offset();return e?zr(o)?tr(o.nextSibling)?rl(o.nextSibling,0):rl.after(o):Ur(t)?rl(o,n+1):t:zr(o)?tr(o.previousSibling)?rl(o.previousSibling,o.previousSibling.data.length):rl.before(o):jr(t)?rl(o,n-1):t},uv=N(mv,!0),gv=N(mv,!1),hv=(e,t)=>{const o=e=>e.stopImmediatePropagation();e.on("beforeinput input",o,!0),e.getDoc().execCommand(t),e.off("beforeinput input",o)},pv=e=>hv(e,"Delete"),fv=e=>_r(e)||Tr(e),vv=(e,t)=>ko(e,t)?Xo(t,fv,(e=>t=>Lt(Oo(t),e,So))(e)):F.none(),bv=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},yv=(e,t,o)=>It(Gm(o),Km(o),((n,r)=>{const s=mv(!0,n),a=mv(!1,r),i=mv(!1,t);return e?$m(o,i).exists((e=>e.isEqual(a)&&t.isEqual(s))):qm(o,i).exists((e=>e.isEqual(s)&&t.isEqual(a)))})).getOr(!0),wv=e=>{var t;return(8===Wt(t=e)||"#comment"===jt(t)?Mo(e):Po(e)).bind(wv).orThunk((()=>F.some(e)))},xv=(e,t,o,n=!0)=>{var r;t.deleteContents();const s=wv(o).getOr(o),a=yo.fromDom(null!==(r=e.dom.getParent(s.dom,e.dom.isBlock))&&void 0!==r?r:o.dom);if(a.dom===e.getBody()?bv(e,n):ys(a)&&(Rr(a),n&&e.selection.setCursorLocation(a.dom,0)),!So(o,a)){const e=Lt(Oo(a),o)?[]:Oo(i=a).map(Lo).map((e=>Y(e,(e=>!So(i,e))))).getOr([]);q(e.concat(Lo(o)),(e=>{So(e,a)||ko(e,a)||!ys(e)||Cn(e)}))}var i},Cv=(e,t)=>((e,t)=>{const o=e.dom;return o.parentNode?Jo(yo.fromDom(o.parentNode),(o=>!So(e,o)&&t(o))):F.none()})(e,t).isSome(),Sv=(e,t)=>Qo(e,t).isSome(),kv=e=>zn(e,"td,th"),_v=(e,t)=>wu(yo.fromDom(e),t),Ev=e=>(e=>It(e.startTable,e.endTable,((t,o)=>{const n=Sv(t,(e=>So(e,o))),r=Sv(o,(e=>So(e,t)));return n||r?{...e,startTable:n?F.none():e.startTable,endTable:r?F.none():e.endTable,isSameTable:!1,isMultiTable:!1}:e})).getOr(e))(e),Tv=(e,t)=>({start:e,end:t}),Ov=Al([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),Dv=(e,t)=>on(yo.fromDom(e),"td,th",t),Av=e=>!So(e.start,e.end),Mv=(e,t)=>wu(e.start,t).bind((o=>wu(e.end,t).bind((e=>Pt(So(o,e),o))))),Nv=e=>t=>Mv(t,e).map((e=>((e,t,o)=>({rng:e,table:t,cells:o}))(t,e,kv(e)))),Rv=(e,t,o,n)=>{if(o.collapsed||!e.forall(Av))return F.none();if(t.isSameTable){const t=e.bind(Nv(n));return F.some({start:t,end:t})}{const e=Dv(o.startContainer,n),t=Dv(o.endContainer,n),r=e.bind((e=>t=>wu(t,e).bind((e=>me(kv(e)).map((e=>Tv(t,e))))))(n)).bind(Nv(n)),s=t.bind((e=>t=>wu(t,e).bind((e=>de(kv(e)).map((e=>Tv(e,t))))))(n)).bind(Nv(n));return F.some({start:r,end:s})}},Bv=(e,t)=>te(e,(e=>So(e,t))),Lv=e=>It(Bv(e.cells,e.rng.start),Bv(e.cells,e.rng.end),((t,o)=>e.cells.slice(t,o+1))),Hv=(e,t,o)=>e.exists((e=>((e,t)=>!Av(e)&&Mv(e,t).exists((e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length})))(e,o)&&Su(e.start,t))),Iv=(e,t)=>{const{startTable:o,endTable:n}=t,r=e.cloneRange();return o.each((e=>r.setStartAfter(e.dom))),n.each((e=>r.setEndBefore(e.dom))),r},Pv=(e,t)=>{const o=(e=>t=>So(e,t))(e),n=((e,t)=>{const o=Dv(e.startContainer,t),n=Dv(e.endContainer,t);return It(o,n,Tv)})(t,o),r=((e,t)=>{const o=_v(e.startContainer,t),n=_v(e.endContainer,t),r=o.isSome(),s=n.isSome(),a=It(o,n,So).getOr(!1);return Ev({startTable:o,endTable:n,isStartInTable:r,isEndInTable:s,isSameTable:a,isMultiTable:!a&&r&&s})})(t,o);return Hv(n,t,o)?n.map((e=>Ov.singleCellTable(t,e.start))):r.isMultiTable?((e,t,o,n)=>Rv(e,t,o,n).bind((({start:e,end:n})=>{const r=e.bind(Lv).getOr([]),s=n.bind(Lv).getOr([]);if(r.length>0&&s.length>0){const e=Iv(o,t);return F.some(Ov.multiTable(r,s,e))}return F.none()})))(n,r,t,o):((e,t,o,n)=>Rv(e,t,o,n).bind((({start:e,end:t})=>e.or(t))).bind((e=>{const{isSameTable:n}=t,r=Lv(e).getOr([]);if(n&&e.cells.length===r.length)return F.some(Ov.fullTable(e.table));if(r.length>0){if(n)return F.some(Ov.partialTable(r,F.none()));{const e=Iv(o,t);return F.some(Ov.partialTable(r,F.some({...t,rng:e})))}}return F.none()})))(n,r,t,o)},Fv=e=>q(e,(e=>{so(e,"contenteditable"),Rr(e)})),zv=(e,t,o,n)=>{const r=o.cloneRange();n?(r.setStart(o.startContainer,o.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(o.endContainer,o.endOffset)),jv(e,r,t,!1).each((e=>e()))},Vv=e=>{const t=yu(e),o=yo.fromDom(e.selection.getNode());mr(o.dom)&&ys(o)?e.selection.setCursorLocation(o.dom,0):e.selection.collapse(!0),t.length>1&&W(t,(e=>So(e,o)))&&eo(o,"data-mce-selected","1")},Zv=(e,t,o)=>F.some((()=>{const n=e.selection.getRng(),r=o.bind((({rng:o,isStartInTable:r})=>{const s=((e,t)=>F.from(e.dom.getParent(t,e.dom.isBlock)).map(yo.fromDom))(e,r?o.endContainer:o.startContainer);o.deleteContents(),((e,t,o)=>{o.each((o=>{t?Cn(o):(Rr(o),e.selection.setCursorLocation(o.dom,0))}))})(e,r,s.filter(ys));const a=r?t[0]:t[t.length-1];return zv(e,a,n,r),ys(a)?F.none():F.some(r?t.slice(1):t.slice(0,-1))})).getOr(t);Fv(r),Vv(e)})),Uv=(e,t,o,n)=>F.some((()=>{const r=e.selection.getRng(),s=t[0],a=o[o.length-1];zv(e,s,r,!0),zv(e,a,r,!1);const i=ys(s)?t:t.slice(1),l=ys(a)?o:o.slice(0,-1);Fv(i.concat(l)),n.deleteContents(),Vv(e)})),jv=(e,t,o,n=!0)=>F.some((()=>{xv(e,t,o,n)})),Wv=(e,t)=>F.some((()=>av(e,!1,t))),$v=(e,t,o,n)=>Gv(t,n).fold((()=>((e,t,o)=>Pv(t,o).bind((t=>t.fold(N(jv,e),N(Wv,e),N(Zv,e),N(Uv,e)))))(e,t,o)),(t=>((e,t)=>Kv(e,t))(e,t))),qv=(e,t)=>ee(pf(t,e),Dr),Gv=(e,t)=>ee(pf(t,e),Jt("caption")),Kv=(e,t)=>F.some((()=>{Rr(t),e.selection.setCursorLocation(t.dom,0)})),Yv=(e,t,o,n,r)=>Um(o,e.getBody(),r).fold((()=>F.some(E)),(s=>((e,t,o,n)=>Gm(e.dom).bind((r=>Km(e.dom).map((e=>t?o.isEqual(r)&&n.isEqual(e):o.isEqual(e)&&n.isEqual(r))))).getOr(!0))(n,o,r,s)?((e,t)=>Kv(e,t))(e,n):((e,t,o)=>Gv(e,yo.fromDom(o.getNode())).fold((()=>F.some(E)),(e=>Pt(!So(e,t),E))))(t,n,s))),Xv=(e,t,o,n)=>{const r=rl.fromRangeStart(e.selection.getRng());return qv(o,n).bind((n=>ys(n)?Kv(e,n):((e,t,o,n,r)=>Um(o,e.getBody(),r).bind((e=>qv(t,yo.fromDom(e.getNode())).bind((e=>So(e,n)?F.none():F.some(E))))))(e,o,t,n,r)))},Jv=(e,t)=>e?df(t):mf(t),Qv=(e,t,o)=>{const n=yo.fromDom(e.getBody());return Gv(n,o).fold((()=>Xv(e,t,n,o).orThunk((()=>Pt(((e,t)=>{const o=rl.fromRangeStart(e.selection.getRng());return Jv(t,o)||Zm(t,e.getBody(),o).exists((e=>Jv(t,e)))})(e,t),E)))),(o=>((e,t,o,n)=>{const r=rl.fromRangeStart(e.selection.getRng());return ys(n)?Kv(e,n):Yv(e,o,t,n,r)})(e,t,n,o)))},eb=(e,t)=>{const o=yo.fromDom(e.selection.getStart(!0)),n=yu(e);return e.selection.isCollapsed()&&0===n.length?Qv(e,t,o):((e,t,o)=>{const n=yo.fromDom(e.getBody()),r=e.selection.getRng();return 0!==o.length?Zv(e,o,F.none()):$v(e,n,r,t)})(e,o,n)},tb=(e,t)=>{let o=t;for(;o&&o!==e;){if(cr(o)||dr(o))return o;o=o.parentNode}return null},ob=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],nb=Bt.each,rb=e=>{const t=e.dom,o=new Set(e.serializer.getTempAttrs()),n=e=>W(ob,(t=>je(e,t)))||o.has(e);return{compare:(e,o)=>{if(e.nodeName!==o.nodeName||e.nodeType!==o.nodeType)return!1;const r=e=>{const o={};return nb(t.getAttribs(e),(r=>{const s=r.nodeName.toLowerCase();"style"===s||n(s)||(o[s]=t.getAttrib(e,s))})),o},s=(e,t)=>{for(const o in e)if(_e(e,o)){const n=t[o];if(w(n))return!1;if(e[o]!==n)return!1;delete t[o]}for(const e in t)if(_e(t,e))return!1;return!0};if(Wn(e)&&Wn(o)){if(!s(r(e),r(o)))return!1;if(!s(t.parseStyle(t.getAttrib(e,"style")),t.parseStyle(t.getAttrib(o,"style"))))return!1}return!mu(e)&&!mu(o)},isAttributeInternal:n}},sb=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),ab=(e,t,o,n)=>{const r=o.name;for(let t=0,s=e.length;t{const o=(e,o)=>{fe(e,(e=>{const n=ue(e.nodes);q(e.filter.callbacks,(r=>{for(let t=n.length-1;t>=0;t--){const r=n[t];(o?void 0!==r.attr(e.filter.name):r.name===e.filter.name)&&!x(r.parent)||n.splice(t,1)}n.length>0&&r(n,e.filter.name,t)}))}))};o(e.nodes,!1),o(e.attributes,!0)},lb=(e,t,o,n={})=>{const r=((e,t,o)=>{const n={nodes:{},attributes:{}};return o.firstChild&&((e,t)=>{let o=e;for(;o=o.walk();)t(o)})(o,(o=>{ab(e,t,o,n)})),n})(e,t,o);ib(r,n)},cb=(e,t,o,n)=>{if((e.pad_empty_with_br||t.insert)&&o(n)){const e=new Ep("br",1);t.insert&&e.attr("data-mce-bogus","1"),n.empty().append(e)}else n.empty().append(new Ep("#text",3)).value=br},db=(e,t)=>{const o=null==e?void 0:e.firstChild;return C(o)&&o===e.lastChild&&o.name===t},mb=(e,t,o,n)=>n.isEmpty(t,o,(t=>((e,t)=>{const o=e.getElementRule(t.name);return!0===(null==o?void 0:o.paddEmpty)})(e,t))),ub=e=>{let t;for(let o=e;o;o=o.parent){const e=o.attr("contenteditable");if("false"===e)break;"true"===e&&(t=o)}return F.from(t)},gb=(e,t,o=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const n=e.children();for(const e of n)o&&!t.isValidChild(o.name,e.name)&&gb(e,t,o);e.unwrap()}},hb=(e,t,o,n=E)=>{const r=t.getTextBlockElements(),s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Bt.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),l=new Set,c=e=>e!==o&&!i[e.name];for(let o=0;o1)if(pb(t,i,d))gb(i,t);else{g.reverse(),m=g[0].clone(),n(m);let e=m;for(let o=0;o0?(u=g[o].clone(),n(u),e.append(u)):u=e;for(let e=g[o].firstChild;e&&e!==g[o+1];){const t=e.next;u.append(e),e=t}e=u}mb(t,s,a,m)?d.insert(i,g[0],!0):(d.insert(m,g[0],!0),d.insert(i,m)),d=g[0],(mb(t,s,a,d)||db(d,"br"))&&d.empty().remove()}else if(i.parent){if("li"===i.name){let e=i.prev;if(e&&("ul"===e.name||"ol"===e.name)){e.append(i);continue}if(e=i.next,e&&("ul"===e.name||"ol"===e.name)&&e.firstChild){e.insert(i,e.firstChild,!0);continue}const t=new Ep("ul",1);n(t),i.wrap(t);continue}if(t.isValidChild(i.parent.name,"div")&&t.isValidChild("div",i.name)){const e=new Ep("div",1);n(e),i.wrap(e)}else gb(i,t)}}},pb=(e,t,o=t.parent)=>!(!o||(!e.children[t.name]||e.isValidChild(o.name,t.name))&&("a"!==t.name||!((e,t)=>{let o=e;for(;o;){if(o.name===t)return!0;o=o.parent}return!1})(o,"a"))&&(!(e=>"summary"===e.name)(o)||!sb(t)||(null==o?void 0:o.firstChild)===t&&(null==o?void 0:o.lastChild)===t)),fb=e=>{const t=rl.fromRangeStart(e),o=rl.fromRangeEnd(e),n=e.commonAncestorContainer;return Zm(!1,n,o).map((r=>!gm(t,o,n)&&gm(t,r,n)?((e,t,o,n)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(o,n),r})(t.container(),t.offset(),r.container(),r.offset()):e)).getOr(e)},vb=e=>e.collapsed?e:fb(e),bb=(e,t)=>e.getBlockElements()[t.name]&&(e=>C(e.firstChild)&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===br)(t.firstChild),yb=(e,t)=>{let o=t.firstChild,n=t.lastChild;return o&&"meta"===o.name&&(o=o.next),n&&"mce_marker"===n.attr("id")&&(n=n.prev),((e,t)=>{const o=e.getNonEmptyElements();return C(t)&&(t.isEmpty(o)||bb(e,t))})(e,n)&&(n=null==n?void 0:n.prev),!(!o||o!==n||"ul"!==o.name&&"ol"!==o.name)},wb=e=>C(null==e?void 0:e.firstChild)&&e.firstChild===e.lastChild&&(e=>e.data===br||ir(e))(e.firstChild),xb=e=>{return e.length>0&&(!(t=e[e.length-1]).firstChild||wb(t))?e.slice(0,-1):e;var t},Cb=(e,t)=>{const o=e.getParent(t,e.isBlock);return o&&"LI"===o.nodeName?o:null},Sb=(e,t)=>{const o=rl.after(e),n=Im(t).prev(o);return n?n.toRange():null},kb=(e,t,o)=>{const n=e.parentNode;return n&&Bt.each(t,(t=>{n.insertBefore(t,e)})),((e,t)=>{const o=rl.before(e),n=Im(t).next(o);return n?n.toRange():null})(e,o)},_b=(e,t,o,n)=>{const r=((e,t,o)=>{const n=t.serialize(o);return(e=>{var t,o;const n=e.firstChild,r=e.lastChild;return n&&"META"===n.nodeName&&(null===(t=n.parentNode)||void 0===t||t.removeChild(n)),r&&"mce_marker"===r.id&&(null===(o=r.parentNode)||void 0===o||o.removeChild(r)),e})(e.createFragment(n))})(t,e,n),s=Cb(t,o.startContainer),a=xb((i=r.firstChild,Y(null!==(l=null==i?void 0:i.childNodes)&&void 0!==l?l:[],(e=>"LI"===e.nodeName))));var i,l;const c=t.getRoot(),d=e=>{const n=rl.fromRangeStart(o),r=Im(t.getRoot()),a=1===e?r.prev(n):r.next(n),i=null==a?void 0:a.getNode();return!i||Cb(t,i)!==s};return s?d(1)?kb(s,a,c):d(2)?((e,t,o,n)=>(n.insertAfter(t.reverse(),e),Sb(t[0],o)))(s,a,c,t):((e,t,o,n)=>{const r=((e,t)=>{const o=t.cloneRange(),n=t.cloneRange();return o.setStartBefore(e),n.setEndAfter(e),[o.cloneContents(),n.cloneContents()]})(e,n),s=e.parentNode;return s&&(s.insertBefore(r[0],e),Bt.each(t,(t=>{s.insertBefore(t,e)})),s.insertBefore(r[1],e),s.removeChild(e)),Sb(t[t.length-1],o)})(s,a,c,o):null},Eb=["pre"],Tb=mr,Ob=(e,t,o)=>{F.from(e.getParent(t,"td,th")).map(yo.fromDom).each((e=>((e,t)=>{Po(e).each((o=>{Mo(o).each((n=>{t.isBlock(jt(e))&&kr(o)&&t.isBlock(jt(n))&&Cn(o)}))}))})(e,o)))},Db=(e,t)=>{var o,n,r;let s;const a=e.dom,i=e.selection;if(!t)return;i.scrollIntoView(t);const l=tb(e.getBody(),t);if(l&&"false"===a.getContentEditable(l))return a.remove(t),void i.select(l);let c=a.createRng();const d=t.previousSibling;if(tr(d)){c.setStart(d,null!==(n=null===(o=d.nodeValue)||void 0===o?void 0:o.length)&&void 0!==n?n:0);const e=t.nextSibling;tr(e)&&(d.appendData(e.data),null===(r=e.parentNode)||void 0===r||r.removeChild(e))}else c.setStartBefore(t),c.setEndBefore(t);const m=a.getParent(t,a.isBlock);if(a.remove(t),m&&a.isEmpty(m)){const t=Tb(m);xn(yo.fromDom(m)),c.setStart(m,0),c.setEnd(m,0),t||(e=>!!e.getAttribute("data-mce-fragment"))(m)||!(s=(t=>{let o=rl.fromRangeStart(t);return o=Im(e.getBody()).next(o),null==o?void 0:o.toRange()})(c))?a.add(m,a.create("br",t?{}:{"data-mce-bogus":"1"})):(c=s,a.remove(m))}i.setRng(c)},Ab=e=>{const t=e.dom,o=vb(e.selection.getRng());e.selection.setRng(o);const n=t.getParent(o.startContainer,Tb);((e,t,o)=>!!C(o)&&(o===e.getParent(t.endContainer,Tb)&&Su(yo.fromDom(o),t)))(t,o,n)?jv(e,o,yo.fromDom(n)):o.startContainer===o.endContainer&&o.endOffset-o.startOffset==1&&tr(o.startContainer.childNodes[o.startOffset])?o.deleteContents():e.getDoc().execCommand("Delete",!1)},Mb=(e,t,o)=>{var n,r;const s=e.selection,a=e.dom,i=e.parser,l=o.merge,c=$p({validate:!0},e.schema),d='';o.preserve_zwsp||(t=Hr(t)),-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,d);let m=s.getRng();const u=m.startContainer,g=e.getBody();u===g&&s.isCollapsed()&&a.isBlock(g.firstChild)&&((e,t)=>C(t)&&!e.schema.getVoidElements()[t.nodeName])(e,g.firstChild)&&a.isEmpty(g.firstChild)&&(m=a.createRng(),m.setStart(g.firstChild,0),m.setEnd(g.firstChild,0),s.setRng(m)),s.isCollapsed()||Ab(e);const h=s.getNode(),p={context:h.nodeName.toLowerCase(),data:o.data,insert:!0},f=i.parse(t,p);if(!0===o.paste&&yb(e.schema,f)&&((e,t)=>!!Cb(e,t))(a,h))return m=_b(c,a,s.getRng(),f),m&&s.setRng(m),t;!0===o.paste&&((e,t,o,n)=>{var r;const s=t.firstChild,a=t.lastChild,i=s===("bookmark"===a.attr("data-mce-type")?a.prev:a),l=j(Eb,s.name);if(i&&l){const t="false"!==s.attr("contenteditable"),a=(null===(r=e.getParent(o,e.isBlock))||void 0===r?void 0:r.nodeName.toLowerCase())===s.name,i=F.from(tb(n,o)).forall(cr);return t&&a&&i}return!1})(a,f,h,e.getBody())&&(null===(n=f.firstChild)||void 0===n||n.unwrap()),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(f);let v=f.lastChild;if(v&&"mce_marker"===v.attr("id")){const t=v;for(v=v.prev;v;v=v.walk(!0))if(3===v.type||!a.isBlock(v.name)){v.parent&&e.schema.isValidChild(v.parent.name,"span")&&v.parent.insert(t,v,"br"===v.name);break}}if(e._selectionOverrides.showBlockCaretContainer(h),p.invalid||((e,t,o)=>{var n;return W(o.children(),sb)&&"SUMMARY"===(null===(n=e.getParent(t,e.isBlock))||void 0===n?void 0:n.nodeName)})(a,h,f)){e.selection.setContent(d);let o,n=s.getNode();const l=e.getBody();for(sr(n)?n=o=l:o=n;o&&o!==l;)n=o,o=o.parentNode;t=n===l?l.innerHTML:a.getOuterHTML(n);const m=i.parse(t),u=(e=>{for(let t=e;t;t=t.walk())if("mce_marker"===t.attr("id"))return F.some(t);return F.none()})(m),g=u.bind(ub).getOr(m);u.each((e=>e.replace(f)));const h=f.children(),p=null!==(r=f.parent)&&void 0!==r?r:m;f.unwrap();const v=Y(h,(t=>pb(e.schema,t,p)));hb(v,e.schema,g),lb(i.getNodeFilters(),i.getAttributeFilters(),m),t=c.serialize(m),n===l?a.setHTML(l,t):a.setOuterHTML(n,t)}else t=c.serialize(f),((e,t,o)=>{var n;if("all"===o.getAttribute("data-mce-bogus"))null===(n=o.parentNode)||void 0===n||n.insertBefore(e.dom.createFragment(t),o);else{const n=o.firstChild,r=o.lastChild;!n||n===r&&"BR"===n.nodeName?e.dom.setHTML(o,t):e.selection.setContent(t,{no_events:!0})}})(e,t,h);var b;return((e,t)=>{const o=e.schema.getTextInlineElements(),n=e.dom;if(t){const t=e.getBody(),r=rb(e);Bt.each(n.select("*[data-mce-fragment]"),(e=>{if(C(o[e.nodeName.toLowerCase()])&&Yp(n,e))for(let o=e.parentElement;C(o)&&o!==t&&!Xp(n,e,o);o=o.parentElement)if(r.compare(o,e)){n.remove(e,!0);break}}))}})(e,l),Db(e,a.get("mce_marker")),b=e.getBody(),Bt.each(b.getElementsByTagName("*"),(e=>{e.removeAttribute("data-mce-fragment")})),Ob(a,s.getStart(),e.schema),((e,t,o)=>{const n=Ao(yo.fromDom(o),(e=>So(e,yo.fromDom(t))));ce(n,n.length-2).filter(Gt).fold((()=>As(e,t)),(t=>As(e,t.dom)))})(e.schema,e.getBody(),s.getStart()),t},Nb=e=>e instanceof Ep,Rb=(e,t,o)=>{e.dom.setHTML(e.getBody(),t),!0!==o&&(e=>{ap(e)&&Gm(e.getBody()).each((t=>{const o=t.getNode(),n=Jn(o)?Gm(o).getOr(t):t;e.selection.setRng(n.toRange())}))})(e)},Bb=(e,t,o)=>F.from(e.getBody()).map((n=>Nb(t)?((e,t,o,n)=>{lb(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),o);const r=$p({validate:!1},e.schema).serialize(o),s=Hr(Ar(yo.fromDom(t))?r:Bt.trim(r));return Rb(e,s,n.no_selection),{content:o,html:s}})(e,n,t,o):((e,t,o,n)=>{if(0===(o=Hr(o)).length||/^\s+$/.test(o)){const r='
';"TABLE"===t.nodeName?o=""+r+"":/^(UL|OL)$/.test(t.nodeName)&&(o="
  • "+r+"
  • ");const s=Xl(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),s.toLowerCase())?(o=r,o=e.dom.createHTML(s,Jl(e),o)):o||(o=r),Rb(e,o,n.no_selection),{content:o,html:o}}{"raw"!==n.format&&(o=$p({validate:!1},e.schema).serialize(e.parser.parse(o,{isRootContent:!0,insert:!0})));const r=Ar(yo.fromDom(t))?o:Bt.trim(o);return Rb(e,r,n.no_selection),{content:r,html:r}}})(e,n,t,o))).getOr({content:t,html:Nb(o.content)?"":o.content}),Lb=e=>S(e)?e:I,Hb=(e,t,o)=>{const n=t(e),r=Lb(o);return n.orThunk((()=>r(e)?F.none():((e,t,o)=>{let n=e.dom;const r=Lb(o);for(;n.parentNode;){n=n.parentNode;const e=yo.fromDom(n),o=t(e);if(o.isSome())return o;if(r(e))break}return F.none()})(e,t,r)))},Ib=Pu,Pb=(e,t,o)=>{const n=e.formatter.get(o);if(n)for(let o=0;o{const s=e.dom.getRoot();if(t===s)return!1;const a=e.dom.getParent(t,(t=>!!Pb(e,t,o)||t.parentNode===s||!!Zb(e,t,o,n,!0)));return!!Zb(e,a,o,n,r)},zb=(e,t,o)=>!(!qu(o)||!Ib(t,o.inline))||!(!Wu(o)||!Ib(t,o.block))||!!$u(o)&&Wn(t)&&e.is(t,o.selector),Vb=(e,t,o,n,r,s)=>{const a=o[n],i="attributes"===n;if(S(o.onmatch))return o.onmatch(t,o,n);if(a)if(Oe(a)){for(let o=0;o{const s=e.formatter.get(o),a=e.dom;if(s&&Wn(t))for(let o=0;o{if(n)return Fb(e,n,t,o,r);if(n=e.selection.getNode(),Fb(e,n,t,o,r))return!0;const s=e.selection.getStart();return!(s===n||!Fb(e,s,t,o,r))},jb=(e,t)=>{const o=t=>So(t,yo.fromDom(e.getBody()));return F.from(e.selection.getStart(!0)).bind((n=>Hb(yo.fromDom(n),(o=>ge(t,(t=>((t,o)=>Zb(e,t.dom,o)?F.some(o):F.none())(o,t)))),o))).getOrNull()},Wb=(e,t,o)=>J(o,((o,n)=>{const r=((e,t)=>Uu(e,t,(e=>{const t=e=>S(e)||e.length>1&&"%"===e.charAt(0);return W(["styles","attributes"],(o=>ke(e,o).exists((e=>{const o=v(e)?e:Se(e);return W(o,t)}))))})))(e,n);return e.formatter.matchNode(t,n,{},r)?o.concat([n]):o}),[]),$b=Br,qb=e=>{if(e){const t=new Zn(e,e);for(let e=t.current();e;e=t.next())if(tr(e))return e}return null},Gb=e=>{const t=yo.fromTag("span");return to(t,{id:Ym,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&bn(t,yo.fromText($b)),t},Kb=(e,t,o)=>{const n=e.dom,r=e.selection;if(Ku(t))av(e,!1,yo.fromDom(t),o,!0);else{const e=r.getRng(),o=n.getParent(t,n.isBlock),s=e.startContainer,a=e.startOffset,i=e.endContainer,l=e.endOffset,c=(e=>{const t=qb(e);return t&&t.data.charAt(0)===$b&&t.deleteData(0,1),t})(t);n.remove(t,!0),s===c&&a>0&&e.setStart(c,a-1),i===c&&l>0&&e.setEnd(c,l-1),o&&n.isEmpty(o)&&Rr(yo.fromDom(o)),r.setRng(e)}},Yb=(e,t,o)=>{const n=e.dom,r=e.selection;if(t)Kb(e,t,o);else if(!(t=Jm(e.getBody(),r.getStart())))for(;t=n.get(Ym);)Kb(e,t,o)},Xb=(e,t)=>(e.appendChild(t),t),Jb=(e,t)=>{var o;const n=X(e,((e,t)=>Xb(e,t.cloneNode(!1))),t),r=null!==(o=n.ownerDocument)&&void 0!==o?o:document;return Xb(n,r.createTextNode($b))},Qb=(e,t,o,n)=>{const r=e.dom,s=e.selection;let a=!1;const i=e.formatter.get(t);if(!i)return;const l=s.getRng(),c=l.startContainer,d=l.startOffset;let m=c;tr(c)&&(d!==c.data.length&&(a=!0),m=m.parentNode);const u=[];let g;for(;m;){if(Zb(e,m,t,o,n)){g=m;break}m.nextSibling&&(a=!0),u.push(m),m=m.parentNode}if(g)if(a){const a=s.getBookmark();l.collapse(!0);let c=mg(r,l,i,!0);c=dh(c),e.formatter.remove(t,o,c,n),s.moveToBookmark(a)}else{const a=Jm(e.getBody(),g),i=C(a)?r.getParents(g.parentNode,P,a):[],l=Gb(!1).dom;((e,t,o)=>{var n,r;const s=e.dom,a=s.getParent(o,N(Ru,e.schema));a&&s.isEmpty(a)?null===(n=o.parentNode)||void 0===n||n.replaceChild(t,o):(Mr(yo.fromDom(o)),s.isEmpty(o)?null===(r=o.parentNode)||void 0===r||r.replaceChild(t,o):s.insertAfter(t,o))})(e,l,null!=a?a:g);const c=((e,t,o,n,r,s)=>{const a=e.formatter,i=e.dom,l=Y(he(a.get()),(e=>e!==n&&!Ue(e,"removeformat"))),c=Wb(e,o,l);if(Y(c,(t=>!ju(e,t,n))).length>0){const e=o.cloneNode(!1);return i.add(t,e),a.remove(n,r,e,s),i.remove(e),F.some(e)}return F.none()})(e,l,g,t,o,n),d=Jb([...u,...c.toArray(),...i],l);a&&Kb(e,a,C(a)),s.setCursorLocation(d,1),r.isEmpty(g)&&r.remove(g)}},ey=e=>{e.on("mouseup keydown",(t=>{var o;((e,t,o)=>{const n=e.selection,r=e.getBody();Yb(e,null,o),8!==t&&46!==t||!n.isCollapsed()||n.getStart().innerHTML!==$b||Yb(e,Jm(r,n.getStart()),!0),37!==t&&39!==t||Yb(e,Jm(r,n.getStart()),!0)})(e,t.keyCode,(o=e.selection.getRng().endContainer,tr(o)&&We(o.data,br)))}))},ty=e=>{const t=Gb(!1),o=Jb(e,t.dom);return{caretContainer:t,caretPosition:rl(o,0)}},oy=(e,t)=>{const{caretContainer:o,caretPosition:n}=ty(t);return pn(yo.fromDom(e),o),Cn(yo.fromDom(e)),n},ny=(e,t)=>{if(Xm(t.dom))return!1;const o=e.schema.getTextInlineElements();return _e(o,jt(t))&&!Xm(t.dom)&&!Xn(t.dom)},ry={},sy=Gn(["pre"]);((e,t)=>{ry[e]||(ry[e]=[]),ry[e].push(t)})("pre",(e=>{const t=e.selection.getRng();if(!t.collapsed){const t=e.selection.getSelectedBlocks(),o=Y(Y(t,sy),(e=>t=>{const o=t.previousSibling;return sy(o)&&j(e,o)})(t));q(o,(e=>{((e,t)=>{const o=yo.fromDom(t),n=Eo(o).dom;Cn(o),wn(yo.fromDom(e),[yo.fromTag("br",n),yo.fromTag("br",n),...Lo(o)])})(e.previousSibling,e)}))}}));const ay=["fontWeight","fontStyle","color","fontSize","fontFamily"],iy=e=>ee(e,(e=>qu(e)&&"span"===e.inline&&(e=>p(e.styles)&&W(he(e.styles),(e=>j(ay,e))))(e))),ly=(e,t)=>{const o=e.get(t);return v(o)?iy(o):F.none()},cy=(e,t)=>qm(t,rl.fromRangeStart(e)).isNone(),dy=(e,t)=>!1===$m(t,rl.fromRangeEnd(e)).exists((e=>!ir(e.getNode())||$m(t,e).isSome())),my=e=>t=>hr(t)&&e.isEditable(t),uy=e=>Y((e=>{const t=e.getSelectedBlocks(),o=e.getRng();if(e.isCollapsed())return[];if(1===t.length)return cy(o,t[0])&&dy(o,t[0])?t:[];{const e=de(t).filter((e=>cy(o,e))).toArray(),n=me(t).filter((e=>dy(o,e))).toArray(),r=t.slice(1,-1);return e.concat(r).concat(n)}})(e),my(e.dom)),gy=e=>Y(e.getSelectedBlocks(),my(e.dom)),hy=Bt.each,py=e=>Wn(e)&&!mu(e)&&!Xm(e)&&!Xn(e),fy=(e,t)=>{for(let o=e;o;o=o[t]){if(tr(o)&&Ye(o.data))return e;if(Wn(o)&&!mu(o))return o}return e},vy=(e,t,o)=>{const n=rb(e),r=$n(t)&&e.dom.isEditable(t),s=$n(o)&&e.dom.isEditable(o);if(r&&s){const r=fy(t,"previousSibling"),s=fy(o,"nextSibling");if(n.compare(r,s)){for(let e=r.nextSibling;e&&e!==s;){const t=e;e=e.nextSibling,r.appendChild(t)}return e.dom.remove(s),Bt.each(Bt.grep(s.childNodes),(e=>{r.appendChild(e)})),r}}return o},by=(e,t,o,n)=>{var r;if(n&&!1!==t.merge_siblings){const t=null!==(r=vy(e,Nu(n),n))&&void 0!==r?r:n;vy(e,t,Nu(t,!0))}},yy=(e,t,o)=>{hy(e.childNodes,(e=>{py(e)&&(t(e)&&o(e),e.hasChildNodes()&&yy(e,t,o))}))},wy=(e,t)=>o=>!(!o||!zu(e,o,t)),xy=(e,t,o)=>n=>{e.setStyle(n,t,o),""===n.getAttribute("style")&&n.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,n)},Cy=Al([{keep:[]},{rename:["name"]},{removed:[]}]),Sy=/^(src|href|style)$/,ky=Bt.each,_y=Pu,Ey=(e,t,o)=>e.isChildOf(t,o)&&t!==o&&!e.isBlock(o),Ty=(e,t,o)=>{let n=t[o?"startContainer":"endContainer"],r=t[o?"startOffset":"endOffset"];if(Wn(n)){const e=n.childNodes.length-1;!o&&r&&r--,n=n.childNodes[r>e?e:r]}return tr(n)&&o&&r>=n.data.length&&(n=new Zn(n,e.getBody()).next()||n),tr(n)&&!o&&0===r&&(n=new Zn(n,e.getBody()).prev()||n),n},Oy=(e,t)=>{const o=t?"firstChild":"lastChild",n=e[o];return(e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&n?"TR"===e.nodeName&&n[o]||n:e},Dy=(e,t,o,n)=>{var r;const s=e.create(o,n);return null===(r=t.parentNode)||void 0===r||r.insertBefore(s,t),s.appendChild(t),s},Ay=(e,t,o,n,r)=>{const s=yo.fromDom(t),a=yo.fromDom(e.create(n,r)),i=o?Bo(s):Ro(s);return wn(a,i),o?(pn(s,a),vn(a,s)):(fn(s,a),bn(a,s)),a.dom},My=(e,t,o)=>{const n=t.parentNode;let r;const s=e.dom,a=Xl(e);Wu(o)&&n===s.getRoot()&&(o.list_block&&_y(t,o.list_block)||q(ue(t.childNodes),(t=>{Bu(e,a,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=Dy(s,t,a),s.setAttribs(r,Jl(e))):r=null}))),(e=>$u(e)&&qu(e)&&Lt(ke(e,"mixed"),!0))(o)&&!_y(o.inline,t)||s.remove(t,!0)},Ny=(e,t,o)=>k(e)?{name:t,value:null}:{name:e,value:Iu(t,o)},Ry=(e,t)=>{""===e.getAttrib(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},By=(e,t,o,n,r)=>{let s=!1;ky(o.styles,((a,i)=>{const{name:l,value:c}=Ny(i,a,n),d=Fu(c,l);(o.remove_similar||b(c)||!Wn(r)||_y(zu(e,r,l),d))&&e.setStyle(t,l,""),s=!0})),s&&Ry(e,t)},Ly=(e,t,o,n,r)=>{const s=e.dom,a=rb(e),i=e.schema;if(qu(t)&&Rs(i,t.inline)&&Ls(i,n)&&n.parentElement===e.getBody())return My(e,n,t),Cy.removed();if(!t.ceFalseOverride&&n&&"false"===s.getContentEditableParent(n))return Cy.keep();if(n&&!zb(s,n,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(n,t))return Cy.keep();const l=n,c=t.preserve_attributes;if(qu(t)&&"all"===t.remove&&v(c)){const e=Y(s.getAttribs(l),(e=>j(c,e.name.toLowerCase())));if(s.removeAllAttribs(l),q(e,(e=>s.setAttrib(l,e.name,e.value))),e.length>0)return Cy.rename("span")}if("all"!==t.remove){By(s,l,t,o,r),ky(t.attributes,((e,n)=>{const{name:a,value:i}=Ny(n,e,o);if(t.remove_similar||b(i)||!Wn(r)||_y(s.getAttrib(r,a),i)){if("class"===a){const e=s.getAttrib(l,a);if(e){let t="";if(q(e.split(/\s+/),(e=>{/mce\-\w+/.test(e)&&(t+=(t?" ":"")+e)})),t)return void s.setAttrib(l,a,t)}}if(Sy.test(a)&&l.removeAttribute("data-mce-"+a),"style"===a&&Gn(["li"])(l)&&"none"===s.getStyle(l,"list-style-type"))return l.removeAttribute(a),void s.setStyle(l,"list-style-type","none");"class"===a&&l.removeAttribute("className"),l.removeAttribute(a)}})),ky(t.classes,(e=>{e=Iu(e,o),Wn(r)&&!s.hasClass(r,e)||s.removeClass(l,e)}));const e=s.getAttribs(l);for(let t=0;tLy(e,t,o,n,n).fold(D(n),(t=>(e.dom.createFragment().appendChild(n),e.dom.rename(n,t))),D(null)),Iy=(e,t,o,n,r)=>{const s=e.formatter.get(t),a=s[0],i=e.dom,l=e.selection,c=n=>{const i=((e,t,o,n,r)=>{let s;return t.parentNode&&q(Zu(e.dom,t.parentNode).reverse(),(t=>{if(!s&&Wn(t)&&"_start"!==t.id&&"_end"!==t.id){const a=Zb(e,t,o,n,r);a&&!1!==a.split&&(s=t)}})),s})(e,n,t,o,r);return((e,t,o,n,r,s,a,i)=>{var l,c;let d,m;const u=e.dom;if(o){const g=o.parentNode;for(let o=n.parentNode;o&&o!==g;o=o.parentNode){let n=u.clone(o,!1);for(let o=0;oW(s,(n=>Fy(e,n,o,t,t))),m=t=>{const o=ue(t.childNodes),n=d(t)||W(s,(e=>zb(i,t,e))),r=t.parentNode;if(!n&&C(r)&&Gu(a)&&d(r),a.deep&&o.length)for(let e=0;e{Wn(t)&&e.dom.getStyle(t,"text-decoration")===o&&t.parentNode&&Vu(i,t.parentNode)===o&&Fy(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:o}},void 0,t)}))},u=e=>{const t=i.get(e?"_start":"_end");if(t){let o=t[e?"firstChild":"lastChild"];return(e=>mu(e)&&Wn(e)&&("_start"===e.id||"_end"===e.id))(o)&&(o=o[e?"firstChild":"lastChild"]),tr(o)&&0===o.data.length&&(o=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),i.remove(t,!0),o}return null},g=t=>{let o,n,r=mg(i,t,s,t.collapsed);if(a.split){if(r=dh(r),o=Ty(e,r,!0),n=Ty(e,r),o!==n){if(o=Oy(o,!0),n=Oy(n,!1),Ey(i,o,n)){const e=F.from(o.firstChild).getOr(o);return c(Ay(i,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void u(!0)}if(Ey(i,n,o)){const e=F.from(n.lastChild).getOr(n);return c(Ay(i,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void u(!1)}o=Dy(i,o,"span",{id:"_start","data-mce-type":"bookmark"}),n=Dy(i,n,"span",{id:"_end","data-mce-type":"bookmark"});const e=i.createRng();e.setStartAfter(o),e.setEndBefore(n),ug(i,e,(e=>{q(e,(e=>{mu(e)||mu(e.parentNode)||c(e)}))})),c(o),c(n),o=u(!0),n=u()}else o=n=c(o);r.startContainer=o.parentNode?o.parentNode:o,r.startOffset=i.nodeIndex(o),r.endContainer=n.parentNode?n.parentNode:n,r.endOffset=i.nodeIndex(n)+1}ug(i,r,(e=>{q(e,m)}))};if(n){if(Ou(n)){const e=i.createRng();e.setStartBefore(n),e.setEndAfter(n),g(e)}else g(n);_g(e,t,n,o)}else l.isCollapsed()&&qu(a)&&!yu(e).length?Qb(e,t,o,r):(Au(e,(()=>Eu(e,g)),(n=>qu(a)&&Ub(e,t,o,n))),e.nodeChanged()),((e,t,o)=>{"removeformat"===t?q(gy(e.selection),(t=>{q(ay,(o=>e.dom.setStyle(t,o,""))),Ry(e.dom,t)})):ly(e.formatter,t).each((t=>{q(gy(e.selection),(n=>By(e.dom,n,t,o,null)))}))})(e,t,o),_g(e,t,n,o)},Py=(e,t,o,n,r)=>{(n||e.selection.isEditable())&&Iy(e,t,o,n,r)},Fy=(e,t,o,n,r)=>Ly(e,t,o,n,r).fold(I,(t=>(e.dom.rename(n,t),!0)),P),zy=Bt.each,Vy=(e,t,o,n)=>{zy(t,(t=>{qu(t)&&zy(e.dom.select(t.inline,n),(n=>{py(n)&&Fy(e,t,o,n,t.exact?n:null)})),((e,t,o)=>{if(t.clear_child_styles){const n=t.links?"*:not(a)":"*";hy(e.select(n,o),(o=>{py(o)&&e.isEditable(o)&&hy(t.styles,((t,n)=>{e.setStyle(o,n,"")}))}))}})(e.dom,t,n)}))},Zy=Bt.each,Uy=(e,t,o,n)=>{if(Zy(o.styles,((o,r)=>{e.setStyle(t,r,Iu(o,n))})),o.styles){const o=e.getAttrib(t,"style");o&&e.setAttrib(t,"data-mce-style",o)}},jy=(e,t,o,n)=>{const r=e.formatter.get(t),s=r[0],a=!n&&e.selection.isCollapsed(),i=e.dom,l=e.selection,c=(e,t=s)=>{S(t.onformat)&&t.onformat(e,t,o,n),Uy(i,e,t,o),Zy(t.attributes,((t,n)=>{i.setAttrib(e,n,Iu(t,o))})),Zy(t.classes,(t=>{const n=Iu(t,o);i.hasClass(e,n)||i.addClass(e,n)}))},d=(e,t)=>{let o=!1;return Zy(e,(e=>!(!$u(e)||("false"!==i.getContentEditable(t)||e.ceFalseOverride)&&(!C(e.collapsed)||e.collapsed===a)&&i.is(t,e.selector)&&!Xm(t)&&(c(t,e),o=!0,1)))),o},m=e=>{if(h(e)){const t=i.create(e);return c(t),t}return null},u=(n,a,i)=>{const l=[];let u=!0;const g=s.inline||s.block,h=m(g),p=n=>(e=>Wu(e)&&!0===e.wrapper)(s)&&Zb(e,n,t,o),f=(t,o,n)=>{const r=(e=>Wu(e)&&!0!==e.wrapper)(s)&&Ru(e.schema,t)&&Bu(e,o,g);return n&&r};ug(n,a,(t=>{let o;const a=t=>{let m=!1,v=u,b=!1;const y=t.parentNode,w=y.nodeName.toLowerCase(),x=n.getContentEditable(t);C(x)&&(v=u,u="true"===x,m=!0,b=Hu(e,t));const S=u&&!m;if(ir(t)&&!((e,t,o,n)=>{if(Hc(e)&&qu(t)&&o.parentNode){const t=va(e.schema),r=Cv(yo.fromDom(o),(e=>Xm(e.dom)));return Ee(t,n)&&ys(yo.fromDom(o.parentNode),!1)&&!r}return!1})(e,s,t,w))return o=null,void(Wu(s)&&n.remove(t));if(p(t))o=null;else{if(f(t,w,S)){const e=n.rename(t,g);return c(e),l.push(e),void(o=null)}if($u(s)){let e=d(r,t);if(!e&&C(y)&&Gu(s)&&(e=d(r,y)),!qu(s)||e)return void(o=null)}C(h)&&((t,o,r,a)=>{const l=t.nodeName.toLowerCase(),c=Bu(e,g,l)&&Bu(e,o,g),d=!i&&tr(t)&&Lr(t.data),m=Xm(t),u=!qu(s)||!n.isBlock(t);return(r||a)&&c&&!d&&!m&&u})(t,w,S,b)?(o||(o=n.clone(h,!1),y.insertBefore(o,t),l.push(o)),b&&m&&(u=v),o.appendChild(t)):(o=null,q(ue(t.childNodes),a),m&&(u=v),o=null)}};q(t,a)})),!0===s.links&&q(l,(e=>{const t=e=>{"A"===e.nodeName&&c(e,s),q(ue(e.childNodes),t)};t(e)})),q(l,(a=>{const i=(e=>{let t=0;return q(e.childNodes,(e=>{(e=>C(e)&&tr(e)&&0===e.length)(e)||mu(e)||t++})),t})(a);!(l.length>1)&&n.isBlock(a)||0!==i?(qu(s)||Wu(s)&&s.wrapper)&&(s.exact||1!==i||(a=(e=>{const t=ee(e.childNodes,Du).filter((e=>"false"!==n.getContentEditable(e)&&zb(n,e,s)));return t.map((t=>{const o=n.clone(t,!1);return c(o),n.replace(o,e,!0),n.remove(t,!0),o})).getOr(e)})(a)),Vy(e,r,o,a),((e,t,o,n,r)=>{const s=r.parentNode;Zb(e,s,o,n)&&Fy(e,t,n,r)||t.merge_with_parents&&s&&e.dom.getParent(s,(s=>!!Zb(e,s,o,n)&&(Fy(e,t,n,r),!0)))})(e,s,t,o,a),((e,t,o,n)=>{if(t.styles&&t.styles.backgroundColor){const r=wy(e,"fontSize");yy(n,(t=>r(t)&&e.isEditable(t)),xy(e,"backgroundColor",Iu(t.styles.backgroundColor,o)))}})(n,s,o,a),((e,t,o,n)=>{const r=t=>{if($n(t)&&Wn(t.parentNode)&&e.isEditable(t)){const o=Vu(e,t.parentNode);e.getStyle(t,"color")&&o?e.setStyle(t,"text-decoration",o):e.getStyle(t,"text-decoration")===o&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(Bt.walk(n,r,"childNodes"),r(n))})(n,s,0,a),((e,t,o,n)=>{if(qu(t)&&("sub"===t.inline||"sup"===t.inline)){const o=wy(e,"fontSize");yy(n,(t=>o(t)&&e.isEditable(t)),xy(e,"fontSize",""));const r=Y(e.select("sup"===t.inline?"sub":"sup",n),e.isEditable);e.remove(r,!0)}})(n,s,0,a),by(e,s,0,a)):n.remove(a,!0)}))},g=Ou(n)?n:l.getNode();if("false"===i.getContentEditable(g)&&!Hu(e,g))return d(r,n=g),void kg(e,t,n,o);if(s){if(n)if(Ou(n)){if(!d(r,n)){const e=i.createRng();e.setStartBefore(n),e.setEndAfter(n),u(i,mg(i,e,r),!0)}}else u(i,n,!0);else a&&qu(s)&&!yu(e).length?((e,t,o)=>{let n;const r=e.selection,s=e.formatter.get(t);if(!s)return;const a=r.getRng();let i=a.startOffset;const l=a.startContainer.nodeValue;n=Jm(e.getBody(),r.getStart());const c=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&i>0&&i{Eu(e,((e,t)=>{const o=t?e:mg(i,e,r);u(i,o,!1)}))}),P),e.nodeChanged()),ly(e.formatter,t).each((t=>{q(uy(e.selection),(e=>Uy(i,e,t,o)))}));((e,t)=>{_e(ry,e)&&q(ry[e],(e=>{e(t)}))})(t,e)}kg(e,t,n,o)},Wy=(e,t,o,n)=>{(n||e.selection.isEditable())&&jy(e,t,o,n)},$y=e=>_e(e,"vars"),qy=e=>e.selection.getStart(),Gy=(e,t,o,n,r)=>Q(t,(t=>{const s=e.formatter.matchNode(t,o,null!=r?r:{},n);return!w(s)}),(t=>!!Pb(e,t,o)||!n&&C(e.formatter.matchNode(t,o,r,!0)))),Ky=(e,t)=>{const o=null!=t?t:qy(e);return Y(Zu(e.dom,o),(e=>Wn(e)&&!Xn(e)))},Yy=(e,t,o)=>{const n=Ky(e,t);fe(o,((o,r)=>{const s=o=>{const s=Gy(e,n,r,o.similar,$y(o)?o.vars:void 0),a=s.isSome();if(o.state.get()!==a){o.state.set(a);const e=s.getOr(t);$y(o)?o.callback(a,{node:e,format:r,parents:n}):q(o.callbacks,(t=>t(a,{node:e,format:r,parents:n})))}};q([o.withSimilar,o.withoutSimilar],s),q(o.withVars,s)}))},Xy=(e,t,o,n,r,s)=>(((e,t,o,n,r,s)=>{const a=t.get();q(o.split(","),(t=>{const o=ke(a,t).getOrThunk((()=>{const e={withSimilar:{state:Qa(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Qa(!1),similar:!1,callbacks:[]},withVars:[]};return a[t]=e,e})),i=()=>{const o=Ky(e);return Gy(e,o,t,r,s).isSome()};if(w(s)){const e=r?o.withSimilar:o.withoutSimilar;e.callbacks.push(n),1===e.callbacks.length&&e.state.set(i())}else o.withVars.push({state:Qa(i()),similar:r,vars:s,callback:n})})),t.set(a)})(e,t,o,n,r,s),{unbind:()=>((e,t,o)=>{const n=e.get();q(t.split(","),(e=>ke(n,e).each((t=>{n[e]={withSimilar:{...t.withSimilar,callbacks:Y(t.withSimilar.callbacks,(e=>e!==o))},withoutSimilar:{...t.withoutSimilar,callbacks:Y(t.withoutSimilar.callbacks,(e=>e!==o))},withVars:Y(t.withVars,(e=>e.callback!==o))}})))),e.set(n)})(t,o,n)}),Jy=Bt.explode,Qy=()=>{const e={};return{addFilter:(t,o)=>{q(Jy(t),(t=>{_e(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(o)}))},getFilters:()=>Se(e),removeFilter:(t,o)=>{q(Jy(t),(t=>{if(_e(e,t))if(C(o)){const n=e[t],r=Y(n.callbacks,(e=>e!==o));r.length>0?n.callbacks=r:delete e[t]}else delete e[t]}))}}},ew=(e,t,o)=>{e.addNodeFilter("font",(e=>{q(e,(e=>{const n=t.parse(e.attr("style")),r=e.attr("color"),s=e.attr("face"),a=e.attr("size");r&&(n.color=r),s&&(n["font-family"]=s),a&&Je(a).each((e=>{n["font-size"]=o[e-1]})),e.name="span",e.attr("style",t.serialize(n)),((e,t)=>{q(t,(t=>{e.attr(t,null)}))})(e,["color","face","size"])}))}))},tw=(e,t,o)=>{var n;const r=Aa();t.convert_fonts_to_spans&&ew(e,r,Bt.explode(null!==(n=t.font_size_legacy_values)&&void 0!==n?n:"")),((e,t,o)=>{e.addNodeFilter("strike",(e=>{const n="html4"!==t.type;q(e,(e=>{if(n)e.name="s";else{const t=o.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",o.serialize(t))}}))}))})(e,o,r)},ow=(e,t,o)=>{t.addNodeFilter("br",((t,n,r)=>{const s=Bt.extend({},o.getBlockElements()),a=o.getNonEmptyElements(),i=o.getWhitespaceElements();s.body=1;const l=e=>e.name in s||Is(o,e);for(let n=0,c=t.length;n{const[t,...o]=e.split(","),n=o.join(","),r=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(r){const e=";base64"===r[2],t=e?(e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""})(n):decodeURIComponent(n);return F.some({type:r[1],data:t,base64Encoded:e})}return F.none()},rw=(e,t,o=!0)=>{let n=t;if(o)try{n=atob(t)}catch(e){return F.none()}const r=new Uint8Array(n.length);for(let e=0;e{return je(e,"blob:")?(e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject())).catch((()=>Promise.reject({message:`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`,uriType:"blob"}))))(e):je(e,"data:")?(t=e,new Promise(((e,o)=>{nw(t).bind((({type:e,data:t,base64Encoded:o})=>rw(e,t,o))).fold((()=>o("Invalid data URI")),e)}))):Promise.reject("Unknown URI format");var t},aw=e=>new Promise(((t,o)=>{const n=new FileReader;n.onloadend=()=>{t(n.result)},n.onerror=()=>{var e;o(null===(e=n.error)||void 0===e?void 0:e.message)},n.readAsDataURL(e)}));let iw=0;const lw=(e,t,o)=>nw(e).bind((({data:e,type:n,base64Encoded:r})=>{if(t&&!r)return F.none();{const t=r?e:btoa(e);return o(t,n)}})),cw=(e,t,o)=>{const n=e.create((r||"blobid")+iw++,t,o);var r;return e.add(n),n},dw=(e,t,o=!1)=>lw(t,o,((t,o)=>F.from(e.getByData(t,o)).orThunk((()=>rw(o,t).map((o=>cw(e,o,t))))))),mw=(e,t)=>{const{blob_cache:o}=t;if(o){const t=e=>{const t=e.attr("src");(e=>e.attr("src")===At.transparentSrc||C(e.attr("data-mce-placeholder")))(e)||(e=>C(e.attr("data-mce-bogus")))(e)||x(t)||dw(o,t,!0).each((t=>{e.attr("src",t.blobUri())}))};e.addAttributeFilter("src",(e=>q(e,t)))}},uw=(e,t)=>je(e,`${t}/`),gw=(e,t)=>{const o=e.schema;t.remove_trailing_brs&&ow(t,e,o),e.addAttributeFilter("href",(e=>{let o=e.length;const n=e=>{const t=e?Bt.trim(e):"";return/\b(noopener)\b/g.test(t)?t:(e=>e.split(" ").filter((e=>e.length>0)).concat(["noopener"]).sort().join(" "))(t)};if(!t.allow_unsafe_link_target)for(;o--;){const t=e[o];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",n(t.attr("rel")))}})),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",(e=>{let t,o,n,r,s=e.length;for(;s--;)if(r=e[s],"a"===r.name&&r.firstChild&&!r.attr("href"))for(n=r.parent,t=r.lastChild;t&&n;)o=t.prev,n.insert(t,r),t=o})),t.fix_list_elements&&e.addNodeFilter("ul,ol",(e=>{let t,o,n=e.length;for(;n--;)if(t=e[n],o=t.parent,o&&("ul"===o.name||"ol"===o.name))if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{const e=new Ep("li",1);e.attr("style","list-style-type: none"),t.wrap(e)}}));const n=o.getValidClasses();t.validate&&n&&e.addAttributeFilter("class",(e=>{var t;let o=e.length;for(;o--;){const r=e[o],s=null!==(t=r.attr("class"))&&void 0!==t?t:"",a=Bt.explode(s," ");let i="";for(let e=0;eq(e,(e=>{e.replace(((e,t,o,n,r)=>{let s;s=w(e)?"iframe":uw(e,"image")?"img":uw(e,"video")?"video":uw(e,"audio")?"audio":"iframe";const a=new Ep(s,1);return a.attr("audio"===s?{src:t}:{src:t,width:o,height:n}),"audio"!==s&&"video"!==s||a.attr("controls",""),"iframe"===s&&r&&a.attr("sandbox",""),a})(e.attr("type"),"object"===e.name?e.attr("data"):e.attr("src"),e.attr("width"),e.attr("height"),t.sandbox_iframes))})))),t.sandbox_iframes&&e.addNodeFilter("iframe",(e=>q(e,(e=>e.attr("sandbox","")))))},{entries:hw,setPrototypeOf:pw,isFrozen:fw,getPrototypeOf:vw,getOwnPropertyDescriptor:bw}=Object;let{freeze:yw,seal:ww,create:xw}=Object,{apply:Cw,construct:Sw}="undefined"!=typeof Reflect&&Reflect;Cw||(Cw=function(e,t,o){return e.apply(t,o)}),yw||(yw=function(e){return e}),ww||(ww=function(e){return e}),Sw||(Sw=function(e,t){return new e(...t)});const kw=Hw(Array.prototype.forEach),_w=Hw(Array.prototype.pop),Ew=Hw(Array.prototype.push),Tw=Hw(String.prototype.toLowerCase),Ow=Hw(String.prototype.toString),Dw=Hw(String.prototype.match),Aw=Hw(String.prototype.replace),Mw=Hw(String.prototype.indexOf),Nw=Hw(String.prototype.trim),Rw=Hw(RegExp.prototype.test),Bw=(Lw=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o1?o-1:0),r=1;r/gm),Qw=ww(/\${[\w\W]*}/gm),ex=ww(/^data-[\-\w.\u00B7-\uFFFF]/),tx=ww(/^aria-[\-\w]+$/),ox=ww(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),nx=ww(/^(?:\w+script|data):/i),rx=ww(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sx=ww(/^html$/i);var ax=Object.freeze({__proto__:null,MUSTACHE_EXPR:Xw,ERB_EXPR:Jw,TMPLIT_EXPR:Qw,DATA_ATTR:ex,ARIA_ATTR:tx,IS_ALLOWED_URI:ox,IS_SCRIPT_OR_DATA:nx,ATTR_WHITESPACE:rx,DOCTYPE_NAME:sx});const ix=()=>"undefined"==typeof window?null:window;var lx=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ix();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,r=n.currentScript;let{document:s}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:h}=t,p=c.prototype,f=Fw(p,"cloneNode"),v=Fw(p,"nextSibling"),b=Fw(p,"childNodes"),y=Fw(p,"parentNode");if("function"==typeof i){const e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let w,x="";const{implementation:C,createNodeIterator:S,createDocumentFragment:k,getElementsByTagName:_}=s,{importNode:E}=n;let T={};o.isSupported="function"==typeof hw&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:A,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:B}=ax;let{IS_ALLOWED_URI:L}=ax,H=null;const I=Iw({},[...zw,...Vw,...Zw,...jw,...$w]);let P=null;const F=Iw({},[...qw,...Gw,...Kw,...Yw]);let z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,Z=null,U=!0,j=!0,W=!1,$=!0,q=!1,G=!1,K=!1,Y=!1,X=!1,J=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,re={},se=null;const ae=Iw({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=Iw({},["audio","video","img","source","image","track"]);let ce=null;const de=Iw({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),me="http://www.w3.org/1998/Math/MathML",ue="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let he=ge,pe=!1,fe=null;const ve=Iw({},[me,ue,ge],Ow);let be;const ye=["application/xhtml+xml","text/html"];let we,xe=null;const Ce=s.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){if(!xe||xe!==e){if(e&&"object"==typeof e||(e={}),e=Pw(e),be=be=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===be?Ow:Tw,H="ALLOWED_TAGS"in e?Iw({},e.ALLOWED_TAGS,we):I,P="ALLOWED_ATTR"in e?Iw({},e.ALLOWED_ATTR,we):F,fe="ALLOWED_NAMESPACES"in e?Iw({},e.ALLOWED_NAMESPACES,Ow):ve,ce="ADD_URI_SAFE_ATTR"in e?Iw(Pw(de),e.ADD_URI_SAFE_ATTR,we):de,ie="ADD_DATA_URI_TAGS"in e?Iw(Pw(le),e.ADD_DATA_URI_TAGS,we):le,se="FORBID_CONTENTS"in e?Iw({},e.FORBID_CONTENTS,we):ae,V="FORBID_TAGS"in e?Iw({},e.FORBID_TAGS,we):{},Z="FORBID_ATTR"in e?Iw({},e.FORBID_ATTR,we):{},re="USE_PROFILES"in e&&e.USE_PROFILES,U=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,G=e.WHOLE_DOCUMENT||!1,X=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,Y=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||ox,he=e.NAMESPACE||ge,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),J&&(X=!0),re&&(H=Iw({},[...$w]),P=[],!0===re.html&&(Iw(H,zw),Iw(P,qw)),!0===re.svg&&(Iw(H,Vw),Iw(P,Gw),Iw(P,Yw)),!0===re.svgFilters&&(Iw(H,Zw),Iw(P,Gw),Iw(P,Yw)),!0===re.mathMl&&(Iw(H,jw),Iw(P,Kw),Iw(P,Yw))),e.ADD_TAGS&&(H===I&&(H=Pw(H)),Iw(H,e.ADD_TAGS,we)),e.ADD_ATTR&&(P===F&&(P=Pw(P)),Iw(P,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&Iw(ce,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===ae&&(se=Pw(se)),Iw(se,e.FORBID_CONTENTS,we)),oe&&(H["#text"]=!0),G&&Iw(H,["html","head","body"]),H.table&&(Iw(H,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Bw('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Bw('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,r)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));yw&&yw(e),xe=e}},_e=Iw({},["mi","mo","mn","ms","mtext"]),Ee=Iw({},["foreignobject","desc","title","annotation-xml"]),Te=Iw({},["title","style","font","a","script"]),Oe=Iw({},Vw);Iw(Oe,Zw),Iw(Oe,Uw);const De=Iw({},jw);Iw(De,Ww);const Ae=function(e){Ew(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Me=function(e,t){try{Ew(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ew(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!P[e])if(X||J)try{Ae(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t,o;if(Y)e=""+e;else{const t=Dw(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===be&&he===ge&&(e=''+e+"");const n=w?w.createHTML(e):e;if(he===ge)try{t=(new g).parseFromString(n,be)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(he,"template",null);try{t.documentElement.innerHTML=pe?x:n}catch(e){}}const r=t.body||t.documentElement;return e&&o&&r.insertBefore(s.createTextNode(o),r.childNodes[0]||null),he===ge?_.call(t,G?"html":"body")[0]:G?t.documentElement:r},Re=function(e){return S.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Be=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,n){T[e]&&kw(T[e],(e=>{e.call(o,t,n,xe)}))},He=function(e){let t;if(Le("beforeSanitizeElements",e,null),(n=e)instanceof u&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof m)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Ae(e),!0;var n;const r=we(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:H}),e.hasChildNodes()&&!Be(e.firstElementChild)&&(!Be(e.content)||!Be(e.content.firstElementChild))&&Rw(/<[/\w]/g,e.innerHTML)&&Rw(/<[/\w]/g,e.textContent))return Ae(e),!0;if(!H[r]||V[r]){if(!V[r]&&Pe(r)){if(z.tagNameCheck instanceof RegExp&&Rw(z.tagNameCheck,r))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(r))return!1}if(oe&&!se[r]){const t=y(e)||e.parentNode,o=b(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),v(e))}return Ae(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const o=Tw(e.tagName),n=Tw(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===ue?t.namespaceURI===ge?"svg"===o:t.namespaceURI===me?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Oe[o]):e.namespaceURI===me?t.namespaceURI===ge?"math"===o:t.namespaceURI===ue?"math"===o&&Ee[n]:Boolean(De[o]):e.namespaceURI===ge?!(t.namespaceURI===ue&&!Ee[n])&&!(t.namespaceURI===me&&!_e[n])&&!De[o]&&(Te[o]||!Oe[o]):!("application/xhtml+xml"!==be||!fe[e.namespaceURI]))}(e)?(Ae(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Rw(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=Aw(t,O," "),t=Aw(t,D," "),t=Aw(t,A," "),e.textContent!==t&&(Ew(o.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Ae(e),!0)},Ie=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in s||o in Ce))return!1;if(j&&!Z[t]&&Rw(M,t));else if(U&&Rw(N,t));else if(!P[t]||Z[t]){if(!(Pe(e)&&(z.tagNameCheck instanceof RegExp&&Rw(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&Rw(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Rw(z.tagNameCheck,o)||z.tagNameCheck instanceof Function&&z.tagNameCheck(o))))return!1}else if(ce[t]);else if(Rw(L,Aw(o,B,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Mw(o,"data:")||!ie[e])if(W&&!Rw(R,Aw(o,B,"")));else if(o)return!1;return!0},Pe=function(e){return e.indexOf("-")>0},Fe=function(e){let t,o,n,r;Le("beforeSanitizeAttributes",e,null);const{attributes:s}=e;if(!s)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P};for(r=s.length;r--;){t=s[r];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:Nw(t.value);const c=o;if(n=we(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){Me(i,e);continue}if(!$&&Rw(/\/>/i,o)){Me(i,e);continue}q&&(o=Aw(o,O," "),o=Aw(o,D," "),o=Aw(o,A," "));const d=we(e.nodeName);if(Ie(d,n,o)){if(!te||"id"!==n&&"name"!==n||(Me(i,e),o="user-content-"+o),w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(l);else switch(h.getAttributeType(d,n)){case"TrustedHTML":o=w.createHTML(o);break;case"TrustedScriptURL":o=w.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){Me(i,e)}}else Me(i,e)}Le("afterSanitizeAttributes",e,null)},ze=function e(t){let o;const n=Re(t);for(Le("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Le("uponSanitizeShadowNode",o,null),He(o)||(o.content instanceof a&&e(o.content),Fe(o));Le("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,r,s,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(pe=!e,pe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw Bw("toString is not a function");if("string"!=typeof(e=e.toString()))throw Bw("dirty is not a string, aborting")}if(!o.isSupported)return e;if(K||ke(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=we(e.nodeName);if(!H[t]||V[t])throw Bw("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Ne("\x3c!----\x3e"),r=t.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?t=r:t.appendChild(r);else{if(!X&&!q&&!G&&-1===e.indexOf("<"))return w&&Q?w.createHTML(e):e;if(t=Ne(e),!t)return X?null:Q?x:""}t&&Y&&Ae(t.firstChild);const d=Re(ne?e:t);for(;s=d.nextNode();)He(s)||(s.content instanceof a&&ze(s.content),Fe(s));if(ne)return e;if(X){if(J)for(i=k.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(P.shadowroot||P.shadowrootmode)&&(i=E.call(n,i,!0)),i}let m=G?t.outerHTML:t.innerHTML;return G&&H["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&Rw(sx,t.ownerDocument.doctype.name)&&(m="\n"+m),q&&(m=Aw(m,O," "),m=Aw(m,D," "),m=Aw(m,A," ")),w&&Q?w.createHTML(m):m},o.setConfig=function(e){ke(e),K=!0},o.clearConfig=function(){xe=null,K=!1},o.isValidAttribute=function(e,t,o){xe||ke({});const n=we(e),r=we(t);return Ie(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],Ew(T[e],t))},o.removeHook=function(e){if(T[e])return _w(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const cx=Bt.each,dx=Bt.trim,mx=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],ux={ftp:21,http:80,https:443,mailto:25},gx=["img","video"],hx=(e,t,o)=>{const n=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t).replace(/\s/g,"");return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(n)||!e.allow_html_data_urls&&(/^data:image\//i.test(n)?((e,t)=>C(e)?!e:!C(t)||!j(gx,t))(e.allow_svg_data_urls,o)&&/^data:image\/svg\+xml/i.test(n):/^data:/i.test(n)))};class px{static parseDataUri(e){let t;const o=decodeURIComponent(e).split(","),n=/data:([^;]+)/.exec(o[0]);return n&&(t=n[1]),{type:t,data:o[1]}}static isDomSafe(e,t,o={}){if(o.allow_script_urls)return!0;{const n=ia.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!hx(o,n,t)}}static getDocumentBaseUrl(e){var t;let o;return o=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(o)&&(o=o.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(o)||(o+="/")),o}constructor(e,t={}){this.path="",this.directory="",e=dx(e),this.settings=t;const o=t.base_uri,n=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(n.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(o&&o.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=o?o.path:new px(document.location.href).directory;if(""===(null==o?void 0:o.protocol))e="//mce_host"+n.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(o&&o.protocol||"http")+"://mce_host"+n.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);s&&cx(mx,((e,t)=>{let o=s[t];o&&(o=o.replace(/\(mce_at\)/g,"@@")),n[e]=o})),o&&(n.protocol||(n.protocol=o.protocol),n.userInfo||(n.userInfo=o.userInfo),n.port||"mce_host"!==n.host||(n.port=o.port),n.host&&"mce_host"!==n.host||(n.host=o.host),n.source=""),r&&(n.protocol="")}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);t&&(this.path=t[0],this.directory=t[1],this.file=t[2]),this.source="",this.getURI()}toRelative(e){if("./"===e)return e;const t=new px(e,{base_uri:this});if("mce_host"!==t.host&&this.host!==t.host&&t.host||this.port!==t.port||this.protocol!==t.protocol&&""!==t.protocol)return t.getURI();const o=this.getURI(),n=t.getURI();if(o===n||"/"===o.charAt(o.length-1)&&o.substr(0,o.length-1)===n)return o;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const o=new px(e,{base_uri:this});return o.getURI(t&&this.isSameOrigin(o))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?ux[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let o,n,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(o=0,n=a.length;o=i.length||a[o]!==i[o]){r=o+1;break}if(a.length=a.length||a[o]!==i[o]){r=o+1;break}if(1===r)return t;for(o=0,n=a.length-(r-1);o{e&&a.push(e)}));const i=[];for(let e=s.length-1;e>=0;e--)0!==s[e].length&&"."!==s[e]&&(".."!==s[e]?o>0?o--:i.push(s[e]):o++);const l=a.length-o;let c;return c=l<=0?se(i).join("/"):a.slice(0,l).join("/")+"/"+se(i).join("/"),0!==c.indexOf("/")&&(c="/"+c),n&&c.lastIndexOf("/")!==c.length-1&&(c+=n),c}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),this.query&&(t+="?"+this.query),this.anchor&&(t+="#"+this.anchor),this.source=t),this.source}}const fx=Bt.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),vx="data-mce-type";let bx=0;const yx=(e,t,o,n,r)=>{var s,a,i,l;const c=t.validate,d=o.getSpecialElements();8===e.nodeType&&!t.allow_conditional_comments&&/^\[if/i.test(null!==(s=e.nodeValue)&&void 0!==s?s:"")&&(e.nodeValue=" "+e.nodeValue);const m=null!==(a=null==r?void 0:r.tagName)&&void 0!==a?a:e.nodeName.toLowerCase();if("html"!==n&&o.isValid(n))return void(C(r)&&(r.allowedTags[m]=!0));if(1!==e.nodeType||"body"===m)return;const u=yo.fromDom(e),g=ro(u,vx),p=oo(u,"data-mce-bogus");if(!g&&h(p))return void("all"===p?Cn(u):Sn(u));const f=o.getElementRule(m);if(!c||f){if(C(r)&&(r.allowedTags[m]=!0),c&&f&&!g){if(q(null!==(i=f.attributesForced)&&void 0!==i?i:[],(e=>{eo(u,e.name,"{$uid}"===e.value?"mce_"+bx++:e.value)})),q(null!==(l=f.attributesDefault)&&void 0!==l?l:[],(e=>{ro(u,e.name)||eo(u,e.name,"{$uid}"===e.value?"mce_"+bx++:e.value)})),f.attributesRequired&&!W(f.attributesRequired,(e=>ro(u,e))))return void Sn(u);if(f.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(u))return void Sn(u);f.outputName&&f.outputName!==m&&Ei(u,f.outputName)}}else _e(d,m)?Cn(u):Sn(u)},wx=(e,t,o,n,r,s)=>"html"!==o&&!ws(n)||!(r in fx&&hx(e,s,n))&&(!e.validate||t.isValid(n,r)||je(r,"data-")||je(r,"aria-")),xx=(e,t)=>e.hasAttribute(vx)&&("id"===t||"class"===t||"style"===t),Cx=(e,t)=>e in t.getBoolAttrs(),Sx=(e,t,o,n)=>{const{attributes:r}=e;for(let s=r.length-1;s>=0;s--){const a=r[s],i=a.name,l=a.value;wx(t,o,n,e.tagName.toLowerCase(),i,l)||xx(e,i)?Cx(i,o)&&e.setAttribute(i,i):e.removeAttribute(i)}},kx=(e,t,o)=>{const n=lx();return n.addHook("uponSanitizeElement",((n,r)=>{yx(n,e,t,o.track(n),r)})),n.addHook("uponSanitizeAttribute",((n,r)=>{((e,t,o,n,r)=>{const s=e.tagName.toLowerCase(),{attrName:a,attrValue:i}=r;r.keepAttr=wx(t,o,n,s,a,i),r.keepAttr?(r.allowedAttributes[a]=!0,Cx(a,o)&&(r.attrValue=a),t.allow_svg_data_urls&&je(i,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):xx(e,a)&&(r.forceKeepAttr=!0)})(n,e,t,o.current(),r)})),n},_x=e=>{const t=["type","href","role","arcrole","title","show","actuate","label","from","to"].map((e=>`xlink:${e}`)),o={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:t};return lx().sanitize(e,o),e.innerHTML},Ex=(e,t)=>{const o=(()=>{let e=[];const t=()=>e[e.length-1];return{track:o=>{xs(o)&&e.push(o);let n=t();return n&&!n.contains(o)&&(e.pop(),n=t()),Cs(n)},current:()=>Cs(t()),reset:()=>{e=[]}}})();if(e.sanitize){const n=kx(e,t,o),r=(t,r)=>{n.sanitize(t,((e,t)=>{const o={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[]};return o.PARSER_MEDIA_TYPE=t,e.allow_script_urls?o.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(o.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),o})(e,r)),n.removed=[],o.reset()};return{sanitizeHtmlElement:r,sanitizeNamespaceElement:_x}}return{sanitizeHtmlElement:(n,r)=>{const s=document.createNodeIterator(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let a;for(;a=s.nextNode();){const n=o.track(a);yx(a,e,t,n),Wn(a)&&Sx(a,e,t,n)}o.reset()},sanitizeNamespaceElement:E}},Tx=Bt.makeMap,Ox=Bt.extend,Dx=(e,t,o,n)=>{const r=e.name,s=r in o&&"title"!==r&&"textarea"!==r,a=t.childNodes;for(let t=0,r=a.length;t{const r=o.validate,s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Ox(Tx("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=va(t),c=/[ \t\r\n]+/g,d=/^[ \t\r\n]+/,m=/[ \t\r\n]+$/,u=e=>{let t=e.parent;for(;C(t);){if(t.name in a)return!0;t=t.parent}return!1},g=o=>o.name in i||Is(t,o)||ws(o.name)&&o.parent===e,h=(t,o)=>{const r=o?t.prev:t.next;return!C(r)&&!x(t.parent)&&g(t.parent)&&(t.parent!==e||!0===n.isRootContent)};return[e=>{var t;if(3===e.type&&!u(e)){let o=null!==(t=e.value)&&void 0!==t?t:"";o=o.replace(c," "),(((e,t)=>C(e)&&(t(e)||"br"===e.name))(e.prev,g)||h(e,!0))&&(o=o.replace(d,"")),0===o.length?e.remove():e.value=o}},e=>{var i;if(1===e.type){const i=t.getElementRule(e.name);if(r&&i){const r=mb(t,s,a,e);i.paddInEmptyBlock&&r&&(e=>{let o=e;for(;C(o);){if(o.name in l)return mb(t,s,a,o);o=o.parent}return!1})(e)?cb(o,n,g,e):i.removeEmpty&&r?g(e)?e.remove():e.unwrap():i.paddEmpty&&(r||(e=>{var t;return db(e,"#text")&&(null===(t=null==e?void 0:e.firstChild)||void 0===t?void 0:t.value)===br})(e))&&cb(o,n,g,e)}}else if(3===e.type&&!u(e)){let t=null!==(i=e.value)&&void 0!==i?i:"";(e.next&&g(e.next)||h(e,!1))&&(t=t.replace(m,"")),0===t.length?e.remove():e.value=t}}]},Mx=(e={},t=ya())=>{const o=Qy(),n=Qy(),r={validate:!0,root_name:"body",sanitize:!0,...e},s=new DOMParser,a=Ex(r,t),i=o.addFilter,l=o.getFilters,c=o.removeFilter,d=n.addFilter,m=n.getFilters,u=n.removeFilter,g=(e,o)=>{const n=h(o.attr(vx)),r=1===o.type&&!_e(e,o.name)&&!Is(t,o)&&!ws(o.name);return 3===o.type||r&&!n},p={schema:t,addAttributeFilter:d,getAttributeFilters:m,removeAttributeFilter:u,addNodeFilter:i,getNodeFilters:l,removeNodeFilter:c,parse:(e,o={})=>{var n;const i=r.validate,c=null!==(n=o.context)&&void 0!==n?n:r.root_name,d=((e,o,n="html")=>{const r="xhtml"===n?"application/xhtml+xml":"text/html",i=_e(t.getSpecialElements(),o.toLowerCase()),l=i?`<${o}>${e}`:e,c="xhtml"===n?`${l}`:`${l}`,d=s.parseFromString(c,r).body;return a.sanitizeHtmlElement(d,r),i?d.firstChild:d})(e,c,o.format);As(t,d);const u=new Ep(c,11);Dx(u,d,t.getSpecialElements(),a.sanitizeNamespaceElement),d.innerHTML="";const[h,p]=Ax(u,t,r,o),f=[],v=i?e=>((e,o)=>{pb(t,e)&&o.push(e)})(e,f):E,b={nodes:{},attributes:{}},y=e=>ab(l(),m(),e,b);if(((e,t,o)=>{const n=[];for(let o=e,r=o;o;r=o,o=o.walk()){const s=o;q(t,(e=>e(s))),x(s.parent)&&s!==e?o=r:n.push(s)}for(let e=n.length-1;e>=0;e--){const t=n[e];q(o,(e=>e(t)))}})(u,[h,y],[p,v]),f.reverse(),i&&f.length>0)if(o.context){const{pass:e,fail:n}=K(f,(e=>e.parent===u));hb(n,t,u,y),o.invalid=e.length>0}else hb(f,t,u,y);const w=((e,t)=>{var o;const n=null!==(o=t.forced_root_block)&&void 0!==o?o:e.forced_root_block;return!1===n?"":!0===n?"p":n})(r,o);return w&&("body"===u.name||o.isRootContent)&&((e,o)=>{const n=Ox(Tx("script,style,head,html,body,title,meta,param"),t.getBlockElements()),s=/^[ \t\r\n]+/,a=/[ \t\r\n]+$/;let i=e.firstChild,l=null;const c=e=>{var t,o;e&&(i=e.firstChild,i&&3===i.type&&(i.value=null===(t=i.value)||void 0===t?void 0:t.replace(s,"")),i=e.lastChild,i&&3===i.type&&(i.value=null===(o=i.value)||void 0===o?void 0:o.replace(a,"")))};if(t.isValidChild(e.name,o.toLowerCase())){for(;i;){const t=i.next;g(n,i)?(l||(l=new Ep(o,1),l.attr(r.forced_root_block_attrs),e.insert(l,i)),l.append(i)):(c(l),l=null),i=t}c(l)}})(u,w),o.invalid||ib(b,o),u}};return gw(p,r),((e,t,o)=>{t.inline_styles&&tw(e,t,o)})(p,r,t),p},Nx=(e,t,o)=>{const n=(e=>Nb(e)?$p({validate:!1}).serialize(e):e)(e),r=t(n);if(r.isDefaultPrevented())return r;if(Nb(e)){if(r.content!==n){const t=Mx({validate:!1,forced_root_block:!1,...o}).parse(r.content,{context:e.name});return{...r,content:t}}return{...r,content:e}}return r},Rx=(e,t)=>{if(t.no_events)return Dl.value(t);{const o=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return o.isDefaultPrevented()?Dl.error(Tg(e,{content:"",...o}).content):Dl.value(o)}},Bx=(e,t,o)=>{if(o.no_events)return t;{const n=Nx(t,(t=>Tg(e,{...o,content:t})),{sanitize:Td(e),sandbox_iframes:Bd(e)});return n.content}},Lx=(e,t)=>{if(t.no_events)return Dl.value(t);{const o=Nx(t.content,(o=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:o})),{sanitize:Td(e),sandbox_iframes:Bd(e)});return o.isDefaultPrevented()?(Eg(e,o),Dl.error(void 0)):Dl.value(o)}},Hx=(e,t,o)=>{o.no_events||Eg(e,{...o,content:t})},Ix=(e,t,o)=>({element:e,width:t,rows:o}),Px=(e,t)=>({element:e,cells:t}),Fx=(e,t)=>({x:e,y:t}),zx=(e,t)=>no(e,t).bind(Je).getOr(1),Vx=(e,t,o)=>{const n=e.rows;return!!(n[o]?n[o].cells:[])[t]},Zx=e=>J(e,((e,t)=>t.cells.length>e?t.cells.length:e),0),Ux=(e,t)=>{const o=e.rows;for(let e=0;e{const s=[],a=e.rows;for(let e=o;e<=r;e++){const o=a[e].cells,r=t{const t=Ix(ki(e),0,[]);return q(zn(e,"tr"),((e,o)=>{q(zn(e,"td,th"),((n,r)=>{((e,t,o,n,r)=>{const s=zx(r,"rowspan"),a=zx(r,"colspan"),i=e.rows;for(let e=o;e{for(;Vx(e,t,o);)t++;return t})(t,r,o),o,e,n)}))})),Ix(t.element,Zx(t.rows),t.rows)},$x=e=>((e,t)=>{const o=ki(e.element),n=yo.fromTag("tbody");return wn(n,t),bn(o,n),o})(e,(e=>$(e.rows,(e=>{const t=$(e.cells,(e=>{const t=_i(e);return so(t,"colspan"),so(t,"rowspan"),t})),o=ki(e.element);return wn(o,t),o})))(e)),qx=(e,t,o)=>Ux(e,t).bind((t=>Ux(e,o).map((o=>((e,t,o)=>{const n=t.x,r=t.y,s=o.x,a=o.y,i=ree(e,(e=>"li"===jt(e)&&Su(e,t))).fold(D([]),(t=>(e=>ee(e,(e=>"ul"===jt(e)||"ol"===jt(e))))(e).map((e=>{const t=yo.fromTag(jt(e)),o=xe(gn(e),((e,t)=>je(t,"list-style")));return cn(t,o),[yo.fromTag("li"),t]})).getOr([]))),Kx=(e,t,o)=>{const n=yo.fromDom(t.commonAncestorContainer),r=pf(n,e),s=Y(r,(e=>o.isWrapper(jt(e)))),a=Gx(r,t),i=s.concat(a.length?a:(e=>Tr(e)?Oo(e).filter(Er).fold(D([]),(t=>[e,t])):Er(e)?[e]:[])(n));return $(i,ki)},Yx=()=>Xg([]),Xx=(e,t,o)=>((e,t)=>{const o=J(t,((e,t)=>(bn(t,e),t)),e);return t.length>0?Xg([o]):o})(yo.fromDom(t.cloneContents()),Kx(e,t,o)),Jx=(e,t)=>((e,t)=>en(t,"table",N(So,e)))(e,t[0]).bind((e=>{const o=t[0],n=t[t.length-1],r=Wx(e);return qx(r,o,n).map((e=>Xg([$x(e)])))})).getOrThunk(Yx),Qx=(e,t,o)=>{const n=bu(t,e);return n.length>0?Jx(e,n):((e,t,o)=>t.length>0&&t[0].collapsed?Yx():Xx(e,t[0],o))(e,t,o)},eC=(e,t)=>t>=0&&tHr(e.innerText),oC=(e,t)=>{if("text"===t.format)return(e=>F.from(e.selection.getRng()).map((t=>{var o;const n=F.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),r=e.getBody(),s=(e=>e.map((e=>e.nodeName)).getOr("div").toLowerCase())(n),a=yo.fromDom(t.cloneContents());zp(a),Vp(a);const i=e.dom.add(r,s,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},a.dom),l=tC(i),c=Hr(null!==(o=i.textContent)&&void 0!==o?o:"");if(e.dom.remove(i),eC(c,0)||eC(c,c.length-1)){const e=n.getOr(r),t=tC(e),o=t.indexOf(l);return-1===o?l:(eC(t,o-1)?" ":"")+l+(eC(t,o+l.length)?" ":"")}return l})).getOr(""))(e);{const o=((e,t)=>{const o=e.selection.getRng(),n=e.dom.create("body"),r=e.selection.getSel(),s=pp(e,fu(r)),a=t.contextual?Qx(yo.fromDom(e.getBody()),s,e.schema).dom:o.cloneContents();return a&&n.appendChild(a),e.selection.serializer.serialize(n,t)})(e,t);return"tree"===t.format?o:e.selection.isCollapsed()?"":o}},nC=e=>Wn(e)?e.outerHTML:tr(e)?ia.encodeRaw(e.data,!1):rr(e)?"\x3c!--"+e.data+"--\x3e":"",rC=(e,t,o)=>{const n=(e=>{let t;const o=document.createElement("div"),n=document.createDocumentFragment();for(e&&(o.innerHTML=e);t=o.firstChild;)n.appendChild(t);return n})(t);if(e.hasChildNodes()&&o(((e,t)=>{let o=0;q(e,(e=>{0===e[0]?o++:1===e[0]?(rC(t,e[1],o),o++):2===e[0]&&((e,t)=>{if(e.hasChildNodes()&&t{const o=e.length+t.length+2,n=new Array(o),r=new Array(o),s=(o,n,r,a,l)=>{const c=i(o,n,r,a);if(null===c||c.start===n&&c.diag===n-a||c.end===o&&c.diag===o-r){let s=o,i=r;for(;sa-r?(l.push([2,e[s]]),++s):(l.push([1,t[i]]),++i)}else{s(o,c.start,r,c.start-c.diag,l);for(let t=c.start;t{let a=o;for(;a-n({start:e,end:t,diag:o}))(o,a,n)},i=(o,s,i,l)=>{const c=s-o,d=l-i;if(0===c||0===d)return null;const m=c-d,u=d+c,g=(u%2==0?u:u+1)/2;let h,p,f,v,b;for(n[1+g]=o,r[1+g]=s+1,h=0;h<=g;++h){for(p=-h;p<=h;p+=2){for(f=p+g,p===-h||p!==h&&n[f-1]=o&&b>=i&&e[v]===t[b];)r[f]=v--,b--;if(m%2==0&&-h<=p&&p<=h&&r[f]<=n[f+m])return a(r[f],p+o-i,s,l)}}return null},l=[];return s(0,e.length,0,t.length,l),l})($(ue(t.childNodes),nC),e),t),t),aC=He((()=>document.implementation.createHTMLDocument("undo"))),iC=e=>{const t=e.serializer.getTempAttrs(),o=Fp(e.getBody(),t);return(e=>null!==e.querySelector("iframe"))(o)?(n=((e,t)=>Y($(ue(e.childNodes),t?T(Hr,nC):nC),(e=>e.length>0)))(o,!0),{type:"fragmented",fragments:n,content:"",bookmark:null,beforeBookmark:null}):{type:"complete",fragments:null,content:Hr(o.innerHTML),bookmark:null,beforeBookmark:null};var n},lC=(e,t,o)=>{const n=o?t.beforeBookmark:t.bookmark;"fragmented"===t.type?sC(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!C(n)||!eu(n)||!n.isFakeCaret}),n&&(e.selection.moveToBookmark(n),e.selection.scrollIntoView())},cC=e=>"fragmented"===e.type?e.fragments.join(""):e.content,dC=e=>{const t=yo.fromTag("body",aC());return En(t,cC(e)),q(zn(t,"*[data-mce-bogus]"),Sn),_n(t)},mC=(e,t)=>!(!e||!t)&&(!!((e,t)=>cC(e)===cC(t))(e,t)||((e,t)=>dC(e)===dC(t))(e,t)),uC=e=>0===e.get(),gC=(e,t,o)=>{uC(o)&&(e.typing=t)},hC=(e,t)=>{e.typing&&(gC(e,!1,t),e.add())},pC=e=>({init:{bindEvents:E},undoManager:{beforeChange:(t,o)=>((e,t,o)=>{uC(t)&&o.set(El(e.selection))})(e,t,o),add:(t,o,n,r,s,a)=>((e,t,o,n,r,s,a)=>{const i=iC(e),l=Bt.extend(s||{},i);if(!uC(n)||e.removed)return null;const c=t.data[o.get()];if(e.dispatch("BeforeAddUndo",{level:l,lastLevel:c,originalEvent:a}).isDefaultPrevented())return null;if(c&&mC(c,l))return null;t.data[o.get()]&&r.get().each((e=>{t.data[o.get()].beforeBookmark=e}));const d=jc(e);if(d&&t.data.length>d){for(let e=0;e0?(e.setDirty(!0),e.dispatch("AddUndo",m),e.dispatch("change",m)):e.dispatch("AddUndo",m),l})(e,t,o,n,r,s,a),undo:(t,o,n)=>((e,t,o,n)=>{let r;return t.typing&&(t.add(),t.typing=!1,gC(t,!1,o)),n.get()>0&&(n.set(n.get()-1),r=t.data[n.get()],lC(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,o,n),redo:(t,o)=>((e,t,o)=>{let n;return t.get()((e,t,o)=>{t.data=[],o.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,o),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,o)=>((e,t,o)=>o.get()>0||t.typing&&t.data[0]&&!mC(iC(e),t.data[0]))(e,t,o),hasRedo:(e,t)=>((e,t)=>t.get()((e,t,o)=>(hC(e,t),e.beforeChange(),e.ignore(o),e.add()))(e,t,o),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,o,n,r)=>((e,t,o,n,r)=>{if(t.transact(n)){const n=t.data[o.get()].bookmark,s=t.data[o.get()-1];lC(e,s,!0),t.transact(r)&&(t.data[o.get()-1].beforeBookmark=n)}})(e,t,o,n,r)},formatter:{match:(t,o,n,r)=>Ub(e,t,o,n,r),matchAll:(t,o)=>((e,t,o)=>{const n=[],r={},s=e.selection.getStart();return e.dom.getParent(s,(s=>{for(let a=0;aZb(e,t,o,n,r),canApply:t=>((e,t)=>{const o=e.formatter.get(t),n=e.dom;if(o&&e.selection.isEditable()){const t=e.selection.getStart(),r=Zu(n,t);for(let e=o.length-1;e>=0;e--){const t=o[e];if(!$u(t))return!0;for(let e=r.length-1;e>=0;e--)if(n.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>jb(e,t),apply:(t,o,n)=>Wy(e,t,o,n),remove:(t,o,n,r)=>Py(e,t,o,n,r),toggle:(t,o,n)=>((e,t,o,n)=>{const r=e.formatter.get(t);r&&(!Ub(e,t,o,n)||"toggle"in r[0]&&!r[0].toggle?Wy(e,t,o,n):Py(e,t,o,n))})(e,t,o,n),formatChanged:(t,o,n,r,s)=>Xy(e,t,o,n,r,s)},editor:{getContent:t=>((e,t)=>F.from(e.getBody()).fold(D("tree"===t.format?new Ep("body",11):""),(o=>Up(e,t,o))))(e,t),setContent:(t,o)=>Bb(e,t,o),insertContent:(t,o)=>Mb(e,t,o),addVisual:t=>((e,t)=>{const o=e.dom,n=C(t)?t:e.getBody();q(o.select("table,a",n),(t=>{switch(t.nodeName){case"TABLE":const n=Qc(e),r=o.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?o.removeClass(t,n):o.addClass(t,n);break;case"A":if(!o.getAttrib(t,"href")){const n=o.getAttrib(t,"name")||t.id,r=ed(e);n&&e.hasVisual?o.addClass(t,r):o.removeClass(t,r)}}})),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,o)=>((e,t,o={})=>{const n=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(o,t);return Rx(e,n).fold(A,(t=>{const o=oC(e,t);return Bx(e,o,t)}))})(e,t,o)},autocompleter:{addDecoration:t=>wp(e,t),removeDecoration:()=>((e,t)=>xp(t).each((t=>{const o=e.selection.getBookmark();Sn(t),e.selection.moveToBookmark(o)})))(e,yo.fromDom(e.getBody()))},raw:{getModel:()=>F.none()}}),fC=e=>_e(e.plugins,"rtc"),vC=e=>{const t=e;return(e=>ke(e.plugins,"rtc").bind((e=>F.from(e.setup))))(e).fold((()=>(t.rtcInstance=pC(e),F.none())),(e=>(t.rtcInstance=(()=>{const e=D(null),t=D("");return{init:{bindEvents:E},undoManager:{beforeChange:E,add:e,undo:e,redo:e,clear:E,reset:E,hasUndo:I,hasRedo:I,transact:e,ignore:E,extra:E},formatter:{match:I,matchAll:D([]),matchNode:D(void 0),canApply:I,closest:t,apply:E,remove:E,toggle:E,formatChanged:D({unbind:E})},editor:{getContent:t,setContent:D({content:"",html:""}),insertContent:D(""),addVisual:E},selection:{getContent:t},autocompleter:{addDecoration:E,removeDecoration:E},raw:{getModel:D(F.none())}}})(),F.some((()=>e().then((e=>(t.rtcInstance=(e=>{const t=e=>p(e)?e:{},{init:o,undoManager:n,formatter:r,editor:s,selection:a,autocompleter:i,raw:l}=e;return{init:{bindEvents:o.bindEvents},undoManager:{beforeChange:n.beforeChange,add:n.add,undo:n.undo,redo:n.redo,clear:n.clear,reset:n.reset,hasUndo:n.hasUndo,hasRedo:n.hasRedo,transact:(e,t,o)=>n.transact(o),ignore:(e,t)=>n.ignore(t),extra:(e,t,o,r)=>n.extra(o,r)},formatter:{match:(e,o,n,s)=>r.match(e,t(o),s),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,o,n)=>r.apply(e,t(o)),remove:(e,o,n,s)=>r.remove(e,t(o)),toggle:(e,o,n)=>r.toggle(e,t(o)),formatChanged:(e,t,o,n,s)=>r.formatChanged(t,o,n,s)},editor:{getContent:e=>s.getContent(e),setContent:(e,t)=>({content:s.setContent(e,t),html:""}),insertContent:(e,t)=>(s.insertContent(e),""),addVisual:s.addVisual},selection:{getContent:(e,t)=>a.getContent(t)},autocompleter:{addDecoration:i.addDecoration,removeDecoration:i.removeDecoration},raw:{getModel:()=>F.some(l.getRawModel())}}})(e),e.rtc.isRemote))))))))},bC=e=>e.rtcInstance?e.rtcInstance:pC(e),yC=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},wC=e=>yC(e).init.bindEvents(),xC=(e,t={})=>((e,t,o)=>yC(e).selection.getContent(t,o))(e,t.format?t.format:"html",t),CC=e=>0===e.dom.length?(Cn(e),F.none()):F.some(e),SC=(e,t,o,n,r)=>{e.bind((e=>((n?Kf:Gf)(e.dom,n?e.dom.length:0,r),t.filter(Kt).map((t=>((e,t,o,n,r)=>{const s=e.dom,a=t.dom,i=n?s.length:a.length;n?(Yf(s,a,r,!1,!n),o.setStart(a,i)):(Yf(a,s,r,!1,!n),o.setEnd(a,i))})(e,t,o,n,r)))))).orThunk((()=>{const e=((e,t)=>e.filter((e=>xg.isBookmarkNode(e.dom))).bind(t?No:Mo))(t,n).or(t).filter(Kt);return e.map((e=>((e,t,o)=>{Oo(e).each((n=>{const r=e.dom;t&&Pf(n,rl(r,0),o)?Gf(r,0,o):!t&&Ff(n,rl(r,r.length),o)&&Kf(r,r.length,o)}))})(e,n,r)))}))},kC=(e,t,o={})=>{const n=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(o,t);Lx(e,n).each((t=>{const o=((e,t)=>{if("raw"!==t.format){const o=e.selection.getRng(),n=e.dom.getParent(o.commonAncestorContainer,e.dom.isBlock),r=n?{context:n.nodeName.toLowerCase()}:{},s=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return $p({validate:!1},e.schema).serialize(s)}return t.content})(e,t),n=e.selection.getRng();((e,t,o)=>{const n=F.from(t.firstChild).map(yo.fromDom),r=F.from(t.lastChild).map(yo.fromDom);e.deleteContents(),e.insertNode(t);const s=n.bind(Mo).filter(Kt).bind(CC),a=r.bind(No).filter(Kt).bind(CC);SC(s,n,e,!0,o),SC(a,r,e,!1,o),e.collapse(!1)})(n,n.createContextualFragment(o),e.schema),e.selection.setRng(n),Rh(e,n),Hx(e,o,t)}))},_C=(e,t,o)=>{if(_e(e,t)){const n=Y(e[t],(e=>e!==o));0===n.length?delete e[t]:e[t]=n}};var EC=(e,t)=>{let o,n;const r=(t,o)=>ee(o,(o=>e.is(o,t))),s=t=>e.getParents(t,void 0,e.getRoot());return{selectorChangedWithUnbind:(e,a)=>(o||(o={},n={},t.on("NodeChange",(e=>{const t=e.element,a=s(t),i={};fe(o,((e,t)=>{r(t,a).each((o=>{n[t]||(q(e,(e=>{e(!0,{node:o,selector:t,parents:a})})),n[t]=e),i[t]=e}))})),fe(n,((e,o)=>{i[o]||(delete n[o],q(e,(e=>{e(!1,{node:t,selector:o,parents:a})})))}))}))),o[e]||(o[e]=[]),o[e].push(a),r(e,s(t.selection.getStart())).each((()=>{n[e]=o[e]})),{unbind:()=>{_C(o,e,a),_C(n,e,a)}})}};const TC=e=>!(!e||!e.ownerDocument)&&ko(yo.fromDom(e.ownerDocument),yo.fromDom(e)),OC=(e,t,o,n)=>{let r,s;const{selectorChangedWithUnbind:a}=EC(e,n),i=(e,t)=>kC(n,e,t),l=e=>{const t=d();t.collapse(!!e),m(t)},c=()=>t.getSelection?t.getSelection():t.document.selection,d=()=>{let o;const a=(e,t,o)=>{try{return t.compareBoundaryPoints(e,o)}catch(e){return-1}},i=t.document;if(C(n.bookmark)&&!ap(n)){const e=Wh(n);if(e.isSome())return e.map((e=>pp(n,[e])[0])).getOr(i.createRange())}try{const e=c();e&&!jn(e.anchorNode)&&(o=e.rangeCount>0?e.getRangeAt(0):i.createRange(),o=pp(n,[o])[0])}catch(e){}if(o||(o=i.createRange()),sr(o.startContainer)&&o.collapsed){const t=e.getRoot();o.setStart(t,0),o.setEnd(t,0)}return r&&s&&(0===a(o.START_TO_START,o,r)&&0===a(o.END_TO_END,o,r)?o=s:(r=null,s=null)),o},m=(e,t)=>{if(!(e=>!!e&&TC(e.startContainer)&&TC(e.endContainer))(e))return;const o=c();if(e=n.dispatch("SetSelectionRange",{range:e,forward:t}).range,o){s=e;try{o.removeAllRanges(),o.addRange(e)}catch(e){}!1===t&&o.extend&&(o.collapse(e.endContainer,e.endOffset),o.extend(e.startContainer,e.startOffset)),r=o.rangeCount>0?o.getRangeAt(0):null}if(!e.collapsed&&e.startContainer===e.endContainer&&(null==o?void 0:o.setBaseAndExtent)&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()){const t=e.startContainer.childNodes[e.startOffset];t&&"IMG"===t.nodeName&&(o.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),o.anchorNode===e.startContainer&&o.focusNode===e.endContainer||o.setBaseAndExtent(t,0,t,1))}n.dispatch("AfterSetSelectionRange",{range:e,forward:t})},u=()=>{const t=c(),o=null==t?void 0:t.anchorNode,n=null==t?void 0:t.focusNode;if(!t||!o||!n||jn(o)||jn(n))return!0;const r=e.createRng(),s=e.createRng();try{r.setStart(o,t.anchorOffset),r.collapse(!0),s.setStart(n,t.focusOffset),s.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,s)<=0},g={dom:e,win:t,serializer:o,editor:n,expand:(t={type:"word"})=>m(mh(e).expand(d(),t)),collapse:l,setCursorLocation:(t,o)=>{const r=e.createRng();C(t)&&C(o)?(r.setStart(t,o),r.setEnd(t,o),m(r),l(!1)):(ku(e,r,n.getBody(),!0),m(r))},getContent:e=>xC(n,e),setContent:i,getBookmark:(e,t)=>h.getBookmark(e,t),moveToBookmark:e=>h.moveToBookmark(e),select:(t,o)=>(((e,t,o)=>F.from(t).bind((t=>F.from(t.parentNode).map((n=>{const r=e.nodeIndex(t),s=e.createRng();return s.setStart(n,r),s.setEnd(n,r+1),o&&(ku(e,s,t,!0),ku(e,s,t,!1)),s})))))(e,t,o).each(m),t),isCollapsed:()=>{const e=d(),t=c();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isEditable:()=>{const t=d(),o=n.getBody().querySelectorAll('[data-mce-selected="1"]');return o.length>0?re(o,(t=>e.isEditable(t.parentElement))):dp(e,t)},isForward:u,setNode:t=>(i(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{if(!t)return e;let o=t.startContainer,n=t.endContainer;const r=t.startOffset,s=t.endOffset;let a=t.commonAncestorContainer;t.collapsed||(o===n&&s-r<2&&o.hasChildNodes()&&(a=o.childNodes[r]),tr(o)&&tr(n)&&(o=o.length===r?hp(o.nextSibling,!0):o.parentNode,n=0===s?hp(n.previousSibling,!1):n.parentNode,o&&o===n&&(a=o)));const i=tr(a)?a.parentNode:a;return $n(i)?i:e})(n.getBody(),d()),getSel:c,setRng:m,getRng:d,getStart:e=>up(n.getBody(),d(),e),getEnd:e=>gp(n.getBody(),d(),e),getSelectedBlocks:(t,o)=>((e,t,o,n)=>{const r=[],s=e.getRoot(),a=e.getParent(o||up(s,t,t.collapsed),e.isBlock),i=e.getParent(n||gp(s,t,t.collapsed),e.isBlock);if(a&&a!==s&&r.push(a),a&&i&&a!==i){let t;const o=new Zn(a,s);for(;(t=o.next())&&t!==i;)e.isBlock(t)&&r.push(t)}return i&&a!==i&&i!==s&&r.push(i),r})(e,d(),t,o),normalize:()=>{const t=d(),o=c();if(!(fu(o).length>1)&&_u(n)){const o=lh(e,t);return o.each((e=>{m(e,u())})),o.getOr(t)}return t},selectorChanged:(e,t)=>(a(e,t),g),selectorChangedWithUnbind:a,getScrollContainer:()=>{let t,o=e.getRoot();for(;o&&"BODY"!==o.nodeName;){if(o.scrollHeight>o.clientHeight){t=o;break}o=o.parentNode}return t},scrollIntoView:(e,t)=>{C(e)?((e,t,o)=>{(e.inline?Ah:Nh)(e,t,o)})(n,e,t):Rh(n,d(),t)},placeCaretAt:(e,t)=>m(eh(e,t,n.getDoc())),getBoundingClientRect:()=>{const e=d();return e.collapsed?rl.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=s=null,p.destroy()}},h=xg(g),p=Bg(g,n);return g.bookmarkManager=h,g.controlSelection=p,g},DC=(e,t,o)=>((e,t)=>C(e)&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,o)?((e,t,o)=>{let n;const r=e.dom;let s=t.cloneNode(!0);const a=document.implementation;if(a.createHTMLDocument){const e=a.createHTMLDocument("");Bt.each("BODY"===s.nodeName?s.childNodes:[s],(t=>{e.body.appendChild(e.importNode(t,!0))})),s="BODY"!==s.nodeName?e.body.firstChild:e.body,n=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...o,node:s}),n&&(r.doc=n),s})(e,t,o):t,AC=(e,t,o)=>{-1===Bt.inArray(t,o)&&(e.addAttributeFilter(o,((e,t)=>{let o=e.length;for(;o--;)e[o].attr(t,null)})),t.push(o))},MC=(e,t,o,n,r)=>{const s=((e,t,o)=>$p(e,t).serialize(o))(t,o,n);return((e,t,o)=>{if(!t.no_events&&e){const n=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:o});return n.content}return o})(e,r,s)},NC=(e,t)=>{const o=["data-mce-selected"],n={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},r=t&&t.dom?t.dom:Ya.DOM,s=t&&t.schema?t.schema:ya(n),a=Mx(n,s);return((e,t,o)=>{e.addAttributeFilter("data-mce-tabindex",((e,t)=>{let o=e.length;for(;o--;){const n=e[o];n.attr("tabindex",n.attr("data-mce-tabindex")),n.attr(t,null)}})),e.addAttributeFilter("src,href,style",((e,n)=>{const r="data-mce-"+n,s=t.url_converter,a=t.url_converter_scope;let i=e.length;for(;i--;){const t=e[i];let l=t.attr(r);void 0!==l?(t.attr(n,l.length>0?l:null),t.attr(r,null)):(l=t.attr(n),"style"===n?l=o.serializeStyle(o.parseStyle(l),t.name):s&&(l=s.call(a,l,n,t.name)),t.attr(n,l.length>0?l:null))}})),e.addAttributeFilter("class",(e=>{let t=e.length;for(;t--;){const o=e[t];let n=o.attr("class");n&&(n=n.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),o.attr("class",n.length>0?n:null))}})),e.addAttributeFilter("data-mce-type",((e,t,o)=>{let n=e.length;for(;n--;){const t=e[n];if("bookmark"===t.attr("data-mce-type")&&!o.cleanup){const e=F.from(t.firstChild).exists((e=>{var t;return!Lr(null!==(t=e.value)&&void 0!==t?t:"")}));e?t.unwrap():t.remove()}}})),e.addNodeFilter("noscript",(e=>{var t;let o=e.length;for(;o--;){const n=e[o].firstChild;n&&(n.value=ia.decode(null!==(t=n.value)&&void 0!==t?t:""))}})),e.addNodeFilter("script,style",((e,o)=>{var n;const r=e=>e.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let s=e.length;for(;s--;){const a=e[s],i=a.firstChild,l=null!==(n=null==i?void 0:i.value)&&void 0!==n?n:"";if("script"===o){const e=a.attr("type");e&&a.attr("type","mce-no/type"===e?null:e.replace(/^mce\-/,"")),"xhtml"===t.element_format&&i&&l.length>0&&(i.value="// ")}else"xhtml"===t.element_format&&i&&l.length>0&&(i.value="\x3c!--\n"+r(l)+"\n--\x3e")}})),e.addNodeFilter("#comment",(e=>{let n=e.length;for(;n--;){const r=e[n],s=r.value;t.preserve_cdata&&0===(null==s?void 0:s.indexOf("[CDATA["))?(r.name="#cdata",r.type=4,r.value=o.decode(s.replace(/^\[CDATA\[|\]\]$/g,""))):0===(null==s?void 0:s.indexOf("mce:protected "))&&(r.name="#text",r.type=3,r.raw=!0,r.value=unescape(s).substr(14))}})),e.addNodeFilter("xml:namespace,input",((e,t)=>{let o=e.length;for(;o--;){const n=e[o];7===n.type?n.remove():1===n.type&&("input"!==t||n.attr("type")||n.attr("type","text"))}})),e.addAttributeFilter("data-mce-type",(t=>{q(t,(t=>{"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())}))})),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",((e,t)=>{let o=e.length;for(;o--;)e[o].attr(t,null)})),t.remove_trailing_brs&&ow(t,e,e.schema)})(a,n,r),{schema:s,addNodeFilter:a.addNodeFilter,addAttributeFilter:a.addAttributeFilter,serialize:(e,o={})=>{const i={format:"html",...o},l=DC(t,e,i),c=((e,t,o)=>{const n=Hr(o.getInner?t.innerHTML:e.getOuterHTML(t));return o.selection||Ar(yo.fromDom(t))?n:Bt.trim(n)})(r,l,i),d=((e,t,o)=>{const n=o.selection?{forced_root_block:!1,...o}:o,r=e.parse(t,n);return(e=>{const t=e=>"br"===(null==e?void 0:e.name),o=e.lastChild;if(t(o)){const e=o.prev;t(e)&&(o.remove(),e.remove())}})(r),r})(a,c,i);return"tree"===i.format?d:MC(t,n,s,d,i)},addRules:s.addValidElements,setRules:s.setValidElements,addTempAttr:N(AC,a,o),getTempAttrs:D(o),getNodeFilters:a.getNodeFilters,getAttributeFilters:a.getAttributeFilters,removeNodeFilter:a.removeNodeFilter,removeAttributeFilter:a.removeAttributeFilter}},RC=(e,t)=>{const o=NC(e,t);return{schema:o.schema,addNodeFilter:o.addNodeFilter,addAttributeFilter:o.addAttributeFilter,serialize:o.serialize,addRules:o.addRules,setRules:o.setRules,addTempAttr:o.addTempAttr,getTempAttrs:o.getTempAttrs,getNodeFilters:o.getNodeFilters,getAttributeFilters:o.getAttributeFilters,removeNodeFilter:o.removeNodeFilter,removeAttributeFilter:o.removeAttributeFilter}},BC=(e,t={})=>{const o=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return Rx(e,o).fold(A,(t=>{const o=((e,t)=>bC(e).editor.getContent(t))(e,t);return Bx(e,o,t)}))},LC=(e,t,o={})=>{const n=((e,t)=>({format:"html",...e,set:!0,content:t}))(o,t);return Lx(e,n).map((t=>{const o=((e,t,o)=>bC(e).editor.setContent(t,o))(e,t.content,t);return Hx(e,o.html,t),o.content})).getOr(t)},HC="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists".split(","),IC="template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),PC="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor".split(","),FC=[{name:"template",replacedWith:"Advanced Template"},{name:"rtc"}],zC=(e,t)=>{const o=Y(t,(t=>_e(e,t)));return le(o)},VC=e=>{const t=zC(e,HC),o=e.forced_root_block;return!1!==o&&""!==o||t.push("forced_root_block (false only)"),le(t)},ZC=e=>zC(e,IC),UC=(e,t)=>{const o=Bt.makeMap(e.plugins," "),n=Y(t,(e=>_e(o,e)));return le(n)},jC=e=>UC(e,PC),WC=e=>UC(e,FC.map((e=>e.name))),$C=e=>ee(FC,(t=>t.name===e)).fold((()=>e),(t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e)),qC=(e,t)=>{((e,t)=>{const o=VC(e),n=jC(t),r=n.length>0,s=o.length>0,a="mobile"===t.theme;if(r||s||a){const e="\n- ",t=a?`\n\nThemes:${e}mobile`:"",i=r?`\n\nPlugins:${e}${n.join(e)}`:"",l=s?`\n\nOptions:${e}${o.join(e)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 6.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ for more information."+t+i+l)}})(e,t),((e,t)=>{const o=ZC(e),n=WC(t),r=n.length>0,s=o.length>0;if(r||s){const e="\n- ",t=r?`\n\nPlugins:${e}${n.map($C).join(e)}`:"",a=s?`\n\nOptions:${e}${o.join(e)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+t+a)}})(e,t)},GC=Ya.DOM,KC=e=>F.from(e).each((e=>e.destroy())),YC=e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:o}=e,n=e.getBody(),r=e.getElement();n&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&C(null==r?void 0:r.nextSibling)&&GC.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&n&&(e=>{GC.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),GC.remove(e.getContainer()),KC(t),KC(o),e.destroy()}},XC=(e,t)=>{const{selection:o,dom:n}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),KC(o),KC(n)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),GC.unbind(t,"submit reset",e.formEventDelegate))})(e),(e=>{const t=e;t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null;const o=e.selection;if(o){const e=o.dom;t.selection=o.win=o.dom=e.doc=null}})(e),e.destroyed=!0):e.remove())},JC=(()=>{const e={};return{add:(t,o)=>{e[t]=o},get:t=>e[t]?e[t]:{icons:{}},has:t=>_e(e,t)}})(),QC=ri.ModelManager,eS=(e,t)=>t.dom[e],tS=(e,t)=>parseInt(dn(t,e),10),oS=N(eS,"clientWidth"),nS=N(eS,"clientHeight"),rS=N(tS,"margin-top"),sS=N(tS,"margin-left"),aS=(e,t,o)=>{const n=yo.fromDom(e.getBody()),r=e.inline?n:(s=n,yo.fromDom(Eo(s).dom.documentElement));var s;const a=((e,t,o,n)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:o-(e?r.left+t.dom.clientLeft+sS(t):0),y:n-(e?r.top+t.dom.clientTop+rS(t):0)}})(e.inline,r,t,o);return((e,t,o)=>{const n=oS(e),r=nS(e);return t>=0&&o>=0&&t<=n&&o<=r})(r,a.x,a.y)},iS=e=>{const t=e.inline?e.getBody():e.getContentAreaContainer();return(o=t,F.from(o).map(yo.fromDom)).map(Go).getOr(!1);var o},lS=e=>{const t=[],o=()=>{const t=e.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}})()},n=()=>F.from(t[0]),r=()=>{q(t,(e=>{e.reposition()}))},s=e=>{te(t,(t=>t===e)).each((e=>{t.splice(e,1)}))},a=(a,i=!0)=>e.removed||!iS(e)?{}:(i&&e.dispatch("BeforeOpenNotification",{notification:a}),ee(t,(e=>{return t=o().getArgs(e),n=a,!(t.type!==n.type||t.text!==n.text||t.progressBar||t.timeout||n.progressBar||n.timeout);var t,n})).getOrThunk((()=>{e.editorManager.setActive(e);const i=o().open(a,(()=>{s(i),r(),ip(e)&&n().fold((()=>e.focus()),(e=>Bh(yo.fromDom(e.getEl()))))}));return(e=>{t.push(e)})(i),r(),e.dispatch("OpenNotification",{notification:{...i}}),i}))),i=D(t);return(e=>{e.on("SkinLoaded",(()=>{const t=Oc(e);t&&a({text:t,type:"warning",timeout:0},!1),r()})),e.on("show ResizeEditor ResizeWindow NodeChange",(()=>{requestAnimationFrame(r)})),e.on("remove",(()=>{q(t.slice(),(e=>{o().close(e)}))}))})(e),{open:a,close:()=>{n().each((e=>{o().close(e),s(e),r()}))},getNotifications:i}},cS=ri.PluginManager,dS=ri.ThemeManager,mS=e=>{let t=[];const o=()=>{const t=e.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e}})()},n=(e,t)=>(...o)=>t?t.apply(e,o):void 0,r=o=>{t.push(o),(t=>{e.dispatch("OpenWindow",{dialog:t})})(o)},s=o=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(o),t=Y(t,(e=>e!==o)),0===t.length&&e.focus()},a=t=>{e.editorManager.setActive(e),jh(e),e.ui.show();const o=t();return r(o),o};return e.on("remove",(()=>{q(t,(e=>{o().close(e)}))})),{open:(e,t)=>a((()=>o().open(e,t,s))),openUrl:e=>a((()=>o().openUrl(e,s))),alert:(e,t,r)=>{const s=o();s.alert(e,n(r||s,t))},confirm:(e,t,r)=>{const s=o();s.confirm(e,n(r||s,t))},close:()=>{F.from(t[t.length-1]).each((e=>{o().close(e),s(e)}))}}},uS=(e,t)=>{e.notificationManager.open({type:"error",text:t})},gS=(e,t)=>{e._skinLoaded?uS(e,t):e.on("SkinLoaded",(()=>{uS(e,t)}))},hS=(e,t,o)=>{Sg(e,t,{message:o}),console.error(o)},pS=(e,t,o)=>o?`Failed to load ${e}: ${o} from url ${t}`:`Failed to load ${e} url: ${t}`,fS=(e,...t)=>{const o=window.console;o&&(o.error?o.error(e,...t):o.log(e,...t))},vS=e=>"content/"+e+"/content.css",bS=(e,t)=>{const o=e.editorManager.baseURL+"/skins/content",n=`content${e.editorManager.suffix}.css`;return $(t,(t=>(e=>tinymce.Resource.has(vS(e)))(t)?t:(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!e.inline?`${o}/${t}/${n}`:e.documentBaseURI.toAbsolute(t)))},yS=e=>{e.contentCSS=e.contentCSS.concat((e=>bS(e,yc(e)))(e),(e=>bS(e,xc(e)))(e))},wS=(e,t)=>{const o={};return{findAll:(n,r=P)=>{const s=Y((e=>e?ue(e.getElementsByTagName("img")):[])(n),(t=>{const o=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!o||o===At.transparentSrc)&&(je(o,"blob:")?!e.isUploaded(o)&&r(t):!!je(o,"data:")&&r(t))})),a=$(s,(e=>{const n=e.src;if(_e(o,n))return o[n].then((t=>h(t)?t:{image:e,blobInfo:t.blobInfo}));{const r=((e,t)=>{const o=()=>Promise.reject("Invalid data URI");if(je(t,"blob:")){const n=e.getByUri(t);return C(n)?Promise.resolve(n):sw(t).then((t=>aw(t).then((n=>lw(n,!1,(o=>F.some(cw(e,t,o)))).getOrThunk(o)))))}return je(t,"data:")?dw(e,t).fold(o,(e=>Promise.resolve(e))):Promise.reject("Unknown image data format")})(t,n).then((t=>(delete o[n],{image:e,blobInfo:t}))).catch((e=>(delete o[n],e)));return o[n]=r,r}}));return Promise.all(a)}}},xS=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),o=t=>t in e;return{hasBlobUri:o,getResultUri:t=>{const o=e[t];return o?o.resultUri:null},isPending:t=>!!o(t)&&1===e[t].status,isUploaded:t=>!!o(t)&&2===e[t].status,markPending:o=>{e[o]=t(1,null)},markUploaded:(o,n)=>{e[o]=t(2,n)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let CS=0;const SS=e=>e+CS+++(()=>{const e=()=>Math.round(4294967295*Math.random()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),kS=(e,t)=>{const o={},n=(e,o)=>new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("POST",t.url),s.withCredentials=t.credentials,s.upload.onprogress=e=>{o(e.loaded/e.total*100)},s.onerror=()=>{r("Image upload failed due to a XHR Transport error. Code: "+s.status)},s.onload=()=>{if(s.status<200||s.status>=300)return void r("HTTP Error: "+s.status);const e=JSON.parse(s.responseText);var o,a;e&&h(e.location)?n((o=t.basePath,a=e.location,o?o.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+s.responseText)};const a=new FormData;a.append("file",e.blob(),e.filename()),s.send(a)})),r=S(t.handler)?t.handler:n,s=(e,t)=>({url:t,blobInfo:e,status:!0}),a=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),i=(e,t)=>{Bt.each(o[e],(e=>{e(t)})),delete o[e]},l=(t,n)=>(t=Bt.grep(t,(t=>!e.isUploaded(t.blobUri()))),Promise.all(Bt.map(t,(t=>e.isPending(t.blobUri())?(e=>{const t=e.blobUri();return new Promise((e=>{o[t]=o[t]||[],o[t].push(e)}))})(t):((t,o,n)=>(e.markPending(t.blobUri()),new Promise((r=>{let l,c;try{const d=()=>{l&&(l.close(),c=E)},m=o=>{d(),e.markUploaded(t.blobUri(),o),i(t.blobUri(),s(t,o)),r(s(t,o))},u=o=>{d(),e.removeFailed(t.blobUri()),i(t.blobUri(),a(t,o)),r(a(t,o))};c=e=>{e<0||e>100||F.from(l).orThunk((()=>F.from(n).map(L))).each((t=>{l=t,t.progressBar.value(e)}))},o(t,c).then(m,(e=>{u(h(e)?{message:e}:e)}))}catch(e){r(a(t,e))}}))))(t,r,n)))));return{upload:(e,o)=>t.url||r!==n?l(e,o):new Promise((e=>{e([])}))}},_S=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),ES=(e,t)=>kS(t,{url:cc(e),basePath:dc(e),credentials:mc(e),handler:uc(e)}),TS=e=>t=>{((e,t)=>e.dom.isEmpty(t.dom)&&C(e.schema.getTextBlockElements()[jt(t)]))(e,t)&&bn(t,yo.fromHtml('
    '))},OS=e=>{const t=(()=>{let e=[];const t=e=>{if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const t=e.id||SS("blobid"),o=e.name||t,n=e.blob;return{id:D(t),name:D(o),filename:D(e.filename||o+"."+(r=n.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[r.toLowerCase()]||"dat")),blob:D(n),base64:D(e.base64),blobUri:D(e.blobUri||URL.createObjectURL(n)),uri:D(e.uri)};var r},o=t=>ee(e,t).getOrUndefined(),n=e=>o((t=>t.id()===e));return{create:(e,o,n,r,s)=>{if(h(e))return t({id:e,name:r,filename:s,blob:o,base64:n});if(p(e))return t(e);throw new Error("Unknown input type")},add:t=>{n(t.id())||e.push(t)},get:n,getByUri:e=>o((t=>t.blobUri()===e)),getByData:(e,t)=>o((o=>o.base64()===e&&o.blob().type===t)),findFirst:o,removeByUri:t=>{e=Y(e,(e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1)))},destroy:()=>{q(e,(e=>{URL.revokeObjectURL(e.blobUri())})),e=[]}}})();let o,n;const r=xS(),s=[],a=t=>o=>e.selection?t(o):[],i=(e,t,o)=>{let n=0;do{n=e.indexOf(t,n),-1!==n&&(e=e.substring(0,n)+o+e.substr(n+t.length),n+=o.length-t.length+1)}while(-1!==n);return e},l=(e,t,o)=>{const n=`src="${o}"${o===At.transparentSrc?' data-mce-placeholder="1"':""}`;return e=i(e,`src="${t}"`,n),e=i(e,'data-mce-src="'+t+'"','data-mce-src="'+o+'"')},c=(t,o)=>{q(e.undoManager.data,(e=>{"fragmented"===e.type?e.fragments=$(e.fragments,(e=>l(e,t,o))):e.content=l(e.content,t,o)}))},d=()=>(o||(o=ES(e,r)),g().then(a((n=>{const r=$(n,(e=>e.blobInfo));return o.upload(r,_S(e)).then(a((o=>{const r=[];let s=!1;const a=$(o,((o,a)=>{const{blobInfo:i,image:l}=n[a];let d=!1;return o.status&&ac(e)?(o.url&&!Ue(l.src,o.url)&&(s=!0),t.removeByUri(l.src),fC(e)||((t,o)=>{const n=e.convertURL(o,"src");var r;c(t.src,o),to(yo.fromDom(t),{src:sc(e)?(r=o,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):o,"data-mce-src":n})})(l,o.url)):o.error&&(o.error.remove&&(c(l.src,At.transparentSrc),r.push(l),d=!0),((e,t)=>{gS(e,ni.translate(["Failed to upload image: {0}",t]))})(e,o.error.message)),{element:l,status:o.status,uploadUri:o.url,blobInfo:i,removed:d}}));return r.length>0&&!fC(e)?e.undoManager.transact((()=>{q(kn(r),(o=>{const n=Oo(o);Cn(o),n.each(TS(e)),t.removeByUri(o.dom.src)}))})):s&&e.undoManager.dispatchChange(),a})))})))),m=()=>rc(e)?d():Promise.resolve([]),u=e=>re(s,(t=>t(e))),g=()=>(n||(n=wS(r,t)),n.findAll(e.getBody(),u).then(a((t=>{const o=Y(t,(t=>h(t)?(gS(e,t),!1):"blob"!==t.uriType));return fC(e)||q(o,(e=>{c(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")})),o})))),f=o=>o.replace(/src="(blob:[^"]+)"/g,((o,n)=>{const s=r.getResultUri(n);if(s)return'src="'+s+'"';let a=t.getByUri(n);return a||(a=J(e.editorManager.get(),((e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(n)),void 0)),a?'src="data:'+a.blob().type+";base64,"+a.base64()+'"':o}));return e.on("SetContent",(()=>{rc(e)?m():g()})),e.on("RawSaveContent",(e=>{e.content=f(e.content)})),e.on("GetContent",(e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=f(e.content))})),e.on("PostRender",(()=>{e.parser.addNodeFilter("img",(e=>{q(e,(e=>{const o=e.attr("src");if(!o||t.getByUri(o))return;const n=r.getResultUri(o);n&&e.attr("src",n)}))}))})),{blobCache:t,addFilter:e=>{s.push(e)},uploadImages:d,uploadImagesAuto:m,scanForImages:g,destroy:()=>{t.destroy(),r.destroy(),n=o=null}}},DS={remove_similar:!0,inherit:!1},AS={selector:"td,th",...DS},MS={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...AS},tablecellverticalalign:{styles:{"vertical-align":"%value"},...AS},tablecellbordercolor:{styles:{borderColor:"%value"},...AS},tablecellclass:{classes:["%value"],...AS},tableclass:{selector:"table",classes:["%value"],...DS},tablecellborderstyle:{styles:{borderStyle:"%value"},...AS},tablecellborderwidth:{styles:{borderWidth:"%value"},...AS}},NS=D(MS),RS=e=>{const t={},o=(e,n)=>{e&&(h(e)?(v(n)||(n=[n]),q(n,(e=>{w(e.deep)&&(e.deep=!$u(e)),w(e.split)&&(e.split=!$u(e)||qu(e)),w(e.remove)&&$u(e)&&!qu(e)&&(e.remove="none"),$u(e)&&qu(e)&&(e.mixed=!0,e.block_expand=!0),h(e.classes)&&(e.classes=e.classes.split(/\s+/))})),t[e]=n):fe(e,((e,t)=>{o(t,e)})))};return o((e=>{const t=e.dom,o=e.schema.type,n={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"},{selector:".mce-preview-object",ceFalseOverride:!0,styles:{display:"table",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{marginLeft:"auto",marginRight:"auto"},preview:!1}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"right"},preview:!1}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const e={inline:"span",styles:{textDecoration:"line-through"},exact:!0},t={inline:"strike",remove:"all",preserve_attributes:["class","style"]},n={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==o?[n,e,t]:[e,n,t]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(e,t,o)=>Wn(e)&&e.hasAttribute("href"),onformat:(e,o,n)=>{Bt.each(n,((o,n)=>{t.setAttrib(e,n,o)}))}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":e=>{var t;return null!==(t=null==e?void 0:e.customValue)&&void 0!==t?t:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Bt.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/),(e=>{n[e]={block:e,remove:"all"}})),n})(e)),o(NS()),o(Bc(e)),{get:e=>C(e)?t[e]:t,has:e=>_e(t,e),register:o,unregister:e=>(e&&t[e]&&delete t[e],t)}},BS=Bt.each,LS=Ya.DOM,HS=e=>C(e)&&p(e),IS=(e,t)=>{const o=t&&t.schema||ya({}),n=e=>{const t=h(e)?{name:e,classes:[],attrs:{}}:e,o=LS.create(t.name);return((e,t)=>{t.classes.length>0&&LS.addClass(e,t.classes.join(" ")),LS.setAttribs(e,t.attrs)})(o,t),o},r=(e,t,s)=>{let a;const i=t[0],l=HS(i)?i.name:void 0,c=((e,t)=>{const n=o.getElementRule(e.nodeName.toLowerCase()),r=null==n?void 0:n.parentsRequired;return!(!r||!r.length)&&(t&&j(r,t)?t:r[0])})(e,l);if(c)l===c?(a=i,t=t.slice(1)):a=c;else if(i)a=i,t=t.slice(1);else if(!s)return e;const d=a?n(a):LS.create("div");d.appendChild(e),s&&Bt.each(s,(t=>{const o=n(t);d.insertBefore(o,e)}));const m=HS(a)?a.siblings:void 0;return r(d,t,m)},s=LS.create("div");if(e.length>0){const t=e[0],o=n(t),a=HS(t)?t.siblings:void 0;s.appendChild(r(o,e.slice(1),a))}return s},PS=e=>{let t="div";const o={name:t,classes:[],attrs:{},selector:e=Bt.trim(e)};return"*"!==e&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,((e,t,n,r,s)=>{switch(t){case"#":o.attrs.id=n;break;case".":o.classes.push(n);break;case":":-1!==Bt.inArray("checked disabled enabled read-only required".split(" "),n)&&(o.attrs[n]=n)}if("["===r){const e=s.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(o.attrs[e[1]]=e[2])}return""}))),o.name=t||"div",o},FS=(e,t)=>{let o="",n=Lc(e);if(""===n)return"";const r=e=>h(e)?e.replace(/%(\w+)/g,""):"",s=(t,o)=>LS.getStyle(null!=o?o:e.getBody(),t,!0);if(h(t)){const o=e.formatter.get(t);if(!o)return"";t=o[0]}if("preview"in t){const e=t.preview;if(!1===e)return"";n=e||n}let a,i=t.block||t.inline||"span";const l=(c=t.selector,h(c)?(c=(c=c.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Bt.map(c.split(/(?:>|\s+(?![^\[\]]+\]))/),(e=>{const t=Bt.map(e.split(/(?:~\+|~|\+)/),PS),o=t.pop();return t.length&&(o.siblings=t),o})).reverse()):[]);var c;l.length>0?(l[0].name||(l[0].name=i),i=t.selector,a=IS(l,e)):a=IS([i],e);const d=LS.select(i,a)[0]||a.firstChild;BS(t.styles,((e,t)=>{const o=r(e);o&&LS.setStyle(d,t,o)})),BS(t.attributes,((e,t)=>{const o=r(e);o&&LS.setAttrib(d,t,o)})),BS(t.classes,(e=>{const t=r(e);LS.hasClass(d,t)||LS.addClass(d,t)})),e.dispatch("PreviewFormats"),LS.setStyles(a,{position:"absolute",left:-65535}),e.getBody().appendChild(a);const m=s("fontSize"),u=/px$/.test(m)?parseInt(m,10):0;return BS(n.split(" "),(e=>{let t=s(e,d);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=s(e),"#ffffff"===Da(t).toLowerCase())||"color"===e&&"#000000"===Da(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===u)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*u+"px"}"border"===e&&t&&(o+="padding:0 2px;"),o+=e+":"+t+";"}})),e.dispatch("AfterPreviewFormats"),LS.remove(a),o},zS=e=>{const t=RS(e),o=Qa({});return(e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])})(e),ey(e),fC(e)||((e,t)=>{e.set({}),t.on("NodeChange",(o=>{Yy(t,o.element,e.get())})),t.on("FormatApply FormatRemove",(o=>{const n=F.from(o.node).map((e=>Ou(e)?e:e.startContainer)).bind((e=>Wn(e)?F.some(e):F.from(e.parentElement))).getOrThunk((()=>qy(t)));Yy(t,n,e.get())}))})(o,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,o,n)=>{((e,t,o,n)=>{yC(e).formatter.apply(t,o,n)})(e,t,o,n)},remove:(t,o,n,r)=>{((e,t,o,n,r)=>{yC(e).formatter.remove(t,o,n,r)})(e,t,o,n,r)},toggle:(t,o,n)=>{((e,t,o,n)=>{yC(e).formatter.toggle(t,o,n)})(e,t,o,n)},match:(t,o,n,r)=>((e,t,o,n,r)=>yC(e).formatter.match(t,o,n,r))(e,t,o,n,r),closest:t=>((e,t)=>yC(e).formatter.closest(t))(e,t),matchAll:(t,o)=>((e,t,o)=>yC(e).formatter.matchAll(t,o))(e,t,o),matchNode:(t,o,n,r)=>((e,t,o,n,r)=>yC(e).formatter.matchNode(t,o,n,r))(e,t,o,n,r),canApply:t=>((e,t)=>yC(e).formatter.canApply(t))(e,t),formatChanged:(t,n,r,s)=>((e,t,o,n,r,s)=>yC(e).formatter.formatChanged(t,o,n,r,s))(e,o,t,n,r,s),getCssText:N(FS,e)}},VS=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},ZS=e=>{const t=ai(),o=Qa(0),n=Qa(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,o)=>{yC(e).undoManager.beforeChange(t,o)})(e,o,t)},add:(s,a)=>((e,t,o,n,r,s,a)=>yC(e).undoManager.add(t,o,n,r,s,a))(e,r,n,o,t,s,a),dispatchChange:()=>{e.setDirty(!0);const t=iC(e);t.bookmark=El(e.selection),e.dispatch("change",{level:t,lastLevel:ce(r.data,n.get()).getOrUndefined()})},undo:()=>((e,t,o,n)=>yC(e).undoManager.undo(t,o,n))(e,r,o,n),redo:()=>((e,t,o)=>yC(e).undoManager.redo(t,o))(e,n,r.data),clear:()=>{((e,t,o)=>{yC(e).undoManager.clear(t,o)})(e,r,n)},reset:()=>{((e,t)=>{yC(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,o)=>yC(e).undoManager.hasUndo(t,o))(e,r,n),hasRedo:()=>((e,t,o)=>yC(e).undoManager.hasRedo(t,o))(e,r,n),transact:t=>((e,t,o,n)=>yC(e).undoManager.transact(t,o,n))(e,r,o,t),ignore:t=>{((e,t,o)=>{yC(e).undoManager.ignore(t,o)})(e,o,t)},extra:(t,o)=>{((e,t,o,n,r)=>{yC(e).undoManager.extra(t,o,n,r)})(e,r,n,t,o)}};return fC(e)||((e,t,o)=>{const n=Qa(!1),r=e=>{gC(t,!1,o),t.add({},e)};e.on("init",(()=>{t.add()})),e.on("BeforeExecCommand",(e=>{const n=e.command;VS(n)||(hC(t,o),t.beforeChange())})),e.on("ExecCommand",(e=>{const t=e.command;VS(t)||r(e)})),e.on("ObjectResizeStart cut",(()=>{t.beforeChange()})),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",(o=>{const s=o.keyCode;if(o.isDefaultPrevented())return;const a=At.os.isMacOS()&&"Meta"===o.key;(s>=33&&s<=36||s>=37&&s<=40||45===s||o.ctrlKey||a)&&(r(),e.nodeChanged()),46!==s&&8!==s||e.nodeChanged(),n.get()&&t.typing&&!mC(iC(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),n.set(!1),e.nodeChanged())})),e.on("keydown",(e=>{const s=e.keyCode;if(e.isDefaultPrevented())return;if(s>=33&&s<=36||s>=37&&s<=40||45===s)return void(t.typing&&r(e));const a=e.ctrlKey&&!e.altKey||e.metaKey;if((s<16||s>20)&&224!==s&&91!==s&&!t.typing&&!a)return t.beforeChange(),gC(t,!0,o),t.add({},e),void n.set(!0);(At.os.isMacOS()?e.metaKey:e.ctrlKey&&!e.altKey)&&t.beforeChange()})),e.on("mousedown",(e=>{t.typing&&r(e)})),e.on("input",(e=>{var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data||(e=>"insertFromPaste"===e.inputType||"insertFromDrop"===e.inputType)(e))&&r(e)})),e.on("AddUndo Undo Redo ClearUndos",(t=>{t.isDefaultPrevented()||e.nodeChanged()}))})(e,r,o),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},US=[9,27,Dg.HOME,Dg.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Dg.DOWN,Dg.UP,Dg.LEFT,Dg.RIGHT].concat(At.browser.isFirefox()?[224]:[]),jS="data-mce-placeholder",WS=e=>"keydown"===e.type||"keyup"===e.type,$S=e=>{const t=e.keyCode;return t===Dg.BACKSPACE||t===Dg.DELETE},qS=e=>{var t;const o=e.dom,n=Xl(e),r=null!==(t=Ec(e))&&void 0!==t?t:"",s=(t,a)=>{if((e=>{if(WS(e)){const t=e.keyCode;return!$S(e)&&(Dg.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||j(US,t))}return!1})(t))return;const i=e.getBody(),l=!(e=>WS(e)&&!($S(e)||"keyup"===e.type&&229===e.keyCode))(t)&&((e,t,o)=>{if(ys(yo.fromDom(t),!1)){const n=t.firstElementChild;return!n||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&o===n.nodeName.toLowerCase()}return!1})(o,i,n);(""!==o.getAttrib(i,jS)!==l||a)&&(o.setAttrib(i,jS,l?r:null),o.setAttrib(i,"aria-placeholder",l?r:null),((e,t)=>{e.dispatch("PlaceholderToggle",{state:t})})(e,l),e.on(l?"keydown":"keyup",s),e.off(l?"keyup":"keydown",s))};Ye(r)&&e.on("init",(t=>{s(t,!0),e.on("change SetContent ExecCommand",s),e.on("paste",(t=>qh.setEditorTimeout(e,(()=>s(t)))))}))},GS=(e,t)=>({from:e,to:t}),KS=(e,t)=>{const o=yo.fromDom(e),n=yo.fromDom(t.container());return vv(o,n).map((e=>((e,t)=>({block:e,position:t}))(e,t)))},YS=(e,t)=>Xo(t,(e=>Dr(e)||cr(e.dom)),(t=>So(t,e))).filter(Gt).getOr(e),XS=(e,t,o)=>{const n=KS(e,rl.fromRangeStart(o)),r=n.bind((o=>Zm(t,e,o.position).bind((o=>KS(e,o).map((o=>((e,t,o)=>ir(o.position.getNode())&&!ys(o.block)?Wm(!1,o.block.dom).bind((n=>n.isEqual(o.position)?Zm(t,e,n).bind((t=>KS(e,t))):F.some(o))).getOr(o):o)(e,t,o)))))));return It(n,r,GS).filter((t=>(e=>!So(e.from.block,e.to.block))(t)&&((e,t)=>{const o=yo.fromDom(e);return So(YS(o,t.from.block),YS(o,t.to.block))})(e,t)&&(e=>!1===dr(e.from.block.dom)&&!1===dr(e.to.block.dom))(t)&&(e=>{const t=e=>_r(e)||Ns(e.dom);return t(e.from.block)&&t(e.to.block)})(t)))},JS=(e,t)=>{const o=((e,t)=>{const o=Lo(e);return te(o,(e=>t.isBlock(jt(e)))).fold(D(o),(e=>o.slice(0,e)))})(e,t);return q(o,Cn),o},QS=(e,t)=>{const o=pf(t,e);return ee(o.reverse(),(e=>ys(e))).each(Cn)},ek=(e,t,o,n,r)=>{if(ys(o))return Rr(o),Gm(o.dom);0===Y(Ro(r),(e=>!ys(e))).length&&ys(t)&&pn(r,yo.fromTag("br"));const s=qm(o.dom,rl.before(r.dom));return q(JS(t,n),(e=>{pn(r,e)})),QS(e,t),s},tk=(e,t,o,n)=>{if(ys(o)){if(ys(t)){const e=e=>{const t=(e,o)=>Io(e).fold((()=>o),(e=>((e,t)=>e.isInline(jt(t)))(n,e)?t(e,o.concat(ki(e))):o));return t(e,[])},r=X(e(o),((e,t)=>(yn(e,t),t)),Nr());xn(t),bn(t,r)}return Cn(o),Gm(t.dom)}const r=Km(o.dom);return q(JS(t,n),(e=>{bn(o,e)})),QS(e,t),r},ok=(e,t)=>ko(t,e)?((e,t)=>{const o=pf(t,e);return F.from(o[o.length-1])})(t,e):F.none(),nk=(e,t)=>{Wm(e,t.dom).bind((e=>F.from(e.getNode()))).map(yo.fromDom).filter(kr).each(Cn)},rk=(e,t,o,n)=>(nk(!0,t),nk(!1,o),ok(t,o).fold(N(tk,e,t,o,n),N(ek,e,t,o,n))),sk=(e,t,o,n,r)=>t?rk(e,n,o,r):rk(e,o,n,r),ak=(e,t)=>{const o=yo.fromDom(e.getBody()),n=((e,t,o)=>o.collapsed?XS(e,t,o):F.none())(o.dom,t,e.selection.getRng()).map((n=>()=>{sk(o,t,n.from.block,n.to.block,e.schema).each((t=>{e.selection.setRng(t.toRange())}))}));return n},ik=(e,t)=>{const o=yo.fromDom(t),n=N(So,e);return Yo(o,Dr,n).isSome()},lk=(e,t)=>{const o=qm(e.dom,rl.fromRangeStart(t)).isNone(),n=$m(e.dom,rl.fromRangeEnd(t)).isNone();return!((e,t)=>ik(e,t.startContainer)||ik(e,t.endContainer))(e,t)&&o&&n},ck=e=>{const t=yo.fromDom(e.getBody()),o=e.selection.getRng();return lk(t,o)?(e=>F.some((()=>{e.setContent(""),e.selection.setCursorLocation()})))(e):((e,t,o)=>{const n=t.getRng();return It(vv(e,yo.fromDom(n.startContainer)),vv(e,yo.fromDom(n.endContainer)),((r,s)=>So(r,s)?F.none():F.some((()=>{n.deleteContents(),sk(e,!0,r,s,o).each((e=>{t.setRng(e.toRange())}))})))).getOr(F.none())})(t,e.selection,e.schema)},dk=(e,t)=>e.selection.isCollapsed()?F.none():ck(e),mk=(e,t,o,n,r)=>F.from(t._selectionOverrides.showCaret(e,o,n,r)),uk=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?F.none():F.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),gk=(e,t,o)=>t.collapsed?((e,t,o)=>{const n=wm(1,e.getBody(),t),r=rl.fromRangeStart(n),s=r.getNode();if(Xd(s))return mk(1,e,s,!r.isAtEnd(),!1);const a=r.getNode(!0);if(Xd(a))return mk(1,e,a,!1,!1);const i=tb(e.dom.getRoot(),r.getNode());return Xd(i)?mk(1,e,i,!1,o):F.none()})(e,t,o).getOr(t):t,hk=e=>uf(e)||lf(e),pk=e=>gf(e)||cf(e),fk=(e,t,o,n,r,s)=>{mk(n,e,s.getNode(!r),r,!0).each((o=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(o.startContainer,o.startOffset):e.setStart(o.endContainer,o.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(o)})),((e,t)=>{tr(t)&&0===t.data.length&&e.remove(t)})(e.dom,o)},vk=(e,t)=>((e,t)=>{const o=e.selection.getRng();if(!tr(o.commonAncestorContainer))return F.none();const n=t?Em.Forwards:Em.Backwards,r=Im(e.getBody()),s=N(km,t?r.next:r.prev),a=t?hk:pk,i=Cm(n,e.getBody(),o),l=s(i),c=l?mv(t,l):l;if(!c||!_m(i,c))return F.none();if(a(c))return F.some((()=>fk(e,o,i.getNode(),n,t,c)));const d=s(c);return d&&a(d)&&_m(c,d)?F.some((()=>fk(e,o,i.getNode(),n,t,d))):F.none()})(e,t),bk=(e,t)=>{const o=e.getBody();return t?Gm(o).filter(uf):Km(o).filter(gf)},yk=e=>{const t=e.selection.getRng();return!t.collapsed&&(bk(e,!0).exists((e=>e.isEqual(rl.fromRangeStart(t))))||bk(e,!1).exists((e=>e.isEqual(rl.fromRangeEnd(t)))))},wk=Al([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),xk=(e,t,o,n)=>{const r=n.getNode(!t);return vv(yo.fromDom(e),yo.fromDom(o.getNode())).map((e=>ys(e)?wk.remove(e.dom):wk.moveToElement(r))).orThunk((()=>F.some(wk.moveToElement(r))))},Ck=(e,t,o,n)=>Zm(t,e,o).bind((r=>{return s=r.getNode(),C(s)&&(Dr(yo.fromDom(s))||Tr(yo.fromDom(s)))||((e,t,o,n,r)=>{const s=t=>r.isInline(t.nodeName.toLowerCase())&&!gm(o,n,e);return xm(!t,o).fold((()=>xm(t,n).fold(I,s)),s)})(e,t,o,r,n)?F.none():t&&dr(r.getNode())||!t&&dr(r.getNode(!0))?xk(e,t,o,r):t&&gf(o)||!t&&uf(o)?F.some(wk.moveToPosition(r)):F.none();var s})),Sk=(e,t,o,n)=>((e,t)=>{const o=t.getNode(!e),n=e?"after":"before";return Wn(o)&&o.getAttribute("data-mce-caret")===n})(t,o)?((e,t)=>x(t)?F.none():e&&dr(t.nextSibling)?F.some(wk.moveToElement(t.nextSibling)):!e&&dr(t.previousSibling)?F.some(wk.moveToElement(t.previousSibling)):F.none())(t,o.getNode(!t)).orThunk((()=>Ck(e,t,o,n))):Ck(e,t,o,n).bind((t=>((e,t,o)=>o.fold((e=>F.some(wk.remove(e))),(e=>F.some(wk.moveToElement(e))),(o=>gm(t,o,e)?F.none():F.some(wk.moveToPosition(o)))))(e,o,t))),kk=(e,t)=>F.from(tb(e.getBody(),t)),_k=(e,t)=>{const o=e.selection.getNode();return kk(e,o).filter(dr).fold((()=>((e,t,o,n)=>{const r=wm(t?1:-1,e,o),s=rl.fromRangeStart(r),a=yo.fromDom(e);return!t&&gf(s)?F.some(wk.remove(s.getNode(!0))):t&&uf(s)?F.some(wk.remove(s.getNode())):!t&&uf(s)&&Tf(a,s,n)?Of(a,s,n).map((e=>wk.remove(e.getNode()))):t&&gf(s)&&Ef(a,s,n)?Df(a,s,n).map((e=>wk.remove(e.getNode()))):Sk(e,t,s,n)})(e.getBody(),t,e.selection.getRng(),e.schema).map((o=>()=>o.fold(((e,t)=>o=>(e._selectionOverrides.hideFakeCaret(),av(e,t,yo.fromDom(o)),!0))(e,t),((e,t)=>o=>{const n=t?rl.before(o):rl.after(o);return e.selection.setRng(n.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))))),(()=>F.some(E)))},Ek=(e,t)=>{const o=e.selection.getNode();return dr(o)&&!mr(o)?kk(e,o.parentNode).filter(dr).fold((()=>F.some((()=>{var o;o=yo.fromDom(e.getBody()),q(zn(o,".mce-offscreen-selection"),Cn),av(e,t,yo.fromDom(e.selection.getNode())),bv(e)}))),(()=>F.some(E))):yk(e)?F.some((()=>{xv(e,e.selection.getRng(),yo.fromDom(e.getBody()))})):F.none()},Tk=e=>{const t=e.dom,o=e.selection,n=tb(e.getBody(),o.getNode());if(cr(n)&&t.isBlock(n)&&t.isEmpty(n)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(n,""),n.appendChild(e),o.setRng(rl.before(e).toRange())}return!0},Ok=(e,t)=>e.selection.isCollapsed()?_k(e,t):Ek(e,t),Dk=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const o=rl.fromRangeStart(e.selection.getRng());return Zm(t,e.getBody(),o).filter((e=>t?sf(e):af(e))).bind((e=>hm(t?0:-1,e))).map((t=>()=>e.selection.select(t)))})(e,t):F.none(),Ak=tr,Mk=e=>Ak(e)&&e.data[0]===Br,Nk=e=>Ak(e)&&e.data[e.data.length-1]===Br,Rk=e=>{var t;return(null!==(t=e.ownerDocument)&&void 0!==t?t:document).createTextNode(Br)},Bk=(e,t)=>e?(e=>{var t;if(Ak(e.previousSibling))return Nk(e.previousSibling)||e.previousSibling.appendData(Br),e.previousSibling;if(Ak(e))return Mk(e)||e.insertData(0,Br),e;{const o=Rk(e);return null===(t=e.parentNode)||void 0===t||t.insertBefore(o,e),o}})(t):(e=>{var t,o;if(Ak(e.nextSibling))return Mk(e.nextSibling)||e.nextSibling.insertData(0,Br),e.nextSibling;if(Ak(e))return Nk(e)||e.appendData(Br),e;{const n=Rk(e);return e.nextSibling?null===(t=e.parentNode)||void 0===t||t.insertBefore(n,e.nextSibling):null===(o=e.parentNode)||void 0===o||o.appendChild(n),n}})(t),Lk=N(Bk,!0),Hk=N(Bk,!1),Ik=(e,t)=>tr(e.container())?Bk(t,e.container()):Bk(t,e.getNode()),Pk=(e,t)=>{const o=t.get();return o&&e.container()===o&&zr(o)},Fk=(e,t)=>t.fold((t=>{jd(e.get());const o=Lk(t);return e.set(o),F.some(rl(o,o.length-1))}),(t=>Gm(t).map((t=>{if(Pk(t,e)){const t=e.get();return rl(t,1)}{jd(e.get());const o=Ik(t,!0);return e.set(o),rl(o,1)}}))),(t=>Km(t).map((t=>{if(Pk(t,e)){const t=e.get();return rl(t,t.length-1)}{jd(e.get());const o=Ik(t,!1);return e.set(o),rl(o,o.length-1)}}))),(t=>{jd(e.get());const o=Hk(t);return e.set(o),F.some(rl(o,1))})),zk=(e,t)=>{for(let o=0;o{const o=um(t,e);return o||e},Uk=(e,t,o)=>{const n=uv(o),r=Zk(t,n.container());return dv(e,r,n).fold((()=>$m(r,n).bind(N(dv,e,r)).map((e=>Vk.before(e)))),F.none)},jk=(e,t)=>null===Jm(e,t),Wk=(e,t,o)=>dv(e,t,o).filter(N(jk,t)),$k=(e,t,o)=>{const n=gv(o);return Wk(e,t,n).bind((e=>qm(e,n).isNone()?F.some(Vk.start(e)):F.none()))},qk=(e,t,o)=>{const n=uv(o);return Wk(e,t,n).bind((e=>$m(e,n).isNone()?F.some(Vk.end(e)):F.none()))},Gk=(e,t,o)=>{const n=gv(o),r=Zk(t,n.container());return dv(e,r,n).fold((()=>qm(r,n).bind(N(dv,e,r)).map((e=>Vk.after(e)))),F.none)},Kk=e=>!cv(Xk(e)),Yk=(e,t,o)=>zk([Uk,$k,qk,Gk],[e,t,o]).filter(Kk),Xk=e=>e.fold(A,A,A,A),Jk=e=>e.fold(D("before"),D("start"),D("end"),D("after")),Qk=e=>e.fold(Vk.before,Vk.before,Vk.after,Vk.after),e_=e=>e.fold(Vk.start,Vk.start,Vk.end,Vk.end),t_=(e,t,o,n,r,s)=>It(dv(t,o,n),dv(t,o,r),((t,n)=>t!==n&&((e,t,o)=>{const n=um(t,e),r=um(o,e);return C(n)&&n===r})(o,t,n)?Vk.after(e?t:n):s)).getOr(s),o_=(e,t)=>e.fold(P,(e=>{return n=t,!(Jk(o=e)===Jk(n)&&Xk(o)===Xk(n));var o,n})),n_=(e,t)=>e?t.fold(T(F.some,Vk.start),F.none,T(F.some,Vk.after),F.none):t.fold(F.none,T(F.some,Vk.before),F.none,T(F.some,Vk.end)),r_=(e,t,o,n)=>{const r=mv(e,n),s=Yk(t,o,r);return Yk(t,o,r).bind(N(n_,e)).orThunk((()=>((e,t,o,n,r)=>{const s=mv(e,r);return Zm(e,o,s).map(N(mv,e)).fold((()=>n.map(Qk)),(r=>Yk(t,o,r).map(N(t_,e,t,o,s,r)).filter(N(o_,n)))).filter(Kk)})(e,t,o,s,n)))},s_=(e,t,o)=>{const n=e?1:-1;return t.setRng(rl(o.container(),o.offset()+n).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0},a_=(e,t)=>{const o=t.selection.getRng(),n=e?rl.fromRangeEnd(o):rl.fromRangeStart(o);return!!(e=>S(e.selection.getSel().modify))(t)&&(e&&Ur(n)?s_(!0,t.selection,n):!(e||!jr(n))&&s_(!1,t.selection,n))};var i_;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(i_||(i_={}));const l_=(e,t)=>e===Em.Backwards?se(t):t,c_=(e,t,o)=>e===Em.Forwards?t.next(o):t.prev(o),d_=(e,t,o,n)=>ir(n.getNode(t===Em.Forwards))?i_.Br:!1===gm(o,n)?i_.Block:i_.Wrap,m_=(e,t,o,n)=>{const r=Im(o);let s=n;const a=[];for(;s;){const o=c_(t,r,s);if(!o)break;if(ir(o.getNode(!1)))return t===Em.Forwards?{positions:l_(t,a).concat([o]),breakType:i_.Br,breakAt:F.some(o)}:{positions:l_(t,a),breakType:i_.Br,breakAt:F.some(o)};if(o.isVisible()){if(e(s,o)){const e=d_(0,t,s,o);return{positions:l_(t,a),breakType:e,breakAt:F.some(o)}}a.push(o),s=o}else s=o}return{positions:l_(t,a),breakType:i_.Eol,breakAt:F.none()}},u_=(e,t,o,n)=>t(o,n).breakAt.map((n=>{const r=t(o,n).positions;return e===Em.Backwards?r.concat(n):[n].concat(r)})).getOr([]),g_=(e,t)=>J(e,((e,o)=>e.fold((()=>F.some(o)),(n=>It(de(n.getClientRects()),de(o.getClientRects()),((e,r)=>{const s=Math.abs(t-e.left);return Math.abs(t-r.left)<=s?o:n})).or(e)))),F.none()),h_=(e,t)=>de(t.getClientRects()).bind((t=>g_(e,t.left))),p_=N(m_,rl.isAbove,-1),f_=N(m_,rl.isBelow,1),v_=N(u_,-1,p_),b_=N(u_,1,f_),y_=(e,t)=>p_(e,t).breakAt.isNone(),w_=(e,t)=>f_(e,t).breakAt.isNone(),x_=(e,t)=>h_(v_(e,t),t),C_=(e,t)=>h_(b_(e,t),t),S_=dr,k_=(e,t)=>Math.abs(e.left-t),__=(e,t)=>Math.abs(e.right-t),E_=(e,t)=>Re(e,((e,o)=>{const n=Math.min(k_(e,t),__(e,t)),r=Math.min(k_(o,t),__(o,t));return r===n&&Ee(o,"node")&&S_(o.node)||r{const t=t=>$(t,(t=>{const o=Ai(t);return o.node=e,o}));if(Wn(e))return t(e.getClientRects());if(tr(e)){const o=e.ownerDocument.createRange();return o.setStart(e,0),o.setEnd(e,e.data.length),t(o.getClientRects())}return[]},O_=e=>ne(e,T_);var D_;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(D_||(D_={}));const A_=(e,t,o,n,r,s)=>{let a=0;const i=[],l=n=>{let s=O_([n]);-1===e&&(s=s.reverse());for(let e=0;e0&&t(n,Le(i))&&a++,n.line=a,r(n))return!0;i.push(n)}}return!1},c=Le(s.getClientRects());if(!c)return i;const d=s.getNode();return d&&(l(d),((e,t,o,n)=>{let r=n;for(;r=mm(r,e,ss,t);)if(o(r))return})(e,n,l,d)),i},M_=N(A_,D_.Up,Ri,Bi),N_=N(A_,D_.Down,Bi,Ri),R_=e=>Le(e.getClientRects()),B_=e=>t=>((e,t)=>t.line>e)(e,t),L_=e=>t=>((e,t)=>t.line===e)(e,t),H_=(e,t)=>{e.selection.setRng(t),Rh(e,e.selection.getRng())},I_=(e,t,o)=>F.some(gk(e,t,o)),P_=(e,t,o,n,r,s)=>{const a=t===Em.Forwards,i=Im(e.getBody()),l=N(km,a?i.next:i.prev),c=a?n:r;if(!o.collapsed){const n=Hi(o);if(s(n))return mk(t,e,n,t===Em.Backwards,!1);if(yk(e)){const e=o.cloneRange();return e.collapse(t===Em.Backwards),F.from(e)}}const d=Cm(t,e.getBody(),o);if(c(d))return uk(e,d.getNode(!a));let m=l(d);const u=Gr(o);if(!m)return u?F.some(o):F.none();if(m=mv(a,m),c(m))return mk(t,e,m.getNode(!a),a,!1);const g=l(m);return g&&c(g)&&_m(m,g)?mk(t,e,g.getNode(!a),a,!1):u?I_(e,m.toRange(),!1):F.none()},F_=(e,t,o,n,r,s)=>{const a=Cm(t,e.getBody(),o),i=Le(a.getClientRects()),l=t===D_.Down,c=e.getBody();if(!i)return F.none();if(yk(e)){const e=l?rl.fromRangeEnd(o):rl.fromRangeStart(o);return(l?C_:x_)(c,e).orThunk((()=>F.from(e))).map((e=>e.toRange()))}const d=(l?N_:M_)(c,B_(1),a),m=Y(d,L_(1)),u=i.left,g=E_(m,u);if(g&&s(g.node)){const o=Math.abs(u-g.left),n=Math.abs(u-g.right);return mk(t,e,g.node,o{const r=Im(t);let s,a,i,l;const c=[];let d=0;1===e?(s=r.next,a=Bi,i=Ri,l=rl.after(n)):(s=r.prev,a=Ri,i=Bi,l=rl.before(n));const m=R_(l);do{if(!l.isVisible())continue;const e=R_(l);if(i(e,m))continue;c.length>0&&a(e,Le(c))&&d++;const t=Ai(e);if(t.position=l,t.line=d,o(t))return c;c.push(t)}while(l=s(l));return c})(t,c,B_(1),h);let n=E_(Y(o,L_(1)),u);if(n)return I_(e,n.position.toRange(),!1);if(n=Le(Y(o,L_(0))),n)return I_(e,n.position.toRange(),!1)}return 0===m.length?z_(e,l).filter(l?r:n).map((t=>gk(e,t.toRange(),!1))):F.none()},z_=(e,t)=>{const o=e.selection.getRng(),n=t?rl.fromRangeEnd(o):rl.fromRangeStart(o),r=(s=n.container(),a=e.getBody(),Yo(yo.fromDom(s),(e=>Qd(e.dom)),(e=>e.dom===a)).map((e=>e.dom)).getOr(a));var s,a;if(t){const e=f_(r,n);return me(e.positions)}{const e=p_(r,n);return de(e.positions)}},V_=(e,t,o)=>z_(e,t).filter(o).exists((t=>(e.selection.setRng(t.toRange()),!0))),Z_=(e,t)=>{const o=e.dom.createRng();o.setStart(t.container(),t.offset()),o.setEnd(t.container(),t.offset()),e.selection.setRng(o)},U_=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},j_=(e,t,o)=>Fk(t,o).map((t=>(Z_(e,t),o))),W_=(e,t,o)=>{const n=e.getBody(),r=((e,t,o)=>{const n=rl.fromRangeStart(e);if(e.collapsed)return n;{const r=rl.fromRangeEnd(e);return o?qm(t,r).getOr(r):$m(t,n).getOr(n)}})(e.selection.getRng(),n,o),s=N(lv,e);return r_(o,s,n,r).bind((o=>j_(e,t,o)))},$_=(e,t)=>{const o=t.get();if(e.selection.isCollapsed()&&!e.composing&&o){const n=rl.fromRangeStart(e.selection.getRng());rl.isTextPosition(n)&&!(e=>Ur(e)||jr(e))(n)&&(Z_(e,Ud(o,n)),t.set(null))}},q_=(e,t,o)=>!!Rc(e)&&W_(e,t,o).isSome(),G_=(e,t,o)=>!!Rc(t)&&a_(e,t),K_=e=>{const t=Qa(null),o=N(lv,e);return e.on("NodeChange",(n=>{Rc(e)&&(((e,t,o)=>{const n=$(zn(yo.fromDom(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),(e=>e.dom)),r=Y(n,e),s=Y(o,e);q(ae(r,s),N(U_,!1)),q(ae(s,r),N(U_,!0))})(o,e.dom,n.parents),$_(e,t),((e,t,o,n)=>{if(t.selection.isCollapsed()){const r=Y(n,e);q(r,(n=>{const r=rl.fromRangeStart(t.selection.getRng());Yk(e,t.getBody(),r).bind((e=>j_(t,o,e)))}))}})(o,e,t,n.parents))})),t},Y_=N(G_,!0),X_=N(G_,!1),J_=(e,t,o)=>{if(Rc(e)){const n=z_(e,t).getOrThunk((()=>{const o=e.selection.getRng();return t?rl.fromRangeEnd(o):rl.fromRangeStart(o)}));return Yk(N(lv,e),e.getBody(),n).exists((t=>{const n=Qk(t);return Fk(o,n).exists((t=>(Z_(e,t),!0)))}))}return!1},Q_=(e,t)=>o=>Fk(t,o).map((t=>()=>Z_(e,t))),eE=(e,t,o,n)=>{const r=e.getBody(),s=N(lv,e);e.undoManager.ignore((()=>{e.selection.setRng(((e,t)=>{const o=document.createRange();return o.setStart(e.container(),e.offset()),o.setEnd(t.container(),t.offset()),o})(o,n)),pv(e),Yk(s,r,rl.fromRangeStart(e.selection.getRng())).map(e_).bind(Q_(e,t)).each(H)})),e.nodeChanged()},tE=(e,t,o,n)=>{const r=((e,t)=>{const o=um(t,e);return o||e})(e.getBody(),n.container()),s=N(lv,e),a=Yk(s,r,n);return a.bind((e=>o?e.fold(D(F.some(e_(e))),F.none,D(F.some(Qk(e))),F.none):e.fold(F.none,D(F.some(Qk(e))),F.none,D(F.some(e_(e)))))).map(Q_(e,t)).getOrThunk((()=>{const i=Um(o,r,n),l=i.bind((e=>Yk(s,r,e)));return It(a,l,(()=>dv(s,r,n).bind((t=>(e=>It(Gm(e),Km(e),((t,o)=>{const n=mv(!0,t),r=mv(!1,o);return $m(e,n).forall((e=>e.isEqual(r)))})).getOr(!0))(t)?F.some((()=>{av(e,o,yo.fromDom(t))})):F.none())))).getOrThunk((()=>l.bind((()=>i.map((r=>()=>{o?eE(e,t,n,r):eE(e,t,r,n)}))))))}))},oE=(e,t,o)=>{if(e.selection.isCollapsed()&&Rc(e)){const n=rl.fromRangeStart(e.selection.getRng());return tE(e,t,o,n)}return F.none()},nE=(e,t)=>{const o=yo.fromDom(e.getBody()),n=yo.fromDom(e.selection.getStart()),r=pf(n,o);return te(r,t).fold(D(r),(e=>r.slice(0,e)))},rE=e=>1===Fo(e),sE=e=>nE(e,(t=>e.schema.isBlock(jt(t))||(e=>Fo(e)>1)(t))),aE=(e,t)=>{const o=N(ny,e);return ne(t,(e=>o(e)?[e.dom]:[]))},iE=e=>{const t=(e=>nE(e,(t=>e.schema.isBlock(jt(t)))))(e);return aE(e,t)},lE=(e,t)=>{const o=Y(sE(e),rE);return me(o).bind((n=>{const r=rl.fromRangeStart(e.selection.getRng());return yv(t,r,n.dom)&&!Yu(n)?F.some((()=>((e,t,o,n)=>{const r=aE(t,n);if(0===r.length)av(t,e,o);else{const e=oy(o.dom,r);t.selection.setRng(e.toRange())}})(t,e,n,o))):F.none()}))},cE=(e,t)=>{const o=e.selection.getStart(),n=((e,t)=>{const o=t.parentElement;return ir(t)&&!b(o)&&e.dom.isEmpty(o)})(e,o)||(r=o,Yu(yo.fromDom(r)))?oy(o,t):((e,t)=>{const{caretContainer:o,caretPosition:n}=ty(t);return e.insertNode(o.dom),n})(e.selection.getRng(),t);var r;e.selection.setRng(n.toRange())},dE=e=>tr(e.startContainer),mE=e=>(e=>{const t=e.startContainer.parentNode,o=e.endContainer.parentNode;return!b(t)&&!b(o)&&t.isEqualNode(o)})(e)&&(e=>{const t=e.endContainer;return e.endOffset===(tr(t)?t.length:t.childNodes.length)})(e),uE=e=>{const t=e.selection.getRng();return(e=>0===e.startOffset&&dE(e))(t)&&((e,t)=>{const o=t.startContainer.parentElement;return!b(o)&&ny(e,yo.fromDom(o))})(e,t)&&(e=>mE(e)||(e=>!e.endContainer.isEqualNode(e.commonAncestorContainer))(e))(t)},gE=e=>{if(uE(e)){const t=iE(e);return F.some((()=>{pv(e),((e,t)=>{const o=ae(t,iE(e));o.length>0&&cE(e,o)})(e,t)}))}return F.none()},hE=(e,t)=>e.selection.isCollapsed()?lE(e,t):gE(e),pE=(e,t)=>((e,t,o)=>Yo(e,t,o).isSome())(e,(e=>Xm(e.dom)),(e=>t.isBlock(jt(e)))),fE=e=>{const t=e.selection.getRng();return t.collapsed&&(dE(t)||e.dom.isEmpty(t.startContainer))&&!(e=>pE(yo.fromDom(e.selection.getStart()),e.schema))(e)},vE=e=>(fE(e)&&cE(e,[]),!0),bE=(e,t,o)=>C(o)?F.some((()=>{e._selectionOverrides.hideFakeCaret(),av(e,t,yo.fromDom(o))})):F.none(),yE=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const o=t?lf:cf,n=t?Em.Forwards:Em.Backwards,r=Cm(n,e.getBody(),e.selection.getRng());return o(r)?bE(e,t,r.getNode(!t)):F.from(mv(t,r)).filter((e=>o(e)&&_m(r,e))).bind((o=>bE(e,t,o.getNode(!t))))})(e,t):((e,t)=>{const o=e.selection.getNode();return gr(o)?bE(e,t,o):F.none()})(e,t),wE=e=>Je(null!=e?e:"").getOr(0),xE=(e,t)=>(e||"table"===jt(t)?"margin":"padding")+("rtl"===dn(t,"direction")?"-right":"-left"),CE=e=>{const t=kE(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>re(t,(t=>{const o=xE(vc(e),t),n=un(t,o).map(wE).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&n>0})))(e,t))},SE=e=>Er(e)||Tr(e),kE=e=>Y(kn(e.selection.getSelectedBlocks()),(e=>!SE(e)&&!(e=>Oo(e).exists(SE))(e)&&Xo(e,(e=>cr(e.dom)||dr(e.dom))).exists((e=>cr(e.dom))))),_E=(e,t)=>{var o,n;const{dom:r}=e,s=bc(e),a=null!==(n=null===(o=/[a-z%]+$/i.exec(s))||void 0===o?void 0:o[0])&&void 0!==n?n:"px",i=wE(s),l=vc(e);q(kE(e),(e=>{((e,t,o,n,r,s)=>{const a=xE(o,yo.fromDom(s)),i=wE(e.getStyle(s,a));if("outdent"===t){const t=Math.max(0,i-n);e.setStyle(s,a,t?t+r:"")}else{const t=i+n+r;e.setStyle(s,a,t)}})(r,t,l,i,a,e.dom)}))},EE=e=>_E(e,"outdent"),TE=e=>{if(e.selection.isCollapsed()&&CE(e)){const t=e.dom,o=e.selection.getRng(),n=rl.fromRangeStart(o),r=t.getParent(o.startContainer,t.isBlock);if(null!==r&&wf(yo.fromDom(r),n,e.schema))return F.some((()=>EE(e)))}return F.none()},OE=(e,t,o)=>ge([TE,Ok,vk,(e,o)=>oE(e,t,o),ak,eb,Dk,yE,dk,hE],(t=>t(e,o))).filter((t=>e.selection.isEditable())),DE=(e,t)=>{OE(e,t,!0).fold((()=>{e.selection.isEditable()&&(e=>{hv(e,"ForwardDelete")})(e)}),H)},AE=(e,t)=>{e.addCommand("delete",(()=>{((e,t)=>{OE(e,t,!1).fold((()=>{e.selection.isEditable()&&(pv(e),bv(e))}),H)})(e,t)})),e.addCommand("forwardDelete",(()=>{DE(e,t)}))},ME=e=>void 0===e.touches||1!==e.touches.length?F.none():F.some(e.touches[0]),NE=e=>{const t=ai(),o=Qa(!1),n=li((t=>{e.dispatch("longpress",{...t,type:"longpress"}),o.set(!0)}),400);e.on("touchstart",(e=>{ME(e).each((r=>{n.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};n.throttle(e),o.set(!1),t.set(s)}))}),!0),e.on("touchmove",(r=>{n.cancel(),ME(r).each((n=>{t.on((r=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(n,r)&&(t.clear(),o.set(!1),e.dispatch("longpresscancel"))}))}))}),!0),e.on("touchend touchcancel",(r=>{n.cancel(),"touchcancel"!==r.type&&t.get().filter((e=>e.target.isEqualNode(r.target))).each((()=>{o.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})}))}),!0)},RE=(e,t)=>_e(e,t.nodeName),BE=(e,t)=>!!tr(t)||!!Wn(t)&&!(RE(e.getBlockElements(),t)||mu(t)||Ls(e,t)||xs(t)),LE=(e,t)=>{if(tr(t)){if(0===t.data.length)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||RE(e,t.nextSibling)||xs(t.nextSibling)}return!1},HE=e=>e.dom.create(Xl(e),Jl(e)),IE=e=>{const t=e.dom,o=e.selection,n=e.schema,r=n.getBlockElements(),s=o.getStart(),a=e.getBody();let i,l,c=!1;const d=Xl(e);if(!s||!Wn(s))return;const m=a.nodeName.toLowerCase();if(!n.isValidChild(m,d.toLowerCase())||((e,t,o)=>W(hf(yo.fromDom(o),yo.fromDom(t)),(t=>RE(e,t.dom))))(r,a,s))return;const u=o.getRng(),{startContainer:g,startOffset:h,endContainer:p,endOffset:f}=u,v=ap(e);let b=a.firstChild;for(;b;)if(Wn(b)&&Ms(n,b),BE(n,b)){if(LE(r,b)){l=b,b=b.nextSibling,t.remove(l);continue}i||(i=HE(e),a.insertBefore(i,b),c=!0),l=b,b=b.nextSibling,i.appendChild(l)}else i=null,b=b.nextSibling;c&&v&&(u.setStart(g,h),u.setEnd(p,f),o.setRng(u),e.nodeChanged())},PE=(e,t,o)=>{const n=yo.fromDom(HE(e)),r=Nr();bn(n,r),o(t,n);const s=document.createRange();return s.setStartBefore(r.dom),s.setEndBefore(r.dom),s},FE=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),zE=(e,t,o)=>function(n){const r=arguments,s=r[r.length-2],a=s>0?t.charAt(s-1):"";if('"'===a)return n;if(">"===a){const e=t.lastIndexOf("<",s);if(-1!==e&&-1!==t.substring(e,s).indexOf('contenteditable="false"'))return n}return''+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+""},VE=e=>{const t="contenteditable",o=" "+Bt.trim(Sd(e))+" ",n=" "+Bt.trim(Cd(e))+" ",r=FE(o),s=FE(n),a=kd(e);a.length>0&&e.on("BeforeSetContent",(t=>{((e,t,o)=>{let n=t.length,r=o.content;if("raw"!==o.format){for(;n--;)r=r.replace(t[n],zE(e,r,Cd(e)));o.content=r}})(e,a,t)})),e.parser.addAttributeFilter("class",(e=>{let o=e.length;for(;o--;){const n=e[o];r(n)?n.attr(t,"true"):s(n)&&n.attr(t,"false")}})),e.serializer.addAttributeFilter(t,(e=>{let o=e.length;for(;o--;){const n=e[o];(r(n)||s(n))&&(a.length>0&&n.attr("data-mce-content")?(n.name="#text",n.type=3,n.raw=!0,n.value=n.attr("data-mce-content")):n.attr(t,null))}}))},ZE=(e,t)=>{t.hasAttribute("data-mce-caret")&&(qr(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},UE=(e,t)=>{const o=(e=>tn(yo.fromDom(e.getBody()),"*[data-mce-caret]").map((e=>e.dom)).getOrNull())(e);if(o)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void ZE(e,o)):void(Zr(o)&&(ZE(e,o),e.undoManager.add()))},jE=dr,WE=(e,t,o)=>{const n=Im(e.getBody()),r=N(km,1===t?n.next:n.prev);if(o.collapsed){const n=e.dom.getParent(o.startContainer,"PRE");if(!n)return;if(!r(rl.fromRangeStart(o))){const o=yo.fromDom((e=>{const t=e.dom.create(Xl(e));return t.innerHTML='
    ',t})(e));1===t?fn(yo.fromDom(n),o):pn(yo.fromDom(n),o),e.selection.select(o.dom,!0),e.selection.collapse()}}},$E=(e,t)=>{const o=t?Em.Forwards:Em.Backwards,n=e.selection.getRng();return((e,t,o)=>P_(t,e,o,uf,gf,jE))(o,e,n).orThunk((()=>(WE(e,o,n),F.none())))},qE=(e,t)=>{const o=t?1:-1,n=e.selection.getRng();return((e,t,o)=>F_(t,e,o,(e=>uf(e)||df(e)),(e=>gf(e)||mf(e)),jE))(o,e,n).orThunk((()=>(WE(e,o,n),F.none())))},GE=(e,t)=>$E(e,((e,t)=>{const o=t?e.getEnd(!0):e.getStart(!0);return cv(o)?!t:t})(e.selection,t)).exists((t=>(H_(e,t),!0))),KE=(e,t)=>qE(e,t).exists((t=>(H_(e,t),!0))),YE=(e,t)=>V_(e,t,t?gf:uf),XE=(e,t)=>bk(e,!t).map((o=>{const n=o.toRange(),r=e.selection.getRng();return t?n.setStart(r.startContainer,r.startOffset):n.setEnd(r.endContainer,r.endOffset),n})).exists((t=>(H_(e,t),!0))),JE=e=>j(["figcaption"],jt(e)),QE=(e,t)=>{const o=yo.fromDom(e.getBody()),n=rl.fromRangeStart(e.selection.getRng());return((e,t,o)=>{const n=N(So,t);return Xo(yo.fromDom(e.container()),(e=>o.isBlock(jt(e))),n).filter(JE)})(n,o,e.schema).exists((()=>{if(((e,t,o)=>t?w_(e.dom,o):y_(e.dom,o))(o,t,n)){const n=PE(e,o,t?bn:vn);return e.selection.setRng(n),!0}return!1}))},eT=(e,t)=>!!e.selection.isCollapsed()&&QE(e,t),tT=(e,t)=>t?F.from(e.dom.getParent(e.selection.getNode(),"details")).map((t=>((e,t)=>{const o=e.selection.getRng(),n=rl.fromRangeStart(o);return!(e.getBody().lastChild!==t||!w_(t,n)||(e.execCommand("InsertNewBlockAfter"),0))})(e,t))).getOr(!1):F.from(e.dom.getParent(e.selection.getNode(),"summary")).bind((t=>F.from(e.dom.getParent(t,"details")).map((o=>((e,t,o)=>{const n=e.selection.getRng(),r=rl.fromRangeStart(n);return!(e.getBody().firstChild!==t||!y_(o,r)||(e.execCommand("InsertNewBlockBefore"),0))})(e,o,t))))).getOr(!1),oT=(e,t)=>tT(e,t),nT={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},rT=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,sT=(e,t)=>ne((e=>$(e,(e=>({...nT,...e}))))(e),(e=>rT(e,t)?[e]:[])),aT=(e,t)=>ne((e=>$(e,(e=>({...nT,...e}))))(e),(e=>rT(e,t)?[e]:[])),iT=(e,...t)=>()=>e.apply(null,t),lT=(e,t)=>ee(sT(e,t),(e=>e.action())),cT=(e,t)=>ge(aT(e,t),(e=>e.action())),dT=(e,t)=>{const o=t?Em.Forwards:Em.Backwards,n=e.selection.getRng();return P_(e,o,n,lf,cf,gr).exists((t=>(H_(e,t),!0)))},mT=(e,t)=>{const o=t?1:-1,n=e.selection.getRng();return F_(e,o,n,lf,cf,gr).exists((t=>(H_(e,t),!0)))},uT=(e,t)=>V_(e,t,t?cf:lf),gT=Al([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),hT={...gT,none:e=>gT.none(e)},pT=(e,t,o)=>ne(Lo(e),(e=>xo(e,t)?o(e)?[e]:[]:pT(e,t,o))),fT=(e,t)=>((e,t,o=I)=>o(t)?F.none():j(e,jt(t))?F.some(t):en(t,e.join(","),(e=>xo(e,"table")||o(e))))(["td","th"],e,t),vT=e=>pT(e,"th,td",P),bT=(e,t)=>on(e,"table",t),yT=(e,t,o,n,r=P)=>{const s=1===n;if(!s&&o<=0)return hT.first(e[0]);if(s&&o>=e.length-1)return hT.last(e[e.length-1]);{const s=o+n,a=e[s];return r(a)?hT.middle(t,a):yT(e,t,s,n,r)}},wT=(e,t)=>bT(e,t).bind((t=>{const o=vT(t);return te(o,(t=>So(e,t))).map((e=>({index:e,all:o})))})),xT=(e,t,o,n,r)=>{const s=zn(yo.fromDom(o),"td,th,caption").map((e=>e.dom)),a=Y(((e,t)=>ne(t,(t=>{const o=((e,t)=>({left:e.left-t,top:e.top-t,right:e.right+2*t,bottom:e.bottom+2*t,width:e.width+t,height:e.height+t}))(Ai(t.getBoundingClientRect()),-1);return[{x:o.left,y:e(o),cell:t},{x:o.right,y:e(o),cell:t}]})))(e,s),(e=>t(e,r)));return((e,t,o)=>J(e,((e,n)=>e.fold((()=>F.some(n)),(e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-o)),s=Math.sqrt(Math.abs(n.x-t)+Math.abs(n.y-o));return F.some(se.cell))},CT=N(xT,(e=>e.bottom),((e,t)=>e.ye.top),((e,t)=>e.y>t)),kT=(e,t)=>de(t.getClientRects()).bind((t=>CT(e,t.left,t.top))).bind((e=>{return h_(Km(o=e).map((e=>p_(o,e).positions.concat(e))).getOr([]),t);var o})),_T=(e,t)=>me(t.getClientRects()).bind((t=>ST(e,t.left,t.top))).bind((e=>{return h_(Gm(o=e).map((e=>[e].concat(f_(o,e).positions))).getOr([]),t);var o})),ET=(e,t,o)=>{const n=e(t,o);return(e=>e.breakType===i_.Wrap&&0===e.positions.length)(n)||!ir(o.getNode())&&(e=>e.breakType===i_.Br&&1===e.positions.length)(n)?!((e,t,o)=>o.breakAt.exists((o=>e(t,o).breakAt.isSome())))(e,t,n):n.breakAt.isNone()},TT=N(ET,p_),OT=N(ET,f_),DT=(e,t,o,n)=>{const r=e.selection.getRng(),s=t?1:-1;return!(!Yd()||!((e,t,o)=>{const n=rl.fromRangeStart(t);return Wm(!e,o).exists((e=>e.isEqual(n)))})(t,r,o)||(mk(s,e,o,!t,!1).each((t=>{H_(e,t)})),0))},AT=(e,t)=>{const o=t.getNode(e);return Jn(o)?F.some(o):F.none()},MT=(e,t,o)=>{const n=AT(!!t,o),r=!1===t;n.fold((()=>H_(e,o.toRange())),(n=>Wm(r,e.getBody()).filter((e=>e.isEqual(o))).fold((()=>H_(e,o.toRange())),(o=>((e,t,o)=>{t.undoManager.transact((()=>{const n=e?fn:pn,r=PE(t,yo.fromDom(o),n);H_(t,r)}))})(t,e,n)))))},NT=(e,t,o,n)=>{const r=e.selection.getRng(),s=rl.fromRangeStart(r),a=e.getBody();if(!t&&TT(n,s)){const n=((e,t,o)=>kT(t,o).orThunk((()=>de(o.getClientRects()).bind((o=>g_(v_(e,rl.before(t)),o.left))))).getOr(rl.before(t)))(a,o,s);return MT(e,t,n),!0}if(t&&OT(n,s)){const n=((e,t,o)=>_T(t,o).orThunk((()=>de(o.getClientRects()).bind((o=>g_(b_(e,rl.after(t)),o.left))))).getOr(rl.after(t)))(a,o,s);return MT(e,t,n),!0}return!1},RT=(e,t,o)=>F.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind((n=>F.from(e.dom.getParent(n,"table")).map((r=>o(e,t,r,n))))).getOr(!1),BT=(e,t)=>RT(e,t,DT),LT=(e,t)=>RT(e,t,NT),HT=(e,t,o)=>o.fold(F.none,F.none,((e,t)=>{return(o=t,Qo(o,vp)).map((e=>(e=>{const t=qg.exact(e,0,e,0);return Jg(t)})(e)));var o}),(o=>(e.execCommand("mceTableInsertRowAfter"),IT(e,t,o)))),IT=(e,t,o)=>HT(e,t,((e,t,o)=>wT(e,o).fold((()=>hT.none(e)),(o=>yT(o.all,e,o.index,1,t))))(o,nn)),PT=(e,t,o)=>HT(e,t,((e,t,o)=>wT(e,o).fold((()=>hT.none()),(o=>yT(o.all,e,o.index,-1,t))))(o,nn)),FT=(e,t)=>{const o=["table","li","dl"],n=yo.fromDom(e.getBody()),r=e=>{const t=jt(e);return So(e,n)||j(o,t)},s=e.selection.getRng(),a=yo.fromDom(t?s.endContainer:s.startContainer);return fT(a,r).map((o=>(bT(o,r).each((t=>{e.model.table.clearSelectedCells(t.dom)})),e.selection.collapse(!t),(t?IT:PT)(e,r,o).each((t=>{e.selection.setRng(t)})),!0))).getOr(!1)},zT=(e,t)=>{e.on("keydown",(o=>{o.isDefaultPrevented()||((e,t,o)=>{const n=At.os.isMacOS()||At.os.isiOS();lT([{keyCode:Dg.RIGHT,action:iT(GE,e,!0)},{keyCode:Dg.LEFT,action:iT(GE,e,!1)},{keyCode:Dg.UP,action:iT(KE,e,!1)},{keyCode:Dg.DOWN,action:iT(KE,e,!0)},...n?[{keyCode:Dg.UP,action:iT(XE,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Dg.DOWN,action:iT(XE,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Dg.RIGHT,action:iT(BT,e,!0)},{keyCode:Dg.LEFT,action:iT(BT,e,!1)},{keyCode:Dg.UP,action:iT(LT,e,!1)},{keyCode:Dg.DOWN,action:iT(LT,e,!0)},{keyCode:Dg.UP,action:iT(LT,e,!1)},{keyCode:Dg.UP,action:iT(oT,e,!1)},{keyCode:Dg.DOWN,action:iT(oT,e,!0)},{keyCode:Dg.RIGHT,action:iT(dT,e,!0)},{keyCode:Dg.LEFT,action:iT(dT,e,!1)},{keyCode:Dg.UP,action:iT(mT,e,!1)},{keyCode:Dg.DOWN,action:iT(mT,e,!0)},{keyCode:Dg.RIGHT,action:iT(q_,e,t,!0)},{keyCode:Dg.LEFT,action:iT(q_,e,t,!1)},{keyCode:Dg.RIGHT,ctrlKey:!n,altKey:n,action:iT(Y_,e,t)},{keyCode:Dg.LEFT,ctrlKey:!n,altKey:n,action:iT(X_,e,t)},{keyCode:Dg.UP,action:iT(eT,e,!1)},{keyCode:Dg.DOWN,action:iT(eT,e,!0)}],o).each((e=>{o.preventDefault()}))})(e,t,o)}))},VT=(e,t)=>({container:e,offset:t}),ZT=Ya.DOM,UT=e=>t=>e===t?-1:0,jT=(e,t,o)=>{if(tr(e)&&t>=0)return F.some(VT(e,t));{const n=Oi(ZT);return F.from(n.backwards(e,t,UT(e),o)).map((e=>VT(e.container,e.container.data.length)))}},WT=(e,t,o)=>{if(!tr(e))return F.none();const n=e.data;if(t>=0&&t<=n.length)return F.some(VT(e,t));{const n=Oi(ZT);return F.from(n.backwards(e,t,UT(e),o)).bind((e=>{const n=e.container.data;return WT(e.container,t+n.length,o)}))}},$T=(e,t,o)=>{if(!tr(e))return F.none();const n=e.data;if(t<=n.length)return F.some(VT(e,t));{const r=Oi(ZT);return F.from(r.forwards(e,t,UT(e),o)).bind((e=>$T(e.container,t-n.length,o)))}},qT=(e,t,o,n,r)=>{const s=Oi(e,(e=>t=>e.isBlock(t)||j(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return F.from(s.backwards(t,o,n,r))},GT=e=>Hr(e.toString().replace(/\u00A0/g," ")),KT=e=>""!==e&&-1!=="  \f\n\r\t\v".indexOf(e),YT=(e,t)=>e.substring(t.length),XT=(e,t,o,n=0)=>{if(!(r=t).collapsed||!tr(r.startContainer))return F.none();var r;const s={text:"",offset:0},a=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return qT(e,t.startContainer,t.startOffset,((e,t,n)=>(s.text=n+s.text,s.offset+=t,((e,t,o)=>{let n;const r=o.charAt(0);for(n=t-1;n>=0;n--){const s=e.charAt(n);if(KT(s))return F.none();if(r===s&&Ue(e,o,n,t))break}return F.some(n)})(s.text,s.offset,o).getOr(t))),a).bind((e=>{const r=t.cloneRange();if(r.setStart(e.container,e.offset),r.setEnd(t.endContainer,t.endOffset),r.collapsed)return F.none();const s=GT(r);return 0!==s.lastIndexOf(o)||YT(s,o).length{return(r=yo.fromDom(t.startContainer),on(r,yp)).fold((()=>XT(e,t,o,n)),(t=>{const n=e.createRng();n.selectNode(t.dom);const r=GT(n);return F.some({range:n,text:YT(r,o),trigger:o})}));var r},QT=e=>{if((e=>3===e.nodeType)(e))return VT(e,e.data.length);{const t=e.childNodes;return t.length>0?QT(t[t.length-1]):VT(e,t.length)}},eO=(e,t)=>{const o=e.childNodes;return o.length>0&&t0&&(e=>1===e.nodeType)(e)&&o.length===t?QT(o[o.length-1]):VT(e,t)},tO=e=>t=>{const o=eO(t.startContainer,t.startOffset);return!((e,t)=>{var o;const n=null!==(o=e.getParent(t.container,e.isBlock))&&void 0!==o?o:e.getRoot();return qT(e,t.container,t.offset,((e,t)=>0===t?-1:t),n).filter((e=>{const t=e.container.data.charAt(e.offset-1);return!KT(t)})).isSome()})(e,o)},oO=(e,t)=>{const o=t(),n=e.selection.getRng();return((e,t,o)=>ge(o.triggers,(o=>JT(e,t,o))))(e.dom,n,o).bind((o=>nO(e,t,o)))},nO=(e,t,o,n={})=>{var r;const s=t(),a=null!==(r=e.selection.getRng().startContainer.nodeValue)&&void 0!==r?r:"",i=Y(s.lookupByTrigger(o.trigger),(t=>o.text.length>=t.minChars&&t.matches.getOrThunk((()=>tO(e.dom)))(o.range,a,o.text)));if(0===i.length)return F.none();const l=Promise.all($(i,(e=>e.fetch(o.text,e.maxResults,n).then((t=>({matchText:o.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))))));return F.some({lookupData:l,context:o})};var rO;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(rO||(rO={}));const sO=(e,t,o)=>e.stype===rO.Error?t(e.serror):o(e.svalue),aO=e=>({stype:rO.Value,svalue:e}),iO=e=>({stype:rO.Error,serror:e}),lO=e=>sO(e,Dl.error,Dl.value),cO=aO,dO=e=>{const t=[],o=[];return q(e,(e=>{sO(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}},mO=iO,uO=(e,t)=>e.stype===rO.Error?t(e.serror):e,gO=(e,t)=>e.stype===rO.Value?{stype:rO.Value,svalue:t(e.svalue)}:e,hO=(e,t)=>e.stype===rO.Error?{stype:rO.Error,serror:t(e.serror)}:e,pO=sO,fO=e=>p(e)&&he(e).length>100?" removed due to size":JSON.stringify(e,null,2),vO=(e,t)=>mO([{path:e,getErrorInfo:t}]),bO=(e,t,o,n)=>ke(o,n).fold((()=>((e,t,o)=>vO(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+fO(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))),yO=(e,t)=>({extract:(o,n)=>ke(n,e).fold((()=>((e,t)=>vO(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>bO(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+he(t)}),wO=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;nf(e)&&f(t)?xO(e,t):t)),CO=(wO(((e,t)=>t)),e=>({tag:"defaultedThunk",process:D(e)})),SO=e=>T(mO,oe)(e),kO=e=>{const t=dO(e);return t.errors.length>0?SO(t.errors):cO(t.values)},_O=(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)}},EO=e=>({extract:(t,o)=>uO(e(o),(e=>((e,t)=>vO(e,D(t)))(t,e))),toString:D("val")}),TO=EO(cO),OO=(e,t,o,n)=>ke(t,o).fold((()=>((e,t,o)=>vO(e,(()=>'Could not find valid *required* value for "'+t+'" in '+fO(o))))(e,o,t)),n),DO=(e,t,o,n)=>n(ke(e,t).getOrThunk((()=>o(e)))),AO=(e,t,o,n,r)=>{const s=e=>r.extract(t.concat([n]),e),a=e=>e.fold((()=>cO(F.none())),(e=>{const o=r.extract(t.concat([n]),e);return gO(o,F.some)}));switch(e.tag){case"required":return OO(t,o,n,s);case"defaultedThunk":return DO(o,n,e.process,s);case"option":return((e,t,o)=>o(ke(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(ke(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return DO(o,n,D({}),(t=>{const n=xO(e.process(o),t);return s(n)}))}},MO=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const s of o)_O(s,((o,s,a,i)=>{const l=AO(a,e,t,o,i);pO(l,(e=>{r.push(...e)}),(e=>{n[s]=e}))}),((e,o)=>{n[e]=o(t)}));return r.length>0?mO(r):cO(n)})(t,o,e),toString:()=>{const t=$(e,(e=>_O(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),NO=e=>({extract:(t,o)=>{const n=$(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return kO(n)},toString:()=>"array("+e.toString()+")"}),RO=(e,t,o)=>lO(((e,t,o)=>{const n=t.extract([e],o);return hO(n,(e=>({input:o,errors:e})))})(e,t,o)),BO=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:D("... (only showing first ten failures)")}]):e;return $(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+fO(e.input),LO=(e,t)=>yO(e,ve(t,MO)),HO=D(TO),IO=(e,t)=>EO((o=>{const n=typeof o;return e(o)?cO(o):mO(`Expected type: ${t} but got: ${n}`)})),PO=IO(k,"number"),FO=IO(h,"string"),zO=IO(y,"boolean"),VO=IO(S,"function"),ZO=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),UO=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),jO=e=>{return t=t=>j(e,t)?Dl.value(t):Dl.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`),EO((e=>t(e).fold(mO,cO)));var t},WO=(e,t)=>ZO(e,e,{tag:"required",process:{}},t),$O=e=>WO(e,FO),qO=e=>WO(e,VO),GO=(e,t)=>ZO(e,e,{tag:"option",process:{}},t),KO=e=>GO(e,FO),YO=(e,t,o)=>ZO(e,e,CO(t),o),XO=(e,t)=>YO(e,t,PO),JO=(e,t,o)=>YO(e,t,jO(o)),QO=(e,t)=>YO(e,t,zO),eD=(e,t)=>YO(e,t,VO),tD=$O("type"),oD=qO("fetch"),nD=qO("onAction"),rD=eD("onSetup",(()=>E)),sD=KO("text"),aD=KO("icon"),iD=KO("tooltip"),lD=KO("label"),cD=QO("active",!1),dD=QO("enabled",!0),mD=QO("primary",!1),uD=e=>((e,t)=>YO(e,t,FO))("type",e),gD=MO([tD,$O("trigger"),XO("minChars",1),(pD=1,((e,t)=>ZO(e,e,CO(t),HO()))("columns",pD)),XO("maxResults",10),(hD="matches",GO(hD,VO)),oD,nD,((e,t,o)=>YO(e,t,NO(o)))("highlightOn",[],FO)]);var hD,pD;const fD=[dD,iD,aD,sD,rD],vD=[cD].concat(fD),bD=[eD("predicate",I),JO("scope","node",["node","editor"]),JO("position","selection",["node","selection","line"])],yD=fD.concat([uD("contextformbutton"),mD,nD,UO("original",A)]),wD=vD.concat([uD("contextformbutton"),mD,nD,UO("original",A)]),xD=fD.concat([uD("contextformbutton")]),CD=vD.concat([uD("contextformtogglebutton")]),SD=LO("type",{contextformbutton:yD,contextformtogglebutton:wD});MO([uD("contextform"),eD("initValue",D("")),lD,((e,t)=>ZO(e,e,{tag:"required",process:{}},NO(t)))("commands",SD),GO("launch",LO("type",{contextformbutton:xD,contextformtogglebutton:CD}))].concat(bD));const kD=e=>{const t=e.ui.registry.getAll().popups,o=ve(t,(e=>{return(t=e,RO("Autocompleter",gD,{trigger:t.ch,...t})).fold((e=>{throw new Error(BO(e))}),A);var t})),n=Te(Ce(o,(e=>e.trigger))),r=Se(o);return{dataset:o,triggers:n,lookupByTrigger:e=>Y(r,(t=>t.trigger===e))}},_D=e=>{const t=ai(),o=Qa(!1),n=t.isSet,r=()=>{n()&&((e=>{yC(e).autocompleter.removeDecoration()})(e),(e=>{e.dispatch("AutocompleterEnd")})(e),o.set(!1),t.clear())},s=o=>{n()||(((e,t)=>{yC(e).autocompleter.addDecoration(t)})(e,o.range),t.set({trigger:o.trigger,matchLength:o.text.length}))},a=He((()=>kD(e))),i=n=>{(o=>t.get().map((t=>JT(e.dom,e.selection.getRng(),t.trigger).bind((t=>nO(e,a,t,o))))).getOrThunk((()=>oO(e,a))))(n).fold(r,(n=>{s(n.context),n.lookupData.then((s=>{t.get().map((a=>{const i=n.context;a.trigger===i.trigger&&(i.text.length-a.matchLength>=10?r():(t.set({...a,matchLength:i.text.length}),o.get()?((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:s}):(o.set(!0),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:s}))))}))}))}))};e.addCommand("mceAutocompleterReload",((e,t)=>{const o=p(t)?t.fetchOptions:{};i(o)})),e.addCommand("mceAutocompleterClose",r),((e,t)=>{const o=li(t.load,50);e.on("keypress compositionend",(e=>{27!==e.which&&o.throttle()})),e.on("keydown",(e=>{const n=e.which;8===n?o.throttle():27===n&&t.cancelIfNecessary()})),e.on("remove",o.cancel)})(e,{cancelIfNecessary:r,load:i})},ED=St().browser.isSafari(),TD=e=>Rr(yo.fromDom(e)),OD=(e,t)=>{var o;return 0===e.startOffset&&e.endOffset===(null===(o=t.textContent)||void 0===o?void 0:o.length)},DD=(e,t)=>F.from(e.getParent(t.container(),"details")),AD=(e,t)=>DD(e,t).isSome(),MD=(e,t)=>t.startSummary.exists((t=>((e,t)=>Gm(t).exists((t=>t.isEqual(e))))(e,t))),ND=(e,t)=>t.startSummary.exists((t=>((e,t)=>Km(t).exists((o=>ir(o.getNode())&&qm(t,o).exists((t=>t.isEqual(e)))||o.isEqual(e))))(e,t))),RD=(e,t)=>{const o=t.getNode();w(o)||e.selection.setCursorLocation(o,t.offset())},BD=(e,t,o)=>{const n=e.dom.getParent(t.container(),"details");if(n&&!n.open){const t=e.dom.select("summary",n)[0];t&&(o?Gm(t):Km(t)).each((t=>RD(e,t)))}else RD(e,t)},LD=(e,t,o)=>{const{dom:n,selection:r}=e,s=e.getBody();if("character"===o){const o=rl.fromRangeStart(r.getRng()),a=n.getParent(o.container(),n.isBlock),i=DD(n,o),l=a&&n.isEmpty(a),c=b(null==a?void 0:a.previousSibling),d=b(null==a?void 0:a.nextSibling);return!!(l&&(t?d:c)&&Um(!t,s,o).exists((e=>AD(n,e)&&!Ht(i,DD(n,e)))))||Um(t,s,o).fold(I,(o=>{const r=DD(n,o);if(AD(n,o)&&!Ht(i,r)){if(t||BD(e,o,!1),a&&l){if(t&&c)return!0;if(!t&&d)return!0;BD(e,o,t),e.dom.remove(a)}return!0}return!1}))}return!1},HD=(e,t,o,n)=>{const r=e.selection.getRng(),s=rl.fromRangeStart(r),a=e.getBody();return"selection"===n?((e,t)=>{const o=t.startSummary.exists((t=>t.contains(e.startContainer))),n=t.startSummary.exists((t=>t.contains(e.endContainer))),r=t.startDetails.forall((e=>t.endDetails.forall((t=>e!==t))));return(o||n)&&!(o&&n)||r})(r,t):o?ND(s,t)||((e,t,o)=>o.startDetails.exists((o=>$m(e,t).forall((e=>!o.contains(e.container()))))))(a,s,t):MD(s,t)||((e,t)=>t.startDetails.exists((o=>qm(o,e).forall((o=>t.startSummary.exists((t=>!t.contains(e.container())&&t.contains(o.container()))))))))(s,t)},ID=(e,t,o)=>((e,t)=>{const o=F.from(e.getParent(t.startContainer,"details")),n=F.from(e.getParent(t.endContainer,"details"));if(o.isSome()||n.isSome()){const t=o.bind((t=>F.from(e.select("summary",t)[0])));return F.some({startSummary:t,startDetails:o,endDetails:n})}return F.none()})(e.dom,e.selection.getRng()).fold((()=>LD(e,t,o)),(n=>HD(e,n,t,o)||LD(e,t,o))),PD=(e,t,o)=>{const n=e.selection,r=n.getNode(),s=n.getRng(),a=rl.fromRangeStart(s);return!!fr(r)&&("selection"===o&&OD(s,r)||yv(t,a,r)?TD(r):e.undoManager.transact((()=>{const s=n.getSel();let{anchorNode:a,anchorOffset:i,focusNode:l,focusOffset:c}=null!=s?s:{};const d=()=>{C(a)&&C(i)&&C(l)&&C(c)&&(null==s||s.setBaseAndExtent(a,i,l,c))},m=(e,t)=>{q(e.childNodes,(e=>{Ou(e)&&t.appendChild(e)}))},u=e.dom.create("span",{"data-mce-bogus":"1"});m(r,u),r.appendChild(u),d(),"word"!==o&&"line"!==o||null==s||s.modify("extend",t?"right":"left",o),!n.isCollapsed()&&OD(n.getRng(),u)?TD(r):(e.execCommand(t?"ForwardDelete":"Delete"),a=null==s?void 0:s.anchorNode,i=null==s?void 0:s.anchorOffset,l=null==s?void 0:s.focusNode,c=null==s?void 0:s.focusOffset,m(u,r),d()),e.dom.remove(u)})),!0)},FD=(e,t,o)=>ID(e,t,o)||ED&&PD(e,t,o)?F.some(E):F.none(),zD=e=>(t,o,n={})=>{const r=t.getBody(),s={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:r,currentTarget:r,eventPhase:Event.AT_TARGET,originalTarget:r,explicitOriginalTarget:r,isTrusted:!1,srcElement:r,cancelable:!1,preventDefault:E,inputType:o},a=Ra(new InputEvent(e));return t.dispatch(e,{...a,...s,...n})},VD=zD("input"),ZD=zD("beforeinput"),UD=St(),jD=UD.os,WD=jD.isMacOS()||jD.isiOS(),$D=UD.browser.isFirefox(),qD=(e,t)=>{let o=!1;e.on("keydown",(n=>{o=n.keyCode===Dg.BACKSPACE,n.isDefaultPrevented()||((e,t,o)=>{const n=o.keyCode===Dg.BACKSPACE?"deleteContentBackward":"deleteContentForward",r=e.selection.isCollapsed(),s=r?"character":"selection",a=e=>r?e?"word":"line":"selection";cT([{keyCode:Dg.BACKSPACE,action:iT(TE,e)},{keyCode:Dg.BACKSPACE,action:iT(Ok,e,!1)},{keyCode:Dg.DELETE,action:iT(Ok,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(vk,e,!1)},{keyCode:Dg.DELETE,action:iT(vk,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(oE,e,t,!1)},{keyCode:Dg.DELETE,action:iT(oE,e,t,!0)},{keyCode:Dg.BACKSPACE,action:iT(eb,e,!1)},{keyCode:Dg.DELETE,action:iT(eb,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(FD,e,!1,s)},{keyCode:Dg.DELETE,action:iT(FD,e,!0,s)},...WD?[{keyCode:Dg.BACKSPACE,altKey:!0,action:iT(FD,e,!1,a(!0))},{keyCode:Dg.DELETE,altKey:!0,action:iT(FD,e,!0,a(!0))},{keyCode:Dg.BACKSPACE,metaKey:!0,action:iT(FD,e,!1,a(!1))}]:[{keyCode:Dg.BACKSPACE,ctrlKey:!0,action:iT(FD,e,!1,a(!0))},{keyCode:Dg.DELETE,ctrlKey:!0,action:iT(FD,e,!0,a(!0))}],{keyCode:Dg.BACKSPACE,action:iT(Dk,e,!1)},{keyCode:Dg.DELETE,action:iT(Dk,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(yE,e,!1)},{keyCode:Dg.DELETE,action:iT(yE,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(dk,e,!1)},{keyCode:Dg.DELETE,action:iT(dk,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(ak,e,!1)},{keyCode:Dg.DELETE,action:iT(ak,e,!0)},{keyCode:Dg.BACKSPACE,action:iT(hE,e,!1)},{keyCode:Dg.DELETE,action:iT(hE,e,!0)}],o).filter((t=>e.selection.isEditable())).each((t=>{o.preventDefault(),ZD(e,n).isDefaultPrevented()||(t(),VD(e,n))}))})(e,t,n)})),e.on("keyup",(t=>{t.isDefaultPrevented()||((e,t,o)=>{lT([{keyCode:Dg.BACKSPACE,action:iT(Tk,e)},{keyCode:Dg.DELETE,action:iT(Tk,e)},...WD?[{keyCode:Dg.BACKSPACE,altKey:!0,action:iT(vE,e)},{keyCode:Dg.DELETE,altKey:!0,action:iT(vE,e)},...o?[{keyCode:$D?224:91,action:iT(vE,e)}]:[]]:[{keyCode:Dg.BACKSPACE,ctrlKey:!0,action:iT(vE,e)},{keyCode:Dg.DELETE,ctrlKey:!0,action:iT(vE,e)}]],t)})(e,t,o),o=!1}))},GD=(e,t)=>{const o=e.dom,n=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(Wn(e)||tr(e)&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}return null})(t.firstChild);e&&/^(UL|OL|DL)$/.test(e.nodeName)&&t.insertBefore(o.doc.createTextNode(br),t.firstChild)}const r=o.createRng();if(t.normalize(),t.hasChildNodes()){const e=new Zn(t,t);let o,s=t;for(;o=e.current();){if(tr(o)){r.setStart(o,0),r.setEnd(o,0);break}if(n[o.nodeName.toLowerCase()]){r.setStartBefore(o),r.setEndBefore(o);break}s=o,o=e.next()}o||(r.setStart(s,0),r.setEnd(s,0))}else ir(t)?t.nextSibling&&o.isBlock(t.nextSibling)?(r.setStartBefore(t),r.setEndBefore(t)):(r.setStartAfter(t),r.setEndAfter(t)):(r.setStart(t,0),r.setEnd(t,0));e.selection.setRng(r),Rh(e,r)},KD=(e,t)=>{const o=e.getRoot();let n,r=t;for(;r!==o&&r&&"false"!==e.getContentEditable(r);){if("true"===e.getContentEditable(r)){n=r;break}r=r.parentNode}return r!==o?n:o},YD=e=>F.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),XD=e=>{e.innerHTML='
    '},JD=(e,t)=>{Xl(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,o)=>{const n=e.dom;F.from(o.style).map(n.parseStyle).each((e=>{const o={...gn(yo.fromDom(t)),...e};n.setStyles(t,o)}));const r=F.from(o.class).map((e=>e.split(/\s+/))),s=F.from(t.className).map((e=>Y(e.split(/\s+/),(e=>""!==e))));It(r,s,((e,o)=>{const r=Y(o,(t=>!j(e,t))),s=[...e,...r];n.setAttrib(t,"class",s.join(" "))}));const a=["style","class"],i=xe(o,((e,t)=>!j(a,t)));n.setAttribs(t,i)})(e,t,Jl(e))},QD=(e,t,o,n,r=!0,s,a)=>{const i=e.dom,l=e.schema,c=Xl(e),d=o?o.nodeName.toUpperCase():"";let m=t;const u=l.getTextInlineElements();let g;g=s||"TABLE"===d||"HR"===d?i.create(s||c,a||{}):o.cloneNode(!1);let h=g;if(r){do{if(u[m.nodeName]){if(Xm(m)||mu(m))continue;const e=m.cloneNode(!1);i.setAttrib(e,"id",""),g.hasChildNodes()?(e.appendChild(g.firstChild),g.appendChild(e)):(h=e,g.appendChild(e))}}while((m=m.parentNode)&&m!==n)}else i.setAttrib(g,"style",null),i.setAttrib(g,"class",null);return JD(e,g),XD(h),g},eA=(e,t,o)=>!t&&o.nodeName.toLowerCase()===Xl(e)&&e.dom.isEmpty(o)&&((e,t,o)=>{let n=t;for(;n&&n!==e&&b(n.nextSibling);){const e=n.parentElement;if(!e||!o(e))return pr(e);n=e}return!1})(e.getBody(),o,(t=>_e(e.schema.getTextBlockElements(),t.nodeName.toLowerCase()))),tA=(e,t,o)=>{var n,r,s;const a=t(Xl(e)),i=((e,t)=>e.dom.getParent(t,pr))(e,o);i&&(e.dom.insertAfter(a,i),GD(e,a),(null!==(s=null===(r=null===(n=o.parentElement)||void 0===n?void 0:n.childNodes)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>1&&e.dom.remove(o))},oA=(e,t)=>{const o=null==e?void 0:e.parentNode;return C(o)&&o.nodeName===t},nA=e=>C(e)&&/^(OL|UL|LI)$/.test(e.nodeName),rA=e=>C(e)&&/^(LI|DT|DD)$/.test(e.nodeName),sA=e=>{const t=e.parentNode;return rA(t)?t:e},aA=(e,t,o)=>{let n=e[o?"firstChild":"lastChild"];for(;n&&!Wn(n);)n=n[o?"nextSibling":"previousSibling"];return n===t},iA=e=>J(Ce(gn(yo.fromDom(e)),((e,t)=>`${t}: ${e};`)),((e,t)=>e+t),""),lA=(e,t,o,n,r)=>{const s=e.dom,a=e.selection.getRng(),i=o.parentNode;if(o===e.getBody()||!i)return;var l;nA(l=o)&&nA(l.parentNode)&&(r="LI");const c=rA(n)?iA(n):void 0;let d=rA(n)&&c?t(r,{style:iA(n)}):t(r);if(aA(o,n,!0)&&aA(o,n,!1))if(oA(o,"LI")){const e=sA(o);s.insertAfter(d,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(o)?s.remove(e):s.remove(o)}else s.replace(d,o);else if(aA(o,n,!0))oA(o,"LI")?(s.insertAfter(d,sA(o)),d.appendChild(s.doc.createTextNode(" ")),d.appendChild(o)):i.insertBefore(d,o),s.remove(n);else if(aA(o,n,!1))s.insertAfter(d,sA(o)),s.remove(n);else{o=sA(o);const e=a.cloneRange();e.setStartAfter(n),e.setEndAfter(o);const t=e.extractContents();if("LI"===r&&((e,t)=>e.firstChild&&e.firstChild.nodeName===t)(t,"LI")){const e=Y($(d.children,yo.fromDom),R(Jt("br")));d=t.firstChild,s.insertAfter(t,o),q(e,(e=>vn(yo.fromDom(d),e))),c&&d.setAttribute("style",c)}else s.insertAfter(t,o),s.insertAfter(d,o);s.remove(n)}GD(e,d)},cA=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),dA=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,mA=(e,t)=>C(t)&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&e.isEditable(t.parentNode)&&"false"!==e.getContentEditable(t),uA=(e,t,o)=>tr(t)?e?1===o&&t.data.charAt(o-1)===Br?0:o:o===t.data.length-1&&t.data.charAt(o)===Br?t.data.length:o:o,gA={insert:(e,t)=>{let o,n,r,s,a=!1;const i=e.dom,l=e.schema.getNonEmptyElements(),c=e.selection.getRng(),d=Xl(e),m=yo.fromDom(c.startContainer),u=Ho(m,c.startOffset),g=u.exists((e=>qt(e)&&!nn(e))),p=c.collapsed&&g,f=(t,n)=>QD(e,o,k,S,oc(e),t,n),v=e=>{const t=uA(e,o,n);if(tr(o)&&(e?t>0:t{let t;return t=/^(H[1-6]|PRE|FIGURE)$/.test(r)&&"HGROUP"!==_?f(d):f(),((e,t)=>{const o=nc(e);return!x(t)&&(h(o)?j(Bt.explode(o),t.nodeName.toLowerCase()):o)})(e,s)&&mA(i,s)&&i.isEmpty(k,void 0,{includeZwsp:!0})?t=i.split(s,k):i.insertAfter(t,k),GD(e,t),t};lh(i,c).each((e=>{c.setStart(e.startContainer,e.startOffset),c.setEnd(e.endContainer,e.endOffset)})),o=c.startContainer,n=c.startOffset;const y=!(!t||!t.shiftKey),w=!(!t||!t.ctrlKey);Wn(o)&&o.hasChildNodes()&&!p&&(a=n>o.childNodes.length-1,o=o.childNodes[Math.min(n,o.childNodes.length-1)]||o,n=a&&tr(o)?o.data.length:0);const S=KD(i,o);if(!S||((e,t)=>{const o=e.dom.getParent(t,"ol,ul,dl");return null!==o&&"false"===e.dom.getContentEditableParent(o)})(e,o))return;y||(o=((e,t,o,n,r)=>{var s,a;const i=e.dom,l=null!==(s=KD(i,n))&&void 0!==s?s:i.getRoot();let c=i.getParent(n,i.isBlock);if(!c||!mA(i,c)){if(c=c||l,!c.hasChildNodes()){const n=i.create(t);return JD(e,n),c.appendChild(n),o.setStart(n,0),o.setEnd(n,0),n}let s,d=n;for(;d&&d.parentNode!==c;)d=d.parentNode;for(;d&&!i.isBlock(d);)s=d,d=d.previousSibling;const m=null===(a=null==s?void 0:s.parentElement)||void 0===a?void 0:a.nodeName;if(s&&m&&e.schema.isValidChild(m,t.toLowerCase())){const a=s.parentNode,l=i.create(t);for(JD(e,l),a.insertBefore(l,s),d=s;d&&!i.isBlock(d);){const e=d.nextSibling;l.appendChild(d),d=e}o.setStart(n,r),o.setEnd(n,r)}}return n})(e,d,c,o,n));let k=i.getParent(o,i.isBlock)||i.getRoot();s=C(null==k?void 0:k.parentNode)?i.getParent(k.parentNode,i.isBlock):null,r=k?k.nodeName.toUpperCase():"";const _=s?s.nodeName.toUpperCase():"";if("LI"!==_||w||(k=s,s=s.parentNode,r=_),Wn(s)&&eA(e,y,k))return tA(e,f,k);if(/^(LI|DT|DD)$/.test(r)&&Wn(s)&&i.isEmpty(k))return void lA(e,f,s,k,d);if(!(p||k!==e.getBody()&&mA(i,k)))return;const E=k.parentNode;let T;if(p)T=f(d),u.fold((()=>{bn(m,yo.fromDom(T))}),(e=>{pn(e,yo.fromDom(T))})),e.selection.setCursorLocation(T,0);else if(Fr(k))T=qr(k),i.isEmpty(k)&&XD(k),JD(e,T),GD(e,T);else if(v(!1))T=b();else if(v(!0)&&E){T=E.insertBefore(f(),k);const t=yo.fromDom(c.startContainer).dom.hasChildNodes()&&c.collapsed;GD(e,dA(k,"HR")||t?T:k)}else{const t=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,uA(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,uA(!1,e.endContainer,e.endOffset)),t})(c).cloneRange();t.setEndAfter(k);const o=t.extractContents();(e=>{q(Fn(yo.fromDom(e),Kt),(e=>{const t=e.dom;t.nodeValue=Hr(t.data)}))})(o),(e=>{let t=e;do{tr(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild}while(t)})(o),T=o.firstChild,i.insertAfter(o,k),((e,t,o)=>{var n;const r=[];if(!o)return;let s=o;for(;s=s.firstChild;){if(e.isBlock(s))return;Wn(s)&&!t[s.nodeName.toLowerCase()]&&r.push(s)}let a=r.length;for(;a--;)s=r[a],(!s.hasChildNodes()||s.firstChild===s.lastChild&&""===(null===(n=s.firstChild)||void 0===n?void 0:n.nodeValue)||cA(e,s))&&e.remove(s)})(i,l,T),((e,t)=>{t.normalize();const o=t.lastChild;(!o||Wn(o)&&/^(left|right)$/gi.test(e.getStyle(o,"float",!0)))&&e.add(t,"br")})(i,k),i.isEmpty(k)&&XD(k),T.normalize(),i.isEmpty(T)?(i.remove(T),b()):(JD(e,T),GD(e,T))}i.setAttrib(T,"id",""),e.dispatch("NewBlock",{newBlock:T})},fakeEventName:"insertParagraph"},hA=(e,t,o)=>{const n=e.dom.createRng();o?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),e.selection.setRng(n),Rh(e,n)},pA=(e,t)=>{const o=e.selection,n=e.dom,r=o.getRng();let s,a=!1;lh(n,r).each((e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)}));let i=r.startOffset,l=r.startContainer;if(Wn(l)&&l.hasChildNodes()){const e=i>l.childNodes.length-1;l=l.childNodes[Math.min(i,l.childNodes.length-1)]||l,i=e&&tr(l)?l.data.length:0}let c=n.getParent(l,n.isBlock);const d=c&&c.parentNode?n.getParent(c.parentNode,n.isBlock):null,m=d?d.nodeName.toUpperCase():"",u=!(!t||!t.ctrlKey);"LI"!==m||u||(c=d),tr(l)&&i>=l.data.length&&(((e,t,o)=>{const n=new Zn(t,o);let r;const s=e.getNonEmptyElements();for(;r=n.next();)if(s[r.nodeName.toLowerCase()]||tr(r)&&r.length>0)return!0;return!1})(e.schema,l,c||n.getRoot())||(s=n.create("br"),r.insertNode(s),r.setStartAfter(s),r.setEndAfter(s),a=!0)),s=n.create("br"),al(n,r,s),hA(e,s,a),e.undoManager.add()},fA=(e,t)=>{const o=yo.fromTag("br");pn(yo.fromDom(t),o),e.undoManager.add()},vA=(e,t)=>{bA(e.getBody(),t)||fn(yo.fromDom(t),yo.fromTag("br"));const o=yo.fromTag("br");fn(yo.fromDom(t),o),hA(e,o.dom,!1),e.undoManager.add()},bA=(e,t)=>{return o=rl.after(t),!!ir(o.getNode())||$m(e,rl.after(t)).map((e=>ir(e.getNode()))).getOr(!1);var o},yA=e=>e&&"A"===e.nodeName&&"href"in e,wA=e=>e.fold(I,yA,yA,I),xA=(e,t)=>{t.fold(E,N(fA,e),N(vA,e),E)},CA={insert:(e,t)=>{const o=(e=>{const t=N(lv,e),o=rl.fromRangeStart(e.selection.getRng());return Yk(t,e.getBody(),o).filter(wA)})(e);o.isSome()?o.each(N(xA,e)):pA(e,t)},fakeEventName:"insertLineBreak"},SA=(e,t)=>YD(e).filter((e=>t.length>0&&xo(yo.fromDom(e),t))).isSome(),kA=Al([{br:[]},{block:[]},{none:[]}]),_A=(e,t)=>(e=>SA(e,tc(e)))(e),EA=e=>(t,o)=>(e=>YD(e).filter((e=>Tr(yo.fromDom(e)))).isSome())(t)===e,TA=(e,t)=>(o,n)=>{const r=(e=>YD(e).fold(D(""),(e=>e.nodeName.toUpperCase())))(o)===e.toUpperCase();return r===t},OA=e=>{const t=KD(e.dom,e.selection.getStart());return x(t)},DA=e=>TA("pre",e),AA=e=>(t,o)=>Yl(t)===e,MA=(e,t)=>(e=>SA(e,ec(e)))(e),NA=(e,t)=>t,RA=e=>{const t=Xl(e),o=KD(e.dom,e.selection.getStart());return C(o)&&e.schema.isValidChild(o.nodeName,t)},BA=e=>{const t=e.selection.getRng(),o=yo.fromDom(t.startContainer),n=Ho(o,t.startOffset).map((e=>qt(e)&&!nn(e)));return t.collapsed&&n.getOr(!0)},LA=(e,t)=>(o,n)=>J(e,((e,t)=>e&&t(o,n)),!0)?F.some(t):F.none(),HA=(e,t,o)=>{t.selection.isCollapsed()||(e=>{e.execCommand("delete")})(t),C(o)&&ZD(t,e.fakeEventName).isDefaultPrevented()||(e.insert(t,o),C(o)&&VD(t,e.fakeEventName))},IA=(e,t)=>{const o=()=>HA(CA,e,t),n=()=>HA(gA,e,t),r=((e,t)=>zk([LA([_A],kA.none()),LA([DA(!0),OA],kA.none()),LA([TA("summary",!0)],kA.br()),LA([DA(!0),AA(!1),NA],kA.br()),LA([DA(!0),AA(!1)],kA.block()),LA([DA(!0),AA(!0),NA],kA.block()),LA([DA(!0),AA(!0)],kA.br()),LA([EA(!0),NA],kA.br()),LA([EA(!0)],kA.block()),LA([MA],kA.br()),LA([NA],kA.br()),LA([RA],kA.block()),LA([BA],kA.block())],[e,!(!t||!t.shiftKey)]).getOr(kA.none()))(e,t);switch(Ql(e)){case"linebreak":r.fold(o,o,E);break;case"block":r.fold(n,n,E);break;case"invert":r.fold(n,o,E);break;default:r.fold(o,n,E)}},PA=St(),FA=PA.os.isiOS()&&PA.browser.isSafari(),zA=(e,t)=>{var o;t.isDefaultPrevented()||(t.preventDefault(),(o=e.undoManager).typing&&(o.typing=!1,o.add()),e.undoManager.transact((()=>{IA(e,t)})))},VA=e=>{let t=F.none();e.on("keydown",(o=>{o.keyCode===Dg.ENTER&&(FA&&(e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(tr(t)){const o=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,n=t.data.charAt(e.startOffset-1);return o.test(n)}return!1})(e.selection.getRng())?(e=>{t=F.some(e.selection.getBookmark()),e.undoManager.add()})(e):zA(e,o))})),e.on("keyup",(o=>{o.keyCode===Dg.ENTER&&t.each((()=>((e,o)=>{e.undoManager.undo(),t.fold(E,(t=>e.selection.moveToBookmark(t))),zA(e,o),t=F.none()})(e,o)))}))},ZA=(e,t)=>{e.on("keydown",(o=>{o.isDefaultPrevented()||((e,t,o)=>{const n=At.os.isMacOS()||At.os.isiOS();lT([{keyCode:Dg.END,action:iT(YE,e,!0)},{keyCode:Dg.HOME,action:iT(YE,e,!1)},...n?[]:[{keyCode:Dg.HOME,action:iT(XE,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Dg.END,action:iT(XE,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Dg.END,action:iT(uT,e,!0)},{keyCode:Dg.HOME,action:iT(uT,e,!1)},{keyCode:Dg.END,action:iT(J_,e,!0,t)},{keyCode:Dg.HOME,action:iT(J_,e,!1,t)}],o).each((e=>{o.preventDefault()}))})(e,t,o)}))},UA=e=>{e.on("input",(t=>{t.isComposing||(e=>{const t=yo.fromDom(e.getBody());e.selection.isCollapsed()&&$f(t,rl.fromRangeStart(e.selection.getRng()),e.schema).each((t=>{e.selection.setRng(t.toRange())}))})(e)}))},jA=St(),WA=e=>e.stopImmediatePropagation(),$A=e=>e.keyCode===Dg.PAGE_UP||e.keyCode===Dg.PAGE_DOWN,qA=(e,t,o)=>{o&&!e.get()?t.on("NodeChange",WA,!0):!o&&e.get()&&t.off("NodeChange",WA),e.set(o)},GA=(e,t)=>{if(jA.os.isMacOS())return;const o=Qa(!1);e.on("keydown",(t=>{$A(t)&&qA(o,e,!0)})),e.on("keyup",(n=>{n.isDefaultPrevented()||((e,t,o)=>{lT([{keyCode:Dg.PAGE_UP,action:iT(J_,e,!1,t)},{keyCode:Dg.PAGE_DOWN,action:iT(J_,e,!0,t)}],o)})(e,t,n),$A(n)&&o.get()&&(qA(o,e,!1),e.nodeChanged())}))},KA=(e,t)=>{const o=t.container(),n=t.offset();return tr(o)?(o.insertData(n,e),F.some(rl(o,n+e.length))):Sm(t).map((o=>{const n=yo.fromText(e);return t.isAtEnd()?fn(o,n):pn(o,n),rl(n.dom,e.length)}))},YA=N(KA,br),XA=N(KA," "),JA=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},QA=e=>{const t=rl.fromRangeStart(e.selection.getRng()),o=yo.fromDom(e.getBody());if(e.selection.isCollapsed()){const n=N(lv,e),r=rl.fromRangeStart(e.selection.getRng());return Yk(n,e.getBody(),r).bind((e=>t=>t.fold((t=>qm(e.dom,rl.before(t))),(e=>Gm(e)),(e=>Km(e)),(t=>$m(e.dom,rl.after(t)))))(o)).map((n=>()=>((e,t,o)=>n=>If(e,n,o)?YA(t):XA(t))(o,t,e.schema)(n).each(JA(e))))}return F.none()},eM=e=>{return Pt(At.browser.isFirefox()&&e.selection.isEditable()&&(t=e.dom,o=e.selection.getRng().startContainer,t.isEditable(t.getParent(o,"summary"))),(()=>{const t=yo.fromDom(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete"),((e,t,o)=>If(e,t,o)?YA(t):XA(t))(t,rl.fromRangeStart(e.selection.getRng()),e.schema).each(JA(e))}));var t,o},tM=e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{cT([{keyCode:Dg.SPACEBAR,action:iT(QA,e)},{keyCode:Dg.SPACEBAR,action:iT(eM,e)}],t).each((o=>{t.preventDefault(),ZD(e,"insertText",{data:" "}).isDefaultPrevented()||(o(),VD(e,"insertText",{data:" "}))}))})(e,t)}))},oM=e=>Ad(e)?[{keyCode:Dg.TAB,action:iT(FT,e,!0)},{keyCode:Dg.TAB,shiftKey:!0,action:iT(FT,e,!1)}]:[],nM=e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{lT([...oM(e)],t).each((e=>{t.preventDefault()}))})(e,t)}))},rM=e=>{if(e.addShortcut("Meta+P","","mcePrint"),_D(e),fC(e))return Qa(null);{const t=K_(e);return(e=>{e.on("beforeinput",(t=>{e.selection.isEditable()&&!W(t.getTargetRanges(),(t=>!dp(e.dom,t)))||t.preventDefault()}))})(e),(e=>{e.on("keyup compositionstart",N(UE,e))})(e),zT(e,t),qD(e,t),VA(e),tM(e),UA(e),nM(e),ZA(e,t),GA(e,t),t}};class sM{constructor(e){let t;this.lastPath=[],this.editor=e;const o=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",(o=>{const n=e.selection.getRng(),r={startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset};"nodechange"!==o.type&&th(r,t)||e.dispatch("SelectionChange"),t=r})),e.on("contextmenu",(()=>{e.dispatch("SelectionChange")})),e.on("SelectionChange",(()=>{const t=e.selection.getStart(!0);t&&_u(e)&&!o.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})})),e.on("mouseup",(t=>{!t.isDefaultPrevented()&&_u(e)&&("IMG"===e.selection.getNode().nodeName?qh.setEditorTimeout(e,(()=>{e.nodeChanged()})):e.nodeChanged())}))}nodeChanged(e={}){const t=this.editor.selection;let o;if(this.editor.initialized&&t&&!Wc(this.editor)&&!this.editor.mode.isReadOnly()){const n=this.editor.getBody();o=t.getStart(!0)||n,o.ownerDocument===this.editor.getDoc()&&this.editor.dom.isChildOf(o,n)||(o=n);const r=[];this.editor.dom.getParent(o,(e=>e===n||(r.push(e),!1))),this.editor.dispatch("NodeChange",{...e,element:o,parents:r})}}isSameElementPath(e){let t;const o=this.editor,n=se(o.dom.getParents(e,P,o.getBody()));if(n.length===this.lastPath.length){for(t=n.length;t>=0&&n[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=n,!0}return this.lastPath=n,!1}}const aM=Ci("image"),iM=Ci("event"),lM=e=>t=>{t[iM]=e},cM=lM(0),dM=lM(2),mM=lM(1),uM=(gM=0,e=>{const t=e;return F.from(t[iM]).exists((e=>e===gM))});var gM;const hM=Ci("mode"),pM=e=>t=>{t[hM]=e},fM=(e,t)=>pM(t)(e),vM=pM(0),bM=pM(2),yM=pM(1),wM=e=>t=>{const o=t;return F.from(o[hM]).exists((t=>t===e))},xM=wM(0),CM=wM(1),SM=["none","copy","link","move"],kM=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],_M=()=>{const e=new window.DataTransfer;let t="move",o="all";const n={get dropEffect(){return t},set dropEffect(e){j(SM,e)&&(t=e)},get effectAllowed(){return o},set effectAllowed(e){uM(n)&&j(kM,e)&&(o=e)},get items(){return((e,t)=>({...t,get length(){return t.length},add:(o,n)=>{if(xM(e)){if(!h(o))return t.add(o);if(!w(n))return t.add(o,n)}return null},remove:o=>{xM(e)&&t.remove(o)},clear:()=>{xM(e)&&t.clear()}}))(n,e.items)},get files(){return CM(n)?Object.freeze({length:0,item:e=>null}):e.files},get types(){return e.types},setDragImage:(t,o,r)=>{var s;xM(n)&&(s={image:t,x:o,y:r},n[aM]=s,e.setDragImage(t,o,r))},getData:t=>CM(n)?"":e.getData(t),setData:(t,o)=>{xM(n)&&e.setData(t,o)},clearData:t=>{xM(n)&&e.clearData(t)}};return vM(n),n},EM=e=>{const t=_M(),o=(e=>{const t=e;return F.from(t[hM])})(e);return bM(e),cM(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,(e=>{const t=e;return F.from(t[aM])})(e).each((e=>t.setDragImage(e.image,e.x,e.y))),q(e.types,(o=>{"Files"!==o&&t.setData(o,e.getData(o))})),q(e.files,(e=>t.items.add(e))),(e=>{const t=e;return F.from(t[iM])})(e).each((e=>{((e,t)=>{lM(t)(e)})(t,e)})),o.each((o=>{fM(e,o),fM(t,o)})),t},TM=(e,t)=>e.setData("text/html",t),OM="x-tinymce/html",DM=D(OM),AM="\x3c!-- "+OM+" --\x3e",MM=e=>AM+e,NM=e=>-1!==e.indexOf(AM),RM=(e,t,o)=>{const n=e.split(/\n\n/),r=((e,t)=>{let o="<"+e;const n=Ce(t,((e,t)=>t+'="'+ia.encodeAllRaw(e)+'"'));return n.length&&(o+=" "+n.join(" ")),o+">"})(t,o),s="",a=$(n,(e=>e.split(/\n/).join("
    ")));return 1===a.length?a[0]:$(a,(e=>r+e+s)).join("")},BM="%MCEPASTEBIN%",LM=e=>e.dom.get("mcepastebin"),HM=e=>C(e)&&"mcepastebin"===e.id,IM=e=>e===BM,PM=e=>{const t=Qa(null);return{create:()=>((e,t)=>{const{dom:o,selection:n}=e,r=e.getBody();t.set(n.getRng());const s=o.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},BM);At.browser.isFirefox()&&o.setStyle(s,"left","rtl"===o.getStyle(r,"direction",!0)?65535:-65535),o.bind(s,"beforedeactivate focusin focusout",(e=>{e.stopPropagation()})),s.focus(),n.select(s,!0)})(e,t),remove:()=>((e,t)=>{const o=e.dom;if(LM(e)){let n;const r=t.get();for(;n=LM(e);)o.remove(n),o.unbind(n);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>LM(e),getHtml:()=>(e=>{const t=e.dom,o=(e,o)=>{e.appendChild(o),t.remove(o,!0)},[n,...r]=Y(e.getBody().childNodes,HM);q(r,(e=>{o(n,e)}));const s=t.select("div[id=mcepastebin]",n);for(let e=s.length-1;e>=0;e--){const r=t.create("div");n.insertBefore(r,s[e]),o(r,s[e])}return n?n.innerHTML:""})(e),getLastRng:t.get}},FM=(e,t)=>(Bt.each(t,(t=>{e=g(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])})),e),zM=e=>e=FM(e,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,(e,t,o)=>t||o?br:" "],/
    /g,/
    $/i]),VM=(e,t)=>({content:e,cancelled:t}),ZM=(e,t,o)=>{const n=((e,t,o)=>e.dispatch("PastePreProcess",{content:t,internal:o}))(e,t,o),r=((e,t)=>{const o=Mx({sanitize:Td(e),sandbox_iframes:Bd(e)},e.schema);o.addNodeFilter("meta",(e=>{Bt.each(e,(e=>{e.remove()}))}));const n=o.parse(t,{forced_root_block:!1,isRootContent:!0});return $p({validate:!0},e.schema).serialize(n)})(e,n.content);return e.hasEventListeners("PastePostProcess")&&!n.isDefaultPrevented()?((e,t,o)=>{const n=e.dom.create("div",{style:"display:none"},t),r=((e,t,o)=>e.dispatch("PastePostProcess",{node:t,internal:o}))(e,n,o);return VM(r.node.innerHTML,r.isDefaultPrevented())})(e,r,o):VM(r,n.isDefaultPrevented())},UM=(e,t)=>(e.insertContent(t,{merge:pd(e),paste:!0}),!0),jM=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),WM=(e,t,o)=>!(e.selection.isCollapsed()||!jM(t))&&((e,t,o)=>(e.undoManager.extra((()=>{o(e,t)}),(()=>{e.execCommand("mceInsertLink",!1,t)})),!0))(e,t,o),$M=(e,t,o)=>!!((e,t)=>jM(t)&&W(Dd(e),(e=>We(t.toLowerCase(),`.${e.toLowerCase()}`))))(e,t)&&((e,t,o)=>(e.undoManager.extra((()=>{o(e,t)}),(()=>{e.insertContent('')})),!0))(e,t,o),qM=(e,t,o)=>{o||!fd(e)?UM(e,t):((e,t)=>{Bt.each([WM,$M,UM],(o=>!o(e,t,UM)))})(e,t)},GM=(e=>{let t=0;return()=>e+t++})("mceclip"),KM=e=>{const t=_M();return TM(t,e),bM(t),t},YM=(e,t,o,n,r)=>{const s=((e,t,o)=>ZM(e,t,o))(e,t,o);if(!s.cancelled){const t=s.content,o=()=>qM(e,t,n);r?ZD(e,"insertFromPaste",{dataTransfer:KM(t)}).isDefaultPrevented()||(o(),VD(e,"insertFromPaste")):o()}},XM=(e,t,o,n)=>{const r=o||NM(t);YM(e,(e=>e.replace(AM,""))(t),r,!1,n)},JM=(e,t,o)=>{const n=e.dom.encode(t).replace(/\r\n/g,"\n"),r=ds(n,bd(e)),s=RM(r,Xl(e),Jl(e));YM(e,s,!1,!0,o)},QM=e=>{const t={};if(e&&e.types)for(let o=0;ot in e&&e[t].length>0,tN=e=>eN(e,"text/html")||eN(e,"text/plain"),oN=(e,t,o,n)=>{const r=GM(),s=sc(e)&&C(o.name),a=s?((e,t)=>{const o=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return C(o)?e.dom.encode(o[1]):void 0})(e,o.name):r,i=s?o.name:void 0,l=t.create(r,o,n,a,i);return t.add(l),l},nN=e=>{const t=Dd(e);return e=>je(e.type,"image/")&&W(t,(t=>(e=>{const t=e.toLowerCase(),o={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Bt.hasOwn(o,t)?"image/"+o[t]:"image/"+t})(t)===e.type))},rN=(e,t,o)=>{const n="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(cd(e)&&n){const s=((e,t)=>{const o=t.items?ne(ue(t.items),(e=>"file"===e.kind?[e.getAsFile()]:[])):[],n=t.files?ue(t.files):[];return Y(o.length>0?o:n,nN(e))})(e,n);if(s.length>0)return t.preventDefault(),(r=s,Promise.all($(r,(e=>aw(e).then((t=>({file:e,uri:t}))))))).then((t=>{o&&e.selection.setRng(o),q(t,(t=>{((e,t)=>{nw(t.uri).each((({data:o,type:n,base64Encoded:r})=>{const s=r?o:btoa(o),a=t.file,i=e.editorUpload.blobCache,l=i.getByData(s,n),c=null!=l?l:oN(e,i,a,s);XM(e,``,!1,!0)}))})(e,t)}))})),!0}return!1},sN=(e,t,o,n,r)=>{let s=zM(o);const a=eN(t,DM())||NM(o),i=!a&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(s),l=jM(s);(IM(s)||!s.length||i&&!l)&&(n=!0),(n||l)&&(s=eN(t,"text/plain")&&i?t["text/plain"]:(e=>{const t=ya(),o=Mx({},t);let n="";const r=t.getVoidElements(),s=Bt.makeMap("script noscript style textarea video audio iframe object"," "),a=t.getBlockElements(),i=e=>{const o=e.name,l=e;if("br"!==o){if("wbr"!==o)if(r[o]&&(n+=" "),s[o])n+=" ";else{if(3===e.type&&(n+=e.value),!(e.name in t.getVoidElements())){let t=e.firstChild;if(t)do{i(t)}while(t=t.next)}a[o]&&l.next&&(n+="\n","p"===o&&(n+="\n"))}}else n+="\n"};return e=FM(e,[//g]),i(o.parse(e)),n})(s)),IM(s)||(n?JM(e,s,r):XM(e,s,a,r))},aN=(e,t,o)=>{let n;e.on("keydown",(e=>{(e=>Dg.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(n=e.shiftKey&&86===e.keyCode)})),e.on("paste",(r=>{if(r.isDefaultPrevented()||(e=>{var t,o;return At.os.isAndroid()&&0===(null===(o=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===o?void 0:o.length)})(r))return;const s="text"===o.get()||n;n=!1;const a=QM(r.clipboardData);!tN(a)&&rN(e,r,t.getLastRng()||e.selection.getRng())||(eN(a,"text/html")?(r.preventDefault(),sN(e,a,a["text/html"],s,!0)):eN(a,"text/plain")&&eN(a,"text/uri-list")?(r.preventDefault(),sN(e,a,a["text/plain"],s,!0)):(t.create(),qh.setEditorTimeout(e,(()=>{const o=t.getHtml();t.remove(),sN(e,a,o,s,!1)}),0)))}))},iN=(e,t,o)=>{aN(e,t,o),(e=>{const t=e=>je(e,"webkit-fake-url"),o=e=>je(e,"data:");e.parser.addNodeFilter("img",((n,r,s)=>{if(!cd(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(s))for(const r of n){const n=r.attr("src");h(n)&&!r.attr("data-mce-object")&&n!==At.transparentSrc&&(t(n)||!yd(e)&&o(n))&&r.remove()}}))})(e)},lN=(e,t)=>{e.addCommand("mceTogglePlainTextPaste",(()=>{((e,t)=>{"text"===t.get()?(t.set("html"),Og(e,!1)):(t.set("text"),Og(e,!0)),e.focus()})(e,t)})),e.addCommand("mceInsertClipboardContent",((t,o)=>{o.html&&XM(e,o.html,o.internal,!1),o.text&&JM(e,o.text,!1)}))},cN=(e,t,o,n)=>{((e,t,o)=>{if(!e)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",o),e.setData(DM(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),n()):o(t.html,n)},dN=e=>(t,o)=>{const{dom:n,selection:r}=e,s=n.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=n.create("div",{contenteditable:"true"},t);n.setStyles(s,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),s.appendChild(a),n.add(e.getBody(),s);const i=r.getRng();a.focus();const l=n.createRng();l.selectNodeContents(a),r.setRng(l),qh.setEditorTimeout(e,(()=>{r.setRng(i),n.remove(s),o()}),0)},mN=e=>({html:MM(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),uN=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),gN=e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&uN(e)&&e.selection.isEditable()&&cN(t,mN(e),dN(e),(()=>{if(At.browser.isChromium()||At.browser.isFirefox()){const t=e.selection.getRng();qh.setEditorTimeout(e,(()=>{e.selection.setRng(t),e.execCommand("Delete")}),0)}else e.execCommand("Delete")}))})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&uN(e)&&cN(t,mN(e),dN(e),E)})(e))},hN=(e,t)=>{var o,n;return mh.getCaretRangeFromPoint(null!==(o=t.clientX)&&void 0!==o?o:0,null!==(n=t.clientY)&&void 0!==n?n:0,e.getDoc())},pN=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},fN=(e,t)=>{ld(e)&&e.on("dragend dragover draggesture dragdrop drop drag",(e=>{e.preventDefault(),e.stopPropagation()})),cd(e)||e.on("drop",(e=>{const t=e.dataTransfer;t&&(e=>W(e.files,(e=>/^image\//.test(e.type))))(t)&&e.preventDefault()})),e.on("drop",(o=>{if(o.isDefaultPrevented())return;const n=hN(e,o);if(x(n))return;const r=QM(o.dataTransfer),s=eN(r,DM());if((!tN(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&rN(e,o,n))return;const a=r[DM()],i=a||r["text/html"]||r["text/plain"],l=((e,t,o,n)=>{const r=e.getParent(o,(e=>Ls(t,e)));if(!b(e.getParent(o,"summary")))return!0;if(r&&_e(n,"text/html")){const e=(new DOMParser).parseFromString(n["text/html"],"text/html").body;return!b(e.querySelector(r.nodeName.toLowerCase()))}return!1})(e.dom,e.schema,n.startContainer,r),c=t.get();c&&!l||i&&(o.preventDefault(),qh.setEditorTimeout(e,(()=>{e.undoManager.transact((()=>{(a||c&&l)&&e.execCommand("Delete"),pN(e,n);const t=zM(i);r["text/html"]?XM(e,t,s,!0):JM(e,t,!0)}))})))})),e.on("dragstart",(e=>{t.set(!0)})),e.on("dragover dragend",(o=>{cd(e)&&!t.get()&&(o.preventDefault(),pN(e,hN(e,o))),"dragend"===o.type&&t.set(!1)})),(e=>{e.on("input",(t=>{const o=e=>b(e.querySelector("summary"));if("deleteByDrag"===t.inputType){const t=Y(e.dom.select("details"),o);q(t,(t=>{ir(t.firstChild)&&t.firstChild.remove();const o=e.dom.create("summary");o.appendChild(Nr().dom),t.prepend(o)}))}}))})(e)},vN=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,bN=e=>Bt.trim(e).replace(vN,Da).toLowerCase(),yN=(e,t,o)=>{const n=gd(e);if(o||"all"===n||!hd(e))return t;const r=n?n.split(/[, ]/):[];if(r&&"none"!==n){const o=e.dom,n=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,((e,t,s,a)=>{const i=o.parseStyle(o.decode(s)),l={};for(let e=0;e]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,((e,t,o,n)=>t+' style="'+o+'"'+n)),t},wN=e=>{const t=Qa(!1),o=Qa(vd(e)?"text":"html"),n=PM(e);(e=>{(At.browser.isChromium()||At.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",(o=>{o.content=t(e,o.content,o.internal)}))})(e,yN)})(e),lN(e,o),(e=>{const t=t=>o=>{t(e,o)},o=dd(e);S(o)&&e.on("PastePreProcess",t(o));const n=md(e);S(n)&&e.on("PastePostProcess",t(n))})(e),e.on("PreInit",(()=>{gN(e),fN(e,t),iN(e,n,o)}))},xN=e=>{(e=>{e.on("click",(t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()}))})(e),(e=>{e.parser.addNodeFilter("details",(t=>{const o=Md(e);q(t,(e=>{"expanded"===o?e.attr("open","open"):"collapsed"===o&&e.attr("open",null)}))})),e.serializer.addNodeFilter("details",(t=>{const o=Nd(e);q(t,(e=>{"expanded"===o?e.attr("open","open"):"collapsed"===o&&e.attr("open",null)}))}))})(e)},CN=ir,SN=tr,kN=e=>dr(e.dom),_N=e=>t=>So(yo.fromDom(e),t),EN=(e,t,o)=>Xo(yo.fromDom(e),(e=>(e=>cr(e.dom))(e)||o.isBlock(jt(e))),_N(t)).getOr(yo.fromDom(t)).dom,TN=(e,t)=>Xo(yo.fromDom(e),kN,_N(t)),ON=(e,t,o)=>{const n=new Zn(e,t),r=o?n.next.bind(n):n.prev.bind(n);let s=e;for(let t=o?e:r();t&&!CN(t);t=r())ns(t)&&(s=t);return s},DN=e=>{const t=((e,t,o)=>{const n=rl.fromRangeStart(e).getNode(),r=EN(n,t,o),s=ON(n,r,!1),a=ON(n,r,!0),i=document.createRange();return TN(s,r).fold((()=>{SN(s)?i.setStart(s,0):i.setStartBefore(s)}),(e=>i.setStartBefore(e.dom))),TN(a,r).fold((()=>{SN(a)?i.setEnd(a,a.data.length):i.setEndAfter(a)}),(e=>i.setEndAfter(e.dom))),i})(e.selection.getRng(),e.getBody(),e.schema);e.selection.setRng(vb(t))};var AN;!function(e){e.Before="before",e.After="after"}(AN||(AN={}));const MN=(e,t)=>Math.abs(e.left-t),NN=(e,t)=>Math.abs(e.right-t),RN=(e,t)=>{const o=((e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)))(e,t)/Math.min(e.height,t.height);return((e,t)=>e.topt.top)(e,t)&&o>.5},BN=(e,t)=>(e=>J(e,((e,t)=>e.fold((()=>F.some(t)),(e=>{const o=Math.min(t.left,e.left),n=Math.min(t.top,e.top),r=Math.max(t.right,e.right),s=Math.max(t.bottom,e.bottom);return F.some({top:n,right:r,bottom:s,left:o,width:r-o,height:s-n})}))),F.none()))(Y(e,(e=>{return(o=t)>=(n=e).top&&o<=n.bottom;var o,n}))).fold((()=>[[],e]),(t=>{const{pass:o,fail:n}=K(e,(e=>RN(e,t)));return[o,n]})),LN=(e,t,o)=>t>e.left&&t{const r=e=>ns(e.node)?F.some(e):Wn(e.node)?HN(ue(e.node.childNodes),t,o,!1):F.none(),s=(e,s)=>{const a=le(e,((e,n)=>s(e,t,o)-s(n,t,o)));return ge(a,r).map((e=>n&&!tr(e.node)&&a.length>1?((e,n,s)=>r(n).filter((n=>Math.abs(s(e,t,o)-s(n,t,o))<2&&tr(n.node))))(e,a[1],s).getOr(e):e))},[a,i]=BN(O_(e),o),{pass:l,fail:c}=K(i,(e=>e.tops(c,Li))).orThunk((()=>s(l,Li)))},IN=(e,t,o)=>{const n=yo.fromDom(e),r=Eo(n),s=yo.fromPoint(r,t,o).filter((e=>ko(n,e))).getOr(n);return((e,t,o,n)=>{const r=(t,s)=>{const a=Y(t.dom.childNodes,R((e=>Wn(e)&&e.classList.contains("mce-drag-container"))));return s.fold((()=>HN(a,o,n,!0)),(e=>{const t=Y(a,(t=>t!==e.dom));return HN(t,o,n,!0)})).orThunk((()=>(So(t,e)?F.none():Do(t)).bind((e=>r(e,F.some(t))))))};return r(t,F.none())})(n,s,t,o)},PN=(e,t,o)=>IN(e,t,o).filter((e=>Jd(e.node))).map((e=>((e,t)=>({node:e.node,position:MN(e,t){var t,o;const n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.documentElement,a=r.defaultView;return{top:n.top+(null!==(t=null==a?void 0:a.scrollY)&&void 0!==t?t:0)-s.clientTop,left:n.left+(null!==(o=null==a?void 0:a.scrollX)&&void 0!==o?o:0)-s.clientLeft}},zN=(e,t)=>{return o=(e=>e.inline?FN(e.getBody()):{left:0,top:0})(e),n=(e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}})(e),r=((e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const o=FN(e.getContentAreaContainer()),n=(e=>{const t=e.getBody(),o=e.getDoc().documentElement,n={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||o.scrollLeft,top:t.scrollTop||o.scrollTop};return e.inline?n:r})(e);return{left:t.pageX-o.left+n.left,top:t.pageY-o.top+n.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-o.left+n.left,pageY:r.top-o.top+n.top};var o,n,r},VN=e=>({target:e,srcElement:e}),ZN=(e,t,o,n)=>{const r=((e,t)=>{const o=EM(e);return"dragstart"===t?(cM(o),vM(o)):"drop"===t?(dM(o),bM(o)):(mM(o),yM(o)),o})(o,e);return w(n)?((e,t,o)=>{const n=B("Function not supported on simulated event.");return{bubbles:!0,cancelBubble:!1,cancelable:!0,composed:!1,currentTarget:null,defaultPrevented:!1,eventPhase:0,isTrusted:!0,returnValue:!1,timeStamp:0,type:e,composedPath:n,initEvent:n,preventDefault:E,stopImmediatePropagation:E,stopPropagation:E,AT_TARGET:window.Event.AT_TARGET,BUBBLING_PHASE:window.Event.BUBBLING_PHASE,CAPTURING_PHASE:window.Event.CAPTURING_PHASE,NONE:window.Event.NONE,altKey:!1,button:0,buttons:0,clientX:0,clientY:0,ctrlKey:!1,metaKey:!1,movementX:0,movementY:0,offsetX:0,offsetY:0,pageX:0,pageY:0,relatedTarget:null,screenX:0,screenY:0,shiftKey:!1,x:0,y:0,detail:0,view:null,which:0,initUIEvent:n,initMouseEvent:n,getModifierState:n,dataTransfer:o,...VN(t)}})(e,t,r):((e,t,o,n)=>({...t,dataTransfer:n,type:e,...VN(o)}))(e,n,t,r)},UN=dr,jN=((...e)=>t=>{for(let o=0;o{const r=e.dom,s=t.cloneNode(!0);r.setStyles(s,{width:o,height:n}),r.setAttrib(s,"data-mce-selected",null);const a=r.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return r.setStyles(a,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:o,height:n}),r.setStyles(s,{margin:0,boxSizing:"border-box"}),a.appendChild(s),a},$N=(e,t)=>o=>()=>{const n="left"===e?o.scrollX:o.scrollY;o.scroll({[e]:n+t,behavior:"smooth"})},qN=$N("left",-32),GN=$N("left",32),KN=$N("top",-32),YN=$N("top",32),XN=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},JN=(e,t)=>o=>{if((e=>0===e.button)(o)){const n=ee(t.dom.getParents(o.target),jN).getOr(null);if(C(n)&&((e,t,o)=>UN(o)&&o!==t&&e.isEditable(o.parentElement))(t.dom,t.getBody(),n)){const r=t.dom.getPos(n),s=t.getBody(),a=t.getDoc().documentElement;e.set({element:n,dataTransfer:_M(),dragging:!1,screenX:o.screenX,screenY:o.screenY,maxX:(t.inline?s.scrollWidth:a.offsetWidth)-2,maxY:(t.inline?s.scrollHeight:a.offsetHeight)-2,relX:o.pageX-r.x,relY:o.pageY-r.y,width:n.offsetWidth,height:n.offsetHeight,ghost:WN(t,n,n.offsetWidth,n.offsetHeight),intervalId:si(100)})}}},QN=(e,t,o,n,r)=>{"dragstart"===t&&TM(n,e.dom.getOuterHTML(o));const s=ZN(t,o,n,r);return e.dispatch(t,s)},eR=(e,t)=>{const o=ii(((e,o)=>((e,t,o)=>{e._selectionOverrides.hideFakeCaret(),PN(e.getBody(),t,o).fold((()=>e.selection.placeCaretAt(t,o)),(n=>{const r=e._selectionOverrides.showCaret(1,n.node,n.position===AN.Before,!1);r?e.selection.setRng(r):e.selection.placeCaretAt(t,o)}))})(t,e,o)),0);t.on("remove",o.cancel);const n=e;return r=>e.on((e=>{const s=Math.max(Math.abs(r.screenX-e.screenX),Math.abs(r.screenY-e.screenY));if(!e.dragging&&s>10){const o=QN(t,"dragstart",e.element,e.dataTransfer,r);if(C(o.dataTransfer)&&(e.dataTransfer=o.dataTransfer),o.isDefaultPrevented())return;e.dragging=!0,t.focus()}if(e.dragging){const s=r.currentTarget===t.getDoc().documentElement,l=((e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}))(e,zN(t,r));a=e.ghost,i=t.getBody(),a.parentNode!==i&&i.appendChild(a),((e,t,o,n,r,s,a,i,l,c,d,m)=>{let u=0,g=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+o>r&&(u=t.pageX+o-r),t.pageY+n>s&&(g=t.pageY+n-s),e.style.width=o-u+"px",e.style.height=n-g+"px";const h=l.clientHeight,p=l.clientWidth,f=a+l.getBoundingClientRect().top,v=i+l.getBoundingClientRect().left;d.on((e=>{e.intervalId.clear(),e.dragging&&m&&(a+8>=h?e.intervalId.set(YN(c)):a-8<=0?e.intervalId.set(KN(c)):i+8>=p?e.intervalId.set(GN(c)):i-8<=0?e.intervalId.set(qN(c)):f+16>=window.innerHeight?e.intervalId.set(YN(window)):f-16<=0?e.intervalId.set(KN(window)):v+16>=window.innerWidth?e.intervalId.set(GN(window)):v-16<=0&&e.intervalId.set(qN(window)))}))})(e.ghost,l,e.width,e.height,e.maxX,e.maxY,r.clientY,r.clientX,t.getContentAreaContainer(),t.getWin(),n,s),o.throttle(r.clientX,r.clientY)}var a,i}))},tR=(e,t)=>o=>{e.on((e=>{var n;if(e.intervalId.clear(),e.dragging){if(((e,t,o)=>!x(t)&&t!==o&&!e.dom.isChildOf(t,o)&&e.dom.isEditable(t))(t,(e=>{const t=e.getSel();if(C(t)){const e=t.getRangeAt(0).startContainer;return tr(e)?e.parentNode:e}return null})(t.selection),e.element)){const r=null!==(n=t.getDoc().elementFromPoint(o.clientX,o.clientY))&&void 0!==n?n:t.getBody();QN(t,"drop",r,e.dataTransfer,o).isDefaultPrevented()||t.undoManager.transact((()=>{((e,t)=>{const o=e.getParent(t.parentNode,e.isBlock);XN(t),o&&o!==e.getRoot()&&e.isEmpty(o)&&Rr(yo.fromDom(o))})(t.dom,e.element),(e=>{const t=e.getData("text/html");return""===t?F.none():F.some(t)})(e.dataTransfer).each((e=>t.insertContent(e))),t._selectionOverrides.hideFakeCaret()}))}QN(t,"dragend",t.getBody(),e.dataTransfer,o)}})),nR(e)},oR=(e,t,o)=>{e.on((e=>{e.intervalId.clear(),e.dragging&&o.fold((()=>QN(t,"dragend",e.element,e.dataTransfer)),(o=>QN(t,"dragend",e.element,e.dataTransfer,o)))})),nR(e)},nR=e=>{e.on((e=>{e.intervalId.clear(),XN(e.ghost)})),e.clear()},rR=e=>{const t=ai(),o=Ya.DOM,n=document,r=JN(t,e),s=eR(t,e),a=tR(t,e),i=((e,t)=>o=>oR(e,t,F.some(o)))(t,e);e.on("mousedown",r),e.on("mousemove",s),e.on("mouseup",a),o.bind(n,"mousemove",s),o.bind(n,"mouseup",i),e.on("remove",(()=>{o.unbind(n,"mousemove",s),o.unbind(n,"mouseup",i)})),e.on("keydown",(o=>{o.keyCode===Dg.ESC&&oR(t,e,F.none())}))},sR=e=>{rR(e),Xc(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const o=t.dataTransfer;o&&(j(o.types,"Files")||o.files.length>0)&&(t.preventDefault(),"drop"===t.type&&gS(e,"Dropped file type is not supported"))}},o=o=>{Jh(e,o.target)&&t(o)},n=()=>{const n=Ya.DOM,r=e.dom,s=document,a=e.inline?e.getBody():e.getDoc(),i=["drop","dragover"];q(i,(e=>{n.bind(s,e,o),r.bind(a,e,t)})),e.on("remove",(()=>{q(i,(e=>{n.unbind(s,e,o),r.unbind(a,e,t)}))}))};e.on("init",(()=>{qh.setEditorTimeout(e,n,0)}))})(e)},aR=dr,iR=(e,t)=>tb(e.getBody(),t),lR=e=>{const t=e.selection,o=e.dom,n=e.getBody(),r=Kd(e,n,o.isBlock,(()=>ap(e))),s="sel-"+o.uniqueId(),a="data-mce-selected";let i;const l=e=>e!==n&&(aR(e)||gr(e))&&o.isChildOf(e,n)&&o.isEditable(e.parentNode),c=(o,n,s,a=!0)=>e.dispatch("ShowCaret",{target:n,direction:o,before:s}).isDefaultPrevented()?null:(a&&t.scrollIntoView(n,-1===o),r.show(s,n)),d=()=>{e.on("click",(t=>{o.isEditable(t.target)||(t.preventDefault(),e.focus())})),e.on("blur NewBlock",f),e.on("ResizeWindow FullscreenStateChanged",r.reposition),e.on("tap",(t=>{const o=t.target,n=iR(e,o);aR(n)?(t.preventDefault(),uk(e,n).each(p)):l(o)&&uk(e,o).each(p)}),!0),e.on("mousedown",(r=>{const s=r.target;if(s!==n&&"HTML"!==s.nodeName&&!o.isChildOf(s,n))return;if(!aS(e,r.clientX,r.clientY))return;f(),v();const a=iR(e,s);aR(a)?(r.preventDefault(),uk(e,a).each(p)):PN(n,r.clientX,r.clientY).each((o=>{r.preventDefault(),(e=>{e&&t.setRng(e)})(c(1,o.node,o.position===AN.Before,!1)),$n(a)?a.focus():e.getBody().focus()}))})),e.on("keypress",(e=>{Dg.modifierPressed(e)||aR(t.getNode())&&e.preventDefault()})),e.on("GetSelectionRange",(e=>{let t=e.range;if(i){if(!i.parentNode)return void(i=null);t=t.cloneRange(),t.selectNode(i),e.range=t}})),e.on("SetSelectionRange",(e=>{e.range=g(e.range);const t=p(e.range,e.forward);t&&(e.range=t)})),e.on("AfterSetSelectionRange",(e=>{const t=e.range,n=t.startContainer.parentElement;var r;u(t)||Wn(r=n)&&"mcepastebin"===r.id||v(),(e=>C(e)&&o.hasClass(e,"mce-offscreen-selection"))(n)||f()})),sR(e),(e=>{const t=ii((()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const o=gk(e,t,!1);e.selection.setRng(o)}}}),0);e.on("focus",(()=>{t.throttle()})),e.on("blur",(()=>{t.cancel()}))})(e),(e=>{e.on("init",(()=>{e.on("focusin",(t=>{const o=t.target;if(gr(o)){const t=tb(e.getBody(),o),n=dr(t)?t:o;e.selection.getNode()!==n&&uk(e,n).each((t=>e.selection.setRng(t)))}}))}))})(e)},m=e=>Vr(e)||Wr(e)||$r(e),u=e=>m(e.startContainer)||m(e.endContainer),g=t=>{const n=e.schema.getVoidElements(),r=o.createRng(),s=t.startContainer,a=t.startOffset,i=t.endContainer,l=t.endOffset;return _e(n,s.nodeName.toLowerCase())?0===a?r.setStartBefore(s):r.setStartAfter(s):r.setStart(s,a),_e(n,i.nodeName.toLowerCase())?0===l?r.setEndBefore(i):r.setEndAfter(i):r.setEnd(i,l),r},h=n=>{const r=n.cloneNode(!0),l=e.dispatch("ObjectSelected",{target:n,targetClone:r});if(l.isDefaultPrevented())return null;const c=((n,r)=>{const a=yo.fromDom(e.getBody()),i=e.getDoc(),l=tn(a,"#"+s).getOrThunk((()=>{const e=yo.fromHtml('
    ',i);return eo(e,"id",s),bn(a,e),e})),c=o.createRng();xn(l),wn(l,[yo.fromText(br,i),yo.fromDom(r),yo.fromText(br,i)]),c.setStart(l.dom.firstChild,1),c.setEnd(l.dom.lastChild,0),cn(l,{top:o.getPos(n,e.getBody()).y+"px"}),Bh(l);const d=t.getSel();return d&&(d.removeAllRanges(),d.addRange(c)),c})(n,l.targetClone),d=yo.fromDom(n);return q(zn(yo.fromDom(e.getBody()),`*[${a}]`),(e=>{So(d,e)||so(e,a)})),o.getAttrib(n,a)||n.setAttribute(a,"1"),i=n,v(),c},p=(e,t)=>{if(!e)return null;if(e.collapsed){if(!u(e)){const r=t?1:-1,s=Cm(r,n,e),a=s.getNode(!t);if(C(a)){if(Jd(a))return c(r,a,!!t&&!s.isAtEnd(),!1);if(zr(a)&&dr(a.nextSibling)){const e=o.createRng();return e.setStart(a,0),e.setEnd(a,0),e}}const i=s.getNode(t);if(C(i)){if(Jd(i))return c(r,i,!t&&!s.isAtEnd(),!1);if(zr(i)&&dr(i.previousSibling)){const e=o.createRng();return e.setStart(i,1),e.setEnd(i,1),e}}}return null}let r=e.startContainer,s=e.startOffset;const a=e.endOffset;if(tr(r)&&0===s&&aR(r.parentNode)&&(r=r.parentNode,s=o.nodeIndex(r),r=r.parentNode),!Wn(r))return null;if(a===s+1&&r===e.endContainer){const e=r.childNodes[s];if(l(e))return h(e)}return null},f=()=>{i&&i.removeAttribute(a),tn(yo.fromDom(e.getBody()),"#"+s).each(Cn),i=null},v=()=>{r.hide()};return fC(e)||d(),{showCaret:c,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(qr(e),t.scrollIntoView(e))},hideFakeCaret:v,destroy:()=>{r.destroy(),i=null}}},cR=(e,t)=>{let o=t;for(let t=e.previousSibling;tr(t);t=t.previousSibling)o+=t.data.length;return o},dR=(e,t,o,n,r)=>{if(tr(o)&&(n<0||n>o.data.length))return[];const s=r&&tr(o)?[cR(o,n)]:[n];let a=o;for(;a!==t&&a.parentNode;)s.push(e.nodeIndex(a,r)),a=a.parentNode;return a===t?s.reverse():[]},mR=(e,t,o,n,r,s,a=!1)=>({start:dR(e,t,o,n,a),end:dR(e,t,r,s,a)}),uR=(e,t)=>{const o=t.slice(),n=o.pop();return k(n)?J(o,((e,t)=>e.bind((e=>F.from(e.childNodes[t])))),F.some(e)).bind((e=>tr(e)&&(n<0||n>e.data.length)?F.none():F.some({node:e,offset:n}))):F.none()},gR=(e,t)=>uR(e,t.start).bind((({node:o,offset:n})=>uR(e,t.end).map((({node:e,offset:t})=>{const r=document.createRange();return r.setStart(o,n),r.setEnd(e,t),r})))),hR=(e,t,o)=>{if(t&&e.isEmpty(t)&&!o(t)){const n=t.parentNode;e.remove(t,tr(t.firstChild)&&is(t.firstChild.data)),hR(e,n,o)}},pR=(e,t,o,n=!0)=>{const r=t.startContainer.parentNode,s=t.endContainer.parentNode;t.deleteContents(),n&&!o(t.startContainer)&&(tr(t.startContainer)&&0===t.startContainer.data.length&&e.remove(t.startContainer),tr(t.endContainer)&&0===t.endContainer.data.length&&e.remove(t.endContainer),hR(e,r,o),r!==s&&hR(e,s,o))},fR=(e,t)=>F.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),vR=(e,t,o)=>{const n=e.dynamicPatternsLookup({text:o,block:t});return{...e,blockPatterns:Bl(n).concat(e.blockPatterns),inlinePatterns:Ll(n).concat(e.inlinePatterns)}},bR=(e,t,o,n)=>{const r=e.createRng();return r.setStart(t,0),r.setEnd(o,n),r.toString()},yR=(e,t,o)=>{const n=((e,t,o)=>{if(tr(e)&&t>=e.length)return F.some(VT(e,t));{const n=Oi(ZT);return F.from(n.forwards(e,t,UT(e),o)).map((e=>VT(e.container,0)))}})(t,0,t);n.each((n=>{const r=n.container;$T(r,o.start.length,t).each((o=>{const n=e.createRng();n.setStart(r,0),n.setEnd(o.container,o.offset),pR(e,n,(e=>e===t))}));const s=yo.fromDom(r),a=xr(s);/^\s[^\s]/.test(a)&&((e,t)=>{wr.set(e,t)})(s,a.slice(1))}))},wR=(e,t)=>{const o=e.dom,n=t.pattern,r=gR(o.getRoot(),t.range).getOrDie("Unable to resolve path range");return fR(e,r).each((t=>{"block-format"===n.type?((e,t)=>{const o=t.get(e);return v(o)&&de(o).exists((e=>_e(e,"block")))})(n.format,e.formatter)&&e.undoManager.transact((()=>{yR(e.dom,t,n),e.formatter.apply(n.format)})):"block-command"===n.type&&e.undoManager.transact((()=>{yR(e.dom,t,n),e.execCommand(n.cmd,!1,n.value)}))})),!0},xR=(e,t)=>{const o=(e=>le(e,((e,t)=>t.start.length-e.start.length)))(e),n=t.replace(br," ");return ee(o,(e=>0===t.indexOf(e.start)||0===n.indexOf(e.start)))},CR=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),SR=(e,t)=>{const o=e.createRng();return o.setStartAfter(t.start),o.setEndBefore(t.end),o},kR=(e,t,o)=>{const n=gR(e.getRoot(),o).getOrDie("Unable to resolve path range"),r=n.startContainer,s=n.endContainer,a=0===n.endOffset?s:s.splitText(n.endOffset),i=0===n.startOffset?r:r.splitText(n.startOffset),l=i.parentNode;return{prefix:t,end:a.parentNode.insertBefore(CR(e,t+"-end"),a),start:l.insertBefore(CR(e,t+"-start"),i)}},_R=(e,t,o)=>{hR(e,e.get(t.prefix+"-end"),o),hR(e,e.get(t.prefix+"-start"),o)},ER=e=>0===e.start.length,TR=(e,t,o,n)=>{const r=t.start;var s;return qT(e,n.container,n.offset,(s=r,(e,t)=>{const o=e.data.substring(0,t),n=o.lastIndexOf(s.charAt(s.length-1)),r=o.lastIndexOf(s);return-1!==r?r+s.length:-1!==n?n+1:-1}),o).bind((n=>{var s,a;const i=null!==(a=null===(s=o.textContent)||void 0===s?void 0:s.indexOf(r))&&void 0!==a?a:-1;if(-1!==i&&n.offset>=i+r.length){const t=e.createRng();return t.setStart(n.container,n.offset-r.length),t.setEnd(n.container,n.offset),F.some(t)}{const s=n.offset-r.length;return WT(n.container,s,o).map((t=>{const o=e.createRng();return o.setStart(t.container,t.offset),o.setEnd(n.container,n.offset),o})).filter((e=>e.toString()===r)).orThunk((()=>TR(e,t,o,VT(n.container,0))))}}))},OR=(e,t,o,n)=>{const r=e.dom,s=r.getRoot(),a=o.pattern,i=o.position.container,l=o.position.offset;return WT(i,l-o.pattern.end.length,t).bind((c=>{const d=mR(r,s,c.container,c.offset,i,l,n);if(ER(a))return F.some({matches:[{pattern:a,startRng:d,endRng:d}],position:c});{const i=DR(e,o.remainingPatterns,c.container,c.offset,t,n),l=i.getOr({matches:[],position:c}),m=l.position,u=((e,t,o,n,r,s=!1)=>{if(0===t.start.length&&!s){const t=e.createRng();return t.setStart(o,n),t.setEnd(o,n),F.some(t)}return jT(o,n,r).bind((o=>TR(e,t,r,o).bind((e=>{var t;if(s){if(e.endContainer===o.container&&e.endOffset===o.offset)return F.none();if(0===o.offset&&(null===(t=e.endContainer.textContent)||void 0===t?void 0:t.length)===e.endOffset)return F.none()}return F.some(e)}))))})(r,a,m.container,m.offset,t,i.isNone());return u.map((e=>{const t=((e,t,o,n=!1)=>mR(e,t,o.startContainer,o.startOffset,o.endContainer,o.endOffset,n))(r,s,e,n);return{matches:l.matches.concat([{pattern:a,startRng:t,endRng:d}]),position:VT(e.startContainer,e.startOffset)}}))}}))},DR=(e,t,o,n,r,s)=>{const a=e.dom;return jT(o,n,a.getRoot()).bind((i=>{const l=bR(a,r,o,n);for(let a=0;a0)return DR(e,t,o,n-1,r,s);if(m.isSome())return m}return F.none()}))},AR=(e,t,o)=>{e.selection.setRng(o),"inline-format"===t.type?q(t.format,(t=>{e.formatter.apply(t)})):e.execCommand(t.cmd,!1,t.value)},MR=(e,t,o,n,r,s)=>{var a;return((e,t)=>{const o=re(e,(e=>W(t,(t=>e.pattern.start===t.pattern.start&&e.pattern.end===t.pattern.end))));return e.length===t.length?o?e:t:e.length>t.length?e:t})(DR(e,r.inlinePatterns,o,n,t,s).fold((()=>[]),(e=>e.matches)),DR(e,(a=r.inlinePatterns,le(a,((e,t)=>t.end.length-e.end.length))),o,n,t,s).fold((()=>[]),(e=>e.matches)))},NR=(e,t)=>{if(0===t.length)return;const o=e.dom,n=e.selection.getBookmark(),r=((e,t)=>{const o=Ci("mce_textpattern"),n=X(t,((t,n)=>{const r=kR(e,o+`_end${t.length}`,n.endRng);return t.concat([{...n,endMarker:r}])}),[]);return X(n,((t,r)=>{const s=n.length-t.length-1,a=ER(r.pattern)?r.endMarker:kR(e,o+`_start${s}`,r.startRng);return t.concat([{...r,startMarker:a}])}),[])})(o,t);q(r,(t=>{const n=o.getParent(t.startMarker.start,o.isBlock),r=e=>e===n;ER(t.pattern)?((e,t,o,n)=>{const r=SR(e.dom,o);pR(e.dom,r,n),AR(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,o,n,r)=>{const s=e.dom,a=SR(s,n),i=SR(s,o);pR(s,i,r),pR(s,a,r);const l={prefix:o.prefix,start:o.end,end:n.start},c=SR(s,l);AR(e,t,c)})(e,t.pattern,t.startMarker,t.endMarker,r),_R(o,t.endMarker,r),_R(o,t.startMarker,r)})),e.selection.moveToBookmark(n)},RR=(e,t)=>{const o=e.selection.getRng();return fR(e,o).map((n=>{var r;const s=Math.max(0,o.startOffset),a=vR(t,n,null!==(r=n.textContent)&&void 0!==r?r:""),i=MR(e,n,o.startContainer,s,a,!0),l=((e,t,o,n)=>{var r;const s=e.dom,a=Xl(e);if(!s.is(t,a))return[];const i=null!==(r=t.textContent)&&void 0!==r?r:"";return xR(o.blockPatterns,i).map((e=>Bt.trim(i).length===e.start.length?[]:[{pattern:e,range:mR(s,s.getRoot(),t,0,t,0,n)}])).getOr([])})(e,n,a,!0);return(l.length>0||i.length>0)&&(e.undoManager.add(),e.undoManager.extra((()=>{e.execCommand("mceInsertNewLine")}),(()=>{(e=>{e.insertContent(Br,{preserve_zwsp:!0})})(e),NR(e,i),((e,t)=>{if(0===t.length)return;const o=e.selection.getBookmark();q(t,(t=>wR(e,t))),e.selection.moveToBookmark(o)})(e,l);const t=e.selection.getRng(),o=jT(t.startContainer,t.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),o.each((t=>{const o=t.container;o.data.charAt(t.offset-1)===vr&&(o.deleteData(t.offset-1,1),hR(e.dom,o.parentNode,(t=>t===e.dom.getRoot())))}))})),!0)})).getOr(!1)},BR=(e,t,o)=>{for(let n=0;n{const t=[",",".",";",":","!","?"],o=[32],n=()=>{return t=wd(e),o=xd(e),{inlinePatterns:Ll(t),blockPatterns:Bl(t),dynamicPatternsLookup:o};var t,o},r=()=>(e=>e.options.isSet("text_patterns_lookup"))(e);e.on("keydown",(t=>{if(13===t.keyCode&&!Dg.modifierPressed(t)&&e.selection.isCollapsed()){const o=n();(o.inlinePatterns.length>0||o.blockPatterns.length>0||r())&&RR(e,o)&&t.preventDefault()}}),!0);const s=()=>{if(e.selection.isCollapsed()){const t=n();(t.inlinePatterns.length>0||r())&&((e,t)=>{const o=e.selection.getRng();fR(e,o).map((n=>{const r=Math.max(0,o.startOffset-1),s=bR(e.dom,n,o.startContainer,r),a=vR(t,n,s),i=MR(e,n,o.startContainer,r,a,!1);i.length>0&&e.undoManager.transact((()=>{NR(e,i)}))}))})(e,t)}};e.on("keyup",(e=>{BR(o,e,((e,t)=>e===t.keyCode&&!Dg.modifierPressed(t)))&&s()})),e.on("keypress",(o=>{BR(t,o,((e,t)=>e.charCodeAt(0)===t.charCode))&&qh.setEditorTimeout(e,s)}))},HR=e=>{const t=Bt.each,o=Dg.BACKSPACE,n=Dg.DELETE,r=e.dom,s=e.selection,a=e.parser,i=At.browser,l=i.isFirefox(),c=i.isChromium()||i.isSafari(),d=At.deviceType.isiPhone()||At.deviceType.isiPad(),m=At.os.isMacOS()||At.os.isiOS(),u=(t,o)=>{try{e.getDoc().execCommand(t,!1,String(o))}catch(e){}},g=e=>e.isDefaultPrevented(),p=()=>{const t=e=>{const t=r.create("body"),o=e.cloneContents();return t.appendChild(o),s.serializer.serialize(t,{format:"html"})};e.on("keydown",(s=>{const a=s.keyCode;if(!g(s)&&(a===n||a===o)&&e.selection.isEditable()){const o=e.selection.isCollapsed(),n=e.getBody();if(o&&!ys(yo.fromDom(n)))return;if(!o&&!(o=>{const n=t(o),s=r.createRng();return s.selectNode(e.getBody()),n===t(s)})(e.selection.getRng()))return;s.preventDefault(),e.setContent(""),n.firstChild&&r.isBlock(n.firstChild)?e.selection.setCursorLocation(n.firstChild,0):e.selection.setCursorLocation(n,0),e.nodeChanged()}}))},f=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},v=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",(t=>{let o;if(t.target===e.getDoc().documentElement)if(o=s.getRng(),e.getBody().focus(),"mousedown"===t.type){if(Vr(o.startContainer))return;s.placeCaretAt(t.clientX,t.clientY)}else s.setRng(o)}))},b=()=>{Range.prototype.getClientRects||e.on("mousedown",(t=>{if(!g(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),qh.setEditorTimeout(e,(()=>{t.focus()}))}}))},y=()=>{const t=ed(e);e.on("click",(o=>{const n=o.target;/^(IMG|HR)$/.test(n.nodeName)&&r.isEditable(n)&&(o.preventDefault(),e.selection.select(n),e.nodeChanged()),"A"===n.nodeName&&r.hasClass(n,t)&&0===n.childNodes.length&&r.isEditable(n.parentNode)&&(o.preventDefault(),s.select(n))}))},w=()=>{e.on("keydown",(e=>{if(!g(e)&&e.keyCode===o&&s.isCollapsed()&&0===s.getRng().startOffset){const t=s.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}return!0}))},x=()=>{const t=()=>{u("StyleWithCSS",!1),u("enableInlineTableEditing",!1),kc(e)||u("enableObjectResizing",!1)};$c(e)||e.on("BeforeExecCommand mousedown",t)},C=()=>{e.on("SetContent ExecCommand",(e=>{"setcontent"!==e.type&&"mceInsertLink"!==e.command||t(r.select("a:not([data-mce-block])"),(e=>{var t;let o=e.parentNode;const n=r.getRoot();if((null==o?void 0:o.lastChild)===e){for(;o&&!r.isBlock(o);){if((null===(t=o.parentNode)||void 0===t?void 0:t.lastChild)!==o||o===n)return;o=o.parentNode}r.add(o,"br",{"data-mce-bogus":1})}}))}))},S=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},k=()=>{e.inline||e.on("keydown",(()=>{document.activeElement===document.body&&e.getWin().focus()}))},_=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",(t=>{let o;"HTML"===t.target.nodeName&&(o=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(o),e.selection.normalize(),e.nodeChanged())})))},T=()=>{m&&e.on("keydown",(t=>{!Dg.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}))},O=()=>{e.on("click",(e=>{let t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)})),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},D=()=>{e.on("init",(()=>{e.dom.bind(e.getBody(),"submit",(e=>{e.preventDefault()}))}))},A=E,M=()=>{e.on("keydown",(t=>{if(g(t)||t.keyCode!==Dg.BACKSPACE)return;let o=s.getRng();const n=o.startContainer,a=o.startOffset,i=r.getRoot();let l=n;if(o.collapsed&&0===a){for(;l.parentNode&&l.parentNode.firstChild===l&&l.parentNode!==i;)l=l.parentNode;"BLOCKQUOTE"===l.nodeName&&(e.formatter.toggle("blockquote",void 0,l),o=r.createRng(),o.setStart(n,0),o.setEnd(n,0),s.setRng(o))}})),p(),At.windowsPhone||e.on("keyup focusin mouseup",(t=>{Dg.modifierPressed(t)||(e=>{const t=e.getBody(),o=e.selection.getRng();return o.startContainer===o.endContainer&&o.startContainer===t&&0===o.startOffset&&o.endOffset===t.childNodes.length})(e)||s.normalize()}),!0),c&&(v(),y(),e.on("init",(()=>{u("DefaultParagraphSeparator",Xl(e))})),D(),w(),a.addNodeFilter("br",(e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()})),d?(k(),_(),O()):f()),l&&(e.on("keydown",(t=>{if(!g(t)&&t.keyCode===o){if(!e.getBody().getElementsByTagName("hr").length)return;if(s.isCollapsed()&&0===s.getRng().startOffset){const e=s.getNode(),o=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();o&&o.nodeName&&"hr"===o.nodeName.toLowerCase()&&(r.remove(o),t.preventDefault())}}})),b(),(()=>{const o=()=>{const o=r.getAttribs(s.getStart().cloneNode(!1));return()=>{const n=s.getStart();n!==e.getBody()&&(r.setAttrib(n,"style",null),t(o,(e=>{n.setAttributeNode(e.cloneNode(!0))})))}},n=()=>!s.isCollapsed()&&r.getParent(s.getStart(),r.isBlock)!==r.getParent(s.getEnd(),r.isBlock);e.on("keypress",(t=>{let r;return!(!(g(t)||8!==t.keyCode&&46!==t.keyCode)&&n()&&(r=o(),e.getDoc().execCommand("delete",!1),r(),t.preventDefault(),1))})),r.bind(e.getDoc(),"cut",(t=>{if(!g(t)&&n()){const t=o();qh.setEditorTimeout(e,(()=>{t()}))}}))})(),x(),C(),S(),T(),w(),e.on("drop",(t=>{var o;const n=null===(o=t.dataTransfer)||void 0===o?void 0:o.getData("text/html");h(n)&&/^]*>$/.test(n)&&e.dispatch("dragend",new window.DragEvent("dragend",t))})))};return fC(e)?(c&&(v(),y(),D(),f(),d&&(k(),_(),O())),l&&(b(),x(),S(),T())):M(),{refreshContentEditable:A,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},IR=Ya.DOM,PR=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,FR=e=>xe(e,(e=>!1===w(e))),zR=e=>{const t=e.options.get,o=e.editorUpload.blobCache;return FR({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_unsafe_embeds:t("convert_unsafe_embeds"),convert_fonts_to_spans:t("convert_fonts_to_spans"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),inline_styles:t("inline_styles"),root_name:PR(e),sandbox_iframes:t("sandbox_iframes"),sanitize:t("xss_sanitization"),validate:!0,blob_cache:o,document:e.getDoc()})},VR=e=>{const t=e.options.get;return FR({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},ZR=e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||_u(e)&&e.selection.getStart(!0)!==t||Gm(t).each((t=>{const o=t.getNode(),n=Jn(o)?Gm(o).getOr(t):t;e.selection.setRng(n.toRange())}))})(e),e.nodeChanged({initial:!0});const t=nd(e);S(t)&&t.call(e,e),(e=>{const t=sd(e);t&&qh.setEditorTimeout(e,(()=>{let o;o=!0===t?e:e.editorManager.get(t),o&&!o.destroyed&&(o.focus(),o.selection.scrollIntoView())}),100)})(e)},UR=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,jR=e=>{const t=UR(e),o=xc(e),n=e.contentCSS,r=()=>{t.unloadAll(n),e.inline||e.ui.styleSheetLoader.unloadAll(o)},s=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";Bt.each(e.contentStyles,(e=>{t+=e+"\r\n"})),e.dom.addStyle(t)}const a=Promise.all(((e,t,o)=>{const{pass:n,fail:r}=K(t,(e=>tinymce.Resource.has(vS(e)))),s=n.map((t=>{const o=tinymce.Resource.get(vS(t));return h(o)?Promise.resolve(UR(e).loadRawCss(t,o)):Promise.resolve()})),a=[...s,UR(e).loadAll(r)];return e.inline?a:a.concat([e.ui.styleSheetLoader.loadAll(o)])})(e,n,o)).then(s).catch(s),i=wc(e);return i&&((e,t)=>{const o=yo.fromDom(e.getBody()),n=jo(Uo(o)),r=yo.fromTag("style");eo(r,"type","text/css"),bn(r,yo.fromText(t)),bn(n,r),e.on("remove",(()=>{Cn(r)}))})(e,i),a},WR=e=>{!0!==e.removed&&((e=>{fC(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),ZR(e))},$R=e=>{const t=e.getElement();let o=e.getDoc();e.inline&&(IR.addClass(t,"mce-content-body"),e.contentDocument=o=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const n=e.getBody();n.disabled=!0,e.readonly=$c(e),e._editableRoot=qc(e),!e.readonly&&e.hasEditableRoot()&&(e.inline&&"static"===IR.getStyle(n,"position",!0)&&(n.style.position="relative"),n.contentEditable="true"),n.disabled=!1,e.editorUpload=OS(e),e.schema=ya(VR(e)),e.dom=Ya(o,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:e.inline,schema:e.schema,contentCssCors:gc(e),referrerPolicy:hc(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)},force_hex_color:Rd(e)}),e.parser=(e=>{const t=Mx(zR(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",((t,o)=>{const n=e.dom,r="data-mce-"+o;let s=t.length;for(;s--;){const a=t[s];let i=a.attr(o);if(i&&!a.attr(r)){if(0===i.indexOf("data:")||0===i.indexOf("blob:"))continue;"style"===o?(i=n.serializeStyle(n.parseStyle(i),a.name),i.length||(i=null),a.attr(r,i),a.attr(o,i)):"tabindex"===o?(a.attr(r,i),a.attr(o,null)):a.attr(r,e.convertURL(i,o,a.name))}}})),t.addNodeFilter("script",(e=>{let t=e.length;for(;t--;){const o=e[t],n=o.attr("type")||"no/type";0!==n.indexOf("mce-")&&o.attr("type","mce-"+n)}})),_d(e)&&t.addNodeFilter("#cdata",(t=>{var o;let n=t.length;for(;n--;){const r=t[n];r.type=8,r.name="#comment",r.value="[CDATA["+e.dom.encode(null!==(o=r.value)&&void 0!==o?o:"")+"]]"}})),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",(t=>{let o=t.length;const n=e.schema.getNonEmptyElements();for(;o--;){const e=t[o];e.isEmpty(n)&&0===e.getAll("br").length&&e.append(new Ep("br",1))}})),t})(e),e.serializer=RC((e=>{const t=e.options.get;return{...zR(e),...VR(e),...FR({remove_trailing_brs:t("remove_trailing_brs"),pad_empty_with_br:t("pad_empty_with_br"),url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}})(e),e),e.selection=OC(e.dom,e.getWin(),e.serializer,e),e.annotator=wg(e),e.formatter=zS(e),e.undoManager=ZS(e),e._nodeChangeDispatcher=new sM(e),e._selectionOverrides=lR(e),NE(e),xN(e),VE(e),fC(e)||((e=>{e.on("mousedown",(t=>{t.detail>=3&&(t.preventDefault(),DN(e))}))})(e),(e=>{LR(e)})(e));const r=rM(e);AE(e,r),(e=>{e.on("NodeChange",N(IE,e))})(e),qS(e),wN(e);const s=vC(e);(e=>{const t=e.getDoc(),o=e.getBody();(e=>{e.dispatch("PreInit")})(e),ad(e)||(t.body.spellcheck=!1,IR.setAttrib(o,"spellcheck","false")),e.quirks=HR(e),(e=>{e.dispatch("PostRender")})(e);const n=Cc(e);void 0!==n&&(o.dir=n);const r=id(e);r&&e.on("BeforeSetContent",(e=>{Bt.each(r,(t=>{e.content=e.content.replace(t,(e=>"\x3c!--mce:protected "+escape(e)+"--\x3e"))}))})),e.on("SetContent",(()=>{e.addVisual(e.getBody())})),e.on("compositionstart compositionend",(t=>{e.composing="compositionstart"===t.type}))})(e),s.fold((()=>{const t=(e=>{let t=!1;const o=setTimeout((()=>{t||e.setProgressState(!0)}),500);return()=>{clearTimeout(o),t=!0,e.setProgressState(!1)}})(e);jR(e).then((()=>{WR(e),t()}))}),(t=>{e.setProgressState(!0),jR(e).then((()=>{t().then((t=>{e.setProgressState(!1),WR(e),wC(e)}),(t=>{e.notificationManager.open({type:"error",text:String(t)}),WR(e),wC(e)}))}))}))},qR=P,GR=Ya.DOM,KR=(e,t)=>{const o=e.translate("Rich Text Area"),n=no(yo.fromDom(e.getElement()),"tabindex").bind(Je),r=((e,t,o,n)=>{const r=yo.fromTag("iframe");return n.each((e=>eo(r,"tabindex",e))),to(r,o),to(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),go(r,"tox-edit-area__iframe"),r})(e.id,o,jl(e),n).dom;r.onload=()=>{r.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=r,e.iframeHTML=(e=>{let t=Wl(e)+"";$l(e)!==e.documentBaseUrl&&(t+=''),t+='';const o=ql(e),n=Gl(e),r=e.translate(td(e));return Kl(e)&&(t+=''),t+=`
    `,t})(e),GR.add(t.iframeContainer,r)},YR=e=>{const t=e.iframeElement,o=()=>{e.contentDocument=t.contentDocument,$R(e)};if(Od(e)||At.browser.isFirefox()){const t=e.getDoc();t.open(),t.write(e.iframeHTML),t.close(),o()}else{const r=(n=yo.fromDom(t),On(n,"load",qR,(()=>{r.unbind(),o()})));t.srcdoc=e.iframeHTML}var n},XR=Ya.DOM,JR=(e,t,o)=>{const n=cS.get(o),r=cS.urls[o]||e.documentBaseUrl.replace(/\/$/,"");if(o=Bt.trim(o),n&&-1===Bt.inArray(t,o)){if(e.plugins[o])return;try{const s=n(e,r)||{};e.plugins[o]=s,S(s.init)&&(s.init(e,r),t.push(o))}catch(t){((e,t,o)=>{const n=ni.translate(["Failed to initialize plugin: {0}",t]);Sg(e,"PluginLoadError",{message:n}),fS(n,o),gS(e,n)})(e,o,t)}}},QR=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),eB=e=>{const t=e.getElement();return e.inline?QR(null):(e=>{const t=XR.create("div");return XR.insertAfter(t,e),QR(t,t)})(t)},tB=e=>{const t=e.getElement();return e.orgDisplay=t.style.display,h(Dc(e))?(e=>{const t=e.theme.renderUI;return t?t():eB(e)})(e):S(Dc(e))?(e=>{const t=e.getElement(),o=Dc(e)(e,t);return o.editorContainer.nodeType&&(o.editorContainer.id=o.editorContainer.id||e.id+"_parent"),o.iframeContainer&&o.iframeContainer.nodeType&&(o.iframeContainer.id=o.iframeContainer.id||e.id+"_iframecontainer"),o.height=o.iframeHeight?o.iframeHeight:t.offsetHeight,o})(e):eB(e)},oB=async e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=Bt.trim(ic(e)),o=e.ui.registry.getAll().icons,n={...JC.get("default").icons,...JC.get(t).icons};fe(n,((t,n)=>{_e(o,n)||e.ui.registry.addIcon(n,t)}))})(e),(e=>{const t=Dc(e);if(h(t)){const o=dS.get(t);e.theme=o(e,dS.urls[t])||{},S(e.theme.init)&&e.theme.init(e,dS.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=Mc(e),o=QC.get(t);e.model=o(e,QC.urls[t])})(e),(e=>{const t=[];q(Kc(e),(o=>{JR(e,t,(e=>e.replace(/^\-/,""))(o))}))})(e);const t=await tB(e);((e,t)=>{const o={show:F.from(t.show).getOr(E),hide:F.from(t.hide).getOr(E),isEnabled:F.from(t.isEnabled).getOr(P),setEnabled:o=>{e.mode.isReadOnly()||F.from(t.setEnabled).each((e=>e(o)))}};e.ui={...e.ui,...o}})(e,F.from(t.api).getOr({})),e.editorContainer=t.editorContainer,yS(e),e.inline?$R(e):((e,t)=>{KR(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=GR.isHidden(t.editorContainer)),e.getElement().style.display="none",GR.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,YR(e)})(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},nB=Ya.DOM,rB=e=>"-"===e.charAt(0),sB=(e,t)=>{const o=pc(t),n=fc(t);if(!ni.hasCode(o)&&"en"!==o){const r=Ye(n)?n:`${t.editorManager.baseURL}/langs/${o}.js`;e.add(r).catch((()=>{((e,t,o)=>{hS(e,"LanguageLoadError",pS("language",t,o))})(t,r,o)}))}},aB=(e,t)=>{const o=Dc(e);if(h(o)&&!rB(o)&&!_e(dS.urls,o)){const n=Ac(e),r=n?e.documentBaseURI.toAbsolute(n):`themes/${o}/theme${t}.js`;dS.load(o,r).catch((()=>{((e,t,o)=>{hS(e,"ThemeLoadError",pS("theme",t,o))})(e,r,o)}))}},iB=(e,t)=>{const o=Mc(e);if("plugin"!==o&&!_e(QC.urls,o)){const n=Nc(e),r=h(n)?e.documentBaseURI.toAbsolute(n):`models/${o}/model${t}.js`;QC.load(o,r).catch((()=>{((e,t,o)=>{hS(e,"ModelLoadError",pS("model",t,o))})(e,r,o)}))}},lB=(e,t,o)=>F.from(t).filter((e=>Ye(e)&&!JC.has(e))).map((t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${o}.js`,name:F.some(t)}))),cB=(e,t,o)=>{const n=lB(t,"default",o),r=(e=>F.from(lc(e)).filter(Ye).map((e=>({url:e,name:F.none()}))))(t).orThunk((()=>lB(t,ic(t),"")));q((e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t{e.add(o.url).catch((()=>{((e,t,o)=>{hS(e,"IconsLoadError",pS("icons",t,o))})(t,o.url,o.name.getOrUndefined())}))}))},dB=(e,t)=>{const o=(t,o)=>{cS.load(t,o).catch((()=>{((e,t,o)=>{hS(e,"PluginLoadError",pS("plugin",t,o))})(e,o,t)}))};fe(Yc(e),((t,n)=>{o(n,t),e.options.set("plugins",Kc(e).concat(n))})),q(Kc(e),(e=>{!(e=Bt.trim(e))||cS.urls[e]||rB(e)||o(e,`plugins/${e}/plugin${t}.js`)}))},mB=(e,t)=>{const o=Ja.ScriptLoader,n=()=>{!e.removed&&(e=>{const t=Dc(e);return!h(t)||C(dS.get(t))})(e)&&(e=>{const t=Mc(e);return C(QC.get(t))})(e)&&oB(e)};aB(e,t),iB(e,t),sB(o,e),cB(o,e,t),dB(e,t),o.loadQueue().then(n,n)},uB=e=>{const t=e.id;ni.setCode(pc(e));const o=()=>{nB.unbind(window,"ready",o),e.render()};if(!za.Event.domLoaded)return void nB.bind(window,"ready",o);if(!e.getElement())return;const n=yo.fromDom(e.getElement()),r=ao(n);e.on("remove",(()=>{G(n.dom.attributes,(e=>so(n,e.name))),to(n,r)})),e.ui.styleSheetLoader=((e,t)=>Us.forElement(e,{contentCssCors:Gc(t),referrerPolicy:hc(t)}))(n,e),Fc(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const s=e.getElement().form||nB.getParent(t,"form");s&&(e.formElement=s,zc(e)&&!er(e.getElement())&&(nB.insertAfter(nB.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},nB.bind(s,"submit reset",e.formEventDelegate),e.on("reset",(()=>{e.resetContent()})),!Vc(e)||s.submit.nodeType||s.submit.length||s._mceOldSubmit||(s._mceOldSubmit=s.submit,s.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),s._mceOldSubmit(s)))),e.windowManager=mS(e),e.notificationManager=lS(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",(e=>{e.save&&(e.content=nB.encode(e.content))})),Zc(e)&&e.on("submit",(()=>{e.initialized&&e.save()})),Uc(e)&&(e._beforeUnload=()=>{!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),mB(e,e.suffix)},gB=St().deviceType,hB=gB.isPhone(),pB=gB.isTablet(),fB=e=>{if(x(e))return[];{const t=v(e)?e:e.split(/[ ,]/),o=$(t,qe);return Y(o,Ye)}},vB=(e,t)=>{const o=((e,t)=>{const o={},n={};return we(e,t,ye(o),ye(n)),{t:o,f:n}})(t,((t,o)=>j(e,o)));return n=o.t,r=o.f,{sections:D(n),options:D(r)};var n,r},bB=(e,t)=>_e(e.sections(),t),yB=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:ke(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),wB=(e,t)=>{var o;const n=null!==(o=t.external_plugins)&&void 0!==o?o:{};return e&&e.external_plugins?Bt.extend({},e.external_plugins,n):n},xB=(e,t,o,n)=>{const r=fB(o.forced_plugins),s=fB(n.plugins),a=((e,t)=>bB(e,t)?e.sections()[t]:{})(t,"mobile"),i=((e,t,o,n)=>e&&bB(t,"mobile")?n:o)(e,t,s,a.plugins?fB(a.plugins):s),l=((e,t)=>[...fB(e),...fB(t)])(r,i);return Bt.extend(n,{forced_plugins:r,plugins:l})},CB=(e,t,o,n,r)=>{var s;const a=e?{mobile:yB(null!==(s=r.mobile)&&void 0!==s?s:{},t)}:{},i=vB(["mobile"],xO(a,r)),l=Bt.extend(o,n,i.options(),((e,t)=>e&&bB(t,"mobile"))(e,i)?((e,t,o={})=>{const n=e.sections(),r=ke(n,t).getOr({});return Bt.extend({},o,r)})(i,"mobile"):{},{external_plugins:wB(n,i.options())});return xB(e,i,n,l)},SB=(e,t)=>((e,t)=>yC(e).editor.addVisual(t))(e,t),kB=e=>{const t=t=>()=>{q("left,center,right,justify".split(","),(o=>{t!==o&&e.formatter.remove("align"+o)})),"none"!==t&&((t,o)=>{e.formatter.toggle(t,o),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})},_B=e=>{kB(e),(e=>{const t=t=>()=>{const o=e.selection,n=o.isCollapsed()?[e.dom.getParent(o.getNode(),e.dom.isBlock)]:o.getSelectedBlocks();return W(n,(o=>C(e.formatter.matchNode(o,t))))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},EB=(e,t)=>{const o=e.selection,n=e.dom;return/^ | $/.test(t)?((e,t,o,n)=>{const r=yo.fromDom(e.getRoot());return o=Pf(r,rl.fromRangeStart(t),n)?o.replace(/^ /," "):o.replace(/^ /," "),Ff(r,rl.fromRangeEnd(t),n)?o.replace(/( | )()?$/," "):o.replace(/ ()?$/," ")})(n,o.getRng(),t,e.schema):t},TB=(e,t)=>{if(e.selection.isEditable()){const{content:o,details:n}=(e=>{if("string"!=typeof e){const t=Bt.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);Lx(e,{...n,content:EB(e,o),format:"html",set:!1,selection:!0}).each((t=>{const o=((e,t,o)=>bC(e).editor.insertContent(t,o))(e,t.content,n);Hx(e,o,t),e.addVisual()}))}},OB={"font-size":"size","font-family":"face"},DB=Jt("font"),AB=(e,t,o)=>Hb(yo.fromDom(o),(t=>(t=>un(t,e).orThunk((()=>DB(t)?ke(OB,e).bind((e=>no(t,e))):F.none())))(t)),(e=>So(yo.fromDom(t),e))),MB=e=>(t,o)=>F.from(o).map(yo.fromDom).filter(Gt).bind((o=>AB(e,t,o.dom).or(((e,t)=>F.from(Ya.DOM.getStyle(t,e,!0)))(e,o.dom)))).getOr(""),NB=MB("font-size"),RB=T((e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")),MB("font-family")),BB=e=>Gm(e.getBody()).bind((e=>{const t=e.container();return F.from(tr(t)?t.parentNode:t)})),LB=(e,t)=>(e=>F.from(e.selection.getRng()).bind((t=>{const o=e.getBody();return t.startContainer===o&&0===t.startOffset?F.none():F.from(e.selection.getStart(!0))})))(e).orThunk(N(BB,e)).map(yo.fromDom).filter(Gt).bind(t),HB=(e,t)=>LB(e,O(F.some,t)),IB=(e,t)=>{if(/^[0-9.]+$/.test(t)){const o=parseInt(t,10);if(o>=1&&o<=7){const n=(e=>Bt.explode(e.options.get("font_size_style_values")))(e),r=(e=>Bt.explode(e.options.get("font_size_classes")))(e);return r.length>0?r[o-1]||t:n[o-1]||t}return t}return t},PB=e=>{const t=e.split(/\s*,\s*/);return $(t,(e=>-1===e.indexOf(" ")||je(e,'"')||je(e,"'")?e:`'${e}'`)).join(",")},FB=e=>{const t=(t,o)=>{e.formatter.toggle(t,o),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,o,n)=>{t(e,{value:n})},BackColor:(e,o,n)=>{t("hilitecolor",{value:n})},FontName:(t,o,n)=>{((e,t)=>{const o=IB(e,t);e.formatter.toggle("fontname",{value:PB(o)}),e.nodeChanged()})(e,n)},FontSize:(t,o,n)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:IB(e,t)}),e.nodeChanged()})(e,n)},LineHeight:(t,o,n)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,n)},Lang:(e,o,n)=>{var r;t(e,{value:n.code,customValue:null!==(r=n.customCode)&&void 0!==r?r:null})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,o,n)=>{t(h(n)?n:"p")},mceToggleFormat:(e,o,n)=>{t(n)}})},zB=e=>{const t=t=>e.formatter.match(t);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>t(e),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",(()=>(e=>HB(e,(t=>RB(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("FontSize",(()=>(e=>HB(e,(t=>NB(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("LineHeight",(()=>(e=>HB(e,(t=>{const o=yo.fromDom(e.getBody()),n=Hb(t,(e=>un(e,"line-height")),N(So,o));return n.getOrThunk((()=>{const e=parseFloat(dn(t,"line-height")),o=parseFloat(dn(t,"font-size"));return String(e/o)}))})).getOr(""))(e)))},VB=e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{_E(e,"indent")})(e)},Outdent:()=>{EE(e)}}),e.editorCommands.addCommands({Outdent:()=>CE(e)},"state")},ZB=(e,t)=>{const o=e.dom,n=e.selection.getRng(),r=t?e.selection.getStart():e.selection.getEnd(),s=t?n.startContainer:n.endContainer,a=KD(o,s);if(!a||!a.isContentEditable)return;const i=t?pn:fn,l=Xl(e);((e,t,o,n)=>{const r=e.dom,s=e=>r.isBlock(e)&&e.parentElement===o,a=s(t)?t:r.getParent(n,s,o);return F.from(a).map(yo.fromDom)})(e,r,a,s).each((t=>{const o=QD(e,s,t.dom,a,!1,l);i(t,yo.fromDom(o)),e.selection.setCursorLocation(o,0),e.dispatch("NewBlock",{newBlock:o}),VD(e,"insertParagraph")}))},UB=e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{(e=>{ZB(e,!0)})(e)},InsertNewBlockAfter:()=>{(e=>{ZB(e,!1)})(e)}})},jB=e=>{_B(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const o=e.getDoc();let n;try{o.execCommand(t)}catch(e){n=!0}if("paste"!==t||o.queryCommandEnabled(t)||(n=!0),n||!o.queryCommandSupported(t)){let t=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(At.os.isMacOS()||At.os.isiOS())&&(t=t.replace(/Ctrl\+/g,"⌘+")),e.notificationManager.open({text:t,type:"error"})}}})})(e),(e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})})(e),(e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,o,n)=>{let r=0;e.dom.getParent(e.selection.getNode(),(t=>!Wn(t)||r++!==n||(e.selection.select(t),!1)),e.getBody())},mceSelectNode:(t,o,n)=>{e.selection.select(n)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),cr);if(t){const o=e.dom.createRng();o.selectNodeContents(t),e.selection.setRng(o)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,o,n)=>{TB(e,e.dom.createHTML("img",{src:n}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"
    ")},insertText:(t,o,n)=>{TB(e,e.dom.encode(n))},insertHTML:(t,o,n)=>{TB(e,n)},mceInsertContent:(t,o,n)=>{TB(e,n)},mceSetContent:(t,o,n)=>{e.setContent(n)},mceReplaceContent:(t,o,n)=>{e.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(ud(e))}})})(e),(e=>{const t=(t,o,n)=>{const r=h(n)?{href:n}:n,s=e.dom.getParent(e.selection.getNode(),"a");p(r)&&h(r.href)&&(r.href=r.href.replace(/ /g,"%20"),s&&r.href||e.formatter.remove("link"),r.href&&e.formatter.apply("link",r,s))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isEditable()){if(e.selection.isCollapsed()){const t=e.dom.getParent(e.selection.getStart(),"a");return void(t&&e.dom.remove(t,!0))}e.formatter.remove("link")}},mceInsertLink:t,createLink:t})})(e),VB(e),UB(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{HA(gA,e)},mceInsertNewLine:(t,o,n)=>{IA(e,n)},InsertLineBreak:(t,o,n)=>{HA(CA,e)}})})(e),(e=>{(e=>{e.editorCommands.addCommands({"InsertUnorderedList,InsertOrderedList":t=>{e.getDoc().execCommand(t);const o=e.dom.getParent(e.selection.getNode(),"ol,ul");if(o){const t=o.parentNode;if(t&&/^(H[1-6]|P|ADDRESS|PRE)$/.test(t.nodeName)){const n=e.selection.getBookmark();e.dom.split(t,o),e.selection.moveToBookmark(n)}}}})})(e),(e=>{e.editorCommands.addCommands({"InsertUnorderedList,InsertOrderedList":t=>{const o=e.dom.getParent(e.selection.getNode(),"ul,ol");return o&&("insertunorderedlist"===t&&"UL"===o.tagName||"insertorderedlist"===t&&"OL"===o.tagName)}},"state")})(e)})(e),(e=>{FB(e),zB(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,o,n)=>{const r=null!=n?n:e.selection.getNode();if(r!==e.getBody()){const t=e.selection.getBookmark();e.dom.remove(r,!0),e.selection.moveToBookmark(t)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,o,n)=>{cp(e,!0===n)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)},WB=["toggleview"],$B=e=>j(WB,e.toLowerCase());class qB{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t=!1,o,n){const r=this.editor,s=e.toLowerCase(),a=null==n?void 0:n.skip_focus;if(r.removed)return!1;if("mcefocus"!==s&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(s)||a?(e=>{Wh(e).each((t=>e.selection.setRng(t)))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:o}).isDefaultPrevented())return!1;const i=this.commands.exec[s];return!!S(i)&&(i(s,t,o),r.dispatch("ExecCommand",{command:e,ui:t,value:o}),!0)}queryCommandState(e){if(!$B(e)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),o=this.commands.state[t];return!!S(o)&&o(t)}queryCommandValue(e){if(!$B(e)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),o=this.commands.value[t];return S(o)?o(t):""}addCommands(e,t="exec"){const o=this.commands;fe(e,((e,n)=>{q(n.toLowerCase().split(","),(n=>{o[t][n]=e}))}))}addCommand(e,t,o){const n=e.toLowerCase();this.commands.exec[n]=(e,n,r)=>t.call(null!=o?o:this.editor,n,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,o){this.commands.state[e.toLowerCase()]=()=>t.call(null!=o?o:this.editor)}addQueryValueHandler(e,t,o){this.commands.value[e.toLowerCase()]=()=>t.call(null!=o?o:this.editor)}}const GB="data-mce-contenteditable",KB=(e,t,o)=>{try{e.getDoc().execCommand(t,!1,String(o))}catch(e){}},YB=(e,t)=>{e.dom.contentEditable=t?"true":"false"},XB=(e,t)=>{const o=yo.fromDom(e.getBody());((e,t,o)=>{vo(e,t)&&!o?po(e,t):o&&go(e,t)})(o,"mce-content-readonly",t),t?(e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{F.from(e.selection.getNode()).each((e=>{e.removeAttribute("data-mce-selected")}))})(e),e.readonly=!0,YB(o,!1),q(zn(o,'*[contenteditable="true"]'),(e=>{eo(e,GB,"true"),YB(e,!1)}))):(e.readonly=!1,e.hasEditableRoot()&&YB(o,!0),(e=>{q(zn(e,`*[${GB}="true"]`),(e=>{so(e,GB),YB(e,!0)}))})(o),KB(e,"StyleWithCSS",!1),KB(e,"enableInlineTableEditing",!1),KB(e,"enableObjectResizing",!1),ip(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged())},JB=e=>e.readonly,QB=e=>{e.parser.addAttributeFilter("contenteditable",(t=>{JB(e)&&q(t,(e=>{e.attr(GB,e.attr("contenteditable")),e.attr("contenteditable","false")}))})),e.serializer.addAttributeFilter(GB,(t=>{JB(e)&&q(t,(e=>{e.attr("contenteditable",e.attr(GB))}))})),e.serializer.addTempAttr(GB)},eL=["copy"],tL=(e,t)=>{if((e=>"click"===e.type)(t)&&!Dg.metaKeyPressed(t)){const o=yo.fromDom(t.target);((e,t)=>on(t,"a",(t=>So(t,yo.fromDom(e.getBody())))).bind((e=>no(e,"href"))))(e,o).each((o=>{if(t.preventDefault(),/^#/.test(o)){const t=e.dom.select(`${o},[name="${Ze(o,"#")}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(o,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")}))}else(e=>j(eL,e.type))(t)&&e.dispatch(t.type,t)},oL=Bt.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class nL{static isNative(e){return!!oL[e.toLowerCase()]}constructor(e){this.bindings={},this.settings=e||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||I}fire(e,t){return this.dispatch(e,t)}dispatch(e,t){const o=e.toLowerCase(),n=Ba(o,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(n);const r=this.bindings[o];if(r)for(let e=0,t=r.length;e{this.toggleEvent(t,!1),delete this.bindings[t]})),this;if(s){if(t){const e=K(s,(e=>e.func===t));s=e.fail,this.bindings[r]=s,q(e.pass,(e=>{e.removed=!0}))}else s.length=0;s.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else fe(this.bindings,((e,t)=>{this.toggleEvent(t,!1)})),this.bindings={};return this}once(e,t,o){return this.on(e,t,o,{once:!0})}has(e){e=e.toLowerCase();const t=this.bindings[e];return!(!t||0===t.length)}}const rL=e=>(e._eventDispatcher||(e._eventDispatcher=new nL({scope:e,toggleEvent:(t,o)=>{nL.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,o)}})),e._eventDispatcher),sL={fire(e,t,o){return this.dispatch(e,t,o)},dispatch(e,t,o){const n=this;if(n.removed&&"remove"!==e&&"detach"!==e)return Ba(e.toLowerCase(),null!=t?t:{},n);const r=rL(n).dispatch(e,t);if(!1!==o&&n.parent){let t=n.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent?t.parent():void 0}return r},on(e,t,o){return rL(this).on(e,t,o)},off(e,t){return rL(this).off(e,t)},once(e,t){return rL(this).once(e,t)},hasEventListeners(e){return rL(this).has(e)}},aL=Ya.DOM;let iL;const lL=(e,t)=>{if("selectionchange"===t)return e.getDoc();if(!e.inline&&/^(?:mouse|touch|click|contextmenu|drop|dragover|dragend)/.test(t))return e.getDoc().documentElement;const o=Tc(e);return o?(e.eventRoot||(e.eventRoot=aL.select(o)[0]),e.eventRoot):e.getBody()},cL=(e,t,o)=>{(e=>!e.hidden&&!JB(e))(e)?e.dispatch(t,o):JB(e)&&tL(e,o)},dL=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const o=lL(e,t);if(Tc(e)){if(iL||(iL={},e.editorManager.on("removeEditor",(()=>{e.editorManager.activeEditor||iL&&(fe(iL,((t,o)=>{e.dom.unbind(lL(e,o))})),iL=null)}))),iL[t])return;const n=o=>{const n=o.target,r=e.editorManager.get();let s=r.length;for(;s--;){const e=r[s].getBody();(e===n||aL.isChildOf(n,e))&&cL(r[s],t,o)}};iL[t]=n,aL.bind(o,t,n)}else{const n=o=>{cL(e,t,o)};aL.bind(o,t,n),e.delegates[t]=n}},mL={...sL,bindPendingEventDelegates(){const e=this;Bt.each(e._pendingNativeEvents,(t=>{dL(e,t)}))},toggleNativeEvent(e,t){const o=this;"focus"!==e&&"blur"!==e&&(o.removed||(t?o.initialized?dL(o,e):o._pendingNativeEvents?o._pendingNativeEvents.push(e):o._pendingNativeEvents=[e]:o.initialized&&o.delegates&&(o.dom.unbind(lL(o,e),e,o.delegates[e]),delete o.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),o=e.dom;e.delegates&&(fe(e.delegates,((t,o)=>{e.dom.unbind(lL(e,o),o,t)})),delete e.delegates),!e.inline&&t&&o&&(t.onload=null,o.unbind(e.getWin()),o.unbind(e.getDoc())),o&&(o.unbind(t),o.unbind(e.getContainer()))}},uL=e=>h(e)?{value:e.split(/[ ,]/),valid:!0}:_(e,h)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},gL=(e,t)=>e+(Xe(t.message)?"":`. ${t.message}`),hL=e=>e.valid,pL=(e,t,o="")=>{const n=t(e);return y(n)?n?{value:e,valid:!0}:{valid:!1,message:o}:n},fL=(e,t)=>{const o={},n={},r=(e,t,o)=>{const r=pL(t,o);return hL(r)?(n[e]=r.value,!0):(console.warn(gL(`Invalid value passed for the ${e} option`,r)),!1)},s=e=>_e(o,e);return{register:(e,s)=>{const a=(e=>h(e.processor))(s)?(e=>{const t=(()=>{switch(e){case"array":return v;case"boolean":return y;case"function":return S;case"number":return k;case"object":return p;case"string":return h;case"string[]":return uL;case"object[]":return e=>_(e,p);case"regexp":return e=>g(e,RegExp);default:return P}})();return o=>pL(o,t,`The value must be a ${e}.`)})(s.processor):s.processor,i=((e,t,o)=>{if(!w(t)){const n=pL(t,o);if(hL(n))return n.value;console.error(gL(`Invalid default value passed for the "${e}" option`,n))}})(e,s.default,a);o[e]={...s,default:i,processor:a},ke(n,e).orThunk((()=>ke(t,e))).each((t=>r(e,t,a)))},isRegistered:s,get:e=>ke(n,e).orThunk((()=>ke(o,e).map((e=>e.default)))).getOrUndefined(),set:(e,t)=>{if(s(e)){const n=o[e];return n.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):r(e,t,n.processor)}return console.warn(`"${e}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:e=>{const t=s(e);return t&&delete n[e],t},isSet:e=>_e(n,e)}},vL=["design","readonly"],bL=(e,t,o,n)=>{const r=o[t.get()],s=o[n];try{s.activate()}catch(e){return void console.error(`problem while activating editor mode ${n}:`,e)}r.deactivate(),r.editorReadOnly!==s.editorReadOnly&&XB(e,s.editorReadOnly),t.set(n),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,n)},yL=e=>{const t=Qa("design"),o=Qa({design:{activate:E,deactivate:E,editorReadOnly:!1},readonly:{activate:E,deactivate:E,editorReadOnly:!0}});return(e=>{e.serializer?QB(e):e.on("PreInit",(()=>{QB(e)}))})(e),(e=>{e.on("ShowCaret",(t=>{JB(e)&&t.preventDefault()})),e.on("ObjectSelected",(t=>{JB(e)&&t.preventDefault()}))})(e),{isReadOnly:()=>JB(e),set:n=>((e,t,o,n)=>{if(n!==o.get()){if(!_e(t,n))throw new Error(`Editor mode '${n}' is invalid`);e.initialized?bL(e,o,t,n):e.on("init",(()=>bL(e,o,t,n)))}})(e,o.get(),t,n),get:()=>t.get(),register:(e,t)=>{o.set(((e,t,o)=>{if(j(vL,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...o,deactivate:()=>{try{o.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(o.get(),e,t))}}},wL=Bt.each,xL=Bt.explode,CL={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},SL=Bt.makeMap("alt,ctrl,shift,meta,access"),kL=e=>{const t={},o=At.os.isMacOS()||At.os.isiOS();wL(xL(e.toLowerCase(),"+"),(e=>{(e=>e in SL)(e)?t[e]=!0:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=CL[e]||e.toUpperCase().charCodeAt(0))}));const n=[t.keyCode];let r;for(r in SL)t[r]?n.push(r):t[r]=!1;return t.id=n.join(","),t.access&&(t.alt=!0,o?t.ctrl=!0:t.shift=!0),t.meta&&(o?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class _L{constructor(e){this.shortcuts={},this.pendingPatterns=[],this.editor=e;const t=this;e.on("keyup keypress keydown",(e=>{!t.hasModifier(e)&&!t.isFunctionKey(e)||e.isDefaultPrevented()||(wL(t.shortcuts,(o=>{t.matchShortcut(e,o)&&(t.pendingPatterns=o.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(o))})),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))}))}add(e,t,o,n){const r=this,s=r.normalizeCommandFunc(o);return wL(xL(Bt.trim(e)),(e=>{const o=r.createShortcut(e,t,s,n);r.shortcuts[o.id]=o})),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,o=e;return"string"==typeof o?()=>{t.editor.execCommand(o,!1,null)}:Bt.isArray(o)?()=>{t.editor.execCommand(o[0],o[1],o[2])}:o}createShortcut(e,t,o,n){const r=Bt.map(xL(e,">"),kL);return r[r.length-1]=Bt.extend(r[r.length-1],{func:o,scope:n||this.editor}),Bt.extend(r[0],{desc:this.editor.translate(t),subpatterns:r.slice(1)})}hasModifier(e){return e.altKey||e.ctrlKey||e.metaKey}isFunctionKey(e){return"keydown"===e.type&&e.keyCode>=112&&e.keyCode<=123}matchShortcut(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)}executeShortcutAction(e){return e.func?e.func.call(e.scope):null}}const EL=()=>{const e=(()=>{const e={},t={},o={},n={},r={},s={},a={},i={},l=(e,t)=>(o,n)=>{e[o.toLowerCase()]={...n,type:t}};return{addButton:l(e,"button"),addGroupToolbarButton:l(e,"grouptoolbarbutton"),addToggleButton:l(e,"togglebutton"),addMenuButton:l(e,"menubutton"),addSplitButton:l(e,"splitbutton"),addMenuItem:l(t,"menuitem"),addNestedMenuItem:l(t,"nestedmenuitem"),addToggleMenuItem:l(t,"togglemenuitem"),addAutocompleter:l(o,"autocompleter"),addContextMenu:l(r,"contextmenu"),addContextToolbar:l(s,"contexttoolbar"),addContextForm:l(s,"contextform"),addSidebar:l(a,"sidebar"),addView:l(i,"views"),addIcon:(e,t)=>n[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:n,popups:o,contextMenus:r,contextToolbars:s,sidebars:a,views:i})}})();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,addView:e.addView,getAll:e.getAll}},TL=Ya.DOM,OL=Bt.extend,DL=Bt.each;class AL{constructor(e,t,o){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.composing=!1,this.destroyed=!1,this.hasHiddenInput=!1,this.iframeElement=null,this.initialized=!1,this.readonly=!1,this.removed=!1,this.startContent="",this._pendingNativeEvents=[],this._skinLoaded=!1,this._editableRoot=!0,this.editorManager=o,this.documentBaseUrl=o.documentBaseURL,OL(this,mL);const n=this;this.id=e,this.hidden=!1;const r=((e,t)=>CB(hB||pB,hB,t,e,t))(o.defaultOptions,t);this.options=fL(0,r),(e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean",default:!0}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:""}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:Ul(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:Ul(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:e=>{const t=h(e)&&Ye(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:e=>{const t=j(["block","linebreak","invert","default"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:e=>y(e)||h(e)?{valid:!0,value:e}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:e=>{const t=!1===e||h(e)||_(e,h);return t?h(e)?{value:$(e.split(","),qe),valid:t}:v(e)?{value:e,valid:t}:!1===e?{value:[],valid:t}:{value:e,valid:t}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:Fc(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=h(e)||_(e,h);return t?{value:v(e)?e:$(e.split(","),qe),valid:t}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:e=>{const t=y(e)||h(e);return t?!1===e||Il.isiPhone()||Il.isiPad()?{value:"",valid:t}:{value:!0===e?"table,img,figure.image,div,video,iframe":e,valid:t}:{valid:!1,message:"Must be boolean or a string"}},default:!Pl}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"object"}),t("service_message",{processor:"string"}),t("theme",{processor:e=>!1===e||h(e)||S(e),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("format_noneditable_selector",{processor:"string",default:""}),t("preview_styles",{processor:e=>{const t=!1===e||h(e);return t?{value:!1===e?"":e,valid:t}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("readonly",{processor:"boolean",default:!1}),t("editable_root",{processor:"boolean",default:!0}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area. Press ALT-0 for help."}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean",default:!0}),t("pad_empty_with_br",{processor:"boolean",default:!1}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:"string"}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:Zl}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:Zl}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:Zl}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>h(e)||!0===e}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:e=>_(e,p)||!1===e?{value:Hl(!1===e?[]:e),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1"},{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:"1. ",cmd:"InsertOrderedList"},{start:"* ",cmd:"InsertUnorderedList"},{start:"- ",cmd:"InsertUnorderedList"}]}),t("text_patterns_lookup",{processor:e=>{return S(e)?{value:(t=e,e=>{const o=t(e);return Hl(o)}),valid:!0}:{valid:!1,message:"Must be a single function"};var t},default:e=>[]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:e=>_(e,zl)?{value:e,valid:!0}:zl(e)?{value:[e],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),t("highlight_on_focus",{processor:"boolean",default:!1}),t("xss_sanitization",{processor:"boolean",default:!0}),t("details_initial_state",{processor:e=>{const t=j(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("details_serialized_state",{processor:e=>{const t=j(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("init_content_sync",{processor:"boolean",default:!1}),t("newdocument_content",{processor:"string",default:""}),t("force_hex_color",{processor:e=>{const t=["always","rgb_only","off"],o=j(t,e);return o?{value:e,valid:o}:{valid:!1,message:`Must be one of: ${t.join(", ")}.`}},default:"off"}),t("sandbox_iframes",{processor:"boolean",default:!1}),t("convert_unsafe_embeds",{processor:"boolean",default:!1}),e.on("ScriptsLoaded",(()=>{t("directionality",{processor:"string",default:ni.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:Fl.getAttrib(e.getElement(),"placeholder")})}))})(n);const s=this.options.get;s("deprecation_warnings")&&qC(t,r);const a=s("suffix");a&&(o.suffix=a),this.suffix=o.suffix;const i=s("base_url");i&&o._setBaseUrl(i),this.baseUri=o.baseURI;const l=hc(n);l&&(Ja.ScriptLoader._setReferrerPolicy(l),Ya.DOM.styleSheetLoader._setReferrerPolicy(l));const c=Gc(n);C(c)&&Ya.DOM.styleSheetLoader._setContentCssCors(c),ri.languageLoad=s("language_load"),ri.baseURL=o.baseURL,this.setDirty(!1),this.documentBaseURI=new px($l(n),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=Fc(n),this.hasVisual=Jc(n),this.shortcuts=new _L(this),this.editorCommands=new qB(this),jB(this);const d=s("cache_suffix");d&&(At.cacheSuffix=d.replace(/^[\?\&]+/,"")),this.ui={registry:EL(),styleSheetLoader:void 0,show:E,hide:E,setEnabled:E,isEnabled:P},this.mode=yL(n),o.dispatch("SetupEditor",{editor:this});const m=od(n);S(m)&&m.call(n,n)}render(){uB(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return ap(this)}translate(e){return ni.translate(e)}getParam(e,t,o){const n=this.options;return n.isRegistered(e)||(C(o)?n.register(e,{processor:o,default:t}):n.register(e,{processor:P,default:t})),n.isSet(e)||w(t)?n.get(e):t}hasPlugin(e,t){return!(!j(Kc(this),e)||t&&void 0===cS.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,o){this.editorCommands.addCommand(e,t,o)}addQueryStateHandler(e,t,o){this.editorCommands.addQueryStateHandler(e,t,o)}addQueryValueHandler(e,t,o){this.editorCommands.addQueryValueHandler(e,t,o)}addShortcut(e,t,o,n){this.shortcuts.add(e,t,o,n)}execCommand(e,t,o,n){return this.editorCommands.execCommand(e,t,o,n)}queryCommandState(e){return this.editorCommands.queryCommandState(e)}queryCommandValue(e){return this.editorCommands.queryCommandValue(e)}queryCommandSupported(e){return this.editorCommands.queryCommandSupported(e)}show(){const e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable="true":(TL.show(e.getContainer()),TL.hide(e.id)),e.load(),e.dispatch("show"))}hide(){const e=this;e.hidden||(e.save(),e.inline?(e.getBody().contentEditable="false",e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(TL.hide(e.getContainer()),TL.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(e,t){this.dispatch("ProgressState",{state:e,time:t})}load(e={}){const t=this,o=t.getElement();if(t.removed)return"";if(o){const n={...e,load:!0},r=er(o)?o.value:o.innerHTML,s=t.setContent(r,n);return n.no_events||t.dispatch("LoadContent",{...n,element:o}),s}return""}save(e={}){const t=this;let o=t.getElement();if(!o||!t.initialized||t.removed)return"";const n={...e,save:!0,element:o};let r=t.getContent(n);const s={...n,content:r};if(s.no_events||t.dispatch("SaveContent",s),"raw"===s.format&&t.dispatch("RawSaveContent",s),r=s.content,er(o))o.value=r;else{!e.is_removing&&t.inline||(o.innerHTML=r);const n=TL.getParent(t.id,"form");n&&DL(n.elements,(e=>e.name!==t.id||(e.value=r,!1)))}return s.element=n.element=o=null,!1!==s.set_dirty&&t.setDirty(!1),r}setContent(e,t){return LC(this,e,t)}getContent(e){return BC(this,e)}insertContent(e,t){t&&(e=OL({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?LC(this,this.startContent,{format:"raw"}):LC(this,e),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(e){const t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.dispatch("dirty")}getContainer(){const e=this;return e.container||(e.container=e.editorContainer||TL.get(e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=TL.get(this.id)),this.targetElm}getWin(){const e=this;if(!e.contentWindow){const t=e.iframeElement;t&&(e.contentWindow=t.contentWindow)}return e.contentWindow}getDoc(){const e=this;if(!e.contentDocument){const t=e.getWin();t&&(e.contentDocument=t.document)}return e.contentDocument}getBody(){var e,t;const o=this.getDoc();return null!==(t=null!==(e=this.bodyElement)&&void 0!==e?e:null==o?void 0:o.body)&&void 0!==t?t:null}convertURL(e,t,o){const n=this,r=n.options.get,s=rd(n);if(S(s))return s.call(n,e,o,!0,t);if(!r("convert_urls")||"link"===o||p(o)&&"LINK"===o.nodeName||0===e.indexOf("file:")||0===e.length)return e;const a=new px(e);return"http"!==a.protocol&&"https"!==a.protocol&&""!==a.protocol?e:r("relative_urls")?n.documentBaseURI.toRelative(e):e=n.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){SB(this,e)}setEditableRoot(e){((e,t)=>{e._editableRoot!==t&&(e._editableRoot=t,e.readonly||(e.getBody().contentEditable=String(e.hasEditableRoot()),e.nodeChanged()),((e,t)=>{e.dispatch("EditableRootStateChange",{state:t})})(e,t))})(this,e)}hasEditableRoot(){return this._editableRoot}remove(){YC(this)}destroy(e){XC(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const ML=Ya.DOM,NL=Bt.each;let RL,BL=!1,LL=[];const HL=e=>{const t=e.type;NL(zL.get(),(o=>{switch(t){case"scroll":o.dispatch("ScrollWindow",e);break;case"resize":o.dispatch("ResizeWindow",e)}}))},IL=e=>{if(e!==BL){const t=Ya.DOM;e?(t.bind(window,"resize",HL),t.bind(window,"scroll",HL)):(t.unbind(window,"resize",HL),t.unbind(window,"scroll",HL)),BL=e}},PL=e=>{const t=LL;return LL=Y(LL,(t=>e!==t)),zL.activeEditor===e&&(zL.activeEditor=LL.length>0?LL[0]:null),zL.focusedEditor===e&&(zL.focusedEditor=null),t.length!==LL.length},FL="CSS1Compat"!==document.compatMode,zL={...sL,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"6",minorVersion:"8.3",releaseDate:"2024-02-08",i18n:ni,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",o="",n=px.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/"));const r=window.tinymce||window.tinyMCEPreInit;if(r)t=r.base||r.baseURL,o=r.suffix;else{const e=document.getElementsByTagName("script");for(let n=0;n{ri.PluginManager.urls[t]=e}))},init(e){const t=this;let o;const n=Bt.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," ");let r=e=>{o=e};const s=()=>{let o=0;const a=[];let i;ML.unbind(window,"ready",s),(o=>{const n=e[o];n&&n.apply(t,[])})("onpageload"),i=((e,t)=>{const o=[],n=S(t)?e=>W(o,(o=>t(o,e))):e=>j(o,e);for(let t=0,r=e.length;tAt.browser.isIE()||At.browser.isEdge()?(fS("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/6/support/#supportedwebbrowsers"),[]):FL?(fS("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):h(e.selector)?ML.select(e.selector):C(e.target)?[e.target]:[])(e)),Bt.each(i,(e=>{var o;(o=t.get(e.id))&&o.initialized&&!(o.getContainer()||o.getBody()).parentNode&&(PL(o),o.unbindAllNativeEvents(),o.destroy(!0),o.removed=!0)})),i=Bt.grep(i,(e=>!t.get(e.id))),0===i.length?r([]):NL(i,(s=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in n)(e,s)?fS("Could not initialize inline editor on invalid inline target element",s):((e,n,s)=>{const l=new AL(e,n,t);a.push(l),l.on("init",(()=>{++o===i.length&&r(a)})),l.targetElm=l.targetElm||s,l.render()})((e=>{let t=e.id;return t||(t=ke(e,"name").filter((e=>!ML.get(e))).getOrThunk(ML.uniqueId),e.setAttribute("id",t)),t})(s),e,s)}))};return ML.bind(window,"ready",s),new Promise((e=>{o?e(o):r=t=>{e(t)}}))},get(e){return 0===arguments.length?LL.slice(0):h(e)?ee(LL,(t=>t.id===e)).getOr(null):k(e)&&LL[e]?LL[e]:null},add(e){const t=this,o=t.get(e.id);return o===e||(null===o&&LL.push(e),IL(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),RL||(RL=e=>{const o=t.dispatch("BeforeUnload");if(o.returnValue)return e.preventDefault(),e.returnValue=o.returnValue,o.returnValue},window.addEventListener("beforeunload",RL))),e},createEditor(e,t){return this.add(new AL(e,t,this))},remove(e){const t=this;let o;if(e){if(!h(e))return o=e,b(t.get(o.id))?null:(PL(o)&&t.dispatch("RemoveEditor",{editor:o}),0===LL.length&&window.removeEventListener("beforeunload",RL),o.remove(),IL(LL.length>0),o);NL(ML.select(e),(e=>{o=t.get(e.id),o&&t.remove(o)}))}else for(let e=LL.length-1;e>=0;e--)t.remove(LL[e])},execCommand(e,t,o){var n;const r=this,s=p(o)?null!==(n=o.id)&&void 0!==n?n:o.index:o;switch(e){case"mceAddEditor":if(!r.get(s)){const e=o.options;new AL(s,e,r).render()}return!0;case"mceRemoveEditor":{const e=r.get(s);return e&&e.remove(),!0}case"mceToggleEditor":{const e=r.get(s);return e?(e.isHidden()?e.show():e.hide(),!0):(r.execCommand("mceAddEditor",!1,o),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,o)},triggerSave:()=>{NL(LL,(e=>{e.save()}))},addI18n:(e,t)=>{ni.add(e,t)},translate:e=>ni.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new px(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new px(this.baseURL)}};zL.setup();const VL=(()=>{const e=ai();return{FakeClipboardItem:e=>({items:e,types:he(e),getType:t=>ke(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),ZL=Math.min,UL=Math.max,jL=Math.round,WL=(e,t,o)=>{let n=t.x,r=t.y;const s=e.w,a=e.h,i=t.w,l=t.h,c=(o||"").split("");return"b"===c[0]&&(r+=l),"r"===c[1]&&(n+=i),"c"===c[0]&&(r+=jL(l/2)),"c"===c[1]&&(n+=jL(i/2)),"b"===c[3]&&(r-=a),"r"===c[4]&&(n-=s),"c"===c[3]&&(r-=jL(a/2)),"c"===c[4]&&(n-=jL(s/2)),$L(n,r,s,a)},$L=(e,t,o,n)=>({x:e,y:t,w:o,h:n}),qL={inflate:(e,t,o)=>$L(e.x-t,e.y-o,e.w+2*t,e.h+2*o),relativePosition:WL,findBestRelativePosition:(e,t,o,n)=>{for(let r=0;r=o.x&&s.x+s.w<=o.w+o.x&&s.y>=o.y&&s.y+s.h<=o.h+o.y)return n[r]}return null},intersect:(e,t)=>{const o=UL(e.x,t.x),n=UL(e.y,t.y),r=ZL(e.x+e.w,t.x+t.w),s=ZL(e.y+e.h,t.y+t.h);return r-o<0||s-n<0?null:$L(o,n,r-o,s-n)},clamp:(e,t,o)=>{let n=e.x,r=e.y,s=e.x+e.w,a=e.y+e.h;const i=t.x+t.w,l=t.y+t.h,c=UL(0,t.x-n),d=UL(0,t.y-r),m=UL(0,s-i),u=UL(0,a-l);return n+=c,r+=d,o&&(s+=c,a+=d,n-=m,r-=u),s-=m,a-=u,$L(n,r,s-n,a-r)},create:$L,fromClientRect:e=>$L(e.left,e.top,e.width,e.height)},GL=(()=>{const e={},t={},o={};return{load:(o,n)=>{const r=`Script at URL "${n}" failed to load`,s=`Script at URL "${n}" did not call \`tinymce.Resource.add('${o}', data)\` within 1 second`;if(void 0!==e[o])return e[o];{const a=new Promise(((e,a)=>{const i=((e,t,o=1e3)=>{let n=!1,r=null;const s=e=>(...t)=>{n||(n=!0,null!==r&&(clearTimeout(r),r=null),e.apply(null,t))},a=s(e),i=s(t);return{start:(...e)=>{n||null!==r||(r=setTimeout((()=>i.apply(null,e)),o))},resolve:a,reject:i}})(e,a);t[o]=i.resolve,Ja.ScriptLoader.loadScript(n).then((()=>i.start(s)),(()=>i.reject(r)))}));return e[o]=a,a}},add:(n,r)=>{void 0!==t[n]&&(t[n](r),delete t[n]),e[n]=Promise.resolve(r),o[n]=r},has:e=>e in o,get:e=>o[e],unload:t=>{delete e[t]}}})();let KL;try{const e="__storage_test__";KL=window.localStorage,KL.setItem(e,e),KL.removeItem(e)}catch(e){KL=(()=>{let e={},t=[];const o={getItem:t=>e[t]||null,setItem:(o,n)=>{t.push(o),e[o]=String(n)},key:e=>t[e],removeItem:o=>{t=t.filter((e=>e===o)),delete e[o]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(o,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),o})()}const YL={geom:{Rect:qL},util:{Delay:qh,Tools:Bt,VK:Dg,URI:px,EventDispatcher:nL,Observable:sL,I18n:ni,LocalStorage:KL,ImageUploader:e=>{const t=xS(),o=ES(e,t);return{upload:(t,n=!0)=>o.upload(t,n?_S(e):void 0)}}},dom:{EventUtils:za,TreeWalker:Zn,TextSeeker:Oi,DOMUtils:Ya,ScriptLoader:Ja,RangeUtils:mh,Serializer:RC,StyleSheetLoader:Zs,ControlSelection:Bg,BookmarkManager:xg,Selection:OC,Event:za.Event},html:{Styles:Aa,Entities:ia,Node:Ep,Schema:ya,DomParser:Mx,Writer:Wp,Serializer:$p},Env:At,AddOnManager:ri,Annotator:wg,Formatter:zS,UndoManager:ZS,EditorCommands:qB,WindowManager:mS,NotificationManager:lS,EditorObservable:mL,Shortcuts:_L,Editor:AL,FocusManager:$h,EditorManager:zL,DOM:Ya.DOM,ScriptLoader:Ja.ScriptLoader,PluginManager:cS,ThemeManager:dS,ModelManager:QC,IconManager:JC,Resource:GL,FakeClipboard:VL,trim:Bt.trim,isArray:Bt.isArray,is:Bt.is,toArray:Bt.toArray,makeMap:Bt.makeMap,each:Bt.each,map:Bt.map,grep:Bt.grep,inArray:Bt.inArray,extend:Bt.extend,walk:Bt.walk,resolve:Bt.resolve,explode:Bt.explode,_addCacheSuffix:Bt._addCacheSuffix},XL=Bt.extend(zL,YL);(e=>{window.tinymce=e,window.tinyMCE=e})(XL),(e=>{try{t.exports=e}catch(e){}})(XL)}();var n=e(o.exports);tinymce.IconManager.add("default",{icons:{"accessibility-check":'',"accordion-toggle":'',accordion:'',"action-next":'',"action-prev":'',addtag:'',"ai-prompt":'',ai:'',"align-center":'',"align-justify":'',"align-left":'',"align-none":'',"align-right":'',"arrow-left":'',"arrow-right":'',bold:'',bookmark:'',"border-style":'',"border-width":'',brightness:'',browse:'',cancel:'',"cell-background-color":'',"cell-border-color":'',"change-case":'',"character-count":'',"checklist-rtl":'',checklist:'',checkmark:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',close:'',"code-sample":'',"color-levels":'',"color-picker":'',"color-swatch-remove-color":'',"color-swatch":'',"comment-add":'',comment:'',contrast:'',copy:'',crop:'',"cut-column":'',"cut-row":'',cut:'',"document-properties":'',drag:'',"duplicate-column":'',"duplicate-row":'',duplicate:'',"edit-block":'',"edit-image":'',"embed-page":'',embed:'',emoji:'',export:'',fill:'',"flip-horizontally":'',"flip-vertically":'',footnote:'',"format-painter":'',format:'',fullscreen:'',gallery:'',gamma:'',help:'',"highlight-bg-color":'',home:'',"horizontal-rule":'',"image-options":'',image:'',indent:'',info:'',"insert-character":'',"insert-time":'',invert:'',italic:'',language:'',"line-height":'',line:'',link:'',"list-bull-circle":'',"list-bull-default":'',"list-bull-square":'',"list-num-default-rtl":'',"list-num-default":'',"list-num-lower-alpha-rtl":'',"list-num-lower-alpha":'',"list-num-lower-greek-rtl":'',"list-num-lower-greek":'',"list-num-lower-roman-rtl":'',"list-num-lower-roman":'',"list-num-upper-alpha-rtl":'',"list-num-upper-alpha":'',"list-num-upper-roman-rtl":'',"list-num-upper-roman":'',lock:'',ltr:'',minus:'',"more-drawer":'',"new-document":'',"new-tab":'',"non-breaking":'',notice:'',"ordered-list-rtl":'',"ordered-list":'',orientation:'',outdent:'',"page-break":'',paragraph:'',"paste-column-after":'',"paste-column-before":'',"paste-row-after":'',"paste-row-before":'',"paste-text":'',paste:'',"permanent-pen":'',plus:'',preferences:'',preview:'',print:'',quote:'',redo:'',reload:'',"remove-formatting":'',remove:'',"resize-handle":'',resize:'',"restore-draft":'',"rotate-left":'',"rotate-right":'',rtl:'',save:'',search:'',"select-all":'',selected:'',send:'',settings:'',sharpen:'',sourcecode:'',"spell-check":'',"strike-through":'',subscript:'',superscript:'',"table-caption":'',"table-cell-classes":'',"table-cell-properties":'',"table-cell-select-all":'',"table-cell-select-inner":'',"table-classes":'',"table-delete-column":'',"table-delete-row":'',"table-delete-table":'',"table-insert-column-after":'',"table-insert-column-before":'',"table-insert-row-above":'',"table-insert-row-after":'',"table-left-header":'',"table-merge-cells":'',"table-row-numbering-rtl":'',"table-row-numbering":'',"table-row-properties":'',"table-split-cells":'',"table-top-header":'',table:'',"template-add":'',template:'',"temporary-placeholder":'',"text-color":'',"text-size-decrease":'',"text-size-increase":'',toc:'',translate:'',typography:'',underline:'',undo:'',unlink:'',unlock:'',"unordered-list":'',unselected:'',upload:'',user:'',"vertical-align":'',visualblocks:'',visualchars:'',warning:'',"zoom-in":'',"zoom-out":''}}),function(){const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>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,r=e=>t=>e===t,s=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=r(null),d=n("boolean"),m=r(void 0),u=e=>null==e,g=e=>!u(e),h=n("function"),p=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o{},b=e=>()=>e(),y=(e,t)=>(...o)=>e(t.apply(null,o)),w=e=>()=>e,x=e=>e,C=(e,t)=>e===t;function S(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),_=e=>()=>{throw new Error(e)},E=e=>e(),T=w(!1),O=w(!0);class D{constructor(e,t){this.tag=e,this.value=t}static some(e){return new D(!0,e)}static none(){return D.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?D.some(e(this.value)):D.none()}bind(e){return this.tag?e(this.value):D.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:D.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?D.some(e):D.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()"}}D.singletonNone=new D(!1);const A=Array.prototype.slice,M=Array.prototype.indexOf,N=Array.prototype.push,R=(e,t)=>M.call(e,t),B=(e,t)=>{const o=R(e,t);return-1===o?D.none():D.some(o)},L=(e,t)=>R(e,t)>-1,H=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t,o)=>(z(e,((e,n)=>{o=t(o,e,n)})),o),W=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oq(F(e,t)),K=(e,t)=>{for(let o=0,n=e.length;o{const t=A.call(e,0);return t.reverse(),t},X=(e,t)=>Z(e,(e=>!L(t,e))),J=(e,t)=>{const o={};for(let n=0,r=e.length;n[e],ee=(e,t)=>{const o=A.call(e,0);return o.sort(t),o},te=(e,t)=>t>=0&&tte(e,0),ne=e=>te(e,e.length-1),re=h(Array.from)?Array.from:e=>A.call(e),se=(e,t)=>{for(let o=0;o{const o=ae(e);for(let n=0,r=o.length;nde(e,((e,o)=>({k:o,v:t(e,o)}))),de=(e,t)=>{const o={};return le(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},me=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{le(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))},ge=(e,t)=>{const o={};return ue(e,t,me(o),v),o},he=(e,t)=>{const o=[];return le(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=ae(e);for(let n=0,r=o.length;nhe(e,x),ve=(e,t)=>be(e,t)?D.from(e[t]):D.none(),be=(e,t)=>ie.call(e,t),ye=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],we=(e,t,o=C)=>e.exists((e=>o(e,t))),xe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te.isSome()&&t.isSome()?D.some(o(e.getOrDie(),t.getOrDie())):D.none(),Se=(e,t)=>null!=e?D.some(t(e)):D.none(),ke=(e,t)=>e?D.some(t):D.none(),_e=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ee=(e,t)=>Oe(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Te=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!m(n)||r+t.length<=n)},Oe=(e,t)=>_e(e,t,0),De=(e,t)=>_e(e,t,e.length-t.length),Ae=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Me=e=>e.length>0,Ne=e=>!Me(e),Re=e=>void 0!==e.style&&h(e.style.getPropertyValue),Be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Le={fromHtml:(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 Be(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return Be(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return Be(o)},fromDom:Be,fromPoint:(e,t,o)=>D.from(e.dom.elementFromPoint(t,o)).map(Be)},He="undefined"!=typeof window?window:Function("return this;")(),Ie=(e,t)=>((e,t)=>{let o=null!=t?t:He;for(let t=0;t{const o=((e,t)=>Ie(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},Fe=Object.getPrototypeOf,ze=e=>{const t=Ie("ownerDocument.defaultView",e);return a(e)&&((e=>Pe("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Fe(e).constructor.name))},Ve=e=>e.dom.nodeName.toLowerCase(),Ze=e=>t=>(e=>e.dom.nodeType)(t)===e,Ue=e=>je(e)&&ze(e.dom),je=Ze(1),We=Ze(3),$e=Ze(9),qe=Ze(11),Ge=e=>t=>je(t)&&Ve(t)===e,Ke=(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")}},Ye=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Xe=(e,t)=>e.dom===t.dom,Je=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Qe=e=>Le.fromDom(e.dom.ownerDocument),et=e=>$e(e)?e:Qe(e),tt=e=>Le.fromDom(et(e).dom.documentElement),ot=e=>Le.fromDom(et(e).dom.defaultView),nt=e=>D.from(e.dom.parentNode).map(Le.fromDom),rt=e=>D.from(e.dom.parentElement).map(Le.fromDom),st=e=>D.from(e.dom.offsetParent).map(Le.fromDom),at=e=>F(e.dom.childNodes,Le.fromDom),it=(e,t)=>{const o=e.dom.childNodes;return D.from(o[t]).map(Le.fromDom)},lt=e=>it(e,0),ct=(e,t)=>({element:e,offset:t}),dt=(e,t)=>{const o=at(e);return o.length>0&&tqe(e)&&g(e.dom.host),ut=h(Element.prototype.attachShadow)&&h(Node.prototype.getRootNode),gt=w(ut),ht=ut?e=>Le.fromDom(e.dom.getRootNode()):et,pt=e=>mt(e)?e:Le.fromDom(et(e).dom.body),ft=e=>{const t=ht(e);return mt(t)?D.some(t):D.none()},vt=e=>Le.fromDom(e.dom.host),bt=e=>g(e.dom.shadowRoot),yt=e=>{const t=We(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ft(Le.fromDom(t)).fold((()=>o.body.contains(t)),(n=yt,r=vt,e=>n(r(e))));var n,r},wt=()=>xt(Le.fromDom(document)),xt=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Le.fromDom(t)},Ct=(e,t,o)=>{if(!(s(o)||d(o)||p(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+"")},St=(e,t,o)=>{Ct(e.dom,t,o)},kt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{Ct(o,t,e)}))},_t=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Et=(e,t)=>D.from(_t(e,t)),Tt=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Ot=(e,t)=>{e.dom.removeAttribute(t)},Dt=(e,t,o)=>{if(!s(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Re(e)&&e.style.setProperty(t,o)},At=(e,t)=>{Re(e)&&e.style.removeProperty(t)},Mt=(e,t,o)=>{const n=e.dom;Dt(n,t,o)},Nt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{Dt(o,t,e)}))},Rt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{e.fold((()=>{At(o,t)}),(e=>{Dt(o,t,e)}))}))},Bt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||yt(e)?n:Lt(o,t)},Lt=(e,t)=>Re(e)?e.style.getPropertyValue(t):"",Ht=(e,t)=>{const o=e.dom,n=Lt(o,t);return D.from(n).filter((e=>e.length>0))},It=e=>{const t={},o=e.dom;if(Re(o))for(let e=0;e{const n=Le.fromTag(e);Mt(n,t,o);return Ht(n,t).isSome()},Ft=(e,t)=>{const o=e.dom;At(o,t),we(Et(e,"style").map(Ae),"")&&Ot(e,"style")},zt=e=>e.dom.offsetWidth,Vt=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Bt(o,e);return parseFloat(t)||0}return n},n=(e,t)=>j(t,((t,o)=>{const n=Bt(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!p(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Re(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},Zt=Vt("height",(e=>{const t=e.dom;return yt(e)?t.getBoundingClientRect().height:t.offsetHeight})),Ut=e=>Zt.get(e),jt=e=>Zt.getOuter(e),Wt=(e,t)=>({left:e,top:t,translate:(o,n)=>Wt(e+o,t+n)}),$t=Wt,qt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Gt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return $t(o.offsetLeft,o.offsetTop);const s=qt(null==n?void 0:n.pageYOffset,r.scrollTop),a=qt(null==n?void 0:n.pageXOffset,r.scrollLeft),i=qt(r.clientTop,o.clientTop),l=qt(r.clientLeft,o.clientLeft);return Kt(e).translate(a-l,s-i)},Kt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?$t(o.offsetLeft,o.offsetTop):yt(e)?(e=>{const t=e.getBoundingClientRect();return $t(t.left,t.top)})(t):$t(0,0)},Yt=Vt("width",(e=>e.dom.offsetWidth)),Xt=e=>Yt.get(e),Jt=e=>Yt.getOuter(e),Qt=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},eo=()=>to(0,0),to=(e,t)=>({major:e,minor:t}),oo={nu:to,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?eo():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return to(n(1),n(2))})(e,o)},unknown:eo},no=(e,t)=>{const o=String(t).toLowerCase();return W(e,(e=>e.search(o)))},ro=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,so=e=>t=>Te(t,e),ao=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Te(e,"edge/")&&Te(e,"chrome")&&Te(e,"safari")&&Te(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ro],search:e=>Te(e,"chrome")&&!Te(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Te(e,"msie")||Te(e,"trident")},{name:"Opera",versionRegexes:[ro,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:so("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:so("firefox")},{name:"Safari",versionRegexes:[ro,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Te(e,"safari")||Te(e,"mobile/"))&&Te(e,"applewebkit")}],io=[{name:"Windows",search:so("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Te(e,"iphone")||Te(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:so("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:so("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:so("linux"),versionRegexes:[]},{name:"Solaris",search:so("sunos"),versionRegexes:[]},{name:"FreeBSD",search:so("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:so("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],lo={browsers:w(ao),oses:w(io)},co="Edge",mo="Chromium",uo="Opera",go="Firefox",ho="Safari",po=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(co),isChromium:n(mo),isIE:n("IE"),isOpera:n(uo),isFirefox:n(go),isSafari:n(ho)}},fo={unknown:()=>po({current:void 0,version:oo.unknown()}),nu:po,edge:w(co),chromium:w(mo),ie:w("IE"),opera:w(uo),firefox:w(go),safari:w(ho)},vo="Windows",bo="Android",yo="Linux",wo="macOS",xo="Solaris",Co="FreeBSD",So="ChromeOS",ko=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(vo),isiOS:n("iOS"),isAndroid:n(bo),isMacOS:n(wo),isLinux:n(yo),isSolaris:n(xo),isFreeBSD:n(Co),isChromeOS:n(So)}},_o={unknown:()=>ko({current:void 0,version:oo.unknown()}),nu:ko,windows:w(vo),ios:w("iOS"),android:w(bo),linux:w(yo),macos:w(wo),solaris:w(xo),freebsd:w(Co),chromeos:w(So)},Eo=(e,t,o)=>{const n=lo.browsers(),r=lo.oses(),s=t.bind((e=>((e,t)=>se(t.brands,(t=>{const o=t.brand.toLowerCase();return W(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:oo.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>no(e,t).map((e=>{const o=oo.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(fo.unknown,fo.nu),a=((e,t)=>no(e,t).map((e=>{const o=oo.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(_o.unknown,_o.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:w(r),isiPhone:w(s),isTablet:w(l),isPhone:w(c),isTouch:w(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:w(d),isDesktop:w(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},To=e=>window.matchMedia(e).matches;let Oo=Qt((()=>Eo(navigator.userAgent,D.from(navigator.userAgentData),To)));const Do=()=>Oo(),Ao=e=>{const t=Le.fromDom((e=>{if(gt()&&g(e.target)){const t=Le.fromDom(e.target);if(je(t)&&bt(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return oe(t)}}return D.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=y(n,o);return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},Mo=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(Ao(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:S(No,e,t,s,r)}},No=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Ro=(e,t)=>{nt(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Bo=(e,t)=>{const o=(e=>D.from(e.dom.nextSibling).map(Le.fromDom))(e);o.fold((()=>{nt(e).each((e=>{Ho(e,t)}))}),(e=>{Ro(e,t)}))},Lo=(e,t)=>{lt(e).fold((()=>{Ho(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ho=(e,t)=>{e.dom.appendChild(t.dom)},Io=(e,t)=>{z(t,(t=>{Ho(e,t)}))},Po=e=>{e.dom.textContent="",z(at(e),(e=>{Fo(e)}))},Fo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},zo=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return $t(o,n)},Vo=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},Zo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Uo=e=>{const t=void 0===e?window:e,o=t.document,n=zo(Le.fromDom(o));return(e=>{const t=void 0===e?window:e;return Do().browser.isFirefox()?D.none():D.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Zo(n.left,n.top,o,r)}),(e=>Zo(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},jo=()=>Le.fromDom(document),Wo=(e,t)=>e.view(t).fold(w([]),(t=>{const o=e.owner(t),n=Wo(e,o);return[t].concat(n)}));var $o=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?D.none():D.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Le.fromDom)},owner:e=>Qe(e)});const qo=e=>{const t=jo(),o=zo(t),n=((e,t)=>{const o=t.owner(e),n=Wo(t,o);return D.some(n)})(e,$o);return n.fold(S(Gt,e),(t=>{const n=Kt(e),r=U(t,((e,t)=>{const o=Kt(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return $t(r.left+n.left+o.left,r.top+n.top+o.top)}))},Go=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Ko=e=>{const t=Gt(e),o=Jt(e),n=jt(e);return Go(t.left,t.top,o,n)},Yo=e=>{const t=qo(e),o=Jt(e),n=jt(e);return Go(t.left,t.top,o,n)},Xo=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),r=Math.min(e.right,t.right),s=Math.min(e.bottom,t.bottom);return Go(o,n,r-o,s-n)},Jo=()=>Uo(window);var Qo=tinymce.util.Tools.resolve("tinymce.ThemeManager");const en=e=>{const t=t=>t(e),o=w(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:O,isError:T,map:t=>on.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:()=>D.some(e)};return r},tn=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:O,map:t,mapError:t=>on.error(t(e)),bind:t,exists:T,forall:O,getOr:x,or:x,getOrThunk:E,orThunk:E,getOrDie:_(String(e)),each:v,toOptional:D.none};return o},on={value:en,error:tn,fromOption:(e,t)=>e.fold((()=>tn(t)),en)};var nn;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(nn||(nn={}));const rn=(e,t,o)=>e.stype===nn.Error?t(e.serror):o(e.svalue),sn=e=>({stype:nn.Value,svalue:e}),an=e=>({stype:nn.Error,serror:e}),ln=e=>e.fold(an,sn),cn=e=>rn(e,on.error,on.value),dn=sn,mn=e=>{const t=[],o=[];return z(e,(e=>{rn(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}},un=an,gn=(e,t)=>e.stype===nn.Value?t(e.svalue):e,hn=(e,t)=>e.stype===nn.Error?t(e.serror):e,pn=(e,t)=>e.stype===nn.Value?{stype:nn.Value,svalue:t(e.svalue)}:e,fn=(e,t)=>e.stype===nn.Error?{stype:nn.Error,serror:t(e.serror)}:e,vn=rn,bn=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),yn=(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)}},wn=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;ni(e)&&i(t)?xn(e,t):t)),Cn=wn(((e,t)=>t)),Sn=e=>({tag:"defaultedThunk",process:e}),kn=e=>Sn(w(e)),_n=e=>({tag:"mergeWithThunk",process:e}),En=e=>y(un,q)(e),Tn=e=>{const t=mn(e);return t.errors.length>0?En(t.errors):dn(t.values)},On=e=>a(e)&&ae(e).length>100?" removed due to size":JSON.stringify(e,null,2),Dn=(e,t)=>un([{path:e,getErrorInfo:t}]),An=e=>({extract:(t,o)=>hn(e(o),(e=>((e,t)=>Dn(e,w(t)))(t,e))),toString:w("val")}),Mn=An(dn),Nn=(e,t,o,n)=>ve(t,o).fold((()=>((e,t,o)=>Dn(e,(()=>'Could not find valid *required* value for "'+t+'" in '+On(o))))(e,o,t)),n),Rn=(e,t,o,n)=>n(ve(e,t).getOrThunk((()=>o(e)))),Bn=(e,t,o,n,r)=>{const s=e=>r.extract(t.concat([n]),e),a=e=>e.fold((()=>dn(D.none())),(e=>{const o=r.extract(t.concat([n]),e);return pn(o,D.some)}));switch(e.tag){case"required":return Nn(t,o,n,s);case"defaultedThunk":return Rn(o,n,e.process,s);case"option":return((e,t,o)=>o(ve(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(ve(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return Rn(o,n,w({}),(t=>{const n=xn(e.process(o),t);return s(n)}))}},Ln=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),Hn=e=>ae(ge(e,g)),In=e=>{const t=Pn(e),o=U(e,((e,t)=>yn(t,(t=>xn(e,{[t]:!0})),w(e))),{});return{extract:(e,n)=>{const r=d(n)?[]:Hn(n),s=Z(r,(e=>!ye(o,e)));return 0===s.length?t.extract(e,n):((e,t)=>Dn(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,s)},toString:t.toString}},Pn=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const s of o)yn(s,((o,s,a,i)=>{const l=Bn(a,e,t,o,i);vn(l,(e=>{r.push(...e)}),(e=>{n[s]=e}))}),((e,o)=>{n[e]=o(t)}));return r.length>0?un(r):dn(n)})(t,o,e),toString:()=>{const t=F(e,(e=>yn(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),Fn=e=>({extract:(t,o)=>{const n=F(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return Tn(n)},toString:()=>"array("+e.toString()+")"}),zn=(e,t)=>{const o=void 0!==t?t:x;return{extract:(t,n)=>{const r=[];for(const s of e){const e=s.extract(t,n);if(e.stype===nn.Value)return{stype:nn.Value,svalue:o(e.svalue)};r.push(e)}return Tn(r)},toString:()=>"oneOf("+F(e,(e=>e.toString())).join(", ")+")"}},Vn=(e,t)=>({extract:(o,n)=>{const r=ae(n),s=((t,o)=>Fn(An(e)).extract(t,o))(o,r);return gn(s,(e=>{const r=F(e,(e=>bn(e,e,{tag:"required",process:{}},t)));return Pn(r).extract(o,n)}))},toString:()=>"setOf("+t.toString()+")"}),Zn=y(Fn,Pn),Un=w(Mn),jn=(e,t)=>An((o=>{const n=typeof o;return e(o)?dn(o):un(`Expected type: ${t} but got: ${n}`)})),Wn=jn(p,"number"),$n=jn(s,"string"),qn=jn(d,"boolean"),Gn=jn(h,"function"),Kn=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=>Kn(e[t])));default:return!1}},Yn=An((e=>Kn(e)?dn(e):un("Expected value to be acceptable for sending via postMessage"))),Xn=(e,t,o,n)=>ve(o,n).fold((()=>((e,t,o)=>Dn(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+On(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))),Jn=(e,t)=>({extract:(o,n)=>ve(n,e).fold((()=>((e,t)=>Dn(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>Xn(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+ae(t)}),Qn=e=>An((t=>e(t).fold(un,dn))),er=(e,t)=>Vn((t=>ln(e(t))),t),tr=(e,t,o)=>cn(((e,t,o)=>{const n=t.extract([e],o);return fn(n,(e=>({input:o,errors:e})))})(e,t,o)),or=e=>e.fold((e=>{throw new Error(rr(e))}),x),nr=(e,t,o)=>or(tr(e,t,o)),rr=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:w("... (only showing first ten failures)")}]):e;return F(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+On(e.input),sr=(e,t)=>Jn(e,ce(t,Pn)),ar=(e,t)=>((e,t)=>{const o=Qt(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),ir=bn,lr=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),cr=e=>Qn((t=>L(e,t)?on.value(t):on.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),dr=e=>ir(e,e,{tag:"required",process:{}},Un()),mr=(e,t)=>ir(e,e,{tag:"required",process:{}},t),ur=e=>mr(e,Wn),gr=e=>mr(e,$n),hr=(e,t)=>ir(e,e,{tag:"required",process:{}},cr(t)),pr=e=>mr(e,Gn),fr=(e,t)=>ir(e,e,{tag:"required",process:{}},Pn(t)),vr=(e,t)=>ir(e,e,{tag:"required",process:{}},Zn(t)),br=(e,t)=>ir(e,e,{tag:"required",process:{}},Fn(t)),yr=e=>ir(e,e,{tag:"option",process:{}},Un()),wr=(e,t)=>ir(e,e,{tag:"option",process:{}},t),xr=e=>wr(e,Wn),Cr=e=>wr(e,$n),Sr=(e,t)=>wr(e,cr(t)),kr=e=>wr(e,Gn),_r=(e,t)=>wr(e,Fn(t)),Er=(e,t)=>wr(e,Pn(t)),Tr=(e,t)=>ir(e,e,kn(t),Un()),Or=(e,t,o)=>ir(e,e,kn(t),o),Dr=(e,t)=>Or(e,t,Wn),Ar=(e,t)=>Or(e,t,$n),Mr=(e,t,o)=>Or(e,t,cr(o)),Nr=(e,t)=>Or(e,t,qn),Rr=(e,t)=>Or(e,t,Gn),Br=(e,t,o)=>Or(e,t,Fn(o)),Lr=(e,t,o)=>Or(e,t,Pn(o)),Hr=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Ir=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 z(e,((n,r)=>{const s=ae(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!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[r].apply(null,o)},match:e=>{const n=ae(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!K(t,(e=>L(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};Ir([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Pr=(e,t)=>((e,t)=>{const o={};return le(e,((e,n)=>{L(t,n)||(o[n]=e)})),o})(e,t),Fr=(e,t)=>((e,t)=>({[e]:t}))(e,t),zr=e=>(e=>{const t={};return z(e,(e=>{t[e.key]=e.value})),t})(e),Vr=(e,t)=>{const o=(e=>{const t=[],o=[];return z(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,on.error(q(n))):((e,t)=>0===e.length?on.value(t):on.value(xn(t,Cn.apply(void 0,e))))(o.values,t);var n},Zr=e=>h(e)?e:T,Ur=(e,t,o)=>{let n=e.dom;const r=Zr(o);for(;n.parentNode;){n=n.parentNode;const e=Le.fromDom(n),o=t(e);if(o.isSome())return o;if(r(e))break}return D.none()},jr=(e,t,o)=>{const n=t(e),r=Zr(o);return n.orThunk((()=>r(e)?D.none():Ur(e,t,r)))},Wr=(e,t)=>Xe(e.element,t.event.target),$r={can:O,abort:T,run:v},qr=e=>{if(!ye(e,"can")&&!ye(e,"abort")&&!ye(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...$r,...e}},Gr=e=>{const t=((e,t)=>(...o)=>j(e,((e,n)=>e&&t(n).apply(void 0,o)),!0))(e,(e=>e.can)),o=((e,t)=>(...o)=>j(e,((e,n)=>e||t(n).apply(void 0,o)),!1))(e,(e=>e.abort));return{can:t,abort:o,run:(...t)=>{z(e,(e=>{e.run.apply(void 0,t)}))}}},Kr=w,Yr=Kr("touchstart"),Xr=Kr("touchmove"),Jr=Kr("touchend"),Qr=Kr("touchcancel"),es=Kr("mousedown"),ts=Kr("mousemove"),os=Kr("mouseout"),ns=Kr("mouseup"),rs=Kr("mouseover"),ss=Kr("focusin"),as=Kr("focusout"),is=Kr("keydown"),ls=Kr("keyup"),cs=Kr("input"),ds=Kr("change"),ms=Kr("click"),us=Kr("transitioncancel"),gs=Kr("transitionend"),hs=Kr("transitionstart"),ps=Kr("selectstart"),fs=e=>w("alloy."+e),vs={tap:fs("tap")},bs=fs("focus"),ys=fs("blur.post"),ws=fs("paste.post"),xs=fs("receive"),Cs=fs("execute"),Ss=fs("focus.item"),ks=vs.tap,_s=fs("longpress"),Es=fs("sandbox.close"),Ts=fs("typeahead.cancel"),Os=fs("system.init"),Ds=fs("system.touchmove"),As=fs("system.touchend"),Ms=fs("system.scroll"),Ns=fs("system.resize"),Rs=fs("system.attached"),Bs=fs("system.detached"),Ls=fs("system.dismissRequested"),Hs=fs("system.repositionRequested"),Is=fs("focusmanager.shifted"),Ps=fs("slotcontainer.visibility"),Fs=fs("system.external.element.scroll"),zs=fs("change.tab"),Vs=fs("dismiss.tab"),Zs=fs("highlight"),Us=fs("dehighlight"),js=(e,t)=>{Gs(e,e.element,t,{})},Ws=(e,t,o)=>{Gs(e,e.element,t,o)},$s=e=>{js(e,Cs())},qs=(e,t,o)=>{Gs(e,t,o,{})},Gs=(e,t,o,n)=>{const r={target:t,...n};e.getSystem().triggerEvent(o,t,r)},Ks=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Ys=e=>zr(e),Xs=(e,t)=>({key:e,value:qr({abort:t})}),Js=e=>({key:e,value:qr({run:(e,t)=>{t.event.prevent()}})}),Qs=(e,t)=>({key:e,value:qr({run:t})}),ea=(e,t,o)=>({key:e,value:qr({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),ta=e=>t=>({key:e,value:qr({run:(e,o)=>{Wr(e,o)&&t(e,o)}})}),oa=(e,t,o)=>((e,t)=>Qs(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Ks(t,t.element,e,n)}))})))(e,t.partUids[o]),na=(e,t)=>Qs(e,((e,o)=>{const n=o.event,r=e.getSystem().getByDom(n.target).getOrThunk((()=>jr(n.target,(t=>e.getSystem().getByDom(t).toOptional()),T).getOr(e)));t(e,r,o)})),ra=e=>Qs(e,((e,t)=>{t.cut()})),sa=e=>Qs(e,((e,t)=>{t.stop()})),aa=(e,t)=>ta(e)(t),ia=ta(Rs()),la=ta(Bs()),ca=ta(Os()),da=(e=>t=>Qs(e,t))(Cs()),ma=e=>e.dom.innerHTML,ua=(e,t)=>{const o=Qe(e).dom,n=Le.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,at(Le.fromDom(o))})(t,o);Io(n,r),Po(e),Ho(e,n)},ga=(e,t)=>Le.fromDom(e.dom.cloneNode(t)),ha=e=>{if(mt(e))return"#shadow-root";{const t=(e=>ga(e,!1))(e);return(e=>{const t=Le.fromTag("div"),o=Le.fromDom(e.dom.cloneNode(!0));return Ho(t,o),ma(t)})(t)}},pa=e=>ha(e),fa=Ys([((e,t)=>({key:e,value:qr({can:t})}))(bs(),((e,t)=>{const o=t.event,n=o.originator,r=o.target;return!((e,t,o)=>Xe(t,e.element)&&!Xe(t,o))(e,n,r)||(console.warn(bs()+" did not get interpreted by the desired target. \nOriginator: "+pa(n)+"\nTarget: "+pa(r)+"\nCheck the "+bs()+" event handlers"),!1)}))]);var va=Object.freeze({__proto__:null,events:fa});let ba=0;const ya=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return ba++,e+"_"+o+ba+String(t)},wa=w("alloy-id-"),xa=w("data-alloy-id"),Ca=wa(),Sa=xa(),ka=(e,t)=>{Object.defineProperty(e.dom,Sa,{value:t,writable:!0})},_a=e=>{const t=je(e)?e.dom[Sa]:null;return D.from(t)},Ea=e=>ya(e),Ta=x,Oa=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+pa(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:w("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}},Da=Oa(),Aa=e=>F(e,(e=>De(e,"/*")?e.substring(0,e.length-2):e)),Ma=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Aa(s)}),e},Na=ya("alloy-premade"),Ra=e=>(Object.defineProperty(e.element.dom,Na,{value:e.uid,writable:!0}),Fr(Na,e)),Ba=e=>ve(e,Na),La=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Aa(s.slice(1))}),e})(((t,...o)=>e(t.getApis(),t,...o)),e),Ha={init:()=>Ia({readState:w("No State required")})},Ia=e=>e,Pa=(e,t)=>{const o={};return le(e,((e,n)=>{le(e,((e,r)=>{const s=ve(o,r).getOr([]);o[r]=s.concat([t(n,e)])}))})),o},Fa=e=>({classes:m(e.classes)?[]:e.classes,attributes:m(e.attributes)?{}:e.attributes,styles:m(e.styles)?{}:e.styles}),za=e=>e.cHandler,Va=(e,t)=>({name:e,handler:t}),Za=(e,t)=>{const o={};return z(e,(e=>{o[e.name()]=e.handlers(t)})),o},Ua=(e,t,o,n)=>{const r=((e,t,o)=>{const n={...o,...Za(t,e)};return Pa(n,Va)})(e,o,n);return $a(r,t)},ja=e=>{const t=(e=>h(e)?{can:O,abort:T,run:e}:e)(e);return(e,o,...n)=>{const r=[e,o].concat(n);t.abort.apply(void 0,r)?o.stop():t.can.apply(void 0,r)&&t.run.apply(void 0,r)}},Wa=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const r=ee(o,((o,r)=>{const s=o[t],a=r[t],i=n.indexOf(s),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i{const t=F(e,(e=>e.handler));return Gr(t)})):((e,t)=>on.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(F(t,(e=>e.name)),null,2)]))(o,e)},$a=(e,t)=>{const o=he(e,((e,o)=>(1===e.length?on.value(e[0].handler):Wa(e,t,o)).map((n=>{const r=ja(n),s=e.length>1?Z(t[o],(t=>H(e,(e=>e.name===t)))).join(" > "):e[0].name;return Fr(o,((e,t)=>({handler:e,purpose:t}))(r,s))}))));return Vr(o,{})},qa="alloy.base.behaviour",Ga=Pn([ir("dom","dom",{tag:"required",process:{}},Pn([dr("tag"),Tr("styles",{}),Tr("classes",[]),Tr("attributes",{}),yr("value"),yr("innerHtml")])),dr("components"),dr("uid"),Tr("events",{}),Tr("apis",{}),ir("eventOrder","eventOrder",(e=>_n(w(e)))({[Cs()]:["disabling",qa,"toggling","typeaheadevents"],[bs()]:[qa,"focusing","keying"],[Os()]:[qa,"disabling","toggling","representing"],[cs()]:[qa,"representing","streaming","invalidating"],[Bs()]:[qa,"representing","item-events","tooltipping"],[es()]:["focusing",qa,"item-type-events"],[Yr()]:["focusing",qa,"item-type-events"],[rs()]:["item-type-events","tooltipping"],[xs()]:["receiving","reflecting","tooltipping"]}),Un()),yr("domModification")]),Ka=e=>e.events,Ya=(e,t)=>{const o=_t(e,t);return void 0===o||""===o?[]:o.split(" ")},Xa=e=>void 0!==e.dom.classList,Ja=e=>Ya(e,"class"),Qa=(e,t)=>((e,t,o)=>{const n=Ya(e,t).concat([o]);return St(e,t,n.join(" ")),!0})(e,"class",t),ei=(e,t)=>((e,t,o)=>{const n=Z(Ya(e,t),(e=>e!==o));return n.length>0?St(e,t,n.join(" ")):Ot(e,t),!1})(e,"class",t),ti=(e,t)=>{Xa(e)?e.dom.classList.add(t):Qa(e,t)},oi=e=>{0===(Xa(e)?e.dom.classList:Ja(e)).length&&Ot(e,"class")},ni=(e,t)=>{if(Xa(e)){e.dom.classList.remove(t)}else ei(e,t);oi(e)},ri=(e,t)=>{const o=Xa(e)?e.dom.classList.toggle(t):((e,t)=>L(Ja(e),t)?ei(e,t):Qa(e,t))(e,t);return oi(e),o},si=(e,t)=>Xa(e)&&e.dom.classList.contains(t),ai=(e,t)=>{z(t,(t=>{ti(e,t)}))},ii=(e,t)=>{z(t,(t=>{ni(e,t)}))},li=e=>Xa(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;ee.dom.value,di=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},mi=(e,t,o)=>{o.fold((()=>Ho(e,t)),(e=>{Xe(e,t)||(Ro(e,t),Fo(e))}))},ui=(e,t,o)=>{const n=F(t,o),r=at(e);return z(r.slice(n.length),Fo),n},gi=(e,t,o,n)=>{const r=it(e,t),s=n(o,r),a=((e,t,o)=>it(e,t).map((e=>{if(o.exists((t=>!Xe(t,e)))){const t=o.map(Ve).getOr("span"),n=Le.fromTag(t);return Ro(e,n),n}return e})))(e,t,r);return mi(e,s.element,a),s},hi=(e,t)=>{const o=ae(e),n=ae(t),r=X(n,o),s=((e,t)=>{const o={},n={};return ue(e,t,me(o),me(n)),{t:o,f:n}})(e,((e,o)=>!be(t,o)||e!==t[o])).t;return{toRemove:r,toSet:s}},pi=(e,t)=>{const{class:o,style:n,...r}=(e=>j(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:s,toRemove:a}=hi(e.attributes,r),i=It(t),{toSet:l,toRemove:c}=hi(e.styles,i),d=li(t),m=X(d,e.classes),u=X(e.classes,d);return z(a,(e=>Ot(t,e))),kt(t,s),ai(t,u),ii(t,m),z(c,(e=>Ft(t,e))),Nt(t,l),e.innerHtml.fold((()=>{const o=e.domChildren;((e,t)=>{ui(e,t,((t,o)=>{const n=it(e,o);return mi(e,t,n),t}))})(t,o)}),(e=>{ua(t,e)})),(()=>{const o=t,n=e.value.getOrUndefined();n!==ci(o)&&di(o,null!=n?n:"")})(),t},fi=(e,t)=>{const o=t.filter((t=>Ve(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>be(e.dom,Na))(t))).bind((t=>((e,t)=>{try{const o=pi(e,t);return D.some(o)}catch(e){return D.none()}})(e,t))).getOrThunk((()=>(e=>{const t=Le.fromTag(e.tag);kt(t,e.attributes),ai(t,e.classes),Nt(t,e.styles),e.innerHtml.each((e=>ua(t,e)));const o=e.domChildren;return Io(t,o),e.value.each((e=>{di(t,e)})),t})(e)));return ka(o,e.uid),o},vi=(e,t)=>((e,t)=>{const o=F(t,(e=>Er(e.name(),[dr("config"),Tr("state",Ha)]))),n=tr("component.behaviours",Pn(o),e.behaviours).fold((t=>{throw new Error(rr(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),x);return{list:t,data:ce(n,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return w(t)}))}})(e,t),bi=e=>{const t=(e=>{const t=ve(e,"behaviours").getOr({});return G(ae(t),(e=>{const o=t[e];return g(o)?[o.me]:[]}))})(e);return vi(e,t)},yi=(e,t,o)=>{const n={...(r=e).dom,uid:r.uid,domChildren:F(r.components,(e=>e.element))};var r;const s=(e=>e.domModification.fold((()=>Fa({})),Fa))(e),a={"alloy.base.modification":s},i=t.length>0?((e,t,o,n)=>{const r={...t};z(o,(t=>{r[t.name()]=t.exhibit(e,n)}));const s=Pa(r,((e,t)=>({name:e,modification:t}))),a=e=>U(e,((e,t)=>({...t.modification,...e})),{}),i=U(s.classes,((e,t)=>t.modification.concat(e)),[]),l=a(s.attributes),c=a(s.styles);return Fa({classes:i,attributes:l,styles:c})})(o,a,t,n):s;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},wi=(e,t)=>{const o=()=>u,n=Hr(Da),r=or((e=>tr("custom.definition",Ga,e))(e)),s=bi(e),a=(e=>e.list)(s),i=(e=>e.data)(s),l=yi(r,a,i),c=fi(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":Ka(e)};return Ua(o,e.eventOrder,t,n).getOrDie()})(r,a,i),m=Hr(r.components),u={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(h(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>h(i[e.name()]),spec:e,readState:e=>i[e]().map((e=>e.state.readState())).getOr("not enabled"),getApis:()=>r.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(Oa(o))},element:c,syncComponents:()=>{const e=at(c),t=G(e,(e=>n.get().getByDom(e).fold((()=>[]),Q)));m.set(t)},components:m.get,events:d};return u},xi=(e,t)=>{const{events:o,...n}=Ta(e),r=((e,t)=>{const o=ve(e,"components").getOr([]);return t.fold((()=>F(o,Ei)),(e=>F(o,((t,o)=>_i(t,it(e,o))))))})(n,t),s={...n,events:{...va,...o},components:r};return on.value(wi(s,t))},Ci=e=>{const t=Le.fromText(e);return Si({element:t})},Si=e=>{const t=nr("external.component",In([dr("element"),yr("uid")]),e),o=Hr(Oa()),n=t.uid.getOrThunk((()=>Ea("external")));ka(t.element,n);const r={uid:n,getSystem:o.get,config:D.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(Oa((()=>r)))},getApis:()=>({}),element:t.element,spec:e,readState:w("No state"),syncComponents:v,components:w([]),events:{}};return Ra(r)},ki=Ea,_i=(e,t)=>Ba(e).getOrThunk((()=>{const o=(e=>be(e,"uid"))(e)?e:{uid:ki(""),...e};return xi(o,t).getOrDie()})),Ei=e=>_i(e,D.none()),Ti=Ra;var Oi=(e,t,o,n,r)=>e(o,n)?D.some(o):h(r)&&r(o)?D.none():t(o,n,r);const Di=(e,t,o)=>{let n=e.dom;const r=h(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=Le.fromDom(n);if(t(e))return D.some(e);if(r(e))break}return D.none()},Ai=(e,t,o)=>Oi(((e,t)=>t(e)),Di,e,t,o),Mi=(e,t,o)=>Ai(e,t,o).isSome(),Ni=(e,t,o)=>Di(e,(e=>Ke(e,t)),o),Ri=(e,t)=>((e,t)=>W(e.dom.childNodes,(e=>t(Le.fromDom(e)))).map(Le.fromDom))(e,(e=>Ke(e,t))),Bi=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ye(o)?D.none():D.from(o.querySelector(e)).map(Le.fromDom)})(t,e),Li=(e,t,o)=>Oi(((e,t)=>Ke(e,t)),Ni,e,t,o),Hi="aria-controls",Ii=()=>{const e=ya(Hi);return{id:e,link:t=>{St(t,Hi,e)},unlink:e=>{Ot(e,Hi)}}},Pi=(e,t)=>(e=>Ai(e,(e=>{if(!je(e))return!1;const t=_t(e,"id");return void 0!==t&&t.indexOf(Hi)>-1})).bind((e=>{const t=_t(e,"id"),o=ht(e);return Bi(o,`[${Hi}="${t}"]`)})))(t).exists((t=>Fi(e,t))),Fi=(e,t)=>Mi(t,(t=>Xe(t,e.element)),T)||Pi(e,t),zi="unknown";var Vi;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(Vi||(Vi={}));const Zi=Hr({}),Ui=(e,t,o)=>{switch(ve(Zi.get(),e).orThunk((()=>{const t=ae(Zi.get());return se(t,(t=>e.indexOf(t)>-1?D.some(Zi.get()[t]):D.none()))})).getOr(Vi.NORMAL)){case Vi.NORMAL:return o($i());case Vi.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 r=(new Date).getTime();L(["mousemove","mouseover","mouseout",Os()],e)||console.log(e,{event:e,time:r-n,target:t.dom,sequence:F(o,(e=>L(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+pa(e.target)+")":e.outcome))})}}})(e,t),r=o(n);return n.write(),r}case Vi.STOP:return!0}},ji=["alloy/data/Fields","alloy/debugging/Debugging"],Wi=(e,t,o)=>Ui(e,t,o),$i=w({logEventCut:v,logEventStopped:v,logNoParent:v,logEventNoHandlers:v,logEventResponse:v,write:v}),qi=w([dr("menu"),dr("selectedMenu")]),Gi=w([dr("item"),dr("selectedItem")]);w(Pn(Gi().concat(qi())));const Ki=w(Pn(Gi())),Yi=fr("initSize",[dr("numColumns"),dr("numRows")]),Xi=()=>fr("markers",[dr("backgroundMenu")].concat(qi()).concat(Gi())),Ji=e=>fr("markers",F(e,dr)),Qi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");return W(t,(e=>e.indexOf("alloy")>0&&!H(ji,(t=>e.indexOf(t)>-1)))).getOr(zi)}})(),ir(t,t,o,Qn((e=>on.value(((...t)=>e.apply(void 0,t))))))),el=e=>Qi(0,e,kn(v)),tl=e=>Qi(0,e,kn(D.none)),ol=e=>Qi(0,e,{tag:"required",process:{}}),nl=e=>Qi(0,e,{tag:"required",process:{}}),rl=(e,t)=>lr(e,w(t)),sl=e=>lr(e,x),al=w(Yi),il=(e,t,o,n,r,s,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:r,restriction:s,label:`${a}-${r}`,alwaysFit:i}),ll=Ir([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),cl=ll.southeast,dl=ll.southwest,ml=ll.northeast,ul=ll.northwest,gl=ll.south,hl=ll.north,pl=ll.east,fl=ll.west,vl=(e,t,o,n)=>{const r=e+t;return r>n?o:rMath.min(Math.max(e,t),o),yl=(e,t)=>J(["left","right","top","bottom"],(o=>ve(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))))),wl="layout",xl=e=>e.x,Cl=(e,t)=>e.x+e.width/2-t.width/2,Sl=(e,t)=>e.x+e.width-t.width,kl=(e,t)=>e.y-t.height,_l=e=>e.y+e.height,El=(e,t)=>e.y+e.height/2-t.height/2,Tl=(e,t,o)=>il(xl(e),_l(e),o.southeast(),cl(),"southeast",yl(e,{left:1,top:3}),wl),Ol=(e,t,o)=>il(Sl(e,t),_l(e),o.southwest(),dl(),"southwest",yl(e,{right:0,top:3}),wl),Dl=(e,t,o)=>il(xl(e),kl(e,t),o.northeast(),ml(),"northeast",yl(e,{left:1,bottom:2}),wl),Al=(e,t,o)=>il(Sl(e,t),kl(e,t),o.northwest(),ul(),"northwest",yl(e,{right:0,bottom:2}),wl),Ml=(e,t,o)=>il(Cl(e,t),kl(e,t),o.north(),hl(),"north",yl(e,{bottom:2}),wl),Nl=(e,t,o)=>il(Cl(e,t),_l(e),o.south(),gl(),"south",yl(e,{top:3}),wl),Rl=(e,t,o)=>il((e=>e.x+e.width)(e),El(e,t),o.east(),pl(),"east",yl(e,{left:0}),wl),Bl=(e,t,o)=>il(((e,t)=>e.x-t.width)(e,t),El(e,t),o.west(),fl(),"west",yl(e,{right:1}),wl),Ll=()=>[Tl,Ol,Dl,Al,Nl,Ml,Rl,Bl],Hl=()=>[Ol,Tl,Al,Dl,Nl,Ml,Rl,Bl],Il=()=>[Dl,Al,Tl,Ol,Ml,Nl],Pl=()=>[Al,Dl,Ol,Tl,Ml,Nl],Fl=()=>[Tl,Ol,Dl,Al,Nl,Ml],zl=()=>[Ol,Tl,Al,Dl,Nl,Ml];var Vl=Object.freeze({__proto__:null,events:e=>Ys([Qs(xs(),((t,o)=>{const n=e.channels,r=ae(n),s=o,a=((e,t)=>t.universal?e:Z(e,(e=>L(t.channels,e))))(r,s);z(a,(e=>{const o=n[e],r=o.schema,a=nr("channel["+e+"] data\nReceiver: "+pa(t.element),r,s.data);o.onReceive(t,a)}))}))])}),Zl=[mr("channels",er(on.value,In([ol("onReceive"),Tr("schema",Un())])))];const Ul=(e,t,o)=>ca(((n,r)=>{o(n,e,t)})),jl=(e,t,o)=>((e,t,o)=>{const n=o.toString(),r=n.indexOf(")")+1,s=n.indexOf("("),a=n.substring(s+1,r-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Aa(a.slice(0,1).concat(a.slice(3)))}),e})(((n,...r)=>{const s=[n].concat(r);return n.config({name:w(e)}).fold((()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)}),(e=>{const o=Array.prototype.slice.call(s,1);return t.apply(void 0,[n,e.config,e.state].concat(o))}))}),o,t),Wl=e=>({key:e,value:void 0}),$l=(e,t,o,n,r,s,a)=>{const i=e=>ye(e,o)?e[o]():D.none(),l=ce(r,((e,t)=>jl(o,e,t))),c={...ce(s,((e,t)=>Ma(e,t))),...l,revoke:S(Wl,o),config:t=>{const n=nr(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:Qt((()=>nr(o+"-config",e,t))),initialConfig:t,state:a}}},schema:w(t),exhibit:(e,t)=>Ce(i(e),ve(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>Fa({}))),name:w(o),handlers:e=>i(e).map((e=>ve(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},ql=e=>zr(e),Gl=In([dr("fields"),dr("name"),Tr("active",{}),Tr("apis",{}),Tr("state",Ha),Tr("extra",{})]),Kl=e=>{const t=nr("Creating behaviour: "+e.name,Gl,e);return((e,t,o,n,r,s)=>{const a=In(e),i=Er(t,[(l="config",c=e,wr(l,In(c)))]);var l,c;return $l(a,i,t,o,n,r,s)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},Yl=In([dr("branchKey"),dr("branches"),dr("name"),Tr("active",{}),Tr("apis",{}),Tr("state",Ha),Tr("extra",{})]),Xl=e=>{const t=nr("Creating behaviour: "+e.name,Yl,e);return((e,t,o,n,r,s)=>{const a=e,i=Er(t,[wr("config",e)]);return $l(a,i,t,o,n,r,s)})(sr(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},Jl=w(void 0),Ql=Kl({fields:Zl,name:"receiving",active:Vl});var ec=Object.freeze({__proto__:null,exhibit:(e,t)=>Fa({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const tc=(e,t=!1)=>e.dom.focus({preventScroll:t}),oc=e=>e.dom.blur(),nc=e=>{const t=ht(e).dom;return e.dom===t.activeElement},rc=(e=jo())=>D.from(e.dom.activeElement).map(Le.fromDom),sc=e=>rc(ht(e)).filter((t=>e.dom.contains(t.dom))),ac=(e,t)=>{const o=ht(t),n=rc(o).bind((e=>{const o=t=>Xe(e,t);return o(t)?D.some(t):((e,t)=>{const o=e=>{for(let n=0;n{rc(o).filter((t=>Xe(t,e))).fold((()=>{tc(e)}),v)})),r},ic=(e,t,o,n,r)=>{const s=e=>e+"px";return{position:e,left:t.map(s),top:o.map(s),right:n.map(s),bottom:r.map(s)}},lc=(e,t)=>{Rt(e,(e=>({...e,position:D.some(e.position)}))(t))},cc=Ir([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),dc=(e,t,o,n,r,s)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=r-(i+a.width),d=s-(l+a.height),m=D.some(i),u=D.some(l),g=D.some(c),h=D.some(d),p=D.none();return((e,t,o,n,r,s,a,i,l)=>e.fold(t,o,n,r,s,a,i,l))(t.direction,(()=>ic(e,m,u,p,p)),(()=>ic(e,p,u,g,p)),(()=>ic(e,m,p,p,h)),(()=>ic(e,p,p,g,h)),(()=>ic(e,m,u,p,p)),(()=>ic(e,m,p,p,h)),(()=>ic(e,m,u,p,p)),(()=>ic(e,p,u,g,p)))},mc=(e,t)=>e.fold((()=>{const e=t.rect;return ic("absolute",D.some(e.x),D.some(e.y),D.none(),D.none())}),((e,o,n,r)=>dc("absolute",t,e,o,n,r)),((e,o,n,r)=>dc("fixed",t,e,o,n,r))),uc=(e,t)=>{const o=S(qo,t),n=e.fold(o,o,(()=>{const e=zo();return qo(t).translate(-e.left,-e.top)})),r=Jt(t),s=jt(t);return Go(n.left,n.top,r,s)},gc=(e,t)=>t.fold((()=>e.fold(Jo,Jo,Go)),(t=>e.fold(w(t),w(t),(()=>{const o=hc(e,t.x,t.y);return Go(o.left,o.top,t.width,t.height)})))),hc=(e,t,o)=>{const n=$t(t,o);return e.fold(w(n),w(n),(()=>{const e=zo();return n.translate(-e.left,-e.top)}))};cc.none;const pc=cc.relative,fc=cc.fixed,vc=(e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t),bc="data-alloy-placement",yc=e=>Et(e,bc),wc=Ir([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),xc=(e,t,o,n)=>{const r=e.bubble,s=r.offset,a=((e,t,o)=>{const n=(n,r)=>t[n].map((t=>{const s="top"===n||"bottom"===n,a=s?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,r)+a;return s?bl(i,e.y,e.bottom):bl(i,e.x,e.right)})).getOr(r),r=n("left",e.x),s=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Go(r,s,a-r,i-s)})(n,e.restriction,s),i=e.x+s.left,l=e.y+s.top,c=Go(i,l,t,o),{originInBounds:d,sizeInBounds:m,visibleW:u,visibleH:g}=((e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,right:l,bottom:c,width:d,height:m}=e;return{originInBounds:a>=o&&a<=r&&i>=n&&i<=s,sizeInBounds:l<=r&&l>=o&&c<=s&&c>=n,visibleW:Math.min(d,a>=o?r-a:l-o),visibleH:Math.min(m,i>=n?s-i:c-n)}})(c,a),h=d&&m,p=h?c:((e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,r-l),m=Math.max(n,s-c),u=bl(a,o,d),g=bl(i,n,m),h=Math.min(u+l,r)-u,p=Math.min(g+c,s)-g;return Go(u,g,h,p)})(c,a),f=p.width>0&&p.height>0,{maxWidth:v,maxHeight:b}=((e,t,o)=>{const n=w(t.bottom-o.y),r=w(o.bottom-t.y),s=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,r,r,n),a=w(t.right-o.x),i=w(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:s}})(e.direction,p,n),y={rect:p,maxHeight:b,maxWidth:v,direction:e.direction,placement:e.placement,classes:{on:r.classesOn,off:r.classesOff},layout:e.label,testY:l};return h||e.alwaysFit?wc.fit(y):wc.nofit(y,u,g,f)},Cc=e=>{const t=Hr(D.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(D.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(D.some(e))}}},Sc=()=>Cc((e=>e.unbind())),kc=()=>{const e=Cc(v);return{...e,on:t=>e.get().each(t)}},_c=O,Ec=(e,t,o)=>((e,t,o,n)=>Mo(e,t,o,n,!1))(e,t,_c,o),Tc=(e,t,o)=>((e,t,o,n)=>Mo(e,t,o,n,!0))(e,t,_c,o),Oc=Ao,Dc=["top","bottom","right","left"],Ac="data-alloy-transition-timer",Mc=(e,t)=>((e,t)=>K(t,(t=>si(e,t))))(e,t.classes),Nc=(e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,((t,n)=>!((e,t,o=C)=>Ce(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o)))).isSome()},Rc=(e,t)=>{const o=Sc(),n=Sc();let r;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return Xe(t.target,e)&&Ne(n)&&L(Dc,t.raw.propertyName)},i=s=>{if(u(s)||a(s)){o.clear(),n.clear();const a=null==s?void 0:s.raw.type;(u(a)||a===gs())&&(clearTimeout(r),Ot(e,Ac),ii(e,t.classes))}},l=Ec(e,hs(),(t=>{a(t)&&(l.unbind(),o.set(Ec(e,gs(),i)),n.set(Ec(e,us(),i)))})),c=(e=>{const t=t=>{const o=Bt(e,t).split(/\s*,\s*/);return Z(o,Me)},o=e=>{if(s(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return De(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),r=t("transition-duration");return j(r,((e,t,r)=>{const s=o(n[r])+o(t);return Math.max(e,s)}),0)})(e);requestAnimationFrame((()=>{r=setTimeout(i,c+17),St(e,Ac,r)}))},Bc=(e,t,o,n,r,s)=>{const a=((e,t,o)=>o.exists((o=>{const n=e.mode;return"all"===n||o[n]!==t[n]})))(n,r,s);if(a||Mc(e,n)){Mt(e,"position",o.position);const s=uc(t,e),i=mc(t,{...r,rect:s}),l=J(Dc,(e=>i[e]));Nc(o,l)&&(Rt(e,l),a&&((e,t)=>{ai(e,t.classes),Et(e,Ac).each((t=>{clearTimeout(parseInt(t,10)),Ot(e,Ac)})),Rc(e,t)})(e,n),zt(e))}else ii(e,n.classes)},Lc=(e,t,o,n)=>{Ft(t,"max-height"),Ft(t,"max-width");const r={width:Jt(s=t),height:jt(s)};var s;return((e,t,o,n,r,s)=>{const a=n.width,i=n.height,l=(t,l,c,d,m)=>{const u=t(o,n,r,e,s),g=xc(u,a,i,s);return g.fold(w(g),((e,t,o,n)=>(m===n?o>d||t>c:!m&&n)?g:wc.nofit(l,c,d,m)))},c=j(t,((e,t)=>{const o=S(l,t);return e.fold(w(e),o)}),wc.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:cl(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1));return c.fold(x,x)})(t,n.preference,e,r,o,n.bounds)},Hc=(e,t)=>{((e,t)=>{St(e,bc,t)})(e,t.placement)},Ic=(e,t)=>{((e,t)=>{const o=Zt.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);Mt(e,"max-height",o+"px")})(e,Math.floor(t))},Pc=w(((e,t)=>{Ic(e,t),Nt(e,{"overflow-x":"hidden","overflow-y":"auto"})})),Fc=w(((e,t)=>{Ic(e,t)})),zc=(e,t,o)=>void 0===e[t]?o:e[t],Vc=(e,t,o,n)=>{const r=Lc(e,t,o,n);return((e,t,o)=>{const n=mc(o.origin,t);o.transition.each((r=>{Bc(e,o.origin,n,r,t,o.lastPlacement)})),lc(e,n)})(t,r,n),Hc(t,r),((e,t)=>{const o=t.classes;ii(e,o.off),ai(e,o.on)})(t,r),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,r,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,r,n),{layout:r.layout,placement:r.placement}},Zc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Uc=(e,t,o,n=1)=>{const r=e*n,s=t*n,a=e=>ve(o,e).getOr([]),i=(e,t,o)=>{const n=X(Zc,o);return{offset:$t(e,t),classesOn:G(o,a),classesOff:G(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(r,s,["top","alignLeft","inset"]),insetNorthwest:()=>i(-r,s,["top","alignRight","inset"]),insetNorth:()=>i(-r/2,s,["top","alignCentre","inset"]),insetSoutheast:()=>i(r,-s,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-r,-s,["bottom","alignRight","inset"]),insetSouth:()=>i(-r/2,-s,["bottom","alignCentre","inset"]),insetEast:()=>i(-r,-s/2,["valignCentre","right","inset"]),insetWest:()=>i(r,-s/2,["valignCentre","left","inset"])}},jc=()=>Uc(0,0,{}),Wc=x,$c=(e,t)=>o=>"rtl"===qc(o)?t:e,qc=e=>"rtl"===Bt(e,"direction")?"rtl":"ltr";var Gc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Gc||(Gc={}));const Kc="data-alloy-vertical-dir",Yc=e=>Mi(e,(e=>je(e)&&_t(e,"data-alloy-vertical-dir")===Gc.BottomToTop)),Xc=()=>Er("layouts",[dr("onLtr"),dr("onRtl"),yr("onBottomLtr"),yr("onBottomRtl")]),Jc=(e,t,o,n,r,s,a)=>{const i=a.map(Yc).getOr(!1),l=t.layouts.map((t=>t.onLtr(e))),c=t.layouts.map((t=>t.onRtl(e))),d=i?t.layouts.bind((t=>t.onBottomLtr.map((t=>t(e))))).or(l).getOr(r):l.getOr(o),m=i?t.layouts.bind((t=>t.onBottomRtl.map((t=>t(e))))).or(c).getOr(s):c.getOr(n);return $c(d,m)(e)};var Qc=[dr("hotspot"),yr("bubble"),Tr("overrides",{}),Xc(),rl("placement",((e,t,o)=>{const n=t.hotspot,r=uc(o,n.element),s=Jc(e.element,t,Fl(),zl(),Il(),Pl(),D.some(t.hotspot.element));return D.some(Wc({anchorBox:r,bubble:t.bubble.getOr(jc()),overrides:t.overrides,layouts:s}))}))];var ed=[dr("x"),dr("y"),Tr("height",0),Tr("width",0),Tr("bubble",jc()),Tr("overrides",{}),Xc(),rl("placement",((e,t,o)=>{const n=hc(o,t.x,t.y),r=Go(n.left,n.top,t.width,t.height),s=Jc(e.element,t,Ll(),Hl(),Ll(),Hl(),D.none());return D.some(Wc({anchorBox:r,bubble:t.bubble,overrides:t.overrides,layouts:s}))}))];const td=Ir([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),od=e=>e.fold(x,((e,t,o)=>e.translate(-t,-o))),nd=e=>e.fold(x,x),rd=e=>j(e,((e,t)=>e.translate(t.left,t.top)),$t(0,0)),sd=e=>{const t=F(e,nd);return rd(t)},ad=td.screen,id=td.absolute,ld=(e,t,o)=>{const n=Qe(e.element),r=zo(n),s=((e,t,o)=>{const n=ot(o.root).dom;return D.from(n.frameElement).map(Le.fromDom).filter((t=>{const o=Qe(t),n=Qe(e.element);return Xe(o,n)})).map(Gt)})(e,0,o).getOr(r);return id(s,r.left,r.top)},cd=(e,t,o,n)=>{const r=ad($t(e,t));return D.some(((e,t,o)=>({point:e,width:t,height:o}))(r,o,n))},dd=(e,t,o,n,r)=>e.map((e=>{const s=[t,e.point],a=(i=()=>sd(s),l=()=>sd(s),c=()=>(e=>{const t=F(e,od);return rd(t)})(s),n.fold(i,l,c));var i,l,c;const d=((e,t,o,n)=>({x:e,y:t,width:o,height:n}))(a.left,a.top,e.width,e.height),m=o.showAbove?Il():Fl(),u=o.showAbove?Pl():zl(),g=Jc(r,o,m,u,m,u,D.none());return Wc({anchorBox:d,bubble:o.bubble.getOr(jc()),overrides:o.overrides,layouts:g})}));var md=[dr("node"),dr("root"),yr("bubble"),Xc(),Tr("overrides",{}),Tr("showAbove",!1),rl("placement",((e,t,o)=>{const n=ld(e,0,t);return t.node.filter(yt).bind((r=>{const s=r.dom.getBoundingClientRect(),a=cd(s.left,s.top,s.width,s.height),i=t.node.getOr(e.element);return dd(a,n,t,o,i)}))}))];const ud=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),gd=Ir([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),hd=(gd.before,gd.on,gd.after,e=>e.fold(x,x,x)),pd=Ir([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),fd={domRange:pd.domRange,relative:pd.relative,exact:pd.exact,exactFromRange:e=>pd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Le.fromDom(e.startContainer),relative:(e,t)=>hd(e),exact:(e,t,o,n)=>e}))(e);return ot(t)},range:ud},vd=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.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},bd=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},yd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),wd=Ir([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),xd=(e,t,o)=>t(Le.fromDom(o.startContainer),o.startOffset,Le.fromDom(o.endContainer),o.endOffset),Cd=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:w(e),rtl:D.none}),relative:(t,o)=>({ltr:Qt((()=>vd(e,t,o))),rtl:Qt((()=>D.some(vd(e,o,t))))}),exact:(t,o,n,r)=>({ltr:Qt((()=>bd(e,t,o,n,r))),rtl:Qt((()=>D.some(bd(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();if(o.collapsed)return t.rtl().filter((e=>!1===e.collapsed)).map((e=>wd.rtl(Le.fromDom(e.endContainer),e.endOffset,Le.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>xd(0,wd.ltr,o)));return xd(0,wd.ltr,o)})(0,o)},Sd=(e,t)=>Cd(e,t).match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}});wd.ltr,wd.rtl;const kd=(e,t,o)=>Z(((e,t)=>{const o=h(t)?t:T;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Le.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r})(e,o),t),_d=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ye(o)?[]:F(o.querySelectorAll(e),Le.fromDom)})(t,e),Ed=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Qe(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Xe(e,o)&&t===n;return r.collapsed&&!s},Td=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return D.some(ud(Le.fromDom(t.startContainer),t.startOffset,Le.fromDom(o.endContainer),o.endOffset))}return D.none()},Od=e=>{if(null===e.anchorNode||null===e.focusNode)return Td(e);{const t=Le.fromDom(e.anchorNode),o=Le.fromDom(e.focusNode);return Ed(t,e.anchorOffset,o,e.focusOffset)?D.some(ud(t,e.anchorOffset,o,e.focusOffset)):Td(e)}},Dd=e=>(e=>D.from(e.getSelection()))(e).filter((e=>e.rangeCount>0)).bind(Od),Ad=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?D.some(o).map(yd):D.none()})(Sd(e,t)),Md=(e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?D.some(t).map(yd):D.none()})(Sd(e,t)),Nd=((e,t)=>{const o=t=>e(t)?D.from(t.dom.nodeValue):D.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})(We,"text"),Rd=(e,t)=>({element:e,offset:t}),Bd=(e,t)=>{const o=at(e);if(0===o.length)return Rd(e,t);if(tNd.get(e))(e).length:at(e).length;return Rd(e,t)}},Ld=(e,t)=>We(e)?Rd(e,t):Bd(e,t),Hd=e=>void 0!==e.foffset,Id=(e,t)=>t.getSelection.getOrThunk((()=>()=>Dd(e)))().map((e=>{if(Hd(e)){const t=Ld(e.start,e.soffset),o=Ld(e.finish,e.foffset);return fd.range(t.element,t.offset,o.element,o.offset)}return e}));var Pd=[yr("getSelection"),dr("root"),yr("bubble"),Xc(),Tr("overrides",{}),Tr("showAbove",!1),rl("placement",((e,t,o)=>{const n=ot(t.root).dom,r=ld(e,0,t),s=Id(n,t).bind((e=>{if(Hd(e)){const t=Md(n,fd.exactFromRange(e)).orThunk((()=>{const t=Le.fromText("\ufeff");Ro(e.start,t);const o=Ad(n,fd.exact(t,0,t,1));return Fo(t),o}));return t.bind((e=>cd(e.left,e.top,e.width,e.height)))}{const t=ce(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 cd(o.left,o.top,o.right-o.left,o.bottom-o.top)}})),a=Id(n,t).bind((e=>Hd(e)?je(e.start)?D.some(e.start):rt(e.start):D.some(e.firstCell))).getOr(e.element);return dd(s,r,t,o,a)}))];const Fd="link-layout",zd=e=>e.x+e.width,Vd=(e,t)=>e.x-t.width,Zd=(e,t)=>e.y-t.height+e.height,Ud=e=>e.y,jd=(e,t,o)=>il(zd(e),Ud(e),o.southeast(),cl(),"southeast",yl(e,{left:0,top:2}),Fd),Wd=(e,t,o)=>il(Vd(e,t),Ud(e),o.southwest(),dl(),"southwest",yl(e,{right:1,top:2}),Fd),$d=(e,t,o)=>il(zd(e),Zd(e,t),o.northeast(),ml(),"northeast",yl(e,{left:0,bottom:3}),Fd),qd=(e,t,o)=>il(Vd(e,t),Zd(e,t),o.northwest(),ul(),"northwest",yl(e,{right:1,bottom:3}),Fd),Gd=()=>[jd,Wd,$d,qd],Kd=()=>[Wd,jd,qd,$d];var Yd=[dr("item"),Xc(),Tr("overrides",{}),rl("placement",((e,t,o)=>{const n=uc(o,t.item.element),r=Jc(e.element,t,Gd(),Kd(),Gd(),Kd(),D.none());return D.some(Wc({anchorBox:n,bubble:jc(),overrides:t.overrides,layouts:r}))}))],Xd=sr("type",{selection:Pd,node:md,hotspot:Qc,submenu:Yd,makeshift:ed});const Jd=[br("classes",$n),Mr("mode","all",["all","layout","placement"])],Qd=[Tr("useFixed",T),yr("getBounds")],em=[mr("anchor",Xd),Er("transition",Jd)],tm=(e,t,o,n,r,s)=>((e,t,o,n,r,s,a,i)=>{const l=zc(a,"maxHeightFunction",Pc()),c=zc(a,"maxWidthFunction",v),d=e.anchorBox,m=e.origin,u={bounds:gc(m,s),origin:m,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:r,transition:i};return Vc(d,t,o,u)})(vc(t.anchorBox,e),n.element,t.bubble,t.layouts,r,o,t.overrides,s),om=(e,t,o,n,r,s)=>{const a=nr("placement.info",Pn(em),r),i=a.anchor,l=n.element,c=o.get(n.uid);ac((()=>{Mt(l,"position","fixed");const r=Ht(l,"visibility");Mt(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return fc(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Gt(e.element),o=e.element.dom.getBoundingClientRect();return pc(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each((e=>{const r=s.orThunk((()=>t.getBounds.map(E))),i=tm(d,e,r,n,c,a.transition);o.set(n.uid,i)})),r.fold((()=>{Ft(l,"visibility")}),(e=>{Mt(l,"visibility",e)})),Ht(l,"left").isNone()&&Ht(l,"top").isNone()&&Ht(l,"right").isNone()&&Ht(l,"bottom").isNone()&&we(Ht(l,"position"),"fixed")&&Ft(l,"position")}),l)};var nm=Object.freeze({__proto__:null,position:(e,t,o,n,r)=>{const s=D.none();om(e,t,o,n,r,s)},positionWithinBounds:om,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const r=n.element;z(["position","left","right","top","bottom"],(e=>Ft(r,e))),(e=>{Ot(e,bc)})(r),o.clear(n.uid)}});const rm=Kl({fields:Qd,name:"positioning",active:ec,apis:nm,state:Object.freeze({__proto__:null,init:()=>{let e={};return Ia({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>ve(e,t)})}})}),sm=e=>e.getSystem().isConnected(),am=e=>{js(e,Bs());const t=e.components();z(t,am)},im=e=>{const t=e.components();z(t,im),js(e,Rs())},lm=(e,t)=>{e.getSystem().addToWorld(t),yt(e.element)&&im(t)},cm=e=>{am(e),e.getSystem().removeFromWorld(e)},dm=(e,t)=>{Ho(e.element,t.element)},mm=(e,t,o)=>{const n=e.components();(e=>{z(e.components(),(e=>Fo(e.element))),Po(e.element),e.syncComponents()})(e);const r=o(t),s=X(n,r);z(s,(t=>{am(t),e.getSystem().removeFromWorld(t)})),z(r,(t=>{sm(t)?dm(e,t):(e.getSystem().addToWorld(t),dm(e,t),yt(e.element)&&im(t))})),e.syncComponents()},um=(e,t)=>{gm(e,t,Ho)},gm=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),yt(e.element)&&im(t),e.syncComponents()},hm=e=>{am(e),Fo(e.element),e.getSystem().removeFromWorld(e)},pm=e=>{const t=nt(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()));hm(e),t.each((e=>{e.syncComponents()}))},fm=e=>{const t=e.components();z(t,hm),Po(e.element),e.syncComponents()},vm=(e,t)=>{ym(e,t,Ho)},bm=(e,t)=>{ym(e,t,Bo)},ym=(e,t,o)=>{o(e,t.element);const n=at(t.element);z(n,(e=>{t.getByDom(e).each(im)}))},wm=e=>{const t=at(e.element);z(t,(t=>{e.getByDom(t).each(am)})),Fo(e.element)},xm=(e,t,o,n)=>{o.get().each((t=>{fm(e)}));const r=t.getAttachPoint(e);um(r,e);const s=e.getSystem().build(n);return um(e,s),o.set(s),s},Cm=(e,t,o,n)=>{const r=xm(e,t,o,n);return t.onOpen(e,r),r},Sm=(e,t,o)=>{o.get().each((n=>{fm(e),pm(e),t.onClose(e,n),o.clear()}))},km=(e,t,o)=>o.isOpen(),_m=(e,t,o)=>{const n=t.getAttachPoint(e);Mt(e.element,"position",rm.getMode(n)),((e,t,o,n)=>{Ht(e.element,t).fold((()=>{Ot(e.element,o)}),(t=>{St(e.element,o,t)})),Mt(e.element,t,n)})(e,"visibility",t.cloakVisibilityAttr,"hidden")},Em=(e,t,o)=>{(e=>H(["top","left","right","bottom"],(t=>Ht(e,t).isSome())))(e.element)||Ft(e.element,"position"),((e,t,o)=>{Et(e.element,o).fold((()=>Ft(e.element,t)),(o=>Mt(e.element,t,o)))})(e,"visibility",t.cloakVisibilityAttr)};var Tm=Object.freeze({__proto__:null,cloak:_m,decloak:Em,open:Cm,openWhileCloaked:(e,t,o,n,r)=>{_m(e,t),Cm(e,t,o,n),r(),Em(e,t)},close:Sm,isOpen:km,isPartOf:(e,t,o,n)=>km(0,0,o)&&o.get().exists((o=>t.isPartOf(e,o,n))),getState:(e,t,o)=>o.get(),setContent:(e,t,o,n)=>o.get().map((()=>xm(e,t,o,n)))});var Om=Object.freeze({__proto__:null,events:(e,t)=>Ys([Qs(Es(),((o,n)=>{Sm(o,e,t)}))])}),Dm=[el("onOpen"),el("onClose"),dr("isPartOf"),dr("getAttachPoint"),Tr("cloakVisibilityAttr","data-precloak-visibility")];var Am=Object.freeze({__proto__:null,init:()=>{const e=kc(),t=w("not-implemented");return Ia({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Mm=Kl({fields:Dm,name:"sandboxing",active:Om,apis:Tm,state:Am}),Nm=w("dismiss.popups"),Rm=w("reposition.popups"),Bm=w("mouse.released"),Lm=In([Tr("isExtraPart",T),Er("fireEventInstead",[Tr("event",Ls())])]),Hm=e=>{const t=nr("Dismissal",Lm,e);return{[Nm()]:{schema:In([dr("target")]),onReceive:(e,o)=>{if(Mm.isOpen(e)){Mm.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold((()=>Mm.close(e)),(t=>js(e,t.event)))}}}}},Im=In([Er("fireEventInstead",[Tr("event",Hs())]),pr("doReposition")]),Pm=e=>{const t=nr("Reposition",Im,e);return{[Rm()]:{onReceive:e=>{Mm.isOpen(e)&&t.fireEventInstead.fold((()=>t.doReposition(e)),(t=>js(e,t.event)))}}}},Fm=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},zm=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var Vm=Object.freeze({__proto__:null,onLoad:Fm,onUnload:zm,setValue:(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)},getValue:(e,t,o)=>t.store.manager.getValue(e,t,o),getState:(e,t,o)=>o});var Zm=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[ia(((o,n)=>{Fm(o,e,t)})),la(((o,n)=>{zm(o,e,t)}))]:[Ul(e,t,Fm)];return Ys(o)}});const Um=()=>{const e=Hr(null);return Ia({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},jm=()=>{const e=Hr({}),t=Hr({});return Ia({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>ve(e.get(),o).orThunk((()=>ve(t.get(),o))),update:o=>{const n=e.get(),r=t.get(),s={},a={};z(o,(e=>{s[e.value]=e,ve(e,"meta").each((t=>{ve(t,"text").each((t=>{a[t]=e}))}))})),e.set({...n,...s}),t.set({...r,...a})},clear:()=>{e.set({}),t.set({})}})};var Wm=Object.freeze({__proto__:null,memory:Um,dataset:jm,manual:()=>Ia({readState:v}),init:e=>e.store.manager.state(e)});const $m=(e,t,o,n)=>{const r=t.store;o.update([n]),r.setValue(e,n),t.onSetValue(e,n)};var qm=[yr("initialValue"),dr("getFallbackEntry"),dr("getDataKey"),dr("setValue"),rl("manager",{setValue:$m,getValue:(e,t,o)=>{const n=t.store,r=n.getDataKey(e);return o.lookup(r).getOrThunk((()=>n.getFallbackEntry(r)))},onLoad:(e,t,o)=>{t.store.initialValue.each((n=>{$m(e,t,o,n)}))},onUnload:(e,t,o)=>{o.clear()},state:jm})];var Gm=[dr("getValue"),Tr("setValue",v),yr("initialValue"),rl("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:v,state:Ha.init})];var Km=[yr("initialValue"),rl("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:Um})],Ym=[Or("store",{mode:"memory"},sr("mode",{memory:Km,manual:Gm,dataset:qm})),el("onSetValue"),Tr("resetOnDom",!1)];const Xm=Kl({fields:Ym,name:"representing",active:Zm,apis:Vm,extra:{setValueFrom:(e,t)=>{const o=Xm.getValue(t);Xm.setValue(e,o)}},state:Wm}),Jm=(e,t)=>Lr(e,{},F(t,(t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,ir(o,o,{tag:"option",process:{}},An((e=>un("The field: "+o+" is forbidden. "+n))));var o,n})).concat([lr("dump",x)])),Qm=e=>e.dump,eu=(e,t)=>({...ql(t),...e.dump}),tu=Jm,ou=eu,nu="placeholder",ru=Ir([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),su=e=>be(e,"uiType"),au=(e,t,o,n)=>su(o)&&o.uiType===nu?((e,t,o,n)=>e.exists((e=>e!==o.owner))?ru.single(!0,w(o)):ve(n,o.name).fold((()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+ae(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))}),(e=>e.replace())))(e,0,o,n):ru.single(!1,w(o)),iu=(e,t,o,n)=>au(e,0,o,n).fold(((r,s)=>{const a=su(o)?s(t,o.config,o.validated):s(t),i=ve(a,"components").getOr([]),l=G(i,(o=>iu(e,t,o,n)));return[{...a,components:l}]}),((e,n)=>{if(su(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(x)(e)}return n(t)})),lu=(e,t,o,n)=>{const r=ce(n,((e,t)=>((e,t)=>{let o=!1;return{name:w(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))),s=((e,t,o,n)=>G(o,(o=>iu(e,t,o,n))))(e,t,o,r);return le(r,(o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),s},cu=ru.single,du=ru.multiple,mu=w(nu),uu=Ir([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),gu=Tr("factory",{sketch:x}),hu=Tr("schema",[]),pu=dr("name"),fu=ir("pname","pname",Sn((e=>"")),Un()),vu=lr("schema",(()=>[yr("preprocess")])),bu=Tr("defaults",w({})),yu=Tr("overrides",w({})),wu=Pn([gu,hu,pu,fu,bu,yu]),xu=Pn([gu,hu,pu,bu,yu]),Cu=Pn([gu,hu,pu,fu,bu,yu]),Su=Pn([gu,vu,pu,dr("unit"),fu,bu,yu]),ku=e=>e.fold(D.some,D.none,D.some,D.some),_u=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},Eu=(e,t)=>o=>{const n=nr("Converting part type",t,o);return e(n)},Tu=Eu(uu.required,wu),Ou=Eu(uu.external,xu),Du=Eu(uu.optional,Cu),Au=Eu(uu.group,Su),Mu=w("entirety");var Nu=Object.freeze({__proto__:null,required:Tu,external:Ou,optional:Du,group:Au,asNamedPart:ku,name:_u,asCommon:e=>e.fold(x,x,x,x),original:Mu});const Ru=(e,t,o,n)=>xn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),Bu=(e,t)=>{const o={};return z(t,(t=>{ku(t).each((t=>{const n=Lu(e,t.pname);o[t.name]=o=>{const r=nr("Part: "+t.name+" in "+e,Pn(t.schema),o);return{...n,config:o,validated:r}}}))})),o},Lu=(e,t)=>({uiType:mu(),owner:e,name:t}),Hu=(e,t,o)=>({uiType:mu(),owner:e,name:t,config:o,validated:{}}),Iu=e=>G(e,(e=>e.fold(D.none,D.some,D.none,D.none).map((e=>fr(e.name,e.schema.concat([sl(Mu())])))).toArray())),Pu=e=>F(e,_u),Fu=(e,t,o)=>((e,t,o)=>{const n={},r={};return z(o,(e=>{e.fold((e=>{n[e.pname]=cu(!0,((t,o,n)=>e.factory.sketch(Ru(t,e,o,n))))}),(e=>{const o=t.parts[e.name];r[e.name]=w(e.factory.sketch(Ru(t,e,o[Mu()]),o))}),(e=>{n[e.pname]=cu(!1,((t,o,n)=>e.factory.sketch(Ru(t,e,o,n))))}),(e=>{n[e.pname]=du(!0,((t,o,n)=>{const r=t[e.name];return F(r,(o=>e.factory.sketch(xn(e.defaults(t,o,n),o,e.overrides(t,o)))))}))}))})),{internals:w(n),externals:w(r)}})(0,t,o),zu=(e,t,o)=>lu(D.some(e),t,t.components,o),Vu=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},Zu=(e,t,o)=>Vu(e,t,o).getOrDie("Could not find part: "+o),Uu=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return z(o,(e=>{n[e]=w(s.getByUid(r[e]))})),n},ju=(e,t)=>{const o=e.getSystem();return ce(t.partUids,((e,t)=>w(o.getByUid(e))))},Wu=e=>ae(e.partUids),$u=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return z(o,(e=>{n[e]=w(s.getByUid(r[e]).getOrDie())})),n},qu=(e,t)=>{const o=Pu(t);return zr(F(o,(t=>({key:t,value:e+"-"+t}))))},Gu=e=>ir("partUids","partUids",_n((t=>qu(t.uid,e))),Un());var Ku=Object.freeze({__proto__:null,generate:Bu,generateOne:Hu,schemas:Iu,names:Pu,substitutes:Fu,components:zu,defaultUids:qu,defaultUidsSchema:Gu,getAllParts:ju,getAllPartNames:Wu,getPart:Vu,getPartOrDie:Zu,getParts:Uu,getPartsOrDie:$u});const Yu=(e,t,o,n,r)=>{const s=((e,t)=>(e.length>0?[fr("parts",e)]:[]).concat([dr("uid"),Tr("dom",{}),Tr("components",[]),sl("originalSpec"),Tr("debug.sketcher",{})]).concat(t))(n,r);return nr(e+" [SpecSchema]",In(s.concat(t)),o)},Xu=(e,t,o,n,r)=>{const s=Ju(r),a=Iu(o),i=Gu(o),l=Yu(e,t,s,a,[i]),c=Fu(0,l,o);return n(l,zu(e,l,c.internals()),s,c.externals())},Ju=e=>(e=>be(e,"uid"))(e)?e:{...e,uid:Ea("uid")},Qu=In([dr("name"),dr("factory"),dr("configFields"),Tr("apis",{}),Tr("extraApis",{})]),eg=In([dr("name"),dr("factory"),dr("configFields"),dr("partFields"),Tr("apis",{}),Tr("extraApis",{})]),tg=e=>{const t=nr("Sketcher for "+e.name,Qu,e),o=ce(t.apis,La),n=ce(t.extraApis,((e,t)=>Ma(e,t)));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const r=Ju(n);return o(Yu(e,t,r,[],[]),r)})(t.name,t.configFields,t.factory,e),...o,...n}},og=e=>{const t=nr("Sketcher for "+e.name,eg,e),o=Bu(t.name,t.partFields),n=ce(t.apis,La),r=ce(t.extraApis,((e,t)=>Ma(e,t)));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>Xu(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...r}},ng=e=>Ge("input")(e)&&"radio"!==_t(e,"type")||Ge("textarea")(e);var rg=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const sg=[dr("find")],ag=Kl({fields:sg,name:"composing",apis:rg}),ig=["input","button","textarea","select"],lg=(e,t,o)=>{(t.disabled()?hg:pg)(e,t)},cg=(e,t)=>!0===t.useNative&&L(ig,Ve(e.element)),dg=e=>{St(e.element,"disabled","disabled")},mg=e=>{Ot(e.element,"disabled")},ug=e=>{St(e.element,"aria-disabled","true")},gg=e=>{St(e.element,"aria-disabled","false")},hg=(e,t,o)=>{t.disableClass.each((t=>{ti(e.element,t)}));(cg(e,t)?dg:ug)(e),t.onDisabled(e)},pg=(e,t,o)=>{t.disableClass.each((t=>{ni(e.element,t)}));(cg(e,t)?mg:gg)(e),t.onEnabled(e)},fg=(e,t)=>cg(e,t)?(e=>Tt(e.element,"disabled"))(e):(e=>"true"===_t(e.element,"aria-disabled"))(e);var vg=Object.freeze({__proto__:null,enable:pg,disable:hg,isDisabled:fg,onLoad:lg,set:(e,t,o,n)=>{(n?hg:pg)(e,t)}});var bg=Object.freeze({__proto__:null,exhibit:(e,t)=>Fa({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Ys([Xs(Cs(),((t,o)=>fg(t,e))),Ul(e,t,lg)])}),yg=[Rr("disabled",T),Tr("useNative",!0),yr("disableClass"),el("onDisabled"),el("onEnabled")];const wg=Kl({fields:yg,name:"disabling",active:bg,apis:vg}),xg=(e,t,o,n)=>{const r=_d(e.element,"."+t.highlightClass);z(r,(o=>{H(n,(e=>Xe(e.element,o)))||(ni(o,t.highlightClass),e.getSystem().getByDom(o).each((o=>{t.onDehighlight(e,o),js(o,Us())})))}))},Cg=(e,t,o,n)=>{xg(e,t,0,[n]),Sg(e,t,o,n)||(ti(n.element,t.highlightClass),t.onHighlight(e,n),js(n,Zs()))},Sg=(e,t,o,n)=>si(n.element,t.highlightClass),kg=(e,t,o,n)=>{const r=_d(e.element,"."+t.itemClass);return D.from(r[n]).fold((()=>on.error(new Error("No element found with index "+n))),e.getSystem().getByDom)},_g=(e,t,o)=>Bi(e.element,"."+t.itemClass).bind((t=>e.getSystem().getByDom(t).toOptional())),Eg=(e,t,o)=>{const n=_d(e.element,"."+t.itemClass);return(n.length>0?D.some(n[n.length-1]):D.none()).bind((t=>e.getSystem().getByDom(t).toOptional()))},Tg=(e,t,o,n)=>{const r=_d(e.element,"."+t.itemClass),s=$(r,(e=>si(e,t.highlightClass)));return s.bind((t=>{const o=vl(t,n,0,r.length-1);return e.getSystem().getByDom(r[o]).toOptional()}))},Og=(e,t,o)=>{const n=_d(e.element,"."+t.itemClass);return xe(F(n,(t=>e.getSystem().getByDom(t).toOptional())))};var Dg=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>xg(e,t,0,[]),dehighlight:(e,t,o,n)=>{Sg(e,t,o,n)&&(ni(n.element,t.highlightClass),t.onDehighlight(e,n),js(n,Us()))},highlight:Cg,highlightFirst:(e,t,o)=>{_g(e,t).each((n=>{Cg(e,t,o,n)}))},highlightLast:(e,t,o)=>{Eg(e,t).each((n=>{Cg(e,t,o,n)}))},highlightAt:(e,t,o,n)=>{kg(e,t,o,n).fold((e=>{throw e}),(n=>{Cg(e,t,o,n)}))},highlightBy:(e,t,o,n)=>{const r=Og(e,t);W(r,n).each((n=>{Cg(e,t,o,n)}))},isHighlighted:Sg,getHighlighted:(e,t,o)=>Bi(e.element,"."+t.highlightClass).bind((t=>e.getSystem().getByDom(t).toOptional())),getFirst:_g,getLast:Eg,getPrevious:(e,t,o)=>Tg(e,t,0,-1),getNext:(e,t,o)=>Tg(e,t,0,1),getCandidates:Og}),Ag=[dr("highlightClass"),dr("itemClass"),el("onHighlight"),el("onDehighlight")];const Mg=Kl({fields:Ag,name:"highlighting",apis:Dg}),Ng=[8],Rg=[9],Bg=[13],Lg=[27],Hg=[32],Ig=[37],Pg=[38],Fg=[39],zg=[40],Vg=(e,t,o)=>{const n=Y(e.slice(0,t)),r=Y(e.slice(t+1));return W(n.concat(r),o)},Zg=(e,t,o)=>{const n=Y(e.slice(0,t));return W(n,o)},Ug=(e,t,o)=>{const n=e.slice(0,t),r=e.slice(t+1);return W(r.concat(n),o)},jg=(e,t,o)=>{const n=e.slice(t+1);return W(n,o)},Wg=e=>t=>{const o=t.raw;return L(e,o.which)},$g=e=>t=>K(e,(e=>e(t))),qg=e=>!0===e.raw.shiftKey,Gg=e=>!0===e.raw.ctrlKey,Kg=k(qg),Yg=(e,t)=>({matches:e,classification:t}),Xg=(e,t,o)=>{t.exists((e=>o.exists((t=>Xe(t,e)))))||Ws(e,Is(),{prevFocus:t,newFocus:o})},Jg=()=>{const e=e=>sc(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const r=e(t);Xg(t,n,r)}}},Qg=()=>{const e=e=>Mg.getHighlighted(e).map((e=>e.element));return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(v,(e=>{Mg.highlight(t,e)}));const r=e(t);Xg(t,n,r)}}};var eh;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(eh||(eh={}));const th=(e,t,o,n,r)=>{const s=(e,t,o,n,r)=>((e,t)=>{const o=W(e,(e=>e.matches(t)));return o.map((e=>e.classification))})(o(e,t,n,r),t.event).bind((o=>o(e,t,n,r))),a={schema:()=>e.concat([Tr("focusManager",Jg()),Or("focusInside","onFocus",Qn((e=>L(["onFocus","onEnterOrSpace","onApi"],e)?on.value(e):on.error("Invalid value for focusInside")))),rl("handler",a),rl("state",t),rl("sendFocusIn",r)]),processKey:s,toEvents:(e,t)=>{const a=e.focusInside!==eh.OnFocusMode?D.none():r(e).map((o=>Qs(bs(),((n,r)=>{o(n,e,t),r.stop()})))),i=[Qs(is(),((n,a)=>{s(n,a,o,e,t).fold((()=>{((o,n)=>{const s=Wg(Hg.concat(Bg))(n.event);e.focusInside===eh.OnEnterOrSpaceMode&&s&&Wr(o,n)&&r(e).each((r=>{r(o,e,t),n.stop()}))})(n,a)}),(e=>{a.stop()}))})),Qs(ls(),((o,r)=>{s(o,r,n,e,t).each((e=>{r.stop()}))}))];return Ys(a.toArray().concat(i))}};return a},oh=e=>{const t=[yr("onEscape"),yr("onEnter"),Tr("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Tr("firstTabstop",0),Tr("useTabstopAt",O),yr("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind((e=>Li(t,e))).getOr(t);return Ut(o)>0},n=(e,t)=>t.focusManager.get(e).bind((e=>Li(e,t.selector))),r=(e,t,n)=>{((e,t)=>{const n=_d(e.element,t.selector),r=Z(n,(e=>o(t,e)));return D.from(r[t.firstTabstop])})(e,t).each((o=>{t.focusManager.set(e,o)}))},s=(e,t,n,r,s)=>s(t,n,(e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(r,e))).fold((()=>r.cyclic?D.some(!0):D.none()),(t=>(r.focusManager.set(e,t),D.some(!0)))),a=(e,t,o,r)=>{const a=_d(e.element,o.selector);return n(e,o).bind((t=>$(a,S(Xe,t)).bind((t=>s(e,a,t,o,r)))))},i=(e,t,o)=>{const n=o.cyclic?Vg:Zg;return a(e,0,o,n)},l=(e,t,o)=>{const n=o.cyclic?Ug:jg;return a(e,0,o,n)},c=e=>(e=>nt(e))(e).bind(lt).exists((t=>Xe(t,e))),d=w([Yg($g([qg,Wg(Rg)]),i),Yg(Wg(Rg),l),Yg($g([Kg,Wg(Bg)]),((e,t,o)=>o.onEnter.bind((o=>o(e,t)))))]),m=w([Yg(Wg(Lg),((e,t,o)=>o.onEscape.bind((o=>o(e,t))))),Yg(Wg(Rg),((e,t,o)=>n(e,o).filter((e=>!o.useTabstopAt(e))).bind((n=>(c(n)?i:l)(e,t,o)))))]);return th(t,Ha.init,d,m,(()=>D.some(r)))};var nh=oh(lr("cyclic",T)),rh=oh(lr("cyclic",O));const sh=(e,t,o)=>ng(o)&&Wg(Hg)(t.event)?D.none():((e,t,o)=>(qs(e,o,Cs()),D.some(!0)))(e,0,o),ah=(e,t)=>D.some(!0),ih=[Tr("execute",sh),Tr("useSpace",!1),Tr("useEnter",!0),Tr("useControlEnter",!1),Tr("useDown",!1)],lh=(e,t,o)=>o.execute(e,t,e.element);var ch=th(ih,Ha.init,((e,t,o,n)=>{const r=o.useSpace&&!ng(e.element)?Hg:[],s=o.useEnter?Bg:[],a=o.useDown?zg:[],i=r.concat(s).concat(a);return[Yg(Wg(i),lh)].concat(o.useControlEnter?[Yg($g([Gg,Wg(Bg)]),lh)]:[])}),((e,t,o,n)=>o.useSpace&&!ng(e.element)?[Yg(Wg(Hg),ah)]:[]),(()=>D.none()));const dh=()=>{const e=kc();return Ia({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 mh=Object.freeze({__proto__:null,flatgrid:dh,init:e=>e.state(e)});const uh=e=>(t,o,n,r)=>{const s=e(t.element);return fh(s,t,o,n,r)},gh=(e,t)=>{const o=$c(e,t);return uh(o)},hh=(e,t)=>{const o=$c(t,e);return uh(o)},ph=e=>(t,o,n,r)=>fh(e,t,o,n,r),fh=(e,t,o,n,r)=>n.focusManager.get(t).bind((o=>e(t.element,o,n,r))).map((e=>(n.focusManager.set(t,e),!0))),vh=ph,bh=ph,yh=ph,wh=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),xh=(e,t,o)=>{const n=_d(e,o);return((e,t)=>$(e,t).map((t=>({index:t,candidates:e}))))(Z(n,wh),(e=>Xe(e,t)))},Ch=(e,t)=>$(e,(e=>Xe(t,e))),Sh=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind((t=>{const n=t.row*o+t.column;return n>=0&&nSh(e,t,n,((t,s)=>{const a=t===o-1?e.length-t*n:n,i=vl(s,r,0,a-1);return D.some({row:t,column:i})})),_h=(e,t,o,n,r)=>Sh(e,t,n,((t,s)=>{const a=vl(t,r,0,o-1),i=a===o-1?e.length-a*n:n,l=bl(s,0,i-1);return D.some({row:a,column:l})})),Eh=[dr("selector"),Tr("execute",sh),tl("onEscape"),Tr("captureTab",!1),al()],Th=(e,t,o)=>{Bi(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},Oh=e=>(t,o,n,r)=>xh(t,o,n.selector).bind((t=>e(t.candidates,t.index,r.getNumRows().getOr(n.initSize.numRows),r.getNumColumns().getOr(n.initSize.numColumns)))),Dh=(e,t,o)=>o.captureTab?D.some(!0):D.none(),Ah=Oh(((e,t,o,n)=>kh(e,t,o,n,-1))),Mh=Oh(((e,t,o,n)=>kh(e,t,o,n,1))),Nh=Oh(((e,t,o,n)=>_h(e,t,o,n,-1))),Rh=Oh(((e,t,o,n)=>_h(e,t,o,n,1))),Bh=w([Yg(Wg(Ig),gh(Ah,Mh)),Yg(Wg(Fg),hh(Ah,Mh)),Yg(Wg(Pg),vh(Nh)),Yg(Wg(zg),bh(Rh)),Yg($g([qg,Wg(Rg)]),Dh),Yg($g([Kg,Wg(Rg)]),Dh),Yg(Wg(Hg.concat(Bg)),((e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind((e=>Li(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n)))))]),Lh=w([Yg(Wg(Lg),((e,t,o)=>o.onEscape(e,t))),Yg(Wg(Hg),ah)]);var Hh=th(Eh,dh,Bh,Lh,(()=>D.some(Th)));const Ih=(e,t,o,n,r)=>{const s=(e,t,o)=>r(e,t,n,0,o.length-1,o[t],(t=>{return n=o[t],"button"===Ve(n)&&"disabled"===_t(n,"disabled")?s(e,t,o):D.from(o[t]);var n}));return xh(e,o,t).bind((e=>{const t=e.index,o=e.candidates;return s(t,t,o)}))},Ph=(e,t,o,n)=>Ih(e,t,o,n,((e,t,o,n,r,s,a)=>{const i=bl(t+o,n,r);return i===e?D.from(s):a(i)})),Fh=(e,t,o,n)=>Ih(e,t,o,n,((e,t,o,n,r,s,a)=>{const i=vl(t,o,n,r);return i===e?D.none():a(i)})),zh=[dr("selector"),Tr("getInitial",D.none),Tr("execute",sh),tl("onEscape"),Tr("executeOnMove",!1),Tr("allowVertical",!0),Tr("allowHorizontal",!0),Tr("cycles",!0)],Vh=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind((e=>Li(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n))),Zh=(e,t,o)=>{t.getInitial(e).orThunk((()=>Bi(e.element,t.selector))).each((o=>{t.focusManager.set(e,o)}))},Uh=(e,t,o)=>(o.cycles?Fh:Ph)(e,o.selector,t,-1),jh=(e,t,o)=>(o.cycles?Fh:Ph)(e,o.selector,t,1),Wh=e=>(t,o,n,r)=>e(t,o,n,r).bind((()=>n.executeOnMove?Vh(t,o,n):D.some(!0))),$h=w([Yg(Wg(Hg),ah),Yg(Wg(Lg),((e,t,o)=>o.onEscape(e,t)))]);var qh=th(zh,Ha.init,((e,t,o,n)=>{const r=[...o.allowHorizontal?Ig:[]].concat(o.allowVertical?Pg:[]),s=[...o.allowHorizontal?Fg:[]].concat(o.allowVertical?zg:[]);return[Yg(Wg(r),Wh(gh(Uh,jh))),Yg(Wg(s),Wh(hh(Uh,jh))),Yg(Wg(Bg),Vh),Yg(Wg(Hg),Vh)]}),$h,(()=>D.some(Zh)));const Gh=(e,t,o)=>D.from(e[t]).bind((e=>D.from(e[o]).map((e=>({rowIndex:t,columnIndex:o,cell:e}))))),Kh=(e,t,o,n)=>{const r=e[t].length,s=vl(o,n,0,r-1);return Gh(e,t,s)},Yh=(e,t,o,n)=>{const r=vl(o,n,0,e.length-1),s=e[r].length,a=bl(t,0,s-1);return Gh(e,r,a)},Xh=(e,t,o,n)=>{const r=e[t].length,s=bl(o+n,0,r-1);return Gh(e,t,s)},Jh=(e,t,o,n)=>{const r=bl(o+n,0,e.length-1),s=e[r].length,a=bl(t,0,s-1);return Gh(e,r,a)},Qh=[fr("selectors",[dr("row"),dr("cell")]),Tr("cycles",!0),Tr("previousSelector",D.none),Tr("execute",sh)],ep=(e,t,o)=>{t.previousSelector(e).orThunk((()=>{const o=t.selectors;return Bi(e.element,o.cell)})).each((o=>{t.focusManager.set(e,o)}))},tp=(e,t)=>(o,n,r)=>{const s=r.cycles?e:t;return Li(n,r.selectors.row).bind((e=>{const t=_d(e,r.selectors.cell);return Ch(t,n).bind((t=>{const n=_d(o,r.selectors.row);return Ch(n,e).bind((e=>{const o=((e,t)=>F(e,(e=>_d(e,t.selectors.cell))))(n,r);return s(o,e,t).map((e=>e.cell))}))}))}))},op=tp(((e,t,o)=>Kh(e,t,o,-1)),((e,t,o)=>Xh(e,t,o,-1))),np=tp(((e,t,o)=>Kh(e,t,o,1)),((e,t,o)=>Xh(e,t,o,1))),rp=tp(((e,t,o)=>Yh(e,o,t,-1)),((e,t,o)=>Jh(e,o,t,-1))),sp=tp(((e,t,o)=>Yh(e,o,t,1)),((e,t,o)=>Jh(e,o,t,1))),ap=w([Yg(Wg(Ig),gh(op,np)),Yg(Wg(Fg),hh(op,np)),Yg(Wg(Pg),vh(rp)),Yg(Wg(zg),bh(sp)),Yg(Wg(Hg.concat(Bg)),((e,t,o)=>sc(e.element).bind((n=>o.execute(e,t,n)))))]),ip=w([Yg(Wg(Hg),ah)]);var lp=th(Qh,Ha.init,ap,ip,(()=>D.some(ep)));const cp=[dr("selector"),Tr("execute",sh),Tr("moveOnTab",!1)],dp=(e,t,o)=>o.focusManager.get(e).bind((n=>o.execute(e,t,n))),mp=(e,t,o)=>{Bi(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},up=(e,t,o)=>Fh(e,o.selector,t,-1),gp=(e,t,o)=>Fh(e,o.selector,t,1),hp=w([Yg(Wg(Pg),yh(up)),Yg(Wg(zg),yh(gp)),Yg($g([qg,Wg(Rg)]),((e,t,o,n)=>o.moveOnTab?yh(up)(e,t,o,n):D.none())),Yg($g([Kg,Wg(Rg)]),((e,t,o,n)=>o.moveOnTab?yh(gp)(e,t,o,n):D.none())),Yg(Wg(Bg),dp),Yg(Wg(Hg),dp)]),pp=w([Yg(Wg(Hg),ah)]);var fp=th(cp,Ha.init,hp,pp,(()=>D.some(mp)));const vp=[tl("onSpace"),tl("onEnter"),tl("onShiftEnter"),tl("onLeft"),tl("onRight"),tl("onTab"),tl("onShiftTab"),tl("onUp"),tl("onDown"),tl("onEscape"),Tr("stopSpaceKeyup",!1),yr("focusIn")];var bp=th(vp,Ha.init,((e,t,o)=>[Yg(Wg(Hg),o.onSpace),Yg($g([Kg,Wg(Bg)]),o.onEnter),Yg($g([qg,Wg(Bg)]),o.onShiftEnter),Yg($g([qg,Wg(Rg)]),o.onShiftTab),Yg($g([Kg,Wg(Rg)]),o.onTab),Yg(Wg(Pg),o.onUp),Yg(Wg(zg),o.onDown),Yg(Wg(Ig),o.onLeft),Yg(Wg(Fg),o.onRight),Yg(Wg(Hg),o.onSpace)]),((e,t,o)=>[...o.stopSpaceKeyup?[Yg(Wg(Hg),ah)]:[],Yg(Wg(Lg),o.onEscape)]),(e=>e.focusIn));const yp=nh.schema(),wp=rh.schema(),xp=qh.schema(),Cp=Hh.schema(),Sp=lp.schema(),kp=ch.schema(),_p=fp.schema(),Ep=bp.schema();const Tp=Xl({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:yp,cyclic:wp,flow:xp,flatgrid:Cp,matrix:Sp,execution:kp,menu:_p,special:Ep}),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,r)=>{(e=>ye(e,"setGridSize"))(o)?o.setGridSize(n,r):console.error("Layout does not support setGridSize")}},state:mh}),Op=(e,t)=>{ac((()=>{mm(e,t,(()=>F(t,e.getSystem().build)))}),e.element)},Dp=(e,t)=>{ac((()=>{((e,t,o)=>{const n=e.components(),r=G(t,(e=>Ba(e).toArray()));z(n,(e=>{L(r,e)||cm(e)}));const s=o(t),a=X(n,s);z(a,(e=>{sm(e)&&cm(e)})),z(s,(t=>{sm(t)||lm(e,t)})),e.syncComponents()})(e,t,(()=>((e,t,o)=>ui(e,t,((t,n)=>gi(e,n,t,o))))(e.element,t,e.getSystem().buildOrPatch)))}),e.element)},Ap=(e,t,o,n)=>{cm(t);const r=gi(e.element,o,n,e.getSystem().buildOrPatch);lm(e,r),e.syncComponents()},Mp=(e,t,o)=>{const n=e.getSystem().build(o);gm(e,n,t)},Np=(e,t,o,n)=>{pm(t),Mp(e,((e,t)=>((e,t,o)=>{it(e,o).fold((()=>{Ho(e,t)}),(e=>{Ro(e,t)}))})(e,t,o)),n)},Rp=(e,t)=>e.components(),Bp=(e,t,o,n,r)=>{const s=Rp(e);return D.from(s[n]).map((o=>(r.fold((()=>pm(o)),(r=>{(t.reuseDom?Ap:Np)(e,o,n,r)})),o)))};var Lp=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Mp(e,Ho,n)},prepend:(e,t,o,n)=>{Mp(e,Lo,n)},remove:(e,t,o,n)=>{const r=Rp(e),s=W(r,(e=>Xe(n.element,e.element)));s.each(pm)},replaceAt:Bp,replaceBy:(e,t,o,n,r)=>{const s=Rp(e);return $(s,n).bind((o=>Bp(e,t,0,o,r)))},set:(e,t,o,n)=>(t.reuseDom?Dp:Op)(e,n),contents:Rp});const Hp=Kl({fields:[Nr("reuseDom",!0)],name:"replacing",apis:Lp}),Ip=(e,t)=>{const o=((e,t)=>{const o=Ys(t);return Kl({fields:[dr("enabled")],name:e,active:{events:w(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:w({}),initialConfig:{},state:Ha}}},Pp=(e,t)=>{t.ignore||(tc(e.element),t.onFocus(e))};var Fp=Object.freeze({__proto__:null,focus:Pp,blur:(e,t)=>{t.ignore||oc(e.element)},isFocused:e=>nc(e.element)});var zp=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return Fa(o)},events:e=>Ys([Qs(bs(),((t,o)=>{Pp(t,e),o.stop()}))].concat(e.stopMousedown?[Qs(es(),((e,t)=>{t.event.prevent()}))]:[]))}),Vp=[el("onFocus"),Tr("stopMousedown",!1),Tr("ignore",!1)];const Zp=Kl({fields:Vp,name:"focusing",active:zp,apis:Fp}),Up=(e,t,o,n)=>{const r=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each((t=>{o.get()?ti(e.element,t):ni(e.element,t)}))})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),r!==n&&t.onToggled(e,n)},jp=(e,t,o)=>{Up(e,t,o,!o.get())},Wp=(e,t,o)=>{Up(e,t,o,t.selected)};var $p=Object.freeze({__proto__:null,onLoad:Wp,toggle:jp,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{Up(e,t,o,!0)},off:(e,t,o)=>{Up(e,t,o,!1)},set:Up});var qp=Object.freeze({__proto__:null,exhibit:()=>Fa({}),events:(e,t)=>{const o=(n=e,r=t,s=jp,da((e=>{s(e,n,r)})));var n,r,s;const a=Ul(e,t,Wp);return Ys(q([e.toggleOnExecute?[o]:[],[a]]))}});const Gp=(e,t,o)=>{St(e.element,"aria-expanded",o)};var Kp=[Tr("selected",!1),yr("toggleClass"),Tr("toggleOnExecute",!0),el("onToggled"),Or("aria",{mode:"none"},sr("mode",{pressed:[Tr("syncWithExpanded",!1),rl("update",((e,t,o)=>{St(e.element,"aria-pressed",o),t.syncWithExpanded&&Gp(e,t,o)}))],checked:[rl("update",((e,t,o)=>{St(e.element,"aria-checked",o)}))],expanded:[rl("update",Gp)],selected:[rl("update",((e,t,o)=>{St(e.element,"aria-selected",o)}))],none:[rl("update",v)]}))];const Yp=Kl({fields:Kp,name:"toggling",active:qp,apis:$p,state:(Xp=!1,{init:()=>{const e=Hr(Xp);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(Xp),readState:()=>e.get()}}})});var Xp;const Jp=()=>{const e=(e,t)=>{t.stop(),$s(e)};return[Qs(ms(),e),Qs(ks(),e),ra(Yr()),ra(es())]},Qp=e=>Ys(q([e.map((e=>da(((t,o)=>{e(t),o.stop()})))).toArray(),Jp()])),ef="alloy.item-hover",tf="alloy.item-focus",of="alloy.item-toggled",nf=e=>{(sc(e.element).isNone()||Zp.isFocused(e))&&(Zp.isFocused(e)||Zp.focus(e),Ws(e,ef,{item:e}))},rf=e=>{Ws(e,tf,{item:e})},sf=w(ef),af=w(tf),lf=w(of),cf=e=>e.toggling.map((e=>e.exclusive?"menuitemradio":"menuitemcheckbox")).getOr("menuitem"),df=e=>({aria:{mode:"checked"},...ge(e,((e,t)=>"exclusive"!==t)),onToggled:(t,o)=>{h(e.onToggled)&&e.onToggled(t,o),((e,t)=>{Ws(e,of,{item:e,state:t})})(t,o)}}),mf=[dr("data"),dr("components"),dr("dom"),Tr("hasSubmenu",!1),yr("toggling"),tu("itemBehaviours",[Yp,Zp,Tp,Xm]),Tr("ignoreFocus",!1),Tr("domModification",{}),rl("builder",(e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:cf(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:ou(e.itemBehaviours,[e.toggling.fold(Yp.revoke,(e=>Yp.config(df(e)))),Zp.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{rf(e)}}),Tp.config({mode:"execution"}),Xm.config({store:{mode:"memory",initialValue:e.data}}),Ip("item-type-events",[...Jp(),Qs(rs(),nf),Qs(Ss(),Zp.focus)])]),components:e.components,eventOrder:e.eventOrder}))),Tr("eventOrder",{})],uf=[dr("dom"),dr("components"),rl("builder",(e=>({dom:e.dom,components:e.components,events:Ys([sa(Ss())])})))],gf=w("item-widget"),hf=w([Tu({name:"widget",overrides:e=>({behaviours:ql([Xm.config({store:{mode:"manual",getValue:t=>e.data,setValue:v}})])})})]),pf=[dr("uid"),dr("data"),dr("components"),dr("dom"),Tr("autofocus",!1),Tr("ignoreFocus",!1),tu("widgetBehaviours",[Xm,Zp,Tp]),Tr("domModification",{}),Gu(hf()),rl("builder",(e=>{const t=Fu(gf(),e,hf()),o=zu(gf(),e,t.internals()),n=t=>Vu(t,e,"widget").map((e=>(Tp.focusIn(e),e))),r=(t,o)=>ng(o.event.target)?D.none():e.autofocus?(o.setSource(t.element),D.none()):D.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Ys([da(((e,t)=>{n(e).each((e=>{t.stop()}))})),Qs(rs(),nf),Qs(Ss(),((t,o)=>{e.autofocus?n(t):Zp.focus(t)}))]),behaviours:ou(e.widgetBehaviours,[Xm.config({store:{mode:"memory",initialValue:e.data}}),Zp.config({ignore:e.ignoreFocus,onFocus:e=>{rf(e)}}),Tp.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:Jl(),onLeft:r,onRight:r,onEscape:(t,o)=>Zp.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),D.none()):D.none():(Zp.focus(t),D.some(!0))})])}}))],ff=sr("type",{widget:pf,item:mf,separator:uf}),vf=w([Au({factory:{sketch:e=>{const t=nr("menu.spec item",ff,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>be(t,"uid")?t:{...t,uid:Ea("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),bf=w([dr("value"),dr("items"),dr("dom"),dr("components"),Tr("eventOrder",{}),Jm("menuBehaviours",[Mg,Xm,ag,Tp]),Or("movement",{mode:"menu",moveOnTab:!0},sr("mode",{grid:[al(),rl("config",((e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager})))],matrix:[rl("config",((e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}))),dr("rowSelector"),Tr("previousSelector",D.none)],menu:[Tr("moveOnTab",!0),rl("config",((e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager})))]})),mr("markers",Ki()),Tr("fakeFocus",!1),Tr("focusManager",Jg()),el("onHighlight"),el("onDehighlight")]),yf=w("alloy.menu-focus"),wf=og({name:"Menu",configFields:bf(),partFields:vf(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:eu(e.menuBehaviours,[Mg.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),Xm.config({store:{mode:"memory",initialValue:e.value}}),ag.config({find:D.some}),Tp.config(e.movement.config(e,e.movement))]),events:Ys([Qs(af(),((e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each((o=>{Mg.highlight(e,o),t.stop(),Ws(e,yf(),{menu:e,item:o})}))})),Qs(sf(),((e,t)=>{const o=t.event.item;Mg.highlight(e,o)})),Qs(lf(),((e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===_t(o.element,"role")&&((e,t)=>{const o=_d(e.element,'[role="menuitemradio"][aria-checked="true"]');z(o,(o=>{Xe(o,t.element)||e.getSystem().getByDom(o).each((e=>{Yp.off(e)}))}))})(e,o)}))]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}})}),xf=(e,t,o,n)=>ve(o,n).bind((n=>ve(e,n).bind((n=>{const r=xf(e,t,o,n);return D.some([n].concat(r))})))).getOr([]),Cf=(e,t)=>{const o={};le(e,((e,t)=>{z(e,(e=>{o[e]=t}))}));const n=t,r=de(t,((e,t)=>({k:e,v:t})));const s=ce(r,((e,t)=>[t].concat(xf(o,n,r,t))));return ce(o,(e=>ve(s,e).getOr([e])))},Sf=e=>"prepared"===e.type?D.some(e.menu):D.none(),kf={init:()=>{const e=Hr({}),t=Hr({}),o=Hr({}),n=kc(),r=Hr({}),s=(t,o,n)=>a(t).bind((r=>(t=>pe(e.get(),((e,o)=>e===t)))(t).bind((e=>o(e).map((e=>({triggeredMenu:r,triggeringItem:e,triggeringPath:n}))))))),a=e=>i(e).bind(Sf),i=e=>ve(t.get(),e),l=t=>ve(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(s,a,i,l)=>{n.set(s),e.set(i),t.set(a),r.set(l);const c=Cf(l,i);o.set(c)},expand:t=>ve(e.get(),t).map((e=>{const n=ve(o.get(),t).getOr([]);return[e].concat(n)})),refresh:e=>ve(o.get(),e),collapse:e=>ve(o.get(),e).bind((e=>e.length>1?D.some(e.slice(1)):D.none())),lookupMenu:i,lookupItem:l,otherMenus:e=>{const t=r.get();return X(ae(t),e)},getPrimary:()=>n.get().bind(a),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(e,t)=>{const r=Z(l(e).toArray(),(e=>a(e).isSome()));return ve(o.get(),e).bind((e=>{const o=Y(r.concat(e));return(e=>{const t=[];for(let o=0;os(e,t,o.slice(0,r+1)).fold((()=>we(n.get(),e)?[]:[D.none()]),(e=>[D.some(e)])))))}))}}},extractPreparedMenu:Sf},_f=ya("tiered-menu-item-highlight"),Ef=ya("tiered-menu-item-dehighlight");var Tf;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Tf||(Tf={}));const Of=w("collapse-item"),Df=tg({name:"TieredMenu",configFields:[nl("onExecute"),nl("onEscape"),ol("onOpenMenu"),ol("onOpenSubmenu"),el("onRepositionMenu"),el("onCollapseMenu"),Tr("highlightOnOpen",Tf.HighlightMenuAndItem),fr("data",[dr("primary"),dr("menus"),dr("expansions")]),Tr("fakeFocus",!1),el("onHighlightItem"),el("onDehighlightItem"),el("onHover"),Xi(),dr("dom"),Tr("navigateOnHover",!0),Tr("stayInDom",!1),Jm("tmenuBehaviours",[Tp,Mg,ag,Hp]),Tr("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=kc(),n=kf.init(),r=t=>{const o=((t,o,n)=>ce(n,((n,r)=>{const s=()=>wf.sketch({...n,value:r,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{Ws(e,_f,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{Ws(e,Ef,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?Qg():Jg()});return r===o?{type:"prepared",menu:t.getSystem().build(s())}:{type:"notbuilt",nbMenu:s}})))(t,e.data.primary,e.data.menus),r=a();return n.setContents(e.data.primary,o,e.data.expansions,r),n.getPrimary()},s=e=>Xm.getValue(e).value,a=t=>ce(e.data.menus,((e,t)=>G(e.items,(e=>"separator"===e.type?[]:[e.data.value])))),i=Mg.highlight,l=(t,o)=>{i(t,o),Mg.getHighlighted(o).orThunk((()=>Mg.getFirst(o))).each((n=>{e.fakeFocus?Mg.highlight(o,n):qs(t,n.element,Ss())}))},c=(e,t)=>xe(F(t,(t=>e.lookupMenu(t).bind((e=>"prepared"===e.type?D.some(e.menu):D.none()))))),d=(t,o,n)=>{const r=c(o,o.otherMenus(n));z(r,(o=>{ii(o.element,[e.markers.backgroundMenu]),e.stayInDom||Hp.remove(t,o)}))},m=(t,n)=>{const r=(t=>o.get().getOrThunk((()=>{const n={},r=_d(t.element,`.${e.markers.item}`),a=Z(r,(e=>"true"===_t(e,"aria-haspopup")));return z(a,(e=>{t.getSystem().getByDom(e).each((e=>{const t=s(e);n[t]=e}))})),o.set(n),n})))(t);le(r,((e,t)=>{const o=L(n,t);St(e.element,"aria-expanded",o)}))},u=(t,o,n)=>D.from(n[0]).bind((r=>o.lookupMenu(r).bind((r=>{if("notbuilt"===r.type)return D.none();{const s=r.menu,a=c(o,n.slice(1));return z(a,(t=>{ti(t.element,e.markers.backgroundMenu)})),yt(s.element)||Hp.append(t,Ti(s)),ii(s.element,[e.markers.backgroundMenu]),l(t,s),d(t,o,n),D.some(s)}}))));let g;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(g||(g={}));const h=(t,o,r=g.HighlightSubmenu)=>{if(o.hasConfigured(wg)&&wg.isDisabled(o))return D.some(o);{const a=s(o);return n.expand(a).bind((s=>(m(t,s),D.from(s[0]).bind((a=>n.lookupMenu(a).bind((i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const r=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,r),r}return o.menu})(t,a,i);return yt(l.element)||Hp.append(t,Ti(l)),e.onOpenSubmenu(t,o,l,Y(s)),r===g.HighlightSubmenu?(Mg.highlightFirst(l),u(t,n,s)):(Mg.dehighlightAll(l),D.some(o))})))))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind((r=>(m(t,r),u(t,n,r).map((n=>(e.onCollapseMenu(t,o,n),n))))))},f=t=>(o,n)=>Li(n.getSource(),`.${e.markers.item}`).bind((e=>o.getSystem().getByDom(e).toOptional().bind((e=>t(o,e).map(O))))),b=Ys([Qs(yf(),((e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each((()=>{const o=t.event.menu;Mg.highlight(e,o);const r=s(t.event.item);n.refresh(r).each((t=>d(e,n,t)))}))})),da(((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each((o=>{0===s(o).indexOf("collapse-item")&&p(t,o),h(t,o,g.HighlightSubmenu).fold((()=>{e.onExecute(t,o)}),v)}))})),ia(((t,o)=>{r(t).each((o=>{Hp.append(t,Ti(o)),e.onOpenMenu(t,o),e.highlightOnOpen===Tf.HighlightMenuAndItem?l(t,o):e.highlightOnOpen===Tf.HighlightJustMenu&&i(t,o)}))})),Qs(_f,((t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)})),Qs(Ef,((t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)})),...e.navigateOnHover?[Qs(sf(),((t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind((t=>(m(e,t),u(e,n,t))))})(t,r),h(t,r,g.HighlightParent),e.onHover(t,r)}))]:[]]),y=e=>Mg.getHighlighted(e).bind(Mg.getHighlighted),w={collapseMenu:e=>{y(e).each((t=>{p(e,t)}))},highlightPrimary:e=>{n.getPrimary().each((t=>{l(e,t)}))},repositionMenus:t=>{const o=n.getPrimary().bind((e=>y(t).bind((e=>{const t=s(e),o=fe(n.getMenus()),r=xe(F(o,kf.extractPreparedMenu));return n.getTriggeringPath(t,(e=>((e,t,o)=>se(t,(e=>{if(!e.getSystem().isConnected())return D.none();const t=Mg.getCandidates(e);return W(t,(e=>s(e)===o))})))(0,r,e)))})).map((t=>({primary:e,triggeringPath:t})))));o.fold((()=>{(e=>D.from(e.components()[0]).filter((e=>"menu"===_t(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:eu(e.tmenuBehaviours,[Tp.config({mode:"special",onRight:f(((e,t)=>ng(t.element)?D.none():h(e,t,g.HighlightSubmenu))),onLeft:f(((e,t)=>ng(t.element)?D.none():p(e,t))),onEscape:f(((t,o)=>p(t,o).orThunk((()=>e.onEscape(t,o).map((()=>t)))))),focusIn:(e,t)=>{n.getPrimary().each((t=>{qs(e,t.element,Ss())}))}}),Mg.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),ag.config({find:e=>Mg.getHighlighted(e)}),Hp.config({})]),eventOrder:e.eventOrder,apis:w,events:b}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:Fr(e,t),expansions:{}}),collapseItem:e=>({value:ya(Of()),meta:{text:e}})}}),Af=tg({name:"InlineView",configFields:[dr("lazySink"),el("onShow"),el("onHide"),kr("onEscape"),Jm("inlineBehaviours",[Mm,Xm,Ql]),Er("fireDismissalEventInstead",[Tr("event",Ls())]),Er("fireRepositionEventInstead",[Tr("event",Hs())]),Tr("getRelated",D.none),Tr("isExtraPart",T),Tr("eventOrder",D.none)],factory:(e,t)=>{const o=(t,o,n,r)=>{const s=e.lazySink(t).getOrDie();Mm.openWhileCloaked(t,o,(()=>rm.positionWithinBounds(s,t,n,r()))),Xm.setValue(t,D.some({mode:"position",config:n,getBounds:r}))},n=(t,o,n,r)=>{const s=((e,t,o,n,r)=>{const s=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>Fl(),onRtl:()=>zl()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return Df.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Mm.close(t),e.onEscape.map((e=>e(t))),D.some(!0)),onExecute:()=>D.some(!0),onOpenMenu:(e,t)=>{rm.positionWithinBounds(s().getOrDie(),t,o,r())},onOpenSubmenu:(e,t,o,n)=>{const r=s().getOrDie();rm.position(r,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=s().getOrDie();rm.positionWithinBounds(a,t,o,r()),z(n,(e=>{const t=i(e.triggeringPath);rm.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})}))}})})(e,t,o,n,r);Mm.open(t,s),Xm.setValue(t,D.some({mode:"menu",menu:s}))},r=t=>{Mm.isOpen(t)&&Xm.getValue(t).each((o=>{switch(o.mode){case"menu":Mm.getState(t).each(Df.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();rm.positionWithinBounds(n,t,o.config,o.getBounds())}}))},s={setContent:(e,t)=>{Mm.setContent(e,t)},showAt:(e,t,n)=>{const r=D.none;o(e,t,n,r)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,D.none)},showMenuWithinBounds:n,hide:e=>{Mm.isOpen(e)&&(Xm.setValue(e,D.none()),Mm.close(e))},getContent:e=>Mm.getState(e),reposition:r,isOpen:Mm.isOpen};return{uid:e.uid,dom:e.dom,behaviours:eu(e.inlineBehaviours,[Mm.config({isPartOf:(t,o,n)=>Fi(o,n)||((t,o)=>e.getRelated(t).exists((e=>Fi(e,o))))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),Xm.config({store:{mode:"memory",initialValue:D.none()}}),Ql.config({channels:{...Hm({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Pm({...e.fireRepositionEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({}),doReposition:r})}})]),eventOrder:e.eventOrder,apis:s}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,r)=>{e.showWithinBounds(t,o,n,r)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,r)=>{e.showMenuWithinBounds(t,o,n,r)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var Mf=tinymce.util.Tools.resolve("tinymce.util.Delay");const Nf=tg({name:"Button",factory:e=>{const t=Qp(e.action),o=e.dom.tag,n=t=>ve(e.dom,"attributes").bind((e=>ve(e,t)));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:ou(e.buttonBehaviours,[Zp.config({}),Tp.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:(()=>{if("button"===o){return{type:n("type").getOr("button"),...n("role").map((e=>({role:e}))).getOr({})}}return{role:e.role.getOr(n("role").getOr("button"))}})()},eventOrder:e.eventOrder}},configFields:[Tr("uid",void 0),dr("dom"),Tr("components",[]),tu("buttonBehaviours",[Zp,Tp]),yr("action"),yr("role"),Tr("eventOrder",{})]}),Rf=e=>{const t=Le.fromHtml(e),o=at(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return j(t,((e,t)=>"class"===t.name?e:{...e,[t.name]:t.value}),{})})(t),r=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),s=0===o.length?{}:{innerHtml:ma(t)};return{tag:Ve(t),classes:r,attributes:n,...s}},Bf=e=>{const t=(e=>void 0!==e.uid)(e)&&ye(e,"uid")?e.uid:Ea("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}},{entries:Lf,setPrototypeOf:Hf,isFrozen:If,getPrototypeOf:Pf,getOwnPropertyDescriptor:Ff}=Object;let{freeze:zf,seal:Vf,create:Zf}=Object,{apply:Uf,construct:jf}="undefined"!=typeof Reflect&&Reflect;Uf||(Uf=function(e,t,o){return e.apply(t,o)}),zf||(zf=function(e){return e}),Vf||(Vf=function(e){return e}),jf||(jf=function(e,t){return new e(...t)});const Wf=nv(Array.prototype.forEach),$f=nv(Array.prototype.pop),qf=nv(Array.prototype.push),Gf=nv(String.prototype.toLowerCase),Kf=nv(String.prototype.toString),Yf=nv(String.prototype.match),Xf=nv(String.prototype.replace),Jf=nv(String.prototype.indexOf),Qf=nv(String.prototype.trim),ev=nv(RegExp.prototype.test),tv=(ov=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o1?o-1:0),r=1;r/gm),wv=Vf(/\${[\w\W]*}/gm),xv=Vf(/^data-[\-\w.\u00B7-\uFFFF]/),Cv=Vf(/^aria-[\-\w]+$/),Sv=Vf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kv=Vf(/^(?:\w+script|data):/i),_v=Vf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ev=Vf(/^html$/i);var Tv=Object.freeze({__proto__:null,MUSTACHE_EXPR:bv,ERB_EXPR:yv,TMPLIT_EXPR:wv,DATA_ATTR:xv,ARIA_ATTR:Cv,IS_ALLOWED_URI:Sv,IS_SCRIPT_OR_DATA:kv,ATTR_WHITESPACE:_v,DOCTYPE_NAME:Ev});const Ov=()=>"undefined"==typeof window?null:window;var Dv=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ov();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,r=n.currentScript;let{document:s}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:h}=t,p=c.prototype,f=av(p,"cloneNode"),v=av(p,"nextSibling"),b=av(p,"childNodes"),y=av(p,"parentNode");if("function"==typeof i){const e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let w,x="";const{implementation:C,createNodeIterator:S,createDocumentFragment:k,getElementsByTagName:_}=s,{importNode:E}=n;let T={};o.isSupported="function"==typeof Lf&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:A,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:B}=Tv;let{IS_ALLOWED_URI:L}=Tv,H=null;const I=rv({},[...iv,...lv,...cv,...mv,...gv]);let P=null;const F=rv({},[...hv,...pv,...fv,...vv]);let z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,Z=null,U=!0,j=!0,W=!1,$=!0,q=!1,G=!1,K=!1,Y=!1,X=!1,J=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,re={},se=null;const ae=rv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=rv({},["audio","video","img","source","image","track"]);let ce=null;const de=rv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),me="http://www.w3.org/1998/Math/MathML",ue="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let he=ge,pe=!1,fe=null;const ve=rv({},[me,ue,ge],Kf);let be;const ye=["application/xhtml+xml","text/html"];let we,xe=null;const Ce=s.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){if(!xe||xe!==e){if(e&&"object"==typeof e||(e={}),e=sv(e),be=be=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===be?Kf:Gf,H="ALLOWED_TAGS"in e?rv({},e.ALLOWED_TAGS,we):I,P="ALLOWED_ATTR"in e?rv({},e.ALLOWED_ATTR,we):F,fe="ALLOWED_NAMESPACES"in e?rv({},e.ALLOWED_NAMESPACES,Kf):ve,ce="ADD_URI_SAFE_ATTR"in e?rv(sv(de),e.ADD_URI_SAFE_ATTR,we):de,ie="ADD_DATA_URI_TAGS"in e?rv(sv(le),e.ADD_DATA_URI_TAGS,we):le,se="FORBID_CONTENTS"in e?rv({},e.FORBID_CONTENTS,we):ae,V="FORBID_TAGS"in e?rv({},e.FORBID_TAGS,we):{},Z="FORBID_ATTR"in e?rv({},e.FORBID_ATTR,we):{},re="USE_PROFILES"in e&&e.USE_PROFILES,U=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,G=e.WHOLE_DOCUMENT||!1,X=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,Y=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||Sv,he=e.NAMESPACE||ge,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),J&&(X=!0),re&&(H=rv({},[...gv]),P=[],!0===re.html&&(rv(H,iv),rv(P,hv)),!0===re.svg&&(rv(H,lv),rv(P,pv),rv(P,vv)),!0===re.svgFilters&&(rv(H,cv),rv(P,pv),rv(P,vv)),!0===re.mathMl&&(rv(H,mv),rv(P,fv),rv(P,vv))),e.ADD_TAGS&&(H===I&&(H=sv(H)),rv(H,e.ADD_TAGS,we)),e.ADD_ATTR&&(P===F&&(P=sv(P)),rv(P,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&rv(ce,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===ae&&(se=sv(se)),rv(se,e.FORBID_CONTENTS,we)),oe&&(H["#text"]=!0),G&&rv(H,["html","head","body"]),H.table&&(rv(H,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw tv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw tv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,r)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));zf&&zf(e),xe=e}},_e=rv({},["mi","mo","mn","ms","mtext"]),Ee=rv({},["foreignobject","desc","title","annotation-xml"]),Te=rv({},["title","style","font","a","script"]),Oe=rv({},lv);rv(Oe,cv),rv(Oe,dv);const De=rv({},mv);rv(De,uv);const Ae=function(e){qf(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Me=function(e,t){try{qf(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){qf(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!P[e])if(X||J)try{Ae(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t,o;if(Y)e=""+e;else{const t=Yf(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===be&&he===ge&&(e=''+e+"");const n=w?w.createHTML(e):e;if(he===ge)try{t=(new g).parseFromString(n,be)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(he,"template",null);try{t.documentElement.innerHTML=pe?x:n}catch(e){}}const r=t.body||t.documentElement;return e&&o&&r.insertBefore(s.createTextNode(o),r.childNodes[0]||null),he===ge?_.call(t,G?"html":"body")[0]:G?t.documentElement:r},Re=function(e){return S.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Be=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,n){T[e]&&Wf(T[e],(e=>{e.call(o,t,n,xe)}))},He=function(e){let t;if(Le("beforeSanitizeElements",e,null),(n=e)instanceof u&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof m)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Ae(e),!0;var n;const r=we(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:H}),e.hasChildNodes()&&!Be(e.firstElementChild)&&(!Be(e.content)||!Be(e.content.firstElementChild))&&ev(/<[/\w]/g,e.innerHTML)&&ev(/<[/\w]/g,e.textContent))return Ae(e),!0;if(!H[r]||V[r]){if(!V[r]&&Pe(r)){if(z.tagNameCheck instanceof RegExp&&ev(z.tagNameCheck,r))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(r))return!1}if(oe&&!se[r]){const t=y(e)||e.parentNode,o=b(e)||e.childNodes;if(o&&t){for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),v(e))}}return Ae(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const o=Gf(e.tagName),n=Gf(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===ue?t.namespaceURI===ge?"svg"===o:t.namespaceURI===me?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Oe[o]):e.namespaceURI===me?t.namespaceURI===ge?"math"===o:t.namespaceURI===ue?"math"===o&&Ee[n]:Boolean(De[o]):e.namespaceURI===ge?!(t.namespaceURI===ue&&!Ee[n])&&!(t.namespaceURI===me&&!_e[n])&&!De[o]&&(Te[o]||!Oe[o]):!("application/xhtml+xml"!==be||!fe[e.namespaceURI]))}(e)?(Ae(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!ev(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=Xf(t,O," "),t=Xf(t,D," "),t=Xf(t,A," "),e.textContent!==t&&(qf(o.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Ae(e),!0)},Ie=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in s||o in Ce))return!1;if(j&&!Z[t]&&ev(M,t));else if(U&&ev(N,t));else if(!P[t]||Z[t]){if(!(Pe(e)&&(z.tagNameCheck instanceof RegExp&&ev(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&ev(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&ev(z.tagNameCheck,o)||z.tagNameCheck instanceof Function&&z.tagNameCheck(o))))return!1}else if(ce[t]);else if(ev(L,Xf(o,B,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Jf(o,"data:")||!ie[e]){if(W&&!ev(R,Xf(o,B,"")));else if(o)return!1}else;return!0},Pe=function(e){return e.indexOf("-")>0},Fe=function(e){let t,o,n,r;Le("beforeSanitizeAttributes",e,null);const{attributes:s}=e;if(!s)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P};for(r=s.length;r--;){t=s[r];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:Qf(t.value);const c=o;if(n=we(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){Me(i,e);continue}if(!$&&ev(/\/>/i,o)){Me(i,e);continue}q&&(o=Xf(o,O," "),o=Xf(o,D," "),o=Xf(o,A," "));const d=we(e.nodeName);if(Ie(d,n,o)){if(!te||"id"!==n&&"name"!==n||(Me(i,e),o="user-content-"+o),w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(l);else switch(h.getAttributeType(d,n)){case"TrustedHTML":o=w.createHTML(o);break;case"TrustedScriptURL":o=w.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){Me(i,e)}}else Me(i,e)}Le("afterSanitizeAttributes",e,null)},ze=function e(t){let o;const n=Re(t);for(Le("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Le("uponSanitizeShadowNode",o,null),He(o)||(o.content instanceof a&&e(o.content),Fe(o));Le("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,r,s,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(pe=!e,pe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw tv("toString is not a function");if("string"!=typeof(e=e.toString()))throw tv("dirty is not a string, aborting")}if(!o.isSupported)return e;if(K||ke(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=we(e.nodeName);if(!H[t]||V[t])throw tv("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Ne("\x3c!----\x3e"),r=t.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?t=r:t.appendChild(r);else{if(!X&&!q&&!G&&-1===e.indexOf("<"))return w&&Q?w.createHTML(e):e;if(t=Ne(e),!t)return X?null:Q?x:""}t&&Y&&Ae(t.firstChild);const d=Re(ne?e:t);for(;s=d.nextNode();)He(s)||(s.content instanceof a&&ze(s.content),Fe(s));if(ne)return e;if(X){if(J)for(i=k.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(P.shadowroot||P.shadowrootmode)&&(i=E.call(n,i,!0)),i}let m=G?t.outerHTML:t.innerHTML;return G&&H["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&ev(Ev,t.ownerDocument.doctype.name)&&(m="\n"+m),q&&(m=Xf(m,O," "),m=Xf(m,D," "),m=Xf(m,A," ")),w&&Q?w.createHTML(m):m},o.setConfig=function(e){ke(e),K=!0},o.clearConfig=function(){xe=null,K=!1},o.isValidAttribute=function(e,t,o){xe||ke({});const n=we(e),r=we(t);return Ie(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],qf(T[e],t))},o.removeHook=function(e){if(T[e])return $f(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const Av=e=>Dv().sanitize(e);var Mv=tinymce.util.Tools.resolve("tinymce.util.I18n");const Nv={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},Rv="temporary-placeholder",Bv=e=>()=>ve(e,Rv).getOr("!not found!"),Lv=(e,t)=>{const o=e.toLowerCase();if(Mv.isRtl()){const e=((e,t)=>De(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},Hv=(e,t)=>ve(t,Lv(e,t)),Iv=(e,t)=>{const o=t();return Hv(e,o).getOrThunk(Bv(o))},Pv=()=>Ip("add-focusable",[ia((e=>{Ri(e.element,"svg").each((e=>St(e,"focusable","false")))}))]),Fv=(e,t,o,n)=>{var r,s;const a=(e=>!!Mv.isRtl()&&be(Nv,e))(t)?["tox-icon--flip"]:[],i=ve(o,Lv(t,o)).or(n).getOrThunk(Bv(o));return{dom:{tag:e.tag,attributes:null!==(r=e.attributes)&&void 0!==r?r:{},classes:e.classes.concat(a),innerHtml:i},behaviours:ql([...null!==(s=e.behaviours)&&void 0!==s?s:[],Pv()])}},zv=(e,t,o,n=D.none())=>Fv(t,e,o(),n),Vv={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Zv=tg({name:"Notification",factory:e=>{const t=Bf({dom:Rf(`

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

    `),behaviours:ql([Hp.config({})])}),o=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),n=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Bf({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(0)]},n(0)],behaviours:ql([Hp.config({})])}),s={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{Hp.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(t)]},n(t)])}))},updateText:(e,o)=>{if(e.getSystem().isConnected()){const n=t.get(e);Hp.set(n,[Ci(o)])}}},a=q([e.icon.toArray(),e.level.toArray(),e.level.bind((e=>D.from(Vv[e]))).toArray()]),i=Bf(Nf.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[zv("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":e.translationProvider("Close")}},e.iconProvider)],action:t=>{e.onAction(t)}})),l=((e,t,o)=>{const n=o(),r=W(e,(e=>be(n,Lv(e,n))));return Fv(t,r.getOr(Rv),n,D.none())})(a,{tag:"div",classes:["tox-notification__icon"]},e.iconProvider),c=[l,{dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:ql([Hp.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert"},classes:e.level.map((e=>["tox-notification","tox-notification--in",`tox-notification--${e}`])).getOr(["tox-notification","tox-notification--in"])},behaviours:ql([Zp.config({}),Ip("notification-events",[Qs(ss(),(e=>{i.getOpt(e).each(Zp.focus)}))])]),components:c.concat(e.progress?[r.asSpec()]:[]).concat(e.closeButton?[i.asSpec()]:[]),apis:s}},configFields:[yr("level"),dr("progress"),yr("icon"),dr("onAction"),dr("text"),dr("iconProvider"),dr("translationProvider"),Nr("closeButton",!0)],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var Uv,jv,Wv=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),$v=tinymce.util.Tools.resolve("tinymce.EditorManager"),qv=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(Uv||(Uv={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(jv||(jv={}));const Gv=e=>t=>t.options.get(e),Kv=e=>t=>D.from(e(t)),Yv=e=>{const t=qv.deviceType.isPhone(),o=qv.deviceType.isTablet()||t,n=e.options.register,r=e=>s(e)||!1===e,a=e=>s(e)||p(e);n("skin",{processor:e=>s(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:Wv.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=>s(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||s(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),I(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:jv.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:r,default:"#top"}),n("anchor_bottom",{processor:r,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("promotion",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!qv.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},Xv=Gv("readonly"),Jv=Gv("height"),Qv=Gv("width"),eb=Kv(Gv("min_width")),tb=Kv(Gv("min_height")),ob=Kv(Gv("max_width")),nb=Kv(Gv("max_height")),rb=Kv(Gv("style_formats")),sb=Gv("style_formats_merge"),ab=Gv("style_formats_autohide"),ib=Gv("content_langs"),lb=Gv("removed_menuitems"),cb=Gv("toolbar_mode"),db=Gv("toolbar_groups"),mb=Gv("toolbar_location"),ub=Gv("fixed_toolbar_container"),gb=Gv("fixed_toolbar_container_target"),hb=Gv("toolbar_persist"),pb=Gv("toolbar_sticky_offset"),fb=Gv("menubar"),vb=Gv("toolbar"),bb=Gv("file_picker_callback"),yb=Gv("file_picker_validator_handler"),wb=Gv("font_size_input_default_unit"),xb=Gv("file_picker_types"),Cb=Gv("typeahead_urls"),Sb=Gv("anchor_top"),kb=Gv("anchor_bottom"),_b=Gv("draggable_modal"),Eb=Gv("statusbar"),Tb=Gv("elementpath"),Ob=Gv("branding"),Db=Gv("resize"),Ab=Gv("paste_as_text"),Mb=Gv("sidebar_show"),Nb=Gv("promotion"),Rb=Gv("help_accessibility"),Bb=Gv("default_font_stack"),Lb=e=>!1===e.options.get("skin"),Hb=e=>!1!==e.options.get("menubar"),Ib=e=>{const t=e.options.get("skin_url");if(Lb(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return $v.baseURL+"/skins/ui/"+t}},Pb=e=>D.from(e.options.get("skin_url")),Fb=e=>e.options.get("line_height_formats").split(" "),zb=e=>{const t=vb(e),o=s(t),n=l(t)&&t.length>0;return!Zb(e)&&(n||o||!0===t)},Vb=e=>{const t=I(9,(t=>e.options.get("toolbar"+(t+1)))),o=Z(t,s);return ke(o.length>0,o)},Zb=e=>Vb(e).fold((()=>{const t=vb(e);return f(t,s)&&t.length>0}),O),Ub=e=>mb(e)===jv.bottom,jb=e=>{var t;if(!e.inline)return D.none();const o=null!==(t=ub(e))&&void 0!==t?t:"";if(o.length>0)return Bi(wt(),o);const n=gb(e);return g(n)?D.some(Le.fromDom(n)):D.none()},Wb=e=>e.inline&&jb(e).isSome(),$b=e=>jb(e).getOrThunk((()=>pt(ht(Le.fromDom(e.getElement()))))),qb=e=>e.inline&&!Hb(e)&&!zb(e)&&!Zb(e),Gb=e=>(e.options.get("toolbar_sticky")||e.inline)&&!Wb(e)&&!qb(e),Kb=e=>!Wb(e)&&"split"===e.options.get("ui_mode"),Yb=e=>{const t=e.options.get("menu");return ce(t,(e=>({...e,items:e.items})))};var Xb=Object.freeze({__proto__:null,get ToolbarMode(){return Uv},get ToolbarLocation(){return jv},register:Yv,getSkinUrl:Ib,getSkinUrlOption:Pb,isReadOnly:Xv,isSkinDisabled:Lb,getHeightOption:Jv,getWidthOption:Qv,getMinWidthOption:eb,getMinHeightOption:tb,getMaxWidthOption:ob,getMaxHeightOption:nb,getUserStyleFormats:rb,shouldMergeStyleFormats:sb,shouldAutoHideStyleFormats:ab,getLineHeightFormats:Fb,getContentLanguages:ib,getRemovedMenuItems:lb,isMenubarEnabled:Hb,isMultipleToolbars:Zb,isToolbarEnabled:zb,isToolbarPersist:hb,getMultipleToolbarsOption:Vb,getUiContainer:$b,useFixedContainer:Wb,isSplitUiMode:Kb,getToolbarMode:cb,isDraggableModal:_b,isDistractionFree:qb,isStickyToolbar:Gb,getStickyToolbarOffset:pb,getToolbarLocation:mb,isToolbarLocationBottom:Ub,getToolbarGroups:db,getMenus:Yb,getMenubar:fb,getToolbar:vb,getFilePickerCallback:bb,getFilePickerTypes:xb,useTypeaheadUrls:Cb,getAnchorTop:Sb,getAnchorBottom:kb,getFilePickerValidatorHandler:yb,getFontSizeInputDefaultUnit:wb,useStatusBar:Eb,useElementPath:Tb,promotionEnabled:Nb,useBranding:Ob,getResize:Db,getPasteAsText:Ab,getSidebarShow:Mb,useHelpAccessibility:Rb,getDefaultFontStack:Bb});const Jb="[data-mce-autocompleter]",Qb=e=>Li(e,Jb),ey=(e,t)=>{const o=(e,t)=>{Ws(e,is(),{raw:t})},n=()=>e.getMenu().bind(Mg.getHighlighted);t.on("keydown",(t=>{const r=t.which;e.isActive()&&(e.isMenuOpen()?13===r?(n().each($s),t.preventDefault()):40===r?(n().fold((()=>{e.getMenu().each(Mg.highlightFirst)}),(e=>{o(e,t)})),t.preventDefault(),t.stopImmediatePropagation()):37!==r&&38!==r&&39!==r||n().each((e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()})):13!==r&&38!==r&&40!==r||e.cancelIfNecessary())})),t.on("NodeChange",(t=>{e.isActive()&&!e.isProcessingAction()&&Qb(Le.fromDom(t.element)).isNone()&&e.cancelIfNecessary()}))};var ty;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(ty||(ty={}));var oy=ty;const ny="tox-menu-nav__js",ry="tox-collection__item",sy="tox-swatch",ay={normal:ny,color:sy},iy="tox-collection__item--enabled",ly="tox-collection__item-icon",cy="tox-collection__item-label",dy="tox-collection__item-caret",my="tox-collection__item--active",uy="tox-collection__item-container",gy="tox-collection__item-container--row",hy=e=>ve(ay,e).getOr(ny),py=e=>"color"===e?"tox-swatches":"tox-menu",fy=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:py(e),tieredMenu:"tox-tiered-menu"}),vy=e=>{const t=fy(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:hy(e)}},by=(e,t,o)=>{const n=fy(o);return{tag:"div",classes:q([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},yy=[wf.parts.items({})],wy=(e,t,o)=>{const n=fy(o);return{dom:{tag:"div",classes:q([[n.tieredMenu]])},markers:vy(o)}},xy=w([yr("data"),Tr("inputAttributes",{}),Tr("inputStyles",{}),Tr("tag","input"),Tr("inputClasses",[]),el("onSetValue"),Tr("styles",{}),Tr("eventOrder",{}),Jm("inputBehaviours",[Xm,Zp]),Tr("selectOnFocus",!0)]),Cy=e=>ql([Zp.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=ci(t);t.dom.setSelectionRange(0,o.length)}:v})]),Sy=e=>({...Cy(e),...eu(e.inputBehaviours,[Xm.config({store:{mode:"manual",...e.data.map((e=>({initialValue:e}))).getOr({}),getValue:e=>ci(e.element),setValue:(e,t)=>{ci(e.element)!==t&&di(e.element,t)}},onSetValue:e.onSetValue})])}),ky=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),_y=tg({name:"Input",configFields:xy(),factory:(e,t)=>({uid:e.uid,dom:ky(e),components:[],behaviours:Sy(e),eventOrder:e.eventOrder})}),Ey=ya("refetch-trigger-event"),Ty=ya("redirect-menu-item-interaction"),Oy="tox-menu__searcher",Dy=e=>Bi(e.element,`.${Oy}`).bind((t=>e.getSystem().getByDom(t).toOptional())),Ay=Dy,My=e=>({fetchPattern:Xm.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),Ny=e=>{const t=(e,t)=>(t.cut(),D.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return Ws(e,Ty,o),D.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[ry]},components:[_y.sketch({inputClasses:[Oy,"tox-textfield"],inputAttributes:{...e.placeholder.map((t=>({placeholder:e.i18n(t)}))).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:ql([Ip(n,[Qs(cs(),(e=>{js(e,Ey)})),Qs(is(),((e,t)=>{"Escape"===t.event.raw.key&&t.stop()}))]),Tp.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,Tp.name()]}})]}},Ry="tox-collection--results__js",By=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:ya("aria-item-search-result-id"),"aria-selected":"false"}}}:e},Ly=(e,t)=>o=>{const n=P(o,t);return F(n,(t=>({dom:e,components:t})))},Hy=(e,t)=>{const o=[];let n=[];return z(e,((e,r)=>{t(e,r)?(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),F(o,(e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e})))},Iy=(e,t,o)=>wf.parts.items({preprocess:n=>{const r=F(n,o);return"auto"!==e&&e>1?Ly({tag:"div",classes:["tox-collection__group"]},e)(r):Hy(r,((e,o)=>"separator"===t[o].type))}}),Py=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Iy(e,t,x)]}),Fy=e=>H(e,(e=>"icon"in e&&void 0!==e.icon)),zy=e=>(console.error(rr(e)),console.log(e),D.none()),Vy=(e,t,o,n,r)=>{const s=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[wf.parts.items({preprocess:e=>Hy(e,((e,t)=>"separator"===a[t].type))})]});var a;return{value:e,dom:s.dom,components:s.components,items:o}},Zy=(e,t,o,n,r)=>{const s=()=>"searchable"!==r.menuType?Py(n,o):"search-with-field"===r.searchMode.searchMode?((e,t,o)=>{const n=ya("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Ny({i18n:Mv.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],Ry],attributes:{id:n}},components:[Iy(e,t,By)]}]}})(n,o,r.searchMode):((e,t,o=!0)=>{const n=ya("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",Ry].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:n}},components:[Iy(e,t,By)]}})(n,o);if("color"===r.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[wf.parts.items({preprocess:"auto"!==e?Ly({tag:"div",classes:["tox-swatches__row"]},e):x})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType&&"auto"===n){const t=Py(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType||"searchable"===r.menuType){const t=s();return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===r.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[wf.parts.items({preprocess:Ly({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:by(t,n,r.menuType),components:yy,items:o}},Uy=gr("type"),jy=gr("name"),Wy=gr("label"),$y=gr("text"),qy=gr("title"),Gy=gr("icon"),Ky=gr("value"),Yy=pr("fetch"),Xy=pr("getSubmenuItems"),Jy=pr("onAction"),Qy=pr("onItemAction"),ew=Rr("onSetup",(()=>v)),tw=Cr("name"),ow=Cr("text"),nw=Cr("icon"),rw=Cr("tooltip"),sw=Cr("label"),aw=Cr("shortcut"),iw=kr("select"),lw=Nr("active",!1),cw=Nr("borderless",!1),dw=Nr("enabled",!0),mw=Nr("primary",!1),uw=e=>Tr("columns",e),gw=Tr("meta",{}),hw=Rr("onAction",v),pw=e=>Ar("type",e),fw=e=>ir("name","name",Sn((()=>ya(`${e}-name`))),$n),vw=Pn([Uy,ow]),bw=Pn([pw("autocompleteitem"),lw,dw,gw,Ky,ow,nw]),yw=[dw,rw,nw,ow,ew],ww=Pn([Uy,Jy].concat(yw)),xw=e=>tr("toolbarbutton",ww,e),Cw=[lw].concat(yw),Sw=Pn(Cw.concat([Uy,Jy])),kw=e=>tr("ToggleButton",Sw,e),_w=[Rr("predicate",T),Mr("scope","node",["node","editor"]),Mr("position","selection",["node","selection","line"])],Ew=yw.concat([pw("contextformbutton"),mw,Jy,lr("original",x)]),Tw=Cw.concat([pw("contextformbutton"),mw,Jy,lr("original",x)]),Ow=yw.concat([pw("contextformbutton")]),Dw=Cw.concat([pw("contextformtogglebutton")]),Aw=sr("type",{contextformbutton:Ew,contextformtogglebutton:Tw}),Mw=Pn([pw("contextform"),Rr("initValue",w("")),sw,br("commands",Aw),wr("launch",sr("type",{contextformbutton:Ow,contextformtogglebutton:Dw}))].concat(_w)),Nw=Pn([pw("contexttoolbar"),gr("items")].concat(_w)),Rw=[Uy,gr("src"),Cr("alt"),Br("classes",[],$n)],Bw=Pn(Rw),Lw=[Uy,$y,tw,Br("classes",["tox-collection__item-label"],$n)],Hw=Pn(Lw),Iw=Ln((()=>Jn("type",{cardimage:Bw,cardtext:Hw,cardcontainer:Pw}))),Pw=Pn([Uy,Ar("direction","horizontal"),Ar("align","left"),Ar("valign","middle"),br("items",Iw)]),Fw=[dw,ow,aw,(zw="menuitem",ir("value","value",Sn((()=>ya(`${zw}-value`))),Un())),gw];var zw;const Vw=Pn([Uy,sw,br("items",Iw),ew,hw].concat(Fw)),Zw=Pn([Uy,lw,nw].concat(Fw)),Uw=[Uy,gr("fancytype"),hw],jw=[Tr("initData",{})].concat(Uw),Ww=[kr("select"),Lr("initData",{},[Nr("allowCustomColors",!0),Ar("storageKey","default"),_r("colors",Un())])].concat(Uw),$w=sr("fancytype",{inserttable:jw,colorswatch:Ww}),qw=Pn([Uy,ew,hw,nw].concat(Fw)),Gw=Pn([Uy,Xy,ew,nw].concat(Fw)),Kw=Pn([Uy,nw,lw,ew,Jy].concat(Fw)),Yw=(e,t,o)=>{const n=_d(e.element,"."+o);if(n.length>0){const e=$(n,(e=>{const o=e.dom.getBoundingClientRect().top,r=n[0].dom.getBoundingClientRect().top;return Math.abs(o-r)>t})).getOr(n.length);return D.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return D.none()},Xw=(e,t)=>ql([Ip(e,t)]),Jw=e=>Xw(ya("unnamed-events"),e),Qw=ya("tooltip.exclusive"),ex=ya("tooltip.show"),tx=ya("tooltip.hide"),ox=(e,t,o)=>{e.getSystem().broadcastOn([Qw],{})};var nx=Object.freeze({__proto__:null,hideAllExclusive:ox,setComponents:(e,t,o,n)=>{o.getTooltip().each((e=>{e.getSystem().isConnected()&&Hp.set(e,n)}))}});var rx=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each((n=>{pm(n),e.onHide(o,n),t.clearTooltip()})),t.clearTimer()};return Ys(q([[Qs(ex,(o=>{t.resetTimer((()=>{(o=>{if(!t.isShowing()){ox(o);const n=e.lazySink(o).getOrDie(),r=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Ys("normal"===e.mode?[Qs(rs(),(e=>{js(o,ex)})),Qs(os(),(e=>{js(o,tx)}))]:[]),behaviours:ql([Hp.config({})])});t.setTooltip(r),um(n,r),e.onShow(o,r),rm.position(n,r,{anchor:e.anchor(o)})}})(o)}),e.delay)})),Qs(tx,(n=>{t.resetTimer((()=>{o(n)}),e.delay)})),Qs(xs(),((e,t)=>{const n=t;n.universal||L(n.channels,Qw)&&o(e)})),la((e=>{o(e)}))],"normal"===e.mode?[Qs(ss(),(e=>{js(e,ex)})),Qs(ys(),(e=>{js(e,tx)})),Qs(rs(),(e=>{js(e,ex)})),Qs(os(),(e=>{js(e,tx)}))]:[Qs(Zs(),((e,t)=>{js(e,ex)})),Qs(Us(),(e=>{js(e,tx)}))]]))}}),sx=[dr("lazySink"),dr("tooltipDom"),Tr("exclusive",!0),Tr("tooltipComponents",[]),Tr("delay",300),Mr("mode","normal",["normal","follow-highlight"]),Tr("anchor",(e=>({type:"hotspot",hotspot:e,layouts:{onLtr:w([Nl,Ml,Tl,Dl,Ol,Al]),onRtl:w([Nl,Ml,Tl,Dl,Ol,Al])}}))),el("onHide"),el("onShow")];var ax=Object.freeze({__proto__:null,init:()=>{const e=kc(),t=kc(),o=()=>{e.on(clearTimeout)},n=w("not-implemented");return Ia({getTooltip:t.get,isShowing:t.isSet,setTooltip:t.set,clearTooltip:t.clear,clearTimer:o,resetTimer:(t,n)=>{o(),e.set(setTimeout(t,n))},readState:n})}});const ix=Kl({fields:sx,name:"tooltipping",active:rx,state:ax,apis:nx}),lx="silver.readonly",cx=Pn([(dx="readonly",mr(dx,qn))]);var dx;const mx=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&z(n,(e=>{e.broadcastOn([Nm()],{target:o})})),z(n,(e=>{e.broadcastOn([lx],{readonly:t})}))},ux=(e,t)=>{e.on("init",(()=>{e.mode.isReadOnly()&&mx(t,!0)})),e.on("SwitchMode",(()=>mx(t,e.mode.isReadOnly()))),Xv(e)&&e.mode.set("readonly")},gx=()=>Ql.config({channels:{[lx]:{schema:cx,onReceive:(e,t)=>{wg.set(e,t.readonly)}}}}),hx=e=>wg.config({disabled:e,disableClass:"tox-collection__item--state-disabled"}),px=e=>wg.config({disabled:e}),fx=e=>wg.config({disabled:e,disableClass:"tox-tbtn--disabled"}),vx=e=>wg.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),bx=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},yx=(e,t)=>ia((o=>{bx(e,o)((o=>{const n=e.onSetup(o);h(n)&&t.set(n)}))})),wx=(e,t)=>la((o=>bx(e,o)(t.get()))),xx=(e,t)=>da(((o,n)=>{bx(e,o)(e.onAction),e.triggersSubmenu||t!==oy.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&js(o,Es()),n.stop())})),Cx={[Cs()]:["disabling","alloy.base.behaviour","toggling","item-events"]},Sx=xe,kx=(e,t,o,n)=>{const r=Hr(v);return{type:"item",dom:t.dom,components:Sx(t.optComponents),data:e.data,eventOrder:Cx,hasSubmenu:e.triggersSubmenu,itemBehaviours:ql([Ip("item-events",[xx(e,o),yx(e,r),wx(e,r)]),hx((()=>!e.enabled||n.isDisabled())),gx(),Hp.config({})].concat(e.itemBehaviours))}},_x=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),Ex=e=>{const t=qv.os.isMacOS()||qv.os.isiOS(),o=t?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),r=F(n,(e=>{const t=e.toLowerCase().trim();return be(o,t)?o[t]:e}));return t?r.join(""):r.join("+")},Tx=(e,t,o=[ly])=>zv(e,{tag:"div",classes:o},t),Ox=e=>({dom:{tag:"div",classes:[cy]},components:[Ci(Mv.translate(e))]}),Dx=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),Ax=(e,t)=>({dom:{tag:"div",classes:[cy]},components:[{dom:{tag:e.tag,styles:e.styles},components:[Ci(Mv.translate(t))]}]}),Mx=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[Ci(Ex(e))]}),Nx=e=>Tx("checkmark",e,["tox-collection__item-checkmark"]),Rx=(e,t,o)=>{const n=e.ariaLabel,r=e.value,s=e.iconContent.map((e=>((e,t,o)=>{const n=t();return Hv(e,n).or(o).getOrThunk(Bv(n))})(e,t.icons,o)));return{dom:(()=>{const e=sy,o=s.getOr(""),a=n.map((e=>({title:t.translate(e)}))).getOr({}),i={tag:"div",attributes:a,classes:[e]};return"custom"===r?{...i,tag:"button",classes:[...i.classes,"tox-swatches__picker-btn"],innerHtml:o}:"remove"===r?{...i,classes:[...i.classes,"tox-swatch--remove"],innerHtml:o}:g(r)?{...i,attributes:{...i.attributes,"data-mce-color":r},styles:{"background-color":r},innerHtml:o}:i})(),optComponents:[]}},Bx=e=>{const t=e.map((e=>({attributes:{title:Mv.translate(e),id:ya("menu-item")}}))).getOr({});return{tag:"div",classes:[ny,ry],...t}},Lx=(e,t,o,n=D.none())=>"color"===e.presets?Rx(e,t,n):((e,t,o,n)=>{const r={tag:"div",classes:[ly]},s=o?e.iconContent.map((e=>zv(e,r,t.icons,n))).orThunk((()=>D.some({dom:r}))):D.none(),a=e.checkMark,i=D.from(e.meta).fold((()=>Ox),(e=>be(e,"style")?S(Ax,e.style):Ox)),l=e.htmlContent.fold((()=>e.textContent.map(i)),(e=>D.some(Dx(e,[cy]))));return{dom:Bx(e.ariaLabel),optComponents:[s,l,e.shortcutContent.map(Mx),a,e.caret]}})(e,t,o,n),Hx=(e,t)=>ve(e,"tooltipWorker").map((e=>[ix.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:Fc}}),mode:"follow-highlight",onShow:(t,o)=>{e((e=>{ix.setComponents(t,[Si({element:Le.fromDom(e)})])}))}})])).getOr([]),Ix=(e,t)=>{const o=(e=>Wv.DOM.encode(e))(Mv.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,(e=>`${e}`))}return o},Px=(e,t)=>F(e,(e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":gy,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[uy,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,Px(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=>L(t.cardText.highlightOn,e))),n=o?D.from(t.cardText.matchText).getOr(""):"";return Dx(Ix(e.text,n),e.classes)}})),Fx=Bu(gf(),hf()),zx=e=>({value:jx(e)}),Vx=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Zx=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Ux=e=>Vx.test(e)||Zx.test(e),jx=e=>Ee(e,"#").toUpperCase(),Wx=e=>{const t=(e=>{const t=e.value.replace(Vx,((e,t,o,n)=>t+t+o+o+n+n));return{value:t}})(e),o=Zx.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o},$x=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},qx=e=>{const t=$x(e.red)+$x(e.green)+$x(e.blue);return zx(t)},Gx=Math.min,Kx=Math.max,Yx=Math.round,Xx=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,Jx=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Qx=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),eC=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},tC=e=>{let t,o,n;const r=(e.hue||0)%360;let s=e.saturation/100,a=e.value/100;if(s=Kx(0,Gx(s,1)),a=Kx(0,Gx(a,1)),0===s)return t=o=n=Yx(255*a),Qx(t,o,n,1);const i=r/60,l=a*s,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=Yx(255*(t+d)),o=Yx(255*(o+d)),n=Yx(255*(n+d)),Qx(t,o,n,1)},oC=e=>{const t=Wx(e),o=parseInt(t[1],16),n=parseInt(t[2],16),r=parseInt(t[3],16);return Qx(o,n,r,1)},nC=(e,t,o,n)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return Qx(r,s,a,i)},rC=e=>{if("transparent"===e)return D.some(Qx(0,0,0,0));const t=Xx.exec(e);if(null!==t)return D.some(nC(t[1],t[2],t[3],"1"));const o=Jx.exec(e);return null!==o?D.some(nC(o[1],o[2],o[3],o[4])):D.none()},sC=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,aC=Qx(255,0,0,1),iC=(e,t)=>{e.dispatch("ResizeContent",t)},lC=(e,t)=>{e.dispatch("TextColorChange",t)},cC=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),dC=(e,t)=>()=>{e(),t()},mC=e=>gC(e,"NodeChange",(t=>{t.setEnabled(e.selection.isEditable())})),uC=(e,t)=>o=>{const n=mC(e)(o),r=((e,t)=>o=>{const n=Sc(),r=()=>{o.setActive(e.formatter.match(t));const r=e.formatter.formatChanged(t,o.setActive);n.set(r)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),n.clear()}})(e,t)(o);return()=>{n(),r()}},gC=(e,t,o)=>n=>{const r=()=>o(n),s=()=>{o(n),e.on(t,r)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),e.off(t,r)}},hC=e=>t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)}))},pC=(e,t)=>()=>e.execCommand(t);var fC=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const vC={},bC=e=>ve(vC,e).getOrThunk((()=>{const t=`tinymce-custom-colors-${e}`,o=fC.getItem(t);if(u(o)){const e=fC.getItem("tinymce-custom-colors");fC.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=fC.getItem(e),n=s(o)?JSON.parse(o):[],r=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{r.splice(e,1)};return{add:o=>{B(r,o).each(i),r.unshift(o),r.length>t&&r.pop(),fC.setItem(e,JSON.stringify(r))},state:()=>r.slice(0)}})(t,10);return vC[e]=n,n})),yC=(e,t)=>{bC(e).add(t)},wC=(e,t,o)=>({hue:e,saturation:t,value:o}),xC=e=>{let t=0,o=0,n=0;const r=e.red/255,s=e.green/255,a=e.blue/255,i=Math.min(r,Math.min(s,a)),l=Math.max(r,Math.max(s,a));if(i===l)return n=i,wC(0,0,100*n);return t=r===i?3:a===i?1:5,t=60*(t-(r===i?s-a:a===i?r-s:a-r)/(l-i)),o=(l-i)/l,n=l,wC(Math.round(t),Math.round(100*o),Math.round(100*n))},CC=e=>qx(tC(e)),SC=e=>{return(t=e,Ux(t)?D.some({value:jx(t)}):D.none()).orThunk((()=>rC(e).map(qx))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,r=n[0],s=n[1],a=n[2],i=n[3];return qx(Qx(r,s,a,i))}));var t},kC="forecolor",_C="hilitecolor",EC=e=>{const t=[];for(let o=0;ot=>t.options.get(e),OC="#000000",DC=(e,t)=>t===kC&&e.options.isSet("color_map_foreground")?TC("color_map_foreground")(e):t===_C&&e.options.isSet("color_map_background")?TC("color_map_background")(e):TC("color_map")(e),AC=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(DC(e,t).length))),MC=(e,t)=>{const o=TC("color_cols")(e),n=AC(e,t);return o===AC(e)?n:o},NC=(e,t="default")=>Math.round(t===kC?TC("color_cols_foreground")(e):t===_C?TC("color_cols_background")(e):TC("color_cols")(e)),RC=TC("custom_colors"),BC=TC("color_default_foreground"),LC=TC("color_default_background"),HC=e=>jr(e,(e=>{if(je(e)){const t=Bt(e,"background-color");return ke((e=>rC(e).exists((e=>0!==e.alpha)))(t),t)}return D.none()})).getOr("rgba(0, 0, 0, 0)"),IC=(e,t)=>{const o=Le.fromDom(e.selection.getStart()),n="hilitecolor"===t?HC(o):Bt(o,"color");return rC(n).map((e=>"#"+qx(e).value))},PC=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]},FC=(e,t,o,n)=>{if("custom"===o){GC(e)((o=>{o.each((o=>{yC(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)}))}),IC(e,t).getOr(OC))}else"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},zC=(e,t,o)=>e.concat((e=>F(bC(e).state(),(e=>({type:"choiceitem",text:e,icon:"checkmark",value:e}))))(t).concat(PC(o))),VC=(e,t,o)=>n=>{n(zC(e,t,o))},ZC=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},UC=(e,t)=>{e.setTooltip(t)},jC=(e,t)=>o=>{const n=IC(e,t);return we(n,o.toUpperCase())},WC=(e,t,o)=>{if(Ne(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",r=zC(DC(e,t),t,!1),s=W(r,(e=>e.value===o)).getOr({text:""}).text;return e.translate([n,e.translate(s)])},$C=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:WC(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:jC(e,o),columns:NC(e,o),fetch:VC(DC(e,o),o,RC(e)),onAction:t=>{FC(e,o,n.get(),v)},onItemAction:(r,s)=>{FC(e,o,s,(o=>{n.set(o),lC(e,{name:t,color:o})}))},onSetup:r=>{ZC(r,t,n.get());const s=n=>{n.name===t&&(ZC(r,n.name,n.color),UC(r,WC(e,o,n.color)))};return e.on("TextColorChange",s),dC(mC(e)(r),(()=>{e.off("TextColorChange",s)}))}})},qC=(e,t,o,n,r)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(UC(n,WC(e,o,r.get())),ZC(n,t,r.get()),mC(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:jC(e,o),initData:{storageKey:o},onAction:n=>{FC(e,o,n.value,(o=>{r.set(o),lC(e,{name:t,color:o})}))}}]})},GC=e=>(t,o)=>{let n=!1;const r={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:r,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const r=o.getData().colorpicker;n?(t(D.from(r)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",r]))},onClose:v,onCancel:()=>{t(D.none())}})},KC=(e,t,o,n,r,s,a,i)=>{const l=Fy(t),c=YC(t,o,n,"color"!==r?"normal":"color",s,a,i);return Zy(e,l,c,n,{menuType:r})},YC=(e,t,o,n,r,s,a)=>xe(F(e,(i=>{return"choiceitem"===i.type?(l=i,tr("choicemenuitem",Zw,l)).fold(zy,(i=>D.some(((e,t,o,n,r,s,a,i=!0)=>{const l=Lx({presets:o,textContent:t?e.text:D.none(),htmlContent:D.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:D.none(),checkMark:t?D.some(Nx(a.icons)):D.none(),caret:D.none(),value:e.value},a,i);return xn(kx({data:_x(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Yp.set(e,t)},isActive:()=>Yp.isOn(e),isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(r),v),triggersSubmenu:!1,itemBehaviours:[]},l,s,a),{toggling:{toggleClass:iy,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,s(i.value),r,a,Fy(e))))):D.none();var l}))),XC=(e,t)=>{const o=vy(t);if(1===e)return{mode:"menu",moveOnTab:!0};if("auto"===e)return{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}};return{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?Bi(e.element,"[aria-checked=true]"):D.none()}},JC=(e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold((()=>zC(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o)),(e=>e.concat(PC(o))))},QC=ya("cell-over"),eS=ya("cell-execute"),tS=(e,t,o)=>{const n=o=>Ws(o,eS,{row:e,col:t}),r=(e,t)=>{t.stop(),n(e)};return Ei({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:ql([Ip("insert-table-picker-cell",[Qs(rs(),Zp.focus),Qs(Cs(),n),Qs(ms(),r),Qs(ks(),r)]),Yp.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Zp.config({onFocus:o=>Ws(o,QC,{row:e,col:t})})])})},oS=e=>G(e,(e=>F(e,Ti))),nS=(e,t)=>Ci(`${t}x${e}`),rS={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=((e,t,o)=>{const n=[];for(let r=0;r{Hp.set(s.get(e),[r])})),na(QC,((e,t,o)=>{const{row:r,col:a}=o.event;((e,t,o,n,r)=>{for(let s=0;s{const{row:r,col:s}=n.event;e.onAction({numRows:r+1,numColumns:s+1}),js(t,Es())}))]),Tp.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=JC(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),r="color",s=KC(ya("menu-value"),o,(t=>{e.onAction({value:t})}),n,r,oy.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),a={...s,markers:vy(r),movement:XC(n,r)};return{type:"widget",data:{value:ya("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Fx.widget(wf.sketch(a))]}}},sS=(e,t,o,n,r,s,a,i=!0)=>{const l=Lx({presets:n,textContent:D.none(),htmlContent:o?e.text.map((e=>Ix(e,t))):D.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:D.none(),checkMark:D.none(),caret:D.none(),value:e.value},a.providers,i,e.icon);return kx({data:_x(e),enabled:e.enabled,getApi:w({}),onAction:t=>r(e.value,e.meta),onSetup:w(v),triggersSubmenu:!1,itemBehaviours:Hx(e.meta,a)},l,s,a.providers)},aS=e=>({type:"separator",dom:{tag:"div",classes:[ry,"tox-collection__group-heading"]},components:e.text.map(Ci).toArray()}),iS=(e,t,o,n=!0)=>{const r=Lx({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,caret:D.none(),checkMark:D.none(),shortcutContent:e.shortcut},o,n);return kx({data:_x(e),getApi:e=>({isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o)},lS=(e,t,o,n=!0,r=!1)=>{const s=r?(a=o.icons,Tx("chevron-down",a,[dy])):(e=>Tx("chevron-right",e,[dy]))(o.icons);var a;const i=Lx({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,caret:D.some(s),checkMark:D.none(),shortcutContent:e.shortcut},o,n);return kx({data:_x(e),getApi:e=>({isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t),setIconFill:(t,o)=>{Bi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{St(e,"fill",o)}))},setTooltip:t=>{const n=o.translate(t);kt(e.element,{"aria-label":n,title:n})}}),enabled:e.enabled,onAction:v,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)},cS=(e,t,o,n=!0)=>{const r=Lx({iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,checkMark:D.some(Nx(o.icons)),caret:D.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return xn(kx({data:_x(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Yp.set(e,t)},isActive:()=>Yp.isOn(e),isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o),{toggling:{toggleClass:iy,toggleOnExecute:!1,selected:e.active}})},dS=(e,t)=>ve(rS,e.fancytype).map((o=>o(e,t))),mS=(e,t,o,n)=>{const r={dom:Bx(e.label),optComponents:[D.some({dom:{tag:"div",classes:[uy,gy]},components:Px(e.items,n)})]};return kx({data:_x({text:D.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>{wg.set(e,!t),z(_d(e.element,"*"),(o=>{e.getSystem().getByDom(o).each((e=>{e.hasConfigured(wg)&&wg.set(e,!t)}))}))}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:D.from(n.itemBehaviours).getOr([])},r,t,o.providers)};var uS=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),gS=[mr("others",er(on.value,Un()))];var hS=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===ae(t.others).length)throw new Error("Cannot find any known coupled components");return ve(e,o)},o=w({});return Ia({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk((()=>(ve(o.others,n).getOrDie("No information found for coupled component: "+n),D.none()))),getOrCreate:(o,n,r)=>t(n,r).getOrThunk((()=>{const t=ve(n.others,r).getOrDie("No information found for coupled component: "+r)(o),s=o.getSystem().build(t);return e[r]=s,s}))})}});const pS=Kl({fields:gS,name:"coupling",apis:uS,state:hS}),fS=e=>{let t=D.none(),o=[];const n=e=>{r()?a(e):o.push(e)},r=()=>t.isSome(),s=e=>{z(e,a)},a=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{r()||(t=D.some(e),s(o),o=[])})),{get:n,map:e=>fS((t=>{n((o=>{t(e(o))}))})),isReady:r}},vS={nu:fS,pure:e=>fS((t=>{t(e)}))},bS=e=>{setTimeout((()=>{throw e}),0)},yS=e=>{const t=t=>{e().then(t,bS)};return{map:t=>yS((()=>e().then(t))),bind:t=>yS((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>yS((()=>e().then((()=>t.toPromise())))),toLazy:()=>vS.nu(t),toCached:()=>{let t=null;return yS((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},wS=e=>yS((()=>new Promise(e))),xS=e=>yS((()=>Promise.resolve(e))),CS=w("sink"),SS=w(Du({name:CS(),overrides:w({dom:{tag:"div"},behaviours:ql([rm.config({useFixed:O})]),events:Ys([ra(is()),ra(es()),ra(ms())])})})),kS=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",r=e.getAnchorOverrides();return e.layouts.fold((()=>({type:n,hotspot:o,overrides:r})),(e=>({type:n,hotspot:o,overrides:r,layouts:e})))},_S=(e,t,o,n,r,s,a)=>{const i=((e,t,o,n,r,s,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=DS(n,e);return i.map((e=>e.bind((e=>D.from(Df.sketch({...s.menu(),uid:Ea(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();rm.position(n,t,{anchor:o}),Mm.decloak(r)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();rm.position(n,o,{anchor:{type:"submenu",item:t}}),Mm.decloak(r)},onRepositionMenu:(e,t,n)=>{const r=l().getOrDie();rm.position(r,t,{anchor:o}),z(n,(e=>{rm.position(r,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})}))},onEscape:()=>(Zp.focus(n),Mm.close(r),D.some(!0))}))))))})(e,t,kS(e,o),o,n,r,a);return i.map((e=>(e.fold((()=>{Mm.isOpen(n)&&Mm.close(n)}),(e=>{Mm.cloak(n),Mm.open(n,e),s(n)})),n)))},ES=(e,t,o,n,r,s,a)=>(Mm.close(n),xS(n)),TS=(e,t,o,n,r,s)=>{const a=pS.getCoupled(o,"sandbox");return(Mm.isOpen(a)?ES:_S)(e,t,o,a,n,r,s)},OS=(e,t,o)=>{const n=ag.getCurrent(t).getOr(t),r=Xt(e.element);o?Mt(n.element,"min-width",r+"px"):((e,t)=>{Yt.set(e,t)})(n.element,r)},DS=(e,t)=>e.getSystem().getByUid(t.uid+"-"+CS()).map((e=>()=>on.value(e))).getOrThunk((()=>t.lazySink.fold((()=>()=>on.error(new Error("No internal sink is specified, nor could an external sink be found"))),(t=>()=>t(e))))),AS=e=>{Mm.getState(e).each((e=>{Df.repositionMenus(e)}))},MS=(e,t,o)=>{const n=Ii(),r=DS(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:ou(e.sandboxBehaviours,[Xm.config({store:{mode:"memory",initialValue:t}}),Mm.config({onOpen:(r,s)=>{const a=kS(e,t);n.link(t.element),e.matchWidth&&OS(a.hotspot,s,e.useMinWidth),e.onOpen(a,r,s),void 0!==o&&void 0!==o.onOpen&&o.onOpen(r,s)},onClose:(e,r)=>{n.unlink(t.element),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Fi(o,n)||Fi(t,n),getAttachPoint:()=>r().getOrDie()}),ag.config({find:e=>Mm.getState(e).bind((e=>ag.getCurrent(e)))}),Ql.config({channels:{...Hm({isExtraPart:T}),...Pm({doReposition:AS})}})])}},NS=e=>{const t=pS.getCoupled(e,"sandbox");AS(t)},RS=()=>[Tr("sandboxClasses",[]),tu("sandboxBehaviours",[ag,Ql,Mm,Xm])],BS=w([dr("dom"),dr("fetch"),el("onOpen"),tl("onExecute"),Tr("getHotspot",D.some),Tr("getAnchorOverrides",w({})),Xc(),Jm("dropdownBehaviours",[Yp,pS,Tp,Zp]),dr("toggleClass"),Tr("eventOrder",{}),yr("lazySink"),Tr("matchWidth",!1),Tr("useMinWidth",!1),yr("role")].concat(RS())),LS=w([Ou({schema:[Xi(),Tr("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),SS()]),HS=og({name:"Dropdown",configFields:BS(),partFields:LS(),factory:(e,t,o,n)=>{const r=e=>{Mm.getState(e).each((e=>{Df.highlightPrimary(e)}))},s=(t,o,r)=>TS(e,x,t,n,o,r),a={expand:e=>{Yp.isOn(e)||s(e,v,Tf.HighlightNone).get(v)},open:e=>{Yp.isOn(e)||s(e,v,Tf.HighlightMenuAndItem).get(v)},refetch:t=>pS.getExistingCoupled(t,"sandbox").fold((()=>s(t,v,Tf.HighlightMenuAndItem).map(v)),(o=>_S(e,x,t,o,n,v,Tf.HighlightMenuAndItem).map(v))),isOpen:Yp.isOn,close:e=>{Yp.isOn(e)&&s(e,v,Tf.HighlightMenuAndItem).get(v)},repositionMenus:e=>{Yp.isOn(e)&&NS(e)}},i=(e,t)=>($s(e),D.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.dropdownBehaviours,[Yp.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),pS.config({others:{sandbox:t=>MS(e,t,{onOpen:()=>Yp.on(t),onClose:()=>Yp.off(t)})}}),Tp.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(HS.isOpen(e)){const t=pS.getCoupled(e,"sandbox");r(t)}else HS.open(e);return D.some(!0)},onEscape:(e,t)=>HS.isOpen(e)?(HS.close(e),D.some(!0)):D.none()}),Zp.config({})]),events:Qp(D.some((e=>{s(e,r,Tf.HighlightMenuAndItem).get(v)}))),eventOrder:{...e.eventOrder,[Cs()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold((()=>({})),(e=>({role:e}))),..."button"===e.dom.tag?{type:(l="type",ve(e.dom,"attributes").bind((e=>ve(e,l)))).getOr("button")}:{}}}};var l},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)}}),IS=e=>{const t=Xm.getValue(e),o=Dy(e).map(My);HS.refetch(t).get((()=>{const e=pS.getCoupled(t,"sandbox");o.each((t=>Dy(e).each((e=>((e,t)=>{Xm.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))))}))},PS=e=>Mm.getState(e).bind(Mg.getHighlighted).bind(Mg.getHighlighted),FS=(e,t,o)=>{Ay(e).each((e=>{((e,t)=>{Et(t.element,"id").each((t=>St(e.element,"aria-activedescendant",t)))})(e,o);var n;(si((n=t).element,Ry)?D.some(n.element):Bi(n.element,"."+Ry)).each((t=>{Et(t,"id").each((t=>St(e.element,"aria-controls",t)))}))})),St(o.element,"aria-selected","true")},zS=(e,t,o)=>{St(o.element,"aria-selected","false")},VS=e=>pS.getExistingCoupled(e,"sandbox").bind(Dy).map(My).map((e=>e.fetchPattern)).getOr("");var ZS;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(ZS||(ZS={}));const US=(e,t,o,n,r)=>{const s=o.shared.providers,a=e=>r?{...e,shortcut:D.none(),icon:e.text.isSome()?D.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,tr("menuitem",qw,i)).fold(zy,(e=>D.some(iS(a(e),t,s,n))));case"nestedmenuitem":return(e=>tr("nestedmenuitem",Gw,e))(e).fold(zy,(e=>D.some(lS(a(e),t,s,n,r))));case"togglemenuitem":return(e=>tr("togglemenuitem",Kw,e))(e).fold(zy,(e=>D.some(cS(a(e),t,s,n))));case"separator":return(e=>tr("separatormenuitem",vw,e))(e).fold(zy,(e=>D.some(aS(e))));case"fancymenuitem":return(e=>tr("fancymenuitem",$w,e))(e).fold(zy,(e=>dS(e,o)));default:return console.error("Unknown item in general menu",e),D.none()}var i},jS=(e,t,o,n,r,s,a)=>{const i=1===n,l=!i||Fy(e);return xe(F(e,(e=>{switch(e.type){case"separator":return(n=e,tr("Autocompleter.Separator",vw,n)).fold(zy,(e=>D.some(aS(e))));case"cardmenuitem":return(e=>tr("cardmenuitem",Vw,e))(e).fold(zy,(e=>D.some(mS({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},r,s,{itemBehaviours:Hx(e.meta,s),cardText:{matchText:t,highlightOn:a}}))));default:return(e=>tr("Autocompleter.Item",bw,e))(e).fold(zy,(e=>D.some(sS(e,t,i,"normal",o,r,s,l))))}var n})))},WS=(e,t,o,n,r,s)=>{const a=Fy(t),i=xe(F(t,(e=>{const t=e=>US(e,o,n,(e=>r?!be(e,"text"):a)(e),r);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})(s);return(r?Vy:Zy)(e,a,i,1,l)},$S=e=>Df.singleData(e.value,e),qS=(e,t)=>{const o=ya("autocompleter"),n=Hr(!1),r=Hr(!1),s=Ei(Af.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:ql([Ip("dismissAutocompleter",[Qs(Ls(),(()=>d())),Qs(Zs(),((t,o)=>{Et(o.event.target,"id").each((t=>St(Le.fromDom(e.getBody()),"aria-activedescendant",t)))}))])]),lazySink:t.getSink})),a=()=>Af.isOpen(s),i=r.get,l=()=>{if(a()){Af.hide(s),e.dom.remove(o,!1);const t=Le.fromDom(e.getBody());Et(t,"aria-owns").filter((e=>e===o)).each((()=>{Ot(t,"aria-owns"),Ot(t,"aria-activedescendant")}))}},c=()=>Af.getContent(s).bind((e=>te(e.components(),0))),d=()=>e.execCommand("mceAutocompleterClose"),m=o=>{const r=se(o,(e=>D.from(e.columns))).getOr(1);return G(o,(o=>{const s=o.items;return jS(s,o.matchText,((t,r)=>{const s=e.selection.getRng();((e,t)=>Qb(Le.fromDom(t.startContainer)).map((t=>{const o=e.createRng();return o.selectNode(t.dom),o})))(e.dom,s).each((s=>{const a={hide:()=>d(),reload:t=>{l(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};n.set(!0),o.onAction(a,s,t,r),n.set(!1)}))}),r,oy.BUBBLE_TO_SANDBOX,t,o.highlightOn)}))},u=(t,o)=>{var n;(n=Le.fromDom(e.getBody()),Bi(n,Jb)).each((n=>{const r=se(t,(e=>D.from(e.columns))).getOr(1);Af.showMenuAt(s,{anchor:{type:"node",root:Le.fromDom(e.getBody()),node:D.from(n)}},((e,t,o,n)=>{const r=XC(t,n),s=vy(n);return{data:$S({...e,movement:r,menuBehaviours:Jw("auto"!==t?[]:[ia(((e,t)=>{Yw(e,4,s.item).each((({numColumns:t,numRows:o})=>{Tp.setGridSize(e,o,t)}))}))])}),menu:{markers:vy(n),fakeFocus:o===ZS.ContentFocus}}})(Zy("autocompleter-value",!0,o,r,{menuType:"normal"}),r,ZS.ContentFocus,"normal"))})),c().each(Mg.highlightFirst)},g=t=>{const n=m(t);n.length>0?(u(t,n),St(Le.fromDom(e.getBody()),"aria-owns",o),e.inline||h()):l()},h=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),r=(e=>ga(e,!0))(s.element);Nt(r,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,r.dom),Bi(r,'[role="menu"]').each((e=>{Ft(e,"position"),Ft(e,"max-height")}))};e.on("AutocompleterStart",(({lookupData:e})=>{r.set(!0),n.set(!1),g(e)})),e.on("AutocompleterUpdate",(({lookupData:e})=>g(e))),e.on("AutocompleterEnd",(()=>{l(),r.set(!1),n.set(!1)}));const p={cancelIfNecessary:d,isMenuOpen:a,isActive:i,isProcessingAction:n.get,getMenu:c};ey(p,e)},GS=["visible","hidden","clip"],KS=e=>Ae(e).length>0&&!L(GS,e),YS=e=>{if(Ue(e)){const t=Bt(e,"overflow-x"),o=Bt(e,"overflow-y");return KS(t)||KS(o)}return!1},XS=(e,t)=>Kb(e)?(e=>{const t=kd(e,YS),o=0===t.length?ft(e).map(vt).map((e=>kd(e,YS))).getOr([]):t;return oe(o).map((e=>({element:e,others:o.slice(1)})))})(t):D.none(),JS=e=>{const t=[...F(e.others,Ko),Jo()];return((e,t)=>j(t,((e,t)=>Xo(e,t)),e))(Ko(e.element),t)},QS=(e,t,o)=>Li(e,t,o).isSome(),ek=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout((()=>{e.apply(null,n),o=null}),t)}}},tk=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?D.none():D.some(t.touches[0])},ok=e=>{const t=kc(),o=Hr(!1),n=ek((t=>{e.triggerEvent(_s(),t),o.set(!0)}),400),r=zr([{key:Yr(),value:e=>(tk(e).each((r=>{n.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(s)})),D.none())},{key:Xr(),value:e=>(n.cancel(),tk(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()}))})),D.none())},{key:Jr(),value:r=>{n.cancel();return t.get().filter((e=>Xe(e.target,r.target))).map((t=>o.get()?(r.prevent(),!1):e.triggerEvent(ks(),r)))}}]);return{fireIfReady:(e,t)=>ve(r,t).bind((t=>t(e)))}},nk=(e,t)=>{const o={stopBackspace:!0,...t},n=ok(o),r=F(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(t=>Ec(e,t,(e=>{n.fireIfReady(e,t).each((t=>{t&&e.kill()}));o.triggerEvent(t,e)&&e.kill()})))),s=kc(),a=Ec(e,"paste",(e=>{n.fireIfReady(e,"paste").each((t=>{t&&e.kill()}));o.triggerEvent("paste",e)&&e.kill(),s.set(setTimeout((()=>{o.triggerEvent(ws(),e)}),0))})),i=Ec(e,"keydown",(e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Ng[0]&&!L(["input","textarea"],Ve(e.target))&&!QS(e.target,'[contenteditable="true"]'))(e)&&e.prevent()})),l=Ec(e,"focusin",(e=>{o.triggerEvent("focusin",e)&&e.kill()})),c=kc(),d=Ec(e,"focusout",(e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout((()=>{o.triggerEvent(ys(),e)}),0))}));return{unbind:()=>{z(r,(e=>{e.unbind()})),i.unbind(),l.unbind(),d.unbind(),a.unbind(),s.on(clearTimeout),c.on(clearTimeout)}}},rk=(e,t)=>{const o=ve(e,"target").getOr(t);return Hr(o)},sk=Ir([{stopped:[]},{resume:["element"]},{complete:[]}]),ak=(e,t,o,n,r,s)=>{const a=e(t,n),i=((e,t)=>{const o=Hr(!1),n=Hr(!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,r);return a.fold((()=>(s.logEventNoHandlers(t,n),sk.complete())),(e=>{const o=e.descHandler;return za(o)(i),i.isStopped()?(s.logEventStopped(t,e.element,o.purpose),sk.stopped()):i.isCut()?(s.logEventCut(t,e.element,o.purpose),sk.complete()):nt(e.element).fold((()=>(s.logNoParent(t,e.element,o.purpose),sk.complete())),(n=>(s.logEventResponse(t,e.element,o.purpose),sk.resume(n))))}))},ik=(e,t,o,n,r,s)=>ak(e,t,o,n,r,s).fold(O,(n=>ik(e,t,o,n,r,s)),T),lk=(e,t,o)=>{const n=(e=>{const t=Hr(!1);return{stop:()=>{t.set(!0)},cut:v,isStopped:t.get,isCut:T,event:e,setSource:_("Cannot set source of a broadcasted event"),getSource:_("Cannot get source of a broadcasted event")}})(t);return z(e,(e=>{const t=e.descHandler;za(t)(n)})),n.isStopped()},ck=(e,t,o,n,r)=>{const s=rk(o,n);return ik(e,t,o,n,s,r)},dk=()=>{const e={};return{registerId:(t,o,n)=>{le(n,((n,r)=>{const s=void 0!==e[r]?e[r]:{};s[o]=((e,t)=>{return o=S.apply(void 0,[e.handler].concat(t)),n=e.purpose,{cHandler:o,purpose:n};var o,n})(n,t),e[r]=s}))},unregisterId:t=>{le(e,((e,o)=>{be(e,t)&&delete e[t]}))},filterByType:t=>ve(e,t).map((e=>he(e,((e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))))).getOr([]),find:(t,o,n)=>ve(e,o).bind((e=>jr(n,(t=>((e,t)=>_a(t).bind((t=>ve(e,t))).map((e=>((e,t)=>({element:e,descHandler:t}))(t,e))))(e,t)),t)))}},mk=()=>{const e=dk(),t={},o=e=>{const t=e.element;return _a(t).getOrThunk((()=>((e,t)=>{const o=ya(Ca+e);return ka(t,o),o})("uid-",e.element)))},n=o=>{_a(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:r=>{const s=o(r);ye(t,s)&&((e,o)=>{const r=t[o];if(r!==e)throw new Error('The tagId "'+o+'" is already used by: '+pa(r.element)+"\nCannot use it for: "+pa(e.element)+"\nThe conflicting element is"+(yt(r.element)?" ":" not ")+"already in the DOM");n(e)})(r,s);const a=[r];e.registerId(a,s,r.events),t[s]=r},unregister:n,getById:e=>ve(t,e)}},uk=tg({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:Qm(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Tr("components",[]),Jm("containerBehaviours",[]),Tr("events",{}),Tr("domModification",{}),Tr("eventOrder",{})]}),gk=e=>{const t=t=>nt(e.element).fold(O,(e=>Xe(t,e))),o=mk(),n=(e,n)=>o.find(t,e,n),r=nk(e.element,{triggerEvent:(e,t)=>Wi(e,t.target,(o=>((e,t,o,n)=>ck(e,t,o,o.target,n))(n,e,t,o)))}),s={debugInfo:w("real"),triggerEvent:(e,t,o)=>{Wi(e,t,(r=>ck(n,e,o,t,r)))},triggerFocus:(e,t)=>{_a(e).fold((()=>{tc(e)}),(o=>{Wi(bs(),e,(o=>(((e,t,o,n,r)=>{const s=rk(o,n);ak(e,t,o,n,s,r)})(n,bs(),{originator:t,kill:v,prevent:v,target:e},e,o),!1)))}))},triggerEscape:(e,t)=>{s.triggerEvent("keydown",e.element,t.event)},getByUid:e=>h(e),getByDom:e=>p(e),build:Ei,buildOrPatch:_i,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{m(e)},broadcastOn:(e,t)=>{u(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:O},a=e=>{e.connect(s),We(e.element)||(o.register(e),z(e.components(),a),s.triggerEvent(Os(),e.element,{target:e.element}))},i=e=>{We(e.element)||(z(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{um(e,t)},c=e=>{pm(e)},d=e=>{const t=o.filter(xs());z(t,(t=>{const o=t.descHandler;za(o)(e)}))},m=e=>{d({universal:!0,data:e})},u=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>{const n=o.filter(e);return lk(n,t)},h=e=>o.getById(e).fold((()=>on.error(new Error('Could not find component with uid: "'+e+'" in system.'))),on.value),p=e=>{const t=_a(e).getOr("not found");return h(t)};return a(e),{root:e,element:e.element,destroy:()=>{r.unbind(),Fo(e.element)},add:l,remove:c,getByUid:h,getByDom:p,addToWorld:a,removeFromWorld:i,broadcast:m,broadcastOn:u,broadcastEvent:g}},hk=w([Tr("prefix","form-field"),Jm("fieldBehaviours",[ag,Xm])]),pk=w([Du({schema:[dr("dom")],name:"label"}),Du({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[dr("text")],name:"aria-descriptor"}),Tu({factory:{sketch:e=>{const t=Pr(e,["factory"]);return e.factory.sketch(t)}},schema:[dr("factory")],name:"field"})]),fk=og({name:"FormField",configFields:hk(),partFields:pk(),factory:(e,t,o,n)=>{const r=eu(e.fieldBehaviours,[ag.config({find:t=>Vu(t,e,"field")}),Xm.config({store:{mode:"manual",getValue:e=>ag.getCurrent(e).bind(Xm.getValue),setValue:(e,t)=>{ag.getCurrent(e).each((e=>{Xm.setValue(e,t)}))}}})]),s=Ys([ia(((t,o)=>{const n=Uu(t,e,["label","field","aria-descriptor"]);n.field().each((t=>{const o=ya(e.prefix);n.label().each((e=>{St(e.element,"for",o),St(t.element,"id",o)})),n["aria-descriptor"]().each((o=>{const n=ya(e.prefix);St(o.element,"id",n),St(t.element,"aria-describedby",n)}))}))}))]),a={getField:t=>Vu(t,e,"field"),getLabel:t=>Vu(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:r,events:s,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var vk=Object.freeze({__proto__:null,exhibit:(e,t)=>Fa({attributes:zr([{key:t.tabAttr,value:"true"}])})}),bk=[Tr("tabAttr","data-alloy-tabstop")];const yk=Kl({fields:bk,name:"tabstopping",active:vk});var wk=tinymce.util.Tools.resolve("tinymce.html.Entities");const xk=(e,t,o,n)=>{const r=Ck(e,t,o,n);return fk.sketch(r)},Ck=(e,t,o,n)=>({dom:Sk(o),components:e.toArray().concat([t]),fieldBehaviours:ql(n)}),Sk=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),kk=(e,t)=>fk.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Ci(t.translate(e))]}),_k=ya("form-component-change"),Ek=ya("form-close"),Tk=ya("form-cancel"),Ok=ya("form-action"),Dk=ya("form-submit"),Ak=ya("form-block"),Mk=ya("form-unblock"),Nk=ya("form-tabchange"),Rk=ya("form-resize"),Bk=(e,t,o)=>{const n=e.label.map((e=>kk(e,t))),r=t.icons(),s=e=>(t,o)=>{Li(o.event.target,"[data-collection-item-value]").each((n=>{e(t,o,n,_t(n,"data-collection-item-value"))}))},a=(o,n)=>{const s=F(n,(o=>{const n=Mv.translate(o.text),s=1===e.columns?`
    ${n}
    `:"",a=`
    ${(e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})(o.icon)}
    `,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,(e=>i[e]));return`
    ${a}${s}
    `})),a="auto"!==e.columns&&e.columns>1?P(s,e.columns):[s],i=F(a,(e=>`
    ${e.join("")}
    `));ua(o.element,i.join(""))},i=s(((o,n,r,s)=>{n.stop(),t.isDisabled()||Ws(o,Ok,{name:e.name,value:s})})),l=[Qs(rs(),s(((e,t,o)=>{tc(o)}))),Qs(ms(),i),Qs(ks(),i),Qs(ss(),s(((e,t,o)=>{Bi(e.element,"."+my).each((e=>{ni(e,my)})),ti(o,my)}))),Qs(as(),s((e=>{Bi(e.element,"."+my).each((e=>{ni(e,my)}))}))),da(s(((t,o,n,r)=>{Ws(t,Ok,{name:e.name,value:r})})))],c=(e,t)=>F(_d(e.element,".tox-collection__item"),t),d=fk.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:x},behaviours:ql([wg.config({disabled:t.isDisabled,onDisabled:e=>{c(e,(e=>{ti(e,"tox-collection__item--state-disabled"),St(e,"aria-disabled",!0)}))},onEnabled:e=>{c(e,(e=>{ni(e,"tox-collection__item--state-disabled"),Ot(e,"aria-disabled")}))}}),gx(),Hp.config({}),Xm.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(t,o)=>{a(t,o),"auto"===e.columns&&Yw(t,5,"tox-collection__item").each((({numRows:e,numColumns:o})=>{Tp.setGridSize(t,e,o)})),js(t,Rk)}}),yk.config({}),Tp.config((m=e.columns,u="normal",1===m?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===m?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===u?".tox-swatches__row":".tox-collection__group",cell:"color"===u?`.${sy}`:`.${ry}`}})),Ip("collection-events",l)]),eventOrder:{[Cs()]:["disabling","alloy.base.behaviour","collection-events"]}});var m,u;return xk(n,d,["tox-form__group--collection"],[])},Lk=["input","textarea"],Hk=e=>{const t=Ve(e);return L(Lk,t)},Ik=(e,t)=>{const o=t.getRoot(e).getOr(e.element);ni(o,t.invalidClass),t.notify.each((t=>{Hk(e.element)&&St(e.element,"aria-invalid",!1),t.getContainer(e).each((e=>{ua(e,t.validHtml)})),t.onValid(e)}))},Pk=(e,t,o,n)=>{const r=t.getRoot(e).getOr(e.element);ti(r,t.invalidClass),t.notify.each((t=>{Hk(e.element)&&St(e.element,"aria-invalid",!0),t.getContainer(e).each((e=>{ua(e,n)})),t.onInvalid(e,n)}))},Fk=(e,t,o)=>t.validator.fold((()=>xS(on.value(!0))),(t=>t.validate(e))),zk=(e,t,o)=>(t.notify.each((t=>{t.onValidate(e)})),Fk(e,t).map((o=>e.getSystem().isConnected()?o.fold((o=>(Pk(e,t,0,o),on.error(o))),(o=>(Ik(e,t),on.value(o)))):on.error("No longer in system"))));var Vk=Object.freeze({__proto__:null,markValid:Ik,markInvalid:Pk,query:Fk,run:zk,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return si(o,t.invalidClass)}});var Zk=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map((t=>Ys([Qs(t.onEvent,(t=>{zk(t,e).get(x)}))].concat(t.validateOnLoad?[ia((t=>{zk(t,e).get(v)}))]:[])))).getOr({})}),Uk=[dr("invalidClass"),Tr("getRoot",D.none),Er("notify",[Tr("aria","alert"),Tr("getContainer",D.none),Tr("validHtml",""),el("onValid"),el("onInvalid"),el("onValidate")]),Er("validator",[dr("validate"),Tr("onEvent","input"),Tr("validateOnLoad",!0)])];const jk=Kl({fields:Uk,name:"invalidating",active:Zk,apis:Vk,extra:{validation:e=>t=>{const o=Xm.getValue(t);return xS(e(o))}}});const Wk=Kl({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Ys([Xs(ps(),O)]),exhibit:()=>Fa({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),$k=ya("color-input-change"),qk=ya("color-swatch-change"),Gk=ya("color-picker-cancel"),Kk=(e,t,o,n)=>{const r=fk.parts.field({factory:_y,inputClasses:["tox-textfield"],data:n,onSetValue:e=>jk.run(e).get(v),inputBehaviours:ql([wg.config({disabled:t.providers.isDisabled}),gx(),yk.config({}),jk.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>rt(e.element),notify:{onValid:e=>{const t=Xm.getValue(e);Ws(e,$k,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=Xm.getValue(e);if(0===t.length)return xS(on.value(!0));{const e=Le.fromTag("span");Mt(e,"background-color",t);const o=Ht(e,"background-color").fold((()=>on.error("blah")),(e=>on.value(t)));return xS(o)}}}})]),selectOnFocus:!1}),s=e.label.map((e=>kk(e,t.providers))),a=(e,t)=>{Ws(e,qk,{value:t})},i=Bf(((e,t)=>HS.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ql([px(t.providers.isDisabled),gx(),Wk.config({}),yk.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>wS((t=>e.fetch(t))).map((n=>D.from($S(xn(KC(ya("menu-value"),n,(t=>{e.onItemAction(o,t)}),e.columns,e.presets,oy.CLOSE_ON_EXECUTE,T,t.providers),{movement:XC(e.columns,e.presets)}))))),parts:{menu:wy(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Ol,Tl,Nl],onLtr:()=>[Tl,Ol,Nl]},components:[],fetch:VC(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((()=>js(t,Gk)),(o=>{a(t,o),yC(e.storageKey,o)}))}),"#ffffff"):a(t,"remove"===n?"":n)}))}},t));return fk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:s.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[r,i.asSpec()]}]),fieldBehaviours:ql([Ip("form-field-events",[Qs($k,((t,o)=>{i.getOpt(t).each((e=>{Mt(e.element,"background-color",o.event.color)})),Ws(t,_k,{name:e.name})})),Qs(qk,((e,t)=>{fk.getField(e).each((o=>{Xm.setValue(o,t.event.value),ag.getCurrent(e).each(Zp.focus)}))})),Qs(Gk,((e,t)=>{fk.getField(e).each((t=>{ag.getCurrent(e).each(Zp.focus)}))}))])])})},Yk=Du({schema:[dr("dom")],name:"label"}),Xk=e=>Du({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold((()=>({})),(e=>({events:Ys([ea(Yr(),((t,o,n)=>e(t,n)),[t]),ea(es(),((t,o,n)=>e(t,n)),[t]),ea(ts(),((t,o,n)=>{n.mouseIsDown.get()&&e(t,n)}),[t])])})))}),Jk=Xk("top-left"),Qk=Xk("top"),e_=Xk("top-right"),t_=Xk("right"),o_=Xk("bottom-right"),n_=Xk("bottom"),r_=Xk("bottom-left"),s_=Xk("left"),a_=Tu({name:"thumb",defaults:w({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Ys([oa(Yr(),e,"spectrum"),oa(Xr(),e,"spectrum"),oa(Jr(),e,"spectrum"),oa(es(),e,"spectrum"),oa(ts(),e,"spectrum"),oa(ns(),e,"spectrum")])})}),i_=e=>qg(e.event),l_=Tu({schema:[lr("mouseIsDown",(()=>Hr(!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:ql([Tp.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,i_(n)),onRight:(o,n)=>t.onRight(o,e,i_(n)),onUp:(o,n)=>t.onUp(o,e,i_(n)),onDown:(o,n)=>t.onDown(o,e,i_(n))}),yk.config({}),Zp.config({})]),events:Ys([Qs(Yr(),o),Qs(Xr(),o),Qs(es(),o),Qs(ts(),((t,n)=>{e.mouseIsDown.get()&&o(t,n)}))])}}});var c_=[Yk,s_,t_,Qk,n_,Jk,e_,r_,o_,a_,l_];const d_=w("slider.change.value"),m_=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?D.some(e.touches[0]).map((e=>$t(e.clientX,e.clientY))):D.none()}{const e=t;return void 0!==e.clientX?D.some(e).map((e=>$t(e.clientX,e.clientY))):D.none()}},u_=e=>e.model.minX,g_=e=>e.model.minY,h_=e=>e.model.minX-1,p_=e=>e.model.minY-1,f_=e=>e.model.maxX,v_=e=>e.model.maxY,b_=e=>e.model.maxX+1,y_=e=>e.model.maxY+1,w_=(e,t,o)=>t(e)-o(e),x_=e=>w_(e,f_,u_),C_=e=>w_(e,v_,g_),S_=e=>x_(e)/2,k_=e=>C_(e)/2,__=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,E_=e=>e.snapToGrid,T_=e=>e.snapStart,O_=e=>e.rounded,D_=(e,t)=>void 0!==e[t+"-edge"],A_=e=>D_(e,"left"),M_=e=>D_(e,"right"),N_=e=>D_(e,"top"),R_=e=>D_(e,"bottom"),B_=e=>e.model.value.get(),L_=(e,t)=>({x:e,y:t}),H_=(e,t)=>{Ws(e,d_(),{value:t})},I_=(e,t,o,n)=>eo?o:e===t?t-1:Math.max(t,e-n),P_=(e,t,o,n)=>e>o?e:eMath.max(t,Math.min(o,e)),z_=e=>{const{min:t,max:o,range:n,value:r,step:s,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:m,maxBound:u,screenRange:g}=e,h=c?t-1:t,p=d?o+1:o;if(ru)return p;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(r,m,u),c=F_(e/g*n+t,h,p);return a&&c>=t&&c<=o?((e,t,o,n,r)=>r.fold((()=>{const r=e-t,s=Math.round(r/n)*n;return F_(t+s,t-1,o+1)}),(t=>{const r=(e-t)%n,s=Math.round(r/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+s)*n;return Math.max(t,l)})))(c,t,o,s,i):l?Math.round(c):c}},V_=e=>{const{min:t,max:o,range:n,value:r,hasMinEdge:s,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return ro?a?i:d:(r-t)/n*l},Z_="top",U_="right",j_="bottom",W_="left",$_=e=>e.element.dom.getBoundingClientRect(),q_=(e,t)=>e[t],G_=e=>{const t=$_(e);return q_(t,W_)},K_=e=>{const t=$_(e);return q_(t,U_)},Y_=e=>{const t=$_(e);return q_(t,Z_)},X_=e=>{const t=$_(e);return q_(t,j_)},J_=e=>{const t=$_(e);return q_(t,"width")},Q_=e=>{const t=$_(e);return q_(t,"height")},eE=(e,t,o)=>(e+t)/2-o,tE=(e,t)=>{const o=$_(e),n=$_(t),r=q_(o,W_),s=q_(o,U_),a=q_(n,W_);return eE(r,s,a)},oE=(e,t)=>{const o=$_(e),n=$_(t),r=q_(o,Z_),s=q_(o,j_),a=q_(n,Z_);return eE(r,s,a)},nE=(e,t)=>{Ws(e,d_(),{value:t})},rE=(e,t,o)=>{const n={min:u_(t),max:f_(t),range:x_(t),value:o,step:__(t),snap:E_(t),snapStart:T_(t),rounded:O_(t),hasMinEdge:A_(t),hasMaxEdge:M_(t),minBound:G_(e),maxBound:K_(e),screenRange:J_(e)};return z_(n)},sE=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?P_:I_)(B_(o),u_(o),f_(o),__(o,n));return nE(t,r),D.some(r)})(e,t,o,n).map(O),aE=(e,t,o,n,r,s)=>{const a=((e,t,o,n,r)=>{const s=J_(e),a=n.bind((t=>D.some(tE(t,e)))).getOr(0),i=r.bind((t=>D.some(tE(t,e)))).getOr(s),l={min:u_(t),max:f_(t),range:x_(t),value:o,hasMinEdge:A_(t),hasMaxEdge:M_(t),minBound:G_(e),minOffset:0,maxBound:K_(e),maxOffset:s,centerMinEdge:a,centerMaxEdge:i};return V_(l)})(t,s,o,n,r);return G_(t)-G_(e)+a},iE=sE(-1),lE=sE(1),cE=D.none,dE=D.none,mE={"top-left":D.none(),top:D.none(),"top-right":D.none(),right:D.some(((e,t)=>{H_(e,b_(t))})),"bottom-right":D.none(),bottom:D.none(),"bottom-left":D.none(),left:D.some(((e,t)=>{H_(e,h_(t))}))};var uE=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=rE(e,t,o);return nE(e,n),n},setToMin:(e,t)=>{const o=u_(t);nE(e,o)},setToMax:(e,t)=>{const o=f_(t);nE(e,o)},findValueOfOffset:rE,getValueFromEvent:e=>m_(e).map((e=>e.left)),findPositionOfValue:aE,setPositionFromValue:(e,t,o,n)=>{const r=B_(o),s=aE(e,n.getSpectrum(e),r,n.getLeftEdge(e),n.getRightEdge(e),o),a=Xt(t.element)/2;Mt(t.element,"left",s-a+"px")},onLeft:iE,onRight:lE,onUp:cE,onDown:dE,edgeActions:mE});const gE=(e,t)=>{Ws(e,d_(),{value:t})},hE=(e,t,o)=>{const n={min:g_(t),max:v_(t),range:C_(t),value:o,step:__(t),snap:E_(t),snapStart:T_(t),rounded:O_(t),hasMinEdge:N_(t),hasMaxEdge:R_(t),minBound:Y_(e),maxBound:X_(e),screenRange:Q_(e)};return z_(n)},pE=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?P_:I_)(B_(o),g_(o),v_(o),__(o,n));return gE(t,r),D.some(r)})(e,t,o,n).map(O),fE=(e,t,o,n,r,s)=>{const a=((e,t,o,n,r)=>{const s=Q_(e),a=n.bind((t=>D.some(oE(t,e)))).getOr(0),i=r.bind((t=>D.some(oE(t,e)))).getOr(s),l={min:g_(t),max:v_(t),range:C_(t),value:o,hasMinEdge:N_(t),hasMaxEdge:R_(t),minBound:Y_(e),minOffset:0,maxBound:X_(e),maxOffset:s,centerMinEdge:a,centerMaxEdge:i};return V_(l)})(t,s,o,n,r);return Y_(t)-Y_(e)+a},vE=D.none,bE=D.none,yE=pE(-1),wE=pE(1),xE={"top-left":D.none(),top:D.some(((e,t)=>{H_(e,p_(t))})),"top-right":D.none(),right:D.none(),"bottom-right":D.none(),bottom:D.some(((e,t)=>{H_(e,y_(t))})),"bottom-left":D.none(),left:D.none()};var CE=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=hE(e,t,o);return gE(e,n),n},setToMin:(e,t)=>{const o=g_(t);gE(e,o)},setToMax:(e,t)=>{const o=v_(t);gE(e,o)},findValueOfOffset:hE,getValueFromEvent:e=>m_(e).map((e=>e.top)),findPositionOfValue:fE,setPositionFromValue:(e,t,o,n)=>{const r=B_(o),s=fE(e,n.getSpectrum(e),r,n.getTopEdge(e),n.getBottomEdge(e),o),a=Ut(t.element)/2;Mt(t.element,"top",s-a+"px")},onLeft:vE,onRight:bE,onUp:yE,onDown:wE,edgeActions:xE});const SE=(e,t)=>{Ws(e,d_(),{value:t})},kE=(e,t)=>({x:e,y:t}),_E=(e,t)=>(o,n,r)=>((e,t,o,n,r)=>{const s=e>0?P_:I_,a=t?B_(n).x:s(B_(n).x,u_(n),f_(n),__(n,r)),i=t?s(B_(n).y,g_(n),v_(n),__(n,r)):B_(n).y;return SE(o,kE(a,i)),D.some(a)})(e,t,o,n,r).map(O),EE=_E(-1,!1),TE=_E(1,!1),OE=_E(-1,!0),DE=_E(1,!0),AE={"top-left":D.some(((e,t)=>{H_(e,L_(h_(t),p_(t)))})),top:D.some(((e,t)=>{H_(e,L_(S_(t),p_(t)))})),"top-right":D.some(((e,t)=>{H_(e,L_(b_(t),p_(t)))})),right:D.some(((e,t)=>{H_(e,L_(b_(t),k_(t)))})),"bottom-right":D.some(((e,t)=>{H_(e,L_(b_(t),y_(t)))})),bottom:D.some(((e,t)=>{H_(e,L_(S_(t),y_(t)))})),"bottom-left":D.some(((e,t)=>{H_(e,L_(h_(t),y_(t)))})),left:D.some(((e,t)=>{H_(e,L_(h_(t),k_(t)))}))};var ME=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=rE(e,t,o.left),r=hE(e,t,o.top),s=kE(n,r);return SE(e,s),s},setToMin:(e,t)=>{const o=u_(t),n=g_(t);SE(e,kE(o,n))},setToMax:(e,t)=>{const o=f_(t),n=v_(t);SE(e,kE(o,n))},getValueFromEvent:e=>m_(e),setPositionFromValue:(e,t,o,n)=>{const r=B_(o),s=aE(e,n.getSpectrum(e),r.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=fE(e,n.getSpectrum(e),r.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Xt(t.element)/2,l=Ut(t.element)/2;Mt(t.element,"left",s-i+"px"),Mt(t.element,"top",a-l+"px")},onLeft:EE,onRight:TE,onUp:OE,onDown:DE,edgeActions:AE});const NE=og({name:"Slider",configFields:[Tr("stepSize",1),Tr("speedMultiplier",10),Tr("onChange",v),Tr("onChoose",v),Tr("onInit",v),Tr("onDragStart",v),Tr("onDragEnd",v),Tr("snapToGrid",!1),Tr("rounded",!0),yr("snapStart"),mr("model",sr("mode",{x:[Tr("minX",0),Tr("maxX",100),lr("value",(e=>Hr(e.mode.minX))),dr("getInitialValue"),rl("manager",uE)],y:[Tr("minY",0),Tr("maxY",100),lr("value",(e=>Hr(e.mode.minY))),dr("getInitialValue"),rl("manager",CE)],xy:[Tr("minX",0),Tr("maxX",100),Tr("minY",0),Tr("maxY",100),lr("value",(e=>Hr({x:e.mode.minX,y:e.mode.minY}))),dr("getInitialValue"),rl("manager",ME)]})),Jm("sliderBehaviours",[Tp,Xm]),lr("mouseIsDown",(()=>Hr(!1)))],partFields:c_,factory:(e,t,o,n)=>{const r=t=>Zu(t,e,"thumb"),s=t=>Zu(t,e,"spectrum"),a=t=>Vu(t,e,"left-edge"),i=t=>Vu(t,e,"right-edge"),l=t=>Vu(t,e,"top-edge"),c=t=>Vu(t,e,"bottom-edge"),d=e.model,m=d.manager,u=(t,o)=>{m.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:s})},g=(e,t)=>{d.value.set(t);const o=r(e);u(e,o)},h=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&Vu(t,e,"thumb").each((o=>{const n=d.value.get();e.onChoose(t,o,n)}))},p=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,r(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,r(t)),h(t)},v=t=>{Vu(t,e,"spectrum").map(Tp.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.sliderBehaviours,[Tp.config({mode:"special",focusIn:v}),Xm.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),Ql.config({channels:{[Bm()]:{onReceive:h}}})]),events:Ys([Qs(d_(),((t,o)=>{((t,o)=>{g(t,o);const n=r(t);e.onChange(t,n,o),D.some(!0)})(t,o.event.value)})),ia(((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=r(t);u(t,a);const i=s(t);e.onInit(t,a,i,d.value.get())})),Qs(Yr(),p),Qs(Jr(),f),Qs(es(),((e,t)=>{v(e),p(e,t)})),Qs(ns(),f)]),apis:{resetToMin:t=>{m.setToMin(t,e)},resetToMax:t=>{m.setToMax(t,e)},setValue:g,refresh:u},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)}}}),RE=ya("rgb-hex-update"),BE=ya("slider-update"),LE=ya("palette-update"),HE="form",IE=[Jm("formBehaviours",[Xm])],PE=e=>"",FE=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.formBehaviours,[Xm.config({store:{mode:"manual",getValue:t=>{const o=ju(t,e);return ce(o,((e,t)=>e().bind((e=>{const o=ag.getCurrent(e);return n=o,r=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+pa(e.element)),n.fold((()=>on.error(r)),on.value);var n,r})).map(Xm.getValue)))},setValue:(t,o)=>{le(o,((o,n)=>{Vu(t,e,n).each((e=>{ag.getCurrent(e).each((e=>{Xm.setValue(e,o)}))}))}))}}})]),apis:{getField:(t,o)=>Vu(t,e,o).bind(ag.getCurrent)}}),zE={getField:La(((e,t,o)=>e.getField(t,o))),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),Hu(HE,PE(t),o)),record:w(e)}})(),o=e(t),n=t.record(),r=F(n,(e=>Tu({name:e,pname:PE(e)})));return Xu(HE,IE,r,FE,o)}},VE=ya("valid-input"),ZE=ya("invalid-input"),UE=ya("validating-input"),jE="colorcustom.rgb.",WE=(e,t,o,n)=>{const r=(o,n)=>jk.config({invalidClass:t("invalid"),notify:{onValidate:e=>{Ws(e,UE,{type:o})},onValid:e=>{Ws(e,VE,{type:o,value:Xm.getValue(e)})},onInvalid:e=>{Ws(e,ZE,{type:o,value:Xm.getValue(e)})}},validator:{validate:t=>{const o=Xm.getValue(t),r=n(o)?on.value(!0):on.error(e("aria.input.invalid"));return xS(r)},validateOnLoad:!1}}),s=(o,n,s,a,i)=>{const l=e(jE+"range"),c=fk.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[Ci(s)]}),d=fk.parts.field({data:i,factory:_y,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:ql([r(n,o),yk.config({})]),onSetValue:e=>{if(jk.isInvalid(e)){jk.run(e).get(v)}}}),m=[c,d],u="hex"!==n?[fk.parts["aria-descriptor"]({text:l})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:m.concat(u)}},a=(e,t)=>{const o=t.red,n=t.green,r=t.blue;Xm.setValue(e,{red:o,green:n,blue:r})},i=Bf({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each((e=>{Mt(e.element,"background-color","#"+t.value)}))},c=tg({factory:()=>{const r={red:Hr(D.some(255)),green:Hr(D.some(255)),blue:Hr(D.some(255)),hex:Hr(D.some("ffffff"))},c=e=>r[e].get(),d=(e,t)=>{r[e].set(t)},m=e=>{const t=e.red,o=e.green,n=e.blue;d("red",D.some(t)),d("green",D.some(o)),d("blue",D.some(n))},u=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,D.none()):n(e)},g=(e,t,o)=>{const n=parseInt(o,10);d(t,D.some(n)),c("red").bind((e=>c("green").bind((t=>c("blue").map((o=>Qx(e,t,o,1))))))).each((t=>{const o=((e,t)=>{const o=qx(t);return zE.getField(e,"hex").each((t=>{Zp.isFocused(t)||Xm.setValue(e,{hex:o.value})})),o})(e,t);Ws(e,RE,{hex:o}),l(e,o)}))},h=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=zx(t);d("hex",D.some(n.value));const r=oC(n);a(e,r),m(r),Ws(e,RE,{hex:n}),l(e,n)})(e,n.value):g(e,n.type,n.value)},p=t=>({label:e(jE+t+".label"),description:e(jE+t+".description")}),f=p("red"),v=p("green"),b=p("blue"),y=p("hex");return xn(zE.sketch((o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",fk.sketch(s(eC,"red",f.label,f.description,255))),o.field("green",fk.sketch(s(eC,"green",v.label,v.description,255))),o.field("blue",fk.sketch(s(eC,"blue",b.label,b.description,255))),o.field("hex",fk.sketch(s(Ux,"hex",y.label,y.description,"ffffff"))),i.asSpec()],formBehaviours:ql([jk.config({invalidClass:t("form-invalid")}),Ip("rgb-form-events",[Qs(VE,h),Qs(ZE,u),Qs(UE,u)])])}))),{apis:{updateHex:(e,t)=>{Xm.setValue(e,{hex:t.value}),((e,t)=>{const o=oC(t);a(e,o),m(o)})(e,t),l(e,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return c},$E=(e,t)=>{const o=NE.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=NE.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:``}}),r=(e,t)=>{const{width:o,height:n}=e,r=e.getContext("2d");if(null===r)return;r.fillStyle=t,r.fillRect(0,0,o,n);const s=r.createLinearGradient(0,0,o,0);s.addColorStop(0,"rgba(255,255,255,1)"),s.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=s,r.fillRect(0,0,o,n);const a=r.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=a,r.fillRect(0,0,o,n)},s=tg({factory:s=>{const a=w({x:0,y:0}),i=ql([ag.config({find:D.some}),Zp.config({})]);return NE.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)=>{p(n)||St(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),Ws(t,LE,{value:n})},onInit:(e,t,o,n)=>{r(o.element.dom,sC(aC))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=wC(t,100,100),s=tC(n);r(o,sC(s))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=xC(oC(o));NE.setValue(t,{x:n.saturation,y:100-n.value}),St(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}});return s},qE=(e,t)=>{const o=tg({name:"ColourPicker",configFields:[dr("dom"),Tr("onValidHex",v),Tr("onInvalidHex",v)],factory:o=>{const n=WE(e,t,o.onValidHex,o.onInvalidHex),r=$E(e,t),s={paletteRgba:Hr(aC),paletteHue:Hr(0)},a=Bf(((e,t)=>{const o=NE.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=NE.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return NE.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:w(0)},components:[o,n],sliderBehaviours:ql([Zp.config({})]),onChange:(e,t,o)=>{St(e.element,"aria-valuenow",Math.floor(360-3.6*o)),Ws(e,BE,{value:o})}})})(0,t)),i=Bf(r.sketch({})),l=Bf(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each((e=>{r.setHue(e,o)}))},d=(e,t)=>{l.getOpt(e).each((e=>{n.updateHex(e,t)}))},m=(e,t,o)=>{a.getOpt(e).each((e=>{NE.setValue(e,(e=>100-e/360*100)(o))}))},u=(e,t)=>{i.getOpt(e).each((e=>{r.setThumb(e,t)}))},g=(e,t,o,n)=>{((e,t)=>{const o=oC(e);s.paletteRgba.set(o),s.paletteHue.set(t)})(t,o),z(n,(n=>{n(e,t,o)}))};return{uid:o.uid,dom:o.dom,components:[i.asSpec(),a.asSpec(),l.asSpec()],behaviours:ql([Ip("colour-picker-events",[Qs(RE,(()=>{const e=[c,m,u];return(t,o)=>{const n=o.event.hex,r=(e=>xC(oC(e)))(n);g(t,n,r.hue,e)}})()),Qs(LE,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,r=s.paletteHue.get(),a=wC(r,n.x,100-n.y),i=CC(a);g(t,i,r,e)}})()),Qs(BE,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),r=s.paletteRgba.get(),a=xC(r),i=wC(n,a.saturation,a.value),l=CC(i);g(t,l,n,e)}})())]),ag.config({find:e=>l.getOpt(e)}),Tp.config({mode:"acyclic"})])}}});return o},GE=()=>ag.config({find:D.some}),KE=e=>ag.config({find:e.getOpt}),YE=e=>ag.config({find:t=>it(t.element,e).bind((e=>t.getSystem().getByDom(e).toOptional()))}),XE=Pn([Tr("preprocess",x),Tr("postprocess",x)]),JE=(e,t)=>{const o=nr("RepresentingConfigs.memento processors",XE,t);return Xm.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),r=Xm.getValue(n);return o.postprocess(r)},setValue:(t,n)=>{const r=o.preprocess(n),s=e.get(t);Xm.setValue(s,r)}}})},QE=(e,t,o)=>Xm.config({store:{mode:"manual",...e.map((e=>({initialValue:e}))).getOr({}),getValue:t,setValue:o}}),eT=(e,t,o)=>QE(e,(e=>t(e.element)),((e,t)=>o(e.element,t))),tT=e=>Xm.config({store:{mode:"memory",initialValue:e}}),oT={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"},nT=(e,t,o)=>{const n=e=>"tox-"+e,r=qE((e=>t=>s(t)?e.translate(oT[t]):e.translate(t))(t),n),a=Bf(r.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{Ws(e,Ok,{name:"hex-valid",value:!0})},onInvalidHex:e=>{Ws(e,Ok,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:ql([QE(o,(e=>{const t=a.get(e);return ag.getCurrent(t).bind((e=>Xm.getValue(e).hex)).map((e=>"#"+Ee(e,"#"))).getOr("")}),((e,t)=>{const o=D.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind((e=>te(e,1))),n=a.get(e);ag.getCurrent(n).fold((()=>{console.log("Can not find form")}),(e=>{Xm.setValue(e,{hex:o.getOr("")}),zE.getField(e,"hex").each((e=>{js(e,cs())}))}))})),GE()])}};var rT=tinymce.util.Tools.resolve("tinymce.Resource");var sT=tinymce.util.Tools.resolve("tinymce.util.Tools");const aT=(e,t,o)=>{const n=(e,t)=>{t.stop()},r=e=>(t,o)=>{z(e,(e=>{e(t,o)}))},s=(e,t)=>{var o;if(!wg.isDisabled(e)){const n=t.event.raw;i(e,null===(o=n.dataTransfer)||void 0===o?void 0:o.files)}},a=(e,t)=>{const o=t.event.raw.target;i(e,o.files)},i=(o,n)=>{n&&(Xm.setValue(o,((e,t)=>{const o=sT.explode(t.getOption("images_file_types"));return Z(re(e),(e=>H(o,(t=>De(e.name.toLowerCase(),`.${t.toLowerCase()}`)))))})(n,t)),Ws(o,_k,{name:e.name}))},l=Bf({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ql([Ip("input-file-events",[ra(ms()),ra(ks())])])}),c=e.label.map((e=>kk(e,t))),d=fk.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ql([tT(o.getOr([])),GE(),wg.config({}),Yp.config({toggleClass:"dragenter",toggleOnExecute:!1}),Ip("dropzone-events",[Qs("dragenter",r([n,Yp.toggle])),Qs("dragleave",r([n,Yp.toggle])),Qs("dragover",n),Qs("drop",r([n,s])),Qs(ds(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[Ci(t.translate("Drop an image here"))]},Nf.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[Ci(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:ql([yk.config({}),px(t.isDisabled),gx()])})]}]})}});return xk(c,d,["tox-form__group--stretched"],[])},iT=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}},lT=ya("alloy-fake-before-tabstop"),cT=ya("alloy-fake-after-tabstop"),dT=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:ql([Zp.config({ignore:!0}),yk.config({})])}),mT=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[dT([lT]),t,dT([cT])],behaviours:ql([YE(1)])}),uT=(e,t)=>{Ws(e,is(),{raw:{which:9,shiftKey:t}})},gT=(e,t)=>{const o=t.element;si(o,lT)?uT(e,!0):si(o,cT)&&uT(e,!1)},hT=e=>QS(e,["."+lT,"."+cT].join(","),T),pT=ya("update-dialog"),fT=ya("update-title"),vT=ya("update-body"),bT=ya("update-footer"),yT=ya("body-send-message"),wT=ya("dialog-focus-shifted"),xT=Do().browser,CT=xT.isSafari(),ST=xT.isFirefox(),kT=CT||ST,_T=xT.isChromium(),ET=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,TT=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),OT=(e,t,o)=>{const n=e.dom;D.from(n.contentDocument).fold(o,(e=>{let o=0;const r=((e,t)=>{const o=e.body;return D.from(!/^1))?o:e.documentElement)})(e,t).map((e=>(o=e.scrollTop,e))).forall(ET),s=()=>{const e=n.contentWindow;g(e)&&(r?TT(e,"bottom"):!r&&kT&&0!==o&&TT(e,o))};CT&&n.addEventListener("load",s,{once:!0}),e.open(),e.write(t),e.close(),CT||s()}))},DT=ke(kT,CT?500:200).map((e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...r)=>{n=r,c(o)&&(o=setTimeout((()=>{const t=n;o=null,n=null,e.apply(null,t)}),t))}}})(OT,e))),AT=(e,t,o)=>{const n="tox-dialog__iframe",r=e.transparent?[]:[`${n}--opaque`],s=e.border?["tox-navobj-bordered"]:[],a={...e.label.map((e=>({title:e}))).getOr({}),...o.map((e=>({srcdoc:e}))).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=((e,t)=>{const o=Hr(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,r=()=>St(o,"srcdoc",n);t?DT.fold(w(OT),(e=>e.throttle))(o,n,r):r()}o.set(n)}}})(o,e.streamContent),l=e.label.map((e=>kk(e,t))),c=fk.parts.field({factory:{sketch:e=>mT(D.from(s),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...r]},behaviours:ql([yk.config({}),Zp.config({}),QE(o,i.getValue,i.setValue),Ql.config({channels:{[wT]:{onReceive:(e,t)=>{t.newFocus.each((t=>{rt(e.element).each((o=>{(Xe(e.element,t)?ti:ni)(o,"tox-navobj-bordered-focus")}))}))}}}})])})}});return xk(l,c,["tox-form__group--stretched"],[])},MT=(e,t)=>{const o=Hr(t.getOr({url:""})),n=Bf({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map((e=>({src:e.url}))).getOr({})}}),r=Bf({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),s={};e.height.each((e=>s.height=e));const a=t.map((e=>({url:e.url,zoom:D.from(e.zoom),cachedWidth:D.from(e.cachedWidth),cachedHeight:D.from(e.cachedHeight)})));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:s,attributes:{role:"presentation"}},components:[r.asSpec()],behaviours:ql([GE(),QE(a,(()=>o.get()),((e,t)=>{const s={url:t.url};t.zoom.each((e=>s.zoom=e)),t.cachedWidth.each((e=>s.cachedWidth=e)),t.cachedHeight.each((e=>s.cachedHeight=e)),o.set(s);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=s;if(!m(t)&&!m(o)){if(m(n)){const n=((e,t,o)=>{const n=Xt(e),r=Ut(e);return Math.min(n/t,r/o,1)})(e.element,t,o);s.zoom=n}const a=((e,t,o,n,r)=>{const s=o*r,a=n*r,i=Math.max(0,e/2-s/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:s.toString()+"px",height:a.toString()+"px"}})(Xt(e.element),Ut(e.element),t,o,s.zoom);r.getOpt(e).each((e=>{Nt(e.element,a)}))}};n.getOpt(e).each((o=>{const n=o.element;t.url!==_t(n,"src")&&(St(n,"src",t.url),ni(e.element,"tox-imagepreview__loaded")),a(),(e=>new Promise(((t,o)=>{const n=()=>{s(),t(e)},r=[Ec(e,"load",n),Ec(e,"error",(()=>{s(),o("Unable to load data from image: "+e.dom.src)}))],s=()=>z(r,(e=>e.unbind()));e.dom.complete&&n()})))(n).then((t=>{e.getSystem().isConnected()&&(ti(e.element,"tox-imagepreview__loaded"),s.cachedWidth=t.dom.naturalWidth,s.cachedHeight=t.dom.naturalHeight,a())}))}))}))])}},NT=ya("toolbar.button.execute"),RT=ya("common-button-display-events"),BT={[Cs()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events"],[Rs()]:["toolbar-button-events",RT],[es()]:["focusing","alloy.base.behaviour",RT]},LT=e=>Mt(e.element,"width",Bt(e.element,"width")),HT=(e,t,o)=>zv(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),IT=(e,t)=>HT(e,t,[]),PT=(e,t)=>HT(e,t,[Hp.config({})]),FT=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[Ci(o.translate(e))],behaviours:ql([Hp.config({})])}),zT=ya("update-menu-text"),VT=ya("update-menu-icon"),ZT=(e,t,o)=>{const n=Hr(v),r=e.text.map((e=>Bf(FT(e,t,o.providers)))),s=e.icon.map((e=>Bf(PT(e,o.providers.icons)))),a=(e,t)=>{const o=Xm.getValue(e);return Zp.focus(o),Ws(o,"keydown",{raw:t.event.raw}),HS.close(o),D.some(!0)},i=e.role.fold((()=>({})),(e=>({role:e}))),l=e.tooltip.fold((()=>({})),(e=>{const t=o.providers.translate(e);return{title:t,"aria-label":t}})),c=zv("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),d=ya("common-button-display-events"),m=Bf(HS.sketch({...e.uid?{uid:e.uid}:{},...i,dom:{tag:"button",classes:[t,`${t}--select`].concat(F(e.classes,(e=>`${t}--${e}`))),attributes:{...l}},components:Sx([s.map((e=>e.asSpec())),r.map((e=>e.asSpec())),D.some(c)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{Ay(e).each((e=>Zp.focus(e)))})(n)},dropdownBehaviours:ql([...e.dropdownBehaviours,px((()=>e.disabled||o.providers.isDisabled())),gx(),Wk.config({}),Hp.config({}),Ip("dropdown-events",[yx(e,n),wx(e,n)]),Ip(d,[ia(((e,t)=>LT(e)))]),Ip("menubutton-update-display-text",[Qs(zT,((e,t)=>{r.bind((t=>t.getOpt(e))).each((e=>{Hp.set(e,[Ci(o.providers.translate(t.event.text))])}))})),Qs(VT,((e,t)=>{s.bind((t=>t.getOpt(e))).each((e=>{Hp.set(e,[PT(t.event.icon,o.providers.icons)])}))}))])]),eventOrder:xn(BT,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[Rs()]:["toolbar-button-events","dropdown-events",d]}),sandboxBehaviours:ql([Tp.config({mode:"special",onLeft:a,onRight:a}),Ip("dropdown-sandbox-events",[Qs(Ey,((e,t)=>{IS(e),t.stop()})),Qs(Ty,((e,t)=>{((e,t)=>{PS(e).each((o=>{((e,t,o,n)=>{const r={...n,target:t};e.getSystem().triggerEvent(o,t,r)})(e,o.element,t.event.eventType,t.event.interactionEvent)}))})(e,t),t.stop()}))])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...wy(0,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:FS,onCollapseMenu:(e,t,o)=>{Mg.getHighlighted(o).each((t=>{FS(e,o,t)}))},onDehighlightItem:zS}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Pc()(e,t-10)}}),fetch:t=>wS(S(e.fetch,t))}));return m.asSpec()},UT=e=>"separator"===e.type,jT={type:"separator"},WT=(e,t)=>{const o=j(e,((e,o)=>(e=>s(e))(o)?""===o?e:"|"===o?e.length>0&&!UT(e[e.length-1])?e.concat([jT]):e:be(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o])),[]);return o.length>0&&UT(o[o.length-1])&&o.pop(),o},$T=(e,t)=>{const o=WT(s(e)?e.split(" "):e,t);return U(o,((e,o)=>{if((e=>be(e,"getSubmenuItems"))(o)){const n=(e=>{const t=ve(e,"value").getOrThunk((()=>ya("generated-menu-item")));return xn({value:t},e)})(o),r=((e,t)=>{const o=e.getSubmenuItems(),n=$T(o,t);return{item:e,menus:xn(n.menus,{[e.value]:n.items}),expansions:xn(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:xn(e.menus,r.menus),items:[r.item,...e.items],expansions:xn(e.expansions,r.expansions)}}return{...e,items:[o,...e.items]}}),{menus:{},expansions:{},items:[]})},qT=(e,t,o,n)=>{const r=ya("primary-menu"),s=$T(e,o.shared.providers.menuItems());if(0===s.items.length)return D.none();const a=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-field",placeholder:e.placeholder}))))(n),i=WS(r,s.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-results"}))))(n),c=ce(s.menus,((e,n)=>WS(n,e,t,o,!1,l))),d=xn(c,Fr(r,i));return D.from(Df.tieredData(r,d,s.expansions))},GT=e=>!be(e,"items"),KT="data-value",YT=(e,t,o,n)=>F(o,(o=>GT(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{Xm.setValue(e,o.value),Ws(e,_k,{name:t}),Zp.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>YT(e,t,o.items,n)})),XT=(e,t)=>se(e,(e=>GT(e)?ke(e.value===t,e):XT(e.items,t))),JT=tg({name:"HtmlSelect",configFields:[dr("options"),Jm("selectBehaviours",[Zp,Xm]),Tr("selectClasses",[]),Tr("selectAttributes",{}),yr("data")],factory:(e,t)=>{const o=F(e.options,(e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}}))),n=e.data.map((e=>Fr("initialValue",e))).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:eu(e.selectBehaviours,[Zp.config({}),Xm.config({store:{mode:"manual",getValue:e=>ci(e.element),setValue:(t,o)=>{const n=oe(e.options);W(e.options,(e=>e.value===o)).isSome()?di(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each((e=>di(t.element,e.value)))},...n}})])}}}),QT=w([Tr("field1Name","field1"),Tr("field2Name","field2"),ol("onLockedChange"),Ji(["lockClass"]),Tr("locked",!1),tu("coupledFieldBehaviours",[ag,Xm])]),eO=(e,t)=>Tu({factory:fk,name:e,overrides:e=>({fieldBehaviours:ql([Ip("coupled-input-behaviour",[Qs(cs(),(o=>{((e,t,o)=>Vu(e,t,o).bind(ag.getCurrent))(o,e,t).each((t=>{Vu(o,e,"lock").each((n=>{Yp.isOn(n)&&e.onLockedChange(o,t,n)}))}))}))])])})}),tO=w([eO("field1","field2"),eO("field2","field1"),Tu({factory:Nf,schema:[dr("dom")],name:"lock",overrides:e=>({buttonBehaviours:ql([Yp.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),oO=og({name:"FormCoupledInputs",configFields:QT(),partFields:tO(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:ou(e.coupledFieldBehaviours,[ag.config({find:D.some}),Xm.config({store:{mode:"manual",getValue:t=>{const o=$u(t,e,["field1","field2"]);return{[e.field1Name]:Xm.getValue(o.field1()),[e.field2Name]:Xm.getValue(o.field2())}},setValue:(t,o)=>{const n=$u(t,e,["field1","field2"]);ye(o,e.field1Name)&&Xm.setValue(n.field1(),o[e.field1Name]),ye(o,e.field2Name)&&Xm.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>Vu(t,e,"field1"),getField2:t=>Vu(t,e,"field2"),getLock:t=>Vu(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),nO=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 on.value({value:e,unit:o})}return on.error(e)},rO=(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?D.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?D.some(e.value):D.some(e.value/o[e.unit]*o[t]):D.none()},sO=e=>D.none(),aO=(e,t)=>{const o=nO(e).toOptional(),n=nO(t).toOptional();return Ce(o,n,((e,t)=>rO(e,t.unit).map((e=>t.value/e)).map((e=>{return o=e,n=t.unit,e=>rO(e,n).map((e=>({value:e*o,unit:n})));var o,n})).getOr(sO))).getOr(sO)},iO=(e,t)=>{const o=e.label.map((e=>kk(e,t))),n=[wg.config({disabled:()=>e.disabled||t.isDisabled()}),gx(),Tp.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(js(e,Dk),D.some(!0))}),Ip("textfield-change",[Qs(cs(),((t,o)=>{Ws(t,_k,{name:e.name})})),Qs(ws(),((t,o)=>{Ws(t,_k,{name:e.name})}))]),yk.config({})],r=e.validation.map((e=>jk.config({getRoot:e=>rt(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=Xm.getValue(t),n=e.validator(o);return xS(!0===n?on.value(o):on.error(n))},validateOnLoad:e.validateOnLoad}}))).toArray(),s={...e.placeholder.fold(w({}),(e=>({placeholder:t.translate(e)}))),...e.inputMode.fold(w({}),(e=>({inputmode:e})))},a=fk.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map((e=>({data:e}))).getOr({}),inputAttributes:s,inputClasses:[e.classname],inputBehaviours:ql(q([n,r])),selectOnFocus:!1,factory:_y}),i=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[a]}:a,l=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),c=[wg.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{fk.getField(e).each(wg.disable)},onEnabled:e=>{fk.getField(e).each(wg.enable)}}),gx()];return xk(o,i,l,c)},lO=(e,t)=>t.getAnimationRoot.fold((()=>e.element),(t=>t(e))),cO=e=>e.dimension.property,dO=(e,t)=>e.dimension.getDimension(t),mO=(e,t)=>{const o=lO(e,t);ii(o,[t.shrinkingClass,t.growingClass])},uO=(e,t)=>{ni(e.element,t.openClass),ti(e.element,t.closedClass),Mt(e.element,cO(t),"0px"),zt(e.element)},gO=(e,t)=>{ni(e.element,t.closedClass),ti(e.element,t.openClass),Ft(e.element,cO(t))},hO=(e,t,o,n)=>{o.setCollapsed(),Mt(e.element,cO(t),dO(t,e.element)),mO(e,t),uO(e,t),t.onStartShrink(e),t.onShrunk(e)},pO=(e,t,o,n)=>{const r=n.getOrThunk((()=>dO(t,e.element)));o.setCollapsed(),Mt(e.element,cO(t),r),zt(e.element);const s=lO(e,t);ni(s,t.growingClass),ti(s,t.shrinkingClass),uO(e,t),t.onStartShrink(e)},fO=(e,t,o)=>{const n=dO(t,e.element);("0px"===n?hO:pO)(e,t,o,D.some(n))},vO=(e,t,o)=>{const n=lO(e,t),r=si(n,t.shrinkingClass),s=dO(t,e.element);gO(e,t);const a=dO(t,e.element);(r?()=>{Mt(e.element,cO(t),s),zt(e.element)}:()=>{uO(e,t)})(),ni(n,t.shrinkingClass),ti(n,t.growingClass),gO(e,t),Mt(e.element,cO(t),a),o.setExpanded(),t.onStartGrow(e)},bO=(e,t,o)=>{const n=lO(e,t);return!0===si(n,t.growingClass)},yO=(e,t,o)=>{const n=lO(e,t);return!0===si(n,t.shrinkingClass)};var wO=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){Ft(e.element,cO(t));const o=dO(t,e.element);Mt(e.element,cO(t),o)}},grow:(e,t,o)=>{o.isExpanded()||vO(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&fO(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&hO(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:bO,isShrinking:yO,isTransitioning:(e,t,o)=>bO(e,t)||yO(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?fO:vO)(e,t,o)},disableTransitions:mO,immediateGrow:(e,t,o)=>{o.isExpanded()||(gO(e,t),Mt(e.element,cO(t),dO(t,e.element)),mO(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}});var xO=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return Fa(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:Fr(t.dimension.property,"0px")})},events:(e,t)=>Ys([aa(gs(),((o,n)=>{if(n.event.raw.propertyName===e.dimension.property){mO(o,e),t.isExpanded()&&Ft(o.element,e.dimension.property);(t.isExpanded()?e.onGrown:e.onShrunk)(o)}}))])}),CO=[dr("closedClass"),dr("openClass"),dr("shrinkingClass"),dr("growingClass"),yr("getAnimationRoot"),el("onShrunk"),el("onStartShrink"),el("onGrown"),el("onStartGrow"),Tr("expanded",!1),mr("dimension",sr("property",{width:[rl("property","width"),rl("getDimension",(e=>Xt(e)+"px"))],height:[rl("property","height"),rl("getDimension",(e=>Ut(e)+"px"))]}))];const SO=Kl({fields:CO,name:"sliding",active:xO,apis:wO,state:Object.freeze({__proto__:null,init:e=>{const t=Hr(e.expanded);return Ia({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:S(t.set,!1),setExpanded:S(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),kO=e=>({isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t),setActive:t=>{const o=e.element;t?(ti(o,"tox-tbtn--enabled"),St(o,"aria-pressed",!0)):(ni(o,"tox-tbtn--enabled"),Ot(o,"aria-pressed"))},isActive:()=>si(e.element,"tox-tbtn--enabled"),setText:t=>{Ws(e,zT,{text:t})},setIcon:t=>Ws(e,VT,{icon:t})}),_O=(e,t,o,n,r=!0)=>ZT({text:e.text,icon:e.icon,tooltip:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const r={pattern:e.search.isSome()?VS(t):""};e.fetch((t=>{n(qT(t,oy.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))}),r,kO(t))},onSetup:e.onSetup,getApi:kO,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...r?[yk.config({})]:[]]},t,o.shared),EO=(e,t,o)=>{const n=e=>n=>{const r=!n.isActive();n.setActive(r),e.storage.set(r),o.shared.getSink().each((o=>{t().getOpt(o).each((t=>{tc(t.element),Ws(t,Ok,{name:e.name,value:e.storage.get()})}))}))},r=e=>t=>{t.setActive(e.storage.get())};return t=>{t(F(e,(e=>{const t=e.text.fold((()=>({})),(e=>({text:e})));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:r(e)}})))}},TO=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{title:e,"aria-label":e}},components:[Ci(e)]}),OO=ya("leaf-label-event-id"),DO=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:r,backstage:s})=>{const a=e.menu.map((e=>_O(e,"tox-mbtn",s,D.none(),o))),i=[TO(e.title)];return a.each((e=>i.push(e))),Nf.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:{[is()]:[OO,"keying"]},buttonBehaviours:ql([...o?[yk.config({})]:[],Yp.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),Ql.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?Yp.on:Yp.off)(t)}}}}),Ip(OO,[ia(((t,o)=>{r.each((o=>{(o===e.id?Yp.on:Yp.off)(t)}))})),Qs(is(),((e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(Ni(e.element,".tox-tree--directory").each((t=>{e.getSystem().getByDom(t).each((e=>{Ri(t,".tox-tree--directory__label").each((t=>{e.getSystem().getByDom(t).each(Zp.focus)}))}))})),t.stop()):n&&t.stop()}))])])})},AO=(e,t)=>((e,t,o)=>zv(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:o},t))(e,t,[]),MO=ya("directory-label-event-id"),NO=({directory:e,visible:t,noChildren:o,backstage:n})=>{const r=e.menu.map((e=>_O(e,"tox-mbtn",n,D.none()))),s=[{dom:{tag:"div",classes:["tox-chevron"]},components:[AO("chevron-right",n.shared.providers.icons)]},TO(e.title)];r.each((e=>{s.push(e)}));const a=t=>{Ni(t.element,".tox-tree--directory").each((o=>{t.getSystem().getByDom(o).each((o=>{const n=!Yp.isOn(o);Yp.toggle(o),Ws(t,"expand-tree-node",{expanded:n,node:e.id})}))}))};return Nf.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:s,action:a,eventOrder:{[is()]:[MO,"keying"]},buttonBehaviours:ql([...t?[yk.config({})]:[],Ip(MO,[Qs(is(),((e,t)=>{const n="ArrowRight"===t.event.raw.code,r="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||r)&&Ni(e.element,".tox-tree--directory").each((o=>{e.getSystem().getByDom(o).each((o=>{!Yp.isOn(o)&&n||Yp.isOn(o)&&r?(a(e),t.stop()):r&&!Yp.isOn(o)&&(Ni(o.element,".tox-tree--directory").each((e=>{Ri(e,".tox-tree--directory__label").each((e=>{o.getSystem().getByDom(e).each(Zp.focus)}))})),t.stop())}))}))}))])])})},RO=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:r,selectedId:s,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map((e=>"leaf"===e.type?DO({leaf:e,selectedId:s,onLeafAction:t,visible:o,treeId:n,backstage:a}):LO({directory:e,expandedIds:r,selectedId:s,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a}))),behaviours:ql([SO.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}),Hp.config({})])}),BO=ya("directory-event-id"),LO=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:r,expandedIds:s,selectedId:a})=>{const{children:i}=e,l=Hr(s),c=s.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[NO({directory:e,visible:o,noChildren:0===e.children.length,backstage:r}),RO({children:i,expandedIds:s,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:r})],behaviours:ql([Ip(BO,[ia(((e,t)=>{Yp.set(e,c)})),Qs("expand-tree-node",((e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter((e=>e!==n)))}))]),Yp.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const s=e.components()[1],c=(d=o,i.map((e=>"leaf"===e.type?DO({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:r}):LO({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:r}))));var d;o?SO.grow(s):SO.shrink(s),Hp.set(s,c)}})])}},HO=ya("tree-event-id");var IO=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Ys([Qs(e.event,o),la((()=>t.cancel()))].concat(e.cancelEvent.map((e=>[Qs(e,(()=>t.cancel()))])).getOr([])))}});const PO=e=>{const t=Hr(null);return Ia({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var FO=Object.freeze({__proto__:null,throttle:PO,init:e=>e.stream.streams.state(e)});var zO=[mr("stream",sr("mode",{throttle:[dr("delay"),Tr("stopEvent",!0),rl("streams",{setup:(e,t)=>{const o=e.stream,n=iT(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:PO})]})),Tr("event","input"),yr("cancelEvent"),ol("onStream")];const VO=Kl({fields:zO,name:"streaming",active:IO,state:FO}),ZO=(e,t,o)=>{const n=Xm.getValue(o);Xm.setValue(t,n),jO(t)},UO=(e,t)=>{const o=e.element,n=ci(o),r=o.dom;"number"!==_t(o,"type")&&t(r,n)},jO=e=>{UO(e,((e,t)=>e.setSelectionRange(t.length,t.length)))},WO=(e,t,o)=>{if(e.selectsOver){const n=Xm.getValue(t),r=e.getDisplayText(n),s=Xm.getValue(o);return 0===e.getDisplayText(s).indexOf(r)?D.some((()=>{ZO(0,t,o),((e,t)=>{UO(e,((e,o)=>e.setSelectionRange(t,o.length)))})(t,r.length)})):D.none()}return D.none()},$O=w("alloy.typeahead.itemexecute"),qO=w([yr("lazySink"),dr("fetch"),Tr("minChars",5),Tr("responseTime",1e3),el("onOpen"),Tr("getHotspot",D.some),Tr("getAnchorOverrides",w({})),Tr("layouts",D.none()),Tr("eventOrder",{}),Lr("model",{},[Tr("getDisplayText",(e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value)),Tr("selectsOver",!0),Tr("populateFromBrowse",!0)]),el("onSetValue"),tl("onExecute"),el("onItemExecute"),Tr("inputClasses",[]),Tr("inputAttributes",{}),Tr("inputStyles",{}),Tr("matchWidth",!0),Tr("useMinWidth",!1),Tr("dismissOnBlur",!0),Ji(["openClass"]),yr("initialData"),Jm("typeaheadBehaviours",[Zp,Xm,VO,Tp,Yp,pS]),lr("lazyTypeaheadComp",(()=>Hr(D.none))),lr("previewing",(()=>Hr(!0)))].concat(xy()).concat(RS())),GO=w([Ou({schema:[Xi()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each((t=>{WO(e.model,t,n).fold((()=>{e.model.selectsOver?(Mg.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&&ZO(e.model,t,n),Et(n.element,"id").each((e=>St(t.element,"aria-activedescendant",e)))}))},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map((e=>(Ws(e,$O(),{item:o}),!0))),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&ZO(e.model,t,o)}))}})})]),KO=og({name:"Typeahead",configFields:qO(),partFields:GO(),factory:(e,t,o,n)=>{const r=(t,o,r)=>{e.previewing.set(!1);const s=pS.getCoupled(t,"sandbox");if(Mm.isOpen(s))ag.getCurrent(s).each((e=>{Mg.getHighlighted(e).fold((()=>{r(e)}),(()=>{Ks(s,e.element,"keydown",o)}))}));else{const o=e=>{ag.getCurrent(e).each(r)};_S(e,a(t),t,s,n,o,Tf.HighlightMenuAndItem).get(v)}},s=Cy(e),a=e=>t=>t.map((t=>{const o=fe(t.menus),n=G(o,(e=>Z(e.items,(e=>"item"===e.type))));return Xm.getState(e).update(F(n,(e=>e.data))),t})),i=e=>ag.getCurrent(e),l="typeaheadevents",c=[Zp.config({}),Xm.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>ci(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{di(t.element,e.model.getDisplayText(o))},...e.initialData.map((e=>Fr("initialValue",e))).getOr({})}}),VO.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const r=pS.getCoupled(t,"sandbox");if(Zp.isFocused(t)&&ci(t.element).length>=e.minChars){const o=i(r).bind((e=>Mg.getHighlighted(e).map(Xm.getValue)));e.previewing.set(!0);const s=t=>{i(r).each((t=>{o.fold((()=>{e.model.selectsOver&&Mg.highlightFirst(t)}),(e=>{Mg.highlightBy(t,(t=>Xm.getValue(t).value===e.value)),Mg.getHighlighted(t).orThunk((()=>(Mg.highlightFirst(t),D.none())))}))}))};_S(e,a(t),t,r,n,s,Tf.HighlightJustMenu).get(v)}},cancelEvent:Ts()}),Tp.config({mode:"special",onDown:(e,t)=>(r(e,t,Mg.highlightFirst),D.some(!0)),onEscape:e=>{const t=pS.getCoupled(e,"sandbox");return Mm.isOpen(t)?(Mm.close(t),D.some(!0)):D.none()},onUp:(e,t)=>(r(e,t,Mg.highlightLast),D.some(!0)),onEnter:t=>{const o=pS.getCoupled(t,"sandbox"),n=Mm.isOpen(o);if(n&&!e.previewing.get())return i(o).bind((e=>Mg.getHighlighted(e))).map((e=>(Ws(t,$O(),{item:e}),!0)));{const r=Xm.getValue(t);return js(t,Ts()),e.onExecute(o,t,r),n&&Mm.close(o),D.some(!0)}}}),Yp.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),pS.config({others:{sandbox:t=>MS(e,t,{onOpen:()=>Yp.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each((e=>Ot(e.element,"aria-activedescendant"))),Yp.off(t)}})}}),Ip(l,[ia((t=>{e.lazyTypeaheadComp.set(D.some(t))})),la((t=>{e.lazyTypeaheadComp.set(D.none())})),da((t=>{const o=v;TS(e,a(t),t,n,o,Tf.HighlightMenuAndItem).get(v)})),Qs($O(),((t,o)=>{const n=pS.getCoupled(t,"sandbox");ZO(e.model,t,o.event.item),js(t,Ts()),e.onItemExecute(t,n,o.event.item,Xm.getValue(t)),Mm.close(n),jO(t)}))].concat(e.dismissOnBlur?[Qs(ys(),(e=>{const t=pS.getCoupled(e,"sandbox");sc(t.element).isNone()&&Mm.close(t)}))]:[]))],d={[Bs()]:[Xm.name(),VO.name(),l],...e.eventOrder};return{uid:e.uid,dom:ky(xn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...s,...eu(e.typeaheadBehaviours,c)},eventOrder:d}}}),YO=e=>({...e,toCached:()=>YO(e.toCached()),bindFuture:t=>YO(e.bind((e=>e.fold((e=>xS(on.error(e))),(e=>t(e)))))),bindResult:t=>YO(e.map((e=>e.bind(t)))),mapResult:t=>YO(e.map((e=>e.map(t)))),mapError:t=>YO(e.map((e=>e.mapError(t)))),foldResult:(t,o)=>e.map((e=>e.fold(t,o))),withTimeout:(t,o)=>YO(wS((n=>{let r=!1;const s=setTimeout((()=>{r=!0,n(on.error(o()))}),t);e.get((e=>{r||(clearTimeout(s),n(e))}))})))}),XO=e=>YO(wS(e)),JO=XO,QO=(e,t,o=[],n,r,s)=>{const a=t.fold((()=>({})),(e=>({action:e}))),i={buttonBehaviours:ql([px((()=>!e.enabled||s.isDisabled())),gx(),yk.config({}),Ip("button press",[Js("click"),Js("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...a},l=xn(i,{dom:n});return xn(l,{components:r})},eD=(e,t,o,n=[])=>{const r={tag:"button",classes:["tox-tbtn"],attributes:e.tooltip.map((e=>({"aria-label":o.translate(e),title:o.translate(e)}))).getOr({})},s=e.icon.map((e=>IT(e,o.icons))),a=Sx([s]);return QO(e,t,n,r,a,o)},tD=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},oD=(e,t,o,n=[],r=[])=>{const s=o.translate(e.text),a=e.icon.map((e=>IT(e,o.icons))),i=[a.getOrThunk((()=>Ci(s)))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c=[...tD(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...r];return QO(e,t,n,{tag:"button",classes:c,attributes:{title:s}},i,o)},nD=(e,t,o,n=[],r=[])=>{const s=oD(e,D.some(t),o,n,r);return Nf.sketch(s)},rD=(e,t)=>o=>{"custom"===t?Ws(o,Ok,{name:e,value:{}}):"submit"===t?js(o,Dk):"cancel"===t?js(o,Tk):console.error("Unknown button type: ",t)},sD=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>s,n=e,r={...e,type:"menubutton",search:D.none(),onSetup:t=>(t.setEnabled(e.enabled),v),fetch:EO(n.items,t,o)},s=Bf(_O(r,"tox-tbtn",o,D.none()));return s.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=rD(e.name,t),r={...e,borderless:!1};return nD(r,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t)=>{var o,n;const r=e.icon.map((e=>PT(e,t.icons))).map(Bf),s=e.buttonType.getOr(e.primary?"primary":"secondary"),a={...e,name:null!==(o=e.name)&&void 0!==o?o:"",primary:"primary"===s,tooltip:D.from(e.tooltip),enabled:null!==(n=e.enabled)&&void 0!==n&&n,borderless:!1},i=a.tooltip.map((e=>({"aria-label":t.translate(e),title:t.translate(e)}))).getOr({}),l=tD(null!=s?s:"secondary"),c=e.icon.isSome()&&e.text.isSome(),d={tag:"button",classes:[...l.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...c?["tox-button--icon-and-text"]:[]],attributes:i},m=t.translate(e.text.getOr("")),u=Ci(m),g=[...Sx([r.map((e=>e.asSpec()))]),...e.text.isSome()?[u]:[]],h=QO(a,D.some((o=>{Ws(o,Ok,{name:e.name,value:{setIcon:e=>{r.map((n=>n.getOpt(o).each((o=>{Hp.set(o,[PT(e,t.icons)])}))))}}})})),[],d,g,t);return Nf.sketch(h)})(e,o.shared.providers);throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},aD=(e,t)=>{const o=rD(e.name,"custom");return n=D.none(),r=fk.parts.field({factory:Nf,...oD(e,D.some(o),t,[tT(""),GE()])}),xk(n,r,[],[]);var n,r},iD={type:"separator"},lD=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:v}),cD=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:v}),dD=(e,t)=>(e=>F(e,lD))(((e,t)=>Z(t,(t=>t.type===e)))(e,t)),mD=e=>dD("header",e.targets),uD=e=>dD("anchor",e.targets),gD=e=>D.from(e.anchorTop).map((e=>cD("",e))).toArray(),hD=e=>D.from(e.anchorBottom).map((e=>cD("",e))).toArray(),pD=(e,t)=>{const o=e.toLowerCase();return Z(t,(e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,r=null!==(t=e.value)&&void 0!==t?t:"";return Te(n.toLowerCase(),o)||Te(r.toLowerCase(),o)}))},fD=(e,t,o)=>{var n,r;const s=Xm.getValue(t),a=null!==(r=null===(n=null==s?void 0:s.meta)||void 0===n?void 0:n.text)&&void 0!==r?r:s.value;return o.getLinkInformation().fold((()=>[]),(t=>{const n=pD(a,(e=>F(e,(e=>cD(e,e))))(o.getHistory(e)));return"file"===e?(r=[n,pD(a,mD(t)),pD(a,q([gD(t),uD(t),hD(t)]))],j(r,((e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(iD,t)),[])):n;var r}))},vD=ya("aria-invalid"),bD=(e,t)=>{e.dom.checked=t},yD=e=>e.dom.checked,wD=e=>(t,o,n,r)=>ve(o,"name").fold((()=>e(o,r,D.none())),(s=>t.field(s,e(o,r,ve(n,s))))),xD={bar:wD(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:F(e.items,t.interpreter)}))(e,t.shared))),collection:wD(((e,t,o)=>Bk(e,t.shared.providers,o))),alertbanner:wD(((e,t)=>((e,t)=>{const o=Iv(e.icon,t.icons);return uk.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?[Nf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>Ws(t,Ok,{name:"alert-banner",value:e.url}),buttonBehaviours:ql([Pv()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers))),input:wD(((e,t,o)=>((e,t,o)=>iO({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:D.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),textarea:wD(((e,t,o)=>((e,t,o)=>iO({name:e.name,multiline:!0,label:e.label,inputMode:D.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:D.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),label:wD(((e,t)=>((e,t)=>{const o="tox-label";return{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"label",classes:[o,..."center"===e.align?[`${o}--center`]:[],..."end"===e.align?[`${o}--end`]:[]]},components:[Ci(t.providers.translate(e.label))]},...F(e.items,t.interpreter)],behaviours:ql([GE(),Hp.config({}),(n=D.none(),eT(n,ma,ua)),Tp.config({mode:"acyclic"})])};var n})(e,t.shared))),iframe:(e=>(t,o,n,r)=>{const s=xn(o,{source:"dynamic"});return wD(e)(t,s,n,r)})(((e,t,o)=>AT(e,t.shared.providers,o))),button:wD(((e,t)=>aD(e,t.shared.providers))),checkbox:wD(((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),D.some(!0)),r=fk.parts.field({factory:{sketch:x},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ql([GE(),wg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{rt(e.element).each((e=>ti(e,"tox-checkbox--disabled")))},onEnabled:e=>{rt(e.element).each((e=>ni(e,"tox-checkbox--disabled")))}}),yk.config({}),Zp.config({}),eT(o,yD,bD),Tp.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),Ip("checkbox-events",[Qs(ds(),((t,o)=>{Ws(t,_k,{name:e.name})}))])])}),s=fk.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[Ci(t.translate(e.label))],behaviours:ql([Wk.config({})])}),a=e=>zv("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Bf({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return fk.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[r,i.asSpec(),s],fieldBehaviours:ql([wg.config({disabled:()=>!e.enabled||t.isDisabled()}),gx()])})})(e,t.shared.providers,o))),colorinput:wD(((e,t,o)=>Kk(e,t.shared,t.colorinput,o))),colorpicker:wD(((e,t,o)=>nT(0,t.shared.providers,o))),dropzone:wD(((e,t,o)=>aT(e,t.shared.providers,o))),grid:wD(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:F(e.items,t.interpreter)}))(e,t.shared))),listbox:wD(((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,r=o.bind((t=>XT(e.items,t))).orThunk((()=>oe(e.items).filter(GT))),s=e.label.map((e=>kk(e,n))),a=fk.parts.field({dom:{},factory:{sketch:o=>ZT({uid:o.uid,text:r.map((e=>e.text)),icon:D.none(),tooltip:e.label,role:D.none(),fetch:(o,n)=>{const r=YT(o,e.name,e.items,Xm.getValue(o));n(qT(r,oy.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:D.none()}))},onSetup:w(v),getApi:w({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[yk.config({}),QE(r.map((e=>e.value)),(e=>_t(e.element,KT)),((t,o)=>{XT(e.items,o).each((e=>{St(t.element,KT,e.value),Ws(t,zT,{text:e.text})}))}))]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return fk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([s.toArray(),[i]]),fieldBehaviours:ql([wg.config({disabled:w(!e.enabled),onDisabled:e=>{fk.getField(e).each(wg.disable)},onEnabled:e=>{fk.getField(e).each(wg.enable)}})])})})(e,t,o))),selectbox:wD(((e,t,o)=>((e,t,o)=>{const n=F(e.items,(e=>({text:t.translate(e.text),value:e.value}))),r=e.label.map((e=>kk(e,t))),s=fk.parts.field({dom:{},...o.map((e=>({data:e}))).getOr({}),selectAttributes:{size:e.size},options:n,factory:JT,selectBehaviours:ql([wg.config({disabled:()=>!e.enabled||t.isDisabled()}),yk.config({}),Ip("selectbox-change",[Qs(ds(),((t,o)=>{Ws(t,_k,{name:e.name})}))])])}),a=e.size>1?D.none():D.some(zv("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[s],a.toArray()])};return fk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([r.toArray(),[i]]),fieldBehaviours:ql([wg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{fk.getField(e).each(wg.disable)},onEnabled:e=>{fk.getField(e).each(wg.enable)}}),gx()])})})(e,t.shared.providers,o))),sizeinput:wD(((e,t)=>((e,t)=>{let o=sO;const n=ya("ratio-event"),r=e=>zv(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),s=oO.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:t.translate(e.label.getOr("Constrain proportions"))}},components:[r("lock"),r("unlock")],buttonBehaviours:ql([wg.config({disabled:()=>!e.enabled||t.isDisabled()}),gx(),yk.config({})])}),a=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),i=o=>fk.parts.field({factory:_y,inputClasses:["tox-textfield"],inputBehaviours:ql([wg.config({disabled:()=>!e.enabled||t.isDisabled()}),gx(),yk.config({}),Ip("size-input-events",[Qs(ss(),((e,t)=>{Ws(e,n,{isField1:o})})),Qs(ds(),((t,o)=>{Ws(t,_k,{name:e.name})}))])]),selectOnFocus:!1}),l=e=>({dom:{tag:"label",classes:["tox-label"]},components:[Ci(t.translate(e))]}),c=oO.parts.field1(a([fk.parts.label(l("Width")),i(!0)])),d=oO.parts.field2(a([fk.parts.label(l("Height")),i(!1)]));return oO.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,d,a([l(" "),s])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{nO(Xm.getValue(e)).each((e=>{o(e).each((e=>{Xm.setValue(t,(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})(e))}))}))},coupledFieldBehaviours:ql([wg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{oO.getField1(e).bind(fk.getField).each(wg.disable),oO.getField2(e).bind(fk.getField).each(wg.disable),oO.getLock(e).each(wg.disable)},onEnabled:e=>{oO.getField1(e).bind(fk.getField).each(wg.enable),oO.getField2(e).bind(fk.getField).each(wg.enable),oO.getLock(e).each(wg.enable)}}),gx(),Ip("size-input-events2",[Qs(n,((e,t)=>{const n=t.event.isField1,r=n?oO.getField1(e):oO.getField2(e),s=n?oO.getField2(e):oO.getField1(e),a=r.map(Xm.getValue).getOr(""),i=s.map(Xm.getValue).getOr("");o=aO(a,i)}))])])})})(e,t.shared.providers))),slider:wD(((e,t,o)=>((e,t,o)=>{const n=NE.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Ci(t.translate(e.label))]}),r=NE.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),s=NE.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return NE.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:w(o.getOrThunk((()=>(Math.abs(e.max)-Math.abs(e.min))/2)))},components:[n,r,s],sliderBehaviours:ql([GE(),Zp.config({})]),onChoose:(t,o,n)=>{Ws(t,_k,{name:e.name,value:n})}})})(e,t.shared.providers,o))),urlinput:wD(((e,t,o)=>((e,t,o,n)=>{const r=t.shared.providers,s=t=>{const n=Xm.getValue(t);o.addToHistory(n.value,e.filetype)},a={...n.map((e=>({initialData:e}))).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":vD,type:"url"},minChars:0,responseTime:0,fetch:n=>{const r=fD(e.filetype,n,o),s=qT(r,oy.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:D.none()});return xS(s)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(jk)&&jk.run(e).get(v)},typeaheadBehaviours:ql([...o.getValidationHandler().map((t=>jk.config({getRoot:e=>rt(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each((e=>{St(e.element,"title",r.translate(t))}))}},validator:{validate:o=>{const n=Xm.getValue(o);return JO((o=>{t({type:e.filetype,url:n.value},(e=>{if("invalid"===e.status){const t=on.error(e.message);o(t)}else{const t=on.value(e.message);o(t)}}))}))},validateOnLoad:!1}}))).toArray(),wg.config({disabled:()=>!e.enabled||r.isDisabled()}),yk.config({}),Ip("urlinput-events",[Qs(cs(),(t=>{const o=ci(t.element),n=o.trim();n!==o&&di(t.element,n),"file"===e.filetype&&Ws(t,_k,{name:e.name})})),Qs(ds(),(t=>{Ws(t,_k,{name:e.name}),s(t)})),Qs(ws(),(t=>{Ws(t,_k,{name:e.name}),s(t)}))])]),eventOrder:{[cs()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:wy(0,0,"normal")},onExecute:(e,t,o)=>{Ws(t,Dk,{})},onItemExecute:(t,o,n,r)=>{s(t),Ws(t,_k,{name:e.name})}},i=fk.parts.field({...a,factory:KO}),l=e.label.map((e=>kk(e,r))),c=Bf(((e,t,o=e,n=e)=>zv(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:r.translate(n),"aria-live":"polite",...t.fold((()=>({})),(e=>({id:e})))}},r.icons))("invalid",D.some(vD),"warning")),d=Bf({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),m=o.getUrlPicker(e.filetype),u=ya("browser.url.event"),g=Bf({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:ql([wg.config({disabled:()=>!e.enabled||r.isDisabled()})])}),h=Bf(nD({name:e.name,icon:D.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:D.none(),borderless:!0},(e=>js(e,u)),r,[],["tox-browse-url"]));return fk.sketch({dom:Sk([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[g.asSpec()],m.map((()=>h.asSpec())).toArray()])}]),fieldBehaviours:ql([wg.config({disabled:()=>!e.enabled||r.isDisabled(),onDisabled:e=>{fk.getField(e).each(wg.disable),h.getOpt(e).each(wg.disable)},onEnabled:e=>{fk.getField(e).each(wg.enable),h.getOpt(e).each(wg.enable)}}),gx(),Ip("url-input-events",[Qs(u,(t=>{ag.getCurrent(t).each((o=>{const n=Xm.getValue(o),r={fieldname:e.name,...n};m.each((n=>{n(r).get((n=>{Xm.setValue(o,n),Ws(t,_k,{name:e.name})}))}))}))}))])])})})(e,t,t.urlinput,o))),customeditor:wD((e=>{const t=kc(),o=Bf({dom:{tag:e.tag}}),n=kc();return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ql([Ip("custom-editor-events",[ia((r=>{o.getOpt(r).each((o=>{((e=>be(e,"init"))(e)?e.init(o.element.dom):rT.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)}))}))}))]),QE(D.none(),(()=>t.get().fold((()=>n.get().getOr("")),(e=>e.getValue()))),((e,o)=>{t.get().fold((()=>n.set(o)),(e=>e.setValue(o)))})),GE()]),components:[o.asSpec()]}})),htmlpanel:wD((e=>"presentation"===e.presets?uk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html}}):uk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:ql([yk.config({}),Zp.config({})])}))),imagepreview:wD(((e,t,o)=>MT(e,o))),table:wD(((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"th",innerHtml:t.translate(e)}}),n=e=>({dom:{tag:"td",innerHtml:t.translate(e)}}),r=e=>({dom:{tag:"tr"},components:F(e,n)});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(a=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:F(a,o)}]}),(s=e.cells,{dom:{tag:"tbody"},components:F(s,r)})],behaviours:ql([yk.config({}),Zp.config({})])};var s,a})(e,t.shared.providers))),tree:wD(((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(v),n=e.onToggleExpand.getOr(v),r=e.defaultExpandedIds,s=Hr(r),a=Hr(e.defaultSelectedId),i=ya("tree-id"),l=(n,r)=>e.items.map((e=>"leaf"===e.type?DO({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):LO({directory:e,selectedId:n,onLeafAction:o,expandedIds:r,labelTabstopping:!0,treeId:i,backstage:t})));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),s.get()),behaviours:ql([Tp.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),Ip(HO,[Qs("expand-tree-node",((e,t)=>{const{expanded:o,node:r}=t.event;s.set(o?[...s.get(),r]:s.get().filter((e=>e!==r))),n(s.get(),{expanded:o,node:r})}))]),Ql.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(D.some(t.value)),Hp.set(e,l(D.some(t.value),s.get()))}}}}),Hp.config({})])}})(e,t))),panel:wD(((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:F(e.items,t.shared.interpreter)}))(e,t)))},CD={field:(e,t)=>t,record:w([])},SD=(e,t,o,n)=>{const r=xn(n,{shared:{interpreter:t=>kD(e,t,o,r)}});return kD(e,t,o,r)},kD=(e,t,o,n)=>ve(xD,t.type).fold((()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t)),(r=>r(e,t,o,n))),_D=(e,t,o)=>kD(CD,e,t,o),ED="layout-inset",TD=e=>e.x,OD=(e,t)=>e.x+e.width/2-t.width/2,DD=(e,t)=>e.x+e.width-t.width,AD=e=>e.y,MD=(e,t)=>e.y+e.height-t.height,ND=(e,t)=>e.y+e.height/2-t.height/2,RD=(e,t,o)=>il(DD(e,t),MD(e,t),o.insetSouthwest(),ul(),"southwest",yl(e,{right:0,bottom:3}),ED),BD=(e,t,o)=>il(TD(e),MD(e,t),o.insetSoutheast(),ml(),"southeast",yl(e,{left:1,bottom:3}),ED),LD=(e,t,o)=>il(DD(e,t),AD(e),o.insetNorthwest(),dl(),"northwest",yl(e,{right:0,top:2}),ED),HD=(e,t,o)=>il(TD(e),AD(e),o.insetNortheast(),cl(),"northeast",yl(e,{left:1,top:2}),ED),ID=(e,t,o)=>il(OD(e,t),AD(e),o.insetNorth(),gl(),"north",yl(e,{top:2}),ED),PD=(e,t,o)=>il(OD(e,t),MD(e,t),o.insetSouth(),hl(),"south",yl(e,{bottom:3}),ED),FD=(e,t,o)=>il(DD(e,t),ND(e,t),o.insetEast(),fl(),"east",yl(e,{right:0}),ED),zD=(e,t,o)=>il(TD(e),ND(e,t),o.insetWest(),pl(),"west",yl(e,{left:1}),ED),VD=e=>{switch(e){case"north":return ID;case"northeast":return HD;case"northwest":return LD;case"south":return PD;case"southeast":return BD;case"southwest":return RD;case"east":return FD;case"west":return zD}},ZD=(e,t,o,n,r)=>yc(n).map(VD).getOr(ID)(e,t,o,n,r),UD=e=>{switch(e){case"north":return PD;case"northeast":return BD;case"northwest":return RD;case"south":return ID;case"southeast":return HD;case"southwest":return LD;case"east":return zD;case"west":return FD}},jD=(e,t,o,n,r)=>yc(n).map(UD).getOr(ID)(e,t,o,n,r),WD={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},$D=(e,t,o)=>{const n={maxHeightFunction:Fc()};return()=>o()?{type:"node",root:pt(ht(e())),node:D.from(e()),bubble:Uc(12,12,WD),layouts:{onRtl:()=>[HD],onLtr:()=>[LD]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:Uc(-12,12,WD),layouts:{onRtl:()=>[Tl,Ol,Nl],onLtr:()=>[Ol,Tl,Nl]},overrides:n}},qD=(e,t,o,n)=>{const r={maxHeightFunction:Fc()};return()=>n()?{type:"node",root:pt(ht(t())),node:D.from(t()),bubble:Uc(12,12,WD),layouts:{onRtl:()=>[ID],onLtr:()=>[ID]},overrides:r}:e?{type:"node",root:pt(ht(t())),node:D.from(t()),bubble:Uc(0,-jt(t()),WD),layouts:{onRtl:()=>[Ml],onLtr:()=>[Ml]},overrides:r}:{type:"hotspot",hotspot:o(),bubble:Uc(0,0,WD),layouts:{onRtl:()=>[Ml],onLtr:()=>[Ml]},overrides:r}},GD=(e,t,o)=>()=>o()?{type:"node",root:pt(ht(e())),node:D.from(e()),layouts:{onRtl:()=>[ID],onLtr:()=>[ID]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[Nl],onLtr:()=>[Nl]}},KD=(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:Le.fromDom(e),lastCell:Le.fromDom(t)};return D.some(n)}return D.some(fd.range(Le.fromDom(t.startContainer),t.startOffset,Le.fromDom(t.endContainer),t.endOffset))}}),YD=e=>t=>({type:"node",root:e(),node:t}),XD=(e,t,o,n)=>{const r=Wb(e),s=()=>Le.fromDom(e.getBody()),a=()=>Le.fromDom(e.getContentAreaContainer()),i=()=>r||!n();return{inlineDialog:$D(a,t,i),inlineBottomDialog:qD(e.inline,a,o,i),banner:GD(a,t,i),cursor:KD(e,s),node:YD(s)}},JD=e=>(t,o)=>{GC(e)(t,o)},QD=e=>()=>RC(e),eA=e=>t=>DC(e,t),tA=e=>t=>NC(e,t),oA=e=>()=>_b(e),nA=e=>ye(e,"items"),rA=e=>ye(e,"format"),sA=[{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"}]}],aA=e=>j(e,((e,t)=>{if(be(t,"items")){const o=aA(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if((e=>be(e,"inline"))(t)||(e=>be(e,"block"))(t)||(e=>be(e,"selector"))(t)){const o=`custom-${s(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:[]}),iA=e=>rb(e).map((t=>{const o=((e,t)=>{const o=aA(t),n=t=>{z(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 sb(e)?sA.concat(o):o})).getOr(sA),lA=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),cA=(e,t,o,n)=>{const r=t=>F(t,(t=>nA(t)?(e=>{const t=r(e.items);return{...e,type:"submenu",getStyleItems:w(t)}})(t):rA(t)?(e=>lA(e,o,n))(t):(e=>{const t=ae(e);return 1===t.length&&L(t,"title")})(t)?{...t,type:"separator"}:(t=>{const r=s(t.name)?t.name:ya(t.title),a=`custom-${r}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(r,i),i})(t)));return r(t)},dA=sT.trim,mA=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},uA=mA("true"),gA=mA("false"),hA=(e,t,o,n,r)=>({type:e,title:t,url:o,level:n,attach:r}),pA=e=>e.innerText||e.textContent,fA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&bA(e),vA=e=>e&&/^(H[1-6])$/.test(e.nodeName),bA=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return uA(t)}return!1})(e)&&!gA(e),yA=e=>vA(e)&&bA(e),wA=e=>{var t;const o=(e=>e.id?e.id:ya("h"))(e);return hA("header",null!==(t=pA(e))&&void 0!==t?t:"","#"+o,(e=>vA(e)?parseInt(e.nodeName.substr(1),10):0)(e),(()=>{e.id=o}))},xA=e=>{const t=e.id||e.name,o=pA(e);return hA("anchor",o||"#"+t,"#"+t,0,v)},CA=e=>{const t=(o="h1,h2,h3,h4,h5,h6,a:not([href])",n=e,F(_d(Le.fromDom(n),o),(e=>e.dom)));var o,n;return t},SA=e=>dA(e.title).length>0,kA=e=>{const t=CA(e);return Z((e=>F(Z(e,yA),wA))(t).concat((e=>F(Z(e,fA),xA))(t)),SA)},_A="tinymce-url-history",EA=e=>s(e)&&/^https?/.test(e),TA=e=>a(e)&&pe(e,(e=>{return!(l(t=e)&&t.length<=5&&K(t,EA));var t})).isNone(),OA=()=>{const e=fC.getItem(_A);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+_A+" was not valid JSON",e),{};throw e}return TA(t)?t:(console.log("Local storage "+_A+" was not valid format",t),{})},DA=e=>{const t=OA();return ve(t,e).getOr([])},AA=(e,t)=>{if(!EA(e))return;const o=OA(),n=ve(o,t).getOr([]),r=Z(n,(t=>t!==e));o[t]=[e].concat(r).slice(0,5),(e=>{if(!TA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));fC.setItem(_A,JSON.stringify(e))})(o)},MA=e=>!!e,NA=e=>ce(sT.makeMap(e,/[, ]/),MA),RA=e=>D.from(bb(e)),BA=(e,t)=>{const o=(e=>{const t=D.from(xb(e)).filter(MA).map(NA);return RA(e).fold(T,(e=>t.fold(O,(e=>ae(e).length>0&&e))))})(e);return d(o)?o?RA(e):D.none():o[t]?RA(e):D.none()},LA=e=>D.from(e).filter(s).getOrUndefined(),HA=e=>({getHistory:DA,addToHistory:AA,getLinkInformation:()=>(e=>Cb(e)?D.some({targets:kA(e.getBody()),anchorTop:LA(Sb(e)),anchorBottom:LA(kb(e))}):D.none())(e),getValidationHandler:()=>(e=>D.from(yb(e)))(e),getUrlPicker:t=>((e,t)=>BA(e,t).map((o=>n=>wS((r=>{const i={filetype:t,fieldname:n.fieldname,...D.from(n.meta).getOr({})};o.call(e,((e,t)=>{if(!s(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");r({value:e,meta:t})}),n.value,i)})))))(e,t)}),IA=(e,t,o,n)=>{const r=Hr(!1),s=(e=>{const t=Hr(Ub(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:Mv.translate,isDisabled:()=>t.mode.isReadOnly()||!t.ui.isEnabled(),getOption:t.options.get},i=HA(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},n=Hr([]),r=Hr([]),s=Hr(!1);return e.on("PreInit",(r=>{const s=iA(e),a=cA(e,s,t,o);n.set(a)})),e.on("addStyleModifications",(n=>{const a=cA(e,n.items,t,o);r.set(a),s.set(n.replace)})),{getData:()=>{const e=s.get()?[]:n.get(),t=r.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:JD(e),hasCustomColors:QD(e),getColors:eA(e),getColorCols:tA(e)}))(t),d=(e=>({isDraggableModal:oA(e)}))(t),m={shared:{providers:a,anchors:XD(t,o,n,s.isPositionedAtTop),header:s},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>r.get(),setContextMenuState:e=>r.set(e)},u={...m,shared:{...m.shared,interpreter:e=>_D(e,{},u),getSink:e.popup}},g={...m,shared:{...m.shared,interpreter:e=>_D(e,{},g),getSink:e.dialog}};return{popup:u,dialog:g}},PA=Ku,FA=Nu,zA=w([Tr("shell",!1),dr("makeItem"),Tr("setupItem",v),tu("listBehaviours",[Hp])]),VA=Du({name:"items",overrides:()=>({behaviours:ql([Hp.config({})])})}),ZA=w([VA]),UA=og({name:w("CustomList")(),configFields:zA(),partFields:ZA(),factory:(e,t,o,n)=>{const r=e.shell?{behaviours:[Hp.config({})],components:[]}:{behaviours:[],components:t},s=t=>e.shell?D.some(t):Vu(t,e,"items");return{uid:e.uid,dom:e.dom,components:r.components,behaviours:eu(e.listBehaviours,r.behaviours),apis:{setItems:(t,o)=>{s(t).fold((()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")}),(n=>{const r=Hp.contents(n),s=o.length,a=s-r.length,i=a>0?I(a,(()=>e.makeItem())):[],l=r.slice(s);z(l,(e=>Hp.remove(n,e))),z(i,(e=>Hp.append(n,e)));const c=Hp.contents(n);z(c,((n,r)=>{e.setupItem(t,n,o[r],r)}))}))}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),jA=w([dr("dom"),Tr("shell",!0),Jm("toolbarBehaviours",[Hp])]),WA=w([Du({name:"groups",overrides:()=>({behaviours:ql([Hp.config({})])})})]),$A=og({name:"Toolbar",configFields:jA(),partFields:WA(),factory:(e,t,o,n)=>{const r=t=>e.shell?D.some(t):Vu(t,e,"groups"),s=e.shell?{behaviours:[Hp.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:eu(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(e,t)=>{r(e).fold((()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")}),(e=>{Hp.set(e,t)}))},refresh:v},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),qA=v,GA=T,KA=w([]);var YA=Object.freeze({__proto__:null,setup:qA,isDocked:GA,getBehaviours:KA});const XA=e=>(we(Ht(e,"position"),"fixed")?D.none():st(e)).orThunk((()=>{const t=Le.fromTag("span");return nt(e).bind((e=>{Ho(e,t);const o=st(t);return Fo(t),o}))})),JA=e=>XA(e).map(Gt).getOrThunk((()=>$t(0,0))),QA=(e,t)=>{const o=e.element;ti(o,t.transitionClass),ni(o,t.fadeOutClass),ti(o,t.fadeInClass),t.onShow(e)},eM=(e,t)=>{const o=e.element;ti(o,t.transitionClass),ni(o,t.fadeInClass),ti(o,t.fadeOutClass),t.onHide(e)},tM=(e,t)=>e.y>=t.y,oM=(e,t)=>e.bottom<=t.bottom,nM=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),rM=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),sM=e=>e.box.x-e.win.x,aM=(e,t,o)=>o.getInitialPos().map((o=>{const n=((e,t)=>{const o=t.optScrollEnv.fold(w(e.bounds.y),(t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop)));return $t(e.bounds.x,o)})(o,t);return{box:Go(n.left,n.top,Xt(e),Ut(e)),location:o.location}})),iM=(e,t,o,n,r)=>{const s=((e,t)=>{const o=t.optScrollEnv.fold(w(e.y),(t=>e.y+t.currentScrollTop-t.scrollElmTop));return $t(e.x,o)})(t,o),a=Go(s.left,s.top,t.width,t.height);n.setInitialPos({style:It(e),position:Bt(e,"position")||"static",bounds:a,location:r.location})},lM=(e,t,o)=>o.getInitialPos().bind((n=>{var r;switch(o.clearInitialPos(),n.position){case"static":return D.some({morph:"static"});case"absolute":const o=XA(e).getOr(wt()),s=Ko(o),a=null!==(r=o.dom.scrollTop)&&void 0!==r?r:0;return D.some({morph:"absolute",positionCss:ic("absolute",ve(n.style,"left").map((e=>t.x-s.x)),ve(n.style,"top").map((e=>t.y-s.y+a)),ve(n.style,"right").map((e=>s.right-t.right)),ve(n.style,"bottom").map((e=>s.bottom-t.bottom)))});default:return D.none()}})),cM=(e,t,o)=>aM(e,t,o).filter((({box:e})=>((e,t,o)=>K(e,(e=>{switch(e){case"bottom":return oM(t,o.bounds);case"top":return tM(t,o.bounds)}})))(o.getModes(),e,t))).bind((({box:t})=>lM(e,t,o))),dM=e=>{switch(e.location){case"top":return D.some({morph:"fixed",positionCss:ic("fixed",D.some(e.leftX),D.some(e.topY),D.none(),D.none())});case"bottom":return D.some({morph:"fixed",positionCss:ic("fixed",D.some(e.leftX),D.none(),D.none(),D.some(e.bottomY))});default:return D.none()}},mM=(e,t,o)=>{const n=Ko(e),r=Jo(),s=((e,t,o)=>{const n=t.win,r=t.box,s=sM(t);return se(e,(e=>{switch(e){case"bottom":return oM(r,o.bounds)?D.none():D.some(rM(n,s,o));case"top":return tM(r,o.bounds)?D.none():D.some(nM(n,s,o));default:return D.none()}})).getOr({location:"no-dock"})})(o.getModes(),{win:r,box:n},t);return"top"===s.location||"bottom"===s.location?(iM(e,n,t,o,s),dM(s)):D.none()},uM=(e,t,o)=>{const n=e.element;return we(Ht(n,"position"),"fixed")?((e,t,o)=>cM(e,t,o).orThunk((()=>t.optScrollEnv.bind((n=>aM(e,t,o))).bind((({box:e,location:o})=>{const n=Jo(),r=sM({win:n,box:e}),s="top"===o?nM(n,r,t):rM(n,r,t);return dM(s)})))))(n,t,o):mM(n,t,o)},gM=(e,t,o,n)=>{const r=Ko(e),s=Jo(),a=n(s,sM({win:s,box:r}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,r)=>{n.getInitialPos().fold((()=>iM(e,t,o,n,r)),(()=>v))})(e,r,t,o,a),dM(a)):D.none()},hM=(e,t,o)=>{o.setDocked(!1),z(["left","right","top","bottom","position"],(t=>Ft(e.element,t))),t.onUndocked(e)},pM=(e,t,o,n)=>{const r="fixed"===n.position;o.setDocked(r),lc(e.element,n);(r?t.onDocked:t.onUndocked)(e)},fM=(e,t,o,n,r=!1)=>{t.contextual.each((t=>{t.lazyContext(e).each((s=>{const a=((e,t)=>e.yt.y)(s,n.bounds);if(a!==o.isVisible())if(o.setVisible(a),r&&!a)ai(e.element,[t.fadeOutClass]),t.onHide(e);else{(a?QA:eM)(e,t)}}))}))},vM=(e,t,o,n,r)=>{fM(e,t,o,n,!0),pM(e,t,o,r.positionCss)},bM=(e,t,o)=>{const n=t.lazyViewport(e);fM(e,t,o,n),uM(e,n,o).each((r=>{((e,t,o,n,r)=>{switch(r.morph){case"static":return hM(e,t,o);case"absolute":return pM(e,t,o,r.positionCss);case"fixed":vM(e,t,o,n,r)}})(e,t,o,n,r)}))},yM=(e,t,o)=>{const n=e.element;o.setDocked(!1);const r=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return aM(n,t,o).bind((({box:e})=>lM(n,e,o)))})(e,r,o).each((n=>{switch(n.morph){case"static":hM(e,t,o);break;case"absolute":pM(e,t,o,n.positionCss)}})),o.setVisible(!0),t.contextual.each((t=>{ii(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)})),wM(e,t,o)},wM=(e,t,o)=>{e.getSystem().isConnected()&&bM(e,t,o)},xM=(e,t,o)=>{o.isDocked()&&yM(e,t,o)},CM=e=>(t,o,n)=>{const r=o.lazyViewport(t);gM(t.element,r,n,e).each((e=>{vM(t,o,n,r,e)}))},SM=CM(nM),kM=CM(rM);var _M=Object.freeze({__proto__:null,refresh:wM,reset:xM,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:SM,forceDockToBottom:kM});var EM=Object.freeze({__proto__:null,events:(e,t)=>Ys([aa(gs(),((o,n)=>{e.contextual.each((e=>{if(si(o.element,e.transitionClass)){ii(o.element,[e.transitionClass,e.fadeInClass]);(t.isVisible()?e.onShown:e.onHidden)(o)}n.stop()}))})),Qs(Ms(),((o,n)=>{wM(o,e,t)})),Qs(Fs(),((o,n)=>{wM(o,e,t)})),Qs(Ns(),((o,n)=>{xM(o,e,t)}))])}),TM=[Er("contextual",[gr("fadeInClass"),gr("fadeOutClass"),gr("transitionClass"),pr("lazyContext"),el("onShow"),el("onShown"),el("onHide"),el("onHidden")]),Rr("lazyViewport",(()=>({bounds:Jo(),optScrollEnv:D.none()}))),Br("modes",["top","bottom"],$n),el("onDocked"),el("onUndocked")];const OM=Kl({fields:TM,name:"docking",active:EM,apis:_M,state:Object.freeze({__proto__:null,init:e=>{const t=Hr(!1),o=Hr(!0),n=kc(),r=Hr(e.modes);return Ia({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:r.get,setModes:r.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${r.get().join(",")}`})}})}),DM=w(ya("toolbar-height-change")),AM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},MM="tox-tinymce--toolbar-sticky-on",NM="tox-tinymce--toolbar-sticky-off",RM=(e,t)=>L(OM.getModes(e),t),BM=e=>{const t=e.element;rt(t).each((o=>{const n="padding-"+OM.getModes(e)[0];if(OM.isDocked(e)){const e=Xt(o);Mt(t,"width",e+"px"),Mt(o,n,(e=>jt(e)+(parseInt(Bt(e,"margin-top"),10)||0)+(parseInt(Bt(e,"margin-bottom"),10)||0))(t)+"px")}else Ft(t,"width"),Ft(o,n)}))},LM=(e,t)=>{t?(ni(e,AM.fadeOutClass),ai(e,[AM.transitionClass,AM.fadeInClass])):(ni(e,AM.fadeInClass),ai(e,[AM.fadeOutClass,AM.transitionClass]))},HM=(e,t)=>{const o=Le.fromDom(e.getContainer());t?(ti(o,MM),ni(o,NM)):(ti(o,NM),ni(o,MM))},IM=(e,t)=>{const o=kc(),n=t.getSink,r=e=>{n().each((t=>e(t.element)))},s=t=>{e.inline||BM(t),HM(e,OM.isDocked(t)),t.getSystem().broadcastOn([Rm()],{}),n().each((e=>e.getSystem().broadcastOn([Rm()],{})))},a=e.inline?[]:[Ql.config({channels:{[DM()]:{onReceive:BM}}})];return[Zp.config({}),OM.config({contextual:{lazyContext:t=>{const o=jt(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return D.from(n).map((n=>{const r=Ko(Le.fromDom(n));return XS(e,t.element).fold((()=>{const e=r.height-o,n=r.y+(RM(t,"top")?0:o);return Go(r.x,n,r.width,e)}),(e=>{const n=Xo(r,JS(e)),s=RM(t,"top")?n.y:n.y+o;return Go(n.x,s,n.width,n.height-o)}))}))},onShow:()=>{r((e=>LM(e,!0)))},onShown:e=>{r((e=>ii(e,[AM.transitionClass,AM.fadeInClass]))),o.get().each((t=>{((e,t)=>{const o=Qe(t);rc(o).filter((e=>!Xe(t,e))).filter((t=>Xe(t,Le.fromDom(o.dom.body))||Je(e,t))).each((()=>tc(t)))})(e.element,t),o.clear()}))},onHide:e=>{((e,t)=>sc(e).orThunk((()=>t().toOptional().bind((e=>sc(e.element))))))(e.element,n).fold(o.clear,o.set),r((e=>LM(e,!1)))},onHidden:()=>{r((e=>ii(e,[AM.transitionClass])))},...AM},lazyViewport:t=>XS(e,t.element).fold((()=>{const o=Jo(),n=pb(e),r=o.y+(RM(t,"top")?n:0),s=o.height-(RM(t,"bottom")?n:0);return{bounds:Go(o.x,r,o.width,s),optScrollEnv:D.none()}}),(e=>({bounds:JS(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Gt(e.element).top})}))),modes:[t.header.getDockingMode()],onDocked:s,onUndocked:s}),...a]};var PM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",(()=>{o().each(OM.reset)})),e.on("ResizeWindow ResizeEditor",(()=>{o().each(BM)})),e.on("SkinLoaded",(()=>{o().each((e=>{OM.isDocked(e)?OM.reset(e):OM.refresh(e)}))})),e.on("FullscreenStateChanged",(()=>{o().each(OM.reset)}))),e.on("AfterScrollIntoView",(e=>{o().each((t=>{OM.refresh(t);const o=t.element;wh(o)&&((e,t)=>{const o=Qe(t),n=ot(t).dom.innerHeight,r=zo(o),s=Le.fromDom(e.elm),a=Yo(s),i=Ut(s),l=a.y,c=l+i,d=Gt(t),m=Ut(t),u=d.top,g=u+m,h=Math.abs(u-r.top)<2,p=Math.abs(g-(r.top+n))<2;if(h&&lu){const e=l-n+i+m;Vo(r.left,e,o)}})(e,o)}))})),e.on("PostRender",(()=>{HM(e,!1)}))},isDocked:e=>e().map(OM.isDocked).getOr(!1),getBehaviours:IM});const FM=Pn([Uy,mr("items",zn([Zn([jy,br("items",$n)]),$n]))].concat(yw)),zM=[Cr("text"),Cr("tooltip"),Cr("icon"),Or("search",!1,zn([qn,Pn([Cr("placeholder")])],(e=>d(e)?e?D.some({placeholder:D.none()}):D.none():D.some(e)))),pr("fetch"),Rr("onSetup",(()=>v))],VM=Pn([Uy,...zM]),ZM=e=>tr("menubutton",VM,e),UM=Pn([Uy,rw,nw,ow,iw,Yy,ew,Mr("presets","normal",["normal","color","listpreview"]),uw(1),Jy,Qy]);var jM=tg({factory:(e,t)=>{const o={focus:Tp.focusIn,setMenus:(e,o)=>{const n=F(o,(e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=ZM(o).mapError((e=>rr(e))).getOrDie();return _O(n,"tox-mbtn",t.backstage,D.some("menuitem"))}));Hp.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:ql([Hp.config({}),Ip("menubar-events",[ia((t=>{e.onSetup(t)})),Qs(rs(),((e,t)=>{Bi(e.element,".tox-mbtn--active").each((o=>{Li(t.event.target,".tox-mbtn").each((t=>{Xe(o,t)||e.getSystem().getByDom(o).each((o=>{e.getSystem().getByDom(t).each((e=>{HS.expand(e),HS.close(o),Zp.focus(e)}))}))}))}))})),Qs(Is(),((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=>{HS.isOpen(o)&&(HS.expand(e),HS.close(o))}))}))}))]),Tp.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),D.some(!0))}),yk.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[dr("dom"),dr("uid"),dr("onEscape"),dr("backstage"),Tr("onSetup",v)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const WM="container",$M=[Jm("slotBehaviours",[])],qM=e=>"",GM=(e,t)=>{const o=t=>Wu(e),n=(t,o)=>(n,r)=>Vu(n,e,r).map((e=>t(e,r))).getOr(o),r=(e,t)=>"true"!==_t(e.element,"aria-hidden"),s=n(r,!1),a=n(((e,t)=>{if(r(e)){const o=e.element;Mt(o,"display","none"),St(o,"aria-hidden","true"),Ws(e,Ps(),{name:t,visible:!1})}})),i=(e=>(t,o)=>{z(o,(o=>e(t,o)))})(a),l=n(((e,t)=>{if(!r(e)){const o=e.element;Ft(o,"display"),Ot(o,"aria-hidden"),Ws(e,Ps(),{name:t,visible:!0})}})),c={getSlotNames:o,getSlot:(t,o)=>Vu(t,e,o),isShowing:s,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:Qm(e.slotBehaviours),apis:c}},KM=ce({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=>La(e))),YM={...KM,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),Hu(WM,qM(t),o)),record:w(e)}})(),o=e(t),n=t.record(),r=F(n,(e=>Tu({name:e,pname:qM(e)})));return Xu(WM,$M,r,GM,o)}},XM=Pn([nw,rw,Rr("onShow",v),Rr("onHide",v),ew]),JM=e=>({element:()=>e.element.dom}),QM=(e,t)=>{const o=F(ae(t),(e=>{const o=t[e],n=or((e=>tr("sidebar",XM,e))(o));return{name:e,getApi:JM,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}}));return F(o,(t=>{const n=Hr(v);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Jw([yx(t,n),wx(t,n),Qs(Ps(),((e,t)=>{const n=t.event,r=W(o,(e=>e.name===n.name));r.each((t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))}))}))])})}))},eN=e=>YM.sketch((t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:QM(t,e),slotBehaviours:Jw([ia((e=>YM.hideAllSlots(e)))])}))),tN=(e,t)=>{St(e,"role",t)},oN=e=>ag.getCurrent(e).bind((e=>{if(SO.isGrowing(e)||SO.hasGrown(e)){return ag.getCurrent(e).bind((e=>W(YM.getSlotNames(e),(t=>YM.isShowing(e,t)))))}return D.none()})),nN=ya("FixSizeEvent"),rN=ya("AutoSizeEvent");var sN=Object.freeze({__proto__:null,block:(e,t,o,n)=>{St(e.element,"aria-busy",!0);const r=t.getRoot(e).getOr(e),s=ql([Tp.config({mode:"special",onTab:()=>D.some(!0),onShiftTab:()=>D.some(!0)}),Zp.config({})]),a=n(r,s),i=r.getSystem().build(a);Hp.append(r,Ti(i)),i.hasConfigured(Tp)&&t.focus&&Tp.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith((()=>Hp.remove(r,i)))},unblock:(e,t,o)=>{Ot(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),aN=[Rr("getRoot",D.none),Nr("focus",!0),el("onBlock"),el("onUnblock")];const iN=Kl({fields:aN,name:"blocking",apis:sN,state:Object.freeze({__proto__:null,init:()=>{const e=Cc((e=>e.destroy()));return Ia({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})}),lN=e=>ag.getCurrent(e).each((e=>tc(e.element,!0))),cN=(e,t,o,n)=>{const r=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;D.from(e.iframeElement).map(Le.fromDom).each((e=>{t?(Et(e,o).each((t=>St(e,n,t))),St(e,o,-1)):(Ot(e,o),Et(e,n).each((t=>{St(e,o,t),Ot(e,n)})))}))})(e,o),o)iN.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:Rf('
    ')}]}))(n)),Ft(r,"display"),Ot(r,"aria-hidden"),e.hasFocus()&&lN(t);else{const o=ag.getCurrent(t).exists((e=>nc(e.element)));iN.unblock(t),Mt(r,"display","none"),St(r,"aria-hidden","true"),o&&e.focus()}},dN=(e,t,o)=>{const n=Hr(!1),r=kc(),s=o=>{n.get()&&!(e=>{if((e=>"focusin"===e.type)(e))return(e.composed?oe(e.composedPath()):D.from(e.target)).map(Le.fromDom).filter(je).exists((e=>si(e,"mce-pastebin")));return!1})(o)&&(o.preventDefault(),lN(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",(()=>{e.dom.bind(e.getWin(),"focusin",s),e.on("BeforeExecCommand",(e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&s(e)}))}));const a=r=>{r!==n.get()&&(n.set(r),cN(e,t(),r,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,r))};e.on("ProgressState",(t=>{if(r.on(clearTimeout),p(t.time)){const o=Mf.setEditorTimeout(e,(()=>a(t.state)),t.time);r.set(o)}else a(t.state),r.clear()}))},mN=(e,t,o)=>({within:e,extra:t,withinWidth:o}),uN=(e,t,o)=>{const n=((e,t)=>{const o=j(e,((e,o)=>t(o,e.len).fold(w(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:0,list:[]});return o.list})(e,((e,t)=>{const n=o(e);return D.some({element:e,start:t,finish:t+n,width:n})})),r=Z(n,(e=>e.finish<=t)),s=U(r,((e,t)=>e+t.width),0);return{within:r,extra:n.slice(r.length),withinWidth:s}},gN=e=>F(e,(e=>e.element)),hN=(e,t,o,n)=>{const r=((e,t,o)=>{const n=uN(t,e,o);return 0===n.extra.length?D.some(n):D.none()})(e,t,o).getOrThunk((()=>uN(t,e-o(n),o))),s=r.within,a=r.extra,i=r.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=gN(e.concat(t));return mN(n,[],o)})(s,a,i):a.length>=1?((e,t,o,n)=>{const r=gN(e).concat([o]);return mN(r,gN(t),n)})(s,a,n,i):((e,t,o)=>mN(gN(e),[],o))(s,0,i)},pN=(e,t)=>{const o=F(t,(e=>Ti(e)));$A.setGroups(e,o)},fN=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const r=Zu(e,t,"primary"),s=pS.getCoupled(e,"overflowGroup");Mt(r.element,"visibility","hidden");const a=n.concat([s]),i=se(a,(e=>sc(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()))));o([]),pN(r,a);const l=Xt(r.element),c=hN(l,t.builtGroups.get(),(e=>Xt(e.element)),s);0===c.extra.length?(Hp.remove(r,s),o([])):(pN(r,c.within),o(c.extra)),Ft(r.element,"visibility"),zt(r.element),i.each(Zp.focus)},vN=w([Jm("splitToolbarBehaviours",[pS]),lr("builtGroups",(()=>Hr([])))]),bN=w([Ji(["overflowToggledClass"]),kr("getOverflowBounds"),dr("lazySink"),lr("overflowGroups",(()=>Hr([]))),el("onOpened"),el("onClosed")].concat(vN())),yN=w([Tu({factory:$A,schema:jA(),name:"primary"}),Ou({schema:jA(),name:"overflow"}),Ou({name:"overflow-button"}),Ou({name:"overflow-group"})]),wN=w(((e,t)=>{((e,t)=>{const o=Yt.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);Mt(e,"max-width",o+"px")})(e,Math.floor(t))})),xN=w([Ji(["toggledClass"]),dr("lazySink"),pr("fetch"),kr("getBounds"),Er("fireDismissalEventInstead",[Tr("event",Ls())]),Xc(),el("onToggled")]),CN=w([Ou({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:ql([Yp.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Ou({factory:$A,schema:jA(),name:"toolbar",overrides:e=>({toolbarBehaviours:ql([Tp.config({mode:"cyclic",onEscape:t=>(Vu(t,e,"button").each(Zp.focus),D.none())})])})})]),SN=kc(),kN=(e,t)=>{const o=pS.getCoupled(e,"toolbarSandbox");Mm.isOpen(o)?Mm.close(o):Mm.open(o,t.toolbar())},_N=(e,t,o,n)=>{const r=o.getBounds.map((e=>e())),s=o.lazySink(e).getOrDie();rm.positionWithinBounds(s,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:wN()}}},r)},EN=(e,t,o,n,r)=>{$A.setGroups(t,r),_N(e,t,o,n),Yp.on(e)},TN=og({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Nf.sketch({...n.button(),action:e=>{kN(e,n)},buttonBehaviours:ou({dump:n.button().buttonBehaviours},[pS.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Ii();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:ql([Tp.config({mode:"special",onEscape:e=>(Mm.close(e),D.some(!0))}),Mm.config({onOpen:(r,s)=>{const a=SN.get().getOr(!1);o.fetch().get((r=>{EN(e,s,o,t.layouts,r),n.link(e.element),a||Tp.focusIn(s)}))},onClose:()=>{Yp.off(e),SN.get().getOr(!1)||Zp.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Fi(o,n)||Fi(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),Ql.config({channels:{...Hm({isExtraPart:T,...o.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Pm({doReposition:()=>{Mm.getState(pS.getCoupled(e,"toolbarSandbox")).each((n=>{_N(e,n,o,t.layouts)}))}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{Mm.getState(pS.getCoupled(t,"toolbarSandbox")).each((r=>{EN(t,r,e,o.layouts,n)}))},reposition:t=>{Mm.getState(pS.getCoupled(t,"toolbarSandbox")).each((n=>{_N(t,n,e,o.layouts)}))},toggle:e=>{kN(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{SN.set(!0),kN(e,t),SN.clear()})(e,n)},getToolbar:e=>Mm.getState(pS.getCoupled(e,"toolbarSandbox")),isOpen:e=>Mm.isOpen(pS.getCoupled(e,"toolbarSandbox"))}}),configFields:xN(),partFields:CN(),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)}}),ON=w([dr("items"),Ji(["itemSelector"]),Jm("tgroupBehaviours",[Tp])]),DN=w([Au({name:"items",unit:"item"})]),AN=og({name:"ToolbarGroup",configFields:ON(),partFields:DN(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.tgroupBehaviours,[Tp.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),MN=e=>F(e,(e=>Ti(e))),NN=(e,t,o)=>{fN(e,o,(n=>{o.overflowGroups.set(n),t.getOpt(e).each((e=>{TN.setGroups(e,MN(n))}))}))},RN=og({name:"SplitFloatingToolbar",configFields:bN(),partFields:yN(),factory:(e,t,o,n)=>{const r=Bf(TN.sketch({fetch:()=>wS((t=>{t(MN(e.overflowGroups.get()))})),layouts:{onLtr:()=>[Ol,Tl],onRtl:()=>[Tl,Ol],onBottomLtr:()=>[Al,Dl],onBottomRtl:()=>[Dl,Al]},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:eu(e.splitToolbarBehaviours,[pS.config({others:{overflowGroup:()=>AN.sketch({...n["overflow-group"](),items:[r.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(F(o,t.getSystem().build)),NN(t,r,e)},refresh:t=>NN(t,r,e),toggle:e=>{r.getOpt(e).each((e=>{TN.toggle(e)}))},toggleWithoutFocusing:e=>{r.getOpt(e).each(TN.toggleWithoutFocusing)},isOpen:e=>r.getOpt(e).map(TN.isOpen).getOr(!1),reposition:e=>{r.getOpt(e).each((e=>{TN.reposition(e)}))},getOverflow:e=>r.getOpt(e).bind(TN.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)}}),BN=w([Ji(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),el("onOpened"),el("onClosed")].concat(vN())),LN=w([Tu({factory:$A,schema:jA(),name:"primary"}),Tu({factory:$A,schema:jA(),name:"overflow",overrides:e=>({toolbarBehaviours:ql([SO.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{Vu(t,e,"overflow-button").each((e=>{Yp.off(e),Zp.focus(e)})),e.onClosed(t)},onGrown:t=>{Tp.focusIn(t),e.onOpened(t)},onStartGrow:t=>{Vu(t,e,"overflow-button").each(Yp.on)}}),Tp.config({mode:"acyclic",onEscape:t=>(Vu(t,e,"overflow-button").each(Zp.focus),D.some(!0))})])})}),Ou({name:"overflow-button",overrides:e=>({buttonBehaviours:ql([Yp.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])})}),Ou({name:"overflow-group"})]),HN=(e,t)=>{Vu(e,t,"overflow-button").bind((()=>Vu(e,t,"overflow"))).each((o=>{IN(e,t),SO.toggleGrow(o)}))},IN=(e,t)=>{Vu(e,t,"overflow").each((o=>{fN(e,t,(e=>{const t=F(e,(e=>Ti(e)));$A.setGroups(o,t)})),Vu(e,t,"overflow-button").each((e=>{SO.hasGrown(o)&&Yp.on(e)})),SO.refresh(o)}))},PN=og({name:"SplitSlidingToolbar",configFields:BN(),partFields:LN(),factory:(e,t,o,n)=>{const r="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.splitToolbarBehaviours,[pS.config({others:{overflowGroup:e=>AN.sketch({...n["overflow-group"](),items:[Nf.sketch({...n["overflow-button"](),action:t=>{js(e,r)}})]})}}),Ip("toolbar-toggle-events",[Qs(r,(t=>{HN(t,e)}))])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=F(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),IN(t,e)},refresh:t=>IN(t,e),toggle:t=>HN(t,e),isOpen:t=>((e,t)=>Vu(e,t,"overflow").map(SO.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)}}),FN=e=>{const t=e.title.fold((()=>({})),(e=>({attributes:{title:e}})));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[AN.parts.items({})],items:e.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:ql([yk.config({}),Zp.config({})])}},zN=e=>AN.sketch(FN(e)),VN=(e,t)=>{const o=ia((t=>{const o=F(e.initGroups,zN);$A.setGroups(t,o)}));return ql([vx(e.providers.isDisabled),gx(),Tp.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Ip("toolbar-events",[o])])},ZN=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":FN({title:D.none(),items:[]}),"overflow-button":eD({name:"more",icon:D.some("more-drawer"),enabled:!0,tooltip:D.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:D.none(),borderless:!1},D.none(),e.providers)},splitToolbarBehaviours:VN(e,t)}},UN=e=>{const t=ZN(e),o=RN.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return RN.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=Yo(t),n=tt(t),r=Yo(n),s=Math.max(n.dom.scrollHeight,r.height);return Go(o.x+4,r.y,o.width-8,s)},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)})},jN=e=>{const t=PN.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=PN.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=ZN(e);return PN.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([DM()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([DM()],{type:"closed"}),e.onToggled(t,!1)}})},WN=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return $A.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===Uv.scrolling?["tox-toolbar--scrolling"]:[])},components:[$A.parts.groups({})],toolbarBehaviours:VN(e,t)})},$N=[ow,nw,Cr("tooltip"),Mr("buttonType","secondary",["primary","secondary"]),Nr("borderless",!1),pr("onAction")],qN={button:[...$N,$y,hr("type",["button"])],togglebutton:[...$N,Nr("active",!1),hr("type",["togglebutton"])]},GN=[hr("type",["group"]),Br("buttons",[],sr("type",qN))],KN=sr("type",{...qN,group:GN}),YN=Pn([Br("buttons",[],KN),pr("onShow"),pr("onHide")]),XN=(e,t)=>((e,t)=>{var o,n;const r="togglebutton"===e.type,s=e.icon.map((e=>PT(e,t.icons))).map(Bf),a=o=>{const n=e=>{s.map((n=>n.getOpt(o).each((o=>{Hp.set(o,[PT(e,t.icons)])}))))},a=e=>{const t=o.element;e?(ti(t,"tox-button--enabled"),St(t,"aria-pressed",!0)):(ni(t,"tox-button--enabled"),Ot(t,"aria-pressed"))},i=()=>si(o.element,"tox-button--enabled");return r?e.onAction({setIcon:n,setActive:a,isActive:i}):"button"===e.type?e.onAction({setIcon:n}):void 0},i={...e,name:r?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:D.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},l=tD(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),c=r?e.text.map(t.translate):D.some(t.translate(e.text)),d=c.map(Ci),m=i.tooltip.or(c).map((e=>({"aria-label":t.translate(e),title:t.translate(e)}))).getOr({}),u=s.map((e=>e.asSpec())),g=Sx([u,d]),h=e.icon.isSome()&&d.isSome(),p={tag:"button",classes:l.concat(...e.icon.isSome()&&!h?["tox-button--icon"]:[]).concat(...h?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:m},f=QO(i,D.some(a),[],p,g,t);return Nf.sketch(f)})(e,t),JN=Do().deviceType,QN=JN.isPhone(),eR=JN.isTablet();var tR=og({name:"silver.View",configFields:[dr("viewConfig")],partFields:[Du({factory:{sketch:e=>{let t=!1;const o=F(e.buttons,(o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:F(e.buttons,(e=>XN(e,t)))}))(o,e.providers)):XN(o,e.providers)));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...QN||eR?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:ql([Zp.config({}),Tp.config({mode:"flow",selector:"button, .tox-button",focusInside:eh.OnEnterOrSpaceMode})]),components:t?o:[uk.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),uk.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[dr("buttons"),dr("providers")],name:"header"}),Du({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const r={getPane:t=>PA.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,apis:r}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const oR=(e,t,o)=>he(t,((t,n)=>{const r=or(tr("view",YN,t));return e.slot(n,tR.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:r,components:[...r.buttons.length>0?[tR.parts.header({buttons:r.buttons,providers:o})]:[],tR.parts.pane({})]}))})),nR=(e,t)=>YM.sketch((o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:oR(o,e,t),slotBehaviours:Jw([ia((e=>YM.hideAllSlots(e)))])}))),rR=e=>W(YM.getSlotNames(e),(t=>YM.isShowing(e,t))),sR=(e,t,o)=>{YM.getSlot(e,t).each((e=>{tR.getPane(e).each((t=>{var n;o(e)((n=t.element.dom,{getContainer:w(n)}))}))}))};var aR=tg({factory:(e,t)=>{const o={setViews:(e,o)=>{Hp.set(e,[nR(o,t.backstage.shared.providers)])},whichView:e=>ag.getCurrent(e).bind(rR),toggleView:(e,t,o,n)=>ag.getCurrent(e).exists((r=>{const s=rR(r),a=s.exists((e=>n===e)),i=YM.getSlot(r,n).isSome();return i&&(YM.hideAllSlots(r),a?((e=>{const t=e.element;Mt(t,"display","none"),St(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;Ft(t,"display"),Ot(t,"aria-hidden")})(e),YM.showSlot(r,n),((e,t)=>{sR(e,t,tR.getOnShow)})(r,n)),s.each((e=>((e,t)=>sR(e,t,tR.getOnHide))(r,e)))),i}))};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:ql([Hp.config({}),ag.config({find:e=>{const t=Hp.contents(e);return oe(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[dr("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,r)=>e.toggleView(t,o,n,r),whichView:(e,t)=>e.whichView(t)}});const iR=FA.optional({factory:jM,name:"menubar",schema:[dr("backstage")]}),lR=FA.optional({factory:{sketch:e=>UA.sketch({uid:e.uid,dom:e.dom,listBehaviours:ql([Tp.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>WN({type:e.type,uid:ya("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),D.some(!0))}),setupItem:(e,t,o,n)=>{$A.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[dr("dom"),dr("onEscape")]}),cR=FA.optional({factory:{sketch:e=>{const t=(e=>e.type===Uv.sliding?jN:e.type===Uv.floating?UN:WN)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),D.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:[dr("dom"),dr("onEscape"),dr("getSink")]}),dR=FA.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?IM:KA;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:ql(o(t,e.sharedBackstage))}}},name:"header",schema:[dr("dom")]}),mR=FA.optional({factory:{sketch:e=>({uid:e.uid,dom:e.dom,components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/tinymce-self-hosted-premium-features/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:"⚡️Upgrade"}}]})},name:"promotion",schema:[dr("dom")]}),uR=FA.optional({name:"socket",schema:[dr("dom")]}),gR=FA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:ql([yk.config({}),Zp.config({}),SO.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=>{ag.getCurrent(e).each(YM.hideAllSlots),js(e,rN)},onGrown:e=>{js(e,rN)},onStartGrow:e=>{Ws(e,nN,{width:Ht(e.element,"width").getOr("")})},onStartShrink:e=>{Ws(e,nN,{width:Xt(e.element)+"px"})}}),Hp.config({}),ag.config({find:e=>{const t=Hp.contents(e);return oe(t)}})])}],behaviours:ql([YE(0),Ip("sidebar-sliding-events",[Qs(nN,((e,t)=>{Mt(e.element,"width",t.event.width)})),Qs(rN,((e,t)=>{Ft(e.element,"width")}))])])})},name:"sidebar",schema:[dr("dom")]}),hR=FA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:ql([Hp.config({}),iN.config({focus:!1}),ag.config({find:e=>oe(e.components())})]),components:[]})},name:"throbber",schema:[dr("dom")]}),pR=FA.optional({factory:aR,name:"viewWrapper",schema:[dr("backstage")]}),fR=FA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var vR=og({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const r={getSocket:t=>PA.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{PA.getPart(t,e,"sidebar").each((e=>((e,t,o)=>{ag.getCurrent(e).each((n=>{Hp.set(n,[eN(t)]);const r=null==o?void 0:o.toLowerCase();s(r)&&be(t,r)&&ag.getCurrent(n).each((t=>{YM.showSlot(t,r),SO.immediateGrow(n),Ft(n.element,"width"),tN(e.element,"region")}))}))})(e,o,n)))},toggleSidebar:(t,o)=>{PA.getPart(t,e,"sidebar").each((e=>((e,t)=>{ag.getCurrent(e).each((o=>{ag.getCurrent(o).each((n=>{SO.hasGrown(o)?YM.isShowing(n,t)?(SO.shrink(o),tN(e.element,"presentation")):(YM.hideAllSlots(n),YM.showSlot(n,t),tN(e.element,"region")):(YM.hideAllSlots(n),YM.showSlot(n,t),SO.grow(o),tN(e.element,"region"))}))}))})(e,o)))},whichSidebar:t=>PA.getPart(t,e,"sidebar").bind(oN).getOrNull(),getHeader:t=>PA.getPart(t,e,"header"),getToolbar:t=>PA.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{PA.getPart(t,e,"toolbar").each((e=>{const t=F(o,zN);e.getApis().setGroups(e,t)}))},setToolbars:(t,o)=>{PA.getPart(t,e,"multiple-toolbar").each((e=>{const t=F(o,(e=>F(e,zN)));UA.setItems(e,t)}))},refreshToolbar:t=>{PA.getPart(t,e,"toolbar").each((e=>e.getApis().refresh(e)))},toggleToolbarDrawer:t=>{PA.getPart(t,e,"toolbar").each((e=>{Se(e.getApis().toggle,(t=>t(e)))}))},toggleToolbarDrawerWithoutFocusing:t=>{PA.getPart(t,e,"toolbar").each((e=>{Se(e.getApis().toggleWithoutFocusing,(t=>t(e)))}))},isToolbarDrawerToggled:t=>PA.getPart(t,e,"toolbar").bind((e=>D.from(e.getApis().isOpen).map((t=>t(e))))).getOr(!1),getThrobber:t=>PA.getPart(t,e,"throbber"),focusToolbar:t=>{PA.getPart(t,e,"toolbar").orThunk((()=>PA.getPart(t,e,"multiple-toolbar"))).each((e=>{Tp.focusIn(e)}))},setMenubar:(t,o)=>{PA.getPart(t,e,"menubar").each((e=>{jM.setMenus(e,o)}))},focusMenubar:t=>{PA.getPart(t,e,"menubar").each((e=>{jM.focus(e)}))},setViews:(t,o)=>{PA.getPart(t,e,"viewWrapper").each((e=>{aR.setViews(e,o)}))},toggleView:(t,o)=>PA.getPart(t,e,"viewWrapper").exists((e=>aR.toggleView(e,(()=>r.showMainView(t)),(()=>r.hideMainView(t)),o))),whichView:t=>PA.getPart(t,e,"viewWrapper").bind(aR.whichView).getOrNull(),hideMainView:t=>{n=r.isToolbarDrawerToggled(t),n&&r.toggleToolbarDrawer(t),PA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;Mt(t,"display","none"),St(t,"aria-hidden","true")}))},showMainView:t=>{n&&r.toggleToolbarDrawer(t),PA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;Ft(t,"display"),Ot(t,"aria-hidden")}))}};return{uid:e.uid,dom:e.dom,components:t,apis:r,behaviours:e.behaviours}},configFields:[dr("dom"),dr("behaviours")],partFields:[dR,iR,cR,lR,uR,gR,mR,hR,pR,fR],apis:{getSocket:(e,t)=>e.getSocket(t),setSidebar:(e,t,o,n)=>{e.setSidebar(t,o,n)},toggleSidebar:(e,t,o)=>{e.toggleSidebar(t,o)},whichSidebar:(e,t)=>e.whichSidebar(t),getHeader:(e,t)=>e.getHeader(t),getToolbar:(e,t)=>e.getToolbar(t),setToolbar:(e,t,o)=>{e.setToolbar(t,o)},setToolbars:(e,t,o)=>{e.setToolbars(t,o)},refreshToolbar:(e,t)=>e.refreshToolbar(t),toggleToolbarDrawer:(e,t)=>{e.toggleToolbarDrawer(t)},toggleToolbarDrawerWithoutFocusing:(e,t)=>{e.toggleToolbarDrawerWithoutFocusing(t)},isToolbarDrawerToggled:(e,t)=>e.isToolbarDrawerToggled(t),getThrobber:(e,t)=>e.getThrobber(t),setMenubar:(e,t,o)=>{e.setMenubar(t,o)},focusMenubar:(e,t)=>{e.focusMenubar(t)},focusToolbar:(e,t)=>{e.focusToolbar(t)},setViews:(e,t,o)=>{e.setViews(t,o)},toggleView:(e,t,o)=>e.toggleView(t,o),whichView:(e,t)=>e.whichView(t)}});const bR={file:{title:"File",items:"newdocument restoredraft | preview | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template inserttemplate codesample inserttable accordion | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"aidialog aishortcuts | spellchecker spellcheckerlanguage | autocorrect capitalization | a11ycheck code typography wordcount addtemplate"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},yR=e=>e.split(" "),wR=(e,t)=>{const o={...bR,...t.menus},n=ae(t.menus).length>0,r=void 0===t.menubar||!0===t.menubar?yR("file edit view insert format tools table help"):yR(!1===t.menubar?"":t.menubar),a=Z(r,(e=>{const o=be(bR,e);return n?o||ve(t.menus,e).exists((e=>be(e,"items"))):o})),i=F(a,(n=>{const r=o[n];return((e,t,o)=>{const n=lb(o).split(/[ ,]/);return{text:e.title,getItems:()=>G(e.items,(e=>{const o=e.toLowerCase();return 0===o.trim().length||H(n,(e=>e===o))?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]}))}})({title:r.title,items:yR(r.items)},t,e)}));return Z(i,(e=>e.getItems().length>0&&H(e.getItems(),(e=>s(e)||"separator"!==e.type))))},xR=(e,t,o)=>(e.on("remove",(()=>o.unload(t))),o.load(t)),CR=(e,t,o,n)=>(e.on("remove",(()=>n.unloadRawCss(t))),n.loadRawCss(t,o)),SR=async(e,t)=>{const o="ui/"+Pb(e).getOr("default")+"/skin.css",n=tinymce.Resource.get(o);if(s(n))return Promise.resolve(CR(e,o,n,e.ui.styleSheetLoader));return xR(e,t+"/skin.min.css",e.ui.styleSheetLoader)},kR=async(e,t)=>{var o;if(o=Le.fromDom(e.getElement()),ft(o).isSome()){const o="ui/"+Pb(e).getOr("default")+"/skin.shadowdom.css",n=tinymce.Resource.get(o);if(s(n))return CR(e,o,n,Wv.DOM.styleSheetLoader),Promise.resolve();return xR(e,t+"/skin.shadowdom.min.css",Wv.DOM.styleSheetLoader)}},_R=(e,t)=>(async(e,t)=>{Pb(t).fold((()=>{const o=Ib(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}),(o=>{const n="ui/"+o+(e?"/content.inline":"/content")+".css",r=tinymce.Resource.get(n);if(s(r))CR(t,n,r,t.ui.styleSheetLoader);else{const o=Ib(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}}));const o=Ib(t);if(!Lb(t)&&s(o))return Promise.all([SR(t,o),kR(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,t)=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:t}))(t,"Skin could not be loaded")),ER=S(_R,!1),TR=S(_R,!0),OR=(e,t,o)=>e.translate([t,e.translate(o)]),DR=(e,t)=>{const o=(o,r,s,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return D.some({type:"separator",text:i});if("submenu"===o.type){const e=G(o.getStyleItems(),(e=>n(e,r,a)));return 0===r&&e.length<=0?D.none():D.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>G(o.getStyleItems(),(e=>n(e,r,a)))})}return D.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!s,onAction:t.onAction(o),...o.getStylePreview().fold((()=>({})),(e=>({meta:{style:e}})))})},n=(e,n,r)=>{const s="formatter"===e.type&&t.isInvalid(e);return 0===n?s?[]:o(e,n,!1,r).toArray():o(e,n,s,r).toArray()},r=e=>{const o=t.getCurrentValue(),r=t.shouldHide?0:1;return G(e,(e=>n(e,r,o)))};return{validateItems:r,getFetch:(e,t)=>(o,n)=>{const s=t(),a=r(s);n(qT(a,oy.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:D.none()}))}}},AR=(e,t,o)=>{const n=o.dataset,r="basic"===n.type?()=>F(n.data,(e=>lA(e,o.isSelectedFor,o.getPreviewFor))):n.getData;return{items:DR(t,o),getStyleItems:r}},MR=(e,t,o,n,r)=>{const{items:s,getStyleItems:a}=AR(0,t,o);return ZT({text:o.icon.isSome()?D.none():o.text,icon:o.icon,tooltip:D.from(o.tooltip),role:D.none(),fetch:s.getFetch(t,a),onSetup:t=>{const s=o=>t.setTooltip(OR(e,n,o.value));return e.on(r,s),dC(gC(e,"NodeChange",(t=>{const n=t.getComponent();o.updateText(n),wg.set(t.getComponent(),!e.selection.isEditable())}))(t),(()=>e.off(r,s)))},getApi:e=>({getComponent:w(e),setTooltip:o=>{const n=t.shared.providers.translate(o);kt(e.element,{"aria-label":n,title:n})}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};var NR;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(NR||(NR={}));const RR=(e,t,o)=>{const n=(e=>F(e,(e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}})))(((e,t)=>t===NR.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o));return{type:"basic",data:n}},BR="Alignment {0}",LR="left",HR=[{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"}],IR=e=>{const t={type:"basic",data:HR};return{tooltip:OR(e,BR,LR),text:D.none(),icon:D.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:e=>D.none,onAction:t=>()=>W(HR,(e=>e.format===t.format)).each((t=>e.execCommand(t.command))),updateText:t=>{const o=W(HR,(t=>e.formatter.match(t.format))),n=o.fold(w(LR),(e=>e.title.toLowerCase()));Ws(t,VT,{icon:`align-${n}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},PR=(e,t)=>{const o=t(),n=F(o,(e=>e.format));return D.from(e.formatter.closest(n)).bind((e=>W(o,(t=>t.format===e)))).orThunk((()=>ke(e.formatter.match("p"),{title:"Paragraph",format:"p"})))},FR="Block {0}",zR="Paragraph",VR=e=>{const t=RR(e,"block_formats",NR.SemiColon);return{tooltip:OR(e,FR,zR),text:D.some(zR),icon:D.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},onAction:hC(e),updateText:o=>{const n=PR(e,(()=>t.data)).fold(w(zR),(e=>e.title));Ws(o,zT,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},ZR="Font {0}",UR="System Font",jR=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],WR=e=>{const t=e.split(/\s*,\s*/);return F(t,(e=>e.replace(/^['"]+|['"]+$/g,"")))},$R=(e,t)=>t.length>0&&K(t,(t=>e.indexOf(t.toLowerCase())>-1)),qR=e=>{const t=()=>{const t=e=>e?WR(e)[0]:"",n=e.queryCommandValue("FontName"),r=o.data,s=n?n.toLowerCase():"",a=Bb(e),i=W(r,(e=>{const o=e.format;return o.toLowerCase()===s||t(o).toLowerCase()===t(s).toLowerCase()})).orThunk((()=>ke(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=WR(e.toLowerCase());return $R(o,jR)||$R(o,t)}return!1})(s,a),{title:UR,format:s})));return{matchOpt:i,font:n}},o=RR(e,"font_family_formats",NR.SemiColon);return{tooltip:OR(e,ZR,UR),text:D.some(UR),icon:D.none(),isSelectedFor:e=>t=>t.exists((t=>t.format===e)),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>D.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:r}=t(),s=n.fold(w(r),(e=>e.title));Ws(o,zT,{text:s}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:s})},dataset:o,shouldHide:!1,isInvalid:T}},GR={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:[""]},KR=(()=>{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})`})(.*)$`)})(),YR=(e,t)=>D.from(KR.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>H(t,(t=>H(GR[t],(t=>e===t)))))(n,t)?D.some({value:o,unit:n}):D.none()})),XR={tab:w(9),escape:w(27),enter:w(13),backspace:w(8),delete:w(46),left:w(37),up:w(38),right:w(39),down:w(40),space:w(32),home:w(36),end:w(35),pageUp:w(33),pageDown:w(34)},JR=(e,t,o)=>{let n=D.none();const r=gC(e,"NodeChange SwitchMode",(t=>{const r=t.getComponent();n=D.some(r),o.updateInputValue(r),wg.set(r,!e.selection.isEditable())})),s=e=>({getComponent:w(e)}),a=Hr(v),i=ya("custom-number-input-events"),l=(e,t,r)=>{const s=n.map((e=>Xm.getValue(e))).getOr("");const a=o.getNewValue(s,e),i=s.length-`${a}`.length,l=n.map((e=>e.element.dom.selectionStart-i)),c=n.map((e=>e.element.dom.selectionEnd-i));o.onAction(a,r),n.each((e=>{Xm.setValue(e,a),t&&(l.each((t=>e.element.dom.selectionStart=t)),c.each((t=>e.element.dom.selectionEnd=t)))}))},c=(e,t)=>l(((e,t)=>e-t),e,t),d=(e,t)=>l(((e,t)=>e+t),e,t),m=e=>rt(e.element).fold(D.none,(e=>(tc(e),D.some(!0)))),u=e=>nc(e.element)?(lt(e.element).each((e=>tc(e))),D.some(!0)):D.none(),g=(o,n,r,a)=>{const i=Hr(v),l=t.shared.providers.translate(r),c=ya("altExecuting"),d=gC(e,"NodeChange SwitchMode",(t=>{wg.set(t.getComponent(),!e.selection.isEditable())})),m=e=>{wg.isDisabled(e)||o(!0)};return Nf.sketch({dom:{tag:"button",attributes:{title:l,"aria-label":l},classes:a.concat(n)},components:[IT(n,t.shared.providers.icons)],buttonBehaviours:ql([wg.config({}),Ip(c,[yx({onSetup:d,getApi:s},i),wx({getApi:s},i),Qs(is(),((e,t)=>{t.event.raw.keyCode!==XR.space()&&t.event.raw.keyCode!==XR.enter()||wg.isDisabled(e)||o(!1)})),Qs(ms(),m),Qs(Jr(),m)])]),eventOrder:{[is()]:[c,"keying"],[ms()]:[c,"alloy.base.behaviour"],[Jr()]:[c,"alloy.base.behaviour"]}})},h=Bf(g((e=>c(!1,e)),"minus","Decrease font size",[])),p=Bf(g((e=>d(!1,e)),"plus","Increase font size",[])),f=Bf({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[_y.sketch({inputBehaviours:ql([wg.config({}),Ip(i,[yx({onSetup:r,getApi:s},a),wx({getApi:s},a)]),Ip("input-update-display-text",[Qs(zT,((e,t)=>{Xm.setValue(e,t.event.text)})),Qs(as(),(e=>{o.onAction(Xm.getValue(e))})),Qs(ds(),(e=>{o.onAction(Xm.getValue(e))}))]),Tp.config({mode:"special",onEnter:e=>(l(x,!0,!0),D.some(!0)),onEscape:m,onUp:e=>(d(!0,!1),D.some(!0)),onDown:e=>(c(!0,!1),D.some(!0)),onLeft:(e,t)=>(t.cut(),D.none()),onRight:(e,t)=>(t.cut(),D.none())})])})],behaviours:ql([Zp.config({}),Tp.config({mode:"special",onEnter:u,onSpace:u,onEscape:m}),Ip("input-wrapper-events",[Qs(rs(),(e=>{z([h,p],(t=>{const o=Le.fromDom(t.get(e).element.dom);nc(o)&&oc(o)}))}))])])});return{dom:{tag:"div",classes:["tox-number-input"]},components:[h.asSpec(),f.asSpec(),p.asSpec()],behaviours:ql([Zp.config({}),Tp.config({mode:"flow",focusInside:eh.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>nc(e.element)?D.none():(tc(e.element),D.some(!0))})])}},QR="Font size {0}",eB="12pt",tB={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},oB={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},nB=(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":ve(oB,e).getOr(e),rB=e=>ve(tB,e).getOr(""),sB=e=>{const t=()=>{let t=D.none();const o=n.data,r=e.queryCommandValue("FontSize");if(r)for(let e=3;t.isNone()&&e>=0;e--){const n=nB(r,e),s=rB(n);t=W(o,(e=>e.format===r||e.format===n||e.format===s))}return{matchOpt:t,size:r}},o=w(D.none),n=RR(e,"font_size_formats",NR.Space);return{tooltip:OR(e,QR,eB),text:D.some(eB),icon:D.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:r}=t(),s=n.fold(w(r),(e=>e.title));Ws(o,zT,{text:s}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:s})},dataset:n,shouldHide:!1,isInvalid:T}},aB="Format {0}",iB=(e,t)=>{const o="Paragraph";return{tooltip:OR(e,aB,o),text:D.some(o),icon:D.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},onAction:hC(e),updateText:t=>{const n=e=>nA(e)?G(e.items,n):rA(e)?[{title:e.title,format:e.format}]:[],r=G(iA(e),n),s=PR(e,w(r)).fold(w(o),(e=>e.title));Ws(t,zT,{text:s}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:s})},shouldHide:ab(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},lB=w([dr("toggleClass"),dr("fetch"),ol("onExecute"),Tr("getHotspot",D.some),Tr("getAnchorOverrides",w({})),Xc(),ol("onItemExecute"),yr("lazySink"),dr("dom"),el("onOpen"),Jm("splitDropdownBehaviours",[pS,Tp,Zp]),Tr("matchWidth",!1),Tr("useMinWidth",!1),Tr("eventOrder",{}),yr("role")].concat(RS())),cB=Tu({factory:Nf,schema:[dr("dom")],name:"arrow",defaults:()=>({buttonBehaviours:ql([Zp.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each($s)},buttonBehaviours:ql([Yp.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),dB=Tu({factory:Nf,schema:[dr("dom")],name:"button",defaults:()=>({buttonBehaviours:ql([Zp.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each((o=>{e.onExecute(o,t)}))}})}),mB=w([cB,dB,Du({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[dr("text")],name:"aria-descriptor"}),Ou({schema:[Xi()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each((n=>{e.onItemExecute(n,t,o)}))}})}),SS()]),uB=og({name:"SplitDropdown",configFields:lB(),partFields:mB(),factory:(e,t,o,n)=>{const r=e=>{ag.getCurrent(e).each((e=>{Mg.highlightFirst(e),Tp.focusIn(e)}))},s=t=>{TS(e,x,t,n,r,Tf.HighlightMenuAndItem).get(v)},a=t=>{const o=Zu(t,e,"button");return $s(o),D.some(!0)},i={...Ys([ia(((t,o)=>{Vu(t,e,"aria-descriptor").each((e=>{const o=ya("aria");St(e.element,"id",o),St(t.element,"aria-describedby",o)}))}))]),...Qp(D.some(s))},l={repositionMenus:e=>{Yp.isOn(e)&&NS(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[Cs()]:["disabling","toggling","alloy.base.behaviour"]},events:i,behaviours:eu(e.splitDropdownBehaviours,[pS.config({others:{sandbox:t=>{const o=Zu(t,e,"arrow");return MS(e,t,{onOpen:()=>{Yp.on(o),Yp.on(t)},onClose:()=>{Yp.off(o),Yp.off(t)}})}}}),Tp.config({mode:"special",onSpace:a,onEnter:a,onDown:e=>(s(e),D.some(!0))}),Zp.config({}),Yp.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),gB=e=>({isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t),setText:t=>Ws(e,zT,{text:t}),setIcon:t=>Ws(e,VT,{icon:t})}),hB=e=>({setActive:t=>{Yp.set(e,t)},isActive:()=>Yp.isOn(e),isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t),setText:t=>Ws(e,zT,{text:t}),setIcon:t=>Ws(e,VT,{icon:t})}),pB=(e,t)=>e.map((e=>({"aria-label":t.translate(e),title:t.translate(e)}))).getOr({}),fB=ya("focus-button"),vB=(e,t,o,n,r)=>{const s=t.map((e=>Bf(FT(e,"tox-tbtn",r)))),a=e.map((e=>Bf(PT(e,r.icons))));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:pB(o,r)},components:Sx([a.map((e=>e.asSpec())),s.map((e=>e.asSpec()))]),eventOrder:{[es()]:["focusing","alloy.base.behaviour",RT],[Rs()]:[RT,"toolbar-group-button-events"]},buttonBehaviours:ql([vx(r.isDisabled),gx(),Ip(RT,[ia(((e,t)=>LT(e))),Qs(zT,((e,t)=>{s.bind((t=>t.getOpt(e))).each((e=>{Hp.set(e,[Ci(r.translate(t.event.text))])}))})),Qs(VT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Hp.set(e,[PT(t.event.icon,r.icons)])}))})),Qs(es(),((e,t)=>{t.event.prevent(),js(e,fB)}))])].concat(n.getOr([])))}},bB=(e,t,o)=>{var n;const r=Hr(v),s=vB(e.icon,e.text,e.tooltip,D.none(),o);return Nf.sketch({dom:s.dom,components:s.components,eventOrder:BT,buttonBehaviours:{...ql([Ip("toolbar-button-events",[(a={onAction:e.onAction,getApi:t.getApi},da(((e,t)=>{bx(a,e)((t=>{Ws(e,NT,{buttonApi:t}),a.onAction(t)}))}))),yx(t,r),wx(t,r)]),vx((()=>!e.enabled||o.isDisabled())),gx()].concat(t.toolbarButtonBehaviours)),[RT]:null===(n=s.buttonBehaviours)||void 0===n?void 0:n[RT]}});var a},yB=(e,t,o)=>bB(e,{toolbarButtonBehaviours:o.length>0?[Ip("toolbarButtonWith",o)]:[],getApi:gB,onSetup:e.onSetup},t),wB=(e,t,o)=>bB(e,{toolbarButtonBehaviours:[Hp.config({}),Yp.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[Ip("toolbarToggleButtonWith",o)]:[]),getApi:hB,onSetup:e.onSetup},t),xB=(e,t,o)=>n=>wS((e=>t.fetch(e))).map((r=>D.from($S(xn(KC(ya("menu-value"),r,(o=>{t.onItemAction(e(n),o)}),t.columns,t.presets,oy.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:XC(t.columns,t.presets),menuBehaviours:Jw("auto"!==t.columns?[]:[ia(((e,o)=>{Yw(e,4,hy(t.presets)).each((({numRows:t,numColumns:o})=>{Tp.setGridSize(e,t,o)}))}))])}))))),CB=[{name:"history",items:["undo","redo"]},{name:"ai",items:["aidialog","aishortcuts"]},{name:"styles",items:["styles"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],SB=(e,t)=>(o,n,r)=>{const s=e(o).mapError((e=>rr(e))).getOrDie();return t(s,n,r)},kB={button:SB(xw,((e,t)=>{return o=e,n=t.shared.providers,yB(o,n,[]);var o,n})),togglebutton:SB(kw,((e,t)=>{return o=e,n=t.shared.providers,wB(o,n,[]);var o,n})),menubutton:SB(ZM,((e,t)=>_O(e,"tox-tbtn",t,D.none(),!1))),splitbutton:SB((e=>tr("SplitButton",UM,e)),((e,t)=>((e,t)=>{const o=e=>({isEnabled:()=>!wg.isDisabled(e),setEnabled:t=>wg.set(e,!t),setIconFill:(t,o)=>{Bi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{St(e,"fill",o)}))},setActive:t=>{St(e.element,"aria-pressed",t),Bi(e.element,"span").each((o=>{e.getSystem().getByDom(o).each((e=>Yp.set(e,t)))}))},isActive:()=>Bi(e.element,"span").exists((t=>e.getSystem().getByDom(t).exists(Yp.isOn))),setText:t=>Bi(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>Ws(e,zT,{text:t}))))),setIcon:t=>Bi(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>Ws(e,VT,{icon:t}))))),setTooltip:o=>{const n=t.providers.translate(o);kt(e.element,{"aria-label":n,title:n})}}),n=Hr(v),r={getApi:o,onSetup:e.onSetup};return uB.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...pB(e.tooltip,t.providers)}},onExecute:t=>{const n=o(t);n.isEnabled()&&e.onAction(n)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:ql([fx(t.providers.isDisabled),gx(),Ip("split-dropdown-events",[ia(((e,t)=>LT(e))),Qs(fB,Zp.focus),yx(r,n),wx(r,n)]),Wk.config({})]),eventOrder:{[Rs()]:["alloy.base.behaviour","split-dropdown-events"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:xB(o,e,t.providers),parts:{menu:wy(0,e.columns,e.presets)},components:[uB.parts.button(vB(e.icon,e.text,D.none(),D.some([Yp.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),uB.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:Iv("chevron-down",t.providers.icons)},buttonBehaviours:ql([fx(t.providers.isDisabled),gx(),Pv()])}),uB.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared))),grouptoolbarbutton:SB((e=>tr("GroupToolbarButton",FM,e)),((e,t,o)=>{const n=o.ui.registry.getAll().buttons,r=e=>OB(o,{buttons:n,toolbar:e,allowToolbarGroups:!1},t,D.none()),s={[Kc]:t.shared.header.isPositionedAtTop()?Gc.TopToBottom:Gc.BottomToTop};if(cb(o)===Uv.floating)return((e,t,o,n)=>{const r=t.shared,s=Hr(v),a={toolbarButtonBehaviours:[],getApi:gB,onSetup:e.onSetup},i=[Ip("toolbar-group-button-events",[yx(a,s),wx(a,s)])];return TN.sketch({lazySink:r.getSink,fetch:()=>wS((t=>{t(F(o(e.items),zN))})),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:vB(e.icon,e.text,e.tooltip,D.some(i),r.providers),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,r,s);throw new Error("Toolbar groups are only supported when using floating toolbar mode")}))},_B={styles:(e,t)=>{const o={type:"advanced",...t.styles};return MR(e,t,iB(e,o),aB,"StylesTextUpdate")},fontsize:(e,t)=>MR(e,t,sB(e),QR,"FontSizeTextUpdate"),fontsizeinput:(e,t)=>JR(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>Ws(e,zT,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{YR(o,["unsupportedLength","empty"]);const r=t(),s=YR(o,["unsupportedLength","empty"]).or(YR(r,["unsupportedLength","empty"])),a=s.map((e=>e.value)).getOr(16),i=wb(e),l=s.map((e=>e.unit)).filter((e=>""!==e)).getOr(i),c=n(a,(e=>{var t;return null!==(t={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e])&&void 0!==t?t:{step:1}})(l).step),d=`${(e=>e>=0)(c)?c:a}${l}`;return d!==r&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e)),fontfamily:(e,t)=>MR(e,t,qR(e),ZR,"FontFamilyTextUpdate"),blocks:(e,t)=>MR(e,t,VR(e),FR,"BlocksTextUpdate"),align:(e,t)=>MR(e,t,IR(e),BR,"AlignTextUpdate")},EB=e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=F(CB,(t=>{const o=Z(t.items,(t=>be(e,t)||be(_B,t)));return{name:t.name,items:o}}));return Z(t,(e=>e.items.length>0))})(o):s(t)?(e=>{const t=e.split("|");return F(t,(e=>({items:e.trim().split(" ")})))})(t):(e=>f(e,(e=>be(e,"name")&&be(e,"items"))))(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},TB=(e,t,o,n,r,s)=>ve(t,o.toLowerCase()).orThunk((()=>s.bind((e=>se(e,(e=>ve(t,e+o.toLowerCase()))))))).fold((()=>ve(_B,o.toLowerCase()).map((t=>t(e,r)))),(t=>"grouptoolbarbutton"!==t.type||n?((e,t,o)=>ve(kB,e.type).fold((()=>(console.error("skipping button defined by",e),D.none())),(n=>D.some(n(e,t,o)))))(t,r,e):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),D.none()))),OB=(e,t,o,n)=>{const r=EB(t),s=F(r,(r=>{const s=G(r.items,(r=>0===r.trim().length?[]:TB(e,t.buttons,r,t.allowToolbarGroups,o,n).toArray()));return{title:D.from(e.translate(r.name)),items:s}}));return Z(s,(e=>e.items.length>0))},DB=(e,t,o,n)=>{const r=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,s)){const t=a.map((t=>{const r={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return OB(e,r,n,D.none())}));vR.setToolbars(r,t)}else vR.setToolbar(r,OB(e,o,n,D.none()))},AB=Do(),MB=AB.os.isiOS()&&AB.os.version.major<=12;var NB=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=t,i=Hr(0),l=s.outerContainer;ER(e);const d=Le.fromDom(r.targetNode),m=pt(ht(d));bm(d,s.mothership),((e,t,o)=>{Kb(e)&&bm(o.mainUi.mothership.element,o.popupUi.mothership),vm(t,o.dialogUi.mothership)})(e,m,t),e.on("SkinLoaded",(()=>{vR.setSidebar(l,o.sidebar,Mb(e)),DB(e,t,o,n),i.set(e.getWin().innerWidth),vR.setMenubar(l,wR(e,o)),vR.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let r=e.getWin();const s=e.getDoc().documentElement,a=Hr($t(r.innerWidth,r.innerHeight)),i=Hr($t(s.offsetWidth,s.offsetHeight)),l=()=>{const t=a.get();t.left===r.innerWidth&&t.top===r.innerHeight||(a.set($t(r.innerWidth,r.innerHeight)),iC(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set($t(t.offsetWidth,t.offsetHeight)),iC(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(r,"resize",l),n.bind(r,"scroll",d);const m=Tc(Le.fromDom(e.getBody()),"load",c);e.on("hide",(()=>{z(o,(e=>{Mt(e.element,"display","none")}))})),e.on("show",(()=>{z(o,(e=>{Ft(e.element,"display")}))})),e.on("NodeChange",c),e.on("remove",(()=>{m.unbind(),n.unbind(r,"resize",l),n.unbind(r,"scroll",d),r=null}))})(e,t)}));const u=vR.getSocket(l).getOrDie("Could not find expected socket element");if(MB){Nt(u.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=((e,t)=>{let o=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{c(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}})((()=>{e.dispatch("ScrollContent")}),20),o=Ec(u.element,"scroll",t.throttle);e.on("remove",o.unbind)}ux(e,t),e.addCommand("ToggleSidebar",((t,o)=>{vR.toggleSidebar(l,o),e.dispatch("ToggleSidebar")})),e.addQueryValueHandler("ToggleSidebar",(()=>{var e;return null!==(e=vR.whichSidebar(l))&&void 0!==e?e:""})),e.addCommand("ToggleView",((t,o)=>{if(vR.toggleView(l,o)){const t=l.element;s.mothership.broadcastOn([Nm()],{target:t}),z(a,(e=>{e.broadcastOn([Nm()],{target:t})})),c(vR.whichView(l))&&(e.focus(),e.nodeChanged(),vR.refreshToolbar(l))}})),e.addQueryValueHandler("ToggleView",(()=>{var e;return null!==(e=vR.whichView(l))&&void 0!==e?e:""}));const g=cb(e);g!==Uv.sliding&&g!==Uv.floating||e.on("ResizeWindow ResizeEditor ResizeContent",(()=>{const o=e.getWin().innerWidth;o!==i.get()&&(vR.refreshToolbar(t.mainUi.outerContainer),i.set(o))}));const h={setEnabled:e=>{mx(t,!e)},isEnabled:()=>!wg.isDisabled(l)};return{iframeContainer:u.element.dom,editorContainer:l.element.dom,api:h}}});const RB=e=>/^[0-9\.]+(|px)$/i.test(""+e)?D.some(parseInt(""+e,10)):D.none(),BB=e=>p(e)?e+"px":e,LB=(e,t,o)=>{const n=t.filter((t=>ee>t));return n.or(r).getOr(e)},HB=e=>{const t=(e=>{const t=Jv(e),o=tb(e),n=nb(e);return RB(t).map((e=>LB(e,o,n)))})(e);return t.getOr(Jv(e))},IB=e=>{const t=Qv(e),o=eb(e),n=ob(e);return RB(t).map((e=>LB(e,o,n)))},{ToolbarLocation:PB,ToolbarMode:FB}=Xb,zB=(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=o,i=Wv.DOM,l=Wb(e),c=Gb(e),d=ob(e).or(IB(e)),m=n.shared.header,u=m.isPositionedAtTop,g=cb(e),h=g===FB.sliding||g===FB.floating,p=Hr(!1),f=()=>p.get()&&!e.removed,v=e=>h?e.fold(w(0),(e=>e.components().length>1?Ut(e.components()[1].element):0)):0,b=(e,t)=>Kb(e)?XA(t):D.none(),y=()=>{z(a,(e=>{e.broadcastOn([Rm()],{})}))},x=o=>{if(!f())return;l||r.on((e=>{const o=d.getOrThunk((()=>{const e=RB(Bt(wt(),"margin-left")).getOr(0);return Xt(wt())-Gt(t).left+e}));Mt(e.element,"max-width",o+"px")}));const n=l?D.none():(()=>{if(l)return D.none();if(Gt(s.outerContainer.element).left+Jt(s.outerContainer.element)>=window.innerWidth-40||Ht(s.outerContainer.element,"width").isSome()){Mt(s.outerContainer.element,"position","absolute"),Mt(s.outerContainer.element,"left","0px"),Ft(s.outerContainer.element,"width");const e=Jt(s.outerContainer.element);return D.some(e)}return D.none()})();h&&vR.refreshToolbar(s.outerContainer),l||(o=>{r.on((n=>{const r=vR.getToolbar(s.outerContainer),a=v(r),i=Ko(t),{top:l,left:c}=b(e,s.outerContainer.element).fold((()=>({top:u()?Math.max(i.y-Ut(n.element)+a,0):i.bottom,left:i.x})),(e=>{var t;const o=Ko(e),r=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,s=Xe(e,wt()),l=s?Math.max(i.y-Ut(n.element)+a,0):i.y-o.y+r-Ut(n.element)+a;return{top:u()?l:i.bottom,left:s?i.x:i.x-o.x}})),d={position:"absolute",left:Math.round(c)+"px",top:Math.round(l)+"px"},m=o.map((e=>{const t=zo(),o=window.innerWidth-(c-t.left);return{width:Math.max(Math.min(e,o),150)+"px"}})).getOr({});Nt(s.outerContainer.element,{...d,...m})}))})(n),c&&r.on(o),y()},C=()=>!(l||!c||!f())&&r.get().exists((o=>{const n=m.getDockingMode(),a=(o=>{switch(mb(e)){case PB.auto:const e=vR.getToolbar(s.outerContainer),n=v(e),r=Ut(o.element)-n,a=Ko(t);if(a.y>r)return"top";{const e=tt(t),o=Math.max(e.dom.scrollHeight,Ut(e));return a.bottom{OM.setModes(e,[i]),m.setDockingMode(i);const t=u()?Gc.TopToBottom:Gc.BottomToTop;St(e.element,Kc,t)})),!0);var i}));return{isVisible:f,isPositionedAtTop:u,show:()=>{p.set(!0),Mt(s.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),z(a,(e=>{Ft(e.element,"display")})),C(),Kb(e)?x((e=>OM.isDocked(e)?OM.reset(e):OM.refresh(e))):x(OM.refresh)},hide:()=>{p.set(!1),Mt(s.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),z(a,(e=>{Mt(e.element,"display","none")}))},update:x,updateMode:()=>{C()&&x(OM.reset)},repositionPopups:y}},VB=(e,t)=>{const o=Ko(e);return{pos:t?o.y:o.bottom,bounds:o}};var ZB=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:s}=t,a=kc(),i=Le.fromDom(r.targetNode),l=zB(e,i,t,n,a),c=hb(e);TR(e);const d=()=>{if(a.isSet())return void l.show();a.set(vR.getHeader(s.outerContainer).getOrDie());const r=$b(e);Kb(e)?(bm(i,s.mothership),bm(i,t.popupUi.mothership)):vm(r,s.mothership),vm(r,t.dialogUi.mothership),DB(e,t,o,n),vR.setMenubar(s.outerContainer,wR(e,o)),l.show(),((e,t,o,n)=>{const r=Hr(VB(t,o.isPositionedAtTop())),s=n=>{const{pos:s,bounds:a}=VB(t,o.isPositionedAtTop()),{pos:i,bounds:l}=r.get(),c=a.height!==l.height||a.width!==l.width;r.set({pos:s,bounds:a}),c&&iC(e,n),o.isVisible()&&(i!==s?o.update(OM.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",(()=>o.update(OM.reset))),e.on("NodeChange keydown",(e=>{requestAnimationFrame((()=>s(e)))}));let a=0;const i=iT((()=>o.update(OM.refresh)),33);e.on("ScrollWindow",(()=>{const e=zo().left;e!==a&&(a=e,i.throttle()),o.updateMode()})),Kb(e)&&e.on("ElementScroll",(e=>{o.update(OM.refresh)}));const l=Sc();l.set(Tc(Le.fromDom(e.getBody()),"load",(e=>s(e.raw)))),e.on("remove",(()=>{l.clear()}))})(e,i,l,c),e.nodeChanged()};e.on("show",d),e.on("hide",l.hide),c||(e.on("focus",d),e.on("blur",l.hide)),e.on("init",(()=>{(e.hasFocus()||c)&&d()})),ux(e,t);const m={show:d,hide:l.hide,setEnabled:e=>{mx(t,!e)},isEnabled:()=>!wg.isDisabled(s.outerContainer)};return{editorContainer:s.outerContainer.element.dom,api:m}}});const UB="contexttoolbar-hide",jB=(e,t)=>Qs(NT,((o,n)=>{const r=(e=>({hide:()=>js(e,Es()),getValue:()=>Xm.getValue(e)}))(e.get(o));t.onAction(r,n.event.buttonApi)})),WB=(e,t,o)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o)=>{const{primary:n,...r}=t.original,s=or(kw({...r,type:"togglebutton",onAction:v}));return wB(s,o,[jB(e,t)])})(e,t,o):((e,t,o)=>{const{primary:n,...r}=t.original,s=or(xw({...r,type:"button",onAction:v}));return yB(s,o,[jB(e,t)])})(e,t,o),$B=(e,t)=>{const o=e.label.fold((()=>({})),(e=>({"aria-label":e}))),n=Bf(_y.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:ql([Tp.config({mode:"special",onEnter:e=>r.findPrimary(e).map((e=>($s(e),!0))),onLeft:(e,t)=>(t.cut(),D.none()),onRight:(e,t)=>(t.cut(),D.none())})])})),r=((e,t,o)=>{const n=F(t,(t=>Bf(WB(e,t,o))));return{asSpecs:()=>F(n,(e=>e.asSpec())),findPrimary:e=>se(t,((t,o)=>t.primary?D.from(n[o]).bind((t=>t.getOpt(e))).filter(k(wg.isDisabled)):D.none()))}})(n,e.commands,t);return[{title:D.none(),items:[n.asSpec()]},{title:D.none(),items:r.asSpecs()}]},qB=$B,GB=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,KB=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=dt(Le.fromDom(e.startContainer),e.startOffset).element;return(We(o)?nt(o):D.some(o)).filter(je).map((e=>e.dom.getBoundingClientRect())).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=zo();return Go(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=Yo(Le.fromDom(e.getBody()));return Go(o.x+t.left,o.y+t.top,t.width,t.height)}},YB=(e,t,o,n=0)=>{const r=Uo(window),s=Ko(Le.fromDom(e.getContentAreaContainer())),a=Hb(e)||zb(e)||Zb(e),{x:i,width:l}=((e,t,o)=>{const n=Math.max(e.x+o,t.x);return{x:n,width:Math.min(e.right-o,t.right)-n}})(s,r,n);if(e.inline&&!a)return Go(i,r.y,l,r.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,r,s)=>{const a=Le.fromDom(e.getContainer()),i=Bi(a,".tox-editor-header").getOr(a),l=Ko(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+s,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-s,o.bottom)};const m="line"===r?Ko(a):t;return d?{y:Math.max(l.bottom+s,o.y),bottom:Math.min(m.bottom-s,o.bottom)}:{y:Math.max(m.y+s,o.y),bottom:Math.min(l.y-s,o.bottom)}})(e,s,r,a,o,n);return Go(i,c,l,d-c)}},XB={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"]},JB={maxHeightFunction:Fc(),maxWidthFunction:wN()},QB=e=>"node"===e,eL=(e,t,o,n,r)=>{const s=KB(e),a=n.lastElement().exists((e=>Xe(o,e)));if(((e,t)=>{const o=e.selection.getRng(),n=dt(Le.fromDom(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&Xe(n.element,t)})(e,o))return a?ZD:ID;if(a)return((e,t,o)=>{const n=Ht(e,"position");Mt(e,"position",t);const r=o(e);return n.each((t=>Mt(e,"position",t))),r})(t,n.getMode(),(()=>GB(s,Ko(t),-20)&&!n.isReposition()?jD:ZD));return("fixed"===n.getMode()?r.y+zo().top:r.y)+(Ut(t)+12)<=s.y?ID:PD},tL=(e,t,o,n)=>{const r=t=>(n,r,s,a,i)=>({...eL(e,a,t,o,i)({...n,y:i.y,height:i.height},r,s,a,i),alwaysFit:!0}),s=e=>QB(n)?[r(e)]:[];return t?{onLtr:e=>[Nl,Tl,Ol,Dl,Al,Ml].concat(s(e)),onRtl:e=>[Nl,Ol,Tl,Al,Dl,Ml].concat(s(e))}:{onLtr:e=>[Ml,Nl,Dl,Tl,Al,Ol].concat(s(e)),onRtl:e=>[Ml,Nl,Al,Ol,Dl,Tl].concat(s(e))}},oL=(e,t)=>{const o=Z(t,(t=>t.predicate(e.dom))),{pass:n,fail:r}=V(o,(e=>"contexttoolbar"===e.type));return{contextToolbars:n,contextForms:r}},nL=(e,t,o)=>{const n=oL(e,t);if(n.contextForms.length>0)return D.some({elem:e,toolbars:[n.contextForms[0]]});{const t=oL(e,o);if(t.contextForms.length>0)return D.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=>H(e,(e=>e.position===t)),o=t=>Z(e,(e=>e.position===t)),n=t("selection"),r=t("node");if(n||r){if(r&&n){const e=o("node"),t=F(o("selection"),(e=>({...e,position:"node"})));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return D.some({elem:e,toolbars:o})}return D.none()}},rL=(e,t,o)=>e(t)?D.none():Ur(t,(e=>{if(je(e)){const{contextToolbars:t,contextForms:n}=oL(e,o.inNodeScope),r=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>W(e,(e=>e.position===t)),o=t("selection").orThunk((()=>t("node"))).orThunk((()=>t("line"))).map((e=>e.position));return o.fold((()=>[]),(t=>Z(e,(e=>e.position===t))))}})(t);return r.length>0?D.some({elem:e,toolbars:r}):D.none()}return D.none()}),e),sL=(e,t)=>{const o={},n=[],r=[],s={},a={},i=(e,i)=>{const l=or(tr("ContextForm",Mw,i));o[e]=l,l.launch.map((o=>{s["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}})),"editor"===l.scope?r.push(l):n.push(l),a[e]=l},l=(e,t)=>{var o;(o=t,tr("ContextToolbar",Nw,o)).each((o=>{"editor"===t.scope?r.push(o):n.push(o),a[e]=o}))},c=ae(e);return z(c,(t=>{const o=e[t];"contextform"===o.type?i(t,o):"contexttoolbar"===o.type&&l(t,o)})),{forms:o,inNodeScope:n,inEditorScope:r,lookupTable:a,formNavigators:s}},aL=ya("forward-slide"),iL=ya("backward-slide"),lL=ya("change-slide-event"),cL="tox-pop--resizing",dL="tox-pop--transition",mL=(e,t,o,n)=>{const r=n.backstage,s=r.shared,a=Do().deviceType.isTouch,i=kc(),l=kc(),c=kc(),d=Ei((e=>{const t=Hr([]);return Af.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),Af.getContent(e).each((e=>{Ft(e.element,"visibility")})),ni(e.element,cL),Ft(e.element,"width")},inlineBehaviours:ql([Ip("context-toolbar-events",[aa(gs(),((e,t)=>{"width"===t.event.raw.propertyName&&(ni(e.element,cL),Ft(e.element,"width"))})),Qs(lL,((e,t)=>{const o=e.element;Ft(o,"width");const n=Xt(o);Af.setContent(e,t.event.contents),ti(o,cL);const r=Xt(o);Mt(o,"width",n+"px"),Af.getContent(e).each((e=>{t.event.focus.bind((e=>(tc(e),sc(o)))).orThunk((()=>(Tp.focusIn(e),rc(ht(o)))))})),setTimeout((()=>{Mt(e.element,"width",r+"px")}),0)})),Qs(aL,((e,o)=>{Af.getContent(e).each((o=>{t.set(t.get().concat([{bar:o,focus:rc(ht(e.element))}]))})),Ws(e,lL,{contents:o.event.forwardContents,focus:D.none()})})),Qs(iL,((e,o)=>{ne(t.get()).each((o=>{t.set(t.get().slice(0,t.get().length-1)),Ws(e,lL,{contents:Ti(o.bar),focus:o.focus})}))}))]),Tp.config({mode:"special",onEscape:o=>ne(t.get()).fold((()=>e.onEscape()),(e=>(js(o,iL),D.some(!0))))})]),lazySink:()=>on.value(e.sink)})})({sink:o,onEscape:()=>(e.focus(),D.some(!0))})),m=()=>{const t=c.get().getOr("node"),o=QB(t)?1:0;return YB(e,s,t,o)},u=()=>!(e.removed||a()&&r.isContextMenuOpen()),g=()=>{if(u()){const t=m(),o=we(c.get(),"node")?((e,t)=>t.filter((e=>yt(e)&&Ue(e))).map(Yo).getOrThunk((()=>KB(e))))(e,i.get()):KB(e);return t.height<=0||!GB(o,t,.01)}return!0},h=()=>{i.clear(),l.clear(),c.clear(),Af.hide(d)},p=()=>{if(Af.isOpen(d)){const e=d.element;Ft(e,"display"),g()?Mt(e,"display","none"):(l.set(0),Af.reposition(d))}},f=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:ql([Tp.config({mode:"acyclic"}),Ip("pop-dialog-wrap-events",[ia((t=>{e.shortcuts.add("ctrl+F9","focus statusbar",(()=>Tp.focusIn(t)))})),la((t=>{e.shortcuts.remove("ctrl+F9")}))])])}),b=Qt((()=>sL(t,(e=>{const t=y([e]);Ws(d,aL,{forwardContents:f(t)})})))),y=t=>{const{buttons:o}=e.ui.registry.getAll(),r={...o,...b().formNavigators},a=cb(e)===Uv.scrolling?Uv.scrolling:Uv.default,i=q(F(t,(t=>"contexttoolbar"===t.type?((t,o)=>OB(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,D.some(["form:"])))(r,t):((e,t)=>qB(e,t))(t,s.providers))));return WN({type:a,uid:ya("context-toolbar"),initGroups:i,onEscape:D.none,cyclicKeying:!0,providers:s.providers})},w=(t,n)=>{const r="node"===t?s.anchors.node(n):s.anchors.cursor(),c=((e,t,o,n)=>"line"===t?{bubble:Uc(12,0,XB),layouts:{onLtr:()=>[Rl],onRtl:()=>[Bl]},overrides:JB}:{bubble:Uc(0,12,XB,1/12),layouts:tL(e,o,n,t),overrides:JB})(e,t,a(),{lastElement:i.get,isReposition:()=>we(l.get(),0),getMode:()=>rm.getMode(o)});return xn(r,c)},x=(e,t)=>{if(S.cancel(),!u())return;const n=y(e),r=e[0].position,s=w(r,t);c.set(r),l.set(1);const a=d.element;Ft(a,"display"),(e=>we(Ce(e,i.get(),Xe),!0))(t)||(ni(a,dL),rm.reset(o,d)),Af.showWithinBounds(d,f(n),{anchor:s,transition:{classes:[dL],mode:"placement"}},(()=>D.some(m()))),t.fold(i.clear,i.set),g()&&Mt(a,"display","none")};let C=!1;const S=iT((()=>{if(e.hasFocus()&&!e.removed&&!C)if(si(d.element,dL))S.throttle();else{((e,t)=>{const o=Le.fromDom(t.getBody()),n=e=>Xe(e,o),r=Le.fromDom(t.selection.getNode());return(e=>!n(e)&&!Je(o,e))(r)?D.none():nL(r,e.inNodeScope,e.inEditorScope).orThunk((()=>rL(n,r,e)))})(b(),e).fold(h,(e=>{x(e.toolbars,D.some(e.elem))}))}}),17);e.on("init",(()=>{e.on("remove",h),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",p),e.on("click keyup focus SetContent",S.throttle),e.on(UB,h),e.on("contexttoolbar-show",(t=>{const o=b();ve(o.lookupTable,t.toolbarKey).each((o=>{x([o],ke(t.target!==e,t.target)),Af.getContent(d).each(Tp.focusIn)}))})),e.on("focusout",(t=>{Mf.setEditorTimeout(e,(()=>{sc(o.element).isNone()&&sc(d.element).isNone()&&h()}),0)})),e.on("SwitchMode",(()=>{e.mode.isReadOnly()&&h()})),e.on("AfterProgressState",(t=>{t.state?h():e.hasFocus()&&S.throttle()})),e.on("dragstart",(()=>{C=!0})),e.on("dragend drop",(()=>{C=!1})),e.on("NodeChange",(e=>{sc(d.element).fold(S.throttle,v)}))}))},uL=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),r=kc();return F(o,(o=>({type:"togglemenuitem",text:t.display(o),onSetup:s=>{const a=e=>{e&&(r.on((e=>e.setActive(!1))),r.set(s)),s.setActive(e)};a(we(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{r.clear(),i()}},onAction:()=>t.setCurrent(e,o)})))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},gL=e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:Fb,hash:e=>((e,t)=>YR(e,t).map((({value:e,unit:t})=>e+t)))(e,["fixed","relative","empty"]).getOr(e),display:x,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>D.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:mC(e),onMenuSetup:mC(e)}),hL=e=>{uL(e,gL(e)),(e=>D.from(ib(e)).map((t=>({name:"language",text:"Language",icon:"language",getOptions:w(t),hash:e=>m(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>{var n;return e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:null!==(n=t.customCode)&&void 0!==n?n:null}).unbind},getCurrent:e=>{const t=Le.fromDom(e.selection.getNode());return jr(t,(e=>D.some(e).filter(je).bind((e=>Et(e,"lang").map((t=>({code:t,customCode:Et(e,"data-mce-lang").getOrUndefined(),title:""})))))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=Sc();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),dC(o.clear,mC(e)(t))},onMenuSetup:mC(e)}))))(e).each((t=>uL(e,t)))},pL=(e,t)=>{((e,t)=>{const o=AR(0,t,IR(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:mC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=AR(0,t,qR(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:mC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=AR(0,t,iB(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:mC(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=AR(0,t,VR(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:mC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=AR(0,t,sB(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:mC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)},fL=e=>gC(e,"NodeChange",(t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())})),vL=e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:fL(e),onAction:pC(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:mC(e),onAction:pC(e,"indent")})})(e)},bL=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),dC((()=>e.off("PastePlainTextToggle",n)),mC(e)(o))},yL=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},wL=e=>{(e=>{sT.each([{name:"bold",text:"Bold",icon:"bold"},{name:"italic",text:"Italic",icon:"italic"},{name:"underline",text:"Underline",icon:"underline"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],((t,o)=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:uC(e,t.name),onAction:yL(e,t.name)})}));for(let t=1;t<=6;t++){const o="h"+t;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:uC(e,o),onAction:yL(e,o)})}})(e),(e=>{sT.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print"}],(t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:pC(e,t.action)})})),sT.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:mC(e),onAction:pC(e,t.action)})}))})(e),(e=>{sT.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],(t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:pC(e,t.action),onSetup:uC(e,t.name)})}))})(e)},xL=e=>{wL(e),(e=>{sT.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],(t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:pC(e,t.action)})})),sT.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:mC(e),onAction:pC(e,t.action)})})),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:mC(e),onAction:yL(e,"code")})})(e)},CL=(e,t)=>gC(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",(o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())})),SL=e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:CL(e,"hasUndo"),onAction:pC(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:CL(e,"hasRedo"),onAction:pC(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:CL(e,"hasUndo"),onAction:pC(e,"undo")}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:CL(e,"hasRedo"),onAction:pC(e,"redo")})})(e)},kL=e=>gC(e,"VisualAid",(t=>{t.setActive(e.hasVisual)})),_L=e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:pC(e,"mceToggleVisualAid")})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:kL(e),onAction:pC(e,"mceToggleVisualAid")})})(e)},EL=(e,t)=>{(e=>{z([{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:pC(e,t.cmd),onSetup:uC(e,t.name)})})),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:mC(e),onAction:pC(e,"JustifyNone")})})(e),xL(e),pL(e,t),SL(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=BC(e),o=LC(e),n=Hr(t),r=Hr(o);$C(e,"forecolor","forecolor",n),$C(e,"backcolor","hilitecolor",r),qC(e,"forecolor","forecolor","Text color",n),qC(e,"backcolor","hilitecolor","Background color",r)})(e),_L(e),vL(e),hL(e),(e=>{const t=Hr(Ab(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:bL(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:bL(e,t)})})(e)},TL=e=>s(e)?e.split(/[ ,]/):e,OL=e=>t=>t.options.get(e),DL=OL("contextmenu_never_use_native"),AL=OL("contextmenu_avoid_overlap"),ML=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:Z(o,(e=>be(t,e)))},NL=(e,t)=>({type:"makeshift",x:e,y:t}),RL=e=>"longpress"===e.type||0===e.type.indexOf("touch"),BL=(e,t)=>{const o=Wv.DOM.getPos(e);return((e,t,o)=>NL(e.x+t,e.y+o))(t,o.x,o.y)},LL=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(RL(e)){const t=e.touches[0];return NL(t.pageX,t.pageY)}return NL(e.pageX,e.pageY)})(t):BL(e.getContentAreaContainer(),(e=>{if(RL(e)){const t=e.touches[0];return NL(t.clientX,t.clientY)}return NL(e.clientX,e.clientY)})(t)):HL(e),HL=e=>({type:"selection",root:Le.fromDom(e.selection.getNode())}),IL=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:D.some(Le.fromDom(e.selection.getNode())),root:Le.fromDom(e.getBody())}))(e);case"point":return LL(e,t);case"selection":return HL(e)}},PL=(e,t,o,n,r,s)=>{const a=o(),i=IL(e,t,s);qT(a,oy.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:D.none()}).map((e=>{t.preventDefault(),Af.showMenuAt(r,{anchor:i},{menu:{markers:vy("normal")},data:e})}))},FL={onLtr:()=>[Nl,Tl,Ol,Dl,Al,Ml,ID,PD,HD,BD,LD,RD],onRtl:()=>[Nl,Ol,Tl,Al,Dl,Ml,ID,PD,LD,RD,HD,BD]},zL={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"]},VL=(e,t,o,n,r,s,a)=>{const i=((e,t,o)=>{const n=IL(e,t,o);return{bubble:Uc(0,"point"===o?12:0,zL),layouts:FL,overrides:{maxWidthFunction:wN(),maxHeightFunction:Fc()},...n}})(e,t,s);qT(o,oy.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:D.none()}).map((o=>{t.preventDefault();const l=a?Tf.HighlightMenuAndItem:Tf.HighlightNone;Af.showMenuWithinBounds(r,{anchor:i},{menu:{markers:vy("normal"),highlightOnOpen:l},data:o,type:"horizontal"},(()=>D.some(YB(e,n.shared,"node"===s?"node":"selection")))),e.dispatch(UB)}))},ZL=(e,t,o,n,r,s)=>{const a=Do(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),m=()=>{const a=o();VL(e,t,a,n,r,s,!(c||i||l&&d))};if((l||i)&&"node"!==s){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Mf.setEditorTimeout(e,(()=>{e.selection.setRng(t)}),10),s()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const r=()=>s();e.once("longpresscancel",r);const s=()=>{e.off("touchend",o),e.off("longpresscancel",r),e.off("mousedown",n)}})(e),m()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],r=o.getRng();return Ad(e.getWin(),fd.domRange(r)).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 m()},UL=e=>s(e)?"|"===e:"separator"===e.type,jL={type:"separator"},WL=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(s(e))return e;switch(e.type){case"separator":return jL;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return s(t)?t:F(t,WL)}};default:const o=e;return{type:"menuitem",...t(o),onAction:b(o.onAction)}}},$L=(e,t)=>{if(0===t.length)return e;const o=ne(e).filter((e=>!UL(e))),n=o.fold((()=>[]),(e=>[jL]));return e.concat(n).concat(t).concat([jL])},qL=(e,t)=>!(e=>"longpress"===e.type||be(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),GL=(e,t)=>qL(e,t)?e.selection.getStart(!0):t.target,KL=(e,t,o)=>{const n=Do().deviceType.isTouch,r=Ei(Af.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:ql([Ip("dismissContextMenu",[Qs(Ls(),((t,o)=>{Mm.close(t),e.focus()}))])])})),a=()=>Af.hide(r),i=t=>{if(DL(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!DL(e))(e,t)||(e=>0===ML(e).length)(e))return;const a=((e,t)=>{const o=AL(e),n=qL(e,t)?"selection":"point";if(Me(o)){const r=GL(e,t);return QS(Le.fromDom(r),o)?"node":n}return n})(e,t);(n()?ZL:PL)(e,t,(()=>{const o=GL(e,t),n=e.ui.registry.getAll(),r=ML(e);return((e,t,o)=>{const n=j(t,((t,n)=>ve(e,n.toLowerCase()).map((e=>{const n=e.update(o);if(s(n)&&Me(Ae(n)))return $L(t,n.split(" "));if(l(n)&&n.length>0){const e=F(n,WL);return $L(t,e)}return t})).getOrThunk((()=>t.concat([n])))),[]);return n.length>0&&UL(n[n.length-1])&&n.pop(),n})(n.contextMenus,r,o)}),o,r,a)};e.on("init",(()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)}))},YL=Ir([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),XL=e=>t=>t.translate(-e.left,-e.top),JL=e=>t=>t.translate(e.left,e.top),QL=e=>(t,o)=>j(e,((e,t)=>t(e)),$t(t,o)),eH=(e,t,o)=>e.fold(QL([JL(o),XL(t)]),QL([XL(t)]),QL([])),tH=(e,t,o)=>e.fold(QL([JL(o)]),QL([]),QL([JL(t)])),oH=(e,t,o)=>e.fold(QL([]),QL([XL(o)]),QL([JL(t),XL(o)])),nH=(e,t,o)=>{const n=e.fold(((e,t)=>({position:D.some("absolute"),left:D.some(e+"px"),top:D.some(t+"px")})),((e,t)=>({position:D.some("absolute"),left:D.some(e-o.left+"px"),top:D.some(t-o.top+"px")})),((e,t)=>({position:D.some("fixed"),left:D.some(e+"px"),top:D.some(t+"px")})));return{right:D.none(),bottom:D.none(),...n}},rH=(e,t,o,n)=>{const r=(e,r)=>(s,a)=>{const i=e(t,o,n);return r(s.getOr(i.left),a.getOr(i.top))};return e.fold(r(oH,sH),r(tH,aH),r(eH,iH))},sH=YL.offset,aH=YL.absolute,iH=YL.fixed,lH=(e,t)=>{const o=_t(e,t);return m(o)?NaN:parseInt(o,10)},cH=(e,t,o,n)=>((e,t)=>{const o=e.element,n=lH(o,t.leftAttr),r=lH(o,t.topAttr);return isNaN(n)||isNaN(r)?D.none():D.some($t(n,r))})(e,t).fold((()=>o),(e=>iH(e.left+n.left,e.top+n.top))),dH=(e,t,o,n,r,s)=>{const a=cH(e,t,o,n),i=t.mustSnap?gH(e,t,a,r,s):hH(e,t,a,r,s),l=eH(a,r,s);return((e,t,o)=>{const n=e.element;St(n,t.leftAttr,o.left+"px"),St(n,t.topAttr,o.top+"px")})(e,t,l),i.fold((()=>({coord:iH(l.left,l.top),extra:D.none()})),(e=>({coord:e.output,extra:e.extra})))},mH=(e,t)=>{((e,t)=>{const o=e.element;Ot(o,t.leftAttr),Ot(o,t.topAttr)})(e,t)},uH=(e,t,o,n)=>se(e,(e=>{const r=e.sensor,s=((e,t,o,n,r,s)=>{const a=tH(e,r,s),i=tH(t,r,s);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,r,e.range.left,e.range.top,o,n);return s?D.some({output:rH(e.output,t,o,n),extra:e.extra}):D.none()})),gH=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return uH(s,o,n,r).orThunk((()=>{const e=j(s,((e,t)=>{const s=t.sensor,a=((e,t,o,n,r,s)=>{const a=tH(e,r,s),i=tH(t,r,s),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return $t(l,c)})(o,s,t.range.left,t.range.top,n,r);return e.deltas.fold((()=>({deltas:D.some(a),snap:D.some(t)})),(o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:D.some(a),snap:D.some(t)}:e))}),{deltas:D.none(),snap:D.none()});return e.snap.map((e=>({output:rH(e.output,o,n,r),extra:e.extra})))}))},hH=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return uH(s,o,n,r)};var pH=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const t=Qe(e.element),o=zo(t),s=JA(r),a=((e,t,o)=>({coord:rH(e.output,e.output,t,o),extra:e.extra}))(n,o,s),i=nH(a.coord,0,s);Rt(r,i)}}});const fH="data-initial-z-index",vH=(e,t)=>{e.getSystem().addToGui(t),(e=>{nt(e.element).filter(je).each((t=>{Ht(t,"z-index").each((e=>{St(t,fH,e)})),Mt(t,"z-index",Bt(e.element,"z-index"))}))})(t)},bH=e=>{(e=>{nt(e.element).filter(je).each((e=>{Et(e,fH).fold((()=>Ft(e,"z-index")),(t=>Mt(e,"z-index",t))),Ot(e,fH)}))})(e),e.getSystem().removeFromGui(e)},yH=(e,t,o)=>e.getSystem().build(uk.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var wH=Er("snaps",[dr("getSnapPoints"),el("onSensor"),dr("leftAttr"),dr("topAttr"),Tr("lazyViewport",Jo),Tr("mustSnap",!1)]);const xH=[Tr("useFixed",T),dr("blockerClass"),Tr("getTarget",x),Tr("onDrag",v),Tr("repositionTarget",!0),Tr("onDrop",v),Rr("getBounds",Jo),wH],CH=e=>((e,t,o,n)=>e.isSome()&&t.isSome()&&o.isSome()?D.some(n(e.getOrDie(),t.getOrDie(),o.getOrDie())):D.none())(Ht(e,"left"),Ht(e,"top"),Ht(e,"position"),((e,t,o)=>("fixed"===o?iH:sH)(parseInt(e,10),parseInt(t,10)))).getOrThunk((()=>{const t=Gt(e);return aH(t.left,t.top)})),SH=(e,t,o,n,r,s,a)=>((e,t,o,n,r)=>{const s=r.bounds,a=tH(t,o,n),i=bl(a.left,s.x,s.x+s.width-r.width),l=bl(a.top,s.y,s.y+s.height-r.height),c=aH(i,l);return t.fold((()=>{const e=oH(c,o,n);return sH(e.left,e.top)}),w(c),(()=>{const e=eH(c,o,n);return iH(e.left,e.top)}))})(0,t.fold((()=>{const e=(t=o,a=s.left,i=s.top,t.fold(((e,t)=>sH(e+a,t+i)),((e,t)=>aH(e+a,t+i)),((e,t)=>iH(e+a,t+i))));var t,a,i;const l=eH(e,n,r);return iH(l.left,l.top)}),(t=>{const a=dH(e,t,o,s,n,r);return a.extra.each((o=>{t.onSensor(e,o)})),a.coord})),n,r,a),kH=(e,t)=>({bounds:e.getBounds(),height:jt(t.element),width:Jt(t.element)}),_H=(e,t,o,n,r)=>{const s=o.update(n,r),a=o.getStartData().getOrThunk((()=>kH(t,e)));s.each((o=>{((e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const s=Qe(e.element),a=zo(s),i=JA(r),l=CH(r),c=SH(e,t.snaps,l,a,i,n,o),d=nH(c,0,i);Rt(r,d)}t.onDrag(e,r,n)})(e,t,a,o)}))},EH=(e,t,o,n)=>{t.each(bH),o.snaps.each((t=>{mH(e,t)}));const r=o.getTarget(e.element);n.reset(),o.onDrop(e,r)},TH=e=>(t,o)=>{const n=e=>{o.setStartData(kH(t,e))};return Ys([Qs(Ms(),(e=>{o.getStartData().each((()=>n(e)))})),...e(t,o,n)])};var OH=Object.freeze({__proto__:null,getData:e=>D.from($t(e.x,e.y)),getDelta:(e,t)=>$t(t.left-e.left,t.top-e.top)});const DH=(e,t,o)=>[Qs(es(),((n,r)=>{if(0!==r.event.raw.button)return;r.stop();const s=()=>EH(n,D.some(l),e,t),a=ek(s,200),i={drop:s,delayDrop:a.schedule,forceDrop:s,move:o=>{a.cancel(),_H(n,e,t,OH,o)}},l=yH(n,e.blockerClass,(e=>Ys([Qs(es(),e.forceDrop),Qs(ns(),e.drop),Qs(ts(),((t,o)=>{e.move(o.event)})),Qs(os(),e.delayDrop)]))(i));o(n),vH(n,l)}))],AH=[...xH,rl("dragger",{handlers:TH(DH)})];var MH=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return D.some($t(t.clientX,t.clientY))})(t):D.none()},getDelta:(e,t)=>$t(t.left-e.left,t.top-e.top)});const NH=(e,t,o)=>{const n=kc(),r=o=>{EH(o,n.get(),e,t),n.clear()};return[Qs(Yr(),((s,a)=>{a.stop();const i=()=>r(s),l={drop:i,delayDrop:v,forceDrop:i,move:o=>{_H(s,e,t,MH,o)}},c=yH(s,e.blockerClass,(e=>Ys([Qs(Yr(),e.forceDrop),Qs(Jr(),e.drop),Qs(Qr(),e.drop),Qs(Xr(),((t,o)=>{e.move(o.event)}))]))(l));n.set(c);o(s),vH(s,c)})),Qs(Xr(),((o,n)=>{n.stop(),_H(o,e,t,MH,n.event)})),Qs(Jr(),((e,t)=>{t.stop(),r(e)})),Qs(Qr(),r)]},RH=AH,BH=[...xH,rl("dragger",{handlers:TH(NH)})],LH=[...xH,rl("dragger",{handlers:TH(((e,t,o)=>[...DH(e,t,o),...NH(e,t,o)]))})];var HH=Object.freeze({__proto__:null,mouse:RH,touch:BH,mouseOrTouch:LH});var IH=Object.freeze({__proto__:null,init:()=>{let e=D.none(),t=D.none();const o=w({});return Ia({readState:o,reset:()=>{e=D.none(),t=D.none()},update:(t,o)=>t.getData(o).bind((o=>((t,o)=>{const n=e.map((e=>t.getDelta(e,o)));return e=D.some(o),n})(t,o))),getStartData:()=>t,setStartData:e=>{t=D.some(e)}})}});const PH=Xl({branchKey:"mode",branches:HH,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:D.from(e.extra)})},state:IH,apis:pH}),FH=(e,t,o,n,r,s)=>e.fold((()=>PH.snap({sensor:aH(o-20,n-20),range:$t(r,s),output:aH(D.some(o),D.some(n)),extra:{td:t}})),(e=>{const r=o-20,s=n-20,a=e.element.dom.getBoundingClientRect();return PH.snap({sensor:aH(r,s),range:$t(40,40),output:aH(D.some(o-a.width/2),D.some(n-a.height/2)),extra:{td:t}})})),zH=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const r=n.td;((e,t)=>e.exists((e=>Xe(e,t))))(t.get(),r)||(t.set(r),o(r))},mustSnap:!0}),VH=e=>Bf(Nf.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:ql([PH.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),Wk.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),ZH=(e,t)=>{const o=Hr([]),n=Hr([]),r=Hr(!1),s=kc(),a=kc(),i=e=>{const o=Yo(e);return FH(m.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=Yo(e);return FH(u.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=zH((()=>F(o.get(),(e=>i(e)))),s,(t=>{a.get().each((o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})}))})),d=zH((()=>F(n.get(),(e=>l(e)))),a,(t=>{s.get().each((o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})}))})),m=VH(c),u=VH(d),g=Ei(m.asSpec()),h=Ei(u.asSpec()),p=(t,o,n,r)=>{const s=n(o);PH.snapTo(t,s);((t,o,n,r)=>{const s=o.dom.getBoundingClientRect();Ft(t.element,"display");const a=ot(Le.fromDom(e.getBody())).dom.innerHeight,i=n(s),l=r(s,a);(i||l)&&Mt(t.element,"display","none")})(t,o,(e=>e[r]<0),((e,t)=>e[r]>t))},f=e=>p(g,e,i,"top"),v=e=>p(h,e,l,"bottom");Do().deviceType.isTouch()&&(e.on("TableSelectionChange",(e=>{r.get()||(um(t,g),um(t,h),r.set(!0)),s.set(e.start),a.set(e.finish),e.otherCells.each((t=>{o.set(t.upOrLeftCells),n.set(t.downOrRightCells),f(e.start),v(e.finish)}))})),e.on("ResizeEditor ResizeWindow ScrollContent",(()=>{s.get().each(f),a.get().each(v)})),e.on("TableSelectionClear",(()=>{r.get()&&(pm(g),pm(h),r.set(!1)),s.clear(),a.clear()})))};const UH=(e,t,o)=>{var n;const r=null!==(n=t.delimiter)&&void 0!==n?n:"›",s=t=>j(t,((t,n,s)=>{const a=((t,n,r)=>Nf.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":r,"aria-level":r+1}},components:[Ci(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:ql([px(o.isDisabled),gx()])}))(n.name,n.element,s);return 0===s?t.concat([a]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Ci(` ${r} `)]},a])}),[]);return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:ql([Tp.config({mode:"flow",selector:"div[role=button]"}),wg.config({disabled:o.isDisabled}),gx(),yk.config({}),Hp.config({}),Ip("elementPathEvents",[ia(((t,o)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",(()=>Tp.focusIn(t))),e.on("NodeChange",(o=>{const n=(t=>{const o=[];let n=t.length;for(;n-- >0;){const s=t[n];if(1===s.nodeType&&"BR"!==(r=s).nodeName&&!r.getAttribute("data-mce-bogus")&&"bookmark"!==r.getAttribute("data-mce-type")){const t=cC(e,s);if(t.isDefaultPrevented()||o.push({name:t.name,element:s}),t.isPropagationStopped())break}}var r;return o})(o.parents),r=n.length>0?s(n):[];Hp.set(t,r)}))}))])]),components:[]}};var jH;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(jH||(jH={}));const WH=(e,t,o)=>{const n=Le.fromDom(e.getContainer()),r=((e,t,o,n,r)=>{const s={height:LB(n+t.top,tb(e),nb(e))};return o===jH.Both&&(s.width=LB(r+t.left,eb(e),ob(e))),s})(e,t,o,Ut(n),Xt(n));le(r,((e,t)=>{p(e)&&Mt(n,t,BB(e))})),(e=>{e.dispatch("ResizeEditor")})(e)},$H=(e,t,o,n)=>{const r=$t(20*o,20*n);return WH(e,r,t),D.some(!0)},qH=(e,t)=>{const o=(e=>{const t=Db(e);return!1===t?jH.None:"both"===t?jH.Both:jH.Vertical})(e);if(o===jH.None)return D.none();const n=o===jH.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return D.some(zv("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize"),"aria-label":t.translate(n)},behaviours:[PH.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,r)=>WH(e,r,o),blockerClass:"tox-blocker"}),Tp.config({mode:"special",onLeft:()=>$H(e,o,-1,0),onRight:()=>$H(e,o,1,0),onUp:()=>$H(e,o,0,-1),onDown:()=>$H(e,o,0,1)}),yk.config({}),Zp.config({})]},t.icons))},GH=(e,t)=>{const o=()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>Hp.set(e,[Ci(t.translate(["{0} "+n,o[n]]))]);return Nf.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:ql([px(t.isDisabled),gx(),yk.config({}),Hp.config({}),Xm.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Ip("wordcount-events",[da((e=>{const t=Xm.getValue(e),n="words"===t.mode?"characters":"words";Xm.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)})),ia((t=>{e.on("wordCountUpdate",(e=>{const{mode:n}=Xm.getValue(t);Xm.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)}))}))])]),eventOrder:{[Cs()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),Ob(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=v6",rel:"noopener",target:"_blank","aria-label":Mv.translate(["Powered by {0}","Tiny"])},innerHtml:'\n \n\n'.trim()},behaviours:ql([Zp.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}},n=()=>{const n=[],r=Rb(e),s=Tb(e),a=Ob(e)||e.hasPlugin("wordcount"),i=()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(r){const o="tox-statusbar__text-container-3-cols";return a||s?a&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[a&&!s?t:e]};return s&&n.push(UH(e,{},t)),r&&n.push((()=>{const e=Ex("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Ci(Mv.translate(["Press {0} for help",e]))]}})()),a&&n.push(o()),n.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...i()]},components:n}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const o=n(),r=qH(e,t);return o.concat(r.toArray())})()}},KH=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),YH=(e,t)=>{const o=e.inline,n=o?ZB:NB,r=Gb(e)?PM:YA,s=(()=>{const e=kc(),t=kc(),o=kc();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=>Xe(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=kc(),i=kc(),l=kc(),c=Do().deviceType.isTouch()?["tox-platform-touch"]:[],d=Ub(e),m=cb(e),u=Bf({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=Bf({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),h=()=>s.mainUi.get().map((e=>e.outerContainer)).bind(vR.getHeader),p=s.lazyGetInOuterOrDie("anchor bar",u.getOpt),f=s.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),v=s.lazyGetInOuterOrDie("toolbar",vR.getToolbar),b=s.lazyGetInOuterOrDie("throbber",vR.getThrobber),y=IA({popup:()=>on.fromOption(s.popupUi.get().map((e=>e.sink)),"(popup) UI has not been rendered"),dialog:()=>on.fromOption(s.dialogUi.get().map((e=>e.sink)),"UI has not been rendered")},e,p,f),w=()=>vR.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]}}),x=()=>{const t=(()=>{const t={attributes:{[Kc]:d?Gc.BottomToTop:Gc.TopToBottom}},o=vR.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=vR.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:y.popup.shared.getSink,providers:y.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:m,lazyToolbar:v,lazyHeader:()=>h().getOrDie("Could not find header element"),...t}),r=vR.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:m}),s=Zb(e),a=zb(e),i=Hb(e),l=Nb(e),c=w(),g=s||a||i,p=l?[c,o]:[o];return vR.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(g?[]:["tox-editor-header--empty"]),...t},components:q([i?p:[],s?[r]:a?[n]:[],Wb(e)?[]:[u.asSpec()]]),sticky:Gb(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[vR.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),vR.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},r=vR.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),s=vR.parts.viewWrapper({backstage:y.popup}),i=Eb(e)&&!o?D.some(GH(e,y.popup.shared.providers)):D.none(),l=q([d?[]:[t],o?[]:[n],d?[t]:[]]),p=vR.parts.editorContainer({components:q([l,o?[]:[g.asSpec(),...i.toArray()]])}),f=qb(e),b={role:"application",...Mv.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},x=Ei(vR.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:b},components:[p,...o?[]:[s],r],behaviours:ql([gx(),wg.config({disableClass:"tox-tinymce--disabled"}),Tp.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"})])})),C=gk(x);return a.set(C),{mothership:C,outerContainer:x}},C=t=>{const o=BB(HB(e)),n=BB((e=>IB(e).getOr(Qv(e)))(e));return e.inline||(Pt("div","width",n)&&Mt(t.element,"width",n),Pt("div","height",o)?Mt(t.element,"height",o):Mt(t.element,"height","400px")),o},S=t=>{const{mainUi:o,popupUi:s,uiMotherships:a}=t;ce(db(e),((t,o)=>{e.ui.registry.addGroupToolbarButton(o,t)}));const{buttons:i,menuItems:l,contextToolbars:c,sidebars:d,views:u}=e.ui.registry.getAll(),g=Vb(e),p={menuItems:l,menus:Yb(e),menubar:fb(e),toolbar:g.getOrThunk((()=>vb(e))),allowToolbarGroups:m===Uv.floating,buttons:i,sidebar:d,views:u};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",(()=>{vR.focusMenubar(f)})),e.addShortcut("alt+F10","focus toolbar",(()=>{vR.focusToolbar(f)})),e.addCommand("ToggleToolbarDrawer",((e,t)=>{(null==t?void 0:t.skipFocus)?vR.toggleToolbarDrawerWithoutFocusing(f):vR.toggleToolbarDrawer(f)})),e.addQueryStateHandler("ToggleToolbarDrawer",(()=>vR.isToolbarDrawerToggled(f))),((e,t,o)=>{const n=(e,n)=>{z([t,...o],(t=>{t.broadcastEvent(e,n)}))},r=(e,n)=>{z([t,...o],(t=>{t.broadcastOn([e],n)}))},s=e=>r(Nm(),{target:e.target}),a=jo(),i=Ec(a,"touchstart",s),l=Ec(a,"touchmove",(e=>n(Ds(),e))),c=Ec(a,"touchend",(e=>n(As(),e))),d=Ec(a,"mousedown",s),m=Ec(a,"mouseup",(e=>{0===e.raw.button&&r(Bm(),{target:e.target})})),u=e=>r(Nm(),{target:Le.fromDom(e.target)}),g=e=>{0===e.button&&r(Bm(),{target:Le.fromDom(e.target)})},h=()=>{z(e.editorManager.get(),(t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})}))},p=e=>n(Ms(),Oc(e)),f=e=>{r(Rm(),{}),n(Ns(),Oc(e))},v=ht(Le.fromDom(e.getElement())),b=Tc(v,"scroll",(o=>{requestAnimationFrame((()=>{if(null!=e.getContainer()){const r=XS(e,t.element).map((e=>[e.element,...e.others])).getOr([]);H(r,(e=>Xe(e,o.target)))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Fs(),o))}}))})),y=()=>r(Rm(),{}),w=t=>{t.state&&r(Nm(),{target:Le.fromDom(e.getContainer())})},x=e=>{r(Nm(),{target:Le.fromDom(e.relatedTarget.getContainer())})};e.on("PostRender",(()=>{e.on("click",u),e.on("tap",u),e.on("mouseup",g),e.on("mousedown",h),e.on("ScrollWindow",p),e.on("ResizeWindow",f),e.on("ResizeEditor",y),e.on("AfterProgressState",w),e.on("DismissPopups",x)})),e.on("remove",(()=>{e.off("click",u),e.off("tap",u),e.off("mouseup",g),e.off("mousedown",h),e.off("ScrollWindow",p),e.off("ResizeWindow",f),e.off("ResizeEditor",y),e.off("AfterProgressState",w),e.off("DismissPopups",x),d.unbind(),i.unbind(),l.unbind(),c.unbind(),m.unbind(),b.unbind()})),e.on("detach",(()=>{z([t,...o],wm),z([t,...o],(e=>e.destroy()))}))})(e,o.mothership,a),r.setup(e,y.popup.shared,h),EL(e,y.popup),KL(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();z(ae(t),(o=>{const n=t[o],r=()=>we(D.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(r())},onSetup:t=>{t.setActive(r());const o=()=>t.setActive(r());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})}))})(e),dN(e,b,y.popup.shared),mL(e,c,s.sink,{backstage:y.popup}),ZH(e,s.sink);const v={targetNode:e.getElement(),height:C(o.outerContainer)};return n.render(e,t,p,y.popup,v)};return{popups:{backstage:y.popup,getMothership:()=>KH("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>KH("dialogs",i)},renderUI:()=>{const o=x(),n=(()=>{const t=$b(e),o=Xe(wt(),t)&&"grid"===Bt(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...Mv.isRtl()?{dir:"rtl"}:{}}},behaviours:ql([rm.config({useFixed:()=>r.isDocked(h)})])},s={dom:{styles:{width:document.body.clientWidth+"px"}},events:Ys([Qs(Ns(),(e=>{Mt(e.element,"width",document.body.clientWidth+"px")}))])},a=Ei(xn(n,o?s:{})),l=gk(a);return i.set(l),{sink:a,mothership:l}})(),a=Kb(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...Mv.isRtl()?{dir:"rtl"}:{}}},behaviours:ql([rm.config({useFixed:()=>r.isDocked(h),getBounds:()=>t.getPopupSinkBounds()})])},o=Ei(e),n=gk(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(n);s.dialogUi.set(n),s.popupUi.set(a),s.mainUi.set(o);const d={popupUi:a,dialogUi:n,mainUi:o,uiMotherships:s.getUiMotherships()};return S(d)}}},XH=w([dr("lazySink"),yr("dragBlockClass"),Rr("getBounds",Jo),Tr("useTabstopAt",O),Tr("firstTabstop",0),Tr("eventOrder",{}),Jm("modalBehaviours",[Tp]),tl("onExecute"),nl("onEscape")]),JH={sketch:x},QH=w([Du({name:"draghandle",overrides:(e,t)=>({behaviours:ql([PH.config({mode:"mouse",getTarget:e=>Ni(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})])})}),Tu({schema:[dr("dom")],name:"title"}),Tu({factory:JH,schema:[dr("dom")],name:"close"}),Tu({factory:JH,schema:[dr("dom")],name:"body"}),Du({factory:JH,schema:[dr("dom")],name:"footer"}),Ou({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[Tr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Tr("components",[])],name:"blocker"})]),eI=og({name:"ModalDialog",configFields:XH(),partFields:QH(),factory:(e,t,o,n)=>{const r=kc(),s=ya("modal-events"),a={...e.eventOrder,[Rs()]:[s].concat(e.eventOrder["alloy.system.attached"]||[])};return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{r.set(t);const o=e.lazySink(t).getOrDie(),s=n.blocker(),a=o.getSystem().build({...s,components:s.components.concat([Ti(t)]),behaviours:ql([Zp.config({}),Ip("dialog-blocker-events",[aa(ss(),(()=>{iN.isBlocked(t)||Tp.focusIn(t)}))])])});um(o,a),Tp.focusIn(t)},hide:e=>{r.clear(),nt(e.element).each((t=>{e.getSystem().getByDom(t).each((e=>{pm(e)}))}))},getBody:t=>Zu(t,e,"body"),getFooter:t=>Vu(t,e,"footer"),setIdle:e=>{iN.unblock(e)},setBusy:(e,t)=>{iN.block(e,t)}},eventOrder:a,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:eu(e.modalBehaviours,[Hp.config({}),Tp.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),iN.config({getRoot:r.get}),Ip(s,[ia((t=>{((e,t)=>{const o=Et(e,"id").fold((()=>{const e=ya("dialog-label");return St(t,"id",e),e}),x);St(e,"aria-labelledby",o)})(t.element,Zu(t,e,"title").element)}))])])}},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)}}}),tI=Pn([Uy,jy].concat(Fw)),oI=qn,nI=[fw("button"),nw,Mr("align","end",["start","end"]),mw,dw,Sr("buttonType",["primary","secondary"])],rI=[...nI,$y],sI=[hr("type",["submit","cancel","custom"]),...rI],aI=[hr("type",["menu"]),ow,rw,nw,br("items",tI),...nI],iI=[...nI,hr("type",["togglebutton"]),gr("tooltip"),nw,ow,Nr("active",!1)],lI=sr("type",{submit:sI,cancel:sI,custom:sI,menu:aI,togglebutton:iI}),cI=[Uy,$y,hr("level",["info","warn","error","success"]),Gy,Tr("url","")],dI=Pn(cI),mI=[Uy,$y,dw,fw("button"),nw,cw,Sr("buttonType",["primary","secondary","toolbar"]),mw],uI=Pn(mI),gI=[Uy,jy],hI=gI.concat([sw]),pI=gI.concat([Wy,dw]),fI=Pn(pI),vI=qn,bI=hI.concat([uw("auto")]),yI=Pn(bI),wI=Zn([Ky,$y,Gy]),xI=hI.concat([Ar("storageKey","default")]),CI=Pn(xI),SI=$n,kI=Pn(hI),_I=$n,EI=gI.concat([Ar("tag","textarea"),gr("scriptId"),gr("scriptUrl"),((e,t)=>Or(e,t,Yn))("settings",void 0)]),TI=gI.concat([Ar("tag","textarea"),pr("init")]),OI=Qn((e=>tr("customeditor.old",In(TI),e).orThunk((()=>tr("customeditor.new",In(EI),e))))),DI=$n,AI=Pn(hI),MI=Fn(Mn),NI=e=>[Uy,ur("columns"),e],RI=[Uy,gr("html"),Mr("presets","presentation",["presentation","document"])],BI=Pn(RI),LI=hI.concat([Nr("border",!1),Nr("sandboxed",!0),Nr("streamContent",!1),Nr("transparent",!0)]),HI=Pn(LI),II=$n,PI=Pn(gI.concat([Cr("height")])),FI=Pn([gr("url"),xr("zoom"),xr("cachedWidth"),xr("cachedHeight")]),zI=hI.concat([Cr("inputMode"),Cr("placeholder"),Nr("maximized",!1),dw]),VI=Pn(zI),ZI=$n,UI=e=>[Uy,Wy,e,Mr("align","start",["start","center","end"])],jI=[$y,Ky],WI=[$y,br("items",ar(0,(()=>$I)))],$I=zn([Pn(jI),Pn(WI)]),qI=hI.concat([br("items",$I),dw]),GI=Pn(qI),KI=$n,YI=hI.concat([vr("items",[$y,Ky]),Dr("size",1),dw]),XI=Pn(YI),JI=$n,QI=hI.concat([Nr("constrain",!0),dw]),eP=Pn(QI),tP=Pn([gr("width"),gr("height")]),oP=gI.concat([Wy,Dr("min",0),Dr("max",0)]),nP=Pn(oP),rP=Wn,sP=[Uy,br("header",$n),br("cells",Fn($n))],aP=Pn(sP),iP=hI.concat([Cr("placeholder"),Nr("maximized",!1),dw]),lP=Pn(iP),cP=$n,dP=[hr("type",["directory","leaf"]),qy,gr("id"),wr("menu",VM)],mP=Pn(dP),uP=dP.concat([br("children",ar(0,(()=>Jn("type",{directory:gP,leaf:mP}))))]),gP=Pn(uP),hP=Jn("type",{directory:gP,leaf:mP}),pP=[Uy,br("items",hP),kr("onLeafAction"),kr("onToggleExpand"),Br("defaultExpandedIds",[],$n),Cr("defaultSelectedId")],fP=Pn(pP),vP=hI.concat([Mr("filetype","file",["image","media","file"]),dw,Cr("picker_text")]),bP=Pn(vP),yP=Pn([Ky,gw]),wP=e=>ir("items","items",{tag:"required",process:{}},Fn(Qn((t=>tr(`Checking item of ${e}`,xP,t).fold((e=>on.error(rr(e))),(e=>on.value(e))))))),xP=Ln((()=>{return Jn("type",{alertbanner:dI,bar:Pn((e=wP("bar"),[Uy,e])),button:uI,checkbox:fI,colorinput:CI,colorpicker:kI,dropzone:AI,grid:Pn(NI(wP("grid"))),iframe:HI,input:VI,listbox:GI,selectbox:XI,sizeinput:eP,slider:nP,textarea:lP,urlinput:bP,customeditor:OI,htmlpanel:BI,imagepreview:PI,collection:yI,label:Pn(UI(wP("label"))),table:aP,tree:fP,panel:SP});var e})),CP=[Uy,Tr("classes",[]),br("items",xP)],SP=Pn(CP),kP=[fw("tab"),qy,br("items",xP)],_P=[Uy,vr("tabs",kP)],EP=Pn(_P),TP=rI,OP=lI,DP=Pn([gr("title"),mr("body",Jn("type",{panel:SP,tabpanel:EP})),Ar("size","normal"),Br("buttons",[],OP),Tr("initialData",{}),Rr("onAction",v),Rr("onChange",v),Rr("onSubmit",v),Rr("onClose",v),Rr("onCancel",v),Rr("onTabChange",v)]),AP=Pn([hr("type",["cancel","custom"]),...TP]),MP=Pn([gr("title"),gr("url"),xr("height"),xr("width"),_r("buttons",AP),Rr("onAction",v),Rr("onCancel",v),Rr("onClose",v),Rr("onMessage",v)]),NP=e=>a(e)?[e].concat(G(fe(e),NP)):l(e)?G(e,NP):[],RP=e=>s(e.type)&&s(e.name),BP={checkbox:vI,colorinput:SI,colorpicker:_I,dropzone:MI,input:ZI,iframe:II,imagepreview:FI,selectbox:JI,sizeinput:tP,slider:rP,listbox:KI,size:tP,textarea:cP,urlinput:yP,customeditor:DI,collection:wI,togglemenuitem:oI},LP=e=>{const t=(e=>Z(NP(e),RP))(e),o=G(t,(e=>(e=>D.from(BP[e.type]))(e).fold((()=>[]),(t=>[mr(e.name,t)]))));return Pn(o)},HP=e=>{var t;return{internalDialog:or(tr("dialog",DP,e)),dataValidator:LP(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},IP={open:(e,t)=>{const o=HP(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(or(tr("dialog",MP,t))),redial:e=>HP(e)};var PP=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each((e=>{const r=e(o,n);t.set(r)})),e.renderComponents.each((r=>{const s=r(n,t.get());(e.reuseDom?Dp:Op)(o,s)}))};return Ys([Qs(xs(),((t,n)=>{const r=n;if(!r.universal){const n=e.channel;L(r.channels,n)&&o(t,r.data)}})),ia(((t,n)=>{e.initialData.each((e=>{o(t,e)}))}))])}});var FP=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),zP=[dr("channel"),yr("renderComponents"),yr("updateState"),yr("initialData"),Nr("reuseDom",!0)];const VP=Kl({fields:zP,name:"reflecting",active:PP,apis:FP,state:Object.freeze({__proto__:null,init:()=>{const e=Hr(D.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(D.none())}}})}),ZP=e=>{const t=[],o={};return le(e,((e,n)=>{e.fold((()=>{t.push(n)}),(e=>{o[n]=e}))})),t.length>0?on.error(t):on.value(o)},UP=(e,t,o)=>{const n=Bf(zE.sketch((n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:F(e.items,(e=>SD(n,e,t,o)))}))));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:ql([Tp.config({mode:"acyclic",useTabstopAt:k(hT)}),KE(n),JE(n,{postprocess:e=>ZP(e).fold((e=>(console.error(e),{})),x)}),Ip("dialog-body-panel",[Qs(ss(),((e,t)=>{e.getSystem().broadcastOn([wT],{newFocus:D.some(t.event.target)})}))])])}},jP=tg({name:"TabButton",configFields:[Tr("uid",void 0),dr("value"),ir("dom","dom",_n((()=>({attributes:{role:"tab",id:ya("aria"),"aria-selected":"false"}}))),Un()),yr("action"),Tr("domModification",{}),Jm("tabButtonBehaviours",[Zp,Tp,Xm]),dr("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:Qp(e.action),behaviours:eu(e.tabButtonBehaviours,[Zp.config({}),Tp.config({mode:"execution",useSpace:!0,useEnter:!0}),Xm.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),WP=w([dr("tabs"),dr("dom"),Tr("clickToDismiss",!1),Jm("tabbarBehaviours",[Mg,Tp]),Ji(["tabClass","selectedClass"])]),$P=Au({factory:jP,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Mg.dehighlight(e,t),Ws(e,Vs(),{tabbar:e,button:t})},o=(e,t)=>{Mg.highlight(e,t),Ws(e,zs(),{tabbar:e,button:t})};return{action:n=>{const r=n.getSystem().getByUid(e.uid).getOrDie(),s=Mg.isHighlighted(r,n);(s&&e.clickToDismiss?t:s?v:o)(r,n)},domModification:{classes:[e.markers.tabClass]}}}}),qP=w([$P]),GP=og({name:"Tabbar",configFields:WP(),partFields:qP(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:eu(e.tabbarBehaviours,[Mg.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{St(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{St(t.element,"aria-selected","false")}}),Tp.config({mode:"flow",getInitial:e=>Mg.getHighlighted(e).map((e=>e.element)),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),KP=tg({name:"Tabview",configFields:[Jm("tabviewBehaviours",[Hp])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:eu(e.tabviewBehaviours,[Hp.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),YP=w([Tr("selectFirst",!0),el("onChangeTab"),el("onDismissTab"),Tr("tabs",[]),Jm("tabSectionBehaviours",[])]),XP=Tu({factory:GP,schema:[dr("dom"),fr("markers",[dr("tabClass"),dr("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),JP=Tu({factory:KP,name:"tabview"}),QP=w([XP,JP]),eF=og({name:"TabSection",configFields:YP(),partFields:QP(),factory:(e,t,o,n)=>{const r=(t,o)=>{Vu(t,e,"tabbar").each((e=>{o(e).each($s)}))};return{uid:e.uid,dom:e.dom,components:t,behaviours:Qm(e.tabSectionBehaviours),events:Ys(q([e.selectFirst?[ia(((e,t)=>{r(e,Mg.getFirst)}))]:[],[Qs(zs(),((t,o)=>{(t=>{const o=Xm.getValue(t);Vu(t,e,"tabview").each((n=>{const r=W(e.tabs,(e=>e.value===o));r.each((o=>{const r=o.view();Et(t.element,"id").each((e=>{St(n.element,"aria-labelledby",e)})),Hp.set(n,r),e.onChangeTab(n,t,r)}))}))})(o.event.button)})),Qs(Vs(),((t,o)=>{const n=o.event.button;e.onDismissTab(t,n)}))]])),apis:{getViewItems:t=>Vu(t,e,"tabview").map((e=>Hp.contents(e))).getOr([]),showTab:(e,t)=>{r(e,(e=>{const o=Mg.getCandidates(e);return W(o,(e=>Xm.getValue(e)===t)).filter((t=>!Mg.isHighlighted(e,t)))}))}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),tF=(e,t)=>{Mt(e,"height",t+"px"),Mt(e,"flex-basis",t+"px")},oF=(e,t,o)=>{Ni(e,'[role="dialog"]').each((e=>{Bi(e,'[role="tablist"]').each((n=>{o.get().map((o=>(Mt(t,"height","0"),Mt(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=tt(e).dom,r=Ni(e,".tox-dialog-wrap").getOr(e);let s;s="fixed"===Bt(r,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=Ut(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+Xt(o)?Math.max(Ut(o),a):a,l=parseInt(Bt(e,"margin-top"),10)||0,c=parseInt(Bt(e,"margin-bottom"),10)||0;return s-(Ut(e)+l+c-i)})(e,t,n))))).each((e=>{tF(t,e)}))}))}))},nF=e=>Bi(e,'[role="tabpanel"]'),rF=e=>{const t=kc(),o=[ia((o=>{const n=o.element;nF(n).each((r=>{Mt(r,"visibility","hidden"),o.getSystem().getByDom(r).toOptional().each((o=>{const n=((e,t,o)=>F(e,((n,r)=>{Hp.set(o,e[r].view());const s=t.dom.getBoundingClientRect();return Hp.set(o,[]),s.height})))(e,r,o),s=(e=>oe(ee(e,((e,t)=>e>t?-1:e{oe(e).each((e=>eF.showTab(t,e.value)))})(e,o),requestAnimationFrame((()=>{oF(n,r,t)}))}))})),Qs(Ns(),(e=>{const o=e.element;nF(o).each((e=>{oF(o,e,t)}))})),Qs(Rk,((e,o)=>{const n=e.element;nF(n).each((e=>{const o=rc(ht(e));Mt(e,"visibility","hidden");const r=Ht(e,"height").map((e=>parseInt(e,10)));Ft(e,"height"),Ft(e,"flex-basis");const s=e.dom.getBoundingClientRect().height;r.forall((e=>s>e))?(t.set(s),oF(n,e,t)):r.each((t=>{tF(e,t)})),Ft(e,"visibility"),o.each(tc)}))}))];return{extraEvents:o,selectFirst:!1}},sF="send-data-to-section",aF="send-data-to-view",iF=(e,t,o)=>{const n=Hr({}),r=e=>{const t=Xm.getValue(e),o=ZP(t).getOr({}),r=n.get(),s=xn(r,o);n.set(s)},s=e=>{const t=n.get();Xm.setValue(e,t)},a=Hr(null),i=F(e.tabs,(e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[Ci(o.shared.providers.translate(e.title))],view:()=>[zE.sketch((n=>({dom:{tag:"div",classes:["tox-form"]},components:F(e.items,(e=>SD(n,e,t,o))),formBehaviours:ql([Tp.config({mode:"acyclic",useTabstopAt:k(hT)}),Ip("TabView.form.events",[ia(s),la(r)]),Ql.config({channels:zr([{key:sF,value:{onReceive:r}},{key:aF,value:{onReceive:s}}])})])})))]}))),l=rF(i);return eF.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=Xm.getValue(t);Ws(e,Nk,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[eF.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[GP.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:ql([yk.config({})])}),eF.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:ql([Ip("tabpanel",l.extraEvents),Tp.config({mode:"acyclic"}),ag.config({find:e=>oe(eF.getViewItems(e))}),QE(D.none(),(e=>(e.getSystem().broadcastOn([sF],{}),n.get())),((e,t)=>{n.set(t),e.getSystem().broadcastOn([aF],{})}))])})},lF=(e,t,o,n,r)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map((e=>({id:e}))).getOr({}),...r?{"aria-live":"polite"}:{}}},components:[],behaviours:ql([YE(0),VP.config({channel:`${vT}-${t}`,updateState:(e,t)=>D.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[iF(t,e.initialData,n)]:[UP(t,e.initialData,n)]},initialData:e})])}),cF=qv.deviceType.isTouch(),dF=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),mF=(e,t)=>eI.parts.close(Nf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:ql([yk.config({})])})),uF=()=>eI.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),gF=(e,t)=>eI.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:Rf(`

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

    `)}]}]}),hF=e=>eI.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),pF=(e,t)=>[uk.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),uk.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],fF=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",r=t+"__disable-scroll";return eI.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),D.some(!0)),useTabstopAt:e=>!hT(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:Rf(`
    `),components:[{dom:{tag:"div",classes:cF?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:ql([Zp.config({}),Ip("dialog-events",e.dialogEvents.concat([aa(ss(),((e,t)=>{iN.isBlocked(e)||Tp.focusIn(e)})),Qs(Is(),((e,t)=>{e.getSystem().broadcastOn([wT],{newFocus:t.event.newFocus})}))])),Ip("scroll-lock",[ia((()=>{ti(wt(),r)})),la((()=>{ni(wt(),r)}))]),...e.extraBehaviours]),eventOrder:{[Cs()]:["dialog-events"],[Rs()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[Bs()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},vF=e=>Nf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),title:e.translate("Close")}},buttonBehaviours:ql([yk.config({})]),components:[zv("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{js(e,Tk)}}),bF=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...o.map((e=>({id:e}))).getOr({})}},components:[],behaviours:ql([VP.config({channel:`${fT}-${t}`,initialData:e,renderComponents:e=>[Ci(n.translate(e.title))]})])}),yF=()=>({dom:Rf('
    ')}),wF=(e,t,o)=>((e,t,o)=>{const n=eI.parts.title(bF(e,t,D.none(),o)),r=eI.parts.draghandle(yF()),s=eI.parts.close(vF(o)),a=[n].concat(e.draggable?[r]:[]).concat([s]);return uk.sketch({dom:Rf('
    '),components:a})})({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),xF=(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:Rf('
    ')}]}),CF=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=Bi(e().element,".tox-dialog__header").map((e=>Ut(e)));eI.setBusy(e(),((e,r)=>xF(o.message,r,t,n)))},onUnblock:()=>{eI.setIdle(e())}}),SF="tox-dialog--fullscreen",kF="tox-dialog--width-lg",_F="tox-dialog--width-md",EF=e=>{switch(e){case"large":return D.some(kF);case"medium":return D.some(_F);default:return D.none()}},TF=(e,t)=>{const o=Le.fromDom(t.element.dom);si(o,SF)||(ii(o,[kF,_F]),EF(e).each((e=>ti(o,e))))},OF=(e,t)=>{const o=Le.fromDom(e.element.dom),n=li(o),r=W(n,(e=>e===kF||e===_F)).or(EF(t));((e,t)=>{z(t,(t=>{ri(e,t)}))})(o,[SF,...r.toArray()])},DF=(e,t,o)=>Ei(fF({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[tT({}),...e.extraBehaviours],onEscape:e=>{js(e,Tk)},dialogEvents:t,eventOrder:{[xs()]:[VP.name(),Ql.name()],[Rs()]:["scroll-lock",VP.name(),"messages","dialog-events","alloy.base.behaviour"],[Bs()]:["alloy.base.behaviour","dialog-events","messages",VP.name(),"scroll-lock"]}})),AF=(e,t={})=>F(e,(e=>"menu"===e.type?(e=>{const o=F(e.items,(e=>{const o=ve(t,e.name).getOr(Hr(!1));return{...e,storage:o}}));return{...e,items:o}})(e):e)),MF=e=>j(e,((e,t)=>{if("menu"===t.type){return j(t.items,((e,t)=>(e[t.name]=t.storage,e)),e)}return e}),{}),NF=(e,t)=>[na(ss(),gT),e(Ek,((e,o,n,r)=>{rc(ht(r.element)).fold(v,oc),t.onClose(),o.onClose()})),e(Tk,((e,t,o,n)=>{t.onCancel(e),js(n,Ek)})),Qs(Mk,((e,o)=>t.onUnblock())),Qs(Ak,((e,o)=>t.onBlock(o.event)))],RF=(e,t,o)=>{const n=(t,o)=>Qs(t,((t,n)=>{r(t,((r,s)=>{o(e(),r,n.event,t)}))})),r=(e,t)=>{VP.getState(e).get().each((o=>{t(o.internalDialog,e)}))};return[...NF(n,t),n(Dk,((e,t)=>t.onSubmit(e))),n(_k,((e,t,o)=>{t.onChange(e,{name:o.name})})),n(Ok,((e,t,n,r)=>{const s=()=>r.getSystem().isConnected()?Tp.focusIn(r):void 0,a=e=>Tt(e,"disabled")||Et(e,"aria-disabled").exists((e=>"true"===e)),i=ht(r.element),l=rc(i);t.onAction(e,{name:n.name,value:n.value}),rc(i).fold(s,(e=>{a(e)||l.exists((t=>Je(e,t)&&a(t)))?s():o().toOptional().filter((t=>!Je(t.element,e))).each(s)}))})),n(Nk,((e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})})),la((t=>{const o=e();Xm.setValue(t,o.getData())}))]},BF=(e,t)=>{const o=t.map((e=>e.footerButtons)).getOr([]),n=V(o,(e=>"start"===e.align)),r=(e,t)=>uk.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:F(t,(e=>e.memento.asSpec()))});return[r("start",n.pass),r("end",n.fail)]},LF=(e,t,o)=>({dom:Rf(''),components:[],behaviours:ql([VP.config({channel:`${bT}-${t}`,initialData:e,updateState:(e,t)=>{const n=F(t.buttons,(e=>{const t=Bf(((e,t)=>sD(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}}));return D.some({lookupByName:t=>((e,t,o)=>W(t,(e=>e.name===o)).bind((t=>t.memento.getOpt(e))))(e,n,t),footerButtons:n})},renderComponents:BF})])}),HF=(e,t,o)=>eI.parts.footer(LF(e,t,o)),IF=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=ag.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return zE.getField(o,t).orThunk((()=>{const o=e.getFooter().bind((e=>VP.getState(e).get()));return o.bind((e=>e.lookupByName(t)))}))}return D.none()},PF=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},r={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...Xm.getValue(n),...ce(o,(e=>e.get()))}},setData:t=>{n((n=>{const s=r.getData(),a=xn(s,t),i=((e,t)=>{const o=e.getRoot();return VP.getState(o).get().map((e=>or(tr("data",e.dataValidator,t)))).getOr(t)})(e,a),l=e.getFormWrapper();Xm.setValue(l,i),le(o,((e,t)=>{be(a,t)&&e.set(a[t])}))}))},setEnabled:(t,o)=>{IF(e,t).each(o?wg.enable:wg.disable)},focus:t=>{IF(e,t).each(Zp.focus)},block:e=>{if(!s(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n((t=>{Ws(t,Ak,{message:e})}))},unblock:()=>{n((e=>{js(e,Mk)}))},showTab:t=>{n((o=>{const n=e.getBody();VP.getState(n).get().exists((e=>e.isTabPanel()))&&ag.getCurrent(n).each((e=>{eF.showTab(e,t)}))}))},redial:s=>{n((n=>{const a=e.getId(),i=t(s),l=AF(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${pT}-${a}`],i),n.getSystem().broadcastOn([`${fT}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${vT}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${bT}-${a}`],{...i.internalDialog,buttons:l}),r.setData(i.initialData)}))},close:()=>{n((e=>{js(e,Ek)}))},toggleFullscreen:e.toggleFullscreen};return r},FF=(e,t,o)=>{const n=ya("dialog"),r=e.internalDialog,s=wF(r.title,n,o),a=Hr(r.size),i=EF(a.get()).toArray(),l=((e,t,o)=>{const n=lF(e,t,D.none(),o,!1);return eI.parts.body(n)})({body:r.body,initialData:r.initialData},n,o),c=AF(r.buttons),d=MF(c),m=ke(0!==c.length,HF({buttons:c},n,o)),u=RF((()=>f),CF((()=>h),o.shared.providers,t),o.shared.getSink),g={id:n,header:s,body:l,footer:m,extraClasses:i,extraBehaviours:[VP.config({channel:`${pT}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),TF(t.internalDialog.size,e),D.some(t)),initialData:e})],extraStyles:{}},h=DF(g,u,o),p={getId:w(n),getRoot:w(h),getBody:()=>eI.getBody(h),getFooter:()=>eI.getFooter(h),getFormWrapper:()=>{const e=eI.getBody(h);return ag.getCurrent(e).getOr(e)},toggleFullscreen:()=>{OF(h,a.get())}},f=PF(p,t.redial,d);return{dialog:h,instanceApi:f}},zF=(e,t,o,n=!1,r)=>{const s=ya("dialog"),a=ya("dialog-label"),i=ya("dialog-content"),l=e.internalDialog,c=Hr(l.size),d=EF(c.get()).toArray(),m=Bf(((e,t,o,n)=>uk.sketch({dom:Rf('
    '),components:[bF(e,t,D.some(o),n),yF(),vF(n)],containerBehaviours:ql([PH.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>Li(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:l.title,draggable:!0},s,a,o.shared.providers)),u=Bf(((e,t,o,n,r)=>lF(e,t,D.some(o),n,r))({body:l.body,initialData:l.initialData},s,i,o,n)),g=AF(l.buttons),h=MF(g),p=ke(0!==g.length,Bf(((e,t,o)=>LF(e,t,o))({buttons:g},s,o))),f=RF((()=>b),{onBlock:e=>{iN.block(v,((t,n)=>{const r=m.getOpt(v).map((e=>Ut(e.element)));return xF(e.message,n,o.shared.providers,r)}))},onUnblock:()=>{iN.unblock(v)},onClose:()=>t.closeWindow()},o.shared.getSink),v=Ei({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog","aria-labelledby":a}},eventOrder:{[xs()]:[VP.name(),Ql.name()],[Cs()]:["execute-on-form"],[Rs()]:["reflecting","execute-on-form"]},behaviours:ql([Tp.config({mode:"cyclic",onEscape:e=>(js(e,Ek),D.some(!0)),useTabstopAt:e=>!hT(e)&&("button"!==Ve(e)||"disabled"!==_t(e,"disabled")),firstTabstop:1}),VP.config({channel:`${pT}-${s}`,updateState:(e,t)=>(c.set(t.internalDialog.size),TF(t.internalDialog.size,e),r(),D.some(t)),initialData:e}),Zp.config({}),Ip("execute-on-form",f.concat([aa(ss(),((e,t)=>{Tp.focusIn(e)})),Qs(Is(),((e,t)=>{e.getSystem().broadcastOn([wT],{newFocus:t.event.newFocus})}))])),iN.config({getRoot:()=>D.some(v)}),Hp.config({}),tT({})]),components:[m.asSpec(),u.asSpec(),...p.map((e=>e.asSpec())).toArray()]}),b=PF({getId:w(s),getRoot:w(v),getFooter:()=>p.map((e=>e.get(v))),getBody:()=>u.get(v),getFormWrapper:()=>{const e=u.get(v);return ag.getCurrent(e).getOr(e)},toggleFullscreen:()=>{OF(v,c.get())}},t.redial,h);return{dialog:v,instanceApi:b}};var VF=tinymce.util.Tools.resolve("tinymce.util.URI");const ZF=["insertContent","setContent","execCommand","close","block","unblock"],UF=e=>a(e)&&-1!==ZF.indexOf(e.mceAction),jF=(e,t,o,n)=>{const r=ya("dialog"),i=wF(e.title,r,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[mT(D.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:ql([yk.config({}),Zp.config({})])})]}],behaviours:ql([Tp.config({mode:"acyclic",useTabstopAt:k(hT)})])};return eI.parts.body(t)})(e),c=e.buttons.bind((e=>0===e.length?D.none():D.some(HF({buttons:e},r,n)))),m=((e,t)=>{const o=(t,o)=>Qs(t,((t,r)=>{n(t,((n,s)=>{o(e(),n,r.event,t)}))})),n=(e,t)=>{VP.getState(e).get().each((o=>{t(o,e)}))};return[...NF(o,t),o(Ok,((e,t,o)=>{t.onAction(e,{name:o.name})}))]})((()=>w),CF((()=>y),n.shared.providers,t)),u={...e.height.fold((()=>({})),(e=>({height:e+"px","max-height":e+"px"}))),...e.width.fold((()=>({})),(e=>({width:e+"px","max-width":e+"px"})))},h=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],p=new VF(e.url,{base_uri:new VF(window.location.href)}),f=`${p.protocol}://${p.host}${p.port?":"+p.port:""}`,v=Sc(),b=[VP.config({channel:`${pT}-${r}`,updateState:(e,t)=>D.some(t),initialData:e}),Ip("messages",[ia((()=>{const t=Ec(Le.fromDom(window),"message",(t=>{if(p.isSameOrigin(new VF(t.raw.origin))){const n=t.raw.data;UF(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,w,n):(e=>!UF(e)&&a(e)&&be(e,"mceAction"))(n)&&e.onMessage(w,n)}}));v.set(t)})),la(v.clear)]),Ql.config({channels:{[yT]:{onReceive:(e,t)=>{Bi(e.element,"iframe").each((e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)}))}}}})],y=DF({id:r,header:i,body:l,footer:c,extraClasses:h,extraBehaviours:b,extraStyles:u},m,n),w=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!s(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t((t=>{Ws(t,Ak,{message:e})}))},unblock:()=>{t((e=>{js(e,Mk)}))},close:()=>{t((e=>{js(e,Ek)}))},sendMessage:e=>{t((t=>{t.getSystem().broadcastOn([yT],e)}))}}})(y);return{dialog:y,instanceApi:w}},WF=(e,t)=>or(tr("data",t,e)),$F=e=>QS(e,".tox-alert-dialog")||QS(e,".tox-confirm-dialog"),qF=(e,t,o)=>t&&o?[]:[OM.config({contextual:{lazyContext:()=>D.some(Ko(Le.fromDom(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>XS(e,t.element).map((e=>({bounds:JS(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Gt(e.element).top})}))).getOrThunk((()=>({bounds:Jo(),optScrollEnv:D.none()})))})],GF=e=>{const t=e.editor,o=Gb(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const r=()=>{eI.hide(l),n()},s=Bf(sD({name:"close-alert",text:"OK",primary:!0,buttonType:D.some("primary"),align:"end",enabled:!0,icon:D.none()},"cancel",e)),a=uF(),i=mF(r,t.providers),l=Ei(fF({lazySink:()=>t.getSink(),header:dF(a,i),body:gF(o,t.providers),footer:D.some(hF(pF([],[s.asSpec()]))),onEscape:r,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Qs(Tk,r)],eventOrder:{}}));eI.show(l);const c=s.get(l);Zp.focus(c)}}})(e.backstages.dialog),r=(e=>{const t=e.shared;return{open:(o,n)=>{const r=e=>{eI.hide(c),n(e)},s=Bf(sD({name:"yes",text:"Yes",primary:!0,buttonType:D.some("primary"),align:"end",enabled:!0,icon:D.none()},"submit",e)),a=sD({name:"no",text:"No",primary:!1,buttonType:D.some("secondary"),align:"end",enabled:!0,icon:D.none()},"cancel",e),i=uF(),l=mF((()=>r(!1)),t.providers),c=Ei(fF({lazySink:()=>t.getSink(),header:dF(i,l),body:gF(o,t.providers),footer:D.some(hF(pF([],[a,s.asSpec()]))),onEscape:()=>r(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Qs(Tk,(()=>r(!1))),Qs(Dk,(()=>r(!0)))],eventOrder:{}}));eI.show(c);const d=s.get(c);Zp.focus(d)}}})(e.backstages.dialog),s=(o,n)=>IP.openUrl((o=>{const r=jF(o,{closeWindow:()=>{eI.hide(r.dialog),n(r.instanceApi)}},t,e.backstages.dialog);return eI.show(r.dialog),r.instanceApi}),o),a=(t,o)=>IP.open(((t,n,r)=>{const s=n,a=FF({dataValidator:r,initialData:s,internalDialog:t},{redial:IP.redial,closeWindow:()=>{eI.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return eI.show(a.dialog),a.instanceApi.setData(s),a.instanceApi}),t),i=(n,r,s,a)=>IP.open(((n,i,l)=>{const c=WF(i,l),d=kc(),m=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>d.on((e=>{Af.reposition(e),o&&m||OM.refresh(e)})),g=zF({dataValidator:l,initialData:c,internalDialog:n},{redial:IP.redial,closeWindow:()=>{d.on(Af.hide),t.off("ResizeEditor",u),d.clear(),s(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,u),h=Ei(Af.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...m?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ql([Ip("window-manager-inline-events",[Qs(Ls(),((e,t)=>{js(g.dialog,Tk)}))]),...qF(t,o,m)]),isExtraPart:(e,t)=>$F(t)}));d.set(h);return Af.showWithinBounds(h,Ti(g.dialog),{anchor:r},(()=>{const e=t.inline?wt():Le.fromDom(t.getContainer()),o=Ko(e);return D.some(o)})),o&&m||(OM.refresh(h),t.on("ResizeEditor",u)),g.instanceApi.setData(c),Tp.focusIn(g.dialog),g.instanceApi}),n),l=(o,n,r,s)=>IP.open(((o,a,i)=>{const l=WF(a,i),c=kc(),d=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>c.on((e=>{Af.reposition(e),OM.refresh(e)})),u=zF({dataValidator:i,initialData:l,internalDialog:o},{redial:IP.redial,closeWindow:()=>{c.on(Af.hide),t.off("ResizeEditor ScrollWindow ElementScroll",m),c.clear(),r(u.instanceApi)}},e.backstages.popup,s.ariaAttrs,m),g=Ei(Af.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:s.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ql([Ip("window-manager-inline-events",[Qs(Ls(),((e,t)=>{js(u.dialog,Tk)}))]),OM.config({contextual:{lazyContext:()=>D.some(Ko(Le.fromDom(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>XS(t,e.element).map((e=>({bounds:JS(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Gt(e.element).top})}))).getOrThunk((()=>({bounds:Jo(),optScrollEnv:D.none()})))})]),isExtraPart:(e,t)=>$F(t)}));c.set(g);return Af.showWithinBounds(g,Ti(u.dialog),{anchor:n},(()=>e.backstages.popup.shared.getSink().toOptional().bind((e=>{const o=XS(t,e.element).map((e=>JS(e))).getOr(Jo()),n=Ko(Le.fromDom(t.getContentAreaContainer())),r=Xo(n,o);return D.some(Go(r.x,r.y,r.width,r.height-15))})))),OM.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",m),u.instanceApi.setData(l),Tp.focusIn(u.dialog),u.instanceApi}),o);return{open:(t,o,n)=>{if(!m(o)){if("toolbar"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return l(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return i(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return a(t,n)},openUrl:(e,t)=>s(e,t),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{r.open(e,t)}}},KF=e=>{Yv(e),(e=>{const t=e.options.register,o=e=>f(e,s)?{value:EC(e),valid:!0}:{valid:!1,message:"Must be an array of strings."},n=e=>p(e)&&e>0?{value:e,valid:!0}:{valid:!1,message:"Must be a positive number."};t("color_map",{processor:o,default:["#BFEDD2","Light Green","#FBEEB8","Light Yellow","#F8CAC6","Light Red","#ECCAFA","Light Purple","#C2E0F4","Light Blue","#2DC26B","Green","#F1C40F","Yellow","#E03E2D","Red","#B96AD9","Purple","#3598DB","Blue","#169179","Dark Turquoise","#E67E23","Orange","#BA372A","Dark Red","#843FA1","Dark Purple","#236FA1","Dark Blue","#ECF0F1","Light Gray","#CED4D9","Medium Gray","#95A5A6","Gray","#7E8C8D","Dark Gray","#34495E","Navy Blue","#000000","Black","#ffffff","White"]}),t("color_map_background",{processor:o}),t("color_map_foreground",{processor:o}),t("color_cols",{processor:n,default:AC(e)}),t("color_cols_foreground",{processor:n,default:MC(e,kC)}),t("color_cols_background",{processor:n,default:MC(e,_C)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:OC}),t("color_default_background",{processor:"string",default:OC})})(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}:s(e)||f(e,s)?{value:TL(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)};Qo.add("silver",(e=>{KF(e);let t=()=>Jo();const{dialogs:o,popups:n,renderUI:r}=YH(e,{getPopupSinkBounds:()=>t()});qS(e,n.backstage.shared);const s=GF({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}});return{renderUI:()=>{const o=r();return XS(e,n.getMothership().element).each((e=>{t=()=>JS(e)})),o},getWindowManagerImpl:w(s),getNotificationManagerImpl:()=>((e,t,o)=>{const n=t.backstage.shared,r=()=>{const t=Ko(Le.fromDom(e.getContentAreaContainer())),o=Jo(),n=bl(o.x,t.x,t.right),r=bl(o.y,t.y,t.bottom),s=Math.max(t.right,o.right),a=Math.max(t.bottom,o.bottom);return D.some(Go(n,r,s-n,a-r))};return{open:(t,s)=>{const a=()=>{s(),Af.hide(l)},i=Ei(Zv.sketch({text:t.text,level:L(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,closeButton:t.closeButton,onAction:a,iconProvider:n.providers.icons,translationProvider:n.providers.translate})),l=Ei(Af.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:n.getSink,fireDismissalEventInstead:{},...n.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}}}));o.add(l),p(t.timeout)&&t.timeout>0&&Mf.setEditorTimeout(e,(()=>{a()}),t.timeout);const c={close:a,reposition:()=>{const t=Ti(i),o={maxHeightFunction:Fc()},s=e.notificationManager.getNotifications();if(s[0]===c){const e={...n.anchors.banner(),overrides:o};Af.showWithinBounds(l,t,{anchor:e},r)}else B(s,c).each((e=>{const n=s[e-1].getEl(),a={type:"node",root:wt(),node:D.some(Le.fromDom(n)),overrides:o,layouts:{onRtl:()=>[Nl],onLtr:()=>[Nl]}};Af.showWithinBounds(l,t,{anchor:a},r)}))},text:e=>{Zv.updateText(i,e)},settings:t,getEl:()=>i.element.dom,progressBar:{value:e=>{Zv.updateProgress(i,e)}}};return c},close:e=>{e.close()},getArgs:e=>e.settings}})(e,{backstage:n.backstage},n.getMothership())}}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.ModelManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,o=e=>t=>typeof t===e,n=e=>t=>e===t,r=t("string"),s=t("object"),a=t("array"),i=n(null),l=o("boolean"),c=n(void 0),d=e=>!(e=>null==e)(e),m=o("function"),u=o("number"),g=()=>{},h=e=>()=>e,p=e=>e,f=(e,t)=>e===t;function v(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const b=e=>t=>!e(t),y=e=>e(),w=h(!1),x=h(!0);class C{constructor(e,t){this.tag=e,this.value=t}static some(e){return new C(!0,e)}static none(){return C.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?C.some(e(this.value)):C.none()}bind(e){return this.tag?e(this.value):C.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:C.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return d(e)?C.some(e):C.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()"}}C.singletonNone=new C(!1);const S=Array.prototype.slice,k=Array.prototype.indexOf,_=Array.prototype.push,E=(e,t)=>{return o=e,n=t,k.call(o,n)>-1;var o,n},T=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),B=(e,t,o)=>(A(e,((e,n)=>{o=t(o,e,n)})),o),L=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oI(D(e,t)),F=(e,t)=>{for(let o=0,n=e.length;o{const o={};for(let n=0,r=e.length;nt>=0&&tV(e,0),U=e=>V(e,e.length-1),j=(e,t)=>{for(let o=0;o{const o=W(e);for(let n=0,r=o.length;nK(e,((e,o)=>({k:o,v:t(e,o)}))),K=(e,t)=>{const o={};return q(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},Y=(e,t)=>{const o={};return((e,t,o,n)=>{q(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))})(e,t,(e=>(t,o)=>{e[o]=t})(o),g),o},X=(e,t)=>{const o=[];return q(e,((e,n)=>{o.push(t(e,n))})),o},J=e=>X(e,p),Q=(e,t)=>$.call(e,t),ee="undefined"!=typeof window?window:Function("return this;")(),te=(e,t)=>((e,t)=>{let o=null!=t?t:ee;for(let t=0;t{const o=((e,t)=>te(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},ne=Object.getPrototypeOf,re=e=>{const t=te("ownerDocument.defaultView",e);return s(e)&&((e=>oe("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ne(e).constructor.name))},se=e=>e.dom.nodeName.toLowerCase(),ae=e=>e.dom.nodeType,ie=e=>t=>ae(t)===e,le=e=>8===ae(e)||"#comment"===se(e),ce=e=>de(e)&&re(e.dom),de=ie(1),me=ie(3),ue=ie(9),ge=ie(11),he=e=>t=>de(t)&&se(t)===e,pe=(e,t,o)=>{if(!(r(o)||l(o)||u(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+"")},fe=(e,t,o)=>{pe(e.dom,t,o)},ve=(e,t)=>{const o=e.dom;q(t,((e,t)=>{pe(o,t,e)}))},be=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},ye=(e,t)=>C.from(be(e,t)),we=(e,t)=>{e.dom.removeAttribute(t)},xe=e=>B(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Ce=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Se={fromHtml:(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 Ce(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return Ce(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return Ce(o)},fromDom:Ce,fromPoint:(e,t,o)=>C.from(e.dom.elementFromPoint(t,o)).map(Ce)},ke=(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")}},_e=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ee=(e,t)=>{const o=void 0===t?document:t.dom;return _e(o)?C.none():C.from(o.querySelector(e)).map(Se.fromDom)},Te=(e,t)=>e.dom===t.dom,Oe=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},De=ke,Ae=e=>Se.fromDom(e.dom.ownerDocument),Me=e=>ue(e)?e:Ae(e),Ne=e=>C.from(e.dom.parentNode).map(Se.fromDom),Re=e=>C.from(e.dom.parentElement).map(Se.fromDom),Be=(e,t)=>{const o=m(t)?t:w;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Se.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},Le=e=>C.from(e.dom.previousSibling).map(Se.fromDom),He=e=>C.from(e.dom.nextSibling).map(Se.fromDom),Ie=e=>D(e.dom.childNodes,Se.fromDom),Pe=(e,t)=>{const o=e.dom.childNodes;return C.from(o[t]).map(Se.fromDom)},Fe=(e,t)=>{Ne(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},ze=(e,t)=>{He(e).fold((()=>{Ne(e).each((e=>{Ze(e,t)}))}),(e=>{Fe(e,t)}))},Ve=(e,t)=>{const o=(e=>Pe(e,0))(e);o.fold((()=>{Ze(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ze=(e,t)=>{e.dom.appendChild(t.dom)},Ue=(e,t)=>{Fe(e,t),Ze(t,e)},je=(e,t)=>{A(t,((o,n)=>{const r=0===n?e:t[n-1];ze(r,o)}))},We=(e,t)=>{A(t,(t=>{Ze(e,t)}))},$e=e=>{e.dom.textContent="",A(Ie(e),(e=>{qe(e)}))},qe=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ge=e=>{const t=Ie(e);t.length>0&&je(e,t),qe(e)},Ke=(e,t)=>Se.fromDom(e.dom.cloneNode(t)),Ye=e=>Ke(e,!1),Xe=e=>Ke(e,!0),Je=(e,t)=>{const o=Se.fromTag(t),n=xe(e);return ve(o,n),o},Qe=["tfoot","thead","tbody","colgroup"],et=(e,t,o)=>({element:e,rowspan:t,colspan:o}),tt=(e,t,o)=>({element:e,cells:t,section:o}),ot=(e,t,o)=>({element:e,isNew:t,isLocked:o}),nt=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),rt=m(Element.prototype.attachShadow)&&m(Node.prototype.getRootNode),st=h(rt),at=rt?e=>Se.fromDom(e.dom.getRootNode()):Me,it=e=>{const t=at(e);return ge(o=t)&&d(o.dom.host)?C.some(t):C.none();var o},lt=e=>Se.fromDom(e.dom.host),ct=e=>d(e.dom.shadowRoot),dt=e=>{const t=me(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return it(Se.fromDom(t)).fold((()=>o.body.contains(t)),(n=dt,r=lt,e=>n(r(e))));var n,r},mt=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Se.fromDom(t)},ut=(e,t)=>{let o=[];return A(Ie(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(ut(e,t))})),o},gt=(e,t,o)=>((e,t,o)=>N(Be(e,o),t))(e,(e=>ke(e,t)),o),ht=(e,t)=>((e,t)=>N(Ie(e),t))(e,(e=>ke(e,t))),pt=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return _e(o)?[]:D(o.querySelectorAll(e),Se.fromDom)})(t,e);var ft=(e,t,o,n,r)=>e(o,n)?C.some(o):m(r)&&r(o)?C.none():t(o,n,r);const vt=(e,t,o)=>{let n=e.dom;const r=m(o)?o:w;for(;n.parentNode;){n=n.parentNode;const e=Se.fromDom(n);if(t(e))return C.some(e);if(r(e))break}return C.none()},bt=(e,t,o)=>ft(((e,t)=>t(e)),vt,e,t,o),yt=(e,t,o)=>vt(e,(e=>ke(e,t)),o),wt=(e,t)=>((e,t)=>L(e.dom.childNodes,(e=>t(Se.fromDom(e)))).map(Se.fromDom))(e,(e=>ke(e,t))),xt=(e,t)=>Ee(t,e),Ct=(e,t,o)=>ft(((e,t)=>ke(e,t)),yt,e,t,o),St=(e,t,o=f)=>e.exists((e=>o(e,t))),kt=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te?C.some(t):C.none(),Et=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Tt=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!c(n)||r+t.length<=n)},Ot=(e,t)=>Et(e,t,0),Dt=(e,t)=>Et(e,t,e.length-t.length),At=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Mt=e=>e.length>0,Nt=e=>void 0!==e.style&&m(e.style.getPropertyValue),Rt=(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);Nt(e)&&e.style.setProperty(t,o)},Bt=(e,t,o)=>{const n=e.dom;Rt(n,t,o)},Lt=(e,t)=>{const o=e.dom;q(t,((e,t)=>{Rt(o,t,e)}))},Ht=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||dt(e)?n:It(o,t)},It=(e,t)=>Nt(e)?e.style.getPropertyValue(t):"",Pt=(e,t)=>{const o=e.dom,n=It(o,t);return C.from(n).filter((e=>e.length>0))},Ft=(e,t)=>{((e,t)=>{Nt(e)&&e.style.removeProperty(t)})(e.dom,t),St(ye(e,"style").map(At),"")&&we(e,"style")},zt=(e,t,o=0)=>ye(e,t).map((e=>parseInt(e,10))).getOr(o),Vt=(e,t)=>zt(e,t,1),Zt=e=>he("col")(e)?zt(e,"span",1)>1:Vt(e,"colspan")>1,Ut=e=>Vt(e,"rowspan")>1,jt=(e,t)=>parseInt(Ht(e,t),10),Wt=h(10),$t=h(10),qt=(e,t)=>Gt(e,t,x),Gt=(e,t,o)=>P(Ie(e),(e=>ke(e,t)?o(e)?[e]:[]:Gt(e,t,o))),Kt=(e,t)=>((e,t,o=w)=>o(t)?C.none():E(e,se(t))?C.some(t):yt(t,e.join(","),(e=>ke(e,"table")||o(e))))(["td","th"],e,t),Yt=e=>qt(e,"th,td"),Xt=e=>ke(e,"colgroup")?ht(e,"col"):P(eo(e),(e=>ht(e,"col"))),Jt=(e,t)=>Ct(e,"table",t),Qt=e=>qt(e,"tr"),eo=e=>Jt(e).fold(h([]),(e=>ht(e,"colgroup"))),to=(e,t)=>D(e,(e=>{if("colgroup"===se(e)){const t=D(Xt(e),(e=>{const t=zt(e,"span",1);return et(e,1,t)}));return tt(e,t,"colgroup")}{const o=D(Yt(e),(e=>{const t=zt(e,"rowspan",1),o=zt(e,"colspan",1);return et(e,t,o)}));return tt(e,o,t(e))}})),oo=e=>Ne(e).map((e=>{const t=se(e);return(e=>E(Qe,e))(t)?t:"tbody"})).getOr("tbody"),no=e=>{const t=Qt(e),o=[...eo(e),...t];return to(o,oo)},ro=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},so=()=>ao(0,0),ao=(e,t)=>({major:e,minor:t}),io={nu:ao,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?so():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return ao(n(1),n(2))})(e,o)},unknown:so},lo=(e,t)=>{const o=String(t).toLowerCase();return L(e,(e=>e.search(o)))},co=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,mo=e=>t=>Tt(t,e),uo=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Tt(e,"edge/")&&Tt(e,"chrome")&&Tt(e,"safari")&&Tt(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,co],search:e=>Tt(e,"chrome")&&!Tt(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Tt(e,"msie")||Tt(e,"trident")},{name:"Opera",versionRegexes:[co,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:mo("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:mo("firefox")},{name:"Safari",versionRegexes:[co,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Tt(e,"safari")||Tt(e,"mobile/"))&&Tt(e,"applewebkit")}],go=[{name:"Windows",search:mo("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Tt(e,"iphone")||Tt(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:mo("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:mo("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:mo("linux"),versionRegexes:[]},{name:"Solaris",search:mo("sunos"),versionRegexes:[]},{name:"FreeBSD",search:mo("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:mo("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ho={browsers:h(uo),oses:h(go)},po="Edge",fo="Chromium",vo="Opera",bo="Firefox",yo="Safari",wo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(po),isChromium:n(fo),isIE:n("IE"),isOpera:n(vo),isFirefox:n(bo),isSafari:n(yo)}},xo={unknown:()=>wo({current:void 0,version:io.unknown()}),nu:wo,edge:h(po),chromium:h(fo),ie:h("IE"),opera:h(vo),firefox:h(bo),safari:h(yo)},Co="Windows",So="Android",ko="Linux",_o="macOS",Eo="Solaris",To="FreeBSD",Oo="ChromeOS",Do=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Co),isiOS:n("iOS"),isAndroid:n(So),isMacOS:n(_o),isLinux:n(ko),isSolaris:n(Eo),isFreeBSD:n(To),isChromeOS:n(Oo)}},Ao={unknown:()=>Do({current:void 0,version:io.unknown()}),nu:Do,windows:h(Co),ios:h("iOS"),android:h(So),linux:h(ko),macos:h(_o),solaris:h(Eo),freebsd:h(To),chromeos:h(Oo)},Mo=(e,t,o)=>{const n=ho.browsers(),r=ho.oses(),s=t.bind((e=>((e,t)=>j(t.brands,(t=>{const o=t.brand.toLowerCase();return L(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:io.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>lo(e,t).map((e=>{const o=io.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(xo.unknown,xo.nu),a=((e,t)=>lo(e,t).map((e=>{const o=io.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Ao.unknown,Ao.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:h(r),isiPhone:h(s),isTablet:h(l),isPhone:h(c),isTouch:h(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:h(d),isDesktop:h(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},No=e=>window.matchMedia(e).matches;let Ro=ro((()=>Mo(navigator.userAgent,C.from(navigator.userAgentData),No)));const Bo=()=>Ro(),Lo=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Ht(o,e);return parseFloat(t)||0}return n},n=(e,t)=>B(t,((t,o)=>{const n=Ht(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!u(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Nt(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},Ho=(e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?C.none():C.some(t)})(e).getOr(t),Io=(e,t,o)=>Ho(Ht(e,t),o),Po=(e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-Io(e,`padding-${o}`,0)-Io(e,`padding-${n}`,0)-Io(e,`border-${o}-width`,0)-Io(e,`border-${n}-width`,0))(e,n,"left","right")},Fo=Lo("width",(e=>e.dom.offsetWidth)),zo=e=>Fo.get(e),Vo=e=>Fo.getOuter(e),Zo=e=>Po(e,"content-box"),Uo=e=>Io(e,"width",e.dom.offsetWidth),jo=(e,t,o)=>{const n=e.cells,r=n.slice(0,t),s=n.slice(t),a=r.concat(o).concat(s);return qo(e,a)},Wo=(e,t,o)=>jo(e,t,[o]),$o=(e,t,o)=>{e.cells[t]=o},qo=(e,t)=>nt(e.element,t,e.section,e.isNew),Go=(e,t)=>e.cells[t],Ko=(e,t)=>Go(e,t).element,Yo=e=>e.cells.length,Xo=e=>{const t=M(e,(e=>"colgroup"===e.section));return{rows:t.fail,cols:t.pass}},Jo=(e,t,o)=>{const n=D(e.cells,o);return nt(t(e.element),n,e.section,!0)},Qo="data-snooker-locked-cols",en=e=>ye(e,Qo).bind((e=>C.from(e.match(/\d+/g)))).map((e=>z(e,x))),tn=e=>{const t=B(Xo(e).rows,((e,t)=>(A(t.cells,((t,o)=>{t.isLocked&&(e[o]=!0)})),e)),{}),o=X(t,((e,t)=>parseInt(t,10)));return((e,t)=>{const o=S.call(e,0);return o.sort(t),o})(o)},on=(e,t)=>e+","+t,nn=(e,t)=>{const o=P(e.all,(e=>e.cells));return N(o,t)},rn=e=>{const t={},o=[],n=Z(e).map((e=>e.element)).bind(Jt).bind(en).getOr({});let r=0,s=0,a=0;const{pass:i,fail:l}=M(e,(e=>"colgroup"===e.section));A(l,(e=>{const i=[];A(e.cells,(e=>{let o=0;for(;void 0!==t[on(a,o)];)o++;const r=((e,t)=>Q(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),l=((e,t,o,n,r,s)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:s}))(e.element,e.rowspan,e.colspan,a,o,r);for(let n=0;n{const t=(e=>{const t={};let o=0;return A(e.cells,(e=>{const n=e.colspan;O(n,(r=>{const s=o+r;t[s]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,s)})),o+=n})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,J(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),m=((e,t)=>({rows:e,columns:t}))(r,s);return{grid:m,access:t,all:o,columns:c,colgroups:d}},sn={fromTable:e=>{const t=no(e);return rn(t)},generate:rn,getAt:(e,t,o)=>C.from(e.access[on(t,o)]),findItem:(e,t,o)=>{const n=nn(e,(e=>o(t,e.element)));return n.length>0?C.some(n[0]):C.none()},filterItems:nn,justCells:e=>P(e.all,(e=>e.cells)),justColumns:e=>J(e.columns),hasColumns:e=>W(e.columns).length>0,getColumnAt:(e,t)=>C.from(e.columns[t])},an=(e,t=x)=>{const o=e.grid,n=O(o.columns,p),r=O(o.rows,p);return D(n,(o=>ln((()=>P(r,(t=>sn.getAt(e,t,o).filter((e=>e.column===o)).toArray()))),(e=>1===e.colspan&&t(e.element)),(()=>sn.getAt(e,0,o)))))},ln=(e,t,o)=>{const n=e();return L(n,t).orThunk((()=>C.from(n[0]).orThunk(o))).map((e=>e.element))},cn=e=>{const t=e.grid,o=O(t.rows,p),n=O(t.columns,p);return D(o,(t=>ln((()=>P(n,(o=>sn.getAt(e,t,o).filter((e=>e.row===t)).fold(h([]),(e=>[e]))))),(e=>1===e.rowspan),(()=>sn.getAt(e,t,0)))))},dn=(e,t)=>{if(t<0||t>=e.length-1)return C.none();const o=e[t].fold((()=>{const o=(e=>{const t=S.call(e,0);return t.reverse(),t})(e.slice(0,t));return j(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:0}))),n=e[t+1].fold((()=>{const o=e.slice(t+1);return j(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:1})));return o.bind((e=>n.map((t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))))},mn=(e,t)=>o=>"rtl"===un(o)?t:e,un=e=>"rtl"===Ht(e,"direction")?"rtl":"ltr",gn=Lo("height",(e=>{const t=e.dom;return dt(e)?t.getBoundingClientRect().height:t.offsetHeight})),hn=e=>gn.get(e),pn=e=>gn.getOuter(e),fn=e=>Io(e,"height",e.dom.offsetHeight),vn=(e,t)=>({left:e,top:t,translate:(o,n)=>vn(e+o,t+n)}),bn=vn,yn=(e,t)=>void 0!==e?e:void 0!==t?t:0,wn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return bn(o.offsetLeft,o.offsetTop);const s=yn(null==n?void 0:n.pageYOffset,r.scrollTop),a=yn(null==n?void 0:n.pageXOffset,r.scrollLeft),i=yn(r.clientTop,o.clientTop),l=yn(r.clientLeft,o.clientLeft);return xn(e).translate(a-l,s-i)},xn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?bn(o.offsetLeft,o.offsetTop):dt(e)?(e=>{const t=e.getBoundingClientRect();return bn(t.left,t.top)})(t):bn(0,0)},Cn=(e,t)=>({row:e,y:t}),Sn=(e,t)=>({col:e,x:t}),kn=e=>wn(e).left+Vo(e),_n=e=>wn(e).left,En=(e,t)=>Sn(e,_n(t)),Tn=(e,t)=>Sn(e,kn(t)),On=e=>wn(e).top,Dn=(e,t)=>Cn(e,On(t)),An=(e,t)=>Cn(e,On(t)+pn(t)),Mn=(e,t,o)=>{if(0===o.length)return[];const n=D(o.slice(1),((t,o)=>t.map((t=>e(o,t))))),r=o[o.length-1].map((e=>t(o.length-1,e)));return n.concat([r])},Nn={delta:p,positions:e=>Mn(Dn,An,e),edge:On},Rn=mn({delta:p,edge:_n,positions:e=>Mn(En,Tn,e)},{delta:e=>-e,edge:kn,positions:e=>Mn(Tn,En,e)}),Bn={delta:(e,t)=>Rn(t).delta(e,t),positions:(e,t)=>Rn(t).positions(e,t),edge:e=>Rn(e).edge(e)},Ln={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:[""]},Hn=(()=>{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})`})(.*)$`)})(),In=(e,t)=>C.from(Hn.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>T(t,(t=>T(Ln[t],(t=>e===t)))))(n,t)?C.some({value:o,unit:n}):C.none()})),Pn=/(\d+(\.\d+)?)%/,Fn=/(\d+(\.\d+)?)px|em/,zn=he("col"),Vn=(e,t,o)=>{const n=Re(e).getOrThunk((()=>mt(Ae(e))));return t(e)/o(n)*100},Zn=(e,t)=>{Bt(e,"width",t+"px")},Un=(e,t)=>{Bt(e,"width",t+"%")},jn=(e,t)=>{Bt(e,"height",t+"px")},Wn=(e,t,o,n)=>{const r=parseFloat(e);return Dt(e,"%")&&"table"!==se(t)?((e,t,o,n)=>{const r=Jt(e).map((e=>{const n=o(e);return Math.floor(t/100*n)})).getOr(t);return n(e,r),r})(t,r,o,n):r},$n=e=>{const t=(e=>fn(e)+"px")(e);return t?Wn(t,e,hn,jn):hn(e)},qn=(e,t)=>Pt(e,t).orThunk((()=>ye(e,t).map((e=>e+"px")))),Gn=e=>qn(e,"width"),Kn=e=>Vn(e,zo,Zo),Yn=e=>zn(e)?zo(e):Uo(e),Xn=e=>((e,t,o)=>o(e)/Vt(e,t))(e,"rowspan",$n),Jn=(e,t,o)=>{Bt(e,"width",t+o)},Qn=e=>Vn(e,zo,Zo)+"%",er=h(Pn),tr=he("col"),or=e=>Gn(e).getOrThunk((()=>Yn(e)+"px")),nr=e=>{return(t=e,qn(t,"height")).getOrThunk((()=>Xn(e)+"px"));var t},rr=(e,t,o,n,r,s)=>e.filter(n).fold((()=>s(dn(o,t))),(e=>r(e))),sr=(e,t,o,n)=>{const r=an(e),s=sn.hasColumns(e)?(e=>D(sn.justColumns(e),(e=>C.from(e.element))))(e):r,a=[C.some(Bn.edge(t))].concat(D(Bn.positions(r,t),(e=>e.map((e=>e.x))))),i=b(Zt);return D(s,((e,t)=>rr(e,t,a,i,(e=>{if((e=>{const t=Bo().browser,o=t.isChromium()||t.isFirefox();return!tr(e)||o})(e))return o(e);{const e=(s=r[t],l=p,null!=s?l(s):C.none());return rr(e,t,a,i,(e=>n(C.some(zo(e)))),n)}var s,l}),n)))},ar=e=>e.map((e=>e+"px")).getOr(""),ir=(e,t,o)=>sr(e,t,Yn,(e=>e.getOrThunk(o.minCellWidth))),lr=(e,t,o,n,r)=>{const s=cn(e),a=[C.some(o.edge(t))].concat(D(o.positions(s,t),(e=>e.map((e=>e.y)))));return D(s,((e,t)=>rr(e,t,a,b(Ut),n,r)))},cr=(e,t)=>()=>dt(e)?t(e):parseFloat(Pt(e,"width").getOr("0")),dr=e=>{const t=cr(e,zo),o=h(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>ir(t,e,o),getCellDelta:o,singleColumnWidth:h([0]),minCellWidth:o,setElementWidth:g,adjustTableWidth:g,isRelative:!0,label:"none"}},mr=e=>{const t=cr(e,(e=>parseFloat(Qn(e)))),o=cr(e,zo);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>sr(e,t,Kn,(e=>e.fold((()=>o.minCellWidth()),(e=>e/o.pixelWidth()*100)))))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>Wt()/o()*100,setElementWidth:Un,adjustTableWidth:o=>{const n=t();Un(e,n+o/100*n)},isRelative:!0,label:"percent"}},ur=e=>{const t=cr(e,zo);return{width:t,pixelWidth:t,getWidths:(t,o)=>ir(t,e,o),getCellDelta:p,singleColumnWidth:(e,t)=>[Math.max(Wt(),e+t)-e],minCellWidth:Wt,setElementWidth:Zn,adjustTableWidth:o=>{const n=t()+o;Zn(e,n)},isRelative:!1,label:"pixel"}},gr=e=>Gn(e).fold((()=>dr(e)),(t=>((e,t)=>null!==er().exec(t)?mr(e):ur(e))(e,t))),hr=ur,pr=mr,fr=(e,t,o)=>{const n=e[o].element,r=Se.fromTag("td");Ze(r,Se.fromTag("br"));(t?Ze:Ve)(n,r)},vr=(e,t)=>{const o=e=>ke(e.element,t),n=Xe(e),r=no(n),s=gr(e),a=sn.generate(r),i=((e,t)=>{const o=e.grid.columns;let n=e.grid.rows,r=o,s=0,a=0;const i=[],l=[];return q(e.access,(e=>{if(i.push(e),t(e)){l.push(e);const t=e.row,o=t+e.rowspan-1,i=e.column,c=i+e.colspan-1;ts&&(s=o),ia&&(a=c)}})),((e,t,o,n,r,s)=>({minRow:e,minCol:t,maxRow:o,maxCol:n,allCells:r,selectedCells:s}))(n,r,s,a,i,l)})(a,o),l="th:not("+t+"),td:not("+t+")",c=Gt(n,"th,td",(e=>ke(e,l)));A(c,qe),((e,t,o,n)=>{const r=N(e,(e=>"colgroup"!==e.section)),s=t.grid.columns,a=t.grid.rows;for(let e=0;eo.maxRow||io.maxCol||(sn.getAt(t,e,i).filter(n).isNone()?fr(r,a,e):a=!0)}})(r,a,i,o);const d=((e,t,o,n)=>{if(0===n.minCol&&t.grid.columns===n.maxCol+1)return 0;const r=ir(t,e,o),s=B(r,((e,t)=>e+t),0),a=B(r.slice(n.minCol,n.maxCol+1),((e,t)=>e+t),0),i=a/s*o.pixelWidth()-o.pixelWidth();return o.getCellDelta(i)})(e,sn.fromTable(e),s,i);return((e,t,o,n)=>{q(o.columns,(e=>{(e.columnt.maxCol)&&qe(e.element)}));const r=N(qt(e,"tr"),(e=>0===e.dom.childElementCount));A(r,qe),t.minCol!==t.maxCol&&t.minRow!==t.maxRow||A(qt(e,"th,td"),(e=>{we(e,"rowspan"),we(e,"colspan")})),we(e,Qo),we(e,"data-snooker-col-series"),gr(e).adjustTableWidth(n)})(n,i,a,d),n},br=((e,t)=>{const o=t=>e(t)?C.from(t.dom.nodeValue):C.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})(me,"text"),yr=e=>br.get(e),wr=e=>br.getOption(e),xr=(e,t)=>br.set(e,t),Cr=e=>"img"===se(e)?1:wr(e).fold((()=>Ie(e).length),(e=>e.length)),Sr=["img","br"],kr=e=>wr(e).filter((e=>0!==e.trim().length||e.indexOf(" ")>-1)).isSome()||E(Sr,se(e))||(e=>ce(e)&&"false"===be(e,"contenteditable"))(e),_r=e=>((e,t)=>{const o=e=>{for(let n=0;nTr(e,kr),Tr=(e,t)=>{const o=e=>{const n=Ie(e);for(let e=n.length-1;e>=0;e--){const r=n[e];if(t(r))return C.some(r);const s=o(r);if(s.isSome())return s}return C.none()};return o(e)},Or={scope:["row","col"]},Dr=e=>()=>{const t=Se.fromTag("td",e.dom);return Ze(t,Se.fromTag("br",e.dom)),t},Ar=e=>()=>Se.fromTag("col",e.dom),Mr=e=>()=>Se.fromTag("colgroup",e.dom),Nr=e=>()=>Se.fromTag("tr",e.dom),Rr=(e,t,o)=>{const n=((e,t)=>{const o=Je(e,t),n=Ie(Xe(e));return We(o,n),o})(e,t);return q(o,((e,t)=>{null===e?we(n,t):fe(n,t,e)})),n},Br=e=>e,Lr=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;Nt(o)&&Nt(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),Ft(t,"height"),1!==e.colspan&&Ft(t,"width")};return{col:o=>{const r=Se.fromTag(se(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:Mr(t),row:Nr(t),cell:r=>{const s=Se.fromTag(se(r.element),t.dom),a=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),i=a.length>0?((e,t,o)=>_r(e).map((n=>{const r=o.join(","),s=gt(n,r,(t=>Te(t,e)));return R(s,((e,t)=>{const o=Ye(t);return Ze(e,o),o}),t)})).getOr(t))(r.element,s,a):s;return Ze(i,Se.fromTag("br")),n(r,s),((e,t)=>{q(Or,((o,n)=>ye(e,n).filter((e=>E(o,e))).each((e=>fe(t,n,e)))))})(r.element,s),e(r.element,s),s},replace:Rr,colGap:Ar(t),gap:Dr(t)}},Hr=e=>({col:Ar(e),colgroup:Mr(e),row:Nr(e),cell:Dr(e),replace:Br,colGap:Ar(e),gap:Dr(e)}),Ir=e=>t=>t.options.get(e),Pr="100%",Fr=e=>{var t;const o=e.dom,n=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Zo(Se.fromDom(n))+"px"},zr=e=>C.from(e.options.get("table_clone_elements")),Vr=Ir("table_header_type"),Zr=Ir("table_column_resizing"),Ur=e=>"preservetable"===Zr(e),jr=e=>"resizetable"===Zr(e),Wr=Ir("table_sizing_mode"),$r=e=>"relative"===Wr(e),qr=e=>"fixed"===Wr(e),Gr=e=>"responsive"===Wr(e),Kr=Ir("table_resize_bars"),Yr=Ir("table_style_by_css"),Xr=Ir("table_merge_content_on_paste"),Jr=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>Gr(e)||Yr(e)?t:qr(e)?{...t,width:Fr(e)}:{...t,width:Pr})(e,o)},Qr=e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>Gr(e)||!Yr(e)?t:qr(e)?{...t,width:Fr(e)}:{...t,width:Pr})(e,o)},es=Ir("table_use_colgroups"),ts=e=>Ct(e,"[contenteditable]"),os=(e,t=!1)=>dt(e)?e.dom.isContentEditable:ts(e).fold(h(t),(e=>"true"===ns(e))),ns=e=>e.dom.contentEditable,rs=e=>Se.fromDom(e.getBody()),ss=e=>t=>Te(t,rs(e)),as=e=>{we(e,"data-mce-style");const t=e=>we(e,"data-mce-style");A(Yt(e),t),A(Xt(e),t),A(Qt(e),t)},is=e=>Se.fromDom(e.selection.getStart()),ls=e=>e.getBoundingClientRect().width,cs=e=>e.getBoundingClientRect().height,ds=e=>bt(e,he("table")).exists(os),ms=(e,t)=>{const o=t.column,n=t.column+t.colspan-1,r=t.row,s=t.row+t.rowspan-1;return o<=e.finishCol&&n>=e.startCol&&r<=e.finishRow&&s>=e.startRow},us=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,gs=(e,t,o)=>{const n=sn.findItem(e,t,Te),r=sn.findItem(e,o,Te);return n.bind((e=>r.map((t=>{return o=e,n=t,r=Math.min(o.row,n.row),s=Math.min(o.column,n.column),a=Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),i=Math.max(o.column+o.colspan-1,n.column+n.colspan-1),{startRow:r,startCol:s,finishRow:a,finishCol:i};var o,n,r,s,a,i}))))},hs=(e,t,o)=>gs(e,t,o).bind((t=>((e,t)=>{let o=!0;const n=v(us,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let s=t.startCol;s<=t.finishCol;s++)o=o&&sn.getAt(e,r,s).exists(n);return o?C.some(t):C.none()})(e,t))),ps=(e,t,o)=>gs(e,t,o).map((t=>{const o=sn.filterItems(e,v(ms,t));return D(o,(e=>e.element))})),fs=(e,t)=>sn.findItem(e,t,((e,t)=>Oe(t,e))).map((e=>e.element)),vs=(e,t,o)=>Jt(e).bind((n=>((e,t,o,n)=>sn.findItem(e,t,Te).bind((t=>{const r=o>0?t.row+t.rowspan-1:t.row,s=n>0?t.column+t.colspan-1:t.column;return sn.getAt(e,r+o,s+n).map((e=>e.element))})))(ws(n),e,t,o))),bs=(e,t,o)=>{const n=ws(e);return ps(n,t,o)},ys=(e,t,o,n,r)=>{const s=ws(e),a=Te(e,o)?C.some(t):fs(s,t),i=Te(e,r)?C.some(n):fs(s,n);return a.bind((e=>i.bind((t=>ps(s,e,t)))))},ws=sn.fromTable;var xs=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Cs=()=>({up:h({selector:yt,closest:Ct,predicate:vt,all:Be}),down:h({selector:pt,predicate:ut}),styles:h({get:Ht,getRaw:Pt,set:Bt,remove:Ft}),attrs:h({get:be,set:fe,remove:we,copyTo:(e,t)=>{const o=xe(e);ve(t,o)}}),insert:h({before:Fe,after:ze,afterAll:je,append:Ze,appendAll:We,prepend:Ve,wrap:Ue}),remove:h({unwrap:Ge,remove:qe}),create:h({nu:Se.fromTag,clone:e=>Se.fromDom(e.dom.cloneNode(!1)),text:Se.fromText}),query:h({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:Le,nextSibling:He}),property:h({children:Ie,name:se,parent:Ne,document:e=>Me(e).dom,isText:me,isComment:le,isElement:de,isSpecial:e=>{const t=se(e);return E(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>de(e)?ye(e,"lang"):C.none(),getText:yr,setText:xr,isBoundary:e=>!!de(e)&&("body"===se(e)||E(xs,se(e))),isEmptyTag:e=>!!de(e)&&E(["br","img","hr","input"],se(e)),isNonEditable:e=>de(e)&&"false"===be(e,"contenteditable")}),eq:Te,is:De});const Ss=(e,t,o,n)=>{const r=t(e,o);return R(n,((o,n)=>{const r=t(e,n);return ks(e,o,r)}),r)},ks=(e,t,o)=>t.bind((t=>o.filter(v(e.eq,t)))),_s=(e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,Ss):C.none(),Es=(e,t,o,n=w)=>{const r=[t].concat(e.up().all(t)),s=[o].concat(e.up().all(o)),a=e=>H(e,n).fold((()=>e),(t=>e.slice(0,t+1))),i=a(r),l=a(s),c=L(i,(t=>T(l,((e,t)=>v(e.eq,t))(e,t))));return{firstpath:i,secondpath:l,shared:c}},Ts=Cs(),Os=(e,t)=>_s(Ts,((t,o)=>e(o)),t),Ds=e=>yt(e,"table"),As=(e,t,o)=>{const n=e=>t=>void 0!==o&&o(t)||Te(t,e);return Te(e,t)?C.some({boxes:C.some([e]),start:e,finish:t}):Ds(e).bind((r=>Ds(t).bind((s=>{if(Te(r,s))return C.some({boxes:bs(r,e,t),start:e,finish:t});if(Oe(r,s)){const o=gt(t,"td,th",n(r)),a=o.length>0?o[o.length-1]:t;return C.some({boxes:ys(r,e,r,t,s),start:e,finish:a})}if(Oe(s,r)){const o=gt(e,"td,th",n(s)),a=o.length>0?o[o.length-1]:e;return C.some({boxes:ys(s,e,r,t,s),start:e,finish:a})}return((e,t,o)=>Es(Ts,e,t,o))(e,t).shared.bind((a=>Ct(a,"table",o).bind((o=>{const a=gt(t,"td,th",n(o)),i=a.length>0?a[a.length-1]:t,l=gt(e,"td,th",n(o)),c=l.length>0?l[l.length-1]:e;return C.some({boxes:ys(o,e,r,t,s),start:c,finish:i})}))))}))))},Ms=(e,t)=>{const o=pt(e,t);return o.length>0?C.some(o):C.none()},Ns=(e,t,o)=>xt(e,t).bind((t=>xt(e,o).bind((e=>Os(Ds,[t,e]).map((o=>({first:t,last:e,table:o}))))))),Rs=(e,t,o,n,r)=>((e,t)=>L(e,(e=>ke(e,t))))(e,r).bind((e=>vs(e,t,o).bind((e=>((e,t)=>yt(e,"table").bind((o=>xt(o,t).bind((t=>As(t,e).bind((e=>e.boxes.map((t=>({boxes:t,start:e.start,finish:e.finish}))))))))))(e,n))))),Bs=(e,t)=>Ms(e,t),Ls=(e,t,o)=>Ns(e,t,o).bind((t=>{const o=t=>Te(e,t),n="thead,tfoot,tbody,table",r=yt(t.first,n,o),s=yt(t.last,n,o);return r.bind((e=>s.bind((o=>Te(e,o)?((e,t,o)=>{const n=ws(e);return hs(n,t,o)})(t.table,t.first,t.last):C.none()))))})),Hs=p,Is=e=>{const t=(e,t)=>ye(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&F(e,(e=>t(e,"rowspan")||t(e,"colspan")))?C.some(e):C.none()},Ps=(e,t,o)=>t.length<=1?C.none():Ls(e,o.firstSelectedSelector,o.lastSelectedSelector).map((e=>({bounds:e,cells:t}))),Fs="data-mce-selected",zs="td["+Fs+"],th["+Fs+"]",Vs="["+Fs+"]",Zs="data-mce-first-selected",Us="td["+Zs+"],th["+Zs+"]",js="data-mce-last-selected",Ws="td["+js+"],th["+js+"]",$s=Vs,qs={selected:Fs,selectedSelector:zs,firstSelected:Zs,firstSelectedSelector:Us,lastSelected:js,lastSelectedSelector:Ws},Gs=(e,t,o)=>({element:o,mergable:Ps(t,e,qs),unmergable:Is(e),selection:Hs(e)}),Ks=e=>(t,o)=>{const n=se(t),r="col"===n||"colgroup"===n?Jt(s=t).bind((e=>Bs(e,qs.firstSelectedSelector))).fold(h(s),(e=>e[0])):t;var s;return Ct(r,e,o)},Ys=Ks("th,td,caption"),Xs=Ks("th,td"),Js=e=>{return t=e.model.table.getSelectedCells(),D(t,Se.fromDom);var t},Qs=(e,t)=>{e.on("BeforeGetContent",(t=>{const o=o=>{t.preventDefault(),(e=>Jt(e[0]).map((e=>{const t=vr(e,$s);return as(t),[t]})))(o).each((o=>{t.content="text"===t.format?(e=>D(e,(e=>e.dom.innerText)).join(""))(o):((e,t)=>D(t,(t=>e.selection.serializer.serialize(t.dom,{}))).join(""))(e,o)}))};if(!0===t.selection){const t=(e=>N(Js(e),(e=>ke(e,qs.selectedSelector))))(e);t.length>=1&&o(t)}})),e.on("BeforeSetContent",(o=>{if(!0===o.selection&&!0===o.paste){const n=Js(e);Z(n).each((n=>{Jt(n).each((r=>{const s=N(((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Ie(Se.fromDom(o))})(o.content),(e=>"meta"!==se(e))),a=he("table");if(Xr(e)&&1===s.length&&a(s[0])){o.preventDefault();const a=Se.fromDom(e.getDoc()),i=Hr(a),l=((e,t,o)=>({element:e,clipboard:t,generators:o}))(n,s[0],i);t.pasteCells(r,l).each((()=>{e.focus()}))}}))}))}}))},ea=(e,t)=>({element:e,offset:t}),ta=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind((t=>ta(e,t,o).orThunk((()=>C.some(t))))):C.none(),oa=(e,t)=>{if(e.property().isText(t))return e.property().getText(t).length;return e.property().children(t).length},na=(e,t)=>{const o=ta(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return ea(o,oa(e,o));const n=e.property().children(o);return n.length>0?na(e,n[n.length-1]):ea(o,oa(e,o))},ra=na,sa=Cs(),aa=(e,t)=>{if(!Zt(e)){const o=(e=>Gn(e).bind((e=>In(e,["fixed","relative","empty"]))))(e);o.each((o=>{const n=o.value/2;Jn(e,n,o.unit),Jn(t,n,o.unit)}))}},ia=e=>D(e,h(0)),la=(e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))),ca=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),s=Math.abs(e-t[o]);return n>=0?s:-s}return n},da=ca((e=>e<0)),ma=ca(x),ua=()=>{const e=(e,t,o,n)=>{const r=(100+o)/100,s=Math.max(n,(e[t]+o)/r);return D(e,((e,o)=>(o===t?s:e/r)-e))},t=(t,o,n,r,s,a)=>a?e(t,o,r,s):((e,t,o,n,r)=>{const s=da(e,t,n,r);return la(e,t,o+1,[s,0],ia)})(t,o,n,r,s);return{resizeTable:(e,t)=>e(t),clampTableDelta:da,calcLeftEdgeDeltas:t,calcMiddleDeltas:(e,o,n,r,s,a,i)=>t(e,n,r,s,a,i),calcRightEdgeDeltas:(t,o,n,r,s,a)=>{if(a)return e(t,n,r,s);{const e=da(t,n,r,s);return ia(t.slice(0,n)).concat([e])}},calcRedestributedWidths:(e,t,o,n)=>{if(n){const n=(t+o)/t,r=D(e,(e=>e/n));return{delta:100*n-100,newSizes:r}}return{delta:o,newSizes:e}}}},ga=()=>{const e=(e,t,o,n,r)=>{const s=ma(e,n>=0?o:t,n,r);return la(e,t,o+1,[s,-s],ia)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=B(e,((e,t)=>e+t-n),0);return Math.max(-t,o)}}return da(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,s,a)=>e(t,n,r,s,a),calcRightEdgeDeltas:(e,t,o,n,r,s)=>{if(s)return ia(e);{const t=n/e.length;return D(e,h(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},ha=e=>sn.fromTable(e).grid,pa=he("th"),fa=e=>F(e,(e=>pa(e.element))),va=(e,t)=>e&&t?"sectionCells":e?"section":"cells",ba=e=>{const t="thead"===e.section,o=St(ya(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:va(t,o)}:{type:"body"}},ya=e=>{const t=N(e,(e=>pa(e.element)));return 0===t.length?C.some("td"):t.length===e.length?C.some("th"):C.none()},wa=(e,t,o)=>ot(o(e.element,t),!0,e.isLocked),xa=(e,t)=>e.section!==t?nt(e.element,e.cells,t,e.isNew):e,Ca=()=>({transformRow:xa,transformCell:(e,t,o)=>{const n=o(e.element,t),r="td"!==se(n)?((e,t)=>{const o=Je(e,t);ze(e,o);const n=Ie(e);return We(o,n),qe(e),o})(n,"td"):n;return ot(r,e.isNew,e.isLocked)}}),Sa=()=>({transformRow:xa,transformCell:wa}),ka=()=>({transformRow:(e,t)=>xa(e,"thead"===t?"tbody":t),transformCell:wa}),_a=(e,t)=>{const o=(e=>j(e.all,(e=>{const t=ba(e);return"header"===t.type?C.from(t.subType):C.none()})))(sn.fromTable(e)).getOr(t);switch(o){case"section":return Ca();case"sectionCells":return Sa();case"cells":return ka()}},Ea=Ca,Ta=Sa,Oa=ka,Da=()=>({transformRow:p,transformCell:wa}),Aa=(e,t,o,n)=>{o===n?we(e,t):fe(e,t,o)},Ma=(e,t,o)=>{U(ht(e,t)).fold((()=>Ve(e,o)),(e=>ze(e,o)))},Na=(e,t)=>{const o=[],n=[],r=e=>D(e,(e=>{e.isNew&&o.push(e.element);const t=e.element;return $e(t),A(e.cells,(e=>{e.isNew&&n.push(e.element),Aa(e.element,"colspan",e.colspan,1),Aa(e.element,"rowspan",e.rowspan,1),Ze(t,e.element)})),t})),s=e=>P(e,(e=>D(e.cells,(e=>(Aa(e.element,"span",e.colspan,1),e.element))))),a=(t,o)=>{const n=((e,t)=>{const o=wt(e,t).getOrThunk((()=>{const o=Se.fromTag(t,Ae(e).dom);return"thead"===t?Ma(e,"caption,colgroup",o):"colgroup"===t?Ma(e,"caption",o):Ze(e,o),o}));return $e(o),o})(e,o),a=("colgroup"===o?s:r)(t);We(n,a)},i=(t,o)=>{t.length>0?a(t,o):(t=>{wt(e,t).each(qe)})(o)},l=[],c=[],d=[],m=[];return A(t,(e=>{switch(e.section){case"thead":l.push(e);break;case"tbody":c.push(e);break;case"tfoot":d.push(e);break;case"colgroup":m.push(e)}})),i(m,"colgroup"),i(l,"thead"),i(c,"tbody"),i(d,"tfoot"),{newRows:o,newCells:n}},Ra=(e,t)=>{if(0===e.length)return 0;const o=e[0];return H(e,(e=>!t(o.element,e.element))).getOr(e.length)},Ba=(e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),s="colgroup"===r.section,a=Ra(r.cells.slice(o),n),i=s?1:Ra(((e,t)=>D(e,(e=>Go(e,t))))(e.slice(t),o),n);return{colspan:a,rowspan:i}},La=(e,t)=>{const o=D(e,(e=>D(e.cells,w)));return D(e,((n,r)=>{const s=P(n.cells,((n,s)=>{if(!1===o[r][s]){const d=Ba(e,r,s,t);return((e,t,n,r)=>{for(let s=e;s({element:e,cells:t,section:o,isNew:n}))(n.element,s,n.section,n.isNew)}))},Ha=(e,t,o)=>{const n=[];A(e.colgroups,(r=>{const s=[];for(let n=0;not(e.element,o,!1))).getOrThunk((()=>ot(t.colGap(),!0,!1)));s.push(r)}n.push(nt(r.element,s,"colgroup",o))}));for(let r=0;rot(e.element,o,e.isLocked))).getOrThunk((()=>ot(t.gap(),!0,!1)));s.push(a)}const a=e.all[r],i=nt(a.element,s,a.section,o);n.push(i)}return n},Ia=e=>La(e,Te),Pa=(e,t)=>j(e.all,(e=>L(e.cells,(e=>Te(t,e.element))))),Fa=(e,t,o)=>{const n=D(t.selection,(t=>Kt(t).bind((t=>Pa(e,t))).filter(o))),r=kt(n);return _t(r.length>0,r)},za=(e,t,o,n,r)=>(s,a,i,l)=>{const c=sn.fromTable(s),d=C.from(null==l?void 0:l.section).getOrThunk(Da);return t(c,a).map((t=>{const o=((e,t)=>Ha(e,t,!1))(c,i),n=e(o,t,Te,r(i),d),s=tn(n.grid);return{info:t,grid:Ia(n.grid),cursor:n.cursor,lockedColumns:s}})).bind((e=>{const t=Na(s,e.grid),r=C.from(null==l?void 0:l.sizing).getOrThunk((()=>gr(s))),a=C.from(null==l?void 0:l.resize).getOrThunk(ga);return o(s,e.grid,e.info,{sizing:r,resize:a,section:d}),n(s),we(s,Qo),e.lockedColumns.length>0&&fe(s,Qo,e.lockedColumns.join(",")),C.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})}))},Va=(e,t)=>Fa(e,t,x).map((e=>({cells:e,generators:t.generators,clipboard:t.clipboard}))),Za=(e,t)=>Fa(e,t,x),Ua=(e,t)=>Fa(e,t,(e=>!e.isLocked)),ja=(e,t)=>F(t,(t=>((e,t)=>Pa(e,t).exists((e=>!e.isLocked)))(e,t))),Wa=(e,t,o,n)=>{const r=Xo(e).rows;let s=!0;for(let e=0;e{const r=Xo(e).rows;if(t>0&&tB(e,((e,o)=>T(e,(e=>t(e.element,o.element)))?e:e.concat([o])),[]))(r[t-1].cells,o);A(e,(e=>{let s=C.none();for(let a=t;a{$o(i,t,ot(e,!0,l.isLocked))})))}}))}return e},qa=e=>{const t=t=>t(e),o=h(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:x,isError:w,map:t=>Ka.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:()=>C.some(e)};return r},Ga=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:w,isError:x,map:t,mapError:t=>Ka.error(t(e)),bind:t,exists:w,forall:x,getOr:p,or:p,getOrThunk:y,orThunk:y,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:g,toOptional:C.none};var n;return o},Ka={value:qa,error:Ga,fromOption:(e,t)=>e.fold((()=>Ga(t)),qa)},Ya=(e,t)=>({rowDelta:0,colDelta:Yo(e[0])-Yo(t[0])}),Xa=(e,t)=>({rowDelta:e.length-t.length,colDelta:0}),Ja=(e,t,o,n)=>{const r="colgroup"===t.section?o.col:o.cell;return O(e,(e=>ot(r(),!0,n(e))))},Qa=(e,t,o,n)=>{const r=e[e.length-1];return e.concat(O(t,(()=>{const e="colgroup"===r.section?o.colgroup:o.row,t=Jo(r,e,p),s=Ja(t.cells.length,t,o,(e=>Q(n,e.toString())));return qo(t,s)})))},ei=(e,t,o,n)=>D(e,(e=>{const r=Ja(t,e,o,w);return jo(e,n,r)})),ti=(e,t,o)=>{const n=t.colDelta<0?ei:p,r=t.rowDelta<0?Qa:p,s=tn(e),a=Yo(e[0]),i=T(s,(e=>e===a-1)),l=n(e,Math.abs(t.colDelta),o,i?a-1:a),c=tn(l);return r(l,Math.abs(t.rowDelta),o,z(c,x))},oi=(e,t,o,n)=>{const r=v(n,Go(e[t],o).element),s=e[t];return e.length>1&&Yo(s)>1&&(o>0&&r(Ko(s,o-1))||o0&&r(Ko(e[t-1],o))||tN(o,(o=>o>=e.column&&o<=Yo(t[0])+e.column)),ri=(e,t,o,n,r)=>{const s=tn(t),a=((e,t,o)=>{const n=Yo(t[0]),r=Xo(t).cols.length+e.row,s=O(n-e.column,(t=>t+e.column)),a=L(s,(e=>F(o,(t=>t!==e)))).getOr(n-1);return{row:r,column:a}})(e,t,s),i=Xo(o).rows,l=ni(a,i,s),c=((e,t,o)=>{if(e.row>=t.length||e.column>Yo(t[0]))return Ka.error("invalid start address out of table bounds, row: "+e.row+", column: "+e.column);const n=t.slice(e.row),r=n[0].cells.slice(e.column),s=Yo(o[0]),a=o.length;return Ka.value({rowDelta:n.length-a,colDelta:r.length-s})})(a,t,i);return c.map((e=>{const o={...e,colDelta:e.colDelta-l.length},s=ti(t,o,n),c=tn(s),d=ni(a,i,c);return((e,t,o,n,r,s)=>{const a=e.row,i=e.column,l=a+o.length,c=i+Yo(o[0])+s.length,d=z(s,x);for(let e=a;e{((e,t,o,n)=>{t>0&&t{const r=e.cells[t-1];let s=0;const a=n();for(;e.cells.length>t+s&&o(r.element,e.cells[t+s].element);)$o(e,t+s,ot(a,!0,e.cells[t+s].isLocked)),s++}))})(t,e,r,n.cell);const s=Xa(o,t),a=ti(o,s,n),i=Xa(t,a),l=ti(t,i,n);return D(l,((t,o)=>jo(t,e,a[o].cells)))},ai=(e,t,o,n,r)=>{$a(t,e,r,n.cell);const s=tn(t),a=Ya(t,o),i={...a,colDelta:a.colDelta-s.length},l=ti(t,i,n),{cols:c,rows:d}=Xo(l),m=tn(l),u=Ya(o,t),g={...u,colDelta:u.colDelta+m.length},h=((e,t,o)=>D(e,(e=>B(o,((o,n)=>{const r=Ja(1,e,t,x)[0];return Wo(o,n,r)}),e))))(o,n,m),p=ti(h,g,n);return[...c,...d.slice(0,e),...p,...d.slice(e,d.length)]},ii=(e,t,o,n,r)=>{const{rows:s,cols:a}=Xo(e),i=s.slice(0,t),l=s.slice(t),c=((e,t,o,n)=>Jo(e,(e=>n(e,o)),t))(s[o],((e,o)=>t>0&&tD(e,(e=>{const s=t>0&&t{if("colgroup"!==o&&n)return Go(e,t);{const t=Go(e,r);return ot(a(t.element,s),!0,!1)}})(e,t,e.section,s,o,n,r);return Wo(e,t,a)})),ci=(e,t,o,n)=>((e,t,o,n)=>void 0!==Ko(e[t],o)&&t>0&&n(Ko(e[t-1],o),Ko(e[t],o)))(e,t,o,n)||((e,t,o)=>t>0&&o(Ko(e,t-1),Ko(e,t)))(e[t],o,n),di=(e,t,o,n)=>{const r=e=>(e=>"row"===e?Ut(t):Zt(t))(e)?`${e}group`:e;if(e)return pa(t)?r(o):null;if(n&&pa(t)){return r("row"===o?"col":"row")}return null},mi=(e,t,o)=>ot(o(e.element,t),!0,e.isLocked),ui=(e,t,o,n,r,s,a)=>D(e,((e,i)=>((e,t)=>{const o=e.cells,n=D(o,t);return nt(e.element,n,e.section,e.isNew)})(e,((e,l)=>{if((e=>T(t,(t=>o(e.element,t.element))))(e)){const t=a(e,i,l)?r(e,o,n):e;return s(t,i,l).each((e=>{var o,n;o=t.element,n={scope:C.from(e)},q(n,((e,t)=>{e.fold((()=>{we(o,t)}),(e=>{pe(o.dom,t,e)}))}))})),t}return e})))),gi=(e,t,o)=>P(e,((n,r)=>ci(e,r,t,o)?[]:[Go(n,t)])),hi=(e,t,o,n,r)=>{const s=Xo(e).rows,a=P(t,(e=>gi(s,e,n))),i=D(s,(e=>fa(e.cells))),l=((e,t)=>F(t,p)&&fa(e)?x:(e,o,n)=>!("th"===se(e.element)&&t[o]))(a,i),c=((e,t)=>(o,n)=>C.some(di(e,o.element,"row",t[n])))(o,i);return ui(e,a,n,r,mi,c,l)},pi=(e,t,o,n,r,s,a)=>{const{cols:i,rows:l}=Xo(e),c=l[t[0]],d=P(t,(e=>((e,t,o)=>{const n=e[t];return P(n.cells,((n,r)=>ci(e,t,r,o)?[]:[n]))})(l,e,r))),m=D(c.cells,((e,t)=>fa(gi(l,t,r)))),u=[...l];A(t,(e=>{u[e]=a.transformRow(l[e],o)}));const g=[...i,...u],h=((e,t)=>F(t,p)&&fa(e.cells)?x:(e,o,n)=>!("th"===se(e.element)&&t[n]))(c,m),f=((e,t)=>(o,n,r)=>C.some(di(e,o.element,"col",t[r])))(n,m);return ui(g,d,r,s,a.transformCell,f,h)},fi=(e,t,o,n)=>{const r=Xo(e).rows,s=D(t,(e=>Go(r[e.row],e.column)));return ui(e,s,o,n,mi,C.none,x)},vi=e=>{if(!a(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 A(e,((n,r)=>{const s=W(n);if(1!==s.length)throw new Error("one and only one name per case");const i=s[0],l=n[i];if(void 0!==o[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!a(l))throw new Error("case arguments must be an array");t.push(i),o[i]=(...o)=>{const n=o.length;if(n!==l.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+l.length+" ("+l+"), 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[r].apply(null,o)},match:e=>{const n=W(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!F(t,(e=>E(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[i].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:i,params:o})}}}})),o},bi={...vi([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},yi=(e,t,o,n,r)=>{const s=e.slice(0),a=((e,t)=>0===e.length?bi.none():1===e.length?bi.only(0):0===t?bi.left(0,1):t===e.length-1?bi.right(t-1,t):t>0&&tn.singleColumnWidth(s[e],o)),((e,t)=>r.calcLeftEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)),((e,t,a)=>r.calcMiddleDeltas(s,e,t,a,o,n.minCellWidth(),n.isRelative)),((e,t)=>r.calcRightEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)))},wi=(e,t,o)=>{let n=0;for(let r=e;r{const o=sn.justCells(e);return D(o,(e=>{const o=wi(e.row,e.row+e.rowspan,t);return{element:e.element,height:o,rowspan:e.rowspan}}))},Ci=(e,t)=>sn.hasColumns(e)?((e,t)=>{const o=sn.justColumns(e);return D(o,((e,o)=>({element:e.element,width:t[o],colspan:e.colspan})))})(e,t):((e,t)=>{const o=sn.justCells(e);return D(o,(e=>{const o=wi(e.column,e.column+e.colspan,t);return{element:e.element,width:o,colspan:e.colspan}}))})(e,t),Si=(e,t,o)=>{const n=Ci(e,t);A(n,(e=>{o.setElementWidth(e.element,e.width)}))},ki=(e,t,o,n,r)=>{const s=sn.fromTable(e),a=r.getCellDelta(t),i=r.getWidths(s,r),l=o===s.grid.columns-1,c=n.clampTableDelta(i,o,a,r.minCellWidth(),l),d=yi(i,o,c,r,n),m=D(d,((e,t)=>e+i[t]));Si(s,m,r),n.resizeTable(r.adjustTableWidth,c,l)},_i=(e,t,o,n)=>{const r=sn.fromTable(e),s=((e,t,o)=>lr(e,t,o,Xn,(e=>e.getOrThunk($t))))(r,e,n),a=D(s,((e,n)=>o===n?Math.max(t+e,$t()):e)),i=xi(r,a),l=((e,t)=>D(e.all,((e,o)=>({element:e.element,height:t[o]}))))(r,a);A(l,(e=>{jn(e.element,e.height)})),A(i,(e=>{jn(e.element,e.height)}));const c=R(a,((e,t)=>e+t),0);jn(e,c)},Ei=e=>B(e,((e,t)=>T(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),Ti=he("col"),Oi=he("colgroup"),Di=e=>"tr"===se(e)||Oi(e),Ai=e=>({element:e,colspan:zt(e,"colspan",1),rowspan:zt(e,"rowspan",1)}),Mi=e=>ye(e,"scope").map((e=>e.substr(0,3))),Ni=(e,t=Ai)=>{const o=o=>{if(Di(o))return Oi((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,s=(t=>Ti(t.element)?e.col(t):e.cell(t))(t(r));return n=C.some({item:r,replacement:s}),s}var r};let n=C.none();return{getOrInit:(e,t)=>n.fold((()=>o(e)),(n=>t(e,n.item)?n.replacement:o(e)))}},Ri=e=>t=>{const o=[],n=n=>{const r="td"===e?{scope:null}:{},s=t.replace(n,e,r);return o.push({item:n,sub:s}),s};return{replaceOrInit:(e,t)=>{if(Di(e)||Ti(e))return e;{const r=e;return((e,t)=>L(o,(o=>t(o.item,e))))(r,t).fold((()=>n(r)),(o=>t(e,o.item)?o.sub:n(r)))}}}},Bi=e=>({unmerge:t=>{const o=Mi(t);return o.each((e=>fe(t,"scope",e))),()=>{const n=e.cell({element:t,colspan:1,rowspan:1});return Ft(n,"width"),Ft(t,"width"),o.each((e=>fe(n,"scope",e))),n}},merge:e=>(Ft(e[0],"width"),(()=>{const t=kt(D(e,Mi));if(0===t.length)return C.none();{const e=t[0],o=["row","col"];return T(t,(t=>t!==e&&E(o,t)))?C.none():C.from(e)}})().fold((()=>we(e[0],"scope")),(t=>fe(e[0],"scope",t+"group"))),h(e[0]))}),Li=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Hi=Cs(),Ii=e=>((e,t)=>{const o=e.property().name(t);return E(Li,o)})(Hi,e),Pi=e=>((e,t)=>{const o=e.property().name(t);return E(["ol","ul"],o)})(Hi,e),Fi=e=>((e,t)=>E(["br","img","hr","input"],e.property().name(t)))(Hi,e),zi=e=>{const t=he("br"),o=e=>Er(e).bind((o=>{const n=He(o).map((e=>!!Ii(e)||!!Fi(e)&&"img"!==se(e))).getOr(!1);return Ne(o).map((r=>!0===n||(e=>"li"===se(e)||vt(e,Pi).isSome())(r)||t(o)||Ii(r)&&!Te(e,r)?[]:[Se.fromTag("br")]))})).getOr([]),n=(()=>{const n=P(e,(e=>{const n=Ie(e);return(e=>F(e,(e=>t(e)||me(e)&&0===yr(e).trim().length)))(n)?[]:n.concat(o(e))}));return 0===n.length?[Se.fromTag("br")]:n})();$e(e[0]),We(e[0],n)},Vi=e=>os(e,!0),Zi=e=>{0===Yt(e).length&&qe(e)},Ui=(e,t)=>({grid:e,cursor:t}),ji=(e,t,o)=>{var n,r;const s=Xo(e).rows;return C.from(null===(r=null===(n=s[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(Vi).orThunk((()=>(e=>j(e,(e=>j(e.cells,(e=>{const t=e.element;return _t(Vi(t),t)})))))(s)))},Wi=(e,t,o)=>{const n=ji(e,t,o);return Ui(e,n)},$i=e=>B(e,((e,t)=>T(e,(e=>e.row===t.row))?e:e.concat([t])),[]).sort(((e,t)=>e.row-t.row)),qi=(e,t)=>(o,n,r,s,a)=>{const i=$i(n),l=D(i,(e=>e.row)),c=pi(o,l,e,t,r,s.replaceOrInit,a);return Wi(c,n[0].row,n[0].column)},Gi=qi("thead",!0),Ki=qi("tbody",!1),Yi=qi("tfoot",!1),Xi=(e,t,o)=>{const n=((e,t)=>to(e,(()=>t)))(e,o.section),r=sn.generate(n);return Ha(r,t,!0)},Ji=(e,t,o,n)=>((e,t,o,n)=>{const r=sn.generate(t),s=n.getWidths(r,n);Si(r,s,n)})(0,t,0,n.sizing),Qi=(e,t,o,n)=>((e,t,o,n,r)=>{const s=sn.generate(t),a=n.getWidths(s,n),i=n.pixelWidth(),{newSizes:l,delta:c}=r.calcRedestributedWidths(a,i,o.pixelDelta,n.isRelative);Si(s,l,n),n.adjustTableWidth(c)})(0,t,o,n.sizing,n.resize),el=(e,t)=>T(t,(e=>0===e.column&&e.isLocked)),tl=(e,t)=>T(t,(t=>t.column+t.colspan>=e.grid.columns&&t.isLocked)),ol=(e,t)=>{const o=an(e),n=Ei(t);return B(n,((e,t)=>e+o[t.column].map(Vo).getOr(0)),0)},nl=e=>(t,o)=>Za(t,o).filter((o=>!(e?el:tl)(t,o))).map((e=>({details:e,pixelDelta:ol(t,e)}))),rl=e=>(t,o)=>Va(t,o).filter((o=>!(e?el:tl)(t,o.cells))),sl=Ri("th"),al=Ri("td"),il=za(((e,t,o,n)=>{const r=t[0].row,s=$i(t),a=R(s,((e,t)=>({grid:ii(e.grid,r,t.row+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return Wi(a,r,t[0].column)}),Za,g,g,Ni),ll=za(((e,t,o,n)=>{const r=$i(t),s=r[r.length-1],a=s.row+s.rowspan,i=R(r,((e,t)=>ii(e,a,t.row,o,n.getOrInit)),e);return Wi(i,a,t[0].column)}),Za,g,g,Ni),cl=za(((e,t,o,n)=>{const r=t.details,s=Ei(r),a=s[0].column,i=R(s,((e,t)=>({grid:li(e.grid,a,t.column+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return Wi(i,r[0].row,a)}),nl(!0),Qi,g,Ni),dl=za(((e,t,o,n)=>{const r=t.details,s=r[r.length-1],a=s.column+s.colspan,i=Ei(r),l=R(i,((e,t)=>li(e,a,t.column,o,n.getOrInit)),e);return Wi(l,r[0].row,a)}),nl(!1),Qi,g,Ni),ml=za(((e,t,o,n)=>{const r=Ei(t.details),s=((e,t)=>P(e,(e=>{const o=e.cells,n=R(t,((e,t)=>t>=0&&t0?[nt(e.element,n,e.section,e.isNew)]:[]})))(e,D(r,(e=>e.column))),a=s.length>0?s[0].cells.length-1:0;return Wi(s,r[0].row,Math.min(r[0].column,a))}),((e,t)=>Ua(e,t).map((t=>({details:t,pixelDelta:-ol(e,t)})))),Qi,Zi,Ni),ul=za(((e,t,o,n)=>{const r=$i(t),s=((e,t,o)=>{const{rows:n,cols:r}=Xo(e);return[...r,...n.slice(0,t),...n.slice(o+1)]})(e,r[0].row,r[r.length-1].row),a=s.length>0?s.length-1:0;return Wi(s,Math.min(t[0].row,a),t[0].column)}),Za,g,Zi,Ni),gl=za(((e,t,o,n)=>{const r=Ei(t),s=D(r,(e=>e.column)),a=hi(e,s,!0,o,n.replaceOrInit);return Wi(a,t[0].row,t[0].column)}),Ua,g,g,sl),hl=za(((e,t,o,n)=>{const r=Ei(t),s=D(r,(e=>e.column)),a=hi(e,s,!1,o,n.replaceOrInit);return Wi(a,t[0].row,t[0].column)}),Ua,g,g,al),pl=za(Gi,Ua,g,g,sl),fl=za(Ki,Ua,g,g,al),vl=za(Yi,Ua,g,g,al),bl=za(((e,t,o,n)=>{const r=fi(e,t,o,n.replaceOrInit);return Wi(r,t[0].row,t[0].column)}),Ua,g,g,sl),yl=za(((e,t,o,n)=>{const r=fi(e,t,o,n.replaceOrInit);return Wi(r,t[0].row,t[0].column)}),Ua,g,g,al),wl=za(((e,t,o,n)=>{const r=t.cells;zi(r);const s=((e,t,o,n)=>{const r=Xo(e).rows;if(0===r.length)return e;for(let e=t.startRow;e<=t.finishRow;e++)for(let o=t.startCol;o<=t.finishCol;o++){const t=r[e],s=Go(t,o).isLocked;$o(t,o,ot(n(),!1,s))}return e})(e,t.bounds,0,n.merge(r));return Ui(s,C.from(r[0]))}),((e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>ja(e,t.cells)))),Ji,g,Bi),xl=za(((e,t,o,n)=>{const r=R(t,((e,t)=>Wa(e,t,o,n.unmerge(t))),e);return Ui(r,C.from(t[0]))}),((e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>ja(e,t)))),Ji,g,Bi),Cl=za(((e,t,o,n)=>{const r=((e,t)=>{const o=sn.fromTable(e);return Ha(o,t,!0)})(t.clipboard,t.generators),s=((e,t)=>({row:e,column:t}))(t.row,t.column);return ri(s,e,r,t.generators,o).fold((()=>Ui(e,C.some(t.element))),(e=>Wi(e,t.row,t.column)))}),((e,t)=>Kt(t.element).bind((o=>Pa(e,o).map((e=>({...e,generators:t.generators,clipboard:t.clipboard})))))),Ji,g,Ni),Sl=za(((e,t,o,n)=>{const r=Xo(e).rows,s=t.cells[0].column,a=r[t.cells[0].row],i=Xi(t.clipboard,t.generators,a),l=si(s,e,i,t.generators,o);return Wi(l,t.cells[0].row,t.cells[0].column)}),rl(!0),g,g,Ni),kl=za(((e,t,o,n)=>{const r=Xo(e).rows,s=t.cells[t.cells.length-1].column+t.cells[t.cells.length-1].colspan,a=r[t.cells[0].row],i=Xi(t.clipboard,t.generators,a),l=si(s,e,i,t.generators,o);return Wi(l,t.cells[0].row,t.cells[0].column)}),rl(!1),g,g,Ni),_l=za(((e,t,o,n)=>{const r=Xo(e).rows,s=t.cells[0].row,a=r[s],i=Xi(t.clipboard,t.generators,a),l=ai(s,e,i,t.generators,o);return Wi(l,t.cells[0].row,t.cells[0].column)}),Va,g,g,Ni),El=za(((e,t,o,n)=>{const r=Xo(e).rows,s=t.cells[t.cells.length-1].row+t.cells[t.cells.length-1].rowspan,a=r[t.cells[0].row],i=Xi(t.clipboard,t.generators,a),l=ai(s,e,i,t.generators,o);return Wi(l,t.cells[0].row,t.cells[0].column)}),Va,g,g,Ni),Tl=(e,t)=>{const o=sn.fromTable(e);return Za(o,t).bind((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=I(D(o.all,(e=>N(e.cells,(e=>e.column>=n&&e.column{const o=sn.fromTable(e);return Za(o,t).bind(ya).getOr("")},Dl=(e,t)=>{const o=sn.fromTable(e);return Za(o,t).bind((e=>{const t=e[e.length-1],n=e[0].row,r=t.row+t.rowspan;return(e=>{const t=D(e,(e=>ba(e).type)),o=E(t,"header"),n=E(t,"footer");if(o||n){const e=E(t,"body");return!o||e||n?o||e||!n?C.none():C.some("footer"):C.some("header")}return C.some("body")})(o.all.slice(n,r))})).getOr("")},Al=(e,t)=>e.dispatch("NewRow",{node:t}),Ml=(e,t)=>e.dispatch("NewCell",{node:t}),Nl=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},Rl={structure:!1,style:!0},Bl={structure:!0,style:!1},Ll={structure:!0,style:!0},Hl=(e,t)=>$r(e)?pr(t):qr(e)?hr(t):gr(t),Il=(e,t,o)=>{const n=e=>"table"===se(rs(e)),r=zr(e),s=jr(e)?g:aa,a=t=>{switch(Vr(e)){case"section":return Ea();case"sectionCells":return Ta();case"cells":return Oa();default:return _a(t,"section")}},i=(t,n)=>n.cursor.fold((()=>{const n=Yt(t);return Z(n).filter(dt).map((n=>{o.clearSelectedCells(t.dom);const r=e.dom.createRng();return r.selectNode(n.dom),e.selection.setRng(r),fe(n,"data-mce-selected","1"),r}))}),(n=>{const r=ra(sa,n);const s=e.dom.createRng();return s.setStart(r.element.dom,r.offset),s.setEnd(r.element.dom,r.offset),e.selection.setRng(s),o.clearSelectedCells(t.dom),C.some(s)})),l=(o,n,s,l)=>(c,d,m=!1)=>{as(c);const u=Se.fromDom(e.getDoc()),g=Lr(s,u,r),h={sizing:Hl(e,c),resize:jr(e)?ua():ga(),section:a(c)};return n(c)?o(c,d,g,h).bind((o=>{t.refresh(c.dom),A(o.newRows,(t=>{Al(e,t.dom)})),A(o.newCells,(t=>{Ml(e,t.dom)}));const n=i(c,o);return dt(c)&&(as(c),m||Nl(e,c.dom,l)),n.map((e=>({rng:e,effect:l})))})):C.none()},c=l(ul,(t=>!n(e)||ha(t).rows>1),g,Bl),d=l(ml,(t=>!n(e)||ha(t).columns>1),g,Bl);return{deleteRow:c,deleteColumn:d,insertRowsBefore:l(il,x,g,Bl),insertRowsAfter:l(ll,x,g,Bl),insertColumnsBefore:l(cl,x,s,Bl),insertColumnsAfter:l(dl,x,s,Bl),mergeCells:l(wl,x,g,Bl),unmergeCells:l(xl,x,g,Bl),pasteColsBefore:l(Sl,x,g,Bl),pasteColsAfter:l(kl,x,g,Bl),pasteRowsBefore:l(_l,x,g,Bl),pasteRowsAfter:l(El,x,g,Bl),pasteCells:l(Cl,x,g,Ll),makeCellsHeader:l(bl,x,g,Bl),unmakeCellsHeader:l(yl,x,g,Bl),makeColumnsHeader:l(gl,x,g,Bl),unmakeColumnsHeader:l(hl,x,g,Bl),makeRowsHeader:l(pl,x,g,Bl),makeRowsBody:l(fl,x,g,Bl),makeRowsFooter:l(vl,x,g,Bl),getTableRowType:Dl,getTableCellType:Ol,getTableColType:Tl}},Pl=(e,t,o)=>{const n=zt(e,t,1);1===o||n<=1?we(e,t):fe(e,t,Math.min(o,n))},Fl=(e,t)=>o=>{const n=o.column+o.colspan-1,r=o.column;return n>=e&&r{const o=sn.fromTable(e);return Ua(o,t).map((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=((e,t,o)=>{if(sn.hasColumns(e)){const n=N(sn.justColumns(e),Fl(t,o)),r=D(n,(e=>{const n=Xe(e.element);return Pl(n,"span",o-t),n})),s=Se.fromTag("colgroup");return We(s,r),[s]}return[]})(o,n,r),a=((e,t,o)=>D(e.all,(e=>{const n=N(e.cells,Fl(t,o)),r=D(n,(e=>{const n=Xe(e.element);return Pl(n,"colspan",o-t),n})),s=Se.fromTag("tr");return We(s,r),s})))(o,n,r);return[...s,...a]}))},Vl=(e,t,o)=>{const n=sn.fromTable(e);return Za(n,t).bind((e=>{const t=Ha(n,o,!1),r=Xo(t).rows.slice(e[0].row,e[e.length-1].row+e[e.length-1].rowspan),s=P(r,(e=>{const t=N(e.cells,(e=>!e.isLocked));return t.length>0?[{...e,cells:t}]:[]})),a=Ia(s);return _t(a.length>0,a)})).map((e=>(e=>D(e,(e=>{const t=Ye(e.element);return A(e.cells,(e=>{const o=Xe(e.element);Aa(o,"colspan",e.colspan,1),Aa(o,"rowspan",e.rowspan,1),Ze(t,o)})),t})))(e)))},Zl=vi([{invalid:["raw"]},{pixels:["value"]},{percent:["value"]}]),Ul=(e,t,o)=>{const n=o.substring(0,o.length-e.length),r=parseFloat(n);return n===r.toString()?t(r):Zl.invalid(o)},jl={...Zl,from:e=>Dt(e,"%")?Ul("%",Zl.percent,e):Dt(e,"px")?Ul("px",Zl.pixels,e):Zl.invalid(e)},Wl=(e,t,o)=>e.fold((()=>t),(e=>((e,t,o)=>{const n=o/t;return D(e,(e=>jl.from(e).fold((()=>e),(e=>e*n+"px"),(e=>e/100*o+"px"))))})(t,o,e)),(e=>((e,t)=>D(e,(e=>jl.from(e).fold((()=>e),(e=>e/t*100+"%"),(e=>e+"%")))))(t,o))),$l=(e,t,o)=>{const n=jl.from(o),r=F(e,(e=>"0px"===e))?((e,t)=>{const o=e.fold((()=>h("")),(e=>h(e/t+"px")),(()=>h(100/t+"%")));return O(t,o)})(n,e.length):Wl(n,e,t);return Kl(r)},ql=(e,t)=>0===e.length?t:R(e,((e,t)=>jl.from(t).fold(h(0),p,p)+e),0),Gl=(e,t)=>jl.from(e).fold(h(e),(e=>e+t+"px"),(e=>e+t+"%")),Kl=e=>{if(0===e.length)return e;const t=R(e,((e,t)=>{const o=jl.from(t).fold((()=>({value:t,remainder:0})),(e=>((e,t)=>{const o=Math.floor(e);return{value:o+t,remainder:e-o}})(e,"px")),(e=>({value:e+"%",remainder:0})));return{output:[o.value].concat(e.output),remainder:e.remainder+o.remainder}}),{output:[],remainder:0}),o=t.output;return o.slice(0,o.length-1).concat([Gl(o[o.length-1],Math.round(t.remainder))])},Yl=jl.from,Xl=e=>Yl(e).fold(h("px"),h("px"),h("%")),Jl=(e,t,o)=>{const n=sn.fromTable(e),r=n.all,s=sn.justCells(n),a=sn.justColumns(n);t.each((t=>{const o=Xl(t),r=zo(e),i=((e,t)=>sr(e,t,or,ar))(n,e),l=$l(i,r,t);sn.hasColumns(n)?((e,t,o)=>{A(t,((t,n)=>{const r=ql([e[n]],Wt());Bt(t.element,"width",r+o)}))})(l,a,o):((e,t,o)=>{A(t,(t=>{const n=e.slice(t.column,t.colspan+t.column),r=ql(n,Wt());Bt(t.element,"width",r+o)}))})(l,s,o),Bt(e,"width",t)})),o.each((t=>{const o=Xl(t),a=hn(e),i=((e,t,o)=>lr(e,t,o,nr,ar))(n,e,Nn);((e,t,o,n)=>{A(o,(t=>{const o=e.slice(t.row,t.rowspan+t.row),r=ql(o,$t());Bt(t.element,"height",r+n)})),A(t,((t,o)=>{Bt(t.element,"height",e[o])}))})($l(i,a,t),r,s,o),Bt(e,"height",t)}))},Ql=e=>Gn(e).exists((e=>Pn.test(e))),ec=e=>Gn(e).exists((e=>Fn.test(e))),tc=e=>Gn(e).isNone(),oc=e=>{we(e,"width")},nc=e=>{const t=Qn(e);Jl(e,C.some(t),C.none()),oc(e)},rc=e=>{const t=(e=>zo(e)+"px")(e);Jl(e,C.some(t),C.none()),oc(e)},sc=e=>{Ft(e,"width");const t=Xt(e),o=t.length>0?t:Yt(e);A(o,(e=>{Ft(e,"width"),oc(e)})),oc(e)},ac={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},ic=e=>{const t=Se.fromTag("colgroup");return O(e,(()=>Ze(t,Se.fromTag("col")))),t},lc=(e,t,o,n)=>O(e,(e=>((e,t,o,n)=>{const r=Se.fromTag("tr");for(let s=0;s{e.selection.select(t.dom,!0),e.selection.collapse(!0)},dc=(e,t,o,n,s)=>{const a=Qr(e),i={styles:a,attributes:Jr(e),colGroups:es(e)};return e.undoManager.ignore((()=>{const r=((e,t,o,n,r,s=ac)=>{const a=Se.fromTag("table"),i="cells"!==r;Lt(a,s.styles),ve(a,s.attributes),s.colGroups&&Ze(a,ic(t));const l=Math.min(e,o);if(i&&o>0){const e=Se.fromTag("thead");Ze(a,e);const s=lc(o,t,"sectionCells"===r?l:0,n);We(e,s)}const c=Se.fromTag("tbody");Ze(a,c);const d=lc(i?e-l:e,t,i?0:o,n);return We(c,d),a})(o,t,s,n,Vr(e),i);fe(r,"data-mce-id","__mce");const a=(e=>{const t=Se.fromTag("div"),o=Se.fromDom(e.dom.cloneNode(!0));return Ze(t,o),(e=>e.dom.innerHTML)(t)})(r);e.insertContent(a),e.addVisual()})),xt(rs(e),'table[data-mce-id="__mce"]').map((t=>(qr(e)?rc(t):Gr(e)?sc(t):($r(e)||(e=>r(e)&&-1!==e.indexOf("%"))(a.width))&&nc(t),as(t),we(t,"data-mce-id"),((e,t)=>{A(pt(t,"tr"),(t=>{Al(e,t.dom),A(pt(t,"th,td"),(t=>{Ml(e,t.dom)}))}))})(e,t),((e,t)=>{xt(t,"td,th").each(v(cc,e))})(e,t),t.dom))).getOrNull()};var mc=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const uc="x-tinymce/dom-table-",gc=uc+"rows",hc=uc+"columns",pc=e=>{const t=mc.FakeClipboardItem(e);mc.write([t])},fc=e=>{var t;const o=null!==(t=mc.read())&&void 0!==t?t:[];return j(o,(t=>C.from(t.getType(e))))},vc=e=>{fc(e).isSome()&&mc.clear()},bc=e=>{e.fold(wc,(e=>pc({[gc]:e})))},yc=()=>fc(gc),wc=()=>vc(gc),xc=e=>{e.fold(Sc,(e=>pc({[hc]:e})))},Cc=()=>fc(hc),Sc=()=>vc(hc),kc=e=>Ys(is(e),ss(e)).filter(ds),_c=(e,t)=>{const o=ss(e),n=e=>Jt(e,o),a=t=>(e=>Xs(is(e),ss(e)).filter(ds))(e).bind((e=>n(e).map((o=>t(o,e))))),i=t=>{e.focus()},l=(t,o=!1)=>a(((n,r)=>{const s=Gs(Js(e),n,r);t(n,s,o).each(i)})),c=()=>a(((t,o)=>{const n=Gs(Js(e),t,o),r=Lr(g,Se.fromDom(e.getDoc()),C.none());return Vl(t,n,r)})),d=()=>a(((t,o)=>{const n=Gs(Js(e),t,o);return zl(t,n)})),m=(t,o)=>o().each((o=>{const n=D(o,(e=>Xe(e)));a(((o,r)=>{const s=Hr(Se.fromDom(e.getDoc())),a=((e,t,o,n)=>({selection:Hs(e),clipboard:o,generators:n}))(Js(e),0,n,s);t(o,a).each(i)}))})),h=e=>(t,o)=>((e,t)=>Q(e,t)?C.from(e[t]):C.none())(o,"type").each((t=>{l(e(t),o.no_events)}));q({mceTableSplitCells:()=>l(t.unmergeCells),mceTableMergeCells:()=>l(t.mergeCells),mceTableInsertRowBefore:()=>l(t.insertRowsBefore),mceTableInsertRowAfter:()=>l(t.insertRowsAfter),mceTableInsertColBefore:()=>l(t.insertColumnsBefore),mceTableInsertColAfter:()=>l(t.insertColumnsAfter),mceTableDeleteCol:()=>l(t.deleteColumn),mceTableDeleteRow:()=>l(t.deleteRow),mceTableCutCol:()=>d().each((e=>{xc(e),l(t.deleteColumn)})),mceTableCutRow:()=>c().each((e=>{bc(e),l(t.deleteRow)})),mceTableCopyCol:()=>d().each((e=>xc(e))),mceTableCopyRow:()=>c().each((e=>bc(e))),mceTablePasteColBefore:()=>m(t.pasteColsBefore,Cc),mceTablePasteColAfter:()=>m(t.pasteColsAfter,Cc),mceTablePasteRowBefore:()=>m(t.pasteRowsBefore,yc),mceTablePasteRowAfter:()=>m(t.pasteRowsAfter,yc),mceTableDelete:()=>kc(e).each((t=>{Jt(t,o).filter(b(o)).each((t=>{const o=Se.fromText("");if(ze(t,o),qe(t),e.dom.isEmpty(e.getBody()))e.setContent(""),e.selection.setCursorLocation();else{const t=e.dom.createRng();t.setStart(o.dom,0),t.setEnd(o.dom,0),e.selection.setRng(t),e.nodeChanged()}}))})),mceTableCellToggleClass:(t,o)=>{a((t=>{const n=Js(e),r=F(n,(t=>e.formatter.match("tablecellclass",{value:o},t.dom))),s=r?e.formatter.remove:e.formatter.apply;A(n,(e=>s("tablecellclass",{value:o},e.dom))),Nl(e,t.dom,Rl)}))},mceTableToggleClass:(t,o)=>{a((t=>{e.formatter.toggle("tableclass",{value:o},t.dom),Nl(e,t.dom,Rl)}))},mceTableToggleCaption:()=>{kc(e).each((t=>{Jt(t,o).each((o=>{wt(o,"caption").fold((()=>{const t=Se.fromTag("caption");Ze(t,Se.fromText("Caption")),((e,t,o)=>{Pe(e,o).fold((()=>{Ze(e,t)}),(e=>{Fe(e,t)}))})(o,t,0),e.selection.setCursorLocation(t.dom,0)}),(n=>{he("caption")(t)&&Ee("td",o).each((t=>e.selection.setCursorLocation(t.dom,0))),qe(n)})),Nl(e,o.dom,Bl)}))}))},mceTableSizingMode:(t,n)=>(t=>kc(e).each((n=>{Gr(e)||qr(e)||$r(e)||Jt(n,o).each((o=>{"relative"!==t||Ql(o)?"fixed"!==t||ec(o)?"responsive"!==t||tc(o)||sc(o):rc(o):nc(o),as(o),Nl(e,o.dom,Bl)}))})))(n),mceTableCellType:h((e=>"th"===e?t.makeCellsHeader:t.unmakeCellsHeader)),mceTableColType:h((e=>"th"===e?t.makeColumnsHeader:t.unmakeColumnsHeader)),mceTableRowType:h((e=>{switch(e){case"header":return t.makeRowsHeader;case"footer":return t.makeRowsFooter;default:return t.makeRowsBody}}))},((t,o)=>e.addCommand(o,t))),e.addCommand("mceInsertTable",((t,o)=>{((e,t,o,n={})=>{const r=e=>u(e)&&e>0;if(r(t)&&r(o)){const r=n.headerRows||0,s=n.headerColumns||0;return dc(e,o,t,s,r)}console.error("Invalid values for mceInsertTable - rows and columns values are required to insert a table.")})(e,o.rows,o.columns,o.options)})),e.addCommand("mceTableApplyCellStyle",((t,o)=>{const a=e=>"tablecell"+e.toLowerCase().replace("-","");if(!s(o))return;const i=N(Js(e),ds);if(0===i.length)return;const l=Y(o,((t,o)=>e.formatter.has(a(o))&&r(t)));(e=>{for(const t in e)if($.call(e,t))return!1;return!0})(l)||(q(l,((t,o)=>{const n=a(o);A(i,(o=>{""===t?e.formatter.remove(n,{value:null},o.dom,!0):e.formatter.apply(n,{value:t},o.dom)}))})),n(i[0]).each((t=>Nl(e,t.dom,Rl))))}))},Ec=vi([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Tc={before:Ec.before,on:Ec.on,after:Ec.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(p,p,p)},Oc=(e,t)=>({selection:e,kill:t}),Dc=(e,t)=>{const o=e.document.createRange();return o.selectNode(t.dom),o},Ac=(e,t)=>{const o=e.document.createRange();return Mc(o,t),o},Mc=(e,t)=>e.selectNodeContents(t.dom),Nc=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.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},Rc=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},Bc=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),Lc=vi([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Hc=(e,t,o)=>t(Se.fromDom(o.startContainer),o.startOffset,Se.fromDom(o.endContainer),o.endOffset),Ic=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:h(e),rtl:C.none}),relative:(t,o)=>({ltr:ro((()=>Nc(e,t,o))),rtl:ro((()=>C.some(Nc(e,o,t))))}),exact:(t,o,n,r)=>({ltr:ro((()=>Rc(e,t,o,n,r))),rtl:ro((()=>C.some(Rc(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();if(o.collapsed)return t.rtl().filter((e=>!1===e.collapsed)).map((e=>Lc.rtl(Se.fromDom(e.endContainer),e.endOffset,Se.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Hc(0,Lc.ltr,o)));return Hc(0,Lc.ltr,o)})(0,o)},Pc=(e,t)=>Ic(e,t).match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}});Lc.ltr,Lc.rtl;const Fc=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),zc=(e,t,o,n)=>({start:Tc.on(e,t),finish:Tc.on(o,n)}),Vc=(e,t)=>{const o=Pc(e,t);return Fc(Se.fromDom(o.startContainer),o.startOffset,Se.fromDom(o.endContainer),o.endOffset)},Zc=zc,Uc=(e,t,o,n,r)=>Te(o,n)?C.none():As(o,n,t).bind((t=>{const n=t.boxes.getOr([]);return n.length>1?(r(e,n,t.start,t.finish),C.some(Oc(C.some(Zc(o,0,o,Cr(o))),!0))):C.none()})),jc=(e,t)=>({item:e,mode:t}),Wc=(e,t,o,n=$c)=>e.property().parent(t).map((e=>jc(e,n))),$c=(e,t,o,n=qc)=>o.sibling(e,t).map((e=>jc(e,n))),qc=(e,t,o,n=qc)=>{const r=e.property().children(t);return o.first(r).map((e=>jc(e,n)))},Gc=[{current:Wc,next:$c,fallback:C.none()},{current:$c,next:qc,fallback:C.some(Wc)},{current:qc,next:qc,fallback:C.some($c)}],Kc=(e,t,o,n,r=Gc)=>L(r,(e=>e.current===o)).bind((o=>o.current(e,t,n,o.next).orThunk((()=>o.fallback.bind((o=>Kc(e,t,o,n))))))),Yc=()=>({sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?C.some(e[e.length-1]):C.none()}),Xc=()=>({sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?C.some(e[0]):C.none()}),Jc=(e,t,o,n,r,s)=>Kc(e,t,n,r).bind((t=>s(t.item)?C.none():o(t.item)?C.some(t.item):Jc(e,t.item,o,t.mode,r,s))),Qc=e=>t=>0===e.property().children(t).length,ed=(e,t,o,n)=>Jc(e,t,o,$c,Yc(),n),td=(e,t,o,n)=>Jc(e,t,o,$c,Xc(),n),od=Cs(),nd=(e,t)=>((e,t,o)=>ed(e,t,Qc(e),o))(od,e,t),rd=(e,t)=>((e,t,o)=>td(e,t,Qc(e),o))(od,e,t),sd=vi([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),ad=e=>Ct(e,"tr"),id={...sd,verify:(e,t,o,n,r,s,a)=>Ct(n,"td,th",a).bind((o=>Ct(t,"td,th",a).map((t=>Te(o,t)?Te(n,o)&&Cr(o)===r?s(t):sd.none("in same cell"):Os(ad,[o,t]).fold((()=>((e,t,o)=>{const n=e.getRect(t),r=e.getRect(o);return r.right>n.left&&r.lefts(t))))))).getOr(sd.none("default")),cata:(e,t,o,n,r)=>e.fold(t,o,n,r)},ld=(e,t)=>H(e,v(Te,t)),cd=he("br"),dd=(e,t,o)=>t(e,o).bind((e=>me(e)&&0===yr(e).trim().length?dd(e,t,o):C.some(e))),md=(e,t,o,n)=>((e,t)=>Pe(e,t).filter(cd).orThunk((()=>Pe(e,t-1).filter(cd))))(t,o).bind((t=>n.traverse(t).fold((()=>dd(t,n.gather,e).map(n.relative)),(e=>(e=>Ne(e).bind((t=>{const o=Ie(t);return ld(o,e).map((n=>((e,t,o,n)=>({parent:e,children:t,element:o,index:n}))(t,o,e,n)))})))(e).map((e=>Tc.on(e.parent,e.index))))))),ud=(e,t,o,n)=>{const r=cd(t)?((e,t,o)=>o.traverse(t).orThunk((()=>dd(t,o.gather,e))).map(o.relative))(e,t,n):md(e,t,o,n);return r.map((e=>({start:e,finish:e})))},gd=(e,t)=>({left:e.left,top:e.top+t,right:e.right,bottom:e.bottom+t}),hd=(e,t)=>({left:e.left,top:e.top-t,right:e.right,bottom:e.bottom-t}),pd=(e,t,o)=>({left:e.left+t,top:e.top+o,right:e.right+t,bottom:e.bottom+o}),fd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),vd=(e,t)=>C.some(e.getRect(t)),bd=(e,t,o)=>de(t)?vd(e,t).map(fd):me(t)?((e,t,o)=>o>=0&&o0?e.getRangedRect(t,o-1,t,o):C.none())(e,t,o).map(fd):C.none(),yd=(e,t)=>de(t)?vd(e,t).map(fd):me(t)?e.getRangedRect(t,0,t,Cr(t)).map(fd):C.none(),wd=vi([{none:[]},{retry:["caret"]}]),xd=(e,t,o)=>bt(t,Ii).fold(w,(t=>yd(e,t).exists((e=>((e,t)=>e.leftt.right)(o,e))))),Cd={point:e=>e.bottom,adjuster:(e,t,o,n,r)=>{const s=gd(r,5);return Math.abs(o.bottom-n.bottom)<1||o.top>r.bottom?wd.retry(s):o.top===r.bottom?wd.retry(gd(r,1)):xd(e,t,r)?wd.retry(pd(s,5,0)):wd.none()},move:gd,gather:rd},Sd=(e,t,o,n,r)=>0===r?C.some(n):((e,t,o)=>e.elementFromPoint(t,o).filter((e=>"table"===se(e))).isSome())(e,n.left,t.point(n))?((e,t,o,n,r)=>Sd(e,t,o,t.move(n,5),r))(e,t,o,n,r-1):e.situsFromPoint(n.left,t.point(n)).bind((s=>s.start.fold(C.none,(s=>yd(e,s).bind((a=>t.adjuster(e,s,a,o,n).fold(C.none,(n=>Sd(e,t,o,n,r-1))))).orThunk((()=>C.some(n)))),C.none))),kd=(e,t,o)=>{const n=e.move(o,5),r=Sd(t,e,o,n,100).getOr(n);return((e,t,o)=>e.point(t)>o.getInnerHeight()?C.some(e.point(t)-o.getInnerHeight()):e.point(t)<0?C.some(-e.point(t)):C.none())(e,r,t).fold((()=>t.situsFromPoint(r.left,e.point(r))),(o=>(t.scrollBy(0,o),t.situsFromPoint(r.left,e.point(r)-o))))},_d={tryUp:v(kd,{point:e=>e.top,adjuster:(e,t,o,n,r)=>{const s=hd(r,5);return Math.abs(o.top-n.top)<1||o.bottome.getSelection().bind((n=>ud(t,n.finish,n.foffset,o).fold((()=>C.some(ea(n.finish,n.foffset))),(r=>{const s=e.fromSitus(r);return(e=>id.cata(e,(e=>C.none()),(()=>C.none()),(e=>C.some(ea(e,0))),(e=>C.some(ea(e,Cr(e))))))(id.verify(e,n.finish,n.foffset,s.finish,s.foffset,o.failure,t))})))),Td=(e,t,o,n,r,s)=>0===s?C.none():Ad(e,t,o,n,r).bind((a=>{const i=e.fromSitus(a),l=id.verify(e,o,n,i.finish,i.foffset,r.failure,t);return id.cata(l,(()=>C.none()),(()=>C.some(a)),(a=>Te(o,a)&&0===n?Od(e,o,n,hd,r):Td(e,t,a,0,r,s-1)),(a=>Te(o,a)&&n===Cr(a)?Od(e,o,n,gd,r):Td(e,t,a,Cr(a),r,s-1)))})),Od=(e,t,o,n,r)=>bd(e,t,o).bind((t=>Dd(e,r,n(t,_d.getJumpSize())))),Dd=(e,t,o)=>{const n=Bo().browser;return n.isChromium()||n.isSafari()||n.isFirefox()?t.retry(e,o):C.none()},Ad=(e,t,o,n,r)=>bd(e,o,n).bind((t=>Dd(e,r,t))),Md=(e,t)=>{return vt(e,(e=>Ne(e).exists((e=>Te(e,t)))),o).isSome();var o},Nd=(e,t,o,n,r)=>Ct(n,"td,th",t).bind((n=>Ct(n,"table",t).bind((s=>Md(r,s)?((e,t,o)=>Ed(e,t,o).bind((n=>Td(e,t,n.element,n.offset,o,20).map(e.fromSitus))))(e,t,o).bind((e=>Ct(e.finish,"td,th",t).map((t=>({start:n,finish:t,range:e}))))):C.none())))),Rd=(e,t,o,n,r,s)=>s(n,t).orThunk((()=>Nd(e,t,o,n,r).map((e=>{const t=e.range;return Oc(C.some(Zc(t.start,t.soffset,t.finish,t.foffset)),!0)})))),Bd=(e,t)=>Ct(e,"tr",t).bind((e=>Ct(e,"table",t).bind((o=>{const n=pt(o,"tr");return Te(e,n[0])?((e,t,o)=>ed(od,e,t,o))(o,(e=>Er(e).isSome()),t).map((e=>{const t=Cr(e);return Oc(C.some(Zc(e,t,e,t)),!0)})):C.none()})))),Ld=(e,t)=>Ct(e,"tr",t).bind((e=>Ct(e,"table",t).bind((o=>{const n=pt(o,"tr");return Te(e,n[n.length-1])?((e,t,o)=>td(od,e,t,o))(o,(e=>_r(e).isSome()),t).map((e=>Oc(C.some(Zc(e,0,e,0)),!0))):C.none()})))),Hd=(e,t,o,n,r,s,a)=>Nd(e,o,n,r,s).bind((e=>Uc(t,o,e.start,e.finish,a))),Id=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Pd=()=>{const e=(e=>{const t=Id(C.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(C.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(C.some(e))}}})(g);return{...e,on:t=>e.get().each(t)}},Fd=(e,t)=>Ct(e,"td,th",t),zd=e=>Re(e).exists(os),Vd={traverse:He,gather:rd,relative:Tc.before,retry:_d.tryDown,failure:id.failedDown},Zd={traverse:Le,gather:nd,relative:Tc.before,retry:_d.tryUp,failure:id.failedUp},Ud=e=>t=>t===e,jd=Ud(38),Wd=Ud(40),$d=e=>e>=37&&e<=40,qd={isBackward:Ud(37),isForward:Ud(39)},Gd={isBackward:Ud(39),isForward:Ud(37)},Kd=vi([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Yd={domRange:Kd.domRange,relative:Kd.relative,exact:Kd.exact,exactFromRange:e=>Kd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Se.fromDom(e.startContainer),relative:(e,t)=>Tc.getStart(e),exact:(e,t,o,n)=>e}))(e);return o=t,Se.fromDom(Me(o).dom.defaultView);var o},range:Fc},Xd=(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(n,t,o)).bind((t=>{if(null===t.offsetNode)return C.none();const o=e.dom.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),C.some(o)}))},Jd=(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(n,t,o))},Qd=document.caretPositionFromPoint?Xd:document.caretRangeFromPoint?Jd:C.none,em=(e,t)=>{const o=se(e);return"input"===o?Tc.after(e):E(["br","img"],o)?0===t?Tc.before(e):Tc.after(e):Tc.on(e,t)},tm=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Ae(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Te(e,o)&&t===n;return r.collapsed&&!s},om=e=>C.from(e.getSelection()),nm=(e,t)=>{om(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))},rm=(e,t,o,n,r)=>{const s=Rc(e,t,o,n,r);nm(e,s)},sm=(e,t)=>Ic(e,t).match({ltr:(t,o,n,r)=>{rm(e,t,o,n,r)},rtl:(t,o,n,r)=>{om(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,o,n.dom,r);else if(s.extend)try{((e,t,o,n,r,s)=>{t.collapse(o.dom,n),t.extend(r.dom,s)})(0,s,t,o,n,r)}catch(s){rm(e,n,r,t,o)}else rm(e,n,r,t,o)}))}}),am=(e,t,o,n,r)=>{const s=((e,t,o,n)=>{const r=em(e,t),s=em(o,n);return Yd.relative(r,s)})(t,o,n,r);sm(e,s)},im=(e,t,o)=>{const n=((e,t)=>{const o=e.fold(Tc.before,em,Tc.after),n=t.fold(Tc.before,em,Tc.after);return Yd.relative(o,n)})(t,o);sm(e,n)},lm=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return C.some(Fc(Se.fromDom(t.startContainer),t.startOffset,Se.fromDom(o.endContainer),o.endOffset))}return C.none()},cm=e=>{if(null===e.anchorNode||null===e.focusNode)return lm(e);{const t=Se.fromDom(e.anchorNode),o=Se.fromDom(e.focusNode);return tm(t,e.anchorOffset,o,e.focusOffset)?C.some(Fc(t,e.anchorOffset,o,e.focusOffset)):lm(e)}},dm=(e,t,o=!0)=>{const n=(o?Ac:Dc)(e,t);nm(e,n)},mm=e=>(e=>om(e).filter((e=>e.rangeCount>0)).bind(cm))(e).map((e=>Yd.exact(e.start,e.soffset,e.finish,e.foffset))),um=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?C.some(o).map(Bc):C.none()})(Pc(e,t)),gm=(e,t,o)=>((e,t,o)=>{const n=Se.fromDom(e.document);return Qd(n,t,o).map((e=>Fc(Se.fromDom(e.startContainer),e.startOffset,Se.fromDom(e.endContainer),e.endOffset)))})(e,t,o),hm=e=>({elementFromPoint:(t,o)=>Se.fromPoint(Se.fromDom(e.document),t,o),getRect:e=>e.dom.getBoundingClientRect(),getRangedRect:(t,o,n,r)=>{const s=Yd.exact(t,o,n,r);return um(e,s)},getSelection:()=>mm(e).map((t=>Vc(e,t))),fromSitus:t=>{const o=Yd.relative(t.start,t.finish);return Vc(e,o)},situsFromPoint:(t,o)=>gm(e,t,o).map((e=>zc(e.start,e.soffset,e.finish,e.foffset))),clearSelection:()=>{(e=>{om(e).each((e=>e.removeAllRanges()))})(e)},collapseSelection:(t=!1)=>{mm(e).each((o=>o.fold((e=>e.collapse(t)),((o,n)=>{const r=t?o:n;im(e,r,r)}),((o,n,r,s)=>{const a=t?o:r,i=t?n:s;am(e,a,i,a,i)}))))},setSelection:t=>{am(e,t.start,t.soffset,t.finish,t.foffset)},setRelativeSelection:(t,o)=>{im(e,t,o)},selectNode:t=>{dm(e,t,!1)},selectContents:t=>{dm(e,t)},getInnerHeight:()=>e.innerHeight,getScrollY:()=>(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return bn(o,n)})(Se.fromDom(e.document)).top,scrollBy:(t,o)=>{((e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollBy(e,t)})(t,o,Se.fromDom(e.document))}}),pm=(e,t)=>({rows:e,cols:t}),fm=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Pd(),s=r.clear,a=s=>{r.on((r=>{n.clearBeforeUpdate(t),Fd(s.target,o).each((a=>{As(r,a,o).each((o=>{const r=o.boxes.getOr([]);if(1===r.length){const o=r[0],a="false"===ns(o),i=St(ts(s.target),o,Te);a&&i&&(n.selectRange(t,r,o,o),e.selectContents(o))}else r.length>1&&(n.selectRange(t,r,o.start,o.finish),e.selectContents(a))}))}))}))};return{clearstate:s,mousedown:e=>{n.clear(t),Fd(e.target,o).filter(zd).each(r.set)},mouseover:e=>{a(e)},mouseup:e=>{a(e),s()}}})(hm(e),t,o,n);return{clearstate:r.clearstate,mousedown:r.mousedown,mouseover:r.mouseover,mouseup:r.mouseup}},vm=e=>bt(e,ce).exists(os),bm=(e,t)=>vm(e)||vm(t),ym=(e,t,o,n)=>{const r=hm(e),s=()=>(n.clear(t),C.none());return{keydown:(e,a,i,l,c,d)=>{const m=e.raw,u=m.which,g=!0===m.shiftKey,h=Ms(t,n.selectedSelector).fold((()=>($d(u)&&!g&&n.clearBeforeUpdate(t),$d(u)&&g&&!bm(a,l)?C.none:Wd(u)&&g?v(Hd,r,t,o,Vd,l,a,n.selectRange):jd(u)&&g?v(Hd,r,t,o,Zd,l,a,n.selectRange):Wd(u)?v(Rd,r,o,Vd,l,a,Ld):jd(u)?v(Rd,r,o,Zd,l,a,Bd):C.none)),(e=>{const o=o=>()=>{const s=j(o,(o=>((e,t,o,n,r)=>Rs(n,e,t,r.firstSelectedSelector,r.lastSelectedSelector).map((e=>(r.clearBeforeUpdate(o),r.selectRange(o,e.boxes,e.start,e.finish),e.boxes))))(o.rows,o.cols,t,e,n)));return s.fold((()=>Ns(t,n.firstSelectedSelector,n.lastSelectedSelector).map((e=>{const o=Wd(u)||d.isForward(u)?Tc.after:Tc.before;return r.setRelativeSelection(Tc.on(e.first,0),o(e.table)),n.clear(t),Oc(C.none(),!0)}))),(e=>C.some(Oc(C.none(),!0))))};return $d(u)&&g&&!bm(a,l)?C.none:Wd(u)&&g?o([pm(1,0)]):jd(u)&&g?o([pm(-1,0)]):d.isBackward(u)&&g?o([pm(0,-1),pm(-1,0)]):d.isForward(u)&&g?o([pm(0,1),pm(1,0)]):$d(u)&&!g?s:C.none}));return h()},keyup:(e,r,s,a,i)=>Ms(t,n.selectedSelector).fold((()=>{const l=e.raw,c=l.which;return!0===l.shiftKey&&$d(c)&&bm(r,a)?((e,t,o,n,r,s,a)=>Te(o,r)&&n===s?C.none():Ct(o,"td,th",t).bind((o=>Ct(r,"td,th",t).bind((n=>Uc(e,t,o,n,a))))))(t,o,r,s,a,i,n.selectRange):C.none()}),C.none)}},wm=(e,t)=>{const o=be(e,t);return void 0===o||""===o?[]:o.split(" ")},xm=e=>void 0!==e.dom.classList,Cm=(e,t)=>((e,t,o)=>{const n=wm(e,t).concat([o]);return fe(e,t,n.join(" ")),!0})(e,"class",t),Sm=(e,t)=>{xm(e)?e.dom.classList.add(t):Cm(e,t)},km=(e,t)=>xm(e)&&e.dom.classList.contains(t),_m=(e,t,o)=>{const n=t=>{we(t,e.selected),we(t,e.firstSelected),we(t,e.lastSelected)},r=t=>{fe(t,e.selected,"1")},s=e=>{a(e),o()},a=t=>{const o=pt(t,`${e.selectedSelector},${e.firstSelectedSelector},${e.lastSelectedSelector}`);A(o,n)};return{clearBeforeUpdate:a,clear:s,selectRange:(o,n,a,i)=>{s(o),A(n,r),fe(a,e.firstSelected,"1"),fe(i,e.lastSelected,"1"),t(n,a,i)},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}},Em=()=>({tag:"none"}),Tm=e=>({tag:"multiple",elements:e}),Om=e=>({tag:"single",element:e}),Dm=(e,t,o)=>{const n=sn.fromTable(e);return Za(n,t).map((e=>{const t=Ha(n,o,!1),{rows:r}=Xo(t),s=((e,t)=>{const o=e.slice(0,t[t.length-1].row+1),n=Ia(o);return P(n,(e=>{const o=e.cells.slice(0,t[t.length-1].column+1);return D(o,(e=>e.element))}))})(r,e),a=((e,t)=>{const o=e.slice(t[0].row+t[0].rowspan-1,e.length),n=Ia(o);return P(n,(e=>{const o=e.cells.slice(t[0].column+t[0].colspan-1,e.cells.length);return D(o,(e=>e.element))}))})(r,e);return{upOrLeftCells:s,downOrRightCells:a}}))},Am=e=>{const t=Se.fromDom((e=>{if(st()&&d(e.target)){const t=Se.fromDom(e.target);if(de(t)&&ct(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return Z(t)}}return C.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(s=n,a=o,(...e)=>s(a.apply(null,e)));var s,a;return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},Mm=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(Am(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:v(Nm,e,t,s,r)}},Nm=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Rm=x,Bm=(e,t,o)=>((e,t,o,n)=>Mm(e,t,o,n,!1))(e,t,Rm,o),Lm=Am,Hm=e=>!km(Se.fromDom(e.target),"ephox-snooker-resizer-bar"),Im=(e,t)=>{const o=((e,t,o)=>({get:()=>Bs(e(),o).fold((()=>t().fold(Em,Om)),Tm)}))((()=>Se.fromDom(e.getBody())),(()=>Xs(is(e),ss(e))),qs.selectedSelector),n=_m(qs,((t,o,n)=>{Jt(o).each((r=>{const s=zr(e),a=Lr(g,Se.fromDom(e.getDoc()),s),i=Js(e),l=Dm(r,{selection:i},a);((e,t,o,n,r)=>{e.dispatch("TableSelectionChange",{cells:t,start:o,finish:n,otherCells:r})})(e,t,o,n,l)}))}),(()=>(e=>{e.dispatch("TableSelectionClear")})(e)));e.on("init",(o=>{const r=e.getWin(),s=rs(e),a=ss(e),i=fm(r,s,a,n),l=ym(r,s,a,n),c=((e,t,o,n)=>{const r=hm(e);return(e,s)=>{n.clearBeforeUpdate(t),As(e,s,o).each((e=>{const o=e.boxes.getOr([]);n.selectRange(t,o,e.start,e.finish),r.selectContents(s),r.collapseSelection()}))}})(r,s,a,n);e.on("TableSelectorChange",(e=>c(e.start,e.finish)));const d=(t,o)=>{(e=>!0===e.raw.shiftKey)(t)&&(o.kill&&t.kill(),o.selection.each((t=>{const o=Yd.relative(t.start,t.finish),n=Pc(r,o);e.selection.setRng(n)})))},m=e=>0===e.button,u=(()=>{const e=Id(Se.fromDom(s)),t=Id(0);return{touchEnd:o=>{const n=Se.fromDom(o.target);if(he("td")(n)||he("th")(n)){const r=e.get(),s=t.get();Te(r,n)&&o.timeStamp-s<300&&(o.preventDefault(),c(n,n))}e.set(n),t.set(o.timeStamp)}}})();e.on("dragstart",(e=>{i.clearstate()})),e.on("mousedown",(e=>{m(e)&&Hm(e)&&i.mousedown(Lm(e))})),e.on("mouseover",(e=>{var t;void 0!==(t=e).buttons&&0==(1&t.buttons)||!Hm(e)||i.mouseover(Lm(e))})),e.on("mouseup",(e=>{m(e)&&Hm(e)&&i.mouseup(Lm(e))})),e.on("touchend",u.touchEnd),e.on("keyup",(t=>{const o=Lm(t);if(o.raw.shiftKey&&$d(o.raw.which)){const t=e.selection.getRng(),n=Se.fromDom(t.startContainer),r=Se.fromDom(t.endContainer);l.keyup(o,n,t.startOffset,r,t.endOffset).each((e=>{d(o,e)}))}})),e.on("keydown",(o=>{const n=Lm(o);t.hide();const r=e.selection.getRng(),s=Se.fromDom(r.startContainer),a=Se.fromDom(r.endContainer),i=mn(qd,Gd)(Se.fromDom(e.selection.getStart()));l.keydown(n,s,r.startOffset,a,r.endOffset,i).each((e=>{d(n,e)})),t.show()})),e.on("NodeChange",(()=>{const t=e.selection,o=Se.fromDom(t.getStart()),r=Se.fromDom(t.getEnd());Os(Jt,[o,r]).fold((()=>n.clear(s)),g)}))})),e.on("PreInit",(()=>{e.serializer.addTempAttr(qs.firstSelected),e.serializer.addTempAttr(qs.lastSelected)}));return{getSelectedCells:()=>((e,t,o,n)=>{switch(e.tag){case"none":return t();case"single":return n(e.element);case"multiple":return o(e.elements)}})(o.get(),h([]),(e=>D(e,(e=>e.dom))),(e=>[e.dom])),clearSelectedCells:e=>n.clear(Se.fromDom(e))}},Pm=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=N(t,(t=>t!==e))},trigger:(...o)=>{const n={};A(e,((e,t)=>{n[e]=o[t]})),A(t,(e=>{e(n)}))}}},Fm=e=>({registry:G(e,(e=>({bind:e.bind,unbind:e.unbind}))),trigger:G(e,(e=>e.trigger))}),zm=e=>e.slice(0).sort(),Vm=(e,t,o)=>{if(0===t.length)throw new Error("You must specify at least one required field.");return((e,t)=>{if(!a(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");A(t,(t=>{if(!r(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")}))})("required",t),(e=>{const t=zm(e);L(t,((e,o)=>o{throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+t.join(", ")+"].")}))})(t),n=>{const r=W(n);F(t,(e=>E(r,e)))||((e,t)=>{throw new Error("All required keys ("+zm(e).join(", ")+") were not specified. Specified keys were: "+zm(t).join(", ")+".")})(t,r),e(t,r);const s=N(t,(e=>!o.validate(n[e],e)));return s.length>0&&((e,t)=>{throw new Error("All values need to be of type: "+t+". Keys ("+zm(e).join(", ")+") were not.")})(s,o.label),n}},Zm=(e,t)=>{const o=N(t,(t=>!E(e,t)));o.length>0&&(e=>{throw new Error("Unsupported keys for object: "+zm(e).join(", "))})(o)},Um=e=>((e,t)=>Vm(e,t,{validate:m,label:"function"}))(Zm,e),jm=Um(["compare","extract","mutate","sink"]),Wm=Um(["element","start","stop","destroy"]),$m=Um(["forceDrop","drop","move","delayDrop"]),qm=()=>{let e=C.none();const t=Fm({move:Pm(["info"])});return{onEvent:(o,n)=>{n.extract(o).each((o=>{const r=((t,o)=>{const n=e.map((e=>t.compare(e,o)));return e=C.some(o),n})(n,o);r.each((e=>{t.trigger.move(e)}))}))},reset:()=>{e=C.none()},events:t.registry}},Gm=()=>{const e=(()=>{const e=Fm({move:Pm(["info"])});return{onEvent:g,reset:g,events:e.registry}})(),t=qm();let o=e;return{on:()=>{o.reset(),o=t},off:()=>{o.reset(),o=e},isOn:()=>o===t,onEvent:(e,t)=>{o.onEvent(e,t)},events:t.events}},Km=(e,t,o)=>{let n=!1;const r=Fm({start:Pm([]),stop:Pm([])}),s=Gm(),a=()=>{d.stop(),s.isOn()&&(s.off(),r.trigger.stop())},l=((e,t)=>{let o=null;const n=()=>{i(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}})(a,200);s.events.move.bind((o=>{t.mutate(e,o.info)}));const c=e=>(...t)=>{n&&e.apply(null,t)},d=t.sink($m({forceDrop:a,drop:c(a),move:c((e=>{l.cancel(),s.onEvent(e,t)})),delayDrop:c(l.throttle)}),o);return{element:d.element,go:e=>{d.start(e),s.on(),r.trigger.start()},on:()=>{n=!0},off:()=>{n=!1},isActive:()=>n,destroy:()=>{d.destroy()},events:r.registry}},Ym=e=>{const t=e.replace(/\./g,"-");return{resolve:e=>t+"-"+e}},Xm=Ym("ephox-dragster").resolve;var Jm=jm({compare:(e,t)=>bn(t.left-e.left,t.top-e.top),extract:e=>C.some(bn(e.x,e.y)),sink:(e,t)=>{const o=(e=>{const t={layerClass:Xm("blocker"),...e},o=Se.fromTag("div");return fe(o,"role","presentation"),Lt(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Sm(o,Xm("blocker")),Sm(o,t.layerClass),{element:h(o),destroy:()=>{qe(o)}}})(t),n=Bm(o.element(),"mousedown",e.forceDrop),r=Bm(o.element(),"mouseup",e.drop),s=Bm(o.element(),"mousemove",e.move),a=Bm(o.element(),"mouseout",e.delayDrop);return Wm({element:o.element,start:e=>{Ze(e,o.element())},stop:()=>{qe(o.element())},destroy:()=>{o.destroy(),r.unbind(),s.unbind(),a.unbind(),n.unbind()}})},mutate:(e,t)=>{e.mutate(t.left,t.top)}});const Qm=Ym("ephox-snooker").resolve,eu=()=>{const e=Fm({drag:Pm(["xDelta","yDelta","target"])});let t=C.none();const o=(()=>{const e=Fm({drag:Pm(["xDelta","yDelta"])});return{mutate:(t,o)=>{e.trigger.drag(t,o)},events:e.registry}})();o.events.drag.bind((o=>{t.each((t=>{e.trigger.drag(o.xDelta,o.yDelta,t)}))}));return{assign:e=>{t=C.some(e)},get:()=>t,mutate:o.mutate,events:e.registry}},tu=Qm("resizer-bar"),ou=Qm("resizer-rows"),nu=Qm("resizer-cols"),ru=e=>{const t=pt(e.parent(),"."+tu);A(t,qe)},su=(e,t,o)=>{const n=e.origin();A(t,(t=>{t.each((t=>{const r=o(n,t);Sm(r,tu),Ze(e.parent(),r)}))}))},au=(e,t,o,n)=>{su(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=Se.fromTag("div");return Lt(s,{position:"absolute",left:t-n/2+"px",top:o+"px",height:r+"px",width:n+"px"}),ve(s,{"data-column":e,role:"presentation"}),s})(t.col,t.x-e.left,o.top-e.top,7,n);return Sm(r,nu),r}))},iu=(e,t,o,n)=>{su(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=Se.fromTag("div");return Lt(s,{position:"absolute",left:t+"px",top:o-r/2+"px",height:r+"px",width:n+"px"}),ve(s,{"data-row":e,role:"presentation"}),s})(t.row,o.left-e.left,t.y-e.top,n,7);return Sm(r,ou),r}))},lu=(e,t,o,n,r)=>{const s=wn(o),a=t.isResizable,i=n.length>0?Nn.positions(n,o):[],l=i.length>0?((e,t)=>P(e.all,((e,o)=>t(e.element)?[o]:[])))(e,a):[],c=N(i,((e,t)=>T(l,(e=>t===e))));iu(t,c,s,Vo(o));const d=r.length>0?Bn.positions(r,o):[],m=d.length>0?((e,t)=>{const o=[];return O(e.grid.columns,(n=>{const r=sn.getColumnAt(e,n).map((e=>e.element));r.forall(t)&&o.push(n)})),N(o,(o=>{const n=sn.filterItems(e,(e=>e.column===o));return F(n,(e=>t(e.element)))}))})(e,a):[],u=N(d,((e,t)=>T(m,(e=>t===e))));au(t,u,s,pn(o))},cu=(e,t)=>{if(ru(e),e.isResizable(t)){const o=sn.fromTable(t),n=cn(o),r=an(o);lu(o,e,t,n,r)}},du=(e,t)=>{const o=pt(e.parent(),"."+tu);A(o,t)},mu=e=>{du(e,(e=>{Bt(e,"display","none")}))},uu=e=>{du(e,(e=>{Bt(e,"display","block")}))},gu=Qm("resizer-bar-dragging"),hu=e=>{const t=eu(),o=((e,t={})=>{var o;const n=null!==(o=t.mode)&&void 0!==o?o:Jm;return Km(e,n,t)})(t,{});let n=C.none();const r=(e,t)=>C.from(be(e,t));t.events.drag.bind((e=>{r(e.target,"data-row").each((t=>{const o=jt(e.target,"top");Bt(e.target,"top",o+e.yDelta+"px")})),r(e.target,"data-column").each((t=>{const o=jt(e.target,"left");Bt(e.target,"left",o+e.xDelta+"px")}))}));const s=(e,t)=>jt(e,t)-zt(e,"data-initial-"+t,0);o.events.stop.bind((()=>{t.get().each((t=>{n.each((o=>{r(t,"data-row").each((e=>{const n=s(t,"top");we(t,"data-initial-top"),d.trigger.adjustHeight(o,n,parseInt(e,10))})),r(t,"data-column").each((e=>{const n=s(t,"left");we(t,"data-initial-left"),d.trigger.adjustWidth(o,n,parseInt(e,10))})),cu(e,o)}))}))}));const a=(n,r)=>{d.trigger.startAdjust(),t.assign(n),fe(n,"data-initial-"+r,jt(n,r)),Sm(n,gu),Bt(n,"opacity","0.2"),o.go(e.parent())},i=Bm(e.parent(),"mousedown",(e=>{var t;t=e.target,km(t,ou)&&a(e.target,"top"),(e=>km(e,nu))(e.target)&&a(e.target,"left")})),l=t=>Te(t,e.view()),c=Bm(e.view(),"mouseover",(t=>{var r;(r=t.target,Ct(r,"table",l).filter(os)).fold((()=>{dt(t.target)&&ru(e)}),(t=>{o.isActive()&&(n=C.some(t),cu(e,t))}))})),d=Fm({adjustHeight:Pm(["table","delta","row"]),adjustWidth:Pm(["table","delta","column"]),startAdjust:Pm([])});return{destroy:()=>{i.unbind(),c.unbind(),o.destroy(),ru(e)},refresh:t=>{cu(e,t)},on:o.on,off:o.off,hideBars:v(mu,e),showBars:v(uu,e),events:d.registry}},pu=(e,t,o)=>{const n=Nn,r=Bn,s=hu(e),a=Fm({beforeResize:Pm(["table","type"]),afterResize:Pm(["table","type"]),startDrag:Pm([])});return s.events.adjustHeight.bind((e=>{const t=e.table;a.trigger.beforeResize(t,"row");const o=n.delta(e.delta,t);_i(t,o,e.row,n),a.trigger.afterResize(t,"row")})),s.events.startAdjust.bind((e=>{a.trigger.startDrag()})),s.events.adjustWidth.bind((e=>{const n=e.table;a.trigger.beforeResize(n,"col");const s=r.delta(e.delta,n),i=o(n);ki(n,s,e.column,t,i),a.trigger.afterResize(n,"col")})),{on:s.on,off:s.off,refreshBars:s.refresh,hideBars:s.hideBars,showBars:s.showBars,destroy:s.destroy,events:a.registry}},fu=(e,t)=>{const o=ue(e)?(e=>Se.fromDom(Me(e).dom.documentElement))(e):e;return{parent:h(o),view:h(e),origin:h(bn(0,0)),isResizable:t}},vu=(e,t,o)=>({parent:h(t),view:h(e),origin:h(bn(0,0)),isResizable:o}),bu=()=>{const e=Se.fromTag("div");return Lt(e,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Ze(mt(Se.fromDom(document)),e),e},yu=e=>d(e)&&"TABLE"===e.nodeName,wu="bar-",xu=e=>"false"!==be(e,"data-mce-resize"),Cu=e=>{const t=Pd(),o=Pd(),n=Pd();let r,s;const a=t=>Hl(e,t),i=()=>Ur(e)?ga():ua(),l=(t,o,n)=>{const l=Dt(o,"e");if(""===s&&nc(t),n!==r&&""!==s){Bt(t,"width",s);const o=i(),c=a(t),d=Ur(e)||l?(e=>ha(e).columns)(t)-1:0;ki(t,n-r,d,o,c)}else if((e=>/^(\d+(\.\d+)?)%$/.test(e))(s)){const e=parseFloat(s.replace("%",""));Bt(t,"width",n*e/r+"%")}(e=>/^(\d+(\.\d+)?)px$/.test(e))(s)&&(e=>{const t=sn.fromTable(e);sn.hasColumns(t)||A(Yt(e),(e=>{const t=Ht(e,"width");Bt(e,"width",t),we(e,"width")}))})(t)},c=()=>{o.on((e=>{e.destroy()})),n.on((t=>{((e,t)=>{e.inline&&qe(t.parent())})(e,t)}))};e.on("init",(()=>{const r=((e,t)=>e.inline?vu(Se.fromDom(e.getBody()),bu(),t):fu(Se.fromDom(e.getDoc()),t))(e,xu);if(n.set(r),(e=>{const t=e.options.get("object_resizing");return E(t.split(","),"table")})(e)&&Kr(e)){const n=i(),s=pu(r,n,a);s.on(),s.events.startDrag.bind((o=>{t.set(e.selection.getRng())})),s.events.beforeResize.bind((t=>{const o=t.table.dom;((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(e,o,ls(o),cs(o),wu+t.type)})),s.events.afterResize.bind((o=>{const n=o.table,r=n.dom;as(n),t.on((t=>{e.selection.setRng(t),e.focus()})),((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(e,r,ls(r),cs(r),wu+o.type),e.undoManager.add()})),o.set(s)}})),e.on("ObjectResizeStart",(t=>{const o=t.target;if(yu(o)){const n=Se.fromDom(o);A(e.dom.select(".mce-clonedresizable"),(t=>{e.dom.addClass(t,"mce-"+Zr(e)+"-columns")})),!ec(n)&&qr(e)?rc(n):!Ql(n)&&$r(e)&&nc(n),tc(n)&&Ot(t.origin,wu)&&nc(n),r=t.width,s=Gr(e)?"":((e,t)=>{const o=e.dom.getStyle(t,"width")||e.dom.getAttrib(t,"width");return C.from(o).filter(Mt)})(e,o).getOr("")}})),e.on("ObjectResized",(t=>{const o=t.target;if(yu(o)){const n=Se.fromDom(o),r=t.origin;Ot(r,"corner-")&&l(n,r,t.width),as(n),Nl(e,n.dom,Rl)}})),e.on("SwitchMode",(()=>{o.on((t=>{e.mode.isReadOnly()?t.hideBars():t.showBars()}))})),e.on("dragstart dragend",(e=>{o.on((t=>{"dragstart"===e.type?(t.hideBars(),t.off()):(t.on(),t.showBars())}))})),e.on("remove",(()=>{c()}));return{refresh:e=>{o.on((t=>t.refreshBars(Se.fromDom(e))))},hide:()=>{o.on((e=>e.hideBars()))},show:()=>{o.on((e=>e.showBars()))}}},Su=e=>{(e=>{const t=e.options.register;t("table_clone_elements",{processor:"string[]"}),t("table_use_colgroups",{processor:"boolean",default:!0}),t("table_header_type",{processor:e=>{const t=E(["section","cells","sectionCells","auto"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: section, cells, sectionCells or auto."}},default:"section"}),t("table_sizing_mode",{processor:"string",default:"auto"}),t("table_default_attributes",{processor:"object",default:{border:"1"}}),t("table_default_styles",{processor:"object",default:{"border-collapse":"collapse"}}),t("table_column_resizing",{processor:e=>{const t=E(["preservetable","resizetable"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be preservetable, or resizetable."}},default:"preservetable"}),t("table_resize_bars",{processor:"boolean",default:!0}),t("table_style_by_css",{processor:"boolean",default:!0}),t("table_merge_content_on_paste",{processor:"boolean",default:!0})})(e);const t=Cu(e),o=Im(e,t),n=Il(e,t,o);return _c(e,n),((e,t)=>{const o=ss(e),n=t=>Xs(is(e)).bind((n=>Jt(n,o).map((o=>{const r=Gs(Js(e),o,n);return t(o,r)})))).getOr("");q({mceTableRowType:()=>n(t.getTableRowType),mceTableCellType:()=>n(t.getTableCellType),mceTableColType:()=>n(t.getTableColType)},((t,o)=>e.addQueryValueHandler(o,t)))})(e,n),Qs(e,n),{getSelectedCells:o.getSelectedCells,clearSelectedCells:o.clearSelectedCells}},ku=e=>({table:Su(e)});e.add("dom",ku)}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=(r="allow_html_in_named_anchor",e=>e.options.get(r));var r;const s="a:not([href])",a=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),c=e=>{const n=e.dom;t(n).walk(e.selection.getRng(),(e=>{o.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&n.remove(e,!1)}))}))},d=e=>e.dom.getParent(e.selection.getStart(),s),m=(e,t)=>{const o=d(e);o?((e,t,o)=>{o.removeAttribute("name"),o.id=t,e.addVisual(),e.undoManager.add()})(e,t,o):((e,t)=>{e.undoManager.transact((()=>{n(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:t})):(c(e),e.formatter.remove("namedAnchor",void 0,void 0,!0),e.formatter.apply("namedAnchor",{value:t}),e.addVisual())}))})(e,t),e.focus()},u=e=>{const t=(e=>{const t=d(e);return t?i(t):""})(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:t=>{((e,t)=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)?(m(e,t),!0):(e.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1))(e,t.getData().id)&&t.close()}})},g=e=>(e=>a(e.attr("href"))&&!a(e.attr("id")||e.attr("name")))(e)&&!e.firstChild,h=e=>t=>{for(let o=0;ot=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}};e.add("anchor",(e=>{(e=>{(0,e.options.register)("allow_html_in_named_anchor",{processor:"boolean",default:!1})})(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("a",h("false")),e.serializer.addNodeFilter("a",h(null))}))})(e),(e=>{e.addCommand("mceAnchor",(()=>{u(e)}))})(e),(e=>{const t=()=>e.execCommand("mceAnchor");e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:t,onSetup:t=>{const o=e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind,n=p(e)(t);return()=>{o(),n()}}}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:t,onSetup:p(e)})})(e),e.on("PreInit",(()=>{(e=>{e.formatter.register("namedAnchor",{inline:"a",selector:s,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(e,t,o)=>l(e)})})(e)}))}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=(e,t)=>{const o=((e,t)=>e.dispatch("insertCustomChar",{chr:t}))(e,t).chr;e.execCommand("mceInsertContent",!1,o)},o=e=>t=>e===t,n=(r="array",e=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(e)===r);var r;const s=o(null),a=o(void 0),i=(e=>t=>typeof t===e)("function"),l=(c=!1,()=>c);var c;class d{constructor(e,t){this.tag=e,this.value=t}static some(e){return new d(!0,e)}static none(){return d.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?d.some(e(this.value)):d.none()}bind(e){return this.tag?e(this.value):d.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:d.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return(e=>null==e)(e)?d.none():d.some(e)}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()"}}d.singletonNone=new d(!1);const m=Array.prototype.push,u=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r((e,t,o)=>{for(let n=0,r=e.length;n(e=>{const t=[];for(let o=0,r=e.length;ot=>t.options.get(e),v=f("charmap"),b=f("charmap_append"),y=p.isArray,w="User Defined",x=e=>{return y(e)?(t=e,p.grep(t,(e=>y(e)&&2===e.length))):"function"==typeof e?e():[];var t},C=e=>{const t=((e,t)=>{const o=v(e);o&&(t=[{name:w,characters:x(o)}]);const n=b(e);if(n){const e=p.grep(t,(e=>e.name===w));return e.length?(e[0].characters=[...e[0].characters,...x(n)],t):t.concat({name:w,characters:x(n)})}return t})(e,[{name:"Currency",characters:[[36,"dollar sign"],[162,"cent sign"],[8364,"euro sign"],[163,"pound sign"],[165,"yen sign"],[164,"currency sign"],[8352,"euro-currency sign"],[8353,"colon sign"],[8354,"cruzeiro sign"],[8355,"french franc sign"],[8356,"lira sign"],[8357,"mill sign"],[8358,"naira sign"],[8359,"peseta sign"],[8360,"rupee sign"],[8361,"won sign"],[8362,"new sheqel sign"],[8363,"dong sign"],[8365,"kip sign"],[8366,"tugrik sign"],[8367,"drachma sign"],[8368,"german penny symbol"],[8369,"peso sign"],[8370,"guarani sign"],[8371,"austral sign"],[8372,"hryvnia sign"],[8373,"cedi sign"],[8374,"livre tournois sign"],[8375,"spesmilo sign"],[8376,"tenge sign"],[8377,"indian rupee sign"],[8378,"turkish lira sign"],[8379,"nordic mark sign"],[8380,"manat sign"],[8381,"ruble sign"],[20870,"yen character"],[20803,"yuan character"],[22291,"yuan character, in hong kong and taiwan"],[22278,"yen/yuan character variant one"]]},{name:"Text",characters:[[169,"copyright sign"],[174,"registered sign"],[8482,"trade mark sign"],[8240,"per mille sign"],[181,"micro sign"],[183,"middle dot"],[8226,"bullet"],[8230,"three dot leader"],[8242,"minutes / feet"],[8243,"seconds / inches"],[167,"section sign"],[182,"paragraph sign"],[223,"sharp s / ess-zed"]]},{name:"Quotations",characters:[[8249,"single left-pointing angle quotation mark"],[8250,"single right-pointing angle quotation mark"],[171,"left pointing guillemet"],[187,"right pointing guillemet"],[8216,"left single quotation mark"],[8217,"right single quotation mark"],[8220,"left double quotation mark"],[8221,"right double quotation mark"],[8218,"single low-9 quotation mark"],[8222,"double low-9 quotation mark"],[60,"less-than sign"],[62,"greater-than sign"],[8804,"less-than or equal to"],[8805,"greater-than or equal to"],[8211,"en dash"],[8212,"em dash"],[175,"macron"],[8254,"overline"],[164,"currency sign"],[166,"broken bar"],[168,"diaeresis"],[161,"inverted exclamation mark"],[191,"turned question mark"],[710,"circumflex accent"],[732,"small tilde"],[176,"degree sign"],[8722,"minus sign"],[177,"plus-minus sign"],[247,"division sign"],[8260,"fraction slash"],[215,"multiplication sign"],[185,"superscript one"],[178,"superscript two"],[179,"superscript three"],[188,"fraction one quarter"],[189,"fraction one half"],[190,"fraction three quarters"]]},{name:"Mathematical",characters:[[402,"function / florin"],[8747,"integral"],[8721,"n-ary sumation"],[8734,"infinity"],[8730,"square root"],[8764,"similar to"],[8773,"approximately equal to"],[8776,"almost equal to"],[8800,"not equal to"],[8801,"identical to"],[8712,"element of"],[8713,"not an element of"],[8715,"contains as member"],[8719,"n-ary product"],[8743,"logical and"],[8744,"logical or"],[172,"not sign"],[8745,"intersection"],[8746,"union"],[8706,"partial differential"],[8704,"for all"],[8707,"there exists"],[8709,"diameter"],[8711,"backward difference"],[8727,"asterisk operator"],[8733,"proportional to"],[8736,"angle"]]},{name:"Extended Latin",characters:[[192,"A - grave"],[193,"A - acute"],[194,"A - circumflex"],[195,"A - tilde"],[196,"A - diaeresis"],[197,"A - ring above"],[256,"A - macron"],[198,"ligature AE"],[199,"C - cedilla"],[200,"E - grave"],[201,"E - acute"],[202,"E - circumflex"],[203,"E - diaeresis"],[274,"E - macron"],[204,"I - grave"],[205,"I - acute"],[206,"I - circumflex"],[207,"I - diaeresis"],[298,"I - macron"],[208,"ETH"],[209,"N - tilde"],[210,"O - grave"],[211,"O - acute"],[212,"O - circumflex"],[213,"O - tilde"],[214,"O - diaeresis"],[216,"O - slash"],[332,"O - macron"],[338,"ligature OE"],[352,"S - caron"],[217,"U - grave"],[218,"U - acute"],[219,"U - circumflex"],[220,"U - diaeresis"],[362,"U - macron"],[221,"Y - acute"],[376,"Y - diaeresis"],[562,"Y - macron"],[222,"THORN"],[224,"a - grave"],[225,"a - acute"],[226,"a - circumflex"],[227,"a - tilde"],[228,"a - diaeresis"],[229,"a - ring above"],[257,"a - macron"],[230,"ligature ae"],[231,"c - cedilla"],[232,"e - grave"],[233,"e - acute"],[234,"e - circumflex"],[235,"e - diaeresis"],[275,"e - macron"],[236,"i - grave"],[237,"i - acute"],[238,"i - circumflex"],[239,"i - diaeresis"],[299,"i - macron"],[240,"eth"],[241,"n - tilde"],[242,"o - grave"],[243,"o - acute"],[244,"o - circumflex"],[245,"o - tilde"],[246,"o - diaeresis"],[248,"o slash"],[333,"o macron"],[339,"ligature oe"],[353,"s - caron"],[249,"u - grave"],[250,"u - acute"],[251,"u - circumflex"],[252,"u - diaeresis"],[363,"u - macron"],[253,"y - acute"],[254,"thorn"],[255,"y - diaeresis"],[563,"y - macron"],[913,"Alpha"],[914,"Beta"],[915,"Gamma"],[916,"Delta"],[917,"Epsilon"],[918,"Zeta"],[919,"Eta"],[920,"Theta"],[921,"Iota"],[922,"Kappa"],[923,"Lambda"],[924,"Mu"],[925,"Nu"],[926,"Xi"],[927,"Omicron"],[928,"Pi"],[929,"Rho"],[931,"Sigma"],[932,"Tau"],[933,"Upsilon"],[934,"Phi"],[935,"Chi"],[936,"Psi"],[937,"Omega"],[945,"alpha"],[946,"beta"],[947,"gamma"],[948,"delta"],[949,"epsilon"],[950,"zeta"],[951,"eta"],[952,"theta"],[953,"iota"],[954,"kappa"],[955,"lambda"],[956,"mu"],[957,"nu"],[958,"xi"],[959,"omicron"],[960,"pi"],[961,"rho"],[962,"final sigma"],[963,"sigma"],[964,"tau"],[965,"upsilon"],[966,"phi"],[967,"chi"],[968,"psi"],[969,"omega"]]},{name:"Symbols",characters:[[8501,"alef symbol"],[982,"pi symbol"],[8476,"real part symbol"],[978,"upsilon - hook symbol"],[8472,"Weierstrass p"],[8465,"imaginary part"]]},{name:"Arrows",characters:[[8592,"leftwards arrow"],[8593,"upwards arrow"],[8594,"rightwards arrow"],[8595,"downwards arrow"],[8596,"left right arrow"],[8629,"carriage return"],[8656,"leftwards double arrow"],[8657,"upwards double arrow"],[8658,"rightwards double arrow"],[8659,"downwards double arrow"],[8660,"left right double arrow"],[8756,"therefore"],[8834,"subset of"],[8835,"superset of"],[8836,"not a subset of"],[8838,"subset of or equal to"],[8839,"superset of or equal to"],[8853,"circled plus"],[8855,"circled times"],[8869,"perpendicular"],[8901,"dot operator"],[8968,"left ceiling"],[8969,"right ceiling"],[8970,"left floor"],[8971,"right floor"],[9001,"left-pointing angle bracket"],[9002,"right-pointing angle bracket"],[9674,"lozenge"],[9824,"black spade suit"],[9827,"black club suit"],[9829,"black heart suit"],[9830,"black diamond suit"],[8194,"en space"],[8195,"em space"],[8201,"thin space"],[8204,"zero width non-joiner"],[8205,"zero width joiner"],[8206,"left-to-right mark"],[8207,"right-to-left mark"]]}]);return t.length>1?[{name:"All",characters:h(t,(e=>e.characters))}].concat(t):t},S=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},k=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!a(n)||r+t.length<=n)},_=String.fromCodePoint,E=(e,t)=>{const o=[],n=t.toLowerCase();return((e,t)=>{for(let o=0,n=e.length;o{((e,t,o)=>!!k(_(e).toLowerCase(),o)||k(t.toLowerCase(),o)||k(t.toLowerCase().replace(/\s+/g,""),o))(e[0],e[1],n)&&o.push(e)})),u(o,(e=>({text:e[1],value:_(e[0]),icon:_(e[0])})))},T="pattern",O=(e,o)=>{const n=()=>[{label:"Search",type:"input",name:T},{type:"collection",name:"results"}],r=1===o.length?S(w):S("All"),a=((e,t)=>{let o=null;const n=()=>{s(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}})((e=>{const t=e.getData().pattern;((e,t)=>{g(o,(e=>e.name===r.get())).each((o=>{const n=E(o,t);e.setData({results:n})}))})(e,t)}),40),i={title:"Special Character",size:"normal",body:1===o.length?{type:"panel",items:n()}:{type:"tabpanel",tabs:u(o,(e=>({title:e.name,name:e.name,items:n()})))},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{pattern:"",results:E(o[0],"")},onAction:(o,n)=>{"results"===n.name&&(t(e,n.value),o.close())},onTabChange:(e,t)=>{r.set(t.newTabName),a.throttle(e)},onChange:(e,t)=>{t.name===T&&a.throttle(e)}};e.windowManager.open(i).focus(T)},D=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}};e.add("charmap",(e=>{(e=>{const t=e.options.register,o=e=>i(e)||n(e);t("charmap",{processor:o}),t("charmap_append",{processor:o})})(e);const o=C(e);return((e,t)=>{e.addCommand("mceShowCharmap",(()=>{O(e,t)}))})(e,o),(e=>{const t=()=>e.execCommand("mceShowCharmap");e.ui.registry.addButton("charmap",{icon:"insert-character",tooltip:"Special character",onAction:t,onSetup:D(e)}),e.ui.registry.addMenuItem("charmap",{icon:"insert-character",text:"Special character...",onAction:t,onSetup:D(e)})})(e),((e,t)=>{e.ui.registry.addAutocompleter("charmap",{trigger:":",columns:"auto",minChars:2,fetch:(e,o)=>new Promise(((o,n)=>{o(E(t,e))})),onAction:(t,o,n)=>{e.selection.setRng(o),e.insertContent(n),t.hide()}})})(e,o[0]),(e=>({getCharMap:()=>C(e),insertChar:o=>{t(e,o)}}))(e)}))}(),tinymce.util.Tools.resolve("tinymce.PluginManager").add("code",(e=>((e=>{e.addCommand("mceCodeEditor",(()=>{(e=>{const t=(e=>e.getContent({source_view:!0}))(e);e.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:t},onSubmit:t=>{((e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()})(e,t.getData().code),t.close()}})})(e)}))})(e),(e=>{const t=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:t}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:t})})(e),{}))),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>typeof t===e,o=(e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e)("string"),n=t("boolean"),r=e=>!(e=>null==e)(e),s=t("function"),a=t("number"),i=(l=!1,()=>l);var l;class c{constructor(e,t){this.tag=e,this.value=t}static some(e){return new c(!0,e)}static none(){return c.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?c.some(e(this.value)):c.none()}bind(e){return this.tag?e(this.value):c.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:c.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return r(e)?c.some(e):c.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()"}}c.singletonNone=new c(!1);const d=(e,t)=>{for(let o=0,n=e.length;o{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},u={fromHtml:(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 m(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return m(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return m(o)},fromDom:m,fromPoint:(e,t,o)=>c.from(e.dom.elementFromPoint(t,o)).map(m)},g=(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")}};"undefined"!=typeof window?window:Function("return this;")();const h=e=>t=>(e=>e.dom.nodeType)(t)===e,p=h(1),f=h(3),v=h(9),b=h(11),y=e=>((e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r{((e,t,r)=>{if(!(o(r)||n(r)||a(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},x=(e,t)=>{e.dom.removeAttribute(t)},C=s(Element.prototype.attachShadow)&&s(Node.prototype.getRootNode)?e=>u.fromDom(e.dom.getRootNode()):e=>{return v(e)?e:(t=e,u.fromDom(t.dom.ownerDocument));var t},S=e=>{const t=C(e);return b(o=t)&&r(o.dom.host)?c.some(t):c.none();var o},k=e=>u.fromDom(e.dom.host),_=e=>{const t=f(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return S(u.fromDom(t)).fold((()=>o.body.contains(t)),(n=_,r=k,e=>n(r(e))));var n,r},E=(e,t,o)=>((e,t,o)=>{let n=e.dom;const r=s(o)?o:i;for(;n.parentNode;){n=n.parentNode;const e=u.fromDom(n);if(t(e))return c.some(e);if(r(e))break}return c.none()})(e,(e=>g(e,t)),o),T=(e,t)=>(e=>void 0!==e.style&&s(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",O=e=>"rtl"===((e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||_(e)?n:T(o,t)})(e,"direction")?"rtl":"ltr",D=(e,t)=>((e,t)=>((e,t)=>{const o=[];for(let n=0,r=e.length;ng(e,t))),A=e=>(e=>c.from(e.dom.parentNode).map(u.fromDom))(e).filter(p),M=(N="li",e=>p(e)&&e.dom.nodeName.toLowerCase()===N);var N;const R=(e,t,o)=>{d(t,(t=>{const n=u.fromDom(t),r=M(n),s=((e,t)=>(t?E(e,"ol,ul"):c.some(e)).getOr(e))(n,r);A(s).each((t=>{e.setStyle(s.dom,"direction",null);if(O(t)===o?x(s,"dir"):w(s,"dir",o),O(s)!==o&&e.setStyle(s.dom,"direction",o),r){const t=D(s,"li[dir],li[style]");d(t,(t=>{x(t,"dir"),e.setStyle(t.dom,"direction",null)}))}}))}))},B=(e,t)=>{e.selection.isEditable()&&(R(e.dom,e.selection.getSelectedBlocks(),t),e.nodeChanged())},L=(e,t)=>o=>{const n=n=>{const r=u.fromDom(n.element);o.setActive(O(r)===t),o.setEnabled(e.selection.isEditable())};return e.on("NodeChange",n),o.setEnabled(e.selection.isEditable()),()=>e.off("NodeChange",n)};e.add("directionality",(e=>{(e=>{e.addCommand("mceDirectionLTR",(()=>{B(e,"ltr")})),e.addCommand("mceDirectionRTL",(()=>{B(e,"rtl")}))})(e),(e=>{e.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:()=>e.execCommand("mceDirectionLTR"),onSetup:L(e,"ltr")}),e.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:()=>e.execCommand("mceDirectionRTL"),onSetup:L(e,"rtl")})})(e)}))}(),function(){const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const o=e=>({isFullscreen:()=>null!==e.get()}),n=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,r=e=>t=>typeof t===e,s=e=>t=>e===t,a=n("string"),i=n("object"),l=n("array"),c=s(null),d=r("boolean"),m=s(void 0),u=e=>!(e=>null==e)(e),g=r("function"),h=r("number"),p=()=>{},f=e=>()=>e;function v(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const b=f(!1),y=f(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.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:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return u(e)?w.some(e):w.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()"}}w.singletonNone=new w(!1);const x=Array.prototype.push,C=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[];for(let n=0,r=e.length;n((e,t,o)=>{for(let n=0,r=e.length;n(e=>{const t=[];for(let o=0,n=e.length;o((e,t)=>t>=0&&t{const o=e(w.none()),n=()=>o.get().each(t);return{clear:()=>{n(),o.set(w.none())},isSet:()=>o.get().isSome(),get:()=>o.get(),set:e=>{n(),o.set(w.some(e))}}},D=()=>O((e=>e.unbind())),A=Object.keys,M="undefined"!=typeof window?window:Function("return this;")(),N=(e,t)=>((e,t)=>{let o=null!=t?t:M;for(let t=0;t{const o=((e,t)=>N(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},B=Object.getPrototypeOf,L=e=>{const t=N("ownerDocument.defaultView",e);return i(e)&&((e=>R("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(B(e).constructor.name))},H=e=>t=>(e=>e.dom.nodeType)(t)===e,I=H(1),P=H(3),F=H(9),z=H(11),V=(e,t,o)=>{((e,t,o)=>{if(!(a(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+"")})(e.dom,t,o)},Z=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},U=(e,t)=>{e.dom.removeAttribute(t)},j=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!m(n)||r+t.length<=n)},W=e=>void 0!==e.style&&g(e.style.getPropertyValue),$=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},q={fromHtml:(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 $(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return $(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return $(o)},fromDom:$,fromPoint:(e,t,o)=>w.from(e.dom.elementFromPoint(t,o)).map($)},G=(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")}},K=e=>q.fromDom(e.dom.ownerDocument),Y=e=>(e=>w.from(e.dom.parentNode).map(q.fromDom))(e).map(X).map((t=>k(t,(t=>{return o=t,!(e.dom===o.dom);var o})))).getOr([]),X=e=>C(e.dom.childNodes,q.fromDom),J=g(Element.prototype.attachShadow)&&g(Node.prototype.getRootNode),Q=f(J),ee=J?e=>q.fromDom(e.dom.getRootNode()):e=>F(e)?e:K(e),te=e=>{const t=ee(e);return z(o=t)&&u(o.dom.host)?w.some(t):w.none();var o},oe=e=>q.fromDom(e.dom.host),ne=e=>u(e.dom.shadowRoot),re=e=>{const t=P(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return te(q.fromDom(t)).fold((()=>o.body.contains(t)),(n=re,r=oe,e=>n(r(e))));var n,r},se=(e,t,o)=>{if(!a(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);W(e)&&e.style.setProperty(t,o)},ae=(e,t,o)=>{const n=e.dom;se(n,t,o)},ie=(e,t)=>{const o=e.dom;((e,t)=>{const o=A(e);for(let n=0,r=o.length;n{se(o,t,e)}))},le=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||re(e)?n:ce(o,t)},ce=(e,t)=>W(e)?e.style.getPropertyValue(t):"",de=e=>{const t=q.fromDom((e=>{if(Q()&&u(e.target)){const t=q.fromDom(e.target);if(I(t)&&ne(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return T(t)}}return w.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(s=n,a=o,(...e)=>s(a.apply(null,e)));var s,a;return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},me=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(de(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:v(ue,e,t,s,r)}},ue=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},ge=y,he=(e,t,o)=>((e,t,o,n)=>me(e,t,o,n,!1))(e,t,ge,o),pe=()=>fe(0,0),fe=(e,t)=>({major:e,minor:t}),ve={nu:fe,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?pe():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return fe(n(1),n(2))})(e,o)},unknown:pe},be=(e,t)=>((e,t)=>{for(let o=0;o{const o=t.brand.toLowerCase();return _(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:ve.nu(parseInt(t.version,10),0)})))})),ye=(e,t)=>{const o=String(t).toLowerCase();return _(e,(e=>e.search(o)))},we=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,xe=e=>t=>j(t,e),Ce=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>j(e,"edge/")&&j(e,"chrome")&&j(e,"safari")&&j(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,we],search:e=>j(e,"chrome")&&!j(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>j(e,"msie")||j(e,"trident")},{name:"Opera",versionRegexes:[we,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:xe("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:xe("firefox")},{name:"Safari",versionRegexes:[we,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(j(e,"safari")||j(e,"mobile/"))&&j(e,"applewebkit")}],Se=[{name:"Windows",search:xe("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>j(e,"iphone")||j(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:xe("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:xe("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:xe("linux"),versionRegexes:[]},{name:"Solaris",search:xe("sunos"),versionRegexes:[]},{name:"FreeBSD",search:xe("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:xe("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ke={browsers:f(Ce),oses:f(Se)},_e="Edge",Ee="Chromium",Te="Opera",Oe="Firefox",De="Safari",Ae=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(_e),isChromium:n(Ee),isIE:n("IE"),isOpera:n(Te),isFirefox:n(Oe),isSafari:n(De)}},Me={unknown:()=>Ae({current:void 0,version:ve.unknown()}),nu:Ae,edge:f(_e),chromium:f(Ee),ie:f("IE"),opera:f(Te),firefox:f(Oe),safari:f(De)},Ne="Windows",Re="Android",Be="Linux",Le="macOS",He="Solaris",Ie="FreeBSD",Pe="ChromeOS",Fe=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Ne),isiOS:n("iOS"),isAndroid:n(Re),isMacOS:n(Le),isLinux:n(Be),isSolaris:n(He),isFreeBSD:n(Ie),isChromeOS:n(Pe)}},ze={unknown:()=>Fe({current:void 0,version:ve.unknown()}),nu:Fe,windows:f(Ne),ios:f("iOS"),android:f(Re),linux:f(Be),macos:f(Le),solaris:f(He),freebsd:f(Ie),chromeos:f(Pe)},Ve=(e,t,o)=>{const n=ke.browsers(),r=ke.oses(),s=t.bind((e=>be(n,e))).orThunk((()=>((e,t)=>ye(e,t).map((e=>{const o=ve.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(Me.unknown,Me.nu),a=((e,t)=>ye(e,t).map((e=>{const o=ve.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(ze.unknown,ze.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:f(r),isiPhone:f(s),isTablet:f(l),isPhone:f(c),isTouch:f(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:f(d),isDesktop:f(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},Ze=e=>window.matchMedia(e).matches;let Ue=(e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)})((()=>Ve(navigator.userAgent,w.from(navigator.userAgentData),Ze)));const je=(e,t)=>({left:e,top:t,translate:(o,n)=>je(e+o,t+n)}),We=je,$e=e=>{const t=void 0===e?window:e;return Ue().browser.isFirefox()?w.none():w.from(t.visualViewport)},qe=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Ge=e=>{const t=void 0===e?window:e,o=t.document,n=(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return We(o,n)})(q.fromDom(o));return $e(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return qe(n.left,n.top,o,r)}),(e=>qe(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},Ke=(e,t,o)=>$e(o).map((o=>{const n=e=>t(de(e));return o.addEventListener(e,n),{unbind:()=>o.removeEventListener(e,n)}})).getOrThunk((()=>({unbind:p})));var Ye=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Xe=tinymce.util.Tools.resolve("tinymce.Env");const Je=(e,t)=>{e.dispatch("FullscreenStateChanged",{state:t}),e.dispatch("ResizeEditor")},Qe=(et="fullscreen_native",e=>e.options.get(et));var et;const tt=e=>{const t=q.fromDom(e.getElement());return te(t).map(oe).getOrThunk((()=>(e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return q.fromDom(t)})(K(t))))},ot=e=>{return e.dom===(void 0!==(t=K(e).dom).fullscreenElement?t.fullscreenElement:void 0!==t.msFullscreenElement?t.msFullscreenElement:void 0!==t.webkitFullscreenElement?t.webkitFullscreenElement:null);var t},nt=(e,t,o)=>k(((e,t)=>{const o=g(t)?t:b;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=q.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r})(e,o),t),rt=e=>((e,t)=>{const o=void 0===t?document:t.dom;return 1!==(n=o).nodeType&&9!==n.nodeType&&11!==n.nodeType||0===n.childElementCount?[]:C(o.querySelectorAll(e),q.fromDom);var n})(e),st=(e,t,o)=>nt(e,(e=>G(e,t)),o),at=(e,t)=>((e,t)=>k(Y(e),t))(e,(e=>G(e,t))),it="data-ephox-mobile-fullscreen-style",lt="position:absolute!important;",ct="top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;",dt=Xe.os.isAndroid(),mt=(e,t,o)=>{const n=t=>o=>{const n=Z(o,"style"),r=void 0===n?"no-styles":n.trim();r!==t&&(V(o,it,r),ie(o,e.parseStyle(t)))},r=st(t,"*"),s=E(r,(e=>at(e,"*:not(.tox-silver-sink)"))),a=(e=>{const t=le(e,"background-color");return void 0!==t&&""!==t?"background-color:"+t+"!important":"background-color:rgb(255,255,255)!important;"})(o);S(s,n("display:none!important;")),S(r,n(lt+ct+a));n((!0===dt?"":lt)+ct+a)(t)},ut=Ye.DOM,gt=$e().fold((()=>({bind:p,unbind:p})),(e=>{const t=(()=>{const e=O(p);return{...e,on:t=>e.get().each(t)}})(),o=D(),n=D(),r=((e,t)=>{let o=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{c(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}})((()=>{document.body.scrollTop=0,document.documentElement.scrollTop=0,window.requestAnimationFrame((()=>{t.on((t=>ie(t,{top:e.offsetTop+"px",left:e.offsetLeft+"px",height:e.height+"px",width:e.width+"px"})))}))}),50);return{bind:e=>{t.set(e),r.throttle(),o.set(Ke("resize",r.throttle)),n.set(Ke("scroll",r.throttle))},unbind:()=>{t.on((()=>{o.clear(),n.clear()})),t.clear()}}})),ht=(e,t)=>{const o=document.body,n=document.documentElement,r=e.getContainer(),s=q.fromDom(r),a=(i=s,w.from(i.dom.nextSibling).map(q.fromDom)).filter((e=>(e=>I(e)&&L(e.dom))(e)&&((e,t)=>(e=>void 0!==e.dom.classList)(e)&&e.dom.classList.contains(t))(e,"tox-silver-sink")));var i;const l=tt(e),c=t.get(),d=q.fromDom(e.getBody()),m=Xe.deviceType.isTouch(),u=r.style,g=e.iframeElement,h=null==g?void 0:g.style,p=e=>{e(o,"tox-fullscreen"),e(n,"tox-fullscreen"),e(r,"tox-fullscreen"),te(s).map((e=>oe(e).dom)).each((t=>{e(t,"tox-fullscreen"),e(t,"tox-shadowhost")}))},f=()=>{m&&(e=>{const t=rt("["+it+"]");S(t,(t=>{const o=Z(t,it);o&&"no-styles"!==o?ie(t,e.parseStyle(o)):U(t,"style"),U(t,it)}))})(e.dom),p(ut.removeClass),gt.unbind(),w.from(t.get()).each((e=>e.fullscreenChangeHandler.unbind()))};if(c)c.fullscreenChangeHandler.unbind(),Qe(e)&&ot(l)&&(e=>{const t=e.dom;t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.webkitCancelFullScreen&&t.webkitCancelFullScreen()})(K(l)),h.width=c.iframeWidth,h.height=c.iframeHeight,u.width=c.containerWidth,u.height=c.containerHeight,u.top=c.containerTop,u.left=c.containerLeft,b=a,y=c.sinkCssPosition,x=(e,t)=>{ae(e,"position",t)},b.isSome()&&y.isSome()?w.some(x(b.getOrDie(),y.getOrDie())):w.none(),f(),v=c.scrollPos,window.scrollTo(v.x,v.y),t.set(null),Je(e,!1),e.off("remove",f);else{const o=he(K(l),void 0!==document.fullscreenElement?"fullscreenchange":void 0!==document.msFullscreenElement?"MSFullscreenChange":void 0!==document.webkitFullscreenElement?"webkitfullscreenchange":"fullscreenchange",(o=>{Qe(e)&&(ot(l)||null===t.get()||ht(e,t))})),n={scrollPos:Ge(window),containerWidth:u.width,containerHeight:u.height,containerTop:u.top,containerLeft:u.left,iframeWidth:h.width,iframeHeight:h.height,fullscreenChangeHandler:o,sinkCssPosition:a.map((e=>le(e,"position")))};m&&mt(e.dom,s,d),h.width=h.height="100%",u.width=u.height="",p(ut.addClass),a.each((e=>{ae(e,"position","fixed")})),gt.bind(s),e.on("remove",f),t.set(n),Qe(e)&&(e=>{const t=e.dom;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.webkitRequestFullScreen&&t.webkitRequestFullScreen()})(l),Je(e,!0)}var v,b,y,x},pt=(e,t)=>o=>{o.setActive(null!==t.get());const n=e=>o.setActive(e.state);return e.on("FullscreenStateChanged",n),()=>e.off("FullscreenStateChanged",n)};t.add("fullscreen",(t=>{const n=e(null);return t.inline||((e=>{(0,e.options.register)("fullscreen_native",{processor:"boolean",default:!1})})(t),((e,t)=>{e.addCommand("mceFullScreen",(()=>{ht(e,t)}))})(t,n),((e,t)=>{const o=()=>e.execCommand("mceFullScreen");e.ui.registry.addToggleMenuItem("fullscreen",{text:"Fullscreen",icon:"fullscreen",shortcut:"Meta+Shift+F",onAction:o,onSetup:pt(e,t)}),e.ui.registry.addToggleButton("fullscreen",{tooltip:"Fullscreen",icon:"fullscreen",onAction:o,onSetup:pt(e,t)})})(t,n),t.addShortcut("Meta+Shift+F","","mceFullScreen")),o(n)}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,o=e=>t=>typeof t===e,n=t("string"),r=t("object"),s=t("array"),a=(i=null,e=>i===e);var i;const l=o("boolean"),c=e=>!(e=>null==e)(e),d=o("function"),m=(e,t)=>{if(s(e)){for(let o=0,n=e.length;o{},g=(e,t)=>e===t;class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.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:h.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?h.some(e):h.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()"}}h.singletonNone=new h(!1);const p=Array.prototype.indexOf,f=Array.prototype.push,v=(e,t)=>((e,t)=>p.call(e,t))(e,t)>-1,b=e=>{const t=[];for(let o=0,n=e.length;ob(((e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0;oe.exists((e=>o(e,t))),C=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te?h.some(t):h.none(),k=e=>t=>t.options.get(e),_=k("link_assume_external_targets"),E=k("link_context_toolbar"),T=k("link_list"),O=k("link_default_target"),D=k("link_default_protocol"),A=k("link_target_list"),M=k("link_rel_list"),N=k("link_class_list"),R=k("link_title"),B=k("allow_unsafe_link_target"),L=k("link_quicklink");var H=tinymce.util.Tools.resolve("tinymce.util.Tools");const I=e=>n(e.value)?e.value:"",P=(e,t)=>{const o=[];return H.each(e,(e=>{const r=(e=>n(e.text)?e.text:n(e.title)?e.title:"")(e);if(void 0!==e.menu){const n=P(e.menu,t);o.push({text:r,items:n})}else{const n=t(e);o.push({text:r,value:n})}})),o},F=(e=I)=>t=>h.from(t).map((t=>P(t,e))),z={sanitize:e=>F(I)(e),sanitizeWith:F,createUi:(e,t)=>o=>({name:e,type:"listbox",label:t,items:o}),getValue:I},V=Object.keys,Z=Object.hasOwnProperty,U=(e,t,o,n)=>{((e,t)=>{const o=V(e);for(let n=0,r=o.length;n{(t(e,r)?o:n)(e,r)}))},j=(e,t)=>Z.call(e,t);var W=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),$=tinymce.util.Tools.resolve("tinymce.util.URI");const q=e=>c(e)&&"a"===e.nodeName.toLowerCase(),G=e=>q(e)&&!!X(e),K=(e,t)=>{if(e.collapsed)return[];{const o=e.cloneContents(),n=o.firstChild,r=new W(n,o),s=[];let a=n;do{t(a)&&s.push(a)}while(a=r.next());return s}},Y=e=>/^\w+:/i.test(e),X=e=>{var t,o;return null!==(o=null!==(t=e.getAttribute("data-mce-href"))&&void 0!==t?t:e.getAttribute("href"))&&void 0!==o?o:""},J=(e,t)=>{const o=["noopener"],n=e?e.split(/\s+/):[],r=e=>e.filter((e=>-1===H.inArray(o,e))),s=t?(e=>(e=r(e)).length>0?e.concat(o):o)(n):r(n);return s.length>0?(e=>H.trim(e.sort().join(" ")))(s):""},Q=(e,t)=>(t=t||oe(e.selection.getRng())[0]||e.selection.getNode(),ae(t)?h.from(e.dom.select("a[href]",t)[0]):h.from(e.dom.getParent(t,"a[href]"))),ee=(e,t)=>Q(e,t).isSome(),te=(e,t)=>(e=>e.replace(/\uFEFF/g,""))(t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||""))),oe=e=>K(e,G),ne=e=>H.grep(e,G),re=e=>ne(e).length>0,se=e=>{const t=e.schema.getTextInlineElements(),o=e=>1===e.nodeType&&!q(e)&&!j(t,e.nodeName.toLowerCase());if(Q(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const n=e.selection.getRng();if(n.collapsed)return!0;return 0===K(n,o).length},ae=e=>c(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ie=(e,t)=>{const o={...t};if(0===M(e).length&&!B(e)){const e=J(o.rel,"_blank"===o.target);o.rel=e||null}return h.from(o.target).isNone()&&!1===A(e)&&(o.target=O(e)),o.href=((e,t)=>"http"!==t&&"https"!==t||Y(e)?e:t+"://"+e)(o.href,_(e)),o},le=(e,t,o)=>{const n=e.selection.getNode(),r=Q(e,n),s=ie(e,(e=>{return t=["title","rel","class","target"],o=(t,o)=>(e[o].each((e=>{t[o]=e.length>0?e:null})),t),n={href:e.href},((e,t)=>{for(let o=0,n=e.length;o{n=o(n,e,t)})),n;var t,o,n})(o));e.undoManager.transact((()=>{o.href===t.href&&t.attach(),r.fold((()=>{((e,t,o,n)=>{const r=e.dom;ae(t)?ge(r,t,n):o.fold((()=>{e.execCommand("mceInsertLink",!1,n)}),(t=>{e.insertContent(r.createHTML("a",n,r.encode(t)))}))})(e,n,o.text,s)}),(t=>{e.focus(),((e,t,o,n)=>{o.each((e=>{j(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,n),e.selection.select(t)})(e,t,o.text,s)}))}))},ce=e=>{const{class:t,href:o,rel:n,target:r,text:s,title:i}=e;return((e,t)=>{const o={};var n;return U(e,t,(n=o,(e,t)=>{n[t]=e}),u),o})({class:t.getOrNull(),href:o,rel:n.getOrNull(),target:r.getOrNull(),text:s.getOrNull(),title:i.getOrNull()},((e,t)=>!1===a(e)))},de=(e,t,o)=>{const n=((e,t)=>{const o=e.options.get,n={allow_html_data_urls:o("allow_html_data_urls"),allow_script_urls:o("allow_script_urls"),allow_svg_data_urls:o("allow_svg_data_urls")},r=t.href;return{...t,href:$.isDomSafe(r,"a",n)?r:""}})(e,o);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,ce(n)):le(e,t,n)},me=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();ae(t)?ue(e,t):(e=>{const t=e.dom,o=e.selection,n=o.getBookmark(),r=o.getRng().cloneRange(),s=t.getParent(r.startContainer,"a[href]",e.getBody()),a=t.getParent(r.endContainer,"a[href]",e.getBody());s&&r.setStartBefore(s),a&&r.setEndAfter(a),o.setRng(r),e.execCommand("unlink"),o.moveToBookmark(n)})(e),e.focus()}))})(e)},ue=(e,t)=>{var o;const n=e.dom.select("img",t)[0];if(n){const r=e.dom.getParents(n,"a[href]",t)[0];r&&(null===(o=r.parentNode)||void 0===o||o.insertBefore(n,r),e.dom.remove(r))}},ge=(e,t,o)=>{var n;const r=e.select("img",t)[0];if(r){const t=e.create("a",o);null===(n=r.parentNode)||void 0===n||n.insertBefore(t,r),t.appendChild(r)}},he=e=>{return j(t=e,o="items")&&void 0!==t[o]&&null!==t[o];var t,o},pe=(e,t)=>w(t,(t=>he(t)?pe(e,t.items):S(t.value===e,t))),fe=(e,t,o,n)=>{const r=n[t],s=e.length>0;return void 0!==r?pe(r,o).map((t=>({url:{value:t.value,meta:{text:s?e:t.text,attach:u}},text:s?e:t.text}))):h.none()},ve=(e,t)=>{const o={text:e.text,title:e.title},n=e=>{const t=(n=e.url,S(o.text.length<=0,h.from(null===(r=n.meta)||void 0===r?void 0:r.text).getOr(n.value)));var n,r;const s=(e=>{var t;return S(o.title.length<=0,h.from(null===(t=e.meta)||void 0===t?void 0:t.title).getOr(""))})(e.url);return t.isSome()||s.isSome()?h.some({...t.map((e=>({text:e}))).getOr({}),...s.map((e=>({title:e}))).getOr({})}):h.none()},r=(e,n)=>{const r=(s=t,a=n,"link"===a?s.link:"anchor"===a?s.anchor:h.none()).getOr([]);var s,a;return fe(o.text,n,r,e)};return{onChange:(e,t)=>{const s=t.name;return"url"===s?n(e()):v(["anchor","link"],s)?r(e(),s):"text"===s||"title"===s?(o[s]=e()[s],h.none()):h.none()}}};var be=tinymce.util.Tools.resolve("tinymce.util.Delay");const ye=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?h.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):h.none()},we=(e,t)=>o=>{const n=o.href;return 1===e&&!Y(n)||0===e&&/^\s*www(\.|\d\.)/i.test(n)?h.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+n})}):h.none()},xe=(e,t)=>w([ye,we(_(e),D(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(o=>new Promise((n=>{((e,t,o)=>{const n=e.selection.getRng();be.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(n),o(t)}))}))})(e,o.message,(e=>{n(e?o.preprocess(t):t)}))})))),Ce=e=>{const t=e.dom.select("a:not([href])"),o=y(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]}));return o.length>0?h.some([{text:"None",value:""}].concat(o)):h.none()},Se=e=>{const t=N(e);return t.length>0?z.sanitize(t):h.none()},ke=e=>{try{return h.some(JSON.parse(e))}catch(e){return h.none()}},_e=e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),o=T(e);return new Promise((e=>{n(o)?fetch(o).then((e=>e.ok?e.text().then(ke):Promise.reject())).then(e,(()=>e(h.none()))):d(o)?o((t=>e(h.some(t)))):e(h.from(o))})).then((e=>e.bind(z.sanitizeWith(t)).map((e=>{if(e.length>0){return[{text:"None",value:""}].concat(e)}return e}))))},Ee=(e,t)=>{const o=M(e);if(o.length>0){const n=x(t,"_blank"),r=e=>J(z.getValue(e),n);return(!1===B(e)?z.sanitizeWith(r):z.sanitize)(o)}return h.none()},Te=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],Oe=e=>{const t=A(e);return s(t)?z.sanitize(t).orThunk((()=>h.some(Te))):!1===t?h.none():h.some(Te)},De=(e,t,o)=>{const n=e.getAttrib(t,o);return null!==n&&n.length>0?h.some(n):h.none()},Ae=(e,t)=>_e(e).then((o=>{const n=((e,t)=>{const o=e.dom,n=se(e)?h.some(te(e.selection,t)):h.none(),r=t.bind((e=>h.from(o.getAttrib(e,"href")))),s=t.bind((e=>h.from(o.getAttrib(e,"target")))),a=t.bind((e=>De(o,e,"rel"))),i=t.bind((e=>De(o,e,"class")));return{url:r,text:n,title:t.bind((e=>De(o,e,"title"))),target:s,rel:a,linkClass:i}})(e,t);return{anchor:n,catalogs:{targets:Oe(e),rels:Ee(e,n.target),classes:Se(e),anchor:Ce(e),link:o},optNode:t,flags:{titleEnabled:R(e)}}})),Me=e=>{const t=(e=>{const t=Q(e);return Ae(e,t)})(e);t.then((t=>{const o=((e,t)=>o=>{const n=o.getData();if(!n.url.value)return me(e),void o.close();const r=e=>h.from(n[e]).filter((o=>!x(t.anchor[e],o))),s={href:n.url.value,text:r("text"),target:r("target"),rel:r("rel"),class:r("linkClass"),title:r("title")},a={href:n.url.value,attach:void 0!==n.url.meta&&n.url.meta.attach?n.url.meta.attach:u};xe(e,s).then((t=>{de(e,a,t)})),o.close()})(e,t);return((e,t,o)=>{const n=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),r=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],s=((e,t)=>{const o=e.anchor,n=o.url.getOr("");return{url:{value:n,meta:{original:{value:n}}},text:o.text.getOr(""),title:o.title.getOr(""),anchor:n,link:n,rel:o.rel.getOr(""),target:o.target.or(t).getOr(""),linkClass:o.linkClass.getOr("")}})(e,h.from(O(o))),a=e.catalogs,i=ve(s,a);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:b([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],n,r,C([a.anchor.map(z.createUi("anchor","Anchors")),a.rels.map(z.createUi("rel","Rel")),a.targets.map(z.createUi("target","Open link in...")),a.link.map(z.createUi("link","Link list")),a.classes.map(z.createUi("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:s,onChange:(e,{name:t})=>{i.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,o,e)})).then((t=>{e.windowManager.open(t)}))};var Ne=tinymce.util.Tools.resolve("tinymce.util.VK");const Re=e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,o)},Be=(e,t)=>e.dom.getParent(t,"a[href]"),Le=e=>Be(e,e.selection.getStart()),He=(e,t)=>{if(t){const o=X(t);if(/^#/.test(o)){const t=e.dom.select(o);t.length&&e.selection.scrollIntoView(t[0],!0)}else Re(t.href)}},Ie=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},Pe=e=>()=>{He(e,Le(e))},Fe=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),ze=e=>t=>{const o=()=>{t.setActive(!e.mode.isReadOnly()&&ee(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return o(),Fe(e,o)},Ve=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return o(),Fe(e,o)},Ze=e=>t=>{const o=()=>t.setEnabled((e=>1===(e.selection.isCollapsed()?ne(e.dom.getParents(e.selection.getStart())):oe(e.selection.getRng())).length)(e));return o(),Fe(e,o)},Ue=e=>t=>{const o=t=>{return re(t)||(o=e.selection.getRng(),oe(o).length>0);var o},n=e.dom.getParents(e.selection.getStart()),r=n=>{t.setEnabled(o(n)&&e.selection.isEditable())};return r(n),Fe(e,(e=>r(e.parents)))},je=e=>{const t=t=>{const o=e.selection.getNode();return t.setEnabled(ee(e,o)),u};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:ze(e)},label:"Link",predicate:t=>E(e)&&ee(e,t),initValue:()=>{return Q(e).fold((t="",()=>t),X);var t},commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const o=e.selection.getNode();return t.setActive(ee(e,o)),ze(e)(t)},onAction:t=>{const o=t.getValue(),n=(t=>{const o=Q(e),n=se(e);if(o.isNone()&&n){const n=te(e.selection,o);return S(0===n.length,t)}return h.none()})(o);de(e,{href:o,attach:u},{href:o,text:n,title:h.none(),rel:h.none(),target:h.none(),class:h.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:t,onAction:t=>{me(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:t,onAction:t=>{Pe(e)(),t.hide()}}]})};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=n(e)||l(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>n(e)||d(e)||m(e,r)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>l(e)||m(e,r),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1})})(e),(e=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",onAction:Ie(e),onSetup:ze(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:Pe(e),onSetup:Ze(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>me(e),onSetup:Ue(e)})})(e),(e=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:Pe(e),onSetup:Ze(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onSetup:Ve(e),onAction:Ie(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>me(e),onSetup:Ue(e)})})(e),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?re(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),je(e),(e=>{e.on("click",(t=>{const o=Be(e,t.target);o&&Ne.metaKeyPressed(t)&&(t.preventDefault(),He(e,o))})),e.on("keydown",(t=>{if(!t.isDefaultPrevented()&&13===t.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(t)){const o=Le(e);o&&(t.preventDefault(),He(e,o))}}))})(e),(e=>{e.addCommand("mceLink",((t,o)=>{!0!==(null==o?void 0:o.dialog)&&L(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Me(e)}))})(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,o=e=>t=>typeof t===e,n=t("string"),r=t("object"),s=t("array"),a=o("boolean"),i=e=>!(e=>null==e)(e),l=o("function"),c=o("number"),d=()=>{},m=e=>()=>e,u=(e,t)=>e===t;const g=e=>t=>!e(t),h=m(!1);class p{constructor(e,t){this.tag=e,this.value=t}static some(e){return new p(!0,e)}static none(){return p.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?p.some(e(this.value)):p.none()}bind(e){return this.tag?e(this.value):p.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:p.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return i(e)?p.some(e):p.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()"}}p.singletonNone=new p(!1);const f=Array.prototype.slice,v=Array.prototype.indexOf,b=Array.prototype.push,y=(e,t)=>{return o=e,n=t,v.call(o,n)>-1;var o,n},w=(e,t)=>{for(let o=0,n=e.length;o{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[];for(let n=0,r=e.length;n(C(e,((e,n)=>{o=t(o,e,n)})),o),_=(e,t,o)=>{for(let n=0,r=e.length;n_(e,t,h),T=(e,t)=>(e=>{const t=[];for(let o=0,n=e.length;o{const t=f.call(e,0);return t.reverse(),t},D=(e,t)=>t>=0&&tD(e,0),M=e=>D(e,e.length-1),N=(e,t)=>{const o=[],n=l(t)?e=>w(o,(o=>t(o,e))):e=>y(o,e);for(let t=0,r=e.length;te.exists((e=>o(e,t))),B=(e,t,o)=>e.isSome()&&t.isSome()?p.some(o(e.getOrDie(),t.getOrDie())):p.none(),L=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},H={fromHtml:(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 L(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return L(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return L(o)},fromDom:L,fromPoint:(e,t,o)=>p.from(e.dom.elementFromPoint(t,o)).map(L)},I=(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")}},P=(e,t)=>e.dom===t.dom,F=I,z="undefined"!=typeof window?window:Function("return this;")(),V=(e,t)=>((e,t)=>{let o=null!=t?t:z;for(let t=0;t{const o=((e,t)=>V(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},U=Object.getPrototypeOf,j=e=>{const t=V("ownerDocument.defaultView",e);return r(e)&&((e=>Z("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(U(e).constructor.name))},W=e=>e.dom.nodeName.toLowerCase(),$=e=>e.dom.nodeType,q=e=>t=>$(t)===e,G=e=>K(e)&&j(e.dom),K=q(1),Y=q(3),X=q(9),J=q(11),Q=e=>t=>K(t)&&W(t)===e,ee=e=>p.from(e.dom.parentNode).map(H.fromDom),te=e=>x(e.dom.childNodes,H.fromDom),oe=(e,t)=>{const o=e.dom.childNodes;return p.from(o[t]).map(H.fromDom)},ne=e=>oe(e,0),re=e=>oe(e,e.dom.childNodes.length-1),se=l(Element.prototype.attachShadow)&&l(Node.prototype.getRootNode)?e=>H.fromDom(e.dom.getRootNode()):e=>{return X(e)?e:(t=e,H.fromDom(t.dom.ownerDocument));var t},ae=e=>{const t=se(e);return J(o=t)&&i(o.dom.host)?p.some(t):p.none();var o},ie=e=>H.fromDom(e.dom.host),le=e=>{const t=Y(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ae(H.fromDom(t)).fold((()=>o.body.contains(t)),(n=le,r=ie,e=>n(r(e))));var n,r};var ce=(e,t,o,n,r)=>e(o,n)?p.some(o):l(r)&&r(o)?p.none():t(o,n,r);const de=(e,t,o)=>{let n=e.dom;const r=l(o)?o:h;for(;n.parentNode;){n=n.parentNode;const e=H.fromDom(n);if(t(e))return p.some(e);if(r(e))break}return p.none()},me=(e,t,o)=>ce(((e,t)=>t(e)),de,e,t,o),ue=(e,t,o)=>de(e,(e=>I(e,t)),o),ge=e=>{return ce(((e,t)=>I(e,t)),ue,e,"[contenteditable]",t);var t},he=e=>e.dom.contentEditable,pe=(e,t)=>{ee(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},fe=(e,t)=>{const o=(e=>p.from(e.dom.nextSibling).map(H.fromDom))(e);o.fold((()=>{ee(e).each((e=>{ve(e,t)}))}),(e=>{pe(e,t)}))},ve=(e,t)=>{e.dom.appendChild(t.dom)},be=(e,t)=>{C(t,(t=>{ve(e,t)}))},ye=e=>{e.dom.textContent="",C(te(e),(e=>{we(e)}))},we=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)};var xe=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Ce=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Se=tinymce.util.Tools.resolve("tinymce.util.VK");const ke=e=>x(e,H.fromDom),_e=Object.keys,Ee=(e,t)=>{const o=_e(e);for(let n=0,r=o.length;n{const o={};var n;return((e,t,o,n)=>{Ee(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))})(e,t,(n=o,(e,t)=>{n[t]=e}),d),o},Oe=(e,t)=>{const o=e.dom;Ee(t,((e,t)=>{((e,t,o)=>{if(!(n(o)||a(o)||c(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+"")})(o,t,e)}))},De=e=>k(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Ae=e=>((e,t)=>H.fromDom(e.dom.cloneNode(t)))(e,!0),Me=(e,t)=>{const o=((e,t)=>{const o=H.fromTag(t),n=De(e);return Oe(o,n),o})(e,t);fe(e,o);const n=te(e);return be(o,n),we(e),o};var Ne=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Re=tinymce.util.Tools.resolve("tinymce.util.Tools");const Be=e=>t=>i(t)&&t.nodeName.toLowerCase()===e,Le=e=>t=>i(t)&&e.test(t.nodeName),He=e=>i(e)&&3===e.nodeType,Ie=e=>i(e)&&1===e.nodeType,Pe=Le(/^(OL|UL|DL)$/),Fe=Le(/^(OL|UL)$/),ze=Be("ol"),Ve=Le(/^(LI|DT|DD)$/),Ze=Le(/^(DT|DD)$/),Ue=Le(/^(TH|TD)$/),je=Be("br"),We=(e,t)=>i(t)&&t.nodeName in e.schema.getTextBlockElements(),$e=(e,t)=>i(e)&&e.nodeName in t,qe=(e,t)=>i(t)&&t.nodeName in e.schema.getVoidElements(),Ge=(e,t,o)=>{const n=e.isEmpty(t);return!(o&&e.select("span[data-mce-type=bookmark]",t).length>0)&&n},Ke=(e,t)=>e.isChildOf(t,e.getRoot()),Ye=e=>t=>t.options.get(e),Xe=Ye("lists_indent_on_tab"),Je=Ye("forced_root_block"),Qe=Ye("forced_root_block_attrs"),et=(e,t)=>{const o=e.dom,n=e.schema.getBlockElements(),r=o.createFragment(),s=Je(e),a=Qe(e);let i,l,c=!1;for(l=o.create(s,a),$e(t.firstChild,n)||r.appendChild(l);i=t.firstChild;){const e=i.nodeName;c||"SPAN"===e&&"bookmark"===i.getAttribute("data-mce-type")||(c=!0),$e(i,n)?(r.appendChild(i),l=null):(l||(l=o.create(s,a),r.appendChild(l)),l.appendChild(i))}return!c&&l&&l.appendChild(o.create("br",{"data-mce-bogus":"1"})),r},tt=Ne.DOM,ot=(e,t,o)=>{const n=tt.select('span[data-mce-type="bookmark"]',t),r=et(e,o),s=tt.createRng();s.setStartAfter(o),s.setEndAfter(t);const a=s.extractContents();for(let t=a.firstChild;t;t=t.firstChild)if("LI"===t.nodeName&&e.dom.isEmpty(t)){tt.remove(t);break}e.dom.isEmpty(a)||tt.insertAfter(a,t),tt.insertAfter(r,t);const i=o.parentElement;i&&Ge(e.dom,i)&&(e=>{const t=e.parentNode;t&&Re.each(n,(e=>{t.insertBefore(e,o.parentNode)})),tt.remove(e)})(i),tt.remove(o),Ge(e.dom,t)&&tt.remove(t)},nt=Q("dd"),rt=Q("dt"),st=(e,t)=>{var o;nt(t)?Me(t,"dt"):rt(t)&&(o=t,p.from(o.dom.parentElement).map(H.fromDom)).each((o=>ot(e,o.dom,t.dom)))},at=e=>{rt(e)&&Me(e,"dd")},it=(e,t)=>{if(He(e))return{container:e,offset:t};const o=xe.getNode(e,t);return He(o)?{container:o,offset:t>=e.childNodes.length?o.data.length:0}:o.previousSibling&&He(o.previousSibling)?{container:o.previousSibling,offset:o.previousSibling.data.length}:o.nextSibling&&He(o.nextSibling)?{container:o.nextSibling,offset:0}:{container:e,offset:t}},lt=e=>{const t=e.cloneRange(),o=it(e.startContainer,e.startOffset);t.setStart(o.container,o.offset);const n=it(e.endContainer,e.endOffset);return t.setEnd(n.container,n.offset),t},ct=["OL","UL","DL"],dt=ct.join(","),mt=(e,t)=>{const o=t||e.selection.getStart(!0);return e.dom.getParent(o,dt,pt(e,o))},ut=e=>{const t=mt(e),o=e.selection.getSelectedBlocks();return((e,t)=>i(e)&&1===t.length&&t[0]===e)(t,o)?(e=>S(e.querySelectorAll(dt),Pe))(t):S(o,(e=>Pe(e)&&t!==e))},gt=e=>{const t=e.selection.getSelectedBlocks();return S(((e,t)=>{const o=Re.map(t,(t=>e.dom.getParent(t,"li,dd,dt",pt(e,t))||t));return N(o)})(e,t),Ve)},ht=(e,t)=>{const o=e.dom.getParents(t,"TD,TH");return o.length>0?o[0]:e.getBody()},pt=(e,t)=>{const o=e.dom.getParents(t,e.dom.isBlock),n=E(o,(t=>{return o=e.schema,!Pe(n=t)&&!Ve(n)&&w(ct,(e=>o.isValidChild(n.nodeName,e)));var o,n}));return n.getOr(e.getBody())},ft=(e,t)=>{const o=e.dom.getParents(t,"ol,ul",pt(e,t));return M(o)},vt=e=>{const t=(e=>{const t=ft(e,e.selection.getStart()),o=S(e.selection.getSelectedBlocks(),Fe);return t.toArray().concat(o)})(e),o=(e=>{const t=e.selection.getStart();return e.dom.getParents(t,"ol,ul",pt(e,t))})(e);return E(o,(e=>{return t=H.fromDom(e),ee(t).exists((e=>Ve(e.dom)&&ne(e).exists((e=>!Pe(e.dom)))&&re(e).exists((e=>!Pe(e.dom)))));var t})).fold((()=>bt(e,t)),(e=>[e]))},bt=(e,t)=>{const o=x(t,(t=>ft(e,t).getOr(t)));return N(o)},yt=e=>/\btox\-/.test(e.className),wt=(e,t)=>_(e,Pe,Ue).exists((e=>e.nodeName===t&&!yt(e))),xt=(e,t)=>null!==t&&!e.dom.isEditable(t),Ct=(e,t)=>{const o=e.dom.getParent(t,"ol,ul,dl");return xt(e,o)},St=(e,t)=>{const o=e.selection.getNode();return t({parents:e.dom.getParents(o),element:o}),e.on("NodeChange",t),()=>e.off("NodeChange",t)},kt=(e,t)=>{const o=(t||document).createDocumentFragment();return C(e,(e=>{o.appendChild(e.dom)})),H.fromDom(o)},_t=(e,t,o)=>e.dispatch("ListMutation",{action:t,element:o}),Et=(Tt=/^\s+|\s+$/g,e=>e.replace(Tt,""));var Tt;const Ot=(e,t,o)=>{if(!n(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);(e=>void 0!==e.style&&l(e.style.getPropertyValue))(e)&&e.style.setProperty(t,o)},Dt=(e,t,o)=>{const n=e.dom;Ot(n,t,o)},At=e=>F(e,"OL,UL"),Mt=e=>ne(e).exists(At),Nt=e=>"listAttributes"in e,Rt=e=>"isComment"in e,Bt=e=>e.depth>0,Lt=e=>e.isSelected,Ht=e=>{const t=te(e),o=re(e).exists(At)?t.slice(0,-1):t;return x(o,Ae)},It=(e,t)=>{ve(e.item,t.list)},Pt=(e,t)=>{const o={list:H.fromTag(t,e),item:H.fromTag("li",e)};return ve(o.list,o.item),o},Ft=(e,t,o)=>{const n=t.slice(0,o.depth);return M(n).each((t=>{if(Nt(o)){const n=((e,t,o)=>{const n=H.fromTag("li",e);return Oe(n,t),be(n,o),n})(e,o.itemAttributes,o.content);((e,t)=>{ve(e.list,t),e.item=t})(t,n),((e,t)=>{W(e.list)!==t.listType&&(e.list=Me(e.list,t.listType)),Oe(e.list,t.listAttributes)})(t,o)}else if((e=>"isFragment"in e)(o))be(t.item,o.content);else{const e=H.fromHtml(`\x3c!--${o.content}--\x3e`);ve(t.list,e)}})),n},zt=(e,t,o)=>{const n=((e,t,o)=>{const n=[];for(let r=0;r{for(let t=1;t{for(let t=0;t{Nt(t)&&(Oe(e.list,t.listAttributes),Oe(e.item,t.itemAttributes)),be(e.item,t.content)}))})(n,o),r=n,B(M(t),A(r),It),t.concat(n)},Vt=(e,t)=>{let o=p.none();const n=k(t,((t,n,r)=>Rt(n)?0===r?(o=p.some(n),t):Ft(e,t,n):n.depth>t.length?zt(e,t,n):Ft(e,t,n)),[]);return o.each((e=>{const t=H.fromHtml(`\x3c!--${e.content}--\x3e`);A(n).each((e=>{((e,t)=>{ne(e).fold((()=>{ve(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))})(e.list,t)}))})),A(n).map((e=>e.list))},Zt=e=>(C(e,((t,o)=>{((e,t)=>{const o=e[t].depth,n=e=>e.depth===o&&!e.dirty,r=e=>e.depth_(e.slice(t+1),n,r)))})(e,o).fold((()=>{t.dirty&&Nt(t)&&(e=>{e.listAttributes=Te(e.listAttributes,((e,t)=>"start"!==t))})(t)}),(e=>{return n=e,void(Nt(o=t)&&Nt(n)&&(o.listType=n.listType,o.listAttributes={...n.listAttributes}));var o,n}))})),e),Ut=(e,t,o,n)=>{var r,s;if(8===$(s=n)||"#comment"===W(s))return[{depth:e+1,content:null!==(r=n.dom.nodeValue)&&void 0!==r?r:"",dirty:!1,isSelected:!1,isComment:!0}];t.each((e=>{P(e.start,n)&&o.set(!0)}));const a=((e,t,o)=>ee(e).filter(K).map((n=>({depth:t,dirty:!1,isSelected:o,content:Ht(e),itemAttributes:De(e),listAttributes:De(n),listType:W(n),isInPreviousLi:!1}))))(n,e,o.get());t.each((e=>{P(e.end,n)&&o.set(!1)}));const i=re(n).filter(At).map((n=>Wt(e,t,o,n))).getOr([]);return a.toArray().concat(i)},jt=(e,t,o,n)=>ne(n).filter(At).fold((()=>Ut(e,t,o,n)),(r=>{const s=k(te(n),((n,s,a)=>{if(0===a)return n;if(F(s,"LI"))return n.concat(Ut(e,t,o,s));{const t={isFragment:!0,depth:e,content:[s],isSelected:!1,dirty:!1,parentListType:W(r)};return n.concat(t)}}),[]);return Wt(e,t,o,r).concat(s)})),Wt=(e,t,o,n)=>T(te(n),(n=>(At(n)?Wt:jt)(e+1,t,o,n))),$t=(e,t)=>T(((e,t)=>{if(0===e.length)return[];{let o=t(e[0]);const n=[];let r=[];for(let s=0,a=e.length;sA(t).exists(Bt)?((e,t)=>{const o=Zt(t);return Vt(e.contentDocument,o).toArray()})(e,t):((e,t)=>{const o=Zt(t);return x(o,(t=>{const o=Rt(t)?kt([H.fromHtml(`\x3c!--${t.content}--\x3e`)]):kt(t.content);return H.fromDom(et(e,o.dom))}))})(e,t))),qt=(e,t,o)=>{const n=((e,t)=>{const o=(e=>{let t=!1;return{get:()=>t,set:e=>{t=e}}})();return x(e,(e=>({sourceList:e,entries:Wt(0,t,o,e)})))})(t,(e=>{const t=x(gt(e),H.fromDom);return B(E(t,g(Mt)),E(O(t),g(Mt)),((e,t)=>({start:e,end:t})))})(e));C(n,(t=>{((e,t)=>{C(S(e,Lt),(e=>((e,t)=>{switch(e){case"Indent":t.depth++;break;case"Outdent":t.depth--;break;case"Flatten":t.depth=0}t.dirty=!0})(t,e)))})(t.entries,o);const n=$t(e,t.entries);var r;C(n,(t=>{_t(e,"Indent"===o?"IndentList":"OutdentList",t.dom)})),r=t.sourceList,C(n,(e=>{pe(r,e)})),we(t.sourceList)}))},Gt=(e,t)=>{const o=ke(vt(e)),n=ke((e=>S(gt(e),Ze))(e));let r=!1;if(o.length||n.length){const s=e.selection.getBookmark();qt(e,o,t),((e,t,o)=>{C(o,"Indent"===t?at:t=>st(e,t))})(e,t,n),e.selection.moveToBookmark(s),e.selection.setRng(lt(e.selection.getRng())),e.nodeChanged(),r=!0}return r},Kt=(e,t)=>!(e=>{const t=mt(e);return xt(e,t)})(e)&&Gt(e,t),Yt=e=>Kt(e,"Indent"),Xt=e=>Kt(e,"Outdent"),Jt=e=>Kt(e,"Flatten"),Qt=e=>"\ufeff"===e,eo=(e,t)=>{return o=e,n=function(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}(P,t),de(o,n,r).isSome();var o,n,r};var to=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const oo=Ne.DOM,no=e=>{const t={},o=o=>{let n=e[o?"startContainer":"endContainer"],r=e[o?"startOffset":"endOffset"];if(Ie(n)){const e=oo.create("span",{"data-mce-type":"bookmark"});n.hasChildNodes()?(r=Math.min(r,n.childNodes.length-1),o?n.insertBefore(e,n.childNodes[r]):oo.insertAfter(e,n.childNodes[r])):n.appendChild(e),n=e,r=0}t[o?"startContainer":"endContainer"]=n,t[o?"startOffset":"endOffset"]=r};return o(!0),e.collapsed||o(),t},ro=e=>{const t=t=>{let o=e[t?"startContainer":"endContainer"],n=e[t?"startOffset":"endOffset"];if(o){if(Ie(o)&&o.parentNode){const e=o;n=(e=>{var t;let o=null===(t=e.parentNode)||void 0===t?void 0:t.firstChild,n=0;for(;o;){if(o===e)return n;Ie(o)&&"bookmark"===o.getAttribute("data-mce-type")||n++,o=o.nextSibling}return-1})(o),o=o.parentNode,oo.remove(e),!o.hasChildNodes()&&oo.isBlock(o)&&o.appendChild(oo.create("br"))}e[t?"startContainer":"endContainer"]=o,e[t?"startOffset":"endOffset"]=n}};t(!0),t();const o=oo.createRng();return o.setStart(e.startContainer,e.startOffset),e.endContainer&&o.setEnd(e.endContainer,e.endOffset),lt(o)},so=e=>{switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},ao=(e,t)=>{Re.each(t,((t,o)=>{e.setAttribute(o,t)}))},io=(e,t,o)=>{((e,t,o)=>{const n=o["list-style-type"]?o["list-style-type"]:null;e.setStyle(t,"list-style-type",n)})(e,t,o),((e,t,o)=>{ao(t,o["list-attributes"]),Re.each(e.select("li",t),(e=>{ao(e,o["list-item-attributes"])}))})(e,t,o)},lo=(e,t)=>i(t)&&!$e(t,e.schema.getBlockElements()),co=(e,t,o,n)=>{let r=t[o?"startContainer":"endContainer"];const s=t[o?"startOffset":"endOffset"];Ie(r)&&(r=r.childNodes[Math.min(s,r.childNodes.length-1)]||r),!o&&je(r.nextSibling)&&(r=r.nextSibling);const a=(t,o)=>{var r;const s=new Ce(t,(t=>{for(;!e.dom.isBlock(t)&&t.parentNode&&n!==t;)t=t.parentNode;return t})(t)),a=o?"next":"prev";let i;for(;i=s[a]();)if(!qe(e,i)&&!Qt(i.textContent)&&0!==(null===(r=i.textContent)||void 0===r?void 0:r.length))return p.some(i);return p.none()};if(o&&He(r))if(Qt(r.textContent))r=a(r,!1).getOr(r);else for(null!==r.parentNode&&lo(e,r.parentNode)&&(r=r.parentNode);null!==r.previousSibling&&(lo(e,r.previousSibling)||He(r.previousSibling));)r=r.previousSibling;if(!o&&He(r))if(Qt(r.textContent))r=a(r,!0).getOr(r);else for(null!==r.parentNode&&lo(e,r.parentNode)&&(r=r.parentNode);null!==r.nextSibling&&(lo(e,r.nextSibling)||He(r.nextSibling));)r=r.nextSibling;for(;r.parentNode!==n;){const t=r.parentNode;if(We(e,r))return r;if(/^(TD|TH)$/.test(t.nodeName))return r;r=t}return r},mo=(e,t,o)=>{const n=e.selection.getRng();let r="LI";const s=pt(e,((e,t)=>{const o=e.selection.getStart(!0),n=co(e,t,!0,e.getBody());return eo(H.fromDom(n),H.fromDom(t.commonAncestorContainer))?t.commonAncestorContainer:o})(e,n)),a=e.dom;if("false"===a.getContentEditable(e.selection.getNode()))return;"DL"===(t=t.toUpperCase())&&(r="DT");const i=no(n),l=S(((e,t,o)=>{const n=[],r=e.dom,s=co(e,t,!0,o),a=co(e,t,!1,o);let i;const l=[];for(let e=s;e&&(l.push(e),e!==a);e=e.nextSibling);return Re.each(l,(t=>{var s;if(We(e,t))return n.push(t),void(i=null);if(r.isBlock(t)||je(t))return je(t)&&r.remove(t),void(i=null);const a=t.nextSibling;to.isBookmarkNode(t)&&(Pe(a)||We(e,a)||!a&&t.parentNode===o)?i=null:(i||(i=r.create("p"),null===(s=t.parentNode)||void 0===s||s.insertBefore(i,t),n.push(i)),i.appendChild(t))})),n})(e,n,s),e.dom.isEditable);Re.each(l,(n=>{let s;const i=n.previousSibling,l=n.parentNode;Ve(l)||(i&&Pe(i)&&i.nodeName===t&&((e,t,o)=>{const n=e.getStyle(t,"list-style-type");let r=o?o["list-style-type"]:"";return r=null===r?"":r,n===r})(a,i,o)?(s=i,n=a.rename(n,r),i.appendChild(n)):(s=a.create(t),l.insertBefore(s,n),s.appendChild(n),n=a.rename(n,r)),((e,t,o)=>{Re.each(o,(o=>e.setStyle(t,o,"")))})(a,n,["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"]),io(a,s,o),go(e.dom,s))})),e.selection.setRng(ro(i))},uo=(e,t,o)=>{return((e,t)=>Pe(e)&&e.nodeName===(null==t?void 0:t.nodeName))(t,o)&&((e,t,o)=>e.getStyle(t,"list-style-type",!0)===e.getStyle(o,"list-style-type",!0))(e,t,o)&&(n=o,t.className===n.className);var n},go=(e,t)=>{let o,n=t.nextSibling;if(uo(e,t,n)){const r=n;for(;o=r.firstChild;)t.appendChild(o);e.remove(r)}if(n=t.previousSibling,uo(e,t,n)){const r=n;for(;o=r.lastChild;)t.insertBefore(o,t.firstChild);e.remove(r)}},ho=(e,t,o,n)=>{if(t.nodeName!==o){const r=e.dom.rename(t,o);io(e.dom,r,n),_t(e,so(o),r)}else io(e.dom,t,n),_t(e,so(o),t)},po=(e,t,o,n)=>{if(t.classList.forEach(((e,o,n)=>{e.startsWith("tox-")&&(n.remove(e),0===n.length&&t.removeAttribute("class"))})),t.nodeName!==o){const r=e.dom.rename(t,o);io(e.dom,r,n),_t(e,so(o),r)}else io(e.dom,t,n),_t(e,so(o),t)},fo=e=>"list-style-type"in e,vo=(e,t,o)=>{const n=mt(e);if(Ct(e,n))return;const s=ut(e),a=r(o)?o:{};s.length>0?((e,t,o,n,r)=>{const s=Pe(t);if(!s||t.nodeName!==n||fo(r)||yt(t)){mo(e,n,r);const a=no(e.selection.getRng()),i=s?[t,...o]:o,l=s&&yt(t)?po:ho;Re.each(i,(t=>{l(e,t,n,r)})),e.selection.setRng(ro(a))}else Jt(e)})(e,n,s,t,a):((e,t,o,n)=>{if(t!==e.getBody())if(t)if(t.nodeName!==o||fo(n)||yt(t)){const r=no(e.selection.getRng());yt(t)&&t.classList.forEach(((e,o,n)=>{e.startsWith("tox-")&&(n.remove(e),0===n.length&&t.removeAttribute("class"))})),io(e.dom,t,n);const s=e.dom.rename(t,o);go(e.dom,s),e.selection.setRng(ro(r)),mo(e,o,n),_t(e,so(o),s)}else Jt(e);else mo(e,o,n),_t(e,so(o),t)})(e,n,t,a)},bo=Ne.DOM,yo=(e,t)=>{const o=Re.grep(e.select("ol,ul",t));Re.each(o,(t=>{((e,t)=>{const o=t.parentElement;if(o&&"LI"===o.nodeName&&o.firstChild===t){const n=o.previousSibling;n&&"LI"===n.nodeName?(n.appendChild(t),Ge(e,o)&&bo.remove(o)):bo.setStyle(o,"listStyleType","none")}if(Pe(o)){const e=o.previousSibling;e&&"LI"===e.nodeName&&e.appendChild(t)}})(e,t)}))},wo=(e,t,o,n)=>{let r=t.startContainer;const s=t.startOffset;if(He(r)&&(o?s0))return r;const a=e.schema.getNonEmptyElements();Ie(r)&&(r=xe.getNode(r,s));const i=new Ce(r,n);o&&((e,t)=>!!je(t)&&e.isBlock(t.nextSibling)&&!je(t.previousSibling))(e.dom,r)&&i.next();const l=o?i.next.bind(i):i.prev2.bind(i);for(;r=l();){if("LI"===r.nodeName&&!r.hasChildNodes())return r;if(a[r.nodeName])return r;if(He(r)&&r.data.length>0)return r}return null},xo=(e,t)=>{const o=t.childNodes;return 1===o.length&&!Pe(o[0])&&e.isBlock(o[0])},Co=e=>p.from(e).map(H.fromDom).filter(G).exists((e=>((e,t=!1)=>le(e)?e.dom.isContentEditable:ge(e).fold(m(t),(e=>"true"===he(e))))(e)&&!y(["details"],W(e)))),So=(e,t,o)=>{let n;const r=xo(e,o)?o.firstChild:o;if(((e,t)=>{xo(e,t)&&Co(t.firstChild)&&e.remove(t.firstChild,!0)})(e,t),!Ge(e,t,!0))for(;n=t.firstChild;)r.appendChild(n)},ko=(e,t,o)=>{let n;const r=t.parentNode;if(!Ke(e,t)||!Ke(e,o))return;Pe(o.lastChild)&&(n=o.lastChild),r===o.lastChild&&je(r.previousSibling)&&e.remove(r.previousSibling);const s=o.lastChild;s&&je(s)&&t.hasChildNodes()&&e.remove(s),Ge(e,o,!0)&&ye(H.fromDom(o)),So(e,t,o),n&&o.appendChild(n);const a=((e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)})(H.fromDom(o),H.fromDom(t))?e.getParents(t,Pe,o):[];e.remove(t),C(a,(t=>{Ge(e,t)&&t!==e.getRoot()&&e.remove(t)}))},_o=(e,t,o,n)=>{const r=e.dom;if(r.isEmpty(n))((e,t,o)=>{ye(H.fromDom(o)),ko(e.dom,t,o),e.selection.setCursorLocation(o,0)})(e,o,n);else{const s=no(t);ko(r,o,n),e.selection.setRng(ro(s))}},Eo=(e,t)=>{const o=e.dom,n=e.selection,r=n.getStart(),s=ht(e,r),a=o.getParent(n.getStart(),"LI",s);if(a){const r=a.parentElement;if(r===e.getBody()&&Ge(o,r))return!0;const i=lt(n.getRng()),l=o.getParent(wo(e,i,t,s),"LI",s),c=l&&(t?o.isChildOf(a,l):o.isChildOf(l,a));if(l&&l!==a&&!c)return e.undoManager.transact((()=>{var o,n;t?_o(e,i,l,a):(null===(n=(o=a).parentNode)||void 0===n?void 0:n.firstChild)===o?Xt(e):((e,t,o,n)=>{const r=no(t);ko(e.dom,o,n);const s=ro(r);e.selection.setRng(s)})(e,i,a,l)})),!0;if(c&&!t&&l!==a)return e.undoManager.transact((()=>{if(i.commonAncestorContainer.parentElement){const t=no(i),n=i.commonAncestorContainer.parentElement;So(o,i.commonAncestorContainer.parentElement,l),n.remove();const r=ro(t);e.selection.setRng(r)}})),!0;if(!l&&!t&&0===i.startOffset&&0===i.endOffset)return e.undoManager.transact((()=>{Jt(e)})),!0}return!1},To=(e,t)=>{const o=e.dom,n=e.selection.getStart(),r=ht(e,n),s=o.getParent(n,o.isBlock,r);if(s&&o.isEmpty(s)){const n=lt(e.selection.getRng()),a=o.getParent(wo(e,n,t,r),"LI",r);if(a){const i=e=>y(["td","th","caption"],W(e)),l=e=>e.dom===r;return!!((e,t,o=u)=>B(e,t,o).getOr(e.isNone()&&t.isNone()))(me(H.fromDom(a),i,l),me(H.fromDom(n.startContainer),i,l),P)&&(e.undoManager.transact((()=>{const n=a.parentNode;((e,t,o)=>{const n=e.getParent(t.parentNode,e.isBlock,o);e.remove(t),n&&e.isEmpty(n)&&e.remove(n)})(o,s,r),go(o,n),e.selection.select(a,!0),e.selection.collapse(t)})),!0)}}return!1},Oo=e=>{const t=e.selection.getStart(),o=ht(e,t);return e.dom.getParent(t,"LI,DT,DD",o)||gt(e).length>0},Do=(e,t)=>{const o=e.selection;return!Ct(e,o.getNode())&&(o.isCollapsed()?((e,t)=>Eo(e,t)||To(e,t))(e,t):(e=>!!Oo(e)&&(e.undoManager.transact((()=>{e.execCommand("Delete"),yo(e.dom,e.getBody())})),!0))(e))},Ao=e=>{const t=O(Et(e).split("")),o=x(t,((e,t)=>{const o=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,t)*o}));return k(o,((e,t)=>e+t),0)},Mo=e=>{if(--e<0)return"";{const t=e%26,o=Math.floor(e/26);return Mo(o)+String.fromCharCode("A".charCodeAt(0)+t)}},No=e=>{const t=parseInt(e.start,10);return R(e.listStyleType,"upper-alpha")?Mo(t):R(e.listStyleType,"lower-alpha")?Mo(t).toLowerCase():e.start},Ro=e=>{const t=mt(e);ze(t)&&!Ct(e,t)&&e.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:No({start:e.dom.getAttrib(t,"start","1"),listStyleType:p.from(e.dom.getStyle(t,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{(e=>{switch((e=>/^[0-9]+$/.test(e)?2:/^[A-Z]+$/.test(e)?0:(e=>/^[a-z]+$/.test(e))(e)?1:e.length>0?4:3)(e)){case 2:return p.some({listStyleType:p.none(),start:e});case 0:return p.some({listStyleType:p.some("upper-alpha"),start:Ao(e).toString()});case 1:return p.some({listStyleType:p.some("lower-alpha"),start:Ao(e).toString()});case 3:return p.some({listStyleType:p.none(),start:""});case 4:return p.none()}})(t.getData().start).each((t=>{e.execCommand("mceListUpdate",!1,{attrs:{start:"1"===t.start?"":t.start},styles:{"list-style-type":t.listStyleType.getOr("")}})})),t.close()}})},Bo=(e,t)=>()=>{const o=mt(e);return i(o)&&o.nodeName===t},Lo=e=>{e.addCommand("mceListProps",(()=>{Ro(e)}))},Ho=e=>{e.on("BeforeExecCommand",(t=>{const o=t.command.toLowerCase();"indent"===o?Yt(e):"outdent"===o&&Xt(e)})),e.addCommand("InsertUnorderedList",((t,o)=>{vo(e,"UL",o)})),e.addCommand("InsertOrderedList",((t,o)=>{vo(e,"OL",o)})),e.addCommand("InsertDefinitionList",((t,o)=>{vo(e,"DL",o)})),e.addCommand("RemoveList",(()=>{Jt(e)})),Lo(e),e.addCommand("mceListUpdate",((t,o)=>{r(o)&&((e,t)=>{const o=mt(e);null===o||Ct(e,o)||e.undoManager.transact((()=>{r(t.styles)&&e.dom.setStyles(o,t.styles),r(t.attrs)&&Ee(t.attrs,((t,n)=>e.dom.setAttrib(o,n,t)))}))})(e,o)})),e.addQueryStateHandler("InsertUnorderedList",Bo(e,"UL")),e.addQueryStateHandler("InsertOrderedList",Bo(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",Bo(e,"DL"))};var Io=tinymce.util.Tools.resolve("tinymce.html.Node");const Po=e=>3===e.type,Fo=e=>0===e.length,zo=e=>{const t=(t,o)=>{const n=Io.create("li");C(t,(e=>n.append(e))),o?e.insert(n,o,!0):e.append(n)},o=k(e.children(),((e,o)=>Po(o)?[...e,o]:Fo(e)||Po(o)?e:(t(e,o),[])),[]);Fo(o)||t(o)},Vo=e=>{Xe(e)&&(e=>{e.on("keydown",(t=>{t.keyCode!==Se.TAB||Se.metaKeyPressed(t)||e.undoManager.transact((()=>{(t.shiftKey?Xt(e):Yt(e))&&t.preventDefault()}))}))})(e),(e=>{e.on("ExecCommand",(t=>{const o=t.command.toLowerCase();"delete"!==o&&"forwarddelete"!==o||!Oo(e)||yo(e.dom,e.getBody())})),e.on("keydown",(t=>{t.keyCode===Se.BACKSPACE?Do(e,!1)&&t.preventDefault():t.keyCode===Se.DELETE&&Do(e,!0)&&t.preventDefault()}))})(e)},Zo=(e,t)=>o=>(o.setEnabled(e.selection.isEditable()),St(e,(n=>{o.setActive(wt(n.parents,t)),o.setEnabled(!Ct(e,n.element)&&e.selection.isEditable())}))),Uo=(e,t)=>o=>St(e,(n=>o.setEnabled(wt(n.parents,t)&&!Ct(e,n.element))));e.add("lists",(e=>((e=>{(0,e.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(e),(e=>{e.on("PreInit",(()=>{const{parser:t}=e;t.addNodeFilter("ul,ol",(e=>C(e,zo)))}))})(e),e.hasPlugin("rtc",!0)?Lo(e):(Vo(e),Ho(e)),(e=>{const t=t=>()=>e.execCommand(t);e.hasPlugin("advlist")||(e.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:t("InsertOrderedList"),onSetup:Zo(e,"OL")}),e.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:t("InsertUnorderedList"),onSetup:Zo(e,"UL")}))})(e),(e=>{const t={text:"List properties...",icon:"ordered-list",onAction:()=>e.execCommand("mceListProps"),onSetup:Uo(e,"OL")};e.ui.registry.addMenuItem("listprops",t),e.ui.registry.addContextMenu("lists",{update:t=>{const o=mt(e,t);return ze(o)?["listprops"]:[]}})})(e),(e=>({backspaceDelete:t=>{Do(e,t)}}))(e))))}();export{n as default}; +function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,o={exports:{}};t=o,function(){var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},o=function(e){return{eq:e}},n=o((function(e,t){return e===t})),r=function(e){return o((function(t,o){if(t.length!==o.length)return!1;for(var n=t.length,r=0;r{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},d=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&c(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,m=e=>t=>typeof t===e,u=e=>t=>e===t,g=(e,t)=>p(e)&&c(e,t,((e,t)=>l(e)===t)),h=d("string"),p=d("object"),f=e=>g(e,Object),v=d("array"),b=u(null),y=m("boolean"),w=u(void 0),x=e=>null==e,C=e=>!x(e),S=m("function"),k=m("number"),_=(e,t)=>{if(v(e)){for(let o=0,n=e.length;o{},T=(e,t)=>(...o)=>e(t.apply(null,o)),O=(e,t)=>o=>e(t(o)),D=e=>()=>e,A=e=>e,M=(e,t)=>e===t;function N(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const R=e=>t=>!e(t),B=e=>()=>{throw new Error(e)},L=e=>e(),H=e=>{e()},I=D(!1),P=D(!0);class F{constructor(e,t){this.tag=e,this.value=t}static some(e){return new F(!0,e)}static none(){return F.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?F.some(e(this.value)):F.none()}bind(e){return this.tag?e(this.value):F.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:F.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return C(e)?F.some(e):F.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()"}}F.singletonNone=new F(!1);const z=Array.prototype.slice,V=Array.prototype.indexOf,Z=Array.prototype.push,U=(e,t)=>V.call(e,t),j=(e,t)=>U(e,t)>-1,W=(e,t)=>{for(let o=0,n=e.length;o{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{for(let o=e.length-1;o>=0;o--)t(e[o],o)},K=(e,t)=>{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(G(e,((e,n)=>{o=t(o,e,n)})),o),J=(e,t,o)=>(q(e,((e,n)=>{o=t(o,e,n)})),o),Q=(e,t,o)=>{for(let n=0,r=e.length;nQ(e,t,I),te=(e,t)=>{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;ooe($(e,t)),re=(e,t)=>{for(let o=0,n=e.length;o{const t=z.call(e,0);return t.reverse(),t},ae=(e,t)=>Y(e,(e=>!j(t,e))),ie=(e,t)=>{const o={};for(let n=0,r=e.length;n{const o=z.call(e,0);return o.sort(t),o},ce=(e,t)=>t>=0&&tce(e,0),me=e=>ce(e,e.length-1),ue=S(Array.from)?Array.from:e=>z.call(e),ge=(e,t)=>{for(let o=0;o{const o=[],n=S(t)?e=>W(o,(o=>t(o,e))):e=>j(o,e);for(let t=0,r=e.length;t{const o=pe(e);for(let n=0,r=o.length;nye(e,((e,o)=>({k:o,v:t(e,o)}))),ye=(e,t)=>{const o={};return ve(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},we=e=>(t,o)=>{e[o]=t},xe=(e,t,o,n)=>{ve(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))},Ce=(e,t)=>{const o={};return xe(e,t,we(o),E),o},Se=(e,t)=>{const o=[];return ve(e,((e,n)=>{o.push(t(e,n))})),o},ke=e=>Se(e,A),_e=(e,t)=>Ee(e,t)?F.from(e[t]):F.none(),Ee=(e,t)=>fe.call(e,t),Te=(e,t)=>Ee(e,t)&&void 0!==e[t]&&null!==e[t],Oe=e=>{const t={};return q(e,(e=>{t[e]={}})),pe(t)},De=e=>void 0!==e.length,Ae=Array.isArray,Me=(e,t,o)=>{if(!e)return!1;if(o=o||e,De(e)){for(let n=0,r=e.length;n{const o=[];return Me(e,((n,r)=>{o.push(t(n,r,e))})),o},Re=(e,t)=>{const o=[];return Me(e,((n,r)=>{t&&!t(n,r,e)||o.push(n)})),o},Be=(e,t,o,n)=>{let r=w(o)?e[0]:o;for(let o=0;o{for(let n=0,r=e.length;ne[e.length-1],Ie=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},Pe=()=>Fe(0,0),Fe=(e,t)=>({major:e,minor:t}),ze={nu:Fe,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?Pe():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return Fe(n(1),n(2))})(e,o)},unknown:Pe},Ve=(e,t)=>{const o=String(t).toLowerCase();return ee(e,(e=>e.search(o)))},Ze=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ue=(e,t)=>We(e,t)?((e,t)=>e.substring(t))(e,t.length):e,je=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!w(n)||r+t.length<=n)},We=(e,t)=>Ze(e,t,0),$e=(e,t)=>Ze(e,t,e.length-t.length),qe=e=>t=>t.replace(e,""),Ge=qe(/^\s+|\s+$/g),Ke=qe(/^\s+/g),Ye=qe(/\s+$/g),Xe=e=>e.length>0,Je=e=>!Xe(e),Qe=(e,t=10)=>{const o=parseInt(e,t);return isNaN(o)?F.none():F.some(o)},et=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,tt=e=>t=>je(t,e),ot=[{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]+).*/,et],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:[et,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:tt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:tt("firefox")},{name:"Safari",versionRegexes:[et,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(je(e,"safari")||je(e,"mobile/"))&&je(e,"applewebkit")}],nt=[{name:"Windows",search:tt("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:tt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:tt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:tt("linux"),versionRegexes:[]},{name:"Solaris",search:tt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:tt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:tt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],rt={browsers:D(ot),oses:D(nt)},st="Edge",at="Chromium",it="Opera",lt="Firefox",ct="Safari",dt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(st),isChromium:n(at),isIE:n("IE"),isOpera:n(it),isFirefox:n(lt),isSafari:n(ct)}},mt={unknown:()=>dt({current:void 0,version:ze.unknown()}),nu:dt,edge:D(st),chromium:D(at),ie:D("IE"),opera:D(it),firefox:D(lt),safari:D(ct)},ut="Windows",gt="Android",ht="Linux",pt="macOS",ft="Solaris",vt="FreeBSD",bt="ChromeOS",yt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(ut),isiOS:n("iOS"),isAndroid:n(gt),isMacOS:n(pt),isLinux:n(ht),isSolaris:n(ft),isFreeBSD:n(vt),isChromeOS:n(bt)}},wt={unknown:()=>yt({current:void 0,version:ze.unknown()}),nu:yt,windows:D(ut),ios:D("iOS"),android:D(gt),linux:D(ht),macos:D(pt),solaris:D(ft),freebsd:D(vt),chromeos:D(bt)},xt=(e,t,o)=>{const n=rt.browsers(),r=rt.oses(),s=t.bind((e=>((e,t)=>ge(t.brands,(t=>{const o=t.brand.toLowerCase();return ee(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:ze.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>Ve(e,t).map((e=>{const o=ze.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(mt.unknown,mt.nu),a=((e,t)=>Ve(e,t).map((e=>{const o=ze.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(wt.unknown,wt.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:D(r),isiPhone:D(s),isTablet:D(l),isPhone:D(c),isTouch:D(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:D(d),isDesktop:D(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},Ct=e=>window.matchMedia(e).matches;let St=Ie((()=>xt(navigator.userAgent,F.from(navigator.userAgentData),Ct)));const kt=()=>St(),_t=navigator.userAgent,Et=kt(),Tt=Et.browser,Ot=Et.os,Dt=Et.deviceType,At=-1!==_t.indexOf("Windows Phone"),Mt={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:Tt.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!Tt.isIE(),windowsPhone:At,browser:{current:Tt.current,version:Tt.version,isChromium:Tt.isChromium,isEdge:Tt.isEdge,isFirefox:Tt.isFirefox,isIE:Tt.isIE,isOpera:Tt.isOpera,isSafari:Tt.isSafari},os:{current:Ot.current,version:Ot.version,isAndroid:Ot.isAndroid,isChromeOS:Ot.isChromeOS,isFreeBSD:Ot.isFreeBSD,isiOS:Ot.isiOS,isLinux:Ot.isLinux,isMacOS:Ot.isMacOS,isSolaris:Ot.isSolaris,isWindows:Ot.isWindows},deviceType:{isDesktop:Dt.isDesktop,isiPad:Dt.isiPad,isiPhone:Dt.isiPhone,isPhone:Dt.isPhone,isTablet:Dt.isTablet,isTouch:Dt.isTouch,isWebView:Dt.isWebView}},Nt=/^\s*|\s*$/g,Rt=e=>x(e)?"":(""+e).replace(Nt,""),Bt=function(e,t,o,n){n=n||this,e&&(o&&(e=e[o]),Me(e,((e,r)=>!1!==t.call(n,e,r,o)&&(Bt(e,t,o,n),!0))))},Lt={trim:Rt,isArray:Ae,is:(e,t)=>t?!("array"!==t||!Ae(e))||typeof e===t:void 0!==e,toArray:e=>{if(Ae(e))return e;{const t=[];for(let o=0,n=e.length;o{const n=h(e)?e.split(t||","):e||[];let r=n.length;for(;r--;)o[n[r]]={};return o},each:Me,map:Ne,grep:Re,inArray:(e,t)=>{if(e)for(let o=0,n=e.length;o{for(let o=0;o{const o=e.split(".");for(let e=0,n=o.length;ev(e)?e:""===e?[]:Ne(e.split(t||","),Rt),_addCacheSuffix:e=>{const t=Mt.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Ht=(e,t,o=M)=>e.exists((e=>o(e,t))),It=(e,t,o=M)=>Pt(e,t,o).getOr(e.isNone()&&t.isNone()),Pt=(e,t,o)=>e.isSome()&&t.isSome()?F.some(o(e.getOrDie(),t.getOrDie())):F.none(),Ft=(e,t)=>e?F.some(t):F.none(),zt="undefined"!=typeof window?window:Function("return this;")(),Vt=(e,t)=>((e,t)=>{let o=null!=t?t:zt;for(let t=0;t{const o=((e,t)=>Vt(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},Ut=Object.getPrototypeOf,jt=e=>{const t=Vt("ownerDocument.defaultView",e);return p(e)&&((e=>Zt("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Ut(e).constructor.name))},Wt=e=>e.dom.nodeName.toLowerCase(),$t=e=>e.dom.nodeType,qt=e=>t=>$t(t)===e,Gt=e=>Kt(e)&&jt(e.dom),Kt=qt(1),Yt=qt(3),Xt=qt(9),Jt=qt(11),Qt=e=>t=>Kt(t)&&Wt(t)===e,eo=(e,t,o)=>{if(!(h(o)||y(o)||k(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},to=(e,t,o)=>{eo(e.dom,t,o)},oo=(e,t)=>{const o=e.dom;ve(t,((e,t)=>{eo(o,t,e)}))},no=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},ro=(e,t)=>F.from(no(e,t)),so=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},ao=(e,t)=>{e.dom.removeAttribute(t)},io=e=>J(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),lo=(e,t)=>{const o=no(e,t);return void 0===o||""===o?[]:o.split(" ")},co=e=>void 0!==e.dom.classList,mo=e=>lo(e,"class"),uo=(e,t)=>((e,t,o)=>{const n=lo(e,t).concat([o]);return to(e,t,n.join(" ")),!0})(e,"class",t),go=(e,t)=>((e,t,o)=>{const n=Y(lo(e,t),(e=>e!==o));return n.length>0?to(e,t,n.join(" ")):ao(e,t),!1})(e,"class",t),ho=(e,t)=>{co(e)?e.dom.classList.add(t):uo(e,t)},po=e=>{0===(co(e)?e.dom.classList:mo(e)).length&&ao(e,"class")},fo=(e,t)=>{co(e)?e.dom.classList.remove(t):go(e,t),po(e)},vo=(e,t)=>{const o=co(e)?e.dom.classList.toggle(t):((e,t)=>j(mo(e),t)?go(e,t):uo(e,t))(e,t);return po(e),o},bo=(e,t)=>co(e)&&e.dom.classList.contains(t),yo=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},wo={fromHtml:(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 yo(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return yo(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return yo(o)},fromDom:yo,fromPoint:(e,t,o)=>F.from(e.dom.elementFromPoint(t,o)).map(yo)},xo=(e,t)=>{const o=[],n=e=>(o.push(e),t(e));let r=t(e);do{r=r.bind(n)}while(r.isSome());return o},Co=(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")}},So=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,ko=(e,t)=>e.dom===t.dom,_o=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Eo=e=>wo.fromDom(e.dom.ownerDocument),To=e=>Xt(e)?e:Eo(e),Oo=e=>wo.fromDom(To(e).dom.defaultView),Do=e=>F.from(e.dom.parentNode).map(wo.fromDom),Ao=e=>F.from(e.dom.parentElement).map(wo.fromDom),Mo=(e,t)=>{const o=S(t)?t:I;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=wo.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},No=e=>F.from(e.dom.previousSibling).map(wo.fromDom),Ro=e=>F.from(e.dom.nextSibling).map(wo.fromDom),Bo=e=>se(xo(e,No)),Lo=e=>xo(e,Ro),Ho=e=>$(e.dom.childNodes,wo.fromDom),Io=(e,t)=>{const o=e.dom.childNodes;return F.from(o[t]).map(wo.fromDom)},Po=e=>Io(e,0),Fo=e=>Io(e,e.dom.childNodes.length-1),zo=e=>e.dom.childNodes.length,Vo=e=>Jt(e)&&C(e.dom.host),Zo=S(Element.prototype.attachShadow)&&S(Node.prototype.getRootNode),Uo=D(Zo),jo=Zo?e=>wo.fromDom(e.dom.getRootNode()):To,Wo=e=>Vo(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return wo.fromDom(t)})(To(e)),$o=e=>wo.fromDom(e.dom.host),qo=e=>{if(Uo()&&C(e.target)){const t=wo.fromDom(e.target);if(Kt(t)&&Go(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return de(t)}}return F.from(e.target)},Go=e=>C(e.dom.shadowRoot),Ko=e=>{const t=Yt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=jo(e);return Vo(t)?F.some(t):F.none()})(wo.fromDom(t)).fold((()=>o.body.contains(t)),O(Ko,$o))};var Yo=(e,t,o,n,r)=>e(o,n)?F.some(o):S(r)&&r(o)?F.none():t(o,n,r);const Xo=(e,t,o)=>{let n=e.dom;const r=S(o)?o:I;for(;n.parentNode;){n=n.parentNode;const e=wo.fromDom(n);if(t(e))return F.some(e);if(r(e))break}return F.none()},Jo=(e,t,o)=>Yo(((e,t)=>t(e)),Xo,e,t,o),Qo=(e,t)=>ee(e.dom.childNodes,(e=>t(wo.fromDom(e)))).map(wo.fromDom),en=(e,t)=>{const o=e=>{for(let n=0;nXo(e,(e=>Co(e,t)),o),on=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return So(o)?F.none():F.from(o.querySelector(e)).map(wo.fromDom)})(t,e),nn=(e,t,o)=>Yo(((e,t)=>Co(e,t)),tn,e,t,o),rn=(e,t=!1)=>{return Ko(e)?e.dom.isContentEditable:(o=e,nn(o,"[contenteditable]")).fold(D(t),(e=>"true"===sn(e)));var o},sn=e=>e.dom.contentEditable,an=e=>void 0!==e.style&&S(e.style.getPropertyValue),ln=(e,t,o)=>{if(!h(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);an(e)&&e.style.setProperty(t,o)},cn=(e,t,o)=>{const n=e.dom;ln(n,t,o)},dn=(e,t)=>{const o=e.dom;ve(t,((e,t)=>{ln(o,t,e)}))},mn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Ko(e)?n:un(o,t)},un=(e,t)=>an(e)?e.style.getPropertyValue(t):"",gn=(e,t)=>{const o=e.dom,n=un(o,t);return F.from(n).filter((e=>e.length>0))},hn=e=>{const t={},o=e.dom;if(an(o))for(let e=0;e{((e,t)=>{an(e)&&e.style.removeProperty(t)})(e.dom,t),Ht(ro(e,"style").map(Ge),"")&&ao(e,"style")},fn=(e,t)=>{Do(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},vn=(e,t)=>{Ro(e).fold((()=>{Do(e).each((e=>{yn(e,t)}))}),(e=>{fn(e,t)}))},bn=(e,t)=>{Po(e).fold((()=>{yn(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},yn=(e,t)=>{e.dom.appendChild(t.dom)},wn=(e,t)=>{fn(e,t),yn(t,e)},xn=(e,t)=>{q(t,(t=>{yn(e,t)}))},Cn=e=>{e.dom.textContent="",q(Ho(e),(e=>{Sn(e)}))},Sn=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},kn=e=>{const t=Ho(e);var o,n;t.length>0&&(o=e,q(n=t,((e,t)=>{const r=0===t?o:n[t-1];vn(r,e)}))),Sn(e)},_n=e=>$(e,wo.fromDom),En=e=>e.dom.innerHTML,Tn=(e,t)=>{const o=Eo(e).dom,n=wo.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Ho(wo.fromDom(o))})(t,o);xn(n,r),Cn(e),yn(e,n)},On=(e,t)=>o=>{e(o)&&t((e=>{const t=wo.fromDom(qo(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=T(n,o);return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)})(o))},Dn=(e,t,o,n)=>((e,t,o,n,r)=>{const s=On(o,n);return e.dom.addEventListener(t,s,r),{unbind:N(An,e,t,s,r)}})(e,t,o,n,!1),An=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Mn=(e,t)=>({left:e,top:t,translate:(o,n)=>Mn(e+o,t+n)}),Nn=Mn,Rn=(e,t)=>void 0!==e?e:void 0!==t?t:0,Bn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Nn(o.offsetLeft,o.offsetTop):Ko(e)?(e=>{const t=e.getBoundingClientRect();return Nn(t.left,t.top)})(t):Nn(0,0)},Ln=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Nn(o,n)},Hn=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},In=(e,t)=>{kt().browser.isSafari()&&S(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},Pn=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Fn=e=>{const t=void 0===e?window:e,o=t.document,n=Ln(wo.fromDom(o));return(e=>{const t=void 0===e?window:e;return kt().browser.isFirefox()?F.none():F.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Pn(n.left,n.top,o,r)}),(e=>Pn(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},zn=(e,t)=>{let o=[];return q(Ho(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(zn(e,t))})),o},Vn=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return So(o)?[]:$(o.querySelectorAll(e),wo.fromDom)})(t,e),Zn=(e,t,o)=>Xo(e,t,o).isSome(),Un=(e,t)=>((e,t)=>{const o=e.dom;return o.parentNode?Qo(wo.fromDom(o.parentNode),(o=>!ko(e,o)&&t(o))):F.none()})(e,t).isSome(),jn=(e,t)=>en(e,t).isSome();class Wn{constructor(e,t){this.node=e,this.rootNode=t,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(e){return this.node=this.findSibling(this.node,"firstChild","nextSibling",e),this.node}prev(e){return this.node=this.findSibling(this.node,"lastChild","previousSibling",e),this.node}prev2(e){return this.node=this.findPreviousNode(this.node,e),this.node}findSibling(e,t,o,n){if(e){if(!n&&e[t])return e[t];if(e!==this.rootNode){let t=e[o];if(t)return t;for(let n=e.parentNode;n&&n!==this.rootNode;n=n.parentNode)if(t=n[o],t)return t}}}findPreviousNode(e,t){if(e){const o=e.previousSibling;if(this.rootNode&&o===this.rootNode)return;if(o){if(!t)for(let e=o.lastChild;e;e=e.lastChild)if(!e.lastChild)return e;return o}const n=e.parentNode;if(n&&n!==this.rootNode)return n}}}const $n="\ufeff",qn=" ",Gn=e=>e===$n,Kn=/^[ \t\r\n]*$/,Yn=e=>Kn.test(e),Xn=e=>"\n"===e||"\r"===e,Jn=(e,t=4,o=!0,n=!0)=>{const r=((e,t)=>t<=0?"":new Array(t+1).join(e))(" ",t),s=e.replace(/\t/g,r),a=J(s,((e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||t===qn?e.pcIsSpace||""===e.str&&o||e.str.length===s.length-1&&n||((e,t)=>t=0&&Xn(e[t]))(s,e.str.length+1)?{pcIsSpace:!1,str:e.str+qn}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:Xn(t),str:e.str+t}),{pcIsSpace:!1,str:""});return a.str},Qn=e=>t=>!!t&&t.nodeType===e,er=e=>!!e&&!Object.getPrototypeOf(e),tr=Qn(1),or=e=>tr(e)&&Gt(wo.fromDom(e)),nr=e=>{const t=e.toLowerCase();return e=>C(e)&&e.nodeName.toLowerCase()===t},rr=e=>{const t=e.map((e=>e.toLowerCase()));return e=>{if(e&&e.nodeName){const o=e.nodeName.toLowerCase();return j(t,o)}return!1}},sr=(e,t)=>{const o=t.toLowerCase().split(" ");return t=>{if(tr(t)){const n=t.ownerDocument.defaultView;if(n)for(let r=0;rtr(e)&&e.hasAttribute("data-mce-bogus"),ir=e=>tr(e)&&"TABLE"===e.tagName,lr=e=>t=>{if(or(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},cr=rr(["textarea","input"]),dr=Qn(3),mr=Qn(4),ur=Qn(7),gr=Qn(8),hr=Qn(9),pr=Qn(11),fr=nr("br"),vr=nr("img"),br=lr("true"),yr=lr("false"),wr=rr(["td","th"]),xr=rr(["td","th","caption"]),Cr=rr(["video","audio","object","embed"]),Sr=nr("li"),kr=nr("details"),_r=nr("summary"),Er={skipBogus:!0,includeZwsp:!1,checkRootAsContent:!1},Tr=(Or="data-mce-bookmark",e=>tr(e)&&e.hasAttribute(Or));var Or;const Dr=(e,t,o)=>Yn(e.data)&&!((e,t,o)=>{const n=wo.fromDom(t),r=wo.fromDom(e),s=o.getWhitespaceElements();return Zn(r,(e=>Ee(s,Wt(e))),N(ko,n))})(e,t,o),Ar=(e,t,o,n)=>dr(e)&&!Dr(e,t,o)&&(!n.includeZwsp||!(e=>{for(const t of e)if(!Gn(t))return!1;return!0})(e.data)),Mr=(e,t,o,n)=>S(n.isContent)&&n.isContent(t)||((e,t)=>tr(e)&&Ee(t.getNonEmptyElements(),e.nodeName))(t,e)||Tr(t)||(e=>tr(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(t)||Ar(t,o,e,n)||yr(t)||br(t)&&(e=>Ao(wo.fromDom(e)).exists((e=>!rn(e))))(t),Nr=(e,t,o)=>{const n={...Er,...o};if(n.checkRootAsContent&&Mr(e,t,t,n))return!1;let r=t.firstChild,s=0;if(!r)return!0;const a=new Wn(r,t);do{if(n.skipBogus&&tr(r)){const e=r.getAttribute("data-mce-bogus");if(e){r=a.next("all"===e);continue}}if(gr(r))r=a.next(!0);else if(fr(r))s++,r=a.next();else{if(Mr(e,r,t,n))return!1;r=a.next()}}while(r);return s<=1},Rr=(e,t,o)=>Nr(e,t.dom,{checkRootAsContent:!0,...o}),Br=(e,t,o)=>Mr(e,t,t,{includeZwsp:Er.includeZwsp,...o}),Lr=e=>"svg"===e.toLowerCase(),Hr=e=>Lr(e.nodeName),Ir=e=>"svg"===(null==e?void 0:e.nodeName)?"svg":"html",Pr=["svg"],Fr="data-mce-block",zr=e=>$((e=>Y(pe(e),(e=>!/[A-Z]/.test(e))))(e),(e=>`${e}:`+$(Pr,(t=>`not(${t} ${e})`)).join(":"))).join(","),Vr=(e,t)=>C(t.querySelector(e))?(t.setAttribute(Fr,"true"),"inline-boundary"===t.getAttribute("data-mce-selected")&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(Fr),!1),Zr=(e,t)=>{const o=zr(e.getTransparentElements()),n=zr(e.getBlockElements());return Y(t.querySelectorAll(o),(e=>Vr(n,e)))},Ur=(e,t,o)=>{var n;const r=o?"lastChild":"firstChild";for(let o=t[r];o;o=o[r])if(Nr(e,o,{checkRootAsContent:!0}))return void(null===(n=o.parentNode)||void 0===n||n.removeChild(o))},jr=(e,t,o)=>{const n=e.getBlockElements(),r=wo.fromDom(t),s=e=>Wt(e)in n,a=e=>ko(e,r);q(_n(o),(t=>{Xo(t,s,a).each((o=>{const n=((e,t)=>Y(Ho(e),t))(t,(t=>s(t)&&!e.isValidChild(Wt(o),Wt(t))));if(n.length>0){const t=Ao(o);q(n,(t=>{Xo(t,s,a).each((o=>{((e,t,o)=>{const n=document.createRange(),r=t.parentNode;if(r){n.setStartBefore(t),n.setEndBefore(o);const s=n.extractContents();Ur(e,s,!0),n.setStartAfter(o),n.setEndAfter(t);const a=n.extractContents();Ur(e,a,!1),Nr(e,s,{checkRootAsContent:!0})||r.insertBefore(s,t),Nr(e,o,{checkRootAsContent:!0})||r.insertBefore(o,t),Nr(e,a,{checkRootAsContent:!0})||r.insertBefore(a,t),r.removeChild(t)}})(e,o.dom,t.dom)}))})),t.each((t=>Zr(e,t.dom)))}}))}))},Wr=(e,t)=>{const o=Zr(e,t);jr(e,t,o),((e,t,o)=>{q([...o,...Yr(e,t)?[t]:[]],(t=>q(Vn(wo.fromDom(t),t.nodeName.toLowerCase()),(t=>{Xr(e,t.dom)&&kn(t)}))))})(e,t,o)},$r=(e,t)=>{if(Kr(e,t)){const o=zr(e.getBlockElements());Vr(o,t)}},qr=e=>e.hasAttribute(Fr),Gr=(e,t)=>Ee(e.getTransparentElements(),t),Kr=(e,t)=>tr(t)&&Gr(e,t.nodeName),Yr=(e,t)=>Kr(e,t)&&qr(t),Xr=(e,t)=>Kr(e,t)&&!qr(t),Jr=(e,t)=>1===t.type&&Gr(e,t.name)&&h(t.attr(Fr)),Qr=kt().browser,es=e=>ee(e,Kt),ts=(e,t)=>e.children&&j(e.children,t),os=(e,t,o)=>{let n=0,r=0;const s=e.ownerDocument;if(o=o||e,t){if(o===e&&t.getBoundingClientRect&&"static"===mn(wo.fromDom(e),"position")){const o=t.getBoundingClientRect();return n=o.left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentElement.clientLeft,r=o.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop,{x:n,y:r}}let a=t;for(;a&&a!==o&&a.nodeType&&!ts(a,o);){const e=a;n+=e.offsetLeft||0,r+=e.offsetTop||0,a=e.offsetParent}for(a=t.parentNode;a&&a!==o&&a.nodeType&&!ts(a,o);)n-=a.scrollLeft||0,r-=a.scrollTop||0,a=a.parentNode;r+=(e=>Qr.isFirefox()&&"table"===Wt(e)?es(Ho(e)).filter((e=>"caption"===Wt(e))).bind((e=>es(Lo(e)).map((t=>{const o=t.dom.offsetTop,n=e.dom.offsetTop,r=e.dom.offsetHeight;return o<=n?-r:0})))).getOr(0):0)(wo.fromDom(t))}return{x:n,y:r}},ns=(e,t={})=>{let o=0;const n={},r=wo.fromDom(e),s=To(r),a=e=>{yn(Wo(r),e)},i=e=>{const t=Wo(r);on(t,"#"+e).each(Sn)},l=e=>_e(n,e).getOrThunk((()=>({id:"mce-u"+o++,passed:[],failed:[],count:0}))),c=e=>new Promise(((o,r)=>{let i;const c=Lt._addCacheSuffix(e),d=l(c);n[c]=d,d.count++;const m=(e,t)=>{q(e,H),d.status=t,d.passed=[],d.failed=[],i&&(i.onload=null,i.onerror=null,i=null)},u=()=>m(d.passed,2),g=()=>m(d.failed,3);if(o&&d.passed.push(o),r&&d.failed.push(r),1===d.status)return;if(2===d.status)return void u();if(3===d.status)return void g();d.status=1;const h=wo.fromTag("link",s.dom);oo(h,{rel:"stylesheet",type:"text/css",id:d.id}),t.contentCssCors&&to(h,"crossOrigin","anonymous"),t.referrerPolicy&&to(h,"referrerpolicy",t.referrerPolicy),i=h.dom,i.onload=u,i.onerror=g,a(h),to(h,"href",c)})),d=e=>{const t=Lt._addCacheSuffix(e);_e(n,t).each((e=>{0==--e.count&&(delete n[t],i(e.id))}))};return{load:c,loadRawCss:(e,t)=>{const o=l(e);n[e]=o,o.count++;const r=wo.fromTag("style",s.dom);oo(r,{rel:"stylesheet",type:"text/css",id:o.id}),r.dom.innerHTML=t,a(r)},loadAll:e=>Promise.allSettled($(e,(e=>c(e).then(D(e))))).then((e=>{const t=K(e,(e=>"fulfilled"===e.status));return t.fail.length>0?Promise.reject($(t.fail,(e=>e.reason))):$(t.pass,(e=>e.value))})),unload:d,unloadRawCss:e=>{_e(n,e).each((t=>{0==--t.count&&(delete n[e],i(t.id))}))},unloadAll:e=>{q(e,(e=>{d(e)}))},_setReferrerPolicy:e=>{t.referrerPolicy=e},_setContentCssCors:e=>{t.contentCssCors=e}}},rs=(()=>{const e=new WeakMap;return{forElement:(t,o)=>{const n=jo(t).dom;return F.from(e.get(n)).getOrThunk((()=>{const t=ns(n,o);return e.set(n,t),t}))}}})(),ss=(e,t)=>C(e)&&(Br(t,e)||t.isInline(e.nodeName.toLowerCase())),as=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),is=(e,t,o)=>dr(e)&&e.data.length>0&&((e,t,o)=>{const n=new Wn(e,t).prev(!1),r=new Wn(e,t).next(!1),s=w(n)||ss(n,o),a=w(r)||ss(r,o);return s&&a})(e,t,o),ls=(e,t,o,n)=>{var r;const s=n||t;if(tr(t)&&as(t))return t;const a=t.childNodes;for(let t=a.length-1;t>=0;t--)ls(e,a[t],o,s);if(tr(t)){const e=t.childNodes;1===e.length&&as(e[0])&&(null===(r=t.parentNode)||void 0===r||r.insertBefore(e[0],t))}return(e=>pr(e)||hr(e))(t)||Br(o,t)||(e=>!!tr(e)&&e.childNodes.length>0)(t)||is(t,s,o)||e.remove(t),t},cs=Lt.makeMap,ds=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ms=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,us=/[<>&\"\']/g,gs=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,hs={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},ps={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},fs={"<":"<",">":">","&":"&",""":'"',"'":"'"},vs=(e,t)=>{const o={};if(e){const n=e.split(",");t=t||10;for(let e=0;ee.replace(t?ds:ms,(e=>ps[e]||e)),ws=(e,t)=>e.replace(t?ds:ms,(e=>e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":ps[e]||"&#"+e.charCodeAt(0)+";")),xs=(e,t,o)=>{const n=o||bs;return e.replace(t?ds:ms,(e=>ps[e]||n[e]||e))},Cs={encodeRaw:ys,encodeAllRaw:e=>(""+e).replace(us,(e=>ps[e]||e)),encodeNumeric:ws,encodeNamed:xs,getEncodeFunc:(e,t)=>{const o=vs(t)||bs,n=(e,t)=>e.replace(t?ds:ms,(e=>void 0!==ps[e]?ps[e]:void 0!==o[e]?o[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";")),r=(e,t)=>xs(e,t,o),s=cs(e.replace(/\+/g,","));return s.named&&s.numeric?n:s.named?t?r:xs:s.numeric?ws:ys},decode:e=>e.replace(gs,((e,t)=>t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):hs[t]||String.fromCharCode(t):fs[e]||bs[e]||(e=>{const t=wo.fromTag("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e)))},Ss=(e,t)=>(e=Lt.trim(e))?e.split(t||" "):[],ks=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),_s=e=>{const t=e=>v(e)?$(e,t):(e=>p(e)&&e.source&&"[object RegExp]"===Object.prototype.toString.call(e))(e)?new RegExp(e.source,e.flags):p(e)?be(e,t):e;return t(e)},Es=e=>Object.freeze(["id","accesskey","class","dir","lang","style","tabindex","title","role",..."html4"!==e?["contenteditable","contextmenu","draggable","dropzone","hidden","spellcheck","translate"]:[],..."html5-strict"!==e?["xml:lang"]:[]]),Ts=e=>{let t,o;t="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",o="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(t+=" article aside details dialog figure main header footer hgroup section nav a ins del canvas map",o+=" audio canvas command data datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),"html5-strict"!==e&&(o=[o,"acronym applet basefont big font strike tt"].join(" "),t=[t,"center dir isindex noframes"].join(" "));const n=[t,o].join(" ");return{blockContent:t,phrasingContent:o,flowContent:n}},Os=e=>{const{blockContent:t,phrasingContent:o,flowContent:n}=Ts(e),r=e=>Object.freeze(e.split(" "));return Object.freeze({blockContent:r(t),phrasingContent:r(o),flowContent:r(n)})},Ds={html4:Ie((()=>Os("html4"))),html5:Ie((()=>Os("html5"))),"html5-strict":Ie((()=>Os("html5-strict")))},As=(e,t)=>{const{blockContent:o,phrasingContent:n,flowContent:r}=Ds[e]();return"blocks"===t?F.some(o):"phrasing"===t?F.some(n):"flow"===t?F.some(r):F.none()},Ms=e=>F.from(/^(@?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)$/.exec(e)).map((e=>({preset:"@"===e[1],name:e[2]}))),Ns=(e,t)=>{const o=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return ne(Ss(t,","),(t=>{const n=o.exec(t);if(n){const t=n[1],o=n[2],r=n[3],s=n[4],a=n[5],i={attributes:{},attributesOrder:[]};if(e.each((e=>((e,t)=>{ve(e.attributes,((e,o)=>{t.attributes[o]=e})),t.attributesOrder.push(...e.attributesOrder)})(e,i))),"#"===t?i.paddEmpty=!0:"-"===t&&(i.removeEmpty=!0),"!"===s&&(i.removeEmptyAttrs=!0),a&&((e,t)=>{const o=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,n=/[*?+]/,{attributes:r,attributesOrder:s}=t;q(Ss(e,"|"),(e=>{const a=o.exec(e);if(a){const e={},o=a[1],i=a[2].replace(/[\\:]:/g,":"),l=a[3],c=a[4];if("!"===o&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(i),e.required=!0),"-"===o)return delete r[i],void s.splice(Lt.inArray(s,i),1);if(l&&("="===l?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:i,value:c}),e.defaultValue=c):"~"===l?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:i,value:c}),e.forcedValue=c):"<"===l&&(e.validValues=Lt.makeMap(c,"?"))),n.test(i)){const o=e;t.attributePatterns=t.attributePatterns||[],o.pattern=ks(i),t.attributePatterns.push(o)}else r[i]||s.push(i),r[i]=e}}))})(a,i),r&&(i.outputName=o),"@"===o){if(!e.isNone())return[];e=F.some(i)}return[r?{name:o,element:i,aliasName:r}:{name:o,element:i}]}return[]}))},Rs={},Bs=Lt.makeMap,Ls=Lt.each,Hs=Lt.extend,Is=Lt.explode,Ps=(e,t={})=>{const o=Bs(e," ",Bs(e.toUpperCase()," "));return Hs(o,t)},Fs=e=>Ps("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),zs=(e,t)=>{if(e){const o={};return h(e)&&(e={"*":e}),Ls(e,((e,n)=>{o[n]=o[n.toUpperCase()]="map"===t?Bs(e,/[, ]/):Is(e,/[, ]/)})),o}},Vs=(e={})=>{var t;const o={},n={};let r=[];const s={},a={},i=(t,o,n)=>{const r=e[t];if(r)return Bs(r,/[, ]/,Bs(r.toUpperCase(),/[, ]/));{let e=Rs[t];return e||(e=Ps(o,n),Rs[t]=e),e}},l=null!==(t=e.schema)&&void 0!==t?t:"html5",c=(e=>{const t=Es(e),{phrasingContent:o,flowContent:n}=Ts(e),r={},s=(e,t,o)=>{r[e]={attributes:ie(t,D({})),attributesOrder:t,children:ie(o,D({}))}},a=(e,o="",n="")=>{const r=Ss(n),a=Ss(e);let i=a.length;const l=[...t,...Ss(o)];for(;i--;)s(a[i],l.slice(),r)},i=(e,t)=>{const o=Ss(e),n=Ss(t);let s=o.length;for(;s--;){const e=r[o[s]];for(let t=0,o=n.length;t{a(e,"",o)})),q(Ss("center dir isindex noframes"),(e=>{a(e,"",n)}))),a("html","manifest","head body"),a("head","","base command link meta noscript script style title"),a("title hr noscript br"),a("base","href target"),a("link","href rel media hreflang type sizes hreflang"),a("meta","name http-equiv content charset"),a("style","media type scoped"),a("script","src async defer type charset"),a("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",n),a("dd div","",n),a("address dt caption","","html4"===e?o:n),a("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",o),a("blockquote","cite",n),a("ol","reversed start type","li"),a("ul","","li"),a("li","value",n),a("dl","","dt dd"),a("a","href target rel media hreflang type","html4"===e?o:n),a("q","cite",o),a("ins del","cite datetime",n),a("img","src sizes srcset alt usemap ismap width height"),a("iframe","src name width height",n),a("embed","src type width height"),a("object","data type typemustmatch name usemap form width height",[n,"param"].join(" ")),a("param","name value"),a("map","name",[n,"area"].join(" ")),a("area","alt coords shape href target rel media hreflang type"),a("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),a("colgroup","span","col"),a("col","span"),a("tbody thead tfoot","","tr"),a("tr","","td th"),a("td","colspan rowspan headers",n),a("th","colspan rowspan headers scope abbr",n),a("form","accept-charset action autocomplete enctype method name novalidate target",n),a("fieldset","disabled form name",[n,"legend"].join(" ")),a("label","form for",o),a("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),a("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?n:o),a("select","disabled form multiple name required size","option optgroup"),a("optgroup","disabled label","option"),a("option","disabled label selected value"),a("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),a("menu","type label",[n,"li"].join(" ")),a("noscript","",n),"html4"!==e&&(a("wbr"),a("ruby","",[o,"rt rp"].join(" ")),a("figcaption","",n),a("mark rt rp bdi","",o),a("summary","",[o,"h1 h2 h3 h4 h5 h6"].join(" ")),a("canvas","width height",n),a("data","value",o),a("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[n,"track source"].join(" ")),a("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[n,"track source"].join(" ")),a("picture","","img source"),a("source","src srcset type media sizes"),a("track","kind src srclang label default"),a("datalist","",[o,"option"].join(" ")),a("article section nav aside main header footer","",n),a("hgroup","","h1 h2 h3 h4 h5 h6"),a("figure","",[n,"figcaption"].join(" ")),a("time","datetime",o),a("dialog","open",n),a("command","type label icon disabled checked radiogroup command"),a("output","for form name",o),a("progress","value max",o),a("meter","value min max low high optimum",o),a("details","open",[n,"summary"].join(" ")),a("keygen","autofocus challenge disabled form keytype name"),s("svg","id tabindex lang xml:space class style x y width height viewBox preserveAspectRatio zoomAndPan transform".split(" "),[])),"html5-strict"!==e&&(i("script","language xml:space"),i("style","xml:space"),i("object","declare classid code codebase codetype archive standby align border hspace vspace"),i("embed","align name hspace vspace"),i("param","valuetype type"),i("a","charset name rev shape coords"),i("br","clear"),i("applet","codebase archive code object alt name width height align hspace vspace"),i("img","name longdesc align border hspace vspace"),i("iframe","longdesc frameborder marginwidth marginheight scrolling align"),i("font basefont","size color face"),i("input","usemap align"),i("select"),i("textarea"),i("h1 h2 h3 h4 h5 h6 div p legend caption","align"),i("ul","type compact"),i("li","type"),i("ol dl menu dir","compact"),i("pre","width xml:space"),i("hr","align noshade size width"),i("isindex","prompt"),i("table","summary width frame rules cellspacing cellpadding align bgcolor"),i("col","width align char charoff valign"),i("colgroup","width align char charoff valign"),i("thead","align char charoff valign"),i("tr","align char charoff valign bgcolor"),i("th","axis align char charoff valign nowrap bgcolor width height"),i("form","accept"),i("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),i("tfoot","align char charoff valign"),i("tbody","align char charoff valign"),i("area","nohref"),i("body","background bgcolor text link vlink alink")),"html4"!==e&&(i("input button select textarea","autofocus"),i("input textarea","placeholder"),i("a","download"),i("link script img","crossorigin"),i("img","loading"),i("iframe","sandbox seamless allow allowfullscreen loading")),"html4"!==e&&q([r.video,r.audio],(e=>{delete e.children.audio,delete e.children.video})),q(Ss("a form meter progress dfn"),(e=>{r[e]&&delete r[e].children[e]})),delete r.caption.children.table,delete r.script,r})(l);!1===e.verify_html&&(e.valid_elements="*[*]");const d=zs(e.valid_styles),m=zs(e.invalid_styles,"map"),u=zs(e.valid_classes,"map"),g=i("whitespace_elements","pre script noscript style textarea video audio iframe object code"),f=i("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),b=i("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),w=i("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),x="td th iframe video audio object script code",C=i("non_empty_elements",x+" pre svg textarea summary",b),S=i("move_caret_before_on_enter_elements",x+" table",b),k="h1 h2 h3 h4 h5 h6",_=i("text_block_elements",k+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),E=i("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary html body multicol listing",_),T=i("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),O=i("transparent_elements","a ins del canvas map"),A=i("wrap_block_elements","pre "+k);Ls("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),(e=>{a[e]=new RegExp("]*>","gi")}));const M=e=>{const t=F.from(o["@"]),n=/[*?+]/;q(Ns(t,null!=e?e:""),(({name:e,element:t,aliasName:s})=>{if(s&&(o[s]=t),n.test(e)){const o=t;o.pattern=ks(e),r.push(o)}else o[e]=t}))},N=e=>{r=[],q(pe(o),(e=>{delete o[e]})),M(e)},R=(e,t)=>{var r,a;delete Rs.text_block_elements,delete Rs.block_elements;const i=!!t.extends&&!oe(t.extends),c=t.extends;if(n[e]=c?n[c]:{},s[e]=null!=c?c:e,C[e.toUpperCase()]={},C[e]={},i||(E[e.toUpperCase()]={},E[e]={}),c&&!o[e]&&o[c]){const t=_s(o[c]);delete t.removeEmptyAttrs,delete t.removeEmpty,o[e]=t}else o[e]={attributesOrder:[],attributes:{}};if(v(t.attributes)){const n=e=>{s.attributesOrder.push(e),s.attributes[e]={}},s=null!==(r=o[e])&&void 0!==r?r:{};delete s.attributesDefault,delete s.attributesForced,delete s.attributePatterns,delete s.attributesRequired,s.attributesOrder=[],s.attributes={},q(t.attributes,(e=>{const t=Es(l);Ms(e).each((({preset:e,name:o})=>{e?"global"===o&&q(t,n):n(o)}))})),o[e]=s}if(y(t.padEmpty)){const n=null!==(a=o[e])&&void 0!==a?a:{};n.paddEmpty=t.padEmpty,o[e]=n}if(v(t.children)){const o={},r=e=>{o[e]={}},s=e=>{As(l,e).each((e=>{q(e,r)}))};q(t.children,(e=>{Ms(e).each((({preset:e,name:t})=>{e?s(t):r(t)}))})),n[e]=o}c&&ve(n,((t,o)=>{t[c]&&(n[o]=t=Hs({},n[o]),t[e]=t[c])}))},B=e=>{q((e=>{const t=/^(~)?(.+)$/;return ne(Ss(e,","),(e=>{const o=t.exec(e);return o?[{cloneName:"~"===o[1]?"span":"div",name:o[2]}]:[]}))})(null!=e?e:""),(({name:e,cloneName:t})=>{R(e,{extends:t})}))},L=e=>{p(e)?ve(e,((e,t)=>R(t,e))):h(e)&&B(e)},H=e=>{q((e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;return ne(Ss(e,","),(e=>{const o=t.exec(e);if(o){const e=o[1],t=e?(e=>"-"===e?"remove":"add")(e):"replace";return[{operation:t,name:o[2],validChildren:ne(Ss(o[3],"|"),(e=>Ms(e).toArray()))}]}return[]}))})(null!=e?e:""),(({operation:e,name:t,validChildren:o})=>{const r="replace"===e?{"#comment":{}}:n[t],s=t=>{"remove"===e?delete r[t]:r[t]={}};q(o,(({preset:e,name:t})=>{e?(e=>{As(l,e).each((e=>{q(e,s)}))})(t):s(t)})),n[t]=r}))},I=e=>{const t=o[e];if(t)return t;let n=r.length;for(;n--;){const t=r[n];if(t.pattern.test(e))return t}},P=D(d),z=D(m),V=D(u),Z=D(w),U=D(E),j=D(_),W=D(T),$=D(Object.seal(b)),G=D(f),K=D(C),Y=D(S),X=D(g),J=D(O),Q=D(A),ee=D(Object.seal(a)),te=(e,t)=>{const o=I(e);if(o){if(!t)return!0;{if(o.attributes[t])return!0;const e=o.attributePatterns;if(e){let o=e.length;for(;o--;)if(e[o].pattern.test(t))return!0}}}return!1},oe=e=>Ee(U(),e),re=e=>!We(e,"#")&&te(e)&&!oe(e),se=D(s);return e.valid_elements?(N(e.valid_elements),Ls(c,((e,t)=>{n[t]=e.children}))):(Ls(c,((e,t)=>{o[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},n[t]=e.children})),Ls(Ss("strong/b em/i"),(e=>{const t=Ss(e,"/");o[t[1]].outputName=t[0]})),Ls(T,((t,n)=>{o[n]&&(e.padd_empty_block_inline_children&&(o[n].paddInEmptyBlock=!0),o[n].removeEmpty=!0)})),Ls(Ss("ol ul blockquote a table tbody"),(e=>{o[e]&&(o[e].removeEmpty=!0)})),Ls(Ss("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),(e=>{o[e]&&(o[e].paddEmpty=!0)})),Ls(Ss("span"),(e=>{o[e].removeEmptyAttrs=!0}))),delete o.svg,L(e.custom_elements),H(e.valid_children),M(e.extended_valid_elements),H("+ol[ul|ol],+ul[ul|ol]"),Ls({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},((e,t)=>{o[t]&&(o[t].parentsRequired=Ss(e))})),e.invalid_elements&&Ls(Is(e.invalid_elements),(e=>{o[e]&&delete o[e]})),I("span")||M("span[!data-mce-type|*]"),{type:l,children:n,elements:o,getValidStyles:P,getValidClasses:V,getBlockElements:U,getInvalidStyles:z,getVoidElements:$,getTextBlockElements:j,getTextInlineElements:W,getBoolAttrs:Z,getElementRule:I,getSelfClosingElements:G,getNonEmptyElements:K,getMoveCaretBeforeOnEnterElements:Y,getWhitespaceElements:X,getTransparentElements:J,getSpecialElements:ee,isValidChild:(e,t)=>{const o=n[e.toLowerCase()];return!(!o||!o[t.toLowerCase()])},isValid:te,isBlock:oe,isInline:re,isWrapper:e=>Ee(Q(),e)||re(e),getCustomElements:se,addValidElements:M,setValidElements:N,addCustomElements:L,addValidChildren:H}},Zs=e=>Ue(e,"#").toUpperCase(),Us=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},js=e=>(e=>({value:Zs(e)}))(Us(e.red)+Us(e.green)+Us(e.blue)),Ws=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,$s=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,qs=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),Gs=(e,t,o,n)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return qs(r,s,a,i)},Ks=e=>{if("transparent"===e)return F.some(qs(0,0,0,0));const t=Ws.exec(e);if(null!==t)return F.some(Gs(t[1],t[2],t[3],"1"));const o=$s.exec(e);return null!==o?F.some(Gs(o[1],o[2],o[3],o[4])):F.none()},Ys=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Xs=e=>Ks(e).map(js).map((e=>"#"+e.value)).getOr(e),Js=(e={},t)=>{const o=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,n=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/,s=/rgba *\(/i,a={};let i,l;const c=$n;t&&(i=t.getValidStyles(),l=t.getInvalidStyles());const d="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(let e=0;e{const i={};let l=!1;const d=e.url_converter,u=e.url_converter_scope||m,g=(e,t,o)=>{const n=i[e+"-top"+t];if(!n)return;const r=i[e+"-right"+t];if(!r)return;const s=i[e+"-bottom"+t];if(!s)return;const a=i[e+"-left"+t];if(!a)return;const l=[n,r,s,a];let c=l.length-1;for(;c--&&l[c]===l[c+1];);c>-1&&o||(i[e+t]=-1===c?l[0]:l.join(" "),delete i[e+"-top"+t],delete i[e+"-right"+t],delete i[e+"-bottom"+t],delete i[e+"-left"+t])},h=e=>{const t=i[e];if(!t)return;const o=t.indexOf(",")>-1?[t]:t.split(" ");let n=o.length;for(;n--;)if(o[n]!==o[0])return!1;return i[e]=o[0],!0},p=e=>(l=!0,a[e]),f=(e,t)=>(l&&(e=e.replace(/\uFEFF[0-9]/g,(e=>a[e]))),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),v=e=>String.fromCharCode(parseInt(e.slice(1),16)),b=e=>e.replace(/\\[0-9a-f]+/gi,v),y=(t,o,n,r,s,a)=>{if(s=s||a)return"'"+(s=f(s)).replace(/\'/g,"\\'")+"'";if(o=f(o||n||r||""),!e.allow_script_urls){const t=o.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(t))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(t))return""}return d&&(o=d.call(u,o,"style")),"url('"+o.replace(/\'/g,"\\'")+"')"};if(t){let a;for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,p).replace(/\"[^\"]+\"|\'[^\']+\'/g,(e=>e.replace(/[;:]/g,p)));a=n.exec(t);){n.lastIndex=a.index+a[0].length;let t=a[1].replace(r,"").toLowerCase(),d=a[2].replace(r,"");if(t&&d){if(t=b(t),d=b(d),-1!==t.indexOf(c)||-1!==t.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===t||/expression\s*\(|\/\*|\*\//.test(d)))continue;"font-weight"===t&&"700"===d?d="bold":"color"!==t&&"background-color"!==t||(d=d.toLowerCase()),s.test(d)||Ks(d).each((e=>{d=Xs(Ys(e)).toLowerCase()})),d=d.replace(o,y),i[t]=l?f(d,!0):d}}g("border","",!0),g("border","-width"),g("border","-color"),g("border","-style"),g("padding",""),g("margin",""),w="border",C="border-style",S="border-color",h(x="border-width")&&h(C)&&h(S)&&(i[w]=i[x]+" "+i[C]+" "+i[S],delete i[x],delete i[C],delete i[S]),"medium none"===i.border&&delete i.border,"none"===i["border-image"]&&delete i["border-image"]}var w,x,C,S;return i},serialize:(e,t)=>{let o="";const n=(t,n)=>{const r=n[t];if(r)for(let t=0,n=r.length;t0?" ":"")+n+": "+s+";")}};return t&&i?(n("*",i),n(t,i)):ve(e,((e,n)=>{e&&((e,t)=>{if(!l||!t)return!0;let o=l["*"];return!(o&&o[e]||(o=l[t],o&&o[e]))})(n,t)&&(o+=(o.length>0?" ":"")+n+": "+e+";")})),o}};return m},Qs={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},ea=e=>x(e.preventDefault)||(e=>e instanceof Event||S(e.initEvent))(e),ta=(e,t)=>{const o=null!=t?t:{};for(const t in e)Ee(Qs,t)||(o[t]=e[t]);return C(e.composedPath)&&(o.composedPath=()=>e.composedPath()),C(e.getModifierState)&&(o.getModifierState=t=>e.getModifierState(t)),C(e.getTargetRanges)&&(o.getTargetRanges=()=>e.getTargetRanges()),o},oa=(e,t,o,n)=>{var r;const s=ta(t,n);return s.type=e,x(s.target)&&(s.target=null!==(r=s.srcElement)&&void 0!==r?r:o),ea(t)&&(s.preventDefault=()=>{s.defaultPrevented=!0,s.isDefaultPrevented=P,S(t.preventDefault)&&t.preventDefault()},s.stopPropagation=()=>{s.cancelBubble=!0,s.isPropagationStopped=P,S(t.stopPropagation)&&t.stopPropagation()},s.stopImmediatePropagation=()=>{s.isImmediatePropagationStopped=P,s.stopPropagation()},(e=>e.isDefaultPrevented===P||e.isDefaultPrevented===I)(s)||(s.isDefaultPrevented=!0===s.defaultPrevented?P:I,s.isPropagationStopped=!0===s.cancelBubble?P:I,s.isImmediatePropagationStopped=I)),s},na=/^(?:mouse|contextmenu)|click/,ra=(e,t,o,n)=>{e.addEventListener(t,o,n||!1)},sa=(e,t,o,n)=>{e.removeEventListener(t,o,n||!1)},aa=(e,t)=>{const o=oa(e.type,e,document,t);if((e=>C(e)&&na.test(e.type))(e)&&w(e.pageX)&&!w(e.clientX)){const t=o.target.ownerDocument||document,n=t.documentElement,r=t.body,s=o;s.pageX=e.clientX+(n&&n.scrollLeft||r&&r.scrollLeft||0)-(n&&n.clientLeft||r&&r.clientLeft||0),s.pageY=e.clientY+(n&&n.scrollTop||r&&r.scrollTop||0)-(n&&n.clientTop||r&&r.clientTop||0)}return o},ia=(e,t,o)=>{const n=e.document,r={type:"ready"};if(o.domLoaded)return void t(r);const s=()=>{sa(e,"DOMContentLoaded",s),sa(e,"load",s),o.domLoaded||(o.domLoaded=!0,t(r)),e=null};"complete"===n.readyState||"interactive"===n.readyState&&n.body?s():ra(e,"DOMContentLoaded",s),o.domLoaded||ra(e,"load",s)};class la{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando="mce-data-"+(+new Date).toString(32),this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(e,t,o,n){const r=this;let s;const a=window,i=e=>{r.executeHandlers(aa(e||a.event),l)};if(!e||dr(e)||gr(e))return o;let l;e[r.expando]?l=e[r.expando]:(l=r.count++,e[r.expando]=l,r.events[l]={}),n=n||e;const c=t.split(" ");let d=c.length;for(;d--;){let t=c[d],m=i,u=!1,g=!1;"DOMContentLoaded"===t&&(t="ready"),r.domLoaded&&"ready"===t&&"complete"===e.readyState?o.call(n,aa({type:t})):(r.hasFocusIn||"focusin"!==t&&"focusout"!==t||(u=!0,g="focusin"===t?"focus":"blur",m=e=>{const t=aa(e||a.event);t.type="focus"===t.type?"focusin":"focusout",r.executeHandlers(t,l)}),s=r.events[l][t],s?"ready"===t&&r.domLoaded?o(aa({type:t})):s.push({func:o,scope:n}):(r.events[l][t]=s=[{func:o,scope:n}],s.fakeName=g,s.capture=u,s.nativeHandler=m,"ready"===t?ia(e,m,r):ra(e,g||t,m,u)))}return e=s=null,o}unbind(e,t,o){if(!e||dr(e)||gr(e))return this;const n=e[this.expando];if(n){let r=this.events[n];if(t){const n=t.split(" ");let s=n.length;for(;s--;){const t=n[s],a=r[t];if(a){if(o){let e=a.length;for(;e--;)if(a[e].func===o){const o=a.nativeHandler,n=a.fakeName,s=a.capture,i=a.slice(0,e).concat(a.slice(e+1));i.nativeHandler=o,i.fakeName=n,i.capture=s,r[t]=i}}o&&0!==a.length||(delete r[t],sa(e,a.fakeName||t,a.nativeHandler,a.capture))}}}else ve(r,((t,o)=>{sa(e,t.fakeName||o,t.nativeHandler,t.capture)})),r={};for(const e in r)if(Ee(r,e))return this;delete this.events[n];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,o){return this.dispatch(e,t,o)}dispatch(e,t,o){if(!e||dr(e)||gr(e))return this;const n=aa({type:t,target:e},o);do{const t=e[this.expando];t&&this.executeHandlers(n,t),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!n.isPropagationStopped());return this}clean(e){if(!e||dr(e)||gr(e))return this;if(e[this.expando]&&this.unbind(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName){this.unbind(e);const t=e.getElementsByTagName("*");let o=t.length;for(;o--;)(e=t[o])[this.expando]&&this.unbind(e)}return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const o=this.events[t],n=o&&o[e.type];if(n)for(let t=0,o=n.length;t{x(o)||""===o?ao(e,t):to(e,t,o)},ha=e=>e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),pa=(e,t)=>{let o=0;if(e)for(let n=e.nodeType,r=e.previousSibling;r;r=r.previousSibling){const e=r.nodeType;(!t||!dr(r)||e!==n&&r.data.length)&&(o++,n=e)}return o},fa=(e,t)=>{const o=no(t,"style"),n=e.serialize(e.parse(o),Wt(t));ga(t,ma,n)},va=(e,t,o)=>{const n=ha(t);x(o)||""===o?pn(e,n):cn(e,n,((e,t)=>k(e)?Ee(ua,t)?e+"":e+"px":e)(o,n))},ba=(e,t={})=>{const o={},n=window,r={};let s=0;const a=rs.forElement(wo.fromDom(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),i=[],l=t.schema?t.schema:Vs({}),c=Js({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),d=t.ownEvents?new la:la.Event,m=l.getBlockElements(),u=t=>t&&e&&h(t)?e.getElementById(t):t,g=e=>{const t=u(e);return C(t)?wo.fromDom(t):null},p=(e,t,o="")=>{let n;const r=g(e);if(C(r)&&Kt(r)){const e=G[t];n=e&&e.get?e.get(r.dom,t):no(r,t)}return C(n)?n:o},b=e=>{const t=u(e);return x(t)?[]:t.attributes},y=(e,o,n)=>{N(e,(e=>{if(tr(e)){const r=wo.fromDom(e),s=""===n?null:n,a=no(r,o),i=G[o];i&&i.set?i.set(r.dom,s,o):ga(r,o,s),a!==s&&t.onSetAttrib&&t.onSetAttrib({attrElm:r.dom,attrName:o,attrValue:s})}}))},w=()=>t.root_element||e.body,k=(t,o)=>os(e.body,u(t),o),_=(e,t,o)=>{const n=u(e);var r;if(!x(n)&&(or(n)||tr(r=n)&&"http://www.w3.org/2000/svg"===r.namespaceURI))return o?mn(wo.fromDom(n),ha(t)):("float"===(t=t.replace(/-(\D)/g,((e,t)=>t.toUpperCase())))&&(t="cssFloat"),n.style?n.style[t]:void 0)},T=e=>{const t=u(e);if(!t)return{w:0,h:0};let o=_(t,"width"),n=_(t,"height");return o&&-1!==o.indexOf("px")||(o="0"),n&&-1!==n.indexOf("px")||(n="0"),{w:parseInt(o,10)||t.offsetWidth||t.clientWidth,h:parseInt(n,10)||t.offsetHeight||t.clientHeight}},O=(e,t)=>{if(!e)return!1;const o=v(e)?e:[e];return W(o,(e=>Co(wo.fromDom(e),t)))},A=(e,t,o,n)=>{const r=[];let s=u(e);n=void 0===n;const a=o||("BODY"!==w().nodeName?w().parentNode:null);if(h(t))if("*"===t)t=tr;else{const e=t;t=t=>O(t,e)}for(;s&&!(s===a||x(s.nodeType)||hr(s)||pr(s));){if(!t||t(s)){if(!n)return[s];r.push(s)}s=s.parentNode}return n?r:null},M=(e,t,o)=>{let n=t;if(e){h(t)&&(n=e=>O(e,t));for(let t=e[o];t;t=t[o])if(S(n)&&n(t))return t}return null},N=function(e,t,o){const n=null!=o?o:this;if(v(e)){const o=[];return ca(e,((e,r)=>{const s=u(e);s&&o.push(t.call(n,s,r))})),o}{const o=u(e);return!!o&&t.call(n,o)}},R=(e,t)=>{N(e,(e=>{ve(t,((t,o)=>{y(e,o,t)}))}))},B=(e,t)=>{N(e,(e=>{const o=wo.fromDom(e);Tn(o,t)}))},L=(t,o,n,r,s)=>N(t,(t=>{const a=h(o)?e.createElement(o):o;return C(n)&&R(a,n),r&&(!h(r)&&r.nodeType?a.appendChild(r):h(r)&&B(a,r)),s?a:t.appendChild(a)})),H=(t,o,n)=>L(e.createElement(t),t,o,n,!0),I=Cs.encodeAllRaw,P=(e,t)=>N(e,(e=>{const o=wo.fromDom(e);return t&&q(Ho(o),(e=>{Yt(e)&&0===e.dom.length?Sn(e):fn(o,e)})),Sn(o),o.dom})),F=(e,t,o)=>{N(e,(e=>{if(tr(e)){const n=wo.fromDom(e),r=t.split(" ");q(r,(e=>{C(o)?(o?ho:fo)(n,e):vo(n,e)}))}}))},z=(e,t,o)=>N(t,(n=>{var r;const s=v(t)?e.cloneNode(!0):e;return o&&ca(da(n.childNodes),(e=>{s.appendChild(e)})),null===(r=n.parentNode)||void 0===r||r.replaceChild(s,n),n})),V=()=>e.createRange(),Z=(o,r,s,a)=>{if(v(o)){let e=o.length;const t=[];for(;e--;)t[e]=Z(o[e],r,s,a);return t}return!t.collect||o!==e&&o!==n||i.push([o,r,s,a]),d.bind(o,r,s,a||$)},U=(t,o,r)=>{if(v(t)){let e=t.length;const n=[];for(;e--;)n[e]=U(t[e],o,r);return n}if(i.length>0&&(t===e||t===n)){let e=i.length;for(;e--;){const[n,s,a]=i[e];t!==n||o&&o!==s||r&&r!==a||d.unbind(n,s,a)}}return d.unbind(t,o,r)},j=e=>{if(e&&or(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},$={doc:e,settings:t,win:n,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:a,boundEvents:i,styles:c,schema:l,events:d,isBlock:e=>h(e)?Ee(m,e):tr(e)&&(Ee(m,e.nodeName)||Yr(l,e)),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:w,getViewPort:e=>{const t=Fn(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=u(e),o=k(t),n=T(t);return{x:o.x,y:o.y,w:n.w,h:n.h}},getSize:T,getParent:(e,t,o)=>{const n=A(e,t,o,!1);return n&&n.length>0?n[0]:null},getParents:A,get:u,getNext:(e,t)=>M(e,t,"nextSibling"),getPrev:(e,t)=>M(e,t,"previousSibling"),select:(o,n)=>{var r,s;const a=null!==(s=null!==(r=u(n))&&void 0!==r?r:t.root_element)&&void 0!==s?s:e;return S(a.querySelectorAll)?ue(a.querySelectorAll(o)):[]},is:O,add:L,create:H,createHTML:(e,t,o="")=>{let n="<"+e;for(const e in t)Te(t,e)&&(n+=" "+e+'="'+I(t[e])+'"');return Je(o)&&Ee(l.getVoidElements(),e)?n+" />":n+">"+o+""},createFragment:t=>{const o=e.createElement("div"),n=e.createDocumentFragment();let r;for(n.appendChild(o),t&&(o.innerHTML=t);r=o.firstChild;)n.appendChild(r);return n.removeChild(o),n},remove:P,setStyle:(e,o,n)=>{N(e,(e=>{const r=wo.fromDom(e);va(r,o,n),t.update_styles&&fa(c,r)}))},getStyle:_,setStyles:(e,o)=>{N(e,(e=>{const n=wo.fromDom(e);ve(o,((e,t)=>{va(n,t,e)})),t.update_styles&&fa(c,n)}))},removeAllAttribs:e=>N(e,(e=>{const t=e.attributes;for(let o=t.length-1;o>=0;o--)e.removeAttributeNode(t.item(o))})),setAttrib:y,setAttribs:R,getAttrib:p,getPos:k,parseStyle:e=>c.parse(e),serializeStyle:(e,t)=>c.serialize(e,t),addStyle:t=>{if($!==ba.DOM&&e===document){if(o[t])return;o[t]=!0}let n=e.getElementById("mceDefaultStyles");if(!n){n=e.createElement("style"),n.id="mceDefaultStyles",n.type="text/css";const t=e.head;t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),q(e.split(","),(e=>{r[e]=!0,a.load(e).catch(E)}))},addClass:(e,t)=>{F(e,t,!0)},removeClass:(e,t)=>{F(e,t,!1)},hasClass:(e,t)=>{const o=g(e),n=t.split(" ");return C(o)&&re(n,(e=>bo(o,e)))},toggleClass:F,show:e=>{N(e,(e=>pn(wo.fromDom(e),"display")))},hide:e=>{N(e,(e=>cn(wo.fromDom(e),"display","none")))},isHidden:e=>{const t=g(e);return C(t)&&Ht(gn(t,"display"),"none")},uniqueId:e=>(e||"mce_")+s++,setHTML:B,getOuterHTML:e=>{const t=g(e);return C(t)?tr(t.dom)?t.dom.outerHTML:(e=>{const t=wo.fromTag("div"),o=wo.fromDom(e.dom.cloneNode(!0));return yn(t,o),En(t)})(t):""},setOuterHTML:(e,t)=>{N(e,(e=>{tr(e)&&(e.outerHTML=t)}))},decode:Cs.decode,encode:I,insertAfter:(e,t)=>{const o=u(t);return N(e,(e=>{const t=null==o?void 0:o.parentNode,n=null==o?void 0:o.nextSibling;return t&&(n?t.insertBefore(e,n):t.appendChild(e)),e}))},replace:z,rename:(e,t)=>{if(e.nodeName!==t.toUpperCase()){const o=H(t);return ca(b(e),(t=>{y(o,t.nodeName,p(e,t.nodeName))})),z(o,e,!0),o}return e},findCommonAncestor:(e,t)=>{let o=e;for(;o;){let e=t;for(;e&&o!==e;)e=e.parentNode;if(o===e)break;o=o.parentNode}return!o&&e.ownerDocument?e.ownerDocument.documentElement:o},run:N,getAttribs:b,isEmpty:(e,t,o)=>{if(f(t)){const n=e=>{const o=e.nodeName.toLowerCase();return Boolean(t[o])};return Nr(l,e,{...o,isContent:n})}return Nr(l,e,o)},createRng:V,nodeIndex:pa,split:(e,t,o)=>{let n,r,s=V();if(e&&t&&e.parentNode&&t.parentNode){const a=e.parentNode;return s.setStart(a,pa(e)),s.setEnd(t.parentNode,pa(t)),n=s.extractContents(),s=V(),s.setStart(t.parentNode,pa(t)+1),s.setEnd(a,pa(e)+1),r=s.extractContents(),a.insertBefore(ls($,n,l),e),o?a.insertBefore(o,e):a.insertBefore(t,e),a.insertBefore(ls($,r,l),e),P(e),o||t}},bind:Z,unbind:U,fire:(e,t,o)=>d.dispatch(e,t,o),dispatch:(e,t,o)=>d.dispatch(e,t,o),getContentEditable:j,getContentEditableParent:e=>{const t=w();let o=null;for(let n=e;n&&n!==t&&(o=j(n),null===o);n=n.parentNode);return o},isEditable:e=>{if(C(e)){const t=tr(e)?e:e.parentElement;return C(t)&&or(t)&&rn(wo.fromDom(t))}return!1},destroy:()=>{if(i.length>0){let e=i.length;for(;e--;){const[t,o,n]=i[e];d.unbind(t,o,n)}}ve(r,((e,t)=>{a.unload(t),delete r[t]}))},isChildOf:(e,t)=>e===t||t.contains(e),dumpRng:e=>"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},G=((e,t,o)=>{const n=t.keep_values,r={set:(e,n,r)=>{const s=wo.fromDom(e);S(t.url_converter)&&C(n)&&(n=t.url_converter.call(t.url_converter_scope||o(),String(n),r,e)),ga(s,"data-mce-"+r,n),ga(s,r,n)},get:(e,t)=>{const o=wo.fromDom(e);return no(o,"data-mce-"+t)||no(o,t)}},s={style:{set:(t,o)=>{const r=wo.fromDom(t);n&&ga(r,ma,o),ao(r,"style"),h(o)&&dn(r,e.parse(o))},get:t=>{const o=wo.fromDom(t),n=no(o,ma)||no(o,"style");return e.serialize(e.parse(n),Wt(o))}}};return n&&(s.href=s.src=r),s})(c,t,D($));return $};ba.DOM=ba(document),ba.nodeIndex=pa;const ya=ba.DOM;class wa{constructor(e={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=e}_setReferrerPolicy(e){this.settings.referrerPolicy=e}loadScript(e){return new Promise(((t,o)=>{const n=ya;let r;const s=()=>{n.remove(a),r&&(r.onerror=r.onload=r=null)},a=n.uniqueId();r=document.createElement("script"),r.id=a,r.type="text/javascript",r.src=Lt._addCacheSuffix(e),this.settings.referrerPolicy&&n.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{s(),t()},r.onerror=()=>{s(),o("Failed to load script: "+e)},(document.getElementsByTagName("head")[0]||document.body).appendChild(r)}))}isDone(e){return 2===this.states[e]}markDone(e){this.states[e]=2}add(e){const t=this;return t.queue.push(e),void 0===t.states[e]&&(t.states[e]=0),new Promise(((o,n)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:o,reject:n})}))}load(e){return this.add(e)}remove(e){delete this.states[e],delete this.scriptLoadedCallbacks[e]}loadQueue(){const e=this.queue;return this.queue=[],this.loadScripts(e)}loadScripts(e){const t=this,o=(e,o)=>{_e(t.scriptLoadedCallbacks,o).each((t=>{q(t,(t=>t[e](o)))})),delete t.scriptLoadedCallbacks[o]},n=e=>{const t=Y(e,(e=>"rejected"===e.status));return t.length>0?Promise.reject(ne(t,(({reason:e})=>v(e)?e:[e]))):Promise.resolve()},r=e=>Promise.allSettled($(e,(e=>2===t.states[e]?(o("resolve",e),Promise.resolve()):3===t.states[e]?(o("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then((()=>{t.states[e]=2,o("resolve",e);const s=t.queue;return s.length>0?(t.queue=[],r(s).then(n)):Promise.resolve()}),(()=>(t.states[e]=3,o("reject",e),Promise.reject(e)))))))),s=e=>(t.loading=!0,r(e).then((e=>{t.loading=!1;const o=t.queueLoadedCallbacks.shift();return F.from(o).each(H),n(e)}))),a=Oe(e);return t.loading?new Promise(((e,o)=>{t.queueLoadedCallbacks.push((()=>{s(a).then(e,o)}))})):s(a)}}wa.ScriptLoader=new wa;const xa=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Ca={},Sa=xa("en"),ka=()=>_e(Ca,Sa.get()),_a={getData:()=>be(Ca,(e=>({...e}))),setCode:e=>{e&&Sa.set(e)},getCode:()=>Sa.get(),add:(e,t)=>{let o=Ca[e];o||(Ca[e]=o={});const n=$(pe(t),(e=>e.toLowerCase()));ve(t,((e,r)=>{const s=r.toLowerCase();s!==r&&((e,t)=>{const o=e.indexOf(t);return-1!==o&&e.indexOf(t,o+1)>o})(n,s)?(Ee(t,s)||(o[s]=e),o[r]=e):o[s]=e}))},translate:e=>{const t=ka().getOr({}),o=e=>S(e)?Object.prototype.toString.call(e):n(e)?"":""+e,n=e=>""===e||null==e,r=e=>{const n=o(e);return Ee(t,n)?o(t[n]):_e(t,n.toLowerCase()).map(o).getOr(n)},s=e=>e.replace(/{context:\w+}$/,"");if(n(e))return"";if(p(a=e)&&Ee(a,"raw"))return o(e.raw);var a;if((e=>v(e)&&e.length>1)(e)){const t=e.slice(1);return s(r(e[0]).replace(/\{([0-9]+)\}/g,((e,n)=>Ee(t,n)?o(t[n]):e)))}return s(r(e))},isRtl:()=>ka().bind((e=>_e(e,"_dir"))).exists((e=>"rtl"===e)),hasCode:e=>Ee(Ca,e)},Ea=()=>{const e=[],t={},o={},n=[],r=(e,t)=>{const o=Y(n,(o=>o.name===e&&o.state===t));q(o,(e=>e.resolve()))},s=e=>Ee(t,e),a=(e,o)=>{const n=_a.getCode();!n||o&&-1===(","+(o||"")+",").indexOf(","+n+",")||wa.ScriptLoader.add(t[e]+"/langs/"+n+".js")},i=(e,t="added")=>"added"===t&&(e=>Ee(o,e))(e)||"loaded"===t&&s(e)?Promise.resolve():new Promise((o=>{n.push({name:e,state:t,resolve:o})}));return{items:e,urls:t,lookup:o,get:e=>{if(o[e])return o[e].instance},requireLangPack:(e,t)=>{!1!==Ea.languageLoad&&(s(e)?a(e,t):i(e,"loaded").then((()=>a(e,t))))},add:(t,n)=>(e.push(n),o[t]={instance:n},r(t,"added"),n),remove:e=>{delete t[e],delete o[e]},createUrl:(e,t)=>h(t)?h(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,n)=>{if(t[e])return Promise.resolve();let s=h(n)?n:n.prefix+n.resource+n.suffix;0!==s.indexOf("/")&&-1===s.indexOf("://")&&(s=Ea.baseURL+"/"+s),t[e]=s.substring(0,s.lastIndexOf("/"));const a=()=>(r(e,"loaded"),Promise.resolve());return o[e]?a():wa.ScriptLoader.add(s).then(a)},waitFor:i}};Ea.languageLoad=!0,Ea.baseURL="",Ea.PluginManager=Ea(),Ea.ThemeManager=Ea(),Ea.ModelManager=Ea();const Ta=e=>{const t=xa(F.none()),o=()=>t.get().each((e=>clearInterval(e)));return{clear:()=>{o(),t.set(F.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:n=>{o(),t.set(F.some(setInterval(n,e)))}}},Oa=()=>{const e=(e=>{const t=xa(F.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(F.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(F.some(e))}}})(E);return{...e,on:t=>e.get().each(t)}},Da=(e,t)=>{let o=null;return{cancel:()=>{b(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{b(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}},Aa=(e,t)=>{let o=null;const n=()=>{b(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}},Ma=D("mce-annotation"),Na=D("data-mce-annotation"),Ra=D("data-mce-annotation-uid"),Ba=D("data-mce-annotation-active"),La=D("data-mce-annotation-classes"),Ha=D("data-mce-annotation-attrs"),Ia=e=>t=>ko(t,e),Pa=(e,t)=>{const o=e.selection.getRng(),n=wo.fromDom(o.startContainer),r=wo.fromDom(e.getBody()),s=t.fold((()=>"."+Ma()),(e=>`[${Na()}="${e}"]`)),a=Io(n,o.startOffset).getOr(n);return nn(a,s,Ia(r)).bind((t=>ro(t,`${Ra()}`).bind((o=>ro(t,`${Na()}`).map((t=>{const n=za(e,o);return{uid:o,name:t,elements:n}}))))))},Fa=(e,t)=>so(e,"data-mce-bogus")||((e,t,o)=>tn(e,t,o).isSome())(e,'[data-mce-bogus="all"]',Ia(t)),za=(e,t)=>{const o=wo.fromDom(e.getBody()),n=Vn(o,`[${Ra()}="${t}"]`);return Y(n,(e=>!Fa(e,o)))},Va=(e,t)=>{const o=wo.fromDom(e.getBody()),n=Vn(o,`[${Na()}="${t}"]`),r={};return q(n,(e=>{if(!Fa(e,o)){const t=no(e,Ra()),o=_e(r,t).getOr([]);r[t]=o.concat([e])}})),r},Za=(e,t)=>{const o=xa({}),n=()=>({listeners:[],previous:Oa()}),r=(e,t)=>{s(e,(e=>(t(e),e)))},s=(e,t)=>{const r=o.get(),s=t(_e(r,e).getOrThunk(n));r[e]=s,o.set(r)},a=(t,o)=>{q(za(e,t),(e=>{o?to(e,Ba(),"true"):ao(e,Ba())}))},i=Aa((()=>{const o=le(t.getNames());q(o,(t=>{s(t,(o=>{const n=o.previous.get();return Pa(e,F.some(t)).fold((()=>{n.each((e=>{(e=>{r(e,(t=>{q(t.listeners,(t=>t(!1,e)))}))})(t),o.previous.clear(),a(e,!1)}))}),(({uid:e,name:t,elements:s})=>{Ht(n,e)||(n.each((e=>a(e,!1))),((e,t,o)=>{r(e,(n=>{q(n.listeners,(n=>n(!0,e,{uid:t,nodes:$(o,(e=>e.dom))})))}))})(t,e,s),o.previous.set(e),a(e,!0))})),{previous:o.previous,listeners:o.listeners}}))}))}),30);return e.on("remove",(()=>{i.cancel()})),e.on("NodeChange",(()=>{i.throttle()})),{addListener:(e,t)=>{s(e,(e=>({previous:e.previous,listeners:e.listeners.concat([t])})))}}};let Ua=0;const ja=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return Ua++,e+"_"+o+Ua+String(t)},Wa=(e,t)=>wo.fromDom(e.dom.cloneNode(t)),$a=e=>Wa(e,!1),qa=e=>Wa(e,!0),Ga=(e,t)=>{const o=((e,t)=>{const o=wo.fromTag(t),n=io(e);return oo(o,n),o})(e,t);vn(e,o);const n=Ho(e);return xn(o,n),Sn(e),o},Ka=(e,t,o=I)=>{const n=new Wn(e,t),r=e=>{let t;do{t=n[e]()}while(t&&!dr(t)&&!o(t));return F.from(t).filter(dr)};return{current:()=>F.from(n.current()).filter(dr),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},Ya=(e,t)=>{const o=t||(t=>e.isBlock(t)||fr(t)||yr(t)),n=(e,t,o,r)=>{if(dr(e)){const o=r(e,t,e.data);if(-1!==o)return F.some({container:e,offset:o})}return o().bind((e=>n(e.container,e.offset,o,r)))};return{backwards:(t,r,s,a)=>{const i=Ka(t,null!=a?a:e.getRoot(),o);return n(t,r,(()=>i.prev().map((e=>({container:e,offset:e.length})))),s).getOrNull()},forwards:(t,r,s,a)=>{const i=Ka(t,null!=a?a:e.getRoot(),o);return n(t,r,(()=>i.next().map((e=>({container:e,offset:0})))),s).getOrNull()}}},Xa=((e,t)=>{const o=t=>e(t)?F.from(t.dom.nodeValue):F.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})(Yt,"text"),Ja=e=>Xa.get(e),Qa=e=>{let t;return o=>(t=t||ie(e,P),Ee(t,Wt(o)))},ei=e=>Kt(e)&&"br"===Wt(e),ti=Qa(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),oi=Qa(["ul","ol","dl"]),ni=Qa(["li","dd","dt"]),ri=Qa(["thead","tbody","tfoot"]),si=Qa(["td","th"]),ai=Qa(["pre","script","textarea","style"]),ii=e=>{const t=Vn(e,"br"),o=Y((e=>{const t=[];let o=e.dom;for(;o;)t.push(wo.fromDom(o)),o=o.lastChild;return t})(e).slice(-1),ei);t.length===o.length&&q(o,Sn)},li=()=>{const e=wo.fromTag("br");return to(e,"data-mce-bogus","1"),e},ci=e=>{Cn(e),yn(e,li())},di=$n,mi=Gn,ui=e=>e.replace(/\uFEFF/g,""),gi=tr,hi=dr,pi=e=>(hi(e)&&(e=e.parentNode),gi(e)&&e.hasAttribute("data-mce-caret")),fi=e=>hi(e)&&mi(e.data),vi=e=>pi(e)||fi(e),bi=e=>e.firstChild!==e.lastChild||!fr(e.firstChild),yi=e=>{const t=e.container();return!!dr(t)&&(t.data.charAt(e.offset())===di||e.isAtStart()&&fi(t.previousSibling))},wi=e=>{const t=e.container();return!!dr(t)&&(t.data.charAt(e.offset()-1)===di||e.isAtEnd()&&fi(t.nextSibling))},xi=e=>hi(e)&&e.data[0]===di,Ci=e=>hi(e)&&e.data[e.data.length-1]===di,Si=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{var t;const o=e.getElementsByTagName("br"),n=o[o.length-1];ar(n)&&(null===(t=n.parentNode)||void 0===t||t.removeChild(n))})(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,ki=e=>pi(e.startContainer),_i=Math.round,Ei=e=>e?{left:_i(e.left),top:_i(e.top),bottom:_i(e.bottom),right:_i(e.right),width:_i(e.width),height:_i(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},Ti=(e,t)=>(e=Ei(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),Oi=(e,t,o)=>e>=0&&e<=Math.min(t.height,o.height)/2,Di=(e,t)=>{const o=Math.min(t.height/2,e.height/2);return e.bottom-ot.bottom)&&Oi(t.top-e.bottom,e,t)},Ai=(e,t)=>e.top>t.bottom||!(e.bottom{const n=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(o,e.top+e.height),e.top);return Math.sqrt((t-n)*(t-n)+(o-r)*(o-r))},Ni=e=>{const t=e.startContainer,o=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===o+1?t.childNodes[o]:null},Ri=(e,t)=>{if(tr(e)&&e.hasChildNodes()){const o=e.childNodes,n=((e,t,o)=>Math.min(Math.max(e,t),o))(t,0,o.length-1);return o[n]}return e},Bi=new RegExp("[̀-ͯ҃-҇҈-҉֑-ֽֿׁ-ׂׄ-ׇׅؐ-ًؚ-ٰٟۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣣ-ंऺ़ु-ै्॑-ॗॢ-ॣঁ়াু-ৄ্ৗৢ-ৣਁ-ਂ਼ੁ-ੂੇ-ੈੋ-੍ੑੰ-ੱੵઁ-ં઼ુ-ૅે-ૈ્ૢ-ૣଁ଼ାିୁ-ୄ୍ୖୗୢ-ୣஂாீ்ௗఀా-ీె-ైొ-్ౕ-ౖౢ-ౣಁ಼ಿೂೆೌ-್ೕ-ೖೢ-ೣഁാു-ൄ്ൗൢ-ൣ්ාි-ුූෟัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-ཱ༹༙༵༷-ཾྀ-྄྆-྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္-်ွ-ှၘ-ၙၞ-ၠၱ-ၴႂႅ-ႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳ឴-឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧ-ᤨᤲ᤹-᤻ᨗ-ᨘᨛᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼᪰-᪽᪾ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀ-ᮁᮢ-ᮥᮨ-ᮩ᮫-ᮭ᯦ᯨ-ᯩᯭᯯ-ᯱᰬ-ᰳᰶ-᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᳸-᳹᷀-᷵᷼-᷿‌-‍⃐-⃜⃝-⃠⃡⃢-⃤⃥-⃰⳯-⵿⳱ⷠ-〪ⷿ-〭〮-゙〯-゚꙯꙰-꙲ꙴ-꙽ꚞ-ꚟ꛰-꛱ꠂ꠆ꠋꠥ-ꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꧥꨩ-ꨮꨱ-ꨲꨵ-ꨶꩃꩌꩼꪰꪲ-ꪴꪷ-ꪸꪾ-꪿꫁ꫬ-ꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-゙︯-゚]"),Li=e=>h(e)&&e.charCodeAt(0)>=768&&Bi.test(e),Hi=br,Ii=yr,Pi=fr,Fi=dr,zi=rr(["script","style","textarea"]),Vi=rr(["img","input","textarea","hr","iframe","video","audio","object","embed"]),Zi=rr(["table"]),Ui=vi,ji=e=>!Ui(e)&&(Fi(e)?!zi(e.parentNode):Vi(e)||Pi(e)||Zi(e)||Wi(e)),Wi=e=>!(e=>tr(e)&&"true"===e.getAttribute("unselectable"))(e)&&Ii(e),$i=(e,t)=>ji(e)&&((e,t)=>{for(let o=e.parentNode;o&&o!==t;o=o.parentNode){if(Wi(o))return!1;if(Hi(o))return!0}return!0})(e,t),qi=tr,Gi=ji,Ki=sr("display","block table"),Yi=sr("float","left right"),Xi=((...e)=>t=>{for(let o=0;ot<0&&tr(e)&&e.hasChildNodes()?void 0:Ri(e,t),nl=e=>e?e.createRange():ba.DOM.createRng(),rl=e=>h(e)&&/[\r\n\t ]/.test(e),sl=e=>!!e.setStart&&!!e.setEnd,al=e=>{const t=e.startContainer,o=e.startOffset;if(rl(e.toString())&&Ji(t.parentNode)&&dr(t)){const e=t.data;if(rl(e[o-1])||rl(e[o+1]))return!0}return!1},il=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,ll=e=>{var t;let o;const n=e.getClientRects();return o=n.length>0?Ei(n[0]):Ei(e.getBoundingClientRect()),!sl(e)&&el(e)&&il(o)?(e=>{const t=e.ownerDocument,o=nl(t),n=t.createTextNode(qn),r=e.parentNode;r.insertBefore(n,e),o.setStart(n,0),o.setEnd(n,1);const s=Ei(o.getBoundingClientRect());return r.removeChild(n),s})(e):il(o)&&sl(e)&&null!==(t=(e=>{const t=e.startContainer,o=e.endContainer,n=e.startOffset,r=e.endOffset;if(t===o&&dr(o)&&0===n&&1===r){const t=e.cloneRange();return t.setEndAfter(o),ll(t)}return null})(e))&&void 0!==t?t:o},cl=(e,t)=>{const o=Ti(e,t);return o.width=1,o.right=o.left+1,o},dl=e=>{const t=[],o=e=>{var o,n;0!==e.height&&(t.length>0&&(o=e,n=t[t.length-1],o.left===n.left&&o.top===n.top&&o.bottom===n.bottom&&o.right===n.right)||t.push(e))},n=(e,t)=>{const n=nl(e.ownerDocument);if(t0&&(n.setStart(e,t-1),n.setEnd(e,t),al(n)||o(cl(ll(n),!1))),t{const n=()=>(o||(o=dl(ml(e,t))),o);return{container:D(e),offset:D(t),toRange:()=>{const o=nl(e.ownerDocument);return o.setStart(e,t),o.setEnd(e,t),o},getClientRects:n,isVisible:()=>n().length>0,isAtStart:()=>(Qi(e),0===t),isAtEnd:()=>Qi(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:o=>o&&e===o.container()&&t===o.offset(),getNode:o=>ol(e,o?t-1:t)}};ml.fromRangeStart=e=>ml(e.startContainer,e.startOffset),ml.fromRangeEnd=e=>ml(e.endContainer,e.endOffset),ml.after=e=>ml(e.parentNode,tl(e)+1),ml.before=e=>ml(e.parentNode,tl(e)),ml.isAbove=(e,t)=>Pt(de(t.getClientRects()),me(e.getClientRects()),Di).getOr(!1),ml.isBelow=(e,t)=>Pt(me(t.getClientRects()),de(e.getClientRects()),Ai).getOr(!1),ml.isAtStart=e=>!!e&&e.isAtStart(),ml.isAtEnd=e=>!!e&&e.isAtEnd(),ml.isTextPosition=e=>!!e&&dr(e.container()),ml.isElementPosition=e=>!ml.isTextPosition(e);const ul=(e,t)=>{dr(t)&&0===t.data.length&&e.remove(t)},gl=(e,t,o)=>{pr(o)?((e,t,o)=>{const n=F.from(o.firstChild),r=F.from(o.lastChild);t.insertNode(o),n.each((t=>ul(e,t.previousSibling))),r.each((t=>ul(e,t.nextSibling)))})(e,t,o):((e,t,o)=>{t.insertNode(o),ul(e,o.previousSibling),ul(e,o.nextSibling)})(e,t,o)},hl=dr,pl=ar,fl=ba.nodeIndex,vl=e=>{const t=e.parentNode;return pl(t)?vl(t):t},bl=e=>e?Be(e.childNodes,((e,t)=>(pl(t)&&"BR"!==t.nodeName?e=e.concat(bl(t)):e.push(t),e)),[]):[],yl=e=>t=>e===t,wl=e=>(hl(e)?"text()":e.nodeName.toLowerCase())+"["+(e=>{let t,o;t=bl(vl(e)),o=Le(t,yl(e),e),t=t.slice(0,o+1);const n=Be(t,((e,o,n)=>(hl(o)&&hl(t[n-1])&&e++,e)),0);return t=Re(t,rr([e.nodeName])),o=Le(t,yl(e),e),o-n})(e)+"]",xl=(e,t)=>{let o,n=[],r=t.container(),s=t.offset();if(hl(r))o=((e,t)=>{let o=e;for(;(o=o.previousSibling)&&hl(o);)t+=o.data.length;return t})(r,s);else{const e=r.childNodes;s>=e.length?(o="after",s=e.length-1):o="before",r=e[s]}n.push(wl(r));let a=((e,t,o)=>{const n=[];for(let r=t.parentNode;r&&r!==e&&(!o||!o(r));r=r.parentNode)n.push(r);return n})(e,r);return a=Re(a,R(ar)),n=n.concat(Ne(a,(e=>wl(e)))),n.reverse().join("/")+","+o},Cl=(e,t)=>{if(!t)return null;const o=t.split(","),n=o[0].split("/"),r=o.length>1?o[1]:"before",s=Be(n,((e,t)=>{const o=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return o?("text()"===o[1]&&(o[1]="#text"),((e,t,o)=>{let n=bl(e);return n=Re(n,((e,t)=>!hl(e)||!hl(n[t-1]))),n=Re(n,rr([t])),n[o]})(e,o[1],parseInt(o[2],10))):null}),e);if(!s)return null;if(!hl(s)&&s.parentNode){let e;return e="after"===r?fl(s)+1:fl(s),ml(s.parentNode,e)}return((e,t)=>{let o=e,n=0;for(;hl(o);){const r=o.data.length;if(t>=n&&t<=n+r){e=o,t-=n;break}if(!hl(o.nextSibling)){e=o,t=r;break}n+=r,o=o.nextSibling}return hl(e)&&t>e.data.length&&(t=e.data.length),ml(e,t)})(s,parseInt(r,10))},Sl=yr,kl=(e,t,o,n,r)=>{const s=r?n.startContainer:n.endContainer;let a=r?n.startOffset:n.endOffset;const i=[],l=e.getRoot();if(dr(s))i.push(o?((e,t,o)=>{let n=e(t.data.slice(0,o)).length;for(let o=t.previousSibling;o&&dr(o);o=o.previousSibling)n+=e(o.data).length;return n})(t,s,a):a);else{let t=0;const n=s.childNodes;a>=n.length&&n.length&&(t=1,a=Math.max(0,n.length-1)),i.push(e.nodeIndex(n[a],o)+t)}for(let t=s;t&&t!==l;t=t.parentNode)i.push(e.nodeIndex(t,o));return i},_l=(e,t,o)=>{let n=0;return Lt.each(e.select(t),(e=>"all"===e.getAttribute("data-mce-bogus")?void 0:e!==o&&void n++)),n},El=(e,t)=>{let o=t?e.startContainer:e.endContainer,n=t?e.startOffset:e.endOffset;if(tr(o)&&"TR"===o.nodeName){const r=o.childNodes;o=r[Math.min(t?n:n-1,r.length-1)],o&&(n=t?0:o.childNodes.length,t?e.setStart(o,n):e.setEnd(o,n))}},Tl=e=>(El(e,!0),El(e,!1),e),Ol=(e,t)=>{if(tr(e)&&(e=Ri(e,t),Sl(e)))return e;if(vi(e)){dr(e)&&pi(e)&&(e=e.parentNode);let t=e.previousSibling;if(Sl(t))return t;if(t=e.nextSibling,Sl(t))return t}},Dl=(e,t,o)=>{const n=o.getNode(),r=o.getRng();if("IMG"===n.nodeName||Sl(n)){const e=n.nodeName;return{name:e,index:_l(o.dom,e,n)}}const s=(e=>Ol(e.startContainer,e.startOffset)||Ol(e.endContainer,e.endOffset))(r);if(s){const e=s.tagName;return{name:e,index:_l(o.dom,e,s)}}return((e,t,o,n)=>{const r=t.dom,s=kl(r,e,o,n,!0),a=t.isForward(),i=ki(n)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:s,forward:a,...i}:{start:s,end:kl(r,e,o,n,!1),forward:a,...i}})(e,o,t,r)},Al=(e,t,o)=>{const n={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return o?e.create("span",n,""):e.create("span",n)},Ml=(e,t)=>{const o=e.dom;let n=e.getRng();const r=o.uniqueId(),s=e.isCollapsed(),a=e.getNode(),i=a.nodeName,l=e.isForward();if("IMG"===i)return{name:i,index:_l(o,i,a)};const c=Tl(n.cloneRange());if(!s){c.collapse(!1);const e=Al(o,r+"_end",t);gl(o,c,e)}n=Tl(n),n.collapse(!0);const d=Al(o,r+"_start",t);return gl(o,n,d),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},Nl=(e,t,o=!1)=>2===t?Dl(ui,o,e):3===t?(e=>{const t=e.getRng();return{start:xl(e.dom.getRoot(),ml.fromRangeStart(t)),end:xl(e.dom.getRoot(),ml.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):Ml(e,!1),Rl=N(Dl,A,!0),Bl=e=>{const t=t=>t(e),o=D(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:P,isError:I,map:t=>Hl.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:()=>F.some(e)};return r},Ll=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:I,isError:P,map:t,mapError:t=>Hl.error(t(e)),bind:t,exists:I,forall:P,getOr:A,or:A,getOrThunk:L,orThunk:L,getOrDie:B(String(e)),each:E,toOptional:F.none};return o},Hl={value:Bl,error:Ll,fromOption:(e,t)=>e.fold((()=>Ll(t)),Bl)},Il=e=>{if(!v(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 q(e,((n,r)=>{const s=pe(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!v(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[r].apply(null,o)},match:e=>{const n=pe(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!re(t,(e=>j(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};Il([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Pl=e=>"inline-command"===e.type||"inline-format"===e.type,Fl=e=>"block-command"===e.type||"block-format"===e.type,zl=e=>{var t;const o=t=>Hl.error({message:t,pattern:e}),n=(t,n,r)=>{if(void 0!==e.format){let r;if(v(e.format)){if(!re(e.format,h))return o(t+" pattern has non-string items in the `format` array");r=e.format}else{if(!h(e.format))return o(t+" pattern has non-string `format` parameter");r=[e.format]}return Hl.value(n(r))}return void 0!==e.cmd?h(e.cmd)?Hl.value(r(e.cmd,e.value)):o(t+" pattern has non-string `cmd` parameter"):o(t+" pattern is missing both `format` and `cmd` parameters")};if(!p(e))return o("Raw pattern is not an object");if(!h(e.start))return o("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!h(e.end))return o("Inline pattern has non-string `end` parameter");if(0===e.start.length&&0===e.end.length)return o("Inline pattern has empty `start` and `end` parameters");let t=e.start,r=e.end;return 0===r.length&&(r=t,t=""),n("Inline",(e=>({type:"inline-format",start:t,end:r,format:e})),((e,o)=>({type:"inline-command",start:t,end:r,cmd:e,value:o})))}if(void 0!==e.replacement)return h(e.replacement)?0===e.start.length?o("Replacement pattern has empty `start` parameter"):Hl.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):o("Replacement pattern has non-string `replacement` parameter");{const r=null!==(t=e.trigger)&&void 0!==t?t:"space";return 0===e.start.length?o("Block pattern has empty `start` parameter"):n("Block",(t=>({type:"block-format",start:e.start,format:t[0],trigger:r})),((t,o)=>({type:"block-command",start:e.start,cmd:t,value:o,trigger:r})))}},Vl=e=>Y(e,Fl),Zl=e=>Y(e,Pl),Ul=(e,t)=>({...e,blockPatterns:Y(e.blockPatterns,(e=>((e,t)=>("block-command"===e.type||"block-format"===e.type)&&e.trigger===t)(e,t)))}),jl=e=>{const t=(e=>{const t=[],o=[];return q(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{o.push(e)}))})),{errors:t,values:o}})($(e,zl));return q(t.errors,(e=>console.error(e.message,e.pattern))),t.values},Wl=kt().deviceType,$l=Wl.isTouch(),ql=ba.DOM,Gl=e=>g(e,RegExp),Kl=e=>t=>t.options.get(e),Yl=e=>h(e)||p(e),Xl=(e,t="")=>o=>{const n=h(o);if(n){if(-1!==o.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return J(t,((e,t)=>{const o=t.split("="),n=o[0],r=o.length>1?o[1]:n;return e[Ge(n)]=Ge(r),e}),{})})(o);return{value:_e(r,e.id).getOr(t),valid:n}}return{value:o,valid:n}}return{valid:!1,message:"Must be a string."}},Jl=Kl("iframe_attrs"),Ql=Kl("doctype"),ec=Kl("document_base_url"),tc=Kl("body_id"),oc=Kl("body_class"),nc=Kl("content_security_policy"),rc=Kl("br_in_pre"),sc=Kl("forced_root_block"),ac=Kl("forced_root_block_attrs"),ic=Kl("newline_behavior"),lc=Kl("br_newline_selector"),cc=Kl("no_newline_selector"),dc=Kl("keep_styles"),mc=Kl("end_container_on_empty_block"),uc=Kl("automatic_uploads"),gc=Kl("images_reuse_filename"),hc=Kl("images_replace_blob_uris"),pc=Kl("icons"),fc=Kl("icons_url"),vc=Kl("images_upload_url"),bc=Kl("images_upload_base_path"),yc=Kl("images_upload_credentials"),wc=Kl("images_upload_handler"),xc=Kl("content_css_cors"),Cc=Kl("referrer_policy"),Sc=Kl("language"),kc=Kl("language_url"),_c=Kl("indent_use_margin"),Ec=Kl("indentation"),Tc=Kl("content_css"),Oc=Kl("content_style"),Dc=Kl("font_css"),Ac=Kl("directionality"),Mc=Kl("inline_boundaries_selector"),Nc=Kl("object_resizing"),Rc=Kl("resize_img_proportional"),Bc=Kl("placeholder"),Lc=Kl("event_root"),Hc=Kl("service_message"),Ic=Kl("theme"),Pc=Kl("theme_url"),Fc=Kl("model"),zc=Kl("model_url"),Vc=Kl("inline_boundaries"),Zc=Kl("formats"),Uc=Kl("preview_styles"),jc=Kl("format_empty_lines"),Wc=Kl("format_noneditable_selector"),$c=Kl("custom_ui_selector"),qc=Kl("inline"),Gc=Kl("hidden_input"),Kc=Kl("submit_patch"),Yc=Kl("add_form_submit_trigger"),Xc=Kl("add_unload_trigger"),Jc=Kl("custom_undo_redo_levels"),Qc=Kl("disable_nodechange"),ed=Kl("readonly"),td=Kl("editable_root"),od=Kl("content_css_cors"),nd=Kl("plugins"),rd=Kl("external_plugins"),sd=Kl("block_unsupported_drop"),ad=Kl("visual"),id=Kl("visual_table_class"),ld=Kl("visual_anchor_class"),cd=Kl("iframe_aria_text"),dd=Kl("setup"),md=Kl("init_instance_callback"),ud=Kl("urlconverter_callback"),gd=Kl("auto_focus"),hd=Kl("browser_spellcheck"),pd=Kl("protect"),fd=Kl("paste_block_drop"),vd=Kl("paste_data_images"),bd=Kl("paste_preprocess"),yd=Kl("paste_postprocess"),wd=Kl("newdocument_content"),xd=Kl("paste_webkit_styles"),Cd=Kl("paste_remove_styles_if_webkit"),Sd=Kl("paste_merge_formats"),kd=Kl("smart_paste"),_d=Kl("paste_as_text"),Ed=Kl("paste_tab_spaces"),Td=Kl("allow_html_data_urls"),Od=Kl("text_patterns"),Dd=Kl("text_patterns_lookup"),Ad=Kl("noneditable_class"),Md=Kl("editable_class"),Nd=Kl("noneditable_regexp"),Rd=Kl("preserve_cdata"),Bd=Kl("highlight_on_focus"),Ld=Kl("xss_sanitization"),Hd=Kl("init_content_sync"),Id=e=>Lt.explode(e.options.get("images_file_types")),Pd=Kl("table_tab_navigation"),Fd=Kl("details_initial_state"),zd=Kl("details_serialized_state"),Vd=Kl("sandbox_iframes"),Zd=e=>e.options.get("sandbox_iframes_exclusions"),Ud=Kl("convert_unsafe_embeds"),jd=Kl("license_key"),Wd=Kl("api_key"),$d=tr,qd=dr,Gd=e=>{const t=e.parentNode;t&&t.removeChild(e)},Kd=e=>{const t=ui(e);return{count:e.length-t.length,text:t}},Yd=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(di));)e.deleteData(t,1)},Xd=(e,t)=>(tm(e),t),Jd=(e,t)=>{const o=t.container(),n=((e,t)=>{const o=U(e,t);return-1===o?F.none():F.some(o)})(ue(o.childNodes),e).map((e=>eqd(e)&&t.container()===e?((e,t)=>{const o=Kd(e.data.substr(0,t.offset())),n=Kd(e.data.substr(t.offset()));return(o.text+n.text).length>0?(Yd(e),ml(e,t.offset()-o.count)):t})(e,t):Xd(e,t),em=(e,t)=>ml.isTextPosition(t)?Qd(e,t):((e,t)=>t.container()===e.parentNode?Jd(e,t):Xd(e,t))(e,t),tm=e=>{$d(e)&&vi(e)&&(bi(e)?e.removeAttribute("data-mce-caret"):Gd(e)),qd(e)&&(Yd(e),0===e.data.length&&Gd(e))},om=yr,nm=Cr,rm=wr,sm=(e,t,o)=>{const n=Ti(t.getBoundingClientRect(),o);let r,s;if("BODY"===e.tagName){const t=e.ownerDocument.documentElement;r=e.scrollLeft||t.scrollLeft,s=e.scrollTop||t.scrollTop}else{const t=e.getBoundingClientRect();r=e.scrollLeft-t.left,s=e.scrollTop-t.top}n.left+=r,n.right+=r,n.top+=s,n.bottom+=s,n.width=1;let a=t.offsetWidth-t.clientWidth;return a>0&&(o&&(a*=-1),n.left+=a,n.right+=a),n},am=(e,t,o,n)=>{const r=Oa();let s,a;const i=sc(e),l=e.dom,c=()=>{(e=>{var t,o;const n=Vn(wo.fromDom(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e{l.remove(e.caret),r.clear()})),s&&(clearInterval(s),s=void 0)},d=()=>{s=setInterval((()=>{r.on((e=>{n()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")}))}),500)};return{show:(e,n)=>{let s;if(c(),rm(n))return null;if(!o(n))return a=((e,t)=>{var o;const n=(null!==(o=e.ownerDocument)&&void 0!==o?o:document).createTextNode(di),r=e.parentNode;if(t){const t=e.previousSibling;if(hi(t)){if(vi(t))return t;if(Ci(t))return t.splitText(t.data.length-1)}null==r||r.insertBefore(n,e)}else{const t=e.nextSibling;if(hi(t)){if(vi(t))return t;if(xi(t))return t.splitText(1),t}e.nextSibling?null==r||r.insertBefore(n,e.nextSibling):null==r||r.appendChild(n)}return n})(n,e),s=n.ownerDocument.createRange(),lm(a.nextSibling)?(s.setStart(a,0),s.setEnd(a,0)):(s.setStart(a,1),s.setEnd(a,1)),s;{const o=((e,t,o)=>{var n;const r=(null!==(n=t.ownerDocument)&&void 0!==n?n:document).createElement(e);r.setAttribute("data-mce-caret",o?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(li().dom);const s=t.parentNode;return o?null==s||s.insertBefore(r,t):t.nextSibling?null==s||s.insertBefore(r,t.nextSibling):null==s||s.appendChild(r),r})(i,n,e),c=sm(t,n,e);l.setStyle(o,"top",c.top),l.setStyle(o,"caret-color","transparent"),a=o;const m=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(m,{...c}),l.add(t,m),r.set({caret:m,element:n,before:e}),e&&l.addClass(m,"mce-visual-caret-before"),d(),s=n.ownerDocument.createRange(),s.setStart(o,0),s.setEnd(o,0)}return s},hide:c,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{r.on((e=>{const o=sm(t,e.element,e.before);l.setStyles(e.caret,{...o})}))},destroy:()=>clearInterval(s)}},im=()=>Mt.browser.isFirefox(),lm=e=>om(e)||nm(e),cm=e=>(lm(e)||ir(e)&&im())&&Ao(wo.fromDom(e)).exists(rn),dm=br,mm=yr,um=Cr,gm=sr("display","block table table-cell table-caption list-item"),hm=vi,pm=pi,fm=tr,vm=dr,bm=ji,ym=e=>e>0,wm=e=>e<0,xm=(e,t)=>{let o;for(;o=e(t);)if(!pm(o))return o;return null},Cm=(e,t,o,n,r)=>{const s=new Wn(e,n),a=mm(e)||pm(e);let i;if(wm(t)){if(a&&(i=xm(s.prev.bind(s),!0),o(i)))return i;for(;i=xm(s.prev.bind(s),r);)if(o(i))return i}if(ym(t)){if(a&&(i=xm(s.next.bind(s),!0),o(i)))return i;for(;i=xm(s.next.bind(s),r);)if(o(i))return i}return null},Sm=(e,t)=>{for(;e&&e!==t;){if(gm(e))return e;e=e.parentNode}return null},km=(e,t,o)=>Sm(e.container(),o)===Sm(t.container(),o),_m=(e,t)=>{if(!t)return F.none();const o=t.container(),n=t.offset();return fm(o)?F.from(o.childNodes[n+e]):F.none()},Em=(e,t)=>{var o;const n=(null!==(o=t.ownerDocument)&&void 0!==o?o:document).createRange();return e?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),n},Tm=(e,t,o)=>Sm(t,e)===Sm(o,e),Om=(e,t,o)=>{const n=e?"previousSibling":"nextSibling";let r=o;for(;r&&r!==t;){let e=r[n];if(e&&hm(e)&&(e=e[n]),mm(e)||um(e)){if(Tm(t,e,r))return e;break}if(bm(e))break;r=r.parentNode}return null},Dm=N(Em,!0),Am=N(Em,!1),Mm=(e,t,o)=>{let n;const r=N(Om,!0,t),s=N(Om,!1,t),a=o.startContainer,i=o.startOffset;if(pi(a)){const e=vm(a)?a.parentNode:a,t=e.getAttribute("data-mce-caret");if("before"===t&&(n=e.nextSibling,cm(n)))return Dm(n);if("after"===t&&(n=e.previousSibling,cm(n)))return Am(n)}if(!o.collapsed)return o;if(dr(a)){if(hm(a)){if(1===e){if(n=s(a),n)return Dm(n);if(n=r(a),n)return Am(n)}if(-1===e){if(n=r(a),n)return Am(n);if(n=s(a),n)return Dm(n)}return o}if(Ci(a)&&i>=a.data.length-1)return 1===e&&(n=s(a),n)?Dm(n):o;if(xi(a)&&i<=1)return-1===e&&(n=r(a),n)?Am(n):o;if(i===a.data.length)return n=s(a),n?Dm(n):o;if(0===i)return n=r(a),n?Am(n):o}return o},Nm=(e,t)=>_m(e?0:-1,t).filter(mm),Rm=(e,t,o)=>{const n=Mm(e,t,o);return-1===e?ml.fromRangeStart(n):ml.fromRangeEnd(n)},Bm=e=>F.from(e.getNode()).map(wo.fromDom),Lm=(e,t)=>{let o=t;for(;o=e(o);)if(o.isVisible())return o;return o},Hm=(e,t)=>{const o=km(e,t);return!(o||!fr(e.getNode()))||o};var Im;!function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"}(Im||(Im={}));const Pm=yr,Fm=dr,zm=tr,Vm=fr,Zm=ji,Um=e=>Vi(e)||(e=>!!Wi(e)&&!J(ue(e.getElementsByTagName("*")),((e,t)=>e||Hi(t)),!1))(e),jm=$i,Wm=(e,t)=>e.hasChildNodes()&&t{if(ym(e)){if(Zm(t.previousSibling)&&!Fm(t.previousSibling))return ml.before(t);if(Fm(t))return ml(t,0)}if(wm(e)){if(Zm(t.nextSibling)&&!Fm(t.nextSibling))return ml.after(t);if(Fm(t))return ml(t,t.data.length)}return wm(e)?Vm(t)?ml.before(t):ml.after(t):ml.before(t)},qm=(e,t,o)=>{let n,r,s,a;if(!zm(o)||!t)return null;if(t.isEqual(ml.after(o))&&o.lastChild){if(a=ml.after(o.lastChild),wm(e)&&Zm(o.lastChild)&&zm(o.lastChild))return Vm(o.lastChild)?ml.before(o.lastChild):a}else a=t;const i=a.container();let l=a.offset();if(Fm(i)){if(wm(e)&&l>0)return ml(i,--l);if(ym(e)&&l0&&(r=Wm(i,l-1),Zm(r)))return!Um(r)&&(s=Cm(r,e,jm,r),s)?Fm(s)?ml(s,s.data.length):ml.after(s):Fm(r)?ml(r,r.data.length):ml.before(r);if(ym(e)&&l{const o=t.nextSibling;return o&&Zm(o)?Fm(o)?ml(o,0):ml.before(o):qm(Im.Forwards,ml.after(t),e)})(o,r):!Um(r)&&(s=Cm(r,e,jm,r),s)?Fm(s)?ml(s,0):ml.before(s):Fm(r)?ml(r,0):ml.after(r);n=r||a.getNode()}if(n&&(ym(e)&&a.isAtEnd()||wm(e)&&a.isAtStart())&&(n=Cm(n,e,P,o,!0),jm(n,o)))return $m(e,n);r=n?Cm(n,e,jm,o):n;const c=He(Y(((e,t)=>{const o=[];let n=e;for(;n&&n!==t;)o.push(n),n=n.parentNode;return o})(i,o),Pm));return!c||r&&c.contains(r)?r?$m(e,r):null:(a=ym(e)?ml.after(c):ml.before(c),a)},Gm=e=>({next:t=>qm(Im.Forwards,t,e),prev:t=>qm(Im.Backwards,t,e)}),Km=e=>ml.isTextPosition(e)?0===e.offset():ji(e.getNode()),Ym=e=>{if(ml.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return ji(e.getNode(!0))},Xm=(e,t)=>!ml.isTextPosition(e)&&!ml.isTextPosition(t)&&e.getNode()===t.getNode(!0),Jm=(e,t,o)=>{return e?!Xm(t,o)&&(n=t,!(!ml.isTextPosition(n)&&fr(n.getNode())))&&Ym(t)&&Km(o):!Xm(o,t)&&Km(t)&&Ym(o);var n},Qm=(e,t,o)=>{const n=Gm(t);return F.from(e?n.next(o):n.prev(o))},eu=(e,t,o)=>Qm(e,t,o).bind((n=>km(o,n,t)&&Jm(e,o,n)?Qm(e,t,n):F.some(n))),tu=(e,t,o,n)=>eu(e,t,o).bind((o=>n(o)?tu(e,t,o,n):F.some(o))),ou=(e,t)=>{const o=e?t.firstChild:t.lastChild;return dr(o)?F.some(ml(o,e?0:o.data.length)):o?ji(o)?F.some(e?ml.before(o):fr(n=o)?ml.before(n):ml.after(n)):((e,t,o)=>{const n=e?ml.before(o):ml.after(o);return Qm(e,t,n)})(e,t,o):F.none();var n},nu=N(Qm,!0),ru=N(Qm,!1),su=N(ou,!0),au=N(ou,!1),iu="_mce_caret",lu=e=>tr(e)&&e.id===iu,cu=(e,t)=>{let o=t;for(;o&&o!==e;){if(lu(o))return o;o=o.parentNode}return null},du=e=>Ee(e,"name"),mu=e=>Lt.isArray(e.start),uu=e=>!(!du(e)&&y(e.forward))||e.forward,gu=(e,t)=>(tr(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='
    '),t),hu=(e,t)=>au(e).fold(I,(e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0))),pu=(e,t,o)=>!(!(e=>!e.hasChildNodes())(t)||!cu(e,t)||(((e,t)=>{var o;const n=(null!==(o=e.ownerDocument)&&void 0!==o?o:document).createTextNode(di);e.appendChild(n),t.setStart(n,0),t.setEnd(n,0)})(t,o),0)),fu=(e,t,o,n)=>{const r=o[t?"start":"end"],s=e.getRoot();if(r){let e=s,o=r[0];for(let t=r.length-1;e&&t>=1;t--){const o=e.childNodes;if(pu(s,e,n))return!0;if(r[t]>o.length-1)return!!pu(s,e,n)||hu(e,n);e=o[r[t]]}dr(e)&&(o=Math.min(r[0],e.data.length)),tr(e)&&(o=Math.min(r[0],e.childNodes.length)),t?n.setStart(e,o):n.setEnd(e,o)}return!0},vu=e=>dr(e)&&e.data.length>0,bu=(e,t,o)=>{const n=e.get(o.id+"_"+t),r=null==n?void 0:n.parentNode,s=o.keep;if(n&&r){let a,i;if("start"===t?s?n.hasChildNodes()?(a=n.firstChild,i=1):vu(n.nextSibling)?(a=n.nextSibling,i=0):vu(n.previousSibling)?(a=n.previousSibling,i=n.previousSibling.data.length):(a=r,i=e.nodeIndex(n)+1):(a=r,i=e.nodeIndex(n)):s?n.hasChildNodes()?(a=n.firstChild,i=1):vu(n.previousSibling)?(a=n.previousSibling,i=n.previousSibling.data.length):(a=r,i=e.nodeIndex(n)):(a=r,i=e.nodeIndex(n)),!s){const r=n.previousSibling,s=n.nextSibling;let l;for(Lt.each(Lt.grep(n.childNodes),(e=>{dr(e)&&(e.data=e.data.replace(/\uFEFF/g,""))}));l=e.get(o.id+"_"+t);)e.remove(l,!0);if(dr(s)&&dr(r)&&!Mt.browser.isOpera()){const t=r.data.length;r.appendData(s.data),e.remove(s),a=r,i=t}}return F.some(ml(a,i))}return F.none()},yu=(e,t)=>{const o=e.dom;if(t){if(mu(t))return((e,t)=>{const o=e.createRng();return fu(e,!0,t,o)&&fu(e,!1,t,o)?F.some({range:o,forward:uu(t)}):F.none()})(o,t);if((e=>h(e.start))(t))return((e,t)=>{const o=F.from(Cl(e.getRoot(),t.start)),n=F.from(Cl(e.getRoot(),t.end));return Pt(o,n,((o,n)=>{const r=e.createRng();return r.setStart(o.container(),o.offset()),r.setEnd(n.container(),n.offset()),{range:r,forward:uu(t)}}))})(o,t);if((e=>Ee(e,"id"))(t))return((e,t)=>{const o=bu(e,"start",t),n=bu(e,"end",t);return Pt(o,n.or(o),((o,n)=>{const r=e.createRng();return r.setStart(gu(e,o.container()),o.offset()),r.setEnd(gu(e,n.container()),n.offset()),{range:r,forward:uu(t)}}))})(o,t);if(du(t))return((e,t)=>F.from(e.select(t.name)[t.index]).map((t=>{const o=e.createRng();return o.selectNode(t),{range:o,forward:!0}})))(o,t);if((e=>Ee(e,"rng"))(t))return F.some({range:t.rng,forward:uu(t)})}return F.none()},wu=(e,t,o)=>Nl(e,t,o),xu=(e,t)=>{yu(e,t).each((({range:t,forward:o})=>{e.setRng(t,o)}))},Cu=e=>tr(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),Su=(ku=qn,e=>ku===e);var ku;const _u=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),Eu=e=>!_u(e)&&!Su(e)&&!Gn(e),Tu=e=>{const t=[];if(e)for(let o=0;oY((e=>ne(e,(e=>{const t=Ni(e);return t?[wo.fromDom(t)]:[]})))(e),si),Du=(e,t)=>{const o=Vn(t,"td[data-mce-selected],th[data-mce-selected]");return o.length>0?o:Ou(e)},Au=e=>Du(Tu(e.selection.getSel()),wo.fromDom(e.getBody())),Mu=(e,t)=>tn(e,"table",t),Nu=e=>Po(e).fold(D([e]),(t=>[e].concat(Nu(t)))),Ru=e=>Fo(e).fold(D([e]),(t=>"br"===Wt(t)?No(t).map((t=>[e].concat(Ru(t)))).getOr([]):[e].concat(Ru(t)))),Bu=(e,t)=>Pt((e=>{const t=e.startContainer,o=e.startOffset;return dr(t)?0===o?F.some(wo.fromDom(t)):F.none():F.from(t.childNodes[o]).map(wo.fromDom)})(t),(e=>{const t=e.endContainer,o=e.endOffset;return dr(t)?o===t.data.length?F.some(wo.fromDom(t)):F.none():F.from(t.childNodes[o-1]).map(wo.fromDom)})(t),((t,o)=>{const n=ee(Nu(e),N(ko,t)),r=ee(Ru(e),N(ko,o));return n.isSome()&&r.isSome()})).getOr(!1),Lu=(e,t,o,n)=>{const r=o,s=new Wn(o,r),a=Ce(e.schema.getMoveCaretBeforeOnEnterElements(),((e,t)=>!j(["td","th","table"],t.toLowerCase())));let i=o;do{if(dr(i)&&0!==Lt.trim(i.data).length)return void(n?t.setStart(i,0):t.setEnd(i,i.data.length));if(a[i.nodeName])return void(n?t.setStartBefore(i):"BR"===i.nodeName?t.setEndBefore(i):t.setEndAfter(i))}while(i=n?s.next():s.prev());"BODY"===r.nodeName&&(n?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},Hu=e=>{const t=e.selection.getSel();return C(t)&&t.rangeCount>0},Iu=(e,t)=>{const o=Au(e);o.length>0?q(o,(o=>{const n=o.dom,r=e.dom.createRng();r.setStartBefore(n),r.setEndAfter(n),t(r,!0)})):t(e.selection.getRng(),!1)},Pu=(e,t,o)=>{const n=Ml(e,t);o(n),e.moveToBookmark(n)},Fu=e=>k(null==e?void 0:e.nodeType),zu=e=>tr(e)&&!Cu(e)&&!lu(e)&&!ar(e),Vu=(e,t,o)=>{const{selection:n,dom:r}=e,s=n.getNode(),a=yr(s);Pu(n,!0,(()=>{t()})),a&&yr(s)&&r.isChildOf(s,e.getBody())?e.selection.select(s):o(n.getStart())&&Zu(r,n)},Zu=(e,t)=>{var o,n;const r=t.getRng(),{startContainer:s,startOffset:a}=r;if(!((e,t)=>{if(zu(t)&&!/^(TD|TH)$/.test(t.nodeName)){const o=e.getAttrib(t,"data-mce-selected"),n=parseInt(o,10);return!isNaN(n)&&n>0}return!1})(e,t.getNode())&&tr(s)){const i=s.childNodes,l=e.getRoot();let c;if(a{if(e){const n=t?"nextSibling":"previousSibling";for(e=o?e:e[n];e;e=e[n])if(tr(e)||!$u(e))return e}},ju=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Yr(e,t),Wu=(e,t,o)=>e.schema.isValidChild(t,o),$u=(e,t=!1)=>{if(C(e)&&dr(e)){const o=t?e.data.replace(/ /g," "):e.data;return Yn(o)}return!1},qu=(e,t)=>{const o=e.dom;return zu(t)&&"false"===o.getContentEditable(t)&&((e,t)=>{const o="[data-mce-cef-wrappable]",n=Wc(e),r=Je(n)?o:`${o},${n}`;return Co(wo.fromDom(t),r)})(e,t)&&0===o.select('[contenteditable="true"]',t).length},Gu=(e,t)=>S(e)?e(t):(C(t)&&(e=e.replace(/%(\w+)/g,((e,o)=>t[o]||e))),e),Ku=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),Yu=(e,t)=>{if(x(e))return null;{let o=String(e);return"color"!==t&&"backgroundColor"!==t||(o=Xs(o)),"fontWeight"===t&&700===e&&(o="bold"),"fontFamily"===t&&(o=o.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),o}},Xu=(e,t,o)=>{const n=e.getStyle(t,o);return Yu(n,o)},Ju=(e,t)=>{let o;return e.getParent(t,(t=>!!tr(t)&&(o=e.getStyle(t,"text-decoration"),!!o&&"none"!==o))),o},Qu=(e,t,o)=>e.getParents(t,o,e.getRoot()),eg=(e,t,o)=>{const n=e.formatter.get(t);return C(n)&&W(n,o)},tg=(e,t,o)=>{const n=["inline","block","selector","attributes","styles","classes"],r=e=>Ce(e,((e,t)=>W(n,(e=>e===t))));return eg(e,t,(t=>{const n=r(t);return eg(e,o,(e=>{const t=r(e);return((e,t,o=i)=>a(o).eq(e,t))(n,t)}))}))},og=e=>Te(e,"block"),ng=e=>Te(e,"selector"),rg=e=>Te(e,"inline"),sg=e=>ng(e)&&!1!==e.expand&&!rg(e),ag=e=>(e=>{const t=[];let o=e;for(;o;){if(dr(o)&&o.data!==di||o.childNodes.length>1)return[];tr(o)&&t.push(o),o=o.firstChild}return t})(e).length>0,ig=e=>lu(e.dom)&&ag(e.dom),lg=Cu,cg=Qu,dg=$u,mg=ju,ug=(e,t)=>{let o=t;for(;o;){if(tr(o)&&e.getContentEditable(o))return"false"===e.getContentEditable(o)?o:t;o=o.parentNode}return t},gg=(e,t,o,n)=>{const r=t.data;if(e){for(let e=o;e>0;e--)if(n(r.charAt(e-1)))return e}else for(let e=o;egg(e,t,o,(e=>Su(e)||_u(e))),pg=(e,t,o)=>gg(e,t,o,Eu),fg=(e,t,o,n,r,s)=>{let a;const i=e.getParent(o,e.isBlock)||t,l=(t,o,n)=>{const s=Ya(e),l=r?s.backwards:s.forwards;return F.from(l(t,o,((e,t)=>lg(e.parentNode)?-1:(a=e,n(r,e,t))),i))};return l(o,n,hg).bind((e=>s?l(e.container,e.offset+(r?-1:0),pg):F.some(e))).orThunk((()=>a?F.some({container:a,offset:r?0:a.length}):F.none()))},vg=(e,t,o,n,r)=>{const s=n[r];dr(n)&&Je(n.data)&&s&&(n=s);const a=cg(e,n);for(let n=0;n{var r;let s=o;const a=e.getRoot(),i=t[0];if(og(i)&&(s=i.wrapper?null:e.getParent(o,i.block,a)),!s){const t=null!==(r=e.getParent(o,"LI,TD,TH,SUMMARY"))&&void 0!==r?r:a;s=e.getParent(dr(o)?o.parentNode:o,(t=>t!==a&&mg(e.schema,t)),t)}if(s&&og(i)&&i.wrapper&&(s=cg(e,s,"ul,ol").reverse()[0]||s),!s)for(s=o;s&&s[n]&&!e.isBlock(s[n])&&(s=s[n],!Ku(s,"br")););return s||o},yg=(e,t,o,n)=>{const r=o.parentNode;return!C(o[n])&&(!(r!==t&&!x(r)&&!e.isBlock(r))||yg(e,t,r,n))},wg=(e,t,o,n,r)=>{let s=o;const a=r?"previousSibling":"nextSibling",i=e.getRoot();if(dr(o)&&!dg(o)&&(r?n>0:nlg(e.parentNode)||lg(e),Cg=(e,t,o,n=!1)=>{let{startContainer:r,startOffset:s,endContainer:a,endOffset:i}=t;const l=o[0];return tr(r)&&r.hasChildNodes()&&(r=Ri(r,s),dr(r)&&(s=0)),tr(a)&&a.hasChildNodes()&&(a=Ri(a,t.collapsed?i:i-1),dr(a)&&(i=a.data.length)),r=ug(e,r),a=ug(e,a),xg(r)&&(r=lg(r)?r:r.parentNode,r=t.collapsed?r.previousSibling||r:r.nextSibling||r,dr(r)&&(s=t.collapsed?r.length:0)),xg(a)&&(a=lg(a)?a:a.parentNode,a=t.collapsed?a.nextSibling||a:a.previousSibling||a,dr(a)&&(i=t.collapsed?0:a.length)),t.collapsed&&(fg(e,e.getRoot(),r,s,!0,n).each((({container:e,offset:t})=>{r=e,s=t})),fg(e,e.getRoot(),a,i,!1,n).each((({container:e,offset:t})=>{a=e,i=t}))),(rg(l)||l.block_expand)&&(rg(l)&&dr(r)&&0!==s||(r=wg(e,o,r,s,!0)),rg(l)&&dr(a)&&i!==a.data.length||(a=wg(e,o,a,i,!1))),sg(l)&&(r=vg(e,o,t,r,"previousSibling"),a=vg(e,o,t,a,"nextSibling")),(og(l)||ng(l))&&(r=bg(e,o,r,"previousSibling"),a=bg(e,o,a,"nextSibling"),og(l)&&(e.isBlock(r)||(r=wg(e,o,r,s,!0),dr(r)&&(s=0)),e.isBlock(a)||(a=wg(e,o,a,i,!1),dr(a)&&(i=a.data.length)))),tr(r)&&r.parentNode&&(s=e.nodeIndex(r),r=r.parentNode),tr(a)&&a.parentNode&&(i=e.nodeIndex(a)+1,a=a.parentNode),{startContainer:r,startOffset:s,endContainer:a,endOffset:i}},Sg=(e,t,o)=>{var n;const r=t.startOffset,s=Ri(t.startContainer,r),a=t.endOffset,i=Ri(t.endContainer,a-1),l=e=>{const t=e[0];dr(t)&&t===s&&r>=t.data.length&&e.splice(0,1);const o=e[e.length-1];return 0===a&&e.length>0&&o===i&&dr(o)&&e.splice(e.length-1,1),e},c=(e,t,o)=>{const n=[];for(;e&&e!==o;e=e[t])n.push(e);return n},d=(t,o)=>e.getParent(t,(e=>e.parentNode===o),o),m=(e,t,n)=>{const r=n?"nextSibling":"previousSibling";for(let s=e,a=s.parentNode;s&&s!==t;s=a){a=s.parentNode;const t=c(s===e?s:s[r],r);t.length&&(n||t.reverse(),o(l(t)))}};if(s===i)return o(l([s]));const u=null!==(n=e.findCommonAncestor(s,i))&&void 0!==n?n:e.getRoot();if(e.isChildOf(s,i))return m(s,u,!0);if(e.isChildOf(i,s))return m(i,u);const g=d(s,u)||s,h=d(i,u)||i;m(s,g,!0);const p=c(g===s?g:g.nextSibling,"nextSibling",h===i?h.nextSibling:h);p.length&&o(l(p)),m(i,h)},kg=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],_g=(e,t,o,n)=>Do(t).fold((()=>"skipping"),(r=>"br"===n||(e=>Yt(e)&&Ja(e)===di)(t)?"valid":(e=>Kt(e)&&bo(e,Ma()))(t)?"existing":lu(t.dom)?"caret":W(kg,(e=>Co(t,e)))?"valid-block":Wu(e,o,n)&&Wu(e,Wt(r),o)?"valid":"invalid-child")),Eg=(e,t,o,n,r,s)=>{const{uid:a=t,...i}=o;ho(e,Ma()),to(e,`${Ra()}`,a),to(e,`${Na()}`,n);const{attributes:l={},classes:c=[]}=r(a,i);if(oo(e,l),((e,t)=>{q(t,(t=>{ho(e,t)}))})(e,c),s){c.length>0&&to(e,`${La()}`,c.join(","));const t=pe(l);t.length>0&&to(e,`${Ha()}`,t.join(","))}},Tg=e=>{fo(e,Ma()),ao(e,`${Ra()}`),ao(e,`${Na()}`),ao(e,`${Ba()}`);const t=ro(e,`${Ha()}`).map((e=>e.split(","))).getOr([]),o=ro(e,`${La()}`).map((e=>e.split(","))).getOr([]);var n;q(t,(t=>ao(e,t))),n=e,q(o,(e=>{fo(n,e)})),ao(e,`${La()}`),ao(e,`${Ha()}`)},Og=(e,t,o,n,r)=>{const s=wo.fromTag("span",e);return Eg(s,t,o,n,r,!1),s},Dg=(e,t,o,n,r,s)=>{const a=[],i=Og(e.getDoc(),o,s,n,r),l=Oa(),c=()=>{l.clear()},d=e=>{q(e,m)},m=t=>{switch(_g(e,t,"span",Wt(t))){case"invalid-child":{c();const e=Ho(t);d(e),c();break}case"valid-block":c(),Eg(t,o,s,n,r,!0);break;case"valid":{const e=l.get().getOrThunk((()=>{const e=$a(i);return a.push(e),l.set(e),e}));wn(t,e);break}}};return Sg(e.dom,t,(e=>{c(),(e=>{const t=$(e,wo.fromDom);d(t)})(e)})),a},Ag=(e,t,o,n)=>{e.undoManager.transact((()=>{const r=e.selection,s=r.getRng(),a=Au(e).length>0,i=ja("mce-annotation");if(s.collapsed&&!a&&((e,t)=>{const o=Cg(e.dom,t,[{inline:"span"}]);t.setStart(o.startContainer,o.startOffset),t.setEnd(o.endContainer,o.endOffset),e.selection.setRng(t)})(e,s),r.getRng().collapsed&&!a){const s=Og(e.getDoc(),i,n,t,o.decorate);Tn(s,qn),r.getRng().insertNode(s.dom),r.select(s.dom)}else Pu(r,!1,(()=>{Iu(e,(r=>{Dg(e,r,i,t,o.decorate,n)}))}))}))},Mg=e=>{const t=(()=>{const e={};return{register:(t,o)=>{e[t]={name:t,settings:o}},lookup:t=>_e(e,t).map((e=>e.settings)),getNames:()=>pe(e)}})();((e,t)=>{const o=Na(),n=e=>F.from(e.attr(o)).bind(t.lookup),r=e=>{var t,o;e.attr(Ra(),null),e.attr(Na(),null),e.attr(Ba(),null);const n=F.from(e.attr(Ha())).map((e=>e.split(","))).getOr([]),r=F.from(e.attr(La())).map((e=>e.split(","))).getOr([]);q(n,(t=>e.attr(t,null)));const s=null!==(o=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==o?o:[],a=ae(s,[Ma()].concat(r));e.attr("class",a.length>0?a.join(" "):null),e.attr(La(),null),e.attr(Ha(),null)};e.serializer.addTempAttr(Ba()),e.serializer.addAttributeFilter(o,(e=>{for(const t of e)n(t).each((e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))}))}))})(e,t);const o=Za(e,t),n=Qt("span"),r=e=>{q(e,(e=>{n(e)?kn(e):Tg(e)}))};return{register:(e,o)=>{t.register(e,o)},annotate:(o,n)=>{t.lookup(o).each((t=>{Ag(e,o,t,n)}))},annotationChanged:(e,t)=>{o.addListener(e,t)},remove:t=>{Pa(e,F.some(t)).each((({elements:t})=>{const o=e.selection.getBookmark();r(t),e.selection.moveToBookmark(o)}))},removeAll:t=>{const o=e.selection.getBookmark();ve(Va(e,t),((e,t)=>{r(e)})),e.selection.moveToBookmark(o)},getAll:t=>{const o=Va(e,t);return be(o,(e=>$(e,(e=>e.dom))))}}},Ng=e=>({getBookmark:N(wu,e),moveToBookmark:N(xu,e)});Ng.isBookmarkNode=Cu;const Rg=(e,t,o)=>!o.collapsed&&W(o.getClientRects(),(o=>((e,t,o)=>t>=e.left&&t<=e.right&&o>=e.top&&o<=e.bottom)(o,e,t))),Bg=(e,t,o)=>{e.dispatch(t,o)},Lg=(e,t,o,n)=>{e.dispatch("FormatApply",{format:t,node:o,vars:n})},Hg=(e,t,o,n)=>{e.dispatch("FormatRemove",{format:t,node:o,vars:n})},Ig=(e,t)=>e.dispatch("SetContent",t),Pg=(e,t)=>e.dispatch("GetContent",t),Fg=(e,t)=>{e.dispatch("AutocompleterUpdateActiveRange",t)},zg=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),Vg={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||Vg.metaKeyPressed(e),metaKeyPressed:e=>Mt.os.isMacOS()||Mt.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},Zg="data-mce-selected",Ug=Math.abs,jg=Math.round,Wg={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},$g=(e,t)=>{const o=t.dom,n=t.getDoc(),r=document,s=t.getBody();let a,i,l,c,d,m,u,g,h,p,f,v,b,y,w;const x=e=>C(e)&&(vr(e)||o.is(e,"figure.image")),S=e=>Cr(e)||o.hasClass(e,"mce-preview-object"),k=e=>{const o=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const o=e.touches[0];return x(e.target)&&!Rg(o.clientX,o.clientY,t)}return x(e.target)&&!Rg(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(o)},_=e=>o.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?[e,e.firstElementChild]:o.is(e,"figure.image")?[e.querySelector("img")]:[e],E=e=>{const n=Nc(t);return!!n&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(o.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?Co(wo.fromDom(e.firstElementChild),n):Co(wo.fromDom(e),n))},T=(e,n,r)=>{if(C(r)){const s=_(e);q(s,(e=>{e.style[n]||!t.schema.isValid(e.nodeName.toLowerCase(),n)?o.setStyle(e,n,r):o.setAttrib(e,n,""+r)}))}},O=(e,t,o)=>{T(e,"width",t),T(e,"height",o)},D=e=>{let n,r,d,C,k;n=e.screenX-m,r=e.screenY-u,v=n*c[2]+g,b=r*c[3]+h,v=v<5?5:v,b=b<5?5:b,d=(x(a)||S(a))&&!1!==Rc(t)?!Vg.modifierPressed(e):Vg.modifierPressed(e),d&&(Ug(n)>Ug(r)?(b=jg(v*p),v=jg(b/p)):(v=jg(b/p),b=jg(v*p))),O(i,v,b),C=c.startPos.x+n,k=c.startPos.y+r,C=C>0?C:0,k=k>0?k:0,o.setStyles(l,{left:C,top:k,display:"block"}),l.innerHTML=v+" × "+b,c[2]<0&&i.clientWidth<=v&&o.setStyle(i,"left",void 0+(g-v)),c[3]<0&&i.clientHeight<=b&&o.setStyle(i,"top",void 0+(h-b)),n=s.scrollWidth-y,r=s.scrollHeight-w,n+r!==0&&o.setStyles(l,{left:C-n,top:k-r}),f||(((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(t,a,g,h,"corner-"+c.name),f=!0)},A=()=>{const e=f;f=!1,e&&(T(a,"width",v),T(a,"height",b)),o.unbind(n,"mousemove",D),o.unbind(n,"mouseup",A),r!==n&&(o.unbind(r,"mousemove",D),o.unbind(r,"mouseup",A)),o.remove(i),o.remove(l),o.remove(d),M(a),e&&(((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(t,a,v,b,"corner-"+c.name),o.setAttrib(a,"style",o.getAttrib(a,"style"))),t.nodeChanged()},M=e=>{H();const f=o.getPos(e,s),x=f.x,C=f.y,k=e.getBoundingClientRect(),T=k.width||k.right-k.left,M=k.height||k.bottom-k.top;a!==e&&(R(),a=e,v=b=0);const N=t.dispatch("ObjectSelected",{target:e});E(e)&&!N.isDefaultPrevented()?ve(Wg,((e,t)=>{const f=f=>{const v=_(a)[0];m=f.screenX,u=f.screenY,g=v.clientWidth,h=v.clientHeight,p=h/g,c=e,c.name=t,c.startPos={x:T*e[0]+x,y:M*e[1]+C},y=s.scrollWidth,w=s.scrollHeight,d=o.add(s,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),o.setStyles(d,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),i=((e,t)=>{if(S(t))return e.create("img",{src:Mt.transparentSrc});if(ir(t)){const o=We(c.name,"n")?de:me,n=t.cloneNode(!0);return o(e.select("tr",n)).each((t=>{const o=e.select("td,th",t);e.setStyle(t,"height",null),q(o,(t=>e.setStyle(t,"height",null)))})),n}return t.cloneNode(!0)})(o,a),o.addClass(i,"mce-clonedresizable"),o.setAttrib(i,"data-mce-bogus","all"),i.contentEditable="false",o.setStyles(i,{left:x,top:C,margin:0}),O(i,T,M),i.removeAttribute(Zg),s.appendChild(i),o.bind(n,"mousemove",D),o.bind(n,"mouseup",A),r!==n&&(o.bind(r,"mousemove",D),o.bind(r,"mouseup",A)),l=o.add(s,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},g+" × "+h)};let v=o.get("mceResizeHandle"+t);v&&o.remove(v),v=o.add(s,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),o.bind(v,"mousedown",(e=>{e.stopImmediatePropagation(),e.preventDefault(),f(e)})),e.elm=v,o.setStyles(v,{left:T*e[0]+x-v.offsetWidth/2,top:M*e[1]+C-v.offsetHeight/2})})):R(!1)},N=Da(M,0),R=(e=!0)=>{N.cancel(),H(),a&&e&&a.removeAttribute(Zg),ve(Wg,((e,t)=>{const n=o.get("mceResizeHandle"+t);n&&(o.unbind(n),o.remove(n))}))},B=(e,t)=>o.isChildOf(e,t),L=n=>{if(f||t.removed||t.composing)return;const r="mousedown"===n.type?n.target:e.getNode(),a=nn(wo.fromDom(r),"table,img,figure.image,hr,video,span.mce-preview-object,details").map((e=>e.dom)).filter((e=>o.isEditable(e.parentElement)||"IMG"===e.nodeName&&o.isEditable(e))).getOrUndefined(),i=C(a)?o.getAttrib(a,Zg,"1"):"1";if(q(o.select(`img[${Zg}],hr[${Zg}]`),(e=>{e.removeAttribute(Zg)})),C(a)&&B(a,s)&&t.hasFocus()){I();const t=e.getStart(!0);if(B(t,a)&&B(e.getEnd(!0),a))return o.setAttrib(a,Zg,i),void N.throttle(a)}R()},H=()=>{ve(Wg,(e=>{e.elm&&(o.unbind(e.elm),delete e.elm)}))},I=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch(e){}};return t.on("init",(()=>{I(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",L),t.on("keyup compositionend",(e=>{a&&"TABLE"===a.nodeName&&L(e)})),t.on("hide blur",R),t.on("contextmenu longpress",k,!0)})),t.on("remove",H),{isResizable:E,showResizeRect:M,hideResizeRect:R,updateResizeRect:L,destroy:()=>{N.cancel(),a=i=d=null}}},qg=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.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},Gg=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},Kg=Il([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Yg=(e,t,o)=>t(wo.fromDom(o.startContainer),o.startOffset,wo.fromDom(o.endContainer),o.endOffset),Xg=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:D(e),rtl:F.none}),relative:(t,o)=>({ltr:Ie((()=>qg(e,t,o))),rtl:Ie((()=>F.some(qg(e,o,t))))}),exact:(t,o,n,r)=>({ltr:Ie((()=>Gg(e,t,o,n,r))),rtl:Ie((()=>F.some(Gg(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>Kg.rtl(wo.fromDom(e.endContainer),e.endOffset,wo.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Yg(0,Kg.ltr,o))):Yg(0,Kg.ltr,o)})(0,o)};Kg.ltr,Kg.rtl;const Jg=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Qg=(e,t,o)=>{var n,r;return F.from(null===(r=(n=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(n,t,o)).bind((t=>{if(null===t.offsetNode)return F.none();const o=e.dom.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),F.some(o)}))},eh=(e,t,o)=>{var n,r;return F.from(null===(r=(n=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(n,t,o))},th=document.caretPositionFromPoint?Qg:document.caretRangeFromPoint?eh:F.none,oh=Il([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),nh={before:oh.before,on:oh.on,after:oh.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(A,A,A)},rh=Il([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),sh={domRange:rh.domRange,relative:rh.relative,exact:rh.exact,exactFromRange:e=>rh.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>wo.fromDom(e.startContainer),relative:(e,t)=>nh.getStart(e),exact:(e,t,o,n)=>e}))(e);return Oo(t)},range:Jg},ah=(e,t)=>{const o=Wt(e);return"input"===o?nh.after(e):j(["br","img"],o)?0===t?nh.before(e):nh.after(e):nh.on(e,t)},ih=(e,t)=>{const o=e.fold(nh.before,ah,nh.after),n=t.fold(nh.before,ah,nh.after);return sh.relative(o,n)},lh=(e,t,o,n)=>{const r=ah(e,t),s=ah(o,n);return sh.relative(r,s)},ch=(e,t)=>{const o=(t||document).createDocumentFragment();return q(e,(e=>{o.appendChild(e.dom)})),wo.fromDom(o)},dh=e=>{const t=sh.getWin(e).dom,o=(e,o,n,r)=>Gg(t,e,o,n,r),n=(e=>e.match({domRange:e=>{const t=wo.fromDom(e.startContainer),o=wo.fromDom(e.endContainer);return lh(t,e.startOffset,o,e.endOffset)},relative:ih,exact:lh}))(e);return Xg(t,n).match({ltr:o,rtl:o})},mh=(e,t,o)=>((e,t,o)=>{const n=wo.fromDom(e.document);return th(n,t,o).map((e=>Jg(wo.fromDom(e.startContainer),e.startOffset,wo.fromDom(e.endContainer),e.endOffset)))})(e,t,o),uh=(e,t,o)=>{const n=Oo(wo.fromDom(o));return mh(n.dom,e,t).map((e=>{const t=o.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t})).getOrUndefined()},gh=(e,t)=>C(e)&&C(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,hh=(e,t,o)=>null!==((e,t,o)=>{let n=e;for(;n&&n!==t;){if(o(n))return n;n=n.parentNode}return null})(e,t,o),ph=(e,t,o)=>hh(e,t,(e=>e.nodeName===o)),fh=(e,t)=>vi(e)&&!hh(e,t,lu),vh=(e,t,o)=>{const n=t.parentNode;if(n){const r=new Wn(t,e.getParent(n,e.isBlock)||e.getRoot());let s;for(;s=r[o?"prev":"next"]();)if(fr(s))return!0}return!1},bh=(e,t,o,n,r)=>{const s=e.getRoot(),a=e.schema.getNonEmptyElements(),i=r.parentNode;let l,c;if(!i)return F.none();const d=e.getParent(i,e.isBlock)||s;if(n&&fr(r)&&t&&e.isEmpty(d))return F.some(ml(i,e.nodeIndex(r)));const m=new Wn(r,d);for(;c=m[n?"prev":"next"]();){if("false"===e.getContentEditableParent(c)||fh(c,s))return F.none();if(dr(c)&&c.data.length>0)return ph(c,s,"A")?F.none():F.some(ml(c,n?c.data.length:0));if(e.isBlock(c)||a[c.nodeName.toLowerCase()])return F.none();l=c}return gr(l)?F.none():o&&l?F.some(ml(l,0)):F.none()},yh=(e,t,o,n)=>{const r=e.getRoot();let s,a=!1,i=o?n.startContainer:n.endContainer,l=o?n.startOffset:n.endOffset;const c=tr(i)&&l===i.childNodes.length,d=e.schema.getNonEmptyElements();let m=o;if(vi(i))return F.none();if(tr(i)&&l>i.childNodes.length-1&&(m=!1),hr(i)&&(i=r,l=0),i===r){if(m&&(s=i.childNodes[l>0?l-1:0],s)){if(vi(s))return F.none();if(d[s.nodeName]||ir(s))return F.none()}if(i.hasChildNodes()){if(l=Math.min(!m&&l>0?l-1:l,i.childNodes.length-1),i=i.childNodes[l],l=dr(i)&&c?i.data.length:0,!t&&i===r.lastChild&&ir(i))return F.none();if(((e,t)=>{let o=t;for(;o&&o!==e;){if(yr(o))return!0;o=o.parentNode}return!1})(r,i)||vi(i))return F.none();if(kr(i))return F.none();if(i.hasChildNodes()&&!ir(i)){s=i;const t=new Wn(i,r);do{if(yr(s)||vi(s)){a=!1;break}if(dr(s)&&s.data.length>0){l=m?0:s.data.length,i=s,a=!0;break}if(d[s.nodeName.toLowerCase()]&&!xr(s)){l=e.nodeIndex(s),i=s.parentNode,m||l++,a=!0;break}}while(s=m?t.next():t.prev())}}}return t&&(dr(i)&&0===l&&bh(e,c,t,!0,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),tr(i)&&(s=i.childNodes[l],s||(s=i.childNodes[l-1]),!s||!fr(s)||((e,t)=>{var o;return(null===(o=e.previousSibling)||void 0===o?void 0:o.nodeName)===t})(s,"A")||vh(e,s,!1)||vh(e,s,!0)||bh(e,c,t,!0,s).each((e=>{i=e.container(),l=e.offset(),a=!0})))),m&&!t&&dr(i)&&l===i.data.length&&bh(e,c,t,!1,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),a&&i?F.some(ml(i,l)):F.none()},wh=(e,t)=>{const o=t.collapsed,n=t.cloneRange(),r=ml.fromRangeStart(t);return yh(e,o,!0,n).each((e=>{o&&ml.isAbove(r,e)||n.setStart(e.container(),e.offset())})),o||yh(e,o,!1,n).each((e=>{n.setEnd(e.container(),e.offset())})),o&&n.collapse(!0),gh(t,n)?F.none():F.some(n)},xh=(e,t)=>e.splitText(t),Ch=e=>{let t=e.startContainer,o=e.startOffset,n=e.endContainer,r=e.endOffset;if(t===n&&dr(t)){if(o>0&&oo){r-=o;const e=xh(n,r).previousSibling;t=n=e,r=e.data.length,o=0}else r=0}else if(dr(t)&&o>0&&o0&&r({walk:(t,o)=>Sg(e,t,o),split:Ch,expand:(t,o={type:"word"})=>{if("word"===o.type){const o=Cg(e,t,[{inline:"span"}]),n=e.createRng();return n.setStart(o.startContainer,o.startOffset),n.setEnd(o.endContainer,o.endOffset),n}return t},normalize:t=>wh(e,t).fold(I,(e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0)))});Sh.compareRanges=gh,Sh.getCaretRangeFromPoint=uh,Sh.getSelectedNode=Ni,Sh.getNode=Ri;const kh=((e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=mn(o,e);return parseFloat(t)||0}return n},n=(e,t)=>J(t,((t,o)=>{const n=mn(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!k(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;an(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}})("height",(e=>{const t=e.dom;return Ko(e)?t.getBoundingClientRect().height:t.offsetHeight})),_h=()=>wo.fromDom(document),Eh=(e,t)=>e.view(t).fold(D([]),(t=>{const o=e.owner(t),n=Eh(e,o);return[t].concat(n)}));var Th=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?F.none():F.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(wo.fromDom)},owner:e=>To(e)});const Oh=e=>{const t=_h(),o=Ln(t),n=((e,t)=>{const o=t.owner(e);return Eh(t,o)})(e,Th),r=Bn(e),s=X(n,((e,t)=>{const o=Bn(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return Nn(s.left+r.left+o.left,s.top+r.top+o.top)},Dh=e=>"textarea"===Wt(e),Ah=(e,t)=>{const o=(e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Nn(o.offsetLeft,o.offsetTop);const s=Rn(null==n?void 0:n.pageYOffset,r.scrollTop),a=Rn(null==n?void 0:n.pageXOffset,r.scrollLeft),i=Rn(r.clientTop,o.clientTop),l=Rn(r.clientLeft,o.clientLeft);return Bn(e).translate(a-l,s-i)})(e),n=(e=>kh.get(e))(e);return{element:e,bottom:o.top+n,height:n,pos:o,cleanup:t}},Mh=(e,t)=>{const o=((e,t)=>{const o=Ho(e);if(0===o.length||Dh(e))return{element:e,offset:t};if(t\ufeff
    ');return fn(o.element,n),Ah(n,(()=>Sn(n)))},Nh=(e,t,o,n)=>{Hh(e,((r,s)=>Bh(e,t,o,n)),o)},Rh=(e,t,o,n,r)=>{const s={elm:n.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,s)||(o(e,t,Ln(t).top,n,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,s))},Bh=(e,t,o,n)=>{const r=wo.fromDom(e.getBody()),s=wo.fromDom(e.getDoc());r.dom.offsetWidth;const a=Mh(wo.fromDom(o.startContainer),o.startOffset);Rh(e,s,t,a,n),a.cleanup()},Lh=(e,t,o,n)=>{const r=wo.fromDom(e.getDoc());Rh(e,r,o,(e=>Ah(wo.fromDom(e),E))(t),n)},Hh=(e,t,o)=>{const n=o.startContainer,r=o.startOffset,s=o.endContainer,a=o.endOffset;t(wo.fromDom(n),wo.fromDom(s));const i=e.dom.createRng();i.setStart(n,r),i.setEnd(s,a),e.selection.setRng(o)},Ih=(e,t,o,n,r)=>{const s=t.pos;if(n)Hn(s.left,s.top,r);else{const n=s.top-o+t.height;Hn(-e.getBody().getBoundingClientRect().left,n,r)}},Ph=(e,t,o,n,r,s)=>{const a=n+o,i=r.pos.top,l=r.bottom,c=l-i>=n;ia?Ih(e,r,n,c?!1!==s:!0===s,t):l>a&&!c&&Ih(e,r,n,!0===s,t)},Fh=(e,t,o,n,r)=>{const s=Oo(t).dom.innerHeight;Ph(e,t,o,s,n,r)},zh=(e,t,o,n,r)=>{const s=Oo(t).dom.innerHeight;Ph(e,t,o,s,n,r);const a=Oh(n.element),i=Fn(window);a.topi.bottom&&In(n.element,!0===r)},Vh=(e,t,o)=>Nh(e,Fh,t,o),Zh=(e,t,o)=>Lh(e,t,Fh,o),Uh=(e,t,o)=>Nh(e,zh,t,o),jh=(e,t,o)=>Lh(e,t,zh,o),Wh=(e,t,o)=>{(e.inline?Vh:Uh)(e,t,o)},$h=(e,t=!1)=>e.dom.focus({preventScroll:t}),qh=e=>{const t=jo(e).dom;return e.dom===t.activeElement},Gh=(e=_h())=>F.from(e.dom.activeElement).map(wo.fromDom),Kh=(e,t)=>{const o=Yt(t)?Ja(t).length:Ho(t).length+1;return e>o?o:e<0?0:e},Yh=e=>sh.range(e.start,Kh(e.soffset,e.start),e.finish,Kh(e.foffset,e.finish)),Xh=(e,t)=>!er(t.dom)&&(_o(e,t)||ko(e,t)),Jh=e=>t=>Xh(e,t.start)&&Xh(e,t.finish),Qh=e=>sh.range(wo.fromDom(e.startContainer),e.startOffset,wo.fromDom(e.endContainer),e.endOffset),ep=e=>(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?F.from(t.getRangeAt(0)):F.none()).map(Qh)})(Oo(e).dom).filter(Jh(e)),tp=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),F.some(t)}catch(e){return F.none()}},op=e=>{const t=(e=>e.inline||Mt.browser.isFirefox())(e)?ep(wo.fromDom(e.getBody())):F.none();e.bookmark=t.isSome()?t:e.bookmark},np=e=>(e.bookmark?e.bookmark:F.none()).bind((t=>((e,t)=>F.from(t).filter(Jh(e)).map(Yh))(wo.fromDom(e.getBody()),t))).bind(tp),rp={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},sp={setEditorTimeout:(e,t,o)=>((e,t)=>(k(t)||(t=0),setTimeout(e,t)))((()=>{e.removed||t()}),o),setEditorInterval:(e,t,o)=>{const n=((e,t)=>(k(t)||(t=0),setInterval(e,t)))((()=>{e.removed?clearInterval(n):t()}),o);return n}},ap=e=>{const t=Da((()=>{op(e)}),0);e.on("init",(()=>{e.inline&&((e,t)=>{const o=()=>{t.throttle()};ba.DOM.bind(document,"mouseup",o),e.on("remove",(()=>{ba.DOM.unbind(document,"mouseup",o)}))})(e,t),((e,t)=>{((e,t)=>{e.on("mouseup touchend",(e=>{t.throttle()}))})(e,t),e.on("keyup NodeChange AfterSetSelectionRange",(t=>{(e=>"nodechange"===e.type&&e.selectionChange)(t)||op(e)}))})(e,t)})),e.on("remove",(()=>{t.cancel()}))};let ip;const lp=ba.DOM,cp=e=>{const t=e.classList;return void 0!==t&&(t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"))},dp=(e,t)=>{const o=$c(e),n=lp.getParent(t,(t=>(e=>tr(e)&&rp.isEditorUIElement(e))(t)||!!o&&e.dom.is(t,o)));return null!==n},mp=e=>{try{const t=jo(wo.fromDom(e.getElement()));return Gh(t).fold((()=>document.body),(e=>e.dom))}catch(e){return document.body}},up=(e,t)=>{const o=t.editor;ap(o);const n=(e,t)=>{Bd(e)&&!0!==e.inline&&t(wo.fromDom(e.getContainer()),"tox-edit-focus")};o.on("focusin",(()=>{const t=e.focusedEditor;cp(mp(o))&&n(o,ho),t!==o&&(t&&t.dispatch("blur",{focusedEditor:o}),e.setActive(o),e.focusedEditor=o,o.dispatch("focus",{blurredEditor:t}),o.focus(!0))})),o.on("focusout",(()=>{sp.setEditorTimeout(o,(()=>{const t=e.focusedEditor;cp(mp(o))&&t===o||n(o,fo),dp(o,mp(o))||t!==o||(o.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)}))})),ip||(ip=t=>{const o=e.activeEditor;o&&qo(t).each((t=>{const n=t;n.ownerDocument===document&&(n===document.body||dp(o,n)||e.focusedEditor!==o||(o.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))}))},lp.bind(document,"focusin",ip))},gp=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&ip&&(lp.unbind(document,"focusin",ip),ip=null)},hp=(e,t)=>(e=>e.collapsed?F.from(Ri(e.startContainer,e.startOffset)).map(wo.fromDom):F.none())(t).bind((t=>ri(t)?F.some(t):_o(e,t)?F.none():F.some(e))),pp=(e,t)=>{hp(wo.fromDom(e.getBody()),t).bind((e=>su(e.dom))).fold((()=>{e.selection.normalize()}),(t=>e.selection.setRng(t.toRange())))},fp=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},vp=e=>{return qh(e)||(t=e,Gh(jo(t)).filter((e=>t.dom.contains(e.dom)))).isSome();var t},bp=e=>e.inline?(e=>{const t=e.getBody();return t&&vp(wo.fromDom(t))})(e):(e=>C(e.iframeElement)&&qh(wo.fromDom(e.iframeElement)))(e),yp=e=>bp(e)||(e=>{const t=jo(wo.fromDom(e.getElement()));return Gh(t).filter((t=>!cp(t.dom)&&dp(e,t.dom))).isSome()})(e),wp=e=>e.editorManager.setActive(e),xp=(e,t)=>{e.removed||(t?wp(e):(e=>{const t=e.selection,o=e.getBody();let n=t.getRng();e.quirks.refreshContentEditable(),C(e.bookmark)&&!bp(e)&&np(e).each((t=>{e.selection.setRng(t),n=t}));const r=((e,t)=>e.dom.getParent(t,(t=>"true"===e.dom.getContentEditable(t))))(e,t.getNode());if(r&&e.dom.isChildOf(r,o))return fp(r),pp(e,n),void wp(e);e.inline||(Mt.browser.isOpera()||fp(o),e.getWin().focus()),(Mt.browser.isFirefox()||e.inline)&&(fp(o),pp(e,n)),wp(e)})(e))},Cp=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),Sp=(e,t,o,n,r)=>{const s=o?t.startContainer:t.endContainer,a=o?t.startOffset:t.endOffset;return F.from(s).map(wo.fromDom).map((e=>n&&t.collapsed?e:Io(e,r(e,a)).getOr(e))).bind((e=>Kt(e)?F.some(e):Do(e).filter(Kt))).map((e=>e.dom)).getOr(e)},kp=(e,t,o=!1)=>Sp(e,t,!0,o,((e,t)=>Math.min(zo(e),t))),_p=(e,t,o=!1)=>Sp(e,t,!1,o,((e,t)=>t>0?t-1:t)),Ep=(e,t)=>{const o=e;for(;e&&dr(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||o},Tp=(e,t)=>$(t,(t=>{const o=e.dispatch("GetSelectionRange",{range:t});return o.range!==t?o.range:t})),Op={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},Dp=(e,t,o)=>{const n=o?"lastChild":"firstChild",r=o?"prev":"next";if(e[n])return e[n];if(e!==t){let o=e[r];if(o)return o;for(let n=e.parent;n&&n!==t;n=n.parent)if(o=n[r],o)return o}},Ap=e=>{var t;const o=null!==(t=e.value)&&void 0!==t?t:"";if(!Yn(o))return!1;const n=e.parent;return!n||"span"===n.name&&!n.attr("style")||!/^[ ]+$/.test(o)},Mp=e=>{const t="a"===e.name&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class Np{static create(e,t){const o=new Np(e,Op[e]||1);return t&&ve(t,((e,t)=>{o.attr(t,e)})),o}constructor(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}replace(e){const t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t}attr(e,t){const o=this;if(!h(e))return C(e)&&ve(e,((e,t)=>{o.attr(t,e)})),o;const n=o.attributes;if(n){if(void 0!==t){if(null===t){if(e in n.map){delete n.map[e];let t=n.length;for(;t--;)if(n[t].name===e)return n.splice(t,1),o}return o}if(e in n.map){let o=n.length;for(;o--;)if(n[o].name===e){n[o].value=t;break}}else n.push({name:e,value:t});return n.map[e]=t,o}return n.map[e]}}clone(){const e=this,t=new Np(e.name,e.type),o=e.attributes;if(o){const e=[];e.map={};for(let t=0,n=o.length;th(e.nodeValue)&&e.nodeValue.includes(di),Lp=e=>(0===e.length?"":`${$(e,(e=>`[${e}]`)).join(",")},`)+'[data-mce-bogus="all"]',Hp=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,(e=>Bp(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)),Ip=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>{if(Bp(e)){const t=e.parentNode;return t&&Ee(Rp,t.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_SKIP})),Pp=e=>null!==Hp(e).nextNode(),Fp=e=>null!==Ip(e).nextNode(),zp=(e,t)=>null!==t.querySelector(Lp(e)),Vp=(e,t)=>{q(((e,t)=>t.querySelectorAll(Lp(e)))(e,t),(t=>{const o=wo.fromDom(t);"all"===no(o,"data-mce-bogus")?Sn(o):q(e,(e=>{so(o,e)&&ao(o,e)}))}))},Zp=e=>{let t=e.nextNode();for(;null!==t;)t.nodeValue=null,t=e.nextNode()},Up=T(Zp,Hp),jp=T(Zp,Ip),Wp=(e,t)=>{const o=[{condition:N(zp,t),action:N(Vp,t)},{condition:Pp,action:Up},{condition:Fp,action:jp}];let n=e,r=!1;return q(o,(({condition:t,action:o})=>{t(n)&&(r||(n=e.cloneNode(!0),r=!0),o(n))})),n},$p=e=>{const t=Vn(e,"[data-mce-bogus]");q(t,(e=>{"all"===no(e,"data-mce-bogus")?Sn(e):ei(e)?(fn(e,wo.fromText($n)),Sn(e)):kn(e)}))},qp=e=>{const t=Vn(e,"input");q(t,(e=>{ao(e,"name")}))},Gp=(e,t)=>{const o=e.getDoc(),n=jo(wo.fromDom(e.getBody())),r=wo.fromTag("div",o);to(r,"data-mce-bogus","all"),dn(r,{position:"fixed",left:"-9999999px",top:"0"}),Tn(r,t.innerHTML),$p(r),qp(r);const s=(e=>Vo(e)?e:wo.fromDom(To(e).dom.body))(n);yn(s,r);const a=ui(r.dom.innerText);return Sn(r),a},Kp=(e,t,o)=>{let n;return n="raw"===t.format?Lt.trim(ui(Wp(o,e.serializer.getTempAttrs()).innerHTML)):"text"===t.format?Gp(e,o):"tree"===t.format?e.serializer.serialize(o,t):((e,t)=>{const o=sc(e),n=new RegExp(`^(<${o}[^>]*>( | |\\s| |
    |)<\\/${o}>[\r\n]*|
    [\r\n]*)$`);return t.replace(n,"")})(e,e.serializer.serialize(o,t)),"text"!==t.format&&!ai(wo.fromDom(o))&&h(n)?Lt.trim(n):n},Yp=Lt.makeMap,Xp=e=>{const t=[],o=(e=e||{}).indent,n=Yp(e.indent_before||""),r=Yp(e.indent_after||""),s=Cs.getEncodeFunc(e.entity_encoding||"raw",e.entities),a="xhtml"!==e.element_format;return{start:(e,i,l)=>{if(o&&n[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}if(t.push("<",e),i)for(let e=0,o=i.length;e":" />",l&&o&&r[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}},end:e=>{let n;t.push(""),o&&r[e]&&t.length>0&&(n=t[t.length-1],n.length>0&&"\n"!==n&&t.push("\n"))},text:(e,o)=>{e.length>0&&(t[t.length]=o?e:s(e))},cdata:e=>{t.push("")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,n)=>{n?t.push(""):t.push(""),o&&t.push("\n")},doctype:e=>{t.push("",o?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},Jp=(e={},t=Vs())=>{const o=Xp(e);return e.validate=!("validate"in e)||e.validate,{serialize:n=>{const r=e.validate,s={3:e=>{var t;o.text(null!==(t=e.value)&&void 0!==t?t:"",e.raw)},8:e=>{var t;o.comment(null!==(t=e.value)&&void 0!==t?t:"")},7:e=>{o.pi(e.name,e.value)},10:e=>{var t;o.doctype(null!==(t=e.value)&&void 0!==t?t:"")},4:e=>{var t;o.cdata(null!==(t=e.value)&&void 0!==t?t:"")},11:e=>{let t=e;if(t=t.firstChild)do{a(t)}while(t=t.next)}};o.reset();const a=e=>{var n;const i=s[e.type];if(i)i(e);else{const s=e.name,i=s in t.getVoidElements();let l=e.attributes;if(r&&l&&l.length>1){const o=[];o.map={};const n=t.getElementRule(e.name);if(n){for(let e=0,t=n.attributesOrder.length;e{Qp.add(e)}));const ef=["font","text-decoration","text-emphasis"],tf=(e,t)=>pe(e.parseStyle(e.getAttrib(t,"style"))),of=(e,t)=>re(tf(e,t),(e=>!(e=>Qp.has(e))(e))),nf=(e,t,o)=>{const n=tf(e,t),r=tf(e,o),s=n=>{var r,s;const a=null!==(r=e.getStyle(t,n))&&void 0!==r?r:"",i=null!==(s=e.getStyle(o,n))&&void 0!==s?s:"";return Xe(a)&&Xe(i)&&a!==i};return W(n,(e=>{const t=t=>W(t,(t=>t===e));if(!t(r)&&t(ef)){const e=Y(r,(e=>W(ef,(t=>We(e,t)))));return W(e,s)}return s(e)}))},rf=(e,t,o)=>F.from(o.container()).filter(dr).exists((n=>{const r=e?0:-1;return t(n.data.charAt(o.offset()+r))})),sf=N(rf,!0,_u),af=N(rf,!1,_u),lf=e=>{const t=e.container();return dr(t)&&(0===t.data.length||mi(t.data)&&Ng.isBookmarkNode(t.parentNode))},cf=(e,t)=>o=>_m(e?0:-1,o).filter(t).isSome(),df=e=>vr(e)&&"block"===mn(wo.fromDom(e),"display"),mf=e=>yr(e)&&!(e=>tr(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),uf=cf(!0,df),gf=cf(!1,df),hf=cf(!0,Cr),pf=cf(!1,Cr),ff=cf(!0,ir),vf=cf(!1,ir),bf=cf(!0,mf),yf=cf(!1,mf),wf=(e,t)=>((e,t,o)=>_o(t,e)?Mo(e,(e=>o(e)||ko(e,t))).slice(0,-1):[])(e,t,I),xf=(e,t)=>[e].concat(wf(e,t)),Cf=(e,t,o)=>tu(e,t,o,lf),Sf=(e,t,o)=>ee(xf(wo.fromDom(t.container()),e),(e=>t=>e.isBlock(Wt(t)))(o)),kf=(e,t,o,n)=>Cf(e,t.dom,o).forall((e=>Sf(t,o,n).fold((()=>!km(e,o,t.dom)),(n=>!km(e,o,t.dom)&&_o(n,wo.fromDom(e.container())))))),_f=(e,t,o,n)=>Sf(t,o,n).fold((()=>Cf(e,t.dom,o).forall((e=>!km(e,o,t.dom)))),(t=>Cf(e,t.dom,o).isNone())),Ef=N(_f,!1),Tf=N(_f,!0),Of=N(kf,!1),Df=N(kf,!0),Af=e=>Bm(e).exists(ei),Mf=(e,t,o,n)=>{const r=Y(xf(wo.fromDom(o.container()),t),(e=>n.isBlock(Wt(e)))),s=de(r).getOr(t);return Qm(e,s.dom,o).filter(Af)},Nf=(e,t,o)=>Bm(t).exists(ei)||Mf(!0,e,t,o).isSome(),Rf=(e,t,o)=>(e=>F.from(e.getNode(!0)).map(wo.fromDom))(t).exists(ei)||Mf(!1,e,t,o).isSome(),Bf=N(Mf,!1),Lf=N(Mf,!0),Hf=e=>ml.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),If=(e,t,o)=>{const n=Y(xf(wo.fromDom(t.container()),e),(e=>o.isBlock(Wt(e))));return de(n).getOr(e)},Pf=(e,t,o)=>Hf(t)?af(t):af(t)||ru(If(e,t,o).dom,t).exists(af),Ff=(e,t,o)=>Hf(t)?sf(t):sf(t)||nu(If(e,t,o).dom,t).exists(sf),zf=e=>Bm(e).bind((e=>Jo(e,Kt))).exists((e=>(e=>j(["pre","pre-wrap"],e))(mn(e,"white-space")))),Vf=(e,t,o)=>((e,t)=>ru(e.dom,t).isNone())(e,t)||((e,t)=>nu(e.dom,t).isNone())(e,t)||Ef(e,t,o)||Tf(e,t,o)||Rf(e,t,o)||Nf(e,t,o),Zf=(e,t)=>o=>{return n=new Wn(o,e)[t](),C(n)&&yr(n)&&gm(n);var n},Uf=(e,t,o)=>!zf(t)&&(Vf(e,t,o)||Pf(e,t,o)||Ff(e,t,o)),jf=(e,t,o)=>!zf(t)&&(Ef(e,t,o)||Of(e,t,o)||Rf(e,t,o)||Pf(e,t,o)||((e,t)=>{const o=ru(e.dom,t).getOr(t),n=Zf(e.dom,"prev");return t.isAtStart()&&(n(t.container())||n(o.container()))})(e,t)),Wf=(e,t,o)=>!zf(t)&&(Tf(e,t,o)||Df(e,t,o)||Nf(e,t,o)||Ff(e,t,o)||((e,t)=>{const o=nu(e.dom,t).getOr(t),n=Zf(e.dom,"next");return t.isAtEnd()&&(n(t.container())||n(o.container()))})(e,t)),$f=(e,t,o)=>jf(e,t,o)||Wf(e,(e=>{const t=e.container(),o=e.offset();return dr(t)&&oSu(e.charAt(t)),Gf=(e,t)=>_u(e.charAt(t)),Kf=(e,t,o,n)=>{const r=t.data,s=ml(t,0);return o||!qf(r,0)||$f(e,s,n)?!!(o&&Gf(r,0)&&jf(e,s,n))&&(t.data=qn+r.slice(1),!0):(t.data=" "+r.slice(1),!0)},Yf=e=>{const t=e.data,o=(e=>{const t=e.split("");return $(t,((e,o)=>Su(e)&&o>0&&o{const r=t.data,s=ml(t,r.length-1);return o||!qf(r,r.length-1)||$f(e,s,n)?!!(o&&Gf(r,r.length-1)&&Wf(e,s,n))&&(t.data=r.slice(0,-1)+qn,!0):(t.data=r.slice(0,-1)+" ",!0)},Jf=(e,t,o)=>{const n=t.container();if(!dr(n))return F.none();if((e=>{const t=e.container();return dr(t)&&je(t.data,qn)})(t)){const r=Kf(e,n,!1,o)||Yf(n)||Xf(e,n,!1,o);return Ft(r,t)}if($f(e,t,o)){const r=Kf(e,n,!0,o)||Xf(e,n,!0,o);return Ft(r,t)}return F.none()},Qf=(e,t,o,n)=>{if(0===o)return;const r=wo.fromDom(e),s=Xo(r,(e=>n.isBlock(Wt(e)))).getOr(r),a=e.data.slice(t,t+o),i=t+o>=e.data.length&&Wf(s,ml(e,e.data.length),n),l=0===t&&jf(s,ml(e,0),n);e.replaceData(t,o,Jn(a,4,l,i))},ev=(e,t,o)=>{const n=e.data.slice(t),r=n.length-Ke(n).length;Qf(e,t,r,o)},tv=(e,t,o)=>{const n=e.data.slice(0,t),r=n.length-Ye(n).length;Qf(e,t-r,r,o)},ov=(e,t,o,n,r=!0)=>{const s=Ye(e.data).length,a=r?e:t,i=r?t:e;return r?a.appendData(i.data):a.insertData(0,i.data),Sn(wo.fromDom(i)),n&&ev(a,s,o),a},nv=(e,t)=>((e,t)=>{const o=e.container(),n=e.offset();return!ml.isTextPosition(e)&&o===t.parentNode&&n>ml.before(t).offset()})(t,e)?ml(t.container(),t.offset()-1):t,rv=e=>{return ji(e.previousSibling)?F.some((t=e.previousSibling,dr(t)?ml(t,t.data.length):ml.after(t))):e.previousSibling?au(e.previousSibling):F.none();var t},sv=e=>{return ji(e.nextSibling)?F.some((t=e.nextSibling,dr(t)?ml(t,0):ml.before(t))):e.nextSibling?su(e.nextSibling):F.none();var t},av=(e,t)=>rv(t).orThunk((()=>sv(t))).orThunk((()=>((e,t)=>F.from(t.previousSibling?t.previousSibling:t.parentNode).bind((t=>ru(e,ml.before(t)))).orThunk((()=>nu(e,ml.after(t)))))(e,t))),iv=(e,t)=>sv(t).orThunk((()=>rv(t))).orThunk((()=>((e,t)=>nu(e,ml.after(t)).orThunk((()=>ru(e,ml.before(t)))))(e,t))),lv=(e,t,o)=>((e,t,o)=>e?iv(t,o):av(t,o))(e,t,o).map(N(nv,o)),cv=(e,t,o)=>{o.fold((()=>{e.focus()}),(o=>{e.selection.setRng(o.toRange(),t)}))},dv=(e,t)=>t&&Ee(e.schema.getBlockElements(),Wt(t)),mv=(e,t,o,n)=>{const r=No(e).filter(Yt),s=Ro(e).filter(Yt);return Sn(e),(a=r,i=s,l=t,c=(e,t,r)=>{const s=e.dom,a=t.dom,i=s.data.length;return ov(s,a,o,n),r.container()===a?ml(s,i):r},a.isSome()&&i.isSome()&&l.isSome()?F.some(c(a.getOrDie(),i.getOrDie(),l.getOrDie())):F.none()).orThunk((()=>(n&&(r.each((e=>tv(e.dom,e.dom.length,o))),s.each((e=>ev(e.dom,0,o)))),t)));var a,i,l,c},uv=(e,t,o,n=!0,r=!1)=>{const s=lv(t,e.getBody(),o.dom),a=Xo(o,N(dv,e),(i=e.getBody(),e=>e.dom===i));var i;const l=mv(o,s,e.schema,((e,t)=>Ee(e.schema.getTextInlineElements(),Wt(t)))(e,o));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):a.bind((t=>((e,t,o)=>{if(Rr(e,t)){const e=wo.fromHtml('
    ');return o?q(Ho(t),(e=>{ig(e)||Sn(e)})):Cn(t),yn(t,e),F.some(ml.before(e.dom))}return F.none()})(e.schema,t,r))).fold((()=>{n&&cv(e,t,l)}),(o=>{n&&cv(e,t,F.some(o))}))},gv=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,hv=(e,t)=>Co(wo.fromDom(t),Mc(e))&&!Yr(e.schema,t)&&e.dom.isEditable(t),pv=e=>{var t;return"rtl"===ba.DOM.getStyle(e,"direction",!0)||(e=>gv.test(e))(null!==(t=e.textContent)&&void 0!==t?t:"")},fv=(e,t,o)=>{const n=((e,t,o)=>Y(ba.DOM.getParents(o.container(),"*",t),e))(e,t,o);return F.from(n[n.length-1])},vv=(e,t)=>{const o=t.container(),n=t.offset();return e?fi(o)?dr(o.nextSibling)?ml(o.nextSibling,0):ml.after(o):yi(t)?ml(o,n+1):t:fi(o)?dr(o.previousSibling)?ml(o.previousSibling,o.previousSibling.data.length):ml.before(o):wi(t)?ml(o,n-1):t},bv=N(vv,!0),yv=N(vv,!1),wv=(e,t)=>{const o=e=>e.stopImmediatePropagation();e.on("beforeinput input",o,!0),e.getDoc().execCommand(t),e.off("beforeinput input",o)},xv=e=>wv(e,"Delete"),Cv=e=>ti(e)||ni(e),Sv=(e,t)=>_o(e,t)?Jo(t,Cv,(e=>t=>Ht(Do(t),e,ko))(e)):F.none(),kv=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},_v=(e,t,o)=>Pt(su(o),au(o),((n,r)=>{const s=vv(!0,n),a=vv(!1,r),i=vv(!1,t);return e?nu(o,i).exists((e=>e.isEqual(a)&&t.isEqual(s))):ru(o,i).exists((e=>e.isEqual(s)&&t.isEqual(a)))})).getOr(!0),Ev=e=>{var t;return(8===$t(t=e)||"#comment"===Wt(t)?No(e):Fo(e)).bind(Ev).orThunk((()=>F.some(e)))},Tv=(e,t,o,n=!0)=>{var r;t.deleteContents();const s=Ev(o).getOr(o),a=wo.fromDom(null!==(r=e.dom.getParent(s.dom,e.dom.isBlock))&&void 0!==r?r:o.dom);if(a.dom===e.getBody()?kv(e,n):Rr(e.schema,a,{checkRootAsContent:!1})&&(ci(a),n&&e.selection.setCursorLocation(a.dom,0)),!ko(o,a)){const t=Ht(Do(a),o)?[]:Do(i=a).map(Ho).map((e=>Y(e,(e=>!ko(i,e))))).getOr([]);q(t.concat(Ho(o)),(t=>{ko(t,a)||_o(t,a)||!Rr(e.schema,t)||Sn(t)}))}var i},Ov=e=>Vn(e,"td,th"),Dv=(e,t)=>Mu(wo.fromDom(e),t),Av=e=>(e=>Pt(e.startTable,e.endTable,((t,o)=>{const n=jn(t,(e=>ko(e,o))),r=jn(o,(e=>ko(e,t)));return n||r?{...e,startTable:n?F.none():e.startTable,endTable:r?F.none():e.endTable,isSameTable:!1,isMultiTable:!1}:e})).getOr(e))(e),Mv=(e,t)=>({start:e,end:t}),Nv=Il([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),Rv=(e,t)=>nn(wo.fromDom(e),"td,th",t),Bv=e=>!ko(e.start,e.end),Lv=(e,t)=>Mu(e.start,t).bind((o=>Mu(e.end,t).bind((e=>Ft(ko(o,e),o))))),Hv=e=>t=>Lv(t,e).map((e=>((e,t,o)=>({rng:e,table:t,cells:o}))(t,e,Ov(e)))),Iv=(e,t,o,n)=>{if(o.collapsed||!e.forall(Bv))return F.none();if(t.isSameTable){const t=e.bind(Hv(n));return F.some({start:t,end:t})}{const e=Rv(o.startContainer,n),t=Rv(o.endContainer,n),r=e.bind((e=>t=>Mu(t,e).bind((e=>me(Ov(e)).map((e=>Mv(t,e))))))(n)).bind(Hv(n)),s=t.bind((e=>t=>Mu(t,e).bind((e=>de(Ov(e)).map((e=>Mv(e,t))))))(n)).bind(Hv(n));return F.some({start:r,end:s})}},Pv=(e,t)=>te(e,(e=>ko(e,t))),Fv=e=>Pt(Pv(e.cells,e.rng.start),Pv(e.cells,e.rng.end),((t,o)=>e.cells.slice(t,o+1))),zv=(e,t,o)=>e.exists((e=>((e,t)=>!Bv(e)&&Lv(e,t).exists((e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length})))(e,o)&&Bu(e.start,t))),Vv=(e,t)=>{const{startTable:o,endTable:n}=t,r=e.cloneRange();return o.each((e=>r.setStartAfter(e.dom))),n.each((e=>r.setEndBefore(e.dom))),r},Zv=(e,t)=>{const o=(e=>t=>ko(e,t))(e),n=((e,t)=>{const o=Rv(e.startContainer,t),n=Rv(e.endContainer,t);return Pt(o,n,Mv)})(t,o),r=((e,t)=>{const o=Dv(e.startContainer,t),n=Dv(e.endContainer,t),r=o.isSome(),s=n.isSome(),a=Pt(o,n,ko).getOr(!1);return Av({startTable:o,endTable:n,isStartInTable:r,isEndInTable:s,isSameTable:a,isMultiTable:!a&&r&&s})})(t,o);return zv(n,t,o)?n.map((e=>Nv.singleCellTable(t,e.start))):r.isMultiTable?((e,t,o,n)=>Iv(e,t,o,n).bind((({start:e,end:n})=>{const r=e.bind(Fv).getOr([]),s=n.bind(Fv).getOr([]);if(r.length>0&&s.length>0){const e=Vv(o,t);return F.some(Nv.multiTable(r,s,e))}return F.none()})))(n,r,t,o):((e,t,o,n)=>Iv(e,t,o,n).bind((({start:e,end:t})=>e.or(t))).bind((e=>{const{isSameTable:n}=t,r=Fv(e).getOr([]);if(n&&e.cells.length===r.length)return F.some(Nv.fullTable(e.table));if(r.length>0){if(n)return F.some(Nv.partialTable(r,F.none()));{const e=Vv(o,t);return F.some(Nv.partialTable(r,F.some({...t,rng:e})))}}return F.none()})))(n,r,t,o)},Uv=e=>q(e,(e=>{ao(e,"contenteditable"),ci(e)})),jv=(e,t,o,n)=>{const r=o.cloneRange();n?(r.setStart(o.startContainer,o.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(o.endContainer,o.endOffset)),Gv(e,r,t,!1).each((e=>e()))},Wv=e=>{const t=Au(e),o=wo.fromDom(e.selection.getNode());wr(o.dom)&&Rr(e.schema,o)?e.selection.setCursorLocation(o.dom,0):e.selection.collapse(!0),t.length>1&&W(t,(e=>ko(e,o)))&&to(o,"data-mce-selected","1")},$v=(e,t,o)=>F.some((()=>{const n=e.selection.getRng(),r=o.bind((({rng:o,isStartInTable:r})=>{const s=((e,t)=>F.from(e.dom.getParent(t,e.dom.isBlock)).map(wo.fromDom))(e,r?o.endContainer:o.startContainer);o.deleteContents(),((e,t,o)=>{o.each((o=>{t?Sn(o):(ci(o),e.selection.setCursorLocation(o.dom,0))}))})(e,r,s.filter(N(Rr,e.schema)));const a=r?t[0]:t[t.length-1];return jv(e,a,n,r),Rr(e.schema,a)?F.none():F.some(r?t.slice(1):t.slice(0,-1))})).getOr(t);Uv(r),Wv(e)})),qv=(e,t,o,n)=>F.some((()=>{const r=e.selection.getRng(),s=t[0],a=o[o.length-1];jv(e,s,r,!0),jv(e,a,r,!1);const i=Rr(e.schema,s)?t:t.slice(1),l=Rr(e.schema,a)?o:o.slice(0,-1);Uv(i.concat(l)),n.deleteContents(),Wv(e)})),Gv=(e,t,o,n=!0)=>F.some((()=>{Tv(e,t,o,n)})),Kv=(e,t)=>F.some((()=>uv(e,!1,t))),Yv=(e,t,o,n)=>Jv(t,n).fold((()=>((e,t,o)=>Zv(t,o).bind((t=>t.fold(N(Gv,e),N(Kv,e),N($v,e),N(qv,e)))))(e,t,o)),(t=>((e,t)=>Qv(e,t))(e,t))),Xv=(e,t)=>ee(xf(t,e),si),Jv=(e,t)=>ee(xf(t,e),Qt("caption")),Qv=(e,t)=>F.some((()=>{ci(t),e.selection.setCursorLocation(t.dom,0)})),eb=(e,t,o,n,r)=>eu(o,e.getBody(),r).fold((()=>F.some(E)),(s=>((e,t,o,n)=>su(e.dom).bind((r=>au(e.dom).map((e=>t?o.isEqual(r)&&n.isEqual(e):o.isEqual(e)&&n.isEqual(r))))).getOr(!0))(n,o,r,s)?((e,t)=>Qv(e,t))(e,n):((e,t,o)=>Jv(e,wo.fromDom(o.getNode())).fold((()=>F.some(E)),(e=>Ft(!ko(e,t),E))))(t,n,s))),tb=(e,t,o,n)=>{const r=ml.fromRangeStart(e.selection.getRng());return Xv(o,n).bind((n=>Rr(e.schema,n,{checkRootAsContent:!1})?Qv(e,n):((e,t,o,n,r)=>eu(o,e.getBody(),r).bind((e=>Xv(t,wo.fromDom(e.getNode())).bind((e=>ko(e,n)?F.none():F.some(E))))))(e,o,t,n,r)))},ob=(e,t)=>e?ff(t):vf(t),nb=(e,t,o)=>{const n=wo.fromDom(e.getBody());return Jv(n,o).fold((()=>tb(e,t,n,o).orThunk((()=>Ft(((e,t)=>{const o=ml.fromRangeStart(e.selection.getRng());return ob(t,o)||Qm(t,e.getBody(),o).exists((e=>ob(t,e)))})(e,t),E)))),(o=>((e,t,o,n)=>{const r=ml.fromRangeStart(e.selection.getRng());return Rr(e.schema,n)?Qv(e,n):eb(e,o,t,n,r)})(e,t,n,o)))},rb=(e,t)=>{const o=wo.fromDom(e.selection.getStart(!0)),n=Au(e);return e.selection.isCollapsed()&&0===n.length?nb(e,t,o):((e,t,o)=>{const n=wo.fromDom(e.getBody()),r=e.selection.getRng();return 0!==o.length?$v(e,o,F.none()):Yv(e,n,r,t)})(e,o,n)},sb=(e,t)=>{let o=t;for(;o&&o!==e;){if(br(o)||yr(o))return o;o=o.parentNode}return null},ab=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],ib=Lt.each,lb=e=>{const t=e.dom,o=new Set(e.serializer.getTempAttrs()),n=e=>W(ab,(t=>We(e,t)))||o.has(e);return{compare:(e,o)=>{if(e.nodeName!==o.nodeName||e.nodeType!==o.nodeType)return!1;const r=e=>{const o={};return ib(t.getAttribs(e),(r=>{const s=r.nodeName.toLowerCase();"style"===s||n(s)||(o[s]=t.getAttrib(e,s))})),o},s=(e,t)=>{for(const o in e)if(Ee(e,o)){const n=t[o];if(w(n))return!1;if(e[o]!==n)return!1;delete t[o]}for(const e in t)if(Ee(t,e))return!1;return!0};if(tr(e)&&tr(o)){if(!s(r(e),r(o)))return!1;if(!s(t.parseStyle(t.getAttrib(e,"style")),t.parseStyle(t.getAttrib(o,"style"))))return!1}return!Cu(e)&&!Cu(o)},isAttributeInternal:n}},cb=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),db=(e,t,o,n)=>{const r=o.name;for(let t=0,s=e.length;t{const o=(e,o)=>{ve(e,(e=>{const n=ue(e.nodes);q(e.filter.callbacks,(r=>{for(let t=n.length-1;t>=0;t--){const r=n[t];(o?void 0!==r.attr(e.filter.name):r.name===e.filter.name)&&!x(r.parent)||n.splice(t,1)}n.length>0&&r(n,e.filter.name,t)}))}))};o(e.nodes,!1),o(e.attributes,!0)},ub=(e,t,o,n={})=>{const r=((e,t,o)=>{const n={nodes:{},attributes:{}};return o.firstChild&&((e,t)=>{let o=e;for(;o=o.walk();)t(o)})(o,(o=>{db(e,t,o,n)})),n})(e,t,o);mb(r,n)},gb=(e,t,o,n)=>{if((e.pad_empty_with_br||t.insert)&&o(n)){const e=new Np("br",1);t.insert&&e.attr("data-mce-bogus","1"),n.empty().append(e)}else n.empty().append(new Np("#text",3)).value=qn},hb=(e,t)=>{const o=null==e?void 0:e.firstChild;return C(o)&&o===e.lastChild&&o.name===t},pb=(e,t,o,n)=>n.isEmpty(t,o,(t=>((e,t)=>{const o=e.getElementRule(t.name);return!0===(null==o?void 0:o.paddEmpty)})(e,t))),fb=e=>{let t;for(let o=e;o;o=o.parent){const e=o.attr("contenteditable");if("false"===e)break;"true"===e&&(t=o)}return F.from(t)},vb=(e,t,o=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const n=e.children();for(const e of n)o&&!t.isValidChild(o.name,e.name)&&vb(e,t,o);e.unwrap()}},bb=(e,t,o,n=E)=>{const r=t.getTextBlockElements(),s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Lt.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),l=new Set,c=e=>e!==o&&!i[e.name];for(let o=0;o1)if(yb(t,i,d))vb(i,t);else{g.reverse(),m=g[0].clone(),n(m);let e=m;for(let o=0;o0?(u=g[o].clone(),n(u),e.append(u)):u=e;for(let e=g[o].firstChild;e&&e!==g[o+1];){const t=e.next;u.append(e),e=t}e=u}pb(t,s,a,m)?d.insert(i,g[0],!0):(d.insert(m,g[0],!0),d.insert(i,m)),d=g[0],(pb(t,s,a,d)||hb(d,"br"))&&d.empty().remove()}else if(i.parent){if("li"===i.name){let e=i.prev;if(e&&("ul"===e.name||"ol"===e.name)){e.append(i);continue}if(e=i.next,e&&("ul"===e.name||"ol"===e.name)&&e.firstChild){e.insert(i,e.firstChild,!0);continue}const t=new Np("ul",1);n(t),i.wrap(t);continue}if(t.isValidChild(i.parent.name,"div")&&t.isValidChild("div",i.name)){const e=new Np("div",1);n(e),i.wrap(e)}else vb(i,t)}}},yb=(e,t,o=t.parent)=>!(!o||(!e.children[t.name]||e.isValidChild(o.name,t.name))&&("a"!==t.name||!((e,t)=>{let o=e;for(;o;){if(o.name===t)return!0;o=o.parent}return!1})(o,"a"))&&(!(e=>"summary"===e.name)(o)||!cb(t)||(null==o?void 0:o.firstChild)===t&&(null==o?void 0:o.lastChild)===t)),wb=e=>{const t=ml.fromRangeStart(e),o=ml.fromRangeEnd(e),n=e.commonAncestorContainer;return Qm(!1,n,o).map((r=>!km(t,o,n)&&km(t,r,n)?((e,t,o,n)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(o,n),r})(t.container(),t.offset(),r.container(),r.offset()):e)).getOr(e)},xb=e=>e.collapsed?e:wb(e),Cb=(e,t)=>e.getBlockElements()[t.name]&&(e=>C(e.firstChild)&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===qn)(t.firstChild),Sb=(e,t)=>{let o=t.firstChild,n=t.lastChild;return o&&"meta"===o.name&&(o=o.next),n&&"mce_marker"===n.attr("id")&&(n=n.prev),((e,t)=>{const o=e.getNonEmptyElements();return C(t)&&(t.isEmpty(o)||Cb(e,t))})(e,n)&&(n=null==n?void 0:n.prev),!(!o||o!==n||"ul"!==o.name&&"ol"!==o.name)},kb=e=>C(null==e?void 0:e.firstChild)&&e.firstChild===e.lastChild&&(e=>e.data===qn||fr(e))(e.firstChild),_b=e=>{return e.length>0&&(!(t=e[e.length-1]).firstChild||kb(t))?e.slice(0,-1):e;var t},Eb=(e,t)=>{const o=e.getParent(t,e.isBlock);return o&&"LI"===o.nodeName?o:null},Tb=(e,t)=>{const o=ml.after(e),n=Gm(t).prev(o);return n?n.toRange():null},Ob=(e,t,o)=>{const n=e.parentNode;return n&&Lt.each(t,(t=>{n.insertBefore(t,e)})),((e,t)=>{const o=ml.before(e),n=Gm(t).next(o);return n?n.toRange():null})(e,o)},Db=(e,t,o,n)=>{const r=((e,t,o)=>{const n=t.serialize(o);return(e=>{var t,o;const n=e.firstChild,r=e.lastChild;return n&&"META"===n.nodeName&&(null===(t=n.parentNode)||void 0===t||t.removeChild(n)),r&&"mce_marker"===r.id&&(null===(o=r.parentNode)||void 0===o||o.removeChild(r)),e})(e.createFragment(n))})(t,e,n),s=Eb(t,o.startContainer),a=_b((i=r.firstChild,Y(null!==(l=null==i?void 0:i.childNodes)&&void 0!==l?l:[],(e=>"LI"===e.nodeName))));var i,l;const c=t.getRoot(),d=e=>{const n=ml.fromRangeStart(o),r=Gm(t.getRoot()),a=1===e?r.prev(n):r.next(n),i=null==a?void 0:a.getNode();return!i||Eb(t,i)!==s};return s?d(1)?Ob(s,a,c):d(2)?((e,t,o,n)=>(n.insertAfter(t.reverse(),e),Tb(t[0],o)))(s,a,c,t):((e,t,o,n)=>{const r=((e,t)=>{const o=t.cloneRange(),n=t.cloneRange();return o.setStartBefore(e),n.setEndAfter(e),[o.cloneContents(),n.cloneContents()]})(e,n),s=e.parentNode;return s&&(s.insertBefore(r[0],e),Lt.each(t,(t=>{s.insertBefore(t,e)})),s.insertBefore(r[1],e),s.removeChild(e)),Tb(t[t.length-1],o)})(s,a,c,o):null},Ab=["pre"],Mb=wr,Nb=(e,t,o)=>{F.from(e.getParent(t,"td,th")).map(wo.fromDom).each((e=>((e,t)=>{Fo(e).each((o=>{No(o).each((n=>{t.isBlock(Wt(e))&&ei(o)&&t.isBlock(Wt(n))&&Sn(o)}))}))})(e,o)))},Rb=(e,t)=>{var o,n,r;let s;const a=e.dom,i=e.selection;if(!t)return;i.scrollIntoView(t);const l=sb(e.getBody(),t);if(l&&"false"===a.getContentEditable(l))return a.remove(t),void i.select(l);let c=a.createRng();const d=t.previousSibling;if(dr(d)){c.setStart(d,null!==(n=null===(o=d.nodeValue)||void 0===o?void 0:o.length)&&void 0!==n?n:0);const e=t.nextSibling;dr(e)&&(d.appendData(e.data),null===(r=e.parentNode)||void 0===r||r.removeChild(e))}else c.setStartBefore(t),c.setEndBefore(t);const m=a.getParent(t,a.isBlock);if(a.remove(t),m&&a.isEmpty(m)){const t=Mb(m);Cn(wo.fromDom(m)),c.setStart(m,0),c.setEnd(m,0),t||(e=>!!e.getAttribute("data-mce-fragment"))(m)||!(s=(t=>{let o=ml.fromRangeStart(t);return o=Gm(e.getBody()).next(o),null==o?void 0:o.toRange()})(c))?a.add(m,a.create("br",t?{}:{"data-mce-bogus":"1"})):(c=s,a.remove(m))}i.setRng(c)},Bb=e=>{const t=e.dom,o=xb(e.selection.getRng());e.selection.setRng(o);const n=t.getParent(o.startContainer,Mb);((e,t,o)=>!!C(o)&&(o===e.getParent(t.endContainer,Mb)&&Bu(wo.fromDom(o),t)))(t,o,n)?Gv(e,o,wo.fromDom(n)):o.startContainer===o.endContainer&&o.endOffset-o.startOffset==1&&dr(o.startContainer.childNodes[o.startOffset])?o.deleteContents():e.getDoc().execCommand("Delete",!1)},Lb=(e,t,o)=>{var n,r;const s=e.selection,a=e.dom,i=e.parser,l=o.merge,c=Jp({validate:!0},e.schema),d='';o.preserve_zwsp||(t=ui(t)),-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,d);let m=s.getRng();const u=m.startContainer,g=e.getBody();u===g&&s.isCollapsed()&&a.isBlock(g.firstChild)&&((e,t)=>C(t)&&!e.schema.getVoidElements()[t.nodeName])(e,g.firstChild)&&a.isEmpty(g.firstChild)&&(m=a.createRng(),m.setStart(g.firstChild,0),m.setEnd(g.firstChild,0),s.setRng(m)),s.isCollapsed()||Bb(e);const h=s.getNode(),p={context:h.nodeName.toLowerCase(),data:o.data,insert:!0},f=i.parse(t,p);if(!0===o.paste&&Sb(e.schema,f)&&((e,t)=>!!Eb(e,t))(a,h))return m=Db(c,a,s.getRng(),f),m&&s.setRng(m),t;!0===o.paste&&((e,t,o,n)=>{var r;const s=t.firstChild,a=t.lastChild,i=s===("bookmark"===a.attr("data-mce-type")?a.prev:a),l=j(Ab,s.name);if(i&&l){const t="false"!==s.attr("contenteditable"),a=(null===(r=e.getParent(o,e.isBlock))||void 0===r?void 0:r.nodeName.toLowerCase())===s.name,i=F.from(sb(n,o)).forall(br);return t&&a&&i}return!1})(a,f,h,e.getBody())&&(null===(n=f.firstChild)||void 0===n||n.unwrap()),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(f);let v=f.lastChild;if(v&&"mce_marker"===v.attr("id")){const t=v;for(v=v.prev;v;v=v.walk(!0))if(3===v.type||!a.isBlock(v.name)){v.parent&&e.schema.isValidChild(v.parent.name,"span")&&v.parent.insert(t,v,"br"===v.name);break}}if(e._selectionOverrides.showBlockCaretContainer(h),p.invalid||((e,t,o)=>{var n;return W(o.children(),cb)&&"SUMMARY"===(null===(n=e.getParent(t,e.isBlock))||void 0===n?void 0:n.nodeName)})(a,h,f)){e.selection.setContent(d);let o,n=s.getNode();const l=e.getBody();for(hr(n)?n=o=l:o=n;o&&o!==l;)n=o,o=o.parentNode;t=n===l?l.innerHTML:a.getOuterHTML(n);const m=i.parse(t),u=(e=>{for(let t=e;t;t=t.walk())if("mce_marker"===t.attr("id"))return F.some(t);return F.none()})(m),g=u.bind(fb).getOr(m);u.each((e=>e.replace(f)));const h=f.children(),p=null!==(r=f.parent)&&void 0!==r?r:m;f.unwrap();const v=Y(h,(t=>yb(e.schema,t,p)));bb(v,e.schema,g),ub(i.getNodeFilters(),i.getAttributeFilters(),m),t=c.serialize(m),n===l?a.setHTML(l,t):a.setOuterHTML(n,t)}else t=c.serialize(f),((e,t,o)=>{var n;if("all"===o.getAttribute("data-mce-bogus"))null===(n=o.parentNode)||void 0===n||n.insertBefore(e.dom.createFragment(t),o);else{const n=o.firstChild,r=o.lastChild;!n||n===r&&"BR"===n.nodeName?e.dom.setHTML(o,t):e.selection.setContent(t,{no_events:!0})}})(e,t,h);var b;return((e,t)=>{const o=e.schema.getTextInlineElements(),n=e.dom;if(t){const t=e.getBody(),r=lb(e);Lt.each(n.select("*[data-mce-fragment]"),(e=>{if(C(o[e.nodeName.toLowerCase()])&&of(n,e))for(let o=e.parentElement;C(o)&&o!==t&&!nf(n,e,o);o=o.parentElement)if(r.compare(o,e)){n.remove(e,!0);break}}))}})(e,l),Rb(e,a.get("mce_marker")),b=e.getBody(),Lt.each(b.getElementsByTagName("*"),(e=>{e.removeAttribute("data-mce-fragment")})),Nb(a,s.getStart(),e.schema),((e,t,o)=>{const n=Mo(wo.fromDom(o),(e=>ko(e,wo.fromDom(t))));ce(n,n.length-2).filter(Kt).fold((()=>Wr(e,t)),(t=>Wr(e,t.dom)))})(e.schema,e.getBody(),s.getStart()),t},Hb=e=>e instanceof Np,Ib=(e,t,o)=>{e.dom.setHTML(e.getBody(),t),!0!==o&&(e=>{bp(e)&&su(e.getBody()).each((t=>{const o=t.getNode(),n=ir(o)?su(o).getOr(t):t;e.selection.setRng(n.toRange())}))})(e)},Pb=(e,t,o)=>F.from(e.getBody()).map((n=>Hb(t)?((e,t,o,n)=>{ub(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),o);const r=Jp({validate:!1},e.schema).serialize(o),s=ui(ai(wo.fromDom(t))?r:Lt.trim(r));return Ib(e,s,n.no_selection),{content:o,html:s}})(e,n,t,o):((e,t,o,n)=>{if(0===(o=ui(o)).length||/^\s+$/.test(o)){const r='
    ';"TABLE"===t.nodeName?o=""+r+"":/^(UL|OL)$/.test(t.nodeName)&&(o="
  • "+r+"
  • ");const s=sc(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),s.toLowerCase())?(o=r,o=e.dom.createHTML(s,ac(e),o)):o||(o=r),Ib(e,o,n.no_selection),{content:o,html:o}}{"raw"!==n.format&&(o=Jp({validate:!1},e.schema).serialize(e.parser.parse(o,{isRootContent:!0,insert:!0})));const r=ai(wo.fromDom(t))?o:Lt.trim(o);return Ib(e,r,n.no_selection),{content:r,html:r}}})(e,n,t,o))).getOr({content:t,html:Hb(o.content)?"":o.content}),Fb=e=>S(e)?e:I,zb=(e,t,o)=>{const n=t(e),r=Fb(o);return n.orThunk((()=>r(e)?F.none():((e,t,o)=>{let n=e.dom;const r=Fb(o);for(;n.parentNode;){n=n.parentNode;const e=wo.fromDom(n),o=t(e);if(o.isSome())return o;if(r(e))break}return F.none()})(e,t,r)))},Vb=Ku,Zb=(e,t,o)=>{const n=e.formatter.get(o);if(n)for(let o=0;o{const s=e.dom.getRoot();if(t===s)return!1;const a=e.dom.getParent(t,(t=>!!Zb(e,t,o)||t.parentNode===s||!!$b(e,t,o,n,!0)));return!!$b(e,a,o,n,r)},jb=(e,t,o)=>!(!rg(o)||!Vb(t,o.inline))||!(!og(o)||!Vb(t,o.block))||!!ng(o)&&tr(t)&&e.is(t,o.selector),Wb=(e,t,o,n,r,s)=>{const a=o[n],i="attributes"===n;if(S(o.onmatch))return o.onmatch(t,o,n);if(a)if(De(a)){for(let o=0;o{const s=e.formatter.get(o),a=e.dom;if(s&&tr(t))for(let o=0;o{if(n)return Ub(e,n,t,o,r);if(n=e.selection.getNode(),Ub(e,n,t,o,r))return!0;const s=e.selection.getStart();return!(s===n||!Ub(e,s,t,o,r))},Gb=(e,t)=>{const o=t=>ko(t,wo.fromDom(e.getBody()));return F.from(e.selection.getStart(!0)).bind((n=>zb(wo.fromDom(n),(o=>ge(t,(t=>((t,o)=>$b(e,t.dom,o)?F.some(o):F.none())(o,t)))),o))).getOrNull()},Kb=(e,t,o)=>J(o,((o,n)=>{const r=((e,t)=>eg(e,t,(e=>{const t=e=>S(e)||e.length>1&&"%"===e.charAt(0);return W(["styles","attributes"],(o=>_e(e,o).exists((e=>{const o=v(e)?e:ke(e);return W(o,t)}))))})))(e,n);return e.formatter.matchNode(t,n,{},r)?o.concat([n]):o}),[]),Yb=di,Xb=e=>{if(e){const t=new Wn(e,e);for(let e=t.current();e;e=t.next())if(dr(e))return e}return null},Jb=e=>{const t=wo.fromTag("span");return oo(t,{id:iu,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&yn(t,wo.fromText(Yb)),t},Qb=(e,t,o)=>{const n=e.dom,r=e.selection;if(ag(t))uv(e,!1,wo.fromDom(t),o,!0);else{const e=r.getRng(),o=n.getParent(t,n.isBlock),s=e.startContainer,a=e.startOffset,i=e.endContainer,l=e.endOffset,c=(e=>{const t=Xb(e);return t&&t.data.charAt(0)===Yb&&t.deleteData(0,1),t})(t);n.remove(t,!0),s===c&&a>0&&e.setStart(c,a-1),i===c&&l>0&&e.setEnd(c,l-1),o&&n.isEmpty(o)&&ci(wo.fromDom(o)),r.setRng(e)}},ey=(e,t,o)=>{const n=e.dom,r=e.selection;if(t)Qb(e,t,o);else if(!(t=cu(e.getBody(),r.getStart())))for(;t=n.get(iu);)Qb(e,t,o)},ty=(e,t)=>(e.appendChild(t),t),oy=(e,t)=>{var o;const n=X(e,((e,t)=>ty(e,t.cloneNode(!1))),t),r=null!==(o=n.ownerDocument)&&void 0!==o?o:document;return ty(n,r.createTextNode(Yb))},ny=(e,t,o,n)=>{const r=e.dom,s=e.selection;let a=!1;const i=e.formatter.get(t);if(!i)return;const l=s.getRng(),c=l.startContainer,d=l.startOffset;let m=c;dr(c)&&(d!==c.data.length&&(a=!0),m=m.parentNode);const u=[];let g;for(;m;){if($b(e,m,t,o,n)){g=m;break}m.nextSibling&&(a=!0),u.push(m),m=m.parentNode}if(g)if(a){const a=s.getBookmark();l.collapse(!0);let c=Cg(r,l,i,!0);c=Ch(c),e.formatter.remove(t,o,c,n),s.moveToBookmark(a)}else{const a=cu(e.getBody(),g),i=C(a)?r.getParents(g.parentNode,P,a):[],l=Jb(!1).dom;((e,t,o)=>{var n,r;const s=e.dom,a=s.getParent(o,N(ju,e.schema));a&&s.isEmpty(a)?null===(n=o.parentNode)||void 0===n||n.replaceChild(t,o):(ii(wo.fromDom(o)),s.isEmpty(o)?null===(r=o.parentNode)||void 0===r||r.replaceChild(t,o):s.insertAfter(t,o))})(e,l,null!=a?a:g);const c=((e,t,o,n,r,s)=>{const a=e.formatter,i=e.dom,l=Y(pe(a.get()),(e=>e!==n&&!je(e,"removeformat"))),c=Kb(e,o,l);if(Y(c,(t=>!tg(e,t,n))).length>0){const e=o.cloneNode(!1);return i.add(t,e),a.remove(n,r,e,s),i.remove(e),F.some(e)}return F.none()})(e,l,g,t,o,n),d=oy([...u,...c.toArray(),...i],l);a&&Qb(e,a,C(a)),s.setCursorLocation(d,1),r.isEmpty(g)&&r.remove(g)}},ry=e=>{e.on("mouseup keydown",(t=>{var o;((e,t,o)=>{const n=e.selection,r=e.getBody();ey(e,null,o),8!==t&&46!==t||!n.isCollapsed()||n.getStart().innerHTML!==Yb||ey(e,cu(r,n.getStart()),!0),37!==t&&39!==t||ey(e,cu(r,n.getStart()),!0)})(e,t.keyCode,(o=e.selection.getRng().endContainer,dr(o)&&$e(o.data,qn)))}))},sy=e=>{const t=Jb(!1),o=oy(e,t.dom);return{caretContainer:t,caretPosition:ml(o,0)}},ay=(e,t)=>{const{caretContainer:o,caretPosition:n}=sy(t);return fn(wo.fromDom(e),o),Sn(wo.fromDom(e)),n},iy=(e,t)=>{if(lu(t.dom))return!1;const o=e.schema.getTextInlineElements();return Ee(o,Wt(t))&&!lu(t.dom)&&!ar(t.dom)},ly={},cy=rr(["pre"]);((e,t)=>{ly[e]||(ly[e]=[]),ly[e].push(t)})("pre",(e=>{const t=e.selection.getRng();if(!t.collapsed){const t=e.selection.getSelectedBlocks(),o=Y(Y(t,cy),(e=>t=>{const o=t.previousSibling;return cy(o)&&j(e,o)})(t));q(o,(e=>{((e,t)=>{const o=wo.fromDom(t),n=To(o).dom;Sn(o),xn(wo.fromDom(e),[wo.fromTag("br",n),wo.fromTag("br",n),...Ho(o)])})(e.previousSibling,e)}))}}));const dy=["fontWeight","fontStyle","color","fontSize","fontFamily"],my=e=>ee(e,(e=>rg(e)&&"span"===e.inline&&(e=>p(e.styles)&&W(pe(e.styles),(e=>j(dy,e))))(e))),uy=(e,t)=>{const o=e.get(t);return v(o)?my(o):F.none()},gy=(e,t)=>ru(t,ml.fromRangeStart(e)).isNone(),hy=(e,t)=>!1===nu(t,ml.fromRangeEnd(e)).exists((e=>!fr(e.getNode())||nu(t,e).isSome())),py=e=>t=>Sr(t)&&e.isEditable(t),fy=e=>Y((e=>{const t=e.getSelectedBlocks(),o=e.getRng();if(e.isCollapsed())return[];if(1===t.length)return gy(o,t[0])&&hy(o,t[0])?t:[];{const e=de(t).filter((e=>gy(o,e))).toArray(),n=me(t).filter((e=>hy(o,e))).toArray(),r=t.slice(1,-1);return e.concat(r).concat(n)}})(e),py(e.dom)),vy=e=>Y(e.getSelectedBlocks(),py(e.dom)),by=Lt.each,yy=e=>tr(e)&&!Cu(e)&&!lu(e)&&!ar(e),wy=(e,t)=>{for(let o=e;o;o=o[t]){if(dr(o)&&Xe(o.data))return e;if(tr(o)&&!Cu(o))return o}return e},xy=(e,t,o)=>{const n=lb(e),r=or(t)&&e.dom.isEditable(t),s=or(o)&&e.dom.isEditable(o);if(r&&s){const r=wy(t,"previousSibling"),s=wy(o,"nextSibling");if(n.compare(r,s)){for(let e=r.nextSibling;e&&e!==s;){const t=e;e=e.nextSibling,r.appendChild(t)}return e.dom.remove(s),Lt.each(Lt.grep(s.childNodes),(e=>{r.appendChild(e)})),r}}return o},Cy=(e,t,o,n)=>{var r;if(n&&!1!==t.merge_siblings){const t=null!==(r=xy(e,Uu(n),n))&&void 0!==r?r:n;xy(e,t,Uu(t,!0))}},Sy=(e,t,o)=>{by(e.childNodes,(e=>{yy(e)&&(t(e)&&o(e),e.hasChildNodes()&&Sy(e,t,o))}))},ky=(e,t)=>o=>!(!o||!Xu(e,o,t)),_y=(e,t,o)=>n=>{e.setStyle(n,t,o),""===n.getAttribute("style")&&n.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,n)},Ey=Il([{keep:[]},{rename:["name"]},{removed:[]}]),Ty=/^(src|href|style)$/,Oy=Lt.each,Dy=Ku,Ay=(e,t,o)=>e.isChildOf(t,o)&&t!==o&&!e.isBlock(o),My=(e,t,o)=>{let n=t[o?"startContainer":"endContainer"],r=t[o?"startOffset":"endOffset"];if(tr(n)){const e=n.childNodes.length-1;!o&&r&&r--,n=n.childNodes[r>e?e:r]}return dr(n)&&o&&r>=n.data.length&&(n=new Wn(n,e.getBody()).next()||n),dr(n)&&!o&&0===r&&(n=new Wn(n,e.getBody()).prev()||n),n},Ny=(e,t)=>{const o=t?"firstChild":"lastChild",n=e[o];return(e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&n?"TR"===e.nodeName&&n[o]||n:e},Ry=(e,t,o,n)=>{var r;const s=e.create(o,n);return null===(r=t.parentNode)||void 0===r||r.insertBefore(s,t),s.appendChild(t),s},By=(e,t,o,n,r)=>{const s=wo.fromDom(t),a=wo.fromDom(e.create(n,r)),i=o?Lo(s):Bo(s);return xn(a,i),o?(fn(s,a),bn(a,s)):(vn(s,a),yn(a,s)),a.dom},Ly=(e,t,o)=>{const n=t.parentNode;let r;const s=e.dom,a=sc(e);og(o)&&n===s.getRoot()&&(o.list_block&&Dy(t,o.list_block)||q(ue(t.childNodes),(t=>{Wu(e,a,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=Ry(s,t,a),s.setAttribs(r,ac(e))):r=null}))),(e=>ng(e)&&rg(e)&&Ht(_e(e,"mixed"),!0))(o)&&!Dy(o.inline,t)||s.remove(t,!0)},Hy=(e,t,o)=>k(e)?{name:t,value:null}:{name:e,value:Gu(t,o)},Iy=(e,t)=>{""===e.getAttrib(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},Py=(e,t,o,n,r)=>{let s=!1;Oy(o.styles,((a,i)=>{const{name:l,value:c}=Hy(i,a,n),d=Yu(c,l);(o.remove_similar||b(c)||!tr(r)||Dy(Xu(e,r,l),d))&&e.setStyle(t,l,""),s=!0})),s&&Iy(e,t)},Fy=(e,t,o,n,r)=>{const s=e.dom,a=lb(e),i=e.schema;if(rg(t)&&Gr(i,t.inline)&&Yr(i,n)&&n.parentElement===e.getBody())return Ly(e,n,t),Ey.removed();if(!t.ceFalseOverride&&n&&"false"===s.getContentEditableParent(n))return Ey.keep();if(n&&!jb(s,n,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(n,t))return Ey.keep();const l=n,c=t.preserve_attributes;if(rg(t)&&"all"===t.remove&&v(c)){const e=Y(s.getAttribs(l),(e=>j(c,e.name.toLowerCase())));if(s.removeAllAttribs(l),q(e,(e=>s.setAttrib(l,e.name,e.value))),e.length>0)return Ey.rename("span")}if("all"!==t.remove){Py(s,l,t,o,r),Oy(t.attributes,((e,n)=>{const{name:a,value:i}=Hy(n,e,o);if(t.remove_similar||b(i)||!tr(r)||Dy(s.getAttrib(r,a),i)){if("class"===a){const e=s.getAttrib(l,a);if(e){let t="";if(q(e.split(/\s+/),(e=>{/mce\-\w+/.test(e)&&(t+=(t?" ":"")+e)})),t)return void s.setAttrib(l,a,t)}}if(Ty.test(a)&&l.removeAttribute("data-mce-"+a),"style"===a&&rr(["li"])(l)&&"none"===s.getStyle(l,"list-style-type"))return l.removeAttribute(a),void s.setStyle(l,"list-style-type","none");"class"===a&&l.removeAttribute("className"),l.removeAttribute(a)}})),Oy(t.classes,(e=>{e=Gu(e,o),tr(r)&&!s.hasClass(r,e)||s.removeClass(l,e)}));const e=s.getAttribs(l);for(let t=0;tFy(e,t,o,n,n).fold(D(n),(t=>(e.dom.createFragment().appendChild(n),e.dom.rename(n,t))),D(null)),Vy=(e,t,o,n,r)=>{const s=e.formatter.get(t),a=s[0],i=e.dom,l=e.selection,c=n=>{const i=((e,t,o,n,r)=>{let s;return t.parentNode&&q(Qu(e.dom,t.parentNode).reverse(),(t=>{if(!s&&tr(t)&&"_start"!==t.id&&"_end"!==t.id){const a=$b(e,t,o,n,r);a&&!1!==a.split&&(s=t)}})),s})(e,n,t,o,r);return((e,t,o,n,r,s,a,i)=>{var l,c;let d,m;const u=e.dom;if(o){const g=o.parentNode;for(let o=n.parentNode;o&&o!==g;o=o.parentNode){let n=u.clone(o,!1);for(let o=0;oW(s,(n=>Uy(e,n,o,t,t))),m=t=>{const o=ue(t.childNodes),n=d(t)||W(s,(e=>jb(i,t,e))),r=t.parentNode;if(!n&&C(r)&&sg(a)&&d(r),a.deep&&o.length)for(let e=0;e{tr(t)&&e.dom.getStyle(t,"text-decoration")===o&&t.parentNode&&Ju(i,t.parentNode)===o&&Uy(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:o}},void 0,t)}))},u=e=>{const t=i.get(e?"_start":"_end");if(t){let o=t[e?"firstChild":"lastChild"];return(e=>Cu(e)&&tr(e)&&("_start"===e.id||"_end"===e.id))(o)&&(o=o[e?"firstChild":"lastChild"]),dr(o)&&0===o.data.length&&(o=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),i.remove(t,!0),o}return null},g=t=>{let o,n,r=Cg(i,t,s,t.collapsed);if(a.split){if(r=Ch(r),o=My(e,r,!0),n=My(e,r),o!==n){if(o=Ny(o,!0),n=Ny(n,!1),Ay(i,o,n)){const e=F.from(o.firstChild).getOr(o);return c(By(i,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void u(!0)}if(Ay(i,n,o)){const e=F.from(n.lastChild).getOr(n);return c(By(i,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void u(!1)}o=Ry(i,o,"span",{id:"_start","data-mce-type":"bookmark"}),n=Ry(i,n,"span",{id:"_end","data-mce-type":"bookmark"});const e=i.createRng();e.setStartAfter(o),e.setEndBefore(n),Sg(i,e,(e=>{q(e,(e=>{Cu(e)||Cu(e.parentNode)||c(e)}))})),c(o),c(n),o=u(!0),n=u()}else o=n=c(o);r.startContainer=o.parentNode?o.parentNode:o,r.startOffset=i.nodeIndex(o),r.endContainer=n.parentNode?n.parentNode:n,r.endOffset=i.nodeIndex(n)+1}Sg(i,r,(e=>{q(e,m)}))};if(n){if(Fu(n)){const e=i.createRng();e.setStartBefore(n),e.setEndAfter(n),g(e)}else g(n);Hg(e,t,n,o)}else l.isCollapsed()&&rg(a)&&!Au(e).length?ny(e,t,o,r):(Vu(e,(()=>Iu(e,g)),(n=>rg(a)&&qb(e,t,o,n))),e.nodeChanged()),((e,t,o)=>{"removeformat"===t?q(vy(e.selection),(t=>{q(dy,(o=>e.dom.setStyle(t,o,""))),Iy(e.dom,t)})):uy(e.formatter,t).each((t=>{q(vy(e.selection),(n=>Py(e.dom,n,t,o,null)))}))})(e,t,o),Hg(e,t,n,o)},Zy=(e,t,o,n,r)=>{(n||e.selection.isEditable())&&Vy(e,t,o,n,r)},Uy=(e,t,o,n,r)=>Fy(e,t,o,n,r).fold(I,(t=>(e.dom.rename(n,t),!0)),P),jy=Lt.each,Wy=(e,t,o,n)=>{jy(t,(t=>{rg(t)&&jy(e.dom.select(t.inline,n),(n=>{yy(n)&&Uy(e,t,o,n,t.exact?n:null)})),((e,t,o)=>{if(t.clear_child_styles){const n=t.links?"*:not(a)":"*";by(e.select(n,o),(o=>{yy(o)&&e.isEditable(o)&&by(t.styles,((t,n)=>{e.setStyle(o,n,"")}))}))}})(e.dom,t,n)}))},$y=Lt.each,qy=(e,t,o,n)=>{if($y(o.styles,((o,r)=>{e.setStyle(t,r,Gu(o,n))})),o.styles){const o=e.getAttrib(t,"style");o&&e.setAttrib(t,"data-mce-style",o)}},Gy=(e,t,o,n)=>{const r=e.formatter.get(t),s=r[0],a=!n&&e.selection.isCollapsed(),i=e.dom,l=e.selection,c=(e,t=s)=>{S(t.onformat)&&t.onformat(e,t,o,n),qy(i,e,t,o),$y(t.attributes,((t,n)=>{i.setAttrib(e,n,Gu(t,o))})),$y(t.classes,(t=>{const n=Gu(t,o);i.hasClass(e,n)||i.addClass(e,n)}))},d=(e,t)=>{let o=!1;return $y(e,(e=>!(!ng(e)||("false"!==i.getContentEditable(t)||e.ceFalseOverride)&&(!C(e.collapsed)||e.collapsed===a)&&i.is(t,e.selector)&&!lu(t)&&(c(t,e),o=!0,1)))),o},m=e=>{if(h(e)){const t=i.create(e);return c(t),t}return null},u=(n,a,i)=>{const l=[];let u=!0;const g=s.inline||s.block,h=m(g),p=n=>(e=>og(e)&&!0===e.wrapper)(s)&&$b(e,n,t,o),f=(t,o,n)=>{const r=(e=>og(e)&&!0!==e.wrapper)(s)&&ju(e.schema,t)&&Wu(e,o,g);return n&&r};Sg(n,a,(t=>{let o;const a=t=>{let m=!1,v=u,b=!1;const y=t.parentNode,w=y.nodeName.toLowerCase(),x=n.getContentEditable(t);C(x)&&(v=u,u="true"===x,m=!0,b=qu(e,t));const S=u&&!m;if(fr(t)&&!((e,t,o,n)=>{if(jc(e)&&rg(t)&&o.parentNode){const t=Fs(e.schema),r=Un(wo.fromDom(o),(e=>lu(e.dom)));return Te(t,n)&&Nr(e.schema,o.parentNode,{skipBogus:!1,includeZwsp:!0})&&!r}return!1})(e,s,t,w))return o=null,void(og(s)&&n.remove(t));if(p(t))o=null;else{if(f(t,w,S)){const e=n.rename(t,g);return c(e),l.push(e),void(o=null)}if(ng(s)){let e=d(r,t);if(!e&&C(y)&&sg(s)&&(e=d(r,y)),!rg(s)||e)return void(o=null)}C(h)&&((t,o,r,a)=>{const l=t.nodeName.toLowerCase(),c=Wu(e,g,l)&&Wu(e,o,g),d=!i&&dr(t)&&mi(t.data),m=lu(t),u=!rg(s)||!n.isBlock(t);return(r||a)&&c&&!d&&!m&&u})(t,w,S,b)?(o||(o=n.clone(h,!1),y.insertBefore(o,t),l.push(o)),b&&m&&(u=v),o.appendChild(t)):(o=null,q(ue(t.childNodes),a),m&&(u=v),o=null)}};q(t,a)})),!0===s.links&&q(l,(e=>{const t=e=>{"A"===e.nodeName&&c(e,s),q(ue(e.childNodes),t)};t(e)})),q(l,(a=>{const i=(e=>{let t=0;return q(e.childNodes,(e=>{(e=>C(e)&&dr(e)&&0===e.length)(e)||Cu(e)||t++})),t})(a);!(l.length>1)&&n.isBlock(a)||0!==i?(rg(s)||og(s)&&s.wrapper)&&(s.exact||1!==i||(a=(e=>{const t=ee(e.childNodes,zu).filter((e=>"false"!==n.getContentEditable(e)&&jb(n,e,s)));return t.map((t=>{const o=n.clone(t,!1);return c(o),n.replace(o,e,!0),n.remove(t,!0),o})).getOr(e)})(a)),Wy(e,r,o,a),((e,t,o,n,r)=>{const s=r.parentNode;$b(e,s,o,n)&&Uy(e,t,n,r)||t.merge_with_parents&&s&&e.dom.getParent(s,(s=>!!$b(e,s,o,n)&&(Uy(e,t,n,r),!0)))})(e,s,t,o,a),((e,t,o,n)=>{if(t.styles&&t.styles.backgroundColor){const r=ky(e,"fontSize");Sy(n,(t=>r(t)&&e.isEditable(t)),_y(e,"backgroundColor",Gu(t.styles.backgroundColor,o)))}})(n,s,o,a),((e,t,o,n)=>{const r=t=>{if(or(t)&&tr(t.parentNode)&&e.isEditable(t)){const o=Ju(e,t.parentNode);e.getStyle(t,"color")&&o?e.setStyle(t,"text-decoration",o):e.getStyle(t,"text-decoration")===o&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(Lt.walk(n,r,"childNodes"),r(n))})(n,s,0,a),((e,t,o,n)=>{if(rg(t)&&("sub"===t.inline||"sup"===t.inline)){const o=ky(e,"fontSize");Sy(n,(t=>o(t)&&e.isEditable(t)),_y(e,"fontSize",""));const r=Y(e.select("sup"===t.inline?"sub":"sup",n),e.isEditable);e.remove(r,!0)}})(n,s,0,a),Cy(e,s,0,a)):n.remove(a,!0)}))},g=Fu(n)?n:l.getNode();if("false"===i.getContentEditable(g)&&!qu(e,g))return d(r,n=g),void Lg(e,t,n,o);if(s){if(n)if(Fu(n)){if(!d(r,n)){const e=i.createRng();e.setStartBefore(n),e.setEndAfter(n),u(i,Cg(i,e,r),!0)}}else u(i,n,!0);else a&&rg(s)&&!Au(e).length?((e,t,o)=>{let n;const r=e.selection,s=e.formatter.get(t);if(!s)return;const a=r.getRng();let i=a.startOffset;const l=a.startContainer.nodeValue;n=cu(e.getBody(),r.getStart());const c=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&i>0&&i{Iu(e,((e,t)=>{const o=t?e:Cg(i,e,r);u(i,o,!1)}))}),P),e.nodeChanged()),uy(e.formatter,t).each((t=>{q(fy(e.selection),(e=>qy(i,e,t,o)))}));((e,t)=>{Ee(ly,e)&&q(ly[e],(e=>{e(t)}))})(t,e)}Lg(e,t,n,o)},Ky=(e,t,o,n)=>{(n||e.selection.isEditable())&&Gy(e,t,o,n)},Yy=e=>Ee(e,"vars"),Xy=e=>e.selection.getStart(),Jy=(e,t,o,n,r)=>Q(t,(t=>{const s=e.formatter.matchNode(t,o,null!=r?r:{},n);return!w(s)}),(t=>!!Zb(e,t,o)||!n&&C(e.formatter.matchNode(t,o,r,!0)))),Qy=(e,t)=>{const o=null!=t?t:Xy(e);return Y(Qu(e.dom,o),(e=>tr(e)&&!ar(e)))},ew=(e,t,o)=>{const n=Qy(e,t);ve(o,((o,r)=>{const s=o=>{const s=Jy(e,n,r,o.similar,Yy(o)?o.vars:void 0),a=s.isSome();if(o.state.get()!==a){o.state.set(a);const e=s.getOr(t);Yy(o)?o.callback(a,{node:e,format:r,parents:n}):q(o.callbacks,(t=>t(a,{node:e,format:r,parents:n})))}};q([o.withSimilar,o.withoutSimilar],s),q(o.withVars,s)}))},tw=(e,t,o,n,r,s)=>(((e,t,o,n,r,s)=>{const a=t.get();q(o.split(","),(t=>{const o=_e(a,t).getOrThunk((()=>{const e={withSimilar:{state:xa(!1),similar:!0,callbacks:[]},withoutSimilar:{state:xa(!1),similar:!1,callbacks:[]},withVars:[]};return a[t]=e,e})),i=()=>{const o=Qy(e);return Jy(e,o,t,r,s).isSome()};if(w(s)){const e=r?o.withSimilar:o.withoutSimilar;e.callbacks.push(n),1===e.callbacks.length&&e.state.set(i())}else o.withVars.push({state:xa(i()),similar:r,vars:s,callback:n})})),t.set(a)})(e,t,o,n,r,s),{unbind:()=>((e,t,o)=>{const n=e.get();q(t.split(","),(e=>_e(n,e).each((t=>{n[e]={withSimilar:{...t.withSimilar,callbacks:Y(t.withSimilar.callbacks,(e=>e!==o))},withoutSimilar:{...t.withoutSimilar,callbacks:Y(t.withoutSimilar.callbacks,(e=>e!==o))},withVars:Y(t.withVars,(e=>e.callback!==o))}})))),e.set(n)})(t,o,n)}),ow=Lt.explode,nw=()=>{const e={};return{addFilter:(t,o)=>{q(ow(t),(t=>{Ee(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(o)}))},getFilters:()=>ke(e),removeFilter:(t,o)=>{q(ow(t),(t=>{if(Ee(e,t))if(C(o)){const n=e[t],r=Y(n.callbacks,(e=>e!==o));r.length>0?n.callbacks=r:delete e[t]}else delete e[t]}))}}},rw=(e,t,o)=>{e.addNodeFilter("font",(e=>{q(e,(e=>{const n=t.parse(e.attr("style")),r=e.attr("color"),s=e.attr("face"),a=e.attr("size");r&&(n.color=r),s&&(n["font-family"]=s),a&&Qe(a).each((e=>{n["font-size"]=o[e-1]})),e.name="span",e.attr("style",t.serialize(n)),((e,t)=>{q(t,(t=>{e.attr(t,null)}))})(e,["color","face","size"])}))}))},sw=(e,t,o)=>{var n;const r=Js();t.convert_fonts_to_spans&&rw(e,r,Lt.explode(null!==(n=t.font_size_legacy_values)&&void 0!==n?n:"")),((e,t,o)=>{e.addNodeFilter("strike",(e=>{const n="html4"!==t.type;q(e,(e=>{if(n)e.name="s";else{const t=o.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",o.serialize(t))}}))}))})(e,o,r)},aw=e=>{const[t,...o]=e.split(","),n=o.join(","),r=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(r){const e=";base64"===r[2],t=e?(e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""})(n):decodeURIComponent(n);return F.some({type:r[1],data:t,base64Encoded:e})}return F.none()},iw=(e,t,o=!0)=>{let n=t;if(o)try{n=atob(t)}catch(e){return F.none()}const r=new Uint8Array(n.length);for(let e=0;e{return We(e,"blob:")?(e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject())).catch((()=>Promise.reject({message:`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`,uriType:"blob"}))))(e):We(e,"data:")?(t=e,new Promise(((e,o)=>{aw(t).bind((({type:e,data:t,base64Encoded:o})=>iw(e,t,o))).fold((()=>o("Invalid data URI")),e)}))):Promise.reject("Unknown URI format");var t},cw=e=>new Promise(((t,o)=>{const n=new FileReader;n.onloadend=()=>{t(n.result)},n.onerror=()=>{var e;o(null===(e=n.error)||void 0===e?void 0:e.message)},n.readAsDataURL(e)}));let dw=0;const mw=(e,t,o)=>aw(e).bind((({data:e,type:n,base64Encoded:r})=>{if(t&&!r)return F.none();{const t=r?e:btoa(e);return o(t,n)}})),uw=(e,t,o)=>{const n=e.create((r||"blobid")+dw++,t,o);var r;return e.add(n),n},gw=(e,t,o=!1)=>mw(t,o,((t,o)=>F.from(e.getByData(t,o)).orThunk((()=>iw(o,t).map((o=>uw(e,o,t))))))),hw=/^(?:(?:(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)([A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*))(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?)$/,pw=e=>F.from(e.match(hw)).bind((e=>ce(e,1))).map((e=>We(e,"www.")?e.substring(4):e)),fw=(e,t)=>{F.from(e.attr("src")).bind(pw).forall((e=>!j(t,e)))&&e.attr("sandbox","")},vw=(e,t)=>We(e,`${t}/`),bw=({type:e,src:t,width:o,height:n}={},r,s)=>{const a=(e=>w(e)?"iframe":vw(e,"image")?"img":vw(e,"video")?"video":vw(e,"audio")?"audio":"iframe")(e),i=new Np(a,1);return i.attr("audio"===a?{src:t}:{src:t,width:o,height:n}),"audio"!==a&&"video"!==a||i.attr("controls",""),"iframe"===a&&r&&fw(i,s),i},yw=(e,t)=>{const{blob_cache:o}=t;if(o){const t=e=>{const t=e.attr("src");(e=>e.attr("src")===Mt.transparentSrc||C(e.attr("data-mce-placeholder")))(e)||(e=>C(e.attr("data-mce-bogus")))(e)||x(t)||gw(o,t,!0).each((t=>{e.attr("src",t.blobUri())}))};e.addAttributeFilter("src",(e=>q(e,t)))}},{entries:ww,setPrototypeOf:xw,isFrozen:Cw,getPrototypeOf:Sw,getOwnPropertyDescriptor:kw}=Object;let{freeze:_w,seal:Ew,create:Tw}=Object,{apply:Ow,construct:Dw}="undefined"!=typeof Reflect&&Reflect;Ow||(Ow=function(e,t,o){return e.apply(t,o)}),_w||(_w=function(e){return e}),Ew||(Ew=function(e){return e}),Dw||(Dw=function(e,t){return new e(...t)});const Aw=Zw(Array.prototype.forEach),Mw=Zw(Array.prototype.pop),Nw=Zw(Array.prototype.push),Rw=Zw(String.prototype.toLowerCase),Bw=Zw(String.prototype.toString),Lw=Zw(String.prototype.match),Hw=Zw(String.prototype.replace),Iw=Zw(String.prototype.indexOf),Pw=Zw(String.prototype.trim),Fw=Zw(RegExp.prototype.test),zw=(Vw=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o1?o-1:0),r=1;r/gm),sx=Ew(/\${[\w\W]*}/gm),ax=Ew(/^data-[\-\w.\u00B7-\uFFFF]/),ix=Ew(/^aria-[\-\w]+$/),lx=Ew(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cx=Ew(/^(?:\w+script|data):/i),dx=Ew(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mx=Ew(/^html$/i);var ux=Object.freeze({__proto__:null,MUSTACHE_EXPR:nx,ERB_EXPR:rx,TMPLIT_EXPR:sx,DATA_ATTR:ax,ARIA_ATTR:ix,IS_ALLOWED_URI:lx,IS_SCRIPT_OR_DATA:cx,ATTR_WHITESPACE:dx,DOCTYPE_NAME:mx});const gx=()=>"undefined"==typeof window?null:window;var hx=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gx();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,r=n.currentScript;let{document:s}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:h}=t,p=c.prototype,f=Ww(p,"cloneNode"),v=Ww(p,"nextSibling"),b=Ww(p,"childNodes"),y=Ww(p,"parentNode");if("function"==typeof i){const e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let w,x="";const{implementation:C,createNodeIterator:S,createDocumentFragment:k,getElementsByTagName:_}=s,{importNode:E}=n;let T={};o.isSupported="function"==typeof ww&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:A,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:B}=ux;let{IS_ALLOWED_URI:L}=ux,H=null;const I=Uw({},[...$w,...qw,...Gw,...Yw,...Jw]);let P=null;const F=Uw({},[...Qw,...ex,...tx,...ox]);let z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,Z=null,U=!0,j=!0,W=!1,$=!0,q=!1,G=!1,K=!1,Y=!1,X=!1,J=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,re={},se=null;const ae=Uw({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=Uw({},["audio","video","img","source","image","track"]);let ce=null;const de=Uw({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),me="http://www.w3.org/1998/Math/MathML",ue="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let he=ge,pe=!1,fe=null;const ve=Uw({},[me,ue,ge],Bw);let be;const ye=["application/xhtml+xml","text/html"];let we,xe=null;const Ce=s.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){if(!xe||xe!==e){if(e&&"object"==typeof e||(e={}),e=jw(e),be=be=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===be?Bw:Rw,H="ALLOWED_TAGS"in e?Uw({},e.ALLOWED_TAGS,we):I,P="ALLOWED_ATTR"in e?Uw({},e.ALLOWED_ATTR,we):F,fe="ALLOWED_NAMESPACES"in e?Uw({},e.ALLOWED_NAMESPACES,Bw):ve,ce="ADD_URI_SAFE_ATTR"in e?Uw(jw(de),e.ADD_URI_SAFE_ATTR,we):de,ie="ADD_DATA_URI_TAGS"in e?Uw(jw(le),e.ADD_DATA_URI_TAGS,we):le,se="FORBID_CONTENTS"in e?Uw({},e.FORBID_CONTENTS,we):ae,V="FORBID_TAGS"in e?Uw({},e.FORBID_TAGS,we):{},Z="FORBID_ATTR"in e?Uw({},e.FORBID_ATTR,we):{},re="USE_PROFILES"in e&&e.USE_PROFILES,U=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,G=e.WHOLE_DOCUMENT||!1,X=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,Y=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||lx,he=e.NAMESPACE||ge,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),J&&(X=!0),re&&(H=Uw({},[...Jw]),P=[],!0===re.html&&(Uw(H,$w),Uw(P,Qw)),!0===re.svg&&(Uw(H,qw),Uw(P,ex),Uw(P,ox)),!0===re.svgFilters&&(Uw(H,Gw),Uw(P,ex),Uw(P,ox)),!0===re.mathMl&&(Uw(H,Yw),Uw(P,tx),Uw(P,ox))),e.ADD_TAGS&&(H===I&&(H=jw(H)),Uw(H,e.ADD_TAGS,we)),e.ADD_ATTR&&(P===F&&(P=jw(P)),Uw(P,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&Uw(ce,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===ae&&(se=jw(se)),Uw(se,e.FORBID_CONTENTS,we)),oe&&(H["#text"]=!0),G&&Uw(H,["html","head","body"]),H.table&&(Uw(H,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw zw('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw zw('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,r)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));_w&&_w(e),xe=e}},_e=Uw({},["mi","mo","mn","ms","mtext"]),Ee=Uw({},["foreignobject","desc","title","annotation-xml"]),Te=Uw({},["title","style","font","a","script"]),Oe=Uw({},qw);Uw(Oe,Gw),Uw(Oe,Kw);const De=Uw({},Yw);Uw(De,Xw);const Ae=function(e){Nw(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Me=function(e,t){try{Nw(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Nw(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!P[e])if(X||J)try{Ae(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t,o;if(Y)e=""+e;else{const t=Lw(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===be&&he===ge&&(e=''+e+"");const n=w?w.createHTML(e):e;if(he===ge)try{t=(new g).parseFromString(n,be)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(he,"template",null);try{t.documentElement.innerHTML=pe?x:n}catch(e){}}const r=t.body||t.documentElement;return e&&o&&r.insertBefore(s.createTextNode(o),r.childNodes[0]||null),he===ge?_.call(t,G?"html":"body")[0]:G?t.documentElement:r},Re=function(e){return S.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Be=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,n){T[e]&&Aw(T[e],(e=>{e.call(o,t,n,xe)}))},He=function(e){let t;if(Le("beforeSanitizeElements",e,null),(n=e)instanceof u&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof m)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Ae(e),!0;var n;const r=we(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:H}),e.hasChildNodes()&&!Be(e.firstElementChild)&&(!Be(e.content)||!Be(e.content.firstElementChild))&&Fw(/<[/\w]/g,e.innerHTML)&&Fw(/<[/\w]/g,e.textContent))return Ae(e),!0;if(!H[r]||V[r]){if(!V[r]&&Pe(r)){if(z.tagNameCheck instanceof RegExp&&Fw(z.tagNameCheck,r))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(r))return!1}if(oe&&!se[r]){const t=y(e)||e.parentNode,o=b(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),v(e))}return Ae(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const o=Rw(e.tagName),n=Rw(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===ue?t.namespaceURI===ge?"svg"===o:t.namespaceURI===me?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Oe[o]):e.namespaceURI===me?t.namespaceURI===ge?"math"===o:t.namespaceURI===ue?"math"===o&&Ee[n]:Boolean(De[o]):e.namespaceURI===ge?!(t.namespaceURI===ue&&!Ee[n])&&!(t.namespaceURI===me&&!_e[n])&&!De[o]&&(Te[o]||!Oe[o]):!("application/xhtml+xml"!==be||!fe[e.namespaceURI]))}(e)?(Ae(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Fw(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=Hw(t,O," "),t=Hw(t,D," "),t=Hw(t,A," "),e.textContent!==t&&(Nw(o.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Ae(e),!0)},Ie=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in s||o in Ce))return!1;if(j&&!Z[t]&&Fw(M,t));else if(U&&Fw(N,t));else if(!P[t]||Z[t]){if(!(Pe(e)&&(z.tagNameCheck instanceof RegExp&&Fw(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&Fw(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Fw(z.tagNameCheck,o)||z.tagNameCheck instanceof Function&&z.tagNameCheck(o))))return!1}else if(ce[t]);else if(Fw(L,Hw(o,B,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Iw(o,"data:")||!ie[e])if(W&&!Fw(R,Hw(o,B,"")));else if(o)return!1;return!0},Pe=function(e){return e.indexOf("-")>0},Fe=function(e){let t,o,n,r;Le("beforeSanitizeAttributes",e,null);const{attributes:s}=e;if(!s)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P};for(r=s.length;r--;){t=s[r];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:Pw(t.value);const c=o;if(n=we(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){Me(i,e);continue}if(!$&&Fw(/\/>/i,o)){Me(i,e);continue}q&&(o=Hw(o,O," "),o=Hw(o,D," "),o=Hw(o,A," "));const d=we(e.nodeName);if(Ie(d,n,o)){if(!te||"id"!==n&&"name"!==n||(Me(i,e),o="user-content-"+o),w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(l);else switch(h.getAttributeType(d,n)){case"TrustedHTML":o=w.createHTML(o);break;case"TrustedScriptURL":o=w.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){Me(i,e)}}else Me(i,e)}Le("afterSanitizeAttributes",e,null)},ze=function e(t){let o;const n=Re(t);for(Le("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Le("uponSanitizeShadowNode",o,null),He(o)||(o.content instanceof a&&e(o.content),Fe(o));Le("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,r,s,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(pe=!e,pe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw zw("toString is not a function");if("string"!=typeof(e=e.toString()))throw zw("dirty is not a string, aborting")}if(!o.isSupported)return e;if(K||ke(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=we(e.nodeName);if(!H[t]||V[t])throw zw("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Ne("\x3c!----\x3e"),r=t.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?t=r:t.appendChild(r);else{if(!X&&!q&&!G&&-1===e.indexOf("<"))return w&&Q?w.createHTML(e):e;if(t=Ne(e),!t)return X?null:Q?x:""}t&&Y&&Ae(t.firstChild);const d=Re(ne?e:t);for(;s=d.nextNode();)He(s)||(s.content instanceof a&&ze(s.content),Fe(s));if(ne)return e;if(X){if(J)for(i=k.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(P.shadowroot||P.shadowrootmode)&&(i=E.call(n,i,!0)),i}let m=G?t.outerHTML:t.innerHTML;return G&&H["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&Fw(mx,t.ownerDocument.doctype.name)&&(m="\n"+m),q&&(m=Hw(m,O," "),m=Hw(m,D," "),m=Hw(m,A," ")),w&&Q?w.createHTML(m):m},o.setConfig=function(e){ke(e),K=!0},o.clearConfig=function(){xe=null,K=!1},o.isValidAttribute=function(e,t,o){xe||ke({});const n=we(e),r=we(t);return Ie(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],Nw(T[e],t))},o.removeHook=function(e){if(T[e])return Mw(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const px=Lt.each,fx=Lt.trim,vx=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],bx={ftp:21,http:80,https:443,mailto:25},yx=["img","video"],wx=(e,t,o)=>{const n=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t).replace(/\s/g,"");return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(n)||!e.allow_html_data_urls&&(/^data:image\//i.test(n)?((e,t)=>C(e)?!e:!C(t)||!j(yx,t))(e.allow_svg_data_urls,o)&&/^data:image\/svg\+xml/i.test(n):/^data:/i.test(n)))};class xx{static parseDataUri(e){let t;const o=decodeURIComponent(e).split(","),n=/data:([^;]+)/.exec(o[0]);return n&&(t=n[1]),{type:t,data:o[1]}}static isDomSafe(e,t,o={}){if(o.allow_script_urls)return!0;{const n=Cs.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!wx(o,n,t)}}static getDocumentBaseUrl(e){var t;let o;return o=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(o)&&(o=o.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(o)||(o+="/")),o}constructor(e,t={}){this.path="",this.directory="",e=fx(e),this.settings=t;const o=t.base_uri,n=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(n.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(o&&o.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=o?o.path:new xx(document.location.href).directory;if(""===(null==o?void 0:o.protocol))e="//mce_host"+n.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(o&&o.protocol||"http")+"://mce_host"+n.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);s&&px(vx,((e,t)=>{let o=s[t];o&&(o=o.replace(/\(mce_at\)/g,"@@")),n[e]=o})),o&&(n.protocol||(n.protocol=o.protocol),n.userInfo||(n.userInfo=o.userInfo),n.port||"mce_host"!==n.host||(n.port=o.port),n.host&&"mce_host"!==n.host||(n.host=o.host),n.source=""),r&&(n.protocol="")}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);t&&(this.path=t[0],this.directory=t[1],this.file=t[2]),this.source="",this.getURI()}toRelative(e){if("./"===e)return e;const t=new xx(e,{base_uri:this});if("mce_host"!==t.host&&this.host!==t.host&&t.host||this.port!==t.port||this.protocol!==t.protocol&&""!==t.protocol)return t.getURI();const o=this.getURI(),n=t.getURI();if(o===n||"/"===o.charAt(o.length-1)&&o.substr(0,o.length-1)===n)return o;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const o=new xx(e,{base_uri:this});return o.getURI(t&&this.isSameOrigin(o))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?bx[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let o,n,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(o=0,n=a.length;o=i.length||a[o]!==i[o]){r=o+1;break}if(a.length=a.length||a[o]!==i[o]){r=o+1;break}if(1===r)return t;for(o=0,n=a.length-(r-1);o{e&&a.push(e)}));const i=[];for(let e=s.length-1;e>=0;e--)0!==s[e].length&&"."!==s[e]&&(".."!==s[e]?o>0?o--:i.push(s[e]):o++);const l=a.length-o;let c;return c=l<=0?se(i).join("/"):a.slice(0,l).join("/")+"/"+se(i).join("/"),0!==c.indexOf("/")&&(c="/"+c),n&&c.lastIndexOf("/")!==c.length-1&&(c+=n),c}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),this.query&&(t+="?"+this.query),this.anchor&&(t+="#"+this.anchor),this.source=t),this.source}}const Cx=Lt.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),Sx="data-mce-type";let kx=0;const _x=(e,t,o,n,r)=>{var s,a,i,l;const c=t.validate,d=o.getSpecialElements();8===e.nodeType&&!t.allow_conditional_comments&&/^\[if/i.test(null!==(s=e.nodeValue)&&void 0!==s?s:"")&&(e.nodeValue=" "+e.nodeValue);const m=null!==(a=null==r?void 0:r.tagName)&&void 0!==a?a:e.nodeName.toLowerCase();if("html"!==n&&o.isValid(n))return void(C(r)&&(r.allowedTags[m]=!0));if(1!==e.nodeType||"body"===m)return;const u=wo.fromDom(e),g=so(u,Sx),p=no(u,"data-mce-bogus");if(!g&&h(p))return void("all"===p?Sn(u):kn(u));const f=o.getElementRule(m);if(!c||f){if(C(r)&&(r.allowedTags[m]=!0),c&&f&&!g){if(q(null!==(i=f.attributesForced)&&void 0!==i?i:[],(e=>{to(u,e.name,"{$uid}"===e.value?"mce_"+kx++:e.value)})),q(null!==(l=f.attributesDefault)&&void 0!==l?l:[],(e=>{so(u,e.name)||to(u,e.name,"{$uid}"===e.value?"mce_"+kx++:e.value)})),f.attributesRequired&&!W(f.attributesRequired,(e=>so(u,e))))return void kn(u);if(f.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(u))return void kn(u);f.outputName&&f.outputName!==m&&Ga(u,f.outputName)}}else Ee(d,m)?Sn(u):kn(u)},Ex=(e,t,o,n,r,s)=>"html"!==o&&!Lr(n)||!(r in Cx&&wx(e,s,n))&&(!e.validate||t.isValid(n,r)||We(r,"data-")||We(r,"aria-")),Tx=(e,t)=>e.hasAttribute(Sx)&&("id"===t||"class"===t||"style"===t),Ox=(e,t)=>e in t.getBoolAttrs(),Dx=(e,t,o,n)=>{const{attributes:r}=e;for(let s=r.length-1;s>=0;s--){const a=r[s],i=a.name,l=a.value;Ex(t,o,n,e.tagName.toLowerCase(),i,l)||Tx(e,i)?Ox(i,o)&&e.setAttribute(i,i):e.removeAttribute(i)}},Ax=(e,t,o)=>{const n=hx();return n.addHook("uponSanitizeElement",((n,r)=>{_x(n,e,t,o.track(n),r)})),n.addHook("uponSanitizeAttribute",((n,r)=>{((e,t,o,n,r)=>{const s=e.tagName.toLowerCase(),{attrName:a,attrValue:i}=r;r.keepAttr=Ex(t,o,n,s,a,i),r.keepAttr?(r.allowedAttributes[a]=!0,Ox(a,o)&&(r.attrValue=a),t.allow_svg_data_urls&&We(i,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):Tx(e,a)&&(r.forceKeepAttr=!0)})(n,e,t,o.current(),r)})),n},Mx=e=>{const t=["type","href","role","arcrole","title","show","actuate","label","from","to"].map((e=>`xlink:${e}`)),o={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:t};return hx().sanitize(e,o),e.innerHTML},Nx=(e,t)=>{const o=(()=>{let e=[];const t=()=>e[e.length-1];return{track:o=>{Hr(o)&&e.push(o);let n=t();return n&&!n.contains(o)&&(e.pop(),n=t()),Ir(n)},current:()=>Ir(t()),reset:()=>{e=[]}}})();if(e.sanitize){const n=Ax(e,t,o),r=(t,r)=>{n.sanitize(t,((e,t)=>{const o={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[]};return o.PARSER_MEDIA_TYPE=t,e.allow_script_urls?o.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(o.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),o})(e,r)),n.removed=[],o.reset()};return{sanitizeHtmlElement:r,sanitizeNamespaceElement:Mx}}return{sanitizeHtmlElement:(n,r)=>{const s=document.createNodeIterator(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let a;for(;a=s.nextNode();){const n=o.track(a);_x(a,e,t,n),tr(a)&&Dx(a,e,t,n)}o.reset()},sanitizeNamespaceElement:E}},Rx=Lt.makeMap,Bx=Lt.extend,Lx=(e,t,o,n)=>{const r=e.name,s=r in o&&"title"!==r&&"textarea"!==r,a=t.childNodes;for(let t=0,r=a.length;t{const r=o.validate,s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Bx(Rx("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=Fs(t),c=/[ \t\r\n]+/g,d=/^[ \t\r\n]+/,m=/[ \t\r\n]+$/,u=e=>{let t=e.parent;for(;C(t);){if(t.name in a)return!0;t=t.parent}return!1},g=o=>o.name in i||Jr(t,o)||Lr(o.name)&&o.parent===e,h=(t,o)=>{const r=o?t.prev:t.next;return!C(r)&&!x(t.parent)&&g(t.parent)&&(t.parent!==e||!0===n.isRootContent)};return[e=>{var t;if(3===e.type&&!u(e)){let o=null!==(t=e.value)&&void 0!==t?t:"";o=o.replace(c," "),(((e,t)=>C(e)&&(t(e)||"br"===e.name))(e.prev,g)||h(e,!0))&&(o=o.replace(d,"")),0===o.length?e.remove():e.value=o}},e=>{var i;if(1===e.type){const i=t.getElementRule(e.name);if(r&&i){const r=pb(t,s,a,e);i.paddInEmptyBlock&&r&&(e=>{let o=e;for(;C(o);){if(o.name in l)return pb(t,s,a,o);o=o.parent}return!1})(e)?gb(o,n,g,e):i.removeEmpty&&r?g(e)?e.remove():e.unwrap():i.paddEmpty&&(r||(e=>{var t;return hb(e,"#text")&&(null===(t=null==e?void 0:e.firstChild)||void 0===t?void 0:t.value)===qn})(e))&&gb(o,n,g,e)}}else if(3===e.type&&!u(e)){let t=null!==(i=e.value)&&void 0!==i?i:"";(e.next&&g(e.next)||h(e,!1))&&(t=t.replace(m,"")),0===t.length?e.remove():e.value=t}}]},Ix=(e={},t=Vs())=>{const o=nw(),n=nw(),r={validate:!0,root_name:"body",sanitize:!0,...e},s=new DOMParser,a=Nx(r,t),i=o.addFilter,l=o.getFilters,c=o.removeFilter,d=n.addFilter,m=n.getFilters,u=n.removeFilter,g=(e,o)=>{const n=h(o.attr(Sx)),r=1===o.type&&!Ee(e,o.name)&&!Jr(t,o)&&!Lr(o.name);return 3===o.type||r&&!n},p={schema:t,addAttributeFilter:d,getAttributeFilters:m,removeAttributeFilter:u,addNodeFilter:i,getNodeFilters:l,removeNodeFilter:c,parse:(e,o={})=>{var n;const i=r.validate,c=null!==(n=o.context)&&void 0!==n?n:r.root_name,d=((e,o,n="html")=>{const r="xhtml"===n?"application/xhtml+xml":"text/html",i=Ee(t.getSpecialElements(),o.toLowerCase()),l=i?`<${o}>${e}`:e,c="xhtml"===n?`${l}`:`${l}`,d=s.parseFromString(c,r).body;return a.sanitizeHtmlElement(d,r),i?d.firstChild:d})(e,c,o.format);Wr(t,d);const u=new Np(c,11);Lx(u,d,t.getSpecialElements(),a.sanitizeNamespaceElement),d.innerHTML="";const[h,p]=Hx(u,t,r,o),f=[],v=i?e=>((e,o)=>{yb(t,e)&&o.push(e)})(e,f):E,b={nodes:{},attributes:{}},y=e=>db(l(),m(),e,b);if(((e,t,o)=>{const n=[];for(let o=e,r=o;o;r=o,o=o.walk()){const s=o;q(t,(e=>e(s))),x(s.parent)&&s!==e?o=r:n.push(s)}for(let e=n.length-1;e>=0;e--){const t=n[e];q(o,(e=>e(t)))}})(u,[h,y],[p,v]),f.reverse(),i&&f.length>0)if(o.context){const{pass:e,fail:n}=K(f,(e=>e.parent===u));bb(n,t,u,y),o.invalid=e.length>0}else bb(f,t,u,y);const w=((e,t)=>{var o;const n=null!==(o=t.forced_root_block)&&void 0!==o?o:e.forced_root_block;return!1===n?"":!0===n?"p":n})(r,o);return w&&("body"===u.name||o.isRootContent)&&((e,o)=>{const n=Bx(Rx("script,style,head,html,body,title,meta,param"),t.getBlockElements()),s=/^[ \t\r\n]+/,a=/[ \t\r\n]+$/;let i=e.firstChild,l=null;const c=e=>{var t,o;e&&(i=e.firstChild,i&&3===i.type&&(i.value=null===(t=i.value)||void 0===t?void 0:t.replace(s,"")),i=e.lastChild,i&&3===i.type&&(i.value=null===(o=i.value)||void 0===o?void 0:o.replace(a,"")))};if(t.isValidChild(e.name,o.toLowerCase())){for(;i;){const t=i.next;g(n,i)?(l||(l=new Np(o,1),l.attr(r.forced_root_block_attrs),e.insert(l,i)),l.append(i)):(c(l),l=null),i=t}c(l)}})(u,w),o.invalid||mb(b,o),u}};return((e,t)=>{var o,n;const r=e.schema;e.addAttributeFilter("href",(e=>{let o=e.length;const n=e=>{const t=e?Lt.trim(e):"";return/\b(noopener)\b/g.test(t)?t:(e=>e.split(" ").filter((e=>e.length>0)).concat(["noopener"]).sort().join(" "))(t)};if(!t.allow_unsafe_link_target)for(;o--;){const t=e[o];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",n(t.attr("rel")))}})),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",(e=>{let t,o,n,r,s=e.length;for(;s--;)if(r=e[s],"a"===r.name&&r.firstChild&&!r.attr("href"))for(n=r.parent,t=r.lastChild;t&&n;)o=t.prev,n.insert(t,r),t=o})),t.fix_list_elements&&e.addNodeFilter("ul,ol",(e=>{let t,o,n=e.length;for(;n--;)if(t=e[n],o=t.parent,o&&("ul"===o.name||"ol"===o.name))if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{const e=new Np("li",1);e.attr("style","list-style-type: none"),t.wrap(e)}}));const s=r.getValidClasses();t.validate&&s&&e.addAttributeFilter("class",(e=>{var t;let o=e.length;for(;o--;){const n=e[o],r=null!==(t=n.attr("class"))&&void 0!==t?t:"",a=Lt.explode(r," ");let i="";for(let e=0;eq(e,(e=>{e.replace(bw({type:e.attr("type"),src:"object"===e.name?e.attr("data"):e.attr("src"),width:e.attr("width"),height:e.attr("height")},a,i))})))),a&&e.addNodeFilter("iframe",(e=>q(e,(e=>fw(e,i)))))})(p,r),((e,t,o)=>{t.inline_styles&&sw(e,t,o)})(p,r,t),p},Px=(e,t,o)=>{const n=(e=>Hb(e)?Jp({validate:!1}).serialize(e):e)(e),r=t(n);if(r.isDefaultPrevented())return r;if(Hb(e)){if(r.content!==n){const t=Ix({validate:!1,forced_root_block:!1,...o}).parse(r.content,{context:e.name});return{...r,content:t}}return{...r,content:e}}return r},Fx=e=>({sanitize:Ld(e),sandbox_iframes:Vd(e),sandbox_iframes_exclusions:Zd(e)}),zx=(e,t)=>{if(t.no_events)return Hl.value(t);{const o=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return o.isDefaultPrevented()?Hl.error(Pg(e,{content:"",...o}).content):Hl.value(o)}},Vx=(e,t,o)=>{if(o.no_events)return t;{const n=Px(t,(t=>Pg(e,{...o,content:t})),Fx(e));return n.content}},Zx=(e,t)=>{if(t.no_events)return Hl.value(t);{const o=Px(t.content,(o=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:o})),Fx(e));return o.isDefaultPrevented()?(Ig(e,o),Hl.error(void 0)):Hl.value(o)}},Ux=(e,t,o)=>{o.no_events||Ig(e,{...o,content:t})},jx=(e,t,o)=>({element:e,width:t,rows:o}),Wx=(e,t)=>({element:e,cells:t}),$x=(e,t)=>({x:e,y:t}),qx=(e,t)=>ro(e,t).bind(Qe).getOr(1),Gx=(e,t,o)=>{const n=e.rows;return!!(n[o]?n[o].cells:[])[t]},Kx=e=>J(e,((e,t)=>t.cells.length>e?t.cells.length:e),0),Yx=(e,t)=>{const o=e.rows;for(let e=0;e{const s=[],a=e.rows;for(let e=o;e<=r;e++){const o=a[e].cells,r=t{const t=jx($a(e),0,[]);return q(Vn(e,"tr"),((e,o)=>{q(Vn(e,"td,th"),((n,r)=>{((e,t,o,n,r)=>{const s=qx(r,"rowspan"),a=qx(r,"colspan"),i=e.rows;for(let e=o;e{for(;Gx(e,t,o);)t++;return t})(t,r,o),o,e,n)}))})),jx(t.element,Kx(t.rows),t.rows)},Qx=e=>((e,t)=>{const o=$a(e.element),n=wo.fromTag("tbody");return xn(n,t),yn(o,n),o})(e,(e=>$(e.rows,(e=>{const t=$(e.cells,(e=>{const t=qa(e);return ao(t,"colspan"),ao(t,"rowspan"),t})),o=$a(e.element);return xn(o,t),o})))(e)),eC=(e,t,o)=>Yx(e,t).bind((t=>Yx(e,o).map((o=>((e,t,o)=>{const n=t.x,r=t.y,s=o.x,a=o.y,i=ree(e,(e=>"li"===Wt(e)&&Bu(e,t))).fold(D([]),(t=>(e=>ee(e,(e=>"ul"===Wt(e)||"ol"===Wt(e))))(e).map((e=>{const t=wo.fromTag(Wt(e)),o=Ce(hn(e),((e,t)=>We(t,"list-style")));return dn(t,o),[wo.fromTag("li"),t]})).getOr([]))),oC=(e,t,o)=>{const n=wo.fromDom(t.commonAncestorContainer),r=xf(n,e),s=Y(r,(e=>o.isWrapper(Wt(e)))),a=tC(r,t),i=s.concat(a.length?a:(e=>ni(e)?Do(e).filter(oi).fold(D([]),(t=>[e,t])):oi(e)?[e]:[])(n));return $(i,$a)},nC=()=>ch([]),rC=(e,t,o)=>((e,t)=>{const o=J(t,((e,t)=>(yn(t,e),t)),e);return t.length>0?ch([o]):o})(wo.fromDom(t.cloneContents()),oC(e,t,o)),sC=(e,t)=>((e,t)=>tn(t,"table",N(ko,e)))(e,t[0]).bind((e=>{const o=t[0],n=t[t.length-1],r=Jx(e);return eC(r,o,n).map((e=>ch([Qx(e)])))})).getOrThunk(nC),aC=(e,t,o)=>{const n=Du(t,e);return n.length>0?sC(e,n):((e,t,o)=>t.length>0&&t[0].collapsed?nC():rC(e,t[0],o))(e,t,o)},iC=(e,t)=>t>=0&&tui(e.innerText),cC=(e,t)=>{if("text"===t.format)return(e=>F.from(e.selection.getRng()).map((t=>{var o;const n=F.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),r=e.getBody(),s=(e=>e.map((e=>e.nodeName)).getOr("div").toLowerCase())(n),a=wo.fromDom(t.cloneContents());$p(a),qp(a);const i=e.dom.add(r,s,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},a.dom),l=lC(i),c=ui(null!==(o=i.textContent)&&void 0!==o?o:"");if(e.dom.remove(i),iC(c,0)||iC(c,c.length-1)){const e=n.getOr(r),t=lC(e),o=t.indexOf(l);return-1===o?l:(iC(t,o-1)?" ":"")+l+(iC(t,o+l.length)?" ":"")}return l})).getOr(""))(e);{const o=((e,t)=>{const o=e.selection.getRng(),n=e.dom.create("body"),r=e.selection.getSel(),s=Tp(e,Tu(r)),a=t.contextual?aC(wo.fromDom(e.getBody()),s,e.schema).dom:o.cloneContents();return a&&n.appendChild(a),e.selection.serializer.serialize(n,t)})(e,t);return"tree"===t.format?o:e.selection.isCollapsed()?"":o}},dC=e=>tr(e)?e.outerHTML:dr(e)?Cs.encodeRaw(e.data,!1):gr(e)?"\x3c!--"+e.data+"--\x3e":"",mC=(e,t,o)=>{const n=(e=>{let t;const o=document.createElement("div"),n=document.createDocumentFragment();for(e&&(o.innerHTML=e);t=o.firstChild;)n.appendChild(t);return n})(t);if(e.hasChildNodes()&&o(((e,t)=>{let o=0;q(e,(e=>{0===e[0]?o++:1===e[0]?(mC(t,e[1],o),o++):2===e[0]&&((e,t)=>{if(e.hasChildNodes()&&t{const o=e.length+t.length+2,n=new Array(o),r=new Array(o),s=(o,n,r,a,l)=>{const c=i(o,n,r,a);if(null===c||c.start===n&&c.diag===n-a||c.end===o&&c.diag===o-r){let s=o,i=r;for(;sa-r?(l.push([2,e[s]]),++s):(l.push([1,t[i]]),++i)}else{s(o,c.start,r,c.start-c.diag,l);for(let t=c.start;t{let a=o;for(;a-n({start:e,end:t,diag:o}))(o,a,n)},i=(o,s,i,l)=>{const c=s-o,d=l-i;if(0===c||0===d)return null;const m=c-d,u=d+c,g=(u%2==0?u:u+1)/2;let h,p,f,v,b;for(n[1+g]=o,r[1+g]=s+1,h=0;h<=g;++h){for(p=-h;p<=h;p+=2){for(f=p+g,p===-h||p!==h&&n[f-1]=o&&b>=i&&e[v]===t[b];)r[f]=v--,b--;if(m%2==0&&-h<=p&&p<=h&&r[f]<=n[f+m])return a(r[f],p+o-i,s,l)}}return null},l=[];return s(0,e.length,0,t.length,l),l})($(ue(t.childNodes),dC),e),t),t),gC=Ie((()=>document.implementation.createHTMLDocument("undo"))),hC=e=>{const t=e.serializer.getTempAttrs(),o=Wp(e.getBody(),t);return(e=>null!==e.querySelector("iframe"))(o)?(n=((e,t)=>Y($(ue(e.childNodes),t?T(ui,dC):dC),(e=>e.length>0)))(o,!0),{type:"fragmented",fragments:n,content:"",bookmark:null,beforeBookmark:null}):{type:"complete",fragments:null,content:ui(o.innerHTML),bookmark:null,beforeBookmark:null};var n},pC=(e,t,o)=>{const n=o?t.beforeBookmark:t.bookmark;"fragmented"===t.type?uC(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!C(n)||!mu(n)||!n.isFakeCaret}),n&&(e.selection.moveToBookmark(n),e.selection.scrollIntoView())},fC=e=>"fragmented"===e.type?e.fragments.join(""):e.content,vC=e=>{const t=wo.fromTag("body",gC());return Tn(t,fC(e)),q(Vn(t,"*[data-mce-bogus]"),kn),En(t)},bC=(e,t)=>!(!e||!t)&&(!!((e,t)=>fC(e)===fC(t))(e,t)||((e,t)=>vC(e)===vC(t))(e,t)),yC=e=>0===e.get(),wC=(e,t,o)=>{yC(o)&&(e.typing=t)},xC=(e,t)=>{e.typing&&(wC(e,!1,t),e.add())},CC=e=>({init:{bindEvents:E},undoManager:{beforeChange:(t,o)=>((e,t,o)=>{yC(t)&&o.set(Rl(e.selection))})(e,t,o),add:(t,o,n,r,s,a)=>((e,t,o,n,r,s,a)=>{const i=hC(e),l=Lt.extend(s||{},i);if(!yC(n)||e.removed)return null;const c=t.data[o.get()];if(e.dispatch("BeforeAddUndo",{level:l,lastLevel:c,originalEvent:a}).isDefaultPrevented())return null;if(c&&bC(c,l))return null;t.data[o.get()]&&r.get().each((e=>{t.data[o.get()].beforeBookmark=e}));const d=Jc(e);if(d&&t.data.length>d){for(let e=0;e0?(e.setDirty(!0),e.dispatch("AddUndo",m),e.dispatch("change",m)):e.dispatch("AddUndo",m),l})(e,t,o,n,r,s,a),undo:(t,o,n)=>((e,t,o,n)=>{let r;return t.typing&&(t.add(),t.typing=!1,wC(t,!1,o)),n.get()>0&&(n.set(n.get()-1),r=t.data[n.get()],pC(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,o,n),redo:(t,o)=>((e,t,o)=>{let n;return t.get()((e,t,o)=>{t.data=[],o.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,o),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,o)=>((e,t,o)=>o.get()>0||t.typing&&t.data[0]&&!bC(hC(e),t.data[0]))(e,t,o),hasRedo:(e,t)=>((e,t)=>t.get()((e,t,o)=>(xC(e,t),e.beforeChange(),e.ignore(o),e.add()))(e,t,o),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,o,n,r)=>((e,t,o,n,r)=>{if(t.transact(n)){const n=t.data[o.get()].bookmark,s=t.data[o.get()-1];pC(e,s,!0),t.transact(r)&&(t.data[o.get()-1].beforeBookmark=n)}})(e,t,o,n,r)},formatter:{match:(t,o,n,r)=>qb(e,t,o,n,r),matchAll:(t,o)=>((e,t,o)=>{const n=[],r={},s=e.selection.getStart();return e.dom.getParent(s,(s=>{for(let a=0;a$b(e,t,o,n,r),canApply:t=>((e,t)=>{const o=e.formatter.get(t),n=e.dom;if(o&&e.selection.isEditable()){const t=e.selection.getStart(),r=Qu(n,t);for(let e=o.length-1;e>=0;e--){const t=o[e];if(!ng(t))return!0;for(let e=r.length-1;e>=0;e--)if(n.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>Gb(e,t),apply:(t,o,n)=>Ky(e,t,o,n),remove:(t,o,n,r)=>Zy(e,t,o,n,r),toggle:(t,o,n)=>((e,t,o,n)=>{const r=e.formatter.get(t);r&&(!qb(e,t,o,n)||"toggle"in r[0]&&!r[0].toggle?Ky(e,t,o,n):Zy(e,t,o,n))})(e,t,o,n),formatChanged:(t,o,n,r,s)=>tw(e,t,o,n,r,s)},editor:{getContent:t=>((e,t)=>F.from(e.getBody()).fold(D("tree"===t.format?new Np("body",11):""),(o=>Kp(e,t,o))))(e,t),setContent:(t,o)=>Pb(e,t,o),insertContent:(t,o)=>Lb(e,t,o),addVisual:t=>((e,t)=>{const o=e.dom,n=C(t)?t:e.getBody();q(o.select("table,a",n),(t=>{switch(t.nodeName){case"TABLE":const n=id(e),r=o.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?o.removeClass(t,n):o.addClass(t,n);break;case"A":if(!o.getAttrib(t,"href")){const n=o.getAttrib(t,"name")||t.id,r=ld(e);n&&e.hasVisual?o.addClass(t,r):o.removeClass(t,r)}}})),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,o)=>((e,t,o={})=>{const n=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(o,t);return zx(e,n).fold(A,(t=>{const o=cC(e,t);return Vx(e,o,t)}))})(e,t,o)},autocompleter:{addDecoration:E,removeDecoration:E},raw:{getModel:()=>F.none()}}),SC=e=>Ee(e.plugins,"rtc"),kC=e=>{const t=e;return(e=>_e(e.plugins,"rtc").bind((e=>F.from(e.setup))))(e).fold((()=>(t.rtcInstance=CC(e),F.none())),(e=>(t.rtcInstance=(()=>{const e=D(null),t=D("");return{init:{bindEvents:E},undoManager:{beforeChange:E,add:e,undo:e,redo:e,clear:E,reset:E,hasUndo:I,hasRedo:I,transact:e,ignore:E,extra:E},formatter:{match:I,matchAll:D([]),matchNode:D(void 0),canApply:I,closest:t,apply:E,remove:E,toggle:E,formatChanged:D({unbind:E})},editor:{getContent:t,setContent:D({content:"",html:""}),insertContent:D(""),addVisual:E},selection:{getContent:t},autocompleter:{addDecoration:E,removeDecoration:E},raw:{getModel:D(F.none())}}})(),F.some((()=>e().then((e=>(t.rtcInstance=(e=>{const t=e=>p(e)?e:{},{init:o,undoManager:n,formatter:r,editor:s,selection:a,autocompleter:i,raw:l}=e;return{init:{bindEvents:o.bindEvents},undoManager:{beforeChange:n.beforeChange,add:n.add,undo:n.undo,redo:n.redo,clear:n.clear,reset:n.reset,hasUndo:n.hasUndo,hasRedo:n.hasRedo,transact:(e,t,o)=>n.transact(o),ignore:(e,t)=>n.ignore(t),extra:(e,t,o,r)=>n.extra(o,r)},formatter:{match:(e,o,n,s)=>r.match(e,t(o),s),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,o,n)=>r.apply(e,t(o)),remove:(e,o,n,s)=>r.remove(e,t(o)),toggle:(e,o,n)=>r.toggle(e,t(o)),formatChanged:(e,t,o,n,s)=>r.formatChanged(t,o,n,s)},editor:{getContent:e=>s.getContent(e),setContent:(e,t)=>({content:s.setContent(e,t),html:""}),insertContent:(e,t)=>(s.insertContent(e),""),addVisual:s.addVisual},selection:{getContent:(e,t)=>a.getContent(t)},autocompleter:{addDecoration:i.addDecoration,removeDecoration:i.removeDecoration},raw:{getModel:()=>F.some(l.getRawModel())}}})(e),e.rtc.isRemote))))))))},_C=e=>e.rtcInstance?e.rtcInstance:CC(e),EC=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},TC=e=>EC(e).init.bindEvents(),OC=(e,t={})=>((e,t,o)=>EC(e).selection.getContent(t,o))(e,t.format?t.format:"html",t),DC=e=>0===e.dom.length?(Sn(e),F.none()):F.some(e),AC=(e,t,o,n,r)=>{e.bind((e=>((n?tv:ev)(e.dom,n?e.dom.length:0,r),t.filter(Yt).map((t=>((e,t,o,n,r)=>{const s=e.dom,a=t.dom,i=n?s.length:a.length;n?(ov(s,a,r,!1,!n),o.setStart(a,i)):(ov(a,s,r,!1,!n),o.setEnd(a,i))})(e,t,o,n,r)))))).orThunk((()=>{const e=((e,t)=>e.filter((e=>Ng.isBookmarkNode(e.dom))).bind(t?Ro:No))(t,n).or(t).filter(Yt);return e.map((e=>((e,t,o)=>{Do(e).each((n=>{const r=e.dom;t&&jf(n,ml(r,0),o)?ev(r,0,o):!t&&Wf(n,ml(r,r.length),o)&&tv(r,r.length,o)}))})(e,n,r)))}))},MC=(e,t,o={})=>{const n=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(o,t);Zx(e,n).each((t=>{const o=((e,t)=>{if("raw"!==t.format){const o=e.selection.getRng(),n=e.dom.getParent(o.commonAncestorContainer,e.dom.isBlock),r=n?{context:n.nodeName.toLowerCase()}:{},s=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return Jp({validate:!1},e.schema).serialize(s)}return t.content})(e,t),n=e.selection.getRng();((e,t,o)=>{const n=F.from(t.firstChild).map(wo.fromDom),r=F.from(t.lastChild).map(wo.fromDom);e.deleteContents(),e.insertNode(t);const s=n.bind(No).filter(Yt).bind(DC),a=r.bind(Ro).filter(Yt).bind(DC);AC(s,n,e,!0,o),AC(a,r,e,!1,o),e.collapse(!1)})(n,n.createContextualFragment(o),e.schema),e.selection.setRng(n),Wh(e,n),Ux(e,o,t)}))},NC=(e,t,o)=>{if(Ee(e,t)){const n=Y(e[t],(e=>e!==o));0===n.length?delete e[t]:e[t]=n}};var RC=(e,t)=>{let o,n;const r=(t,o)=>ee(o,(o=>e.is(o,t))),s=t=>e.getParents(t,void 0,e.getRoot());return{selectorChangedWithUnbind:(e,a)=>(o||(o={},n={},t.on("NodeChange",(e=>{const t=e.element,a=s(t),i={};ve(o,((e,t)=>{r(t,a).each((o=>{n[t]||(q(e,(e=>{e(!0,{node:o,selector:t,parents:a})})),n[t]=e),i[t]=e}))})),ve(n,((e,o)=>{i[o]||(delete n[o],q(e,(e=>{e(!1,{node:t,selector:o,parents:a})})))}))}))),o[e]||(o[e]=[]),o[e].push(a),r(e,s(t.selection.getStart())).each((()=>{n[e]=o[e]})),{unbind:()=>{NC(o,e,a),NC(n,e,a)}})}};const BC=e=>!(!e||!e.ownerDocument)&&_o(wo.fromDom(e.ownerDocument),wo.fromDom(e)),LC=(e,t,o,n)=>{let r,s;const{selectorChangedWithUnbind:a}=RC(e,n),i=(e,t)=>MC(n,e,t),l=e=>{const t=d();t.collapse(!!e),m(t)},c=()=>t.getSelection?t.getSelection():t.document.selection,d=()=>{let o;const a=(e,t,o)=>{try{return t.compareBoundaryPoints(e,o)}catch(e){return-1}},i=t.document;if(C(n.bookmark)&&!bp(n)){const e=np(n);if(e.isSome())return e.map((e=>Tp(n,[e])[0])).getOr(i.createRange())}try{const e=c();e&&!er(e.anchorNode)&&(o=e.rangeCount>0?e.getRangeAt(0):i.createRange(),o=Tp(n,[o])[0])}catch(e){}if(o||(o=i.createRange()),hr(o.startContainer)&&o.collapsed){const t=e.getRoot();o.setStart(t,0),o.setEnd(t,0)}return r&&s&&(0===a(o.START_TO_START,o,r)&&0===a(o.END_TO_END,o,r)?o=s:(r=null,s=null)),o},m=(e,t)=>{if(!(e=>!!e&&BC(e.startContainer)&&BC(e.endContainer))(e))return;const o=c();if(e=n.dispatch("SetSelectionRange",{range:e,forward:t}).range,o){s=e;try{o.removeAllRanges(),o.addRange(e)}catch(e){}!1===t&&o.extend&&(o.collapse(e.endContainer,e.endOffset),o.extend(e.startContainer,e.startOffset)),r=o.rangeCount>0?o.getRangeAt(0):null}if(!e.collapsed&&e.startContainer===e.endContainer&&(null==o?void 0:o.setBaseAndExtent)&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()){const t=e.startContainer.childNodes[e.startOffset];t&&"IMG"===t.nodeName&&(o.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),o.anchorNode===e.startContainer&&o.focusNode===e.endContainer||o.setBaseAndExtent(t,0,t,1))}n.dispatch("AfterSetSelectionRange",{range:e,forward:t})},u=()=>{const t=c(),o=null==t?void 0:t.anchorNode,n=null==t?void 0:t.focusNode;if(!t||!o||!n||er(o)||er(n))return!0;const r=e.createRng(),s=e.createRng();try{r.setStart(o,t.anchorOffset),r.collapse(!0),s.setStart(n,t.focusOffset),s.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,s)<=0},g={dom:e,win:t,serializer:o,editor:n,expand:(t={type:"word"})=>m(Sh(e).expand(d(),t)),collapse:l,setCursorLocation:(t,o)=>{const r=e.createRng();C(t)&&C(o)?(r.setStart(t,o),r.setEnd(t,o),m(r),l(!1)):(Lu(e,r,n.getBody(),!0),m(r))},getContent:e=>OC(n,e),setContent:i,getBookmark:(e,t)=>h.getBookmark(e,t),moveToBookmark:e=>h.moveToBookmark(e),select:(t,o)=>(((e,t,o)=>F.from(t).bind((t=>F.from(t.parentNode).map((n=>{const r=e.nodeIndex(t),s=e.createRng();return s.setStart(n,r),s.setEnd(n,r+1),o&&(Lu(e,s,t,!0),Lu(e,s,t,!1)),s})))))(e,t,o).each(m),t),isCollapsed:()=>{const e=d(),t=c();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isEditable:()=>{const t=d(),o=n.getBody().querySelectorAll('[data-mce-selected="1"]');return o.length>0?re(o,(t=>e.isEditable(t.parentElement))):Cp(e,t)},isForward:u,setNode:t=>(i(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{if(!t)return e;let o=t.startContainer,n=t.endContainer;const r=t.startOffset,s=t.endOffset;let a=t.commonAncestorContainer;t.collapsed||(o===n&&s-r<2&&o.hasChildNodes()&&(a=o.childNodes[r]),dr(o)&&dr(n)&&(o=o.length===r?Ep(o.nextSibling,!0):o.parentNode,n=0===s?Ep(n.previousSibling,!1):n.parentNode,o&&o===n&&(a=o)));const i=dr(a)?a.parentNode:a;return or(i)?i:e})(n.getBody(),d()),getSel:c,setRng:m,getRng:d,getStart:e=>kp(n.getBody(),d(),e),getEnd:e=>_p(n.getBody(),d(),e),getSelectedBlocks:(t,o)=>((e,t,o,n)=>{const r=[],s=e.getRoot(),a=e.getParent(o||kp(s,t,t.collapsed),e.isBlock),i=e.getParent(n||_p(s,t,t.collapsed),e.isBlock);if(a&&a!==s&&r.push(a),a&&i&&a!==i){let t;const o=new Wn(a,s);for(;(t=o.next())&&t!==i;)e.isBlock(t)&&r.push(t)}return i&&a!==i&&i!==s&&r.push(i),r})(e,d(),t,o),normalize:()=>{const t=d(),o=c();if(!(Tu(o).length>1)&&Hu(n)){const o=wh(e,t);return o.each((e=>{m(e,u())})),o.getOr(t)}return t},selectorChanged:(e,t)=>(a(e,t),g),selectorChangedWithUnbind:a,getScrollContainer:()=>{let t,o=e.getRoot();for(;o&&"BODY"!==o.nodeName;){if(o.scrollHeight>o.clientHeight){t=o;break}o=o.parentNode}return t},scrollIntoView:(e,t)=>{C(e)?((e,t,o)=>{(e.inline?Zh:jh)(e,t,o)})(n,e,t):Wh(n,d(),t)},placeCaretAt:(e,t)=>m(uh(e,t,n.getDoc())),getBoundingClientRect:()=>{const e=d();return e.collapsed?ml.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=s=null,p.destroy()}},h=Ng(g),p=$g(g,n);return g.bookmarkManager=h,g.controlSelection=p,g},HC=(e,t,o)=>{e.addAttributeFilter("data-mce-tabindex",((e,t)=>{let o=e.length;for(;o--;){const n=e[o];n.attr("tabindex",n.attr("data-mce-tabindex")),n.attr(t,null)}})),e.addAttributeFilter("src,href,style",((e,n)=>{const r="data-mce-"+n,s=t.url_converter,a=t.url_converter_scope;let i=e.length;for(;i--;){const t=e[i];let l=t.attr(r);void 0!==l?(t.attr(n,l.length>0?l:null),t.attr(r,null)):(l=t.attr(n),"style"===n?l=o.serializeStyle(o.parseStyle(l),t.name):s&&(l=s.call(a,l,n,t.name)),t.attr(n,l.length>0?l:null))}})),e.addAttributeFilter("class",(e=>{let t=e.length;for(;t--;){const o=e[t];let n=o.attr("class");n&&(n=n.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),o.attr("class",n.length>0?n:null))}})),e.addAttributeFilter("data-mce-type",((e,t,o)=>{let n=e.length;for(;n--;){const t=e[n];if("bookmark"===t.attr("data-mce-type")&&!o.cleanup){const e=F.from(t.firstChild).exists((e=>{var t;return!mi(null!==(t=e.value)&&void 0!==t?t:"")}));e?t.unwrap():t.remove()}}})),e.addNodeFilter("noscript",(e=>{var t;let o=e.length;for(;o--;){const n=e[o].firstChild;n&&(n.value=Cs.decode(null!==(t=n.value)&&void 0!==t?t:""))}})),e.addNodeFilter("script,style",((e,o)=>{var n;const r=e=>e.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let s=e.length;for(;s--;){const a=e[s],i=a.firstChild,l=null!==(n=null==i?void 0:i.value)&&void 0!==n?n:"";if("script"===o){const e=a.attr("type");e&&a.attr("type","mce-no/type"===e?null:e.replace(/^mce\-/,"")),"xhtml"===t.element_format&&i&&l.length>0&&(i.value="// ")}else"xhtml"===t.element_format&&i&&l.length>0&&(i.value="\x3c!--\n"+r(l)+"\n--\x3e")}})),e.addNodeFilter("#comment",(e=>{let n=e.length;for(;n--;){const r=e[n],s=r.value;t.preserve_cdata&&0===(null==s?void 0:s.indexOf("[CDATA["))?(r.name="#cdata",r.type=4,r.value=o.decode(s.replace(/^\[CDATA\[|\]\]$/g,""))):0===(null==s?void 0:s.indexOf("mce:protected "))&&(r.name="#text",r.type=3,r.raw=!0,r.value=unescape(s).substr(14))}})),e.addNodeFilter("xml:namespace,input",((e,t)=>{let o=e.length;for(;o--;){const n=e[o];7===n.type?n.remove():1===n.type&&("input"!==t||n.attr("type")||n.attr("type","text"))}})),e.addAttributeFilter("data-mce-type",(t=>{q(t,(t=>{"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())}))})),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",((e,t)=>{let o=e.length;for(;o--;)e[o].attr(t,null)})),t.remove_trailing_brs&&((e,t,o)=>{t.addNodeFilter("br",((t,n,r)=>{const s=Lt.extend({},o.getBlockElements()),a=o.getNonEmptyElements(),i=o.getWhitespaceElements();s.body=1;const l=e=>e.name in s||Jr(o,e);for(let n=0,c=t.length;n((e,t)=>C(e)&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,o)?((e,t,o)=>{let n;const r=e.dom;let s=t.cloneNode(!0);const a=document.implementation;if(a.createHTMLDocument){const e=a.createHTMLDocument("");Lt.each("BODY"===s.nodeName?s.childNodes:[s],(t=>{e.body.appendChild(e.importNode(t,!0))})),s="BODY"!==s.nodeName?e.body.firstChild:e.body,n=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...o,node:s}),n&&(r.doc=n),s})(e,t,o):t,PC=(e,t,o)=>{-1===Lt.inArray(t,o)&&(e.addAttributeFilter(o,((e,t)=>{let o=e.length;for(;o--;)e[o].attr(t,null)})),t.push(o))},FC=(e,t,o,n,r)=>{const s=((e,t,o)=>Jp(e,t).serialize(o))(t,o,n);return((e,t,o)=>{if(!t.no_events&&e){const n=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:o});return n.content}return o})(e,r,s)},zC=(e,t)=>{const o=["data-mce-selected"],n={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},r=t&&t.dom?t.dom:ba.DOM,s=t&&t.schema?t.schema:Vs(n),a=Ix(n,s);return HC(a,n,r),{schema:s,addNodeFilter:a.addNodeFilter,addAttributeFilter:a.addAttributeFilter,serialize:(e,o={})=>{const i={format:"html",...o},l=IC(t,e,i),c=((e,t,o)=>{const n=ui(o.getInner?t.innerHTML:e.getOuterHTML(t));return o.selection||ai(wo.fromDom(t))?n:Lt.trim(n)})(r,l,i),d=((e,t,o)=>{const n=o.selection?{forced_root_block:!1,...o}:o,r=e.parse(t,n);return(e=>{const t=e=>"br"===(null==e?void 0:e.name),o=e.lastChild;if(t(o)){const e=o.prev;t(e)&&(o.remove(),e.remove())}})(r),r})(a,c,i);return"tree"===i.format?d:FC(t,n,s,d,i)},addRules:s.addValidElements,setRules:s.setValidElements,addTempAttr:N(PC,a,o),getTempAttrs:D(o),getNodeFilters:a.getNodeFilters,getAttributeFilters:a.getAttributeFilters,removeNodeFilter:a.removeNodeFilter,removeAttributeFilter:a.removeAttributeFilter}},VC=(e,t)=>{const o=zC(e,t);return{schema:o.schema,addNodeFilter:o.addNodeFilter,addAttributeFilter:o.addAttributeFilter,serialize:o.serialize,addRules:o.addRules,setRules:o.setRules,addTempAttr:o.addTempAttr,getTempAttrs:o.getTempAttrs,getNodeFilters:o.getNodeFilters,getAttributeFilters:o.getAttributeFilters,removeNodeFilter:o.removeNodeFilter,removeAttributeFilter:o.removeAttributeFilter}},ZC=(e,t={})=>{const o=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return zx(e,o).fold(A,(t=>{const o=((e,t)=>_C(e).editor.getContent(t))(e,t);return Vx(e,o,t)}))},UC=(e,t,o={})=>{const n=((e,t)=>({format:"html",...e,set:!0,content:t}))(o,t);return Zx(e,n).map((t=>{const o=((e,t,o)=>_C(e).editor.setContent(t,o))(e,t.content,t);return Ux(e,o.html,t),o.content})).getOr(t)},jC="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists,template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),WC=[],$C="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,template,textcolor,rtc".split(","),qC=[],GC=(e,t)=>{const o=Y(t,(t=>Ee(e,t)));return le(o)},KC=e=>{const t=GC(e,jC),o=e.forced_root_block;return!1!==o&&""!==o||t.push("forced_root_block (false only)"),le(t)},YC=e=>GC(e,WC),XC=(e,t)=>{const o=Lt.makeMap(e.plugins," "),n=Y(t,(e=>Ee(o,e)));return le(n)},JC=e=>XC(e,$C),QC=e=>XC(e,qC.map((e=>e.name))),eS=e=>ee(qC,(t=>t.name===e)).fold((()=>e),(t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e)),tS=(e,t)=>{((e,t)=>{const o=KC(e),n=JC(t),r=n.length>0,s=o.length>0,a="mobile"===t.theme;if(r||s||a){const e="\n- ",t=a?`\n\nThemes:${e}mobile`:"",i=r?`\n\nPlugins:${e}${n.join(e)}`:"",l=s?`\n\nOptions:${e}${o.join(e)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 7.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/7/migration-from-6x/ for more information."+t+i+l)}})(e,t),((e,t)=>{const o=YC(e),n=QC(t),r=n.length>0,s=o.length>0;if(r||s){const e="\n- ",t=r?`\n\nPlugins:${e}${n.map(eS).join(e)}`:"",a=s?`\n\nOptions:${e}${o.join(e)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+t+a)}})(e,t)},oS=ba.DOM,nS=e=>F.from(e).each((e=>e.destroy())),rS=e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:o}=e,n=e.getBody(),r=e.getElement();n&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&C(null==r?void 0:r.nextSibling)&&oS.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&n&&(e=>{oS.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),oS.remove(e.getContainer()),nS(t),nS(o),e.destroy()}},sS=(e,t)=>{const{selection:o,dom:n}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),nS(o),nS(n)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),oS.unbind(t,"submit reset",e.formEventDelegate))})(e),(e=>{const t=e;t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null;const o=e.selection;if(o){const e=o.dom;t.selection=o.win=o.dom=e.doc=null}})(e),e.destroyed=!0):e.remove())},aS=(()=>{const e={};return{add:(t,o)=>{e[t]=o},get:t=>e[t]?e[t]:{icons:{}},has:t=>Ee(e,t)}})(),iS=Ea.ModelManager,lS=(e,t)=>t.dom[e],cS=(e,t)=>parseInt(mn(t,e),10),dS=N(lS,"clientWidth"),mS=N(lS,"clientHeight"),uS=N(cS,"margin-top"),gS=N(cS,"margin-left"),hS=(e,t,o)=>{const n=wo.fromDom(e.getBody()),r=e.inline?n:(s=n,wo.fromDom(To(s).dom.documentElement));var s;const a=((e,t,o,n)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:o-(e?r.left+t.dom.clientLeft+gS(t):0),y:n-(e?r.top+t.dom.clientTop+uS(t):0)}})(e.inline,r,t,o);return((e,t,o)=>{const n=dS(e),r=mS(e);return t>=0&&o>=0&&t<=n&&o<=r})(r,a.x,a.y)},pS=e=>{const t=e.inline?e.getBody():e.getContentAreaContainer();return(o=t,F.from(o).map(wo.fromDom)).map(Ko).getOr(!1);var o},fS=e=>{const t=[],o=()=>{const t=e.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}})()},n=()=>F.from(t[0]),r=()=>{q(t,(e=>{e.reposition()}))},s=e=>{te(t,(t=>t===e)).each((e=>{t.splice(e,1)}))},a=(a,i=!0)=>e.removed||!pS(e)?{}:(i&&e.dispatch("BeforeOpenNotification",{notification:a}),ee(t,(e=>{return t=o().getArgs(e),n=a,!(t.type!==n.type||t.text!==n.text||t.progressBar||t.timeout||n.progressBar||n.timeout);var t,n})).getOrThunk((()=>{e.editorManager.setActive(e);const i=o().open(a,(()=>{s(i),r(),yp(e)&&n().fold((()=>e.focus()),(e=>$h(wo.fromDom(e.getEl()))))}));return(e=>{t.push(e)})(i),r(),e.dispatch("OpenNotification",{notification:{...i}}),i}))),i=D(t);return(e=>{e.on("SkinLoaded",(()=>{const t=Hc(e);t&&a({text:t,type:"warning",timeout:0},!1),r()})),e.on("show ResizeEditor ResizeWindow NodeChange",(()=>{requestAnimationFrame(r)})),e.on("remove",(()=>{q(t.slice(),(e=>{o().close(e)}))}))})(e),{open:a,close:()=>{n().each((e=>{o().close(e),s(e),r()}))},getNotifications:i}},vS=Ea.PluginManager,bS=Ea.ThemeManager,yS=e=>{let t=[];const o=()=>{const t=e.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e}})()},n=(e,t)=>(...o)=>t?t.apply(e,o):void 0,r=o=>{t.push(o),(t=>{e.dispatch("OpenWindow",{dialog:t})})(o)},s=o=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(o),t=Y(t,(e=>e!==o)),0===t.length&&e.focus()},a=t=>{e.editorManager.setActive(e),op(e),e.ui.show();const o=t();return r(o),o};return e.on("remove",(()=>{q(t,(e=>{o().close(e)}))})),{open:(e,t)=>a((()=>o().open(e,t,s))),openUrl:e=>a((()=>o().openUrl(e,s))),alert:(e,t,r)=>{const s=o();s.alert(e,n(r||s,t))},confirm:(e,t,r)=>{const s=o();s.confirm(e,n(r||s,t))},close:()=>{F.from(t[t.length-1]).each((e=>{o().close(e),s(e)}))}}},wS=(e,t)=>{e.notificationManager.open({type:"error",text:t})},xS=(e,t)=>{e._skinLoaded?wS(e,t):e.on("SkinLoaded",(()=>{wS(e,t)}))},CS=(e,t,o)=>{Bg(e,t,{message:o}),console.error(o)},SS=(e,t,o)=>o?`Failed to load ${e}: ${o} from url ${t}`:`Failed to load ${e} url: ${t}`,kS=(e,...t)=>{const o=window.console;o&&(o.error?o.error(e,...t):o.log(e,...t))},_S=e=>"content/"+e+"/content.css",ES=(e,t)=>{const o=e.editorManager.baseURL+"/skins/content",n=`content${e.editorManager.suffix}.css`;return $(t,(t=>(e=>tinymce.Resource.has(_S(e)))(t)?t:(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!e.inline?`${o}/${t}/${n}`:e.documentBaseURI.toAbsolute(t)))},TS=e=>{e.contentCSS=e.contentCSS.concat((e=>ES(e,Tc(e)))(e),(e=>ES(e,Dc(e)))(e))},OS=(e,t)=>{const o={};return{findAll:(n,r=P)=>{const s=Y((e=>e?ue(e.getElementsByTagName("img")):[])(n),(t=>{const o=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!o||o===Mt.transparentSrc)&&(We(o,"blob:")?!e.isUploaded(o)&&r(t):!!We(o,"data:")&&r(t))})),a=$(s,(e=>{const n=e.src;if(Ee(o,n))return o[n].then((t=>h(t)?t:{image:e,blobInfo:t.blobInfo}));{const r=((e,t)=>{const o=()=>Promise.reject("Invalid data URI");if(We(t,"blob:")){const n=e.getByUri(t);return C(n)?Promise.resolve(n):lw(t).then((t=>cw(t).then((n=>mw(n,!1,(o=>F.some(uw(e,t,o)))).getOrThunk(o)))))}return We(t,"data:")?gw(e,t).fold(o,(e=>Promise.resolve(e))):Promise.reject("Unknown image data format")})(t,n).then((t=>(delete o[n],{image:e,blobInfo:t}))).catch((e=>(delete o[n],e)));return o[n]=r,r}}));return Promise.all(a)}}},DS=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),o=t=>t in e;return{hasBlobUri:o,getResultUri:t=>{const o=e[t];return o?o.resultUri:null},isPending:t=>!!o(t)&&1===e[t].status,isUploaded:t=>!!o(t)&&2===e[t].status,markPending:o=>{e[o]=t(1,null)},markUploaded:(o,n)=>{e[o]=t(2,n)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let AS=0;const MS=e=>e+AS+++(()=>{const e=()=>Math.round(4294967295*Math.random()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),NS=(e,t)=>{const o={},n=(e,o)=>new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("POST",t.url),s.withCredentials=t.credentials,s.upload.onprogress=e=>{o(e.loaded/e.total*100)},s.onerror=()=>{r("Image upload failed due to a XHR Transport error. Code: "+s.status)},s.onload=()=>{if(s.status<200||s.status>=300)return void r("HTTP Error: "+s.status);const e=JSON.parse(s.responseText);var o,a;e&&h(e.location)?n((o=t.basePath,a=e.location,o?o.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+s.responseText)};const a=new FormData;a.append("file",e.blob(),e.filename()),s.send(a)})),r=S(t.handler)?t.handler:n,s=(e,t)=>({url:t,blobInfo:e,status:!0}),a=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),i=(e,t)=>{Lt.each(o[e],(e=>{e(t)})),delete o[e]},l=(t,n)=>(t=Lt.grep(t,(t=>!e.isUploaded(t.blobUri()))),Promise.all(Lt.map(t,(t=>e.isPending(t.blobUri())?(e=>{const t=e.blobUri();return new Promise((e=>{o[t]=o[t]||[],o[t].push(e)}))})(t):((t,o,n)=>(e.markPending(t.blobUri()),new Promise((r=>{let l,c;try{const d=()=>{l&&(l.close(),c=E)},m=o=>{d(),e.markUploaded(t.blobUri(),o),i(t.blobUri(),s(t,o)),r(s(t,o))},u=o=>{d(),e.removeFailed(t.blobUri()),i(t.blobUri(),a(t,o)),r(a(t,o))};c=e=>{e<0||e>100||F.from(l).orThunk((()=>F.from(n).map(L))).each((t=>{l=t,t.progressBar.value(e)}))},o(t,c).then(m,(e=>{u(h(e)?{message:e}:e)}))}catch(e){r(a(t,e))}}))))(t,r,n)))));return{upload:(e,o)=>t.url||r!==n?l(e,o):new Promise((e=>{e([])}))}},RS=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),BS=(e,t)=>NS(t,{url:vc(e),basePath:bc(e),credentials:yc(e),handler:wc(e)}),LS=e=>t=>{((e,t)=>e.dom.isEmpty(t.dom)&&C(e.schema.getTextBlockElements()[Wt(t)]))(e,t)&&yn(t,wo.fromHtml('
    '))},HS=e=>{const t=(()=>{let e=[];const t=e=>{if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const t=e.id||MS("blobid"),o=e.name||t,n=e.blob;return{id:D(t),name:D(o),filename:D(e.filename||o+"."+(r=n.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[r.toLowerCase()]||"dat")),blob:D(n),base64:D(e.base64),blobUri:D(e.blobUri||URL.createObjectURL(n)),uri:D(e.uri)};var r},o=t=>ee(e,t).getOrUndefined(),n=e=>o((t=>t.id()===e));return{create:(e,o,n,r,s)=>{if(h(e))return t({id:e,name:r,filename:s,blob:o,base64:n});if(p(e))return t(e);throw new Error("Unknown input type")},add:t=>{n(t.id())||e.push(t)},get:n,getByUri:e=>o((t=>t.blobUri()===e)),getByData:(e,t)=>o((o=>o.base64()===e&&o.blob().type===t)),findFirst:o,removeByUri:t=>{e=Y(e,(e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1)))},destroy:()=>{q(e,(e=>{URL.revokeObjectURL(e.blobUri())})),e=[]}}})();let o,n;const r=DS(),s=[],a=t=>o=>e.selection?t(o):[],i=(e,t,o)=>{let n=0;do{n=e.indexOf(t,n),-1!==n&&(e=e.substring(0,n)+o+e.substr(n+t.length),n+=o.length-t.length+1)}while(-1!==n);return e},l=(e,t,o)=>{const n=`src="${o}"${o===Mt.transparentSrc?' data-mce-placeholder="1"':""}`;return e=i(e,`src="${t}"`,n),e=i(e,'data-mce-src="'+t+'"','data-mce-src="'+o+'"')},c=(t,o)=>{q(e.undoManager.data,(e=>{"fragmented"===e.type?e.fragments=$(e.fragments,(e=>l(e,t,o))):e.content=l(e.content,t,o)}))},d=()=>(o||(o=BS(e,r)),g().then(a((n=>{const r=$(n,(e=>e.blobInfo));return o.upload(r,RS(e)).then(a((o=>{const r=[];let s=!1;const a=$(o,((o,a)=>{const{blobInfo:i,image:l}=n[a];let d=!1;return o.status&&hc(e)?(o.url&&!je(l.src,o.url)&&(s=!0),t.removeByUri(l.src),SC(e)||((t,o)=>{const n=e.convertURL(o,"src");var r;c(t.src,o),oo(wo.fromDom(t),{src:gc(e)?(r=o,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):o,"data-mce-src":n})})(l,o.url)):o.error&&(o.error.remove&&(c(l.src,Mt.transparentSrc),r.push(l),d=!0),((e,t)=>{xS(e,_a.translate(["Failed to upload image: {0}",t]))})(e,o.error.message)),{element:l,status:o.status,uploadUri:o.url,blobInfo:i,removed:d}}));return r.length>0&&!SC(e)?e.undoManager.transact((()=>{q(_n(r),(o=>{const n=Do(o);Sn(o),n.each(LS(e)),t.removeByUri(o.dom.src)}))})):s&&e.undoManager.dispatchChange(),a})))})))),m=()=>uc(e)?d():Promise.resolve([]),u=e=>re(s,(t=>t(e))),g=()=>(n||(n=OS(r,t)),n.findAll(e.getBody(),u).then(a((t=>{const o=Y(t,(t=>h(t)?(xS(e,t),!1):"blob"!==t.uriType));return SC(e)||q(o,(e=>{c(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")})),o})))),f=o=>o.replace(/src="(blob:[^"]+)"/g,((o,n)=>{const s=r.getResultUri(n);if(s)return'src="'+s+'"';let a=t.getByUri(n);return a||(a=J(e.editorManager.get(),((e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(n)),void 0)),a?'src="data:'+a.blob().type+";base64,"+a.base64()+'"':o}));return e.on("SetContent",(()=>{uc(e)?m():g()})),e.on("RawSaveContent",(e=>{e.content=f(e.content)})),e.on("GetContent",(e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=f(e.content))})),e.on("PostRender",(()=>{e.parser.addNodeFilter("img",(e=>{q(e,(e=>{const o=e.attr("src");if(!o||t.getByUri(o))return;const n=r.getResultUri(o);n&&e.attr("src",n)}))}))})),{blobCache:t,addFilter:e=>{s.push(e)},uploadImages:d,uploadImagesAuto:m,scanForImages:g,destroy:()=>{t.destroy(),r.destroy(),n=o=null}}},IS={remove_similar:!0,inherit:!1},PS={selector:"td,th",...IS},FS={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...PS},tablecellverticalalign:{styles:{"vertical-align":"%value"},...PS},tablecellbordercolor:{styles:{borderColor:"%value"},...PS},tablecellclass:{classes:["%value"],...PS},tableclass:{selector:"table",classes:["%value"],...IS},tablecellborderstyle:{styles:{borderStyle:"%value"},...PS},tablecellborderwidth:{styles:{borderWidth:"%value"},...PS}},zS=D(FS),VS=e=>{const t={},o=(e,n)=>{e&&(h(e)?(v(n)||(n=[n]),q(n,(e=>{w(e.deep)&&(e.deep=!ng(e)),w(e.split)&&(e.split=!ng(e)||rg(e)),w(e.remove)&&ng(e)&&!rg(e)&&(e.remove="none"),ng(e)&&rg(e)&&(e.mixed=!0,e.block_expand=!0),h(e.classes)&&(e.classes=e.classes.split(/\s+/))})),t[e]=n):ve(e,((e,t)=>{o(t,e)})))};return o((e=>{const t=e.dom,o=e.schema.type,n={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"},{selector:".mce-preview-object",ceFalseOverride:!0,styles:{display:"table",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{marginLeft:"auto",marginRight:"auto"},preview:!1}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"right"},preview:!1}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const e={inline:"span",styles:{textDecoration:"line-through"},exact:!0},t={inline:"strike",remove:"all",preserve_attributes:["class","style"]},n={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==o?[n,e,t]:[e,n,t]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(e,t,o)=>tr(e)&&e.hasAttribute("href"),onformat:(e,o,n)=>{Lt.each(n,((o,n)=>{t.setAttrib(e,n,o)}))}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":e=>{var t;return null!==(t=null==e?void 0:e.customValue)&&void 0!==t?t:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Lt.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/),(e=>{n[e]={block:e,remove:"all"}})),n})(e)),o(zS()),o(Zc(e)),{get:e=>C(e)?t[e]:t,has:e=>Ee(t,e),register:o,unregister:e=>(e&&t[e]&&delete t[e],t)}},ZS=Lt.each,US=ba.DOM,jS=e=>C(e)&&p(e),WS=(e,t)=>{const o=t&&t.schema||Vs({}),n=e=>{const t=h(e)?{name:e,classes:[],attrs:{}}:e,o=US.create(t.name);return((e,t)=>{t.classes.length>0&&US.addClass(e,t.classes.join(" ")),US.setAttribs(e,t.attrs)})(o,t),o},r=(e,t,s)=>{let a;const i=t[0],l=jS(i)?i.name:void 0,c=((e,t)=>{const n=o.getElementRule(e.nodeName.toLowerCase()),r=null==n?void 0:n.parentsRequired;return!(!r||!r.length)&&(t&&j(r,t)?t:r[0])})(e,l);if(c)l===c?(a=i,t=t.slice(1)):a=c;else if(i)a=i,t=t.slice(1);else if(!s)return e;const d=a?n(a):US.create("div");d.appendChild(e),s&&Lt.each(s,(t=>{const o=n(t);d.insertBefore(o,e)}));const m=jS(a)?a.siblings:void 0;return r(d,t,m)},s=US.create("div");if(e.length>0){const t=e[0],o=n(t),a=jS(t)?t.siblings:void 0;s.appendChild(r(o,e.slice(1),a))}return s},$S=e=>{let t="div";const o={name:t,classes:[],attrs:{},selector:e=Lt.trim(e)};return"*"!==e&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,((e,t,n,r,s)=>{switch(t){case"#":o.attrs.id=n;break;case".":o.classes.push(n);break;case":":-1!==Lt.inArray("checked disabled enabled read-only required".split(" "),n)&&(o.attrs[n]=n)}if("["===r){const e=s.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(o.attrs[e[1]]=e[2])}return""}))),o.name=t||"div",o},qS=(e,t)=>{let o="",n=Uc(e);if(""===n)return"";const r=e=>h(e)?e.replace(/%(\w+)/g,""):"",s=(t,o)=>US.getStyle(null!=o?o:e.getBody(),t,!0);if(h(t)){const o=e.formatter.get(t);if(!o)return"";t=o[0]}if("preview"in t){const e=t.preview;if(!1===e)return"";n=e||n}let a,i=t.block||t.inline||"span";const l=(c=t.selector,h(c)?(c=(c=c.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Lt.map(c.split(/(?:>|\s+(?![^\[\]]+\]))/),(e=>{const t=Lt.map(e.split(/(?:~\+|~|\+)/),$S),o=t.pop();return t.length&&(o.siblings=t),o})).reverse()):[]);var c;l.length>0?(l[0].name||(l[0].name=i),i=t.selector,a=WS(l,e)):a=WS([i],e);const d=US.select(i,a)[0]||a.firstChild;ZS(t.styles,((e,t)=>{const o=r(e);o&&US.setStyle(d,t,o)})),ZS(t.attributes,((e,t)=>{const o=r(e);o&&US.setAttrib(d,t,o)})),ZS(t.classes,(e=>{const t=r(e);US.hasClass(d,t)||US.addClass(d,t)})),e.dispatch("PreviewFormats"),US.setStyles(a,{position:"absolute",left:-65535}),e.getBody().appendChild(a);const m=s("fontSize"),u=/px$/.test(m)?parseInt(m,10):0;return ZS(n.split(" "),(e=>{let t=s(e,d);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=s(e),"#ffffff"===Xs(t).toLowerCase())||"color"===e&&"#000000"===Xs(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===u)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*u+"px"}"border"===e&&t&&(o+="padding:0 2px;"),o+=e+":"+t+";"}})),e.dispatch("AfterPreviewFormats"),US.remove(a),o},GS=e=>{const t=VS(e),o=xa({});return(e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])})(e),ry(e),SC(e)||((e,t)=>{e.set({}),t.on("NodeChange",(o=>{ew(t,o.element,e.get())})),t.on("FormatApply FormatRemove",(o=>{const n=F.from(o.node).map((e=>Fu(e)?e:e.startContainer)).bind((e=>tr(e)?F.some(e):F.from(e.parentElement))).getOrThunk((()=>Xy(t)));ew(t,n,e.get())}))})(o,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,o,n)=>{((e,t,o,n)=>{EC(e).formatter.apply(t,o,n)})(e,t,o,n)},remove:(t,o,n,r)=>{((e,t,o,n,r)=>{EC(e).formatter.remove(t,o,n,r)})(e,t,o,n,r)},toggle:(t,o,n)=>{((e,t,o,n)=>{EC(e).formatter.toggle(t,o,n)})(e,t,o,n)},match:(t,o,n,r)=>((e,t,o,n,r)=>EC(e).formatter.match(t,o,n,r))(e,t,o,n,r),closest:t=>((e,t)=>EC(e).formatter.closest(t))(e,t),matchAll:(t,o)=>((e,t,o)=>EC(e).formatter.matchAll(t,o))(e,t,o),matchNode:(t,o,n,r)=>((e,t,o,n,r)=>EC(e).formatter.matchNode(t,o,n,r))(e,t,o,n,r),canApply:t=>((e,t)=>EC(e).formatter.canApply(t))(e,t),formatChanged:(t,n,r,s)=>((e,t,o,n,r,s)=>EC(e).formatter.formatChanged(t,o,n,r,s))(e,o,t,n,r,s),getCssText:N(qS,e)}},KS=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},YS=e=>{const t=Oa(),o=xa(0),n=xa(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,o)=>{EC(e).undoManager.beforeChange(t,o)})(e,o,t)},add:(s,a)=>((e,t,o,n,r,s,a)=>EC(e).undoManager.add(t,o,n,r,s,a))(e,r,n,o,t,s,a),dispatchChange:()=>{e.setDirty(!0);const t=hC(e);t.bookmark=Rl(e.selection),e.dispatch("change",{level:t,lastLevel:ce(r.data,n.get()).getOrUndefined()})},undo:()=>((e,t,o,n)=>EC(e).undoManager.undo(t,o,n))(e,r,o,n),redo:()=>((e,t,o)=>EC(e).undoManager.redo(t,o))(e,n,r.data),clear:()=>{((e,t,o)=>{EC(e).undoManager.clear(t,o)})(e,r,n)},reset:()=>{((e,t)=>{EC(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,o)=>EC(e).undoManager.hasUndo(t,o))(e,r,n),hasRedo:()=>((e,t,o)=>EC(e).undoManager.hasRedo(t,o))(e,r,n),transact:t=>((e,t,o,n)=>EC(e).undoManager.transact(t,o,n))(e,r,o,t),ignore:t=>{((e,t,o)=>{EC(e).undoManager.ignore(t,o)})(e,o,t)},extra:(t,o)=>{((e,t,o,n,r)=>{EC(e).undoManager.extra(t,o,n,r)})(e,r,n,t,o)}};return SC(e)||((e,t,o)=>{const n=xa(!1),r=e=>{wC(t,!1,o),t.add({},e)};e.on("init",(()=>{t.add()})),e.on("BeforeExecCommand",(e=>{const n=e.command;KS(n)||(xC(t,o),t.beforeChange())})),e.on("ExecCommand",(e=>{const t=e.command;KS(t)||r(e)})),e.on("ObjectResizeStart cut",(()=>{t.beforeChange()})),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",(o=>{const s=o.keyCode;if(o.isDefaultPrevented())return;const a=Mt.os.isMacOS()&&"Meta"===o.key;(s>=33&&s<=36||s>=37&&s<=40||45===s||o.ctrlKey||a)&&(r(),e.nodeChanged()),46!==s&&8!==s||e.nodeChanged(),n.get()&&t.typing&&!bC(hC(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),n.set(!1),e.nodeChanged())})),e.on("keydown",(e=>{const s=e.keyCode;if(e.isDefaultPrevented())return;if(s>=33&&s<=36||s>=37&&s<=40||45===s)return void(t.typing&&r(e));const a=e.ctrlKey&&!e.altKey||e.metaKey;if((s<16||s>20)&&224!==s&&91!==s&&!t.typing&&!a)return t.beforeChange(),wC(t,!0,o),t.add({},e),void n.set(!0);(Mt.os.isMacOS()?e.metaKey:e.ctrlKey&&!e.altKey)&&t.beforeChange()})),e.on("mousedown",(e=>{t.typing&&r(e)})),e.on("input",(e=>{var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data||(e=>"insertFromPaste"===e.inputType||"insertFromDrop"===e.inputType)(e))&&r(e)})),e.on("AddUndo Undo Redo ClearUndos",(t=>{t.isDefaultPrevented()||e.nodeChanged()}))})(e,r,o),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},XS=[9,27,Vg.HOME,Vg.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Vg.DOWN,Vg.UP,Vg.LEFT,Vg.RIGHT].concat(Mt.browser.isFirefox()?[224]:[]),JS="data-mce-placeholder",QS=e=>"keydown"===e.type||"keyup"===e.type,ek=e=>{const t=e.keyCode;return t===Vg.BACKSPACE||t===Vg.DELETE},tk=e=>{var t;const o=e.dom,n=sc(e),r=null!==(t=Bc(e))&&void 0!==t?t:"",s=(t,a)=>{if((e=>{if(QS(e)){const t=e.keyCode;return!ek(e)&&(Vg.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||j(XS,t))}return!1})(t))return;const i=e.getBody(),l=!(e=>QS(e)&&!(ek(e)||"keyup"===e.type&&229===e.keyCode))(t)&&((e,t,o)=>{if(e.isEmpty(t,void 0,{skipBogus:!1,includeZwsp:!0})){const n=t.firstElementChild;return!n||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&o===n.nodeName.toLowerCase()}return!1})(o,i,n);(""!==o.getAttrib(i,JS)!==l||a)&&(o.setAttrib(i,JS,l?r:null),((e,t)=>{e.dispatch("PlaceholderToggle",{state:t})})(e,l),e.on(l?"keydown":"keyup",s),e.off(l?"keyup":"keydown",s))};Xe(r)&&e.on("init",(t=>{s(t,!0),e.on("change SetContent ExecCommand",s),e.on("paste",(t=>sp.setEditorTimeout(e,(()=>s(t)))))}))},ok=(e,t)=>({from:e,to:t}),nk=(e,t)=>{const o=wo.fromDom(e),n=wo.fromDom(t.container());return Sv(o,n).map((e=>((e,t)=>({block:e,position:t}))(e,t)))},rk=(e,t)=>Jo(t,(e=>si(e)||br(e.dom)),(t=>ko(t,e))).filter(Kt).getOr(e),sk=(e,t,o,n)=>{const r=nk(t,ml.fromRangeStart(n)),s=r.bind((n=>Qm(o,t,n.position).bind((n=>nk(t,n).map((n=>((e,t,o,n)=>fr(n.position.getNode())&&!Rr(e,n.block)?ou(!1,n.block.dom).bind((e=>e.isEqual(n.position)?Qm(o,t,e).bind((e=>nk(t,e))):F.some(n))).getOr(n):n)(e,t,o,n)))))));return Pt(r,s,ok).filter((e=>(e=>!ko(e.from.block,e.to.block))(e)&&((e,t)=>{const o=wo.fromDom(e);return ko(rk(o,t.from.block),rk(o,t.to.block))})(t,e)&&(e=>!1===yr(e.from.block.dom)&&!1===yr(e.to.block.dom))(e)&&(e=>{const t=e=>ti(e)||qr(e.dom);return t(e.from.block)&&t(e.to.block)})(e)))},ak=(e,t)=>{const o=((e,t)=>{const o=Ho(e);return te(o,(e=>t.isBlock(Wt(e)))).fold(D(o),(e=>o.slice(0,e)))})(e,t);return q(o,Sn),o},ik=(e,t,o)=>{const n=xf(o,t);return ee(n.reverse(),(t=>Rr(e,t))).each(Sn)},lk=(e,t,o,n,r)=>{if(Rr(n,o))return ci(o),su(o.dom);((e,t)=>0===Y(Bo(t),(t=>!Rr(e,t))).length)(n,r)&&Rr(n,t)&&fn(r,wo.fromTag("br"));const s=ru(o.dom,ml.before(r.dom));return q(ak(t,n),(e=>{fn(r,e)})),ik(n,e,t),s},ck=(e,t,o,n)=>{if(Rr(n,o)){if(Rr(n,t)){const e=e=>{const t=(e,o)=>Po(e).fold((()=>o),(e=>((e,t)=>e.isInline(Wt(t)))(n,e)?t(e,o.concat($a(e))):o));return t(e,[])},r=X(e(o),((e,t)=>(wn(e,t),t)),li());Cn(t),yn(t,r)}return Sn(o),su(t.dom)}const r=au(o.dom);return q(ak(t,n),(e=>{yn(o,e)})),ik(n,e,t),r},dk=(e,t)=>_o(t,e)?((e,t)=>{const o=xf(t,e);return F.from(o[o.length-1])})(t,e):F.none(),mk=(e,t)=>{ou(e,t.dom).bind((e=>F.from(e.getNode()))).map(wo.fromDom).filter(ei).each(Sn)},uk=(e,t,o,n)=>(mk(!0,t),mk(!1,o),dk(t,o).fold(N(ck,e,t,o,n),N(lk,e,t,o,n))),gk=(e,t,o,n,r)=>t?uk(e,n,o,r):uk(e,o,n,r),hk=(e,t)=>{const o=wo.fromDom(e.getBody()),n=((e,t,o,n)=>n.collapsed?sk(e,t,o,n):F.none())(e.schema,o.dom,t,e.selection.getRng()).map((n=>()=>{gk(o,t,n.from.block,n.to.block,e.schema).each((t=>{e.selection.setRng(t.toRange())}))}));return n},pk=(e,t)=>{const o=wo.fromDom(t),n=N(ko,e);return Xo(o,si,n).isSome()},fk=(e,t)=>{const o=ru(e.dom,ml.fromRangeStart(t)).isNone(),n=nu(e.dom,ml.fromRangeEnd(t)).isNone();return!((e,t)=>pk(e,t.startContainer)||pk(e,t.endContainer))(e,t)&&o&&n},vk=e=>{const t=wo.fromDom(e.getBody()),o=e.selection.getRng();return fk(t,o)?(e=>F.some((()=>{e.setContent(""),e.selection.setCursorLocation()})))(e):((e,t,o)=>{const n=t.getRng();return Pt(Sv(e,wo.fromDom(n.startContainer)),Sv(e,wo.fromDom(n.endContainer)),((r,s)=>ko(r,s)?F.none():F.some((()=>{n.deleteContents(),gk(e,!0,r,s,o).each((e=>{t.setRng(e.toRange())}))})))).getOr(F.none())})(t,e.selection,e.schema)},bk=(e,t)=>e.selection.isCollapsed()?F.none():vk(e),yk=(e,t,o,n,r)=>F.from(t._selectionOverrides.showCaret(e,o,n,r)),wk=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?F.none():F.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),xk=(e,t,o)=>t.collapsed?((e,t,o)=>{const n=Mm(1,e.getBody(),t),r=ml.fromRangeStart(n),s=r.getNode();if(lm(s))return yk(1,e,s,!r.isAtEnd(),!1);const a=r.getNode(!0);if(lm(a))return yk(1,e,a,!1,!1);const i=sb(e.dom.getRoot(),r.getNode());return lm(i)?yk(1,e,i,!1,o):F.none()})(e,t,o).getOr(t):t,Ck=e=>bf(e)||hf(e),Sk=e=>yf(e)||pf(e),kk=(e,t,o,n,r,s)=>{yk(n,e,s.getNode(!r),r,!0).each((o=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(o.startContainer,o.startOffset):e.setStart(o.endContainer,o.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(o)})),((e,t)=>{dr(t)&&0===t.data.length&&e.remove(t)})(e.dom,o)},_k=(e,t)=>((e,t)=>{const o=e.selection.getRng();if(!dr(o.commonAncestorContainer))return F.none();const n=t?Im.Forwards:Im.Backwards,r=Gm(e.getBody()),s=N(Lm,t?r.next:r.prev),a=t?Ck:Sk,i=Rm(n,e.getBody(),o),l=s(i),c=l?vv(t,l):l;if(!c||!Hm(i,c))return F.none();if(a(c))return F.some((()=>kk(e,o,i.getNode(),n,t,c)));const d=s(c);return d&&a(d)&&Hm(c,d)?F.some((()=>kk(e,o,i.getNode(),n,t,d))):F.none()})(e,t),Ek=(e,t)=>{const o=e.getBody();return t?su(o).filter(bf):au(o).filter(yf)},Tk=e=>{const t=e.selection.getRng();return!t.collapsed&&(Ek(e,!0).exists((e=>e.isEqual(ml.fromRangeStart(t))))||Ek(e,!1).exists((e=>e.isEqual(ml.fromRangeEnd(t)))))},Ok=Il([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),Dk=(e,t,o,n,r)=>{const s=r.getNode(!o);return Sv(wo.fromDom(t),wo.fromDom(n.getNode())).map((t=>Rr(e,t)?Ok.remove(t.dom):Ok.moveToElement(s))).orThunk((()=>F.some(Ok.moveToElement(s))))},Ak=(e,t,o,n)=>Qm(t,e,o).bind((r=>{return s=r.getNode(),C(s)&&(si(wo.fromDom(s))||ni(wo.fromDom(s)))||((e,t,o,n,r)=>{const s=t=>r.isInline(t.nodeName.toLowerCase())&&!km(o,n,e);return Nm(!t,o).fold((()=>Nm(t,n).fold(I,s)),s)})(e,t,o,r,n)?F.none():t&&yr(r.getNode())||!t&&yr(r.getNode(!0))?Dk(n,e,t,o,r):t&&yf(o)||!t&&bf(o)?F.some(Ok.moveToPosition(r)):F.none();var s})),Mk=(e,t,o,n)=>((e,t)=>{const o=t.getNode(!e),n=e?"after":"before";return tr(o)&&o.getAttribute("data-mce-caret")===n})(t,o)?((e,t)=>x(t)?F.none():e&&yr(t.nextSibling)?F.some(Ok.moveToElement(t.nextSibling)):!e&&yr(t.previousSibling)?F.some(Ok.moveToElement(t.previousSibling)):F.none())(t,o.getNode(!t)).orThunk((()=>Ak(e,t,o,n))):Ak(e,t,o,n).bind((t=>((e,t,o)=>o.fold((e=>F.some(Ok.remove(e))),(e=>F.some(Ok.moveToElement(e))),(o=>km(t,o,e)?F.none():F.some(Ok.moveToPosition(o)))))(e,o,t))),Nk=(e,t)=>F.from(sb(e.getBody(),t)),Rk=(e,t)=>{const o=e.selection.getNode();return Nk(e,o).filter(yr).fold((()=>((e,t,o,n)=>{const r=Mm(t?1:-1,e,o),s=ml.fromRangeStart(r),a=wo.fromDom(e);return!t&&yf(s)?F.some(Ok.remove(s.getNode(!0))):t&&bf(s)?F.some(Ok.remove(s.getNode())):!t&&bf(s)&&Rf(a,s,n)?Bf(a,s,n).map((e=>Ok.remove(e.getNode()))):t&&yf(s)&&Nf(a,s,n)?Lf(a,s,n).map((e=>Ok.remove(e.getNode()))):Mk(e,t,s,n)})(e.getBody(),t,e.selection.getRng(),e.schema).map((o=>()=>o.fold(((e,t)=>o=>(e._selectionOverrides.hideFakeCaret(),uv(e,t,wo.fromDom(o)),!0))(e,t),((e,t)=>o=>{const n=t?ml.before(o):ml.after(o);return e.selection.setRng(n.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))))),(()=>F.some(E)))},Bk=(e,t)=>{const o=e.selection.getNode();return yr(o)&&!wr(o)?Nk(e,o.parentNode).filter(yr).fold((()=>F.some((()=>{var o;o=wo.fromDom(e.getBody()),q(Vn(o,".mce-offscreen-selection"),Sn),uv(e,t,wo.fromDom(e.selection.getNode())),kv(e)}))),(()=>F.some(E))):Tk(e)?F.some((()=>{Tv(e,e.selection.getRng(),wo.fromDom(e.getBody()))})):F.none()},Lk=e=>{const t=e.dom,o=e.selection,n=sb(e.getBody(),o.getNode());if(br(n)&&t.isBlock(n)&&t.isEmpty(n)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(n,""),n.appendChild(e),o.setRng(ml.before(e).toRange())}return!0},Hk=(e,t)=>e.selection.isCollapsed()?Rk(e,t):Bk(e,t),Ik=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const o=ml.fromRangeStart(e.selection.getRng());return Qm(t,e.getBody(),o).filter((e=>t?uf(e):gf(e))).bind((e=>_m(t?0:-1,e))).map((t=>()=>e.selection.select(t)))})(e,t):F.none(),Pk=dr,Fk=e=>Pk(e)&&e.data[0]===di,zk=e=>Pk(e)&&e.data[e.data.length-1]===di,Vk=e=>{var t;return(null!==(t=e.ownerDocument)&&void 0!==t?t:document).createTextNode(di)},Zk=(e,t)=>e?(e=>{var t;if(Pk(e.previousSibling))return zk(e.previousSibling)||e.previousSibling.appendData(di),e.previousSibling;if(Pk(e))return Fk(e)||e.insertData(0,di),e;{const o=Vk(e);return null===(t=e.parentNode)||void 0===t||t.insertBefore(o,e),o}})(t):(e=>{var t,o;if(Pk(e.nextSibling))return Fk(e.nextSibling)||e.nextSibling.insertData(0,di),e.nextSibling;if(Pk(e))return zk(e)||e.appendData(di),e;{const n=Vk(e);return e.nextSibling?null===(t=e.parentNode)||void 0===t||t.insertBefore(n,e.nextSibling):null===(o=e.parentNode)||void 0===o||o.appendChild(n),n}})(t),Uk=N(Zk,!0),jk=N(Zk,!1),Wk=(e,t)=>dr(e.container())?Zk(t,e.container()):Zk(t,e.getNode()),$k=(e,t)=>{const o=t.get();return o&&e.container()===o&&fi(o)},qk=(e,t)=>t.fold((t=>{tm(e.get());const o=Uk(t);return e.set(o),F.some(ml(o,o.length-1))}),(t=>su(t).map((t=>{if($k(t,e)){const t=e.get();return ml(t,1)}{tm(e.get());const o=Wk(t,!0);return e.set(o),ml(o,1)}}))),(t=>au(t).map((t=>{if($k(t,e)){const t=e.get();return ml(t,t.length-1)}{tm(e.get());const o=Wk(t,!1);return e.set(o),ml(o,o.length-1)}}))),(t=>{tm(e.get());const o=jk(t);return e.set(o),F.some(ml(o,1))})),Gk=(e,t)=>{for(let o=0;o{const o=Sm(t,e);return o||e},Xk=(e,t,o)=>{const n=bv(o),r=Yk(t,n.container());return fv(e,r,n).fold((()=>nu(r,n).bind(N(fv,e,r)).map((e=>Kk.before(e)))),F.none)},Jk=(e,t)=>null===cu(e,t),Qk=(e,t,o)=>fv(e,t,o).filter(N(Jk,t)),e_=(e,t,o)=>{const n=yv(o);return Qk(e,t,n).bind((e=>ru(e,n).isNone()?F.some(Kk.start(e)):F.none()))},t_=(e,t,o)=>{const n=bv(o);return Qk(e,t,n).bind((e=>nu(e,n).isNone()?F.some(Kk.end(e)):F.none()))},o_=(e,t,o)=>{const n=yv(o),r=Yk(t,n.container());return fv(e,r,n).fold((()=>ru(r,n).bind(N(fv,e,r)).map((e=>Kk.after(e)))),F.none)},n_=e=>!pv(s_(e)),r_=(e,t,o)=>Gk([Xk,e_,t_,o_],[e,t,o]).filter(n_),s_=e=>e.fold(A,A,A,A),a_=e=>e.fold(D("before"),D("start"),D("end"),D("after")),i_=e=>e.fold(Kk.before,Kk.before,Kk.after,Kk.after),l_=e=>e.fold(Kk.start,Kk.start,Kk.end,Kk.end),c_=(e,t,o,n,r,s)=>Pt(fv(t,o,n),fv(t,o,r),((t,n)=>t!==n&&((e,t,o)=>{const n=Sm(t,e),r=Sm(o,e);return C(n)&&n===r})(o,t,n)?Kk.after(e?t:n):s)).getOr(s),d_=(e,t)=>e.fold(P,(e=>{return n=t,!(a_(o=e)===a_(n)&&s_(o)===s_(n));var o,n})),m_=(e,t)=>e?t.fold(T(F.some,Kk.start),F.none,T(F.some,Kk.after),F.none):t.fold(F.none,T(F.some,Kk.before),F.none,T(F.some,Kk.end)),u_=(e,t,o,n)=>{const r=vv(e,n),s=r_(t,o,r);return r_(t,o,r).bind(N(m_,e)).orThunk((()=>((e,t,o,n,r)=>{const s=vv(e,r);return Qm(e,o,s).map(N(vv,e)).fold((()=>n.map(i_)),(r=>r_(t,o,r).map(N(c_,e,t,o,s,r)).filter(N(d_,n)))).filter(n_)})(e,t,o,s,n)))},g_=(e,t,o)=>{const n=e?1:-1;return t.setRng(ml(o.container(),o.offset()+n).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0},h_=(e,t)=>{const o=t.selection.getRng(),n=e?ml.fromRangeEnd(o):ml.fromRangeStart(o);return!!(e=>S(e.selection.getSel().modify))(t)&&(e&&yi(n)?g_(!0,t.selection,n):!(e||!wi(n))&&g_(!1,t.selection,n))};var p_;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(p_||(p_={}));const f_=(e,t)=>e===Im.Backwards?se(t):t,v_=(e,t,o)=>e===Im.Forwards?t.next(o):t.prev(o),b_=(e,t,o,n)=>fr(n.getNode(t===Im.Forwards))?p_.Br:!1===km(o,n)?p_.Block:p_.Wrap,y_=(e,t,o,n)=>{const r=Gm(o);let s=n;const a=[];for(;s;){const o=v_(t,r,s);if(!o)break;if(fr(o.getNode(!1)))return t===Im.Forwards?{positions:f_(t,a).concat([o]),breakType:p_.Br,breakAt:F.some(o)}:{positions:f_(t,a),breakType:p_.Br,breakAt:F.some(o)};if(o.isVisible()){if(e(s,o)){const e=b_(0,t,s,o);return{positions:f_(t,a),breakType:e,breakAt:F.some(o)}}a.push(o),s=o}else s=o}return{positions:f_(t,a),breakType:p_.Eol,breakAt:F.none()}},w_=(e,t,o,n)=>t(o,n).breakAt.map((n=>{const r=t(o,n).positions;return e===Im.Backwards?r.concat(n):[n].concat(r)})).getOr([]),x_=(e,t)=>J(e,((e,o)=>e.fold((()=>F.some(o)),(n=>Pt(de(n.getClientRects()),de(o.getClientRects()),((e,r)=>{const s=Math.abs(t-e.left);return Math.abs(t-r.left)<=s?o:n})).or(e)))),F.none()),C_=(e,t)=>de(t.getClientRects()).bind((t=>x_(e,t.left))),S_=N(y_,ml.isAbove,-1),k_=N(y_,ml.isBelow,1),__=N(w_,-1,S_),E_=N(w_,1,k_),T_=(e,t)=>S_(e,t).breakAt.isNone(),O_=(e,t)=>k_(e,t).breakAt.isNone(),D_=(e,t)=>C_(__(e,t),t),A_=(e,t)=>C_(E_(e,t),t),M_=yr,N_=(e,t)=>Math.abs(e.left-t),R_=(e,t)=>Math.abs(e.right-t),B_=(e,t)=>Be(e,((e,o)=>{const n=Math.min(N_(e,t),R_(e,t)),r=Math.min(N_(o,t),R_(o,t));return r===n&&Te(o,"node")&&M_(o.node)||r{const t=t=>$(t,(t=>{const o=Ei(t);return o.node=e,o}));if(tr(e))return t(e.getClientRects());if(dr(e)){const o=e.ownerDocument.createRange();return o.setStart(e,0),o.setEnd(e,e.data.length),t(o.getClientRects())}return[]},H_=e=>ne(e,L_);var I_;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(I_||(I_={}));const P_=(e,t,o,n,r,s)=>{let a=0;const i=[],l=n=>{let s=H_([n]);-1===e&&(s=s.reverse());for(let e=0;e0&&t(n,He(i))&&a++,n.line=a,r(n))return!0;i.push(n)}}return!1},c=He(s.getClientRects());if(!c)return i;const d=s.getNode();return d&&(l(d),((e,t,o,n)=>{let r=n;for(;r=Cm(r,e,$i,t);)if(o(r))return})(e,n,l,d)),i},F_=N(P_,I_.Up,Di,Ai),z_=N(P_,I_.Down,Ai,Di),V_=e=>He(e.getClientRects()),Z_=e=>t=>((e,t)=>t.line>e)(e,t),U_=e=>t=>((e,t)=>t.line===e)(e,t),j_=(e,t)=>{e.selection.setRng(t),Wh(e,e.selection.getRng())},W_=(e,t,o)=>F.some(xk(e,t,o)),$_=(e,t,o,n,r,s)=>{const a=t===Im.Forwards,i=Gm(e.getBody()),l=N(Lm,a?i.next:i.prev),c=a?n:r;if(!o.collapsed){const n=Ni(o);if(s(n))return yk(t,e,n,t===Im.Backwards,!1);if(Tk(e)){const e=o.cloneRange();return e.collapse(t===Im.Backwards),F.from(e)}}const d=Rm(t,e.getBody(),o);if(c(d))return wk(e,d.getNode(!a));let m=l(d);const u=ki(o);if(!m)return u?F.some(o):F.none();if(m=vv(a,m),c(m))return yk(t,e,m.getNode(!a),a,!1);const g=l(m);return g&&c(g)&&Hm(m,g)?yk(t,e,g.getNode(!a),a,!1):u?W_(e,m.toRange(),!1):F.none()},q_=(e,t,o,n,r,s)=>{const a=Rm(t,e.getBody(),o),i=He(a.getClientRects()),l=t===I_.Down,c=e.getBody();if(!i)return F.none();if(Tk(e)){const e=l?ml.fromRangeEnd(o):ml.fromRangeStart(o);return(l?A_:D_)(c,e).orThunk((()=>F.from(e))).map((e=>e.toRange()))}const d=(l?z_:F_)(c,Z_(1),a),m=Y(d,U_(1)),u=i.left,g=B_(m,u);if(g&&s(g.node)){const o=Math.abs(u-g.left),n=Math.abs(u-g.right);return yk(t,e,g.node,o{const r=Gm(t);let s,a,i,l;const c=[];let d=0;1===e?(s=r.next,a=Ai,i=Di,l=ml.after(n)):(s=r.prev,a=Di,i=Ai,l=ml.before(n));const m=V_(l);do{if(!l.isVisible())continue;const e=V_(l);if(i(e,m))continue;c.length>0&&a(e,He(c))&&d++;const t=Ei(e);if(t.position=l,t.line=d,o(t))return c;c.push(t)}while(l=s(l));return c})(t,c,Z_(1),h);let n=B_(Y(o,U_(1)),u);if(n)return W_(e,n.position.toRange(),!1);if(n=He(Y(o,U_(0))),n)return W_(e,n.position.toRange(),!1)}return 0===m.length?G_(e,l).filter(l?r:n).map((t=>xk(e,t.toRange(),!1))):F.none()},G_=(e,t)=>{const o=e.selection.getRng(),n=t?ml.fromRangeEnd(o):ml.fromRangeStart(o),r=(s=n.container(),a=e.getBody(),Xo(wo.fromDom(s),(e=>dm(e.dom)),(e=>e.dom===a)).map((e=>e.dom)).getOr(a));var s,a;if(t){const e=k_(r,n);return me(e.positions)}{const e=S_(r,n);return de(e.positions)}},K_=(e,t,o)=>G_(e,t).filter(o).exists((t=>(e.selection.setRng(t.toRange()),!0))),Y_=(e,t)=>{const o=e.dom.createRng();o.setStart(t.container(),t.offset()),o.setEnd(t.container(),t.offset()),e.selection.setRng(o)},X_=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},J_=(e,t,o)=>qk(t,o).map((t=>(Y_(e,t),o))),Q_=(e,t,o)=>{const n=e.getBody(),r=((e,t,o)=>{const n=ml.fromRangeStart(e);if(e.collapsed)return n;{const r=ml.fromRangeEnd(e);return o?ru(t,r).getOr(r):nu(t,n).getOr(n)}})(e.selection.getRng(),n,o),s=N(hv,e);return u_(o,s,n,r).bind((o=>J_(e,t,o)))},eE=(e,t)=>{const o=t.get();if(e.selection.isCollapsed()&&!e.composing&&o){const n=ml.fromRangeStart(e.selection.getRng());ml.isTextPosition(n)&&!(e=>yi(e)||wi(e))(n)&&(Y_(e,em(o,n)),t.set(null))}},tE=(e,t,o)=>!!Vc(e)&&Q_(e,t,o).isSome(),oE=(e,t,o)=>!!Vc(t)&&h_(e,t),nE=e=>{const t=xa(null),o=N(hv,e);return e.on("NodeChange",(n=>{Vc(e)&&(((e,t,o)=>{const n=$(Vn(wo.fromDom(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),(e=>e.dom)),r=Y(n,e),s=Y(o,e);q(ae(r,s),N(X_,!1)),q(ae(s,r),N(X_,!0))})(o,e.dom,n.parents),eE(e,t),((e,t,o,n)=>{if(t.selection.isCollapsed()){const r=Y(n,e);q(r,(n=>{const r=ml.fromRangeStart(t.selection.getRng());r_(e,t.getBody(),r).bind((e=>J_(t,o,e)))}))}})(o,e,t,n.parents))})),t},rE=N(oE,!0),sE=N(oE,!1),aE=(e,t,o)=>{if(Vc(e)){const n=G_(e,t).getOrThunk((()=>{const o=e.selection.getRng();return t?ml.fromRangeEnd(o):ml.fromRangeStart(o)}));return r_(N(hv,e),e.getBody(),n).exists((t=>{const n=i_(t);return qk(o,n).exists((t=>(Y_(e,t),!0)))}))}return!1},iE=(e,t)=>o=>qk(t,o).map((t=>()=>Y_(e,t))),lE=(e,t,o,n)=>{const r=e.getBody(),s=N(hv,e);e.undoManager.ignore((()=>{e.selection.setRng(((e,t)=>{const o=document.createRange();return o.setStart(e.container(),e.offset()),o.setEnd(t.container(),t.offset()),o})(o,n)),xv(e),r_(s,r,ml.fromRangeStart(e.selection.getRng())).map(l_).bind(iE(e,t)).each(H)})),e.nodeChanged()},cE=(e,t,o,n)=>{const r=((e,t)=>{const o=Sm(t,e);return o||e})(e.getBody(),n.container()),s=N(hv,e),a=r_(s,r,n);return a.bind((e=>o?e.fold(D(F.some(l_(e))),F.none,D(F.some(i_(e))),F.none):e.fold(F.none,D(F.some(i_(e))),F.none,D(F.some(l_(e)))))).map(iE(e,t)).getOrThunk((()=>{const i=eu(o,r,n),l=i.bind((e=>r_(s,r,e)));return Pt(a,l,(()=>fv(s,r,n).bind((t=>(e=>Pt(su(e),au(e),((t,o)=>{const n=vv(!0,t),r=vv(!1,o);return nu(e,n).forall((e=>e.isEqual(r)))})).getOr(!0))(t)?F.some((()=>{uv(e,o,wo.fromDom(t))})):F.none())))).getOrThunk((()=>l.bind((()=>i.map((r=>()=>{o?lE(e,t,n,r):lE(e,t,r,n)}))))))}))},dE=(e,t,o)=>{if(e.selection.isCollapsed()&&Vc(e)){const n=ml.fromRangeStart(e.selection.getRng());return cE(e,t,o,n)}return F.none()},mE=(e,t)=>{const o=wo.fromDom(e.getBody()),n=wo.fromDom(e.selection.getStart()),r=xf(n,o);return te(r,t).fold(D(r),(e=>r.slice(0,e)))},uE=e=>1===zo(e),gE=e=>mE(e,(t=>e.schema.isBlock(Wt(t))||(e=>zo(e)>1)(t))),hE=(e,t)=>{const o=N(iy,e);return ne(t,(e=>o(e)?[e.dom]:[]))},pE=e=>{const t=(e=>mE(e,(t=>e.schema.isBlock(Wt(t)))))(e);return hE(e,t)},fE=(e,t)=>{const o=Y(gE(e),uE);return me(o).bind((n=>{const r=ml.fromRangeStart(e.selection.getRng());return _v(t,r,n.dom)&&!ig(n)?F.some((()=>((e,t,o,n)=>{const r=hE(t,n);if(0===r.length)uv(t,e,o);else{const e=ay(o.dom,r);t.selection.setRng(e.toRange())}})(t,e,n,o))):F.none()}))},vE=(e,t)=>{const o=e.selection.getStart(),n=((e,t)=>{const o=t.parentElement;return fr(t)&&!b(o)&&e.dom.isEmpty(o)})(e,o)||(r=o,ig(wo.fromDom(r)))?ay(o,t):((e,t)=>{const{caretContainer:o,caretPosition:n}=sy(t);return e.insertNode(o.dom),n})(e.selection.getRng(),t);var r;e.selection.setRng(n.toRange())},bE=e=>dr(e.startContainer),yE=e=>(e=>{const t=e.startContainer.parentNode,o=e.endContainer.parentNode;return!b(t)&&!b(o)&&t.isEqualNode(o)})(e)&&(e=>{const t=e.endContainer;return e.endOffset===(dr(t)?t.length:t.childNodes.length)})(e),wE=e=>{const t=e.selection.getRng();return(e=>0===e.startOffset&&bE(e))(t)&&((e,t)=>{const o=t.startContainer.parentElement;return!b(o)&&iy(e,wo.fromDom(o))})(e,t)&&(e=>yE(e)||(e=>!e.endContainer.isEqualNode(e.commonAncestorContainer))(e))(t)},xE=e=>{if(wE(e)){const t=pE(e);return F.some((()=>{xv(e),((e,t)=>{const o=ae(t,pE(e));o.length>0&&vE(e,o)})(e,t)}))}return F.none()},CE=(e,t)=>e.selection.isCollapsed()?fE(e,t):xE(e),SE=e=>{return t=wo.fromDom(e.selection.getStart()),o=e.schema,Zn(t,(e=>lu(e.dom)),(e=>o.isBlock(Wt(e))));var t,o},kE=e=>((e=>{const t=e.selection.getRng();return t.collapsed&&(bE(t)||e.dom.isEmpty(t.startContainer))&&!SE(e)})(e)&&vE(e,[]),!0),_E=(e,t,o)=>C(o)?F.some((()=>{e._selectionOverrides.hideFakeCaret(),uv(e,t,wo.fromDom(o))})):F.none(),EE=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const o=t?hf:pf,n=t?Im.Forwards:Im.Backwards,r=Rm(n,e.getBody(),e.selection.getRng());return o(r)?_E(e,t,r.getNode(!t)):F.from(vv(t,r)).filter((e=>o(e)&&Hm(r,e))).bind((o=>_E(e,t,o.getNode(!t))))})(e,t):((e,t)=>{const o=e.selection.getNode();return Cr(o)?_E(e,t,o):F.none()})(e,t),TE=e=>Qe(null!=e?e:"").getOr(0),OE=(e,t)=>(e||"table"===Wt(t)?"margin":"padding")+("rtl"===mn(t,"direction")?"-right":"-left"),DE=e=>{const t=ME(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>re(t,(t=>{const o=OE(_c(e),t),n=gn(t,o).map(TE).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&n>0})))(e,t))},AE=e=>oi(e)||ni(e),ME=e=>Y(_n(e.selection.getSelectedBlocks()),(e=>!AE(e)&&!(e=>Do(e).exists(AE))(e)&&Jo(e,(e=>br(e.dom)||yr(e.dom))).exists((e=>br(e.dom))))),NE=(e,t)=>{var o,n;const{dom:r}=e,s=Ec(e),a=null!==(n=null===(o=/[a-z%]+$/i.exec(s))||void 0===o?void 0:o[0])&&void 0!==n?n:"px",i=TE(s),l=_c(e);q(ME(e),(e=>{((e,t,o,n,r,s)=>{const a=OE(o,wo.fromDom(s)),i=TE(e.getStyle(s,a));if("outdent"===t){const t=Math.max(0,i-n);e.setStyle(s,a,t?t+r:"")}else{const t=i+n+r;e.setStyle(s,a,t)}})(r,t,l,i,a,e.dom)}))},RE=e=>NE(e,"outdent"),BE=e=>{if(e.selection.isCollapsed()&&DE(e)){const t=e.dom,o=e.selection.getRng(),n=ml.fromRangeStart(o),r=t.getParent(o.startContainer,t.isBlock);if(null!==r&&Ef(wo.fromDom(r),n,e.schema))return F.some((()=>RE(e)))}return F.none()},LE=(e,t,o)=>ge([BE,Hk,_k,(e,o)=>dE(e,t,o),hk,rb,Ik,EE,bk,CE],(t=>t(e,o))).filter((t=>e.selection.isEditable())),HE=(e,t)=>{LE(e,t,!0).fold((()=>{e.selection.isEditable()&&(e=>{wv(e,"ForwardDelete")})(e)}),H)},IE=(e,t)=>{e.addCommand("delete",(()=>{((e,t)=>{LE(e,t,!1).fold((()=>{e.selection.isEditable()&&(xv(e),kv(e))}),H)})(e,t)})),e.addCommand("forwardDelete",(()=>{HE(e,t)}))},PE=e=>void 0===e.touches||1!==e.touches.length?F.none():F.some(e.touches[0]),FE=e=>{const t=Oa(),o=xa(!1),n=Aa((t=>{e.dispatch("longpress",{...t,type:"longpress"}),o.set(!0)}),400);e.on("touchstart",(e=>{PE(e).each((r=>{n.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};n.throttle(e),o.set(!1),t.set(s)}))}),!0),e.on("touchmove",(r=>{n.cancel(),PE(r).each((n=>{t.on((r=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(n,r)&&(t.clear(),o.set(!1),e.dispatch("longpresscancel"))}))}))}),!0),e.on("touchend touchcancel",(r=>{n.cancel(),"touchcancel"!==r.type&&t.get().filter((e=>e.target.isEqualNode(r.target))).each((()=>{o.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})}))}),!0)},zE=(e,t)=>Ee(e,t.nodeName),VE=(e,t)=>!!dr(t)||!!tr(t)&&!(zE(e.getBlockElements(),t)||Cu(t)||Yr(e,t)||Hr(t)),ZE=(e,t)=>{if(dr(t)){if(0===t.data.length)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||zE(e,t.nextSibling)||Hr(t.nextSibling)}return!1},UE=e=>e.dom.create(sc(e),ac(e)),jE=e=>{const t=e.dom,o=e.selection,n=e.schema,r=n.getBlockElements(),s=o.getStart(),a=e.getBody();let i,l,c=!1;const d=sc(e);if(!s||!tr(s))return;const m=a.nodeName.toLowerCase();if(!n.isValidChild(m,d.toLowerCase())||((e,t,o)=>W(wf(wo.fromDom(o),wo.fromDom(t)),(t=>zE(e,t.dom))))(r,a,s))return;const u=o.getRng(),{startContainer:g,startOffset:h,endContainer:p,endOffset:f}=u,v=bp(e);let b=a.firstChild;for(;b;)if(tr(b)&&$r(n,b),VE(n,b)){if(ZE(r,b)){l=b,b=b.nextSibling,t.remove(l);continue}i||(i=UE(e),a.insertBefore(i,b),c=!0),l=b,b=b.nextSibling,i.appendChild(l)}else i=null,b=b.nextSibling;c&&v&&(u.setStart(g,h),u.setEnd(p,f),o.setRng(u),e.nodeChanged())},WE=(e,t,o)=>{const n=wo.fromDom(UE(e)),r=li();yn(n,r),o(t,n);const s=document.createRange();return s.setStartBefore(r.dom),s.setEndBefore(r.dom),s},$E=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),qE=(e,t,o)=>function(n){const r=arguments,s=r[r.length-2],a=s>0?t.charAt(s-1):"";if('"'===a)return n;if(">"===a){const e=t.lastIndexOf("<",s);if(-1!==e&&-1!==t.substring(e,s).indexOf('contenteditable="false"'))return n}return''+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+""},GE=e=>{const t="contenteditable",o=" "+Lt.trim(Md(e))+" ",n=" "+Lt.trim(Ad(e))+" ",r=$E(o),s=$E(n),a=Nd(e);a.length>0&&e.on("BeforeSetContent",(t=>{((e,t,o)=>{let n=t.length,r=o.content;if("raw"!==o.format){for(;n--;)r=r.replace(t[n],qE(e,r,Ad(e)));o.content=r}})(e,a,t)})),e.parser.addAttributeFilter("class",(e=>{let o=e.length;for(;o--;){const n=e[o];r(n)?n.attr(t,"true"):s(n)&&n.attr(t,"false")}})),e.serializer.addAttributeFilter(t,(e=>{let o=e.length;for(;o--;){const n=e[o];(r(n)||s(n))&&(a.length>0&&n.attr("data-mce-content")?(n.name="#text",n.type=3,n.raw=!0,n.value=n.attr("data-mce-content")):n.attr(t,null))}}))},KE=(e,t)=>{t.hasAttribute("data-mce-caret")&&(Si(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},YE=(e,t)=>{const o=(e=>on(wo.fromDom(e.getBody()),"*[data-mce-caret]").map((e=>e.dom)).getOrNull())(e);if(o)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void KE(e,o)):void(bi(o)&&(KE(e,o),e.undoManager.add()))},XE=yr,JE=(e,t,o)=>{const n=Gm(e.getBody()),r=N(Lm,1===t?n.next:n.prev);if(o.collapsed){const n=e.dom.getParent(o.startContainer,"PRE");if(!n)return;if(!r(ml.fromRangeStart(o))){const o=wo.fromDom((e=>{const t=e.dom.create(sc(e));return t.innerHTML='
    ',t})(e));1===t?vn(wo.fromDom(n),o):fn(wo.fromDom(n),o),e.selection.select(o.dom,!0),e.selection.collapse()}}},QE=(e,t)=>{const o=t?Im.Forwards:Im.Backwards,n=e.selection.getRng();return((e,t,o)=>$_(t,e,o,bf,yf,XE))(o,e,n).orThunk((()=>(JE(e,o,n),F.none())))},eT=(e,t)=>{const o=t?1:-1,n=e.selection.getRng();return((e,t,o)=>q_(t,e,o,(e=>bf(e)||ff(e)),(e=>yf(e)||vf(e)),XE))(o,e,n).orThunk((()=>(JE(e,o,n),F.none())))},tT=(e,t)=>QE(e,((e,t)=>{const o=t?e.getEnd(!0):e.getStart(!0);return pv(o)?!t:t})(e.selection,t)).exists((t=>(j_(e,t),!0))),oT=(e,t)=>eT(e,t).exists((t=>(j_(e,t),!0))),nT=(e,t)=>K_(e,t,t?yf:bf),rT=(e,t)=>Ek(e,!t).map((o=>{const n=o.toRange(),r=e.selection.getRng();return t?n.setStart(r.startContainer,r.startOffset):n.setEnd(r.endContainer,r.endOffset),n})).exists((t=>(j_(e,t),!0))),sT=e=>j(["figcaption"],Wt(e)),aT=(e,t)=>{const o=wo.fromDom(e.getBody()),n=ml.fromRangeStart(e.selection.getRng());return((e,t,o)=>{const n=N(ko,t);return Jo(wo.fromDom(e.container()),(e=>o.isBlock(Wt(e))),n).filter(sT)})(n,o,e.schema).exists((()=>{if(((e,t,o)=>t?O_(e.dom,o):T_(e.dom,o))(o,t,n)){const n=WE(e,o,t?yn:bn);return e.selection.setRng(n),!0}return!1}))},iT=(e,t)=>!!e.selection.isCollapsed()&&aT(e,t),lT=(e,t)=>t?F.from(e.dom.getParent(e.selection.getNode(),"details")).map((t=>((e,t)=>{const o=e.selection.getRng(),n=ml.fromRangeStart(o);return!(e.getBody().lastChild!==t||!O_(t,n)||(e.execCommand("InsertNewBlockAfter"),0))})(e,t))).getOr(!1):F.from(e.dom.getParent(e.selection.getNode(),"summary")).bind((t=>F.from(e.dom.getParent(t,"details")).map((o=>((e,t,o)=>{const n=e.selection.getRng(),r=ml.fromRangeStart(n);return!(e.getBody().firstChild!==t||!T_(o,r)||(e.execCommand("InsertNewBlockBefore"),0))})(e,o,t))))).getOr(!1),cT=(e,t)=>lT(e,t),dT={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},mT=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,uT=(e,t)=>ne((e=>$(e,(e=>({...dT,...e}))))(e),(e=>mT(e,t)?[e]:[])),gT=(e,t)=>ne((e=>$(e,(e=>({...dT,...e}))))(e),(e=>mT(e,t)?[e]:[])),hT=(e,...t)=>()=>e.apply(null,t),pT=(e,t)=>ee(uT(e,t),(e=>e.action())),fT=(e,t)=>ge(gT(e,t),(e=>e.action())),vT=(e,t)=>{const o=t?Im.Forwards:Im.Backwards,n=e.selection.getRng();return $_(e,o,n,hf,pf,Cr).exists((t=>(j_(e,t),!0)))},bT=(e,t)=>{const o=t?1:-1,n=e.selection.getRng();return q_(e,o,n,hf,pf,Cr).exists((t=>(j_(e,t),!0)))},yT=(e,t)=>K_(e,t,t?pf:hf),wT=Il([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),xT={...wT,none:e=>wT.none(e)},CT=(e,t,o)=>ne(Ho(e),(e=>Co(e,t)?o(e)?[e]:[]:CT(e,t,o))),ST=(e,t)=>((e,t,o=I)=>o(t)?F.none():j(e,Wt(t))?F.some(t):tn(t,e.join(","),(e=>Co(e,"table")||o(e))))(["td","th"],e,t),kT=e=>CT(e,"th,td",P),_T=(e,t)=>nn(e,"table",t),ET=(e,t,o,n,r=P)=>{const s=1===n;if(!s&&o<=0)return xT.first(e[0]);if(s&&o>=e.length-1)return xT.last(e[e.length-1]);{const s=o+n,a=e[s];return r(a)?xT.middle(t,a):ET(e,t,s,n,r)}},TT=(e,t)=>_T(e,t).bind((t=>{const o=kT(t);return te(o,(t=>ko(e,t))).map((e=>({index:e,all:o})))})),OT=e=>{return(t=e,Xa.getOption(t)).filter((e=>0!==e.trim().length||e.indexOf(qn)>-1)).isSome();var t},DT=["img","br"],AT=e=>OT(e)||j(DT,Wt(e))||(e=>Gt(e)&&"false"===no(e,"contenteditable"))(e),MT=(e,t,o,n,r)=>{const s=Vn(wo.fromDom(o),"td,th,caption").map((e=>e.dom)),a=Y(((e,t)=>ne(t,(t=>{const o=((e,t)=>({left:e.left-t,top:e.top-t,right:e.right+2*t,bottom:e.bottom+2*t,width:e.width+t,height:e.height+t}))(Ei(t.getBoundingClientRect()),-1);return[{x:o.left,y:e(o),cell:t},{x:o.right,y:e(o),cell:t}]})))(e,s),(e=>t(e,r)));return((e,t,o)=>J(e,((e,n)=>e.fold((()=>F.some(n)),(e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-o)),s=Math.sqrt(Math.abs(n.x-t)+Math.abs(n.y-o));return F.some(se.cell))},NT=N(MT,(e=>e.bottom),((e,t)=>e.ye.top),((e,t)=>e.y>t)),BT=(e,t)=>de(t.getClientRects()).bind((t=>NT(e,t.left,t.top))).bind((e=>{return C_(au(o=e).map((e=>S_(o,e).positions.concat(e))).getOr([]),t);var o})),LT=(e,t)=>me(t.getClientRects()).bind((t=>RT(e,t.left,t.top))).bind((e=>{return C_(su(o=e).map((e=>[e].concat(k_(o,e).positions))).getOr([]),t);var o})),HT=(e,t,o)=>{const n=e(t,o);return(e=>e.breakType===p_.Wrap&&0===e.positions.length)(n)||!fr(o.getNode())&&(e=>e.breakType===p_.Br&&1===e.positions.length)(n)?!((e,t,o)=>o.breakAt.exists((o=>e(t,o).breakAt.isSome())))(e,t,n):n.breakAt.isNone()},IT=N(HT,S_),PT=N(HT,k_),FT=(e,t,o,n)=>{const r=e.selection.getRng(),s=t?1:-1;return!(!im()||!((e,t,o)=>{const n=ml.fromRangeStart(t);return ou(!e,o).exists((e=>e.isEqual(n)))})(t,r,o)||(yk(s,e,o,!t,!1).each((t=>{j_(e,t)})),0))},zT=(e,t)=>{const o=t.getNode(e);return ir(o)?F.some(o):F.none()},VT=(e,t,o)=>{const n=zT(!!t,o),r=!1===t;n.fold((()=>j_(e,o.toRange())),(n=>ou(r,e.getBody()).filter((e=>e.isEqual(o))).fold((()=>j_(e,o.toRange())),(o=>((e,t,o)=>{t.undoManager.transact((()=>{const n=e?vn:fn,r=WE(t,wo.fromDom(o),n);j_(t,r)}))})(t,e,n)))))},ZT=(e,t,o,n)=>{const r=e.selection.getRng(),s=ml.fromRangeStart(r),a=e.getBody();if(!t&&IT(n,s)){const n=((e,t,o)=>BT(t,o).orThunk((()=>de(o.getClientRects()).bind((o=>x_(__(e,ml.before(t)),o.left))))).getOr(ml.before(t)))(a,o,s);return VT(e,t,n),!0}if(t&&PT(n,s)){const n=((e,t,o)=>LT(t,o).orThunk((()=>de(o.getClientRects()).bind((o=>x_(E_(e,ml.after(t)),o.left))))).getOr(ml.after(t)))(a,o,s);return VT(e,t,n),!0}return!1},UT=(e,t,o)=>F.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind((n=>F.from(e.dom.getParent(n,"table")).map((r=>o(e,t,r,n))))).getOr(!1),jT=(e,t)=>UT(e,t,FT),WT=(e,t)=>UT(e,t,ZT),$T=(e,t,o)=>o.fold(F.none,F.none,((e,t)=>{return(o=t,en(o,AT)).map((e=>(e=>{const t=sh.exact(e,0,e,0);return dh(t)})(e)));var o}),(o=>(e.execCommand("mceTableInsertRowAfter"),qT(e,t,o)))),qT=(e,t,o)=>$T(e,t,((e,t,o)=>TT(e,o).fold((()=>xT.none(e)),(o=>ET(o.all,e,o.index,1,t))))(o,rn)),GT=(e,t,o)=>$T(e,t,((e,t,o)=>TT(e,o).fold((()=>xT.none()),(o=>ET(o.all,e,o.index,-1,t))))(o,rn)),KT=(e,t)=>{const o=["table","li","dl"],n=wo.fromDom(e.getBody()),r=e=>{const t=Wt(e);return ko(e,n)||j(o,t)},s=e.selection.getRng(),a=wo.fromDom(t?s.endContainer:s.startContainer);return ST(a,r).map((o=>(_T(o,r).each((t=>{e.model.table.clearSelectedCells(t.dom)})),e.selection.collapse(!t),(t?qT:GT)(e,r,o).each((t=>{e.selection.setRng(t)})),!0))).getOr(!1)},YT=(e,t)=>{e.on("keydown",(o=>{o.isDefaultPrevented()||((e,t,o)=>{const n=Mt.os.isMacOS()||Mt.os.isiOS();pT([{keyCode:Vg.RIGHT,action:hT(tT,e,!0)},{keyCode:Vg.LEFT,action:hT(tT,e,!1)},{keyCode:Vg.UP,action:hT(oT,e,!1)},{keyCode:Vg.DOWN,action:hT(oT,e,!0)},...n?[{keyCode:Vg.UP,action:hT(rT,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Vg.DOWN,action:hT(rT,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Vg.RIGHT,action:hT(jT,e,!0)},{keyCode:Vg.LEFT,action:hT(jT,e,!1)},{keyCode:Vg.UP,action:hT(WT,e,!1)},{keyCode:Vg.DOWN,action:hT(WT,e,!0)},{keyCode:Vg.UP,action:hT(WT,e,!1)},{keyCode:Vg.UP,action:hT(cT,e,!1)},{keyCode:Vg.DOWN,action:hT(cT,e,!0)},{keyCode:Vg.RIGHT,action:hT(vT,e,!0)},{keyCode:Vg.LEFT,action:hT(vT,e,!1)},{keyCode:Vg.UP,action:hT(bT,e,!1)},{keyCode:Vg.DOWN,action:hT(bT,e,!0)},{keyCode:Vg.RIGHT,action:hT(tE,e,t,!0)},{keyCode:Vg.LEFT,action:hT(tE,e,t,!1)},{keyCode:Vg.RIGHT,ctrlKey:!n,altKey:n,action:hT(rE,e,t)},{keyCode:Vg.LEFT,ctrlKey:!n,altKey:n,action:hT(sE,e,t)},{keyCode:Vg.UP,action:hT(iT,e,!1)},{keyCode:Vg.DOWN,action:hT(iT,e,!0)}],o).each((e=>{o.preventDefault()}))})(e,t,o)}))},XT=(e,t)=>({container:e,offset:t}),JT=ba.DOM,QT=e=>t=>e===t?-1:0,eO=(e,t,o)=>{if(dr(e)&&t>=0)return F.some(XT(e,t));{const n=Ya(JT);return F.from(n.backwards(e,t,QT(e),o)).map((e=>XT(e.container,e.container.data.length)))}},tO=(e,t,o)=>{if(!dr(e))return F.none();const n=e.data;if(t>=0&&t<=n.length)return F.some(XT(e,t));{const n=Ya(JT);return F.from(n.backwards(e,t,QT(e),o)).bind((e=>{const n=e.container.data;return tO(e.container,t+n.length,o)}))}},oO=(e,t,o)=>{if(!dr(e))return F.none();const n=e.data;if(t<=n.length)return F.some(XT(e,t));{const r=Ya(JT);return F.from(r.forwards(e,t,QT(e),o)).bind((e=>oO(e.container,t-n.length,o)))}},nO=(e,t,o,n,r)=>{const s=Ya(e,(e=>t=>e.isBlock(t)||j(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return F.from(s.backwards(t,o,n,r))},rO=e=>""!==e&&-1!=="  \f\n\r\t\v".indexOf(e),sO=(e,t)=>e.substring(t.length),aO=(e,t,o,n=!1)=>{if(!(r=t).collapsed||!dr(r.startContainer))return F.none();var r;const s={text:"",offset:0},a=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return nO(e,t.startContainer,t.startOffset,((e,t,r)=>(s.text=r+s.text,s.offset+=t,((e,t,o,n=!1)=>{let r;const s=o.charAt(0);for(r=t-1;r>=0;r--){const a=e.charAt(r);if(!n&&rO(a))return F.none();if(s===a&&je(e,o,r,t))break}return F.some(r)})(s.text,s.offset,o,n).getOr(t))),a).bind((e=>{const n=t.cloneRange();if(n.setStart(e.container,e.offset),n.setEnd(t.endContainer,t.endOffset),n.collapsed)return F.none();const r=(e=>ui(e.toString().replace(/\u00A0/g," ")))(n);return 0!==r.lastIndexOf(o)?F.none():F.some({text:sO(r,o),range:n,trigger:o})}))},iO=e=>{if((e=>3===e.nodeType)(e))return XT(e,e.data.length);{const t=e.childNodes;return t.length>0?iO(t[t.length-1]):XT(e,t.length)}},lO=(e,t)=>{const o=e.childNodes;return o.length>0&&t0&&(e=>1===e.nodeType)(e)&&o.length===t?iO(o[o.length-1]):XT(e,t)},cO=e=>t=>{const o=lO(t.startContainer,t.startOffset);return!((e,t)=>{var o;const n=null!==(o=e.getParent(t.container,e.isBlock))&&void 0!==o?o:e.getRoot();return nO(e,t.container,t.offset,((e,t)=>0===t?-1:t),n).filter((e=>{const t=e.container.data.charAt(e.offset-1);return!rO(t)})).isSome()})(e,o)},dO=(e,t)=>{const o=t(),n=e.selection.getRng();return((e,t,o)=>ge(o.triggers,(o=>aO(e,t,o))))(e.dom,n,o).bind((o=>mO(e,t,o)))},mO=(e,t,o,n={})=>{var r;const s=t(),a=null!==(r=e.selection.getRng().startContainer.nodeValue)&&void 0!==r?r:"",i=Y(s.lookupByTrigger(o.trigger),(t=>o.text.length>=t.minChars&&t.matches.getOrThunk((()=>cO(e.dom)))(o.range,a,o.text)));if(0===i.length)return F.none();const l=Promise.all($(i,(e=>e.fetch(o.text,e.maxResults,n).then((t=>({matchText:o.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))))));return F.some({lookupData:l,context:o})};var uO;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(uO||(uO={}));const gO=(e,t,o)=>e.stype===uO.Error?t(e.serror):o(e.svalue),hO=e=>({stype:uO.Value,svalue:e}),pO=e=>({stype:uO.Error,serror:e}),fO=e=>gO(e,Hl.error,Hl.value),vO=hO,bO=e=>{const t=[],o=[];return q(e,(e=>{gO(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}},yO=pO,wO=(e,t)=>e.stype===uO.Error?t(e.serror):e,xO=(e,t)=>e.stype===uO.Value?{stype:uO.Value,svalue:t(e.svalue)}:e,CO=(e,t)=>e.stype===uO.Error?{stype:uO.Error,serror:t(e.serror)}:e,SO=gO,kO=e=>p(e)&&pe(e).length>100?" removed due to size":JSON.stringify(e,null,2),_O=(e,t)=>yO([{path:e,getErrorInfo:t}]),EO=(e,t,o,n)=>_e(o,n).fold((()=>((e,t,o)=>_O(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+kO(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))),TO=(e,t)=>({extract:(o,n)=>_e(n,e).fold((()=>((e,t)=>_O(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>EO(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+pe(t)}),OO=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;nf(e)&&f(t)?DO(e,t):t)),AO=(OO(((e,t)=>t)),e=>({tag:"defaultedThunk",process:D(e)})),MO=e=>T(yO,oe)(e),NO=e=>{const t=bO(e);return t.errors.length>0?MO(t.errors):vO(t.values)},RO=(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)}},BO=e=>({extract:(t,o)=>wO(e(o),(e=>((e,t)=>_O(e,D(t)))(t,e))),toString:D("val")}),LO=BO(vO),HO=(e,t,o,n)=>_e(t,o).fold((()=>((e,t,o)=>_O(e,(()=>'Could not find valid *required* value for "'+t+'" in '+kO(o))))(e,o,t)),n),IO=(e,t,o,n)=>n(_e(e,t).getOrThunk((()=>o(e)))),PO=(e,t,o,n,r)=>{const s=e=>r.extract(t.concat([n]),e),a=e=>e.fold((()=>vO(F.none())),(e=>{const o=r.extract(t.concat([n]),e);return xO(o,F.some)}));switch(e.tag){case"required":return HO(t,o,n,s);case"defaultedThunk":return IO(o,n,e.process,s);case"option":return((e,t,o)=>o(_e(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(_e(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return IO(o,n,D({}),(t=>{const n=DO(e.process(o),t);return s(n)}))}},FO=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const s of o)RO(s,((o,s,a,i)=>{const l=PO(a,e,t,o,i);SO(l,(e=>{r.push(...e)}),(e=>{n[s]=e}))}),((e,o)=>{n[e]=o(t)}));return r.length>0?yO(r):vO(n)})(t,o,e),toString:()=>{const t=$(e,(e=>RO(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),zO=e=>({extract:(t,o)=>{const n=$(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return NO(n)},toString:()=>"array("+e.toString()+")"}),VO=(e,t,o)=>fO(((e,t,o)=>{const n=t.extract([e],o);return CO(n,(e=>({input:o,errors:e})))})(e,t,o)),ZO=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:D("... (only showing first ten failures)")}]):e;return $(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+kO(e.input),UO=(e,t)=>TO(e,be(t,FO)),jO=D(LO),WO=(e,t)=>BO((o=>{const n=typeof o;return e(o)?vO(o):yO(`Expected type: ${t} but got: ${n}`)})),$O=WO(k,"number"),qO=WO(h,"string"),GO=WO(y,"boolean"),KO=WO(S,"function"),YO=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),XO=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),JO=e=>{return t=t=>j(e,t)?Hl.value(t):Hl.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`),BO((e=>t(e).fold(yO,vO)));var t},QO=(e,t)=>YO(e,e,{tag:"required",process:{}},t),eD=e=>QO(e,qO),tD=e=>QO(e,KO),oD=(e,t)=>YO(e,e,{tag:"option",process:{}},t),nD=e=>oD(e,qO),rD=(e,t,o)=>YO(e,e,AO(t),o),sD=(e,t)=>rD(e,t,$O),aD=(e,t,o)=>rD(e,t,JO(o)),iD=(e,t)=>rD(e,t,GO),lD=(e,t)=>rD(e,t,KO),cD=eD("type"),dD=tD("fetch"),mD=tD("onAction"),uD=lD("onSetup",(()=>E)),gD=nD("text"),hD=nD("icon"),pD=nD("tooltip"),fD=nD("label"),vD=iD("active",!1),bD=iD("enabled",!0),yD=iD("primary",!1),wD=e=>((e,t)=>rD(e,t,qO))("type",e),xD=FO([cD,eD("trigger"),sD("minChars",1),(SD=1,((e,t)=>YO(e,e,AO(t),jO()))("columns",SD)),sD("maxResults",10),(CD="matches",oD(CD,KO)),dD,mD,((e,t,o)=>rD(e,t,zO(o)))("highlightOn",[],qO)]);var CD,SD;const kD=[bD,pD,hD,gD,uD],_D=[vD].concat(kD),ED=[lD("predicate",I),aD("scope","node",["node","editor"]),aD("position","selection",["node","selection","line"])],TD=kD.concat([wD("contextformbutton"),yD,mD,XO("original",A)]),OD=_D.concat([wD("contextformbutton"),yD,mD,XO("original",A)]),DD=kD.concat([wD("contextformbutton")]),AD=_D.concat([wD("contextformtogglebutton")]),MD=UO("type",{contextformbutton:TD,contextformtogglebutton:OD});FO([wD("contextform"),lD("initValue",D("")),fD,((e,t)=>YO(e,e,{tag:"required",process:{}},zO(t)))("commands",MD),oD("launch",UO("type",{contextformbutton:DD,contextformtogglebutton:AD}))].concat(ED));const ND=e=>{const t=e.ui.registry.getAll().popups,o=be(t,(e=>{return(t=e,VO("Autocompleter",xD,t)).fold((e=>{throw new Error(ZO(e))}),A);var t})),n=Oe(Se(o,(e=>e.trigger))),r=ke(o);return{dataset:o,triggers:n,lookupByTrigger:e=>Y(r,(t=>t.trigger===e))}},RD=e=>{const t=Oa(),o=xa(!1),n=t.isSet,r=()=>{n()&&((e=>{e.dispatch("AutocompleterEnd")})(e),o.set(!1),t.clear())},s=Ie((()=>ND(e))),a=a=>{(o=>t.get().map((t=>aO(e.dom,e.selection.getRng(),t.trigger,!0).bind((t=>mO(e,s,t,o))))).getOrThunk((()=>dO(e,s))))(a).fold(r,(s=>{(e=>{n()||t.set({trigger:e.trigger,matchLength:e.text.length})})(s.context),s.lookupData.then((n=>{t.get().map((a=>{const i=s.context;a.trigger===i.trigger&&(i.text.length-a.matchLength>=10?r():(t.set({...a,matchLength:i.text.length}),o.get()?(Fg(e,{range:i.range}),((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:n})):(o.set(!0),Fg(e,{range:i.range}),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:n}))))}))}))}))},i=()=>t.get().bind((({trigger:t})=>{const n=e.selection.getRng();return aO(e.dom,n,t,o.get()).filter((({range:e})=>((e,t)=>{const o=e.compareBoundaryPoints(window.Range.START_TO_START,t),n=e.compareBoundaryPoints(window.Range.END_TO_END,t);return o>=0&&n<=0})(n,e))).map((({range:e})=>e))}));e.addCommand("mceAutocompleterReload",((e,t)=>{const o=p(t)?t.fetchOptions:{};a(o)})),e.addCommand("mceAutocompleterClose",r),e.addCommand("mceAutocompleterRefreshActiveRange",(()=>{i().each((t=>{Fg(e,{range:t})}))})),e.editorCommands.addQueryStateHandler("mceAutoCompleterInRange",(()=>i().isSome())),((e,t)=>{const o=Aa(t.load,50);e.on("input",(()=>{o.throttle()})),e.on("keydown",(e=>{const n=e.which;8===n?o.throttle():27===n?(o.cancel(),t.cancelIfNecessary()):38!==n&&40!==n||o.cancel()}),!0),e.on("remove",o.cancel)})(e,{cancelIfNecessary:r,load:a})},BD=kt().browser.isSafari(),LD=e=>ci(wo.fromDom(e)),HD=(e,t)=>{var o;return 0===e.startOffset&&e.endOffset===(null===(o=t.textContent)||void 0===o?void 0:o.length)},ID=(e,t)=>F.from(e.getParent(t.container(),"details")),PD=(e,t)=>ID(e,t).isSome(),FD=(e,t)=>t.startSummary.exists((t=>((e,t)=>su(t).exists((t=>t.isEqual(e))))(e,t))),zD=(e,t)=>t.startSummary.exists((t=>((e,t)=>au(t).exists((o=>fr(o.getNode())&&ru(t,o).exists((t=>t.isEqual(e)))||o.isEqual(e))))(e,t))),VD=(e,t)=>{const o=t.getNode();w(o)||e.selection.setCursorLocation(o,t.offset())},ZD=(e,t,o)=>{const n=e.dom.getParent(t.container(),"details");if(n&&!n.open){const t=e.dom.select("summary",n)[0];t&&(o?su(t):au(t)).each((t=>VD(e,t)))}else VD(e,t)},UD=(e,t,o)=>{const{dom:n,selection:r}=e,s=e.getBody();if("character"===o){const o=ml.fromRangeStart(r.getRng()),a=n.getParent(o.container(),n.isBlock),i=ID(n,o),l=a&&n.isEmpty(a),c=b(null==a?void 0:a.previousSibling),d=b(null==a?void 0:a.nextSibling);return!!(l&&(t?d:c)&&eu(!t,s,o).exists((e=>PD(n,e)&&!It(i,ID(n,e)))))||eu(t,s,o).fold(I,(o=>{const r=ID(n,o);if(PD(n,o)&&!It(i,r)){if(t||ZD(e,o,!1),a&&l){if(t&&c)return!0;if(!t&&d)return!0;ZD(e,o,t),e.dom.remove(a)}return!0}return!1}))}return!1},jD=(e,t,o,n)=>{const r=e.selection.getRng(),s=ml.fromRangeStart(r),a=e.getBody();return"selection"===n?((e,t)=>{const o=t.startSummary.exists((t=>t.contains(e.startContainer))),n=t.startSummary.exists((t=>t.contains(e.endContainer))),r=t.startDetails.forall((e=>t.endDetails.forall((t=>e!==t))));return(o||n)&&!(o&&n)||r})(r,t):o?zD(s,t)||((e,t,o)=>o.startDetails.exists((o=>nu(e,t).forall((e=>!o.contains(e.container()))))))(a,s,t):FD(s,t)||((e,t)=>t.startDetails.exists((o=>ru(o,e).forall((o=>t.startSummary.exists((t=>!t.contains(e.container())&&t.contains(o.container()))))))))(s,t)},WD=(e,t,o)=>((e,t)=>{const o=F.from(e.getParent(t.startContainer,"details")),n=F.from(e.getParent(t.endContainer,"details"));if(o.isSome()||n.isSome()){const t=o.bind((t=>F.from(e.select("summary",t)[0])));return F.some({startSummary:t,startDetails:o,endDetails:n})}return F.none()})(e.dom,e.selection.getRng()).fold((()=>UD(e,t,o)),(n=>jD(e,n,t,o)||UD(e,t,o))),$D=(e,t,o)=>{const n=e.selection,r=n.getNode(),s=n.getRng(),a=ml.fromRangeStart(s);return!!_r(r)&&("selection"===o&&HD(s,r)||_v(t,a,r)?LD(r):e.undoManager.transact((()=>{const s=n.getSel();let{anchorNode:a,anchorOffset:i,focusNode:l,focusOffset:c}=null!=s?s:{};const d=()=>{C(a)&&C(i)&&C(l)&&C(c)&&(null==s||s.setBaseAndExtent(a,i,l,c))},m=(e,t)=>{q(e.childNodes,(e=>{Fu(e)&&t.appendChild(e)}))},u=e.dom.create("span",{"data-mce-bogus":"1"});m(r,u),r.appendChild(u),d(),"word"!==o&&"line"!==o||null==s||s.modify("extend",t?"right":"left",o),!n.isCollapsed()&&HD(n.getRng(),u)?LD(r):(e.execCommand(t?"ForwardDelete":"Delete"),a=null==s?void 0:s.anchorNode,i=null==s?void 0:s.anchorOffset,l=null==s?void 0:s.focusNode,c=null==s?void 0:s.focusOffset,m(u,r),d()),e.dom.remove(u)})),!0)},qD=(e,t,o)=>WD(e,t,o)||BD&&$D(e,t,o)?F.some(E):F.none(),GD=e=>(t,o,n={})=>{const r=t.getBody(),s={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:r,currentTarget:r,eventPhase:Event.AT_TARGET,originalTarget:r,explicitOriginalTarget:r,isTrusted:!1,srcElement:r,cancelable:!1,preventDefault:E,inputType:o},a=ta(new InputEvent(e));return t.dispatch(e,{...a,...s,...n})},KD=GD("input"),YD=GD("beforeinput"),XD=kt(),JD=XD.os,QD=JD.isMacOS()||JD.isiOS(),eA=XD.browser.isFirefox(),tA=(e,t)=>{let o=!1;e.on("keydown",(n=>{o=n.keyCode===Vg.BACKSPACE,n.isDefaultPrevented()||((e,t,o)=>{const n=o.keyCode===Vg.BACKSPACE?"deleteContentBackward":"deleteContentForward",r=e.selection.isCollapsed(),s=r?"character":"selection",a=e=>r?e?"word":"line":"selection";fT([{keyCode:Vg.BACKSPACE,action:hT(BE,e)},{keyCode:Vg.BACKSPACE,action:hT(Hk,e,!1)},{keyCode:Vg.DELETE,action:hT(Hk,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(_k,e,!1)},{keyCode:Vg.DELETE,action:hT(_k,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(dE,e,t,!1)},{keyCode:Vg.DELETE,action:hT(dE,e,t,!0)},{keyCode:Vg.BACKSPACE,action:hT(rb,e,!1)},{keyCode:Vg.DELETE,action:hT(rb,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(qD,e,!1,s)},{keyCode:Vg.DELETE,action:hT(qD,e,!0,s)},...QD?[{keyCode:Vg.BACKSPACE,altKey:!0,action:hT(qD,e,!1,a(!0))},{keyCode:Vg.DELETE,altKey:!0,action:hT(qD,e,!0,a(!0))},{keyCode:Vg.BACKSPACE,metaKey:!0,action:hT(qD,e,!1,a(!1))}]:[{keyCode:Vg.BACKSPACE,ctrlKey:!0,action:hT(qD,e,!1,a(!0))},{keyCode:Vg.DELETE,ctrlKey:!0,action:hT(qD,e,!0,a(!0))}],{keyCode:Vg.BACKSPACE,action:hT(Ik,e,!1)},{keyCode:Vg.DELETE,action:hT(Ik,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(EE,e,!1)},{keyCode:Vg.DELETE,action:hT(EE,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(bk,e,!1)},{keyCode:Vg.DELETE,action:hT(bk,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(hk,e,!1)},{keyCode:Vg.DELETE,action:hT(hk,e,!0)},{keyCode:Vg.BACKSPACE,action:hT(CE,e,!1)},{keyCode:Vg.DELETE,action:hT(CE,e,!0)}],o).filter((t=>e.selection.isEditable())).each((t=>{o.preventDefault(),YD(e,n).isDefaultPrevented()||(t(),KD(e,n))}))})(e,t,n)})),e.on("keyup",(t=>{t.isDefaultPrevented()||((e,t,o)=>{pT([{keyCode:Vg.BACKSPACE,action:hT(Lk,e)},{keyCode:Vg.DELETE,action:hT(Lk,e)},...QD?[{keyCode:Vg.BACKSPACE,altKey:!0,action:hT(kE,e)},{keyCode:Vg.DELETE,altKey:!0,action:hT(kE,e)},...o?[{keyCode:eA?224:91,action:hT(kE,e)}]:[]]:[{keyCode:Vg.BACKSPACE,ctrlKey:!0,action:hT(kE,e)},{keyCode:Vg.DELETE,ctrlKey:!0,action:hT(kE,e)}]],t)})(e,t,o),o=!1}))},oA=(e,t)=>{const o=e.dom,n=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(tr(e)||dr(e)&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}return null})(t.firstChild);e&&/^(UL|OL|DL)$/.test(e.nodeName)&&t.insertBefore(o.doc.createTextNode(qn),t.firstChild)}const r=o.createRng();if(t.normalize(),t.hasChildNodes()){const e=new Wn(t,t);let o,s=t;for(;o=e.current();){if(dr(o)){r.setStart(o,0),r.setEnd(o,0);break}if(n[o.nodeName.toLowerCase()]){r.setStartBefore(o),r.setEndBefore(o);break}s=o,o=e.next()}o||(r.setStart(s,0),r.setEnd(s,0))}else fr(t)?t.nextSibling&&o.isBlock(t.nextSibling)?(r.setStartBefore(t),r.setEndBefore(t)):(r.setStartAfter(t),r.setEndAfter(t)):(r.setStart(t,0),r.setEnd(t,0));e.selection.setRng(r),Wh(e,r)},nA=(e,t)=>{const o=e.getRoot();let n,r=t;for(;r!==o&&r&&"false"!==e.getContentEditable(r);){if("true"===e.getContentEditable(r)){n=r;break}r=r.parentNode}return r!==o?n:o},rA=e=>F.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),sA=e=>{e.innerHTML='
    '},aA=(e,t)=>{sc(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,o)=>{const n=e.dom;F.from(o.style).map(n.parseStyle).each((e=>{const o={...hn(wo.fromDom(t)),...e};n.setStyles(t,o)}));const r=F.from(o.class).map((e=>e.split(/\s+/))),s=F.from(t.className).map((e=>Y(e.split(/\s+/),(e=>""!==e))));Pt(r,s,((e,o)=>{const r=Y(o,(t=>!j(e,t))),s=[...e,...r];n.setAttrib(t,"class",s.join(" "))}));const a=["style","class"],i=Ce(o,((e,t)=>!j(a,t)));n.setAttribs(t,i)})(e,t,ac(e))},iA=(e,t,o,n,r=!0,s,a)=>{const i=e.dom,l=e.schema,c=sc(e),d=o?o.nodeName.toUpperCase():"";let m=t;const u=l.getTextInlineElements();let g;g=s||"TABLE"===d||"HR"===d?i.create(s||c,a||{}):o.cloneNode(!1);let h=g;if(r){do{if(u[m.nodeName]){if(lu(m)||Cu(m))continue;const e=m.cloneNode(!1);i.setAttrib(e,"id",""),g.hasChildNodes()?(e.appendChild(g.firstChild),g.appendChild(e)):(h=e,g.appendChild(e))}}while((m=m.parentNode)&&m!==n)}else i.setAttrib(g,"style",null),i.setAttrib(g,"class",null);return aA(e,g),sA(h),g},lA=(e,t,o)=>!t&&o.nodeName.toLowerCase()===sc(e)&&e.dom.isEmpty(o)&&((e,t,o)=>{let n=t;for(;n&&n!==e&&b(n.nextSibling);){const e=n.parentElement;if(!e||!o(e))return kr(e);n=e}return!1})(e.getBody(),o,(t=>Ee(e.schema.getTextBlockElements(),t.nodeName.toLowerCase()))),cA=(e,t,o)=>{var n,r,s;const a=t(sc(e)),i=((e,t)=>e.dom.getParent(t,kr))(e,o);i&&(e.dom.insertAfter(a,i),oA(e,a),(null!==(s=null===(r=null===(n=o.parentElement)||void 0===n?void 0:n.childNodes)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>1&&e.dom.remove(o))},dA=(e,t)=>{const o=null==e?void 0:e.parentNode;return C(o)&&o.nodeName===t},mA=e=>C(e)&&/^(OL|UL|LI)$/.test(e.nodeName),uA=e=>C(e)&&/^(LI|DT|DD)$/.test(e.nodeName),gA=e=>{const t=e.parentNode;return uA(t)?t:e},hA=(e,t,o)=>{let n=e[o?"firstChild":"lastChild"];for(;n&&!tr(n);)n=n[o?"nextSibling":"previousSibling"];return n===t},pA=e=>J(Se(hn(wo.fromDom(e)),((e,t)=>`${t}: ${e};`)),((e,t)=>e+t),""),fA=(e,t,o,n,r)=>{const s=e.dom,a=e.selection.getRng(),i=o.parentNode;if(o===e.getBody()||!i)return;var l;mA(l=o)&&mA(l.parentNode)&&(r="LI");const c=uA(n)?pA(n):void 0;let d=uA(n)&&c?t(r,{style:pA(n)}):t(r);if(hA(o,n,!0)&&hA(o,n,!1))if(dA(o,"LI")){const e=gA(o);s.insertAfter(d,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(o)?s.remove(e):s.remove(o)}else s.replace(d,o);else if(hA(o,n,!0))dA(o,"LI")?(s.insertAfter(d,gA(o)),d.appendChild(s.doc.createTextNode(" ")),d.appendChild(o)):i.insertBefore(d,o),s.remove(n);else if(hA(o,n,!1))s.insertAfter(d,gA(o)),s.remove(n);else{o=gA(o);const e=a.cloneRange();e.setStartAfter(n),e.setEndAfter(o);const t=e.extractContents();if("LI"===r&&((e,t)=>e.firstChild&&e.firstChild.nodeName===t)(t,"LI")){const e=Y($(d.children,wo.fromDom),R(Qt("br")));d=t.firstChild,s.insertAfter(t,o),q(e,(e=>bn(wo.fromDom(d),e))),c&&d.setAttribute("style",c)}else s.insertAfter(t,o),s.insertAfter(d,o);s.remove(n)}oA(e,d)},vA=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),bA=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,yA=(e,t)=>C(t)&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&e.isEditable(t.parentNode)&&"false"!==e.getContentEditable(t),wA=(e,t,o)=>dr(t)?e?1===o&&t.data.charAt(o-1)===di?0:o:o===t.data.length-1&&t.data.charAt(o)===di?t.data.length:o:o,xA={insert:(e,t)=>{let o,n,r,s,a=!1;const i=e.dom,l=e.schema.getNonEmptyElements(),c=e.selection.getRng(),d=sc(e),m=wo.fromDom(c.startContainer),u=Io(m,c.startOffset),g=u.exists((e=>Gt(e)&&!rn(e))),p=c.collapsed&&g,f=(t,n)=>iA(e,o,k,S,dc(e),t,n),v=e=>{const t=wA(e,o,n);if(dr(o)&&(e?t>0:t{let t;return t=/^(H[1-6]|PRE|FIGURE)$/.test(r)&&"HGROUP"!==_?f(d):f(),((e,t)=>{const o=mc(e);return!x(t)&&(h(o)?j(Lt.explode(o),t.nodeName.toLowerCase()):o)})(e,s)&&yA(i,s)&&i.isEmpty(k,void 0,{includeZwsp:!0})?t=i.split(s,k):i.insertAfter(t,k),oA(e,t),t};wh(i,c).each((e=>{c.setStart(e.startContainer,e.startOffset),c.setEnd(e.endContainer,e.endOffset)})),o=c.startContainer,n=c.startOffset;const y=!(!t||!t.shiftKey),w=!(!t||!t.ctrlKey);tr(o)&&o.hasChildNodes()&&!p&&(a=n>o.childNodes.length-1,o=o.childNodes[Math.min(n,o.childNodes.length-1)]||o,n=a&&dr(o)?o.data.length:0);const S=nA(i,o);if(!S||((e,t)=>{const o=e.dom.getParent(t,"ol,ul,dl");return null!==o&&"false"===e.dom.getContentEditableParent(o)})(e,o))return;y||(o=((e,t,o,n,r)=>{var s,a;const i=e.dom,l=null!==(s=nA(i,n))&&void 0!==s?s:i.getRoot();let c=i.getParent(n,i.isBlock);if(!c||!yA(i,c)){if(c=c||l,!c.hasChildNodes()){const n=i.create(t);return aA(e,n),c.appendChild(n),o.setStart(n,0),o.setEnd(n,0),n}let s,d=n;for(;d&&d.parentNode!==c;)d=d.parentNode;for(;d&&!i.isBlock(d);)s=d,d=d.previousSibling;const m=null===(a=null==s?void 0:s.parentElement)||void 0===a?void 0:a.nodeName;if(s&&m&&e.schema.isValidChild(m,t.toLowerCase())){const a=s.parentNode,l=i.create(t);for(aA(e,l),a.insertBefore(l,s),d=s;d&&!i.isBlock(d);){const e=d.nextSibling;l.appendChild(d),d=e}o.setStart(n,r),o.setEnd(n,r)}}return n})(e,d,c,o,n));let k=i.getParent(o,i.isBlock)||i.getRoot();s=C(null==k?void 0:k.parentNode)?i.getParent(k.parentNode,i.isBlock):null,r=k?k.nodeName.toUpperCase():"";const _=s?s.nodeName.toUpperCase():"";if("LI"!==_||w||(k=s,s=s.parentNode,r=_),tr(s)&&lA(e,y,k))return cA(e,f,k);if(/^(LI|DT|DD)$/.test(r)&&tr(s)&&i.isEmpty(k))return void fA(e,f,s,k,d);if(!(p||k!==e.getBody()&&yA(i,k)))return;const E=k.parentNode;let T;if(p)T=f(d),u.fold((()=>{yn(m,wo.fromDom(T))}),(e=>{fn(e,wo.fromDom(T))})),e.selection.setCursorLocation(T,0);else if(pi(k))T=Si(k),i.isEmpty(k)&&sA(k),aA(e,T),oA(e,T);else if(v(!1))T=b();else if(v(!0)&&E){T=E.insertBefore(f(),k);const t=wo.fromDom(c.startContainer).dom.hasChildNodes()&&c.collapsed;oA(e,bA(k,"HR")||t?T:k)}else{const t=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,wA(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,wA(!1,e.endContainer,e.endOffset)),t})(c).cloneRange();t.setEndAfter(k);const o=t.extractContents();(e=>{q(zn(wo.fromDom(e),Yt),(e=>{const t=e.dom;t.nodeValue=ui(t.data)}))})(o),(e=>{let t=e;do{dr(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild}while(t)})(o),T=o.firstChild,i.insertAfter(o,k),((e,t,o)=>{var n;const r=[];if(!o)return;let s=o;for(;s=s.firstChild;){if(e.isBlock(s))return;tr(s)&&!t[s.nodeName.toLowerCase()]&&r.push(s)}let a=r.length;for(;a--;)s=r[a],(!s.hasChildNodes()||s.firstChild===s.lastChild&&""===(null===(n=s.firstChild)||void 0===n?void 0:n.nodeValue)||vA(e,s))&&e.remove(s)})(i,l,T),((e,t)=>{t.normalize();const o=t.lastChild;(!o||tr(o)&&/^(left|right)$/gi.test(e.getStyle(o,"float",!0)))&&e.add(t,"br")})(i,k),i.isEmpty(k)&&sA(k),T.normalize(),i.isEmpty(T)?(i.remove(T),b()):(aA(e,T),oA(e,T))}i.setAttrib(T,"id",""),e.dispatch("NewBlock",{newBlock:T})},fakeEventName:"insertParagraph"},CA=(e,t,o)=>{const n=e.dom.createRng();o?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),e.selection.setRng(n),Wh(e,n)},SA=(e,t)=>{const o=e.selection,n=e.dom,r=o.getRng();let s,a=!1;wh(n,r).each((e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)}));let i=r.startOffset,l=r.startContainer;if(tr(l)&&l.hasChildNodes()){const e=i>l.childNodes.length-1;l=l.childNodes[Math.min(i,l.childNodes.length-1)]||l,i=e&&dr(l)?l.data.length:0}let c=n.getParent(l,n.isBlock);const d=c&&c.parentNode?n.getParent(c.parentNode,n.isBlock):null,m=d?d.nodeName.toUpperCase():"",u=!(!t||!t.ctrlKey);"LI"!==m||u||(c=d),dr(l)&&i>=l.data.length&&(((e,t,o)=>{const n=new Wn(t,o);let r;const s=e.getNonEmptyElements();for(;r=n.next();)if(s[r.nodeName.toLowerCase()]||dr(r)&&r.length>0)return!0;return!1})(e.schema,l,c||n.getRoot())||(s=n.create("br"),r.insertNode(s),r.setStartAfter(s),r.setEndAfter(s),a=!0)),s=n.create("br"),gl(n,r,s),CA(e,s,a),e.undoManager.add()},kA=(e,t)=>{const o=wo.fromTag("br");fn(wo.fromDom(t),o),e.undoManager.add()},_A=(e,t)=>{EA(e.getBody(),t)||vn(wo.fromDom(t),wo.fromTag("br"));const o=wo.fromTag("br");vn(wo.fromDom(t),o),CA(e,o.dom,!1),e.undoManager.add()},EA=(e,t)=>{return o=ml.after(t),!!fr(o.getNode())||nu(e,ml.after(t)).map((e=>fr(e.getNode()))).getOr(!1);var o},TA=e=>e&&"A"===e.nodeName&&"href"in e,OA=e=>e.fold(I,TA,TA,I),DA=(e,t)=>{t.fold(E,N(kA,e),N(_A,e),E)},AA={insert:(e,t)=>{const o=(e=>{const t=N(hv,e),o=ml.fromRangeStart(e.selection.getRng());return r_(t,e.getBody(),o).filter(OA)})(e);o.isSome()?o.each(N(DA,e)):SA(e,t)},fakeEventName:"insertLineBreak"},MA=(e,t)=>rA(e).filter((e=>t.length>0&&Co(wo.fromDom(e),t))).isSome(),NA=Il([{br:[]},{block:[]},{none:[]}]),RA=(e,t)=>(e=>MA(e,cc(e)))(e),BA=e=>(t,o)=>(e=>rA(e).filter((e=>ni(wo.fromDom(e)))).isSome())(t)===e,LA=(e,t)=>(o,n)=>{const r=(e=>rA(e).fold(D(""),(e=>e.nodeName.toUpperCase())))(o)===e.toUpperCase();return r===t},HA=e=>{const t=nA(e.dom,e.selection.getStart());return x(t)},IA=e=>LA("pre",e),PA=e=>(t,o)=>rc(t)===e,FA=(e,t)=>(e=>MA(e,lc(e)))(e),zA=(e,t)=>t,VA=e=>{const t=sc(e),o=nA(e.dom,e.selection.getStart());return C(o)&&e.schema.isValidChild(o.nodeName,t)},ZA=e=>{const t=e.selection.getRng(),o=wo.fromDom(t.startContainer),n=Io(o,t.startOffset).map((e=>Gt(e)&&!rn(e)));return t.collapsed&&n.getOr(!0)},UA=(e,t)=>(o,n)=>J(e,((e,t)=>e&&t(o,n)),!0)?F.some(t):F.none(),jA=(e,t,o)=>{t.selection.isCollapsed()||(e=>{e.execCommand("delete")})(t),C(o)&&YD(t,e.fakeEventName).isDefaultPrevented()||(e.insert(t,o),C(o)&&KD(t,e.fakeEventName))},WA=(e,t)=>{const o=()=>jA(AA,e,t),n=()=>jA(xA,e,t),r=((e,t)=>Gk([UA([RA],NA.none()),UA([IA(!0),HA],NA.none()),UA([LA("summary",!0)],NA.br()),UA([IA(!0),PA(!1),zA],NA.br()),UA([IA(!0),PA(!1)],NA.block()),UA([IA(!0),PA(!0),zA],NA.block()),UA([IA(!0),PA(!0)],NA.br()),UA([BA(!0),zA],NA.br()),UA([BA(!0)],NA.block()),UA([FA],NA.br()),UA([zA],NA.br()),UA([VA],NA.block()),UA([ZA],NA.block())],[e,!(!t||!t.shiftKey)]).getOr(NA.none()))(e,t);switch(ic(e)){case"linebreak":r.fold(o,o,E);break;case"block":r.fold(n,n,E);break;case"invert":r.fold(n,o,E);break;default:r.fold(o,n,E)}},$A=kt(),qA=$A.os.isiOS()&&$A.browser.isSafari(),GA=(e,t)=>{var o;t.isDefaultPrevented()||(t.preventDefault(),(o=e.undoManager).typing&&(o.typing=!1,o.add()),e.undoManager.transact((()=>{WA(e,t)})))},KA=e=>{let t=F.none();e.on("keydown",(o=>{o.keyCode===Vg.ENTER&&(qA&&(e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(dr(t)){const o=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,n=t.data.charAt(e.startOffset-1);return o.test(n)}return!1})(e.selection.getRng())?(e=>{t=F.some(e.selection.getBookmark()),e.undoManager.add()})(e):GA(e,o))})),e.on("keyup",(o=>{o.keyCode===Vg.ENTER&&t.each((()=>((e,o)=>{e.undoManager.undo(),t.fold(E,(t=>e.selection.moveToBookmark(t))),GA(e,o),t=F.none()})(e,o)))}))},YA=(e,t)=>{e.on("keydown",(o=>{o.isDefaultPrevented()||((e,t,o)=>{const n=Mt.os.isMacOS()||Mt.os.isiOS();pT([{keyCode:Vg.END,action:hT(nT,e,!0)},{keyCode:Vg.HOME,action:hT(nT,e,!1)},...n?[]:[{keyCode:Vg.HOME,action:hT(rT,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Vg.END,action:hT(rT,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Vg.END,action:hT(yT,e,!0)},{keyCode:Vg.HOME,action:hT(yT,e,!1)},{keyCode:Vg.END,action:hT(aE,e,!0,t)},{keyCode:Vg.HOME,action:hT(aE,e,!1,t)}],o).each((e=>{o.preventDefault()}))})(e,t,o)}))},XA=e=>{e.on("input",(t=>{t.isComposing||(e=>{const t=wo.fromDom(e.getBody());e.selection.isCollapsed()&&Jf(t,ml.fromRangeStart(e.selection.getRng()),e.schema).each((t=>{e.selection.setRng(t.toRange())}))})(e)}))},JA=kt(),QA=e=>e.stopImmediatePropagation(),eM=e=>e.keyCode===Vg.PAGE_UP||e.keyCode===Vg.PAGE_DOWN,tM=(e,t,o)=>{o&&!e.get()?t.on("NodeChange",QA,!0):!o&&e.get()&&t.off("NodeChange",QA),e.set(o)},oM=(e,t)=>{if(JA.os.isMacOS())return;const o=xa(!1);e.on("keydown",(t=>{eM(t)&&tM(o,e,!0)})),e.on("keyup",(n=>{n.isDefaultPrevented()||((e,t,o)=>{pT([{keyCode:Vg.PAGE_UP,action:hT(aE,e,!1,t)},{keyCode:Vg.PAGE_DOWN,action:hT(aE,e,!0,t)}],o)})(e,t,n),eM(n)&&o.get()&&(tM(o,e,!1),e.nodeChanged())}))},nM=(e,t)=>{const o=t.container(),n=t.offset();return dr(o)?(o.insertData(n,e),F.some(ml(o,n+e.length))):Bm(t).map((o=>{const n=wo.fromText(e);return t.isAtEnd()?vn(o,n):fn(o,n),ml(n.dom,e.length)}))},rM=N(nM,qn),sM=N(nM," "),aM=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},iM=e=>{const t=ml.fromRangeStart(e.selection.getRng()),o=wo.fromDom(e.getBody());if(e.selection.isCollapsed()){const n=N(hv,e),r=ml.fromRangeStart(e.selection.getRng());return r_(n,e.getBody(),r).bind((e=>t=>t.fold((t=>ru(e.dom,ml.before(t))),(e=>su(e)),(e=>au(e)),(t=>nu(e.dom,ml.after(t)))))(o)).map((n=>()=>((e,t,o)=>n=>Uf(e,n,o)?rM(t):sM(t))(o,t,e.schema)(n).each(aM(e))))}return F.none()},lM=e=>{return Ft(Mt.browser.isFirefox()&&e.selection.isEditable()&&(t=e.dom,o=e.selection.getRng().startContainer,t.isEditable(t.getParent(o,"summary"))),(()=>{const t=wo.fromDom(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete"),((e,t,o)=>Uf(e,t,o)?rM(t):sM(t))(t,ml.fromRangeStart(e.selection.getRng()),e.schema).each(aM(e))}));var t,o},cM=e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{fT([{keyCode:Vg.SPACEBAR,action:hT(iM,e)},{keyCode:Vg.SPACEBAR,action:hT(lM,e)}],t).each((o=>{t.preventDefault(),YD(e,"insertText",{data:" "}).isDefaultPrevented()||(o(),KD(e,"insertText",{data:" "}))}))})(e,t)}))},dM=e=>Pd(e)?[{keyCode:Vg.TAB,action:hT(KT,e,!0)},{keyCode:Vg.TAB,shiftKey:!0,action:hT(KT,e,!1)}]:[],mM=e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{pT([...dM(e)],t).each((e=>{t.preventDefault()}))})(e,t)}))},uM=e=>{if(e.addShortcut("Meta+P","","mcePrint"),RD(e),SC(e))return xa(null);{const t=nE(e);return(e=>{e.on("beforeinput",(t=>{e.selection.isEditable()&&!W(t.getTargetRanges(),(t=>!Cp(e.dom,t)))||t.preventDefault()}))})(e),(e=>{e.on("keyup compositionstart",N(YE,e))})(e),YT(e,t),tA(e,t),KA(e),cM(e),XA(e),mM(e),YA(e,t),oM(e,t),t}};class gM{constructor(e){let t;this.lastPath=[],this.editor=e;const o=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",(o=>{const n=e.selection.getRng(),r={startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset};"nodechange"!==o.type&&gh(r,t)||e.dispatch("SelectionChange"),t=r})),e.on("contextmenu",(()=>{op(e),e.dispatch("SelectionChange")})),e.on("SelectionChange",(()=>{const t=e.selection.getStart(!0);t&&Hu(e)&&!o.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})})),e.on("mouseup",(t=>{!t.isDefaultPrevented()&&Hu(e)&&("IMG"===e.selection.getNode().nodeName?sp.setEditorTimeout(e,(()=>{e.nodeChanged()})):e.nodeChanged())}))}nodeChanged(e={}){const t=this.editor.selection;let o;if(this.editor.initialized&&t&&!Qc(this.editor)&&!this.editor.mode.isReadOnly()){const n=this.editor.getBody();o=t.getStart(!0)||n,o.ownerDocument===this.editor.getDoc()&&this.editor.dom.isChildOf(o,n)||(o=n);const r=[];this.editor.dom.getParent(o,(e=>e===n||(r.push(e),!1))),this.editor.dispatch("NodeChange",{...e,element:o,parents:r})}}isSameElementPath(e){let t;const o=this.editor,n=se(o.dom.getParents(e,P,o.getBody()));if(n.length===this.lastPath.length){for(t=n.length;t>=0&&n[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=n,!0}return this.lastPath=n,!1}}const hM=ja("image"),pM=ja("event"),fM=e=>t=>{t[pM]=e},vM=fM(0),bM=fM(2),yM=fM(1),wM=(xM=0,e=>{const t=e;return F.from(t[pM]).exists((e=>e===xM))});var xM;const CM=ja("mode"),SM=e=>t=>{t[CM]=e},kM=(e,t)=>SM(t)(e),_M=SM(0),EM=SM(2),TM=SM(1),OM=e=>t=>{const o=t;return F.from(o[CM]).exists((t=>t===e))},DM=OM(0),AM=OM(1),MM=["none","copy","link","move"],NM=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],RM=()=>{const e=new window.DataTransfer;let t="move",o="all";const n={get dropEffect(){return t},set dropEffect(e){j(MM,e)&&(t=e)},get effectAllowed(){return o},set effectAllowed(e){wM(n)&&j(NM,e)&&(o=e)},get items(){return((e,t)=>({...t,get length(){return t.length},add:(o,n)=>{if(DM(e)){if(!h(o))return t.add(o);if(!w(n))return t.add(o,n)}return null},remove:o=>{DM(e)&&t.remove(o)},clear:()=>{DM(e)&&t.clear()}}))(n,e.items)},get files(){return AM(n)?Object.freeze({length:0,item:e=>null}):e.files},get types(){return e.types},setDragImage:(t,o,r)=>{var s;DM(n)&&(s={image:t,x:o,y:r},n[hM]=s,e.setDragImage(t,o,r))},getData:t=>AM(n)?"":e.getData(t),setData:(t,o)=>{DM(n)&&e.setData(t,o)},clearData:t=>{DM(n)&&e.clearData(t)}};return _M(n),n},BM=e=>{const t=RM(),o=(e=>{const t=e;return F.from(t[CM])})(e);return EM(e),vM(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,(e=>{const t=e;return F.from(t[hM])})(e).each((e=>t.setDragImage(e.image,e.x,e.y))),q(e.types,(o=>{"Files"!==o&&t.setData(o,e.getData(o))})),q(e.files,(e=>t.items.add(e))),(e=>{const t=e;return F.from(t[pM])})(e).each((e=>{((e,t)=>{fM(t)(e)})(t,e)})),o.each((o=>{kM(e,o),kM(t,o)})),t},LM=(e,t)=>e.setData("text/html",t),HM="x-tinymce/html",IM=D(HM),PM="\x3c!-- "+HM+" --\x3e",FM=e=>PM+e,zM=e=>-1!==e.indexOf(PM),VM=(e,t,o)=>{const n=e.split(/\n\n/),r=((e,t)=>{let o="<"+e;const n=Se(t,((e,t)=>t+'="'+Cs.encodeAllRaw(e)+'"'));return n.length&&(o+=" "+n.join(" ")),o+">"})(t,o),s="",a=$(n,(e=>e.split(/\n/).join("
    ")));return 1===a.length?a[0]:$(a,(e=>r+e+s)).join("")},ZM="%MCEPASTEBIN%",UM=e=>e.dom.get("mcepastebin"),jM=e=>C(e)&&"mcepastebin"===e.id,WM=e=>e===ZM,$M=e=>{const t=xa(null);return{create:()=>((e,t)=>{const{dom:o,selection:n}=e,r=e.getBody();t.set(n.getRng());const s=o.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},ZM);Mt.browser.isFirefox()&&o.setStyle(s,"left","rtl"===o.getStyle(r,"direction",!0)?65535:-65535),o.bind(s,"beforedeactivate focusin focusout",(e=>{e.stopPropagation()})),s.focus(),n.select(s,!0)})(e,t),remove:()=>((e,t)=>{const o=e.dom;if(UM(e)){let n;const r=t.get();for(;n=UM(e);)o.remove(n),o.unbind(n);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>UM(e),getHtml:()=>(e=>{const t=e.dom,o=(e,o)=>{e.appendChild(o),t.remove(o,!0)},[n,...r]=Y(e.getBody().childNodes,jM);q(r,(e=>{o(n,e)}));const s=t.select("div[id=mcepastebin]",n);for(let e=s.length-1;e>=0;e--){const r=t.create("div");n.insertBefore(r,s[e]),o(r,s[e])}return n?n.innerHTML:""})(e),getLastRng:t.get}},qM=(e,t)=>(Lt.each(t,(t=>{e=g(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])})),e),GM=e=>e=qM(e,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,(e,t,o)=>t||o?qn:" "],/
    /g,/
    $/i]),KM=(e,t)=>({content:e,cancelled:t}),YM=(e,t,o)=>{const n=((e,t,o)=>e.dispatch("PastePreProcess",{content:t,internal:o}))(e,t,o),r=((e,t)=>{const o=Ix({sanitize:Ld(e),sandbox_iframes:Vd(e),sandbox_iframes_exclusions:Zd(e),convert_unsafe_embeds:Ud(e)},e.schema);o.addNodeFilter("meta",(e=>{Lt.each(e,(e=>{e.remove()}))}));const n=o.parse(t,{forced_root_block:!1,isRootContent:!0});return Jp({validate:!0},e.schema).serialize(n)})(e,n.content);return e.hasEventListeners("PastePostProcess")&&!n.isDefaultPrevented()?((e,t,o)=>{const n=e.dom.create("div",{style:"display:none"},t),r=((e,t,o)=>e.dispatch("PastePostProcess",{node:t,internal:o}))(e,n,o);return KM(r.node.innerHTML,r.isDefaultPrevented())})(e,r,o):KM(r,n.isDefaultPrevented())},XM=(e,t)=>(e.insertContent(t,{merge:Sd(e),paste:!0}),!0),JM=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),QM=(e,t,o)=>!(e.selection.isCollapsed()||!JM(t))&&((e,t,o)=>(e.undoManager.extra((()=>{o(e,t)}),(()=>{e.execCommand("mceInsertLink",!1,t)})),!0))(e,t,o),eN=(e,t,o)=>!!((e,t)=>JM(t)&&W(Id(e),(e=>$e(t.toLowerCase(),`.${e.toLowerCase()}`))))(e,t)&&((e,t,o)=>(e.undoManager.extra((()=>{o(e,t)}),(()=>{e.insertContent('')})),!0))(e,t,o),tN=(e,t,o)=>{o||!kd(e)?XM(e,t):((e,t)=>{Lt.each([QM,eN,XM],(o=>!o(e,t,XM)))})(e,t)},oN=(e=>{let t=0;return()=>e+t++})("mceclip"),nN=e=>{const t=RM();return LM(t,e),EM(t),t},rN=(e,t,o,n,r)=>{const s=((e,t,o)=>YM(e,t,o))(e,t,o);if(!s.cancelled){const t=s.content,o=()=>tN(e,t,n);r?YD(e,"insertFromPaste",{dataTransfer:nN(t)}).isDefaultPrevented()||(o(),KD(e,"insertFromPaste")):o()}},sN=(e,t,o,n)=>{const r=o||zM(t);rN(e,(e=>e.replace(PM,""))(t),r,!1,n)},aN=(e,t,o)=>{const n=e.dom.encode(t).replace(/\r\n/g,"\n"),r=Jn(n,Ed(e)),s=VM(r,sc(e),ac(e));rN(e,s,!1,!0,o)},iN=e=>{const t={};if(e&&e.types)for(let o=0;ot in e&&e[t].length>0,cN=e=>lN(e,"text/html")||lN(e,"text/plain"),dN=(e,t,o,n)=>{const r=oN(),s=gc(e)&&C(o.name),a=s?((e,t)=>{const o=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return C(o)?e.dom.encode(o[1]):void 0})(e,o.name):r,i=s?o.name:void 0,l=t.create(r,o,n,a,i);return t.add(l),l},mN=e=>{const t=Id(e);return e=>We(e.type,"image/")&&W(t,(t=>(e=>{const t=e.toLowerCase(),o={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Lt.hasOwn(o,t)?"image/"+o[t]:"image/"+t})(t)===e.type))},uN=(e,t,o)=>{const n="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(vd(e)&&n){const s=((e,t)=>{const o=t.items?ne(ue(t.items),(e=>"file"===e.kind?[e.getAsFile()]:[])):[],n=t.files?ue(t.files):[];return Y(o.length>0?o:n,mN(e))})(e,n);if(s.length>0)return t.preventDefault(),(r=s,Promise.all($(r,(e=>cw(e).then((t=>({file:e,uri:t}))))))).then((t=>{o&&e.selection.setRng(o),q(t,(t=>{((e,t)=>{aw(t.uri).each((({data:o,type:n,base64Encoded:r})=>{const s=r?o:btoa(o),a=t.file,i=e.editorUpload.blobCache,l=i.getByData(s,n),c=null!=l?l:dN(e,i,a,s);sN(e,``,!1,!0)}))})(e,t)}))})),!0}return!1},gN=(e,t,o,n,r)=>{let s=GM(o);const a=lN(t,IM())||zM(o),i=!a&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(s),l=JM(s);(WM(s)||!s.length||i&&!l)&&(n=!0),(n||l)&&(s=lN(t,"text/plain")&&i?t["text/plain"]:(e=>{const t=Vs(),o=Ix({},t);let n="";const r=t.getVoidElements(),s=Lt.makeMap("script noscript style textarea video audio iframe object"," "),a=t.getBlockElements(),i=e=>{const o=e.name,l=e;if("br"!==o){if("wbr"!==o)if(r[o]&&(n+=" "),s[o])n+=" ";else{if(3===e.type&&(n+=e.value),!(e.name in t.getVoidElements())){let t=e.firstChild;if(t)do{i(t)}while(t=t.next)}a[o]&&l.next&&(n+="\n","p"===o&&(n+="\n"))}}else n+="\n"};return e=qM(e,[//g]),i(o.parse(e)),n})(s)),WM(s)||(n?aN(e,s,r):sN(e,s,a,r))},hN=(e,t,o)=>{let n;e.on("keydown",(e=>{(e=>Vg.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(n=e.shiftKey&&86===e.keyCode)})),e.on("paste",(r=>{if(r.isDefaultPrevented()||(e=>{var t,o;return Mt.os.isAndroid()&&0===(null===(o=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===o?void 0:o.length)})(r))return;const s="text"===o.get()||n;n=!1;const a=iN(r.clipboardData);!cN(a)&&uN(e,r,t.getLastRng()||e.selection.getRng())||(lN(a,"text/html")?(r.preventDefault(),gN(e,a,a["text/html"],s,!0)):lN(a,"text/plain")&&lN(a,"text/uri-list")?(r.preventDefault(),gN(e,a,a["text/plain"],s,!0)):(t.create(),sp.setEditorTimeout(e,(()=>{const o=t.getHtml();t.remove(),gN(e,a,o,s,!1)}),0)))}))},pN=(e,t,o)=>{hN(e,t,o),(e=>{const t=e=>We(e,"webkit-fake-url"),o=e=>We(e,"data:");e.parser.addNodeFilter("img",((n,r,s)=>{if(!vd(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(s))for(const r of n){const n=r.attr("src");h(n)&&!r.attr("data-mce-object")&&n!==Mt.transparentSrc&&(t(n)||!Td(e)&&o(n))&&r.remove()}}))})(e)},fN=(e,t)=>{e.addCommand("mceTogglePlainTextPaste",(()=>{((e,t)=>{"text"===t.get()?(t.set("html"),zg(e,!1)):(t.set("text"),zg(e,!0)),e.focus()})(e,t)})),e.addCommand("mceInsertClipboardContent",((t,o)=>{o.html&&sN(e,o.html,o.internal,!1),o.text&&aN(e,o.text,!1)}))},vN=(e,t,o,n)=>{((e,t,o)=>{if(!e)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",o),e.setData(IM(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),n()):o(t.html,n)},bN=e=>(t,o)=>{const{dom:n,selection:r}=e,s=n.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=n.create("div",{contenteditable:"true"},t);n.setStyles(s,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),s.appendChild(a),n.add(e.getBody(),s);const i=r.getRng();a.focus();const l=n.createRng();l.selectNodeContents(a),r.setRng(l),sp.setEditorTimeout(e,(()=>{r.setRng(i),n.remove(s),o()}),0)},yN=e=>({html:FM(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),wN=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),xN=e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&wN(e)&&e.selection.isEditable()&&vN(t,yN(e),bN(e),(()=>{if(Mt.browser.isChromium()||Mt.browser.isFirefox()){const t=e.selection.getRng();sp.setEditorTimeout(e,(()=>{e.selection.setRng(t),e.execCommand("Delete")}),0)}else e.execCommand("Delete")}))})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&wN(e)&&vN(t,yN(e),bN(e),E)})(e))},CN=(e,t)=>{var o,n;return Sh.getCaretRangeFromPoint(null!==(o=t.clientX)&&void 0!==o?o:0,null!==(n=t.clientY)&&void 0!==n?n:0,e.getDoc())},SN=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},kN=(e,t)=>{fd(e)&&e.on("dragend dragover draggesture dragdrop drop drag",(e=>{e.preventDefault(),e.stopPropagation()})),vd(e)||e.on("drop",(e=>{const t=e.dataTransfer;t&&(e=>W(e.files,(e=>/^image\//.test(e.type))))(t)&&e.preventDefault()})),e.on("drop",(o=>{if(o.isDefaultPrevented())return;const n=CN(e,o);if(x(n))return;const r=iN(o.dataTransfer),s=lN(r,IM());if((!cN(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&uN(e,o,n))return;const a=r[IM()],i=a||r["text/html"]||r["text/plain"],l=((e,t,o,n)=>{const r=e.getParent(o,(e=>Yr(t,e)));if(!b(e.getParent(o,"summary")))return!0;if(r&&Ee(n,"text/html")){const e=(new DOMParser).parseFromString(n["text/html"],"text/html").body;return!b(e.querySelector(r.nodeName.toLowerCase()))}return!1})(e.dom,e.schema,n.startContainer,r),c=t.get();c&&!l||i&&(o.preventDefault(),sp.setEditorTimeout(e,(()=>{e.undoManager.transact((()=>{(a||c&&l)&&e.execCommand("Delete"),SN(e,n);const t=GM(i);r["text/html"]?sN(e,t,s,!0):aN(e,t,!0)}))})))})),e.on("dragstart",(e=>{t.set(!0)})),e.on("dragover dragend",(o=>{vd(e)&&!t.get()&&(o.preventDefault(),SN(e,CN(e,o))),"dragend"===o.type&&t.set(!1)})),(e=>{e.on("input",(t=>{const o=e=>b(e.querySelector("summary"));if("deleteByDrag"===t.inputType){const t=Y(e.dom.select("details"),o);q(t,(t=>{fr(t.firstChild)&&t.firstChild.remove();const o=e.dom.create("summary");o.appendChild(li().dom),t.prepend(o)}))}}))})(e)},_N=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,EN=e=>Lt.trim(e).replace(_N,Xs).toLowerCase(),TN=(e,t,o)=>{const n=xd(e);if(o||"all"===n||!Cd(e))return t;const r=n?n.split(/[, ]/):[];if(r&&"none"!==n){const o=e.dom,n=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,((e,t,s,a)=>{const i=o.parseStyle(o.decode(s)),l={};for(let e=0;e]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,((e,t,o,n)=>t+' style="'+o+'"'+n)),t},ON=e=>{const t=xa(!1),o=xa(_d(e)?"text":"html"),n=$M(e);(e=>{(Mt.browser.isChromium()||Mt.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",(o=>{o.content=t(e,o.content,o.internal)}))})(e,TN)})(e),fN(e,o),(e=>{const t=t=>o=>{t(e,o)},o=bd(e);S(o)&&e.on("PastePreProcess",t(o));const n=yd(e);S(n)&&e.on("PastePostProcess",t(n))})(e),e.on("PreInit",(()=>{xN(e),kN(e,t),pN(e,n,o)}))},DN=e=>{(e=>{e.on("click",(t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()}))})(e),(e=>{e.parser.addNodeFilter("details",(t=>{const o=Fd(e);q(t,(e=>{"expanded"===o?e.attr("open","open"):"collapsed"===o&&e.attr("open",null)}))})),e.serializer.addNodeFilter("details",(t=>{const o=zd(e);q(t,(e=>{"expanded"===o?e.attr("open","open"):"collapsed"===o&&e.attr("open",null)}))}))})(e)},AN=fr,MN=dr,NN=e=>yr(e.dom),RN=e=>t=>ko(wo.fromDom(e),t),BN=(e,t,o)=>Jo(wo.fromDom(e),(e=>(e=>br(e.dom))(e)||o.isBlock(Wt(e))),RN(t)).getOr(wo.fromDom(t)).dom,LN=(e,t)=>Jo(wo.fromDom(e),NN,RN(t)),HN=(e,t,o)=>{const n=new Wn(e,t),r=o?n.next.bind(n):n.prev.bind(n);let s=e;for(let t=o?e:r();t&&!AN(t);t=r())ji(t)&&(s=t);return s},IN=e=>{const t=((e,t,o)=>{const n=ml.fromRangeStart(e).getNode(),r=BN(n,t,o),s=HN(n,r,!1),a=HN(n,r,!0),i=document.createRange();return LN(s,r).fold((()=>{MN(s)?i.setStart(s,0):i.setStartBefore(s)}),(e=>i.setStartBefore(e.dom))),LN(a,r).fold((()=>{MN(a)?i.setEnd(a,a.data.length):i.setEndAfter(a)}),(e=>i.setEndAfter(e.dom))),i})(e.selection.getRng(),e.getBody(),e.schema);e.selection.setRng(xb(t))};var PN;!function(e){e.Before="before",e.After="after"}(PN||(PN={}));const FN=(e,t)=>Math.abs(e.left-t),zN=(e,t)=>Math.abs(e.right-t),VN=(e,t)=>{const o=((e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)))(e,t)/Math.min(e.height,t.height);return((e,t)=>e.topt.top)(e,t)&&o>.5},ZN=(e,t)=>(e=>J(e,((e,t)=>e.fold((()=>F.some(t)),(e=>{const o=Math.min(t.left,e.left),n=Math.min(t.top,e.top),r=Math.max(t.right,e.right),s=Math.max(t.bottom,e.bottom);return F.some({top:n,right:r,bottom:s,left:o,width:r-o,height:s-n})}))),F.none()))(Y(e,(e=>{return(o=t)>=(n=e).top&&o<=n.bottom;var o,n}))).fold((()=>[[],e]),(t=>{const{pass:o,fail:n}=K(e,(e=>VN(e,t)));return[o,n]})),UN=(e,t,o)=>t>e.left&&t{const r=e=>ji(e.node)?F.some(e):tr(e.node)?jN(ue(e.node.childNodes),t,o,!1):F.none(),s=(e,s)=>{const a=le(e,((e,n)=>s(e,t,o)-s(n,t,o)));return ge(a,r).map((e=>n&&!dr(e.node)&&a.length>1?((e,n,s)=>r(n).filter((n=>Math.abs(s(e,t,o)-s(n,t,o))<2&&dr(n.node))))(e,a[1],s).getOr(e):e))},[a,i]=ZN(H_(e),o),{pass:l,fail:c}=K(i,(e=>e.tops(c,Mi))).orThunk((()=>s(l,Mi)))},WN=(e,t,o)=>{const n=wo.fromDom(e),r=To(n),s=wo.fromPoint(r,t,o).filter((e=>_o(n,e))).getOr(n);return((e,t,o,n)=>{const r=(t,s)=>{const a=Y(t.dom.childNodes,R((e=>tr(e)&&e.classList.contains("mce-drag-container"))));return s.fold((()=>jN(a,o,n,!0)),(e=>{const t=Y(a,(t=>t!==e.dom));return jN(t,o,n,!0)})).orThunk((()=>(ko(t,e)?F.none():Ao(t)).bind((e=>r(e,F.some(t))))))};return r(t,F.none())})(n,s,t,o)},$N=(e,t,o)=>WN(e,t,o).filter((e=>cm(e.node))).map((e=>((e,t)=>({node:e.node,position:FN(e,t){var t,o;const n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.documentElement,a=r.defaultView;return{top:n.top+(null!==(t=null==a?void 0:a.scrollY)&&void 0!==t?t:0)-s.clientTop,left:n.left+(null!==(o=null==a?void 0:a.scrollX)&&void 0!==o?o:0)-s.clientLeft}},GN=(e,t)=>{return o=(e=>e.inline?qN(e.getBody()):{left:0,top:0})(e),n=(e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}})(e),r=((e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const o=qN(e.getContentAreaContainer()),n=(e=>{const t=e.getBody(),o=e.getDoc().documentElement,n={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||o.scrollLeft,top:t.scrollTop||o.scrollTop};return e.inline?n:r})(e);return{left:t.pageX-o.left+n.left,top:t.pageY-o.top+n.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-o.left+n.left,pageY:r.top-o.top+n.top};var o,n,r},KN=e=>({target:e,srcElement:e}),YN=(e,t,o,n)=>{const r=((e,t)=>{const o=BM(e);return"dragstart"===t?(vM(o),_M(o)):"drop"===t?(bM(o),EM(o)):(yM(o),TM(o)),o})(o,e);return w(n)?((e,t,o)=>{const n=B("Function not supported on simulated event.");return{bubbles:!0,cancelBubble:!1,cancelable:!0,composed:!1,currentTarget:null,defaultPrevented:!1,eventPhase:0,isTrusted:!0,returnValue:!1,timeStamp:0,type:e,composedPath:n,initEvent:n,preventDefault:E,stopImmediatePropagation:E,stopPropagation:E,AT_TARGET:window.Event.AT_TARGET,BUBBLING_PHASE:window.Event.BUBBLING_PHASE,CAPTURING_PHASE:window.Event.CAPTURING_PHASE,NONE:window.Event.NONE,altKey:!1,button:0,buttons:0,clientX:0,clientY:0,ctrlKey:!1,metaKey:!1,movementX:0,movementY:0,offsetX:0,offsetY:0,pageX:0,pageY:0,relatedTarget:null,screenX:0,screenY:0,shiftKey:!1,x:0,y:0,detail:0,view:null,which:0,initUIEvent:n,initMouseEvent:n,getModifierState:n,dataTransfer:o,...KN(t)}})(e,t,r):((e,t,o,n)=>({...t,dataTransfer:n,type:e,...KN(o)}))(e,n,t,r)},XN=yr,JN=((...e)=>t=>{for(let o=0;o{const r=e.dom,s=t.cloneNode(!0);r.setStyles(s,{width:o,height:n}),r.setAttrib(s,"data-mce-selected",null);const a=r.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return r.setStyles(a,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:o,height:n}),r.setStyles(s,{margin:0,boxSizing:"border-box"}),a.appendChild(s),a},eR=(e,t)=>o=>()=>{const n="left"===e?o.scrollX:o.scrollY;o.scroll({[e]:n+t,behavior:"smooth"})},tR=eR("left",-32),oR=eR("left",32),nR=eR("top",-32),rR=eR("top",32),sR=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},aR=(e,t)=>o=>{if((e=>0===e.button)(o)){const n=ee(t.dom.getParents(o.target),JN).getOr(null);if(C(n)&&((e,t,o)=>XN(o)&&o!==t&&e.isEditable(o.parentElement))(t.dom,t.getBody(),n)){const r=t.dom.getPos(n),s=t.getBody(),a=t.getDoc().documentElement;e.set({element:n,dataTransfer:RM(),dragging:!1,screenX:o.screenX,screenY:o.screenY,maxX:(t.inline?s.scrollWidth:a.offsetWidth)-2,maxY:(t.inline?s.scrollHeight:a.offsetHeight)-2,relX:o.pageX-r.x,relY:o.pageY-r.y,width:n.offsetWidth,height:n.offsetHeight,ghost:QN(t,n,n.offsetWidth,n.offsetHeight),intervalId:Ta(100)})}}},iR=(e,t,o,n,r)=>{"dragstart"===t&&LM(n,e.dom.getOuterHTML(o));const s=YN(t,o,n,r);return e.dispatch(t,s)},lR=(e,t)=>{const o=Da(((e,o)=>((e,t,o)=>{e._selectionOverrides.hideFakeCaret(),$N(e.getBody(),t,o).fold((()=>e.selection.placeCaretAt(t,o)),(n=>{const r=e._selectionOverrides.showCaret(1,n.node,n.position===PN.Before,!1);r?e.selection.setRng(r):e.selection.placeCaretAt(t,o)}))})(t,e,o)),0);t.on("remove",o.cancel);const n=e;return r=>e.on((e=>{const s=Math.max(Math.abs(r.screenX-e.screenX),Math.abs(r.screenY-e.screenY));if(!e.dragging&&s>10){const o=iR(t,"dragstart",e.element,e.dataTransfer,r);if(C(o.dataTransfer)&&(e.dataTransfer=o.dataTransfer),o.isDefaultPrevented())return;e.dragging=!0,t.focus()}if(e.dragging){const s=r.currentTarget===t.getDoc().documentElement,l=((e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}))(e,GN(t,r));a=e.ghost,i=t.getBody(),a.parentNode!==i&&i.appendChild(a),((e,t,o,n,r,s,a,i,l,c,d,m)=>{let u=0,g=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+o>r&&(u=t.pageX+o-r),t.pageY+n>s&&(g=t.pageY+n-s),e.style.width=o-u+"px",e.style.height=n-g+"px";const h=l.clientHeight,p=l.clientWidth,f=a+l.getBoundingClientRect().top,v=i+l.getBoundingClientRect().left;d.on((e=>{e.intervalId.clear(),e.dragging&&m&&(a+8>=h?e.intervalId.set(rR(c)):a-8<=0?e.intervalId.set(nR(c)):i+8>=p?e.intervalId.set(oR(c)):i-8<=0?e.intervalId.set(tR(c)):f+16>=window.innerHeight?e.intervalId.set(rR(window)):f-16<=0?e.intervalId.set(nR(window)):v+16>=window.innerWidth?e.intervalId.set(oR(window)):v-16<=0&&e.intervalId.set(tR(window)))}))})(e.ghost,l,e.width,e.height,e.maxX,e.maxY,r.clientY,r.clientX,t.getContentAreaContainer(),t.getWin(),n,s),o.throttle(r.clientX,r.clientY)}var a,i}))},cR=(e,t)=>o=>{e.on((e=>{var n;if(e.intervalId.clear(),e.dragging){if(((e,t,o)=>!x(t)&&t!==o&&!e.dom.isChildOf(t,o)&&e.dom.isEditable(t))(t,(e=>{const t=e.getSel();if(C(t)){const e=t.getRangeAt(0).startContainer;return dr(e)?e.parentNode:e}return null})(t.selection),e.element)){const r=null!==(n=t.getDoc().elementFromPoint(o.clientX,o.clientY))&&void 0!==n?n:t.getBody();iR(t,"drop",r,e.dataTransfer,o).isDefaultPrevented()||t.undoManager.transact((()=>{((e,t)=>{const o=e.getParent(t.parentNode,e.isBlock);sR(t),o&&o!==e.getRoot()&&e.isEmpty(o)&&ci(wo.fromDom(o))})(t.dom,e.element),(e=>{const t=e.getData("text/html");return""===t?F.none():F.some(t)})(e.dataTransfer).each((e=>t.insertContent(e))),t._selectionOverrides.hideFakeCaret()}))}iR(t,"dragend",t.getBody(),e.dataTransfer,o)}})),mR(e)},dR=(e,t,o)=>{e.on((e=>{e.intervalId.clear(),e.dragging&&o.fold((()=>iR(t,"dragend",e.element,e.dataTransfer)),(o=>iR(t,"dragend",e.element,e.dataTransfer,o)))})),mR(e)},mR=e=>{e.on((e=>{e.intervalId.clear(),sR(e.ghost)})),e.clear()},uR=e=>{const t=Oa(),o=ba.DOM,n=document,r=aR(t,e),s=lR(t,e),a=cR(t,e),i=((e,t)=>o=>dR(e,t,F.some(o)))(t,e);e.on("mousedown",r),e.on("mousemove",s),e.on("mouseup",a),o.bind(n,"mousemove",s),o.bind(n,"mouseup",i),e.on("remove",(()=>{o.unbind(n,"mousemove",s),o.unbind(n,"mouseup",i)})),e.on("keydown",(o=>{o.keyCode===Vg.ESC&&dR(t,e,F.none())}))},gR=e=>{uR(e),sd(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const o=t.dataTransfer;o&&(j(o.types,"Files")||o.files.length>0)&&(t.preventDefault(),"drop"===t.type&&xS(e,"Dropped file type is not supported"))}},o=o=>{dp(e,o.target)&&t(o)},n=()=>{const n=ba.DOM,r=e.dom,s=document,a=e.inline?e.getBody():e.getDoc(),i=["drop","dragover"];q(i,(e=>{n.bind(s,e,o),r.bind(a,e,t)})),e.on("remove",(()=>{q(i,(e=>{n.unbind(s,e,o),r.unbind(a,e,t)}))}))};e.on("init",(()=>{sp.setEditorTimeout(e,n,0)}))})(e)},hR=yr,pR=(e,t)=>sb(e.getBody(),t),fR=e=>{const t=e.selection,o=e.dom,n=e.getBody(),r=am(e,n,o.isBlock,(()=>bp(e))),s="sel-"+o.uniqueId(),a="data-mce-selected";let i;const l=e=>e!==n&&(hR(e)||Cr(e))&&o.isChildOf(e,n)&&o.isEditable(e.parentNode),c=(o,n,s,a=!0)=>e.dispatch("ShowCaret",{target:n,direction:o,before:s}).isDefaultPrevented()?null:(a&&t.scrollIntoView(n,-1===o),r.show(s,n)),d=()=>{e.on("click",(t=>{o.isEditable(t.target)||(t.preventDefault(),e.focus())})),e.on("blur NewBlock",f),e.on("ResizeWindow FullscreenStateChanged",r.reposition),e.on("tap",(t=>{const o=t.target,n=pR(e,o);hR(n)?(t.preventDefault(),wk(e,n).each(p)):l(o)&&wk(e,o).each(p)}),!0),e.on("mousedown",(r=>{const s=r.target;if(s!==n&&"HTML"!==s.nodeName&&!o.isChildOf(s,n))return;if(!hS(e,r.clientX,r.clientY))return;f(),v();const a=pR(e,s);hR(a)?(r.preventDefault(),wk(e,a).each(p)):$N(n,r.clientX,r.clientY).each((o=>{r.preventDefault(),(e=>{e&&t.setRng(e)})(c(1,o.node,o.position===PN.Before,!1)),or(a)?a.focus():e.getBody().focus()}))})),e.on("keypress",(e=>{Vg.modifierPressed(e)||hR(t.getNode())&&e.preventDefault()})),e.on("GetSelectionRange",(e=>{let t=e.range;if(i){if(!i.parentNode)return void(i=null);t=t.cloneRange(),t.selectNode(i),e.range=t}})),e.on("SetSelectionRange",(e=>{e.range=g(e.range);const t=p(e.range,e.forward);t&&(e.range=t)})),e.on("AfterSetSelectionRange",(e=>{const t=e.range,n=t.startContainer.parentElement;var r;u(t)||tr(r=n)&&"mcepastebin"===r.id||v(),(e=>C(e)&&o.hasClass(e,"mce-offscreen-selection"))(n)||f()})),gR(e),(e=>{const t=Da((()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const o=xk(e,t,!1);e.selection.setRng(o)}}}),0);e.on("focus",(()=>{t.throttle()})),e.on("blur",(()=>{t.cancel()}))})(e),(e=>{e.on("init",(()=>{e.on("focusin",(t=>{const o=t.target;if(Cr(o)){const t=sb(e.getBody(),o),n=yr(t)?t:o;e.selection.getNode()!==n&&wk(e,n).each((t=>e.selection.setRng(t)))}}))}))})(e)},m=e=>vi(e)||xi(e)||Ci(e),u=e=>m(e.startContainer)||m(e.endContainer),g=t=>{const n=e.schema.getVoidElements(),r=o.createRng(),s=t.startContainer,a=t.startOffset,i=t.endContainer,l=t.endOffset;return Ee(n,s.nodeName.toLowerCase())?0===a?r.setStartBefore(s):r.setStartAfter(s):r.setStart(s,a),Ee(n,i.nodeName.toLowerCase())?0===l?r.setEndBefore(i):r.setEndAfter(i):r.setEnd(i,l),r},h=n=>{const r=n.cloneNode(!0),l=e.dispatch("ObjectSelected",{target:n,targetClone:r});if(l.isDefaultPrevented())return null;const c=((n,r)=>{const a=wo.fromDom(e.getBody()),i=e.getDoc(),l=on(a,"#"+s).getOrThunk((()=>{const e=wo.fromHtml('
    ',i);return to(e,"id",s),yn(a,e),e})),c=o.createRng();Cn(l),xn(l,[wo.fromText(qn,i),wo.fromDom(r),wo.fromText(qn,i)]),c.setStart(l.dom.firstChild,1),c.setEnd(l.dom.lastChild,0),dn(l,{top:o.getPos(n,e.getBody()).y+"px"}),$h(l);const d=t.getSel();return d&&(d.removeAllRanges(),d.addRange(c)),c})(n,l.targetClone),d=wo.fromDom(n);return q(Vn(wo.fromDom(e.getBody()),`*[${a}]`),(e=>{ko(d,e)||ao(e,a)})),o.getAttrib(n,a)||n.setAttribute(a,"1"),i=n,v(),c},p=(e,t)=>{if(!e)return null;if(e.collapsed){if(!u(e)){const r=t?1:-1,s=Rm(r,n,e),a=s.getNode(!t);if(C(a)){if(cm(a))return c(r,a,!!t&&!s.isAtEnd(),!1);if(fi(a)&&yr(a.nextSibling)){const e=o.createRng();return e.setStart(a,0),e.setEnd(a,0),e}}const i=s.getNode(t);if(C(i)){if(cm(i))return c(r,i,!t&&!s.isAtEnd(),!1);if(fi(i)&&yr(i.previousSibling)){const e=o.createRng();return e.setStart(i,1),e.setEnd(i,1),e}}}return null}let r=e.startContainer,s=e.startOffset;const a=e.endOffset;if(dr(r)&&0===s&&hR(r.parentNode)&&(r=r.parentNode,s=o.nodeIndex(r),r=r.parentNode),!tr(r))return null;if(a===s+1&&r===e.endContainer){const e=r.childNodes[s];if(l(e))return h(e)}return null},f=()=>{i&&i.removeAttribute(a),on(wo.fromDom(e.getBody()),"#"+s).each(Sn),i=null},v=()=>{r.hide()};return SC(e)||d(),{showCaret:c,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(Si(e),t.scrollIntoView(e))},hideFakeCaret:v,destroy:()=>{r.destroy(),i=null}}},vR=(e,t)=>{let o=t;for(let t=e.previousSibling;dr(t);t=t.previousSibling)o+=t.data.length;return o},bR=(e,t,o,n,r)=>{if(dr(o)&&(n<0||n>o.data.length))return[];const s=r&&dr(o)?[vR(o,n)]:[n];let a=o;for(;a!==t&&a.parentNode;)s.push(e.nodeIndex(a,r)),a=a.parentNode;return a===t?s.reverse():[]},yR=(e,t,o,n,r,s,a=!1)=>({start:bR(e,t,o,n,a),end:bR(e,t,r,s,a)}),wR=(e,t)=>{const o=t.slice(),n=o.pop();return k(n)?J(o,((e,t)=>e.bind((e=>F.from(e.childNodes[t])))),F.some(e)).bind((e=>dr(e)&&(n<0||n>e.data.length)?F.none():F.some({node:e,offset:n}))):F.none()},xR=(e,t)=>wR(e,t.start).bind((({node:o,offset:n})=>wR(e,t.end).map((({node:e,offset:t})=>{const r=document.createRange();return r.setStart(o,n),r.setEnd(e,t),r})))),CR=(e,t,o)=>{if(t&&e.isEmpty(t)&&!o(t)){const n=t.parentNode;e.remove(t,dr(t.firstChild)&&Yn(t.firstChild.data)),CR(e,n,o)}},SR=(e,t,o,n=!0)=>{const r=t.startContainer.parentNode,s=t.endContainer.parentNode;t.deleteContents(),n&&!o(t.startContainer)&&(dr(t.startContainer)&&0===t.startContainer.data.length&&e.remove(t.startContainer),dr(t.endContainer)&&0===t.endContainer.data.length&&e.remove(t.endContainer),CR(e,r,o),r!==s&&CR(e,s,o))},kR=(e,t)=>F.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),_R=(e,t,o)=>{const n=e.dynamicPatternsLookup({text:o,block:t});return{...e,blockPatterns:Vl(n).concat(e.blockPatterns),inlinePatterns:Zl(n).concat(e.inlinePatterns)}},ER=(e,t,o,n)=>{const r=e.createRng();return r.setStart(t,0),r.setEnd(o,n),r.toString()},TR=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),OR=(e,t)=>{const o=e.createRng();return o.setStartAfter(t.start),o.setEndBefore(t.end),o},DR=(e,t,o)=>{const n=xR(e.getRoot(),o).getOrDie("Unable to resolve path range"),r=n.startContainer,s=n.endContainer,a=0===n.endOffset?s:s.splitText(n.endOffset),i=0===n.startOffset?r:r.splitText(n.startOffset),l=i.parentNode;return{prefix:t,end:a.parentNode.insertBefore(TR(e,t+"-end"),a),start:l.insertBefore(TR(e,t+"-start"),i)}},AR=(e,t,o)=>{CR(e,e.get(t.prefix+"-end"),o),CR(e,e.get(t.prefix+"-start"),o)},MR=e=>0===e.start.length,NR=(e,t,o,n)=>{const r=t.start;var s;return nO(e,n.container,n.offset,(s=r,(e,t)=>{const o=e.data.substring(0,t),n=o.lastIndexOf(s.charAt(s.length-1)),r=o.lastIndexOf(s);return-1!==r?r+s.length:-1!==n?n+1:-1}),o).bind((n=>{var s,a;const i=null!==(a=null===(s=o.textContent)||void 0===s?void 0:s.indexOf(r))&&void 0!==a?a:-1;if(-1!==i&&n.offset>=i+r.length){const t=e.createRng();return t.setStart(n.container,n.offset-r.length),t.setEnd(n.container,n.offset),F.some(t)}{const s=n.offset-r.length;return tO(n.container,s,o).map((t=>{const o=e.createRng();return o.setStart(t.container,t.offset),o.setEnd(n.container,n.offset),o})).filter((e=>e.toString()===r)).orThunk((()=>NR(e,t,o,XT(n.container,0))))}}))},RR=(e,t,o,n)=>{const r=e.dom,s=r.getRoot(),a=o.pattern,i=o.position.container,l=o.position.offset;return tO(i,l-o.pattern.end.length,t).bind((c=>{const d=yR(r,s,c.container,c.offset,i,l,n);if(MR(a))return F.some({matches:[{pattern:a,startRng:d,endRng:d}],position:c});{const i=BR(e,o.remainingPatterns,c.container,c.offset,t,n),l=i.getOr({matches:[],position:c}),m=l.position,u=((e,t,o,n,r,s=!1)=>{if(0===t.start.length&&!s){const t=e.createRng();return t.setStart(o,n),t.setEnd(o,n),F.some(t)}return eO(o,n,r).bind((o=>NR(e,t,r,o).bind((e=>{var t;if(s){if(e.endContainer===o.container&&e.endOffset===o.offset)return F.none();if(0===o.offset&&(null===(t=e.endContainer.textContent)||void 0===t?void 0:t.length)===e.endOffset)return F.none()}return F.some(e)}))))})(r,a,m.container,m.offset,t,i.isNone());return u.map((e=>{const t=((e,t,o,n=!1)=>yR(e,t,o.startContainer,o.startOffset,o.endContainer,o.endOffset,n))(r,s,e,n);return{matches:l.matches.concat([{pattern:a,startRng:t,endRng:d}]),position:XT(e.startContainer,e.startOffset)}}))}}))},BR=(e,t,o,n,r,s)=>{const a=e.dom;return eO(o,n,a.getRoot()).bind((i=>{const l=ER(a,r,o,n);for(let a=0;a0)return BR(e,t,o,n-1,r,s);if(m.isSome())return m}return F.none()}))},LR=(e,t,o)=>{e.selection.setRng(o),"inline-format"===t.type?q(t.format,(t=>{e.formatter.apply(t)})):e.execCommand(t.cmd,!1,t.value)},HR=(e,t,o,n,r,s)=>{var a;return((e,t)=>{const o=re(e,(e=>W(t,(t=>e.pattern.start===t.pattern.start&&e.pattern.end===t.pattern.end))));return e.length===t.length?o?e:t:e.length>t.length?e:t})(BR(e,r.inlinePatterns,o,n,t,s).fold((()=>[]),(e=>e.matches)),BR(e,(a=r.inlinePatterns,le(a,((e,t)=>t.end.length-e.end.length))),o,n,t,s).fold((()=>[]),(e=>e.matches)))},IR=(e,t)=>{if(0===t.length)return;const o=e.dom,n=e.selection.getBookmark(),r=((e,t)=>{const o=ja("mce_textpattern"),n=X(t,((t,n)=>{const r=DR(e,o+`_end${t.length}`,n.endRng);return t.concat([{...n,endMarker:r}])}),[]);return X(n,((t,r)=>{const s=n.length-t.length-1,a=MR(r.pattern)?r.endMarker:DR(e,o+`_start${s}`,r.startRng);return t.concat([{...r,startMarker:a}])}),[])})(o,t);q(r,(t=>{const n=o.getParent(t.startMarker.start,o.isBlock),r=e=>e===n;MR(t.pattern)?((e,t,o,n)=>{const r=OR(e.dom,o);SR(e.dom,r,n),LR(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,o,n,r)=>{const s=e.dom,a=OR(s,n),i=OR(s,o);SR(s,i,r),SR(s,a,r);const l={prefix:o.prefix,start:o.end,end:n.start},c=OR(s,l);LR(e,t,c)})(e,t.pattern,t.startMarker,t.endMarker,r),AR(o,t.endMarker,r),AR(o,t.startMarker,r)})),e.selection.moveToBookmark(n)},PR=(e,t,o)=>((e,t,o)=>{if(dr(e)&&t>=e.length)return F.some(XT(e,t));{const n=Ya(JT);return F.from(n.forwards(e,t,QT(e),o)).map((e=>XT(e.container,0)))}})(t,0,t).map((n=>{const r=n.container;return oO(r,o.start.length,t).each((o=>{const n=e.createRng();n.setStart(r,0),n.setEnd(o.container,o.offset),SR(e,n,(e=>e===t))})),r})),FR=e=>(t,o)=>{const n=t.dom,r=o.pattern,s=xR(n.getRoot(),o.range).getOrDie("Unable to resolve path range");return kR(t,s).each((o=>{"block-format"===r.type?((e,t)=>{const o=t.get(e);return v(o)&&de(o).exists((e=>Ee(e,"block")))})(r.format,t.formatter)&&t.undoManager.transact((()=>{e(t.dom,o,r),t.formatter.apply(r.format)})):"block-command"===r.type&&t.undoManager.transact((()=>{e(t.dom,o,r),t.execCommand(r.cmd,!1,r.value)}))})),!0},zR=e=>(t,o)=>{const n=(e=>le(e,((e,t)=>t.start.length-e.start.length)))(t),r=o.replace(qn," ");return ee(n,(t=>e(t,o,r)))},VR=(e,t)=>(o,n,r,s,a)=>{var i;void 0===a&&(a=null!==(i=n.textContent)&&void 0!==i?i:"");const l=o.dom,c=sc(o);return l.is(n,c)?e(r.blockPatterns,a).map((e=>t&&Lt.trim(a).length===e.start.length?[]:[{pattern:e,range:yR(l,l.getRoot(),n,0,n,0,s)}])).getOr([]):[]},ZR=FR(((e,t,o)=>{PR(e,t,o).each((e=>{const t=wo.fromDom(e),o=Ja(t);/^\s[^\s]/.test(o)&&((e,t)=>{Xa.set(e,t)})(t,o.slice(1))}))})),UR=zR(((e,t,o)=>0===t.indexOf(e.start)||0===o.indexOf(e.start))),jR=VR(UR,!0),WR=FR(PR),$R=zR(((e,t,o)=>t===e.start||o===e.start)),qR=VR($R,!1),GR=(e,t)=>((e,t)=>{const o=e.selection.getRng();return kR(e,o).map((n=>{var r;const s=Math.max(0,o.startOffset),a=_R(t,n,null!==(r=n.textContent)&&void 0!==r?r:"");return{inlineMatches:HR(e,n,o.startContainer,s,a,!0),blockMatches:jR(e,n,a,!0)}})).filter((({inlineMatches:e,blockMatches:t})=>t.length>0||e.length>0))})(e,t).fold(I,(({inlineMatches:t,blockMatches:o})=>(e.undoManager.add(),e.undoManager.extra((()=>{e.execCommand("mceInsertNewLine")}),(()=>{(e=>{e.insertContent(di,{preserve_zwsp:!0})})(e),IR(e,t),((e,t)=>{if(0===t.length)return;const o=e.selection.getBookmark();q(t,(t=>ZR(e,t))),e.selection.moveToBookmark(o)})(e,o);const n=e.selection.getRng(),r=eO(n.startContainer,n.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),r.each((t=>{const o=t.container;o.data.charAt(t.offset-1)===$n&&(o.deleteData(t.offset-1,1),CR(e.dom,o.parentNode,(t=>t===e.dom.getRoot())))}))})),!0))),KR=(e,t)=>((e,t)=>{const o=e.selection.getRng();return kR(e,o).map((n=>{const r=Math.max(0,o.startOffset),s=ER(e.dom,n,o.startContainer,r),a=_R(t,n,s);return qR(e,n,a,!1,s)})).filter((e=>e.length>0))})(e,t).fold(I,(t=>(e.undoManager.transact((()=>{((e,t)=>{q(t,(t=>WR(e,t)))})(e,t)})),!0))),YR=(e,t,o)=>{for(let n=0;n{const t=[",",".",";",":","!","?"],o=[32],n=()=>{return t=Od(e),o=Dd(e),{inlinePatterns:Zl(t),blockPatterns:Vl(t),dynamicPatternsLookup:o};var t,o},r=()=>(e=>e.options.isSet("text_patterns_lookup"))(e);e.on("keydown",(t=>{if(13===t.keyCode&&!Vg.modifierPressed(t)&&e.selection.isCollapsed()){const o=Ul(n(),"enter");(o.inlinePatterns.length>0||o.blockPatterns.length>0||r())&&GR(e,o)&&t.preventDefault()}}),!0),e.on("keydown",(t=>{if(32===t.keyCode&&e.selection.isCollapsed()){const o=Ul(n(),"space");(o.blockPatterns.length>0||r())&&KR(e,o)&&t.preventDefault()}}),!0);const s=()=>{if(e.selection.isCollapsed()){const t=Ul(n(),"space");(t.inlinePatterns.length>0||r())&&((e,t)=>{const o=e.selection.getRng();kR(e,o).map((n=>{const r=Math.max(0,o.startOffset-1),s=ER(e.dom,n,o.startContainer,r),a=_R(t,n,s),i=HR(e,n,o.startContainer,r,a,!1);i.length>0&&e.undoManager.transact((()=>{IR(e,i)}))}))})(e,t)}};e.on("keyup",(e=>{YR(o,e,((e,t)=>e===t.keyCode&&!Vg.modifierPressed(t)))&&s()})),e.on("keypress",(o=>{YR(t,o,((e,t)=>e.charCodeAt(0)===t.charCode))&&sp.setEditorTimeout(e,s)}))},JR=e=>{const t=Lt.each,o=Vg.BACKSPACE,n=Vg.DELETE,r=e.dom,s=e.selection,a=e.parser,i=Mt.browser,l=i.isFirefox(),c=i.isChromium()||i.isSafari(),d=Mt.deviceType.isiPhone()||Mt.deviceType.isiPad(),m=Mt.os.isMacOS()||Mt.os.isiOS(),u=(t,o)=>{try{e.getDoc().execCommand(t,!1,String(o))}catch(e){}},g=e=>e.isDefaultPrevented(),h=()=>{const t=e=>{const t=r.create("body"),o=e.cloneContents();return t.appendChild(o),s.serializer.serialize(t,{format:"html"})};e.on("keydown",(s=>{const a=s.keyCode;if(!g(s)&&(a===n||a===o)&&e.selection.isEditable()){const o=e.selection.isCollapsed(),n=e.getBody();if(o&&!Nr(e.schema,n))return;if(!o&&!(o=>{const n=t(o),s=r.createRng();return s.selectNode(e.getBody()),n===t(s)})(e.selection.getRng()))return;s.preventDefault(),e.setContent(""),n.firstChild&&r.isBlock(n.firstChild)?e.selection.setCursorLocation(n.firstChild,0):e.selection.setCursorLocation(n,0),e.nodeChanged()}}))},p=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},f=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",(t=>{let o;if(t.target===e.getDoc().documentElement)if(o=s.getRng(),e.getBody().focus(),"mousedown"===t.type){if(vi(o.startContainer))return;s.placeCaretAt(t.clientX,t.clientY)}else s.setRng(o)}))},v=()=>{Range.prototype.getClientRects||e.on("mousedown",(t=>{if(!g(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),sp.setEditorTimeout(e,(()=>{t.focus()}))}}))},b=()=>{const t=ld(e);e.on("click",(o=>{const n=o.target;/^(IMG|HR)$/.test(n.nodeName)&&r.isEditable(n)&&(o.preventDefault(),e.selection.select(n),e.nodeChanged()),"A"===n.nodeName&&r.hasClass(n,t)&&0===n.childNodes.length&&r.isEditable(n.parentNode)&&(o.preventDefault(),s.select(n))}))},y=()=>{e.on("keydown",(e=>{if(!g(e)&&e.keyCode===o&&s.isCollapsed()&&0===s.getRng().startOffset){const t=s.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}return!0}))},w=()=>{const t=()=>{u("StyleWithCSS",!1),u("enableInlineTableEditing",!1),Nc(e)||u("enableObjectResizing",!1)};ed(e)||e.on("BeforeExecCommand mousedown",t)},x=()=>{e.on("SetContent ExecCommand",(e=>{"setcontent"!==e.type&&"mceInsertLink"!==e.command||t(r.select("a:not([data-mce-block])"),(e=>{var t;let o=e.parentNode;const n=r.getRoot();if((null==o?void 0:o.lastChild)===e){for(;o&&!r.isBlock(o);){if((null===(t=o.parentNode)||void 0===t?void 0:t.lastChild)!==o||o===n)return;o=o.parentNode}r.add(o,"br",{"data-mce-bogus":1})}}))}))},C=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},S=()=>{e.inline||e.on("keydown",(()=>{document.activeElement===document.body&&e.getWin().focus()}))},k=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",(t=>{let o;"HTML"===t.target.nodeName&&(o=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(o),e.selection.normalize(),e.nodeChanged())})))},_=()=>{m&&e.on("keydown",(t=>{!Vg.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}))},T=()=>{e.on("click",(e=>{let t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)})),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},O=()=>{e.on("init",(()=>{e.dom.bind(e.getBody(),"submit",(e=>{e.preventDefault()}))}))},D=E,A=()=>{e.on("keydown",(t=>{if(g(t)||t.keyCode!==Vg.BACKSPACE)return;let o=s.getRng();const n=o.startContainer,a=o.startOffset,i=r.getRoot();let l=n;if(o.collapsed&&0===a){for(;l.parentNode&&l.parentNode.firstChild===l&&l.parentNode!==i;)l=l.parentNode;"BLOCKQUOTE"===l.nodeName&&(e.formatter.toggle("blockquote",void 0,l),o=r.createRng(),o.setStart(n,0),o.setEnd(n,0),s.setRng(o))}})),h(),Mt.windowsPhone||e.on("keyup focusin mouseup",(t=>{Vg.modifierPressed(t)||(e=>{const t=e.getBody(),o=e.selection.getRng();return o.startContainer===o.endContainer&&o.startContainer===t&&0===o.startOffset&&o.endOffset===t.childNodes.length})(e)||s.normalize()}),!0),c&&(f(),b(),e.on("init",(()=>{u("DefaultParagraphSeparator",sc(e))})),O(),y(),a.addNodeFilter("br",(e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()})),d?(S(),k(),T()):p()),l&&(e.on("keydown",(t=>{if(!g(t)&&t.keyCode===o){if(!e.getBody().getElementsByTagName("hr").length)return;if(s.isCollapsed()&&0===s.getRng().startOffset){const e=s.getNode(),o=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();o&&o.nodeName&&"hr"===o.nodeName.toLowerCase()&&(r.remove(o),t.preventDefault())}}})),v(),(()=>{const o=()=>{const o=r.getAttribs(s.getStart().cloneNode(!1));return()=>{const n=s.getStart();n!==e.getBody()&&(r.setAttrib(n,"style",null),t(o,(e=>{n.setAttributeNode(e.cloneNode(!0))})))}},n=()=>!s.isCollapsed()&&r.getParent(s.getStart(),r.isBlock)!==r.getParent(s.getEnd(),r.isBlock);e.on("keypress",(t=>{let r;return!(!(g(t)||8!==t.keyCode&&46!==t.keyCode)&&n()&&(r=o(),e.getDoc().execCommand("delete",!1),r(),t.preventDefault(),1))})),r.bind(e.getDoc(),"cut",(t=>{if(!g(t)&&n()){const t=o();sp.setEditorTimeout(e,(()=>{t()}))}}))})(),w(),x(),C(),_(),y())};return SC(e)?(c&&(f(),b(),O(),p(),d&&(S(),k(),T())),l&&(v(),w(),C(),_())):A(),{refreshContentEditable:D,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},QR=ba.DOM,eB=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,tB=e=>Ce(e,(e=>!1===w(e))),oB=e=>{const t=e.options.get,o=e.editorUpload.blobCache;return tB({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_unsafe_embeds:t("convert_unsafe_embeds"),convert_fonts_to_spans:t("convert_fonts_to_spans"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),inline_styles:t("inline_styles"),root_name:eB(e),sandbox_iframes:t("sandbox_iframes"),sandbox_iframes_exclusions:Zd(e),sanitize:t("xss_sanitization"),validate:!0,blob_cache:o,document:e.getDoc()})},nB=e=>{const t=e.options.get;return tB({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},rB=e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||Hu(e)&&e.selection.getStart(!0)!==t||su(t).each((t=>{const o=t.getNode(),n=ir(o)?su(o).getOr(t):t;e.selection.setRng(n.toRange())}))})(e),e.nodeChanged({initial:!0});const t=md(e);S(t)&&t.call(e,e),(e=>{const t=gd(e);t&&sp.setEditorTimeout(e,(()=>{let o;o=!0===t?e:e.editorManager.get(t),o&&!o.destroyed&&(o.focus(),o.selection.scrollIntoView())}),100)})(e)},sB=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,aB=e=>{const t=sB(e),o=Dc(e),n=e.contentCSS,r=()=>{t.unloadAll(n),e.inline||e.ui.styleSheetLoader.unloadAll(o)},s=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";Lt.each(e.contentStyles,(e=>{t+=e+"\r\n"})),e.dom.addStyle(t)}const a=Promise.all(((e,t,o)=>{const{pass:n,fail:r}=K(t,(e=>tinymce.Resource.has(_S(e)))),s=n.map((t=>{const o=tinymce.Resource.get(_S(t));return h(o)?Promise.resolve(sB(e).loadRawCss(t,o)):Promise.resolve()})),a=[...s,sB(e).loadAll(r)];return e.inline?a:a.concat([e.ui.styleSheetLoader.loadAll(o)])})(e,n,o)).then(s).catch(s),i=Oc(e);return i&&((e,t)=>{const o=wo.fromDom(e.getBody()),n=Wo(jo(o)),r=wo.fromTag("style");to(r,"type","text/css"),yn(r,wo.fromText(t)),yn(n,r),e.on("remove",(()=>{Sn(r)}))})(e,i),a},iB=e=>{!0!==e.removed&&((e=>{SC(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),rB(e))},lB=e=>{const t=e.getElement();let o=e.getDoc();e.inline&&(QR.addClass(t,"mce-content-body"),e.contentDocument=o=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const n=e.getBody();n.disabled=!0,e.readonly=ed(e),e._editableRoot=td(e),!e.readonly&&e.hasEditableRoot()&&(e.inline&&"static"===QR.getStyle(n,"position",!0)&&(n.style.position="relative"),n.contentEditable="true"),n.disabled=!1,e.editorUpload=HS(e),e.schema=Vs(nB(e)),e.dom=ba(o,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:e.inline,schema:e.schema,contentCssCors:xc(e),referrerPolicy:Cc(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)}}),e.parser=(e=>{const t=Ix(oB(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",((t,o)=>{const n=e.dom,r="data-mce-"+o;let s=t.length;for(;s--;){const a=t[s];let i=a.attr(o);if(i&&!a.attr(r)){if(0===i.indexOf("data:")||0===i.indexOf("blob:"))continue;"style"===o?(i=n.serializeStyle(n.parseStyle(i),a.name),i.length||(i=null),a.attr(r,i),a.attr(o,i)):"tabindex"===o?(a.attr(r,i),a.attr(o,null)):a.attr(r,e.convertURL(i,o,a.name))}}})),t.addNodeFilter("script",(e=>{let t=e.length;for(;t--;){const o=e[t],n=o.attr("type")||"no/type";0!==n.indexOf("mce-")&&o.attr("type","mce-"+n)}})),Rd(e)&&t.addNodeFilter("#cdata",(t=>{var o;let n=t.length;for(;n--;){const r=t[n];r.type=8,r.name="#comment",r.value="[CDATA["+e.dom.encode(null!==(o=r.value)&&void 0!==o?o:"")+"]]"}})),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",(t=>{let o=t.length;const n=e.schema.getNonEmptyElements();for(;o--;){const e=t[o];e.isEmpty(n)&&0===e.getAll("br").length&&e.append(new Np("br",1))}})),t})(e),e.serializer=VC((e=>{const t=e.options.get;return{...oB(e),...nB(e),...tB({remove_trailing_brs:t("remove_trailing_brs"),pad_empty_with_br:t("pad_empty_with_br"),url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}})(e),e),e.selection=LC(e.dom,e.getWin(),e.serializer,e),e.annotator=Mg(e),e.formatter=GS(e),e.undoManager=YS(e),e._nodeChangeDispatcher=new gM(e),e._selectionOverrides=fR(e),FE(e),DN(e),GE(e),SC(e)||((e=>{e.on("mousedown",(t=>{t.detail>=3&&(t.preventDefault(),IN(e))}))})(e),(e=>{XR(e)})(e));const r=uM(e);IE(e,r),(e=>{e.on("NodeChange",N(jE,e))})(e),tk(e),ON(e);const s=kC(e);(e=>{const t=e.getDoc(),o=e.getBody();(e=>{e.dispatch("PreInit")})(e),hd(e)||(t.body.spellcheck=!1,QR.setAttrib(o,"spellcheck","false")),e.quirks=JR(e),(e=>{e.dispatch("PostRender")})(e);const n=Ac(e);void 0!==n&&(o.dir=n);const r=pd(e);r&&e.on("BeforeSetContent",(e=>{Lt.each(r,(t=>{e.content=e.content.replace(t,(e=>"\x3c!--mce:protected "+escape(e)+"--\x3e"))}))})),e.on("SetContent",(()=>{e.addVisual(e.getBody())})),e.on("compositionstart compositionend",(t=>{e.composing="compositionstart"===t.type}))})(e),(e=>{const t=jd(e);h(Wd(e))||!w(t)&&"INVALID"!==(e=>(e=>"gpl"===e.toLowerCase())(e)||(e=>e.length>=64&&e.length<=255)(e)?"VALID":"INVALID")(t)||console.warn("TinyMCE is running in evaluation mode. Provide a valid license key or add license_key: 'gpl' to the init config to agree to the open source license terms. Read more at https://www.tiny.cloud/license-key/")})(e),s.fold((()=>{const t=(e=>{let t=!1;const o=setTimeout((()=>{t||e.setProgressState(!0)}),500);return()=>{clearTimeout(o),t=!0,e.setProgressState(!1)}})(e);aB(e).then((()=>{iB(e),t()}))}),(t=>{e.setProgressState(!0),aB(e).then((()=>{t().then((t=>{e.setProgressState(!1),iB(e),TC(e)}),(t=>{e.notificationManager.open({type:"error",text:String(t)}),iB(e),TC(e)}))}))}))},cB=P,dB=ba.DOM,mB=(e,t)=>{const o=e.translate("Rich Text Area"),n=ro(wo.fromDom(e.getElement()),"tabindex").bind(Qe),r=((e,t,o,n)=>{const r=wo.fromTag("iframe");return n.each((e=>to(r,"tabindex",e))),oo(r,o),oo(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),ho(r,"tox-edit-area__iframe"),r})(e.id,o,Jl(e),n).dom;r.onload=()=>{r.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=r,e.iframeHTML=(e=>{let t=Ql(e)+"";ec(e)!==e.documentBaseUrl&&(t+=''),t+='';const o=tc(e),n=oc(e),r=e.translate(cd(e));return nc(e)&&(t+=''),t+=`
    `,t})(e),dB.add(t.iframeContainer,r)},uB=e=>{const t=e.iframeElement,o=()=>{e.contentDocument=t.contentDocument,lB(e)};if(Hd(e)||Mt.browser.isFirefox()){const t=e.getDoc();t.open(),t.write(e.iframeHTML),t.close(),o()}else{const r=(n=wo.fromDom(t),Dn(n,"load",cB,(()=>{r.unbind(),o()})));t.srcdoc=e.iframeHTML}var n},gB=ba.DOM,hB=(e,t,o)=>{const n=vS.get(o),r=vS.urls[o]||e.documentBaseUrl.replace(/\/$/,"");if(o=Lt.trim(o),n&&-1===Lt.inArray(t,o)){if(e.plugins[o])return;try{const s=n(e,r)||{};e.plugins[o]=s,S(s.init)&&(s.init(e,r),t.push(o))}catch(t){((e,t,o)=>{const n=_a.translate(["Failed to initialize plugin: {0}",t]);Bg(e,"PluginLoadError",{message:n}),kS(n,o),xS(e,n)})(e,o,t)}}},pB=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),fB=e=>{const t=e.getElement();return e.inline?pB(null):(e=>{const t=gB.create("div");return gB.insertAfter(t,e),pB(t,t)})(t)},vB=e=>{const t=e.getElement();return e.orgDisplay=t.style.display,h(Ic(e))?(e=>{const t=e.theme.renderUI;return t?t():fB(e)})(e):S(Ic(e))?(e=>{const t=e.getElement(),o=Ic(e)(e,t);return o.editorContainer.nodeType&&(o.editorContainer.id=o.editorContainer.id||e.id+"_parent"),o.iframeContainer&&o.iframeContainer.nodeType&&(o.iframeContainer.id=o.iframeContainer.id||e.id+"_iframecontainer"),o.height=o.iframeHeight?o.iframeHeight:t.offsetHeight,o})(e):fB(e)},bB=async e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=Lt.trim(pc(e)),o=e.ui.registry.getAll().icons,n={...aS.get("default").icons,...aS.get(t).icons};ve(n,((t,n)=>{Ee(o,n)||e.ui.registry.addIcon(n,t)}))})(e),(e=>{const t=Ic(e);if(h(t)){const o=bS.get(t);e.theme=o(e,bS.urls[t])||{},S(e.theme.init)&&e.theme.init(e,bS.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=Fc(e),o=iS.get(t);e.model=o(e,iS.urls[t])})(e),(e=>{const t=[];q(nd(e),(o=>{hB(e,t,(e=>e.replace(/^\-/,""))(o))}))})(e);const t=await vB(e);((e,t)=>{const o={show:F.from(t.show).getOr(E),hide:F.from(t.hide).getOr(E),isEnabled:F.from(t.isEnabled).getOr(P),setEnabled:o=>{e.mode.isReadOnly()||F.from(t.setEnabled).each((e=>e(o)))}};e.ui={...e.ui,...o}})(e,F.from(t.api).getOr({})),e.editorContainer=t.editorContainer,TS(e),e.inline?lB(e):((e,t)=>{mB(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=dB.isHidden(t.editorContainer)),e.getElement().style.display="none",dB.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,uB(e)})(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},yB=ba.DOM,wB=e=>"-"===e.charAt(0),xB=(e,t)=>{const o=Sc(t),n=kc(t);if(!_a.hasCode(o)&&"en"!==o){const r=Xe(n)?n:`${t.editorManager.baseURL}/langs/${o}.js`;e.add(r).catch((()=>{((e,t,o)=>{CS(e,"LanguageLoadError",SS("language",t,o))})(t,r,o)}))}},CB=(e,t)=>{const o=Ic(e);if(h(o)&&!wB(o)&&!Ee(bS.urls,o)){const n=Pc(e),r=n?e.documentBaseURI.toAbsolute(n):`themes/${o}/theme${t}.js`;bS.load(o,r).catch((()=>{((e,t,o)=>{CS(e,"ThemeLoadError",SS("theme",t,o))})(e,r,o)}))}},SB=(e,t)=>{const o=Fc(e);if("plugin"!==o&&!Ee(iS.urls,o)){const n=zc(e),r=h(n)?e.documentBaseURI.toAbsolute(n):`models/${o}/model${t}.js`;iS.load(o,r).catch((()=>{((e,t,o)=>{CS(e,"ModelLoadError",SS("model",t,o))})(e,r,o)}))}},kB=(e,t,o)=>F.from(t).filter((e=>Xe(e)&&!aS.has(e))).map((t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${o}.js`,name:F.some(t)}))),_B=(e,t,o)=>{const n=kB(t,"default",o),r=(e=>F.from(fc(e)).filter(Xe).map((e=>({url:e,name:F.none()}))))(t).orThunk((()=>kB(t,pc(t),"")));q((e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t{e.add(o.url).catch((()=>{((e,t,o)=>{CS(e,"IconsLoadError",SS("icons",t,o))})(t,o.url,o.name.getOrUndefined())}))}))},EB=(e,t)=>{const o=(t,o)=>{vS.load(t,o).catch((()=>{((e,t,o)=>{CS(e,"PluginLoadError",SS("plugin",t,o))})(e,o,t)}))};ve(rd(e),((t,n)=>{o(n,t),e.options.set("plugins",nd(e).concat(n))})),q(nd(e),(e=>{!(e=Lt.trim(e))||vS.urls[e]||wB(e)||o(e,`plugins/${e}/plugin${t}.js`)}))},TB=(e,t)=>{const o=wa.ScriptLoader,n=()=>{!e.removed&&(e=>{const t=Ic(e);return!h(t)||C(bS.get(t))})(e)&&(e=>{const t=Fc(e);return C(iS.get(t))})(e)&&bB(e)};CB(e,t),SB(e,t),xB(o,e),_B(o,e,t),EB(e,t),o.loadQueue().then(n,n)},OB=e=>{const t=e.id;_a.setCode(Sc(e));const o=()=>{yB.unbind(window,"ready",o),e.render()};if(!la.Event.domLoaded)return void yB.bind(window,"ready",o);if(!e.getElement())return;const n=wo.fromDom(e.getElement()),r=io(n);e.on("remove",(()=>{G(n.dom.attributes,(e=>ao(n,e.name))),oo(n,r)})),e.ui.styleSheetLoader=((e,t)=>rs.forElement(e,{contentCssCors:od(t),referrerPolicy:Cc(t)}))(n,e),qc(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const s=e.getElement().form||yB.getParent(t,"form");s&&(e.formElement=s,Gc(e)&&!cr(e.getElement())&&(yB.insertAfter(yB.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},yB.bind(s,"submit reset",e.formEventDelegate),e.on("reset",(()=>{e.resetContent()})),!Kc(e)||s.submit.nodeType||s.submit.length||s._mceOldSubmit||(s._mceOldSubmit=s.submit,s.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),s._mceOldSubmit(s)))),e.windowManager=yS(e),e.notificationManager=fS(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",(e=>{e.save&&(e.content=yB.encode(e.content))})),Yc(e)&&e.on("submit",(()=>{e.initialized&&e.save()})),Xc(e)&&(e._beforeUnload=()=>{!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),TB(e,e.suffix)},DB=kt().deviceType,AB=DB.isPhone(),MB=DB.isTablet(),NB=e=>{if(x(e))return[];{const t=v(e)?e:e.split(/[ ,]/),o=$(t,Ge);return Y(o,Xe)}},RB=(e,t)=>{const o=((e,t)=>{const o={},n={};return xe(e,t,we(o),we(n)),{t:o,f:n}})(t,((t,o)=>j(e,o)));return n=o.t,r=o.f,{sections:D(n),options:D(r)};var n,r},BB=(e,t)=>Ee(e.sections(),t),LB=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:_e(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),HB=(e,t)=>{var o;const n=null!==(o=t.external_plugins)&&void 0!==o?o:{};return e&&e.external_plugins?Lt.extend({},e.external_plugins,n):n},IB=(e,t,o,n)=>{const r=NB(o.forced_plugins),s=NB(n.plugins),a=((e,t)=>BB(e,t)?e.sections()[t]:{})(t,"mobile"),i=((e,t,o,n)=>e&&BB(t,"mobile")?n:o)(e,t,s,a.plugins?NB(a.plugins):s),l=((e,t)=>[...NB(e),...NB(t)])(r,i);return Lt.extend(n,{forced_plugins:r,plugins:l})},PB=(e,t,o,n,r)=>{var s;const a=e?{mobile:LB(null!==(s=r.mobile)&&void 0!==s?s:{},t)}:{},i=RB(["mobile"],DO(a,r)),l=Lt.extend(o,n,i.options(),((e,t)=>e&&BB(t,"mobile"))(e,i)?((e,t,o={})=>{const n=e.sections(),r=_e(n,t).getOr({});return Lt.extend({},o,r)})(i,"mobile"):{},{external_plugins:HB(n,i.options())});return IB(e,i,n,l)},FB=(e,t)=>((e,t)=>EC(e).editor.addVisual(t))(e,t),zB=e=>{const t=t=>()=>{q("left,center,right,justify".split(","),(o=>{t!==o&&e.formatter.remove("align"+o)})),"none"!==t&&((t,o)=>{e.formatter.toggle(t,o),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})},VB=e=>{zB(e),(e=>{const t=t=>()=>{const o=e.selection,n=o.isCollapsed()?[e.dom.getParent(o.getNode(),e.dom.isBlock)]:o.getSelectedBlocks();return W(n,(o=>C(e.formatter.matchNode(o,t))))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},ZB=(e,t)=>{const o=e.selection,n=e.dom;return/^ | $/.test(t)?((e,t,o,n)=>{const r=wo.fromDom(e.getRoot());return o=jf(r,ml.fromRangeStart(t),n)?o.replace(/^ /," "):o.replace(/^ /," "),Wf(r,ml.fromRangeEnd(t),n)?o.replace(/( | )()?$/," "):o.replace(/ ()?$/," ")})(n,o.getRng(),t,e.schema):t},UB=(e,t)=>{if(e.selection.isEditable()){const{content:o,details:n}=(e=>{if("string"!=typeof e){const t=Lt.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);Zx(e,{...n,content:ZB(e,o),format:"html",set:!1,selection:!0}).each((t=>{const o=((e,t,o)=>_C(e).editor.insertContent(t,o))(e,t.content,n);Ux(e,o,t),e.addVisual()}))}},jB={"font-size":"size","font-family":"face"},WB=Qt("font"),$B=(e,t,o)=>zb(wo.fromDom(o),(t=>(t=>gn(t,e).orThunk((()=>WB(t)?_e(jB,e).bind((e=>ro(t,e))):F.none())))(t)),(e=>ko(wo.fromDom(t),e))),qB=e=>(t,o)=>F.from(o).map(wo.fromDom).filter(Kt).bind((o=>$B(e,t,o.dom).or(((e,t)=>F.from(ba.DOM.getStyle(t,e,!0)))(e,o.dom)))).getOr(""),GB=qB("font-size"),KB=T((e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")),qB("font-family")),YB=e=>su(e.getBody()).bind((e=>{const t=e.container();return F.from(dr(t)?t.parentNode:t)})),XB=(e,t)=>(e=>F.from(e.selection.getRng()).bind((t=>{const o=e.getBody();return t.startContainer===o&&0===t.startOffset?F.none():F.from(e.selection.getStart(!0))})))(e).orThunk(N(YB,e)).map(wo.fromDom).filter(Kt).bind(t),JB=(e,t)=>XB(e,O(F.some,t)),QB=(e,t)=>{if(/^[0-9.]+$/.test(t)){const o=parseInt(t,10);if(o>=1&&o<=7){const n=(e=>Lt.explode(e.options.get("font_size_style_values")))(e),r=(e=>Lt.explode(e.options.get("font_size_classes")))(e);return r.length>0?r[o-1]||t:n[o-1]||t}return t}return t},eL=e=>{const t=e.split(/\s*,\s*/);return $(t,(e=>-1===e.indexOf(" ")||We(e,'"')||We(e,"'")?e:`'${e}'`)).join(",")},tL=e=>{const t=(t,o)=>{e.formatter.toggle(t,o),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,o,n)=>{t(e,{value:n})},BackColor:(e,o,n)=>{t("hilitecolor",{value:n})},FontName:(t,o,n)=>{((e,t)=>{const o=QB(e,t);e.formatter.toggle("fontname",{value:eL(o)}),e.nodeChanged()})(e,n)},FontSize:(t,o,n)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:QB(e,t)}),e.nodeChanged()})(e,n)},LineHeight:(t,o,n)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,n)},Lang:(e,o,n)=>{var r;t(e,{value:n.code,customValue:null!==(r=n.customCode)&&void 0!==r?r:null})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,o,n)=>{t(h(n)?n:"p")},mceToggleFormat:(e,o,n)=>{t(n)}})},oL=e=>{const t=t=>e.formatter.match(t);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>t(e),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",(()=>(e=>JB(e,(t=>KB(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("FontSize",(()=>(e=>JB(e,(t=>GB(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("LineHeight",(()=>(e=>JB(e,(t=>{const o=wo.fromDom(e.getBody()),n=zb(t,(e=>gn(e,"line-height")),N(ko,o));return n.getOrThunk((()=>{const e=parseFloat(mn(t,"line-height")),o=parseFloat(mn(t,"font-size"));return String(e/o)}))})).getOr(""))(e)))},nL=e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{NE(e,"indent")})(e)},Outdent:()=>{RE(e)}}),e.editorCommands.addCommands({Outdent:()=>DE(e)},"state")},rL=(e,t)=>{const o=e.dom,n=e.selection.getRng(),r=t?e.selection.getStart():e.selection.getEnd(),s=t?n.startContainer:n.endContainer,a=nA(o,s);if(!a||!a.isContentEditable)return;const i=t?fn:vn,l=sc(e);((e,t,o,n)=>{const r=e.dom,s=e=>r.isBlock(e)&&e.parentElement===o,a=s(t)?t:r.getParent(n,s,o);return F.from(a).map(wo.fromDom)})(e,r,a,s).each((t=>{const o=iA(e,s,t.dom,a,!1,l);i(t,wo.fromDom(o)),e.selection.setCursorLocation(o,0),e.dispatch("NewBlock",{newBlock:o}),KD(e,"insertParagraph")}))},sL=e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{(e=>{rL(e,!0)})(e)},InsertNewBlockAfter:()=>{(e=>{rL(e,!1)})(e)}})},aL=e=>{VB(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const o=e.getDoc();let n;try{o.execCommand(t)}catch(e){n=!0}if("paste"!==t||o.queryCommandEnabled(t)||(n=!0),n||!o.queryCommandSupported(t)){let t=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(Mt.os.isMacOS()||Mt.os.isiOS())&&(t=t.replace(/Ctrl\+/g,"⌘+")),e.notificationManager.open({text:t,type:"error"})}}})})(e),(e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})})(e),(e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,o,n)=>{let r=0;e.dom.getParent(e.selection.getNode(),(t=>!tr(t)||r++!==n||(e.selection.select(t),!1)),e.getBody())},mceSelectNode:(t,o,n)=>{e.selection.select(n)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),br);if(t){const o=e.dom.createRng();o.selectNodeContents(t),e.selection.setRng(o)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,o,n)=>{UB(e,e.dom.createHTML("img",{src:n}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"
    ")},insertText:(t,o,n)=>{UB(e,e.dom.encode(n))},insertHTML:(t,o,n)=>{UB(e,n)},mceInsertContent:(t,o,n)=>{UB(e,n)},mceSetContent:(t,o,n)=>{e.setContent(n)},mceReplaceContent:(t,o,n)=>{e.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(wd(e))}})})(e),(e=>{const t=(t,o,n)=>{const r=h(n)?{href:n}:n,s=e.dom.getParent(e.selection.getNode(),"a");p(r)&&h(r.href)&&(r.href=r.href.replace(/ /g,"%20"),s&&r.href||e.formatter.remove("link"),r.href&&e.formatter.apply("link",r,s))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isEditable()){if(e.selection.isCollapsed()){const t=e.dom.getParent(e.selection.getStart(),"a");return void(t&&e.dom.remove(t,!0))}e.formatter.remove("link")}},mceInsertLink:t,createLink:t})})(e),nL(e),sL(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{jA(xA,e)},mceInsertNewLine:(t,o,n)=>{WA(e,n)},InsertLineBreak:(t,o,n)=>{jA(AA,e)}})})(e),(e=>{tL(e),oL(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,o,n)=>{const r=null!=n?n:e.selection.getNode();if(r!==e.getBody()){const t=e.selection.getBookmark();e.dom.remove(r,!0),e.selection.moveToBookmark(t)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,o,n)=>{xp(e,!0===n)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)},iL=["toggleview"],lL=e=>j(iL,e.toLowerCase());class cL{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t=!1,o,n){const r=this.editor,s=e.toLowerCase(),a=null==n?void 0:n.skip_focus;if(r.removed)return!1;if("mcefocus"!==s&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(s)||a?(e=>{np(e).each((t=>e.selection.setRng(t)))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:o}).isDefaultPrevented())return!1;const i=this.commands.exec[s];return!!S(i)&&(i(s,t,o),r.dispatch("ExecCommand",{command:e,ui:t,value:o}),!0)}queryCommandState(e){if(!lL(e)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),o=this.commands.state[t];return!!S(o)&&o(t)}queryCommandValue(e){if(!lL(e)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),o=this.commands.value[t];return S(o)?o(t):""}addCommands(e,t="exec"){const o=this.commands;ve(e,((e,n)=>{q(n.toLowerCase().split(","),(n=>{o[t][n]=e}))}))}addCommand(e,t,o){const n=e.toLowerCase();this.commands.exec[n]=(e,n,r)=>t.call(null!=o?o:this.editor,n,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,o){this.commands.state[e.toLowerCase()]=()=>t.call(null!=o?o:this.editor)}addQueryValueHandler(e,t,o){this.commands.value[e.toLowerCase()]=()=>t.call(null!=o?o:this.editor)}}const dL="data-mce-contenteditable",mL=(e,t,o)=>{try{e.getDoc().execCommand(t,!1,String(o))}catch(e){}},uL=(e,t)=>{e.dom.contentEditable=t?"true":"false"},gL=(e,t)=>{const o=wo.fromDom(e.getBody());((e,t,o)=>{bo(e,t)&&!o?fo(e,t):o&&ho(e,t)})(o,"mce-content-readonly",t),t?(e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{F.from(e.selection.getNode()).each((e=>{e.removeAttribute("data-mce-selected")}))})(e),e.readonly=!0,uL(o,!1),q(Vn(o,'*[contenteditable="true"]'),(e=>{to(e,dL,"true"),uL(e,!1)}))):(e.readonly=!1,e.hasEditableRoot()&&uL(o,!0),(e=>{q(Vn(e,`*[${dL}="true"]`),(e=>{ao(e,dL),uL(e,!0)}))})(o),mL(e,"StyleWithCSS",!1),mL(e,"enableInlineTableEditing",!1),mL(e,"enableObjectResizing",!1),yp(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged())},hL=e=>e.readonly,pL=e=>{e.parser.addAttributeFilter("contenteditable",(t=>{hL(e)&&q(t,(e=>{e.attr(dL,e.attr("contenteditable")),e.attr("contenteditable","false")}))})),e.serializer.addAttributeFilter(dL,(t=>{hL(e)&&q(t,(e=>{e.attr("contenteditable",e.attr(dL))}))})),e.serializer.addTempAttr(dL)},fL=["copy"],vL=(e,t)=>{if((e=>"click"===e.type)(t)&&!Vg.metaKeyPressed(t)){const o=wo.fromDom(t.target);((e,t)=>nn(t,"a",(t=>ko(t,wo.fromDom(e.getBody())))).bind((e=>ro(e,"href"))))(e,o).each((o=>{if(t.preventDefault(),/^#/.test(o)){const t=e.dom.select(`${o},[name="${Ue(o,"#")}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(o,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")}))}else(e=>j(fL,e.type))(t)&&e.dispatch(t.type,t)},bL=Lt.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class yL{static isNative(e){return!!bL[e.toLowerCase()]}constructor(e){this.bindings={},this.settings=e||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||I}fire(e,t){return this.dispatch(e,t)}dispatch(e,t){const o=e.toLowerCase(),n=oa(o,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(n);const r=this.bindings[o];if(r)for(let e=0,t=r.length;e{this.toggleEvent(t,!1),delete this.bindings[t]})),this;if(s){if(t){const e=K(s,(e=>e.func===t));s=e.fail,this.bindings[r]=s,q(e.pass,(e=>{e.removed=!0}))}else s.length=0;s.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else ve(this.bindings,((e,t)=>{this.toggleEvent(t,!1)})),this.bindings={};return this}once(e,t,o){return this.on(e,t,o,{once:!0})}has(e){e=e.toLowerCase();const t=this.bindings[e];return!(!t||0===t.length)}}const wL=e=>(e._eventDispatcher||(e._eventDispatcher=new yL({scope:e,toggleEvent:(t,o)=>{yL.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,o)}})),e._eventDispatcher),xL={fire(e,t,o){return this.dispatch(e,t,o)},dispatch(e,t,o){const n=this;if(n.removed&&"remove"!==e&&"detach"!==e)return oa(e.toLowerCase(),null!=t?t:{},n);const r=wL(n).dispatch(e,t);if(!1!==o&&n.parent){let t=n.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent?t.parent():void 0}return r},on(e,t,o){return wL(this).on(e,t,o)},off(e,t){return wL(this).off(e,t)},once(e,t){return wL(this).once(e,t)},hasEventListeners(e){return wL(this).has(e)}},CL=ba.DOM;let SL;const kL=(e,t)=>{if("selectionchange"===t)return e.getDoc();if(!e.inline&&/^(?:mouse|touch|click|contextmenu|drop|dragover|dragend)/.test(t))return e.getDoc().documentElement;const o=Lc(e);return o?(e.eventRoot||(e.eventRoot=CL.select(o)[0]),e.eventRoot):e.getBody()},_L=(e,t,o)=>{(e=>!e.hidden&&!hL(e))(e)?e.dispatch(t,o):hL(e)&&vL(e,o)},EL=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const o=kL(e,t);if(Lc(e)){if(SL||(SL={},e.editorManager.on("removeEditor",(()=>{e.editorManager.activeEditor||SL&&(ve(SL,((t,o)=>{e.dom.unbind(kL(e,o))})),SL=null)}))),SL[t])return;const n=o=>{const n=o.target,r=e.editorManager.get();let s=r.length;for(;s--;){const e=r[s].getBody();(e===n||CL.isChildOf(n,e))&&_L(r[s],t,o)}};SL[t]=n,CL.bind(o,t,n)}else{const n=o=>{_L(e,t,o)};CL.bind(o,t,n),e.delegates[t]=n}},TL={...xL,bindPendingEventDelegates(){const e=this;Lt.each(e._pendingNativeEvents,(t=>{EL(e,t)}))},toggleNativeEvent(e,t){const o=this;"focus"!==e&&"blur"!==e&&(o.removed||(t?o.initialized?EL(o,e):o._pendingNativeEvents?o._pendingNativeEvents.push(e):o._pendingNativeEvents=[e]:o.initialized&&o.delegates&&(o.dom.unbind(kL(o,e),e,o.delegates[e]),delete o.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),o=e.dom;e.delegates&&(ve(e.delegates,((t,o)=>{e.dom.unbind(kL(e,o),o,t)})),delete e.delegates),!e.inline&&t&&o&&(t.onload=null,o.unbind(e.getWin()),o.unbind(e.getDoc())),o&&(o.unbind(t),o.unbind(e.getContainer()))}},OL=e=>h(e)?{value:e.split(/[ ,]/),valid:!0}:_(e,h)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},DL=(e,t)=>e+(Je(t.message)?"":`. ${t.message}`),AL=e=>e.valid,ML=(e,t,o="")=>{const n=t(e);return y(n)?n?{value:e,valid:!0}:{valid:!1,message:o}:n},NL=(e,t)=>{const o={},n={},r=(e,t,o)=>{const r=ML(t,o);return AL(r)?(n[e]=r.value,!0):(console.warn(DL(`Invalid value passed for the ${e} option`,r)),!1)},s=e=>Ee(o,e);return{register:(e,s)=>{const a=(e=>h(e.processor))(s)?(e=>{const t=(()=>{switch(e){case"array":return v;case"boolean":return y;case"function":return S;case"number":return k;case"object":return p;case"string":return h;case"string[]":return OL;case"object[]":return e=>_(e,p);case"regexp":return e=>g(e,RegExp);default:return P}})();return o=>ML(o,t,`The value must be a ${e}.`)})(s.processor):s.processor,i=((e,t,o)=>{if(!w(t)){const n=ML(t,o);if(AL(n))return n.value;console.error(DL(`Invalid default value passed for the "${e}" option`,n))}})(e,s.default,a);o[e]={...s,default:i,processor:a},_e(n,e).orThunk((()=>_e(t,e))).each((t=>r(e,t,a)))},isRegistered:s,get:e=>_e(n,e).orThunk((()=>_e(o,e).map((e=>e.default)))).getOrUndefined(),set:(e,t)=>{if(s(e)){const n=o[e];return n.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):r(e,t,n.processor)}return console.warn(`"${e}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:e=>{const t=s(e);return t&&delete n[e],t},isSet:e=>Ee(n,e)}},RL=["design","readonly"],BL=(e,t,o,n)=>{const r=o[t.get()],s=o[n];try{s.activate()}catch(e){return void console.error(`problem while activating editor mode ${n}:`,e)}r.deactivate(),r.editorReadOnly!==s.editorReadOnly&&gL(e,s.editorReadOnly),t.set(n),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,n)},LL=e=>{const t=xa("design"),o=xa({design:{activate:E,deactivate:E,editorReadOnly:!1},readonly:{activate:E,deactivate:E,editorReadOnly:!0}});return(e=>{e.serializer?pL(e):e.on("PreInit",(()=>{pL(e)}))})(e),(e=>{e.on("ShowCaret",(t=>{hL(e)&&t.preventDefault()})),e.on("ObjectSelected",(t=>{hL(e)&&t.preventDefault()}))})(e),{isReadOnly:()=>hL(e),set:n=>((e,t,o,n)=>{if(n!==o.get()){if(!Ee(t,n))throw new Error(`Editor mode '${n}' is invalid`);e.initialized?BL(e,o,t,n):e.on("init",(()=>BL(e,o,t,n)))}})(e,o.get(),t,n),get:()=>t.get(),register:(e,t)=>{o.set(((e,t,o)=>{if(j(RL,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...o,deactivate:()=>{try{o.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(o.get(),e,t))}}},HL=Lt.each,IL=Lt.explode,PL={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},FL=Lt.makeMap("alt,ctrl,shift,meta,access"),zL=e=>{const t={},o=Mt.os.isMacOS()||Mt.os.isiOS();HL(IL(e.toLowerCase(),"+"),(e=>{(e=>e in FL)(e)?t[e]=!0:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=PL[e]||e.toUpperCase().charCodeAt(0))}));const n=[t.keyCode];let r;for(r in FL)t[r]?n.push(r):t[r]=!1;return t.id=n.join(","),t.access&&(t.alt=!0,o?t.ctrl=!0:t.shift=!0),t.meta&&(o?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class VL{constructor(e){this.shortcuts={},this.pendingPatterns=[],this.editor=e;const t=this;e.on("keyup keypress keydown",(e=>{!t.hasModifier(e)&&!t.isFunctionKey(e)||e.isDefaultPrevented()||(HL(t.shortcuts,(o=>{t.matchShortcut(e,o)&&(t.pendingPatterns=o.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(o))})),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))}))}add(e,t,o,n){const r=this,s=r.normalizeCommandFunc(o);return HL(IL(Lt.trim(e)),(e=>{const o=r.createShortcut(e,t,s,n);r.shortcuts[o.id]=o})),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,o=e;return"string"==typeof o?()=>{t.editor.execCommand(o,!1,null)}:Lt.isArray(o)?()=>{t.editor.execCommand(o[0],o[1],o[2])}:o}createShortcut(e,t,o,n){const r=Lt.map(IL(e,">"),zL);return r[r.length-1]=Lt.extend(r[r.length-1],{func:o,scope:n||this.editor}),Lt.extend(r[0],{desc:this.editor.translate(t),subpatterns:r.slice(1)})}hasModifier(e){return e.altKey||e.ctrlKey||e.metaKey}isFunctionKey(e){return"keydown"===e.type&&e.keyCode>=112&&e.keyCode<=123}matchShortcut(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)}executeShortcutAction(e){return e.func?e.func.call(e.scope):null}}const ZL=()=>{const e=(()=>{const e={},t={},o={},n={},r={},s={},a={},i={},l=(e,t)=>(o,n)=>{e[o.toLowerCase()]={...n,type:t}};return{addButton:l(e,"button"),addGroupToolbarButton:l(e,"grouptoolbarbutton"),addToggleButton:l(e,"togglebutton"),addMenuButton:l(e,"menubutton"),addSplitButton:l(e,"splitbutton"),addMenuItem:l(t,"menuitem"),addNestedMenuItem:l(t,"nestedmenuitem"),addToggleMenuItem:l(t,"togglemenuitem"),addAutocompleter:l(o,"autocompleter"),addContextMenu:l(r,"contextmenu"),addContextToolbar:l(s,"contexttoolbar"),addContextForm:l(s,"contextform"),addSidebar:l(a,"sidebar"),addView:l(i,"views"),addIcon:(e,t)=>n[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:n,popups:o,contextMenus:r,contextToolbars:s,sidebars:a,views:i})}})();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,addView:e.addView,getAll:e.getAll}},UL=ba.DOM,jL=Lt.extend,WL=Lt.each;class $L{constructor(e,t,o){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.composing=!1,this.destroyed=!1,this.hasHiddenInput=!1,this.iframeElement=null,this.initialized=!1,this.readonly=!1,this.removed=!1,this.startContent="",this._pendingNativeEvents=[],this._skinLoaded=!1,this._editableRoot=!0,this.editorManager=o,this.documentBaseUrl=o.documentBaseURL,jL(this,TL);const n=this;this.id=e,this.hidden=!1;const r=((e,t)=>PB(AB||MB,AB,t,e,t))(o.defaultOptions,t);this.options=NL(0,r),(e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean",default:!0}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:""}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:Xl(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:Xl(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:e=>{const t=h(e)&&Xe(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:e=>{const t=j(["block","linebreak","invert","default"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:e=>y(e)||h(e)?{valid:!0,value:e}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:e=>{const t=!1===e||h(e)||_(e,h);return t?h(e)?{value:$(e.split(","),Ge),valid:t}:v(e)?{value:e,valid:t}:!1===e?{value:[],valid:t}:{value:e,valid:t}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:qc(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=h(e)||_(e,h);return t?{value:v(e)?e:$(e.split(","),Ge),valid:t}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:e=>{const t=y(e)||h(e);return t?!1===e||Wl.isiPhone()||Wl.isiPad()?{value:"",valid:t}:{value:!0===e?"table,img,figure.image,div,video,iframe":e,valid:t}:{valid:!1,message:"Must be boolean or a string"}},default:!$l}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"string"}),t("service_message",{processor:"string"}),t("theme",{processor:e=>!1===e||h(e)||S(e),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("format_noneditable_selector",{processor:"string",default:""}),t("preview_styles",{processor:e=>{const t=!1===e||h(e);return t?{value:!1===e?"":e,valid:t}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("readonly",{processor:"boolean",default:!1}),t("editable_root",{processor:"boolean",default:!0}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area. Press ALT-0 for help."}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean",default:!0}),t("pad_empty_with_br",{processor:"boolean",default:!1}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:Yl}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:Yl}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:Yl}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:Yl}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>h(e)||!0===e}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("license_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:e=>_(e,p)||!1===e?{value:jl(!1===e?[]:e),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1",trigger:"space"},{start:"##",format:"h2",trigger:"space"},{start:"###",format:"h3",trigger:"space"},{start:"####",format:"h4",trigger:"space"},{start:"#####",format:"h5",trigger:"space"},{start:"######",format:"h6",trigger:"space"},{start:"1.",cmd:"InsertOrderedList",trigger:"space"},{start:"*",cmd:"InsertUnorderedList",trigger:"space"},{start:"-",cmd:"InsertUnorderedList",trigger:"space"},{start:">",cmd:"mceBlockQuote",trigger:"space"},{start:"---",cmd:"InsertHorizontalRule",trigger:"space"}]}),t("text_patterns_lookup",{processor:e=>{return S(e)?{value:(t=e,e=>{const o=t(e);return jl(o)}),valid:!0}:{valid:!1,message:"Must be a single function"};var t},default:e=>[]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:e=>_(e,Gl)?{value:e,valid:!0}:Gl(e)?{value:[e],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),t("highlight_on_focus",{processor:"boolean",default:!0}),t("xss_sanitization",{processor:"boolean",default:!0}),t("details_initial_state",{processor:e=>{const t=j(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("details_serialized_state",{processor:e=>{const t=j(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("init_content_sync",{processor:"boolean",default:!1}),t("newdocument_content",{processor:"string",default:""}),t("sandbox_iframes",{processor:"boolean",default:!0}),t("sandbox_iframes_exclusions",{processor:"string[]",default:["youtube.com","youtu.be","vimeo.com","player.vimeo.com","dailymotion.com","embed.music.apple.com","open.spotify.com","giphy.com","dai.ly","codepen.io"]}),t("convert_unsafe_embeds",{processor:"boolean",default:!0}),e.on("ScriptsLoaded",(()=>{t("directionality",{processor:"string",default:_a.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:ql.getAttrib(e.getElement(),"placeholder")})}))})(n);const s=this.options.get;s("deprecation_warnings")&&tS(t,r);const a=s("suffix");a&&(o.suffix=a),this.suffix=o.suffix;const i=s("base_url");i&&o._setBaseUrl(i),this.baseUri=o.baseURI;const l=Cc(n);l&&(wa.ScriptLoader._setReferrerPolicy(l),ba.DOM.styleSheetLoader._setReferrerPolicy(l));const c=od(n);C(c)&&ba.DOM.styleSheetLoader._setContentCssCors(c),Ea.languageLoad=s("language_load"),Ea.baseURL=o.baseURL,this.setDirty(!1),this.documentBaseURI=new xx(ec(n),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=qc(n),this.hasVisual=ad(n),this.shortcuts=new VL(this),this.editorCommands=new cL(this),aL(this);const d=s("cache_suffix");d&&(Mt.cacheSuffix=d.replace(/^[\?\&]+/,"")),this.ui={registry:ZL(),styleSheetLoader:void 0,show:E,hide:E,setEnabled:E,isEnabled:P},this.mode=LL(n),o.dispatch("SetupEditor",{editor:this});const m=dd(n);S(m)&&m.call(n,n)}render(){OB(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return bp(this)}translate(e){return _a.translate(e)}getParam(e,t,o){const n=this.options;return n.isRegistered(e)||(C(o)?n.register(e,{processor:o,default:t}):n.register(e,{processor:P,default:t})),n.isSet(e)||w(t)?n.get(e):t}hasPlugin(e,t){return!(!j(nd(this),e)||t&&void 0===vS.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,o){this.editorCommands.addCommand(e,t,o)}addQueryStateHandler(e,t,o){this.editorCommands.addQueryStateHandler(e,t,o)}addQueryValueHandler(e,t,o){this.editorCommands.addQueryValueHandler(e,t,o)}addShortcut(e,t,o,n){this.shortcuts.add(e,t,o,n)}execCommand(e,t,o,n){return this.editorCommands.execCommand(e,t,o,n)}queryCommandState(e){return this.editorCommands.queryCommandState(e)}queryCommandValue(e){return this.editorCommands.queryCommandValue(e)}queryCommandSupported(e){return this.editorCommands.queryCommandSupported(e)}show(){const e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable="true":(UL.show(e.getContainer()),UL.hide(e.id)),e.load(),e.dispatch("show"))}hide(){const e=this;e.hidden||(e.save(),e.inline?(e.getBody().contentEditable="false",e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(UL.hide(e.getContainer()),UL.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(e,t){this.dispatch("ProgressState",{state:e,time:t})}load(e={}){const t=this,o=t.getElement();if(t.removed)return"";if(o){const n={...e,load:!0},r=cr(o)?o.value:o.innerHTML,s=t.setContent(r,n);return n.no_events||t.dispatch("LoadContent",{...n,element:o}),s}return""}save(e={}){const t=this;let o=t.getElement();if(!o||!t.initialized||t.removed)return"";const n={...e,save:!0,element:o};let r=t.getContent(n);const s={...n,content:r};if(s.no_events||t.dispatch("SaveContent",s),"raw"===s.format&&t.dispatch("RawSaveContent",s),r=s.content,cr(o))o.value=r;else{!e.is_removing&&t.inline||(o.innerHTML=r);const n=UL.getParent(t.id,"form");n&&WL(n.elements,(e=>e.name!==t.id||(e.value=r,!1)))}return s.element=n.element=o=null,!1!==s.set_dirty&&t.setDirty(!1),r}setContent(e,t){return UC(this,e,t)}getContent(e){return ZC(this,e)}insertContent(e,t){t&&(e=jL({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?UC(this,this.startContent,{format:"raw"}):UC(this,e),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(e){const t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.dispatch("dirty")}getContainer(){const e=this;return e.container||(e.container=e.editorContainer||UL.get(e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=UL.get(this.id)),this.targetElm}getWin(){const e=this;if(!e.contentWindow){const t=e.iframeElement;t&&(e.contentWindow=t.contentWindow)}return e.contentWindow}getDoc(){const e=this;if(!e.contentDocument){const t=e.getWin();t&&(e.contentDocument=t.document)}return e.contentDocument}getBody(){var e,t;const o=this.getDoc();return null!==(t=null!==(e=this.bodyElement)&&void 0!==e?e:null==o?void 0:o.body)&&void 0!==t?t:null}convertURL(e,t,o){const n=this,r=n.options.get,s=ud(n);if(S(s))return s.call(n,e,o,!0,t);if(!r("convert_urls")||"link"===o||p(o)&&"LINK"===o.nodeName||0===e.indexOf("file:")||0===e.length)return e;const a=new xx(e);return"http"!==a.protocol&&"https"!==a.protocol&&""!==a.protocol?e:r("relative_urls")?n.documentBaseURI.toRelative(e):e=n.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){FB(this,e)}setEditableRoot(e){((e,t)=>{e._editableRoot!==t&&(e._editableRoot=t,e.readonly||(e.getBody().contentEditable=String(e.hasEditableRoot()),e.nodeChanged()),((e,t)=>{e.dispatch("EditableRootStateChange",{state:t})})(e,t))})(this,e)}hasEditableRoot(){return this._editableRoot}remove(){rS(this)}destroy(e){sS(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const qL=ba.DOM,GL=Lt.each;let KL,YL=!1,XL=[];const JL=e=>{const t=e.type;GL(oH.get(),(o=>{switch(t){case"scroll":o.dispatch("ScrollWindow",e);break;case"resize":o.dispatch("ResizeWindow",e)}}))},QL=e=>{if(e!==YL){const t=ba.DOM;e?(t.bind(window,"resize",JL),t.bind(window,"scroll",JL)):(t.unbind(window,"resize",JL),t.unbind(window,"scroll",JL)),YL=e}},eH=e=>{const t=XL;return XL=Y(XL,(t=>e!==t)),oH.activeEditor===e&&(oH.activeEditor=XL.length>0?XL[0]:null),oH.focusedEditor===e&&(oH.focusedEditor=null),t.length!==XL.length},tH="CSS1Compat"!==document.compatMode,oH={...xL,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"7",minorVersion:"0.0",releaseDate:"2024-03-20",i18n:_a,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",o="",n=xx.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/"));const r=window.tinymce||window.tinyMCEPreInit;if(r)t=r.base||r.baseURL,o=r.suffix;else{const e=document.getElementsByTagName("script");for(let n=0;n{Ea.PluginManager.urls[t]=e}))},init(e){const t=this;let o;const n=Lt.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," ");let r=e=>{o=e};const s=()=>{let o=0;const a=[];let i;qL.unbind(window,"ready",s),(o=>{const n=e[o];n&&n.apply(t,[])})("onpageload"),i=he((e=>Mt.browser.isIE()||Mt.browser.isEdge()?(kS("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/6/support/#supportedwebbrowsers"),[]):tH?(kS("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):h(e.selector)?qL.select(e.selector):C(e.target)?[e.target]:[])(e)),Lt.each(i,(e=>{var o;(o=t.get(e.id))&&o.initialized&&!(o.getContainer()||o.getBody()).parentNode&&(eH(o),o.unbindAllNativeEvents(),o.destroy(!0),o.removed=!0)})),i=Lt.grep(i,(e=>!t.get(e.id))),0===i.length?r([]):GL(i,(s=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in n)(e,s)?kS("Could not initialize inline editor on invalid inline target element",s):((e,n,s)=>{const l=new $L(e,n,t);a.push(l),l.on("init",(()=>{++o===i.length&&r(a)})),l.targetElm=l.targetElm||s,l.render()})((e=>{let t=e.id;return t||(t=_e(e,"name").filter((e=>!qL.get(e))).getOrThunk(qL.uniqueId),e.setAttribute("id",t)),t})(s),e,s)}))};return qL.bind(window,"ready",s),new Promise((e=>{o?e(o):r=t=>{e(t)}}))},get(e){return 0===arguments.length?XL.slice(0):h(e)?ee(XL,(t=>t.id===e)).getOr(null):k(e)&&XL[e]?XL[e]:null},add(e){const t=this,o=t.get(e.id);return o===e||(null===o&&XL.push(e),QL(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),KL||(KL=e=>{const o=t.dispatch("BeforeUnload");if(o.returnValue)return e.preventDefault(),e.returnValue=o.returnValue,o.returnValue},window.addEventListener("beforeunload",KL))),e},createEditor(e,t){return this.add(new $L(e,t,this))},remove(e){const t=this;let o;if(e){if(!h(e))return o=e,b(t.get(o.id))?null:(eH(o)&&t.dispatch("RemoveEditor",{editor:o}),0===XL.length&&window.removeEventListener("beforeunload",KL),o.remove(),QL(XL.length>0),o);GL(qL.select(e),(e=>{o=t.get(e.id),o&&t.remove(o)}))}else for(let e=XL.length-1;e>=0;e--)t.remove(XL[e])},execCommand(e,t,o){var n;const r=this,s=p(o)?null!==(n=o.id)&&void 0!==n?n:o.index:o;switch(e){case"mceAddEditor":if(!r.get(s)){const e=o.options;new $L(s,e,r).render()}return!0;case"mceRemoveEditor":{const e=r.get(s);return e&&e.remove(),!0}case"mceToggleEditor":{const e=r.get(s);return e?(e.isHidden()?e.show():e.hide(),!0):(r.execCommand("mceAddEditor",!1,o),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,o)},triggerSave:()=>{GL(XL,(e=>{e.save()}))},addI18n:(e,t)=>{_a.add(e,t)},translate:e=>_a.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new xx(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new xx(this.baseURL)}};oH.setup();const nH=(()=>{const e=Oa();return{FakeClipboardItem:e=>({items:e,types:pe(e),getType:t=>_e(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),rH=Math.min,sH=Math.max,aH=Math.round,iH=(e,t,o)=>{let n=t.x,r=t.y;const s=e.w,a=e.h,i=t.w,l=t.h,c=(o||"").split("");return"b"===c[0]&&(r+=l),"r"===c[1]&&(n+=i),"c"===c[0]&&(r+=aH(l/2)),"c"===c[1]&&(n+=aH(i/2)),"b"===c[3]&&(r-=a),"r"===c[4]&&(n-=s),"c"===c[3]&&(r-=aH(a/2)),"c"===c[4]&&(n-=aH(s/2)),lH(n,r,s,a)},lH=(e,t,o,n)=>({x:e,y:t,w:o,h:n}),cH={inflate:(e,t,o)=>lH(e.x-t,e.y-o,e.w+2*t,e.h+2*o),relativePosition:iH,findBestRelativePosition:(e,t,o,n)=>{for(let r=0;r=o.x&&s.x+s.w<=o.w+o.x&&s.y>=o.y&&s.y+s.h<=o.h+o.y)return n[r]}return null},intersect:(e,t)=>{const o=sH(e.x,t.x),n=sH(e.y,t.y),r=rH(e.x+e.w,t.x+t.w),s=rH(e.y+e.h,t.y+t.h);return r-o<0||s-n<0?null:lH(o,n,r-o,s-n)},clamp:(e,t,o)=>{let n=e.x,r=e.y,s=e.x+e.w,a=e.y+e.h;const i=t.x+t.w,l=t.y+t.h,c=sH(0,t.x-n),d=sH(0,t.y-r),m=sH(0,s-i),u=sH(0,a-l);return n+=c,r+=d,o&&(s+=c,a+=d,n-=m,r-=u),s-=m,a-=u,lH(n,r,s-n,a-r)},create:lH,fromClientRect:e=>lH(e.left,e.top,e.width,e.height)},dH=(()=>{const e={},t={},o={};return{load:(o,n)=>{const r=`Script at URL "${n}" failed to load`,s=`Script at URL "${n}" did not call \`tinymce.Resource.add('${o}', data)\` within 1 second`;if(void 0!==e[o])return e[o];{const a=new Promise(((e,a)=>{const i=((e,t,o=1e3)=>{let n=!1,r=null;const s=e=>(...t)=>{n||(n=!0,null!==r&&(clearTimeout(r),r=null),e.apply(null,t))},a=s(e),i=s(t);return{start:(...e)=>{n||null!==r||(r=setTimeout((()=>i.apply(null,e)),o))},resolve:a,reject:i}})(e,a);t[o]=i.resolve,wa.ScriptLoader.loadScript(n).then((()=>i.start(s)),(()=>i.reject(r)))}));return e[o]=a,a}},add:(n,r)=>{void 0!==t[n]&&(t[n](r),delete t[n]),e[n]=Promise.resolve(r),o[n]=r},has:e=>e in o,get:e=>o[e],unload:t=>{delete e[t],delete o[t]}}})();let mH;try{const e="__storage_test__";mH=window.localStorage,mH.setItem(e,e),mH.removeItem(e)}catch(e){mH=(()=>{let e={},t=[];const o={getItem:t=>e[t]||null,setItem:(o,n)=>{t.push(o),e[o]=String(n)},key:e=>t[e],removeItem:o=>{t=t.filter((e=>e===o)),delete e[o]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(o,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),o})()}const uH={geom:{Rect:cH},util:{Delay:sp,Tools:Lt,VK:Vg,URI:xx,EventDispatcher:yL,Observable:xL,I18n:_a,LocalStorage:mH,ImageUploader:e=>{const t=DS(),o=BS(e,t);return{upload:(t,n=!0)=>o.upload(t,n?RS(e):void 0)}}},dom:{EventUtils:la,TreeWalker:Wn,TextSeeker:Ya,DOMUtils:ba,ScriptLoader:wa,RangeUtils:Sh,Serializer:VC,StyleSheetLoader:ns,ControlSelection:$g,BookmarkManager:Ng,Selection:LC,Event:la.Event},html:{Styles:Js,Entities:Cs,Node:Np,Schema:Vs,DomParser:Ix,Writer:Xp,Serializer:Jp},Env:Mt,AddOnManager:Ea,Annotator:Mg,Formatter:GS,UndoManager:YS,EditorCommands:cL,WindowManager:yS,NotificationManager:fS,EditorObservable:TL,Shortcuts:VL,Editor:$L,FocusManager:rp,EditorManager:oH,DOM:ba.DOM,ScriptLoader:wa.ScriptLoader,PluginManager:vS,ThemeManager:bS,ModelManager:iS,IconManager:aS,Resource:dH,FakeClipboard:nH,trim:Lt.trim,isArray:Lt.isArray,is:Lt.is,toArray:Lt.toArray,makeMap:Lt.makeMap,each:Lt.each,map:Lt.map,grep:Lt.grep,inArray:Lt.inArray,extend:Lt.extend,walk:Lt.walk,resolve:Lt.resolve,explode:Lt.explode,_addCacheSuffix:Lt._addCacheSuffix},gH=Lt.extend(oH,uH);(e=>{window.tinymce=e,window.tinyMCE=e})(gH),(e=>{try{t.exports=e}catch(e){}})(gH)}();var n=e(o.exports);tinymce.IconManager.add("default",{icons:{"accessibility-check":'',"accordion-toggle":'',accordion:'',"action-next":'',"action-prev":'',addtag:'',"ai-prompt":'',ai:'',"align-center":'',"align-justify":'',"align-left":'',"align-none":'',"align-right":'',"arrow-left":'',"arrow-right":'',bold:'',bookmark:'',"border-style":'',"border-width":'',brightness:'',browse:'',cancel:'',"cell-background-color":'',"cell-border-color":'',"change-case":'',"character-count":'',"checklist-rtl":'',checklist:'',checkmark:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',close:'',"code-sample":'',"color-levels":'',"color-picker":'',"color-swatch-remove-color":'',"color-swatch":'',"comment-add":'',comment:'',contrast:'',copy:'',crop:'',"cut-column":'',"cut-row":'',cut:'',"document-properties":'',drag:'',"duplicate-column":'',"duplicate-row":'',duplicate:'',"edit-block":'',"edit-image":'',"embed-page":'',embed:'',emoji:'',export:'',fill:'',"flip-horizontally":'',"flip-vertically":'',footnote:'',"format-painter":'',format:'',fullscreen:'',gallery:'',gamma:'',help:'',"highlight-bg-color":'',home:'',"horizontal-rule":'',"image-options":'',image:'',indent:'',info:'',"insert-character":'',"insert-time":'',invert:'',italic:'',language:'',"line-height":'',line:'',link:'',"list-bull-circle":'',"list-bull-default":'',"list-bull-square":'',"list-num-default-rtl":'',"list-num-default":'',"list-num-lower-alpha-rtl":'',"list-num-lower-alpha":'',"list-num-lower-greek-rtl":'',"list-num-lower-greek":'',"list-num-lower-roman-rtl":'',"list-num-lower-roman":'',"list-num-upper-alpha-rtl":'',"list-num-upper-alpha":'',"list-num-upper-roman-rtl":'',"list-num-upper-roman":'',lock:'',ltr:'',minus:'',"more-drawer":'',"new-document":'',"new-tab":'',"non-breaking":'',notice:'',"ordered-list-rtl":'',"ordered-list":'',orientation:'',outdent:'',"page-break":'',paragraph:'',"paste-column-after":'',"paste-column-before":'',"paste-row-after":'',"paste-row-before":'',"paste-text":'',paste:'',"permanent-pen":'',plus:'',preferences:'',preview:'',print:'',quote:'',redo:'',reload:'',"remove-formatting":'',remove:'',"resize-handle":'',resize:'',"restore-draft":'',"revision-history":'',"rotate-left":'',"rotate-right":'',rtl:'',save:'',search:'',"select-all":'',selected:'',send:'',settings:'',sharpen:'',sourcecode:'',"spell-check":'',"strike-through":'',subscript:'',superscript:'',"table-caption":'',"table-cell-classes":'',"table-cell-properties":'',"table-cell-select-all":'',"table-cell-select-inner":'',"table-classes":'',"table-delete-column":'',"table-delete-row":'',"table-delete-table":'',"table-insert-column-after":'',"table-insert-column-before":'',"table-insert-row-above":'',"table-insert-row-after":'',"table-left-header":'',"table-merge-cells":'',"table-row-numbering-rtl":'',"table-row-numbering":'',"table-row-properties":'',"table-split-cells":'',"table-top-header":'',table:'',"template-add":'',template:'',"temporary-placeholder":'',"text-color":'',"text-size-decrease":'',"text-size-increase":'',toc:'',translate:'',typography:'',underline:'',undo:'',unlink:'',unlock:'',"unordered-list":'',unselected:'',upload:'',user:'',"vertical-align":'',visualblocks:'',visualchars:'',warning:'',"zoom-in":'',"zoom-out":'',"export-pdf":'',"export-word":'',"import-word":''}}),function(){const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>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,r=e=>t=>e===t,s=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=r(null),d=n("boolean"),m=r(void 0),u=e=>null==e,g=e=>!u(e),h=n("function"),p=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o{},b=e=>()=>e(),y=(e,t)=>(...o)=>e(t.apply(null,o)),w=e=>()=>e,x=e=>e,C=(e,t)=>e===t;function S(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),_=e=>()=>{throw new Error(e)},E=e=>e(),T=w(!1),O=w(!0);class D{constructor(e,t){this.tag=e,this.value=t}static some(e){return new D(!0,e)}static none(){return D.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?D.some(e(this.value)):D.none()}bind(e){return this.tag?e(this.value):D.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:D.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?D.some(e):D.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()"}}D.singletonNone=new D(!1);const A=Array.prototype.slice,M=Array.prototype.indexOf,N=Array.prototype.push,R=(e,t)=>M.call(e,t),B=(e,t)=>{const o=R(e,t);return-1===o?D.none():D.some(o)},L=(e,t)=>R(e,t)>-1,H=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t,o)=>(z(e,((e,n)=>{o=t(o,e,n)})),o),W=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oq(F(e,t)),K=(e,t)=>{for(let o=0,n=e.length;o{const t=A.call(e,0);return t.reverse(),t},X=(e,t)=>Z(e,(e=>!L(t,e))),J=(e,t)=>{const o={};for(let n=0,r=e.length;n[e],ee=(e,t)=>{const o=A.call(e,0);return o.sort(t),o},te=(e,t)=>t>=0&&tte(e,0),ne=e=>te(e,e.length-1),re=h(Array.from)?Array.from:e=>A.call(e),se=(e,t)=>{for(let o=0;o{const o=ae(e);for(let n=0,r=o.length;nde(e,((e,o)=>({k:o,v:t(e,o)}))),de=(e,t)=>{const o={};return le(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},me=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{le(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))},ge=(e,t)=>{const o={};return ue(e,t,me(o),v),o},he=(e,t)=>{const o=[];return le(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=ae(e);for(let n=0,r=o.length;nhe(e,x),ve=(e,t)=>be(e,t)?D.from(e[t]):D.none(),be=(e,t)=>ie.call(e,t),ye=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],we=(e,t,o=C)=>e.exists((e=>o(e,t))),xe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te.isSome()&&t.isSome()?D.some(o(e.getOrDie(),t.getOrDie())):D.none(),Se=(e,t)=>null!=e?D.some(t(e)):D.none(),ke=(e,t)=>e?D.some(t):D.none(),_e=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ee=(e,t)=>Oe(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Te=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!m(n)||r+t.length<=n)},Oe=(e,t)=>_e(e,t,0),De=(e,t)=>_e(e,t,e.length-t.length),Ae=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Me=e=>e.length>0,Ne=e=>!Me(e),Re=e=>void 0!==e.style&&h(e.style.getPropertyValue),Be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Le={fromHtml:(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 Be(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return Be(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return Be(o)},fromDom:Be,fromPoint:(e,t,o)=>D.from(e.dom.elementFromPoint(t,o)).map(Be)},He="undefined"!=typeof window?window:Function("return this;")(),Ie=(e,t)=>((e,t)=>{let o=null!=t?t:He;for(let t=0;t{const o=((e,t)=>Ie(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},Fe=Object.getPrototypeOf,ze=e=>{const t=Ie("ownerDocument.defaultView",e);return a(e)&&((e=>Pe("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Fe(e).constructor.name))},Ve=e=>e.dom.nodeName.toLowerCase(),Ze=e=>t=>(e=>e.dom.nodeType)(t)===e,Ue=e=>je(e)&&ze(e.dom),je=Ze(1),We=Ze(3),$e=Ze(9),qe=Ze(11),Ge=e=>t=>je(t)&&Ve(t)===e,Ke=(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")}},Ye=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Xe=(e,t)=>{const o=void 0===t?document:t.dom;return Ye(o)?D.none():D.from(o.querySelector(e)).map(Le.fromDom)},Je=(e,t)=>e.dom===t.dom,Qe=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},et=e=>Le.fromDom(e.dom.ownerDocument),tt=e=>$e(e)?e:et(e),ot=e=>Le.fromDom(tt(e).dom.documentElement),nt=e=>Le.fromDom(tt(e).dom.defaultView),rt=e=>D.from(e.dom.parentNode).map(Le.fromDom),st=e=>D.from(e.dom.parentElement).map(Le.fromDom),at=e=>D.from(e.dom.offsetParent).map(Le.fromDom),it=e=>F(e.dom.childNodes,Le.fromDom),lt=(e,t)=>{const o=e.dom.childNodes;return D.from(o[t]).map(Le.fromDom)},ct=e=>lt(e,0),dt=(e,t)=>({element:e,offset:t}),mt=(e,t)=>{const o=it(e);return o.length>0&&tqe(e)&&g(e.dom.host),gt=h(Element.prototype.attachShadow)&&h(Node.prototype.getRootNode),ht=w(gt),pt=gt?e=>Le.fromDom(e.dom.getRootNode()):tt,ft=e=>ut(e)?e:Le.fromDom(tt(e).dom.body),vt=e=>{const t=pt(e);return ut(t)?D.some(t):D.none()},bt=e=>Le.fromDom(e.dom.host),yt=e=>g(e.dom.shadowRoot),wt=e=>{const t=We(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return vt(Le.fromDom(t)).fold((()=>o.body.contains(t)),(n=wt,r=bt,e=>n(r(e))));var n,r},xt=()=>Ct(Le.fromDom(document)),Ct=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Le.fromDom(t)},St=(e,t,o)=>{if(!(s(o)||d(o)||p(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+"")},kt=(e,t,o)=>{St(e.dom,t,o)},_t=(e,t)=>{const o=e.dom;le(t,((e,t)=>{St(o,t,e)}))},Et=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Tt=(e,t)=>D.from(Et(e,t)),Ot=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Dt=(e,t)=>{e.dom.removeAttribute(t)},At=(e,t,o)=>{if(!s(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Re(e)&&e.style.setProperty(t,o)},Mt=(e,t)=>{Re(e)&&e.style.removeProperty(t)},Nt=(e,t,o)=>{const n=e.dom;At(n,t,o)},Rt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{At(o,t,e)}))},Bt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{e.fold((()=>{Mt(o,t)}),(e=>{At(o,t,e)}))}))},Lt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||wt(e)?n:Ht(o,t)},Ht=(e,t)=>Re(e)?e.style.getPropertyValue(t):"",It=(e,t)=>{const o=e.dom,n=Ht(o,t);return D.from(n).filter((e=>e.length>0))},Pt=e=>{const t={},o=e.dom;if(Re(o))for(let e=0;e{const n=Le.fromTag(e);Nt(n,t,o);return It(n,t).isSome()},zt=(e,t)=>{const o=e.dom;Mt(o,t),we(Tt(e,"style").map(Ae),"")&&Dt(e,"style")},Vt=e=>e.dom.offsetWidth,Zt=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Lt(o,e);return parseFloat(t)||0}return n},n=(e,t)=>j(t,((t,o)=>{const n=Lt(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!p(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Re(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},Ut=Zt("height",(e=>{const t=e.dom;return wt(e)?t.getBoundingClientRect().height:t.offsetHeight})),jt=e=>Ut.get(e),Wt=e=>Ut.getOuter(e),$t=(e,t)=>({left:e,top:t,translate:(o,n)=>$t(e+o,t+n)}),qt=$t,Gt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Kt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return qt(o.offsetLeft,o.offsetTop);const s=Gt(null==n?void 0:n.pageYOffset,r.scrollTop),a=Gt(null==n?void 0:n.pageXOffset,r.scrollLeft),i=Gt(r.clientTop,o.clientTop),l=Gt(r.clientLeft,o.clientLeft);return Yt(e).translate(a-l,s-i)},Yt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?qt(o.offsetLeft,o.offsetTop):wt(e)?(e=>{const t=e.getBoundingClientRect();return qt(t.left,t.top)})(t):qt(0,0)},Xt=Zt("width",(e=>e.dom.offsetWidth)),Jt=e=>Xt.get(e),Qt=e=>Xt.getOuter(e),eo=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},to=()=>oo(0,0),oo=(e,t)=>({major:e,minor:t}),no={nu:oo,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?to():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return oo(n(1),n(2))})(e,o)},unknown:to},ro=(e,t)=>{const o=String(t).toLowerCase();return W(e,(e=>e.search(o)))},so=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ao=e=>t=>Te(t,e),io=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Te(e,"edge/")&&Te(e,"chrome")&&Te(e,"safari")&&Te(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,so],search:e=>Te(e,"chrome")&&!Te(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Te(e,"msie")||Te(e,"trident")},{name:"Opera",versionRegexes:[so,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ao("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ao("firefox")},{name:"Safari",versionRegexes:[so,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Te(e,"safari")||Te(e,"mobile/"))&&Te(e,"applewebkit")}],lo=[{name:"Windows",search:ao("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Te(e,"iphone")||Te(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ao("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:ao("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ao("linux"),versionRegexes:[]},{name:"Solaris",search:ao("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ao("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ao("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],co={browsers:w(io),oses:w(lo)},mo="Edge",uo="Chromium",go="Opera",ho="Firefox",po="Safari",fo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(mo),isChromium:n(uo),isIE:n("IE"),isOpera:n(go),isFirefox:n(ho),isSafari:n(po)}},vo={unknown:()=>fo({current:void 0,version:no.unknown()}),nu:fo,edge:w(mo),chromium:w(uo),ie:w("IE"),opera:w(go),firefox:w(ho),safari:w(po)},bo="Windows",yo="Android",wo="Linux",xo="macOS",Co="Solaris",So="FreeBSD",ko="ChromeOS",_o=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(bo),isiOS:n("iOS"),isAndroid:n(yo),isMacOS:n(xo),isLinux:n(wo),isSolaris:n(Co),isFreeBSD:n(So),isChromeOS:n(ko)}},Eo={unknown:()=>_o({current:void 0,version:no.unknown()}),nu:_o,windows:w(bo),ios:w("iOS"),android:w(yo),linux:w(wo),macos:w(xo),solaris:w(Co),freebsd:w(So),chromeos:w(ko)},To=(e,t,o)=>{const n=co.browsers(),r=co.oses(),s=t.bind((e=>((e,t)=>se(t.brands,(t=>{const o=t.brand.toLowerCase();return W(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:no.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>ro(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(vo.unknown,vo.nu),a=((e,t)=>ro(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Eo.unknown,Eo.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:w(r),isiPhone:w(s),isTablet:w(l),isPhone:w(c),isTouch:w(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:w(d),isDesktop:w(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},Oo=e=>window.matchMedia(e).matches;let Do=eo((()=>To(navigator.userAgent,D.from(navigator.userAgentData),Oo)));const Ao=()=>Do(),Mo=e=>{const t=Le.fromDom((e=>{if(ht()&&g(e.target)){const t=Le.fromDom(e.target);if(je(t)&&yt(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return oe(t)}}return D.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=y(n,o);return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},No=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(Mo(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:S(Ro,e,t,s,r)}},Ro=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Bo=(e,t)=>{rt(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Lo=(e,t)=>{const o=(e=>D.from(e.dom.nextSibling).map(Le.fromDom))(e);o.fold((()=>{rt(e).each((e=>{Io(e,t)}))}),(e=>{Bo(e,t)}))},Ho=(e,t)=>{ct(e).fold((()=>{Io(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Io=(e,t)=>{e.dom.appendChild(t.dom)},Po=(e,t)=>{z(t,(t=>{Io(e,t)}))},Fo=e=>{e.dom.textContent="",z(it(e),(e=>{zo(e)}))},zo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Vo=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return qt(o,n)},Zo=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},Uo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),jo=e=>{const t=void 0===e?window:e,o=t.document,n=Vo(Le.fromDom(o));return(e=>{const t=void 0===e?window:e;return Ao().browser.isFirefox()?D.none():D.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Uo(n.left,n.top,o,r)}),(e=>Uo(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},Wo=()=>Le.fromDom(document),$o=(e,t)=>e.view(t).fold(w([]),(t=>{const o=e.owner(t),n=$o(e,o);return[t].concat(n)}));var qo=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?D.none():D.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Le.fromDom)},owner:e=>et(e)});const Go=e=>{const t=Wo(),o=Vo(t),n=((e,t)=>{const o=t.owner(e),n=$o(t,o);return D.some(n)})(e,qo);return n.fold(S(Kt,e),(t=>{const n=Yt(e),r=U(t,((e,t)=>{const o=Yt(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return qt(r.left+n.left+o.left,r.top+n.top+o.top)}))},Ko=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Yo=e=>{const t=Kt(e),o=Qt(e),n=Wt(e);return Ko(t.left,t.top,o,n)},Xo=e=>{const t=Go(e),o=Qt(e),n=Wt(e);return Ko(t.left,t.top,o,n)},Jo=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),r=Math.min(e.right,t.right),s=Math.min(e.bottom,t.bottom);return Ko(o,n,r-o,s-n)},Qo=()=>jo(window);var en=tinymce.util.Tools.resolve("tinymce.ThemeManager");const tn=e=>{const t=t=>t(e),o=w(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:O,isError:T,map:t=>nn.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:()=>D.some(e)};return r},on=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:O,map:t,mapError:t=>nn.error(t(e)),bind:t,exists:T,forall:O,getOr:x,or:x,getOrThunk:E,orThunk:E,getOrDie:_(String(e)),each:v,toOptional:D.none};return o},nn={value:tn,error:on,fromOption:(e,t)=>e.fold((()=>on(t)),tn)};var rn;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(rn||(rn={}));const sn=(e,t,o)=>e.stype===rn.Error?t(e.serror):o(e.svalue),an=e=>({stype:rn.Value,svalue:e}),ln=e=>({stype:rn.Error,serror:e}),cn=e=>e.fold(ln,an),dn=e=>sn(e,nn.error,nn.value),mn=an,un=e=>{const t=[],o=[];return z(e,(e=>{sn(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}},gn=ln,hn=(e,t)=>e.stype===rn.Value?t(e.svalue):e,pn=(e,t)=>e.stype===rn.Error?t(e.serror):e,fn=(e,t)=>e.stype===rn.Value?{stype:rn.Value,svalue:t(e.svalue)}:e,vn=(e,t)=>e.stype===rn.Error?{stype:rn.Error,serror:t(e.serror)}:e,bn=sn,yn=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),wn=(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)}},xn=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;ni(e)&&i(t)?Cn(e,t):t)),Sn=xn(((e,t)=>t)),kn=e=>({tag:"defaultedThunk",process:e}),_n=e=>kn(w(e)),En=e=>({tag:"mergeWithThunk",process:e}),Tn=e=>y(gn,q)(e),On=e=>{const t=un(e);return t.errors.length>0?Tn(t.errors):mn(t.values)},Dn=e=>a(e)&&ae(e).length>100?" removed due to size":JSON.stringify(e,null,2),An=(e,t)=>gn([{path:e,getErrorInfo:t}]),Mn=e=>({extract:(t,o)=>pn(e(o),(e=>((e,t)=>An(e,w(t)))(t,e))),toString:w("val")}),Nn=Mn(mn),Rn=(e,t,o,n)=>ve(t,o).fold((()=>((e,t,o)=>An(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Dn(o))))(e,o,t)),n),Bn=(e,t,o,n)=>n(ve(e,t).getOrThunk((()=>o(e)))),Ln=(e,t,o,n,r)=>{const s=e=>r.extract(t.concat([n]),e),a=e=>e.fold((()=>mn(D.none())),(e=>{const o=r.extract(t.concat([n]),e);return fn(o,D.some)}));switch(e.tag){case"required":return Rn(t,o,n,s);case"defaultedThunk":return Bn(o,n,e.process,s);case"option":return((e,t,o)=>o(ve(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(ve(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return Bn(o,n,w({}),(t=>{const n=Cn(e.process(o),t);return s(n)}))}},Hn=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),In=e=>ae(ge(e,g)),Pn=e=>{const t=Fn(e),o=U(e,((e,t)=>wn(t,(t=>Cn(e,{[t]:!0})),w(e))),{});return{extract:(e,n)=>{const r=d(n)?[]:In(n),s=Z(r,(e=>!ye(o,e)));return 0===s.length?t.extract(e,n):((e,t)=>An(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,s)},toString:t.toString}},Fn=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const s of o)wn(s,((o,s,a,i)=>{const l=Ln(a,e,t,o,i);bn(l,(e=>{r.push(...e)}),(e=>{n[s]=e}))}),((e,o)=>{n[e]=o(t)}));return r.length>0?gn(r):mn(n)})(t,o,e),toString:()=>{const t=F(e,(e=>wn(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),zn=e=>({extract:(t,o)=>{const n=F(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return On(n)},toString:()=>"array("+e.toString()+")"}),Vn=(e,t)=>{const o=void 0!==t?t:x;return{extract:(t,n)=>{const r=[];for(const s of e){const e=s.extract(t,n);if(e.stype===rn.Value)return{stype:rn.Value,svalue:o(e.svalue)};r.push(e)}return On(r)},toString:()=>"oneOf("+F(e,(e=>e.toString())).join(", ")+")"}},Zn=(e,t)=>({extract:(o,n)=>{const r=ae(n),s=((t,o)=>zn(Mn(e)).extract(t,o))(o,r);return hn(s,(e=>{const r=F(e,(e=>yn(e,e,{tag:"required",process:{}},t)));return Fn(r).extract(o,n)}))},toString:()=>"setOf("+t.toString()+")"}),Un=y(zn,Fn),jn=w(Nn),Wn=(e,t)=>Mn((o=>{const n=typeof o;return e(o)?mn(o):gn(`Expected type: ${t} but got: ${n}`)})),$n=Wn(p,"number"),qn=Wn(s,"string"),Gn=Wn(d,"boolean"),Kn=Wn(h,"function"),Yn=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=>Yn(e[t])));default:return!1}},Xn=Mn((e=>Yn(e)?mn(e):gn("Expected value to be acceptable for sending via postMessage"))),Jn=(e,t,o,n)=>ve(o,n).fold((()=>((e,t,o)=>An(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+Dn(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))),Qn=(e,t)=>({extract:(o,n)=>ve(n,e).fold((()=>((e,t)=>An(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>Jn(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+ae(t)}),er=e=>Mn((t=>e(t).fold(gn,mn))),tr=(e,t)=>Zn((t=>cn(e(t))),t),or=(e,t,o)=>dn(((e,t,o)=>{const n=t.extract([e],o);return vn(n,(e=>({input:o,errors:e})))})(e,t,o)),nr=e=>e.fold((e=>{throw new Error(sr(e))}),x),rr=(e,t,o)=>nr(or(e,t,o)),sr=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:w("... (only showing first ten failures)")}]):e;return F(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+Dn(e.input),ar=(e,t)=>Qn(e,ce(t,Fn)),ir=(e,t)=>((e,t)=>{const o=eo(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),lr=yn,cr=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),dr=e=>er((t=>L(e,t)?nn.value(t):nn.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),mr=e=>lr(e,e,{tag:"required",process:{}},jn()),ur=(e,t)=>lr(e,e,{tag:"required",process:{}},t),gr=e=>ur(e,$n),hr=e=>ur(e,qn),pr=(e,t)=>lr(e,e,{tag:"required",process:{}},dr(t)),fr=e=>ur(e,Kn),vr=(e,t)=>lr(e,e,{tag:"required",process:{}},Fn(t)),br=(e,t)=>lr(e,e,{tag:"required",process:{}},Un(t)),yr=(e,t)=>lr(e,e,{tag:"required",process:{}},zn(t)),wr=e=>lr(e,e,{tag:"option",process:{}},jn()),xr=(e,t)=>lr(e,e,{tag:"option",process:{}},t),Cr=e=>xr(e,$n),Sr=e=>xr(e,qn),kr=(e,t)=>xr(e,dr(t)),_r=e=>xr(e,Kn),Er=(e,t)=>xr(e,zn(t)),Tr=(e,t)=>xr(e,Fn(t)),Or=(e,t)=>lr(e,e,_n(t),jn()),Dr=(e,t,o)=>lr(e,e,_n(t),o),Ar=(e,t)=>Dr(e,t,$n),Mr=(e,t)=>Dr(e,t,qn),Nr=(e,t,o)=>Dr(e,t,dr(o)),Rr=(e,t)=>Dr(e,t,Gn),Br=(e,t)=>Dr(e,t,Kn),Lr=(e,t,o)=>Dr(e,t,zn(o)),Hr=(e,t,o)=>Dr(e,t,Fn(o)),Ir=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Pr=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 z(e,((n,r)=>{const s=ae(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!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[r].apply(null,o)},match:e=>{const n=ae(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!K(t,(e=>L(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};Pr([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Fr=(e,t)=>((e,t)=>{const o={};return le(e,((e,n)=>{L(t,n)||(o[n]=e)})),o})(e,t),zr=(e,t)=>((e,t)=>({[e]:t}))(e,t),Vr=e=>(e=>{const t={};return z(e,(e=>{t[e.key]=e.value})),t})(e),Zr=(e,t)=>{const o=(e=>{const t=[],o=[];return z(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,nn.error(q(n))):((e,t)=>0===e.length?nn.value(t):nn.value(Cn(t,Sn.apply(void 0,e))))(o.values,t);var n},Ur=e=>h(e)?e:T,jr=(e,t,o)=>{let n=e.dom;const r=Ur(o);for(;n.parentNode;){n=n.parentNode;const e=Le.fromDom(n),o=t(e);if(o.isSome())return o;if(r(e))break}return D.none()},Wr=(e,t,o)=>{const n=t(e),r=Ur(o);return n.orThunk((()=>r(e)?D.none():jr(e,t,r)))},$r=(e,t)=>Je(e.element,t.event.target),qr={can:O,abort:T,run:v},Gr=e=>{if(!ye(e,"can")&&!ye(e,"abort")&&!ye(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...qr,...e}},Kr=e=>{const t=((e,t)=>(...o)=>j(e,((e,n)=>e&&t(n).apply(void 0,o)),!0))(e,(e=>e.can)),o=((e,t)=>(...o)=>j(e,((e,n)=>e||t(n).apply(void 0,o)),!1))(e,(e=>e.abort));return{can:t,abort:o,run:(...t)=>{z(e,(e=>{e.run.apply(void 0,t)}))}}},Yr=w,Xr=Yr("touchstart"),Jr=Yr("touchmove"),Qr=Yr("touchend"),es=Yr("touchcancel"),ts=Yr("mousedown"),os=Yr("mousemove"),ns=Yr("mouseout"),rs=Yr("mouseup"),ss=Yr("mouseover"),as=Yr("focusin"),is=Yr("focusout"),ls=Yr("keydown"),cs=Yr("keyup"),ds=Yr("input"),ms=Yr("change"),us=Yr("click"),gs=Yr("transitioncancel"),hs=Yr("transitionend"),ps=Yr("transitionstart"),fs=Yr("selectstart"),vs=e=>w("alloy."+e),bs={tap:vs("tap")},ys=vs("focus"),ws=vs("blur.post"),xs=vs("paste.post"),Cs=vs("receive"),Ss=vs("execute"),ks=vs("focus.item"),_s=bs.tap,Es=vs("longpress"),Ts=vs("sandbox.close"),Os=vs("typeahead.cancel"),Ds=vs("system.init"),As=vs("system.touchmove"),Ms=vs("system.touchend"),Ns=vs("system.scroll"),Rs=vs("system.resize"),Bs=vs("system.attached"),Ls=vs("system.detached"),Hs=vs("system.dismissRequested"),Is=vs("system.repositionRequested"),Ps=vs("focusmanager.shifted"),Fs=vs("slotcontainer.visibility"),zs=vs("system.external.element.scroll"),Vs=vs("change.tab"),Zs=vs("dismiss.tab"),Us=vs("highlight"),js=vs("dehighlight"),Ws=(e,t)=>{Ks(e,e.element,t,{})},$s=(e,t,o)=>{Ks(e,e.element,t,o)},qs=e=>{Ws(e,Ss())},Gs=(e,t,o)=>{Ks(e,t,o,{})},Ks=(e,t,o,n)=>{const r={target:t,...n};e.getSystem().triggerEvent(o,t,r)},Ys=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Xs=e=>Vr(e),Js=(e,t)=>({key:e,value:Gr({abort:t})}),Qs=e=>({key:e,value:Gr({run:(e,t)=>{t.event.prevent()}})}),ea=(e,t)=>({key:e,value:Gr({run:t})}),ta=(e,t,o)=>({key:e,value:Gr({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),oa=e=>t=>({key:e,value:Gr({run:(e,o)=>{$r(e,o)&&t(e,o)}})}),na=(e,t,o)=>((e,t)=>ea(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Ys(t,t.element,e,n)}))})))(e,t.partUids[o]),ra=(e,t)=>ea(e,((e,o)=>{const n=o.event,r=e.getSystem().getByDom(n.target).getOrThunk((()=>Wr(n.target,(t=>e.getSystem().getByDom(t).toOptional()),T).getOr(e)));t(e,r,o)})),sa=e=>ea(e,((e,t)=>{t.cut()})),aa=e=>ea(e,((e,t)=>{t.stop()})),ia=(e,t)=>oa(e)(t),la=oa(Bs()),ca=oa(Ls()),da=oa(Ds()),ma=(e=>t=>ea(e,t))(Ss()),ua=e=>e.dom.innerHTML,ga=(e,t)=>{const o=et(e).dom,n=Le.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,it(Le.fromDom(o))})(t,o);Po(n,r),Fo(e),Io(e,n)},ha=(e,t)=>Le.fromDom(e.dom.cloneNode(t)),pa=e=>{if(ut(e))return"#shadow-root";{const t=(e=>ha(e,!1))(e);return(e=>{const t=Le.fromTag("div"),o=Le.fromDom(e.dom.cloneNode(!0));return Io(t,o),ua(t)})(t)}},fa=e=>pa(e),va=Xs([((e,t)=>({key:e,value:Gr({can:t})}))(ys(),((e,t)=>{const o=t.event,n=o.originator,r=o.target;return!((e,t,o)=>Je(t,e.element)&&!Je(t,o))(e,n,r)||(console.warn(ys()+" did not get interpreted by the desired target. \nOriginator: "+fa(n)+"\nTarget: "+fa(r)+"\nCheck the "+ys()+" event handlers"),!1)}))]);var ba=Object.freeze({__proto__:null,events:va});let ya=0;const wa=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return ya++,e+"_"+o+ya+String(t)},xa=w("alloy-id-"),Ca=w("data-alloy-id"),Sa=xa(),ka=Ca(),_a=(e,t)=>{Object.defineProperty(e.dom,ka,{value:t,writable:!0})},Ea=e=>{const t=je(e)?e.dom[ka]:null;return D.from(t)},Ta=e=>wa(e),Oa=x,Da=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+fa(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:w("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}},Aa=Da(),Ma=e=>F(e,(e=>De(e,"/*")?e.substring(0,e.length-2):e)),Na=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Ma(s)}),e},Ra=wa("alloy-premade"),Ba=e=>(Object.defineProperty(e.element.dom,Ra,{value:e.uid,writable:!0}),zr(Ra,e)),La=e=>ve(e,Ra),Ha=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Ma(s.slice(1))}),e})(((t,...o)=>e(t.getApis(),t,...o)),e),Ia={init:()=>Pa({readState:w("No State required")})},Pa=e=>e,Fa=(e,t)=>{const o={};return le(e,((e,n)=>{le(e,((e,r)=>{const s=ve(o,r).getOr([]);o[r]=s.concat([t(n,e)])}))})),o},za=e=>({classes:m(e.classes)?[]:e.classes,attributes:m(e.attributes)?{}:e.attributes,styles:m(e.styles)?{}:e.styles}),Va=e=>e.cHandler,Za=(e,t)=>({name:e,handler:t}),Ua=(e,t)=>{const o={};return z(e,(e=>{o[e.name()]=e.handlers(t)})),o},ja=(e,t,o,n)=>{const r=((e,t,o)=>{const n={...o,...Ua(t,e)};return Fa(n,Za)})(e,o,n);return qa(r,t)},Wa=e=>{const t=(e=>h(e)?{can:O,abort:T,run:e}:e)(e);return(e,o,...n)=>{const r=[e,o].concat(n);t.abort.apply(void 0,r)?o.stop():t.can.apply(void 0,r)&&t.run.apply(void 0,r)}},$a=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const r=ee(o,((o,r)=>{const s=o[t],a=r[t],i=n.indexOf(s),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i{const t=F(e,(e=>e.handler));return Kr(t)})):((e,t)=>nn.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(F(t,(e=>e.name)),null,2)]))(o,e)},qa=(e,t)=>{const o=he(e,((e,o)=>(1===e.length?nn.value(e[0].handler):$a(e,t,o)).map((n=>{const r=Wa(n),s=e.length>1?Z(t[o],(t=>H(e,(e=>e.name===t)))).join(" > "):e[0].name;return zr(o,((e,t)=>({handler:e,purpose:t}))(r,s))}))));return Zr(o,{})},Ga="alloy.base.behaviour",Ka=Fn([lr("dom","dom",{tag:"required",process:{}},Fn([mr("tag"),Or("styles",{}),Or("classes",[]),Or("attributes",{}),wr("value"),wr("innerHtml")])),mr("components"),mr("uid"),Or("events",{}),Or("apis",{}),lr("eventOrder","eventOrder",(e=>En(w(e)))({[Ss()]:["disabling",Ga,"toggling","typeaheadevents"],[ys()]:[Ga,"focusing","keying"],[Ds()]:[Ga,"disabling","toggling","representing"],[ds()]:[Ga,"representing","streaming","invalidating"],[Ls()]:[Ga,"representing","item-events","toolbar-button-events","tooltipping"],[ts()]:["focusing",Ga,"item-type-events"],[Xr()]:["focusing",Ga,"item-type-events"],[ss()]:["item-type-events","tooltipping"],[Cs()]:["receiving","reflecting","tooltipping"]}),jn()),wr("domModification")]),Ya=e=>e.events,Xa=(e,t)=>{const o=Et(e,t);return void 0===o||""===o?[]:o.split(" ")},Ja=e=>void 0!==e.dom.classList,Qa=e=>Xa(e,"class"),ei=(e,t)=>((e,t,o)=>{const n=Xa(e,t).concat([o]);return kt(e,t,n.join(" ")),!0})(e,"class",t),ti=(e,t)=>((e,t,o)=>{const n=Z(Xa(e,t),(e=>e!==o));return n.length>0?kt(e,t,n.join(" ")):Dt(e,t),!1})(e,"class",t),oi=(e,t)=>{Ja(e)?e.dom.classList.add(t):ei(e,t)},ni=e=>{0===(Ja(e)?e.dom.classList:Qa(e)).length&&Dt(e,"class")},ri=(e,t)=>{if(Ja(e)){e.dom.classList.remove(t)}else ti(e,t);ni(e)},si=(e,t)=>{const o=Ja(e)?e.dom.classList.toggle(t):((e,t)=>L(Qa(e),t)?ti(e,t):ei(e,t))(e,t);return ni(e),o},ai=(e,t)=>Ja(e)&&e.dom.classList.contains(t),ii=(e,t)=>{z(t,(t=>{oi(e,t)}))},li=(e,t)=>{z(t,(t=>{ri(e,t)}))},ci=e=>Ja(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;ee.dom.value,mi=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},ui=(e,t,o)=>{o.fold((()=>Io(e,t)),(e=>{Je(e,t)||(Bo(e,t),zo(e))}))},gi=(e,t,o)=>{const n=F(t,o),r=it(e);return z(r.slice(n.length),zo),n},hi=(e,t,o,n)=>{const r=lt(e,t),s=n(o,r),a=((e,t,o)=>lt(e,t).map((e=>{if(o.exists((t=>!Je(t,e)))){const t=o.map(Ve).getOr("span"),n=Le.fromTag(t);return Bo(e,n),n}return e})))(e,t,r);return ui(e,s.element,a),s},pi=(e,t)=>{const o=ae(e),n=ae(t),r=X(n,o),s=((e,t)=>{const o={},n={};return ue(e,t,me(o),me(n)),{t:o,f:n}})(e,((e,o)=>!be(t,o)||e!==t[o])).t;return{toRemove:r,toSet:s}},fi=(e,t)=>{const{class:o,style:n,...r}=(e=>j(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:s,toRemove:a}=pi(e.attributes,r),i=Pt(t),{toSet:l,toRemove:c}=pi(e.styles,i),d=ci(t),m=X(d,e.classes),u=X(e.classes,d);return z(a,(e=>Dt(t,e))),_t(t,s),ii(t,u),li(t,m),z(c,(e=>zt(t,e))),Rt(t,l),e.innerHtml.fold((()=>{const o=e.domChildren;((e,t)=>{gi(e,t,((t,o)=>{const n=lt(e,o);return ui(e,t,n),t}))})(t,o)}),(e=>{ga(t,e)})),(()=>{const o=t,n=e.value.getOrUndefined();n!==di(o)&&mi(o,null!=n?n:"")})(),t},vi=(e,t)=>{const o=t.filter((t=>Ve(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>be(e.dom,Ra))(t))).bind((t=>((e,t)=>{try{const o=fi(e,t);return D.some(o)}catch(e){return D.none()}})(e,t))).getOrThunk((()=>(e=>{const t=Le.fromTag(e.tag);_t(t,e.attributes),ii(t,e.classes),Rt(t,e.styles),e.innerHtml.each((e=>ga(t,e)));const o=e.domChildren;return Po(t,o),e.value.each((e=>{mi(t,e)})),t})(e)));return _a(o,e.uid),o},bi=(e,t)=>((e,t)=>{const o=F(t,(e=>Tr(e.name(),[mr("config"),Or("state",Ia)]))),n=or("component.behaviours",Fn(o),e.behaviours).fold((t=>{throw new Error(sr(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),x);return{list:t,data:ce(n,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return w(t)}))}})(e,t),yi=e=>{const t=(e=>{const t=ve(e,"behaviours").getOr({});return G(ae(t),(e=>{const o=t[e];return g(o)?[o.me]:[]}))})(e);return bi(e,t)},wi=(e,t,o)=>{const n={...(r=e).dom,uid:r.uid,domChildren:F(r.components,(e=>e.element))};var r;const s=(e=>e.domModification.fold((()=>za({})),za))(e),a={"alloy.base.modification":s},i=t.length>0?((e,t,o,n)=>{const r={...t};z(o,(t=>{r[t.name()]=t.exhibit(e,n)}));const s=Fa(r,((e,t)=>({name:e,modification:t}))),a=e=>U(e,((e,t)=>({...t.modification,...e})),{}),i=U(s.classes,((e,t)=>t.modification.concat(e)),[]),l=a(s.attributes),c=a(s.styles);return za({classes:i,attributes:l,styles:c})})(o,a,t,n):s;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},xi=(e,t)=>{const o=()=>u,n=Ir(Aa),r=nr((e=>or("custom.definition",Ka,e))(e)),s=yi(e),a=(e=>e.list)(s),i=(e=>e.data)(s),l=wi(r,a,i),c=vi(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":Ya(e)};return ja(o,e.eventOrder,t,n).getOrDie()})(r,a,i),m=Ir(r.components),u={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(h(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>h(i[e.name()]),spec:e,readState:e=>i[e]().map((e=>e.state.readState())).getOr("not enabled"),getApis:()=>r.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(Da(o))},element:c,syncComponents:()=>{const e=it(c),t=G(e,(e=>n.get().getByDom(e).fold((()=>[]),Q)));m.set(t)},components:m.get,events:d};return u},Ci=(e,t)=>{const{events:o,...n}=Oa(e),r=((e,t)=>{const o=ve(e,"components").getOr([]);return t.fold((()=>F(o,Ti)),(e=>F(o,((t,o)=>Ei(t,lt(e,o))))))})(n,t),s={...n,events:{...ba,...o},components:r};return nn.value(xi(s,t))},Si=e=>{const t=Le.fromText(e);return ki({element:t})},ki=e=>{const t=rr("external.component",Pn([mr("element"),wr("uid")]),e),o=Ir(Da()),n=t.uid.getOrThunk((()=>Ta("external")));_a(t.element,n);const r={uid:n,getSystem:o.get,config:D.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(Da((()=>r)))},getApis:()=>({}),element:t.element,spec:e,readState:w("No state"),syncComponents:v,components:w([]),events:{}};return Ba(r)},_i=Ta,Ei=(e,t)=>La(e).getOrThunk((()=>{const o=(e=>be(e,"uid"))(e)?e:{uid:_i(""),...e};return Ci(o,t).getOrDie()})),Ti=e=>Ei(e,D.none()),Oi=Ba;var Di=(e,t,o,n,r)=>e(o,n)?D.some(o):h(r)&&r(o)?D.none():t(o,n,r);const Ai=(e,t,o)=>{let n=e.dom;const r=h(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=Le.fromDom(n);if(t(e))return D.some(e);if(r(e))break}return D.none()},Mi=(e,t,o)=>Di(((e,t)=>t(e)),Ai,e,t,o),Ni=(e,t,o)=>Mi(e,t,o).isSome(),Ri=(e,t,o)=>Ai(e,(e=>Ke(e,t)),o),Bi=(e,t)=>((e,t)=>W(e.dom.childNodes,(e=>t(Le.fromDom(e)))).map(Le.fromDom))(e,(e=>Ke(e,t))),Li=(e,t)=>Xe(t,e),Hi=(e,t,o)=>Di(((e,t)=>Ke(e,t)),Ri,e,t,o),Ii="aria-controls",Pi=()=>{const e=wa(Ii);return{id:e,link:t=>{kt(t,Ii,e)},unlink:e=>{Dt(e,Ii)}}},Fi=(e,t)=>(e=>Mi(e,(e=>{if(!je(e))return!1;const t=Et(e,"id");return void 0!==t&&t.indexOf(Ii)>-1})).bind((e=>{const t=Et(e,"id"),o=pt(e);return Li(o,`[${Ii}="${t}"]`)})))(t).exists((t=>zi(e,t))),zi=(e,t)=>Ni(t,(t=>Je(t,e.element)),T)||Fi(e,t),Vi="unknown";var Zi;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(Zi||(Zi={}));const Ui=Ir({}),ji=(e,t,o)=>{switch(ve(Ui.get(),e).orThunk((()=>{const t=ae(Ui.get());return se(t,(t=>e.indexOf(t)>-1?D.some(Ui.get()[t]):D.none()))})).getOr(Zi.NORMAL)){case Zi.NORMAL:return o(qi());case Zi.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 r=(new Date).getTime();L(["mousemove","mouseover","mouseout",Ds()],e)||console.log(e,{event:e,time:r-n,target:t.dom,sequence:F(o,(e=>L(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+fa(e.target)+")":e.outcome))})}}})(e,t),r=o(n);return n.write(),r}case Zi.STOP:return!0}},Wi=["alloy/data/Fields","alloy/debugging/Debugging"],$i=(e,t,o)=>ji(e,t,o),qi=w({logEventCut:v,logEventStopped:v,logNoParent:v,logEventNoHandlers:v,logEventResponse:v,write:v}),Gi=w([mr("menu"),mr("selectedMenu")]),Ki=w([mr("item"),mr("selectedItem")]);w(Fn(Ki().concat(Gi())));const Yi=w(Fn(Ki())),Xi=vr("initSize",[mr("numColumns"),mr("numRows")]),Ji=()=>vr("markers",[mr("backgroundMenu")].concat(Gi()).concat(Ki())),Qi=e=>vr("markers",F(e,mr)),el=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");return W(t,(e=>e.indexOf("alloy")>0&&!H(Wi,(t=>e.indexOf(t)>-1)))).getOr(Vi)}})(),lr(t,t,o,er((e=>nn.value(((...t)=>e.apply(void 0,t))))))),tl=e=>el(0,e,_n(v)),ol=e=>el(0,e,_n(D.none)),nl=e=>el(0,e,{tag:"required",process:{}}),rl=e=>el(0,e,{tag:"required",process:{}}),sl=(e,t)=>cr(e,w(t)),al=e=>cr(e,x),il=w(Xi),ll=(e,t,o,n,r,s,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:r,restriction:s,label:`${a}-${r}`,alwaysFit:i}),cl=Pr([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),dl=cl.southeast,ml=cl.southwest,ul=cl.northeast,gl=cl.northwest,hl=cl.south,pl=cl.north,fl=cl.east,vl=cl.west,bl=(e,t,o,n)=>{const r=e+t;return r>n?o:rMath.min(Math.max(e,t),o),wl=(e,t)=>J(["left","right","top","bottom"],(o=>ve(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))))),xl="layout",Cl=e=>e.x,Sl=(e,t)=>e.x+e.width/2-t.width/2,kl=(e,t)=>e.x+e.width-t.width,_l=(e,t)=>e.y-t.height,El=e=>e.y+e.height,Tl=(e,t)=>e.y+e.height/2-t.height/2,Ol=(e,t,o)=>ll(Cl(e),El(e),o.southeast(),dl(),"southeast",wl(e,{left:1,top:3}),xl),Dl=(e,t,o)=>ll(kl(e,t),El(e),o.southwest(),ml(),"southwest",wl(e,{right:0,top:3}),xl),Al=(e,t,o)=>ll(Cl(e),_l(e,t),o.northeast(),ul(),"northeast",wl(e,{left:1,bottom:2}),xl),Ml=(e,t,o)=>ll(kl(e,t),_l(e,t),o.northwest(),gl(),"northwest",wl(e,{right:0,bottom:2}),xl),Nl=(e,t,o)=>ll(Sl(e,t),_l(e,t),o.north(),pl(),"north",wl(e,{bottom:2}),xl),Rl=(e,t,o)=>ll(Sl(e,t),El(e),o.south(),hl(),"south",wl(e,{top:3}),xl),Bl=(e,t,o)=>ll((e=>e.x+e.width)(e),Tl(e,t),o.east(),fl(),"east",wl(e,{left:0}),xl),Ll=(e,t,o)=>ll(((e,t)=>e.x-t.width)(e,t),Tl(e,t),o.west(),vl(),"west",wl(e,{right:1}),xl),Hl=()=>[Ol,Dl,Al,Ml,Rl,Nl,Bl,Ll],Il=()=>[Dl,Ol,Ml,Al,Rl,Nl,Bl,Ll],Pl=()=>[Al,Ml,Ol,Dl,Nl,Rl],Fl=()=>[Ml,Al,Dl,Ol,Nl,Rl],zl=()=>[Ol,Dl,Al,Ml,Rl,Nl],Vl=()=>[Dl,Ol,Ml,Al,Rl,Nl];var Zl=Object.freeze({__proto__:null,events:e=>Xs([ea(Cs(),((t,o)=>{const n=e.channels,r=ae(n),s=o,a=((e,t)=>t.universal?e:Z(e,(e=>L(t.channels,e))))(r,s);z(a,(e=>{const o=n[e],r=o.schema,a=rr("channel["+e+"] data\nReceiver: "+fa(t.element),r,s.data);o.onReceive(t,a)}))}))])}),Ul=[ur("channels",tr(nn.value,Pn([nl("onReceive"),Or("schema",jn())])))];const jl=(e,t,o)=>da(((n,r)=>{o(n,e,t)})),Wl=(e,t,o)=>((e,t,o)=>{const n=o.toString(),r=n.indexOf(")")+1,s=n.indexOf("("),a=n.substring(s+1,r-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Ma(a.slice(0,1).concat(a.slice(3)))}),e})(((n,...r)=>{const s=[n].concat(r);return n.config({name:w(e)}).fold((()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)}),(e=>{const o=Array.prototype.slice.call(s,1);return t.apply(void 0,[n,e.config,e.state].concat(o))}))}),o,t),$l=e=>({key:e,value:void 0}),ql=(e,t,o,n,r,s,a)=>{const i=e=>ye(e,o)?e[o]():D.none(),l=ce(r,((e,t)=>Wl(o,e,t))),c={...ce(s,((e,t)=>Na(e,t))),...l,revoke:S($l,o),config:t=>{const n=rr(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:eo((()=>rr(o+"-config",e,t))),initialConfig:t,state:a}}},schema:w(t),exhibit:(e,t)=>Ce(i(e),ve(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>za({}))),name:w(o),handlers:e=>i(e).map((e=>ve(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},Gl=e=>Vr(e),Kl=Pn([mr("fields"),mr("name"),Or("active",{}),Or("apis",{}),Or("state",Ia),Or("extra",{})]),Yl=e=>{const t=rr("Creating behaviour: "+e.name,Kl,e);return((e,t,o,n,r,s)=>{const a=Pn(e),i=Tr(t,[(l="config",c=e,xr(l,Pn(c)))]);var l,c;return ql(a,i,t,o,n,r,s)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},Xl=Pn([mr("branchKey"),mr("branches"),mr("name"),Or("active",{}),Or("apis",{}),Or("state",Ia),Or("extra",{})]),Jl=e=>{const t=rr("Creating behaviour: "+e.name,Xl,e);return((e,t,o,n,r,s)=>{const a=e,i=Tr(t,[xr("config",e)]);return ql(a,i,t,o,n,r,s)})(ar(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},Ql=w(void 0),ec=Yl({fields:Ul,name:"receiving",active:Zl});var tc=Object.freeze({__proto__:null,exhibit:(e,t)=>za({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const oc=(e,t=!1)=>e.dom.focus({preventScroll:t}),nc=e=>e.dom.blur(),rc=e=>{const t=pt(e).dom;return e.dom===t.activeElement},sc=(e=Wo())=>D.from(e.dom.activeElement).map(Le.fromDom),ac=e=>sc(pt(e)).filter((t=>e.dom.contains(t.dom))),ic=(e,t)=>{const o=pt(t),n=sc(o).bind((e=>{const o=t=>Je(e,t);return o(t)?D.some(t):((e,t)=>{const o=e=>{for(let n=0;n{sc(o).filter((t=>Je(t,e))).fold((()=>{oc(e)}),v)})),r},lc=(e,t,o,n,r)=>{const s=e=>e+"px";return{position:e,left:t.map(s),top:o.map(s),right:n.map(s),bottom:r.map(s)}},cc=(e,t)=>{Bt(e,(e=>({...e,position:D.some(e.position)}))(t))},dc=Pr([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),mc=(e,t,o,n,r,s)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=r-(i+a.width),d=s-(l+a.height),m=D.some(i),u=D.some(l),g=D.some(c),h=D.some(d),p=D.none();return((e,t,o,n,r,s,a,i,l)=>e.fold(t,o,n,r,s,a,i,l))(t.direction,(()=>lc(e,m,u,p,p)),(()=>lc(e,p,u,g,p)),(()=>lc(e,m,p,p,h)),(()=>lc(e,p,p,g,h)),(()=>lc(e,m,u,p,p)),(()=>lc(e,m,p,p,h)),(()=>lc(e,m,u,p,p)),(()=>lc(e,p,u,g,p)))},uc=(e,t)=>e.fold((()=>{const e=t.rect;return lc("absolute",D.some(e.x),D.some(e.y),D.none(),D.none())}),((e,o,n,r)=>mc("absolute",t,e,o,n,r)),((e,o,n,r)=>mc("fixed",t,e,o,n,r))),gc=(e,t)=>{const o=S(Go,t),n=e.fold(o,o,(()=>{const e=Vo();return Go(t).translate(-e.left,-e.top)})),r=Qt(t),s=Wt(t);return Ko(n.left,n.top,r,s)},hc=(e,t)=>t.fold((()=>e.fold(Qo,Qo,Ko)),(t=>e.fold(w(t),w(t),(()=>{const o=pc(e,t.x,t.y);return Ko(o.left,o.top,t.width,t.height)})))),pc=(e,t,o)=>{const n=qt(t,o);return e.fold(w(n),w(n),(()=>{const e=Vo();return n.translate(-e.left,-e.top)}))};dc.none;const fc=dc.relative,vc=dc.fixed,bc=(e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t),yc="data-alloy-placement",wc=e=>Tt(e,yc),xc=Pr([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),Cc=(e,t,o,n)=>{const r=e.bubble,s=r.offset,a=((e,t,o)=>{const n=(n,r)=>t[n].map((t=>{const s="top"===n||"bottom"===n,a=s?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,r)+a;return s?yl(i,e.y,e.bottom):yl(i,e.x,e.right)})).getOr(r),r=n("left",e.x),s=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Ko(r,s,a-r,i-s)})(n,e.restriction,s),i=e.x+s.left,l=e.y+s.top,c=Ko(i,l,t,o),{originInBounds:d,sizeInBounds:m,visibleW:u,visibleH:g}=((e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,right:l,bottom:c,width:d,height:m}=e;return{originInBounds:a>=o&&a<=r&&i>=n&&i<=s,sizeInBounds:l<=r&&l>=o&&c<=s&&c>=n,visibleW:Math.min(d,a>=o?r-a:l-o),visibleH:Math.min(m,i>=n?s-i:c-n)}})(c,a),h=d&&m,p=h?c:((e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,r-l),m=Math.max(n,s-c),u=yl(a,o,d),g=yl(i,n,m),h=Math.min(u+l,r)-u,p=Math.min(g+c,s)-g;return Ko(u,g,h,p)})(c,a),f=p.width>0&&p.height>0,{maxWidth:v,maxHeight:b}=((e,t,o)=>{const n=w(t.bottom-o.y),r=w(o.bottom-t.y),s=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,r,r,n),a=w(t.right-o.x),i=w(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:s}})(e.direction,p,n),y={rect:p,maxHeight:b,maxWidth:v,direction:e.direction,placement:e.placement,classes:{on:r.classesOn,off:r.classesOff},layout:e.label,testY:l};return h||e.alwaysFit?xc.fit(y):xc.nofit(y,u,g,f)},Sc=e=>{const t=Ir(D.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(D.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(D.some(e))}}},kc=()=>Sc((e=>e.unbind())),_c=()=>{const e=Sc(v);return{...e,on:t=>e.get().each(t)}},Ec=O,Tc=(e,t,o)=>((e,t,o,n)=>No(e,t,o,n,!1))(e,t,Ec,o),Oc=(e,t,o)=>((e,t,o,n)=>No(e,t,o,n,!0))(e,t,Ec,o),Dc=Mo,Ac=["top","bottom","right","left"],Mc="data-alloy-transition-timer",Nc=(e,t)=>((e,t)=>K(t,(t=>ai(e,t))))(e,t.classes),Rc=(e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,((t,n)=>!((e,t,o=C)=>Ce(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o)))).isSome()},Bc=(e,t)=>{const o=kc(),n=kc();let r;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return Je(t.target,e)&&Ne(n)&&L(Ac,t.raw.propertyName)},i=s=>{if(u(s)||a(s)){o.clear(),n.clear();const a=null==s?void 0:s.raw.type;(u(a)||a===hs())&&(clearTimeout(r),Dt(e,Mc),li(e,t.classes))}},l=Tc(e,ps(),(t=>{a(t)&&(l.unbind(),o.set(Tc(e,hs(),i)),n.set(Tc(e,gs(),i)))})),c=(e=>{const t=t=>{const o=Lt(e,t).split(/\s*,\s*/);return Z(o,Me)},o=e=>{if(s(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return De(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),r=t("transition-duration");return j(r,((e,t,r)=>{const s=o(n[r])+o(t);return Math.max(e,s)}),0)})(e);requestAnimationFrame((()=>{r=setTimeout(i,c+17),kt(e,Mc,r)}))},Lc=(e,t,o,n,r,s)=>{const a=((e,t,o)=>o.exists((o=>{const n=e.mode;return"all"===n||o[n]!==t[n]})))(n,r,s);if(a||Nc(e,n)){Nt(e,"position",o.position);const s=gc(t,e),i=uc(t,{...r,rect:s}),l=J(Ac,(e=>i[e]));Rc(o,l)&&(Bt(e,l),a&&((e,t)=>{ii(e,t.classes),Tt(e,Mc).each((t=>{clearTimeout(parseInt(t,10)),Dt(e,Mc)})),Bc(e,t)})(e,n),Vt(e))}else li(e,n.classes)},Hc=(e,t,o,n)=>{zt(t,"max-height"),zt(t,"max-width");const r={width:Qt(s=t),height:Wt(s)};var s;return((e,t,o,n,r,s)=>{const a=n.width,i=n.height,l=(t,l,c,d,m)=>{const u=t(o,n,r,e,s),g=Cc(u,a,i,s);return g.fold(w(g),((e,t,o,n)=>(m===n?o>d||t>c:!m&&n)?g:xc.nofit(l,c,d,m)))},c=j(t,((e,t)=>{const o=S(l,t);return e.fold(w(e),o)}),xc.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:dl(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1));return c.fold(x,x)})(t,n.preference,e,r,o,n.bounds)},Ic=(e,t)=>{((e,t)=>{kt(e,yc,t)})(e,t.placement)},Pc=(e,t)=>{((e,t)=>{const o=Ut.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);Nt(e,"max-height",o+"px")})(e,Math.floor(t))},Fc=w(((e,t)=>{Pc(e,t),Rt(e,{"overflow-x":"hidden","overflow-y":"auto"})})),zc=w(((e,t)=>{Pc(e,t)})),Vc=(e,t,o)=>void 0===e[t]?o:e[t],Zc=(e,t,o,n)=>{const r=Hc(e,t,o,n);return((e,t,o)=>{const n=uc(o.origin,t);o.transition.each((r=>{Lc(e,o.origin,n,r,t,o.lastPlacement)})),cc(e,n)})(t,r,n),Ic(t,r),((e,t)=>{const o=t.classes;li(e,o.off),ii(e,o.on)})(t,r),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,r,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,r,n),{layout:r.layout,placement:r.placement}},Uc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],jc=(e,t,o,n=1)=>{const r=e*n,s=t*n,a=e=>ve(o,e).getOr([]),i=(e,t,o)=>{const n=X(Uc,o);return{offset:qt(e,t),classesOn:G(o,a),classesOff:G(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(r,s,["top","alignLeft","inset"]),insetNorthwest:()=>i(-r,s,["top","alignRight","inset"]),insetNorth:()=>i(-r/2,s,["top","alignCentre","inset"]),insetSoutheast:()=>i(r,-s,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-r,-s,["bottom","alignRight","inset"]),insetSouth:()=>i(-r/2,-s,["bottom","alignCentre","inset"]),insetEast:()=>i(-r,-s/2,["valignCentre","right","inset"]),insetWest:()=>i(r,-s/2,["valignCentre","left","inset"])}},Wc=()=>jc(0,0,{}),$c=x,qc=(e,t)=>o=>"rtl"===Gc(o)?t:e,Gc=e=>"rtl"===Lt(e,"direction")?"rtl":"ltr";var Kc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Kc||(Kc={}));const Yc="data-alloy-vertical-dir",Xc=e=>Ni(e,(e=>je(e)&&Et(e,"data-alloy-vertical-dir")===Kc.BottomToTop)),Jc=()=>Tr("layouts",[mr("onLtr"),mr("onRtl"),wr("onBottomLtr"),wr("onBottomRtl")]),Qc=(e,t,o,n,r,s,a)=>{const i=a.map(Xc).getOr(!1),l=t.layouts.map((t=>t.onLtr(e))),c=t.layouts.map((t=>t.onRtl(e))),d=i?t.layouts.bind((t=>t.onBottomLtr.map((t=>t(e))))).or(l).getOr(r):l.getOr(o),m=i?t.layouts.bind((t=>t.onBottomRtl.map((t=>t(e))))).or(c).getOr(s):c.getOr(n);return qc(d,m)(e)};var ed=[mr("hotspot"),wr("bubble"),Or("overrides",{}),Jc(),sl("placement",((e,t,o)=>{const n=t.hotspot,r=gc(o,n.element),s=Qc(e.element,t,zl(),Vl(),Pl(),Fl(),D.some(t.hotspot.element));return D.some($c({anchorBox:r,bubble:t.bubble.getOr(Wc()),overrides:t.overrides,layouts:s}))}))];var td=[mr("x"),mr("y"),Or("height",0),Or("width",0),Or("bubble",Wc()),Or("overrides",{}),Jc(),sl("placement",((e,t,o)=>{const n=pc(o,t.x,t.y),r=Ko(n.left,n.top,t.width,t.height),s=Qc(e.element,t,Hl(),Il(),Hl(),Il(),D.none());return D.some($c({anchorBox:r,bubble:t.bubble,overrides:t.overrides,layouts:s}))}))];const od=Pr([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),nd=e=>e.fold(x,((e,t,o)=>e.translate(-t,-o))),rd=e=>e.fold(x,x),sd=e=>j(e,((e,t)=>e.translate(t.left,t.top)),qt(0,0)),ad=e=>{const t=F(e,rd);return sd(t)},id=od.screen,ld=od.absolute,cd=(e,t,o)=>{const n=et(e.element),r=Vo(n),s=((e,t,o)=>{const n=nt(o.root).dom;return D.from(n.frameElement).map(Le.fromDom).filter((t=>{const o=et(t),n=et(e.element);return Je(o,n)})).map(Kt)})(e,0,o).getOr(r);return ld(s,r.left,r.top)},dd=(e,t,o,n)=>{const r=id(qt(e,t));return D.some(((e,t,o)=>({point:e,width:t,height:o}))(r,o,n))},md=(e,t,o,n,r)=>e.map((e=>{const s=[t,e.point],a=(i=()=>ad(s),l=()=>ad(s),c=()=>(e=>{const t=F(e,nd);return sd(t)})(s),n.fold(i,l,c));var i,l,c;const d=((e,t,o,n)=>({x:e,y:t,width:o,height:n}))(a.left,a.top,e.width,e.height),m=o.showAbove?Pl():zl(),u=o.showAbove?Fl():Vl(),g=Qc(r,o,m,u,m,u,D.none());return $c({anchorBox:d,bubble:o.bubble.getOr(Wc()),overrides:o.overrides,layouts:g})}));var ud=[mr("node"),mr("root"),wr("bubble"),Jc(),Or("overrides",{}),Or("showAbove",!1),sl("placement",((e,t,o)=>{const n=cd(e,0,t);return t.node.filter(wt).bind((r=>{const s=r.dom.getBoundingClientRect(),a=dd(s.left,s.top,s.width,s.height),i=t.node.getOr(e.element);return md(a,n,t,o,i)}))}))];const gd=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),hd=Pr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),pd=(hd.before,hd.on,hd.after,e=>e.fold(x,x,x)),fd=Pr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),vd={domRange:fd.domRange,relative:fd.relative,exact:fd.exact,exactFromRange:e=>fd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Le.fromDom(e.startContainer),relative:(e,t)=>pd(e),exact:(e,t,o,n)=>e}))(e);return nt(t)},range:gd},bd=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.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},yd=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},wd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),xd=Pr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Cd=(e,t,o)=>t(Le.fromDom(o.startContainer),o.startOffset,Le.fromDom(o.endContainer),o.endOffset),Sd=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:w(e),rtl:D.none}),relative:(t,o)=>({ltr:eo((()=>bd(e,t,o))),rtl:eo((()=>D.some(bd(e,o,t))))}),exact:(t,o,n,r)=>({ltr:eo((()=>yd(e,t,o,n,r))),rtl:eo((()=>D.some(yd(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();if(o.collapsed)return t.rtl().filter((e=>!1===e.collapsed)).map((e=>xd.rtl(Le.fromDom(e.endContainer),e.endOffset,Le.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Cd(0,xd.ltr,o)));return Cd(0,xd.ltr,o)})(0,o)},kd=(e,t)=>Sd(e,t).match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}});xd.ltr,xd.rtl;const _d=(e,t,o)=>Z(((e,t)=>{const o=h(t)?t:T;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Le.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r})(e,o),t),Ed=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ye(o)?[]:F(o.querySelectorAll(e),Le.fromDom)})(t,e),Td=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=et(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Je(e,o)&&t===n;return r.collapsed&&!s},Od=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return D.some(gd(Le.fromDom(t.startContainer),t.startOffset,Le.fromDom(o.endContainer),o.endOffset))}return D.none()},Dd=e=>{if(null===e.anchorNode||null===e.focusNode)return Od(e);{const t=Le.fromDom(e.anchorNode),o=Le.fromDom(e.focusNode);return Td(t,e.anchorOffset,o,e.focusOffset)?D.some(gd(t,e.anchorOffset,o,e.focusOffset)):Od(e)}},Ad=e=>(e=>D.from(e.getSelection()))(e).filter((e=>e.rangeCount>0)).bind(Dd),Md=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?D.some(o).map(wd):D.none()})(kd(e,t)),Nd=(e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?D.some(t).map(wd):D.none()})(kd(e,t)),Rd=((e,t)=>{const o=t=>e(t)?D.from(t.dom.nodeValue):D.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})(We,"text"),Bd=(e,t)=>({element:e,offset:t}),Ld=(e,t)=>{const o=it(e);if(0===o.length)return Bd(e,t);if(tRd.get(e))(e).length:it(e).length;return Bd(e,t)}},Hd=(e,t)=>We(e)?Bd(e,t):Ld(e,t),Id=e=>void 0!==e.foffset,Pd=(e,t)=>t.getSelection.getOrThunk((()=>()=>Ad(e)))().map((e=>{if(Id(e)){const t=Hd(e.start,e.soffset),o=Hd(e.finish,e.foffset);return vd.range(t.element,t.offset,o.element,o.offset)}return e}));var Fd=[wr("getSelection"),mr("root"),wr("bubble"),Jc(),Or("overrides",{}),Or("showAbove",!1),sl("placement",((e,t,o)=>{const n=nt(t.root).dom,r=cd(e,0,t),s=Pd(n,t).bind((e=>{if(Id(e)){const t=Nd(n,vd.exactFromRange(e)).orThunk((()=>{const t=Le.fromText("\ufeff");Bo(e.start,t);const o=Md(n,vd.exact(t,0,t,1));return zo(t),o}));return t.bind((e=>dd(e.left,e.top,e.width,e.height)))}{const t=ce(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 dd(o.left,o.top,o.right-o.left,o.bottom-o.top)}})),a=Pd(n,t).bind((e=>Id(e)?je(e.start)?D.some(e.start):st(e.start):D.some(e.firstCell))).getOr(e.element);return md(s,r,t,o,a)}))];const zd="link-layout",Vd=e=>e.x+e.width,Zd=(e,t)=>e.x-t.width,Ud=(e,t)=>e.y-t.height+e.height,jd=e=>e.y,Wd=(e,t,o)=>ll(Vd(e),jd(e),o.southeast(),dl(),"southeast",wl(e,{left:0,top:2}),zd),$d=(e,t,o)=>ll(Zd(e,t),jd(e),o.southwest(),ml(),"southwest",wl(e,{right:1,top:2}),zd),qd=(e,t,o)=>ll(Vd(e),Ud(e,t),o.northeast(),ul(),"northeast",wl(e,{left:0,bottom:3}),zd),Gd=(e,t,o)=>ll(Zd(e,t),Ud(e,t),o.northwest(),gl(),"northwest",wl(e,{right:1,bottom:3}),zd),Kd=()=>[Wd,$d,qd,Gd],Yd=()=>[$d,Wd,Gd,qd];var Xd=[mr("item"),Jc(),Or("overrides",{}),sl("placement",((e,t,o)=>{const n=gc(o,t.item.element),r=Qc(e.element,t,Kd(),Yd(),Kd(),Yd(),D.none());return D.some($c({anchorBox:n,bubble:Wc(),overrides:t.overrides,layouts:r}))}))],Jd=ar("type",{selection:Fd,node:ud,hotspot:ed,submenu:Xd,makeshift:td});const Qd=[yr("classes",qn),Nr("mode","all",["all","layout","placement"])],em=[Or("useFixed",T),wr("getBounds")],tm=[ur("anchor",Jd),Tr("transition",Qd)],om=(e,t,o,n,r,s)=>((e,t,o,n,r,s,a,i)=>{const l=Vc(a,"maxHeightFunction",Fc()),c=Vc(a,"maxWidthFunction",v),d=e.anchorBox,m=e.origin,u={bounds:hc(m,s),origin:m,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:r,transition:i};return Zc(d,t,o,u)})(bc(t.anchorBox,e),n.element,t.bubble,t.layouts,r,o,t.overrides,s),nm=(e,t,o,n,r,s)=>{const a=rr("placement.info",Fn(tm),r),i=a.anchor,l=n.element,c=o.get(n.uid);ic((()=>{Nt(l,"position","fixed");const r=It(l,"visibility");Nt(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return vc(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Kt(e.element),o=e.element.dom.getBoundingClientRect();return fc(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each((e=>{const r=s.orThunk((()=>t.getBounds.map(E))),i=om(d,e,r,n,c,a.transition);o.set(n.uid,i)})),r.fold((()=>{zt(l,"visibility")}),(e=>{Nt(l,"visibility",e)})),It(l,"left").isNone()&&It(l,"top").isNone()&&It(l,"right").isNone()&&It(l,"bottom").isNone()&&we(It(l,"position"),"fixed")&&zt(l,"position")}),l)};var rm=Object.freeze({__proto__:null,position:(e,t,o,n,r)=>{const s=D.none();nm(e,t,o,n,r,s)},positionWithinBounds:nm,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const r=n.element;z(["position","left","right","top","bottom"],(e=>zt(r,e))),(e=>{Dt(e,yc)})(r),o.clear(n.uid)}});const sm=Yl({fields:em,name:"positioning",active:tc,apis:rm,state:Object.freeze({__proto__:null,init:()=>{let e={};return Pa({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>ve(e,t)})}})}),am=e=>e.getSystem().isConnected(),im=e=>{Ws(e,Ls());const t=e.components();z(t,im)},lm=e=>{const t=e.components();z(t,lm),Ws(e,Bs())},cm=(e,t)=>{e.getSystem().addToWorld(t),wt(e.element)&&lm(t)},dm=e=>{im(e),e.getSystem().removeFromWorld(e)},mm=(e,t)=>{Io(e.element,t.element)},um=(e,t,o)=>{const n=e.components();(e=>{z(e.components(),(e=>zo(e.element))),Fo(e.element),e.syncComponents()})(e);const r=o(t),s=X(n,r);z(s,(t=>{im(t),e.getSystem().removeFromWorld(t)})),z(r,(t=>{am(t)?mm(e,t):(e.getSystem().addToWorld(t),mm(e,t),wt(e.element)&&lm(t))})),e.syncComponents()},gm=(e,t)=>{hm(e,t,Io)},hm=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),wt(e.element)&&lm(t),e.syncComponents()},pm=e=>{im(e),zo(e.element),e.getSystem().removeFromWorld(e)},fm=e=>{const t=rt(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()));pm(e),t.each((e=>{e.syncComponents()}))},vm=e=>{const t=e.components();z(t,pm),Fo(e.element),e.syncComponents()},bm=(e,t)=>{wm(e,t,Io)},ym=(e,t)=>{wm(e,t,Lo)},wm=(e,t,o)=>{o(e,t.element);const n=it(t.element);z(n,(e=>{t.getByDom(e).each(lm)}))},xm=e=>{const t=it(e.element);z(t,(t=>{e.getByDom(t).each(im)})),zo(e.element)},Cm=(e,t,o,n)=>{o.get().each((t=>{vm(e)}));const r=t.getAttachPoint(e);gm(r,e);const s=e.getSystem().build(n);return gm(e,s),o.set(s),s},Sm=(e,t,o,n)=>{const r=Cm(e,t,o,n);return t.onOpen(e,r),r},km=(e,t,o)=>{o.get().each((n=>{vm(e),fm(e),t.onClose(e,n),o.clear()}))},_m=(e,t,o)=>o.isOpen(),Em=(e,t,o)=>{const n=t.getAttachPoint(e);Nt(e.element,"position",sm.getMode(n)),((e,t,o,n)=>{It(e.element,t).fold((()=>{Dt(e.element,o)}),(t=>{kt(e.element,o,t)})),Nt(e.element,t,n)})(e,"visibility",t.cloakVisibilityAttr,"hidden")},Tm=(e,t,o)=>{(e=>H(["top","left","right","bottom"],(t=>It(e,t).isSome())))(e.element)||zt(e.element,"position"),((e,t,o)=>{Tt(e.element,o).fold((()=>zt(e.element,t)),(o=>Nt(e.element,t,o)))})(e,"visibility",t.cloakVisibilityAttr)};var Om=Object.freeze({__proto__:null,cloak:Em,decloak:Tm,open:Sm,openWhileCloaked:(e,t,o,n,r)=>{Em(e,t),Sm(e,t,o,n),r(),Tm(e,t)},close:km,isOpen:_m,isPartOf:(e,t,o,n)=>_m(0,0,o)&&o.get().exists((o=>t.isPartOf(e,o,n))),getState:(e,t,o)=>o.get(),setContent:(e,t,o,n)=>o.get().map((()=>Cm(e,t,o,n)))});var Dm=Object.freeze({__proto__:null,events:(e,t)=>Xs([ea(Ts(),((o,n)=>{km(o,e,t)}))])}),Am=[tl("onOpen"),tl("onClose"),mr("isPartOf"),mr("getAttachPoint"),Or("cloakVisibilityAttr","data-precloak-visibility")];var Mm=Object.freeze({__proto__:null,init:()=>{const e=_c(),t=w("not-implemented");return Pa({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Nm=Yl({fields:Am,name:"sandboxing",active:Dm,apis:Om,state:Mm}),Rm=w("dismiss.popups"),Bm=w("reposition.popups"),Lm=w("mouse.released"),Hm=Pn([Or("isExtraPart",T),Tr("fireEventInstead",[Or("event",Hs())])]),Im=e=>{const t=rr("Dismissal",Hm,e);return{[Rm()]:{schema:Pn([mr("target")]),onReceive:(e,o)=>{if(Nm.isOpen(e)){Nm.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold((()=>Nm.close(e)),(t=>Ws(e,t.event)))}}}}},Pm=Pn([Tr("fireEventInstead",[Or("event",Is())]),fr("doReposition")]),Fm=e=>{const t=rr("Reposition",Pm,e);return{[Bm()]:{onReceive:e=>{Nm.isOpen(e)&&t.fireEventInstead.fold((()=>t.doReposition(e)),(t=>Ws(e,t.event)))}}}},zm=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Vm=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var Zm=Object.freeze({__proto__:null,onLoad:zm,onUnload:Vm,setValue:(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)},getValue:(e,t,o)=>t.store.manager.getValue(e,t,o),getState:(e,t,o)=>o});var Um=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[la(((o,n)=>{zm(o,e,t)})),ca(((o,n)=>{Vm(o,e,t)}))]:[jl(e,t,zm)];return Xs(o)}});const jm=()=>{const e=Ir(null);return Pa({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},Wm=()=>{const e=Ir({}),t=Ir({});return Pa({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>ve(e.get(),o).orThunk((()=>ve(t.get(),o))),update:o=>{const n=e.get(),r=t.get(),s={},a={};z(o,(e=>{s[e.value]=e,ve(e,"meta").each((t=>{ve(t,"text").each((t=>{a[t]=e}))}))})),e.set({...n,...s}),t.set({...r,...a})},clear:()=>{e.set({}),t.set({})}})};var $m=Object.freeze({__proto__:null,memory:jm,dataset:Wm,manual:()=>Pa({readState:v}),init:e=>e.store.manager.state(e)});const qm=(e,t,o,n)=>{const r=t.store;o.update([n]),r.setValue(e,n),t.onSetValue(e,n)};var Gm=[wr("initialValue"),mr("getFallbackEntry"),mr("getDataKey"),mr("setValue"),sl("manager",{setValue:qm,getValue:(e,t,o)=>{const n=t.store,r=n.getDataKey(e);return o.lookup(r).getOrThunk((()=>n.getFallbackEntry(r)))},onLoad:(e,t,o)=>{t.store.initialValue.each((n=>{qm(e,t,o,n)}))},onUnload:(e,t,o)=>{o.clear()},state:Wm})];var Km=[mr("getValue"),Or("setValue",v),wr("initialValue"),sl("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:v,state:Ia.init})];var Ym=[wr("initialValue"),sl("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:jm})],Xm=[Dr("store",{mode:"memory"},ar("mode",{memory:Ym,manual:Km,dataset:Gm})),tl("onSetValue"),Or("resetOnDom",!1)];const Jm=Yl({fields:Xm,name:"representing",active:Um,apis:Zm,extra:{setValueFrom:(e,t)=>{const o=Jm.getValue(t);Jm.setValue(e,o)}},state:$m}),Qm=(e,t)=>Hr(e,{},F(t,(t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,lr(o,o,{tag:"option",process:{}},Mn((e=>gn("The field: "+o+" is forbidden. "+n))));var o,n})).concat([cr("dump",x)])),eu=e=>e.dump,tu=(e,t)=>({...Gl(t),...e.dump}),ou=Qm,nu=tu,ru="placeholder",su=Pr([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),au=e=>be(e,"uiType"),iu=(e,t,o,n)=>au(o)&&o.uiType===ru?((e,t,o,n)=>e.exists((e=>e!==o.owner))?su.single(!0,w(o)):ve(n,o.name).fold((()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+ae(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))}),(e=>e.replace())))(e,0,o,n):su.single(!1,w(o)),lu=(e,t,o,n)=>iu(e,0,o,n).fold(((r,s)=>{const a=au(o)?s(t,o.config,o.validated):s(t),i=ve(a,"components").getOr([]),l=G(i,(o=>lu(e,t,o,n)));return[{...a,components:l}]}),((e,n)=>{if(au(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(x)(e)}return n(t)})),cu=(e,t,o,n)=>{const r=ce(n,((e,t)=>((e,t)=>{let o=!1;return{name:w(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))),s=((e,t,o,n)=>G(o,(o=>lu(e,t,o,n))))(e,t,o,r);return le(r,(o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),s},du=su.single,mu=su.multiple,uu=w(ru),gu=Pr([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),hu=Or("factory",{sketch:x}),pu=Or("schema",[]),fu=mr("name"),vu=lr("pname","pname",kn((e=>"")),jn()),bu=cr("schema",(()=>[wr("preprocess")])),yu=Or("defaults",w({})),wu=Or("overrides",w({})),xu=Fn([hu,pu,fu,vu,yu,wu]),Cu=Fn([hu,pu,fu,yu,wu]),Su=Fn([hu,pu,fu,vu,yu,wu]),ku=Fn([hu,bu,fu,mr("unit"),vu,yu,wu]),_u=e=>e.fold(D.some,D.none,D.some,D.some),Eu=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},Tu=(e,t)=>o=>{const n=rr("Converting part type",t,o);return e(n)},Ou=Tu(gu.required,xu),Du=Tu(gu.external,Cu),Au=Tu(gu.optional,Su),Mu=Tu(gu.group,ku),Nu=w("entirety");var Ru=Object.freeze({__proto__:null,required:Ou,external:Du,optional:Au,group:Mu,asNamedPart:_u,name:Eu,asCommon:e=>e.fold(x,x,x,x),original:Nu});const Bu=(e,t,o,n)=>Cn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),Lu=(e,t)=>{const o={};return z(t,(t=>{_u(t).each((t=>{const n=Hu(e,t.pname);o[t.name]=o=>{const r=rr("Part: "+t.name+" in "+e,Fn(t.schema),o);return{...n,config:o,validated:r}}}))})),o},Hu=(e,t)=>({uiType:uu(),owner:e,name:t}),Iu=(e,t,o)=>({uiType:uu(),owner:e,name:t,config:o,validated:{}}),Pu=e=>G(e,(e=>e.fold(D.none,D.some,D.none,D.none).map((e=>vr(e.name,e.schema.concat([al(Nu())])))).toArray())),Fu=e=>F(e,Eu),zu=(e,t,o)=>((e,t,o)=>{const n={},r={};return z(o,(e=>{e.fold((e=>{n[e.pname]=du(!0,((t,o,n)=>e.factory.sketch(Bu(t,e,o,n))))}),(e=>{const o=t.parts[e.name];r[e.name]=w(e.factory.sketch(Bu(t,e,o[Nu()]),o))}),(e=>{n[e.pname]=du(!1,((t,o,n)=>e.factory.sketch(Bu(t,e,o,n))))}),(e=>{n[e.pname]=mu(!0,((t,o,n)=>{const r=t[e.name];return F(r,(o=>e.factory.sketch(Cn(e.defaults(t,o,n),o,e.overrides(t,o)))))}))}))})),{internals:w(n),externals:w(r)}})(0,t,o),Vu=(e,t,o)=>cu(D.some(e),t,t.components,o),Zu=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},Uu=(e,t,o)=>Zu(e,t,o).getOrDie("Could not find part: "+o),ju=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return z(o,(e=>{n[e]=w(s.getByUid(r[e]))})),n},Wu=(e,t)=>{const o=e.getSystem();return ce(t.partUids,((e,t)=>w(o.getByUid(e))))},$u=e=>ae(e.partUids),qu=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return z(o,(e=>{n[e]=w(s.getByUid(r[e]).getOrDie())})),n},Gu=(e,t)=>{const o=Fu(t);return Vr(F(o,(t=>({key:t,value:e+"-"+t}))))},Ku=e=>lr("partUids","partUids",En((t=>Gu(t.uid,e))),jn());var Yu=Object.freeze({__proto__:null,generate:Lu,generateOne:Iu,schemas:Pu,names:Fu,substitutes:zu,components:Vu,defaultUids:Gu,defaultUidsSchema:Ku,getAllParts:Wu,getAllPartNames:$u,getPart:Zu,getPartOrDie:Uu,getParts:ju,getPartsOrDie:qu});const Xu=(e,t,o,n,r)=>{const s=((e,t)=>(e.length>0?[vr("parts",e)]:[]).concat([mr("uid"),Or("dom",{}),Or("components",[]),al("originalSpec"),Or("debug.sketcher",{})]).concat(t))(n,r);return rr(e+" [SpecSchema]",Pn(s.concat(t)),o)},Ju=(e,t,o,n,r)=>{const s=Qu(r),a=Pu(o),i=Ku(o),l=Xu(e,t,s,a,[i]),c=zu(0,l,o);return n(l,Vu(e,l,c.internals()),s,c.externals())},Qu=e=>(e=>be(e,"uid"))(e)?e:{...e,uid:Ta("uid")},eg=Pn([mr("name"),mr("factory"),mr("configFields"),Or("apis",{}),Or("extraApis",{})]),tg=Pn([mr("name"),mr("factory"),mr("configFields"),mr("partFields"),Or("apis",{}),Or("extraApis",{})]),og=e=>{const t=rr("Sketcher for "+e.name,eg,e),o=ce(t.apis,Ha),n=ce(t.extraApis,((e,t)=>Na(e,t)));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const r=Qu(n);return o(Xu(e,t,r,[],[]),r)})(t.name,t.configFields,t.factory,e),...o,...n}},ng=e=>{const t=rr("Sketcher for "+e.name,tg,e),o=Lu(t.name,t.partFields),n=ce(t.apis,Ha),r=ce(t.extraApis,((e,t)=>Na(e,t)));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>Ju(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...r}},rg=e=>Ge("input")(e)&&"radio"!==Et(e,"type")||Ge("textarea")(e);var sg=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const ag=[mr("find")],ig=Yl({fields:ag,name:"composing",apis:sg}),lg=["input","button","textarea","select"],cg=(e,t,o)=>{(t.disabled()?pg:fg)(e,t)},dg=(e,t)=>!0===t.useNative&&L(lg,Ve(e.element)),mg=e=>{kt(e.element,"disabled","disabled")},ug=e=>{Dt(e.element,"disabled")},gg=e=>{kt(e.element,"aria-disabled","true")},hg=e=>{kt(e.element,"aria-disabled","false")},pg=(e,t,o)=>{t.disableClass.each((t=>{oi(e.element,t)}));(dg(e,t)?mg:gg)(e),t.onDisabled(e)},fg=(e,t,o)=>{t.disableClass.each((t=>{ri(e.element,t)}));(dg(e,t)?ug:hg)(e),t.onEnabled(e)},vg=(e,t)=>dg(e,t)?(e=>Ot(e.element,"disabled"))(e):(e=>"true"===Et(e.element,"aria-disabled"))(e);var bg=Object.freeze({__proto__:null,enable:fg,disable:pg,isDisabled:vg,onLoad:cg,set:(e,t,o,n)=>{(n?pg:fg)(e,t)}});var yg=Object.freeze({__proto__:null,exhibit:(e,t)=>za({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Xs([Js(Ss(),((t,o)=>vg(t,e))),jl(e,t,cg)])}),wg=[Br("disabled",T),Or("useNative",!0),wr("disableClass"),tl("onDisabled"),tl("onEnabled")];const xg=Yl({fields:wg,name:"disabling",active:yg,apis:bg}),Cg=(e,t,o,n)=>{const r=Ed(e.element,"."+t.highlightClass);z(r,(o=>{H(n,(e=>Je(e.element,o)))||(ri(o,t.highlightClass),e.getSystem().getByDom(o).each((o=>{t.onDehighlight(e,o),Ws(o,js())})))}))},Sg=(e,t,o,n)=>{Cg(e,t,0,[n]),kg(e,t,o,n)||(oi(n.element,t.highlightClass),t.onHighlight(e,n),Ws(n,Us()))},kg=(e,t,o,n)=>ai(n.element,t.highlightClass),_g=(e,t,o,n)=>{const r=Ed(e.element,"."+t.itemClass);return D.from(r[n]).fold((()=>nn.error(new Error("No element found with index "+n))),e.getSystem().getByDom)},Eg=(e,t,o)=>Li(e.element,"."+t.itemClass).bind((t=>e.getSystem().getByDom(t).toOptional())),Tg=(e,t,o)=>{const n=Ed(e.element,"."+t.itemClass);return(n.length>0?D.some(n[n.length-1]):D.none()).bind((t=>e.getSystem().getByDom(t).toOptional()))},Og=(e,t,o,n)=>{const r=Ed(e.element,"."+t.itemClass),s=$(r,(e=>ai(e,t.highlightClass)));return s.bind((t=>{const o=bl(t,n,0,r.length-1);return e.getSystem().getByDom(r[o]).toOptional()}))},Dg=(e,t,o)=>{const n=Ed(e.element,"."+t.itemClass);return xe(F(n,(t=>e.getSystem().getByDom(t).toOptional())))};var Ag=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>Cg(e,t,0,[]),dehighlight:(e,t,o,n)=>{kg(e,t,o,n)&&(ri(n.element,t.highlightClass),t.onDehighlight(e,n),Ws(n,js()))},highlight:Sg,highlightFirst:(e,t,o)=>{Eg(e,t).each((n=>{Sg(e,t,o,n)}))},highlightLast:(e,t,o)=>{Tg(e,t).each((n=>{Sg(e,t,o,n)}))},highlightAt:(e,t,o,n)=>{_g(e,t,o,n).fold((e=>{throw e}),(n=>{Sg(e,t,o,n)}))},highlightBy:(e,t,o,n)=>{const r=Dg(e,t);W(r,n).each((n=>{Sg(e,t,o,n)}))},isHighlighted:kg,getHighlighted:(e,t,o)=>Li(e.element,"."+t.highlightClass).bind((t=>e.getSystem().getByDom(t).toOptional())),getFirst:Eg,getLast:Tg,getPrevious:(e,t,o)=>Og(e,t,0,-1),getNext:(e,t,o)=>Og(e,t,0,1),getCandidates:Dg}),Mg=[mr("highlightClass"),mr("itemClass"),tl("onHighlight"),tl("onDehighlight")];const Ng=Yl({fields:Mg,name:"highlighting",apis:Ag}),Rg=[8],Bg=[9],Lg=[13],Hg=[27],Ig=[32],Pg=[37],Fg=[38],zg=[39],Vg=[40],Zg=(e,t,o)=>{const n=Y(e.slice(0,t)),r=Y(e.slice(t+1));return W(n.concat(r),o)},Ug=(e,t,o)=>{const n=Y(e.slice(0,t));return W(n,o)},jg=(e,t,o)=>{const n=e.slice(0,t),r=e.slice(t+1);return W(r.concat(n),o)},Wg=(e,t,o)=>{const n=e.slice(t+1);return W(n,o)},$g=e=>t=>{const o=t.raw;return L(e,o.which)},qg=e=>t=>K(e,(e=>e(t))),Gg=e=>!0===e.raw.shiftKey,Kg=e=>!0===e.raw.ctrlKey,Yg=k(Gg),Xg=(e,t)=>({matches:e,classification:t}),Jg=(e,t,o)=>{t.exists((e=>o.exists((t=>Je(t,e)))))||$s(e,Ps(),{prevFocus:t,newFocus:o})},Qg=()=>{const e=e=>ac(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const r=e(t);Jg(t,n,r)}}},eh=()=>{const e=e=>Ng.getHighlighted(e).map((e=>e.element));return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(v,(e=>{Ng.highlight(t,e)}));const r=e(t);Jg(t,n,r)}}};var th;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(th||(th={}));const oh=(e,t,o,n,r)=>{const s=(e,t,o,n,r)=>((e,t)=>{const o=W(e,(e=>e.matches(t)));return o.map((e=>e.classification))})(o(e,t,n,r),t.event).bind((o=>o(e,t,n,r))),a={schema:()=>e.concat([Or("focusManager",Qg()),Dr("focusInside","onFocus",er((e=>L(["onFocus","onEnterOrSpace","onApi"],e)?nn.value(e):nn.error("Invalid value for focusInside")))),sl("handler",a),sl("state",t),sl("sendFocusIn",r)]),processKey:s,toEvents:(e,t)=>{const a=e.focusInside!==th.OnFocusMode?D.none():r(e).map((o=>ea(ys(),((n,r)=>{o(n,e,t),r.stop()})))),i=[ea(ls(),((n,a)=>{s(n,a,o,e,t).fold((()=>{((o,n)=>{const s=$g(Ig.concat(Lg))(n.event);e.focusInside===th.OnEnterOrSpaceMode&&s&&$r(o,n)&&r(e).each((r=>{r(o,e,t),n.stop()}))})(n,a)}),(e=>{a.stop()}))})),ea(cs(),((o,r)=>{s(o,r,n,e,t).each((e=>{r.stop()}))}))];return Xs(a.toArray().concat(i))}};return a},nh=e=>{const t=[wr("onEscape"),wr("onEnter"),Or("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Or("firstTabstop",0),Or("useTabstopAt",O),wr("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind((e=>Hi(t,e))).getOr(t);return jt(o)>0},n=(e,t)=>t.focusManager.get(e).bind((e=>Hi(e,t.selector))),r=(e,t,n)=>{((e,t)=>{const n=Ed(e.element,t.selector),r=Z(n,(e=>o(t,e)));return D.from(r[t.firstTabstop])})(e,t).each((o=>{t.focusManager.set(e,o)}))},s=(e,t,n,r,s)=>s(t,n,(e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(r,e))).fold((()=>r.cyclic?D.some(!0):D.none()),(t=>(r.focusManager.set(e,t),D.some(!0)))),a=(e,t,o,r)=>{const a=Ed(e.element,o.selector);return n(e,o).bind((t=>$(a,S(Je,t)).bind((t=>s(e,a,t,o,r)))))},i=(e,t,o)=>{const n=o.cyclic?Zg:Ug;return a(e,0,o,n)},l=(e,t,o)=>{const n=o.cyclic?jg:Wg;return a(e,0,o,n)},c=e=>(e=>rt(e))(e).bind(ct).exists((t=>Je(t,e))),d=w([Xg(qg([Gg,$g(Bg)]),i),Xg($g(Bg),l),Xg(qg([Yg,$g(Lg)]),((e,t,o)=>o.onEnter.bind((o=>o(e,t)))))]),m=w([Xg($g(Hg),((e,t,o)=>o.onEscape.bind((o=>o(e,t))))),Xg($g(Bg),((e,t,o)=>n(e,o).filter((e=>!o.useTabstopAt(e))).bind((n=>(c(n)?i:l)(e,t,o)))))]);return oh(t,Ia.init,d,m,(()=>D.some(r)))};var rh=nh(cr("cyclic",T)),sh=nh(cr("cyclic",O));const ah=(e,t,o)=>rg(o)&&$g(Ig)(t.event)?D.none():((e,t,o)=>(Gs(e,o,Ss()),D.some(!0)))(e,0,o),ih=(e,t)=>D.some(!0),lh=[Or("execute",ah),Or("useSpace",!1),Or("useEnter",!0),Or("useControlEnter",!1),Or("useDown",!1)],ch=(e,t,o)=>o.execute(e,t,e.element);var dh=oh(lh,Ia.init,((e,t,o,n)=>{const r=o.useSpace&&!rg(e.element)?Ig:[],s=o.useEnter?Lg:[],a=o.useDown?Vg:[],i=r.concat(s).concat(a);return[Xg($g(i),ch)].concat(o.useControlEnter?[Xg(qg([Kg,$g(Lg)]),ch)]:[])}),((e,t,o,n)=>o.useSpace&&!rg(e.element)?[Xg($g(Ig),ih)]:[]),(()=>D.none()));const mh=()=>{const e=_c();return Pa({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 uh=Object.freeze({__proto__:null,flatgrid:mh,init:e=>e.state(e)});const gh=e=>(t,o,n,r)=>{const s=e(t.element);return vh(s,t,o,n,r)},hh=(e,t)=>{const o=qc(e,t);return gh(o)},ph=(e,t)=>{const o=qc(t,e);return gh(o)},fh=e=>(t,o,n,r)=>vh(e,t,o,n,r),vh=(e,t,o,n,r)=>n.focusManager.get(t).bind((o=>e(t.element,o,n,r))).map((e=>(n.focusManager.set(t,e),!0))),bh=fh,yh=fh,wh=fh,xh=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),Ch=(e,t,o)=>{const n=Ed(e,o);return((e,t)=>$(e,t).map((t=>({index:t,candidates:e}))))(Z(n,xh),(e=>Je(e,t)))},Sh=(e,t)=>$(e,(e=>Je(t,e))),kh=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind((t=>{const n=t.row*o+t.column;return n>=0&&nkh(e,t,n,((t,s)=>{const a=t===o-1?e.length-t*n:n,i=bl(s,r,0,a-1);return D.some({row:t,column:i})})),Eh=(e,t,o,n,r)=>kh(e,t,n,((t,s)=>{const a=bl(t,r,0,o-1),i=a===o-1?e.length-a*n:n,l=yl(s,0,i-1);return D.some({row:a,column:l})})),Th=[mr("selector"),Or("execute",ah),ol("onEscape"),Or("captureTab",!1),il()],Oh=(e,t,o)=>{Li(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},Dh=e=>(t,o,n,r)=>Ch(t,o,n.selector).bind((t=>e(t.candidates,t.index,r.getNumRows().getOr(n.initSize.numRows),r.getNumColumns().getOr(n.initSize.numColumns)))),Ah=(e,t,o)=>o.captureTab?D.some(!0):D.none(),Mh=Dh(((e,t,o,n)=>_h(e,t,o,n,-1))),Nh=Dh(((e,t,o,n)=>_h(e,t,o,n,1))),Rh=Dh(((e,t,o,n)=>Eh(e,t,o,n,-1))),Bh=Dh(((e,t,o,n)=>Eh(e,t,o,n,1))),Lh=w([Xg($g(Pg),hh(Mh,Nh)),Xg($g(zg),ph(Mh,Nh)),Xg($g(Fg),bh(Rh)),Xg($g(Vg),yh(Bh)),Xg(qg([Gg,$g(Bg)]),Ah),Xg(qg([Yg,$g(Bg)]),Ah),Xg($g(Ig.concat(Lg)),((e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind((e=>Hi(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n)))))]),Hh=w([Xg($g(Hg),((e,t,o)=>o.onEscape(e,t))),Xg($g(Ig),ih)]);var Ih=oh(Th,mh,Lh,Hh,(()=>D.some(Oh)));const Ph=(e,t,o,n,r)=>{const s=(e,t,o)=>r(e,t,n,0,o.length-1,o[t],(t=>{return n=o[t],"button"===Ve(n)&&"disabled"===Et(n,"disabled")?s(e,t,o):D.from(o[t]);var n}));return Ch(e,o,t).bind((e=>{const t=e.index,o=e.candidates;return s(t,t,o)}))},Fh=(e,t,o,n)=>Ph(e,t,o,n,((e,t,o,n,r,s,a)=>{const i=yl(t+o,n,r);return i===e?D.from(s):a(i)})),zh=(e,t,o,n)=>Ph(e,t,o,n,((e,t,o,n,r,s,a)=>{const i=bl(t,o,n,r);return i===e?D.none():a(i)})),Vh=[mr("selector"),Or("getInitial",D.none),Or("execute",ah),ol("onEscape"),Or("executeOnMove",!1),Or("allowVertical",!0),Or("allowHorizontal",!0),Or("cycles",!0)],Zh=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind((e=>Hi(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n))),Uh=(e,t,o)=>{t.getInitial(e).orThunk((()=>Li(e.element,t.selector))).each((o=>{t.focusManager.set(e,o)}))},jh=(e,t,o)=>(o.cycles?zh:Fh)(e,o.selector,t,-1),Wh=(e,t,o)=>(o.cycles?zh:Fh)(e,o.selector,t,1),$h=e=>(t,o,n,r)=>e(t,o,n,r).bind((()=>n.executeOnMove?Zh(t,o,n):D.some(!0))),qh=w([Xg($g(Ig),ih),Xg($g(Hg),((e,t,o)=>o.onEscape(e,t)))]);var Gh=oh(Vh,Ia.init,((e,t,o,n)=>{const r=[...o.allowHorizontal?Pg:[]].concat(o.allowVertical?Fg:[]),s=[...o.allowHorizontal?zg:[]].concat(o.allowVertical?Vg:[]);return[Xg($g(r),$h(hh(jh,Wh))),Xg($g(s),$h(ph(jh,Wh))),Xg($g(Lg),Zh),Xg($g(Ig),Zh)]}),qh,(()=>D.some(Uh)));const Kh=(e,t,o)=>D.from(e[t]).bind((e=>D.from(e[o]).map((e=>({rowIndex:t,columnIndex:o,cell:e}))))),Yh=(e,t,o,n)=>{const r=e[t].length,s=bl(o,n,0,r-1);return Kh(e,t,s)},Xh=(e,t,o,n)=>{const r=bl(o,n,0,e.length-1),s=e[r].length,a=yl(t,0,s-1);return Kh(e,r,a)},Jh=(e,t,o,n)=>{const r=e[t].length,s=yl(o+n,0,r-1);return Kh(e,t,s)},Qh=(e,t,o,n)=>{const r=yl(o+n,0,e.length-1),s=e[r].length,a=yl(t,0,s-1);return Kh(e,r,a)},ep=[vr("selectors",[mr("row"),mr("cell")]),Or("cycles",!0),Or("previousSelector",D.none),Or("execute",ah)],tp=(e,t,o)=>{t.previousSelector(e).orThunk((()=>{const o=t.selectors;return Li(e.element,o.cell)})).each((o=>{t.focusManager.set(e,o)}))},op=(e,t)=>(o,n,r)=>{const s=r.cycles?e:t;return Hi(n,r.selectors.row).bind((e=>{const t=Ed(e,r.selectors.cell);return Sh(t,n).bind((t=>{const n=Ed(o,r.selectors.row);return Sh(n,e).bind((e=>{const o=((e,t)=>F(e,(e=>Ed(e,t.selectors.cell))))(n,r);return s(o,e,t).map((e=>e.cell))}))}))}))},np=op(((e,t,o)=>Yh(e,t,o,-1)),((e,t,o)=>Jh(e,t,o,-1))),rp=op(((e,t,o)=>Yh(e,t,o,1)),((e,t,o)=>Jh(e,t,o,1))),sp=op(((e,t,o)=>Xh(e,o,t,-1)),((e,t,o)=>Qh(e,o,t,-1))),ap=op(((e,t,o)=>Xh(e,o,t,1)),((e,t,o)=>Qh(e,o,t,1))),ip=w([Xg($g(Pg),hh(np,rp)),Xg($g(zg),ph(np,rp)),Xg($g(Fg),bh(sp)),Xg($g(Vg),yh(ap)),Xg($g(Ig.concat(Lg)),((e,t,o)=>ac(e.element).bind((n=>o.execute(e,t,n)))))]),lp=w([Xg($g(Ig),ih)]);var cp=oh(ep,Ia.init,ip,lp,(()=>D.some(tp)));const dp=[mr("selector"),Or("execute",ah),Or("moveOnTab",!1)],mp=(e,t,o)=>o.focusManager.get(e).bind((n=>o.execute(e,t,n))),up=(e,t,o)=>{Li(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},gp=(e,t,o)=>zh(e,o.selector,t,-1),hp=(e,t,o)=>zh(e,o.selector,t,1),pp=w([Xg($g(Fg),wh(gp)),Xg($g(Vg),wh(hp)),Xg(qg([Gg,$g(Bg)]),((e,t,o,n)=>o.moveOnTab?wh(gp)(e,t,o,n):D.none())),Xg(qg([Yg,$g(Bg)]),((e,t,o,n)=>o.moveOnTab?wh(hp)(e,t,o,n):D.none())),Xg($g(Lg),mp),Xg($g(Ig),mp)]),fp=w([Xg($g(Ig),ih)]);var vp=oh(dp,Ia.init,pp,fp,(()=>D.some(up)));const bp=[ol("onSpace"),ol("onEnter"),ol("onShiftEnter"),ol("onLeft"),ol("onRight"),ol("onTab"),ol("onShiftTab"),ol("onUp"),ol("onDown"),ol("onEscape"),Or("stopSpaceKeyup",!1),wr("focusIn")];var yp=oh(bp,Ia.init,((e,t,o)=>[Xg($g(Ig),o.onSpace),Xg(qg([Yg,$g(Lg)]),o.onEnter),Xg(qg([Gg,$g(Lg)]),o.onShiftEnter),Xg(qg([Gg,$g(Bg)]),o.onShiftTab),Xg(qg([Yg,$g(Bg)]),o.onTab),Xg($g(Fg),o.onUp),Xg($g(Vg),o.onDown),Xg($g(Pg),o.onLeft),Xg($g(zg),o.onRight),Xg($g(Ig),o.onSpace)]),((e,t,o)=>[...o.stopSpaceKeyup?[Xg($g(Ig),ih)]:[],Xg($g(Hg),o.onEscape)]),(e=>e.focusIn));const wp=rh.schema(),xp=sh.schema(),Cp=Gh.schema(),Sp=Ih.schema(),kp=cp.schema(),_p=dh.schema(),Ep=vp.schema(),Tp=yp.schema();const Op=Jl({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:wp,cyclic:xp,flow:Cp,flatgrid:Sp,matrix:kp,execution:_p,menu:Ep,special:Tp}),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,r)=>{(e=>ye(e,"setGridSize"))(o)?o.setGridSize(n,r):console.error("Layout does not support setGridSize")}},state:uh}),Dp=(e,t)=>{ic((()=>{um(e,t,(()=>F(t,e.getSystem().build)))}),e.element)},Ap=(e,t)=>{ic((()=>{((e,t,o)=>{const n=e.components(),r=G(t,(e=>La(e).toArray()));z(n,(e=>{L(r,e)||dm(e)}));const s=o(t),a=X(n,s);z(a,(e=>{am(e)&&dm(e)})),z(s,(t=>{am(t)||cm(e,t)})),e.syncComponents()})(e,t,(()=>((e,t,o)=>gi(e,t,((t,n)=>hi(e,n,t,o))))(e.element,t,e.getSystem().buildOrPatch)))}),e.element)},Mp=(e,t,o,n)=>{dm(t);const r=hi(e.element,o,n,e.getSystem().buildOrPatch);cm(e,r),e.syncComponents()},Np=(e,t,o)=>{const n=e.getSystem().build(o);hm(e,n,t)},Rp=(e,t,o,n)=>{fm(t),Np(e,((e,t)=>((e,t,o)=>{lt(e,o).fold((()=>{Io(e,t)}),(e=>{Bo(e,t)}))})(e,t,o)),n)},Bp=(e,t)=>e.components(),Lp=(e,t,o,n,r)=>{const s=Bp(e);return D.from(s[n]).map((o=>(r.fold((()=>fm(o)),(r=>{(t.reuseDom?Mp:Rp)(e,o,n,r)})),o)))};var Hp=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Np(e,Io,n)},prepend:(e,t,o,n)=>{Np(e,Ho,n)},remove:(e,t,o,n)=>{const r=Bp(e),s=W(r,(e=>Je(n.element,e.element)));s.each(fm)},replaceAt:Lp,replaceBy:(e,t,o,n,r)=>{const s=Bp(e);return $(s,n).bind((o=>Lp(e,t,0,o,r)))},set:(e,t,o,n)=>(t.reuseDom?Ap:Dp)(e,n),contents:Bp});const Ip=Yl({fields:[Rr("reuseDom",!0)],name:"replacing",apis:Hp}),Pp=(e,t)=>{const o=((e,t)=>{const o=Xs(t);return Yl({fields:[mr("enabled")],name:e,active:{events:w(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:w({}),initialConfig:{},state:Ia}}},Fp=(e,t)=>{t.ignore||(oc(e.element),t.onFocus(e))};var zp=Object.freeze({__proto__:null,focus:Fp,blur:(e,t)=>{t.ignore||nc(e.element)},isFocused:e=>rc(e.element)});var Vp=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return za(o)},events:e=>Xs([ea(ys(),((t,o)=>{Fp(t,e),o.stop()}))].concat(e.stopMousedown?[ea(ts(),((e,t)=>{t.event.prevent()}))]:[]))}),Zp=[tl("onFocus"),Or("stopMousedown",!1),Or("ignore",!1)];const Up=Yl({fields:Zp,name:"focusing",active:Vp,apis:zp}),jp=(e,t,o,n)=>{const r=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each((t=>{o.get()?oi(e.element,t):ri(e.element,t)}))})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),r!==n&&t.onToggled(e,n)},Wp=(e,t,o)=>{jp(e,t,o,!o.get())},$p=(e,t,o)=>{jp(e,t,o,t.selected)};var qp=Object.freeze({__proto__:null,onLoad:$p,toggle:Wp,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{jp(e,t,o,!0)},off:(e,t,o)=>{jp(e,t,o,!1)},set:jp});var Gp=Object.freeze({__proto__:null,exhibit:()=>za({}),events:(e,t)=>{const o=(n=e,r=t,s=Wp,ma((e=>{s(e,n,r)})));var n,r,s;const a=jl(e,t,$p);return Xs(q([e.toggleOnExecute?[o]:[],[a]]))}});const Kp=(e,t,o)=>{kt(e.element,"aria-expanded",o)};var Yp=[Or("selected",!1),wr("toggleClass"),Or("toggleOnExecute",!0),tl("onToggled"),Dr("aria",{mode:"none"},ar("mode",{pressed:[Or("syncWithExpanded",!1),sl("update",((e,t,o)=>{kt(e.element,"aria-pressed",o),t.syncWithExpanded&&Kp(e,t,o)}))],checked:[sl("update",((e,t,o)=>{kt(e.element,"aria-checked",o)}))],expanded:[sl("update",Kp)],selected:[sl("update",((e,t,o)=>{kt(e.element,"aria-selected",o)}))],none:[sl("update",v)]}))];const Xp=Yl({fields:Yp,name:"toggling",active:Gp,apis:qp,state:(Jp=!1,{init:()=>{const e=Ir(Jp);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(Jp),readState:()=>e.get()}}})});var Jp;const Qp=()=>{const e=(e,t)=>{t.stop(),qs(e)};return[ea(us(),e),ea(_s(),e),sa(Xr()),sa(ts())]},ef=e=>Xs(q([e.map((e=>ma(((t,o)=>{e(t),o.stop()})))).toArray(),Qp()])),tf="alloy.item-hover",of="alloy.item-focus",nf="alloy.item-toggled",rf=e=>{(ac(e.element).isNone()||Up.isFocused(e))&&(Up.isFocused(e)||Up.focus(e),$s(e,tf,{item:e}))},sf=e=>{$s(e,of,{item:e})},af=w(tf),lf=w(of),cf=w(nf),df=e=>e.toggling.map((e=>e.exclusive?"menuitemradio":"menuitemcheckbox")).getOr("menuitem"),mf=e=>({aria:{mode:"checked"},...ge(e,((e,t)=>"exclusive"!==t)),onToggled:(t,o)=>{h(e.onToggled)&&e.onToggled(t,o),((e,t)=>{$s(e,nf,{item:e,state:t})})(t,o)}}),uf=[mr("data"),mr("components"),mr("dom"),Or("hasSubmenu",!1),wr("toggling"),ou("itemBehaviours",[Xp,Up,Op,Jm]),Or("ignoreFocus",!1),Or("domModification",{}),sl("builder",(e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:df(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:nu(e.itemBehaviours,[e.toggling.fold(Xp.revoke,(e=>Xp.config(mf(e)))),Up.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{sf(e)}}),Op.config({mode:"execution"}),Jm.config({store:{mode:"memory",initialValue:e.data}}),Pp("item-type-events",[...Qp(),ea(ss(),rf),ea(ks(),Up.focus)])]),components:e.components,eventOrder:e.eventOrder}))),Or("eventOrder",{})],gf=[mr("dom"),mr("components"),sl("builder",(e=>({dom:e.dom,components:e.components,events:Xs([aa(ks())])})))],hf=w("item-widget"),pf=w([Ou({name:"widget",overrides:e=>({behaviours:Gl([Jm.config({store:{mode:"manual",getValue:t=>e.data,setValue:v}})])})})]),ff=[mr("uid"),mr("data"),mr("components"),mr("dom"),Or("autofocus",!1),Or("ignoreFocus",!1),ou("widgetBehaviours",[Jm,Up,Op]),Or("domModification",{}),Ku(pf()),sl("builder",(e=>{const t=zu(hf(),e,pf()),o=Vu(hf(),e,t.internals()),n=t=>Zu(t,e,"widget").map((e=>(Op.focusIn(e),e))),r=(t,o)=>rg(o.event.target)?D.none():e.autofocus?(o.setSource(t.element),D.none()):D.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Xs([ma(((e,t)=>{n(e).each((e=>{t.stop()}))})),ea(ss(),rf),ea(ks(),((t,o)=>{e.autofocus?n(t):Up.focus(t)}))]),behaviours:nu(e.widgetBehaviours,[Jm.config({store:{mode:"memory",initialValue:e.data}}),Up.config({ignore:e.ignoreFocus,onFocus:e=>{sf(e)}}),Op.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:Ql(),onLeft:r,onRight:r,onEscape:(t,o)=>Up.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),D.none()):D.none():(Up.focus(t),D.some(!0))})])}}))],vf=ar("type",{widget:ff,item:uf,separator:gf}),bf=w([Mu({factory:{sketch:e=>{const t=rr("menu.spec item",vf,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>be(t,"uid")?t:{...t,uid:Ta("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),yf=w([mr("value"),mr("items"),mr("dom"),mr("components"),Or("eventOrder",{}),Qm("menuBehaviours",[Ng,Jm,ig,Op]),Dr("movement",{mode:"menu",moveOnTab:!0},ar("mode",{grid:[il(),sl("config",((e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager})))],matrix:[sl("config",((e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}))),mr("rowSelector"),Or("previousSelector",D.none)],menu:[Or("moveOnTab",!0),sl("config",((e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager})))]})),ur("markers",Yi()),Or("fakeFocus",!1),Or("focusManager",Qg()),tl("onHighlight"),tl("onDehighlight")]),wf=w("alloy.menu-focus"),xf=ng({name:"Menu",configFields:yf(),partFields:bf(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:tu(e.menuBehaviours,[Ng.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),Jm.config({store:{mode:"memory",initialValue:e.value}}),ig.config({find:D.some}),Op.config(e.movement.config(e,e.movement))]),events:Xs([ea(lf(),((e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each((o=>{Ng.highlight(e,o),t.stop(),$s(e,wf(),{menu:e,item:o})}))})),ea(af(),((e,t)=>{const o=t.event.item;Ng.highlight(e,o)})),ea(cf(),((e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===Et(o.element,"role")&&((e,t)=>{const o=Ed(e.element,'[role="menuitemradio"][aria-checked="true"]');z(o,(o=>{Je(o,t.element)||e.getSystem().getByDom(o).each((e=>{Xp.off(e)}))}))})(e,o)}))]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}})}),Cf=(e,t,o,n)=>ve(o,n).bind((n=>ve(e,n).bind((n=>{const r=Cf(e,t,o,n);return D.some([n].concat(r))})))).getOr([]),Sf=(e,t)=>{const o={};le(e,((e,t)=>{z(e,(e=>{o[e]=t}))}));const n=t,r=de(t,((e,t)=>({k:e,v:t})));const s=ce(r,((e,t)=>[t].concat(Cf(o,n,r,t))));return ce(o,(e=>ve(s,e).getOr([e])))},kf=e=>"prepared"===e.type?D.some(e.menu):D.none(),_f={init:()=>{const e=Ir({}),t=Ir({}),o=Ir({}),n=_c(),r=Ir({}),s=(t,o,n)=>a(t).bind((r=>(t=>pe(e.get(),((e,o)=>e===t)))(t).bind((e=>o(e).map((e=>({triggeredMenu:r,triggeringItem:e,triggeringPath:n}))))))),a=e=>i(e).bind(kf),i=e=>ve(t.get(),e),l=t=>ve(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(s,a,i,l)=>{n.set(s),e.set(i),t.set(a),r.set(l);const c=Sf(l,i);o.set(c)},expand:t=>ve(e.get(),t).map((e=>{const n=ve(o.get(),t).getOr([]);return[e].concat(n)})),refresh:e=>ve(o.get(),e),collapse:e=>ve(o.get(),e).bind((e=>e.length>1?D.some(e.slice(1)):D.none())),lookupMenu:i,lookupItem:l,otherMenus:e=>{const t=r.get();return X(ae(t),e)},getPrimary:()=>n.get().bind(a),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(e,t)=>{const r=Z(l(e).toArray(),(e=>a(e).isSome()));return ve(o.get(),e).bind((e=>{const o=Y(r.concat(e));return(e=>{const t=[];for(let o=0;os(e,t,o.slice(0,r+1)).fold((()=>we(n.get(),e)?[]:[D.none()]),(e=>[D.some(e)])))))}))}}},extractPreparedMenu:kf},Ef=wa("tiered-menu-item-highlight"),Tf=wa("tiered-menu-item-dehighlight");var Of;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Of||(Of={}));const Df=w("collapse-item"),Af=og({name:"TieredMenu",configFields:[rl("onExecute"),rl("onEscape"),nl("onOpenMenu"),nl("onOpenSubmenu"),tl("onRepositionMenu"),tl("onCollapseMenu"),Or("highlightOnOpen",Of.HighlightMenuAndItem),vr("data",[mr("primary"),mr("menus"),mr("expansions")]),Or("fakeFocus",!1),tl("onHighlightItem"),tl("onDehighlightItem"),tl("onHover"),Ji(),mr("dom"),Or("navigateOnHover",!0),Or("stayInDom",!1),Qm("tmenuBehaviours",[Op,Ng,ig,Ip]),Or("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=_c(),n=_f.init(),r=t=>{const o=((t,o,n)=>ce(n,((n,r)=>{const s=()=>xf.sketch({...n,value:r,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{$s(e,Ef,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{$s(e,Tf,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?eh():Qg()});return r===o?{type:"prepared",menu:t.getSystem().build(s())}:{type:"notbuilt",nbMenu:s}})))(t,e.data.primary,e.data.menus),r=a();return n.setContents(e.data.primary,o,e.data.expansions,r),n.getPrimary()},s=e=>Jm.getValue(e).value,a=t=>ce(e.data.menus,((e,t)=>G(e.items,(e=>"separator"===e.type?[]:[e.data.value])))),i=Ng.highlight,l=(t,o)=>{i(t,o),Ng.getHighlighted(o).orThunk((()=>Ng.getFirst(o))).each((n=>{e.fakeFocus?Ng.highlight(o,n):Gs(t,n.element,ks())}))},c=(e,t)=>xe(F(t,(t=>e.lookupMenu(t).bind((e=>"prepared"===e.type?D.some(e.menu):D.none()))))),d=(t,o,n)=>{const r=c(o,o.otherMenus(n));z(r,(o=>{li(o.element,[e.markers.backgroundMenu]),e.stayInDom||Ip.remove(t,o)}))},m=(t,n)=>{const r=(t=>o.get().getOrThunk((()=>{const n={},r=Ed(t.element,`.${e.markers.item}`),a=Z(r,(e=>"true"===Et(e,"aria-haspopup")));return z(a,(e=>{t.getSystem().getByDom(e).each((e=>{const t=s(e);n[t]=e}))})),o.set(n),n})))(t);le(r,((e,t)=>{const o=L(n,t);kt(e.element,"aria-expanded",o)}))},u=(t,o,n)=>D.from(n[0]).bind((r=>o.lookupMenu(r).bind((r=>{if("notbuilt"===r.type)return D.none();{const s=r.menu,a=c(o,n.slice(1));return z(a,(t=>{oi(t.element,e.markers.backgroundMenu)})),wt(s.element)||Ip.append(t,Oi(s)),li(s.element,[e.markers.backgroundMenu]),l(t,s),d(t,o,n),D.some(s)}}))));let g;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(g||(g={}));const h=(t,o,r=g.HighlightSubmenu)=>{if(o.hasConfigured(xg)&&xg.isDisabled(o))return D.some(o);{const a=s(o);return n.expand(a).bind((s=>(m(t,s),D.from(s[0]).bind((a=>n.lookupMenu(a).bind((i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const r=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,r),r}return o.menu})(t,a,i);return wt(l.element)||Ip.append(t,Oi(l)),e.onOpenSubmenu(t,o,l,Y(s)),r===g.HighlightSubmenu?(Ng.highlightFirst(l),u(t,n,s)):(Ng.dehighlightAll(l),D.some(o))})))))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind((r=>(m(t,r),u(t,n,r).map((n=>(e.onCollapseMenu(t,o,n),n))))))},f=t=>(o,n)=>Hi(n.getSource(),`.${e.markers.item}`).bind((e=>o.getSystem().getByDom(e).toOptional().bind((e=>t(o,e).map(O))))),b=Xs([ea(wf(),((e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each((()=>{const o=t.event.menu;Ng.highlight(e,o);const r=s(t.event.item);n.refresh(r).each((t=>d(e,n,t)))}))})),ma(((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each((o=>{0===s(o).indexOf("collapse-item")&&p(t,o),h(t,o,g.HighlightSubmenu).fold((()=>{e.onExecute(t,o)}),v)}))})),la(((t,o)=>{r(t).each((o=>{Ip.append(t,Oi(o)),e.onOpenMenu(t,o),e.highlightOnOpen===Of.HighlightMenuAndItem?l(t,o):e.highlightOnOpen===Of.HighlightJustMenu&&i(t,o)}))})),ea(Ef,((t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)})),ea(Tf,((t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)})),...e.navigateOnHover?[ea(af(),((t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind((t=>(m(e,t),u(e,n,t))))})(t,r),h(t,r,g.HighlightParent),e.onHover(t,r)}))]:[]]),y=e=>Ng.getHighlighted(e).bind(Ng.getHighlighted),w={collapseMenu:e=>{y(e).each((t=>{p(e,t)}))},highlightPrimary:e=>{n.getPrimary().each((t=>{l(e,t)}))},repositionMenus:t=>{const o=n.getPrimary().bind((e=>y(t).bind((e=>{const t=s(e),o=fe(n.getMenus()),r=xe(F(o,_f.extractPreparedMenu));return n.getTriggeringPath(t,(e=>((e,t,o)=>se(t,(e=>{if(!e.getSystem().isConnected())return D.none();const t=Ng.getCandidates(e);return W(t,(e=>s(e)===o))})))(0,r,e)))})).map((t=>({primary:e,triggeringPath:t})))));o.fold((()=>{(e=>D.from(e.components()[0]).filter((e=>"menu"===Et(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:tu(e.tmenuBehaviours,[Op.config({mode:"special",onRight:f(((e,t)=>rg(t.element)?D.none():h(e,t,g.HighlightSubmenu))),onLeft:f(((e,t)=>rg(t.element)?D.none():p(e,t))),onEscape:f(((t,o)=>p(t,o).orThunk((()=>e.onEscape(t,o).map((()=>t)))))),focusIn:(e,t)=>{n.getPrimary().each((t=>{Gs(e,t.element,ks())}))}}),Ng.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),ig.config({find:e=>Ng.getHighlighted(e)}),Ip.config({})]),eventOrder:e.eventOrder,apis:w,events:b}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:zr(e,t),expansions:{}}),collapseItem:e=>({value:wa(Df()),meta:{text:e}})}}),Mf=og({name:"InlineView",configFields:[mr("lazySink"),tl("onShow"),tl("onHide"),_r("onEscape"),Qm("inlineBehaviours",[Nm,Jm,ec]),Tr("fireDismissalEventInstead",[Or("event",Hs())]),Tr("fireRepositionEventInstead",[Or("event",Is())]),Or("getRelated",D.none),Or("isExtraPart",T),Or("eventOrder",D.none)],factory:(e,t)=>{const o=(t,o,n,r)=>{const s=e.lazySink(t).getOrDie();Nm.openWhileCloaked(t,o,(()=>sm.positionWithinBounds(s,t,n,r()))),Jm.setValue(t,D.some({mode:"position",config:n,getBounds:r}))},n=(t,o,n,r)=>{const s=((e,t,o,n,r)=>{const s=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>zl(),onRtl:()=>Vl()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return Af.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Nm.close(t),e.onEscape.map((e=>e(t))),D.some(!0)),onExecute:()=>D.some(!0),onOpenMenu:(e,t)=>{sm.positionWithinBounds(s().getOrDie(),t,o,r())},onOpenSubmenu:(e,t,o,n)=>{const r=s().getOrDie();sm.position(r,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=s().getOrDie();sm.positionWithinBounds(a,t,o,r()),z(n,(e=>{const t=i(e.triggeringPath);sm.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})}))}})})(e,t,o,n,r);Nm.open(t,s),Jm.setValue(t,D.some({mode:"menu",menu:s}))},r=t=>{Nm.isOpen(t)&&Jm.getValue(t).each((o=>{switch(o.mode){case"menu":Nm.getState(t).each(Af.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();sm.positionWithinBounds(n,t,o.config,o.getBounds())}}))},s={setContent:(e,t)=>{Nm.setContent(e,t)},showAt:(e,t,n)=>{const r=D.none;o(e,t,n,r)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,D.none)},showMenuWithinBounds:n,hide:e=>{Nm.isOpen(e)&&(Jm.setValue(e,D.none()),Nm.close(e))},getContent:e=>Nm.getState(e),reposition:r,isOpen:Nm.isOpen};return{uid:e.uid,dom:e.dom,behaviours:tu(e.inlineBehaviours,[Nm.config({isPartOf:(t,o,n)=>zi(o,n)||((t,o)=>e.getRelated(t).exists((e=>zi(e,o))))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),Jm.config({store:{mode:"memory",initialValue:D.none()}}),ec.config({channels:{...Im({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Fm({...e.fireRepositionEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({}),doReposition:r})}})]),eventOrder:e.eventOrder,apis:s}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,r)=>{e.showWithinBounds(t,o,n,r)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,r)=>{e.showMenuWithinBounds(t,o,n,r)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var Nf=tinymce.util.Tools.resolve("tinymce.util.Delay");const Rf=og({name:"Button",factory:e=>{const t=ef(e.action),o=e.dom.tag,n=t=>ve(e.dom,"attributes").bind((e=>ve(e,t)));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:nu(e.buttonBehaviours,[Up.config({}),Op.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:(()=>{if("button"===o){return{type:n("type").getOr("button"),...n("role").map((e=>({role:e}))).getOr({})}}return{role:e.role.getOr(n("role").getOr("button"))}})()},eventOrder:e.eventOrder}},configFields:[Or("uid",void 0),mr("dom"),Or("components",[]),ou("buttonBehaviours",[Up,Op]),wr("action"),wr("role"),Or("eventOrder",{})]}),Bf=e=>{const t=Le.fromHtml(e),o=it(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return j(t,((e,t)=>"class"===t.name?e:{...e,[t.name]:t.value}),{})})(t),r=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),s=0===o.length?{}:{innerHtml:ua(t)};return{tag:Ve(t),classes:r,attributes:n,...s}},Lf=e=>{const t=(e=>void 0!==e.uid)(e)&&ye(e,"uid")?e.uid:Ta("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}},{entries:Hf,setPrototypeOf:If,isFrozen:Pf,getPrototypeOf:Ff,getOwnPropertyDescriptor:zf}=Object;let{freeze:Vf,seal:Zf,create:Uf}=Object,{apply:jf,construct:Wf}="undefined"!=typeof Reflect&&Reflect;jf||(jf=function(e,t,o){return e.apply(t,o)}),Vf||(Vf=function(e){return e}),Zf||(Zf=function(e){return e}),Wf||(Wf=function(e,t){return new e(...t)});const $f=rv(Array.prototype.forEach),qf=rv(Array.prototype.pop),Gf=rv(Array.prototype.push),Kf=rv(String.prototype.toLowerCase),Yf=rv(String.prototype.toString),Xf=rv(String.prototype.match),Jf=rv(String.prototype.replace),Qf=rv(String.prototype.indexOf),ev=rv(String.prototype.trim),tv=rv(RegExp.prototype.test),ov=(nv=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o1?o-1:0),r=1;r/gm),xv=Zf(/\${[\w\W]*}/gm),Cv=Zf(/^data-[\-\w.\u00B7-\uFFFF]/),Sv=Zf(/^aria-[\-\w]+$/),kv=Zf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_v=Zf(/^(?:\w+script|data):/i),Ev=Zf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tv=Zf(/^html$/i);var Ov=Object.freeze({__proto__:null,MUSTACHE_EXPR:yv,ERB_EXPR:wv,TMPLIT_EXPR:xv,DATA_ATTR:Cv,ARIA_ATTR:Sv,IS_ALLOWED_URI:kv,IS_SCRIPT_OR_DATA:_v,ATTR_WHITESPACE:Ev,DOCTYPE_NAME:Tv});const Dv=()=>"undefined"==typeof window?null:window;var Av=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dv();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,r=n.currentScript;let{document:s}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:h}=t,p=c.prototype,f=iv(p,"cloneNode"),v=iv(p,"nextSibling"),b=iv(p,"childNodes"),y=iv(p,"parentNode");if("function"==typeof i){const e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let w,x="";const{implementation:C,createNodeIterator:S,createDocumentFragment:k,getElementsByTagName:_}=s,{importNode:E}=n;let T={};o.isSupported="function"==typeof Hf&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:A,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:B}=Ov;let{IS_ALLOWED_URI:L}=Ov,H=null;const I=sv({},[...lv,...cv,...dv,...uv,...hv]);let P=null;const F=sv({},[...pv,...fv,...vv,...bv]);let z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,Z=null,U=!0,j=!0,W=!1,$=!0,q=!1,G=!1,K=!1,Y=!1,X=!1,J=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,re={},se=null;const ae=sv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=sv({},["audio","video","img","source","image","track"]);let ce=null;const de=sv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),me="http://www.w3.org/1998/Math/MathML",ue="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let he=ge,pe=!1,fe=null;const ve=sv({},[me,ue,ge],Yf);let be;const ye=["application/xhtml+xml","text/html"];let we,xe=null;const Ce=s.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){if(!xe||xe!==e){if(e&&"object"==typeof e||(e={}),e=av(e),be=be=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===be?Yf:Kf,H="ALLOWED_TAGS"in e?sv({},e.ALLOWED_TAGS,we):I,P="ALLOWED_ATTR"in e?sv({},e.ALLOWED_ATTR,we):F,fe="ALLOWED_NAMESPACES"in e?sv({},e.ALLOWED_NAMESPACES,Yf):ve,ce="ADD_URI_SAFE_ATTR"in e?sv(av(de),e.ADD_URI_SAFE_ATTR,we):de,ie="ADD_DATA_URI_TAGS"in e?sv(av(le),e.ADD_DATA_URI_TAGS,we):le,se="FORBID_CONTENTS"in e?sv({},e.FORBID_CONTENTS,we):ae,V="FORBID_TAGS"in e?sv({},e.FORBID_TAGS,we):{},Z="FORBID_ATTR"in e?sv({},e.FORBID_ATTR,we):{},re="USE_PROFILES"in e&&e.USE_PROFILES,U=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,G=e.WHOLE_DOCUMENT||!1,X=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,Y=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||kv,he=e.NAMESPACE||ge,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),J&&(X=!0),re&&(H=sv({},[...hv]),P=[],!0===re.html&&(sv(H,lv),sv(P,pv)),!0===re.svg&&(sv(H,cv),sv(P,fv),sv(P,bv)),!0===re.svgFilters&&(sv(H,dv),sv(P,fv),sv(P,bv)),!0===re.mathMl&&(sv(H,uv),sv(P,vv),sv(P,bv))),e.ADD_TAGS&&(H===I&&(H=av(H)),sv(H,e.ADD_TAGS,we)),e.ADD_ATTR&&(P===F&&(P=av(P)),sv(P,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&sv(ce,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===ae&&(se=av(se)),sv(se,e.FORBID_CONTENTS,we)),oe&&(H["#text"]=!0),G&&sv(H,["html","head","body"]),H.table&&(sv(H,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ov('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ov('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,r)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));Vf&&Vf(e),xe=e}},_e=sv({},["mi","mo","mn","ms","mtext"]),Ee=sv({},["foreignobject","desc","title","annotation-xml"]),Te=sv({},["title","style","font","a","script"]),Oe=sv({},cv);sv(Oe,dv),sv(Oe,mv);const De=sv({},uv);sv(De,gv);const Ae=function(e){Gf(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Me=function(e,t){try{Gf(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Gf(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!P[e])if(X||J)try{Ae(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t,o;if(Y)e=""+e;else{const t=Xf(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===be&&he===ge&&(e=''+e+"");const n=w?w.createHTML(e):e;if(he===ge)try{t=(new g).parseFromString(n,be)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(he,"template",null);try{t.documentElement.innerHTML=pe?x:n}catch(e){}}const r=t.body||t.documentElement;return e&&o&&r.insertBefore(s.createTextNode(o),r.childNodes[0]||null),he===ge?_.call(t,G?"html":"body")[0]:G?t.documentElement:r},Re=function(e){return S.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Be=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,n){T[e]&&$f(T[e],(e=>{e.call(o,t,n,xe)}))},He=function(e){let t;if(Le("beforeSanitizeElements",e,null),(n=e)instanceof u&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof m)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Ae(e),!0;var n;const r=we(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:H}),e.hasChildNodes()&&!Be(e.firstElementChild)&&(!Be(e.content)||!Be(e.content.firstElementChild))&&tv(/<[/\w]/g,e.innerHTML)&&tv(/<[/\w]/g,e.textContent))return Ae(e),!0;if(!H[r]||V[r]){if(!V[r]&&Pe(r)){if(z.tagNameCheck instanceof RegExp&&tv(z.tagNameCheck,r))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(r))return!1}if(oe&&!se[r]){const t=y(e)||e.parentNode,o=b(e)||e.childNodes;if(o&&t){for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),v(e))}}return Ae(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const o=Kf(e.tagName),n=Kf(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===ue?t.namespaceURI===ge?"svg"===o:t.namespaceURI===me?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Oe[o]):e.namespaceURI===me?t.namespaceURI===ge?"math"===o:t.namespaceURI===ue?"math"===o&&Ee[n]:Boolean(De[o]):e.namespaceURI===ge?!(t.namespaceURI===ue&&!Ee[n])&&!(t.namespaceURI===me&&!_e[n])&&!De[o]&&(Te[o]||!Oe[o]):!("application/xhtml+xml"!==be||!fe[e.namespaceURI]))}(e)?(Ae(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!tv(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=Jf(t,O," "),t=Jf(t,D," "),t=Jf(t,A," "),e.textContent!==t&&(Gf(o.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Ae(e),!0)},Ie=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in s||o in Ce))return!1;if(j&&!Z[t]&&tv(M,t));else if(U&&tv(N,t));else if(!P[t]||Z[t]){if(!(Pe(e)&&(z.tagNameCheck instanceof RegExp&&tv(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&tv(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&tv(z.tagNameCheck,o)||z.tagNameCheck instanceof Function&&z.tagNameCheck(o))))return!1}else if(ce[t]);else if(tv(L,Jf(o,B,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Qf(o,"data:")||!ie[e]){if(W&&!tv(R,Jf(o,B,"")));else if(o)return!1}else;return!0},Pe=function(e){return e.indexOf("-")>0},Fe=function(e){let t,o,n,r;Le("beforeSanitizeAttributes",e,null);const{attributes:s}=e;if(!s)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P};for(r=s.length;r--;){t=s[r];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:ev(t.value);const c=o;if(n=we(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){Me(i,e);continue}if(!$&&tv(/\/>/i,o)){Me(i,e);continue}q&&(o=Jf(o,O," "),o=Jf(o,D," "),o=Jf(o,A," "));const d=we(e.nodeName);if(Ie(d,n,o)){if(!te||"id"!==n&&"name"!==n||(Me(i,e),o="user-content-"+o),w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(l);else switch(h.getAttributeType(d,n)){case"TrustedHTML":o=w.createHTML(o);break;case"TrustedScriptURL":o=w.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){Me(i,e)}}else Me(i,e)}Le("afterSanitizeAttributes",e,null)},ze=function e(t){let o;const n=Re(t);for(Le("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Le("uponSanitizeShadowNode",o,null),He(o)||(o.content instanceof a&&e(o.content),Fe(o));Le("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,r,s,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(pe=!e,pe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw ov("toString is not a function");if("string"!=typeof(e=e.toString()))throw ov("dirty is not a string, aborting")}if(!o.isSupported)return e;if(K||ke(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=we(e.nodeName);if(!H[t]||V[t])throw ov("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Ne("\x3c!----\x3e"),r=t.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?t=r:t.appendChild(r);else{if(!X&&!q&&!G&&-1===e.indexOf("<"))return w&&Q?w.createHTML(e):e;if(t=Ne(e),!t)return X?null:Q?x:""}t&&Y&&Ae(t.firstChild);const d=Re(ne?e:t);for(;s=d.nextNode();)He(s)||(s.content instanceof a&&ze(s.content),Fe(s));if(ne)return e;if(X){if(J)for(i=k.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(P.shadowroot||P.shadowrootmode)&&(i=E.call(n,i,!0)),i}let m=G?t.outerHTML:t.innerHTML;return G&&H["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&tv(Tv,t.ownerDocument.doctype.name)&&(m="\n"+m),q&&(m=Jf(m,O," "),m=Jf(m,D," "),m=Jf(m,A," ")),w&&Q?w.createHTML(m):m},o.setConfig=function(e){ke(e),K=!0},o.clearConfig=function(){xe=null,K=!1},o.isValidAttribute=function(e,t,o){xe||ke({});const n=we(e),r=we(t);return Ie(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],Gf(T[e],t))},o.removeHook=function(e){if(T[e])return qf(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const Mv=e=>Av().sanitize(e);var Nv=tinymce.util.Tools.resolve("tinymce.util.I18n");const Rv={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},Bv="temporary-placeholder",Lv=e=>()=>ve(e,Bv).getOr("!not found!"),Hv=(e,t)=>{const o=e.toLowerCase();if(Nv.isRtl()){const e=((e,t)=>De(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},Iv=(e,t)=>ve(t,Hv(e,t)),Pv=(e,t)=>{const o=t();return Iv(e,o).getOrThunk(Lv(o))},Fv=()=>Pp("add-focusable",[la((e=>{Bi(e.element,"svg").each((e=>kt(e,"focusable","false")))}))]),zv=(e,t,o,n)=>{var r,s;const a=(e=>!!Nv.isRtl()&&be(Rv,e))(t)?["tox-icon--flip"]:[],i=ve(o,Hv(t,o)).or(n).getOrThunk(Lv(o));return{dom:{tag:e.tag,attributes:null!==(r=e.attributes)&&void 0!==r?r:{},classes:e.classes.concat(a),innerHtml:i},behaviours:Gl([...null!==(s=e.behaviours)&&void 0!==s?s:[],Fv()])}},Vv=(e,t,o,n=D.none())=>zv(t,e,o(),n),Zv={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Uv=og({name:"Notification",factory:e=>{const t=Lf({dom:Bf(`

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

    `),behaviours:Gl([Ip.config({})])}),o=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),n=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Lf({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(0)]},n(0)],behaviours:Gl([Ip.config({})])}),s={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{Ip.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(t)]},n(t)])}))},updateText:(e,o)=>{if(e.getSystem().isConnected()){const n=t.get(e);Ip.set(n,[Si(o)])}}},a=q([e.icon.toArray(),e.level.toArray(),e.level.bind((e=>D.from(Zv[e]))).toArray()]),i=Lf(Rf.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[Vv("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":e.translationProvider("Close")}},e.iconProvider)],action:t=>{e.onAction(t)}})),l=((e,t,o)=>{const n=o(),r=W(e,(e=>be(n,Hv(e,n))));return zv(t,r.getOr(Bv),n,D.none())})(a,{tag:"div",classes:["tox-notification__icon"]},e.iconProvider),c=[l,{dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:Gl([Ip.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert"},classes:e.level.map((e=>["tox-notification","tox-notification--in",`tox-notification--${e}`])).getOr(["tox-notification","tox-notification--in"])},behaviours:Gl([Up.config({}),Pp("notification-events",[ea(as(),(e=>{i.getOpt(e).each(Up.focus)}))])]),components:c.concat(e.progress?[r.asSpec()]:[]).concat([i.asSpec()]),apis:s}},configFields:[wr("level"),mr("progress"),wr("icon"),mr("onAction"),mr("text"),mr("iconProvider"),mr("translationProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var jv,Wv,$v=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),qv=tinymce.util.Tools.resolve("tinymce.EditorManager"),Gv=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(jv||(jv={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(Wv||(Wv={}));const Kv=e=>t=>t.options.get(e),Yv=e=>t=>D.from(e(t)),Xv=e=>{const t=Gv.deviceType.isPhone(),o=Gv.deviceType.isTablet()||t,n=e.options.register,r=e=>s(e)||!1===e,a=e=>s(e)||p(e);n("skin",{processor:e=>s(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:$v.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=>s(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||s(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),I(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:Wv.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:r,default:"#top"}),n("anchor_bottom",{processor:r,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("promotion",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!Gv.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},Jv=Kv("readonly"),Qv=Kv("height"),eb=Kv("width"),tb=Yv(Kv("min_width")),ob=Yv(Kv("min_height")),nb=Yv(Kv("max_width")),rb=Yv(Kv("max_height")),sb=Yv(Kv("style_formats")),ab=Kv("style_formats_merge"),ib=Kv("style_formats_autohide"),lb=Kv("content_langs"),cb=Kv("removed_menuitems"),db=Kv("toolbar_mode"),mb=Kv("toolbar_groups"),ub=Kv("toolbar_location"),gb=Kv("fixed_toolbar_container"),hb=Kv("fixed_toolbar_container_target"),pb=Kv("toolbar_persist"),fb=Kv("toolbar_sticky_offset"),vb=Kv("menubar"),bb=Kv("toolbar"),yb=Kv("file_picker_callback"),wb=Kv("file_picker_validator_handler"),xb=Kv("font_size_input_default_unit"),Cb=Kv("file_picker_types"),Sb=Kv("typeahead_urls"),kb=Kv("anchor_top"),_b=Kv("anchor_bottom"),Eb=Kv("draggable_modal"),Tb=Kv("statusbar"),Ob=Kv("elementpath"),Db=Kv("branding"),Ab=Kv("resize"),Mb=Kv("paste_as_text"),Nb=Kv("sidebar_show"),Rb=Kv("promotion"),Bb=Kv("help_accessibility"),Lb=Kv("default_font_stack"),Hb=e=>!1===e.options.get("skin"),Ib=e=>!1!==e.options.get("menubar"),Pb=e=>{const t=e.options.get("skin_url");if(Hb(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return qv.baseURL+"/skins/ui/"+t}},Fb=e=>D.from(e.options.get("skin_url")),zb=e=>e.options.get("line_height_formats").split(" "),Vb=e=>{const t=bb(e),o=s(t),n=l(t)&&t.length>0;return!Ub(e)&&(n||o||!0===t)},Zb=e=>{const t=I(9,(t=>e.options.get("toolbar"+(t+1)))),o=Z(t,s);return ke(o.length>0,o)},Ub=e=>Zb(e).fold((()=>{const t=bb(e);return f(t,s)&&t.length>0}),O),jb=e=>ub(e)===Wv.bottom,Wb=e=>{var t;if(!e.inline)return D.none();const o=null!==(t=gb(e))&&void 0!==t?t:"";if(o.length>0)return Li(xt(),o);const n=hb(e);return g(n)?D.some(Le.fromDom(n)):D.none()},$b=e=>e.inline&&Wb(e).isSome(),qb=e=>Wb(e).getOrThunk((()=>ft(pt(Le.fromDom(e.getElement()))))),Gb=e=>e.inline&&!Ib(e)&&!Vb(e)&&!Ub(e),Kb=e=>(e.options.get("toolbar_sticky")||e.inline)&&!$b(e)&&!Gb(e),Yb=e=>!$b(e)&&"split"===e.options.get("ui_mode"),Xb=e=>{const t=e.options.get("menu");return ce(t,(e=>({...e,items:e.items})))};var Jb=Object.freeze({__proto__:null,get ToolbarMode(){return jv},get ToolbarLocation(){return Wv},register:Xv,getSkinUrl:Pb,getSkinUrlOption:Fb,isReadOnly:Jv,isSkinDisabled:Hb,getHeightOption:Qv,getWidthOption:eb,getMinWidthOption:tb,getMinHeightOption:ob,getMaxWidthOption:nb,getMaxHeightOption:rb,getUserStyleFormats:sb,shouldMergeStyleFormats:ab,shouldAutoHideStyleFormats:ib,getLineHeightFormats:zb,getContentLanguages:lb,getRemovedMenuItems:cb,isMenubarEnabled:Ib,isMultipleToolbars:Ub,isToolbarEnabled:Vb,isToolbarPersist:pb,getMultipleToolbarsOption:Zb,getUiContainer:qb,useFixedContainer:$b,isSplitUiMode:Yb,getToolbarMode:db,isDraggableModal:Eb,isDistractionFree:Gb,isStickyToolbar:Kb,getStickyToolbarOffset:fb,getToolbarLocation:ub,isToolbarLocationBottom:jb,getToolbarGroups:mb,getMenus:Xb,getMenubar:vb,getToolbar:bb,getFilePickerCallback:yb,getFilePickerTypes:Cb,useTypeaheadUrls:Sb,getAnchorTop:kb,getAnchorBottom:_b,getFilePickerValidatorHandler:wb,getFontSizeInputDefaultUnit:xb,useStatusBar:Tb,useElementPath:Ob,promotionEnabled:Rb,useBranding:Db,getResize:Ab,getPasteAsText:Mb,getSidebarShow:Nb,useHelpAccessibility:Bb,getDefaultFontStack:Lb});const Qb=(e,t)=>{const o=(e,t)=>{$s(e,ls(),{raw:t})},n=()=>e.getMenu().bind(Ng.getHighlighted);t.on("keydown",(t=>{const r=t.which;e.isActive()&&(e.isMenuOpen()?13===r?(n().each(qs),t.preventDefault()):40===r?(n().fold((()=>{e.getMenu().each(Ng.highlightFirst)}),(e=>{o(e,t)})),t.preventDefault(),t.stopImmediatePropagation()):37!==r&&38!==r&&39!==r||n().each((e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()})):13!==r&&38!==r&&40!==r||e.cancelIfNecessary())})),t.on("NodeChange",(()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()}))};var ey;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(ey||(ey={}));var ty=ey;const oy="tox-menu-nav__js",ny="tox-collection__item",ry="tox-swatch",sy={normal:oy,color:ry},ay="tox-collection__item--enabled",iy="tox-collection__item-icon",ly="tox-collection__item-label",cy="tox-collection__item-caret",dy="tox-collection__item--active",my="tox-collection__item-container",uy="tox-collection__item-container--row",gy=e=>ve(sy,e).getOr(oy),hy=e=>"color"===e?"tox-swatches":"tox-menu",py=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:hy(e),tieredMenu:"tox-tiered-menu"}),fy=e=>{const t=py(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:gy(e)}},vy=(e,t,o)=>{const n=py(o);return{tag:"div",classes:q([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},by=[xf.parts.items({})],yy=(e,t,o)=>{const n=py(o);return{dom:{tag:"div",classes:q([[n.tieredMenu]])},markers:fy(o)}},wy=w([wr("data"),Or("inputAttributes",{}),Or("inputStyles",{}),Or("tag","input"),Or("inputClasses",[]),tl("onSetValue"),Or("styles",{}),Or("eventOrder",{}),Qm("inputBehaviours",[Jm,Up]),Or("selectOnFocus",!0)]),xy=e=>Gl([Up.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=di(t);t.dom.setSelectionRange(0,o.length)}:v})]),Cy=e=>({...xy(e),...tu(e.inputBehaviours,[Jm.config({store:{mode:"manual",...e.data.map((e=>({initialValue:e}))).getOr({}),getValue:e=>di(e.element),setValue:(e,t)=>{di(e.element)!==t&&mi(e.element,t)}},onSetValue:e.onSetValue})])}),Sy=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),ky=og({name:"Input",configFields:wy(),factory:(e,t)=>({uid:e.uid,dom:Sy(e),components:[],behaviours:Cy(e),eventOrder:e.eventOrder})}),_y=wa("refetch-trigger-event"),Ey=wa("redirect-menu-item-interaction"),Ty="tox-menu__searcher",Oy=e=>Li(e.element,`.${Ty}`).bind((t=>e.getSystem().getByDom(t).toOptional())),Dy=Oy,Ay=e=>({fetchPattern:Jm.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),My=e=>{const t=(e,t)=>(t.cut(),D.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return $s(e,Ey,o),D.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[ny]},components:[ky.sketch({inputClasses:[Ty,"tox-textfield"],inputAttributes:{...e.placeholder.map((t=>({placeholder:e.i18n(t)}))).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:Gl([Pp(n,[ea(ds(),(e=>{Ws(e,_y)})),ea(ls(),((e,t)=>{"Escape"===t.event.raw.key&&t.stop()}))]),Op.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,Op.name()]}})]}},Ny="tox-collection--results__js",Ry=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:wa("aria-item-search-result-id"),"aria-selected":"false"}}}:e},By=(e,t)=>o=>{const n=P(o,t);return F(n,(t=>({dom:e,components:t})))},Ly=(e,t)=>{const o=[];let n=[];return z(e,((e,r)=>{t(e,r)?(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),F(o,(e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e})))},Hy=(e,t,o)=>xf.parts.items({preprocess:n=>{const r=F(n,o);return"auto"!==e&&e>1?By({tag:"div",classes:["tox-collection__group"]},e)(r):Ly(r,((e,o)=>"separator"===t[o].type))}}),Iy=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Hy(e,t,x)]}),Py=e=>H(e,(e=>"icon"in e&&void 0!==e.icon)),Fy=e=>(console.error(sr(e)),console.log(e),D.none()),zy=(e,t,o,n,r)=>{const s=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[xf.parts.items({preprocess:e=>Ly(e,((e,t)=>"separator"===a[t].type))})]});var a;return{value:e,dom:s.dom,components:s.components,items:o}},Vy=(e,t,o,n,r)=>{const s=()=>"searchable"!==r.menuType?Iy(n,o):"search-with-field"===r.searchMode.searchMode?((e,t,o)=>{const n=wa("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[My({i18n:Nv.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],Ny],attributes:{id:n}},components:[Hy(e,t,Ry)]}]}})(n,o,r.searchMode):((e,t,o=!0)=>{const n=wa("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",Ny].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:n}},components:[Hy(e,t,Ry)]}})(n,o);if("color"===r.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[xf.parts.items({preprocess:"auto"!==e?By({tag:"div",classes:["tox-swatches__row"]},e):x})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType&&"auto"===n){const t=Iy(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType||"searchable"===r.menuType){const t=s();return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===r.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[xf.parts.items({preprocess:By({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:vy(t,n,r.menuType),components:by,items:o}},Zy=hr("type"),Uy=hr("name"),jy=hr("label"),Wy=hr("text"),$y=hr("title"),qy=hr("icon"),Gy=hr("value"),Ky=fr("fetch"),Yy=fr("getSubmenuItems"),Xy=fr("onAction"),Jy=fr("onItemAction"),Qy=Br("onSetup",(()=>v)),ew=Sr("name"),tw=Sr("text"),ow=Sr("icon"),nw=Sr("tooltip"),rw=Sr("label"),sw=Sr("shortcut"),aw=_r("select"),iw=Rr("active",!1),lw=Rr("borderless",!1),cw=Rr("enabled",!0),dw=Rr("primary",!1),mw=e=>Or("columns",e),uw=Or("meta",{}),gw=Br("onAction",v),hw=e=>Mr("type",e),pw=e=>lr("name","name",kn((()=>wa(`${e}-name`))),qn),fw=Fn([Zy,tw]),vw=Fn([hw("autocompleteitem"),iw,cw,uw,Gy,tw,ow]),bw=[cw,nw,ow,tw,Qy],yw=Fn([Zy,Xy,sw].concat(bw)),ww=e=>or("toolbarbutton",yw,e),xw=[iw].concat(bw),Cw=Fn(xw.concat([Zy,Xy,sw])),Sw=e=>or("ToggleButton",Cw,e),kw=[Br("predicate",T),Nr("scope","node",["node","editor"]),Nr("position","selection",["node","selection","line"])],_w=bw.concat([hw("contextformbutton"),dw,Xy,cr("original",x)]),Ew=xw.concat([hw("contextformbutton"),dw,Xy,cr("original",x)]),Tw=bw.concat([hw("contextformbutton")]),Ow=xw.concat([hw("contextformtogglebutton")]),Dw=ar("type",{contextformbutton:_w,contextformtogglebutton:Ew}),Aw=Fn([hw("contextform"),Br("initValue",w("")),rw,yr("commands",Dw),xr("launch",ar("type",{contextformbutton:Tw,contextformtogglebutton:Ow}))].concat(kw)),Mw=Fn([hw("contexttoolbar"),hr("items")].concat(kw)),Nw=[Zy,hr("src"),Sr("alt"),Lr("classes",[],qn)],Rw=Fn(Nw),Bw=[Zy,Wy,ew,Lr("classes",["tox-collection__item-label"],qn)],Lw=Fn(Bw),Hw=Hn((()=>Qn("type",{cardimage:Rw,cardtext:Lw,cardcontainer:Iw}))),Iw=Fn([Zy,Mr("direction","horizontal"),Mr("align","left"),Mr("valign","middle"),yr("items",Hw)]),Pw=[cw,tw,sw,(Fw="menuitem",lr("value","value",kn((()=>wa(`${Fw}-value`))),jn())),uw];var Fw;const zw=Fn([Zy,rw,yr("items",Hw),Qy,gw].concat(Pw)),Vw=Fn([Zy,iw,ow].concat(Pw)),Zw=[Zy,hr("fancytype"),gw],Uw=[Or("initData",{})].concat(Zw),jw=[_r("select"),Hr("initData",{},[Rr("allowCustomColors",!0),Mr("storageKey","default"),Er("colors",jn())])].concat(Zw),Ww=ar("fancytype",{inserttable:Uw,colorswatch:jw}),$w=Fn([Zy,Qy,gw,ow].concat(Pw)),qw=Fn([Zy,Yy,Qy,ow].concat(Pw)),Gw=Fn([Zy,ow,iw,Qy,Xy].concat(Pw)),Kw=(e,t,o)=>{const n=Ed(e.element,"."+o);if(n.length>0){const e=$(n,(e=>{const o=e.dom.getBoundingClientRect().top,r=n[0].dom.getBoundingClientRect().top;return Math.abs(o-r)>t})).getOr(n.length);return D.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return D.none()},Yw=(e,t)=>Gl([Pp(e,t)]),Xw=e=>Yw(wa("unnamed-events"),e),Jw=wa("tooltip.exclusive"),Qw=wa("tooltip.show"),ex=wa("tooltip.hide"),tx=wa("tooltip.immediateHide"),ox=wa("tooltip.immediateShow"),nx=(e,t,o)=>{e.getSystem().broadcastOn([Jw],{})};var rx=Object.freeze({__proto__:null,hideAllExclusive:nx,setComponents:(e,t,o,n)=>{o.getTooltip().each((e=>{e.getSystem().isConnected()&&Ip.set(e,n)}))}});var sx=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each((n=>{n.getSystem().isConnected()&&(fm(n),e.onHide(o,n),t.clearTooltip())})),t.clearTimer()},n=o=>{if(!t.isShowing()){nx(o);const n=e.lazySink(o).getOrDie(),r=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Xs("normal"===e.mode?[ea(ss(),(e=>{Ws(o,Qw)})),ea(ns(),(e=>{Ws(o,ex)}))]:[]),behaviours:Gl([Ip.config({})])});t.setTooltip(r),gm(n,r),e.onShow(o,r),sm.position(n,r,{anchor:e.anchor(o)})}},r=o=>{t.getTooltip().each((t=>{const n=e.lazySink(o).getOrDie();sm.position(n,t,{anchor:e.anchor(o)})}))};return Xs(q([[ea(Qw,(o=>{t.resetTimer((()=>{n(o)}),e.delayForShow())})),ea(ex,(n=>{t.resetTimer((()=>{o(n)}),e.delayForHide())})),ea(ox,(e=>{t.resetTimer((()=>{n(e)}),0)})),ea(tx,(e=>{t.resetTimer((()=>{o(e)}),0)})),ea(Cs(),((e,t)=>{const n=t;n.universal||L(n.channels,Jw)&&o(e)})),ca((e=>{o(e)}))],(()=>{switch(e.mode){case"normal":return[ea(as(),(e=>{Ws(e,ox)})),ea(ws(),(e=>{Ws(e,tx)})),ea(ss(),(e=>{Ws(e,Qw)})),ea(ns(),(e=>{Ws(e,ex)}))];case"follow-highlight":return[ea(Us(),((e,t)=>{Ws(e,Qw)})),ea(js(),(e=>{Ws(e,ex)}))];case"children-normal":return[ea(as(),((o,n)=>{ac(o.element).each((s=>{Ke(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold((()=>{Ws(o,ox)}),(n=>{t.isShowing()&&(e.onShow(o,n),r(o))}))}))})),ea(ws(),(e=>{ac(e.element).fold((()=>{Ws(e,tx)}),v)})),ea(ss(),(o=>{Li(o.element,"[data-mce-tooltip]:hover").each((n=>{t.getTooltip().fold((()=>{Ws(o,Qw)}),(n=>{t.isShowing()&&(e.onShow(o,n),r(o))}))}))})),ea(ns(),(e=>{Li(e.element,"[data-mce-tooltip]:hover").fold((()=>{Ws(e,ex)}),v)}))];default:return[ea(as(),((o,n)=>{ac(o.element).each((s=>{Ke(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold((()=>{Ws(o,ox)}),(n=>{t.isShowing()&&(e.onShow(o,n),r(o))}))}))})),ea(ws(),(e=>{ac(e.element).fold((()=>{Ws(e,tx)}),v)}))]}})()]))}}),ax=[mr("lazySink"),mr("tooltipDom"),Or("exclusive",!0),Or("tooltipComponents",[]),Br("delayForShow",w(300)),Br("delayForHide",w(300)),Nr("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),Or("anchor",(e=>({type:"hotspot",hotspot:e,layouts:{onLtr:w([Rl,Nl,Ol,Al,Dl,Ml]),onRtl:w([Rl,Nl,Ol,Al,Dl,Ml])},bubble:jc(0,-2,{})}))),tl("onHide"),tl("onShow")];var ix=Object.freeze({__proto__:null,init:()=>{const e=_c(),t=_c(),o=()=>{e.on(clearTimeout)},n=w("not-implemented");return Pa({getTooltip:t.get,isShowing:t.isSet,setTooltip:t.set,clearTooltip:t.clear,clearTimer:o,resetTimer:(t,n)=>{o(),e.set(setTimeout(t,n))},readState:n})}});const lx=Yl({fields:ax,name:"tooltipping",active:sx,state:ix,apis:rx}),cx="silver.readonly",dx=Fn([(mx="readonly",ur(mx,Gn))]);var mx;const ux=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&z(n,(e=>{e.broadcastOn([Rm()],{target:o})})),z(n,(e=>{e.broadcastOn([cx],{readonly:t})}))},gx=(e,t)=>{e.on("init",(()=>{e.mode.isReadOnly()&&ux(t,!0)})),e.on("SwitchMode",(()=>ux(t,e.mode.isReadOnly()))),Jv(e)&&e.mode.set("readonly")},hx=()=>ec.config({channels:{[cx]:{schema:dx,onReceive:(e,t)=>{xg.set(e,t.readonly)}}}}),px=e=>xg.config({disabled:e,disableClass:"tox-collection__item--state-disabled"}),fx=e=>xg.config({disabled:e}),vx=e=>xg.config({disabled:e,disableClass:"tox-tbtn--disabled"}),bx=e=>xg.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),yx=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},wx=(e,t)=>la((o=>{yx(e,o)((o=>{const n=e.onSetup(o);h(n)&&t.set(n)}))})),xx=(e,t)=>ca((o=>yx(e,o)(t.get()))),Cx=(e,t)=>ma(((o,n)=>{yx(e,o)(e.onAction),e.triggersSubmenu||t!==ty.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Ws(o,Ts()),n.stop())})),Sx={[Ss()]:["disabling","alloy.base.behaviour","toggling","item-events"]},kx=xe,_x=(e,t,o,n)=>{const r=Ir(v);return{type:"item",dom:t.dom,components:kx(t.optComponents),data:e.data,eventOrder:Sx,hasSubmenu:e.triggersSubmenu,itemBehaviours:Gl([Pp("item-events",[Cx(e,o),wx(e,r),xx(e,r)]),px((()=>!e.enabled||n.isDisabled())),hx(),Ip.config({})].concat(e.itemBehaviours))}},Ex=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),Tx=e=>{const t=Gv.os.isMacOS()||Gv.os.isiOS(),o=t?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),r=F(n,(e=>{const t=e.toLowerCase().trim();return be(o,t)?o[t]:e}));return t?r.join(""):r.join("+")},Ox=(e,t,o=[iy])=>Vv(e,{tag:"div",classes:o},t),Dx=e=>({dom:{tag:"div",classes:[ly]},components:[Si(Nv.translate(e))]}),Ax=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),Mx=(e,t)=>({dom:{tag:"div",classes:[ly]},components:[{dom:{tag:e.tag,styles:e.styles},components:[Si(Nv.translate(t))]}]}),Nx=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[Si(Tx(e))]}),Rx=e=>Ox("checkmark",e,["tox-collection__item-checkmark"]),Bx=(e,t,o)=>{const n=e.value,r=e.iconContent.map((e=>((e,t,o)=>{const n=t();return Iv(e,n).or(o).getOrThunk(Lv(n))})(e,t.icons,o))),s=e.ariaLabel.map((e=>({"aria-label":t.translate(e),"data-mce-name":e}))).getOr({});return{dom:(()=>{const e=ry,t=r.getOr(""),o={tag:"div",attributes:s,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:[]}},Lx=e=>{const t=e.map((e=>({attributes:{id:wa("menu-item"),"aria-label":Nv.translate(e)}}))).getOr({});return{tag:"div",classes:[oy,ny],...t}},Hx=(e,t,o,n=D.none())=>"color"===e.presets?Bx(e,t,n):((e,t,o,n)=>{const r={tag:"div",classes:[iy]},s=o?e.iconContent.map((e=>Vv(e,r,t.icons,n))).orThunk((()=>D.some({dom:r}))):D.none(),a=e.checkMark,i=D.from(e.meta).fold((()=>Dx),(e=>be(e,"style")?S(Mx,e.style):Dx)),l=e.htmlContent.fold((()=>e.textContent.map(i)),(e=>D.some(Ax(e,[ly]))));return{dom:Lx(e.ariaLabel),optComponents:[s,l,e.shortcutContent.map(Nx),a,e.caret]}})(e,t,o,n),Ix=(e,t,o)=>ve(e,"tooltipWorker").map((e=>[lx.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:zc}}),mode:"follow-highlight",onShow:(t,o)=>{e((e=>{lx.setComponents(t,[ki({element:Le.fromDom(e)})])}))}})])).getOrThunk((()=>o.map((e=>[lx.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})])).getOr([]))),Px=(e,t)=>{const o=(e=>$v.DOM.encode(e))(Nv.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,(e=>`${e}`))}return o},Fx=(e,t)=>F(e,(e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":uy,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[my,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,Fx(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=>L(t.cardText.highlightOn,e))),n=o?D.from(t.cardText.matchText).getOr(""):"";return Ax(Px(e.text,n),e.classes)}})),zx=Lu(hf(),pf()),Vx=e=>({value:Wx(e)}),Zx=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Ux=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,jx=e=>Zx.test(e)||Ux.test(e),Wx=e=>Ee(e,"#").toUpperCase(),$x=e=>{const t=(e=>{const t=e.value.replace(Zx,((e,t,o,n)=>t+t+o+o+n+n));return{value:t}})(e),o=Ux.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o},qx=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Gx=e=>{const t=qx(e.red)+qx(e.green)+qx(e.blue);return Vx(t)},Kx=Math.min,Yx=Math.max,Xx=Math.round,Jx=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,Qx=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,eC=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),tC=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},oC=e=>{let t,o,n;const r=(e.hue||0)%360;let s=e.saturation/100,a=e.value/100;if(s=Yx(0,Kx(s,1)),a=Yx(0,Kx(a,1)),0===s)return t=o=n=Xx(255*a),eC(t,o,n,1);const i=r/60,l=a*s,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=Xx(255*(t+d)),o=Xx(255*(o+d)),n=Xx(255*(n+d)),eC(t,o,n,1)},nC=e=>{const t=$x(e),o=parseInt(t[1],16),n=parseInt(t[2],16),r=parseInt(t[3],16);return eC(o,n,r,1)},rC=(e,t,o,n)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return eC(r,s,a,i)},sC=e=>{if("transparent"===e)return D.some(eC(0,0,0,0));const t=Jx.exec(e);if(null!==t)return D.some(rC(t[1],t[2],t[3],"1"));const o=Qx.exec(e);return null!==o?D.some(rC(o[1],o[2],o[3],o[4])):D.none()},aC=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,iC=eC(255,0,0,1),lC=(e,t)=>{e.dispatch("ResizeContent",t)},cC=(e,t)=>{e.dispatch("TextColorChange",t)},dC=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),mC=(e,t)=>()=>{e(),t()},uC=e=>hC(e,"NodeChange",(t=>{t.setEnabled(e.selection.isEditable())})),gC=(e,t)=>o=>{const n=uC(e)(o),r=((e,t)=>o=>{const n=kc(),r=()=>{o.setActive(e.formatter.match(t));const r=e.formatter.formatChanged(t,o.setActive);n.set(r)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),n.clear()}})(e,t)(o);return()=>{n(),r()}},hC=(e,t,o)=>n=>{const r=()=>o(n),s=()=>{o(n),e.on(t,r)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),e.off(t,r)}},pC=e=>t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)}))},fC=(e,t)=>()=>e.execCommand(t);var vC=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const bC={},yC=e=>ve(bC,e).getOrThunk((()=>{const t=`tinymce-custom-colors-${e}`,o=vC.getItem(t);if(u(o)){const e=vC.getItem("tinymce-custom-colors");vC.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=vC.getItem(e),n=s(o)?JSON.parse(o):[],r=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{r.splice(e,1)};return{add:o=>{B(r,o).each(i),r.unshift(o),r.length>t&&r.pop(),vC.setItem(e,JSON.stringify(r))},state:()=>r.slice(0)}})(t,10);return bC[e]=n,n})),wC=(e,t)=>{yC(e).add(t)},xC=(e,t,o)=>({hue:e,saturation:t,value:o}),CC=e=>{let t=0,o=0,n=0;const r=e.red/255,s=e.green/255,a=e.blue/255,i=Math.min(r,Math.min(s,a)),l=Math.max(r,Math.max(s,a));if(i===l)return n=i,xC(0,0,100*n);return t=r===i?3:a===i?1:5,t=60*(t-(r===i?s-a:a===i?r-s:a-r)/(l-i)),o=(l-i)/l,n=l,xC(Math.round(t),Math.round(100*o),Math.round(100*n))},SC=e=>Gx(oC(e)),kC=e=>{return(t=e,jx(t)?D.some({value:Wx(t)}):D.none()).orThunk((()=>sC(e).map(Gx))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,r=n[0],s=n[1],a=n[2],i=n[3];return Gx(eC(r,s,a,i))}));var t},_C="forecolor",EC="hilitecolor",TC=e=>{const t=[];for(let o=0;ot=>t.options.get(e),DC="#000000",AC=(e,t)=>t===_C&&e.options.isSet("color_map_foreground")?OC("color_map_foreground")(e):t===EC&&e.options.isSet("color_map_background")?OC("color_map_background")(e):OC("color_map")(e),MC=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(AC(e,t).length))),NC=(e,t)=>{const o=OC("color_cols")(e),n=MC(e,t);return o===MC(e)?n:o},RC=(e,t="default")=>Math.round(t===_C?OC("color_cols_foreground")(e):t===EC?OC("color_cols_background")(e):OC("color_cols")(e)),BC=OC("custom_colors"),LC=OC("color_default_foreground"),HC=OC("color_default_background"),IC=e=>Wr(e,(e=>{if(je(e)){const t=Lt(e,"background-color");return ke((e=>sC(e).exists((e=>0!==e.alpha)))(t),t)}return D.none()})).getOr("rgba(0, 0, 0, 0)"),PC=(e,t)=>{const o=Le.fromDom(e.selection.getStart()),n="hilitecolor"===t?IC(o):Lt(o,"color");return sC(n).map((e=>"#"+Gx(e).value))},FC=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]},zC=(e,t,o,n)=>{if("custom"===o){KC(e)((o=>{o.each((o=>{wC(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)}))}),PC(e,t).getOr(DC))}else"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},VC=(e,t,o)=>e.concat((e=>F(yC(e).state(),(e=>({type:"choiceitem",text:e,icon:"checkmark",value:e}))))(t).concat(FC(o))),ZC=(e,t,o)=>n=>{n(VC(e,t,o))},UC=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},jC=(e,t)=>{e.setTooltip(t)},WC=(e,t)=>o=>{const n=PC(e,t);return we(n,o.toUpperCase())},$C=(e,t,o)=>{if(Ne(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",r=VC(AC(e,t),t,!1),s=W(r,(e=>e.value===o)).getOr({text:""}).text;return e.translate([n,e.translate(s)])},qC=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:$C(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:WC(e,o),columns:RC(e,o),fetch:ZC(AC(e,o),o,BC(e)),onAction:t=>{zC(e,o,n.get(),v)},onItemAction:(r,s)=>{zC(e,o,s,(o=>{n.set(o),cC(e,{name:t,color:o})}))},onSetup:r=>{UC(r,t,n.get());const s=n=>{n.name===t&&(UC(r,n.name,n.color),jC(r,$C(e,o,n.color)))};return e.on("TextColorChange",s),mC(uC(e)(r),(()=>{e.off("TextColorChange",s)}))}})},GC=(e,t,o,n,r)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(jC(n,$C(e,o,r.get())),UC(n,t,r.get()),uC(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:WC(e,o),initData:{storageKey:o},onAction:n=>{zC(e,o,n.value,(o=>{r.set(o),cC(e,{name:t,color:o})}))}}]})},KC=e=>(t,o)=>{let n=!1;const r={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:r,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const r=o.getData().colorpicker;n?(t(D.from(r)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",r]))},onClose:v,onCancel:()=>{t(D.none())}})},YC=(e,t,o,n,r,s,a,i)=>{const l=Py(t),c=XC(t,o,n,"color"!==r?"normal":"color",s,a,i);return Vy(e,l,c,n,{menuType:r})},XC=(e,t,o,n,r,s,a)=>xe(F(e,(i=>{return"choiceitem"===i.type?(l=i,or("choicemenuitem",Vw,l)).fold(Fy,(i=>D.some(((e,t,o,n,r,s,a,i=!0)=>{const l=Hx({presets:o,textContent:t?e.text:D.none(),htmlContent:D.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:D.none(),checkMark:t?D.some(Rx(a.icons)):D.none(),caret:D.none(),value:e.value},a,i),c=e.text.filter(w(!t)).map((e=>lx.config(a.tooltips.getConfig({tooltipText:a.translate(e)}))));return Cn(_x({data:Ex(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Xp.set(e,t)},isActive:()=>Xp.isOn(e),isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(r),v),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,s,a),{toggling:{toggleClass:ay,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,s(i.value),r,a,Py(e))))):D.none();var l}))),JC=(e,t)=>{const o=fy(t);if(1===e)return{mode:"menu",moveOnTab:!0};if("auto"===e)return{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}};return{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?Li(e.element,"[aria-checked=true]"):D.none()}},QC=(e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold((()=>VC(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o)),(e=>e.concat(FC(o))))},eS=wa("cell-over"),tS=wa("cell-execute"),oS=(e,t,o)=>{const n=o=>$s(o,tS,{row:e,col:t}),r=(e,t)=>{t.stop(),n(e)};return Ti({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:Gl([Pp("insert-table-picker-cell",[ea(ss(),Up.focus),ea(Ss(),n),ea(us(),r),ea(_s(),r)]),Xp.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Up.config({onFocus:o=>$s(o,eS,{row:e,col:t})})])})},nS=e=>G(e,(e=>F(e,Oi))),rS=(e,t)=>Si(`${t}x${e}`),sS={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=((e,t,o)=>{const n=[];for(let r=0;r{Ip.set(s.get(e),[r])})),ra(eS,((e,t,o)=>{const{row:r,col:a}=o.event;((e,t,o,n,r)=>{for(let s=0;s{const{row:r,col:s}=n.event;e.onAction({numRows:r+1,numColumns:s+1}),Ws(t,Ts())}))]),Op.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=QC(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),r="color",s=YC(wa("menu-value"),o,(t=>{e.onAction({value:t})}),n,r,ty.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),a={...s,markers:fy(r),movement:JC(n,r)};return{type:"widget",data:{value:wa("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[zx.widget(xf.sketch(a))]}}},aS=(e,t,o,n,r,s,a,i=!0)=>{const l=Hx({presets:n,textContent:D.none(),htmlContent:o?e.text.map((e=>Px(e,t))):D.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:D.none(),checkMark:D.none(),caret:D.none(),value:e.value},a.providers,i,e.icon),c=e.text.filter((e=>!o&&""!==e));return _x({data:Ex(e),enabled:e.enabled,getApi:w({}),onAction:t=>r(e.value,e.meta),onSetup:w(v),triggersSubmenu:!1,itemBehaviours:Ix(e,a,c)},l,s,a.providers)},iS=e=>({type:"separator",dom:{tag:"div",classes:[ny,"tox-collection__group-heading"]},components:e.text.map(Si).toArray()}),lS=(e,t,o,n=!0)=>{const r=Hx({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,caret:D.none(),checkMark:D.none(),shortcutContent:e.shortcut},o,n);return _x({data:Ex(e),getApi:e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o)},cS=(e,t,o,n=!0,r=!1)=>{const s=r?(a=o.icons,Ox("chevron-down",a,[cy])):(e=>Ox("chevron-right",e,[cy]))(o.icons);var a;const i=Hx({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,caret:D.some(s),checkMark:D.none(),shortcutContent:e.shortcut},o,n);return _x({data:Ex(e),getApi:e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setIconFill:(t,o)=>{Li(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{kt(e,"fill",o)}))},setTooltip:t=>{const n=o.translate(t);kt(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:v,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)},dS=(e,t,o,n=!0)=>{const r=Hx({iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,checkMark:D.some(Rx(o.icons)),caret:D.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return Cn(_x({data:Ex(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Xp.set(e,t)},isActive:()=>Xp.isOn(e),isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o),{toggling:{toggleClass:ay,toggleOnExecute:!1,selected:e.active}})},mS=(e,t)=>ve(sS,e.fancytype).map((o=>o(e,t))),uS=(e,t,o,n)=>{const r={dom:Lx(e.label),optComponents:[D.some({dom:{tag:"div",classes:[my,uy]},components:Fx(e.items,n)})]};return _x({data:Ex({text:D.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>{xg.set(e,!t),z(Ed(e.element,"*"),(o=>{e.getSystem().getByDom(o).each((e=>{e.hasConfigured(xg)&&xg.set(e,!t)}))}))}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:D.from(n.itemBehaviours).getOr([])},r,t,o.providers)};var gS=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),hS=[ur("others",tr(nn.value,jn()))];var pS=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===ae(t.others).length)throw new Error("Cannot find any known coupled components");return ve(e,o)},o=w({});return Pa({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk((()=>(ve(o.others,n).getOrDie("No information found for coupled component: "+n),D.none()))),getOrCreate:(o,n,r)=>t(n,r).getOrThunk((()=>{const t=ve(n.others,r).getOrDie("No information found for coupled component: "+r)(o),s=o.getSystem().build(t);return e[r]=s,s}))})}});const fS=Yl({fields:hS,name:"coupling",apis:gS,state:pS}),vS=e=>{let t=D.none(),o=[];const n=e=>{r()?a(e):o.push(e)},r=()=>t.isSome(),s=e=>{z(e,a)},a=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{r()||(t=D.some(e),s(o),o=[])})),{get:n,map:e=>vS((t=>{n((o=>{t(e(o))}))})),isReady:r}},bS={nu:vS,pure:e=>vS((t=>{t(e)}))},yS=e=>{setTimeout((()=>{throw e}),0)},wS=e=>{const t=t=>{e().then(t,yS)};return{map:t=>wS((()=>e().then(t))),bind:t=>wS((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>wS((()=>e().then((()=>t.toPromise())))),toLazy:()=>bS.nu(t),toCached:()=>{let t=null;return wS((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},xS=e=>wS((()=>new Promise(e))),CS=e=>wS((()=>Promise.resolve(e))),SS=w("sink"),kS=w(Au({name:SS(),overrides:w({dom:{tag:"div"},behaviours:Gl([sm.config({useFixed:O})]),events:Xs([sa(ls()),sa(ts()),sa(us())])})})),_S=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",r=e.getAnchorOverrides();return e.layouts.fold((()=>({type:n,hotspot:o,overrides:r})),(e=>({type:n,hotspot:o,overrides:r,layouts:e})))},ES=(e,t,o,n,r,s,a)=>{const i=((e,t,o,n,r,s,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=AS(n,e);return i.map((e=>e.bind((e=>D.from(Af.sketch({...s.menu(),uid:Ta(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();sm.position(n,t,{anchor:o}),Nm.decloak(r)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();sm.position(n,o,{anchor:{type:"submenu",item:t}}),Nm.decloak(r)},onRepositionMenu:(e,t,n)=>{const r=l().getOrDie();sm.position(r,t,{anchor:o}),z(n,(e=>{sm.position(r,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})}))},onEscape:()=>(Up.focus(n),Nm.close(r),D.some(!0))}))))))})(e,t,_S(e,o),o,n,r,a);return i.map((e=>(e.fold((()=>{Nm.isOpen(n)&&Nm.close(n)}),(e=>{Nm.cloak(n),Nm.open(n,e),s(n)})),n)))},TS=(e,t,o,n,r,s,a)=>(Nm.close(n),CS(n)),OS=(e,t,o,n,r,s)=>{const a=fS.getCoupled(o,"sandbox");return(Nm.isOpen(a)?TS:ES)(e,t,o,a,n,r,s)},DS=(e,t,o)=>{const n=ig.getCurrent(t).getOr(t),r=Jt(e.element);o?Nt(n.element,"min-width",r+"px"):((e,t)=>{Xt.set(e,t)})(n.element,r)},AS=(e,t)=>e.getSystem().getByUid(t.uid+"-"+SS()).map((e=>()=>nn.value(e))).getOrThunk((()=>t.lazySink.fold((()=>()=>nn.error(new Error("No internal sink is specified, nor could an external sink be found"))),(t=>()=>t(e))))),MS=e=>{Nm.getState(e).each((e=>{Af.repositionMenus(e)}))},NS=(e,t,o)=>{const n=Pi(),r=AS(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:nu(e.sandboxBehaviours,[Jm.config({store:{mode:"memory",initialValue:t}}),Nm.config({onOpen:(r,s)=>{const a=_S(e,t);n.link(t.element),e.matchWidth&&DS(a.hotspot,s,e.useMinWidth),e.onOpen(a,r,s),void 0!==o&&void 0!==o.onOpen&&o.onOpen(r,s)},onClose:(e,s)=>{n.unlink(t.element),r().getOr(s).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,s)},isPartOf:(e,o,n)=>zi(o,n)||zi(t,n),getAttachPoint:()=>r().getOrDie()}),ig.config({find:e=>Nm.getState(e).bind((e=>ig.getCurrent(e)))}),ec.config({channels:{...Im({isExtraPart:T}),...Fm({doReposition:MS})}})])}},RS=e=>{const t=fS.getCoupled(e,"sandbox");MS(t)},BS=()=>[Or("sandboxClasses",[]),ou("sandboxBehaviours",[ig,ec,Nm,Jm])],LS=w([mr("dom"),mr("fetch"),tl("onOpen"),ol("onExecute"),Or("getHotspot",D.some),Or("getAnchorOverrides",w({})),Jc(),Qm("dropdownBehaviours",[Xp,fS,Op,Up]),mr("toggleClass"),Or("eventOrder",{}),wr("lazySink"),Or("matchWidth",!1),Or("useMinWidth",!1),wr("role")].concat(BS())),HS=w([Du({schema:[Ji(),Or("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),kS()]),IS=ng({name:"Dropdown",configFields:LS(),partFields:HS(),factory:(e,t,o,n)=>{const r=e=>{Nm.getState(e).each((e=>{Af.highlightPrimary(e)}))},s=(t,o,r)=>OS(e,x,t,n,o,r),a={expand:e=>{Xp.isOn(e)||s(e,v,Of.HighlightNone).get(v)},open:e=>{Xp.isOn(e)||s(e,v,Of.HighlightMenuAndItem).get(v)},refetch:t=>fS.getExistingCoupled(t,"sandbox").fold((()=>s(t,v,Of.HighlightMenuAndItem).map(v)),(o=>ES(e,x,t,o,n,v,Of.HighlightMenuAndItem).map(v))),isOpen:Xp.isOn,close:e=>{Xp.isOn(e)&&s(e,v,Of.HighlightMenuAndItem).get(v)},repositionMenus:e=>{Xp.isOn(e)&&RS(e)}},i=(e,t)=>(qs(e),D.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:tu(e.dropdownBehaviours,[Xp.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),fS.config({others:{sandbox:t=>NS(e,t,{onOpen:()=>Xp.on(t),onClose:()=>Xp.off(t)})}}),Op.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(IS.isOpen(e)){const t=fS.getCoupled(e,"sandbox");r(t)}else IS.open(e);return D.some(!0)},onEscape:(e,t)=>IS.isOpen(e)?(IS.close(e),D.some(!0)):D.none()}),Up.config({})]),events:ef(D.some((e=>{s(e,r,Of.HighlightMenuAndItem).get(v)}))),eventOrder:{...e.eventOrder,[Ss()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold((()=>({})),(e=>({role:e}))),..."button"===e.dom.tag?{type:(l="type",ve(e.dom,"attributes").bind((e=>ve(e,l)))).getOr("button")}:{}}}};var l},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)}}),PS=e=>{const t=Jm.getValue(e),o=Oy(e).map(Ay);IS.refetch(t).get((()=>{const e=fS.getCoupled(t,"sandbox");o.each((t=>Oy(e).each((e=>((e,t)=>{Jm.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))))}))},FS=e=>Nm.getState(e).bind(Ng.getHighlighted).bind(Ng.getHighlighted),zS=(e,t,o)=>{Dy(e).each((e=>{((e,t)=>{Tt(t.element,"id").each((t=>kt(e.element,"aria-activedescendant",t)))})(e,o);var n;(ai((n=t).element,Ny)?D.some(n.element):Li(n.element,"."+Ny)).each((t=>{Tt(t,"id").each((t=>kt(e.element,"aria-controls",t)))}))})),kt(o.element,"aria-selected","true")},VS=(e,t,o)=>{kt(o.element,"aria-selected","false")},ZS=e=>fS.getExistingCoupled(e,"sandbox").bind(Oy).map(Ay).map((e=>e.fetchPattern)).getOr("");var US;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(US||(US={}));const jS=(e,t,o,n,r)=>{const s=o.shared.providers,a=e=>r?{...e,shortcut:D.none(),icon:e.text.isSome()?D.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,or("menuitem",$w,i)).fold(Fy,(e=>D.some(lS(a(e),t,s,n))));case"nestedmenuitem":return(e=>or("nestedmenuitem",qw,e))(e).fold(Fy,(e=>D.some(cS(a(e),t,s,n,r))));case"togglemenuitem":return(e=>or("togglemenuitem",Gw,e))(e).fold(Fy,(e=>D.some(dS(a(e),t,s,n))));case"separator":return(e=>or("separatormenuitem",fw,e))(e).fold(Fy,(e=>D.some(iS(e))));case"fancymenuitem":return(e=>or("fancymenuitem",Ww,e))(e).fold(Fy,(e=>mS(e,o)));default:return console.error("Unknown item in general menu",e),D.none()}var i},WS=(e,t,o,n,r,s,a)=>{const i=1===n,l=!i||Py(e);return xe(F(e,(e=>{switch(e.type){case"separator":return(n=e,or("Autocompleter.Separator",fw,n)).fold(Fy,(e=>D.some(iS(e))));case"cardmenuitem":return(e=>or("cardmenuitem",zw,e))(e).fold(Fy,(e=>D.some(uS({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},r,s,{itemBehaviours:Ix(e.meta,s,D.none()),cardText:{matchText:t,highlightOn:a}}))));default:return(e=>or("Autocompleter.Item",vw,e))(e).fold(Fy,(e=>D.some(aS(e,t,i,"normal",o,r,s,l))))}var n})))},$S=(e,t,o,n,r,s)=>{const a=Py(t),i=xe(F(t,(e=>{const t=e=>jS(e,o,n,(e=>r?!be(e,"text"):a)(e),r);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})(s);return(r?zy:Vy)(e,a,i,1,l)},qS=e=>Af.singleData(e.value,e),GS=e=>gd(Le.fromDom(e.startContainer),e.startOffset,Le.fromDom(e.endContainer),e.endOffset),KS=(e,t)=>{const o=wa("autocompleter"),n=Ir(!1),r=Ir(!1),s=_c(),a=Ti(Mf.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:Gl([Pp("dismissAutocompleter",[ea(Hs(),(()=>m())),ea(Us(),((t,o)=>{Tt(o.event.target,"id").each((t=>kt(Le.fromDom(e.getBody()),"aria-activedescendant",t)))}))])]),lazySink:t.getSink})),i=()=>Mf.isOpen(a),l=r.get,c=()=>{if(i()){Mf.hide(a),e.dom.remove(o,!1);const t=Le.fromDom(e.getBody());Tt(t,"aria-owns").filter((e=>e===o)).each((()=>{Dt(t,"aria-owns"),Dt(t,"aria-activedescendant")}))}},d=()=>Mf.getContent(a).bind((e=>te(e.components(),0))),m=()=>e.execCommand("mceAutocompleterClose"),u=(t,o)=>{const n=se(t,(e=>D.from(e.columns))).getOr(1);Mf.showMenuAt(a,{anchor:{type:"selection",getSelection:()=>s.get().map(GS),root:Le.fromDom(e.getBody())}},((e,t,o,n)=>{const r=JC(t,n),s=fy(n);return{data:qS({...e,movement:r,menuBehaviours:Xw("auto"!==t?[]:[la(((e,t)=>{Kw(e,4,s.item).each((({numColumns:t,numRows:o})=>{Op.setGridSize(e,o,t)}))}))])}),menu:{markers:fy(n),fakeFocus:o===US.ContentFocus}}})(Vy("autocompleter-value",!0,o,n,{menuType:"normal"}),n,US.ContentFocus,"normal")),d().each(Ng.highlightFirst)},g=r=>{const a=(o=>{const r=se(o,(e=>D.from(e.columns))).getOr(1);return G(o,(o=>{const a=o.items;return WS(a,o.matchText,((t,r)=>{const a={hide:()=>m(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),s.get().each((e=>{n.set(!0),o.onAction(a,e,t,r),n.set(!1)}))}),r,ty.BUBBLE_TO_SANDBOX,t,o.highlightOn)}))})(r);a.length>0?(u(r,a),kt(Le.fromDom(e.getBody()),"aria-owns",o),e.inline||h()):c()},h=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),r=(e=>ha(e,!0))(a.element);Rt(r,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,r.dom),Li(r,'[role="menu"]').each((e=>{zt(e,"position"),zt(e,"max-height")}))};e.on("AutocompleterStart",(({lookupData:e})=>{r.set(!0),n.set(!1),g(e)})),e.on("AutocompleterUpdate",(({lookupData:e})=>g(e))),e.on("AutocompleterUpdateActiveRange",(({range:e})=>s.set(e))),e.on("AutocompleterEnd",(()=>{c(),r.set(!1),n.set(!1),s.clear()}));const p={cancelIfNecessary:m,isMenuOpen:i,isActive:l,isProcessingAction:n.get,getMenu:d};Qb(p,e)},YS=["visible","hidden","clip"],XS=e=>Ae(e).length>0&&!L(YS,e),JS=e=>{if(Ue(e)){const t=Lt(e,"overflow-x"),o=Lt(e,"overflow-y");return XS(t)||XS(o)}return!1},QS=(e,t)=>Yb(e)?(e=>{const t=_d(e,JS),o=0===t.length?vt(e).map(bt).map((e=>_d(e,JS))).getOr([]):t;return oe(o).map((e=>({element:e,others:o.slice(1)})))})(t):D.none(),ek=e=>{const t=[...F(e.others,Yo),Qo()];return((e,t)=>j(t,((e,t)=>Jo(e,t)),e))(Yo(e.element),t)},tk=(e,t,o)=>Hi(e,t,o).isSome(),ok=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout((()=>{e.apply(null,n),o=null}),t)}}},nk=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?D.none():D.some(t.touches[0])},rk=e=>{const t=_c(),o=Ir(!1),n=ok((t=>{e.triggerEvent(Es(),t),o.set(!0)}),400),r=Vr([{key:Xr(),value:e=>(nk(e).each((r=>{n.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(s)})),D.none())},{key:Jr(),value:e=>(n.cancel(),nk(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()}))})),D.none())},{key:Qr(),value:r=>{n.cancel();return t.get().filter((e=>Je(e.target,r.target))).map((t=>o.get()?(r.prevent(),!1):e.triggerEvent(_s(),r)))}}]);return{fireIfReady:(e,t)=>ve(r,t).bind((t=>t(e)))}},sk=(e,t)=>{const o={stopBackspace:!0,...t},n=rk(o),r=F(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(t=>Tc(e,t,(e=>{n.fireIfReady(e,t).each((t=>{t&&e.kill()}));o.triggerEvent(t,e)&&e.kill()})))),s=_c(),a=Tc(e,"paste",(e=>{n.fireIfReady(e,"paste").each((t=>{t&&e.kill()}));o.triggerEvent("paste",e)&&e.kill(),s.set(setTimeout((()=>{o.triggerEvent(xs(),e)}),0))})),i=Tc(e,"keydown",(e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Rg[0]&&!L(["input","textarea"],Ve(e.target))&&!tk(e.target,'[contenteditable="true"]'))(e)&&e.prevent()})),l=Tc(e,"focusin",(e=>{o.triggerEvent("focusin",e)&&e.kill()})),c=_c(),d=Tc(e,"focusout",(e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout((()=>{o.triggerEvent(ws(),e)}),0))}));return{unbind:()=>{z(r,(e=>{e.unbind()})),i.unbind(),l.unbind(),d.unbind(),a.unbind(),s.on(clearTimeout),c.on(clearTimeout)}}},ak=(e,t)=>{const o=ve(e,"target").getOr(t);return Ir(o)},ik=Pr([{stopped:[]},{resume:["element"]},{complete:[]}]),lk=(e,t,o,n,r,s)=>{const a=e(t,n),i=((e,t)=>{const o=Ir(!1),n=Ir(!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,r);return a.fold((()=>(s.logEventNoHandlers(t,n),ik.complete())),(e=>{const o=e.descHandler;return Va(o)(i),i.isStopped()?(s.logEventStopped(t,e.element,o.purpose),ik.stopped()):i.isCut()?(s.logEventCut(t,e.element,o.purpose),ik.complete()):rt(e.element).fold((()=>(s.logNoParent(t,e.element,o.purpose),ik.complete())),(n=>(s.logEventResponse(t,e.element,o.purpose),ik.resume(n))))}))},ck=(e,t,o,n,r,s)=>lk(e,t,o,n,r,s).fold(O,(n=>ck(e,t,o,n,r,s)),T),dk=(e,t,o)=>{const n=(e=>{const t=Ir(!1);return{stop:()=>{t.set(!0)},cut:v,isStopped:t.get,isCut:T,event:e,setSource:_("Cannot set source of a broadcasted event"),getSource:_("Cannot get source of a broadcasted event")}})(t);return z(e,(e=>{const t=e.descHandler;Va(t)(n)})),n.isStopped()},mk=(e,t,o,n,r)=>{const s=ak(o,n);return ck(e,t,o,n,s,r)},uk=()=>{const e={};return{registerId:(t,o,n)=>{le(n,((n,r)=>{const s=void 0!==e[r]?e[r]:{};s[o]=((e,t)=>{return o=S.apply(void 0,[e.handler].concat(t)),n=e.purpose,{cHandler:o,purpose:n};var o,n})(n,t),e[r]=s}))},unregisterId:t=>{le(e,((e,o)=>{be(e,t)&&delete e[t]}))},filterByType:t=>ve(e,t).map((e=>he(e,((e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))))).getOr([]),find:(t,o,n)=>ve(e,o).bind((e=>Wr(n,(t=>((e,t)=>Ea(t).bind((t=>ve(e,t))).map((e=>((e,t)=>({element:e,descHandler:t}))(t,e))))(e,t)),t)))}},gk=()=>{const e=uk(),t={},o=e=>{const t=e.element;return Ea(t).getOrThunk((()=>((e,t)=>{const o=wa(Sa+e);return _a(t,o),o})("uid-",e.element)))},n=o=>{Ea(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:r=>{const s=o(r);ye(t,s)&&((e,o)=>{const r=t[o];if(r!==e)throw new Error('The tagId "'+o+'" is already used by: '+fa(r.element)+"\nCannot use it for: "+fa(e.element)+"\nThe conflicting element is"+(wt(r.element)?" ":" not ")+"already in the DOM");n(e)})(r,s);const a=[r];e.registerId(a,s,r.events),t[s]=r},unregister:n,getById:e=>ve(t,e)}},hk=og({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:eu(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Or("components",[]),Qm("containerBehaviours",[]),Or("events",{}),Or("domModification",{}),Or("eventOrder",{})]}),pk=e=>{const t=t=>rt(e.element).fold(O,(e=>Je(t,e))),o=gk(),n=(e,n)=>o.find(t,e,n),r=sk(e.element,{triggerEvent:(e,t)=>$i(e,t.target,(o=>((e,t,o,n)=>mk(e,t,o,o.target,n))(n,e,t,o)))}),s={debugInfo:w("real"),triggerEvent:(e,t,o)=>{$i(e,t,(r=>mk(n,e,o,t,r)))},triggerFocus:(e,t)=>{Ea(e).fold((()=>{oc(e)}),(o=>{$i(ys(),e,(o=>(((e,t,o,n,r)=>{const s=ak(o,n);lk(e,t,o,n,s,r)})(n,ys(),{originator:t,kill:v,prevent:v,target:e},e,o),!1)))}))},triggerEscape:(e,t)=>{s.triggerEvent("keydown",e.element,t.event)},getByUid:e=>h(e),getByDom:e=>p(e),build:Ti,buildOrPatch:Ei,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{m(e)},broadcastOn:(e,t)=>{u(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:O},a=e=>{e.connect(s),We(e.element)||(o.register(e),z(e.components(),a),s.triggerEvent(Ds(),e.element,{target:e.element}))},i=e=>{We(e.element)||(z(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{gm(e,t)},c=e=>{fm(e)},d=e=>{const t=o.filter(Cs());z(t,(t=>{const o=t.descHandler;Va(o)(e)}))},m=e=>{d({universal:!0,data:e})},u=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>{const n=o.filter(e);return dk(n,t)},h=e=>o.getById(e).fold((()=>nn.error(new Error('Could not find component with uid: "'+e+'" in system.'))),nn.value),p=e=>{const t=Ea(e).getOr("not found");return h(t)};return a(e),{root:e,element:e.element,destroy:()=>{r.unbind(),zo(e.element)},add:l,remove:c,getByUid:h,getByDom:p,addToWorld:a,removeFromWorld:i,broadcast:m,broadcastOn:u,broadcastEvent:g}},fk=w([Or("prefix","form-field"),Qm("fieldBehaviours",[ig,Jm])]),vk=w([Au({schema:[mr("dom")],name:"label"}),Au({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[mr("text")],name:"aria-descriptor"}),Ou({factory:{sketch:e=>{const t=Fr(e,["factory"]);return e.factory.sketch(t)}},schema:[mr("factory")],name:"field"})]),bk=ng({name:"FormField",configFields:fk(),partFields:vk(),factory:(e,t,o,n)=>{const r=tu(e.fieldBehaviours,[ig.config({find:t=>Zu(t,e,"field")}),Jm.config({store:{mode:"manual",getValue:e=>ig.getCurrent(e).bind(Jm.getValue),setValue:(e,t)=>{ig.getCurrent(e).each((e=>{Jm.setValue(e,t)}))}}})]),s=Xs([la(((t,o)=>{const n=ju(t,e,["label","field","aria-descriptor"]);n.field().each((t=>{const o=wa(e.prefix);n.label().each((e=>{kt(e.element,"for",o),kt(t.element,"id",o)})),n["aria-descriptor"]().each((o=>{const n=wa(e.prefix);kt(o.element,"id",n),kt(t.element,"aria-describedby",n)}))}))}))]),a={getField:t=>Zu(t,e,"field"),getLabel:t=>Zu(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:r,events:s,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var yk=Object.freeze({__proto__:null,exhibit:(e,t)=>za({attributes:Vr([{key:t.tabAttr,value:"true"}])})}),wk=[Or("tabAttr","data-alloy-tabstop")];const xk=Yl({fields:wk,name:"tabstopping",active:yk});var Ck=tinymce.util.Tools.resolve("tinymce.html.Entities");const Sk=(e,t,o,n)=>{const r=kk(e,t,o,n);return bk.sketch(r)},kk=(e,t,o,n)=>({dom:_k(o),components:e.toArray().concat([t]),fieldBehaviours:Gl(n)}),_k=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),Ek=(e,t)=>bk.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Si(t.translate(e))]}),Tk=wa("form-component-change"),Ok=wa("form-close"),Dk=wa("form-cancel"),Ak=wa("form-action"),Mk=wa("form-submit"),Nk=wa("form-block"),Rk=wa("form-unblock"),Bk=wa("form-tabchange"),Lk=wa("form-resize"),Hk=(e,t,o)=>{const n=e.label.map((e=>Ek(e,t))),r=t.icons(),s=e=>(t,o)=>{Hi(o.event.target,"[data-collection-item-value]").each((n=>{e(t,o,n,Et(n,"data-collection-item-value"))}))},a=(o,n)=>{const s=F(n,(o=>{const n=Nv.translate(o.text),s=1===e.columns?`
    ${n}
    `:"",a=`
    ${(e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})(o.icon)}
    `,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,(e=>i[e]));return`
    ${a}${s}
    `})),a="auto"!==e.columns&&e.columns>1?P(s,e.columns):[s],i=F(a,(e=>`
    ${e.join("")}
    `));ga(o.element,i.join(""))},i=s(((o,n,r,s)=>{n.stop(),t.isDisabled()||$s(o,Ak,{name:e.name,value:s})})),l=[ea(ss(),s(((e,t,o)=>{oc(o)}))),ea(us(),i),ea(_s(),i),ea(as(),s(((e,t,o)=>{Li(e.element,"."+dy).each((e=>{ri(e,dy)})),oi(o,dy)}))),ea(is(),s((e=>{Li(e.element,"."+dy).each((e=>{ri(e,dy),nc(e)}))}))),ma(s(((t,o,n,r)=>{$s(t,Ak,{name:e.name,value:r})})))],c=(e,t)=>F(Ed(e.element,".tox-collection__item"),t),d=bk.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:x},behaviours:Gl([xg.config({disabled:t.isDisabled,onDisabled:e=>{c(e,(e=>{oi(e,"tox-collection__item--state-disabled"),kt(e,"aria-disabled",!0)}))},onEnabled:e=>{c(e,(e=>{ri(e,"tox-collection__item--state-disabled"),Dt(e,"aria-disabled")}))}}),hx(),Ip.config({}),lx.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{Li(e.element,"."+dy+"[data-mce-tooltip]").each((o=>{Tt(o,"data-mce-tooltip").each((o=>{lx.setComponents(e,t.tooltips.getComponents({tooltipText:o}))}))}))}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:Li(e.element,"."+dy).orThunk((()=>Xe(".tox-collection__item"))),root:e.element,layouts:{onLtr:w([Rl,Nl,Ol,Al,Dl,Ml]),onRtl:w([Rl,Nl,Ol,Al,Dl,Ml])},bubble:jc(0,-2,{})})}),Jm.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(t,o)=>{a(t,o),"auto"===e.columns&&Kw(t,5,"tox-collection__item").each((({numRows:e,numColumns:o})=>{Op.setGridSize(t,e,o)})),Ws(t,Lk)}}),xk.config({}),Op.config((m=e.columns,u="normal",1===m?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===m?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===u?".tox-swatches__row":".tox-collection__group",cell:"color"===u?`.${ry}`:`.${ny}`}})),Pp("collection-events",l)]),eventOrder:{[Ss()]:["disabling","alloy.base.behaviour","collection-events"],[as()]:["collection-events","tooltipping"]}});var m,u;return Sk(n,d,["tox-form__group--collection"],[])},Ik=["input","textarea"],Pk=e=>{const t=Ve(e);return L(Ik,t)},Fk=(e,t)=>{const o=t.getRoot(e).getOr(e.element);ri(o,t.invalidClass),t.notify.each((t=>{Pk(e.element)&&kt(e.element,"aria-invalid",!1),t.getContainer(e).each((e=>{ga(e,t.validHtml)})),t.onValid(e)}))},zk=(e,t,o,n)=>{const r=t.getRoot(e).getOr(e.element);oi(r,t.invalidClass),t.notify.each((t=>{Pk(e.element)&&kt(e.element,"aria-invalid",!0),t.getContainer(e).each((e=>{ga(e,n)})),t.onInvalid(e,n)}))},Vk=(e,t,o)=>t.validator.fold((()=>CS(nn.value(!0))),(t=>t.validate(e))),Zk=(e,t,o)=>(t.notify.each((t=>{t.onValidate(e)})),Vk(e,t).map((o=>e.getSystem().isConnected()?o.fold((o=>(zk(e,t,0,o),nn.error(o))),(o=>(Fk(e,t),nn.value(o)))):nn.error("No longer in system"))));var Uk=Object.freeze({__proto__:null,markValid:Fk,markInvalid:zk,query:Vk,run:Zk,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return ai(o,t.invalidClass)}});var jk=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map((t=>Xs([ea(t.onEvent,(t=>{Zk(t,e).get(x)}))].concat(t.validateOnLoad?[la((t=>{Zk(t,e).get(v)}))]:[])))).getOr({})}),Wk=[mr("invalidClass"),Or("getRoot",D.none),Tr("notify",[Or("aria","alert"),Or("getContainer",D.none),Or("validHtml",""),tl("onValid"),tl("onInvalid"),tl("onValidate")]),Tr("validator",[mr("validate"),Or("onEvent","input"),Or("validateOnLoad",!0)])];const $k=Yl({fields:Wk,name:"invalidating",active:jk,apis:Uk,extra:{validation:e=>t=>{const o=Jm.getValue(t);return CS(e(o))}}});const qk=Yl({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Xs([Js(fs(),O)]),exhibit:()=>za({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),Gk=wa("color-input-change"),Kk=wa("color-swatch-change"),Yk=wa("color-picker-cancel"),Xk=(e,t,o,n)=>{const r=bk.parts.field({factory:ky,inputClasses:["tox-textfield"],data:n,onSetValue:e=>$k.run(e).get(v),inputBehaviours:Gl([xg.config({disabled:t.providers.isDisabled}),hx(),xk.config({}),$k.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>st(e.element),notify:{onValid:e=>{const t=Jm.getValue(e);$s(e,Gk,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=Jm.getValue(e);if(0===t.length)return CS(nn.value(!0));{const e=Le.fromTag("span");Nt(e,"background-color",t);const o=It(e,"background-color").fold((()=>nn.error("blah")),(e=>nn.value(t)));return CS(o)}}}})]),selectOnFocus:!1}),s=e.label.map((e=>Ek(e,t.providers))),a=(e,t)=>{$s(e,Kk,{value:t})},i=Lf(((e,t)=>IS.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:Gl([fx(t.providers.isDisabled),hx(),qk.config({}),xk.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>xS((t=>e.fetch(t))).map((n=>D.from(qS(Cn(YC(wa("menu-value"),n,(t=>{e.onItemAction(o,t)}),e.columns,e.presets,ty.CLOSE_ON_EXECUTE,T,t.providers),{movement:JC(e.columns,e.presets)}))))),parts:{menu:yy(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Dl,Ol,Rl],onLtr:()=>[Ol,Dl,Rl]},components:[],fetch:ZC(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((()=>Ws(t,Yk)),(o=>{a(t,o),wC(e.storageKey,o)}))}),"#ffffff"):a(t,"remove"===n?"":n)}))}},t));return bk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:s.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[r,i.asSpec()]}]),fieldBehaviours:Gl([Pp("form-field-events",[ea(Gk,((t,o)=>{i.getOpt(t).each((e=>{Nt(e.element,"background-color",o.event.color)})),$s(t,Tk,{name:e.name})})),ea(Kk,((e,t)=>{bk.getField(e).each((o=>{Jm.setValue(o,t.event.value),ig.getCurrent(e).each(Up.focus)}))})),ea(Yk,((e,t)=>{bk.getField(e).each((t=>{ig.getCurrent(e).each(Up.focus)}))}))])])})},Jk=Au({schema:[mr("dom")],name:"label"}),Qk=e=>Au({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold((()=>({})),(e=>({events:Xs([ta(Xr(),((t,o,n)=>e(t,n)),[t]),ta(ts(),((t,o,n)=>e(t,n)),[t]),ta(os(),((t,o,n)=>{n.mouseIsDown.get()&&e(t,n)}),[t])])})))}),e_=Qk("top-left"),t_=Qk("top"),o_=Qk("top-right"),n_=Qk("right"),r_=Qk("bottom-right"),s_=Qk("bottom"),a_=Qk("bottom-left"),i_=Qk("left"),l_=Ou({name:"thumb",defaults:w({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Xs([na(Xr(),e,"spectrum"),na(Jr(),e,"spectrum"),na(Qr(),e,"spectrum"),na(ts(),e,"spectrum"),na(os(),e,"spectrum"),na(rs(),e,"spectrum")])})}),c_=e=>Gg(e.event),d_=Ou({schema:[cr("mouseIsDown",(()=>Ir(!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:Gl([Op.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,c_(n)),onRight:(o,n)=>t.onRight(o,e,c_(n)),onUp:(o,n)=>t.onUp(o,e,c_(n)),onDown:(o,n)=>t.onDown(o,e,c_(n))}),xk.config({}),Up.config({})]),events:Xs([ea(Xr(),o),ea(Jr(),o),ea(ts(),o),ea(os(),((t,n)=>{e.mouseIsDown.get()&&o(t,n)}))])}}});var m_=[Jk,i_,n_,t_,s_,e_,o_,a_,r_,l_,d_];const u_=w("slider.change.value"),g_=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?D.some(e.touches[0]).map((e=>qt(e.clientX,e.clientY))):D.none()}{const e=t;return void 0!==e.clientX?D.some(e).map((e=>qt(e.clientX,e.clientY))):D.none()}},h_=e=>e.model.minX,p_=e=>e.model.minY,f_=e=>e.model.minX-1,v_=e=>e.model.minY-1,b_=e=>e.model.maxX,y_=e=>e.model.maxY,w_=e=>e.model.maxX+1,x_=e=>e.model.maxY+1,C_=(e,t,o)=>t(e)-o(e),S_=e=>C_(e,b_,h_),k_=e=>C_(e,y_,p_),__=e=>S_(e)/2,E_=e=>k_(e)/2,T_=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,O_=e=>e.snapToGrid,D_=e=>e.snapStart,A_=e=>e.rounded,M_=(e,t)=>void 0!==e[t+"-edge"],N_=e=>M_(e,"left"),R_=e=>M_(e,"right"),B_=e=>M_(e,"top"),L_=e=>M_(e,"bottom"),H_=e=>e.model.value.get(),I_=(e,t)=>({x:e,y:t}),P_=(e,t)=>{$s(e,u_(),{value:t})},F_=(e,t,o,n)=>eo?o:e===t?t-1:Math.max(t,e-n),z_=(e,t,o,n)=>e>o?e:eMath.max(t,Math.min(o,e)),Z_=e=>{const{min:t,max:o,range:n,value:r,step:s,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:m,maxBound:u,screenRange:g}=e,h=c?t-1:t,p=d?o+1:o;if(ru)return p;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(r,m,u),c=V_(e/g*n+t,h,p);return a&&c>=t&&c<=o?((e,t,o,n,r)=>r.fold((()=>{const r=e-t,s=Math.round(r/n)*n;return V_(t+s,t-1,o+1)}),(t=>{const r=(e-t)%n,s=Math.round(r/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+s)*n;return Math.max(t,l)})))(c,t,o,s,i):l?Math.round(c):c}},U_=e=>{const{min:t,max:o,range:n,value:r,hasMinEdge:s,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return ro?a?i:d:(r-t)/n*l},j_="top",W_="right",$_="bottom",q_="left",G_=e=>e.element.dom.getBoundingClientRect(),K_=(e,t)=>e[t],Y_=e=>{const t=G_(e);return K_(t,q_)},X_=e=>{const t=G_(e);return K_(t,W_)},J_=e=>{const t=G_(e);return K_(t,j_)},Q_=e=>{const t=G_(e);return K_(t,$_)},eE=e=>{const t=G_(e);return K_(t,"width")},tE=e=>{const t=G_(e);return K_(t,"height")},oE=(e,t,o)=>(e+t)/2-o,nE=(e,t)=>{const o=G_(e),n=G_(t),r=K_(o,q_),s=K_(o,W_),a=K_(n,q_);return oE(r,s,a)},rE=(e,t)=>{const o=G_(e),n=G_(t),r=K_(o,j_),s=K_(o,$_),a=K_(n,j_);return oE(r,s,a)},sE=(e,t)=>{$s(e,u_(),{value:t})},aE=(e,t,o)=>{const n={min:h_(t),max:b_(t),range:S_(t),value:o,step:T_(t),snap:O_(t),snapStart:D_(t),rounded:A_(t),hasMinEdge:N_(t),hasMaxEdge:R_(t),minBound:Y_(e),maxBound:X_(e),screenRange:eE(e)};return Z_(n)},iE=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?z_:F_)(H_(o),h_(o),b_(o),T_(o,n));return sE(t,r),D.some(r)})(e,t,o,n).map(O),lE=(e,t,o,n,r,s)=>{const a=((e,t,o,n,r)=>{const s=eE(e),a=n.bind((t=>D.some(nE(t,e)))).getOr(0),i=r.bind((t=>D.some(nE(t,e)))).getOr(s),l={min:h_(t),max:b_(t),range:S_(t),value:o,hasMinEdge:N_(t),hasMaxEdge:R_(t),minBound:Y_(e),minOffset:0,maxBound:X_(e),maxOffset:s,centerMinEdge:a,centerMaxEdge:i};return U_(l)})(t,s,o,n,r);return Y_(t)-Y_(e)+a},cE=iE(-1),dE=iE(1),mE=D.none,uE=D.none,gE={"top-left":D.none(),top:D.none(),"top-right":D.none(),right:D.some(((e,t)=>{P_(e,w_(t))})),"bottom-right":D.none(),bottom:D.none(),"bottom-left":D.none(),left:D.some(((e,t)=>{P_(e,f_(t))}))};var hE=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=aE(e,t,o);return sE(e,n),n},setToMin:(e,t)=>{const o=h_(t);sE(e,o)},setToMax:(e,t)=>{const o=b_(t);sE(e,o)},findValueOfOffset:aE,getValueFromEvent:e=>g_(e).map((e=>e.left)),findPositionOfValue:lE,setPositionFromValue:(e,t,o,n)=>{const r=H_(o),s=lE(e,n.getSpectrum(e),r,n.getLeftEdge(e),n.getRightEdge(e),o),a=Jt(t.element)/2;Nt(t.element,"left",s-a+"px")},onLeft:cE,onRight:dE,onUp:mE,onDown:uE,edgeActions:gE});const pE=(e,t)=>{$s(e,u_(),{value:t})},fE=(e,t,o)=>{const n={min:p_(t),max:y_(t),range:k_(t),value:o,step:T_(t),snap:O_(t),snapStart:D_(t),rounded:A_(t),hasMinEdge:B_(t),hasMaxEdge:L_(t),minBound:J_(e),maxBound:Q_(e),screenRange:tE(e)};return Z_(n)},vE=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?z_:F_)(H_(o),p_(o),y_(o),T_(o,n));return pE(t,r),D.some(r)})(e,t,o,n).map(O),bE=(e,t,o,n,r,s)=>{const a=((e,t,o,n,r)=>{const s=tE(e),a=n.bind((t=>D.some(rE(t,e)))).getOr(0),i=r.bind((t=>D.some(rE(t,e)))).getOr(s),l={min:p_(t),max:y_(t),range:k_(t),value:o,hasMinEdge:B_(t),hasMaxEdge:L_(t),minBound:J_(e),minOffset:0,maxBound:Q_(e),maxOffset:s,centerMinEdge:a,centerMaxEdge:i};return U_(l)})(t,s,o,n,r);return J_(t)-J_(e)+a},yE=D.none,wE=D.none,xE=vE(-1),CE=vE(1),SE={"top-left":D.none(),top:D.some(((e,t)=>{P_(e,v_(t))})),"top-right":D.none(),right:D.none(),"bottom-right":D.none(),bottom:D.some(((e,t)=>{P_(e,x_(t))})),"bottom-left":D.none(),left:D.none()};var kE=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=fE(e,t,o);return pE(e,n),n},setToMin:(e,t)=>{const o=p_(t);pE(e,o)},setToMax:(e,t)=>{const o=y_(t);pE(e,o)},findValueOfOffset:fE,getValueFromEvent:e=>g_(e).map((e=>e.top)),findPositionOfValue:bE,setPositionFromValue:(e,t,o,n)=>{const r=H_(o),s=bE(e,n.getSpectrum(e),r,n.getTopEdge(e),n.getBottomEdge(e),o),a=jt(t.element)/2;Nt(t.element,"top",s-a+"px")},onLeft:yE,onRight:wE,onUp:xE,onDown:CE,edgeActions:SE});const _E=(e,t)=>{$s(e,u_(),{value:t})},EE=(e,t)=>({x:e,y:t}),TE=(e,t)=>(o,n,r)=>((e,t,o,n,r)=>{const s=e>0?z_:F_,a=t?H_(n).x:s(H_(n).x,h_(n),b_(n),T_(n,r)),i=t?s(H_(n).y,p_(n),y_(n),T_(n,r)):H_(n).y;return _E(o,EE(a,i)),D.some(a)})(e,t,o,n,r).map(O),OE=TE(-1,!1),DE=TE(1,!1),AE=TE(-1,!0),ME=TE(1,!0),NE={"top-left":D.some(((e,t)=>{P_(e,I_(f_(t),v_(t)))})),top:D.some(((e,t)=>{P_(e,I_(__(t),v_(t)))})),"top-right":D.some(((e,t)=>{P_(e,I_(w_(t),v_(t)))})),right:D.some(((e,t)=>{P_(e,I_(w_(t),E_(t)))})),"bottom-right":D.some(((e,t)=>{P_(e,I_(w_(t),x_(t)))})),bottom:D.some(((e,t)=>{P_(e,I_(__(t),x_(t)))})),"bottom-left":D.some(((e,t)=>{P_(e,I_(f_(t),x_(t)))})),left:D.some(((e,t)=>{P_(e,I_(f_(t),E_(t)))}))};var RE=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=aE(e,t,o.left),r=fE(e,t,o.top),s=EE(n,r);return _E(e,s),s},setToMin:(e,t)=>{const o=h_(t),n=p_(t);_E(e,EE(o,n))},setToMax:(e,t)=>{const o=b_(t),n=y_(t);_E(e,EE(o,n))},getValueFromEvent:e=>g_(e),setPositionFromValue:(e,t,o,n)=>{const r=H_(o),s=lE(e,n.getSpectrum(e),r.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=bE(e,n.getSpectrum(e),r.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Jt(t.element)/2,l=jt(t.element)/2;Nt(t.element,"left",s-i+"px"),Nt(t.element,"top",a-l+"px")},onLeft:OE,onRight:DE,onUp:AE,onDown:ME,edgeActions:NE});const BE=ng({name:"Slider",configFields:[Or("stepSize",1),Or("speedMultiplier",10),Or("onChange",v),Or("onChoose",v),Or("onInit",v),Or("onDragStart",v),Or("onDragEnd",v),Or("snapToGrid",!1),Or("rounded",!0),wr("snapStart"),ur("model",ar("mode",{x:[Or("minX",0),Or("maxX",100),cr("value",(e=>Ir(e.mode.minX))),mr("getInitialValue"),sl("manager",hE)],y:[Or("minY",0),Or("maxY",100),cr("value",(e=>Ir(e.mode.minY))),mr("getInitialValue"),sl("manager",kE)],xy:[Or("minX",0),Or("maxX",100),Or("minY",0),Or("maxY",100),cr("value",(e=>Ir({x:e.mode.minX,y:e.mode.minY}))),mr("getInitialValue"),sl("manager",RE)]})),Qm("sliderBehaviours",[Op,Jm]),cr("mouseIsDown",(()=>Ir(!1)))],partFields:m_,factory:(e,t,o,n)=>{const r=t=>Uu(t,e,"thumb"),s=t=>Uu(t,e,"spectrum"),a=t=>Zu(t,e,"left-edge"),i=t=>Zu(t,e,"right-edge"),l=t=>Zu(t,e,"top-edge"),c=t=>Zu(t,e,"bottom-edge"),d=e.model,m=d.manager,u=(t,o)=>{m.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:s})},g=(e,t)=>{d.value.set(t);const o=r(e);u(e,o)},h=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&Zu(t,e,"thumb").each((o=>{const n=d.value.get();e.onChoose(t,o,n)}))},p=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,r(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,r(t)),h(t)},v=t=>{Zu(t,e,"spectrum").map(Op.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:tu(e.sliderBehaviours,[Op.config({mode:"special",focusIn:v}),Jm.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),ec.config({channels:{[Lm()]:{onReceive:h}}})]),events:Xs([ea(u_(),((t,o)=>{((t,o)=>{g(t,o);const n=r(t);e.onChange(t,n,o),D.some(!0)})(t,o.event.value)})),la(((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=r(t);u(t,a);const i=s(t);e.onInit(t,a,i,d.value.get())})),ea(Xr(),p),ea(Qr(),f),ea(ts(),((e,t)=>{v(e),p(e,t)})),ea(rs(),f)]),apis:{resetToMin:t=>{m.setToMin(t,e)},resetToMax:t=>{m.setToMax(t,e)},setValue:g,refresh:u},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)}}}),LE=wa("rgb-hex-update"),HE=wa("slider-update"),IE=wa("palette-update"),PE="form",FE=[Qm("formBehaviours",[Jm])],zE=e=>"",VE=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:tu(e.formBehaviours,[Jm.config({store:{mode:"manual",getValue:t=>{const o=Wu(t,e);return ce(o,((e,t)=>e().bind((e=>{const o=ig.getCurrent(e);return n=o,r=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+fa(e.element)),n.fold((()=>nn.error(r)),nn.value);var n,r})).map(Jm.getValue)))},setValue:(t,o)=>{le(o,((o,n)=>{Zu(t,e,n).each((e=>{ig.getCurrent(e).each((e=>{Jm.setValue(e,o)}))}))}))}}})]),apis:{getField:(t,o)=>Zu(t,e,o).bind(ig.getCurrent)}}),ZE={getField:Ha(((e,t,o)=>e.getField(t,o))),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),Iu(PE,zE(t),o)),record:w(e)}})(),o=e(t),n=t.record(),r=F(n,(e=>Ou({name:e,pname:zE(e)})));return Ju(PE,FE,r,VE,o)}},UE=wa("valid-input"),jE=wa("invalid-input"),WE=wa("validating-input"),$E="colorcustom.rgb.",qE=(e,t,o,n)=>{const r=(o,n)=>$k.config({invalidClass:t("invalid"),notify:{onValidate:e=>{$s(e,WE,{type:o})},onValid:e=>{$s(e,UE,{type:o,value:Jm.getValue(e)})},onInvalid:e=>{$s(e,jE,{type:o,value:Jm.getValue(e)})}},validator:{validate:t=>{const o=Jm.getValue(t),r=n(o)?nn.value(!0):nn.error(e("aria.input.invalid"));return CS(r)},validateOnLoad:!1}}),s=(o,n,s,a,i)=>{const l=e($E+"range"),c=bk.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[Si(s)]}),d=bk.parts.field({data:i,factory:ky,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:Gl([r(n,o),xk.config({})]),onSetValue:e=>{if($k.isInvalid(e)){$k.run(e).get(v)}}}),m=[c,d],u="hex"!==n?[bk.parts["aria-descriptor"]({text:l})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:m.concat(u)}},a=(e,t)=>{const o=t.red,n=t.green,r=t.blue;Jm.setValue(e,{red:o,green:n,blue:r})},i=Lf({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each((e=>{Nt(e.element,"background-color","#"+t.value)}))},c=og({factory:()=>{const r={red:Ir(D.some(255)),green:Ir(D.some(255)),blue:Ir(D.some(255)),hex:Ir(D.some("ffffff"))},c=e=>r[e].get(),d=(e,t)=>{r[e].set(t)},m=e=>{const t=e.red,o=e.green,n=e.blue;d("red",D.some(t)),d("green",D.some(o)),d("blue",D.some(n))},u=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,D.none()):n(e)},g=(e,t,o)=>{const n=parseInt(o,10);d(t,D.some(n)),c("red").bind((e=>c("green").bind((t=>c("blue").map((o=>eC(e,t,o,1))))))).each((t=>{const o=((e,t)=>{const o=Gx(t);return ZE.getField(e,"hex").each((t=>{Up.isFocused(t)||Jm.setValue(e,{hex:o.value})})),o})(e,t);$s(e,LE,{hex:o}),l(e,o)}))},h=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=Vx(t);d("hex",D.some(n.value));const r=nC(n);a(e,r),m(r),$s(e,LE,{hex:n}),l(e,n)})(e,n.value):g(e,n.type,n.value)},p=t=>({label:e($E+t+".label"),description:e($E+t+".description")}),f=p("red"),v=p("green"),b=p("blue"),y=p("hex");return Cn(ZE.sketch((o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",bk.sketch(s(tC,"red",f.label,f.description,255))),o.field("green",bk.sketch(s(tC,"green",v.label,v.description,255))),o.field("blue",bk.sketch(s(tC,"blue",b.label,b.description,255))),o.field("hex",bk.sketch(s(jx,"hex",y.label,y.description,"ffffff"))),i.asSpec()],formBehaviours:Gl([$k.config({invalidClass:t("form-invalid")}),Pp("rgb-form-events",[ea(UE,h),ea(jE,u),ea(WE,u)])])}))),{apis:{updateHex:(e,t)=>{Jm.setValue(e,{hex:t.value}),((e,t)=>{const o=nC(t);a(e,o),m(o)})(e,t),l(e,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return c},GE=(e,t)=>{const o=BE.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=BE.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:``}}),r=(e,t)=>{const{width:o,height:n}=e,r=e.getContext("2d");if(null===r)return;r.fillStyle=t,r.fillRect(0,0,o,n);const s=r.createLinearGradient(0,0,o,0);s.addColorStop(0,"rgba(255,255,255,1)"),s.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=s,r.fillRect(0,0,o,n);const a=r.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=a,r.fillRect(0,0,o,n)},s=og({factory:s=>{const a=w({x:0,y:0}),i=Gl([ig.config({find:D.some}),Up.config({})]);return BE.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)=>{p(n)||kt(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),$s(t,IE,{value:n})},onInit:(e,t,o,n)=>{r(o.element.dom,aC(iC))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=xC(t,100,100),s=oC(n);r(o,aC(s))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=CC(nC(o));BE.setValue(t,{x:n.saturation,y:100-n.value}),kt(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}});return s},KE=(e,t)=>{const o=og({name:"ColourPicker",configFields:[mr("dom"),Or("onValidHex",v),Or("onInvalidHex",v)],factory:o=>{const n=qE(e,t,o.onValidHex,o.onInvalidHex),r=GE(e,t),s={paletteRgba:Ir(iC),paletteHue:Ir(0)},a=Lf(((e,t)=>{const o=BE.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=BE.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return BE.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:w(0)},components:[o,n],sliderBehaviours:Gl([Up.config({})]),onChange:(e,t,o)=>{kt(e.element,"aria-valuenow",Math.floor(360-3.6*o)),$s(e,HE,{value:o})}})})(0,t)),i=Lf(r.sketch({})),l=Lf(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each((e=>{r.setHue(e,o)}))},d=(e,t)=>{l.getOpt(e).each((e=>{n.updateHex(e,t)}))},m=(e,t,o)=>{a.getOpt(e).each((e=>{BE.setValue(e,(e=>100-e/360*100)(o))}))},u=(e,t)=>{i.getOpt(e).each((e=>{r.setThumb(e,t)}))},g=(e,t,o,n)=>{((e,t)=>{const o=nC(e);s.paletteRgba.set(o),s.paletteHue.set(t)})(t,o),z(n,(n=>{n(e,t,o)}))};return{uid:o.uid,dom:o.dom,components:[i.asSpec(),a.asSpec(),l.asSpec()],behaviours:Gl([Pp("colour-picker-events",[ea(LE,(()=>{const e=[c,m,u];return(t,o)=>{const n=o.event.hex,r=(e=>CC(nC(e)))(n);g(t,n,r.hue,e)}})()),ea(IE,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,r=s.paletteHue.get(),a=xC(r,n.x,100-n.y),i=SC(a);g(t,i,r,e)}})()),ea(HE,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),r=s.paletteRgba.get(),a=CC(r),i=xC(n,a.saturation,a.value),l=SC(i);g(t,l,n,e)}})())]),ig.config({find:e=>l.getOpt(e)}),Op.config({mode:"acyclic"})])}}});return o},YE=()=>ig.config({find:D.some}),XE=e=>ig.config({find:e.getOpt}),JE=e=>ig.config({find:t=>lt(t.element,e).bind((e=>t.getSystem().getByDom(e).toOptional()))}),QE=Fn([Or("preprocess",x),Or("postprocess",x)]),eT=(e,t)=>{const o=rr("RepresentingConfigs.memento processors",QE,t);return Jm.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),r=Jm.getValue(n);return o.postprocess(r)},setValue:(t,n)=>{const r=o.preprocess(n),s=e.get(t);Jm.setValue(s,r)}}})},tT=(e,t,o)=>Jm.config({store:{mode:"manual",...e.map((e=>({initialValue:e}))).getOr({}),getValue:t,setValue:o}}),oT=(e,t,o)=>tT(e,(e=>t(e.element)),((e,t)=>o(e.element,t))),nT=e=>Jm.config({store:{mode:"memory",initialValue:e}}),rT={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"},sT=(e,t,o)=>{const n=e=>"tox-"+e,r=KE((e=>t=>s(t)?e.translate(rT[t]):e.translate(t))(t),n),a=Lf(r.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{$s(e,Ak,{name:"hex-valid",value:!0})},onInvalidHex:e=>{$s(e,Ak,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:Gl([tT(o,(e=>{const t=a.get(e);return ig.getCurrent(t).bind((e=>Jm.getValue(e).hex)).map((e=>"#"+Ee(e,"#"))).getOr("")}),((e,t)=>{const o=D.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind((e=>te(e,1))),n=a.get(e);ig.getCurrent(n).fold((()=>{console.log("Can not find form")}),(e=>{Jm.setValue(e,{hex:o.getOr("")}),ZE.getField(e,"hex").each((e=>{Ws(e,ds())}))}))})),YE()])}};var aT=tinymce.util.Tools.resolve("tinymce.Resource");const iT=e=>be(e,"init");var lT=tinymce.util.Tools.resolve("tinymce.util.Tools");const cT=(e,t,o)=>{const n=(e,t)=>{t.stop()},r=e=>(t,o)=>{z(e,(e=>{e(t,o)}))},s=(e,t)=>{var o;if(!xg.isDisabled(e)){const n=t.event.raw;i(e,null===(o=n.dataTransfer)||void 0===o?void 0:o.files)}},a=(e,t)=>{const o=t.event.raw.target;i(e,o.files)},i=(o,n)=>{n&&(Jm.setValue(o,((e,t)=>{const o=lT.explode(t.getOption("images_file_types"));return Z(re(e),(e=>H(o,(t=>De(e.name.toLowerCase(),`.${t.toLowerCase()}`)))))})(n,t)),$s(o,Tk,{name:e.name}))},l=Lf({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:Gl([Pp("input-file-events",[sa(us()),sa(_s())])])}),c=e.label.map((e=>Ek(e,t))),d=bk.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Gl([nT(o.getOr([])),YE(),xg.config({}),Xp.config({toggleClass:"dragenter",toggleOnExecute:!1}),Pp("dropzone-events",[ea("dragenter",r([n,Xp.toggle])),ea("dragleave",r([n,Xp.toggle])),ea("dragover",n),ea("drop",r([n,s])),ea(ms(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[Si(t.translate("Drop an image here"))]},Rf.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[Si(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:Gl([xk.config({}),fx(t.isDisabled),hx()])})]}]})}});return Sk(c,d,["tox-form__group--stretched"],[])},dT=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}},mT=wa("alloy-fake-before-tabstop"),uT=wa("alloy-fake-after-tabstop"),gT=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:Gl([Up.config({ignore:!0}),xk.config({})])}),hT=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[gT([mT]),t,gT([uT])],behaviours:Gl([JE(1)])}),pT=(e,t)=>{$s(e,ls(),{raw:{which:9,shiftKey:t}})},fT=(e,t)=>{const o=t.element;ai(o,mT)?pT(e,!0):ai(o,uT)&&pT(e,!1)},vT=e=>tk(e,["."+mT,"."+uT].join(","),T),bT=wa("update-dialog"),yT=wa("update-title"),wT=wa("update-body"),xT=wa("update-footer"),CT=wa("body-send-message"),ST=wa("dialog-focus-shifted"),kT=Ao().browser,_T=kT.isSafari(),ET=kT.isFirefox(),TT=_T||ET,OT=kT.isChromium(),DT=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,AT=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),MT=(e,t,o)=>{const n=e.dom;D.from(n.contentDocument).fold(o,(e=>{let o=0;const r=((e,t)=>{const o=e.body;return D.from(!/^1))?o:e.documentElement)})(e,t).map((e=>(o=e.scrollTop,e))).forall(DT),s=()=>{const e=n.contentWindow;g(e)&&(r?AT(e,"bottom"):!r&&TT&&0!==o&&AT(e,o))};_T&&n.addEventListener("load",s,{once:!0}),e.open(),e.write(t),e.close(),_T||s()}))},NT=ke(TT,_T?500:200).map((e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...r)=>{n=r,c(o)&&(o=setTimeout((()=>{const t=n;o=null,n=null,e.apply(null,t)}),t))}}})(MT,e))),RT=(e,t,o)=>{const n="tox-dialog__iframe",r=e.transparent?[]:[`${n}--opaque`],s=e.border?["tox-navobj-bordered"]:[],a={...e.label.map((e=>({title:e}))).getOr({}),...o.map((e=>({srcdoc:e}))).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=((e,t)=>{const o=Ir(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,r=()=>kt(o,"srcdoc",n);t?NT.fold(w(MT),(e=>e.throttle))(o,n,r):r()}o.set(n)}}})(o,e.streamContent),l=e.label.map((e=>Ek(e,t))),c=bk.parts.field({factory:{sketch:e=>hT(D.from(s),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...r]},behaviours:Gl([xk.config({}),Up.config({}),tT(o,i.getValue,i.setValue),ec.config({channels:{[ST]:{onReceive:(e,t)=>{t.newFocus.each((t=>{st(e.element).each((o=>{(Je(e.element,t)?oi:ri)(o,"tox-navobj-bordered-focus")}))}))}}}})])})}});return Sk(l,c,["tox-form__group--stretched"],[])},BT=(e,t)=>{const o=Ir(t.getOr({url:""})),n=Lf({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map((e=>({src:e.url}))).getOr({})}}),r=Lf({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),s={};e.height.each((e=>s.height=e));const a=t.map((e=>({url:e.url,zoom:D.from(e.zoom),cachedWidth:D.from(e.cachedWidth),cachedHeight:D.from(e.cachedHeight)})));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:s,attributes:{role:"presentation"}},components:[r.asSpec()],behaviours:Gl([YE(),tT(a,(()=>o.get()),((e,t)=>{const s={url:t.url};t.zoom.each((e=>s.zoom=e)),t.cachedWidth.each((e=>s.cachedWidth=e)),t.cachedHeight.each((e=>s.cachedHeight=e)),o.set(s);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=s;if(!m(t)&&!m(o)){if(m(n)){const n=((e,t,o)=>{const n=Jt(e),r=jt(e);return Math.min(n/t,r/o,1)})(e.element,t,o);s.zoom=n}const a=((e,t,o,n,r)=>{const s=o*r,a=n*r,i=Math.max(0,e/2-s/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:s.toString()+"px",height:a.toString()+"px"}})(Jt(e.element),jt(e.element),t,o,s.zoom);r.getOpt(e).each((e=>{Rt(e.element,a)}))}};n.getOpt(e).each((o=>{const n=o.element;t.url!==Et(n,"src")&&(kt(n,"src",t.url),ri(e.element,"tox-imagepreview__loaded")),a(),(e=>new Promise(((t,o)=>{const n=()=>{s(),t(e)},r=[Tc(e,"load",n),Tc(e,"error",(()=>{s(),o("Unable to load data from image: "+e.dom.src)}))],s=()=>z(r,(e=>e.unbind()));e.dom.complete&&n()})))(n).then((t=>{e.getSystem().isConnected()&&(oi(e.element,"tox-imagepreview__loaded"),s.cachedWidth=t.dom.naturalWidth,s.cachedHeight=t.dom.naturalHeight,a())}))}))}))])}},LT=wa("toolbar.button.execute"),HT=wa("common-button-display-events"),IT={[Ss()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[Bs()]:["toolbar-button-events",HT],[Ls()]:["toolbar-button-events","dropdown-events","tooltipping"],[ts()]:["focusing","alloy.base.behaviour",HT]},PT=e=>Nt(e.element,"width",Lt(e.element,"width")),FT=(e,t,o)=>Vv(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),zT=(e,t)=>FT(e,t,[]),VT=(e,t)=>FT(e,t,[Ip.config({})]),ZT=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[Si(o.translate(e))],behaviours:Gl([Ip.config({})])}),UT=wa("update-menu-text"),jT=wa("update-menu-icon"),WT=(e,t,o,n)=>{const r=Ir(v),s=e.text.map((e=>Lf(ZT(e,t,o.providers)))),a=e.icon.map((e=>Lf(VT(e,o.providers.icons)))),i=(e,t)=>{const o=Jm.getValue(e);return Up.focus(o),$s(o,"keydown",{raw:t.event.raw}),IS.close(o),D.some(!0)},l=e.role.fold((()=>({})),(e=>({role:e}))),c=e.ariaLabel.fold((()=>({})),(e=>({"aria-label":o.providers.translate(e)}))),d=Vv("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),m=wa("common-button-display-events"),u="dropdown-events",h=Lf(IS.sketch({...e.uid?{uid:e.uid}:{},...l,dom:{tag:"button",classes:[t,`${t}--select`].concat(F(e.classes,(e=>`${t}--${e}`))),attributes:{...c,...g(n)?{"data-mce-name":n}:{}}},components:kx([a.map((e=>e.asSpec())),s.map((e=>e.asSpec())),D.some(d)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{Dy(e).each((e=>Up.focus(e)))})(n)},dropdownBehaviours:Gl([...e.dropdownBehaviours,fx((()=>e.disabled||o.providers.isDisabled())),hx(),qk.config({}),Ip.config({}),...e.tooltip.map((e=>lx.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(e)})))).toArray(),Pp(u,[wx(e,r),xx(e,r)]),Pp(m,[la(((e,t)=>PT(e)))]),Pp("menubutton-update-display-text",[ea(UT,((e,t)=>{s.bind((t=>t.getOpt(e))).each((e=>{Ip.set(e,[Si(o.providers.translate(t.event.text))])}))})),ea(jT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Ip.set(e,[VT(t.event.icon,o.providers.icons)])}))}))])]),eventOrder:Cn(IT,{[ts()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[Bs()]:["toolbar-button-events",lx.name(),u,m]}),sandboxBehaviours:Gl([Op.config({mode:"special",onLeft:i,onRight:i}),Pp("dropdown-sandbox-events",[ea(_y,((e,t)=>{PS(e),t.stop()})),ea(Ey,((e,t)=>{((e,t)=>{FS(e).each((o=>{((e,t,o,n)=>{const r={...n,target:t};e.getSystem().triggerEvent(o,t,r)})(e,o.element,t.event.eventType,t.event.interactionEvent)}))})(e,t),t.stop()}))])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...yy(0,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:zS,onCollapseMenu:(e,t,o)=>{Ng.getHighlighted(o).each((t=>{zS(e,o,t)}))},onDehighlightItem:VS}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Fc()(e,t-10)}}),fetch:t=>xS(S(e.fetch,t))}));return h.asSpec()},$T=e=>"separator"===e.type,qT={type:"separator"},GT=(e,t)=>{const o=j(e,((e,o)=>(e=>s(e))(o)?""===o?e:"|"===o?e.length>0&&!$T(e[e.length-1])?e.concat([qT]):e:be(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o])),[]);return o.length>0&&$T(o[o.length-1])&&o.pop(),o},KT=(e,t)=>{const o=GT(s(e)?e.split(" "):e,t);return U(o,((e,o)=>{if((e=>be(e,"getSubmenuItems"))(o)){const n=(e=>{const t=ve(e,"value").getOrThunk((()=>wa("generated-menu-item")));return Cn({value:t},e)})(o),r=((e,t)=>{const o=e.getSubmenuItems(),n=KT(o,t);return{item:e,menus:Cn(n.menus,{[e.value]:n.items}),expansions:Cn(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:Cn(e.menus,r.menus),items:[r.item,...e.items],expansions:Cn(e.expansions,r.expansions)}}return{...e,items:[o,...e.items]}}),{menus:{},expansions:{},items:[]})},YT=(e,t,o,n)=>{const r=wa("primary-menu"),s=KT(e,o.shared.providers.menuItems());if(0===s.items.length)return D.none();const a=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-field",placeholder:e.placeholder}))))(n),i=$S(r,s.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-results"}))))(n),c=ce(s.menus,((e,n)=>$S(n,e,t,o,!1,l))),d=Cn(c,zr(r,i));return D.from(Af.tieredData(r,d,s.expansions))},XT=e=>!be(e,"items"),JT="data-value",QT=(e,t,o,n)=>F(o,(o=>XT(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{Jm.setValue(e,o.value),$s(e,Tk,{name:t}),Up.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>QT(e,t,o.items,n)})),eO=(e,t)=>se(e,(e=>XT(e)?ke(e.value===t,e):eO(e.items,t))),tO=og({name:"HtmlSelect",configFields:[mr("options"),Qm("selectBehaviours",[Up,Jm]),Or("selectClasses",[]),Or("selectAttributes",{}),wr("data")],factory:(e,t)=>{const o=F(e.options,(e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}}))),n=e.data.map((e=>zr("initialValue",e))).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:tu(e.selectBehaviours,[Up.config({}),Jm.config({store:{mode:"manual",getValue:e=>di(e.element),setValue:(t,o)=>{const n=oe(e.options);W(e.options,(e=>e.value===o)).isSome()?mi(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each((e=>mi(t.element,e.value)))},...n}})])}}}),oO=w([Or("field1Name","field1"),Or("field2Name","field2"),nl("onLockedChange"),Qi(["lockClass"]),Or("locked",!1),ou("coupledFieldBehaviours",[ig,Jm])]),nO=(e,t)=>Ou({factory:bk,name:e,overrides:e=>({fieldBehaviours:Gl([Pp("coupled-input-behaviour",[ea(ds(),(o=>{((e,t,o)=>Zu(e,t,o).bind(ig.getCurrent))(o,e,t).each((t=>{Zu(o,e,"lock").each((n=>{Xp.isOn(n)&&e.onLockedChange(o,t,n)}))}))}))])])})}),rO=w([nO("field1","field2"),nO("field2","field1"),Ou({factory:Rf,schema:[mr("dom")],name:"lock",overrides:e=>({buttonBehaviours:Gl([Xp.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),sO=ng({name:"FormCoupledInputs",configFields:oO(),partFields:rO(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:nu(e.coupledFieldBehaviours,[ig.config({find:D.some}),Jm.config({store:{mode:"manual",getValue:t=>{const o=qu(t,e,["field1","field2"]);return{[e.field1Name]:Jm.getValue(o.field1()),[e.field2Name]:Jm.getValue(o.field2())}},setValue:(t,o)=>{const n=qu(t,e,["field1","field2"]);ye(o,e.field1Name)&&Jm.setValue(n.field1(),o[e.field1Name]),ye(o,e.field2Name)&&Jm.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>Zu(t,e,"field1"),getField2:t=>Zu(t,e,"field2"),getLock:t=>Zu(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),aO=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 nn.value({value:e,unit:o})}return nn.error(e)},iO=(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?D.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?D.some(e.value):D.some(e.value/o[e.unit]*o[t]):D.none()},lO=e=>D.none(),cO=(e,t)=>{const o=aO(e).toOptional(),n=aO(t).toOptional();return Ce(o,n,((e,t)=>iO(e,t.unit).map((e=>t.value/e)).map((e=>{return o=e,n=t.unit,e=>iO(e,n).map((e=>({value:e*o,unit:n})));var o,n})).getOr(lO))).getOr(lO)},dO=(e,t)=>{const o=e.label.map((e=>Ek(e,t))),n=[xg.config({disabled:()=>e.disabled||t.isDisabled()}),hx(),Op.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Ws(e,Mk),D.some(!0))}),Pp("textfield-change",[ea(ds(),((t,o)=>{$s(t,Tk,{name:e.name})})),ea(xs(),((t,o)=>{$s(t,Tk,{name:e.name})}))]),xk.config({})],r=e.validation.map((e=>$k.config({getRoot:e=>st(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=Jm.getValue(t),n=e.validator(o);return CS(!0===n?nn.value(o):nn.error(n))},validateOnLoad:e.validateOnLoad}}))).toArray(),s={...e.placeholder.fold(w({}),(e=>({placeholder:t.translate(e)}))),...e.inputMode.fold(w({}),(e=>({inputmode:e})))},a=bk.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map((e=>({data:e}))).getOr({}),inputAttributes:s,inputClasses:[e.classname],inputBehaviours:Gl(q([n,r])),selectOnFocus:!1,factory:ky}),i=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[a]}:a,l=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),c=[xg.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{bk.getField(e).each(xg.disable)},onEnabled:e=>{bk.getField(e).each(xg.enable)}}),hx()];return Sk(o,i,l,c)},mO=(e,t)=>t.getAnimationRoot.fold((()=>e.element),(t=>t(e))),uO=e=>e.dimension.property,gO=(e,t)=>e.dimension.getDimension(t),hO=(e,t)=>{const o=mO(e,t);li(o,[t.shrinkingClass,t.growingClass])},pO=(e,t)=>{ri(e.element,t.openClass),oi(e.element,t.closedClass),Nt(e.element,uO(t),"0px"),Vt(e.element)},fO=(e,t)=>{ri(e.element,t.closedClass),oi(e.element,t.openClass),zt(e.element,uO(t))},vO=(e,t,o,n)=>{o.setCollapsed(),Nt(e.element,uO(t),gO(t,e.element)),hO(e,t),pO(e,t),t.onStartShrink(e),t.onShrunk(e)},bO=(e,t,o,n)=>{const r=n.getOrThunk((()=>gO(t,e.element)));o.setCollapsed(),Nt(e.element,uO(t),r),Vt(e.element);const s=mO(e,t);ri(s,t.growingClass),oi(s,t.shrinkingClass),pO(e,t),t.onStartShrink(e)},yO=(e,t,o)=>{const n=gO(t,e.element);("0px"===n?vO:bO)(e,t,o,D.some(n))},wO=(e,t,o)=>{const n=mO(e,t),r=ai(n,t.shrinkingClass),s=gO(t,e.element);fO(e,t);const a=gO(t,e.element);(r?()=>{Nt(e.element,uO(t),s),Vt(e.element)}:()=>{pO(e,t)})(),ri(n,t.shrinkingClass),oi(n,t.growingClass),fO(e,t),Nt(e.element,uO(t),a),o.setExpanded(),t.onStartGrow(e)},xO=(e,t,o)=>{const n=mO(e,t);return!0===ai(n,t.growingClass)},CO=(e,t,o)=>{const n=mO(e,t);return!0===ai(n,t.shrinkingClass)};var SO=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){zt(e.element,uO(t));const o=gO(t,e.element);Nt(e.element,uO(t),o)}},grow:(e,t,o)=>{o.isExpanded()||wO(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&yO(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&vO(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:xO,isShrinking:CO,isTransitioning:(e,t,o)=>xO(e,t)||CO(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?yO:wO)(e,t,o)},disableTransitions:hO,immediateGrow:(e,t,o)=>{o.isExpanded()||(fO(e,t),Nt(e.element,uO(t),gO(t,e.element)),hO(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}});var kO=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return za(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:zr(t.dimension.property,"0px")})},events:(e,t)=>Xs([ia(hs(),((o,n)=>{if(n.event.raw.propertyName===e.dimension.property){hO(o,e),t.isExpanded()&&zt(o.element,e.dimension.property);(t.isExpanded()?e.onGrown:e.onShrunk)(o)}}))])}),_O=[mr("closedClass"),mr("openClass"),mr("shrinkingClass"),mr("growingClass"),wr("getAnimationRoot"),tl("onShrunk"),tl("onStartShrink"),tl("onGrown"),tl("onStartGrow"),Or("expanded",!1),ur("dimension",ar("property",{width:[sl("property","width"),sl("getDimension",(e=>Jt(e)+"px"))],height:[sl("property","height"),sl("getDimension",(e=>jt(e)+"px"))]}))];const EO=Yl({fields:_O,name:"sliding",active:kO,apis:SO,state:Object.freeze({__proto__:null,init:e=>{const t=Ir(e.expanded);return Pa({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:S(t.set,!1),setExpanded:S(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),TO=e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setActive:t=>{const o=e.element;t?(oi(o,"tox-tbtn--enabled"),kt(o,"aria-pressed",!0)):(ri(o,"tox-tbtn--enabled"),Dt(o,"aria-pressed"))},isActive:()=>ai(e.element,"tox-tbtn--enabled"),setText:t=>{$s(e,UT,{text:t})},setIcon:t=>$s(e,jT,{icon:t})}),OO=(e,t,o,n,r=!0,s)=>WT({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const r={pattern:e.search.isSome()?ZS(t):""};e.fetch((t=>{n(YT(t,ty.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))}),r,TO(t))},onSetup:e.onSetup,getApi:TO,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...r?[xk.config({})]:[]]},t,o.shared,s),DO=(e,t,o)=>{const n=e=>n=>{const r=!n.isActive();n.setActive(r),e.storage.set(r),o.shared.getSink().each((o=>{t().getOpt(o).each((t=>{oc(t.element),$s(t,Ak,{name:e.name,value:e.storage.get()})}))}))},r=e=>t=>{t.setActive(e.storage.get())};return t=>{t(F(e,(e=>{const t=e.text.fold((()=>({})),(e=>({text:e})));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:r(e)}})))}},AO=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[Si(e)]}),MO=wa("leaf-label-event-id"),NO=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:r,backstage:s})=>{const a=e.menu.map((e=>OO(e,"tox-mbtn",s,D.none(),o))),i=[AO(e.title)];return a.each((e=>i.push(e))),Rf.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:{[ls()]:[MO,"keying"]},buttonBehaviours:Gl([...o?[xk.config({})]:[],Xp.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),ec.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?Xp.on:Xp.off)(t)}}}}),Pp(MO,[la(((t,o)=>{r.each((o=>{(o===e.id?Xp.on:Xp.off)(t)}))})),ea(ls(),((e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(Ri(e.element,".tox-tree--directory").each((t=>{e.getSystem().getByDom(t).each((e=>{Bi(t,".tox-tree--directory__label").each((t=>{e.getSystem().getByDom(t).each(Up.focus)}))}))})),t.stop()):n&&t.stop()}))])])})},RO=(e,t)=>((e,t,o)=>Vv(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:o},t))(e,t,[]),BO=wa("directory-label-event-id"),LO=({directory:e,visible:t,noChildren:o,backstage:n})=>{const r=e.menu.map((e=>OO(e,"tox-mbtn",n,D.none()))),s=[{dom:{tag:"div",classes:["tox-chevron"]},components:[RO("chevron-right",n.shared.providers.icons)]},AO(e.title)];r.each((e=>{s.push(e)}));const a=t=>{Ri(t.element,".tox-tree--directory").each((o=>{t.getSystem().getByDom(o).each((o=>{const n=!Xp.isOn(o);Xp.toggle(o),$s(t,"expand-tree-node",{expanded:n,node:e.id})}))}))};return Rf.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:s,action:a,eventOrder:{[ls()]:[BO,"keying"]},buttonBehaviours:Gl([...t?[xk.config({})]:[],Pp(BO,[ea(ls(),((e,t)=>{const n="ArrowRight"===t.event.raw.code,r="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||r)&&Ri(e.element,".tox-tree--directory").each((o=>{e.getSystem().getByDom(o).each((o=>{!Xp.isOn(o)&&n||Xp.isOn(o)&&r?(a(e),t.stop()):r&&!Xp.isOn(o)&&(Ri(o.element,".tox-tree--directory").each((e=>{Bi(e,".tox-tree--directory__label").each((e=>{o.getSystem().getByDom(e).each(Up.focus)}))})),t.stop())}))}))}))])])})},HO=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:r,selectedId:s,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map((e=>"leaf"===e.type?NO({leaf:e,selectedId:s,onLeafAction:t,visible:o,treeId:n,backstage:a}):PO({directory:e,expandedIds:r,selectedId:s,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a}))),behaviours:Gl([EO.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}),Ip.config({})])}),IO=wa("directory-event-id"),PO=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:r,expandedIds:s,selectedId:a})=>{const{children:i}=e,l=Ir(s),c=s.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[LO({directory:e,visible:o,noChildren:0===e.children.length,backstage:r}),HO({children:i,expandedIds:s,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:r})],behaviours:Gl([Pp(IO,[la(((e,t)=>{Xp.set(e,c)})),ea("expand-tree-node",((e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter((e=>e!==n)))}))]),Xp.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const s=e.components()[1],c=(d=o,i.map((e=>"leaf"===e.type?NO({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:r}):PO({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:r}))));var d;o?EO.grow(s):EO.shrink(s),Ip.set(s,c)}})])}},FO=wa("tree-event-id");var zO=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Xs([ea(e.event,o),ca((()=>t.cancel()))].concat(e.cancelEvent.map((e=>[ea(e,(()=>t.cancel()))])).getOr([])))}});const VO=e=>{const t=Ir(null);return Pa({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var ZO=Object.freeze({__proto__:null,throttle:VO,init:e=>e.stream.streams.state(e)});var UO=[ur("stream",ar("mode",{throttle:[mr("delay"),Or("stopEvent",!0),sl("streams",{setup:(e,t)=>{const o=e.stream,n=dT(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:VO})]})),Or("event","input"),wr("cancelEvent"),nl("onStream")];const jO=Yl({fields:UO,name:"streaming",active:zO,state:ZO}),WO=(e,t,o)=>{const n=Jm.getValue(o);Jm.setValue(t,n),qO(t)},$O=(e,t)=>{const o=e.element,n=di(o),r=o.dom;"number"!==Et(o,"type")&&t(r,n)},qO=e=>{$O(e,((e,t)=>e.setSelectionRange(t.length,t.length)))},GO=(e,t,o)=>{if(e.selectsOver){const n=Jm.getValue(t),r=e.getDisplayText(n),s=Jm.getValue(o);return 0===e.getDisplayText(s).indexOf(r)?D.some((()=>{WO(0,t,o),((e,t)=>{$O(e,((e,o)=>e.setSelectionRange(t,o.length)))})(t,r.length)})):D.none()}return D.none()},KO=w("alloy.typeahead.itemexecute"),YO=w([wr("lazySink"),mr("fetch"),Or("minChars",5),Or("responseTime",1e3),tl("onOpen"),Or("getHotspot",D.some),Or("getAnchorOverrides",w({})),Or("layouts",D.none()),Or("eventOrder",{}),Hr("model",{},[Or("getDisplayText",(e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value)),Or("selectsOver",!0),Or("populateFromBrowse",!0)]),tl("onSetValue"),ol("onExecute"),tl("onItemExecute"),Or("inputClasses",[]),Or("inputAttributes",{}),Or("inputStyles",{}),Or("matchWidth",!0),Or("useMinWidth",!1),Or("dismissOnBlur",!0),Qi(["openClass"]),wr("initialData"),Qm("typeaheadBehaviours",[Up,Jm,jO,Op,Xp,fS]),cr("lazyTypeaheadComp",(()=>Ir(D.none))),cr("previewing",(()=>Ir(!0)))].concat(wy()).concat(BS())),XO=w([Du({schema:[Ji()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each((t=>{GO(e.model,t,n).fold((()=>{e.model.selectsOver?(Ng.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&&WO(e.model,t,n),Tt(n.element,"id").each((e=>kt(t.element,"aria-activedescendant",e)))}))},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map((e=>($s(e,KO(),{item:o}),!0))),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&WO(e.model,t,o)}))}})})]),JO=ng({name:"Typeahead",configFields:YO(),partFields:XO(),factory:(e,t,o,n)=>{const r=(t,o,r)=>{e.previewing.set(!1);const s=fS.getCoupled(t,"sandbox");if(Nm.isOpen(s))ig.getCurrent(s).each((e=>{Ng.getHighlighted(e).fold((()=>{r(e)}),(()=>{Ys(s,e.element,"keydown",o)}))}));else{const o=e=>{ig.getCurrent(e).each(r)};ES(e,a(t),t,s,n,o,Of.HighlightMenuAndItem).get(v)}},s=xy(e),a=e=>t=>t.map((t=>{const o=fe(t.menus),n=G(o,(e=>Z(e.items,(e=>"item"===e.type))));return Jm.getState(e).update(F(n,(e=>e.data))),t})),i=e=>ig.getCurrent(e),l="typeaheadevents",c=[Up.config({}),Jm.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>di(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{mi(t.element,e.model.getDisplayText(o))},...e.initialData.map((e=>zr("initialValue",e))).getOr({})}}),jO.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const r=fS.getCoupled(t,"sandbox");if(Up.isFocused(t)&&di(t.element).length>=e.minChars){const o=i(r).bind((e=>Ng.getHighlighted(e).map(Jm.getValue)));e.previewing.set(!0);const s=t=>{i(r).each((t=>{o.fold((()=>{e.model.selectsOver&&Ng.highlightFirst(t)}),(e=>{Ng.highlightBy(t,(t=>Jm.getValue(t).value===e.value)),Ng.getHighlighted(t).orThunk((()=>(Ng.highlightFirst(t),D.none())))}))}))};ES(e,a(t),t,r,n,s,Of.HighlightJustMenu).get(v)}},cancelEvent:Os()}),Op.config({mode:"special",onDown:(e,t)=>(r(e,t,Ng.highlightFirst),D.some(!0)),onEscape:e=>{const t=fS.getCoupled(e,"sandbox");return Nm.isOpen(t)?(Nm.close(t),D.some(!0)):D.none()},onUp:(e,t)=>(r(e,t,Ng.highlightLast),D.some(!0)),onEnter:t=>{const o=fS.getCoupled(t,"sandbox"),n=Nm.isOpen(o);if(n&&!e.previewing.get())return i(o).bind((e=>Ng.getHighlighted(e))).map((e=>($s(t,KO(),{item:e}),!0)));{const r=Jm.getValue(t);return Ws(t,Os()),e.onExecute(o,t,r),n&&Nm.close(o),D.some(!0)}}}),Xp.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),fS.config({others:{sandbox:t=>NS(e,t,{onOpen:()=>Xp.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each((e=>Dt(e.element,"aria-activedescendant"))),Xp.off(t)}})}}),Pp(l,[la((t=>{e.lazyTypeaheadComp.set(D.some(t))})),ca((t=>{e.lazyTypeaheadComp.set(D.none())})),ma((t=>{const o=v;OS(e,a(t),t,n,o,Of.HighlightMenuAndItem).get(v)})),ea(KO(),((t,o)=>{const n=fS.getCoupled(t,"sandbox");WO(e.model,t,o.event.item),Ws(t,Os()),e.onItemExecute(t,n,o.event.item,Jm.getValue(t)),Nm.close(n),qO(t)}))].concat(e.dismissOnBlur?[ea(ws(),(e=>{const t=fS.getCoupled(e,"sandbox");ac(t.element).isNone()&&Nm.close(t)}))]:[]))],d={[Ls()]:[Jm.name(),jO.name(),l],...e.eventOrder};return{uid:e.uid,dom:Sy(Cn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...s,...tu(e.typeaheadBehaviours,c)},eventOrder:d}}}),QO=e=>({...e,toCached:()=>QO(e.toCached()),bindFuture:t=>QO(e.bind((e=>e.fold((e=>CS(nn.error(e))),(e=>t(e)))))),bindResult:t=>QO(e.map((e=>e.bind(t)))),mapResult:t=>QO(e.map((e=>e.map(t)))),mapError:t=>QO(e.map((e=>e.mapError(t)))),foldResult:(t,o)=>e.map((e=>e.fold(t,o))),withTimeout:(t,o)=>QO(xS((n=>{let r=!1;const s=setTimeout((()=>{r=!0,n(nn.error(o()))}),t);e.get((e=>{r||(clearTimeout(s),n(e))}))})))}),eD=e=>QO(xS(e)),tD=eD,oD=(e,t,o=[],n,r,s,a)=>{const i=t.fold((()=>({})),(e=>({action:e}))),l={buttonBehaviours:Gl([fx((()=>!e.enabled||a.isDisabled())),hx(),xk.config({}),...s.map((e=>lx.config(a.tooltips.getConfig({tooltipText:a.translate(e)})))).toArray(),Pp("button press",[Qs("click"),Qs("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...i},c=Cn(l,{dom:n});return Cn(c,{components:r})},nD=(e,t,o,n=[],r)=>{const s={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map((e=>({"aria-label":o.translate(e)}))).getOr({}),"data-mce-name":r}},a=e.icon.map((e=>zT(e,o.icons))),i=kx([a]);return oD(e,t,n,s,i,e.tooltip,o)},rD=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},sD=(e,t,o,n=[],r=[])=>{const s=o.translate(e.text),a=e.icon.map((e=>zT(e,o.icons))),i=[a.getOrThunk((()=>Si(s)))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...rD(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...r],attributes:{"aria-label":s,"data-mce-name":e.text}},d=e.icon.map(w(s));return oD(e,t,n,c,i,d,o)},aD=(e,t,o,n=[],r=[])=>{const s=sD(e,D.some(t),o,n,r);return Rf.sketch(s)},iD=(e,t)=>o=>{"custom"===t?$s(o,Ak,{name:e,value:{}}):"submit"===t?Ws(o,Mk):"cancel"===t?Ws(o,Dk):console.error("Unknown button type: ",t)},lD=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>s,n=e,r={...e,type:"menubutton",search:D.none(),onSetup:t=>(t.setEnabled(e.enabled),v),fetch:DO(n.items,t,o)},s=Lf(OO(r,"tox-tbtn",o,D.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return s.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=iD(e.name,t),r={...e,borderless:!1};return aD(r,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{var n,r;const s=e.icon.map((e=>VT(e,t.icons))).map(Lf),a=e.buttonType.getOr(e.primary?"primary":"secondary"),i={...e,name:null!==(n=e.name)&&void 0!==n?n:"",primary:"primary"===a,tooltip:e.tooltip,enabled:null!==(r=e.enabled)&&void 0!==r&&r,borderless:!1},l=i.tooltip.or(e.text).map((e=>({"aria-label":t.translate(e)}))).getOr({}),c=rD(null!=a?a:"secondary"),d=e.icon.isSome()&&e.text.isSome(),m={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:{...l,...g(o)?{"data-mce-name":o}:{}}},u=t.translate(e.text.getOr("")),h=Si(u),p=[...kx([s.map((e=>e.asSpec()))]),...e.text.isSome()?[h]:[]],f=oD(i,D.some((o=>{$s(o,Ak,{name:e.name,value:{setIcon:e=>{s.map((n=>n.getOpt(o).each((o=>{Ip.set(o,[VT(e,t.icons)])}))))}}})})),[],m,p,e.tooltip,t);return Rf.sketch(f)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},cD=(e,t)=>{const o=iD(e.name,"custom");return n=D.none(),r=bk.parts.field({factory:Rf,...sD(e,D.some(o),t,[nT(""),YE()])}),Sk(n,r,[],[]);var n,r},dD={type:"separator"},mD=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:v}),uD=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:v}),gD=(e,t)=>(e=>F(e,mD))(((e,t)=>Z(t,(t=>t.type===e)))(e,t)),hD=e=>gD("header",e.targets),pD=e=>gD("anchor",e.targets),fD=e=>D.from(e.anchorTop).map((e=>uD("",e))).toArray(),vD=e=>D.from(e.anchorBottom).map((e=>uD("",e))).toArray(),bD=(e,t)=>{const o=e.toLowerCase();return Z(t,(e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,r=null!==(t=e.value)&&void 0!==t?t:"";return Te(n.toLowerCase(),o)||Te(r.toLowerCase(),o)}))},yD=(e,t,o)=>{var n,r;const s=Jm.getValue(t),a=null!==(r=null===(n=null==s?void 0:s.meta)||void 0===n?void 0:n.text)&&void 0!==r?r:s.value;return o.getLinkInformation().fold((()=>[]),(t=>{const n=bD(a,(e=>F(e,(e=>uD(e,e))))(o.getHistory(e)));return"file"===e?(r=[n,bD(a,hD(t)),bD(a,q([fD(t),pD(t),vD(t)]))],j(r,((e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(dD,t)),[])):n;var r}))},wD=wa("aria-invalid"),xD=(e,t)=>{e.dom.checked=t},CD=e=>e.dom.checked,SD=e=>(t,o,n,r)=>ve(o,"name").fold((()=>e(o,r,D.none())),(s=>t.field(s,e(o,r,ve(n,s))))),kD={bar:SD(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:F(e.items,t.interpreter)}))(e,t.shared))),collection:SD(((e,t,o)=>Hk(e,t.shared.providers,o))),alertbanner:SD(((e,t)=>((e,t)=>{const o=Pv(e.icon,t.icons);return hk.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?[Rf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>$s(t,Ak,{name:"alert-banner",value:e.url}),buttonBehaviours:Gl([Fv()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers))),input:SD(((e,t,o)=>((e,t,o)=>dO({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:D.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),textarea:SD(((e,t,o)=>((e,t,o)=>dO({name:e.name,multiline:!0,label:e.label,inputMode:D.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:D.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),label:SD(((e,t)=>((e,t)=>{const o="tox-label";return{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"label",classes:[o,..."center"===e.align?[`${o}--center`]:[],..."end"===e.align?[`${o}--end`]:[]]},components:[Si(t.providers.translate(e.label))]},...F(e.items,t.interpreter)],behaviours:Gl([YE(),Ip.config({}),(n=D.none(),oT(n,ua,ga)),Op.config({mode:"acyclic"})])};var n})(e,t.shared))),iframe:(e=>(t,o,n,r)=>{const s=Cn(o,{source:"dynamic"});return SD(e)(t,s,n,r)})(((e,t,o)=>RT(e,t.shared.providers,o))),button:SD(((e,t)=>cD(e,t.shared.providers))),checkbox:SD(((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),D.some(!0)),r=bk.parts.field({factory:{sketch:x},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:Gl([YE(),xg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{st(e.element).each((e=>oi(e,"tox-checkbox--disabled")))},onEnabled:e=>{st(e.element).each((e=>ri(e,"tox-checkbox--disabled")))}}),xk.config({}),Up.config({}),oT(o,CD,xD),Op.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),Pp("checkbox-events",[ea(ms(),((t,o)=>{$s(t,Tk,{name:e.name})}))])])}),s=bk.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[Si(t.translate(e.label))],behaviours:Gl([qk.config({})])}),a=e=>Vv("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Lf({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return bk.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[r,i.asSpec(),s],fieldBehaviours:Gl([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),hx()])})})(e,t.shared.providers,o))),colorinput:SD(((e,t,o)=>Xk(e,t.shared,t.colorinput,o))),colorpicker:SD(((e,t,o)=>sT(0,t.shared.providers,o))),dropzone:SD(((e,t,o)=>cT(e,t.shared.providers,o))),grid:SD(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:F(e.items,t.interpreter)}))(e,t.shared))),listbox:SD(((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,r=o.bind((t=>eO(e.items,t))).orThunk((()=>oe(e.items).filter(XT))),s=e.label.map((e=>Ek(e,n))),a=bk.parts.field({dom:{},factory:{sketch:o=>WT({uid:o.uid,text:r.map((e=>e.text)),icon:D.none(),tooltip:D.none(),role:D.none(),ariaLabel:e.label,fetch:(o,n)=>{const r=QT(o,e.name,e.items,Jm.getValue(o));n(YT(r,ty.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:D.none()}))},onSetup:w(v),getApi:w({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[xk.config({}),tT(r.map((e=>e.value)),(e=>Et(e.element,JT)),((t,o)=>{eO(e.items,o).each((e=>{kt(t.element,JT,e.value),$s(t,UT,{text:e.text})}))}))]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return bk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([s.toArray(),[i]]),fieldBehaviours:Gl([xg.config({disabled:w(!e.enabled),onDisabled:e=>{bk.getField(e).each(xg.disable)},onEnabled:e=>{bk.getField(e).each(xg.enable)}})])})})(e,t,o))),selectbox:SD(((e,t,o)=>((e,t,o)=>{const n=F(e.items,(e=>({text:t.translate(e.text),value:e.value}))),r=e.label.map((e=>Ek(e,t))),s=bk.parts.field({dom:{},...o.map((e=>({data:e}))).getOr({}),selectAttributes:{size:e.size},options:n,factory:tO,selectBehaviours:Gl([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),xk.config({}),Pp("selectbox-change",[ea(ms(),((t,o)=>{$s(t,Tk,{name:e.name})}))])])}),a=e.size>1?D.none():D.some(Vv("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[s],a.toArray()])};return bk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([r.toArray(),[i]]),fieldBehaviours:Gl([xg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{bk.getField(e).each(xg.disable)},onEnabled:e=>{bk.getField(e).each(xg.enable)}}),hx()])})})(e,t.shared.providers,o))),sizeinput:SD(((e,t)=>((e,t)=>{let o=lO;const n=wa("ratio-event"),r=e=>Vv(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),s=e.label.getOr("Constrain proportions"),a=t.translate(s),i=sO.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":a,"data-mce-name":s}},components:[r("lock"),r("unlock")],buttonBehaviours:Gl([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),hx(),xk.config({}),lx.config(t.tooltips.getConfig({tooltipText:a}))])}),l=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),c=o=>bk.parts.field({factory:ky,inputClasses:["tox-textfield"],inputBehaviours:Gl([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),hx(),xk.config({}),Pp("size-input-events",[ea(as(),((e,t)=>{$s(e,n,{isField1:o})})),ea(ms(),((t,o)=>{$s(t,Tk,{name:e.name})}))])]),selectOnFocus:!1}),d=e=>({dom:{tag:"label",classes:["tox-label"]},components:[Si(t.translate(e))]}),m=sO.parts.field1(l([bk.parts.label(d("Width")),c(!0)])),u=sO.parts.field2(l([bk.parts.label(d("Height")),c(!1)]));return sO.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[m,u,l([d(" "),i])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{aO(Jm.getValue(e)).each((e=>{o(e).each((e=>{Jm.setValue(t,(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})(e))}))}))},coupledFieldBehaviours:Gl([xg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{sO.getField1(e).bind(bk.getField).each(xg.disable),sO.getField2(e).bind(bk.getField).each(xg.disable),sO.getLock(e).each(xg.disable)},onEnabled:e=>{sO.getField1(e).bind(bk.getField).each(xg.enable),sO.getField2(e).bind(bk.getField).each(xg.enable),sO.getLock(e).each(xg.enable)}}),hx(),Pp("size-input-events2",[ea(n,((e,t)=>{const n=t.event.isField1,r=n?sO.getField1(e):sO.getField2(e),s=n?sO.getField2(e):sO.getField1(e),a=r.map(Jm.getValue).getOr(""),i=s.map(Jm.getValue).getOr("");o=cO(a,i)}))])])})})(e,t.shared.providers))),slider:SD(((e,t,o)=>((e,t,o)=>{const n=BE.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Si(t.translate(e.label))]}),r=BE.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),s=BE.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return BE.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:w(o.getOrThunk((()=>(Math.abs(e.max)-Math.abs(e.min))/2)))},components:[n,r,s],sliderBehaviours:Gl([YE(),Up.config({})]),onChoose:(t,o,n)=>{$s(t,Tk,{name:e.name,value:n})}})})(e,t.shared.providers,o))),urlinput:SD(((e,t,o)=>((e,t,o,n)=>{const r=t.shared.providers,s=t=>{const n=Jm.getValue(t);o.addToHistory(n.value,e.filetype)},a={...n.map((e=>({initialData:e}))).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":wD,type:"url"},minChars:0,responseTime:0,fetch:n=>{const r=yD(e.filetype,n,o),s=YT(r,ty.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:D.none()});return CS(s)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured($k)&&$k.run(e).get(v)},typeaheadBehaviours:Gl([...o.getValidationHandler().map((t=>$k.config({getRoot:e=>st(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each((e=>{kt(e.element,"title",r.translate(t))}))}},validator:{validate:o=>{const n=Jm.getValue(o);return tD((o=>{t({type:e.filetype,url:n.value},(e=>{if("invalid"===e.status){const t=nn.error(e.message);o(t)}else{const t=nn.value(e.message);o(t)}}))}))},validateOnLoad:!1}}))).toArray(),xg.config({disabled:()=>!e.enabled||r.isDisabled()}),xk.config({}),Pp("urlinput-events",[ea(ds(),(t=>{const o=di(t.element),n=o.trim();n!==o&&mi(t.element,n),"file"===e.filetype&&$s(t,Tk,{name:e.name})})),ea(ms(),(t=>{$s(t,Tk,{name:e.name}),s(t)})),ea(xs(),(t=>{$s(t,Tk,{name:e.name}),s(t)}))])]),eventOrder:{[ds()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:yy(0,0,"normal")},onExecute:(e,t,o)=>{$s(t,Mk,{})},onItemExecute:(t,o,n,r)=>{s(t),$s(t,Tk,{name:e.name})}},i=bk.parts.field({...a,factory:JO}),l=e.label.map((e=>Ek(e,r))),c=Lf(((e,t,o=e,n=e)=>Vv(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:r.translate(n),"aria-live":"polite",...t.fold((()=>({})),(e=>({id:e})))}},r.icons))("invalid",D.some(wD),"warning")),d=Lf({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),m=o.getUrlPicker(e.filetype),u=wa("browser.url.event"),g=Lf({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:Gl([xg.config({disabled:()=>!e.enabled||r.isDisabled()})])}),h=Lf(aD({name:e.name,icon:D.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:D.none(),borderless:!0},(e=>Ws(e,u)),r,[],["tox-browse-url"]));return bk.sketch({dom:_k([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[g.asSpec()],m.map((()=>h.asSpec())).toArray()])}]),fieldBehaviours:Gl([xg.config({disabled:()=>!e.enabled||r.isDisabled(),onDisabled:e=>{bk.getField(e).each(xg.disable),h.getOpt(e).each(xg.disable)},onEnabled:e=>{bk.getField(e).each(xg.enable),h.getOpt(e).each(xg.enable)}}),hx(),Pp("url-input-events",[ea(u,(t=>{ig.getCurrent(t).each((o=>{const n=Jm.getValue(o),r={fieldname:e.name,...n};m.each((n=>{n(r).get((n=>{Jm.setValue(o,n),$s(t,Tk,{name:e.name})}))}))}))}))])])})})(e,t,t.urlinput,o))),customeditor:SD((e=>{const t=_c(),o=Lf({dom:{tag:e.tag}}),n=_c(),r=!iT(e)&&e.onFocus.isSome()?[Up.config({onFocus:t=>{e.onFocus.each((e=>{e(t.element.dom)}))}}),xk.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:Gl([Pp("custom-editor-events",[la((r=>{o.getOpt(r).each((o=>{(iT(e)?e.init(o.element.dom):aT.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)}))}))}))]),tT(D.none(),(()=>t.get().fold((()=>n.get().getOr("")),(e=>e.getValue()))),((e,o)=>{t.get().fold((()=>n.set(o)),(e=>e.setValue(o)))})),YE()].concat(r)),components:[o.asSpec()]}})),htmlpanel:SD(((e,t)=>((e,t)=>"presentation"===e.presets?hk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html},containerBehaviours:Gl([lx.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{Li(e.element,"[data-mce-tooltip]:hover").orThunk((()=>ac(e.element))).each((o=>{Tt(o,"data-mce-tooltip").each((o=>{lx.setComponents(e,t.tooltips.getComponents({tooltipText:o}))}))}))}}),mode:"children-normal",anchor:e=>({type:"node",node:Li(e.element,"[data-mce-tooltip]:hover").orThunk((()=>ac(e.element).filter((e=>Tt(e,"data-mce-tooltip").isSome())))),root:e.element,layouts:{onLtr:w([Rl,Nl,Ol,Al,Dl,Ml]),onRtl:w([Rl,Nl,Ol,Al,Dl,Ml])},bubble:jc(0,-2,{})})})])}):hk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:Gl([xk.config({}),Up.config({})])}))(e,t.shared.providers))),imagepreview:SD(((e,t,o)=>BT(e,o))),table:SD(((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"th",innerHtml:t.translate(e)}}),n=e=>({dom:{tag:"td",innerHtml:t.translate(e)}}),r=e=>({dom:{tag:"tr"},components:F(e,n)});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(a=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:F(a,o)}]}),(s=e.cells,{dom:{tag:"tbody"},components:F(s,r)})],behaviours:Gl([xk.config({}),Up.config({})])};var s,a})(e,t.shared.providers))),tree:SD(((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(v),n=e.onToggleExpand.getOr(v),r=e.defaultExpandedIds,s=Ir(r),a=Ir(e.defaultSelectedId),i=wa("tree-id"),l=(n,r)=>e.items.map((e=>"leaf"===e.type?NO({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):PO({directory:e,selectedId:n,onLeafAction:o,expandedIds:r,labelTabstopping:!0,treeId:i,backstage:t})));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),s.get()),behaviours:Gl([Op.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),Pp(FO,[ea("expand-tree-node",((e,t)=>{const{expanded:o,node:r}=t.event;s.set(o?[...s.get(),r]:s.get().filter((e=>e!==r))),n(s.get(),{expanded:o,node:r})}))]),ec.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(D.some(t.value)),Ip.set(e,l(D.some(t.value),s.get()))}}}}),Ip.config({})])}})(e,t))),panel:SD(((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:F(e.items,t.shared.interpreter)}))(e,t)))},_D={field:(e,t)=>t,record:w([])},ED=(e,t,o,n)=>{const r=Cn(n,{shared:{interpreter:t=>TD(e,t,o,r)}});return TD(e,t,o,r)},TD=(e,t,o,n)=>ve(kD,t.type).fold((()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t)),(r=>r(e,t,o,n))),OD=(e,t,o)=>TD(_D,e,t,o),DD="layout-inset",AD=e=>e.x,MD=(e,t)=>e.x+e.width/2-t.width/2,ND=(e,t)=>e.x+e.width-t.width,RD=e=>e.y,BD=(e,t)=>e.y+e.height-t.height,LD=(e,t)=>e.y+e.height/2-t.height/2,HD=(e,t,o)=>ll(ND(e,t),BD(e,t),o.insetSouthwest(),gl(),"southwest",wl(e,{right:0,bottom:3}),DD),ID=(e,t,o)=>ll(AD(e),BD(e,t),o.insetSoutheast(),ul(),"southeast",wl(e,{left:1,bottom:3}),DD),PD=(e,t,o)=>ll(ND(e,t),RD(e),o.insetNorthwest(),ml(),"northwest",wl(e,{right:0,top:2}),DD),FD=(e,t,o)=>ll(AD(e),RD(e),o.insetNortheast(),dl(),"northeast",wl(e,{left:1,top:2}),DD),zD=(e,t,o)=>ll(MD(e,t),RD(e),o.insetNorth(),hl(),"north",wl(e,{top:2}),DD),VD=(e,t,o)=>ll(MD(e,t),BD(e,t),o.insetSouth(),pl(),"south",wl(e,{bottom:3}),DD),ZD=(e,t,o)=>ll(ND(e,t),LD(e,t),o.insetEast(),vl(),"east",wl(e,{right:0}),DD),UD=(e,t,o)=>ll(AD(e),LD(e,t),o.insetWest(),fl(),"west",wl(e,{left:1}),DD),jD=e=>{switch(e){case"north":return zD;case"northeast":return FD;case"northwest":return PD;case"south":return VD;case"southeast":return ID;case"southwest":return HD;case"east":return ZD;case"west":return UD}},WD=(e,t,o,n,r)=>wc(n).map(jD).getOr(zD)(e,t,o,n,r),$D=e=>{switch(e){case"north":return VD;case"northeast":return ID;case"northwest":return HD;case"south":return zD;case"southeast":return FD;case"southwest":return PD;case"east":return UD;case"west":return ZD}},qD=(e,t,o,n,r)=>wc(n).map($D).getOr(zD)(e,t,o,n,r),GD={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},KD=(e,t,o)=>{const n={maxHeightFunction:zc()};return()=>o()?{type:"node",root:ft(pt(e())),node:D.from(e()),bubble:jc(12,12,GD),layouts:{onRtl:()=>[FD],onLtr:()=>[PD]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:jc(-12,12,GD),layouts:{onRtl:()=>[Ol,Dl,Rl],onLtr:()=>[Dl,Ol,Rl]},overrides:n}},YD=(e,t,o,n)=>{const r={maxHeightFunction:zc()};return()=>n()?{type:"node",root:ft(pt(t())),node:D.from(t()),bubble:jc(12,12,GD),layouts:{onRtl:()=>[zD],onLtr:()=>[zD]},overrides:r}:e?{type:"node",root:ft(pt(t())),node:D.from(t()),bubble:jc(0,-Wt(t()),GD),layouts:{onRtl:()=>[Nl],onLtr:()=>[Nl]},overrides:r}:{type:"hotspot",hotspot:o(),bubble:jc(0,0,GD),layouts:{onRtl:()=>[Nl],onLtr:()=>[Nl]},overrides:r}},XD=(e,t,o)=>()=>o()?{type:"node",root:ft(pt(e())),node:D.from(e()),layouts:{onRtl:()=>[zD],onLtr:()=>[zD]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[Rl],onLtr:()=>[Rl]}},JD=(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:Le.fromDom(e),lastCell:Le.fromDom(t)};return D.some(n)}return D.some(vd.range(Le.fromDom(t.startContainer),t.startOffset,Le.fromDom(t.endContainer),t.endOffset))}}),QD=e=>t=>({type:"node",root:e(),node:t}),eA=(e,t,o,n)=>{const r=$b(e),s=()=>Le.fromDom(e.getBody()),a=()=>Le.fromDom(e.getContentAreaContainer()),i=()=>r||!n();return{inlineDialog:KD(a,t,i),inlineBottomDialog:YD(e.inline,a,o,i),banner:XD(a,t,i),cursor:JD(e,s),node:QD(s)}},tA=e=>(t,o)=>{KC(e)(t,o)},oA=e=>()=>BC(e),nA=e=>t=>AC(e,t),rA=e=>t=>RC(e,t),sA=e=>()=>Eb(e),aA=e=>ye(e,"items"),iA=e=>ye(e,"format"),lA=[{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"}]}],cA=e=>j(e,((e,t)=>{if(be(t,"items")){const o=cA(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if((e=>be(e,"inline"))(t)||(e=>be(e,"block"))(t)||(e=>be(e,"selector"))(t)){const o=`custom-${s(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:[]}),dA=e=>sb(e).map((t=>{const o=((e,t)=>{const o=cA(t),n=t=>{z(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 ab(e)?lA.concat(o):o})).getOr(lA),mA=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),uA=(e,t,o,n)=>{const r=t=>F(t,(t=>aA(t)?(e=>{const t=r(e.items);return{...e,type:"submenu",getStyleItems:w(t)}})(t):iA(t)?(e=>mA(e,o,n))(t):(e=>{const t=ae(e);return 1===t.length&&L(t,"title")})(t)?{...t,type:"separator"}:(t=>{const r=s(t.name)?t.name:wa(t.title),a=`custom-${r}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(r,i),i})(t)));return r(t)},gA=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[Si(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:w(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:()=>{t--}}),getComponents:o}},hA=lT.trim,pA=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},fA=pA("true"),vA=pA("false"),bA=(e,t,o,n,r)=>({type:e,title:t,url:o,level:n,attach:r}),yA=e=>e.innerText||e.textContent,wA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&CA(e),xA=e=>e&&/^(H[1-6])$/.test(e.nodeName),CA=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return fA(t)}return!1})(e)&&!vA(e),SA=e=>xA(e)&&CA(e),kA=e=>{var t;const o=(e=>e.id?e.id:wa("h"))(e);return bA("header",null!==(t=yA(e))&&void 0!==t?t:"","#"+o,(e=>xA(e)?parseInt(e.nodeName.substr(1),10):0)(e),(()=>{e.id=o}))},_A=e=>{const t=e.id||e.name,o=yA(e);return bA("anchor",o||"#"+t,"#"+t,0,v)},EA=e=>{const t=(o="h1,h2,h3,h4,h5,h6,a:not([href])",n=e,F(Ed(Le.fromDom(n),o),(e=>e.dom)));var o,n;return t},TA=e=>hA(e.title).length>0,OA=e=>{const t=EA(e);return Z((e=>F(Z(e,SA),kA))(t).concat((e=>F(Z(e,wA),_A))(t)),TA)},DA="tinymce-url-history",AA=e=>s(e)&&/^https?/.test(e),MA=e=>a(e)&&pe(e,(e=>{return!(l(t=e)&&t.length<=5&&K(t,AA));var t})).isNone(),NA=()=>{const e=vC.getItem(DA);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+DA+" was not valid JSON",e),{};throw e}return MA(t)?t:(console.log("Local storage "+DA+" was not valid format",t),{})},RA=e=>{const t=NA();return ve(t,e).getOr([])},BA=(e,t)=>{if(!AA(e))return;const o=NA(),n=ve(o,t).getOr([]),r=Z(n,(t=>t!==e));o[t]=[e].concat(r).slice(0,5),(e=>{if(!MA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));vC.setItem(DA,JSON.stringify(e))})(o)},LA=e=>!!e,HA=e=>ce(lT.makeMap(e,/[, ]/),LA),IA=e=>D.from(yb(e)),PA=(e,t)=>{const o=(e=>{const t=D.from(Cb(e)).filter(LA).map(HA);return IA(e).fold(T,(e=>t.fold(O,(e=>ae(e).length>0&&e))))})(e);return d(o)?o?IA(e):D.none():o[t]?IA(e):D.none()},FA=e=>D.from(e).filter(s).getOrUndefined(),zA=e=>({getHistory:RA,addToHistory:BA,getLinkInformation:()=>(e=>Sb(e)?D.some({targets:OA(e.getBody()),anchorTop:FA(kb(e)),anchorBottom:FA(_b(e))}):D.none())(e),getValidationHandler:()=>(e=>D.from(wb(e)))(e),getUrlPicker:t=>((e,t)=>PA(e,t).map((o=>n=>xS((r=>{const i={filetype:t,fieldname:n.fieldname,...D.from(n.meta).getOr({})};o.call(e,((e,t)=>{if(!s(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");r({value:e,meta:t})}),n.value,i)})))))(e,t)}),VA=(e,t,o,n)=>{const r=Ir(!1),s=(e=>{const t=Ir(jb(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:Nv.translate,isDisabled:()=>t.mode.isReadOnly()||!t.ui.isEnabled(),getOption:t.options.get,tooltips:gA(e.dialog)},i=zA(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},n=Ir([]),r=Ir([]),s=Ir(!1);return e.on("PreInit",(r=>{const s=dA(e),a=uA(e,s,t,o);n.set(a)})),e.on("addStyleModifications",(n=>{const a=uA(e,n.items,t,o);r.set(a),s.set(n.replace)})),{getData:()=>{const e=s.get()?[]:n.get(),t=r.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:tA(e),hasCustomColors:oA(e),getColors:nA(e),getColorCols:rA(e)}))(t),d=(e=>({isDraggableModal:sA(e)}))(t),m={shared:{providers:a,anchors:eA(t,o,n,s.isPositionedAtTop),header:s},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>r.get(),setContextMenuState:e=>r.set(e)},u={...m,shared:{...m.shared,interpreter:e=>OD(e,{},u),getSink:e.popup}},g={...m,shared:{...m.shared,interpreter:e=>OD(e,{},g),getSink:e.dialog}};return{popup:u,dialog:g}},ZA=Yu,UA=Ru,jA=w([Or("shell",!1),mr("makeItem"),Or("setupItem",v),ou("listBehaviours",[Ip])]),WA=Au({name:"items",overrides:()=>({behaviours:Gl([Ip.config({})])})}),$A=w([WA]),qA=ng({name:w("CustomList")(),configFields:jA(),partFields:$A(),factory:(e,t,o,n)=>{const r=e.shell?{behaviours:[Ip.config({})],components:[]}:{behaviours:[],components:t},s=t=>e.shell?D.some(t):Zu(t,e,"items");return{uid:e.uid,dom:e.dom,components:r.components,behaviours:tu(e.listBehaviours,r.behaviours),apis:{setItems:(t,o)=>{s(t).fold((()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")}),(n=>{const r=Ip.contents(n),s=o.length,a=s-r.length,i=a>0?I(a,(()=>e.makeItem())):[],l=r.slice(s);z(l,(e=>Ip.remove(n,e))),z(i,(e=>Ip.append(n,e)));const c=Ip.contents(n);z(c,((n,r)=>{e.setupItem(t,n,o[r],r)}))}))}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),GA=w([mr("dom"),Or("shell",!0),Qm("toolbarBehaviours",[Ip])]),KA=w([Au({name:"groups",overrides:()=>({behaviours:Gl([Ip.config({})])})})]),YA=ng({name:"Toolbar",configFields:GA(),partFields:KA(),factory:(e,t,o,n)=>{const r=t=>e.shell?D.some(t):Zu(t,e,"groups"),s=e.shell?{behaviours:[Ip.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:tu(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(e,t)=>{r(e).fold((()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")}),(e=>{Ip.set(e,t)}))},refresh:v},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),XA=v,JA=T,QA=w([]);var eM=Object.freeze({__proto__:null,setup:XA,isDocked:JA,getBehaviours:QA});const tM=e=>(we(It(e,"position"),"fixed")?D.none():at(e)).orThunk((()=>{const t=Le.fromTag("span");return rt(e).bind((e=>{Io(e,t);const o=at(t);return zo(t),o}))})),oM=e=>tM(e).map(Kt).getOrThunk((()=>qt(0,0))),nM=(e,t)=>{const o=e.element;oi(o,t.transitionClass),ri(o,t.fadeOutClass),oi(o,t.fadeInClass),t.onShow(e)},rM=(e,t)=>{const o=e.element;oi(o,t.transitionClass),ri(o,t.fadeInClass),oi(o,t.fadeOutClass),t.onHide(e)},sM=(e,t)=>e.y>=t.y,aM=(e,t)=>e.bottom<=t.bottom,iM=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),lM=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),cM=e=>e.box.x-e.win.x,dM=(e,t,o)=>o.getInitialPos().map((o=>{const n=((e,t)=>{const o=t.optScrollEnv.fold(w(e.bounds.y),(t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop)));return qt(e.bounds.x,o)})(o,t);return{box:Ko(n.left,n.top,Jt(e),jt(e)),location:o.location}})),mM=(e,t,o,n,r)=>{const s=((e,t)=>{const o=t.optScrollEnv.fold(w(e.y),(t=>e.y+t.currentScrollTop-t.scrollElmTop));return qt(e.x,o)})(t,o),a=Ko(s.left,s.top,t.width,t.height);n.setInitialPos({style:Pt(e),position:Lt(e,"position")||"static",bounds:a,location:r.location})},uM=(e,t,o)=>o.getInitialPos().bind((n=>{var r;switch(o.clearInitialPos(),n.position){case"static":return D.some({morph:"static"});case"absolute":const o=tM(e).getOr(xt()),s=Yo(o),a=null!==(r=o.dom.scrollTop)&&void 0!==r?r:0;return D.some({morph:"absolute",positionCss:lc("absolute",ve(n.style,"left").map((e=>t.x-s.x)),ve(n.style,"top").map((e=>t.y-s.y+a)),ve(n.style,"right").map((e=>s.right-t.right)),ve(n.style,"bottom").map((e=>s.bottom-t.bottom)))});default:return D.none()}})),gM=(e,t,o)=>dM(e,t,o).filter((({box:e})=>((e,t,o)=>K(e,(e=>{switch(e){case"bottom":return aM(t,o.bounds);case"top":return sM(t,o.bounds)}})))(o.getModes(),e,t))).bind((({box:t})=>uM(e,t,o))),hM=e=>{switch(e.location){case"top":return D.some({morph:"fixed",positionCss:lc("fixed",D.some(e.leftX),D.some(e.topY),D.none(),D.none())});case"bottom":return D.some({morph:"fixed",positionCss:lc("fixed",D.some(e.leftX),D.none(),D.none(),D.some(e.bottomY))});default:return D.none()}},pM=(e,t,o)=>{const n=Yo(e),r=Qo(),s=((e,t,o)=>{const n=t.win,r=t.box,s=cM(t);return se(e,(e=>{switch(e){case"bottom":return aM(r,o.bounds)?D.none():D.some(lM(n,s,o));case"top":return sM(r,o.bounds)?D.none():D.some(iM(n,s,o));default:return D.none()}})).getOr({location:"no-dock"})})(o.getModes(),{win:r,box:n},t);return"top"===s.location||"bottom"===s.location?(mM(e,n,t,o,s),hM(s)):D.none()},fM=(e,t,o)=>{const n=e.element;return we(It(n,"position"),"fixed")?((e,t,o)=>gM(e,t,o).orThunk((()=>t.optScrollEnv.bind((n=>dM(e,t,o))).bind((({box:e,location:o})=>{const n=Qo(),r=cM({win:n,box:e}),s="top"===o?iM(n,r,t):lM(n,r,t);return hM(s)})))))(n,t,o):pM(n,t,o)},vM=(e,t,o,n)=>{const r=Yo(e),s=Qo(),a=n(s,cM({win:s,box:r}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,r)=>{n.getInitialPos().fold((()=>mM(e,t,o,n,r)),(()=>v))})(e,r,t,o,a),hM(a)):D.none()},bM=(e,t,o)=>{o.setDocked(!1),z(["left","right","top","bottom","position"],(t=>zt(e.element,t))),t.onUndocked(e)},yM=(e,t,o,n)=>{const r="fixed"===n.position;o.setDocked(r),cc(e.element,n);(r?t.onDocked:t.onUndocked)(e)},wM=(e,t,o,n,r=!1)=>{t.contextual.each((t=>{t.lazyContext(e).each((s=>{const a=((e,t)=>e.yt.y)(s,n.bounds);if(a!==o.isVisible())if(o.setVisible(a),r&&!a)ii(e.element,[t.fadeOutClass]),t.onHide(e);else{(a?nM:rM)(e,t)}}))}))},xM=(e,t,o,n,r)=>{wM(e,t,o,n,!0),yM(e,t,o,r.positionCss)},CM=(e,t,o)=>{const n=t.lazyViewport(e);wM(e,t,o,n),fM(e,n,o).each((r=>{((e,t,o,n,r)=>{switch(r.morph){case"static":return bM(e,t,o);case"absolute":return yM(e,t,o,r.positionCss);case"fixed":xM(e,t,o,n,r)}})(e,t,o,n,r)}))},SM=(e,t,o)=>{const n=e.element;o.setDocked(!1);const r=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return dM(n,t,o).bind((({box:e})=>uM(n,e,o)))})(e,r,o).each((n=>{switch(n.morph){case"static":bM(e,t,o);break;case"absolute":yM(e,t,o,n.positionCss)}})),o.setVisible(!0),t.contextual.each((t=>{li(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)})),kM(e,t,o)},kM=(e,t,o)=>{e.getSystem().isConnected()&&CM(e,t,o)},_M=(e,t,o)=>{o.isDocked()&&SM(e,t,o)},EM=e=>(t,o,n)=>{const r=o.lazyViewport(t);vM(t.element,r,n,e).each((e=>{xM(t,o,n,r,e)}))},TM=EM(iM),OM=EM(lM);var DM=Object.freeze({__proto__:null,refresh:kM,reset:_M,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:TM,forceDockToBottom:OM});var AM=Object.freeze({__proto__:null,events:(e,t)=>Xs([ia(hs(),((o,n)=>{e.contextual.each((e=>{if(ai(o.element,e.transitionClass)){li(o.element,[e.transitionClass,e.fadeInClass]);(t.isVisible()?e.onShown:e.onHidden)(o)}n.stop()}))})),ea(Ns(),((o,n)=>{kM(o,e,t)})),ea(zs(),((o,n)=>{kM(o,e,t)})),ea(Rs(),((o,n)=>{_M(o,e,t)}))])}),MM=[Tr("contextual",[hr("fadeInClass"),hr("fadeOutClass"),hr("transitionClass"),fr("lazyContext"),tl("onShow"),tl("onShown"),tl("onHide"),tl("onHidden")]),Br("lazyViewport",(()=>({bounds:Qo(),optScrollEnv:D.none()}))),Lr("modes",["top","bottom"],qn),tl("onDocked"),tl("onUndocked")];const NM=Yl({fields:MM,name:"docking",active:AM,apis:DM,state:Object.freeze({__proto__:null,init:e=>{const t=Ir(!1),o=Ir(!0),n=_c(),r=Ir(e.modes);return Pa({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:r.get,setModes:r.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${r.get().join(",")}`})}})}),RM=w(wa("toolbar-height-change")),BM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},LM="tox-tinymce--toolbar-sticky-on",HM="tox-tinymce--toolbar-sticky-off",IM=(e,t)=>L(NM.getModes(e),t),PM=e=>{const t=e.element;st(t).each((o=>{const n="padding-"+NM.getModes(e)[0];if(NM.isDocked(e)){const e=Jt(o);Nt(t,"width",e+"px"),Nt(o,n,(e=>Wt(e)+(parseInt(Lt(e,"margin-top"),10)||0)+(parseInt(Lt(e,"margin-bottom"),10)||0))(t)+"px")}else zt(t,"width"),zt(o,n)}))},FM=(e,t)=>{t?(ri(e,BM.fadeOutClass),ii(e,[BM.transitionClass,BM.fadeInClass])):(ri(e,BM.fadeInClass),ii(e,[BM.fadeOutClass,BM.transitionClass]))},zM=(e,t)=>{const o=Le.fromDom(e.getContainer());t?(oi(o,LM),ri(o,HM)):(oi(o,HM),ri(o,LM))},VM=(e,t)=>{const o=_c(),n=t.getSink,r=e=>{n().each((t=>e(t.element)))},s=t=>{e.inline||PM(t),zM(e,NM.isDocked(t)),t.getSystem().broadcastOn([Bm()],{}),n().each((e=>e.getSystem().broadcastOn([Bm()],{})))},a=e.inline?[]:[ec.config({channels:{[RM()]:{onReceive:PM}}})];return[Up.config({}),NM.config({contextual:{lazyContext:t=>{const o=Wt(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return D.from(n).map((n=>{const r=Yo(Le.fromDom(n));return QS(e,t.element).fold((()=>{const e=r.height-o,n=r.y+(IM(t,"top")?0:o);return Ko(r.x,n,r.width,e)}),(e=>{const n=Jo(r,ek(e)),s=IM(t,"top")?n.y:n.y+o;return Ko(n.x,s,n.width,n.height-o)}))}))},onShow:()=>{r((e=>FM(e,!0)))},onShown:e=>{r((e=>li(e,[BM.transitionClass,BM.fadeInClass]))),o.get().each((t=>{((e,t)=>{const o=et(t);sc(o).filter((e=>!Je(t,e))).filter((t=>Je(t,Le.fromDom(o.dom.body))||Qe(e,t))).each((()=>oc(t)))})(e.element,t),o.clear()}))},onHide:e=>{((e,t)=>ac(e).orThunk((()=>t().toOptional().bind((e=>ac(e.element))))))(e.element,n).fold(o.clear,o.set),r((e=>FM(e,!1)))},onHidden:()=>{r((e=>li(e,[BM.transitionClass])))},...BM},lazyViewport:t=>QS(e,t.element).fold((()=>{const o=Qo(),n=fb(e),r=o.y+(IM(t,"top")?n:0),s=o.height-(IM(t,"bottom")?n:0);return{bounds:Ko(o.x,r,o.width,s),optScrollEnv:D.none()}}),(e=>({bounds:ek(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})}))),modes:[t.header.getDockingMode()],onDocked:s,onUndocked:s}),...a]};var ZM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",(()=>{o().each(NM.reset)})),e.on("ResizeWindow ResizeEditor",(()=>{o().each(PM)})),e.on("SkinLoaded",(()=>{o().each((e=>{NM.isDocked(e)?NM.reset(e):NM.refresh(e)}))})),e.on("FullscreenStateChanged",(()=>{o().each(NM.reset)}))),e.on("AfterScrollIntoView",(e=>{o().each((t=>{NM.refresh(t);const o=t.element;xh(o)&&((e,t)=>{const o=et(t),n=nt(t).dom.innerHeight,r=Vo(o),s=Le.fromDom(e.elm),a=Xo(s),i=jt(s),l=a.y,c=l+i,d=Kt(t),m=jt(t),u=d.top,g=u+m,h=Math.abs(u-r.top)<2,p=Math.abs(g-(r.top+n))<2;if(h&&lu){const e=l-n+i+m;Zo(r.left,e,o)}})(e,o)}))})),e.on("PostRender",(()=>{zM(e,!1)}))},isDocked:e=>e().map(NM.isDocked).getOr(!1),getBehaviours:VM});const UM=Fn([Zy,ur("items",Vn([Un([Uy,yr("items",qn)]),qn]))].concat(bw)),jM=[Sr("text"),Sr("tooltip"),Sr("icon"),Dr("search",!1,Vn([Gn,Fn([Sr("placeholder")])],(e=>d(e)?e?D.some({placeholder:D.none()}):D.none():D.some(e)))),fr("fetch"),Br("onSetup",(()=>v))],WM=Fn([Zy,...jM]),$M=e=>or("menubutton",WM,e),qM=Fn([Zy,nw,ow,tw,aw,Ky,Qy,Nr("presets","normal",["normal","color","listpreview"]),mw(1),Xy,Jy]);var GM=og({factory:(e,t)=>{const o={focus:Op.focusIn,setMenus:(e,o)=>{const n=F(o,(e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=$M(o).mapError((e=>sr(e))).getOrDie();return OO(n,"tox-mbtn",t.backstage,D.some("menuitem"))}));Ip.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:Gl([Ip.config({}),Pp("menubar-events",[la((t=>{e.onSetup(t)})),ea(ss(),((e,t)=>{Li(e.element,".tox-mbtn--active").each((o=>{Hi(t.event.target,".tox-mbtn").each((t=>{Je(o,t)||e.getSystem().getByDom(o).each((o=>{e.getSystem().getByDom(t).each((e=>{IS.expand(e),IS.close(o),Up.focus(e)}))}))}))}))})),ea(Ps(),((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=>{IS.isOpen(o)&&(IS.expand(e),IS.close(o))}))}))}))]),Op.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),D.some(!0))}),xk.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[mr("dom"),mr("uid"),mr("onEscape"),mr("backstage"),Or("onSetup",v)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const KM="container",YM=[Qm("slotBehaviours",[])],XM=e=>"",JM=(e,t)=>{const o=t=>$u(e),n=(t,o)=>(n,r)=>Zu(n,e,r).map((e=>t(e,r))).getOr(o),r=(e,t)=>"true"!==Et(e.element,"aria-hidden"),s=n(r,!1),a=n(((e,t)=>{if(r(e)){const o=e.element;Nt(o,"display","none"),kt(o,"aria-hidden","true"),$s(e,Fs(),{name:t,visible:!1})}})),i=(e=>(t,o)=>{z(o,(o=>e(t,o)))})(a),l=n(((e,t)=>{if(!r(e)){const o=e.element;zt(o,"display"),Dt(o,"aria-hidden"),$s(e,Fs(),{name:t,visible:!0})}})),c={getSlotNames:o,getSlot:(t,o)=>Zu(t,e,o),isShowing:s,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.slotBehaviours),apis:c}},QM=ce({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=>Ha(e))),eN={...QM,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),Iu(KM,XM(t),o)),record:w(e)}})(),o=e(t),n=t.record(),r=F(n,(e=>Ou({name:e,pname:XM(e)})));return Ju(KM,YM,r,JM,o)}},tN=Fn([ow,nw,Br("onShow",v),Br("onHide",v),Qy]),oN=e=>({element:()=>e.element.dom}),nN=(e,t)=>{const o=F(ae(t),(e=>{const o=t[e],n=nr((e=>or("sidebar",tN,e))(o));return{name:e,getApi:oN,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}}));return F(o,(t=>{const n=Ir(v);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Xw([wx(t,n),xx(t,n),ea(Fs(),((e,t)=>{const n=t.event,r=W(o,(e=>e.name===n.name));r.each((t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))}))}))])})}))},rN=e=>eN.sketch((t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:nN(t,e),slotBehaviours:Xw([la((e=>eN.hideAllSlots(e)))])}))),sN=(e,t)=>{kt(e,"role",t)},aN=e=>ig.getCurrent(e).bind((e=>{if(EO.isGrowing(e)||EO.hasGrown(e)){return ig.getCurrent(e).bind((e=>W(eN.getSlotNames(e),(t=>eN.isShowing(e,t)))))}return D.none()})),iN=wa("FixSizeEvent"),lN=wa("AutoSizeEvent");var cN=Object.freeze({__proto__:null,block:(e,t,o,n)=>{kt(e.element,"aria-busy",!0);const r=t.getRoot(e).getOr(e),s=Gl([Op.config({mode:"special",onTab:()=>D.some(!0),onShiftTab:()=>D.some(!0)}),Up.config({})]),a=n(r,s),i=r.getSystem().build(a);Ip.append(r,Oi(i)),i.hasConfigured(Op)&&t.focus&&Op.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith((()=>Ip.remove(r,i)))},unblock:(e,t,o)=>{Dt(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),dN=[Br("getRoot",D.none),Rr("focus",!0),tl("onBlock"),tl("onUnblock")];const mN=Yl({fields:dN,name:"blocking",apis:cN,state:Object.freeze({__proto__:null,init:()=>{const e=Sc((e=>e.destroy()));return Pa({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})}),uN=e=>ig.getCurrent(e).each((e=>oc(e.element,!0))),gN=(e,t,o,n)=>{const r=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;D.from(e.iframeElement).map(Le.fromDom).each((e=>{t?(Tt(e,o).each((t=>kt(e,n,t))),kt(e,o,-1)):(Dt(e,o),Tt(e,n).each((t=>{kt(e,o,t),Dt(e,n)})))}))})(e,o),o)mN.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:Bf('
    ')}]}))(n)),zt(r,"display"),Dt(r,"aria-hidden"),e.hasFocus()&&uN(t);else{const o=ig.getCurrent(t).exists((e=>rc(e.element)));mN.unblock(t),Nt(r,"display","none"),kt(r,"aria-hidden","true"),o&&e.focus()}},hN=(e,t,o)=>{const n=Ir(!1),r=_c(),s=o=>{n.get()&&!(e=>{if((e=>"focusin"===e.type)(e))return(e.composed?oe(e.composedPath()):D.from(e.target)).map(Le.fromDom).filter(je).exists((e=>ai(e,"mce-pastebin")));return!1})(o)&&(o.preventDefault(),uN(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",(()=>{e.dom.bind(e.getWin(),"focusin",s),e.on("BeforeExecCommand",(e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&s(e)}))}));const a=r=>{r!==n.get()&&(n.set(r),gN(e,t(),r,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,r))};e.on("ProgressState",(t=>{if(r.on(clearTimeout),p(t.time)){const o=Nf.setEditorTimeout(e,(()=>a(t.state)),t.time);r.set(o)}else a(t.state),r.clear()}))},pN=(e,t,o)=>({within:e,extra:t,withinWidth:o}),fN=(e,t,o)=>{const n=((e,t)=>{const o=j(e,((e,o)=>t(o,e.len).fold(w(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:0,list:[]});return o.list})(e,((e,t)=>{const n=o(e);return D.some({element:e,start:t,finish:t+n,width:n})})),r=Z(n,(e=>e.finish<=t)),s=U(r,((e,t)=>e+t.width),0);return{within:r,extra:n.slice(r.length),withinWidth:s}},vN=e=>F(e,(e=>e.element)),bN=(e,t,o,n)=>{const r=((e,t,o)=>{const n=fN(t,e,o);return 0===n.extra.length?D.some(n):D.none()})(e,t,o).getOrThunk((()=>fN(t,e-o(n),o))),s=r.within,a=r.extra,i=r.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=vN(e.concat(t));return pN(n,[],o)})(s,a,i):a.length>=1?((e,t,o,n)=>{const r=vN(e).concat([o]);return pN(r,vN(t),n)})(s,a,n,i):((e,t,o)=>pN(vN(e),[],o))(s,0,i)},yN=(e,t)=>{const o=F(t,(e=>Oi(e)));YA.setGroups(e,o)},wN=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const r=Uu(e,t,"primary"),s=fS.getCoupled(e,"overflowGroup");Nt(r.element,"visibility","hidden");const a=n.concat([s]),i=se(a,(e=>ac(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()))));o([]),yN(r,a);const l=Jt(r.element),c=bN(l,t.builtGroups.get(),(e=>Math.ceil(e.element.dom.getBoundingClientRect().width)),s);0===c.extra.length?(Ip.remove(r,s),o([])):(yN(r,c.within),o(c.extra)),zt(r.element,"visibility"),Vt(r.element),i.each(Up.focus)},xN=w([Qm("splitToolbarBehaviours",[fS]),cr("builtGroups",(()=>Ir([])))]),CN=w([Qi(["overflowToggledClass"]),_r("getOverflowBounds"),mr("lazySink"),cr("overflowGroups",(()=>Ir([]))),tl("onOpened"),tl("onClosed")].concat(xN())),SN=w([Ou({factory:YA,schema:GA(),name:"primary"}),Du({schema:GA(),name:"overflow"}),Du({name:"overflow-button"}),Du({name:"overflow-group"})]),kN=w(((e,t)=>{((e,t)=>{const o=Xt.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);Nt(e,"max-width",o+"px")})(e,Math.floor(t))})),_N=w([Qi(["toggledClass"]),mr("lazySink"),fr("fetch"),_r("getBounds"),Tr("fireDismissalEventInstead",[Or("event",Hs())]),Jc(),tl("onToggled")]),EN=w([Du({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:Gl([Xp.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Du({factory:YA,schema:GA(),name:"toolbar",overrides:e=>({toolbarBehaviours:Gl([Op.config({mode:"cyclic",onEscape:t=>(Zu(t,e,"button").each(Up.focus),D.none())})])})})]),TN=_c(),ON=(e,t)=>{const o=fS.getCoupled(e,"toolbarSandbox");Nm.isOpen(o)?Nm.close(o):Nm.open(o,t.toolbar())},DN=(e,t,o,n)=>{const r=o.getBounds.map((e=>e())),s=o.lazySink(e).getOrDie();sm.positionWithinBounds(s,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:kN()}}},r)},AN=(e,t,o,n,r)=>{YA.setGroups(t,r),DN(e,t,o,n),Xp.on(e)},MN=ng({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Rf.sketch({...n.button(),action:e=>{ON(e,n)},buttonBehaviours:nu({dump:n.button().buttonBehaviours},[fS.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Pi();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:Gl([Op.config({mode:"special",onEscape:e=>(Nm.close(e),D.some(!0))}),Nm.config({onOpen:(r,s)=>{const a=TN.get().getOr(!1);o.fetch().get((r=>{AN(e,s,o,t.layouts,r),n.link(e.element),a||Op.focusIn(s)}))},onClose:()=>{Xp.off(e),TN.get().getOr(!1)||Up.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>zi(o,n)||zi(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),ec.config({channels:{...Im({isExtraPart:T,...o.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Fm({doReposition:()=>{Nm.getState(fS.getCoupled(e,"toolbarSandbox")).each((n=>{DN(e,n,o,t.layouts)}))}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{Nm.getState(fS.getCoupled(t,"toolbarSandbox")).each((r=>{AN(t,r,e,o.layouts,n)}))},reposition:t=>{Nm.getState(fS.getCoupled(t,"toolbarSandbox")).each((n=>{DN(t,n,e,o.layouts)}))},toggle:e=>{ON(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{TN.set(!0),ON(e,t),TN.clear()})(e,n)},getToolbar:e=>Nm.getState(fS.getCoupled(e,"toolbarSandbox")),isOpen:e=>Nm.isOpen(fS.getCoupled(e,"toolbarSandbox"))}}),configFields:_N(),partFields:EN(),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)}}),NN=w([mr("items"),Qi(["itemSelector"]),Qm("tgroupBehaviours",[Op])]),RN=w([Mu({name:"items",unit:"item"})]),BN=ng({name:"ToolbarGroup",configFields:NN(),partFields:RN(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:tu(e.tgroupBehaviours,[Op.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),LN=e=>F(e,(e=>Oi(e))),HN=(e,t,o)=>{wN(e,o,(n=>{o.overflowGroups.set(n),t.getOpt(e).each((e=>{MN.setGroups(e,LN(n))}))}))},IN=ng({name:"SplitFloatingToolbar",configFields:CN(),partFields:SN(),factory:(e,t,o,n)=>{const r=Lf(MN.sketch({fetch:()=>xS((t=>{t(LN(e.overflowGroups.get()))})),layouts:{onLtr:()=>[Dl,Ol],onRtl:()=>[Ol,Dl],onBottomLtr:()=>[Ml,Al],onBottomRtl:()=>[Al,Ml]},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:tu(e.splitToolbarBehaviours,[fS.config({others:{overflowGroup:()=>BN.sketch({...n["overflow-group"](),items:[r.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(F(o,t.getSystem().build)),HN(t,r,e)},refresh:t=>HN(t,r,e),toggle:e=>{r.getOpt(e).each((e=>{MN.toggle(e)}))},toggleWithoutFocusing:e=>{r.getOpt(e).each(MN.toggleWithoutFocusing)},isOpen:e=>r.getOpt(e).map(MN.isOpen).getOr(!1),reposition:e=>{r.getOpt(e).each((e=>{MN.reposition(e)}))},getOverflow:e=>r.getOpt(e).bind(MN.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)}}),PN=w([Qi(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),tl("onOpened"),tl("onClosed")].concat(xN())),FN=w([Ou({factory:YA,schema:GA(),name:"primary"}),Ou({factory:YA,schema:GA(),name:"overflow",overrides:e=>({toolbarBehaviours:Gl([EO.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{Zu(t,e,"overflow-button").each((e=>{Xp.off(e),Up.focus(e)})),e.onClosed(t)},onGrown:t=>{Op.focusIn(t),e.onOpened(t)},onStartGrow:t=>{Zu(t,e,"overflow-button").each(Xp.on)}}),Op.config({mode:"acyclic",onEscape:t=>(Zu(t,e,"overflow-button").each(Up.focus),D.some(!0))})])})}),Du({name:"overflow-button",overrides:e=>({buttonBehaviours:Gl([Xp.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])})}),Du({name:"overflow-group"})]),zN=(e,t)=>{Zu(e,t,"overflow-button").bind((()=>Zu(e,t,"overflow"))).each((o=>{VN(e,t),EO.toggleGrow(o)}))},VN=(e,t)=>{Zu(e,t,"overflow").each((o=>{wN(e,t,(e=>{const t=F(e,(e=>Oi(e)));YA.setGroups(o,t)})),Zu(e,t,"overflow-button").each((e=>{EO.hasGrown(o)&&Xp.on(e)})),EO.refresh(o)}))},ZN=ng({name:"SplitSlidingToolbar",configFields:PN(),partFields:FN(),factory:(e,t,o,n)=>{const r="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:tu(e.splitToolbarBehaviours,[fS.config({others:{overflowGroup:e=>BN.sketch({...n["overflow-group"](),items:[Rf.sketch({...n["overflow-button"](),action:t=>{Ws(e,r)}})]})}}),Pp("toolbar-toggle-events",[ea(r,(t=>{zN(t,e)}))])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=F(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),VN(t,e)},refresh:t=>VN(t,e),toggle:t=>zN(t,e),isOpen:t=>((e,t)=>Zu(e,t,"overflow").map(EO.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)}}),UN=e=>{const t=e.title.fold((()=>({})),(e=>({attributes:{title:e}})));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[BN.parts.items({})],items:e.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:Gl([xk.config({}),Up.config({})])}},jN=e=>BN.sketch(UN(e)),WN=(e,t)=>{const o=la((t=>{const o=F(e.initGroups,jN);YA.setGroups(t,o)}));return Gl([bx(e.providers.isDisabled),hx(),Op.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Pp("toolbar-events",[o])])},$N=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":UN({title:D.none(),items:[]}),"overflow-button":nD({name:"more",icon:D.some("more-drawer"),enabled:!0,tooltip:D.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:D.none(),borderless:!1},D.none(),e.providers,[],"overflow-button")},splitToolbarBehaviours:WN(e,t)}},qN=e=>{const t=$N(e),o=IN.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return IN.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=Xo(t),n=ot(t),r=Xo(n),s=Math.max(n.dom.scrollHeight,r.height);return Ko(o.x+4,r.y,o.width-8,s)},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)})},GN=e=>{const t=ZN.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=ZN.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=$N(e);return ZN.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([RM()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([RM()],{type:"closed"}),e.onToggled(t,!1)}})},KN=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return YA.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===jv.scrolling?["tox-toolbar--scrolling"]:[])},components:[YA.parts.groups({})],toolbarBehaviours:WN(e,t)})},YN=[tw,ow,Sr("tooltip"),Nr("buttonType","secondary",["primary","secondary"]),Rr("borderless",!1),fr("onAction")],XN={button:[...YN,Wy,pr("type",["button"])],togglebutton:[...YN,Rr("active",!1),pr("type",["togglebutton"])]},JN=[pr("type",["group"]),Lr("buttons",[],ar("type",XN))],QN=ar("type",{...XN,group:JN}),eR=Fn([Lr("buttons",[],QN),fr("onShow"),fr("onHide")]),tR=(e,t)=>((e,t)=>{var o,n;const r="togglebutton"===e.type,s=e.icon.map((e=>VT(e,t.icons))).map(Lf),a=o=>{const n=e=>{s.map((n=>n.getOpt(o).each((o=>{Ip.set(o,[VT(e,t.icons)])}))))},a=e=>{const t=o.element;e?(oi(t,"tox-button--enabled"),kt(t,"aria-pressed",!0)):(ri(t,"tox-button--enabled"),Dt(t,"aria-pressed"))},i=()=>ai(o.element,"tox-button--enabled");return r?e.onAction({setIcon:n,setActive:a,isActive:i}):"button"===e.type?e.onAction({setIcon:n}):void 0},i={...e,name:r?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:D.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},l=rD(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),c=r?e.text.map(t.translate):D.some(t.translate(e.text)),d=c.map(Si),m=i.tooltip.or(c).map((e=>({"aria-label":t.translate(e)}))).getOr({}),u=s.map((e=>e.asSpec())),g=kx([u,d]),h=e.icon.isSome()&&d.isSome(),p={tag:"button",classes:l.concat(...e.icon.isSome()&&!h?["tox-button--icon"]:[]).concat(...h?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:m},f=oD(i,D.some(a),[],p,g,e.tooltip,t);return Rf.sketch(f)})(e,t),oR=Ao().deviceType,nR=oR.isPhone(),rR=oR.isTablet();var sR=ng({name:"silver.View",configFields:[mr("viewConfig")],partFields:[Au({factory:{sketch:e=>{let t=!1;const o=F(e.buttons,(o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:F(e.buttons,(e=>tR(e,t)))}))(o,e.providers)):tR(o,e.providers)));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...nR||rR?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:Gl([Up.config({}),Op.config({mode:"flow",selector:"button, .tox-button",focusInside:th.OnEnterOrSpaceMode})]),components:t?o:[hk.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),hk.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[mr("buttons"),mr("providers")],name:"header"}),Au({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const r={getPane:t=>ZA.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,apis:r}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const aR=(e,t,o)=>he(t,((t,n)=>{const r=nr(or("view",eR,t));return e.slot(n,sR.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:r,components:[...r.buttons.length>0?[sR.parts.header({buttons:r.buttons,providers:o})]:[],sR.parts.pane({})]}))})),iR=(e,t)=>eN.sketch((o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:aR(o,e,t),slotBehaviours:Xw([la((e=>eN.hideAllSlots(e)))])}))),lR=e=>W(eN.getSlotNames(e),(t=>eN.isShowing(e,t))),cR=(e,t,o)=>{eN.getSlot(e,t).each((e=>{sR.getPane(e).each((t=>{var n;o(e)((n=t.element.dom,{getContainer:w(n)}))}))}))};var dR=og({factory:(e,t)=>{const o={setViews:(e,o)=>{Ip.set(e,[iR(o,t.backstage.shared.providers)])},whichView:e=>ig.getCurrent(e).bind(lR),toggleView:(e,t,o,n)=>ig.getCurrent(e).exists((r=>{const s=lR(r),a=s.exists((e=>n===e)),i=eN.getSlot(r,n).isSome();return i&&(eN.hideAllSlots(r),a?((e=>{const t=e.element;Nt(t,"display","none"),kt(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;zt(t,"display"),Dt(t,"aria-hidden")})(e),eN.showSlot(r,n),((e,t)=>{cR(e,t,sR.getOnShow)})(r,n)),s.each((e=>((e,t)=>cR(e,t,sR.getOnHide))(r,e)))),i}))};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:Gl([Ip.config({}),ig.config({find:e=>{const t=Ip.contents(e);return oe(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[mr("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,r)=>e.toggleView(t,o,n,r),whichView:(e,t)=>e.whichView(t)}});const mR=UA.optional({factory:GM,name:"menubar",schema:[mr("backstage")]}),uR=UA.optional({factory:{sketch:e=>qA.sketch({uid:e.uid,dom:e.dom,listBehaviours:Gl([Op.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>KN({type:e.type,uid:wa("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),D.some(!0))}),setupItem:(e,t,o,n)=>{YA.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[mr("dom"),mr("onEscape")]}),gR=UA.optional({factory:{sketch:e=>{const t=(e=>e.type===jv.sliding?GN:e.type===jv.floating?qN:KN)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),D.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:[mr("dom"),mr("onEscape"),mr("getSink")]}),hR=UA.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?VM:QA;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:Gl(o(t,e.sharedBackstage))}}},name:"header",schema:[mr("dom")]}),pR=UA.optional({factory:{sketch:e=>({uid:e.uid,dom:e.dom,components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/tinymce-self-hosted-premium-features/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:"⚡️Upgrade"}}]})},name:"promotion",schema:[mr("dom")]}),fR=UA.optional({name:"socket",schema:[mr("dom")]}),vR=UA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:Gl([xk.config({}),Up.config({}),EO.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=>{ig.getCurrent(e).each(eN.hideAllSlots),Ws(e,lN)},onGrown:e=>{Ws(e,lN)},onStartGrow:e=>{$s(e,iN,{width:It(e.element,"width").getOr("")})},onStartShrink:e=>{$s(e,iN,{width:Jt(e.element)+"px"})}}),Ip.config({}),ig.config({find:e=>{const t=Ip.contents(e);return oe(t)}})])}],behaviours:Gl([JE(0),Pp("sidebar-sliding-events",[ea(iN,((e,t)=>{Nt(e.element,"width",t.event.width)})),ea(lN,((e,t)=>{zt(e.element,"width")}))])])})},name:"sidebar",schema:[mr("dom")]}),bR=UA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:Gl([Ip.config({}),mN.config({focus:!1}),ig.config({find:e=>oe(e.components())})]),components:[]})},name:"throbber",schema:[mr("dom")]}),yR=UA.optional({factory:dR,name:"viewWrapper",schema:[mr("backstage")]}),wR=UA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var xR=ng({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const r={getSocket:t=>ZA.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{ZA.getPart(t,e,"sidebar").each((e=>((e,t,o)=>{ig.getCurrent(e).each((n=>{Ip.set(n,[rN(t)]);const r=null==o?void 0:o.toLowerCase();s(r)&&be(t,r)&&ig.getCurrent(n).each((t=>{eN.showSlot(t,r),EO.immediateGrow(n),zt(n.element,"width"),sN(e.element,"region")}))}))})(e,o,n)))},toggleSidebar:(t,o)=>{ZA.getPart(t,e,"sidebar").each((e=>((e,t)=>{ig.getCurrent(e).each((o=>{ig.getCurrent(o).each((n=>{EO.hasGrown(o)?eN.isShowing(n,t)?(EO.shrink(o),sN(e.element,"presentation")):(eN.hideAllSlots(n),eN.showSlot(n,t),sN(e.element,"region")):(eN.hideAllSlots(n),eN.showSlot(n,t),EO.grow(o),sN(e.element,"region"))}))}))})(e,o)))},whichSidebar:t=>ZA.getPart(t,e,"sidebar").bind(aN).getOrNull(),getHeader:t=>ZA.getPart(t,e,"header"),getToolbar:t=>ZA.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{ZA.getPart(t,e,"toolbar").each((e=>{const t=F(o,jN);e.getApis().setGroups(e,t)}))},setToolbars:(t,o)=>{ZA.getPart(t,e,"multiple-toolbar").each((e=>{const t=F(o,(e=>F(e,jN)));qA.setItems(e,t)}))},refreshToolbar:t=>{ZA.getPart(t,e,"toolbar").each((e=>e.getApis().refresh(e)))},toggleToolbarDrawer:t=>{ZA.getPart(t,e,"toolbar").each((e=>{Se(e.getApis().toggle,(t=>t(e)))}))},toggleToolbarDrawerWithoutFocusing:t=>{ZA.getPart(t,e,"toolbar").each((e=>{Se(e.getApis().toggleWithoutFocusing,(t=>t(e)))}))},isToolbarDrawerToggled:t=>ZA.getPart(t,e,"toolbar").bind((e=>D.from(e.getApis().isOpen).map((t=>t(e))))).getOr(!1),getThrobber:t=>ZA.getPart(t,e,"throbber"),focusToolbar:t=>{ZA.getPart(t,e,"toolbar").orThunk((()=>ZA.getPart(t,e,"multiple-toolbar"))).each((e=>{Op.focusIn(e)}))},setMenubar:(t,o)=>{ZA.getPart(t,e,"menubar").each((e=>{GM.setMenus(e,o)}))},focusMenubar:t=>{ZA.getPart(t,e,"menubar").each((e=>{GM.focus(e)}))},setViews:(t,o)=>{ZA.getPart(t,e,"viewWrapper").each((e=>{dR.setViews(e,o)}))},toggleView:(t,o)=>ZA.getPart(t,e,"viewWrapper").exists((e=>dR.toggleView(e,(()=>r.showMainView(t)),(()=>r.hideMainView(t)),o))),whichView:t=>ZA.getPart(t,e,"viewWrapper").bind(dR.whichView).getOrNull(),hideMainView:t=>{n=r.isToolbarDrawerToggled(t),n&&r.toggleToolbarDrawer(t),ZA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;Nt(t,"display","none"),kt(t,"aria-hidden","true")}))},showMainView:t=>{n&&r.toggleToolbarDrawer(t),ZA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;zt(t,"display"),Dt(t,"aria-hidden")}))}};return{uid:e.uid,dom:e.dom,components:t,apis:r,behaviours:e.behaviours}},configFields:[mr("dom"),mr("behaviours")],partFields:[hR,mR,gR,uR,fR,vR,pR,bR,yR,wR],apis:{getSocket:(e,t)=>e.getSocket(t),setSidebar:(e,t,o,n)=>{e.setSidebar(t,o,n)},toggleSidebar:(e,t,o)=>{e.toggleSidebar(t,o)},whichSidebar:(e,t)=>e.whichSidebar(t),getHeader:(e,t)=>e.getHeader(t),getToolbar:(e,t)=>e.getToolbar(t),setToolbar:(e,t,o)=>{e.setToolbar(t,o)},setToolbars:(e,t,o)=>{e.setToolbars(t,o)},refreshToolbar:(e,t)=>e.refreshToolbar(t),toggleToolbarDrawer:(e,t)=>{e.toggleToolbarDrawer(t)},toggleToolbarDrawerWithoutFocusing:(e,t)=>{e.toggleToolbarDrawerWithoutFocusing(t)},isToolbarDrawerToggled:(e,t)=>e.isToolbarDrawerToggled(t),getThrobber:(e,t)=>e.getThrobber(t),setMenubar:(e,t,o)=>{e.setMenubar(t,o)},focusMenubar:(e,t)=>{e.focusMenubar(t)},focusToolbar:(e,t)=>{e.focusToolbar(t)},setViews:(e,t,o)=>{e.setViews(t,o)},toggleView:(e,t,o)=>e.toggleView(t,o),whichView:(e,t)=>e.whichView(t)}});const CR={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 revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed inserttemplate codesample inserttable accordion | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"aidialog aishortcuts | spellchecker spellcheckerlanguage | autocorrect capitalization | a11ycheck code typography wordcount addtemplate"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},SR=e=>e.split(" "),kR=(e,t)=>{const o={...CR,...t.menus},n=ae(t.menus).length>0,r=void 0===t.menubar||!0===t.menubar?SR("file edit view insert format tools table help"):SR(!1===t.menubar?"":t.menubar),a=Z(r,(e=>{const o=be(CR,e);return n?o||ve(t.menus,e).exists((e=>be(e,"items"))):o})),i=F(a,(n=>{const r=o[n];return((e,t,o)=>{const n=cb(o).split(/[ ,]/);return{text:e.title,getItems:()=>G(e.items,(e=>{const o=e.toLowerCase();return 0===o.trim().length||H(n,(e=>e===o))?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]}))}})({title:r.title,items:SR(r.items)},t,e)}));return Z(i,(e=>e.getItems().length>0&&H(e.getItems(),(e=>s(e)||"separator"!==e.type))))},_R=(e,t,o)=>(e.on("remove",(()=>o.unload(t))),o.load(t)),ER=(e,t,o,n)=>(e.on("remove",(()=>n.unloadRawCss(t))),n.loadRawCss(t,o)),TR=async(e,t)=>{const o="ui/"+Fb(e).getOr("default")+"/skin.css",n=tinymce.Resource.get(o);if(s(n))return Promise.resolve(ER(e,o,n,e.ui.styleSheetLoader));return _R(e,t+"/skin.min.css",e.ui.styleSheetLoader)},OR=async(e,t)=>{var o;if(o=Le.fromDom(e.getElement()),vt(o).isSome()){const o="ui/"+Fb(e).getOr("default")+"/skin.shadowdom.css",n=tinymce.Resource.get(o);if(s(n))return ER(e,o,n,$v.DOM.styleSheetLoader),Promise.resolve();return _R(e,t+"/skin.shadowdom.min.css",$v.DOM.styleSheetLoader)}},DR=(e,t)=>(async(e,t)=>{Fb(t).fold((()=>{const o=Pb(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}),(o=>{const n="ui/"+o+(e?"/content.inline":"/content")+".css",r=tinymce.Resource.get(n);if(s(r))ER(t,n,r,t.ui.styleSheetLoader);else{const o=Pb(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}}));const o=Pb(t);if(!Hb(t)&&s(o))return Promise.all([TR(t,o),OR(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,t)=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:t}))(t,"Skin could not be loaded")),AR=S(DR,!1),MR=S(DR,!0),NR=(e,t,o)=>Ne(o)?e.translate(t):e.translate([t,e.translate(o)]),RR=(e,t)=>{const o=(o,r,s,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return D.some({type:"separator",text:i});if("submenu"===o.type){const e=G(o.getStyleItems(),(e=>n(e,r,a)));return 0===r&&e.length<=0?D.none():D.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>G(o.getStyleItems(),(e=>n(e,r,a)))})}return D.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!s,onAction:t.onAction(o),...o.getStylePreview().fold((()=>({})),(e=>({meta:{style:e}})))})},n=(e,n,r)=>{const s="formatter"===e.type&&t.isInvalid(e);return 0===n?s?[]:o(e,n,!1,r).toArray():o(e,n,s,r).toArray()},r=e=>{const o=t.getCurrentValue(),r=t.shouldHide?0:1;return G(e,(e=>n(e,r,o)))};return{validateItems:r,getFetch:(e,t)=>(o,n)=>{const s=t(),a=r(s);n(YT(a,ty.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:D.none()}))}}},BR=(e,t)=>{const o=t.dataset,n="basic"===o.type?()=>F(o.data,(e=>mA(e,t.isSelectedFor,t.getPreviewFor))):o.getData;return{items:RR(e,t),getStyleItems:n}},LR=(e,t,o,n,r,s)=>{const{items:a,getStyleItems:i}=BR(t,o),l=Ir(o.tooltip);return WT({text:o.icon.isSome()?D.none():o.text,icon:o.icon,ariaLabel:D.some(o.tooltip),tooltip:D.none(),role:D.none(),fetch:a.getFetch(t,i),onSetup:t=>{const s=o=>t.setTooltip(NR(e,n(o.value),o.value));return e.on(r,s),mC(hC(e,"NodeChange",(t=>{const n=t.getComponent();o.updateText(n),xg.set(t.getComponent(),!e.selection.isEditable())}))(t),(()=>e.off(r,s)))},getApi:e=>({getComponent:w(e),setTooltip:o=>{const n=t.shared.providers.translate(o);kt(e.element,"aria-label",n),l.set(o)}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[lx.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());lx.setComponents(e,t.shared.providers.tooltips.getComponents({tooltipText:o}))}}})})]},"tox-tbtn",t.shared,s)};var HR;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(HR||(HR={}));const IR=(e,t,o)=>{const n=(e=>F(e,(e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}})))(((e,t)=>t===HR.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o));return{type:"basic",data:n}},PR=w("Alignment {0}"),FR="left",zR=[{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"}],VR=e=>{const t={type:"basic",data:zR};return{tooltip:NR(e,PR(),FR),text:D.none(),icon:D.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:e=>D.none,onAction:t=>()=>W(zR,(e=>e.format===t.format)).each((t=>e.execCommand(t.command))),updateText:t=>{const o=W(zR,(t=>e.formatter.match(t.format))),n=o.fold(w(FR),(e=>e.title.toLowerCase()));$s(t,jT,{icon:`align-${n}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},ZR=(e,t)=>{const o=t(),n=F(o,(e=>e.format));return D.from(e.formatter.closest(n)).bind((e=>W(o,(t=>t.format===e))))},UR=w("Block {0}"),jR="Paragraph",WR=e=>{const t=IR(e,"block_formats",HR.SemiColon);return{tooltip:NR(e,UR(),jR),text:D.some(jR),icon:D.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},onAction:pC(e),updateText:o=>{const n=ZR(e,(()=>t.data)).fold(w(jR),(e=>e.title));$s(o,UT,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},$R=w("Font {0}"),qR="System Font",GR=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],KR=e=>{const t=e.split(/\s*,\s*/);return F(t,(e=>e.replace(/^['"]+|['"]+$/g,"")))},YR=(e,t)=>t.length>0&&K(t,(t=>e.indexOf(t.toLowerCase())>-1)),XR=e=>{const t=()=>{const t=e=>e?KR(e)[0]:"",n=e.queryCommandValue("FontName"),r=o.data,s=n?n.toLowerCase():"",a=Lb(e),i=W(r,(e=>{const o=e.format;return o.toLowerCase()===s||t(o).toLowerCase()===t(s).toLowerCase()})).orThunk((()=>ke(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=KR(e.toLowerCase());return YR(o,GR)||YR(o,t)}return!1})(s,a),{title:qR,format:s})));return{matchOpt:i,font:n}},o=IR(e,"font_family_formats",HR.SemiColon);return{tooltip:NR(e,$R(),qR),text:D.some(qR),icon:D.none(),isSelectedFor:e=>t=>t.exists((t=>t.format===e)),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>D.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:r}=t(),s=n.fold(w(r),(e=>e.title));$s(o,UT,{text:s}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:s})},dataset:o,shouldHide:!1,isInvalid:T}},JR={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:[""]},QR=(()=>{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})`})(.*)$`)})(),eB=(e,t)=>D.from(QR.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>H(t,(t=>H(JR[t],(t=>e===t)))))(n,t)?D.some({value:o,unit:n}):D.none()})),tB={tab:w(9),escape:w(27),enter:w(13),backspace:w(8),delete:w(46),left:w(37),up:w(38),right:w(39),down:w(40),space:w(32),home:w(36),end:w(35),pageUp:w(33),pageDown:w(34)},oB=(e,t,o,n)=>{let r=D.none();const s=hC(e,"NodeChange SwitchMode",(t=>{const n=t.getComponent();r=D.some(n),o.updateInputValue(n),xg.set(n,!e.selection.isEditable())})),a=e=>({getComponent:w(e)}),i=Ir(v),l=wa("custom-number-input-events"),c=(e,t,n)=>{const s=r.map((e=>Jm.getValue(e))).getOr("");const a=o.getNewValue(s,e),i=s.length-`${a}`.length,l=r.map((e=>e.element.dom.selectionStart-i)),c=r.map((e=>e.element.dom.selectionEnd-i));o.onAction(a,n),r.each((e=>{Jm.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),m=(e,t)=>c(((e,t)=>e+t),e,t),u=e=>st(e.element).fold(D.none,(e=>(oc(e),D.some(!0)))),h=e=>rc(e.element)?(ct(e.element).each((e=>oc(e))),D.some(!0)):D.none(),p=(o,n,r,s)=>{const i=Ir(v),l=t.shared.providers.translate(r),c=wa("altExecuting"),d=hC(e,"NodeChange SwitchMode",(t=>{xg.set(t.getComponent(),!e.selection.isEditable())})),m=e=>{xg.isDisabled(e)||o(!0)};return Rf.sketch({dom:{tag:"button",attributes:{"aria-label":l,"data-mce-name":n},classes:s.concat(n)},components:[zT(n,t.shared.providers.icons)],buttonBehaviours:Gl([xg.config({}),lx.config(t.shared.providers.tooltips.getConfig({tooltipText:l})),Pp(c,[wx({onSetup:d,getApi:a},i),xx({getApi:a},i),ea(ls(),((e,t)=>{t.event.raw.keyCode!==tB.space()&&t.event.raw.keyCode!==tB.enter()||xg.isDisabled(e)||o(!1)})),ea(us(),m),ea(Qr(),m)])]),eventOrder:{[ls()]:[c,"keying"],[us()]:[c,"alloy.base.behaviour"],[Qr()]:[c,"alloy.base.behaviour"],[Bs()]:["alloy.base.behaviour",c,"tooltipping"],[Ls()]:[c,"tooltipping"]}})},f=Lf(p((e=>d(!1,e)),"minus","Decrease font size",[])),b=Lf(p((e=>m(!1,e)),"plus","Increase font size",[])),y=Lf({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[ky.sketch({inputBehaviours:Gl([xg.config({}),Pp(l,[wx({onSetup:s,getApi:a},i),xx({getApi:a},i)]),Pp("input-update-display-text",[ea(UT,((e,t)=>{Jm.setValue(e,t.event.text)})),ea(is(),(e=>{o.onAction(Jm.getValue(e))})),ea(ms(),(e=>{o.onAction(Jm.getValue(e))}))]),Op.config({mode:"special",onEnter:e=>(c(x,!0,!0),D.some(!0)),onEscape:u,onUp:e=>(m(!0,!1),D.some(!0)),onDown:e=>(d(!0,!1),D.some(!0)),onLeft:(e,t)=>(t.cut(),D.none()),onRight:(e,t)=>(t.cut(),D.none())})])})],behaviours:Gl([Up.config({}),Op.config({mode:"special",onEnter:h,onSpace:h,onEscape:u}),Pp("input-wrapper-events",[ea(ss(),(e=>{z([f,b],(t=>{const o=Le.fromDom(t.get(e).element.dom);rc(o)&&nc(o)}))}))])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...g(n)?{"data-mce-name":n}:{}}},components:[f.asSpec(),y.asSpec(),b.asSpec()],behaviours:Gl([Up.config({}),Op.config({mode:"flow",focusInside:th.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>rc(e.element)?D.none():(oc(e.element),D.some(!0))})])}},nB=w("Font size {0}"),rB="12pt",sB={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},aB={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},iB=(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":ve(aB,e).getOr(e),lB=e=>ve(sB,e).getOr(""),cB=e=>{const t=()=>{let t=D.none();const o=n.data,r=e.queryCommandValue("FontSize");if(r)for(let e=3;t.isNone()&&e>=0;e--){const n=iB(r,e),s=lB(n);t=W(o,(e=>e.format===r||e.format===n||e.format===s))}return{matchOpt:t,size:r}},o=w(D.none),n=IR(e,"font_size_formats",HR.Space);return{tooltip:NR(e,nB(),rB),text:D.some(rB),icon:D.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:r}=t(),s=n.fold(w(r),(e=>e.title));$s(o,UT,{text:s}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:s})},dataset:n,shouldHide:!1,isInvalid:T}},dB=e=>Ne(e)?"Formats":"Format {0}",mB=(e,t)=>{const o="Formats";return{tooltip:NR(e,dB(""),""),text:D.some(o),icon:D.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},onAction:pC(e),updateText:t=>{const n=e=>aA(e)?G(e.items,n):iA(e)?[{title:e.title,format:e.format}]:[],r=G(dA(e),n),s=ZR(e,w(r)).fold(w({title:o,tooltipLabel:""}),(e=>({title:e.title,tooltipLabel:e.title})));$s(t,UT,{text:s.title}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:s.tooltipLabel})},shouldHide:ib(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},uB=w([mr("toggleClass"),mr("fetch"),nl("onExecute"),Or("getHotspot",D.some),Or("getAnchorOverrides",w({})),Jc(),nl("onItemExecute"),wr("lazySink"),mr("dom"),tl("onOpen"),Qm("splitDropdownBehaviours",[fS,Op,Up]),Or("matchWidth",!1),Or("useMinWidth",!1),Or("eventOrder",{}),wr("role")].concat(BS())),gB=Ou({factory:Rf,schema:[mr("dom")],name:"arrow",defaults:()=>({buttonBehaviours:Gl([Up.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(qs)},buttonBehaviours:Gl([Xp.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),hB=Ou({factory:Rf,schema:[mr("dom")],name:"button",defaults:()=>({buttonBehaviours:Gl([Up.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each((o=>{e.onExecute(o,t)}))}})}),pB=w([gB,hB,Au({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[mr("text")],name:"aria-descriptor"}),Du({schema:[Ji()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each((n=>{e.onItemExecute(n,t,o)}))}})}),kS()]),fB=ng({name:"SplitDropdown",configFields:uB(),partFields:pB(),factory:(e,t,o,n)=>{const r=e=>{ig.getCurrent(e).each((e=>{Ng.highlightFirst(e),Op.focusIn(e)}))},s=t=>{OS(e,x,t,n,r,Of.HighlightMenuAndItem).get(v)},a=t=>{const o=Uu(t,e,"button");return qs(o),D.some(!0)},i={...Xs([la(((t,o)=>{Zu(t,e,"aria-descriptor").each((e=>{const o=wa("aria");kt(e.element,"id",o),kt(t.element,"aria-describedby",o)}))}))]),...ef(D.some(s))},l={repositionMenus:e=>{Xp.isOn(e)&&RS(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[Ss()]:["disabling","toggling","alloy.base.behaviour"]},events:i,behaviours:tu(e.splitDropdownBehaviours,[fS.config({others:{sandbox:t=>{const o=Uu(t,e,"arrow");return NS(e,t,{onOpen:()=>{Xp.on(o),Xp.on(t)},onClose:()=>{Xp.off(o),Xp.off(t)}})}}}),Op.config({mode:"special",onSpace:a,onEnter:a,onDown:e=>(s(e),D.some(!0))}),Up.config({}),Xp.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),vB=e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setText:t=>$s(e,UT,{text:t}),setIcon:t=>$s(e,jT,{icon:t})}),bB=e=>({setActive:t=>{Xp.set(e,t)},isActive:()=>Xp.isOn(e),isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setText:t=>$s(e,UT,{text:t}),setIcon:t=>$s(e,jT,{icon:t})}),yB=(e,t)=>e.map((e=>({"aria-label":t.translate(e)}))).getOr({}),wB=wa("focus-button"),xB=(e,t,o,n,r,s)=>{const a=t.map((e=>Lf(ZT(e,"tox-tbtn",r)))),i=e.map((e=>Lf(VT(e,r.icons))));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:{...yB(o,r),...g(s)?{"data-mce-name":s}:{}}},components:kx([i.map((e=>e.asSpec())),a.map((e=>e.asSpec()))]),eventOrder:{[ts()]:["focusing","alloy.base.behaviour",HT],[Bs()]:[HT,"toolbar-group-button-events"]},buttonBehaviours:Gl([bx(r.isDisabled),hx(),Pp(HT,[la(((e,t)=>PT(e))),ea(UT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Ip.set(e,[Si(r.translate(t.event.text))])}))})),ea(jT,((e,t)=>{i.bind((t=>t.getOpt(e))).each((e=>{Ip.set(e,[VT(t.event.icon,r.icons)])}))})),ea(ts(),((e,t)=>{t.event.prevent(),Ws(e,wB)}))])].concat(n.getOr([])))}},CB=(e,t,o,n)=>{var r;const s=Ir(v),a=xB(e.icon,e.text,e.tooltip,D.none(),o,n);return Rf.sketch({dom:a.dom,components:a.components,eventOrder:IT,buttonBehaviours:{...Gl([Pp("toolbar-button-events",[(i={onAction:e.onAction,getApi:t.getApi},ma(((e,t)=>{yx(i,e)((t=>{$s(e,LT,{buttonApi:t}),i.onAction(t)}))}))),wx(t,s),xx(t,s)]),...e.tooltip.map((t=>lx.config(o.tooltips.getConfig({tooltipText:o.translate(t)+e.shortcut.map((e=>` (${Tx(e)})`)).getOr("")})))).toArray(),bx((()=>!e.enabled||o.isDisabled())),hx()].concat(t.toolbarButtonBehaviours)),[HT]:null===(r=a.buttonBehaviours)||void 0===r?void 0:r[HT]}});var i},SB=(e,t,o,n)=>CB(e,{toolbarButtonBehaviours:o.length>0?[Pp("toolbarButtonWith",o)]:[],getApi:vB,onSetup:e.onSetup},t,n),kB=(e,t,o,n)=>CB(e,{toolbarButtonBehaviours:[Ip.config({}),Xp.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[Pp("toolbarToggleButtonWith",o)]:[]),getApi:bB,onSetup:e.onSetup},t,n),_B=(e,t,o)=>n=>xS((e=>t.fetch(e))).map((r=>D.from(qS(Cn(YC(wa("menu-value"),r,(o=>{t.onItemAction(e(n),o)}),t.columns,t.presets,ty.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:JC(t.columns,t.presets),menuBehaviours:Xw("auto"!==t.columns?[]:[la(((e,o)=>{Kw(e,4,gy(t.presets)).each((({numRows:t,numColumns:o})=>{Op.setGridSize(e,t,o)}))}))])}))))),EB=[{name:"history",items:["undo","redo"]},{name:"ai",items:["aidialog","aishortcuts"]},{name:"styles",items:["styles"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],TB=(e,t)=>(o,n,r,s)=>{const a=e(o).mapError((e=>sr(e))).getOrDie();return t(a,n,r,s)},OB={button:TB(ww,((e,t,o,n)=>((e,t,o)=>SB(e,t,[],o))(e,t.shared.providers,n))),togglebutton:TB(Sw,((e,t,o,n)=>((e,t,o)=>kB(e,t,[],o))(e,t.shared.providers,n))),menubutton:TB($M,((e,t,o,n)=>OO(e,"tox-tbtn",t,D.none(),!1,n))),splitbutton:TB((e=>or("SplitButton",qM,e)),((e,t,o,n)=>((e,t,o)=>{const n=Ir(e.tooltip.getOr("")),r=e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setIconFill:(t,o)=>{Li(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{kt(e,"fill",o)}))},setActive:t=>{kt(e.element,"aria-pressed",t),Li(e.element,"span").each((o=>{e.getSystem().getByDom(o).each((e=>Xp.set(e,t)))}))},isActive:()=>Li(e.element,"span").exists((t=>e.getSystem().getByDom(t).exists(Xp.isOn))),setText:t=>Li(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>$s(e,UT,{text:t}))))),setIcon:t=>Li(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>$s(e,jT,{icon:t}))))),setTooltip:o=>{const r=t.providers.translate(o);kt(e.element,"aria-label",r),n.set(o)}}),s=Ir(v),a={getApi:r,onSetup:e.onSetup};return fB.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...yB(e.tooltip,t.providers),...g(o)?{"data-mce-name":o}:{}}},onExecute:t=>{const o=r(t);o.isEnabled()&&e.onAction(o)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:Gl([vx(t.providers.isDisabled),hx(),Pp("split-dropdown-events",[la(((e,t)=>PT(e))),ea(wB,Up.focus),wx(a,s),xx(a,s)]),qk.config({}),...e.tooltip.map((e=>lx.config({...t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e),onShow:o=>{if(n.get()!==e){const e=t.providers.translate(n.get());lx.setComponents(o,t.providers.tooltips.getComponents({tooltipText:e}))}}})}))).toArray()]),eventOrder:{[Bs()]:["alloy.base.behaviour","split-dropdown-events","tooltipping"],[Ls()]:["split-dropdown-events","tooltipping"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:_B(r,e,t.providers),parts:{menu:yy(0,e.columns,e.presets)},components:[fB.parts.button(xB(e.icon,e.text,D.none(),D.some([Xp.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),fB.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:Pv("chevron-down",t.providers.icons)},buttonBehaviours:Gl([vx(t.providers.isDisabled),hx(),Fv()])}),fB.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared,n))),grouptoolbarbutton:TB((e=>or("GroupToolbarButton",UM,e)),((e,t,o,n)=>{const r=o.ui.registry.getAll().buttons,s=e=>NB(o,{buttons:r,toolbar:e,allowToolbarGroups:!1},t,D.none()),a={[Yc]:t.shared.header.isPositionedAtTop()?Kc.TopToBottom:Kc.BottomToTop};if(db(o)===jv.floating)return((e,t,o,n,r)=>{const s=t.shared,a=Ir(v),i={toolbarButtonBehaviours:[],getApi:vB,onSetup:e.onSetup},l=[Pp("toolbar-group-button-events",[wx(i,a),xx(i,a)])];return MN.sketch({lazySink:s.getSink,fetch:()=>xS((t=>{t(F(o(e.items),jN))})),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:xB(e.icon,e.text,e.tooltip,D.some(l),s.providers,r),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,s,a,n);throw new Error("Toolbar groups are only supported when using floating toolbar mode")}))},DB={styles:(e,t)=>{const o={type:"advanced",...t.styles};return LR(e,t,mB(e,o),dB,"StylesTextUpdate","styles")},fontsize:(e,t)=>LR(e,t,cB(e),nB,"FontSizeTextUpdate","fontsize"),fontsizeinput:(e,t)=>oB(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>$s(e,UT,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{eB(o,["unsupportedLength","empty"]);const r=t(),s=eB(o,["unsupportedLength","empty"]).or(eB(r,["unsupportedLength","empty"])),a=s.map((e=>e.value)).getOr(16),i=xb(e),l=s.map((e=>e.unit)).filter((e=>""!==e)).getOr(i),c=n(a,(e=>{var t;return null!==(t={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e])&&void 0!==t?t:{step:1}})(l).step),d=`${(e=>e>=0)(c)?c:a}${l}`;return d!==r&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e),"fontsizeinput"),fontfamily:(e,t)=>LR(e,t,XR(e),$R,"FontFamilyTextUpdate","fontfamily"),blocks:(e,t)=>LR(e,t,WR(e),UR,"BlocksTextUpdate","blocks"),align:(e,t)=>LR(e,t,VR(e),PR,"AlignTextUpdate","align")},AB=e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=F(EB,(t=>{const o=Z(t.items,(t=>be(e,t)||be(DB,t)));return{name:t.name,items:o}}));return Z(t,(e=>e.items.length>0))})(o):s(t)?(e=>{const t=e.split("|");return F(t,(e=>({items:e.trim().split(" ")})))})(t):(e=>f(e,(e=>be(e,"name")&&be(e,"items"))))(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},MB=(e,t,o,n,r,s)=>ve(t,o.toLowerCase()).orThunk((()=>s.bind((e=>se(e,(e=>ve(t,e+o.toLowerCase()))))))).fold((()=>ve(DB,o.toLowerCase()).map((t=>t(e,r)))),(t=>"grouptoolbarbutton"!==t.type||n?((e,t,o,n)=>ve(OB,e.type).fold((()=>(console.error("skipping button defined by",e),D.none())),(r=>D.some(r(e,t,o,n)))))(t,r,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.`),D.none()))),NB=(e,t,o,n)=>{const r=AB(t),s=F(r,(r=>{const s=G(r.items,(r=>0===r.trim().length?[]:MB(e,t.buttons,r,t.allowToolbarGroups,o,n).toArray()));return{title:D.from(e.translate(r.name)),items:s}}));return Z(s,(e=>e.items.length>0))},RB=(e,t,o,n)=>{const r=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,s)){const t=a.map((t=>{const r={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return NB(e,r,n,D.none())}));xR.setToolbars(r,t)}else xR.setToolbar(r,NB(e,o,n,D.none()))},BB=Ao(),LB=BB.os.isiOS()&&BB.os.version.major<=12;var HB=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=t,i=Ir(0),l=s.outerContainer;AR(e);const d=Le.fromDom(r.targetNode),m=ft(pt(d));ym(d,s.mothership),((e,t,o)=>{Yb(e)&&ym(o.mainUi.mothership.element,o.popupUi.mothership),bm(t,o.dialogUi.mothership)})(e,m,t),e.on("SkinLoaded",(()=>{xR.setSidebar(l,o.sidebar,Nb(e)),RB(e,t,o,n),i.set(e.getWin().innerWidth),xR.setMenubar(l,kR(e,o)),xR.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let r=e.getWin();const s=e.getDoc().documentElement,a=Ir(qt(r.innerWidth,r.innerHeight)),i=Ir(qt(s.offsetWidth,s.offsetHeight)),l=()=>{const t=a.get();t.left===r.innerWidth&&t.top===r.innerHeight||(a.set(qt(r.innerWidth,r.innerHeight)),lC(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(qt(t.offsetWidth,t.offsetHeight)),lC(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(r,"resize",l),n.bind(r,"scroll",d);const m=Oc(Le.fromDom(e.getBody()),"load",c);e.on("hide",(()=>{z(o,(e=>{Nt(e.element,"display","none")}))})),e.on("show",(()=>{z(o,(e=>{zt(e.element,"display")}))})),e.on("NodeChange",c),e.on("remove",(()=>{m.unbind(),n.unbind(r,"resize",l),n.unbind(r,"scroll",d),r=null}))})(e,t)}));const u=xR.getSocket(l).getOrDie("Could not find expected socket element");if(LB){Rt(u.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=((e,t)=>{let o=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{c(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}})((()=>{e.dispatch("ScrollContent")}),20),o=Tc(u.element,"scroll",t.throttle);e.on("remove",o.unbind)}gx(e,t),e.addCommand("ToggleSidebar",((t,o)=>{xR.toggleSidebar(l,o),e.dispatch("ToggleSidebar")})),e.addQueryValueHandler("ToggleSidebar",(()=>{var e;return null!==(e=xR.whichSidebar(l))&&void 0!==e?e:""})),e.addCommand("ToggleView",((t,o)=>{if(xR.toggleView(l,o)){const t=l.element;s.mothership.broadcastOn([Rm()],{target:t}),z(a,(e=>{e.broadcastOn([Rm()],{target:t})})),c(xR.whichView(l))&&(e.focus(),e.nodeChanged(),xR.refreshToolbar(l))}})),e.addQueryValueHandler("ToggleView",(()=>{var e;return null!==(e=xR.whichView(l))&&void 0!==e?e:""}));const g=db(e);g!==jv.sliding&&g!==jv.floating||e.on("ResizeWindow ResizeEditor ResizeContent",(()=>{const o=e.getWin().innerWidth;o!==i.get()&&(xR.refreshToolbar(t.mainUi.outerContainer),i.set(o))}));const h={setEnabled:e=>{ux(t,!e)},isEnabled:()=>!xg.isDisabled(l)};return{iframeContainer:u.element.dom,editorContainer:l.element.dom,api:h}}});const IB=e=>/^[0-9\.]+(|px)$/i.test(""+e)?D.some(parseInt(""+e,10)):D.none(),PB=e=>p(e)?e+"px":e,FB=(e,t,o)=>{const n=t.filter((t=>ee>t));return n.or(r).getOr(e)},zB=e=>{const t=(e=>{const t=Qv(e),o=ob(e),n=rb(e);return IB(t).map((e=>FB(e,o,n)))})(e);return t.getOr(Qv(e))},VB=e=>{const t=eb(e),o=tb(e),n=nb(e);return IB(t).map((e=>FB(e,o,n)))},{ToolbarLocation:ZB,ToolbarMode:UB}=Jb,jB=(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=o,i=$v.DOM,l=$b(e),c=Kb(e),d=nb(e).or(VB(e)),m=n.shared.header,u=m.isPositionedAtTop,g=db(e),h=g===UB.sliding||g===UB.floating,p=Ir(!1),f=()=>p.get()&&!e.removed,v=e=>h?e.fold(w(0),(e=>e.components().length>1?jt(e.components()[1].element):0)):0,b=(e,t)=>Yb(e)?tM(t):D.none(),y=()=>{z(a,(e=>{e.broadcastOn([Bm()],{})}))},x=o=>{if(!f())return;l||r.on((e=>{const o=d.getOrThunk((()=>{const e=IB(Lt(xt(),"margin-left")).getOr(0);return Jt(xt())-Kt(t).left+e}));Nt(e.element,"max-width",o+"px")}));const n=!l&&(()=>{if(!l&&(Kt(s.outerContainer.element).left+Qt(s.outerContainer.element)>=window.innerWidth-40||It(s.outerContainer.element,"width").isSome()))return Nt(s.outerContainer.element,"position","absolute"),Nt(s.outerContainer.element,"left","0px"),zt(s.outerContainer.element,"width"),!0;return!1})();h&&xR.refreshToolbar(s.outerContainer),l||(o=>{r.on((n=>{const r=xR.getToolbar(s.outerContainer),a=v(r),i=Yo(t),l=b(e,s.outerContainer.element),c=l.fold((()=>i.x),(e=>{const t=Yo(e);return Je(e,xt())?i.x:i.x-t.x})),d=ke(o,Math.ceil(s.outerContainer.element.dom.getBoundingClientRect().width)).filter((e=>e>150)).map((e=>{const t=Vo(),o=window.innerWidth-(c-t.left),n=Math.max(Math.min(e,o),150);return ou()?Math.max(i.y-jt(n.element)+a,0):i.bottom),(e=>{var t;const o=Yo(e),r=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,s=Je(e,xt())?Math.max(i.y-jt(n.element)+a,0):i.y-o.y+r-jt(n.element)+a;return u()?s:i.bottom}))+"px"};Rt(s.outerContainer.element,{...m,...d})}))})(n),c&&r.on(o),y()},C=()=>!(l||!c||!f())&&r.get().exists((o=>{const n=m.getDockingMode(),a=(o=>{switch(ub(e)){case ZB.auto:const e=xR.getToolbar(s.outerContainer),n=v(e),r=jt(o.element)-n,a=Yo(t);if(a.y>r)return"top";{const e=ot(t),o=Math.max(e.dom.scrollHeight,jt(e));return a.bottom{NM.setModes(e,[i]),m.setDockingMode(i);const t=u()?Kc.TopToBottom:Kc.BottomToTop;kt(e.element,Yc,t)})),!0);var i}));return{isVisible:f,isPositionedAtTop:u,show:()=>{p.set(!0),Nt(s.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),z(a,(e=>{zt(e.element,"display")})),C(),Yb(e)?x((e=>NM.isDocked(e)?NM.reset(e):NM.refresh(e))):x(NM.refresh)},hide:()=>{p.set(!1),Nt(s.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),z(a,(e=>{Nt(e.element,"display","none")}))},update:x,updateMode:()=>{C()&&x(NM.reset)},repositionPopups:y}},WB=(e,t)=>{const o=Yo(e);return{pos:t?o.y:o.bottom,bounds:o}};var $B=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:s}=t,a=_c(),i=Le.fromDom(r.targetNode),l=jB(e,i,t,n,a),c=pb(e);MR(e);const d=()=>{if(a.isSet())return void l.show();a.set(xR.getHeader(s.outerContainer).getOrDie());const r=qb(e);Yb(e)?(ym(i,s.mothership),ym(i,t.popupUi.mothership)):bm(r,s.mothership),bm(r,t.dialogUi.mothership);const d=()=>{RB(e,t,o,n),xR.setMenubar(s.outerContainer,kR(e,o)),l.show(),((e,t,o,n)=>{const r=Ir(WB(t,o.isPositionedAtTop())),s=n=>{const{pos:s,bounds:a}=WB(t,o.isPositionedAtTop()),{pos:i,bounds:l}=r.get(),c=a.height!==l.height||a.width!==l.width;r.set({pos:s,bounds:a}),c&&lC(e,n),o.isVisible()&&(i!==s?o.update(NM.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",(()=>o.update(NM.reset))),e.on("NodeChange keydown",(e=>{requestAnimationFrame((()=>s(e)))}));let a=0;const i=dT((()=>o.update(NM.refresh)),33);e.on("ScrollWindow",(()=>{const e=Vo().left;e!==a&&(a=e,i.throttle()),o.updateMode()})),Yb(e)&&e.on("ElementScroll",(e=>{o.update(NM.refresh)}));const l=kc();l.set(Oc(Le.fromDom(e.getBody()),"load",(e=>s(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()})),gx(e,t);const m={show:d,hide:l.hide,setEnabled:e=>{ux(t,!e)},isEnabled:()=>!xg.isDisabled(s.outerContainer)};return{editorContainer:s.outerContainer.element.dom,api:m}}});const qB="contexttoolbar-hide",GB=(e,t)=>ea(LT,((o,n)=>{const r=(e=>({hide:()=>Ws(e,Ts()),getValue:()=>Jm.getValue(e)}))(e.get(o));t.onAction(r,n.event.buttonApi)})),KB=(e,t,o)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o)=>{const{primary:n,...r}=t.original,s=nr(Sw({...r,type:"togglebutton",onAction:v}));return kB(s,o,[GB(e,t)])})(e,t,o):((e,t,o)=>{const{primary:n,...r}=t.original,s=nr(ww({...r,type:"button",onAction:v}));return SB(s,o,[GB(e,t)])})(e,t,o),YB=(e,t)=>{const o=e.label.fold((()=>({})),(e=>({"aria-label":e}))),n=Lf(ky.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:Gl([Op.config({mode:"special",onEnter:e=>r.findPrimary(e).map((e=>(qs(e),!0))),onLeft:(e,t)=>(t.cut(),D.none()),onRight:(e,t)=>(t.cut(),D.none())})])})),r=((e,t,o)=>{const n=F(t,(t=>Lf(KB(e,t,o))));return{asSpecs:()=>F(n,(e=>e.asSpec())),findPrimary:e=>se(t,((t,o)=>t.primary?D.from(n[o]).bind((t=>t.getOpt(e))).filter(k(xg.isDisabled)):D.none()))}})(n,e.commands,t);return[{title:D.none(),items:[n.asSpec()]},{title:D.none(),items:r.asSpecs()}]},XB=YB,JB=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,QB=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=mt(Le.fromDom(e.startContainer),e.startOffset).element;return(We(o)?rt(o):D.some(o)).filter(je).map((e=>e.dom.getBoundingClientRect())).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=Vo();return Ko(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=Xo(Le.fromDom(e.getBody()));return Ko(o.x+t.left,o.y+t.top,t.width,t.height)}},eL=(e,t,o,n=0)=>{const r=jo(window),s=Yo(Le.fromDom(e.getContentAreaContainer())),a=Ib(e)||Vb(e)||Ub(e),{x:i,width:l}=((e,t,o)=>{const n=Math.max(e.x+o,t.x);return{x:n,width:Math.min(e.right-o,t.right)-n}})(s,r,n);if(e.inline&&!a)return Ko(i,r.y,l,r.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,r,s)=>{const a=Le.fromDom(e.getContainer()),i=Li(a,".tox-editor-header").getOr(a),l=Yo(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+s,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-s,o.bottom)};const m="line"===r?Yo(a):t;return d?{y:Math.max(l.bottom+s,o.y),bottom:Math.min(m.bottom-s,o.bottom)}:{y:Math.max(m.y+s,o.y),bottom:Math.min(l.y-s,o.bottom)}})(e,s,r,a,o,n);return Ko(i,c,l,d-c)}},tL={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"]},oL={maxHeightFunction:zc(),maxWidthFunction:kN()},nL=e=>"node"===e,rL=(e,t,o,n,r)=>{const s=QB(e),a=n.lastElement().exists((e=>Je(o,e)));if(((e,t)=>{const o=e.selection.getRng(),n=mt(Le.fromDom(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&Je(n.element,t)})(e,o))return a?WD:zD;if(a)return((e,t,o)=>{const n=It(e,"position");Nt(e,"position",t);const r=o(e);return n.each((t=>Nt(e,"position",t))),r})(t,n.getMode(),(()=>JB(s,Yo(t),-20)&&!n.isReposition()?qD:WD));return("fixed"===n.getMode()?r.y+Vo().top:r.y)+(jt(t)+12)<=s.y?zD:VD},sL=(e,t,o,n)=>{const r=t=>(n,r,s,a,i)=>({...rL(e,a,t,o,i)({...n,y:i.y,height:i.height},r,s,a,i),alwaysFit:!0}),s=e=>nL(n)?[r(e)]:[];return t?{onLtr:e=>[Rl,Ol,Dl,Al,Ml,Nl].concat(s(e)),onRtl:e=>[Rl,Dl,Ol,Ml,Al,Nl].concat(s(e))}:{onLtr:e=>[Nl,Rl,Al,Ol,Ml,Dl].concat(s(e)),onRtl:e=>[Nl,Rl,Ml,Dl,Al,Ol].concat(s(e))}},aL=(e,t)=>{const o=Z(t,(t=>t.predicate(e.dom))),{pass:n,fail:r}=V(o,(e=>"contexttoolbar"===e.type));return{contextToolbars:n,contextForms:r}},iL=(e,t,o)=>{const n=aL(e,t);if(n.contextForms.length>0)return D.some({elem:e,toolbars:[n.contextForms[0]]});{const t=aL(e,o);if(t.contextForms.length>0)return D.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=>H(e,(e=>e.position===t)),o=t=>Z(e,(e=>e.position===t)),n=t("selection"),r=t("node");if(n||r){if(r&&n){const e=o("node"),t=F(o("selection"),(e=>({...e,position:"node"})));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return D.some({elem:e,toolbars:o})}return D.none()}},lL=(e,t,o)=>e(t)?D.none():jr(t,(e=>{if(je(e)){const{contextToolbars:t,contextForms:n}=aL(e,o.inNodeScope),r=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>W(e,(e=>e.position===t)),o=t("selection").orThunk((()=>t("node"))).orThunk((()=>t("line"))).map((e=>e.position));return o.fold((()=>[]),(t=>Z(e,(e=>e.position===t))))}})(t);return r.length>0?D.some({elem:e,toolbars:r}):D.none()}return D.none()}),e),cL=(e,t)=>{const o={},n=[],r=[],s={},a={},i=(e,i)=>{const l=nr(or("ContextForm",Aw,i));o[e]=l,l.launch.map((o=>{s["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}})),"editor"===l.scope?r.push(l):n.push(l),a[e]=l},l=(e,t)=>{var o;(o=t,or("ContextToolbar",Mw,o)).each((o=>{"editor"===t.scope?r.push(o):n.push(o),a[e]=o}))},c=ae(e);return z(c,(t=>{const o=e[t];"contextform"===o.type?i(t,o):"contexttoolbar"===o.type&&l(t,o)})),{forms:o,inNodeScope:n,inEditorScope:r,lookupTable:a,formNavigators:s}},dL=wa("forward-slide"),mL=wa("backward-slide"),uL=wa("change-slide-event"),gL="tox-pop--resizing",hL="tox-pop--transition",pL=(e,t,o,n)=>{const r=n.backstage,s=r.shared,a=Ao().deviceType.isTouch,i=_c(),l=_c(),c=_c(),d=Ti((e=>{const t=Ir([]);return Mf.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),Mf.getContent(e).each((e=>{zt(e.element,"visibility")})),ri(e.element,gL),zt(e.element,"width")},inlineBehaviours:Gl([Pp("context-toolbar-events",[ia(hs(),((e,t)=>{"width"===t.event.raw.propertyName&&(ri(e.element,gL),zt(e.element,"width"))})),ea(uL,((e,t)=>{const o=e.element;zt(o,"width");const n=Jt(o);Mf.setContent(e,t.event.contents),oi(o,gL);const r=Jt(o);Nt(o,"width",n+"px"),Mf.getContent(e).each((e=>{t.event.focus.bind((e=>(oc(e),ac(o)))).orThunk((()=>(Op.focusIn(e),sc(pt(o)))))})),setTimeout((()=>{Nt(e.element,"width",r+"px")}),0)})),ea(dL,((e,o)=>{Mf.getContent(e).each((o=>{t.set(t.get().concat([{bar:o,focus:sc(pt(e.element))}]))})),$s(e,uL,{contents:o.event.forwardContents,focus:D.none()})})),ea(mL,((e,o)=>{ne(t.get()).each((o=>{t.set(t.get().slice(0,t.get().length-1)),$s(e,uL,{contents:Oi(o.bar),focus:o.focus})}))}))]),Op.config({mode:"special",onEscape:o=>ne(t.get()).fold((()=>e.onEscape()),(e=>(Ws(o,mL),D.some(!0))))})]),lazySink:()=>nn.value(e.sink)})})({sink:o,onEscape:()=>(e.focus(),D.some(!0))})),m=()=>{const t=c.get().getOr("node"),o=nL(t)?1:0;return eL(e,s,t,o)},u=()=>!(e.removed||a()&&r.isContextMenuOpen()),g=()=>{if(u()){const t=m(),o=we(c.get(),"node")?((e,t)=>t.filter((e=>wt(e)&&Ue(e))).map(Xo).getOrThunk((()=>QB(e))))(e,i.get()):QB(e);return t.height<=0||!JB(o,t,.01)}return!0},h=()=>{i.clear(),l.clear(),c.clear(),Mf.hide(d)},p=()=>{if(Mf.isOpen(d)){const e=d.element;zt(e,"display"),g()?Nt(e,"display","none"):(l.set(0),Mf.reposition(d))}},f=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:Gl([Op.config({mode:"acyclic"}),Pp("pop-dialog-wrap-events",[la((t=>{e.shortcuts.add("ctrl+F9","focus statusbar",(()=>Op.focusIn(t)))})),ca((t=>{e.shortcuts.remove("ctrl+F9")}))])])}),b=eo((()=>cL(t,(e=>{const t=y([e]);$s(d,dL,{forwardContents:f(t)})})))),y=t=>{const{buttons:o}=e.ui.registry.getAll(),r={...o,...b().formNavigators},a=db(e)===jv.scrolling?jv.scrolling:jv.default,i=q(F(t,(t=>"contexttoolbar"===t.type?((t,o)=>NB(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,D.some(["form:"])))(r,t):((e,t)=>XB(e,t))(t,s.providers))));return KN({type:a,uid:wa("context-toolbar"),initGroups:i,onEscape:D.none,cyclicKeying:!0,providers:s.providers})},w=(t,n)=>{const r="node"===t?s.anchors.node(n):s.anchors.cursor(),c=((e,t,o,n)=>"line"===t?{bubble:jc(12,0,tL),layouts:{onLtr:()=>[Bl],onRtl:()=>[Ll]},overrides:oL}:{bubble:jc(0,12,tL,1/12),layouts:sL(e,o,n,t),overrides:oL})(e,t,a(),{lastElement:i.get,isReposition:()=>we(l.get(),0),getMode:()=>sm.getMode(o)});return Cn(r,c)},x=(e,t)=>{if(S.cancel(),!u())return;const n=y(e),r=e[0].position,s=w(r,t);c.set(r),l.set(1);const a=d.element;zt(a,"display"),(e=>we(Ce(e,i.get(),Je),!0))(t)||(ri(a,hL),sm.reset(o,d)),Mf.showWithinBounds(d,f(n),{anchor:s,transition:{classes:[hL],mode:"placement"}},(()=>D.some(m()))),t.fold(i.clear,i.set),g()&&Nt(a,"display","none")};let C=!1;const S=dT((()=>{if(e.hasFocus()&&!e.removed&&!C)if(ai(d.element,hL))S.throttle();else{((e,t)=>{const o=Le.fromDom(t.getBody()),n=e=>Je(e,o),r=Le.fromDom(t.selection.getNode());return(e=>!n(e)&&!Qe(o,e))(r)?D.none():iL(r,e.inNodeScope,e.inEditorScope).orThunk((()=>lL(n,r,e)))})(b(),e).fold(h,(e=>{x(e.toolbars,D.some(e.elem))}))}}),17);e.on("init",(()=>{e.on("remove",h),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",p),e.on("click keyup focus SetContent",S.throttle),e.on(qB,h),e.on("contexttoolbar-show",(t=>{const o=b();ve(o.lookupTable,t.toolbarKey).each((o=>{x([o],ke(t.target!==e,t.target)),Mf.getContent(d).each(Op.focusIn)}))})),e.on("focusout",(t=>{Nf.setEditorTimeout(e,(()=>{ac(o.element).isNone()&&ac(d.element).isNone()&&h()}),0)})),e.on("SwitchMode",(()=>{e.mode.isReadOnly()&&h()})),e.on("ExecCommand",(({command:e})=>{"toggleview"===e.toLowerCase()&&h()})),e.on("AfterProgressState",(t=>{t.state?h():e.hasFocus()&&S.throttle()})),e.on("dragstart",(()=>{C=!0})),e.on("dragend drop",(()=>{C=!1})),e.on("NodeChange",(e=>{ac(d.element).fold(S.throttle,v)}))}))},fL=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),r=_c();return F(o,(o=>({type:"togglemenuitem",text:t.display(o),onSetup:s=>{const a=e=>{e&&(r.on((e=>e.setActive(!1))),r.set(s)),s.setActive(e)};a(we(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{r.clear(),i()}},onAction:()=>t.setCurrent(e,o)})))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},vL=e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:zb,hash:e=>((e,t)=>eB(e,t).map((({value:e,unit:t})=>e+t)))(e,["fixed","relative","empty"]).getOr(e),display:x,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>D.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:uC(e),onMenuSetup:uC(e)}),bL=e=>{fL(e,vL(e)),(e=>D.from(lb(e)).map((t=>({name:"language",text:"Language",icon:"language",getOptions:w(t),hash:e=>m(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>{var n;return e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:null!==(n=t.customCode)&&void 0!==n?n:null}).unbind},getCurrent:e=>{const t=Le.fromDom(e.selection.getNode());return Wr(t,(e=>D.some(e).filter(je).bind((e=>Tt(e,"lang").map((t=>({code:t,customCode:Tt(e,"data-mce-lang").getOrUndefined(),title:""})))))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=kc();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),mC(o.clear,uC(e)(t))},onMenuSetup:uC(e)}))))(e).each((t=>fL(e,t)))},yL=(e,t)=>{((e,t)=>{const o=BR(t,VR(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:uC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=BR(t,XR(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:uC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=BR(t,mB(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:uC(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=BR(t,WR(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:uC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=BR(t,cB(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:uC(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)},wL=e=>hC(e,"NodeChange",(t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())})),xL=e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:wL(e),onAction:fC(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:uC(e),onAction:fC(e,"indent")})})(e)},CL=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),mC((()=>e.off("PastePlainTextToggle",n)),uC(e)(o))},SL=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},kL=e=>{(e=>{lT.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:gC(e,t.name),onAction:SL(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:gC(e,o),onAction:SL(e,o),shortcut:n})}})(e),(e=>{lT.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],(t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:fC(e,t.action),shortcut:t.shortcut})})),lT.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:uC(e),onAction:fC(e,t.action)})}))})(e),(e=>{lT.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],(t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:fC(e,t.action),onSetup:gC(e,t.name)})}))})(e)},_L=e=>{kL(e),(e=>{lT.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],(t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:fC(e,t.action)})})),lT.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:uC(e),onAction:fC(e,t.action)})})),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:uC(e),onAction:SL(e,"code")})})(e)},EL=(e,t)=>hC(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",(o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())})),TL=e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:EL(e,"hasUndo"),onAction:fC(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:EL(e,"hasRedo"),onAction:fC(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:EL(e,"hasUndo"),onAction:fC(e,"undo"),shortcut:"Meta+Z"}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:EL(e,"hasRedo"),onAction:fC(e,"redo"),shortcut:"Meta+Y"})})(e)},OL=e=>hC(e,"VisualAid",(t=>{t.setActive(e.hasVisual)})),DL=e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:fC(e,"mceToggleVisualAid")})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:OL(e),onAction:fC(e,"mceToggleVisualAid")})})(e)},AL=(e,t)=>{(e=>{z([{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:fC(e,t.cmd),onSetup:gC(e,t.name)})})),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:uC(e),onAction:fC(e,"JustifyNone")})})(e),_L(e),yL(e,t),TL(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=LC(e),o=HC(e),n=Ir(t),r=Ir(o);qC(e,"forecolor","forecolor",n),qC(e,"backcolor","hilitecolor",r),GC(e,"forecolor","forecolor","Text color",n),GC(e,"backcolor","hilitecolor","Background color",r)})(e),DL(e),xL(e),bL(e),(e=>{const t=Ir(Mb(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:CL(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:CL(e,t)})})(e)},ML=e=>s(e)?e.split(/[ ,]/):e,NL=e=>t=>t.options.get(e),RL=NL("contextmenu_never_use_native"),BL=NL("contextmenu_avoid_overlap"),LL=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:Z(o,(e=>be(t,e)))},HL=(e,t)=>({type:"makeshift",x:e,y:t}),IL=e=>"longpress"===e.type||0===e.type.indexOf("touch"),PL=(e,t)=>{const o=$v.DOM.getPos(e);return((e,t,o)=>HL(e.x+t,e.y+o))(t,o.x,o.y)},FL=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(IL(e)){const t=e.touches[0];return HL(t.pageX,t.pageY)}return HL(e.pageX,e.pageY)})(t):PL(e.getContentAreaContainer(),(e=>{if(IL(e)){const t=e.touches[0];return HL(t.clientX,t.clientY)}return HL(e.clientX,e.clientY)})(t)):zL(e),zL=e=>({type:"selection",root:Le.fromDom(e.selection.getNode())}),VL=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:D.some(Le.fromDom(e.selection.getNode())),root:Le.fromDom(e.getBody())}))(e);case"point":return FL(e,t);case"selection":return zL(e)}},ZL=(e,t,o,n,r,s)=>{const a=o(),i=VL(e,t,s);YT(a,ty.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:D.none()}).map((e=>{t.preventDefault(),Mf.showMenuAt(r,{anchor:i},{menu:{markers:fy("normal")},data:e})}))},UL={onLtr:()=>[Rl,Ol,Dl,Al,Ml,Nl,zD,VD,FD,ID,PD,HD],onRtl:()=>[Rl,Dl,Ol,Ml,Al,Nl,zD,VD,PD,HD,FD,ID]},jL={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"]},WL=(e,t,o,n,r,s,a)=>{const i=((e,t,o)=>{const n=VL(e,t,o);return{bubble:jc(0,"point"===o?12:0,jL),layouts:UL,overrides:{maxWidthFunction:kN(),maxHeightFunction:zc()},...n}})(e,t,s);YT(o,ty.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:D.none()}).map((o=>{t.preventDefault();const l=a?Of.HighlightMenuAndItem:Of.HighlightNone;Mf.showMenuWithinBounds(r,{anchor:i},{menu:{markers:fy("normal"),highlightOnOpen:l},data:o,type:"horizontal"},(()=>D.some(eL(e,n.shared,"node"===s?"node":"selection")))),e.dispatch(qB)}))},$L=(e,t,o,n,r,s)=>{const a=Ao(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),m=()=>{const a=o();WL(e,t,a,n,r,s,!(c||i||l&&d))};if((l||i)&&"node"!==s){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Nf.setEditorTimeout(e,(()=>{e.selection.setRng(t)}),10),s()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const r=()=>s();e.once("longpresscancel",r);const s=()=>{e.off("touchend",o),e.off("longpresscancel",r),e.off("mousedown",n)}})(e),m()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],r=o.getRng();return Md(e.getWin(),vd.domRange(r)).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 m()},qL=e=>s(e)?"|"===e:"separator"===e.type,GL={type:"separator"},KL=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(s(e))return e;switch(e.type){case"separator":return GL;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return s(t)?t:F(t,KL)}};default:const o=e;return{type:"menuitem",...t(o),onAction:b(o.onAction)}}},YL=(e,t)=>{if(0===t.length)return e;const o=ne(e).filter((e=>!qL(e))),n=o.fold((()=>[]),(e=>[GL]));return e.concat(n).concat(t).concat([GL])},XL=(e,t)=>!(e=>"longpress"===e.type||be(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),JL=(e,t)=>XL(e,t)?e.selection.getStart(!0):t.target,QL=(e,t,o)=>{const n=Ao().deviceType.isTouch,r=Ti(Mf.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:Gl([Pp("dismissContextMenu",[ea(Hs(),((t,o)=>{Nm.close(t),e.focus()}))])])})),a=()=>Mf.hide(r),i=t=>{if(RL(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!RL(e))(e,t)||(e=>0===LL(e).length)(e))return;const a=((e,t)=>{const o=BL(e),n=XL(e,t)?"selection":"point";if(Me(o)){const r=JL(e,t);return tk(Le.fromDom(r),o)?"node":n}return n})(e,t);(n()?$L:ZL)(e,t,(()=>{const o=JL(e,t),n=e.ui.registry.getAll(),r=LL(e);return((e,t,o)=>{const n=j(t,((t,n)=>ve(e,n.toLowerCase()).map((e=>{const n=e.update(o);if(s(n)&&Me(Ae(n)))return YL(t,n.split(" "));if(l(n)&&n.length>0){const e=F(n,KL);return YL(t,e)}return t})).getOrThunk((()=>t.concat([n])))),[]);return n.length>0&&qL(n[n.length-1])&&n.pop(),n})(n.contextMenus,r,o)}),o,r,a)};e.on("init",(()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)}))},eH=Pr([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),tH=e=>t=>t.translate(-e.left,-e.top),oH=e=>t=>t.translate(e.left,e.top),nH=e=>(t,o)=>j(e,((e,t)=>t(e)),qt(t,o)),rH=(e,t,o)=>e.fold(nH([oH(o),tH(t)]),nH([tH(t)]),nH([])),sH=(e,t,o)=>e.fold(nH([oH(o)]),nH([]),nH([oH(t)])),aH=(e,t,o)=>e.fold(nH([]),nH([tH(o)]),nH([oH(t),tH(o)])),iH=(e,t,o)=>{const n=e.fold(((e,t)=>({position:D.some("absolute"),left:D.some(e+"px"),top:D.some(t+"px")})),((e,t)=>({position:D.some("absolute"),left:D.some(e-o.left+"px"),top:D.some(t-o.top+"px")})),((e,t)=>({position:D.some("fixed"),left:D.some(e+"px"),top:D.some(t+"px")})));return{right:D.none(),bottom:D.none(),...n}},lH=(e,t,o,n)=>{const r=(e,r)=>(s,a)=>{const i=e(t,o,n);return r(s.getOr(i.left),a.getOr(i.top))};return e.fold(r(aH,cH),r(sH,dH),r(rH,mH))},cH=eH.offset,dH=eH.absolute,mH=eH.fixed,uH=(e,t)=>{const o=Et(e,t);return m(o)?NaN:parseInt(o,10)},gH=(e,t,o,n)=>((e,t)=>{const o=e.element,n=uH(o,t.leftAttr),r=uH(o,t.topAttr);return isNaN(n)||isNaN(r)?D.none():D.some(qt(n,r))})(e,t).fold((()=>o),(e=>mH(e.left+n.left,e.top+n.top))),hH=(e,t,o,n,r,s)=>{const a=gH(e,t,o,n),i=t.mustSnap?vH(e,t,a,r,s):bH(e,t,a,r,s),l=rH(a,r,s);return((e,t,o)=>{const n=e.element;kt(n,t.leftAttr,o.left+"px"),kt(n,t.topAttr,o.top+"px")})(e,t,l),i.fold((()=>({coord:mH(l.left,l.top),extra:D.none()})),(e=>({coord:e.output,extra:e.extra})))},pH=(e,t)=>{((e,t)=>{const o=e.element;Dt(o,t.leftAttr),Dt(o,t.topAttr)})(e,t)},fH=(e,t,o,n)=>se(e,(e=>{const r=e.sensor,s=((e,t,o,n,r,s)=>{const a=sH(e,r,s),i=sH(t,r,s);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,r,e.range.left,e.range.top,o,n);return s?D.some({output:lH(e.output,t,o,n),extra:e.extra}):D.none()})),vH=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return fH(s,o,n,r).orThunk((()=>{const e=j(s,((e,t)=>{const s=t.sensor,a=((e,t,o,n,r,s)=>{const a=sH(e,r,s),i=sH(t,r,s),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return qt(l,c)})(o,s,t.range.left,t.range.top,n,r);return e.deltas.fold((()=>({deltas:D.some(a),snap:D.some(t)})),(o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:D.some(a),snap:D.some(t)}:e))}),{deltas:D.none(),snap:D.none()});return e.snap.map((e=>({output:lH(e.output,o,n,r),extra:e.extra})))}))},bH=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return fH(s,o,n,r)};var yH=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const t=et(e.element),o=Vo(t),s=oM(r),a=((e,t,o)=>({coord:lH(e.output,e.output,t,o),extra:e.extra}))(n,o,s),i=iH(a.coord,0,s);Bt(r,i)}}});const wH="data-initial-z-index",xH=(e,t)=>{e.getSystem().addToGui(t),(e=>{rt(e.element).filter(je).each((t=>{It(t,"z-index").each((e=>{kt(t,wH,e)})),Nt(t,"z-index",Lt(e.element,"z-index"))}))})(t)},CH=e=>{(e=>{rt(e.element).filter(je).each((e=>{Tt(e,wH).fold((()=>zt(e,"z-index")),(t=>Nt(e,"z-index",t))),Dt(e,wH)}))})(e),e.getSystem().removeFromGui(e)},SH=(e,t,o)=>e.getSystem().build(hk.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var kH=Tr("snaps",[mr("getSnapPoints"),tl("onSensor"),mr("leftAttr"),mr("topAttr"),Or("lazyViewport",Qo),Or("mustSnap",!1)]);const _H=[Or("useFixed",T),mr("blockerClass"),Or("getTarget",x),Or("onDrag",v),Or("repositionTarget",!0),Or("onDrop",v),Br("getBounds",Qo),kH],EH=e=>((e,t,o,n)=>e.isSome()&&t.isSome()&&o.isSome()?D.some(n(e.getOrDie(),t.getOrDie(),o.getOrDie())):D.none())(It(e,"left"),It(e,"top"),It(e,"position"),((e,t,o)=>("fixed"===o?mH:cH)(parseInt(e,10),parseInt(t,10)))).getOrThunk((()=>{const t=Kt(e);return dH(t.left,t.top)})),TH=(e,t,o,n,r,s,a)=>((e,t,o,n,r)=>{const s=r.bounds,a=sH(t,o,n),i=yl(a.left,s.x,s.x+s.width-r.width),l=yl(a.top,s.y,s.y+s.height-r.height),c=dH(i,l);return t.fold((()=>{const e=aH(c,o,n);return cH(e.left,e.top)}),w(c),(()=>{const e=rH(c,o,n);return mH(e.left,e.top)}))})(0,t.fold((()=>{const e=(t=o,a=s.left,i=s.top,t.fold(((e,t)=>cH(e+a,t+i)),((e,t)=>dH(e+a,t+i)),((e,t)=>mH(e+a,t+i))));var t,a,i;const l=rH(e,n,r);return mH(l.left,l.top)}),(t=>{const a=hH(e,t,o,s,n,r);return a.extra.each((o=>{t.onSensor(e,o)})),a.coord})),n,r,a),OH=(e,t)=>({bounds:e.getBounds(),height:Wt(t.element),width:Qt(t.element)}),DH=(e,t,o,n,r)=>{const s=o.update(n,r),a=o.getStartData().getOrThunk((()=>OH(t,e)));s.each((o=>{((e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const s=et(e.element),a=Vo(s),i=oM(r),l=EH(r),c=TH(e,t.snaps,l,a,i,n,o),d=iH(c,0,i);Bt(r,d)}t.onDrag(e,r,n)})(e,t,a,o)}))},AH=(e,t,o,n)=>{t.each(CH),o.snaps.each((t=>{pH(e,t)}));const r=o.getTarget(e.element);n.reset(),o.onDrop(e,r)},MH=e=>(t,o)=>{const n=e=>{o.setStartData(OH(t,e))};return Xs([ea(Ns(),(e=>{o.getStartData().each((()=>n(e)))})),...e(t,o,n)])};var NH=Object.freeze({__proto__:null,getData:e=>D.from(qt(e.x,e.y)),getDelta:(e,t)=>qt(t.left-e.left,t.top-e.top)});const RH=(e,t,o)=>[ea(ts(),((n,r)=>{if(0!==r.event.raw.button)return;r.stop();const s=()=>AH(n,D.some(l),e,t),a=ok(s,200),i={drop:s,delayDrop:a.schedule,forceDrop:s,move:o=>{a.cancel(),DH(n,e,t,NH,o)}},l=SH(n,e.blockerClass,(e=>Xs([ea(ts(),e.forceDrop),ea(rs(),e.drop),ea(os(),((t,o)=>{e.move(o.event)})),ea(ns(),e.delayDrop)]))(i));o(n),xH(n,l)}))],BH=[..._H,sl("dragger",{handlers:MH(RH)})];var LH=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return D.some(qt(t.clientX,t.clientY))})(t):D.none()},getDelta:(e,t)=>qt(t.left-e.left,t.top-e.top)});const HH=(e,t,o)=>{const n=_c(),r=o=>{AH(o,n.get(),e,t),n.clear()};return[ea(Xr(),((s,a)=>{a.stop();const i=()=>r(s),l={drop:i,delayDrop:v,forceDrop:i,move:o=>{DH(s,e,t,LH,o)}},c=SH(s,e.blockerClass,(e=>Xs([ea(Xr(),e.forceDrop),ea(Qr(),e.drop),ea(es(),e.drop),ea(Jr(),((t,o)=>{e.move(o.event)}))]))(l));n.set(c);o(s),xH(s,c)})),ea(Jr(),((o,n)=>{n.stop(),DH(o,e,t,LH,n.event)})),ea(Qr(),((e,t)=>{t.stop(),r(e)})),ea(es(),r)]},IH=BH,PH=[..._H,sl("dragger",{handlers:MH(HH)})],FH=[..._H,sl("dragger",{handlers:MH(((e,t,o)=>[...RH(e,t,o),...HH(e,t,o)]))})];var zH=Object.freeze({__proto__:null,mouse:IH,touch:PH,mouseOrTouch:FH});var VH=Object.freeze({__proto__:null,init:()=>{let e=D.none(),t=D.none();const o=w({});return Pa({readState:o,reset:()=>{e=D.none(),t=D.none()},update:(t,o)=>t.getData(o).bind((o=>((t,o)=>{const n=e.map((e=>t.getDelta(e,o)));return e=D.some(o),n})(t,o))),getStartData:()=>t,setStartData:e=>{t=D.some(e)}})}});const ZH=Jl({branchKey:"mode",branches:zH,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:D.from(e.extra)})},state:VH,apis:yH}),UH=(e,t,o,n,r,s)=>e.fold((()=>ZH.snap({sensor:dH(o-20,n-20),range:qt(r,s),output:dH(D.some(o),D.some(n)),extra:{td:t}})),(e=>{const r=o-20,s=n-20,a=e.element.dom.getBoundingClientRect();return ZH.snap({sensor:dH(r,s),range:qt(40,40),output:dH(D.some(o-a.width/2),D.some(n-a.height/2)),extra:{td:t}})})),jH=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const r=n.td;((e,t)=>e.exists((e=>Je(e,t))))(t.get(),r)||(t.set(r),o(r))},mustSnap:!0}),WH=e=>Lf(Rf.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:Gl([ZH.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),qk.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),$H=(e,t)=>{const o=Ir([]),n=Ir([]),r=Ir(!1),s=_c(),a=_c(),i=e=>{const o=Xo(e);return UH(m.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=Xo(e);return UH(u.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=jH((()=>F(o.get(),(e=>i(e)))),s,(t=>{a.get().each((o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})}))})),d=jH((()=>F(n.get(),(e=>l(e)))),a,(t=>{s.get().each((o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})}))})),m=WH(c),u=WH(d),g=Ti(m.asSpec()),h=Ti(u.asSpec()),p=(t,o,n,r)=>{const s=n(o);ZH.snapTo(t,s);((t,o,n,r)=>{const s=o.dom.getBoundingClientRect();zt(t.element,"display");const a=nt(Le.fromDom(e.getBody())).dom.innerHeight,i=n(s),l=r(s,a);(i||l)&&Nt(t.element,"display","none")})(t,o,(e=>e[r]<0),((e,t)=>e[r]>t))},f=e=>p(g,e,i,"top"),v=e=>p(h,e,l,"bottom");if(Ao().deviceType.isTouch()){const i=e=>F(e,Le.fromDom);e.on("TableSelectionChange",(e=>{r.get()||(gm(t,g),gm(t,h),r.set(!0));const l=Le.fromDom(e.start),c=Le.fromDom(e.finish);s.set(l),a.set(c),D.from(e.otherCells).each((e=>{o.set(i(e.upOrLeftCells)),n.set(i(e.downOrRightCells)),f(l),v(c)}))})),e.on("ResizeEditor ResizeWindow ScrollContent",(()=>{s.get().each(f),a.get().each(v)})),e.on("TableSelectionClear",(()=>{r.get()&&(fm(g),fm(h),r.set(!1)),s.clear(),a.clear()}))}};const qH=(e,t,o)=>{var n;const r=null!==(n=t.delimiter)&&void 0!==n?n:"›",s=t=>j(t,((t,n,s)=>{const a=((t,n,r)=>Rf.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":r,"aria-level":r+1}},components:[Si(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:Gl([fx(o.isDisabled),hx()])}))(n.name,n.element,s);return 0===s?t.concat([a]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Si(` ${r} `)]},a])}),[]);return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Gl([Op.config({mode:"flow",selector:"div[role=button]"}),xg.config({disabled:o.isDisabled}),hx(),xk.config({}),Ip.config({}),Pp("elementPathEvents",[la(((t,o)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",(()=>Op.focusIn(t))),e.on("NodeChange",(o=>{const n=(t=>{const o=[];let n=t.length;for(;n-- >0;){const s=t[n];if(1===s.nodeType&&"BR"!==(r=s).nodeName&&!r.getAttribute("data-mce-bogus")&&"bookmark"!==r.getAttribute("data-mce-type")){const t=dC(e,s);if(t.isDefaultPrevented()||o.push({name:t.name,element:s}),t.isPropagationStopped())break}}var r;return o})(o.parents),r=n.length>0?s(n):[];Ip.set(t,r)}))}))])]),components:[]}};var GH;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(GH||(GH={}));const KH=(e,t,o)=>{const n=Le.fromDom(e.getContainer()),r=((e,t,o,n,r)=>{const s={height:FB(n+t.top,ob(e),rb(e))};return o===GH.Both&&(s.width=FB(r+t.left,tb(e),nb(e))),s})(e,t,o,jt(n),Jt(n));le(r,((e,t)=>{p(e)&&Nt(n,t,PB(e))})),(e=>{e.dispatch("ResizeEditor")})(e)},YH=(e,t,o,n)=>{const r=qt(20*o,20*n);return KH(e,r,t),D.some(!0)},XH=(e,t)=>{const o=(e=>{const t=Ab(e);return!1===t?GH.None:"both"===t?GH.Both:GH.Vertical})(e);if(o===GH.None)return D.none();const n=o===GH.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return D.some(Vv("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{"aria-label":t.translate(n),"data-mce-name":"resize-handle"},behaviours:[ZH.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,r)=>KH(e,r,o),blockerClass:"tox-blocker"}),Op.config({mode:"special",onLeft:()=>YH(e,o,-1,0),onRight:()=>YH(e,o,1,0),onUp:()=>YH(e,o,0,-1),onDown:()=>YH(e,o,0,1)}),xk.config({}),Up.config({}),lx.config(t.tooltips.getConfig({tooltipText:t.translate("Resize")}))]},t.icons))},JH=(e,t)=>{const o=()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>Ip.set(e,[Si(t.translate(["{0} "+n,o[n]]))]);return Rf.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Gl([fx(t.isDisabled),hx(),xk.config({}),Ip.config({}),Jm.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Pp("wordcount-events",[ma((e=>{const t=Jm.getValue(e),n="words"===t.mode?"characters":"words";Jm.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)})),la((t=>{e.on("wordCountUpdate",(e=>{const{mode:n}=Jm.getValue(t);Jm.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)}))}))])]),eventOrder:{[Ss()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),Db(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":Nv.translate(["Powered by {0}","Tiny"])},innerHtml:'\n \n\n'.trim()},behaviours:Gl([Up.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}},n=()=>{const n=[],r=Bb(e),s=Ob(e),a=Db(e)||e.hasPlugin("wordcount"),i=()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(r){const o="tox-statusbar__text-container-3-cols";return a||s?a&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[a&&!s?t:e]};return s&&n.push(qH(e,{},t)),r&&n.push((()=>{const e=Tx("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Si(Nv.translate(["Press {0} for help",e]))]}})()),a&&n.push(o()),n.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...i()]},components:n}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const o=n(),r=XH(e,t);return o.concat(r.toArray())})()}},QH=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),eI=(e,t)=>{const o=e.inline,n=o?$B:HB,r=Kb(e)?ZM:eM,s=(()=>{const e=_c(),t=_c(),o=_c();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=>Je(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=_c(),i=_c(),l=_c(),c=Ao().deviceType.isTouch()?["tox-platform-touch"]:[],d=jb(e),m=db(e),u=Lf({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=Lf({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),h=()=>s.mainUi.get().map((e=>e.outerContainer)).bind(xR.getHeader),p=s.lazyGetInOuterOrDie("anchor bar",u.getOpt),f=s.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),v=s.lazyGetInOuterOrDie("toolbar",xR.getToolbar),b=s.lazyGetInOuterOrDie("throbber",xR.getThrobber),y=VA({popup:()=>nn.fromOption(s.popupUi.get().map((e=>e.sink)),"(popup) UI has not been rendered"),dialog:()=>nn.fromOption(s.dialogUi.get().map((e=>e.sink)),"UI has not been rendered")},e,p,f),w=()=>xR.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]}}),x=()=>{const t=(()=>{const t={attributes:{[Yc]:d?Kc.BottomToTop:Kc.TopToBottom}},o=xR.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=xR.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:y.popup.shared.getSink,providers:y.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:m,lazyToolbar:v,lazyHeader:()=>h().getOrDie("Could not find header element"),...t}),r=xR.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:m}),s=Ub(e),a=Vb(e),i=Ib(e),l=Rb(e),c=w(),g=s||a||i,p=l?[c,o]:[o];return xR.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(g?[]:["tox-editor-header--empty"]),...t},components:q([i?p:[],s?[r]:a?[n]:[],$b(e)?[]:[u.asSpec()]]),sticky:Kb(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[xR.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),xR.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},r=xR.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),s=xR.parts.viewWrapper({backstage:y.popup}),i=Tb(e)&&!o?D.some(JH(e,y.popup.shared.providers)):D.none(),l=q([d?[]:[t],o?[]:[n],d?[t]:[]]),p=xR.parts.editorContainer({components:q([l,o?[]:[g.asSpec(),...i.toArray()]])}),f=Gb(e),b={role:"application",...Nv.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},x=Ti(xR.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:b},components:[p,...o?[]:[s],r],behaviours:Gl([hx(),xg.config({disableClass:"tox-tinymce--disabled"}),Op.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"})])})),C=pk(x);return a.set(C),{mothership:C,outerContainer:x}},C=t=>{const o=PB(zB(e)),n=PB((e=>VB(e).getOr(eb(e)))(e));return e.inline||(Ft("div","width",n)&&Nt(t.element,"width",n),Ft("div","height",o)?Nt(t.element,"height",o):Nt(t.element,"height","400px")),o},S=t=>{const{mainUi:o,popupUi:s,uiMotherships:a}=t;ce(mb(e),((t,o)=>{e.ui.registry.addGroupToolbarButton(o,t)}));const{buttons:i,menuItems:l,contextToolbars:c,sidebars:d,views:u}=e.ui.registry.getAll(),g=Zb(e),p={menuItems:l,menus:Xb(e),menubar:vb(e),toolbar:g.getOrThunk((()=>bb(e))),allowToolbarGroups:m===jv.floating,buttons:i,sidebar:d,views:u};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",(()=>{xR.focusMenubar(f)})),e.addShortcut("alt+F10","focus toolbar",(()=>{xR.focusToolbar(f)})),e.addCommand("ToggleToolbarDrawer",((e,t)=>{(null==t?void 0:t.skipFocus)?xR.toggleToolbarDrawerWithoutFocusing(f):xR.toggleToolbarDrawer(f)})),e.addQueryStateHandler("ToggleToolbarDrawer",(()=>xR.isToolbarDrawerToggled(f))),((e,t,o)=>{const n=(e,n)=>{z([t,...o],(t=>{t.broadcastEvent(e,n)}))},r=(e,n)=>{z([t,...o],(t=>{t.broadcastOn([e],n)}))},s=e=>r(Rm(),{target:e.target}),a=Wo(),i=Tc(a,"touchstart",s),l=Tc(a,"touchmove",(e=>n(As(),e))),c=Tc(a,"touchend",(e=>n(Ms(),e))),d=Tc(a,"mousedown",s),m=Tc(a,"mouseup",(e=>{0===e.raw.button&&r(Lm(),{target:e.target})})),u=e=>r(Rm(),{target:Le.fromDom(e.target)}),g=e=>{0===e.button&&r(Lm(),{target:Le.fromDom(e.target)})},h=()=>{z(e.editorManager.get(),(t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})}))},p=e=>n(Ns(),Dc(e)),f=e=>{r(Bm(),{}),n(Rs(),Dc(e))},v=pt(Le.fromDom(e.getElement())),b=Oc(v,"scroll",(o=>{requestAnimationFrame((()=>{if(null!=e.getContainer()){const r=QS(e,t.element).map((e=>[e.element,...e.others])).getOr([]);H(r,(e=>Je(e,o.target)))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(zs(),o))}}))})),y=()=>r(Bm(),{}),w=t=>{t.state&&r(Rm(),{target:Le.fromDom(e.getContainer())})},x=e=>{r(Rm(),{target:Le.fromDom(e.relatedTarget.getContainer())})},C=t=>e.dispatch("focusin",t),S=t=>e.dispatch("focusout",t);e.on("PostRender",(()=>{e.on("click",u),e.on("tap",u),e.on("mouseup",g),e.on("mousedown",h),e.on("ScrollWindow",p),e.on("ResizeWindow",f),e.on("ResizeEditor",y),e.on("AfterProgressState",w),e.on("DismissPopups",x),z([t,...o],(e=>{e.element.dom.addEventListener("focusin",C),e.element.dom.addEventListener("focusout",S)}))})),e.on("remove",(()=>{e.off("click",u),e.off("tap",u),e.off("mouseup",g),e.off("mousedown",h),e.off("ScrollWindow",p),e.off("ResizeWindow",f),e.off("ResizeEditor",y),e.off("AfterProgressState",w),e.off("DismissPopups",x),z([t,...o],(e=>{e.element.dom.removeEventListener("focusin",C),e.element.dom.removeEventListener("focusout",S)})),d.unbind(),i.unbind(),l.unbind(),c.unbind(),m.unbind(),b.unbind()})),e.on("detach",(()=>{z([t,...o],xm),z([t,...o],(e=>e.destroy()))}))})(e,o.mothership,a),r.setup(e,y.popup.shared,h),AL(e,y.popup),QL(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();z(ae(t),(o=>{const n=t[o],r=()=>we(D.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(r())},onSetup:t=>{t.setActive(r());const o=()=>t.setActive(r());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})}))})(e),hN(e,b,y.popup.shared),pL(e,c,s.sink,{backstage:y.popup}),$H(e,s.sink);const v={targetNode:e.getElement(),height:C(o.outerContainer)};return n.render(e,t,p,y.popup,v)};return{popups:{backstage:y.popup,getMothership:()=>QH("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>QH("dialogs",i)},renderUI:()=>{const o=x(),n=(()=>{const t=qb(e),o=Je(xt(),t)&&"grid"===Lt(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...Nv.isRtl()?{dir:"rtl"}:{}}},behaviours:Gl([sm.config({useFixed:()=>r.isDocked(h)})])},s={dom:{styles:{width:document.body.clientWidth+"px"}},events:Xs([ea(Rs(),(e=>{Nt(e.element,"width",document.body.clientWidth+"px")}))])},a=Ti(Cn(n,o?s:{})),l=pk(a);return i.set(l),{sink:a,mothership:l}})(),a=Yb(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...Nv.isRtl()?{dir:"rtl"}:{}}},behaviours:Gl([sm.config({useFixed:()=>r.isDocked(h),getBounds:()=>t.getPopupSinkBounds()})])},o=Ti(e),n=pk(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(n);s.dialogUi.set(n),s.popupUi.set(a),s.mainUi.set(o);const d={popupUi:a,dialogUi:n,mainUi:o,uiMotherships:s.getUiMotherships()};return S(d)}}},tI=w([mr("lazySink"),wr("dragBlockClass"),Br("getBounds",Qo),Or("useTabstopAt",O),Or("firstTabstop",0),Or("eventOrder",{}),Qm("modalBehaviours",[Op]),ol("onExecute"),rl("onEscape")]),oI={sketch:x},nI=w([Au({name:"draghandle",overrides:(e,t)=>({behaviours:Gl([ZH.config({mode:"mouse",getTarget:e=>Ri(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})])})}),Ou({schema:[mr("dom")],name:"title"}),Ou({factory:oI,schema:[mr("dom")],name:"close"}),Ou({factory:oI,schema:[mr("dom")],name:"body"}),Au({factory:oI,schema:[mr("dom")],name:"footer"}),Du({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[Or("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Or("components",[])],name:"blocker"})]),rI=ng({name:"ModalDialog",configFields:tI(),partFields:nI(),factory:(e,t,o,n)=>{const r=_c(),s=wa("modal-events"),a={...e.eventOrder,[Bs()]:[s].concat(e.eventOrder["alloy.system.attached"]||[])};return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{r.set(t);const o=e.lazySink(t).getOrDie(),s=n.blocker(),a=o.getSystem().build({...s,components:s.components.concat([Oi(t)]),behaviours:Gl([Up.config({}),Pp("dialog-blocker-events",[ia(as(),(()=>{mN.isBlocked(t)||Op.focusIn(t)}))])])});gm(o,a),Op.focusIn(t)},hide:e=>{r.clear(),rt(e.element).each((t=>{e.getSystem().getByDom(t).each((e=>{fm(e)}))}))},getBody:t=>Uu(t,e,"body"),getFooter:t=>Zu(t,e,"footer"),setIdle:e=>{mN.unblock(e)},setBusy:(e,t)=>{mN.block(e,t)}},eventOrder:a,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:tu(e.modalBehaviours,[Ip.config({}),Op.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),mN.config({getRoot:r.get}),Pp(s,[la((t=>{((e,t)=>{const o=Tt(e,"id").fold((()=>{const e=wa("dialog-label");return kt(t,"id",e),e}),x);kt(e,"aria-labelledby",o)})(t.element,Uu(t,e,"title").element)}))])])}},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)}}}),sI=Fn([Zy,Uy].concat(Pw)),aI=Gn,iI=[pw("button"),ow,Nr("align","end",["start","end"]),dw,cw,kr("buttonType",["primary","secondary"])],lI=[...iI,Wy],cI=[pr("type",["submit","cancel","custom"]),...lI],dI=[pr("type",["menu"]),tw,nw,ow,yr("items",sI),...iI],mI=[...iI,pr("type",["togglebutton"]),nw,ow,tw,Rr("active",!1)],uI=ar("type",{submit:cI,cancel:cI,custom:cI,menu:dI,togglebutton:mI}),gI=[Zy,Wy,pr("level",["info","warn","error","success"]),qy,Or("url","")],hI=Fn(gI),pI=[Zy,Wy,cw,pw("button"),ow,lw,kr("buttonType",["primary","secondary","toolbar"]),dw],fI=Fn(pI),vI=[Zy,Uy],bI=vI.concat([rw]),yI=vI.concat([jy,cw]),wI=Fn(yI),xI=Gn,CI=bI.concat([mw("auto")]),SI=Fn(CI),kI=Un([Gy,Wy,qy]),_I=bI.concat([Mr("storageKey","default")]),EI=Fn(_I),TI=qn,OI=Fn(bI),DI=qn,AI=vI.concat([Mr("tag","textarea"),hr("scriptId"),hr("scriptUrl"),_r("onFocus"),((e,t)=>Dr(e,t,Xn))("settings",void 0)]),MI=vI.concat([Mr("tag","textarea"),fr("init")]),NI=er((e=>or("customeditor.old",Pn(MI),e).orThunk((()=>or("customeditor.new",Pn(AI),e))))),RI=qn,BI=Fn(bI),LI=zn(Nn),HI=e=>[Zy,gr("columns"),e],II=[Zy,hr("html"),Nr("presets","presentation",["presentation","document"])],PI=Fn(II),FI=bI.concat([Rr("border",!1),Rr("sandboxed",!0),Rr("streamContent",!1),Rr("transparent",!0)]),zI=Fn(FI),VI=qn,ZI=Fn(vI.concat([Sr("height")])),UI=Fn([hr("url"),Cr("zoom"),Cr("cachedWidth"),Cr("cachedHeight")]),jI=bI.concat([Sr("inputMode"),Sr("placeholder"),Rr("maximized",!1),cw]),WI=Fn(jI),$I=qn,qI=e=>[Zy,jy,e,Nr("align","start",["start","center","end"])],GI=[Wy,Gy],KI=[Wy,yr("items",ir(0,(()=>YI)))],YI=Vn([Fn(GI),Fn(KI)]),XI=bI.concat([yr("items",YI),cw]),JI=Fn(XI),QI=qn,eP=bI.concat([br("items",[Wy,Gy]),Ar("size",1),cw]),tP=Fn(eP),oP=qn,nP=bI.concat([Rr("constrain",!0),cw]),rP=Fn(nP),sP=Fn([hr("width"),hr("height")]),aP=vI.concat([jy,Ar("min",0),Ar("max",0)]),iP=Fn(aP),lP=$n,cP=[Zy,yr("header",qn),yr("cells",zn(qn))],dP=Fn(cP),mP=bI.concat([Sr("placeholder"),Rr("maximized",!1),cw]),uP=Fn(mP),gP=qn,hP=[pr("type",["directory","leaf"]),$y,hr("id"),xr("menu",WM)],pP=Fn(hP),fP=hP.concat([yr("children",ir(0,(()=>Qn("type",{directory:vP,leaf:pP}))))]),vP=Fn(fP),bP=Qn("type",{directory:vP,leaf:pP}),yP=[Zy,yr("items",bP),_r("onLeafAction"),_r("onToggleExpand"),Lr("defaultExpandedIds",[],qn),Sr("defaultSelectedId")],wP=Fn(yP),xP=bI.concat([Nr("filetype","file",["image","media","file"]),cw,Sr("picker_text")]),CP=Fn(xP),SP=Fn([Gy,uw]),kP=e=>lr("items","items",{tag:"required",process:{}},zn(er((t=>or(`Checking item of ${e}`,_P,t).fold((e=>nn.error(sr(e))),(e=>nn.value(e))))))),_P=Hn((()=>{return Qn("type",{alertbanner:hI,bar:Fn((e=kP("bar"),[Zy,e])),button:fI,checkbox:wI,colorinput:EI,colorpicker:OI,dropzone:BI,grid:Fn(HI(kP("grid"))),iframe:zI,input:WI,listbox:JI,selectbox:tP,sizeinput:rP,slider:iP,textarea:uP,urlinput:CP,customeditor:NI,htmlpanel:PI,imagepreview:ZI,collection:SI,label:Fn(qI(kP("label"))),table:dP,tree:wP,panel:TP});var e})),EP=[Zy,Or("classes",[]),yr("items",_P)],TP=Fn(EP),OP=[pw("tab"),$y,yr("items",_P)],DP=[Zy,br("tabs",OP)],AP=Fn(DP),MP=lI,NP=uI,RP=Fn([hr("title"),ur("body",Qn("type",{panel:TP,tabpanel:AP})),Mr("size","normal"),Lr("buttons",[],NP),Or("initialData",{}),Br("onAction",v),Br("onChange",v),Br("onSubmit",v),Br("onClose",v),Br("onCancel",v),Br("onTabChange",v)]),BP=Fn([pr("type",["cancel","custom"]),...MP]),LP=Fn([hr("title"),hr("url"),Cr("height"),Cr("width"),Er("buttons",BP),Br("onAction",v),Br("onCancel",v),Br("onClose",v),Br("onMessage",v)]),HP=e=>a(e)?[e].concat(G(fe(e),HP)):l(e)?G(e,HP):[],IP=e=>s(e.type)&&s(e.name),PP={checkbox:xI,colorinput:TI,colorpicker:DI,dropzone:LI,input:$I,iframe:VI,imagepreview:UI,selectbox:oP,sizeinput:sP,slider:lP,listbox:QI,size:sP,textarea:gP,urlinput:SP,customeditor:RI,collection:kI,togglemenuitem:aI},FP=e=>{const t=(e=>Z(HP(e),IP))(e),o=G(t,(e=>(e=>D.from(PP[e.type]))(e).fold((()=>[]),(t=>[ur(e.name,t)]))));return Fn(o)},zP=e=>{var t;return{internalDialog:nr(or("dialog",RP,e)),dataValidator:FP(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},VP={open:(e,t)=>{const o=zP(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(nr(or("dialog",LP,t))),redial:e=>zP(e)};var ZP=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each((e=>{const r=e(o,n);t.set(r)})),e.renderComponents.each((r=>{const s=r(n,t.get());(e.reuseDom?Ap:Dp)(o,s)}))};return Xs([ea(Cs(),((t,n)=>{const r=n;if(!r.universal){const n=e.channel;L(r.channels,n)&&o(t,r.data)}})),la(((t,n)=>{e.initialData.each((e=>{o(t,e)}))}))])}});var UP=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),jP=[mr("channel"),wr("renderComponents"),wr("updateState"),wr("initialData"),Rr("reuseDom",!0)];const WP=Yl({fields:jP,name:"reflecting",active:ZP,apis:UP,state:Object.freeze({__proto__:null,init:()=>{const e=Ir(D.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(D.none())}}})}),$P=e=>{const t=[],o={};return le(e,((e,n)=>{e.fold((()=>{t.push(n)}),(e=>{o[n]=e}))})),t.length>0?nn.error(t):nn.value(o)},qP=(e,t,o)=>{const n=Lf(ZE.sketch((n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:F(e.items,(e=>ED(n,e,t,o)))}))));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:Gl([Op.config({mode:"acyclic",useTabstopAt:k(vT)}),XE(n),eT(n,{postprocess:e=>$P(e).fold((e=>(console.error(e),{})),x)}),Pp("dialog-body-panel",[ea(as(),((e,t)=>{e.getSystem().broadcastOn([ST],{newFocus:D.some(t.event.target)})}))])])}},GP=og({name:"TabButton",configFields:[Or("uid",void 0),mr("value"),lr("dom","dom",En((()=>({attributes:{role:"tab",id:wa("aria"),"aria-selected":"false"}}))),jn()),wr("action"),Or("domModification",{}),Qm("tabButtonBehaviours",[Up,Op,Jm]),mr("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:ef(e.action),behaviours:tu(e.tabButtonBehaviours,[Up.config({}),Op.config({mode:"execution",useSpace:!0,useEnter:!0}),Jm.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),KP=w([mr("tabs"),mr("dom"),Or("clickToDismiss",!1),Qm("tabbarBehaviours",[Ng,Op]),Qi(["tabClass","selectedClass"])]),YP=Mu({factory:GP,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Ng.dehighlight(e,t),$s(e,Zs(),{tabbar:e,button:t})},o=(e,t)=>{Ng.highlight(e,t),$s(e,Vs(),{tabbar:e,button:t})};return{action:n=>{const r=n.getSystem().getByUid(e.uid).getOrDie(),s=Ng.isHighlighted(r,n);(s&&e.clickToDismiss?t:s?v:o)(r,n)},domModification:{classes:[e.markers.tabClass]}}}}),XP=w([YP]),JP=ng({name:"Tabbar",configFields:KP(),partFields:XP(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:tu(e.tabbarBehaviours,[Ng.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{kt(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{kt(t.element,"aria-selected","false")}}),Op.config({mode:"flow",getInitial:e=>Ng.getHighlighted(e).map((e=>e.element)),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),QP=og({name:"Tabview",configFields:[Qm("tabviewBehaviours",[Ip])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:tu(e.tabviewBehaviours,[Ip.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),eF=w([Or("selectFirst",!0),tl("onChangeTab"),tl("onDismissTab"),Or("tabs",[]),Qm("tabSectionBehaviours",[])]),tF=Ou({factory:JP,schema:[mr("dom"),vr("markers",[mr("tabClass"),mr("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),oF=Ou({factory:QP,name:"tabview"}),nF=w([tF,oF]),rF=ng({name:"TabSection",configFields:eF(),partFields:nF(),factory:(e,t,o,n)=>{const r=(t,o)=>{Zu(t,e,"tabbar").each((e=>{o(e).each(qs)}))};return{uid:e.uid,dom:e.dom,components:t,behaviours:eu(e.tabSectionBehaviours),events:Xs(q([e.selectFirst?[la(((e,t)=>{r(e,Ng.getFirst)}))]:[],[ea(Vs(),((t,o)=>{(t=>{const o=Jm.getValue(t);Zu(t,e,"tabview").each((n=>{const r=W(e.tabs,(e=>e.value===o));r.each((o=>{const r=o.view();Tt(t.element,"id").each((e=>{kt(n.element,"aria-labelledby",e)})),Ip.set(n,r),e.onChangeTab(n,t,r)}))}))})(o.event.button)})),ea(Zs(),((t,o)=>{const n=o.event.button;e.onDismissTab(t,n)}))]])),apis:{getViewItems:t=>Zu(t,e,"tabview").map((e=>Ip.contents(e))).getOr([]),showTab:(e,t)=>{r(e,(e=>{const o=Ng.getCandidates(e);return W(o,(e=>Jm.getValue(e)===t)).filter((t=>!Ng.isHighlighted(e,t)))}))}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),sF=(e,t)=>{Nt(e,"height",t+"px"),Nt(e,"flex-basis",t+"px")},aF=(e,t,o)=>{Ri(e,'[role="dialog"]').each((e=>{Li(e,'[role="tablist"]').each((n=>{o.get().map((o=>(Nt(t,"height","0"),Nt(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=ot(e).dom,r=Ri(e,".tox-dialog-wrap").getOr(e);let s;s="fixed"===Lt(r,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=jt(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+Jt(o)?Math.max(jt(o),a):a,l=parseInt(Lt(e,"margin-top"),10)||0,c=parseInt(Lt(e,"margin-bottom"),10)||0;return s-(jt(e)+l+c-i)})(e,t,n))))).each((e=>{sF(t,e)}))}))}))},iF=e=>Li(e,'[role="tabpanel"]'),lF=e=>{const t=_c(),o=[la((o=>{const n=o.element;iF(n).each((r=>{Nt(r,"visibility","hidden"),o.getSystem().getByDom(r).toOptional().each((o=>{const n=((e,t,o)=>F(e,((n,r)=>{Ip.set(o,e[r].view());const s=t.dom.getBoundingClientRect();return Ip.set(o,[]),s.height})))(e,r,o),s=(e=>oe(ee(e,((e,t)=>e>t?-1:e{oe(e).each((e=>rF.showTab(t,e.value)))})(e,o),requestAnimationFrame((()=>{aF(n,r,t)}))}))})),ea(Rs(),(e=>{const o=e.element;iF(o).each((e=>{aF(o,e,t)}))})),ea(Lk,((e,o)=>{const n=e.element;iF(n).each((e=>{const o=sc(pt(e));Nt(e,"visibility","hidden");const r=It(e,"height").map((e=>parseInt(e,10)));zt(e,"height"),zt(e,"flex-basis");const s=e.dom.getBoundingClientRect().height;r.forall((e=>s>e))?(t.set(s),aF(n,e,t)):r.each((t=>{sF(e,t)})),zt(e,"visibility"),o.each(oc)}))}))];return{extraEvents:o,selectFirst:!1}},cF="send-data-to-section",dF="send-data-to-view",mF=(e,t,o)=>{const n=Ir({}),r=e=>{const t=Jm.getValue(e),o=$P(t).getOr({}),r=n.get(),s=Cn(r,o);n.set(s)},s=e=>{const t=n.get();Jm.setValue(e,t)},a=Ir(null),i=F(e.tabs,(e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[Si(o.shared.providers.translate(e.title))],view:()=>[ZE.sketch((n=>({dom:{tag:"div",classes:["tox-form"]},components:F(e.items,(e=>ED(n,e,t,o))),formBehaviours:Gl([Op.config({mode:"acyclic",useTabstopAt:k(vT)}),Pp("TabView.form.events",[la(s),ca(r)]),ec.config({channels:Vr([{key:cF,value:{onReceive:r}},{key:dF,value:{onReceive:s}}])})])})))]}))),l=lF(i);return rF.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=Jm.getValue(t);$s(e,Bk,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[rF.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[JP.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:Gl([xk.config({})])}),rF.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:Gl([Pp("tabpanel",l.extraEvents),Op.config({mode:"acyclic"}),ig.config({find:e=>oe(rF.getViewItems(e))}),tT(D.none(),(e=>(e.getSystem().broadcastOn([cF],{}),n.get())),((e,t)=>{n.set(t),e.getSystem().broadcastOn([dF],{})}))])})},uF=(e,t,o,n,r)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map((e=>({id:e}))).getOr({}),...r?{"aria-live":"polite"}:{}}},components:[],behaviours:Gl([JE(0),WP.config({channel:`${wT}-${t}`,updateState:(e,t)=>D.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[mF(t,e.initialData,n)]:[qP(t,e.initialData,n)]},initialData:e})])}),gF=Gv.deviceType.isTouch(),hF=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),pF=(e,t)=>rI.parts.close(Rf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:Gl([xk.config({})])})),fF=()=>rI.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),vF=(e,t)=>rI.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:Bf(`

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

    `)}]}]}),bF=e=>rI.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),yF=(e,t)=>[hk.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),hk.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],wF=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",r=t+"__disable-scroll";return rI.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),D.some(!0)),useTabstopAt:e=>!vT(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:Bf(`
    `),components:[{dom:{tag:"div",classes:gF?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:Gl([Up.config({}),Pp("dialog-events",e.dialogEvents.concat([ia(as(),((e,t)=>{mN.isBlocked(e)||Op.focusIn(e)})),ea(Ps(),((e,t)=>{e.getSystem().broadcastOn([ST],{newFocus:t.event.newFocus})}))])),Pp("scroll-lock",[la((()=>{oi(xt(),r)})),ca((()=>{ri(xt(),r)}))]),...e.extraBehaviours]),eventOrder:{[Ss()]:["dialog-events"],[Bs()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[Ls()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},xF=e=>Rf.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:Gl([xk.config({}),lx.config(e.tooltips.getConfig({tooltipText:e.translate("Close")}))]),components:[Vv("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Ws(e,Dk)}}),CF=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...o.map((e=>({id:e}))).getOr({})}},components:[],behaviours:Gl([WP.config({channel:`${yT}-${t}`,initialData:e,renderComponents:e=>[Si(n.translate(e.title))]})])}),SF=()=>({dom:Bf('
    ')}),kF=(e,t,o)=>((e,t,o)=>{const n=rI.parts.title(CF(e,t,D.none(),o)),r=rI.parts.draghandle(SF()),s=rI.parts.close(xF(o)),a=[n].concat(e.draggable?[r]:[]).concat([s]);return hk.sketch({dom:Bf('
    '),components:a})})({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),_F=(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:Bf('
    ')}]}),EF=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=Li(e().element,".tox-dialog__header").map((e=>jt(e)));rI.setBusy(e(),((e,r)=>_F(o.message,r,t,n)))},onUnblock:()=>{rI.setIdle(e())}}),TF="tox-dialog--fullscreen",OF="tox-dialog--width-lg",DF="tox-dialog--width-md",AF=e=>{switch(e){case"large":return D.some(OF);case"medium":return D.some(DF);default:return D.none()}},MF=(e,t)=>{const o=Le.fromDom(t.element.dom);ai(o,TF)||(li(o,[OF,DF]),AF(e).each((e=>oi(o,e))))},NF=(e,t)=>{const o=Le.fromDom(e.element.dom),n=ci(o),r=W(n,(e=>e===OF||e===DF)).or(AF(t));((e,t)=>{z(t,(t=>{si(e,t)}))})(o,[TF,...r.toArray()])},RF=(e,t,o)=>Ti(wF({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[nT({}),...e.extraBehaviours],onEscape:e=>{Ws(e,Dk)},dialogEvents:t,eventOrder:{[Cs()]:[WP.name(),ec.name()],[Bs()]:["scroll-lock",WP.name(),"messages","dialog-events","alloy.base.behaviour"],[Ls()]:["alloy.base.behaviour","dialog-events","messages",WP.name(),"scroll-lock"]}})),BF=(e,t={})=>F(e,(e=>"menu"===e.type?(e=>{const o=F(e.items,(e=>{const o=ve(t,e.name).getOr(Ir(!1));return{...e,storage:o}}));return{...e,items:o}})(e):e)),LF=e=>j(e,((e,t)=>{if("menu"===t.type){return j(t.items,((e,t)=>(e[t.name]=t.storage,e)),e)}return e}),{}),HF=(e,t)=>[ra(as(),fT),e(Ok,((e,o,n,r)=>{sc(pt(r.element)).fold(v,nc),t.onClose(),o.onClose()})),e(Dk,((e,t,o,n)=>{t.onCancel(e),Ws(n,Ok)})),ea(Rk,((e,o)=>t.onUnblock())),ea(Nk,((e,o)=>t.onBlock(o.event)))],IF=(e,t,o)=>{const n=(t,o)=>ea(t,((t,n)=>{r(t,((r,s)=>{o(e(),r,n.event,t)}))})),r=(e,t)=>{WP.getState(e).get().each((o=>{t(o.internalDialog,e)}))};return[...HF(n,t),n(Mk,((e,t)=>t.onSubmit(e))),n(Tk,((e,t,o)=>{t.onChange(e,{name:o.name})})),n(Ak,((e,t,n,r)=>{const s=()=>r.getSystem().isConnected()?Op.focusIn(r):void 0,a=e=>Ot(e,"disabled")||Tt(e,"aria-disabled").exists((e=>"true"===e)),i=pt(r.element),l=sc(i);t.onAction(e,{name:n.name,value:n.value}),sc(i).fold(s,(e=>{a(e)||l.exists((t=>Qe(e,t)&&a(t)))?s():o().toOptional().filter((t=>!Qe(t.element,e))).each(s)}))})),n(Bk,((e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})})),ca((t=>{const o=e();Jm.setValue(t,o.getData())}))]},PF=(e,t)=>{const o=t.map((e=>e.footerButtons)).getOr([]),n=V(o,(e=>"start"===e.align)),r=(e,t)=>hk.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:F(t,(e=>e.memento.asSpec()))});return[r("start",n.pass),r("end",n.fail)]},FF=(e,t,o)=>({dom:Bf(''),components:[],behaviours:Gl([WP.config({channel:`${xT}-${t}`,initialData:e,updateState:(e,t)=>{const n=F(t.buttons,(e=>{const t=Lf(((e,t)=>lD(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}}));return D.some({lookupByName:t=>((e,t,o)=>W(t,(e=>e.name===o)).bind((t=>t.memento.getOpt(e))))(e,n,t),footerButtons:n})},renderComponents:PF})])}),zF=(e,t,o)=>rI.parts.footer(FF(e,t,o)),VF=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=ig.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return ZE.getField(o,t).orThunk((()=>{const o=e.getFooter().bind((e=>WP.getState(e).get()));return o.bind((e=>e.lookupByName(t)))}))}return D.none()},ZF=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},r={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...Jm.getValue(n),...ce(o,(e=>e.get()))}},setData:t=>{n((n=>{const s=r.getData(),a=Cn(s,t),i=((e,t)=>{const o=e.getRoot();return WP.getState(o).get().map((e=>nr(or("data",e.dataValidator,t)))).getOr(t)})(e,a),l=e.getFormWrapper();Jm.setValue(l,i),le(o,((e,t)=>{be(a,t)&&e.set(a[t])}))}))},setEnabled:(t,o)=>{VF(e,t).each(o?xg.enable:xg.disable)},focus:t=>{VF(e,t).each(Up.focus)},block:e=>{if(!s(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n((t=>{$s(t,Nk,{message:e})}))},unblock:()=>{n((e=>{Ws(e,Rk)}))},showTab:t=>{n((o=>{const n=e.getBody();WP.getState(n).get().exists((e=>e.isTabPanel()))&&ig.getCurrent(n).each((e=>{rF.showTab(e,t)}))}))},redial:s=>{n((n=>{const a=e.getId(),i=t(s),l=BF(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${bT}-${a}`],i),n.getSystem().broadcastOn([`${yT}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${wT}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${xT}-${a}`],{...i.internalDialog,buttons:l}),r.setData(i.initialData)}))},close:()=>{n((e=>{Ws(e,Ok)}))},toggleFullscreen:e.toggleFullscreen};return r},UF=(e,t,o)=>{const n=wa("dialog"),r=e.internalDialog,s=kF(r.title,n,o),a=Ir(r.size),i=AF(a.get()).toArray(),l=((e,t,o)=>{const n=uF(e,t,D.none(),o,!1);return rI.parts.body(n)})({body:r.body,initialData:r.initialData},n,o),c=BF(r.buttons),d=LF(c),m=ke(0!==c.length,zF({buttons:c},n,o)),u=IF((()=>f),EF((()=>h),o.shared.providers,t),o.shared.getSink),g={id:n,header:s,body:l,footer:m,extraClasses:i,extraBehaviours:[WP.config({channel:`${bT}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),MF(t.internalDialog.size,e),D.some(t)),initialData:e})],extraStyles:{}},h=RF(g,u,o),p={getId:w(n),getRoot:w(h),getBody:()=>rI.getBody(h),getFooter:()=>rI.getFooter(h),getFormWrapper:()=>{const e=rI.getBody(h);return ig.getCurrent(e).getOr(e)},toggleFullscreen:()=>{NF(h,a.get())}},f=ZF(p,t.redial,d);return{dialog:h,instanceApi:f}},jF=(e,t,o,n=!1,r)=>{const s=wa("dialog"),a=wa("dialog-label"),i=wa("dialog-content"),l=e.internalDialog,c=Ir(l.size),d=AF(c.get()).toArray(),m=Lf(((e,t,o,n)=>hk.sketch({dom:Bf('
    '),components:[CF(e,t,D.some(o),n),SF(),xF(n)],containerBehaviours:Gl([ZH.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>Hi(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:l.title,draggable:!0},s,a,o.shared.providers)),u=Lf(((e,t,o,n,r)=>uF(e,t,D.some(o),n,r))({body:l.body,initialData:l.initialData},s,i,o,n)),g=BF(l.buttons),h=LF(g),p=ke(0!==g.length,Lf(((e,t,o)=>FF(e,t,o))({buttons:g},s,o))),f=IF((()=>b),{onBlock:e=>{mN.block(v,((t,n)=>{const r=m.getOpt(v).map((e=>jt(e.element)));return _F(e.message,n,o.shared.providers,r)}))},onUnblock:()=>{mN.unblock(v)},onClose:()=>t.closeWindow()},o.shared.getSink),v=Ti({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog","aria-labelledby":a}},eventOrder:{[Cs()]:[WP.name(),ec.name()],[Ss()]:["execute-on-form"],[Bs()]:["reflecting","execute-on-form"]},behaviours:Gl([Op.config({mode:"cyclic",onEscape:e=>(Ws(e,Ok),D.some(!0)),useTabstopAt:e=>!vT(e)&&("button"!==Ve(e)||"disabled"!==Et(e,"disabled")),firstTabstop:1}),WP.config({channel:`${bT}-${s}`,updateState:(e,t)=>(c.set(t.internalDialog.size),MF(t.internalDialog.size,e),r(),D.some(t)),initialData:e}),Up.config({}),Pp("execute-on-form",f.concat([ia(as(),((e,t)=>{Op.focusIn(e)})),ea(Ps(),((e,t)=>{e.getSystem().broadcastOn([ST],{newFocus:t.event.newFocus})}))])),mN.config({getRoot:()=>D.some(v)}),Ip.config({}),nT({})]),components:[m.asSpec(),u.asSpec(),...p.map((e=>e.asSpec())).toArray()]}),b=ZF({getId:w(s),getRoot:w(v),getFooter:()=>p.map((e=>e.get(v))),getBody:()=>u.get(v),getFormWrapper:()=>{const e=u.get(v);return ig.getCurrent(e).getOr(e)},toggleFullscreen:()=>{NF(v,c.get())}},t.redial,h);return{dialog:v,instanceApi:b}};var WF=tinymce.util.Tools.resolve("tinymce.util.URI");const $F=["insertContent","setContent","execCommand","close","block","unblock"],qF=e=>a(e)&&-1!==$F.indexOf(e.mceAction),GF=(e,t,o,n)=>{const r=wa("dialog"),i=kF(e.title,r,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[hT(D.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:Gl([xk.config({}),Up.config({})])})]}],behaviours:Gl([Op.config({mode:"acyclic",useTabstopAt:k(vT)})])};return rI.parts.body(t)})(e),c=e.buttons.bind((e=>0===e.length?D.none():D.some(zF({buttons:e},r,n)))),m=((e,t)=>{const o=(t,o)=>ea(t,((t,r)=>{n(t,((n,s)=>{o(e(),n,r.event,t)}))})),n=(e,t)=>{WP.getState(e).get().each((o=>{t(o,e)}))};return[...HF(o,t),o(Ak,((e,t,o)=>{t.onAction(e,{name:o.name})}))]})((()=>w),EF((()=>y),n.shared.providers,t)),u={...e.height.fold((()=>({})),(e=>({height:e+"px","max-height":e+"px"}))),...e.width.fold((()=>({})),(e=>({width:e+"px","max-width":e+"px"})))},h=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],p=new WF(e.url,{base_uri:new WF(window.location.href)}),f=`${p.protocol}://${p.host}${p.port?":"+p.port:""}`,v=kc(),b=[WP.config({channel:`${bT}-${r}`,updateState:(e,t)=>D.some(t),initialData:e}),Pp("messages",[la((()=>{const t=Tc(Le.fromDom(window),"message",(t=>{if(p.isSameOrigin(new WF(t.raw.origin))){const n=t.raw.data;qF(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,w,n):(e=>!qF(e)&&a(e)&&be(e,"mceAction"))(n)&&e.onMessage(w,n)}}));v.set(t)})),ca(v.clear)]),ec.config({channels:{[CT]:{onReceive:(e,t)=>{Li(e.element,"iframe").each((e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)}))}}}})],y=RF({id:r,header:i,body:l,footer:c,extraClasses:h,extraBehaviours:b,extraStyles:u},m,n),w=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!s(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t((t=>{$s(t,Nk,{message:e})}))},unblock:()=>{t((e=>{Ws(e,Rk)}))},close:()=>{t((e=>{Ws(e,Ok)}))},sendMessage:e=>{t((t=>{t.getSystem().broadcastOn([CT],e)}))}}})(y);return{dialog:y,instanceApi:w}},KF=(e,t)=>nr(or("data",t,e)),YF=e=>tk(e,".tox-alert-dialog")||tk(e,".tox-confirm-dialog"),XF=(e,t,o)=>t&&o?[]:[NM.config({contextual:{lazyContext:()=>D.some(Yo(Le.fromDom(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>QS(e,t.element).map((e=>({bounds:ek(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})}))).getOrThunk((()=>({bounds:Qo(),optScrollEnv:D.none()})))})],JF=e=>{const t=e.editor,o=Kb(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const r=()=>{rI.hide(l),n()},s=Lf(lD({name:"close-alert",text:"OK",primary:!0,buttonType:D.some("primary"),align:"end",enabled:!0,icon:D.none()},"cancel",e)),a=fF(),i=pF(r,t.providers),l=Ti(wF({lazySink:()=>t.getSink(),header:hF(a,i),body:vF(o,t.providers),footer:D.some(bF(yF([],[s.asSpec()]))),onEscape:r,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[ea(Dk,r)],eventOrder:{}}));rI.show(l);const c=s.get(l);Up.focus(c)}}})(e.backstages.dialog),r=(e=>{const t=e.shared;return{open:(o,n)=>{const r=e=>{rI.hide(c),n(e)},s=Lf(lD({name:"yes",text:"Yes",primary:!0,buttonType:D.some("primary"),align:"end",enabled:!0,icon:D.none()},"submit",e)),a=lD({name:"no",text:"No",primary:!1,buttonType:D.some("secondary"),align:"end",enabled:!0,icon:D.none()},"cancel",e),i=fF(),l=pF((()=>r(!1)),t.providers),c=Ti(wF({lazySink:()=>t.getSink(),header:hF(i,l),body:vF(o,t.providers),footer:D.some(bF(yF([],[a,s.asSpec()]))),onEscape:()=>r(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[ea(Dk,(()=>r(!1))),ea(Mk,(()=>r(!0)))],eventOrder:{}}));rI.show(c);const d=s.get(c);Up.focus(d)}}})(e.backstages.dialog),s=(o,n)=>VP.openUrl((o=>{const r=GF(o,{closeWindow:()=>{rI.hide(r.dialog),n(r.instanceApi)}},t,e.backstages.dialog);return rI.show(r.dialog),r.instanceApi}),o),a=(t,o)=>VP.open(((t,n,r)=>{const s=n,a=UF({dataValidator:r,initialData:s,internalDialog:t},{redial:VP.redial,closeWindow:()=>{rI.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return rI.show(a.dialog),a.instanceApi.setData(s),a.instanceApi}),t),i=(n,r,s,a)=>VP.open(((n,i,l)=>{const c=KF(i,l),d=_c(),m=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>d.on((e=>{Mf.reposition(e),o&&m||NM.refresh(e)})),g=jF({dataValidator:l,initialData:c,internalDialog:n},{redial:VP.redial,closeWindow:()=>{d.on(Mf.hide),t.off("ResizeEditor",u),d.clear(),s(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,u),h=Ti(Mf.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...m?{}:{fireRepositionEventInstead:{}},inlineBehaviours:Gl([Pp("window-manager-inline-events",[ea(Hs(),((e,t)=>{Ws(g.dialog,Dk)}))]),...XF(t,o,m)]),isExtraPart:(e,t)=>YF(t)}));d.set(h);return Mf.showWithinBounds(h,Oi(g.dialog),{anchor:r},(()=>{const e=t.inline?xt():Le.fromDom(t.getContainer()),o=Yo(e);return D.some(o)})),o&&m||(NM.refresh(h),t.on("ResizeEditor",u)),g.instanceApi.setData(c),Op.focusIn(g.dialog),g.instanceApi}),n),l=(o,n,r,s)=>VP.open(((o,a,i)=>{const l=KF(a,i),c=_c(),d=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>c.on((e=>{Mf.reposition(e),NM.refresh(e)})),u=jF({dataValidator:i,initialData:l,internalDialog:o},{redial:VP.redial,closeWindow:()=>{c.on(Mf.hide),t.off("ResizeEditor ScrollWindow ElementScroll",m),c.clear(),r(u.instanceApi)}},e.backstages.popup,s.ariaAttrs,m),g=Ti(Mf.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:s.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:Gl([Pp("window-manager-inline-events",[ea(Hs(),((e,t)=>{Ws(u.dialog,Dk)}))]),NM.config({contextual:{lazyContext:()=>D.some(Yo(Le.fromDom(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>QS(t,e.element).map((e=>({bounds:ek(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})}))).getOrThunk((()=>({bounds:Qo(),optScrollEnv:D.none()})))})]),isExtraPart:(e,t)=>YF(t)}));c.set(g);return Mf.showWithinBounds(g,Oi(u.dialog),{anchor:n},(()=>e.backstages.popup.shared.getSink().toOptional().bind((e=>{const o=QS(t,e.element).map((e=>ek(e))).getOr(Qo()),n=Yo(Le.fromDom(t.getContentAreaContainer())),r=Jo(n,o);return D.some(Ko(r.x,r.y,r.width,r.height-15))})))),NM.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",m),u.instanceApi.setData(l),Op.focusIn(u.dialog),u.instanceApi}),o);return{open:(t,o,n)=>{if(!m(o)){if("toolbar"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return l(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return i(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return a(t,n)},openUrl:(e,t)=>s(e,t),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{r.open(e,t)}}},QF=e=>{Xv(e),(e=>{const t=e.options.register,o=e=>f(e,s)?{value:TC(e),valid:!0}:{valid:!1,message:"Must be an array of strings."},n=e=>p(e)&&e>0?{value:e,valid:!0}:{valid:!1,message:"Must be a positive number."};t("color_map",{processor:o,default:["#BFEDD2","Light Green","#FBEEB8","Light Yellow","#F8CAC6","Light Red","#ECCAFA","Light Purple","#C2E0F4","Light Blue","#2DC26B","Green","#F1C40F","Yellow","#E03E2D","Red","#B96AD9","Purple","#3598DB","Blue","#169179","Dark Turquoise","#E67E23","Orange","#BA372A","Dark Red","#843FA1","Dark Purple","#236FA1","Dark Blue","#ECF0F1","Light Gray","#CED4D9","Medium Gray","#95A5A6","Gray","#7E8C8D","Dark Gray","#34495E","Navy Blue","#000000","Black","#ffffff","White"]}),t("color_map_background",{processor:o}),t("color_map_foreground",{processor:o}),t("color_cols",{processor:n,default:MC(e)}),t("color_cols_foreground",{processor:n,default:NC(e,_C)}),t("color_cols_background",{processor:n,default:NC(e,EC)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:DC}),t("color_default_background",{processor:"string",default:DC})})(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}:s(e)||f(e,s)?{value:ML(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)};en.add("silver",(e=>{QF(e);let t=()=>Qo();const{dialogs:o,popups:n,renderUI:r}=eI(e,{getPopupSinkBounds:()=>t()});KS(e,n.backstage.shared);const s=JF({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}});return{renderUI:()=>{const o=r();return QS(e,n.getMothership().element).each((e=>{t=()=>ek(e)})),o},getWindowManagerImpl:w(s),getNotificationManagerImpl:()=>((e,t,o)=>{const n=t.backstage.shared,r=()=>{const t=Yo(Le.fromDom(e.getContentAreaContainer())),o=Qo(),n=yl(o.x,t.x,t.right),r=yl(o.y,t.y,t.bottom),s=Math.max(t.right,o.right),a=Math.max(t.bottom,o.bottom);return D.some(Ko(n,r,s-n,a-r))};return{open:(t,s)=>{const a=()=>{s(),Mf.hide(l)},i=Ti(Uv.sketch({text:t.text,level:L(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:a,iconProvider:n.providers.icons,translationProvider:n.providers.translate})),l=Ti(Mf.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:n.getSink,fireDismissalEventInstead:{},...n.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}}}));o.add(l),p(t.timeout)&&t.timeout>0&&Nf.setEditorTimeout(e,(()=>{a()}),t.timeout);const c={close:a,reposition:()=>{const t=Oi(i),o={maxHeightFunction:zc()},s=e.notificationManager.getNotifications();if(s[0]===c){const e={...n.anchors.banner(),overrides:o};Mf.showWithinBounds(l,t,{anchor:e},r)}else B(s,c).each((e=>{const n=s[e-1].getEl(),a={type:"node",root:xt(),node:D.some(Le.fromDom(n)),overrides:o,layouts:{onRtl:()=>[Rl],onLtr:()=>[Rl]}};Mf.showWithinBounds(l,t,{anchor:a},r)}))},text:e=>{Uv.updateText(i,e)},settings:t,getEl:()=>i.element.dom,progressBar:{value:e=>{Uv.updateProgress(i,e)}}};return c},close:e=>{e.close()},getArgs:e=>e.settings}})(e,{backstage:n.backstage},n.getMothership())}}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.ModelManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,o=e=>t=>typeof t===e,n=e=>t=>e===t,r=t("string"),s=t("object"),a=t("array"),i=n(null),l=o("boolean"),c=n(void 0),d=e=>!(e=>null==e)(e),m=o("function"),u=o("number"),g=()=>{},h=e=>()=>e,p=e=>e,f=(e,t)=>e===t;function v(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const b=e=>t=>!e(t),y=e=>e(),w=h(!1),x=h(!0);class C{constructor(e,t){this.tag=e,this.value=t}static some(e){return new C(!0,e)}static none(){return C.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?C.some(e(this.value)):C.none()}bind(e){return this.tag?e(this.value):C.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:C.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return d(e)?C.some(e):C.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()"}}C.singletonNone=new C(!1);const S=Array.prototype.slice,k=Array.prototype.indexOf,_=Array.prototype.push,E=(e,t)=>{return o=e,n=t,k.call(o,n)>-1;var o,n},T=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),B=(e,t,o)=>(A(e,((e,n)=>{o=t(o,e,n)})),o),L=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oI(D(e,t)),F=(e,t)=>{for(let o=0,n=e.length;o{const o={};for(let n=0,r=e.length;nt>=0&&tV(e,0),U=e=>V(e,e.length-1),j=(e,t)=>{for(let o=0;o{const o=W(e);for(let n=0,r=o.length;nK(e,((e,o)=>({k:o,v:t(e,o)}))),K=(e,t)=>{const o={};return q(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},Y=(e,t)=>{const o={};return((e,t,o,n)=>{q(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))})(e,t,(e=>(t,o)=>{e[o]=t})(o),g),o},X=(e,t)=>{const o=[];return q(e,((e,n)=>{o.push(t(e,n))})),o},J=e=>X(e,p),Q=(e,t)=>$.call(e,t),ee="undefined"!=typeof window?window:Function("return this;")(),te=(e,t)=>((e,t)=>{let o=null!=t?t:ee;for(let t=0;t{const o=((e,t)=>te(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},ne=Object.getPrototypeOf,re=e=>{const t=te("ownerDocument.defaultView",e);return s(e)&&((e=>oe("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ne(e).constructor.name))},se=e=>e.dom.nodeName.toLowerCase(),ae=e=>e.dom.nodeType,ie=e=>t=>ae(t)===e,le=e=>8===ae(e)||"#comment"===se(e),ce=e=>de(e)&&re(e.dom),de=ie(1),me=ie(3),ue=ie(9),ge=ie(11),he=e=>t=>de(t)&&se(t)===e,pe=(e,t,o)=>{if(!(r(o)||l(o)||u(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+"")},fe=(e,t,o)=>{pe(e.dom,t,o)},ve=(e,t)=>{const o=e.dom;q(t,((e,t)=>{pe(o,t,e)}))},be=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},ye=(e,t)=>C.from(be(e,t)),we=(e,t)=>{e.dom.removeAttribute(t)},xe=e=>B(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Ce=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Se={fromHtml:(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 Ce(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return Ce(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return Ce(o)},fromDom:Ce,fromPoint:(e,t,o)=>C.from(e.dom.elementFromPoint(t,o)).map(Ce)},ke=(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")}},_e=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ee=(e,t)=>{const o=void 0===t?document:t.dom;return _e(o)?C.none():C.from(o.querySelector(e)).map(Se.fromDom)},Te=(e,t)=>e.dom===t.dom,Oe=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},De=ke,Ae=e=>Se.fromDom(e.dom.ownerDocument),Me=e=>ue(e)?e:Ae(e),Ne=e=>C.from(e.dom.parentNode).map(Se.fromDom),Re=e=>C.from(e.dom.parentElement).map(Se.fromDom),Be=(e,t)=>{const o=m(t)?t:w;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Se.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},Le=e=>C.from(e.dom.previousSibling).map(Se.fromDom),He=e=>C.from(e.dom.nextSibling).map(Se.fromDom),Ie=e=>D(e.dom.childNodes,Se.fromDom),Pe=(e,t)=>{const o=e.dom.childNodes;return C.from(o[t]).map(Se.fromDom)},Fe=(e,t)=>{Ne(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},ze=(e,t)=>{He(e).fold((()=>{Ne(e).each((e=>{Ze(e,t)}))}),(e=>{Fe(e,t)}))},Ve=(e,t)=>{const o=(e=>Pe(e,0))(e);o.fold((()=>{Ze(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ze=(e,t)=>{e.dom.appendChild(t.dom)},Ue=(e,t)=>{Fe(e,t),Ze(t,e)},je=(e,t)=>{A(t,((o,n)=>{const r=0===n?e:t[n-1];ze(r,o)}))},We=(e,t)=>{A(t,(t=>{Ze(e,t)}))},$e=e=>{e.dom.textContent="",A(Ie(e),(e=>{qe(e)}))},qe=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ge=e=>{const t=Ie(e);t.length>0&&je(e,t),qe(e)},Ke=(e,t)=>Se.fromDom(e.dom.cloneNode(t)),Ye=e=>Ke(e,!1),Xe=e=>Ke(e,!0),Je=(e,t)=>{const o=Se.fromTag(t),n=xe(e);return ve(o,n),o},Qe=["tfoot","thead","tbody","colgroup"],et=(e,t,o)=>({element:e,rowspan:t,colspan:o}),tt=(e,t,o)=>({element:e,cells:t,section:o}),ot=(e,t,o)=>({element:e,isNew:t,isLocked:o}),nt=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),rt=m(Element.prototype.attachShadow)&&m(Node.prototype.getRootNode),st=h(rt),at=rt?e=>Se.fromDom(e.dom.getRootNode()):Me,it=e=>{const t=at(e);return ge(o=t)&&d(o.dom.host)?C.some(t):C.none();var o},lt=e=>Se.fromDom(e.dom.host),ct=e=>d(e.dom.shadowRoot),dt=e=>{const t=me(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return it(Se.fromDom(t)).fold((()=>o.body.contains(t)),(n=dt,r=lt,e=>n(r(e))));var n,r},mt=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Se.fromDom(t)},ut=(e,t)=>{let o=[];return A(Ie(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(ut(e,t))})),o},gt=(e,t,o)=>((e,t,o)=>N(Be(e,o),t))(e,(e=>ke(e,t)),o),ht=(e,t)=>((e,t)=>N(Ie(e),t))(e,(e=>ke(e,t))),pt=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return _e(o)?[]:D(o.querySelectorAll(e),Se.fromDom)})(t,e);var ft=(e,t,o,n,r)=>e(o,n)?C.some(o):m(r)&&r(o)?C.none():t(o,n,r);const vt=(e,t,o)=>{let n=e.dom;const r=m(o)?o:w;for(;n.parentNode;){n=n.parentNode;const e=Se.fromDom(n);if(t(e))return C.some(e);if(r(e))break}return C.none()},bt=(e,t,o)=>ft(((e,t)=>t(e)),vt,e,t,o),yt=(e,t,o)=>vt(e,(e=>ke(e,t)),o),wt=(e,t)=>((e,t)=>L(e.dom.childNodes,(e=>t(Se.fromDom(e)))).map(Se.fromDom))(e,(e=>ke(e,t))),xt=(e,t)=>Ee(t,e),Ct=(e,t,o)=>ft(((e,t)=>ke(e,t)),yt,e,t,o),St=(e,t,o=f)=>e.exists((e=>o(e,t))),kt=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te?C.some(t):C.none(),Et=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Tt=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!c(n)||r+t.length<=n)},Ot=(e,t)=>Et(e,t,0),Dt=(e,t)=>Et(e,t,e.length-t.length),At=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Mt=e=>e.length>0,Nt=e=>void 0!==e.style&&m(e.style.getPropertyValue),Rt=(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);Nt(e)&&e.style.setProperty(t,o)},Bt=(e,t,o)=>{const n=e.dom;Rt(n,t,o)},Lt=(e,t)=>{const o=e.dom;q(t,((e,t)=>{Rt(o,t,e)}))},Ht=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||dt(e)?n:It(o,t)},It=(e,t)=>Nt(e)?e.style.getPropertyValue(t):"",Pt=(e,t)=>{const o=e.dom,n=It(o,t);return C.from(n).filter((e=>e.length>0))},Ft=(e,t)=>{((e,t)=>{Nt(e)&&e.style.removeProperty(t)})(e.dom,t),St(ye(e,"style").map(At),"")&&we(e,"style")},zt=(e,t,o=0)=>ye(e,t).map((e=>parseInt(e,10))).getOr(o),Vt=(e,t)=>zt(e,t,1),Zt=e=>he("col")(e)?zt(e,"span",1)>1:Vt(e,"colspan")>1,Ut=(e,t)=>parseInt(Ht(e,t),10),jt=h(10),Wt=h(10),$t=(e,t)=>qt(e,t,x),qt=(e,t,o)=>P(Ie(e),(e=>ke(e,t)?o(e)?[e]:[]:qt(e,t,o))),Gt=(e,t)=>((e,t,o=w)=>o(t)?C.none():E(e,se(t))?C.some(t):yt(t,e.join(","),(e=>ke(e,"table")||o(e))))(["td","th"],e,t),Kt=e=>$t(e,"th,td"),Yt=e=>ke(e,"colgroup")?ht(e,"col"):P(Qt(e),(e=>ht(e,"col"))),Xt=(e,t)=>Ct(e,"table",t),Jt=e=>$t(e,"tr"),Qt=e=>Xt(e).fold(h([]),(e=>ht(e,"colgroup"))),eo=(e,t)=>D(e,(e=>{if("colgroup"===se(e)){const t=D(Yt(e),(e=>{const t=zt(e,"span",1);return et(e,1,t)}));return tt(e,t,"colgroup")}{const o=D(Kt(e),(e=>{const t=zt(e,"rowspan",1),o=zt(e,"colspan",1);return et(e,t,o)}));return tt(e,o,t(e))}})),to=e=>Ne(e).map((e=>{const t=se(e);return(e=>E(Qe,e))(t)?t:"tbody"})).getOr("tbody"),oo=e=>{const t=Jt(e),o=[...Qt(e),...t];return eo(o,to)},no=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},ro=()=>so(0,0),so=(e,t)=>({major:e,minor:t}),ao={nu:so,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?ro():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return so(n(1),n(2))})(e,o)},unknown:ro},io=(e,t)=>{const o=String(t).toLowerCase();return L(e,(e=>e.search(o)))},lo=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,co=e=>t=>Tt(t,e),mo=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Tt(e,"edge/")&&Tt(e,"chrome")&&Tt(e,"safari")&&Tt(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,lo],search:e=>Tt(e,"chrome")&&!Tt(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Tt(e,"msie")||Tt(e,"trident")},{name:"Opera",versionRegexes:[lo,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:co("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:co("firefox")},{name:"Safari",versionRegexes:[lo,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Tt(e,"safari")||Tt(e,"mobile/"))&&Tt(e,"applewebkit")}],uo=[{name:"Windows",search:co("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Tt(e,"iphone")||Tt(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:co("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:co("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:co("linux"),versionRegexes:[]},{name:"Solaris",search:co("sunos"),versionRegexes:[]},{name:"FreeBSD",search:co("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:co("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],go={browsers:h(mo),oses:h(uo)},ho="Edge",po="Chromium",fo="Opera",vo="Firefox",bo="Safari",yo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(ho),isChromium:n(po),isIE:n("IE"),isOpera:n(fo),isFirefox:n(vo),isSafari:n(bo)}},wo={unknown:()=>yo({current:void 0,version:ao.unknown()}),nu:yo,edge:h(ho),chromium:h(po),ie:h("IE"),opera:h(fo),firefox:h(vo),safari:h(bo)},xo="Windows",Co="Android",So="Linux",ko="macOS",_o="Solaris",Eo="FreeBSD",To="ChromeOS",Oo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(xo),isiOS:n("iOS"),isAndroid:n(Co),isMacOS:n(ko),isLinux:n(So),isSolaris:n(_o),isFreeBSD:n(Eo),isChromeOS:n(To)}},Do={unknown:()=>Oo({current:void 0,version:ao.unknown()}),nu:Oo,windows:h(xo),ios:h("iOS"),android:h(Co),linux:h(So),macos:h(ko),solaris:h(_o),freebsd:h(Eo),chromeos:h(To)},Ao=(e,t,o)=>{const n=go.browsers(),r=go.oses(),s=t.bind((e=>((e,t)=>j(t.brands,(t=>{const o=t.brand.toLowerCase();return L(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:ao.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>io(e,t).map((e=>{const o=ao.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(wo.unknown,wo.nu),a=((e,t)=>io(e,t).map((e=>{const o=ao.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Do.unknown,Do.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:h(r),isiPhone:h(s),isTablet:h(l),isPhone:h(c),isTouch:h(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:h(d),isDesktop:h(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},Mo=e=>window.matchMedia(e).matches;let No=no((()=>Ao(navigator.userAgent,C.from(navigator.userAgentData),Mo)));const Ro=()=>No(),Bo=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Ht(o,e);return parseFloat(t)||0}return n},n=(e,t)=>B(t,((t,o)=>{const n=Ht(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!u(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Nt(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},Lo=(e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?C.none():C.some(t)})(e).getOr(t),Ho=(e,t,o)=>Lo(Ht(e,t),o),Io=(e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-Ho(e,`padding-${o}`,0)-Ho(e,`padding-${n}`,0)-Ho(e,`border-${o}-width`,0)-Ho(e,`border-${n}-width`,0))(e,n,"left","right")},Po=Bo("width",(e=>e.dom.offsetWidth)),Fo=e=>Po.get(e),zo=e=>Po.getOuter(e),Vo=e=>Io(e,"content-box"),Zo=e=>Ho(e,"width",e.dom.offsetWidth),Uo=(e,t,o)=>{const n=e.cells,r=n.slice(0,t),s=n.slice(t),a=r.concat(o).concat(s);return $o(e,a)},jo=(e,t,o)=>Uo(e,t,[o]),Wo=(e,t,o)=>{e.cells[t]=o},$o=(e,t)=>nt(e.element,t,e.section,e.isNew),qo=(e,t)=>e.cells[t],Go=(e,t)=>qo(e,t).element,Ko=e=>e.cells.length,Yo=e=>{const t=M(e,(e=>"colgroup"===e.section));return{rows:t.fail,cols:t.pass}},Xo=(e,t,o)=>{const n=D(e.cells,o);return nt(t(e.element),n,e.section,!0)},Jo="data-snooker-locked-cols",Qo=e=>ye(e,Jo).bind((e=>C.from(e.match(/\d+/g)))).map((e=>z(e,x))),en=e=>{const t=B(Yo(e).rows,((e,t)=>(A(t.cells,((t,o)=>{t.isLocked&&(e[o]=!0)})),e)),{}),o=X(t,((e,t)=>parseInt(t,10)));return((e,t)=>{const o=S.call(e,0);return o.sort(t),o})(o)},tn=(e,t)=>e+","+t,on=(e,t)=>{const o=P(e.all,(e=>e.cells));return N(o,t)},nn=e=>{const t={},o=[],n=Z(e).map((e=>e.element)).bind(Xt).bind(Qo).getOr({});let r=0,s=0,a=0;const{pass:i,fail:l}=M(e,(e=>"colgroup"===e.section));A(l,(e=>{const i=[];A(e.cells,(e=>{let o=0;for(;void 0!==t[tn(a,o)];)o++;const r=((e,t)=>Q(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),l=((e,t,o,n,r,s)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:s}))(e.element,e.rowspan,e.colspan,a,o,r);for(let n=0;n{const t=(e=>{const t={};let o=0;return A(e.cells,(e=>{const n=e.colspan;O(n,(r=>{const s=o+r;t[s]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,s)})),o+=n})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,J(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),m=((e,t)=>({rows:e,columns:t}))(r,s);return{grid:m,access:t,all:o,columns:c,colgroups:d}},rn={fromTable:e=>{const t=oo(e);return nn(t)},generate:nn,getAt:(e,t,o)=>C.from(e.access[tn(t,o)]),findItem:(e,t,o)=>{const n=on(e,(e=>o(t,e.element)));return n.length>0?C.some(n[0]):C.none()},filterItems:on,justCells:e=>P(e.all,(e=>e.cells)),justColumns:e=>J(e.columns),hasColumns:e=>W(e.columns).length>0,getColumnAt:(e,t)=>C.from(e.columns[t])},sn=(e,t=x)=>{const o=e.grid,n=O(o.columns,p),r=O(o.rows,p);return D(n,(o=>an((()=>P(r,(t=>rn.getAt(e,t,o).filter((e=>e.column===o)).toArray()))),(e=>1===e.colspan&&t(e.element)),(()=>rn.getAt(e,0,o)))))},an=(e,t,o)=>{const n=e();return L(n,t).orThunk((()=>C.from(n[0]).orThunk(o))).map((e=>e.element))},ln=e=>{const t=e.grid,o=O(t.rows,p),n=O(t.columns,p);return D(o,(t=>an((()=>P(n,(o=>rn.getAt(e,t,o).filter((e=>e.row===t)).fold(h([]),(e=>[e]))))),(e=>1===e.rowspan),(()=>rn.getAt(e,t,0)))))},cn=(e,t)=>{if(t<0||t>=e.length-1)return C.none();const o=e[t].fold((()=>{const o=(e=>{const t=S.call(e,0);return t.reverse(),t})(e.slice(0,t));return j(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:0}))),n=e[t+1].fold((()=>{const o=e.slice(t+1);return j(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:1})));return o.bind((e=>n.map((t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))))},dn=(e,t)=>o=>"rtl"===mn(o)?t:e,mn=e=>"rtl"===Ht(e,"direction")?"rtl":"ltr",un=Bo("height",(e=>{const t=e.dom;return dt(e)?t.getBoundingClientRect().height:t.offsetHeight})),gn=e=>un.get(e),hn=e=>un.getOuter(e),pn=e=>Ho(e,"height",e.dom.offsetHeight),fn=(e,t)=>({left:e,top:t,translate:(o,n)=>fn(e+o,t+n)}),vn=fn,bn=(e,t)=>void 0!==e?e:void 0!==t?t:0,yn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return vn(o.offsetLeft,o.offsetTop);const s=bn(null==n?void 0:n.pageYOffset,r.scrollTop),a=bn(null==n?void 0:n.pageXOffset,r.scrollLeft),i=bn(r.clientTop,o.clientTop),l=bn(r.clientLeft,o.clientLeft);return wn(e).translate(a-l,s-i)},wn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?vn(o.offsetLeft,o.offsetTop):dt(e)?(e=>{const t=e.getBoundingClientRect();return vn(t.left,t.top)})(t):vn(0,0)},xn=(e,t)=>({row:e,y:t}),Cn=(e,t)=>({col:e,x:t}),Sn=e=>yn(e).left+zo(e),kn=e=>yn(e).left,_n=(e,t)=>Cn(e,kn(t)),En=(e,t)=>Cn(e,Sn(t)),Tn=e=>yn(e).top,On=(e,t)=>xn(e,Tn(t)),Dn=(e,t)=>xn(e,Tn(t)+hn(t)),An=(e,t,o)=>{if(0===o.length)return[];const n=D(o.slice(1),((t,o)=>t.map((t=>e(o,t))))),r=o[o.length-1].map((e=>t(o.length-1,e)));return n.concat([r])},Mn={delta:p,positions:e=>An(On,Dn,e),edge:Tn},Nn=dn({delta:p,edge:kn,positions:e=>An(_n,En,e)},{delta:e=>-e,edge:Sn,positions:e=>An(En,_n,e)}),Rn={delta:(e,t)=>Nn(t).delta(e,t),positions:(e,t)=>Nn(t).positions(e,t),edge:e=>Nn(e).edge(e)},Bn={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:[""]},Ln=(()=>{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})`})(.*)$`)})(),Hn=(e,t)=>C.from(Ln.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>T(t,(t=>T(Bn[t],(t=>e===t)))))(n,t)?C.some({value:o,unit:n}):C.none()})),In=/(\d+(\.\d+)?)%/,Pn=/(\d+(\.\d+)?)px|em/,Fn=he("col"),zn=he("tr"),Vn=(e,t,o)=>{const n=Re(e).getOrThunk((()=>mt(Ae(e))));return t(e)/o(n)*100},Zn=(e,t)=>{Bt(e,"width",t+"px")},Un=(e,t)=>{Bt(e,"width",t+"%")},jn=(e,t)=>{Bt(e,"height",t+"px")},Wn=(e,t,o,n)=>{const r=parseFloat(e);return Dt(e,"%")&&"table"!==se(t)?((e,t,o,n)=>{const r=Xt(e).map((e=>{const n=o(e);return Math.floor(t/100*n)})).getOr(t);return n(e,r),r})(t,r,o,n):r},$n=e=>{const t=(e=>pn(e)+"px")(e);return t?Wn(t,e,gn,jn):gn(e)},qn=(e,t)=>Pt(e,t).orThunk((()=>ye(e,t).map((e=>e+"px")))),Gn=e=>qn(e,"width"),Kn=e=>Vn(e,Fo,Vo),Yn=e=>Fn(e)?Fo(e):Zo(e),Xn=e=>zn(e)?gn(e):((e,t,o)=>o(e)/Vt(e,t))(e,"rowspan",$n),Jn=(e,t,o)=>{Bt(e,"width",t+o)},Qn=e=>Vn(e,Fo,Vo)+"%",er=h(In),tr=he("col"),or=e=>Gn(e).getOrThunk((()=>Yn(e)+"px")),nr=e=>{return(t=e,qn(t,"height")).getOrThunk((()=>Xn(e)+"px"));var t},rr=(e,t,o,n,r,s)=>e.filter(n).fold((()=>s(cn(o,t))),(e=>r(e))),sr=(e,t,o,n)=>{const r=sn(e),s=rn.hasColumns(e)?(e=>D(rn.justColumns(e),(e=>C.from(e.element))))(e):r,a=[C.some(Rn.edge(t))].concat(D(Rn.positions(r,t),(e=>e.map((e=>e.x))))),i=b(Zt);return D(s,((e,t)=>rr(e,t,a,i,(e=>{if((e=>{const t=Ro().browser,o=t.isChromium()||t.isFirefox();return!tr(e)||o})(e))return o(e);{const e=(s=r[t],l=p,null!=s?l(s):C.none());return rr(e,t,a,i,(e=>n(C.some(Fo(e)))),n)}var s,l}),n)))},ar=e=>e.map((e=>e+"px")).getOr(""),ir=(e,t,o)=>sr(e,t,Yn,(e=>e.getOrThunk(o.minCellWidth))),lr=(e,t,o,n)=>{const r=ln(e),s=D(e.all,(e=>C.some(e.element))),a=[C.some(Mn.edge(t))].concat(D(Mn.positions(r,t),(e=>e.map((e=>e.y)))));return D(s,((e,t)=>rr(e,t,a,x,o,n)))},cr=(e,t)=>()=>dt(e)?t(e):parseFloat(Pt(e,"width").getOr("0")),dr=e=>{const t=cr(e,Fo),o=h(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>ir(t,e,o),getCellDelta:o,singleColumnWidth:h([0]),minCellWidth:o,setElementWidth:g,adjustTableWidth:g,isRelative:!0,label:"none"}},mr=e=>{const t=cr(e,(e=>parseFloat(Qn(e)))),o=cr(e,Fo);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>sr(e,t,Kn,(e=>e.fold((()=>o.minCellWidth()),(e=>e/o.pixelWidth()*100)))))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>jt()/o()*100,setElementWidth:Un,adjustTableWidth:o=>{const n=t();Un(e,n+o/100*n)},isRelative:!0,label:"percent"}},ur=e=>{const t=cr(e,Fo);return{width:t,pixelWidth:t,getWidths:(t,o)=>ir(t,e,o),getCellDelta:p,singleColumnWidth:(e,t)=>[Math.max(jt(),e+t)-e],minCellWidth:jt,setElementWidth:Zn,adjustTableWidth:o=>{const n=t()+o;Zn(e,n)},isRelative:!1,label:"pixel"}},gr=e=>Gn(e).fold((()=>dr(e)),(t=>((e,t)=>null!==er().exec(t)?mr(e):ur(e))(e,t))),hr=ur,pr=mr,fr=(e,t,o)=>{const n=e[o].element,r=Se.fromTag("td");Ze(r,Se.fromTag("br"));(t?Ze:Ve)(n,r)},vr=(e,t)=>{const o=e=>ke(e.element,t),n=Xe(e),r=oo(n),s=gr(e),a=rn.generate(r),i=((e,t)=>{const o=e.grid.columns;let n=e.grid.rows,r=o,s=0,a=0;const i=[],l=[];return q(e.access,(e=>{if(i.push(e),t(e)){l.push(e);const t=e.row,o=t+e.rowspan-1,i=e.column,c=i+e.colspan-1;ts&&(s=o),ia&&(a=c)}})),((e,t,o,n,r,s)=>({minRow:e,minCol:t,maxRow:o,maxCol:n,allCells:r,selectedCells:s}))(n,r,s,a,i,l)})(a,o),l="th:not("+t+"),td:not("+t+")",c=qt(n,"th,td",(e=>ke(e,l)));A(c,qe),((e,t,o,n)=>{const r=N(e,(e=>"colgroup"!==e.section)),s=t.grid.columns,a=t.grid.rows;for(let e=0;eo.maxRow||io.maxCol||(rn.getAt(t,e,i).filter(n).isNone()?fr(r,a,e):a=!0)}})(r,a,i,o);const d=((e,t,o,n)=>{if(0===n.minCol&&t.grid.columns===n.maxCol+1)return 0;const r=ir(t,e,o),s=B(r,((e,t)=>e+t),0),a=B(r.slice(n.minCol,n.maxCol+1),((e,t)=>e+t),0),i=a/s*o.pixelWidth()-o.pixelWidth();return o.getCellDelta(i)})(e,rn.fromTable(e),s,i);return((e,t,o,n)=>{q(o.columns,(e=>{(e.columnt.maxCol)&&qe(e.element)}));const r=N($t(e,"tr"),(e=>0===e.dom.childElementCount));A(r,qe),t.minCol!==t.maxCol&&t.minRow!==t.maxRow||A($t(e,"th,td"),(e=>{we(e,"rowspan"),we(e,"colspan")})),we(e,Jo),we(e,"data-snooker-col-series"),gr(e).adjustTableWidth(n)})(n,i,a,d),n},br=((e,t)=>{const o=t=>e(t)?C.from(t.dom.nodeValue):C.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})(me,"text"),yr=e=>br.get(e),wr=e=>br.getOption(e),xr=(e,t)=>br.set(e,t),Cr=e=>"img"===se(e)?1:wr(e).fold((()=>Ie(e).length),(e=>e.length)),Sr=["img","br"],kr=e=>wr(e).filter((e=>0!==e.trim().length||e.indexOf(" ")>-1)).isSome()||E(Sr,se(e))||(e=>ce(e)&&"false"===be(e,"contenteditable"))(e),_r=e=>((e,t)=>{const o=e=>{for(let n=0;nTr(e,kr),Tr=(e,t)=>{const o=e=>{const n=Ie(e);for(let e=n.length-1;e>=0;e--){const r=n[e];if(t(r))return C.some(r);const s=o(r);if(s.isSome())return s}return C.none()};return o(e)},Or={scope:["row","col"]},Dr=e=>()=>{const t=Se.fromTag("td",e.dom);return Ze(t,Se.fromTag("br",e.dom)),t},Ar=e=>()=>Se.fromTag("col",e.dom),Mr=e=>()=>Se.fromTag("colgroup",e.dom),Nr=e=>()=>Se.fromTag("tr",e.dom),Rr=(e,t,o)=>{const n=((e,t)=>{const o=Je(e,t),n=Ie(Xe(e));return We(o,n),o})(e,t);return q(o,((e,t)=>{null===e?we(n,t):fe(n,t,e)})),n},Br=e=>e,Lr=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;Nt(o)&&Nt(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),Ft(t,"height"),1!==e.colspan&&Ft(t,"width")};return{col:o=>{const r=Se.fromTag(se(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:Mr(t),row:Nr(t),cell:r=>{const s=Se.fromTag(se(r.element),t.dom),a=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),i=a.length>0?((e,t,o)=>_r(e).map((n=>{const r=o.join(","),s=gt(n,r,(t=>Te(t,e)));return R(s,((e,t)=>{const o=Ye(t);return Ze(e,o),o}),t)})).getOr(t))(r.element,s,a):s;return Ze(i,Se.fromTag("br")),n(r,s),((e,t)=>{q(Or,((o,n)=>ye(e,n).filter((e=>E(o,e))).each((e=>fe(t,n,e)))))})(r.element,s),e(r.element,s),s},replace:Rr,colGap:Ar(t),gap:Dr(t)}},Hr=e=>({col:Ar(e),colgroup:Mr(e),row:Nr(e),cell:Dr(e),replace:Br,colGap:Ar(e),gap:Dr(e)}),Ir=e=>t=>t.options.get(e),Pr="100%",Fr=e=>{var t;const o=e.dom,n=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Vo(Se.fromDom(n))+"px"},zr=e=>C.from(e.options.get("table_clone_elements")),Vr=Ir("table_header_type"),Zr=Ir("table_column_resizing"),Ur=e=>"preservetable"===Zr(e),jr=e=>"resizetable"===Zr(e),Wr=Ir("table_sizing_mode"),$r=e=>"relative"===Wr(e),qr=e=>"fixed"===Wr(e),Gr=e=>"responsive"===Wr(e),Kr=Ir("table_resize_bars"),Yr=Ir("table_style_by_css"),Xr=Ir("table_merge_content_on_paste"),Jr=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>Gr(e)||Yr(e)?t:qr(e)?{...t,width:Fr(e)}:{...t,width:Pr})(e,o)},Qr=e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>Gr(e)||!Yr(e)?t:qr(e)?{...t,width:Fr(e)}:{...t,width:Pr})(e,o)},es=Ir("table_use_colgroups"),ts=e=>Ct(e,"[contenteditable]"),os=(e,t=!1)=>dt(e)?e.dom.isContentEditable:ts(e).fold(h(t),(e=>"true"===ns(e))),ns=e=>e.dom.contentEditable,rs=e=>Se.fromDom(e.getBody()),ss=e=>t=>Te(t,rs(e)),as=e=>{we(e,"data-mce-style");const t=e=>we(e,"data-mce-style");A(Kt(e),t),A(Yt(e),t),A(Jt(e),t)},is=e=>Se.fromDom(e.selection.getStart()),ls=e=>e.getBoundingClientRect().width,cs=e=>e.getBoundingClientRect().height,ds=e=>(t,o)=>{const n=t.dom.getStyle(o,e)||t.dom.getAttrib(o,e);return C.from(n).filter(Mt)},ms=ds("width"),us=ds("height"),gs=e=>bt(e,he("table")).exists(os),hs=(e,t)=>{const o=t.column,n=t.column+t.colspan-1,r=t.row,s=t.row+t.rowspan-1;return o<=e.finishCol&&n>=e.startCol&&r<=e.finishRow&&s>=e.startRow},ps=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,fs=(e,t,o)=>{const n=rn.findItem(e,t,Te),r=rn.findItem(e,o,Te);return n.bind((e=>r.map((t=>{return o=e,n=t,r=Math.min(o.row,n.row),s=Math.min(o.column,n.column),a=Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),i=Math.max(o.column+o.colspan-1,n.column+n.colspan-1),{startRow:r,startCol:s,finishRow:a,finishCol:i};var o,n,r,s,a,i}))))},vs=(e,t,o)=>fs(e,t,o).bind((t=>((e,t)=>{let o=!0;const n=v(ps,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let s=t.startCol;s<=t.finishCol;s++)o=o&&rn.getAt(e,r,s).exists(n);return o?C.some(t):C.none()})(e,t))),bs=(e,t,o)=>fs(e,t,o).map((t=>{const o=rn.filterItems(e,v(hs,t));return D(o,(e=>e.element))})),ys=(e,t)=>rn.findItem(e,t,((e,t)=>Oe(t,e))).map((e=>e.element)),ws=(e,t,o)=>Xt(e).bind((n=>((e,t,o,n)=>rn.findItem(e,t,Te).bind((t=>{const r=o>0?t.row+t.rowspan-1:t.row,s=n>0?t.column+t.colspan-1:t.column;return rn.getAt(e,r+o,s+n).map((e=>e.element))})))(Ss(n),e,t,o))),xs=(e,t,o)=>{const n=Ss(e);return bs(n,t,o)},Cs=(e,t,o,n,r)=>{const s=Ss(e),a=Te(e,o)?C.some(t):ys(s,t),i=Te(e,r)?C.some(n):ys(s,n);return a.bind((e=>i.bind((t=>bs(s,e,t)))))},Ss=rn.fromTable;var ks=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],_s=()=>({up:h({selector:yt,closest:Ct,predicate:vt,all:Be}),down:h({selector:pt,predicate:ut}),styles:h({get:Ht,getRaw:Pt,set:Bt,remove:Ft}),attrs:h({get:be,set:fe,remove:we,copyTo:(e,t)=>{const o=xe(e);ve(t,o)}}),insert:h({before:Fe,after:ze,afterAll:je,append:Ze,appendAll:We,prepend:Ve,wrap:Ue}),remove:h({unwrap:Ge,remove:qe}),create:h({nu:Se.fromTag,clone:e=>Se.fromDom(e.dom.cloneNode(!1)),text:Se.fromText}),query:h({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:Le,nextSibling:He}),property:h({children:Ie,name:se,parent:Ne,document:e=>Me(e).dom,isText:me,isComment:le,isElement:de,isSpecial:e=>{const t=se(e);return E(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>de(e)?ye(e,"lang"):C.none(),getText:yr,setText:xr,isBoundary:e=>!!de(e)&&("body"===se(e)||E(ks,se(e))),isEmptyTag:e=>!!de(e)&&E(["br","img","hr","input"],se(e)),isNonEditable:e=>de(e)&&"false"===be(e,"contenteditable")}),eq:Te,is:De});const Es=(e,t,o,n)=>{const r=t(e,o);return R(n,((o,n)=>{const r=t(e,n);return Ts(e,o,r)}),r)},Ts=(e,t,o)=>t.bind((t=>o.filter(v(e.eq,t)))),Os=(e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,Es):C.none(),Ds=(e,t,o,n=w)=>{const r=[t].concat(e.up().all(t)),s=[o].concat(e.up().all(o)),a=e=>H(e,n).fold((()=>e),(t=>e.slice(0,t+1))),i=a(r),l=a(s),c=L(i,(t=>T(l,((e,t)=>v(e.eq,t))(e,t))));return{firstpath:i,secondpath:l,shared:c}},As=_s(),Ms=(e,t)=>Os(As,((t,o)=>e(o)),t),Ns=e=>yt(e,"table"),Rs=(e,t,o)=>{const n=e=>t=>void 0!==o&&o(t)||Te(t,e);return Te(e,t)?C.some({boxes:C.some([e]),start:e,finish:t}):Ns(e).bind((r=>Ns(t).bind((s=>{if(Te(r,s))return C.some({boxes:xs(r,e,t),start:e,finish:t});if(Oe(r,s)){const o=gt(t,"td,th",n(r)),a=o.length>0?o[o.length-1]:t;return C.some({boxes:Cs(r,e,r,t,s),start:e,finish:a})}if(Oe(s,r)){const o=gt(e,"td,th",n(s)),a=o.length>0?o[o.length-1]:e;return C.some({boxes:Cs(s,e,r,t,s),start:e,finish:a})}return((e,t,o)=>Ds(As,e,t,o))(e,t).shared.bind((a=>Ct(a,"table",o).bind((o=>{const a=gt(t,"td,th",n(o)),i=a.length>0?a[a.length-1]:t,l=gt(e,"td,th",n(o)),c=l.length>0?l[l.length-1]:e;return C.some({boxes:Cs(o,e,r,t,s),start:c,finish:i})}))))}))))},Bs=(e,t)=>{const o=pt(e,t);return o.length>0?C.some(o):C.none()},Ls=(e,t,o)=>xt(e,t).bind((t=>xt(e,o).bind((e=>Ms(Ns,[t,e]).map((o=>({first:t,last:e,table:o}))))))),Hs=(e,t,o,n,r)=>((e,t)=>L(e,(e=>ke(e,t))))(e,r).bind((e=>ws(e,t,o).bind((e=>((e,t)=>yt(e,"table").bind((o=>xt(o,t).bind((t=>Rs(t,e).bind((e=>e.boxes.map((t=>({boxes:t,start:e.start,finish:e.finish}))))))))))(e,n))))),Is=(e,t)=>Bs(e,t),Ps=(e,t,o)=>Ls(e,t,o).bind((t=>{const o=t=>Te(e,t),n="thead,tfoot,tbody,table",r=yt(t.first,n,o),s=yt(t.last,n,o);return r.bind((e=>s.bind((o=>Te(e,o)?((e,t,o)=>{const n=Ss(e);return vs(n,t,o)})(t.table,t.first,t.last):C.none()))))})),Fs=p,zs=e=>{const t=(e,t)=>ye(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&F(e,(e=>t(e,"rowspan")||t(e,"colspan")))?C.some(e):C.none()},Vs=(e,t,o)=>t.length<=1?C.none():Ps(e,o.firstSelectedSelector,o.lastSelectedSelector).map((e=>({bounds:e,cells:t}))),Zs="data-mce-selected",Us="td["+Zs+"],th["+Zs+"]",js="["+Zs+"]",Ws="data-mce-first-selected",$s="td["+Ws+"],th["+Ws+"]",qs="data-mce-last-selected",Gs="td["+qs+"],th["+qs+"]",Ks=js,Ys={selected:Zs,selectedSelector:Us,firstSelected:Ws,firstSelectedSelector:$s,lastSelected:qs,lastSelectedSelector:Gs},Xs=(e,t,o)=>({element:o,mergable:Vs(t,e,Ys),unmergable:zs(e),selection:Fs(e)}),Js=e=>(t,o)=>{const n=se(t),r="col"===n||"colgroup"===n?Xt(s=t).bind((e=>Is(e,Ys.firstSelectedSelector))).fold(h(s),(e=>e[0])):t;var s;return Ct(r,e,o)},Qs=Js("th,td,caption"),ea=Js("th,td"),ta=e=>{return t=e.model.table.getSelectedCells(),D(t,Se.fromDom);var t},oa=(e,t)=>{e.on("BeforeGetContent",(t=>{const o=o=>{t.preventDefault(),(e=>Xt(e[0]).map((e=>{const t=vr(e,Ks);return as(t),[t]})))(o).each((o=>{t.content="text"===t.format?(e=>D(e,(e=>e.dom.innerText)).join(""))(o):((e,t)=>D(t,(t=>e.selection.serializer.serialize(t.dom,{}))).join(""))(e,o)}))};if(!0===t.selection){const t=(e=>N(ta(e),(e=>ke(e,Ys.selectedSelector))))(e);t.length>=1&&o(t)}})),e.on("BeforeSetContent",(o=>{if(!0===o.selection&&!0===o.paste){const n=ta(e);Z(n).each((n=>{Xt(n).each((r=>{const s=N(((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Ie(Se.fromDom(o))})(o.content),(e=>"meta"!==se(e))),a=he("table");if(Xr(e)&&1===s.length&&a(s[0])){o.preventDefault();const a=Se.fromDom(e.getDoc()),i=Hr(a),l=((e,t,o)=>({element:e,clipboard:t,generators:o}))(n,s[0],i);t.pasteCells(r,l).each((()=>{e.focus()}))}}))}))}}))},na=(e,t)=>({element:e,offset:t}),ra=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind((t=>ra(e,t,o).orThunk((()=>C.some(t))))):C.none(),sa=(e,t)=>{if(e.property().isText(t))return e.property().getText(t).length;return e.property().children(t).length},aa=(e,t)=>{const o=ra(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return na(o,sa(e,o));const n=e.property().children(o);return n.length>0?aa(e,n[n.length-1]):na(o,sa(e,o))},ia=aa,la=_s(),ca=(e,t)=>{if(!Zt(e)){const o=(e=>Gn(e).bind((e=>Hn(e,["fixed","relative","empty"]))))(e);o.each((o=>{const n=o.value/2;Jn(e,n,o.unit),Jn(t,n,o.unit)}))}},da=e=>D(e,h(0)),ma=(e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))),ua=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),s=Math.abs(e-t[o]);return n>=0?s:-s}return n},ga=ua((e=>e<0)),ha=ua(x),pa=()=>{const e=(e,t,o,n)=>{const r=(100+o)/100,s=Math.max(n,(e[t]+o)/r);return D(e,((e,o)=>(o===t?s:e/r)-e))},t=(t,o,n,r,s,a)=>a?e(t,o,r,s):((e,t,o,n,r)=>{const s=ga(e,t,n,r);return ma(e,t,o+1,[s,0],da)})(t,o,n,r,s);return{resizeTable:(e,t)=>e(t),clampTableDelta:ga,calcLeftEdgeDeltas:t,calcMiddleDeltas:(e,o,n,r,s,a,i)=>t(e,n,r,s,a,i),calcRightEdgeDeltas:(t,o,n,r,s,a)=>{if(a)return e(t,n,r,s);{const e=ga(t,n,r,s);return da(t.slice(0,n)).concat([e])}},calcRedestributedWidths:(e,t,o,n)=>{if(n){const n=(t+o)/t,r=D(e,(e=>e/n));return{delta:100*n-100,newSizes:r}}return{delta:o,newSizes:e}}}},fa=()=>{const e=(e,t,o,n,r)=>{const s=ha(e,n>=0?o:t,n,r);return ma(e,t,o+1,[s,-s],da)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=B(e,((e,t)=>e+t-n),0);return Math.max(-t,o)}}return ga(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,s,a)=>e(t,n,r,s,a),calcRightEdgeDeltas:(e,t,o,n,r,s)=>{if(s)return da(e);{const t=n/e.length;return D(e,h(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},va=e=>rn.fromTable(e).grid,ba=he("th"),ya=e=>F(e,(e=>ba(e.element))),wa=(e,t)=>e&&t?"sectionCells":e?"section":"cells",xa=e=>{const t="thead"===e.section,o=St(Ca(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:wa(t,o)}:{type:"body"}},Ca=e=>{const t=N(e,(e=>ba(e.element)));return 0===t.length?C.some("td"):t.length===e.length?C.some("th"):C.none()},Sa=(e,t,o)=>ot(o(e.element,t),!0,e.isLocked),ka=(e,t)=>e.section!==t?nt(e.element,e.cells,t,e.isNew):e,_a=()=>({transformRow:ka,transformCell:(e,t,o)=>{const n=o(e.element,t),r="td"!==se(n)?((e,t)=>{const o=Je(e,t);ze(e,o);const n=Ie(e);return We(o,n),qe(e),o})(n,"td"):n;return ot(r,e.isNew,e.isLocked)}}),Ea=()=>({transformRow:ka,transformCell:Sa}),Ta=()=>({transformRow:(e,t)=>ka(e,"thead"===t?"tbody":t),transformCell:Sa}),Oa=(e,t)=>{const o=(e=>j(e.all,(e=>{const t=xa(e);return"header"===t.type?C.from(t.subType):C.none()})))(rn.fromTable(e)).getOr(t);switch(o){case"section":return _a();case"sectionCells":return Ea();case"cells":return Ta()}},Da=_a,Aa=Ea,Ma=Ta,Na=()=>({transformRow:p,transformCell:Sa}),Ra=(e,t,o,n)=>{o===n?we(e,t):fe(e,t,o)},Ba=(e,t,o)=>{U(ht(e,t)).fold((()=>Ve(e,o)),(e=>ze(e,o)))},La=(e,t)=>{const o=[],n=[],r=e=>D(e,(e=>{e.isNew&&o.push(e.element);const t=e.element;return $e(t),A(e.cells,(e=>{e.isNew&&n.push(e.element),Ra(e.element,"colspan",e.colspan,1),Ra(e.element,"rowspan",e.rowspan,1),Ze(t,e.element)})),t})),s=e=>P(e,(e=>D(e.cells,(e=>(Ra(e.element,"span",e.colspan,1),e.element))))),a=(t,o)=>{const n=((e,t)=>{const o=wt(e,t).getOrThunk((()=>{const o=Se.fromTag(t,Ae(e).dom);return"thead"===t?Ba(e,"caption,colgroup",o):"colgroup"===t?Ba(e,"caption",o):Ze(e,o),o}));return $e(o),o})(e,o),a=("colgroup"===o?s:r)(t);We(n,a)},i=(t,o)=>{t.length>0?a(t,o):(t=>{wt(e,t).each(qe)})(o)},l=[],c=[],d=[],m=[];return A(t,(e=>{switch(e.section){case"thead":l.push(e);break;case"tbody":c.push(e);break;case"tfoot":d.push(e);break;case"colgroup":m.push(e)}})),i(m,"colgroup"),i(l,"thead"),i(c,"tbody"),i(d,"tfoot"),{newRows:o,newCells:n}},Ha=(e,t)=>{if(0===e.length)return 0;const o=e[0];return H(e,(e=>!t(o.element,e.element))).getOr(e.length)},Ia=(e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),s="colgroup"===r.section,a=Ha(r.cells.slice(o),n),i=s?1:Ha(((e,t)=>D(e,(e=>qo(e,t))))(e.slice(t),o),n);return{colspan:a,rowspan:i}},Pa=(e,t)=>{const o=D(e,(e=>D(e.cells,w)));return D(e,((n,r)=>{const s=P(n.cells,((n,s)=>{if(!1===o[r][s]){const d=Ia(e,r,s,t);return((e,t,n,r)=>{for(let s=e;s({element:e,cells:t,section:o,isNew:n}))(n.element,s,n.section,n.isNew)}))},Fa=(e,t,o)=>{const n=[];A(e.colgroups,(r=>{const s=[];for(let n=0;not(e.element,o,!1))).getOrThunk((()=>ot(t.colGap(),!0,!1)));s.push(r)}n.push(nt(r.element,s,"colgroup",o))}));for(let r=0;rot(e.element,o,e.isLocked))).getOrThunk((()=>ot(t.gap(),!0,!1)));s.push(a)}const a=e.all[r],i=nt(a.element,s,a.section,o);n.push(i)}return n},za=e=>Pa(e,Te),Va=(e,t)=>j(e.all,(e=>L(e.cells,(e=>Te(t,e.element))))),Za=(e,t,o)=>{const n=D(t.selection,(t=>Gt(t).bind((t=>Va(e,t))).filter(o))),r=kt(n);return _t(r.length>0,r)},Ua=(e,t,o,n,r)=>(s,a,i,l)=>{const c=rn.fromTable(s),d=C.from(null==l?void 0:l.section).getOrThunk(Na);return t(c,a).map((t=>{const o=((e,t)=>Fa(e,t,!1))(c,i),n=e(o,t,Te,r(i),d),s=en(n.grid);return{info:t,grid:za(n.grid),cursor:n.cursor,lockedColumns:s}})).bind((e=>{const t=La(s,e.grid),r=C.from(null==l?void 0:l.sizing).getOrThunk((()=>gr(s))),a=C.from(null==l?void 0:l.resize).getOrThunk(fa);return o(s,e.grid,e.info,{sizing:r,resize:a,section:d}),n(s),we(s,Jo),e.lockedColumns.length>0&&fe(s,Jo,e.lockedColumns.join(",")),C.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})}))},ja=(e,t)=>Za(e,t,x).map((e=>({cells:e,generators:t.generators,clipboard:t.clipboard}))),Wa=(e,t)=>Za(e,t,x),$a=(e,t)=>Za(e,t,(e=>!e.isLocked)),qa=(e,t)=>F(t,(t=>((e,t)=>Va(e,t).exists((e=>!e.isLocked)))(e,t))),Ga=(e,t,o,n)=>{const r=Yo(e).rows;let s=!0;for(let e=0;e{const r=Yo(e).rows;if(t>0&&tB(e,((e,o)=>T(e,(e=>t(e.element,o.element)))?e:e.concat([o])),[]))(r[t-1].cells,o);A(e,(e=>{let s=C.none();for(let a=t;a{Wo(i,t,ot(e,!0,l.isLocked))})))}}))}return e},Ya=e=>{const t=t=>t(e),o=h(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:x,isError:w,map:t=>Ja.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:()=>C.some(e)};return r},Xa=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:w,isError:x,map:t,mapError:t=>Ja.error(t(e)),bind:t,exists:w,forall:x,getOr:p,or:p,getOrThunk:y,orThunk:y,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:g,toOptional:C.none};var n;return o},Ja={value:Ya,error:Xa,fromOption:(e,t)=>e.fold((()=>Xa(t)),Ya)},Qa=(e,t)=>({rowDelta:0,colDelta:Ko(e[0])-Ko(t[0])}),ei=(e,t)=>({rowDelta:e.length-t.length,colDelta:0}),ti=(e,t,o,n)=>{const r="colgroup"===t.section?o.col:o.cell;return O(e,(e=>ot(r(),!0,n(e))))},oi=(e,t,o,n)=>{const r=e[e.length-1];return e.concat(O(t,(()=>{const e="colgroup"===r.section?o.colgroup:o.row,t=Xo(r,e,p),s=ti(t.cells.length,t,o,(e=>Q(n,e.toString())));return $o(t,s)})))},ni=(e,t,o,n)=>D(e,(e=>{const r=ti(t,e,o,w);return Uo(e,n,r)})),ri=(e,t,o)=>{const n=t.colDelta<0?ni:p,r=t.rowDelta<0?oi:p,s=en(e),a=Ko(e[0]),i=T(s,(e=>e===a-1)),l=n(e,Math.abs(t.colDelta),o,i?a-1:a),c=en(l);return r(l,Math.abs(t.rowDelta),o,z(c,x))},si=(e,t,o,n)=>{const r=v(n,qo(e[t],o).element),s=e[t];return e.length>1&&Ko(s)>1&&(o>0&&r(Go(s,o-1))||o0&&r(Go(e[t-1],o))||tN(o,(o=>o>=e.column&&o<=Ko(t[0])+e.column)),ii=(e,t,o,n,r)=>{const s=en(t),a=((e,t,o)=>{const n=Ko(t[0]),r=Yo(t).cols.length+e.row,s=O(n-e.column,(t=>t+e.column)),a=L(s,(e=>F(o,(t=>t!==e)))).getOr(n-1);return{row:r,column:a}})(e,t,s),i=Yo(o).rows,l=ai(a,i,s),c=((e,t,o)=>{if(e.row>=t.length||e.column>Ko(t[0]))return Ja.error("invalid start address out of table bounds, row: "+e.row+", column: "+e.column);const n=t.slice(e.row),r=n[0].cells.slice(e.column),s=Ko(o[0]),a=o.length;return Ja.value({rowDelta:n.length-a,colDelta:r.length-s})})(a,t,i);return c.map((e=>{const o={...e,colDelta:e.colDelta-l.length},s=ri(t,o,n),c=en(s),d=ai(a,i,c);return((e,t,o,n,r,s)=>{const a=e.row,i=e.column,l=a+o.length,c=i+Ko(o[0])+s.length,d=z(s,x);for(let e=a;e{((e,t,o,n)=>{t>0&&t{const r=e.cells[t-1];let s=0;const a=n();for(;e.cells.length>t+s&&o(r.element,e.cells[t+s].element);)Wo(e,t+s,ot(a,!0,e.cells[t+s].isLocked)),s++}))})(t,e,r,n.cell);const s=ei(o,t),a=ri(o,s,n),i=ei(t,a),l=ri(t,i,n);return D(l,((t,o)=>Uo(t,e,a[o].cells)))},ci=(e,t,o,n,r)=>{Ka(t,e,r,n.cell);const s=en(t),a=Qa(t,o),i={...a,colDelta:a.colDelta-s.length},l=ri(t,i,n),{cols:c,rows:d}=Yo(l),m=en(l),u=Qa(o,t),g={...u,colDelta:u.colDelta+m.length},h=((e,t,o)=>D(e,(e=>B(o,((o,n)=>{const r=ti(1,e,t,x)[0];return jo(o,n,r)}),e))))(o,n,m),p=ri(h,g,n);return[...c,...d.slice(0,e),...p,...d.slice(e,d.length)]},di=(e,t,o,n,r)=>{const{rows:s,cols:a}=Yo(e),i=s.slice(0,t),l=s.slice(t),c=((e,t,o,n)=>Xo(e,(e=>n(e,o)),t))(s[o],((e,o)=>t>0&&tD(e,(e=>{const s=t>0&&t{if("colgroup"!==o&&n)return qo(e,t);{const t=qo(e,r);return ot(a(t.element,s),!0,!1)}})(e,t,e.section,s,o,n,r);return jo(e,t,a)})),ui=(e,t,o,n)=>((e,t,o,n)=>void 0!==Go(e[t],o)&&t>0&&n(Go(e[t-1],o),Go(e[t],o)))(e,t,o,n)||((e,t,o)=>t>0&&o(Go(e,t-1),Go(e,t)))(e[t],o,n),gi=(e,t,o,n)=>{const r=e=>"row"===e?(e=>Vt(e,"rowspan")>1)(t):Zt(t),s=e=>r(e)?`${e}group`:e;if(e)return ba(t)?s(o):null;if(n&&ba(t)){return s("row"===o?"col":"row")}return null},hi=(e,t,o)=>ot(o(e.element,t),!0,e.isLocked),pi=(e,t,o,n,r,s,a)=>D(e,((e,i)=>((e,t)=>{const o=e.cells,n=D(o,t);return nt(e.element,n,e.section,e.isNew)})(e,((e,l)=>{if((e=>T(t,(t=>o(e.element,t.element))))(e)){const t=a(e,i,l)?r(e,o,n):e;return s(t,i,l).each((e=>{var o,n;o=t.element,n={scope:C.from(e)},q(n,((e,t)=>{e.fold((()=>{we(o,t)}),(e=>{pe(o.dom,t,e)}))}))})),t}return e})))),fi=(e,t,o)=>P(e,((n,r)=>ui(e,r,t,o)?[]:[qo(n,t)])),vi=(e,t,o,n,r)=>{const s=Yo(e).rows,a=P(t,(e=>fi(s,e,n))),i=D(s,(e=>ya(e.cells))),l=((e,t)=>F(t,p)&&ya(e)?x:(e,o,n)=>!("th"===se(e.element)&&t[o]))(a,i),c=((e,t)=>(o,n)=>C.some(gi(e,o.element,"row",t[n])))(o,i);return pi(e,a,n,r,hi,c,l)},bi=(e,t,o,n,r,s,a)=>{const{cols:i,rows:l}=Yo(e),c=l[t[0]],d=P(t,(e=>((e,t,o)=>{const n=e[t];return P(n.cells,((n,r)=>ui(e,t,r,o)?[]:[n]))})(l,e,r))),m=D(c.cells,((e,t)=>ya(fi(l,t,r)))),u=[...l];A(t,(e=>{u[e]=a.transformRow(l[e],o)}));const g=[...i,...u],h=((e,t)=>F(t,p)&&ya(e.cells)?x:(e,o,n)=>!("th"===se(e.element)&&t[n]))(c,m),f=((e,t)=>(o,n,r)=>C.some(gi(e,o.element,"col",t[r])))(n,m);return pi(g,d,r,s,a.transformCell,f,h)},yi=(e,t,o,n)=>{const r=Yo(e).rows,s=D(t,(e=>qo(r[e.row],e.column)));return pi(e,s,o,n,hi,C.none,x)},wi=e=>{if(!a(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 A(e,((n,r)=>{const s=W(n);if(1!==s.length)throw new Error("one and only one name per case");const i=s[0],l=n[i];if(void 0!==o[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!a(l))throw new Error("case arguments must be an array");t.push(i),o[i]=(...o)=>{const n=o.length;if(n!==l.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+l.length+" ("+l+"), 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[r].apply(null,o)},match:e=>{const n=W(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!F(t,(e=>E(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[i].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:i,params:o})}}}})),o},xi={...wi([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},Ci=(e,t,o,n,r)=>{const s=e.slice(0),a=((e,t)=>0===e.length?xi.none():1===e.length?xi.only(0):0===t?xi.left(0,1):t===e.length-1?xi.right(t-1,t):t>0&&tn.singleColumnWidth(s[e],o)),((e,t)=>r.calcLeftEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)),((e,t,a)=>r.calcMiddleDeltas(s,e,t,a,o,n.minCellWidth(),n.isRelative)),((e,t)=>r.calcRightEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)))},Si=(e,t)=>rn.hasColumns(e)?((e,t)=>{const o=rn.justColumns(e);return D(o,((e,o)=>({element:e.element,width:t[o],colspan:e.colspan})))})(e,t):((e,t)=>{const o=rn.justCells(e);return D(o,(e=>{const o=((e,t,o)=>{let n=0;for(let r=e;r{const n=Si(e,t);A(n,(e=>{o.setElementWidth(e.element,e.width)}))},_i=(e,t,o,n,r)=>{const s=rn.fromTable(e),a=r.getCellDelta(t),i=r.getWidths(s,r),l=o===s.grid.columns-1,c=n.clampTableDelta(i,o,a,r.minCellWidth(),l),d=Ci(i,o,c,r,n),m=D(d,((e,t)=>e+i[t]));ki(s,m,r),n.resizeTable(r.adjustTableWidth,c,l)},Ei=(e,t,o)=>{const n=rn.fromTable(e),r=((e,t)=>lr(e,t,Xn,(e=>e.getOrThunk(Wt))))(n,e),s=D(r,((e,n)=>o===n?Math.max(t+e,Wt()):e)),a=((e,t)=>D(e.all,((e,o)=>({element:e.element,height:t[o]}))))(n,s);A(a,(e=>{jn(e.element,e.height)})),A(rn.justCells(n),(e=>{(e=>{Ft(e,"height")})(e.element)}));const i=R(s,((e,t)=>e+t),0);jn(e,i)},Ti=e=>B(e,((e,t)=>T(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),Oi=he("col"),Di=he("colgroup"),Ai=e=>"tr"===se(e)||Di(e),Mi=e=>({element:e,colspan:zt(e,"colspan",1),rowspan:zt(e,"rowspan",1)}),Ni=e=>ye(e,"scope").map((e=>e.substr(0,3))),Ri=(e,t=Mi)=>{const o=o=>{if(Ai(o))return Di((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,s=(t=>Oi(t.element)?e.col(t):e.cell(t))(t(r));return n=C.some({item:r,replacement:s}),s}var r};let n=C.none();return{getOrInit:(e,t)=>n.fold((()=>o(e)),(n=>t(e,n.item)?n.replacement:o(e)))}},Bi=e=>t=>{const o=[],n=n=>{const r="td"===e?{scope:null}:{},s=t.replace(n,e,r);return o.push({item:n,sub:s}),s};return{replaceOrInit:(e,t)=>{if(Ai(e)||Oi(e))return e;{const r=e;return((e,t)=>L(o,(o=>t(o.item,e))))(r,t).fold((()=>n(r)),(o=>t(e,o.item)?o.sub:n(r)))}}}},Li=e=>({unmerge:t=>{const o=Ni(t);return o.each((e=>fe(t,"scope",e))),()=>{const n=e.cell({element:t,colspan:1,rowspan:1});return Ft(n,"width"),Ft(t,"width"),o.each((e=>fe(n,"scope",e))),n}},merge:e=>(Ft(e[0],"width"),(()=>{const t=kt(D(e,Ni));if(0===t.length)return C.none();{const e=t[0],o=["row","col"];return T(t,(t=>t!==e&&E(o,t)))?C.none():C.from(e)}})().fold((()=>we(e[0],"scope")),(t=>fe(e[0],"scope",t+"group"))),h(e[0]))}),Hi=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Ii=_s(),Pi=e=>((e,t)=>{const o=e.property().name(t);return E(Hi,o)})(Ii,e),Fi=e=>((e,t)=>{const o=e.property().name(t);return E(["ol","ul"],o)})(Ii,e),zi=e=>((e,t)=>E(["br","img","hr","input"],e.property().name(t)))(Ii,e),Vi=e=>{const t=he("br"),o=e=>Er(e).bind((o=>{const n=He(o).map((e=>!!Pi(e)||!!zi(e)&&"img"!==se(e))).getOr(!1);return Ne(o).map((r=>!0===n||(e=>"li"===se(e)||vt(e,Fi).isSome())(r)||t(o)||Pi(r)&&!Te(e,r)?[]:[Se.fromTag("br")]))})).getOr([]),n=(()=>{const n=P(e,(e=>{const n=Ie(e);return(e=>F(e,(e=>t(e)||me(e)&&0===yr(e).trim().length)))(n)?[]:n.concat(o(e))}));return 0===n.length?[Se.fromTag("br")]:n})();$e(e[0]),We(e[0],n)},Zi=e=>os(e,!0),Ui=e=>{0===Kt(e).length&&qe(e)},ji=(e,t)=>({grid:e,cursor:t}),Wi=(e,t,o)=>{var n,r;const s=Yo(e).rows;return C.from(null===(r=null===(n=s[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(Zi).orThunk((()=>(e=>j(e,(e=>j(e.cells,(e=>{const t=e.element;return _t(Zi(t),t)})))))(s)))},$i=(e,t,o)=>{const n=Wi(e,t,o);return ji(e,n)},qi=e=>B(e,((e,t)=>T(e,(e=>e.row===t.row))?e:e.concat([t])),[]).sort(((e,t)=>e.row-t.row)),Gi=(e,t)=>(o,n,r,s,a)=>{const i=qi(n),l=D(i,(e=>e.row)),c=bi(o,l,e,t,r,s.replaceOrInit,a);return $i(c,n[0].row,n[0].column)},Ki=Gi("thead",!0),Yi=Gi("tbody",!1),Xi=Gi("tfoot",!1),Ji=(e,t,o)=>{const n=((e,t)=>eo(e,(()=>t)))(e,o.section),r=rn.generate(n);return Fa(r,t,!0)},Qi=(e,t,o,n)=>((e,t,o,n)=>{const r=rn.generate(t),s=n.getWidths(r,n);ki(r,s,n)})(0,t,0,n.sizing),el=(e,t,o,n)=>((e,t,o,n,r)=>{const s=rn.generate(t),a=n.getWidths(s,n),i=n.pixelWidth(),{newSizes:l,delta:c}=r.calcRedestributedWidths(a,i,o.pixelDelta,n.isRelative);ki(s,l,n),n.adjustTableWidth(c)})(0,t,o,n.sizing,n.resize),tl=(e,t)=>T(t,(e=>0===e.column&&e.isLocked)),ol=(e,t)=>T(t,(t=>t.column+t.colspan>=e.grid.columns&&t.isLocked)),nl=(e,t)=>{const o=sn(e),n=Ti(t);return B(n,((e,t)=>e+o[t.column].map(zo).getOr(0)),0)},rl=e=>(t,o)=>Wa(t,o).filter((o=>!(e?tl:ol)(t,o))).map((e=>({details:e,pixelDelta:nl(t,e)}))),sl=e=>(t,o)=>ja(t,o).filter((o=>!(e?tl:ol)(t,o.cells))),al=Bi("th"),il=Bi("td"),ll=Ua(((e,t,o,n)=>{const r=t[0].row,s=qi(t),a=R(s,((e,t)=>({grid:di(e.grid,r,t.row+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return $i(a,r,t[0].column)}),Wa,g,g,Ri),cl=Ua(((e,t,o,n)=>{const r=qi(t),s=r[r.length-1],a=s.row+s.rowspan,i=R(r,((e,t)=>di(e,a,t.row,o,n.getOrInit)),e);return $i(i,a,t[0].column)}),Wa,g,g,Ri),dl=Ua(((e,t,o,n)=>{const r=t.details,s=Ti(r),a=s[0].column,i=R(s,((e,t)=>({grid:mi(e.grid,a,t.column+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return $i(i,r[0].row,a)}),rl(!0),el,g,Ri),ml=Ua(((e,t,o,n)=>{const r=t.details,s=r[r.length-1],a=s.column+s.colspan,i=Ti(r),l=R(i,((e,t)=>mi(e,a,t.column,o,n.getOrInit)),e);return $i(l,r[0].row,a)}),rl(!1),el,g,Ri),ul=Ua(((e,t,o,n)=>{const r=Ti(t.details),s=((e,t)=>P(e,(e=>{const o=e.cells,n=R(t,((e,t)=>t>=0&&t0?[nt(e.element,n,e.section,e.isNew)]:[]})))(e,D(r,(e=>e.column))),a=s.length>0?s[0].cells.length-1:0;return $i(s,r[0].row,Math.min(r[0].column,a))}),((e,t)=>$a(e,t).map((t=>({details:t,pixelDelta:-nl(e,t)})))),el,Ui,Ri),gl=Ua(((e,t,o,n)=>{const r=qi(t),s=((e,t,o)=>{const{rows:n,cols:r}=Yo(e);return[...r,...n.slice(0,t),...n.slice(o+1)]})(e,r[0].row,r[r.length-1].row),a=Math.max(Yo(s).rows.length-1,0);return $i(s,Math.min(t[0].row,a),t[0].column)}),Wa,g,Ui,Ri),hl=Ua(((e,t,o,n)=>{const r=Ti(t),s=D(r,(e=>e.column)),a=vi(e,s,!0,o,n.replaceOrInit);return $i(a,t[0].row,t[0].column)}),$a,g,g,al),pl=Ua(((e,t,o,n)=>{const r=Ti(t),s=D(r,(e=>e.column)),a=vi(e,s,!1,o,n.replaceOrInit);return $i(a,t[0].row,t[0].column)}),$a,g,g,il),fl=Ua(Ki,$a,g,g,al),vl=Ua(Yi,$a,g,g,il),bl=Ua(Xi,$a,g,g,il),yl=Ua(((e,t,o,n)=>{const r=yi(e,t,o,n.replaceOrInit);return $i(r,t[0].row,t[0].column)}),$a,g,g,al),wl=Ua(((e,t,o,n)=>{const r=yi(e,t,o,n.replaceOrInit);return $i(r,t[0].row,t[0].column)}),$a,g,g,il),xl=Ua(((e,t,o,n)=>{const r=t.cells;Vi(r);const s=((e,t,o,n)=>{const r=Yo(e).rows;if(0===r.length)return e;for(let e=t.startRow;e<=t.finishRow;e++)for(let o=t.startCol;o<=t.finishCol;o++){const t=r[e],s=qo(t,o).isLocked;Wo(t,o,ot(n(),!1,s))}return e})(e,t.bounds,0,n.merge(r));return ji(s,C.from(r[0]))}),((e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>qa(e,t.cells)))),Qi,g,Li),Cl=Ua(((e,t,o,n)=>{const r=R(t,((e,t)=>Ga(e,t,o,n.unmerge(t))),e);return ji(r,C.from(t[0]))}),((e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>qa(e,t)))),Qi,g,Li),Sl=Ua(((e,t,o,n)=>{const r=((e,t)=>{const o=rn.fromTable(e);return Fa(o,t,!0)})(t.clipboard,t.generators),s=((e,t)=>({row:e,column:t}))(t.row,t.column);return ii(s,e,r,t.generators,o).fold((()=>ji(e,C.some(t.element))),(e=>$i(e,t.row,t.column)))}),((e,t)=>Gt(t.element).bind((o=>Va(e,o).map((e=>({...e,generators:t.generators,clipboard:t.clipboard})))))),Qi,g,Ri),kl=Ua(((e,t,o,n)=>{const r=Yo(e).rows,s=t.cells[0].column,a=r[t.cells[0].row],i=Ji(t.clipboard,t.generators,a),l=li(s,e,i,t.generators,o);return $i(l,t.cells[0].row,t.cells[0].column)}),sl(!0),g,g,Ri),_l=Ua(((e,t,o,n)=>{const r=Yo(e).rows,s=t.cells[t.cells.length-1].column+t.cells[t.cells.length-1].colspan,a=r[t.cells[0].row],i=Ji(t.clipboard,t.generators,a),l=li(s,e,i,t.generators,o);return $i(l,t.cells[0].row,s)}),sl(!1),g,g,Ri),El=Ua(((e,t,o,n)=>{const r=Yo(e).rows,s=t.cells[0].row,a=r[s],i=Ji(t.clipboard,t.generators,a),l=ci(s,e,i,t.generators,o);return $i(l,t.cells[0].row,t.cells[0].column)}),ja,g,g,Ri),Tl=Ua(((e,t,o,n)=>{const r=Yo(e).rows,s=t.cells[t.cells.length-1].row+t.cells[t.cells.length-1].rowspan,a=r[t.cells[0].row],i=Ji(t.clipboard,t.generators,a),l=ci(s,e,i,t.generators,o);return $i(l,s,t.cells[0].column)}),ja,g,g,Ri),Ol=(e,t)=>{const o=rn.fromTable(e);return Wa(o,t).bind((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=I(D(o.all,(e=>N(e.cells,(e=>e.column>=n&&e.column{const o=rn.fromTable(e);return Wa(o,t).bind(Ca).getOr("")},Al=(e,t)=>{const o=rn.fromTable(e);return Wa(o,t).bind((e=>{const t=e[e.length-1],n=e[0].row,r=t.row+t.rowspan;return(e=>{const t=D(e,(e=>xa(e).type)),o=E(t,"header"),n=E(t,"footer");if(o||n){const e=E(t,"body");return!o||e||n?o||e||!n?C.none():C.some("footer"):C.some("header")}return C.some("body")})(o.all.slice(n,r))})).getOr("")},Ml=(e,t)=>e.dispatch("NewRow",{node:t}),Nl=(e,t)=>e.dispatch("NewCell",{node:t}),Rl=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},Bl={structure:!1,style:!0},Ll={structure:!0,style:!1},Hl={structure:!0,style:!0},Il=(e,t)=>$r(e)?pr(t):qr(e)?hr(t):gr(t),Pl=(e,t,o)=>{const n=e=>"table"===se(rs(e)),r=zr(e),s=jr(e)?g:ca,a=t=>{switch(Vr(e)){case"section":return Da();case"sectionCells":return Aa();case"cells":return Ma();default:return Oa(t,"section")}},i=(t,n)=>n.cursor.fold((()=>{const n=Kt(t);return Z(n).filter(dt).map((n=>{o.clearSelectedCells(t.dom);const r=e.dom.createRng();return r.selectNode(n.dom),e.selection.setRng(r),fe(n,"data-mce-selected","1"),r}))}),(n=>{const r=ia(la,n);const s=e.dom.createRng();return s.setStart(r.element.dom,r.offset),s.setEnd(r.element.dom,r.offset),e.selection.setRng(s),o.clearSelectedCells(t.dom),C.some(s)})),l=(o,n,s,l)=>(c,d,m=!1)=>{as(c);const u=Se.fromDom(e.getDoc()),g=Lr(s,u,r),h={sizing:Il(e,c),resize:jr(e)?pa():fa(),section:a(c)};return n(c)?o(c,d,g,h).bind((o=>{t.refresh(c.dom),A(o.newRows,(t=>{Ml(e,t.dom)})),A(o.newCells,(t=>{Nl(e,t.dom)}));const n=i(c,o);return dt(c)&&(as(c),m||Rl(e,c.dom,l)),n.map((e=>({rng:e,effect:l})))})):C.none()},c=l(gl,(t=>!n(e)||va(t).rows>1),g,Ll),d=l(ul,(t=>!n(e)||va(t).columns>1),g,Ll);return{deleteRow:c,deleteColumn:d,insertRowsBefore:l(ll,x,g,Ll),insertRowsAfter:l(cl,x,g,Ll),insertColumnsBefore:l(dl,x,s,Ll),insertColumnsAfter:l(ml,x,s,Ll),mergeCells:l(xl,x,g,Ll),unmergeCells:l(Cl,x,g,Ll),pasteColsBefore:l(kl,x,g,Ll),pasteColsAfter:l(_l,x,g,Ll),pasteRowsBefore:l(El,x,g,Ll),pasteRowsAfter:l(Tl,x,g,Ll),pasteCells:l(Sl,x,g,Hl),makeCellsHeader:l(yl,x,g,Ll),unmakeCellsHeader:l(wl,x,g,Ll),makeColumnsHeader:l(hl,x,g,Ll),unmakeColumnsHeader:l(pl,x,g,Ll),makeRowsHeader:l(fl,x,g,Ll),makeRowsBody:l(vl,x,g,Ll),makeRowsFooter:l(bl,x,g,Ll),getTableRowType:Al,getTableCellType:Dl,getTableColType:Ol}},Fl=(e,t,o)=>{const n=zt(e,t,1);1===o||n<=1?we(e,t):fe(e,t,Math.min(o,n))},zl=(e,t)=>o=>{const n=o.column+o.colspan-1,r=o.column;return n>=e&&r{const o=rn.fromTable(e);return $a(o,t).map((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=((e,t,o)=>{if(rn.hasColumns(e)){const n=N(rn.justColumns(e),zl(t,o)),r=D(n,(e=>{const n=Xe(e.element);return Fl(n,"span",o-t),n})),s=Se.fromTag("colgroup");return We(s,r),[s]}return[]})(o,n,r),a=((e,t,o)=>D(e.all,(e=>{const n=N(e.cells,zl(t,o)),r=D(n,(e=>{const n=Xe(e.element);return Fl(n,"colspan",o-t),n})),s=Se.fromTag("tr");return We(s,r),s})))(o,n,r);return[...s,...a]}))},Zl=(e,t,o)=>{const n=rn.fromTable(e);return Wa(n,t).bind((e=>{const t=Fa(n,o,!1),r=Yo(t).rows.slice(e[0].row,e[e.length-1].row+e[e.length-1].rowspan),s=P(r,(e=>{const t=N(e.cells,(e=>!e.isLocked));return t.length>0?[{...e,cells:t}]:[]})),a=za(s);return _t(a.length>0,a)})).map((e=>(e=>D(e,(e=>{const t=Ye(e.element);return A(e.cells,(e=>{const o=Xe(e.element);Ra(o,"colspan",e.colspan,1),Ra(o,"rowspan",e.rowspan,1),Ze(t,o)})),t})))(e)))},Ul=wi([{invalid:["raw"]},{pixels:["value"]},{percent:["value"]}]),jl=(e,t,o)=>{const n=o.substring(0,o.length-e.length),r=parseFloat(n);return n===r.toString()?t(r):Ul.invalid(o)},Wl={...Ul,from:e=>Dt(e,"%")?jl("%",Ul.percent,e):Dt(e,"px")?jl("px",Ul.pixels,e):Ul.invalid(e)},$l=(e,t,o)=>e.fold((()=>t),(e=>((e,t,o)=>{const n=o/t;return D(e,(e=>Wl.from(e).fold((()=>e),(e=>e*n+"px"),(e=>e/100*o+"px"))))})(t,o,e)),(e=>((e,t)=>D(e,(e=>Wl.from(e).fold((()=>e),(e=>e/t*100+"%"),(e=>e+"%")))))(t,o))),ql=(e,t,o)=>{const n=Wl.from(o),r=F(e,(e=>"0px"===e))?((e,t)=>{const o=e.fold((()=>h("")),(e=>h(e/t+"px")),(()=>h(100/t+"%")));return O(t,o)})(n,e.length):$l(n,e,t);return Yl(r)},Gl=(e,t)=>0===e.length?t:R(e,((e,t)=>Wl.from(t).fold(h(0),p,p)+e),0),Kl=(e,t)=>Wl.from(e).fold(h(e),(e=>e+t+"px"),(e=>e+t+"%")),Yl=e=>{if(0===e.length)return e;const t=R(e,((e,t)=>{const o=Wl.from(t).fold((()=>({value:t,remainder:0})),(e=>((e,t)=>{const o=Math.floor(e);return{value:o+t,remainder:e-o}})(e,"px")),(e=>({value:e+"%",remainder:0})));return{output:[o.value].concat(e.output),remainder:e.remainder+o.remainder}}),{output:[],remainder:0}),o=t.output;return o.slice(0,o.length-1).concat([Kl(o[o.length-1],Math.round(t.remainder))])},Xl=Wl.from,Jl=(e,t,o)=>{const n=rn.fromTable(e),r=n.all,s=rn.justCells(n),a=rn.justColumns(n);t.each((t=>{const o=Xl(t).fold(h("px"),h("px"),h("%"));const r=Fo(e),i=((e,t)=>sr(e,t,or,ar))(n,e),l=ql(i,r,t);rn.hasColumns(n)?((e,t,o)=>{A(t,((t,n)=>{const r=Gl([e[n]],jt());Bt(t.element,"width",r+o)}))})(l,a,o):((e,t,o)=>{A(t,(t=>{const n=e.slice(t.column,t.colspan+t.column),r=Gl(n,jt());Bt(t.element,"width",r+o)}))})(l,s,o),Bt(e,"width",t)})),o.each((t=>{const o=gn(e),a=((e,t)=>lr(e,t,nr,ar))(n,e);((e,t,o)=>{A(o,(e=>{Ft(e.element,"height")})),A(t,((t,o)=>{Bt(t.element,"height",e[o])}))})(ql(a,o,t),r,s),Bt(e,"height",t)}))},Ql=e=>Gn(e).exists((e=>In.test(e))),ec=e=>Gn(e).exists((e=>Pn.test(e))),tc=e=>Gn(e).isNone(),oc=e=>{we(e,"width"),we(e,"height")},nc=e=>{const t=Qn(e);Jl(e,C.some(t),C.none()),oc(e)},rc=e=>{const t=(e=>Fo(e)+"px")(e);Jl(e,C.some(t),C.none()),oc(e)},sc=e=>{const t=(e=>gn(e)+"px")(e);Jl(e,C.none(),C.some(t)),oc(e)},ac=e=>{Ft(e,"width");const t=Yt(e),o=t.length>0?t:Kt(e);A(o,(e=>{Ft(e,"width"),oc(e)})),oc(e)},ic={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},lc=e=>{const t=Se.fromTag("colgroup");return O(e,(()=>Ze(t,Se.fromTag("col")))),t},cc=(e,t,o,n)=>O(e,(e=>((e,t,o,n)=>{const r=Se.fromTag("tr");for(let s=0;s{e.selection.select(t.dom,!0),e.selection.collapse(!0)},mc=(e,t,o,n,s)=>{const a=Qr(e),i={styles:a,attributes:Jr(e),colGroups:es(e)};return e.undoManager.ignore((()=>{const r=((e,t,o,n,r,s=ic)=>{const a=Se.fromTag("table"),i="cells"!==r;Lt(a,s.styles),ve(a,s.attributes),s.colGroups&&Ze(a,lc(t));const l=Math.min(e,o);if(i&&o>0){const e=Se.fromTag("thead");Ze(a,e);const s=cc(o,t,"sectionCells"===r?l:0,n);We(e,s)}const c=Se.fromTag("tbody");Ze(a,c);const d=cc(i?e-l:e,t,i?0:o,n);return We(c,d),a})(o,t,s,n,Vr(e),i);fe(r,"data-mce-id","__mce");const a=(e=>{const t=Se.fromTag("div"),o=Se.fromDom(e.dom.cloneNode(!0));return Ze(t,o),(e=>e.dom.innerHTML)(t)})(r);e.insertContent(a),e.addVisual()})),xt(rs(e),'table[data-mce-id="__mce"]').map((t=>(qr(e)?rc(t):Gr(e)?ac(t):($r(e)||(e=>r(e)&&-1!==e.indexOf("%"))(a.width))&&nc(t),as(t),we(t,"data-mce-id"),((e,t)=>{A(pt(t,"tr"),(t=>{Ml(e,t.dom),A(pt(t,"th,td"),(t=>{Nl(e,t.dom)}))}))})(e,t),((e,t)=>{xt(t,"td,th").each(v(dc,e))})(e,t),t.dom))).getOrNull()};var uc=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const gc="x-tinymce/dom-table-",hc=gc+"rows",pc=gc+"columns",fc=e=>{const t=uc.FakeClipboardItem(e);uc.write([t])},vc=e=>{var t;const o=null!==(t=uc.read())&&void 0!==t?t:[];return j(o,(t=>C.from(t.getType(e))))},bc=e=>{vc(e).isSome()&&uc.clear()},yc=e=>{e.fold(xc,(e=>fc({[hc]:e})))},wc=()=>vc(hc),xc=()=>bc(hc),Cc=e=>{e.fold(kc,(e=>fc({[pc]:e})))},Sc=()=>vc(pc),kc=()=>bc(pc),_c=e=>Qs(is(e),ss(e)).filter(gs),Ec=(e,t)=>{const o=ss(e),n=e=>Xt(e,o),a=t=>(e=>ea(is(e),ss(e)).filter(gs))(e).bind((e=>n(e).map((o=>t(o,e))))),i=t=>{e.focus()},l=(t,o=!1)=>a(((n,r)=>{const s=Xs(ta(e),n,r);t(n,s,o).each(i)})),c=()=>a(((t,o)=>{const n=Xs(ta(e),t,o),r=Lr(g,Se.fromDom(e.getDoc()),C.none());return Zl(t,n,r)})),d=()=>a(((t,o)=>{const n=Xs(ta(e),t,o);return Vl(t,n)})),m=(t,o)=>o().each((o=>{const n=D(o,(e=>Xe(e)));a(((o,r)=>{const s=Hr(Se.fromDom(e.getDoc())),a=((e,t,o,n)=>({selection:Fs(e),clipboard:o,generators:n}))(ta(e),0,n,s);t(o,a).each(i)}))})),h=e=>(t,o)=>((e,t)=>Q(e,t)?C.from(e[t]):C.none())(o,"type").each((t=>{l(e(t),o.no_events)}));q({mceTableSplitCells:()=>l(t.unmergeCells),mceTableMergeCells:()=>l(t.mergeCells),mceTableInsertRowBefore:()=>l(t.insertRowsBefore),mceTableInsertRowAfter:()=>l(t.insertRowsAfter),mceTableInsertColBefore:()=>l(t.insertColumnsBefore),mceTableInsertColAfter:()=>l(t.insertColumnsAfter),mceTableDeleteCol:()=>l(t.deleteColumn),mceTableDeleteRow:()=>l(t.deleteRow),mceTableCutCol:()=>d().each((e=>{Cc(e),l(t.deleteColumn)})),mceTableCutRow:()=>c().each((e=>{yc(e),l(t.deleteRow)})),mceTableCopyCol:()=>d().each((e=>Cc(e))),mceTableCopyRow:()=>c().each((e=>yc(e))),mceTablePasteColBefore:()=>m(t.pasteColsBefore,Sc),mceTablePasteColAfter:()=>m(t.pasteColsAfter,Sc),mceTablePasteRowBefore:()=>m(t.pasteRowsBefore,wc),mceTablePasteRowAfter:()=>m(t.pasteRowsAfter,wc),mceTableDelete:()=>_c(e).each((t=>{Xt(t,o).filter(b(o)).each((t=>{const o=Se.fromText("");if(ze(t,o),qe(t),e.dom.isEmpty(e.getBody()))e.setContent(""),e.selection.setCursorLocation();else{const t=e.dom.createRng();t.setStart(o.dom,0),t.setEnd(o.dom,0),e.selection.setRng(t),e.nodeChanged()}}))})),mceTableCellToggleClass:(t,o)=>{a((t=>{const n=ta(e),r=F(n,(t=>e.formatter.match("tablecellclass",{value:o},t.dom))),s=r?e.formatter.remove:e.formatter.apply;A(n,(e=>s("tablecellclass",{value:o},e.dom))),Rl(e,t.dom,Bl)}))},mceTableToggleClass:(t,o)=>{a((t=>{e.formatter.toggle("tableclass",{value:o},t.dom),Rl(e,t.dom,Bl)}))},mceTableToggleCaption:()=>{_c(e).each((t=>{Xt(t,o).each((o=>{wt(o,"caption").fold((()=>{const t=Se.fromTag("caption");Ze(t,Se.fromText("Caption")),((e,t,o)=>{Pe(e,o).fold((()=>{Ze(e,t)}),(e=>{Fe(e,t)}))})(o,t,0),e.selection.setCursorLocation(t.dom,0)}),(n=>{he("caption")(t)&&Ee("td",o).each((t=>e.selection.setCursorLocation(t.dom,0))),qe(n)})),Rl(e,o.dom,Ll)}))}))},mceTableSizingMode:(t,n)=>(t=>_c(e).each((n=>{Gr(e)||qr(e)||$r(e)||Xt(n,o).each((o=>{"relative"!==t||Ql(o)?"fixed"!==t||ec(o)?"responsive"!==t||tc(o)||ac(o):rc(o):nc(o),as(o),Rl(e,o.dom,Ll)}))})))(n),mceTableCellType:h((e=>"th"===e?t.makeCellsHeader:t.unmakeCellsHeader)),mceTableColType:h((e=>"th"===e?t.makeColumnsHeader:t.unmakeColumnsHeader)),mceTableRowType:h((e=>{switch(e){case"header":return t.makeRowsHeader;case"footer":return t.makeRowsFooter;default:return t.makeRowsBody}}))},((t,o)=>e.addCommand(o,t))),e.addCommand("mceInsertTable",((t,o)=>{((e,t,o,n={})=>{const r=e=>u(e)&&e>0;if(r(t)&&r(o)){const r=n.headerRows||0,s=n.headerColumns||0;return mc(e,o,t,s,r)}console.error("Invalid values for mceInsertTable - rows and columns values are required to insert a table.")})(e,o.rows,o.columns,o.options)})),e.addCommand("mceTableApplyCellStyle",((t,o)=>{const a=e=>"tablecell"+e.toLowerCase().replace("-","");if(!s(o))return;const i=N(ta(e),gs);if(0===i.length)return;const l=Y(o,((t,o)=>e.formatter.has(a(o))&&r(t)));(e=>{for(const t in e)if($.call(e,t))return!1;return!0})(l)||(q(l,((t,o)=>{const n=a(o);A(i,(o=>{""===t?e.formatter.remove(n,{value:null},o.dom,!0):e.formatter.apply(n,{value:t},o.dom)}))})),n(i[0]).each((t=>Rl(e,t.dom,Bl))))}))},Tc=wi([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Oc={before:Tc.before,on:Tc.on,after:Tc.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(p,p,p)},Dc=(e,t)=>({selection:e,kill:t}),Ac=(e,t)=>{const o=e.document.createRange();return o.selectNode(t.dom),o},Mc=(e,t)=>{const o=e.document.createRange();return Nc(o,t),o},Nc=(e,t)=>e.selectNodeContents(t.dom),Rc=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.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},Bc=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},Lc=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),Hc=wi([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Ic=(e,t,o)=>t(Se.fromDom(o.startContainer),o.startOffset,Se.fromDom(o.endContainer),o.endOffset),Pc=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:h(e),rtl:C.none}),relative:(t,o)=>({ltr:no((()=>Rc(e,t,o))),rtl:no((()=>C.some(Rc(e,o,t))))}),exact:(t,o,n,r)=>({ltr:no((()=>Bc(e,t,o,n,r))),rtl:no((()=>C.some(Bc(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();if(o.collapsed)return t.rtl().filter((e=>!1===e.collapsed)).map((e=>Hc.rtl(Se.fromDom(e.endContainer),e.endOffset,Se.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Ic(0,Hc.ltr,o)));return Ic(0,Hc.ltr,o)})(0,o)},Fc=(e,t)=>Pc(e,t).match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}});Hc.ltr,Hc.rtl;const zc=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Vc=(e,t,o,n)=>({start:Oc.on(e,t),finish:Oc.on(o,n)}),Zc=(e,t)=>{const o=Fc(e,t);return zc(Se.fromDom(o.startContainer),o.startOffset,Se.fromDom(o.endContainer),o.endOffset)},Uc=Vc,jc=(e,t,o,n,r)=>Te(o,n)?C.none():Rs(o,n,t).bind((t=>{const n=t.boxes.getOr([]);return n.length>1?(r(e,n,t.start,t.finish),C.some(Dc(C.some(Uc(o,0,o,Cr(o))),!0))):C.none()})),Wc=(e,t)=>({item:e,mode:t}),$c=(e,t,o,n=qc)=>e.property().parent(t).map((e=>Wc(e,n))),qc=(e,t,o,n=Gc)=>o.sibling(e,t).map((e=>Wc(e,n))),Gc=(e,t,o,n=Gc)=>{const r=e.property().children(t);return o.first(r).map((e=>Wc(e,n)))},Kc=[{current:$c,next:qc,fallback:C.none()},{current:qc,next:Gc,fallback:C.some($c)},{current:Gc,next:Gc,fallback:C.some(qc)}],Yc=(e,t,o,n,r=Kc)=>L(r,(e=>e.current===o)).bind((o=>o.current(e,t,n,o.next).orThunk((()=>o.fallback.bind((o=>Yc(e,t,o,n))))))),Xc=()=>({sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?C.some(e[e.length-1]):C.none()}),Jc=()=>({sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?C.some(e[0]):C.none()}),Qc=(e,t,o,n,r,s)=>Yc(e,t,n,r).bind((t=>s(t.item)?C.none():o(t.item)?C.some(t.item):Qc(e,t.item,o,t.mode,r,s))),ed=e=>t=>0===e.property().children(t).length,td=(e,t,o,n)=>Qc(e,t,o,qc,Xc(),n),od=(e,t,o,n)=>Qc(e,t,o,qc,Jc(),n),nd=_s(),rd=(e,t)=>((e,t,o)=>td(e,t,ed(e),o))(nd,e,t),sd=(e,t)=>((e,t,o)=>od(e,t,ed(e),o))(nd,e,t),ad=wi([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),id=e=>Ct(e,"tr"),ld={...ad,verify:(e,t,o,n,r,s,a)=>Ct(n,"td,th",a).bind((o=>Ct(t,"td,th",a).map((t=>Te(o,t)?Te(n,o)&&Cr(o)===r?s(t):ad.none("in same cell"):Ms(id,[o,t]).fold((()=>((e,t,o)=>{const n=e.getRect(t),r=e.getRect(o);return r.right>n.left&&r.lefts(t))))))).getOr(ad.none("default")),cata:(e,t,o,n,r)=>e.fold(t,o,n,r)},cd=(e,t)=>H(e,v(Te,t)),dd=he("br"),md=(e,t,o)=>t(e,o).bind((e=>me(e)&&0===yr(e).trim().length?md(e,t,o):C.some(e))),ud=(e,t,o,n)=>((e,t)=>Pe(e,t).filter(dd).orThunk((()=>Pe(e,t-1).filter(dd))))(t,o).bind((t=>n.traverse(t).fold((()=>md(t,n.gather,e).map(n.relative)),(e=>(e=>Ne(e).bind((t=>{const o=Ie(t);return cd(o,e).map((n=>((e,t,o,n)=>({parent:e,children:t,element:o,index:n}))(t,o,e,n)))})))(e).map((e=>Oc.on(e.parent,e.index))))))),gd=(e,t,o,n)=>{const r=dd(t)?((e,t,o)=>o.traverse(t).orThunk((()=>md(t,o.gather,e))).map(o.relative))(e,t,n):ud(e,t,o,n);return r.map((e=>({start:e,finish:e})))},hd=(e,t)=>({left:e.left,top:e.top+t,right:e.right,bottom:e.bottom+t}),pd=(e,t)=>({left:e.left,top:e.top-t,right:e.right,bottom:e.bottom-t}),fd=(e,t,o)=>({left:e.left+t,top:e.top+o,right:e.right+t,bottom:e.bottom+o}),vd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),bd=(e,t)=>C.some(e.getRect(t)),yd=(e,t,o)=>de(t)?bd(e,t).map(vd):me(t)?((e,t,o)=>o>=0&&o0?e.getRangedRect(t,o-1,t,o):C.none())(e,t,o).map(vd):C.none(),wd=(e,t)=>de(t)?bd(e,t).map(vd):me(t)?e.getRangedRect(t,0,t,Cr(t)).map(vd):C.none(),xd=wi([{none:[]},{retry:["caret"]}]),Cd=(e,t,o)=>bt(t,Pi).fold(w,(t=>wd(e,t).exists((e=>((e,t)=>e.leftt.right)(o,e))))),Sd={point:e=>e.bottom,adjuster:(e,t,o,n,r)=>{const s=hd(r,5);return Math.abs(o.bottom-n.bottom)<1||o.top>r.bottom?xd.retry(s):o.top===r.bottom?xd.retry(hd(r,1)):Cd(e,t,r)?xd.retry(fd(s,5,0)):xd.none()},move:hd,gather:sd},kd=(e,t,o,n,r)=>0===r?C.some(n):((e,t,o)=>e.elementFromPoint(t,o).filter((e=>"table"===se(e))).isSome())(e,n.left,t.point(n))?((e,t,o,n,r)=>kd(e,t,o,t.move(n,5),r))(e,t,o,n,r-1):e.situsFromPoint(n.left,t.point(n)).bind((s=>s.start.fold(C.none,(s=>wd(e,s).bind((a=>t.adjuster(e,s,a,o,n).fold(C.none,(n=>kd(e,t,o,n,r-1))))).orThunk((()=>C.some(n)))),C.none))),_d=(e,t,o)=>{const n=e.move(o,5),r=kd(t,e,o,n,100).getOr(n);return((e,t,o)=>e.point(t)>o.getInnerHeight()?C.some(e.point(t)-o.getInnerHeight()):e.point(t)<0?C.some(-e.point(t)):C.none())(e,r,t).fold((()=>t.situsFromPoint(r.left,e.point(r))),(o=>(t.scrollBy(0,o),t.situsFromPoint(r.left,e.point(r)-o))))},Ed={tryUp:v(_d,{point:e=>e.top,adjuster:(e,t,o,n,r)=>{const s=pd(r,5);return Math.abs(o.top-n.top)<1||o.bottome.getSelection().bind((n=>gd(t,n.finish,n.foffset,o).fold((()=>C.some(na(n.finish,n.foffset))),(r=>{const s=e.fromSitus(r);return(e=>ld.cata(e,(e=>C.none()),(()=>C.none()),(e=>C.some(na(e,0))),(e=>C.some(na(e,Cr(e))))))(ld.verify(e,n.finish,n.foffset,s.finish,s.foffset,o.failure,t))})))),Od=(e,t,o,n,r,s)=>0===s?C.none():Md(e,t,o,n,r).bind((a=>{const i=e.fromSitus(a),l=ld.verify(e,o,n,i.finish,i.foffset,r.failure,t);return ld.cata(l,(()=>C.none()),(()=>C.some(a)),(a=>Te(o,a)&&0===n?Dd(e,o,n,pd,r):Od(e,t,a,0,r,s-1)),(a=>Te(o,a)&&n===Cr(a)?Dd(e,o,n,hd,r):Od(e,t,a,Cr(a),r,s-1)))})),Dd=(e,t,o,n,r)=>yd(e,t,o).bind((t=>Ad(e,r,n(t,Ed.getJumpSize())))),Ad=(e,t,o)=>{const n=Ro().browser;return n.isChromium()||n.isSafari()||n.isFirefox()?t.retry(e,o):C.none()},Md=(e,t,o,n,r)=>yd(e,o,n).bind((t=>Ad(e,r,t))),Nd=(e,t)=>{return vt(e,(e=>Ne(e).exists((e=>Te(e,t)))),o).isSome();var o},Rd=(e,t,o,n,r)=>Ct(n,"td,th",t).bind((n=>Ct(n,"table",t).bind((s=>Nd(r,s)?((e,t,o)=>Td(e,t,o).bind((n=>Od(e,t,n.element,n.offset,o,20).map(e.fromSitus))))(e,t,o).bind((e=>Ct(e.finish,"td,th",t).map((t=>({start:n,finish:t,range:e}))))):C.none())))),Bd=(e,t,o,n,r,s)=>s(n,t).orThunk((()=>Rd(e,t,o,n,r).map((e=>{const t=e.range;return Dc(C.some(Uc(t.start,t.soffset,t.finish,t.foffset)),!0)})))),Ld=(e,t)=>Ct(e,"tr",t).bind((e=>Ct(e,"table",t).bind((o=>{const n=pt(o,"tr");return Te(e,n[0])?((e,t,o)=>td(nd,e,t,o))(o,(e=>Er(e).isSome()),t).map((e=>{const t=Cr(e);return Dc(C.some(Uc(e,t,e,t)),!0)})):C.none()})))),Hd=(e,t)=>Ct(e,"tr",t).bind((e=>Ct(e,"table",t).bind((o=>{const n=pt(o,"tr");return Te(e,n[n.length-1])?((e,t,o)=>od(nd,e,t,o))(o,(e=>_r(e).isSome()),t).map((e=>Dc(C.some(Uc(e,0,e,0)),!0))):C.none()})))),Id=(e,t,o,n,r,s,a)=>Rd(e,o,n,r,s).bind((e=>jc(t,o,e.start,e.finish,a))),Pd=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Fd=()=>{const e=(e=>{const t=Pd(C.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(C.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(C.some(e))}}})(g);return{...e,on:t=>e.get().each(t)}},zd=(e,t)=>Ct(e,"td,th",t),Vd=e=>Re(e).exists(os),Zd={traverse:He,gather:sd,relative:Oc.before,retry:Ed.tryDown,failure:ld.failedDown},Ud={traverse:Le,gather:rd,relative:Oc.before,retry:Ed.tryUp,failure:ld.failedUp},jd=e=>t=>t===e,Wd=jd(38),$d=jd(40),qd=e=>e>=37&&e<=40,Gd={isBackward:jd(37),isForward:jd(39)},Kd={isBackward:jd(39),isForward:jd(37)},Yd=wi([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Xd={domRange:Yd.domRange,relative:Yd.relative,exact:Yd.exact,exactFromRange:e=>Yd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Se.fromDom(e.startContainer),relative:(e,t)=>Oc.getStart(e),exact:(e,t,o,n)=>e}))(e);return o=t,Se.fromDom(Me(o).dom.defaultView);var o},range:zc},Jd=(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(n,t,o)).bind((t=>{if(null===t.offsetNode)return C.none();const o=e.dom.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),C.some(o)}))},Qd=(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(n,t,o))},em=document.caretPositionFromPoint?Jd:document.caretRangeFromPoint?Qd:C.none,tm=(e,t)=>{const o=se(e);return"input"===o?Oc.after(e):E(["br","img"],o)?0===t?Oc.before(e):Oc.after(e):Oc.on(e,t)},om=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Ae(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Te(e,o)&&t===n;return r.collapsed&&!s},nm=e=>C.from(e.getSelection()),rm=(e,t)=>{nm(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))},sm=(e,t,o,n,r)=>{const s=Bc(e,t,o,n,r);rm(e,s)},am=(e,t)=>Pc(e,t).match({ltr:(t,o,n,r)=>{sm(e,t,o,n,r)},rtl:(t,o,n,r)=>{nm(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,o,n.dom,r);else if(s.extend)try{((e,t,o,n,r,s)=>{t.collapse(o.dom,n),t.extend(r.dom,s)})(0,s,t,o,n,r)}catch(s){sm(e,n,r,t,o)}else sm(e,n,r,t,o)}))}}),im=(e,t,o,n,r)=>{const s=((e,t,o,n)=>{const r=tm(e,t),s=tm(o,n);return Xd.relative(r,s)})(t,o,n,r);am(e,s)},lm=(e,t,o)=>{const n=((e,t)=>{const o=e.fold(Oc.before,tm,Oc.after),n=t.fold(Oc.before,tm,Oc.after);return Xd.relative(o,n)})(t,o);am(e,n)},cm=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return C.some(zc(Se.fromDom(t.startContainer),t.startOffset,Se.fromDom(o.endContainer),o.endOffset))}return C.none()},dm=e=>{if(null===e.anchorNode||null===e.focusNode)return cm(e);{const t=Se.fromDom(e.anchorNode),o=Se.fromDom(e.focusNode);return om(t,e.anchorOffset,o,e.focusOffset)?C.some(zc(t,e.anchorOffset,o,e.focusOffset)):cm(e)}},mm=(e,t,o=!0)=>{const n=(o?Mc:Ac)(e,t);rm(e,n)},um=e=>(e=>nm(e).filter((e=>e.rangeCount>0)).bind(dm))(e).map((e=>Xd.exact(e.start,e.soffset,e.finish,e.foffset))),gm=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?C.some(o).map(Lc):C.none()})(Fc(e,t)),hm=(e,t,o)=>((e,t,o)=>{const n=Se.fromDom(e.document);return em(n,t,o).map((e=>zc(Se.fromDom(e.startContainer),e.startOffset,Se.fromDom(e.endContainer),e.endOffset)))})(e,t,o),pm=e=>({elementFromPoint:(t,o)=>Se.fromPoint(Se.fromDom(e.document),t,o),getRect:e=>e.dom.getBoundingClientRect(),getRangedRect:(t,o,n,r)=>{const s=Xd.exact(t,o,n,r);return gm(e,s)},getSelection:()=>um(e).map((t=>Zc(e,t))),fromSitus:t=>{const o=Xd.relative(t.start,t.finish);return Zc(e,o)},situsFromPoint:(t,o)=>hm(e,t,o).map((e=>Vc(e.start,e.soffset,e.finish,e.foffset))),clearSelection:()=>{(e=>{nm(e).each((e=>e.removeAllRanges()))})(e)},collapseSelection:(t=!1)=>{um(e).each((o=>o.fold((e=>e.collapse(t)),((o,n)=>{const r=t?o:n;lm(e,r,r)}),((o,n,r,s)=>{const a=t?o:r,i=t?n:s;im(e,a,i,a,i)}))))},setSelection:t=>{im(e,t.start,t.soffset,t.finish,t.foffset)},setRelativeSelection:(t,o)=>{lm(e,t,o)},selectNode:t=>{mm(e,t,!1)},selectContents:t=>{mm(e,t)},getInnerHeight:()=>e.innerHeight,getScrollY:()=>(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return vn(o,n)})(Se.fromDom(e.document)).top,scrollBy:(t,o)=>{((e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollBy(e,t)})(t,o,Se.fromDom(e.document))}}),fm=(e,t)=>({rows:e,cols:t}),vm=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Fd(),s=r.clear,a=s=>{r.on((r=>{n.clearBeforeUpdate(t),zd(s.target,o).each((a=>{Rs(r,a,o).each((o=>{const r=o.boxes.getOr([]);if(1===r.length){const o=r[0],a="false"===ns(o),i=St(ts(s.target),o,Te);a&&i&&(n.selectRange(t,r,o,o),e.selectContents(o))}else r.length>1&&(n.selectRange(t,r,o.start,o.finish),e.selectContents(a))}))}))}))};return{clearstate:s,mousedown:e=>{n.clear(t),zd(e.target,o).filter(Vd).each(r.set)},mouseover:e=>{a(e)},mouseup:e=>{a(e),s()}}})(pm(e),t,o,n);return{clearstate:r.clearstate,mousedown:r.mousedown,mouseover:r.mouseover,mouseup:r.mouseup}},bm=e=>bt(e,ce).exists(os),ym=(e,t)=>bm(e)||bm(t),wm=(e,t,o,n)=>{const r=pm(e),s=()=>(n.clear(t),C.none());return{keydown:(e,a,i,l,c,d)=>{const m=e.raw,u=m.which,g=!0===m.shiftKey,h=Bs(t,n.selectedSelector).fold((()=>(qd(u)&&!g&&n.clearBeforeUpdate(t),qd(u)&&g&&!ym(a,l)?C.none:$d(u)&&g?v(Id,r,t,o,Zd,l,a,n.selectRange):Wd(u)&&g?v(Id,r,t,o,Ud,l,a,n.selectRange):$d(u)?v(Bd,r,o,Zd,l,a,Hd):Wd(u)?v(Bd,r,o,Ud,l,a,Ld):C.none)),(e=>{const o=o=>()=>{const s=j(o,(o=>((e,t,o,n,r)=>Hs(n,e,t,r.firstSelectedSelector,r.lastSelectedSelector).map((e=>(r.clearBeforeUpdate(o),r.selectRange(o,e.boxes,e.start,e.finish),e.boxes))))(o.rows,o.cols,t,e,n)));return s.fold((()=>Ls(t,n.firstSelectedSelector,n.lastSelectedSelector).map((e=>{const o=$d(u)||d.isForward(u)?Oc.after:Oc.before;return r.setRelativeSelection(Oc.on(e.first,0),o(e.table)),n.clear(t),Dc(C.none(),!0)}))),(e=>C.some(Dc(C.none(),!0))))};return qd(u)&&g&&!ym(a,l)?C.none:$d(u)&&g?o([fm(1,0)]):Wd(u)&&g?o([fm(-1,0)]):d.isBackward(u)&&g?o([fm(0,-1),fm(-1,0)]):d.isForward(u)&&g?o([fm(0,1),fm(1,0)]):qd(u)&&!g?s:C.none}));return h()},keyup:(e,r,s,a,i)=>Bs(t,n.selectedSelector).fold((()=>{const l=e.raw,c=l.which;return!0===l.shiftKey&&qd(c)&&ym(r,a)?((e,t,o,n,r,s,a)=>Te(o,r)&&n===s?C.none():Ct(o,"td,th",t).bind((o=>Ct(r,"td,th",t).bind((n=>jc(e,t,o,n,a))))))(t,o,r,s,a,i,n.selectRange):C.none()}),C.none)}},xm=(e,t)=>{const o=be(e,t);return void 0===o||""===o?[]:o.split(" ")},Cm=e=>void 0!==e.dom.classList,Sm=(e,t)=>((e,t,o)=>{const n=xm(e,t).concat([o]);return fe(e,t,n.join(" ")),!0})(e,"class",t),km=(e,t)=>{Cm(e)?e.dom.classList.add(t):Sm(e,t)},_m=(e,t)=>Cm(e)&&e.dom.classList.contains(t),Em=(e,t,o)=>{const n=t=>{we(t,e.selected),we(t,e.firstSelected),we(t,e.lastSelected)},r=t=>{fe(t,e.selected,"1")},s=e=>{a(e),o()},a=t=>{const o=pt(t,`${e.selectedSelector},${e.firstSelectedSelector},${e.lastSelectedSelector}`);A(o,n)};return{clearBeforeUpdate:a,clear:s,selectRange:(o,n,a,i)=>{s(o),A(n,r),fe(a,e.firstSelected,"1"),fe(i,e.lastSelected,"1"),t(n,a,i)},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}},Tm=()=>({tag:"none"}),Om=e=>({tag:"multiple",elements:e}),Dm=e=>({tag:"single",element:e}),Am=(e,t,o)=>{const n=rn.fromTable(e);return Wa(n,t).map((e=>{const t=Fa(n,o,!1),{rows:r}=Yo(t),s=((e,t)=>{const o=e.slice(0,t[t.length-1].row+1),n=za(o);return P(n,(e=>{const o=e.cells.slice(0,t[t.length-1].column+1);return D(o,(e=>e.element))}))})(r,e),a=((e,t)=>{const o=e.slice(t[0].row+t[0].rowspan-1,e.length),n=za(o);return P(n,(e=>{const o=e.cells.slice(t[0].column+t[0].colspan-1,e.cells.length);return D(o,(e=>e.element))}))})(r,e);return{upOrLeftCells:s,downOrRightCells:a}}))},Mm=e=>{const t=Se.fromDom((e=>{if(st()&&d(e.target)){const t=Se.fromDom(e.target);if(de(t)&&ct(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return Z(t)}}return C.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(s=n,a=o,(...e)=>s(a.apply(null,e)));var s,a;return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},Nm=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(Mm(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:v(Rm,e,t,s,r)}},Rm=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Bm=x,Lm=(e,t,o)=>((e,t,o,n)=>Nm(e,t,o,n,!1))(e,t,Bm,o),Hm=Mm,Im=e=>!_m(Se.fromDom(e.target),"ephox-snooker-resizer-bar"),Pm=(e,t)=>{const o=((e,t,o)=>({get:()=>Is(e(),o).fold((()=>t().fold(Tm,Dm)),Om)}))((()=>Se.fromDom(e.getBody())),(()=>ea(is(e),ss(e))),Ys.selectedSelector),n=Em(Ys,((t,o,n)=>{Xt(o).each((r=>{const s=D(t,(e=>e.dom)),a=zr(e),i=Lr(g,Se.fromDom(e.getDoc()),a),l=ta(e),c=Am(r,{selection:l},i).map((e=>G(e,(e=>D(e,(e=>e.dom)))))).getOrUndefined();((e,t,o,n,r)=>{e.dispatch("TableSelectionChange",{cells:t,start:o,finish:n,otherCells:r})})(e,s,o.dom,n.dom,c)}))}),(()=>(e=>{e.dispatch("TableSelectionClear")})(e)));e.on("init",(o=>{const r=e.getWin(),s=rs(e),a=ss(e),i=vm(r,s,a,n),l=wm(r,s,a,n),c=((e,t,o,n)=>{const r=pm(e);return(e,s)=>{n.clearBeforeUpdate(t),Rs(e,s,o).each((e=>{const o=e.boxes.getOr([]);n.selectRange(t,o,e.start,e.finish),r.selectContents(s),r.collapseSelection()}))}})(r,s,a,n);e.on("TableSelectorChange",(e=>c(e.start,e.finish)));const d=(t,o)=>{(e=>!0===e.raw.shiftKey)(t)&&(o.kill&&t.kill(),o.selection.each((t=>{const o=Xd.relative(t.start,t.finish),n=Fc(r,o);e.selection.setRng(n)})))},m=e=>0===e.button,u=(()=>{const e=Pd(Se.fromDom(s)),t=Pd(0);return{touchEnd:o=>{const n=Se.fromDom(o.target);if(he("td")(n)||he("th")(n)){const r=e.get(),s=t.get();Te(r,n)&&o.timeStamp-s<300&&(o.preventDefault(),c(n,n))}e.set(n),t.set(o.timeStamp)}}})();e.on("dragstart",(e=>{i.clearstate()})),e.on("mousedown",(e=>{m(e)&&Im(e)&&i.mousedown(Hm(e))})),e.on("mouseover",(e=>{var t;void 0!==(t=e).buttons&&0==(1&t.buttons)||!Im(e)||i.mouseover(Hm(e))})),e.on("mouseup",(e=>{m(e)&&Im(e)&&i.mouseup(Hm(e))})),e.on("touchend",u.touchEnd),e.on("keyup",(t=>{const o=Hm(t);if(o.raw.shiftKey&&qd(o.raw.which)){const t=e.selection.getRng(),n=Se.fromDom(t.startContainer),r=Se.fromDom(t.endContainer);l.keyup(o,n,t.startOffset,r,t.endOffset).each((e=>{d(o,e)}))}})),e.on("keydown",(o=>{const n=Hm(o);t.hide();const r=e.selection.getRng(),s=Se.fromDom(r.startContainer),a=Se.fromDom(r.endContainer),i=dn(Gd,Kd)(Se.fromDom(e.selection.getStart()));l.keydown(n,s,r.startOffset,a,r.endOffset,i).each((e=>{d(n,e)})),t.show()})),e.on("NodeChange",(()=>{const t=e.selection,o=Se.fromDom(t.getStart()),r=Se.fromDom(t.getEnd());Ms(Xt,[o,r]).fold((()=>n.clear(s)),g)}))})),e.on("PreInit",(()=>{e.serializer.addTempAttr(Ys.firstSelected),e.serializer.addTempAttr(Ys.lastSelected)}));return{getSelectedCells:()=>((e,t,o,n)=>{switch(e.tag){case"none":return t();case"single":return n(e.element);case"multiple":return o(e.elements)}})(o.get(),h([]),(e=>D(e,(e=>e.dom))),(e=>[e.dom])),clearSelectedCells:e=>n.clear(Se.fromDom(e))}},Fm=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=N(t,(t=>t!==e))},trigger:(...o)=>{const n={};A(e,((e,t)=>{n[e]=o[t]})),A(t,(e=>{e(n)}))}}},zm=e=>({registry:G(e,(e=>({bind:e.bind,unbind:e.unbind}))),trigger:G(e,(e=>e.trigger))}),Vm=e=>e.slice(0).sort(),Zm=(e,t,o)=>{if(0===t.length)throw new Error("You must specify at least one required field.");return((e,t)=>{if(!a(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");A(t,(t=>{if(!r(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")}))})("required",t),(e=>{const t=Vm(e);L(t,((e,o)=>o{throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+t.join(", ")+"].")}))})(t),n=>{const r=W(n);F(t,(e=>E(r,e)))||((e,t)=>{throw new Error("All required keys ("+Vm(e).join(", ")+") were not specified. Specified keys were: "+Vm(t).join(", ")+".")})(t,r),e(t,r);const s=N(t,(e=>!o.validate(n[e],e)));return s.length>0&&((e,t)=>{throw new Error("All values need to be of type: "+t+". Keys ("+Vm(e).join(", ")+") were not.")})(s,o.label),n}},Um=(e,t)=>{const o=N(t,(t=>!E(e,t)));o.length>0&&(e=>{throw new Error("Unsupported keys for object: "+Vm(e).join(", "))})(o)},jm=e=>((e,t)=>Zm(e,t,{validate:m,label:"function"}))(Um,e),Wm=jm(["compare","extract","mutate","sink"]),$m=jm(["element","start","stop","destroy"]),qm=jm(["forceDrop","drop","move","delayDrop"]),Gm=()=>{let e=C.none();const t=zm({move:Fm(["info"])});return{onEvent:(o,n)=>{n.extract(o).each((o=>{const r=((t,o)=>{const n=e.map((e=>t.compare(e,o)));return e=C.some(o),n})(n,o);r.each((e=>{t.trigger.move(e)}))}))},reset:()=>{e=C.none()},events:t.registry}},Km=()=>{const e=(()=>{const e=zm({move:Fm(["info"])});return{onEvent:g,reset:g,events:e.registry}})(),t=Gm();let o=e;return{on:()=>{o.reset(),o=t},off:()=>{o.reset(),o=e},isOn:()=>o===t,onEvent:(e,t)=>{o.onEvent(e,t)},events:t.events}},Ym=(e,t,o)=>{let n=!1;const r=zm({start:Fm([]),stop:Fm([])}),s=Km(),a=()=>{d.stop(),s.isOn()&&(s.off(),r.trigger.stop())},l=((e,t)=>{let o=null;const n=()=>{i(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}})(a,200);s.events.move.bind((o=>{t.mutate(e,o.info)}));const c=e=>(...t)=>{n&&e.apply(null,t)},d=t.sink(qm({forceDrop:a,drop:c(a),move:c((e=>{l.cancel(),s.onEvent(e,t)})),delayDrop:c(l.throttle)}),o);return{element:d.element,go:e=>{d.start(e),s.on(),r.trigger.start()},on:()=>{n=!0},off:()=>{n=!1},isActive:()=>n,destroy:()=>{d.destroy()},events:r.registry}},Xm=e=>{const t=e.replace(/\./g,"-");return{resolve:e=>t+"-"+e}},Jm=Xm("ephox-dragster").resolve;var Qm=Wm({compare:(e,t)=>vn(t.left-e.left,t.top-e.top),extract:e=>C.some(vn(e.x,e.y)),sink:(e,t)=>{const o=(e=>{const t={layerClass:Jm("blocker"),...e},o=Se.fromTag("div");return fe(o,"role","presentation"),Lt(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),km(o,Jm("blocker")),km(o,t.layerClass),{element:h(o),destroy:()=>{qe(o)}}})(t),n=Lm(o.element(),"mousedown",e.forceDrop),r=Lm(o.element(),"mouseup",e.drop),s=Lm(o.element(),"mousemove",e.move),a=Lm(o.element(),"mouseout",e.delayDrop);return $m({element:o.element,start:e=>{Ze(e,o.element())},stop:()=>{qe(o.element())},destroy:()=>{o.destroy(),r.unbind(),s.unbind(),a.unbind(),n.unbind()}})},mutate:(e,t)=>{e.mutate(t.left,t.top)}});const eu=Xm("ephox-snooker").resolve,tu=()=>{const e=zm({drag:Fm(["xDelta","yDelta","target"])});let t=C.none();const o=(()=>{const e=zm({drag:Fm(["xDelta","yDelta"])});return{mutate:(t,o)=>{e.trigger.drag(t,o)},events:e.registry}})();o.events.drag.bind((o=>{t.each((t=>{e.trigger.drag(o.xDelta,o.yDelta,t)}))}));return{assign:e=>{t=C.some(e)},get:()=>t,mutate:o.mutate,events:e.registry}},ou=eu("resizer-bar"),nu=eu("resizer-rows"),ru=eu("resizer-cols"),su=e=>{const t=pt(e.parent(),"."+ou);A(t,qe)},au=(e,t,o)=>{const n=e.origin();A(t,(t=>{t.each((t=>{const r=o(n,t);km(r,ou),Ze(e.parent(),r)}))}))},iu=(e,t,o,n)=>{au(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=Se.fromTag("div");return Lt(s,{position:"absolute",left:t-n/2+"px",top:o+"px",height:r+"px",width:n+"px"}),ve(s,{"data-column":e,role:"presentation"}),s})(t.col,t.x-e.left,o.top-e.top,7,n);return km(r,ru),r}))},lu=(e,t,o,n)=>{au(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=Se.fromTag("div");return Lt(s,{position:"absolute",left:t+"px",top:o-r/2+"px",height:r+"px",width:n+"px"}),ve(s,{"data-row":e,role:"presentation"}),s})(t.row,o.left-e.left,t.y-e.top,n,7);return km(r,nu),r}))},cu=(e,t,o,n,r)=>{const s=yn(o),a=t.isResizable,i=n.length>0?Mn.positions(n,o):[],l=i.length>0?((e,t)=>P(e.all,((e,o)=>t(e.element)?[o]:[])))(e,a):[],c=N(i,((e,t)=>T(l,(e=>t===e))));lu(t,c,s,zo(o));const d=r.length>0?Rn.positions(r,o):[],m=d.length>0?((e,t)=>{const o=[];return O(e.grid.columns,(n=>{const r=rn.getColumnAt(e,n).map((e=>e.element));r.forall(t)&&o.push(n)})),N(o,(o=>{const n=rn.filterItems(e,(e=>e.column===o));return F(n,(e=>t(e.element)))}))})(e,a):[],u=N(d,((e,t)=>T(m,(e=>t===e))));iu(t,u,s,hn(o))},du=(e,t)=>{if(su(e),e.isResizable(t)){const o=rn.fromTable(t),n=ln(o),r=sn(o);cu(o,e,t,n,r)}},mu=(e,t)=>{const o=pt(e.parent(),"."+ou);A(o,t)},uu=e=>{mu(e,(e=>{Bt(e,"display","none")}))},gu=e=>{mu(e,(e=>{Bt(e,"display","block")}))},hu=eu("resizer-bar-dragging"),pu=e=>{const t=tu(),o=((e,t={})=>{var o;const n=null!==(o=t.mode)&&void 0!==o?o:Qm;return Ym(e,n,t)})(t,{});let n=C.none();const r=(e,t)=>C.from(be(e,t));t.events.drag.bind((e=>{r(e.target,"data-row").each((t=>{const o=Ut(e.target,"top");Bt(e.target,"top",o+e.yDelta+"px")})),r(e.target,"data-column").each((t=>{const o=Ut(e.target,"left");Bt(e.target,"left",o+e.xDelta+"px")}))}));const s=(e,t)=>Ut(e,t)-zt(e,"data-initial-"+t,0);o.events.stop.bind((()=>{t.get().each((t=>{n.each((o=>{r(t,"data-row").each((e=>{const n=s(t,"top");we(t,"data-initial-top"),d.trigger.adjustHeight(o,n,parseInt(e,10))})),r(t,"data-column").each((e=>{const n=s(t,"left");we(t,"data-initial-left"),d.trigger.adjustWidth(o,n,parseInt(e,10))})),du(e,o)}))}))}));const a=(n,r)=>{d.trigger.startAdjust(),t.assign(n),fe(n,"data-initial-"+r,Ut(n,r)),km(n,hu),Bt(n,"opacity","0.2"),o.go(e.parent())},i=Lm(e.parent(),"mousedown",(e=>{var t;t=e.target,_m(t,nu)&&a(e.target,"top"),(e=>_m(e,ru))(e.target)&&a(e.target,"left")})),l=t=>Te(t,e.view()),c=Lm(e.view(),"mouseover",(t=>{var r;(r=t.target,Ct(r,"table",l).filter(os)).fold((()=>{dt(t.target)&&su(e)}),(t=>{o.isActive()&&(n=C.some(t),du(e,t))}))})),d=zm({adjustHeight:Fm(["table","delta","row"]),adjustWidth:Fm(["table","delta","column"]),startAdjust:Fm([])});return{destroy:()=>{i.unbind(),c.unbind(),o.destroy(),su(e)},refresh:t=>{du(e,t)},on:o.on,off:o.off,hideBars:v(uu,e),showBars:v(gu,e),events:d.registry}},fu=(e,t,o)=>{const n=Mn,r=Rn,s=pu(e),a=zm({beforeResize:Fm(["table","type"]),afterResize:Fm(["table","type"]),startDrag:Fm([])});return s.events.adjustHeight.bind((e=>{const t=e.table;a.trigger.beforeResize(t,"row");const o=n.delta(e.delta,t);Ei(t,o,e.row),a.trigger.afterResize(t,"row")})),s.events.startAdjust.bind((e=>{a.trigger.startDrag()})),s.events.adjustWidth.bind((e=>{const n=e.table;a.trigger.beforeResize(n,"col");const s=r.delta(e.delta,n),i=o(n);_i(n,s,e.column,t,i),a.trigger.afterResize(n,"col")})),{on:s.on,off:s.off,refreshBars:s.refresh,hideBars:s.hideBars,showBars:s.showBars,destroy:s.destroy,events:a.registry}},vu=(e,t)=>{const o=ue(e)?(e=>Se.fromDom(Me(e).dom.documentElement))(e):e;return{parent:h(o),view:h(e),origin:h(vn(0,0)),isResizable:t}},bu=(e,t,o)=>({parent:h(t),view:h(e),origin:h(vn(0,0)),isResizable:o}),yu=()=>{const e=Se.fromTag("div");return Lt(e,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Ze(mt(Se.fromDom(document)),e),e},wu=e=>d(e)&&"TABLE"===e.nodeName,xu="bar-",Cu=e=>"false"!==be(e,"data-mce-resize"),Su=e=>{return Ot(t=e,o="corner-")?((e,t)=>e.substring(t))(t,o.length):t;var t,o},ku=e=>{const t=Fd(),o=Fd(),n=Fd();let r,s,a,i;const l=t=>Il(e,t),c=()=>Ur(e)?fa():pa(),d=(t,o,n,d)=>{const m=Su(o),u=Dt(m,"e"),g=Ot(m,"n");if(""===s&&nc(t),""===i&&sc(t),n!==r&&""!==s){Bt(t,"width",s);const o=c(),a=l(t),i=Ur(e)||u?(e=>va(e).columns)(t)-1:0;_i(t,n-r,i,o,a)}else if((e=>/^(\d+(\.\d+)?)%$/.test(e))(s)){const e=parseFloat(s.replace("%",""));Bt(t,"width",n*e/r+"%")}if((e=>/^(\d+(\.\d+)?)px$/.test(e))(s)&&(e=>{const t=rn.fromTable(e);rn.hasColumns(t)||A(Kt(e),(e=>{const t=Ht(e,"width");Bt(e,"width",t),we(e,"width")}))})(t),d!==a&&""!==i){Bt(t,"height",i);const e=g?0:(e=>va(e).rows)(t)-1;Ei(t,d-a,e)}},m=()=>{o.on((e=>{e.destroy()})),n.on((t=>{((e,t)=>{e.inline&&qe(t.parent())})(e,t)}))};e.on("init",(()=>{const r=((e,t)=>e.inline?bu(Se.fromDom(e.getBody()),yu(),t):vu(Se.fromDom(e.getDoc()),t))(e,Cu);if(n.set(r),(e=>{const t=e.options.get("object_resizing");return E(t.split(","),"table")})(e)&&Kr(e)){const n=c(),s=fu(r,n,l);s.on(),s.events.startDrag.bind((o=>{t.set(e.selection.getRng())})),s.events.beforeResize.bind((t=>{const o=t.table.dom;((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(e,o,ls(o),cs(o),xu+t.type)})),s.events.afterResize.bind((o=>{const n=o.table,r=n.dom;as(n),t.on((t=>{e.selection.setRng(t),e.focus()})),((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(e,r,ls(r),cs(r),xu+o.type),e.undoManager.add()})),o.set(s)}})),e.on("ObjectResizeStart",(t=>{const o=t.target;if(wu(o)){const n=Se.fromDom(o);A(e.dom.select(".mce-clonedresizable"),(t=>{e.dom.addClass(t,"mce-"+Zr(e)+"-columns")})),!ec(n)&&qr(e)?rc(n):!Ql(n)&&$r(e)&&nc(n),tc(n)&&Ot(t.origin,xu)&&nc(n),r=t.width,s=Gr(e)?"":ms(e,o).getOr(""),a=t.height,i=us(e,o).getOr("")}})),e.on("ObjectResized",(t=>{const o=t.target;if(wu(o)){const n=Se.fromDom(o),r=t.origin;(e=>Ot(e,"corner-"))(r)&&d(n,r,t.width,t.height),as(n),Rl(e,n.dom,Bl)}})),e.on("SwitchMode",(()=>{o.on((t=>{e.mode.isReadOnly()?t.hideBars():t.showBars()}))})),e.on("dragstart dragend",(e=>{o.on((t=>{"dragstart"===e.type?(t.hideBars(),t.off()):(t.on(),t.showBars())}))})),e.on("remove",(()=>{m()}));return{refresh:e=>{o.on((t=>t.refreshBars(Se.fromDom(e))))},hide:()=>{o.on((e=>e.hideBars()))},show:()=>{o.on((e=>e.showBars()))}}},_u=e=>{(e=>{const t=e.options.register;t("table_clone_elements",{processor:"string[]"}),t("table_use_colgroups",{processor:"boolean",default:!0}),t("table_header_type",{processor:e=>{const t=E(["section","cells","sectionCells","auto"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: section, cells, sectionCells or auto."}},default:"section"}),t("table_sizing_mode",{processor:"string",default:"auto"}),t("table_default_attributes",{processor:"object",default:{border:"1"}}),t("table_default_styles",{processor:"object",default:{"border-collapse":"collapse"}}),t("table_column_resizing",{processor:e=>{const t=E(["preservetable","resizetable"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be preservetable, or resizetable."}},default:"preservetable"}),t("table_resize_bars",{processor:"boolean",default:!0}),t("table_style_by_css",{processor:"boolean",default:!0}),t("table_merge_content_on_paste",{processor:"boolean",default:!0})})(e);const t=ku(e),o=Pm(e,t),n=Pl(e,t,o);return Ec(e,n),((e,t)=>{const o=ss(e),n=t=>ea(is(e)).bind((n=>Xt(n,o).map((o=>{const r=Xs(ta(e),o,n);return t(o,r)})))).getOr("");q({mceTableRowType:()=>n(t.getTableRowType),mceTableCellType:()=>n(t.getTableCellType),mceTableColType:()=>n(t.getTableColType)},((t,o)=>e.addQueryValueHandler(o,t)))})(e,n),oa(e,n),{getSelectedCells:o.getSelectedCells,clearSelectedCells:o.clearSelectedCells}},Eu=e=>({table:_u(e)});e.add("dom",Eu)}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=(r="allow_html_in_named_anchor",e=>e.options.get(r));var r;const s="a:not([href])",a=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),c=e=>{const n=e.dom;t(n).walk(e.selection.getRng(),(e=>{o.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&n.remove(e,!1)}))}))},d=e=>e.dom.getParent(e.selection.getStart(),s),m=(e,t)=>{const o=d(e);o?((e,t,o)=>{o.removeAttribute("name"),o.id=t,e.addVisual(),e.undoManager.add()})(e,t,o):((e,t)=>{e.undoManager.transact((()=>{n(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:t})):(c(e),e.formatter.remove("namedAnchor",void 0,void 0,!0),e.formatter.apply("namedAnchor",{value:t}),e.addVisual())}))})(e,t),e.focus()},u=e=>{const t=(e=>{const t=d(e);return t?i(t):""})(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:t=>{((e,t)=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)?(m(e,t),!0):(e.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1))(e,t.getData().id)&&t.close()}})},g=e=>(e=>a(e.attr("href"))&&!a(e.attr("id")||e.attr("name")))(e)&&!e.firstChild,h=e=>t=>{for(let o=0;ot=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}};e.add("anchor",(e=>{(e=>{(0,e.options.register)("allow_html_in_named_anchor",{processor:"boolean",default:!1})})(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("a",h("false")),e.serializer.addNodeFilter("a",h(null))}))})(e),(e=>{e.addCommand("mceAnchor",(()=>{u(e)}))})(e),(e=>{const t=()=>e.execCommand("mceAnchor");e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:t,onSetup:t=>{const o=e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind,n=p(e)(t);return()=>{o(),n()}}}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:t,onSetup:p(e)})})(e),e.on("PreInit",(()=>{(e=>{e.formatter.register("namedAnchor",{inline:"a",selector:s,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(e,t,o)=>l(e)})})(e)}))}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=(e,t)=>{const o=((e,t)=>e.dispatch("insertCustomChar",{chr:t}))(e,t).chr;e.execCommand("mceInsertContent",!1,o)},o=e=>t=>e===t,n=(r="array",e=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(e)===r);var r;const s=o(null),a=o(void 0),i=(e=>t=>typeof t===e)("function"),l=(c=!1,()=>c);var c;class d{constructor(e,t){this.tag=e,this.value=t}static some(e){return new d(!0,e)}static none(){return d.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?d.some(e(this.value)):d.none()}bind(e){return this.tag?e(this.value):d.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:d.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return(e=>null==e)(e)?d.none():d.some(e)}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()"}}d.singletonNone=new d(!1);const m=Array.prototype.push,u=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r((e,t,o)=>{for(let n=0,r=e.length;n(e=>{const t=[];for(let o=0,r=e.length;ot=>t.options.get(e),v=f("charmap"),b=f("charmap_append"),y=p.isArray,w="User Defined",x=e=>{return y(e)?(t=e,p.grep(t,(e=>y(e)&&2===e.length))):"function"==typeof e?e():[];var t},C=e=>{const t=((e,t)=>{const o=v(e);o&&(t=[{name:w,characters:x(o)}]);const n=b(e);if(n){const e=p.grep(t,(e=>e.name===w));return e.length?(e[0].characters=[...e[0].characters,...x(n)],t):t.concat({name:w,characters:x(n)})}return t})(e,[{name:"Currency",characters:[[36,"dollar sign"],[162,"cent sign"],[8364,"euro sign"],[163,"pound sign"],[165,"yen sign"],[164,"currency sign"],[8352,"euro-currency sign"],[8353,"colon sign"],[8354,"cruzeiro sign"],[8355,"french franc sign"],[8356,"lira sign"],[8357,"mill sign"],[8358,"naira sign"],[8359,"peseta sign"],[8360,"rupee sign"],[8361,"won sign"],[8362,"new sheqel sign"],[8363,"dong sign"],[8365,"kip sign"],[8366,"tugrik sign"],[8367,"drachma sign"],[8368,"german penny symbol"],[8369,"peso sign"],[8370,"guarani sign"],[8371,"austral sign"],[8372,"hryvnia sign"],[8373,"cedi sign"],[8374,"livre tournois sign"],[8375,"spesmilo sign"],[8376,"tenge sign"],[8377,"indian rupee sign"],[8378,"turkish lira sign"],[8379,"nordic mark sign"],[8380,"manat sign"],[8381,"ruble sign"],[20870,"yen character"],[20803,"yuan character"],[22291,"yuan character, in hong kong and taiwan"],[22278,"yen/yuan character variant one"]]},{name:"Text",characters:[[169,"copyright sign"],[174,"registered sign"],[8482,"trade mark sign"],[8240,"per mille sign"],[181,"micro sign"],[183,"middle dot"],[8226,"bullet"],[8230,"three dot leader"],[8242,"minutes / feet"],[8243,"seconds / inches"],[167,"section sign"],[182,"paragraph sign"],[223,"sharp s / ess-zed"]]},{name:"Quotations",characters:[[8249,"single left-pointing angle quotation mark"],[8250,"single right-pointing angle quotation mark"],[171,"left pointing guillemet"],[187,"right pointing guillemet"],[8216,"left single quotation mark"],[8217,"right single quotation mark"],[8220,"left double quotation mark"],[8221,"right double quotation mark"],[8218,"single low-9 quotation mark"],[8222,"double low-9 quotation mark"],[60,"less-than sign"],[62,"greater-than sign"],[8804,"less-than or equal to"],[8805,"greater-than or equal to"],[8211,"en dash"],[8212,"em dash"],[175,"macron"],[8254,"overline"],[164,"currency sign"],[166,"broken bar"],[168,"diaeresis"],[161,"inverted exclamation mark"],[191,"turned question mark"],[710,"circumflex accent"],[732,"small tilde"],[176,"degree sign"],[8722,"minus sign"],[177,"plus-minus sign"],[247,"division sign"],[8260,"fraction slash"],[215,"multiplication sign"],[185,"superscript one"],[178,"superscript two"],[179,"superscript three"],[188,"fraction one quarter"],[189,"fraction one half"],[190,"fraction three quarters"]]},{name:"Mathematical",characters:[[402,"function / florin"],[8747,"integral"],[8721,"n-ary sumation"],[8734,"infinity"],[8730,"square root"],[8764,"similar to"],[8773,"approximately equal to"],[8776,"almost equal to"],[8800,"not equal to"],[8801,"identical to"],[8712,"element of"],[8713,"not an element of"],[8715,"contains as member"],[8719,"n-ary product"],[8743,"logical and"],[8744,"logical or"],[172,"not sign"],[8745,"intersection"],[8746,"union"],[8706,"partial differential"],[8704,"for all"],[8707,"there exists"],[8709,"diameter"],[8711,"backward difference"],[8727,"asterisk operator"],[8733,"proportional to"],[8736,"angle"]]},{name:"Extended Latin",characters:[[192,"A - grave"],[193,"A - acute"],[194,"A - circumflex"],[195,"A - tilde"],[196,"A - diaeresis"],[197,"A - ring above"],[256,"A - macron"],[198,"ligature AE"],[199,"C - cedilla"],[200,"E - grave"],[201,"E - acute"],[202,"E - circumflex"],[203,"E - diaeresis"],[274,"E - macron"],[204,"I - grave"],[205,"I - acute"],[206,"I - circumflex"],[207,"I - diaeresis"],[298,"I - macron"],[208,"ETH"],[209,"N - tilde"],[210,"O - grave"],[211,"O - acute"],[212,"O - circumflex"],[213,"O - tilde"],[214,"O - diaeresis"],[216,"O - slash"],[332,"O - macron"],[338,"ligature OE"],[352,"S - caron"],[217,"U - grave"],[218,"U - acute"],[219,"U - circumflex"],[220,"U - diaeresis"],[362,"U - macron"],[221,"Y - acute"],[376,"Y - diaeresis"],[562,"Y - macron"],[222,"THORN"],[224,"a - grave"],[225,"a - acute"],[226,"a - circumflex"],[227,"a - tilde"],[228,"a - diaeresis"],[229,"a - ring above"],[257,"a - macron"],[230,"ligature ae"],[231,"c - cedilla"],[232,"e - grave"],[233,"e - acute"],[234,"e - circumflex"],[235,"e - diaeresis"],[275,"e - macron"],[236,"i - grave"],[237,"i - acute"],[238,"i - circumflex"],[239,"i - diaeresis"],[299,"i - macron"],[240,"eth"],[241,"n - tilde"],[242,"o - grave"],[243,"o - acute"],[244,"o - circumflex"],[245,"o - tilde"],[246,"o - diaeresis"],[248,"o slash"],[333,"o macron"],[339,"ligature oe"],[353,"s - caron"],[249,"u - grave"],[250,"u - acute"],[251,"u - circumflex"],[252,"u - diaeresis"],[363,"u - macron"],[253,"y - acute"],[254,"thorn"],[255,"y - diaeresis"],[563,"y - macron"],[913,"Alpha"],[914,"Beta"],[915,"Gamma"],[916,"Delta"],[917,"Epsilon"],[918,"Zeta"],[919,"Eta"],[920,"Theta"],[921,"Iota"],[922,"Kappa"],[923,"Lambda"],[924,"Mu"],[925,"Nu"],[926,"Xi"],[927,"Omicron"],[928,"Pi"],[929,"Rho"],[931,"Sigma"],[932,"Tau"],[933,"Upsilon"],[934,"Phi"],[935,"Chi"],[936,"Psi"],[937,"Omega"],[945,"alpha"],[946,"beta"],[947,"gamma"],[948,"delta"],[949,"epsilon"],[950,"zeta"],[951,"eta"],[952,"theta"],[953,"iota"],[954,"kappa"],[955,"lambda"],[956,"mu"],[957,"nu"],[958,"xi"],[959,"omicron"],[960,"pi"],[961,"rho"],[962,"final sigma"],[963,"sigma"],[964,"tau"],[965,"upsilon"],[966,"phi"],[967,"chi"],[968,"psi"],[969,"omega"]]},{name:"Symbols",characters:[[8501,"alef symbol"],[982,"pi symbol"],[8476,"real part symbol"],[978,"upsilon - hook symbol"],[8472,"Weierstrass p"],[8465,"imaginary part"]]},{name:"Arrows",characters:[[8592,"leftwards arrow"],[8593,"upwards arrow"],[8594,"rightwards arrow"],[8595,"downwards arrow"],[8596,"left right arrow"],[8629,"carriage return"],[8656,"leftwards double arrow"],[8657,"upwards double arrow"],[8658,"rightwards double arrow"],[8659,"downwards double arrow"],[8660,"left right double arrow"],[8756,"therefore"],[8834,"subset of"],[8835,"superset of"],[8836,"not a subset of"],[8838,"subset of or equal to"],[8839,"superset of or equal to"],[8853,"circled plus"],[8855,"circled times"],[8869,"perpendicular"],[8901,"dot operator"],[8968,"left ceiling"],[8969,"right ceiling"],[8970,"left floor"],[8971,"right floor"],[9001,"left-pointing angle bracket"],[9002,"right-pointing angle bracket"],[9674,"lozenge"],[9824,"black spade suit"],[9827,"black club suit"],[9829,"black heart suit"],[9830,"black diamond suit"],[8194,"en space"],[8195,"em space"],[8201,"thin space"],[8204,"zero width non-joiner"],[8205,"zero width joiner"],[8206,"left-to-right mark"],[8207,"right-to-left mark"]]}]);return t.length>1?[{name:"All",characters:h(t,(e=>e.characters))}].concat(t):t},S=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},k=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!a(n)||r+t.length<=n)},_=String.fromCodePoint,E=(e,t)=>{const o=[],n=t.toLowerCase();return((e,t)=>{for(let o=0,n=e.length;o{((e,t,o)=>!!k(_(e).toLowerCase(),o)||k(t.toLowerCase(),o)||k(t.toLowerCase().replace(/\s+/g,""),o))(e[0],e[1],n)&&o.push(e)})),u(o,(e=>({text:e[1],value:_(e[0]),icon:_(e[0])})))},T="pattern",O=(e,o)=>{const n=()=>[{label:"Search",type:"input",name:T},{type:"collection",name:"results"}],r=1===o.length?S(w):S("All"),a=((e,t)=>{let o=null;const n=()=>{s(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}})((e=>{const t=e.getData().pattern;((e,t)=>{g(o,(e=>e.name===r.get())).each((o=>{const n=E(o,t);e.setData({results:n})}))})(e,t)}),40),i={title:"Special Character",size:"normal",body:1===o.length?{type:"panel",items:n()}:{type:"tabpanel",tabs:u(o,(e=>({title:e.name,name:e.name,items:n()})))},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{pattern:"",results:E(o[0],"")},onAction:(o,n)=>{"results"===n.name&&(t(e,n.value),o.close())},onTabChange:(e,t)=>{r.set(t.newTabName),a.throttle(e)},onChange:(e,t)=>{t.name===T&&a.throttle(e)}};e.windowManager.open(i).focus(T)},D=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}};e.add("charmap",(e=>{(e=>{const t=e.options.register,o=e=>i(e)||n(e);t("charmap",{processor:o}),t("charmap_append",{processor:o})})(e);const o=C(e);return((e,t)=>{e.addCommand("mceShowCharmap",(()=>{O(e,t)}))})(e,o),(e=>{const t=()=>e.execCommand("mceShowCharmap");e.ui.registry.addButton("charmap",{icon:"insert-character",tooltip:"Special character",onAction:t,onSetup:D(e)}),e.ui.registry.addMenuItem("charmap",{icon:"insert-character",text:"Special character...",onAction:t,onSetup:D(e)})})(e),((e,t)=>{e.ui.registry.addAutocompleter("charmap",{trigger:":",columns:"auto",minChars:2,fetch:(e,o)=>new Promise(((o,n)=>{o(E(t,e))})),onAction:(t,o,n)=>{e.selection.setRng(o),e.insertContent(n),t.hide()}})})(e,o[0]),(e=>({getCharMap:()=>C(e),insertChar:o=>{t(e,o)}}))(e)}))}(),tinymce.util.Tools.resolve("tinymce.PluginManager").add("code",(e=>((e=>{e.addCommand("mceCodeEditor",(()=>{(e=>{const t=(e=>e.getContent({source_view:!0}))(e);e.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:t},onSubmit:t=>{((e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()})(e,t.getData().code),t.close()}})})(e)}))})(e),(e=>{const t=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:t}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:t})})(e),{}))),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>typeof t===e,o=(e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e)("string"),n=t("boolean"),r=e=>!(e=>null==e)(e),s=t("function"),a=t("number"),i=(l=!1,()=>l);var l;class c{constructor(e,t){this.tag=e,this.value=t}static some(e){return new c(!0,e)}static none(){return c.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?c.some(e(this.value)):c.none()}bind(e){return this.tag?e(this.value):c.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:c.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return r(e)?c.some(e):c.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()"}}c.singletonNone=new c(!1);const d=(e,t)=>{for(let o=0,n=e.length;o{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},u={fromHtml:(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 m(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return m(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return m(o)},fromDom:m,fromPoint:(e,t,o)=>c.from(e.dom.elementFromPoint(t,o)).map(m)},g=(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")}};"undefined"!=typeof window?window:Function("return this;")();const h=e=>t=>(e=>e.dom.nodeType)(t)===e,p=h(1),f=h(3),v=h(9),b=h(11),y=e=>((e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r{((e,t,r)=>{if(!(o(r)||n(r)||a(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},x=(e,t)=>{e.dom.removeAttribute(t)},C=s(Element.prototype.attachShadow)&&s(Node.prototype.getRootNode)?e=>u.fromDom(e.dom.getRootNode()):e=>{return v(e)?e:(t=e,u.fromDom(t.dom.ownerDocument));var t},S=e=>{const t=C(e);return b(o=t)&&r(o.dom.host)?c.some(t):c.none();var o},k=e=>u.fromDom(e.dom.host),_=e=>{const t=f(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return S(u.fromDom(t)).fold((()=>o.body.contains(t)),(n=_,r=k,e=>n(r(e))));var n,r},E=(e,t,o)=>((e,t,o)=>{let n=e.dom;const r=s(o)?o:i;for(;n.parentNode;){n=n.parentNode;const e=u.fromDom(n);if(t(e))return c.some(e);if(r(e))break}return c.none()})(e,(e=>g(e,t)),o),T=(e,t)=>(e=>void 0!==e.style&&s(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",O=e=>"rtl"===((e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||_(e)?n:T(o,t)})(e,"direction")?"rtl":"ltr",D=(e,t)=>((e,t)=>((e,t)=>{const o=[];for(let n=0,r=e.length;ng(e,t))),A=e=>(e=>c.from(e.dom.parentNode).map(u.fromDom))(e).filter(p),M=(N="li",e=>p(e)&&e.dom.nodeName.toLowerCase()===N);var N;const R=(e,t,o)=>{d(t,(t=>{const n=u.fromDom(t),r=M(n),s=((e,t)=>(t?E(e,"ol,ul"):c.some(e)).getOr(e))(n,r);A(s).each((t=>{e.setStyle(s.dom,"direction",null);if(O(t)===o?x(s,"dir"):w(s,"dir",o),O(s)!==o&&e.setStyle(s.dom,"direction",o),r){const t=D(s,"li[dir],li[style]");d(t,(t=>{x(t,"dir"),e.setStyle(t.dom,"direction",null)}))}}))}))},B=(e,t)=>{e.selection.isEditable()&&(R(e.dom,e.selection.getSelectedBlocks(),t),e.nodeChanged())},L=(e,t)=>o=>{const n=n=>{const r=u.fromDom(n.element);o.setActive(O(r)===t),o.setEnabled(e.selection.isEditable())};return e.on("NodeChange",n),o.setEnabled(e.selection.isEditable()),()=>e.off("NodeChange",n)};e.add("directionality",(e=>{(e=>{e.addCommand("mceDirectionLTR",(()=>{B(e,"ltr")})),e.addCommand("mceDirectionRTL",(()=>{B(e,"rtl")}))})(e),(e=>{e.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:()=>e.execCommand("mceDirectionLTR"),onSetup:L(e,"ltr")}),e.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:()=>e.execCommand("mceDirectionRTL"),onSetup:L(e,"rtl")})})(e)}))}(),function(){const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const o=e=>({isFullscreen:()=>null!==e.get()}),n=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,r=e=>t=>typeof t===e,s=e=>t=>e===t,a=n("string"),i=n("object"),l=n("array"),c=s(null),d=r("boolean"),m=s(void 0),u=e=>!(e=>null==e)(e),g=r("function"),h=r("number"),p=()=>{},f=e=>()=>e;function v(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const b=f(!1),y=f(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.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:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return u(e)?w.some(e):w.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()"}}w.singletonNone=new w(!1);const x=Array.prototype.push,C=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[];for(let n=0,r=e.length;n((e,t,o)=>{for(let n=0,r=e.length;n(e=>{const t=[];for(let o=0,n=e.length;o((e,t)=>t>=0&&t{const o=e(w.none()),n=()=>o.get().each(t);return{clear:()=>{n(),o.set(w.none())},isSet:()=>o.get().isSome(),get:()=>o.get(),set:e=>{n(),o.set(w.some(e))}}},D=()=>O((e=>e.unbind())),A=Object.keys,M="undefined"!=typeof window?window:Function("return this;")(),N=(e,t)=>((e,t)=>{let o=null!=t?t:M;for(let t=0;t{const o=((e,t)=>N(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},B=Object.getPrototypeOf,L=e=>{const t=N("ownerDocument.defaultView",e);return i(e)&&((e=>R("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(B(e).constructor.name))},H=e=>t=>(e=>e.dom.nodeType)(t)===e,I=H(1),P=H(3),F=H(9),z=H(11),V=(e,t,o)=>{((e,t,o)=>{if(!(a(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+"")})(e.dom,t,o)},Z=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},U=(e,t)=>{e.dom.removeAttribute(t)},j=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!m(n)||r+t.length<=n)},W=e=>void 0!==e.style&&g(e.style.getPropertyValue),$=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},q={fromHtml:(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 $(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return $(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return $(o)},fromDom:$,fromPoint:(e,t,o)=>w.from(e.dom.elementFromPoint(t,o)).map($)},G=(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")}},K=e=>q.fromDom(e.dom.ownerDocument),Y=e=>(e=>w.from(e.dom.parentNode).map(q.fromDom))(e).map(X).map((t=>k(t,(t=>{return o=t,!(e.dom===o.dom);var o})))).getOr([]),X=e=>C(e.dom.childNodes,q.fromDom),J=g(Element.prototype.attachShadow)&&g(Node.prototype.getRootNode),Q=f(J),ee=J?e=>q.fromDom(e.dom.getRootNode()):e=>F(e)?e:K(e),te=e=>{const t=ee(e);return z(o=t)&&u(o.dom.host)?w.some(t):w.none();var o},oe=e=>q.fromDom(e.dom.host),ne=e=>u(e.dom.shadowRoot),re=e=>{const t=P(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return te(q.fromDom(t)).fold((()=>o.body.contains(t)),(n=re,r=oe,e=>n(r(e))));var n,r},se=(e,t,o)=>{if(!a(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);W(e)&&e.style.setProperty(t,o)},ae=(e,t,o)=>{const n=e.dom;se(n,t,o)},ie=(e,t)=>{const o=e.dom;((e,t)=>{const o=A(e);for(let n=0,r=o.length;n{se(o,t,e)}))},le=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||re(e)?n:ce(o,t)},ce=(e,t)=>W(e)?e.style.getPropertyValue(t):"",de=e=>{const t=q.fromDom((e=>{if(Q()&&u(e.target)){const t=q.fromDom(e.target);if(I(t)&&ne(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return T(t)}}return w.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(s=n,a=o,(...e)=>s(a.apply(null,e)));var s,a;return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},me=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(de(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:v(ue,e,t,s,r)}},ue=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},ge=y,he=(e,t,o)=>((e,t,o,n)=>me(e,t,o,n,!1))(e,t,ge,o),pe=()=>fe(0,0),fe=(e,t)=>({major:e,minor:t}),ve={nu:fe,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?pe():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return fe(n(1),n(2))})(e,o)},unknown:pe},be=(e,t)=>((e,t)=>{for(let o=0;o{const o=t.brand.toLowerCase();return _(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:ve.nu(parseInt(t.version,10),0)})))})),ye=(e,t)=>{const o=String(t).toLowerCase();return _(e,(e=>e.search(o)))},we=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,xe=e=>t=>j(t,e),Ce=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>j(e,"edge/")&&j(e,"chrome")&&j(e,"safari")&&j(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,we],search:e=>j(e,"chrome")&&!j(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>j(e,"msie")||j(e,"trident")},{name:"Opera",versionRegexes:[we,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:xe("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:xe("firefox")},{name:"Safari",versionRegexes:[we,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(j(e,"safari")||j(e,"mobile/"))&&j(e,"applewebkit")}],Se=[{name:"Windows",search:xe("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>j(e,"iphone")||j(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:xe("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:xe("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:xe("linux"),versionRegexes:[]},{name:"Solaris",search:xe("sunos"),versionRegexes:[]},{name:"FreeBSD",search:xe("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:xe("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ke={browsers:f(Ce),oses:f(Se)},_e="Edge",Ee="Chromium",Te="Opera",Oe="Firefox",De="Safari",Ae=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(_e),isChromium:n(Ee),isIE:n("IE"),isOpera:n(Te),isFirefox:n(Oe),isSafari:n(De)}},Me={unknown:()=>Ae({current:void 0,version:ve.unknown()}),nu:Ae,edge:f(_e),chromium:f(Ee),ie:f("IE"),opera:f(Te),firefox:f(Oe),safari:f(De)},Ne="Windows",Re="Android",Be="Linux",Le="macOS",He="Solaris",Ie="FreeBSD",Pe="ChromeOS",Fe=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Ne),isiOS:n("iOS"),isAndroid:n(Re),isMacOS:n(Le),isLinux:n(Be),isSolaris:n(He),isFreeBSD:n(Ie),isChromeOS:n(Pe)}},ze={unknown:()=>Fe({current:void 0,version:ve.unknown()}),nu:Fe,windows:f(Ne),ios:f("iOS"),android:f(Re),linux:f(Be),macos:f(Le),solaris:f(He),freebsd:f(Ie),chromeos:f(Pe)},Ve=(e,t,o)=>{const n=ke.browsers(),r=ke.oses(),s=t.bind((e=>be(n,e))).orThunk((()=>((e,t)=>ye(e,t).map((e=>{const o=ve.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(Me.unknown,Me.nu),a=((e,t)=>ye(e,t).map((e=>{const o=ve.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(ze.unknown,ze.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),m=!c&&!l&&!d;return{isiPad:f(r),isiPhone:f(s),isTablet:f(l),isPhone:f(c),isTouch:f(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:f(d),isDesktop:f(m)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},Ze=e=>window.matchMedia(e).matches;let Ue=(e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)})((()=>Ve(navigator.userAgent,w.from(navigator.userAgentData),Ze)));const je=(e,t)=>({left:e,top:t,translate:(o,n)=>je(e+o,t+n)}),We=je,$e=e=>{const t=void 0===e?window:e;return Ue().browser.isFirefox()?w.none():w.from(t.visualViewport)},qe=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Ge=e=>{const t=void 0===e?window:e,o=t.document,n=(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return We(o,n)})(q.fromDom(o));return $e(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return qe(n.left,n.top,o,r)}),(e=>qe(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},Ke=(e,t,o)=>$e(o).map((o=>{const n=e=>t(de(e));return o.addEventListener(e,n),{unbind:()=>o.removeEventListener(e,n)}})).getOrThunk((()=>({unbind:p})));var Ye=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Xe=tinymce.util.Tools.resolve("tinymce.Env");const Je=(e,t)=>{e.dispatch("FullscreenStateChanged",{state:t}),e.dispatch("ResizeEditor")},Qe=(et="fullscreen_native",e=>e.options.get(et));var et;const tt=e=>{const t=q.fromDom(e.getElement());return te(t).map(oe).getOrThunk((()=>(e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return q.fromDom(t)})(K(t))))},ot=e=>{return e.dom===(void 0!==(t=K(e).dom).fullscreenElement?t.fullscreenElement:void 0!==t.msFullscreenElement?t.msFullscreenElement:void 0!==t.webkitFullscreenElement?t.webkitFullscreenElement:null);var t},nt=(e,t,o)=>k(((e,t)=>{const o=g(t)?t:b;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=q.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r})(e,o),t),rt=e=>((e,t)=>{const o=void 0===t?document:t.dom;return 1!==(n=o).nodeType&&9!==n.nodeType&&11!==n.nodeType||0===n.childElementCount?[]:C(o.querySelectorAll(e),q.fromDom);var n})(e),st=(e,t,o)=>nt(e,(e=>G(e,t)),o),at=(e,t)=>((e,t)=>k(Y(e),t))(e,(e=>G(e,t))),it="data-ephox-mobile-fullscreen-style",lt="position:absolute!important;",ct="top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;",dt=Xe.os.isAndroid(),mt=(e,t,o)=>{const n=t=>o=>{const n=Z(o,"style"),r=void 0===n?"no-styles":n.trim();r!==t&&(V(o,it,r),ie(o,e.parseStyle(t)))},r=st(t,"*"),s=E(r,(e=>at(e,"*:not(.tox-silver-sink)"))),a=(e=>{const t=le(e,"background-color");return void 0!==t&&""!==t?"background-color:"+t+"!important":"background-color:rgb(255,255,255)!important;"})(o);S(s,n("display:none!important;")),S(r,n(lt+ct+a));n((!0===dt?"":lt)+ct+a)(t)},ut=Ye.DOM,gt=$e().fold((()=>({bind:p,unbind:p})),(e=>{const t=(()=>{const e=O(p);return{...e,on:t=>e.get().each(t)}})(),o=D(),n=D(),r=((e,t)=>{let o=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{c(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}})((()=>{document.body.scrollTop=0,document.documentElement.scrollTop=0,window.requestAnimationFrame((()=>{t.on((t=>ie(t,{top:e.offsetTop+"px",left:e.offsetLeft+"px",height:e.height+"px",width:e.width+"px"})))}))}),50);return{bind:e=>{t.set(e),r.throttle(),o.set(Ke("resize",r.throttle)),n.set(Ke("scroll",r.throttle))},unbind:()=>{t.on((()=>{o.clear(),n.clear()})),t.clear()}}})),ht=(e,t)=>{const o=document.body,n=document.documentElement,r=e.getContainer(),s=q.fromDom(r),a=(i=s,w.from(i.dom.nextSibling).map(q.fromDom)).filter((e=>(e=>I(e)&&L(e.dom))(e)&&((e,t)=>(e=>void 0!==e.dom.classList)(e)&&e.dom.classList.contains(t))(e,"tox-silver-sink")));var i;const l=tt(e),c=t.get(),d=q.fromDom(e.getBody()),m=Xe.deviceType.isTouch(),u=r.style,g=e.iframeElement,h=null==g?void 0:g.style,p=e=>{e(o,"tox-fullscreen"),e(n,"tox-fullscreen"),e(r,"tox-fullscreen"),te(s).map((e=>oe(e).dom)).each((t=>{e(t,"tox-fullscreen"),e(t,"tox-shadowhost")}))},f=()=>{m&&(e=>{const t=rt("["+it+"]");S(t,(t=>{const o=Z(t,it);o&&"no-styles"!==o?ie(t,e.parseStyle(o)):U(t,"style"),U(t,it)}))})(e.dom),p(ut.removeClass),gt.unbind(),w.from(t.get()).each((e=>e.fullscreenChangeHandler.unbind()))};if(c)c.fullscreenChangeHandler.unbind(),Qe(e)&&ot(l)&&(e=>{const t=e.dom;t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.webkitCancelFullScreen&&t.webkitCancelFullScreen()})(K(l)),h.width=c.iframeWidth,h.height=c.iframeHeight,u.width=c.containerWidth,u.height=c.containerHeight,u.top=c.containerTop,u.left=c.containerLeft,b=a,y=c.sinkCssPosition,x=(e,t)=>{ae(e,"position",t)},b.isSome()&&y.isSome()?w.some(x(b.getOrDie(),y.getOrDie())):w.none(),f(),v=c.scrollPos,window.scrollTo(v.x,v.y),t.set(null),Je(e,!1),e.off("remove",f);else{const o=he(K(l),void 0!==document.fullscreenElement?"fullscreenchange":void 0!==document.msFullscreenElement?"MSFullscreenChange":void 0!==document.webkitFullscreenElement?"webkitfullscreenchange":"fullscreenchange",(o=>{Qe(e)&&(ot(l)||null===t.get()||ht(e,t))})),n={scrollPos:Ge(window),containerWidth:u.width,containerHeight:u.height,containerTop:u.top,containerLeft:u.left,iframeWidth:h.width,iframeHeight:h.height,fullscreenChangeHandler:o,sinkCssPosition:a.map((e=>le(e,"position")))};m&&mt(e.dom,s,d),h.width=h.height="100%",u.width=u.height="",p(ut.addClass),a.each((e=>{ae(e,"position","fixed")})),gt.bind(s),e.on("remove",f),t.set(n),Qe(e)&&(e=>{const t=e.dom;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.webkitRequestFullScreen&&t.webkitRequestFullScreen()})(l),Je(e,!0)}var v,b,y,x},pt=(e,t)=>o=>{o.setActive(null!==t.get());const n=e=>o.setActive(e.state);return e.on("FullscreenStateChanged",n),()=>e.off("FullscreenStateChanged",n)};t.add("fullscreen",(t=>{const n=e(null);return t.inline||((e=>{(0,e.options.register)("fullscreen_native",{processor:"boolean",default:!1})})(t),((e,t)=>{e.addCommand("mceFullScreen",(()=>{ht(e,t)}))})(t,n),((e,t)=>{const o=()=>e.execCommand("mceFullScreen");e.ui.registry.addToggleMenuItem("fullscreen",{text:"Fullscreen",icon:"fullscreen",shortcut:"Meta+Shift+F",onAction:o,onSetup:pt(e,t)}),e.ui.registry.addToggleButton("fullscreen",{tooltip:"Fullscreen",icon:"fullscreen",onAction:o,onSetup:pt(e,t),shortcut:"Meta+Shift+F"})})(t,n),t.addShortcut("Meta+Shift+F","","mceFullScreen")),o(n)}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,o=e=>t=>typeof t===e,n=t("string"),r=t("object"),s=t("array"),a=(i=null,e=>i===e);var i;const l=o("boolean"),c=e=>!(e=>null==e)(e),d=o("function"),m=(e,t)=>{if(s(e)){for(let o=0,n=e.length;o{},g=(e,t)=>e===t;class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.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:h.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?h.some(e):h.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()"}}h.singletonNone=new h(!1);const p=Array.prototype.indexOf,f=Array.prototype.push,v=(e,t)=>((e,t)=>p.call(e,t))(e,t)>-1,b=e=>{const t=[];for(let o=0,n=e.length;ob(((e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0;oe.exists((e=>o(e,t))),C=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te?h.some(t):h.none(),k=e=>t=>t.options.get(e),_=k("link_assume_external_targets"),E=k("link_context_toolbar"),T=k("link_list"),O=k("link_default_target"),D=k("link_default_protocol"),A=k("link_target_list"),M=k("link_rel_list"),N=k("link_class_list"),R=k("link_title"),B=k("allow_unsafe_link_target"),L=k("link_quicklink");var H=tinymce.util.Tools.resolve("tinymce.util.Tools");const I=e=>n(e.value)?e.value:"",P=(e,t)=>{const o=[];return H.each(e,(e=>{const r=(e=>n(e.text)?e.text:n(e.title)?e.title:"")(e);if(void 0!==e.menu){const n=P(e.menu,t);o.push({text:r,items:n})}else{const n=t(e);o.push({text:r,value:n})}})),o},F=(e=I)=>t=>h.from(t).map((t=>P(t,e))),z={sanitize:e=>F(I)(e),sanitizeWith:F,createUi:(e,t)=>o=>({name:e,type:"listbox",label:t,items:o}),getValue:I},V=Object.keys,Z=Object.hasOwnProperty,U=(e,t,o,n)=>{((e,t)=>{const o=V(e);for(let n=0,r=o.length;n{(t(e,r)?o:n)(e,r)}))},j=(e,t)=>Z.call(e,t);var W=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),$=tinymce.util.Tools.resolve("tinymce.util.URI");const q=e=>c(e)&&"a"===e.nodeName.toLowerCase(),G=e=>q(e)&&!!X(e),K=(e,t)=>{if(e.collapsed)return[];{const o=e.cloneContents(),n=o.firstChild,r=new W(n,o),s=[];let a=n;do{t(a)&&s.push(a)}while(a=r.next());return s}},Y=e=>/^\w+:/i.test(e),X=e=>{var t,o;return null!==(o=null!==(t=e.getAttribute("data-mce-href"))&&void 0!==t?t:e.getAttribute("href"))&&void 0!==o?o:""},J=(e,t)=>{const o=["noopener"],n=e?e.split(/\s+/):[],r=e=>e.filter((e=>-1===H.inArray(o,e))),s=t?(e=>(e=r(e)).length>0?e.concat(o):o)(n):r(n);return s.length>0?(e=>H.trim(e.sort().join(" ")))(s):""},Q=(e,t)=>(t=t||oe(e.selection.getRng())[0]||e.selection.getNode(),ae(t)?h.from(e.dom.select("a[href]",t)[0]):h.from(e.dom.getParent(t,"a[href]"))),ee=(e,t)=>Q(e,t).isSome(),te=(e,t)=>(e=>e.replace(/\uFEFF/g,""))(t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||""))),oe=e=>K(e,G),ne=e=>H.grep(e,G),re=e=>ne(e).length>0,se=e=>{const t=e.schema.getTextInlineElements(),o=e=>1===e.nodeType&&!q(e)&&!j(t,e.nodeName.toLowerCase());if(Q(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const n=e.selection.getRng();if(n.collapsed)return!0;return 0===K(n,o).length},ae=e=>c(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ie=(e,t)=>{const o={...t};if(0===M(e).length&&!B(e)){const e=J(o.rel,"_blank"===o.target);o.rel=e||null}return h.from(o.target).isNone()&&!1===A(e)&&(o.target=O(e)),o.href=((e,t)=>"http"!==t&&"https"!==t||Y(e)?e:t+"://"+e)(o.href,_(e)),o},le=(e,t,o)=>{const n=e.selection.getNode(),r=Q(e,n),s=ie(e,(e=>{return t=["title","rel","class","target"],o=(t,o)=>(e[o].each((e=>{t[o]=e.length>0?e:null})),t),n={href:e.href},((e,t)=>{for(let o=0,n=e.length;o{n=o(n,e,t)})),n;var t,o,n})(o));e.undoManager.transact((()=>{o.href===t.href&&t.attach(),r.fold((()=>{((e,t,o,n)=>{const r=e.dom;ae(t)?ge(r,t,n):o.fold((()=>{e.execCommand("mceInsertLink",!1,n)}),(t=>{e.insertContent(r.createHTML("a",n,r.encode(t)))}))})(e,n,o.text,s)}),(t=>{e.focus(),((e,t,o,n)=>{o.each((e=>{j(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,n),e.selection.select(t)})(e,t,o.text,s)}))}))},ce=e=>{const{class:t,href:o,rel:n,target:r,text:s,title:i}=e;return((e,t)=>{const o={};var n;return U(e,t,(n=o,(e,t)=>{n[t]=e}),u),o})({class:t.getOrNull(),href:o,rel:n.getOrNull(),target:r.getOrNull(),text:s.getOrNull(),title:i.getOrNull()},((e,t)=>!1===a(e)))},de=(e,t,o)=>{const n=((e,t)=>{const o=e.options.get,n={allow_html_data_urls:o("allow_html_data_urls"),allow_script_urls:o("allow_script_urls"),allow_svg_data_urls:o("allow_svg_data_urls")},r=t.href;return{...t,href:$.isDomSafe(r,"a",n)?r:""}})(e,o);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,ce(n)):le(e,t,n)},me=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();ae(t)?ue(e,t):(e=>{const t=e.dom,o=e.selection,n=o.getBookmark(),r=o.getRng().cloneRange(),s=t.getParent(r.startContainer,"a[href]",e.getBody()),a=t.getParent(r.endContainer,"a[href]",e.getBody());s&&r.setStartBefore(s),a&&r.setEndAfter(a),o.setRng(r),e.execCommand("unlink"),o.moveToBookmark(n)})(e),e.focus()}))})(e)},ue=(e,t)=>{var o;const n=e.dom.select("img",t)[0];if(n){const r=e.dom.getParents(n,"a[href]",t)[0];r&&(null===(o=r.parentNode)||void 0===o||o.insertBefore(n,r),e.dom.remove(r))}},ge=(e,t,o)=>{var n;const r=e.select("img",t)[0];if(r){const t=e.create("a",o);null===(n=r.parentNode)||void 0===n||n.insertBefore(t,r),t.appendChild(r)}},he=e=>{return j(t=e,o="items")&&void 0!==t[o]&&null!==t[o];var t,o},pe=(e,t)=>w(t,(t=>he(t)?pe(e,t.items):S(t.value===e,t))),fe=(e,t,o,n)=>{const r=n[t],s=e.length>0;return void 0!==r?pe(r,o).map((t=>({url:{value:t.value,meta:{text:s?e:t.text,attach:u}},text:s?e:t.text}))):h.none()},ve=(e,t)=>{const o={text:e.text,title:e.title},n=e=>{const t=(n=e.url,S(o.text.length<=0,h.from(null===(r=n.meta)||void 0===r?void 0:r.text).getOr(n.value)));var n,r;const s=(e=>{var t;return S(o.title.length<=0,h.from(null===(t=e.meta)||void 0===t?void 0:t.title).getOr(""))})(e.url);return t.isSome()||s.isSome()?h.some({...t.map((e=>({text:e}))).getOr({}),...s.map((e=>({title:e}))).getOr({})}):h.none()},r=(e,n)=>{const r=(s=t,a=n,"link"===a?s.link:"anchor"===a?s.anchor:h.none()).getOr([]);var s,a;return fe(o.text,n,r,e)};return{onChange:(e,t)=>{const s=t.name;return"url"===s?n(e()):v(["anchor","link"],s)?r(e(),s):"text"===s||"title"===s?(o[s]=e()[s],h.none()):h.none()}}};var be=tinymce.util.Tools.resolve("tinymce.util.Delay");const ye=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?h.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):h.none()},we=(e,t)=>o=>{const n=o.href;return 1===e&&!Y(n)||0===e&&/^\s*www(\.|\d\.)/i.test(n)?h.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+n})}):h.none()},xe=(e,t)=>w([ye,we(_(e),D(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(o=>new Promise((n=>{((e,t,o)=>{const n=e.selection.getRng();be.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(n),o(t)}))}))})(e,o.message,(e=>{n(e?o.preprocess(t):t)}))})))),Ce=e=>{const t=e.dom.select("a:not([href])"),o=y(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]}));return o.length>0?h.some([{text:"None",value:""}].concat(o)):h.none()},Se=e=>{const t=N(e);return t.length>0?z.sanitize(t):h.none()},ke=e=>{try{return h.some(JSON.parse(e))}catch(e){return h.none()}},_e=e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),o=T(e);return new Promise((e=>{n(o)?fetch(o).then((e=>e.ok?e.text().then(ke):Promise.reject())).then(e,(()=>e(h.none()))):d(o)?o((t=>e(h.some(t)))):e(h.from(o))})).then((e=>e.bind(z.sanitizeWith(t)).map((e=>{if(e.length>0){return[{text:"None",value:""}].concat(e)}return e}))))},Ee=(e,t)=>{const o=M(e);if(o.length>0){const n=x(t,"_blank"),r=e=>J(z.getValue(e),n);return(!1===B(e)?z.sanitizeWith(r):z.sanitize)(o)}return h.none()},Te=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],Oe=e=>{const t=A(e);return s(t)?z.sanitize(t).orThunk((()=>h.some(Te))):!1===t?h.none():h.some(Te)},De=(e,t,o)=>{const n=e.getAttrib(t,o);return null!==n&&n.length>0?h.some(n):h.none()},Ae=(e,t)=>_e(e).then((o=>{const n=((e,t)=>{const o=e.dom,n=se(e)?h.some(te(e.selection,t)):h.none(),r=t.bind((e=>h.from(o.getAttrib(e,"href")))),s=t.bind((e=>h.from(o.getAttrib(e,"target")))),a=t.bind((e=>De(o,e,"rel"))),i=t.bind((e=>De(o,e,"class")));return{url:r,text:n,title:t.bind((e=>De(o,e,"title"))),target:s,rel:a,linkClass:i}})(e,t);return{anchor:n,catalogs:{targets:Oe(e),rels:Ee(e,n.target),classes:Se(e),anchor:Ce(e),link:o},optNode:t,flags:{titleEnabled:R(e)}}})),Me=e=>{const t=(e=>{const t=Q(e);return Ae(e,t)})(e);t.then((t=>{const o=((e,t)=>o=>{const n=o.getData();if(!n.url.value)return me(e),void o.close();const r=e=>h.from(n[e]).filter((o=>!x(t.anchor[e],o))),s={href:n.url.value,text:r("text"),target:r("target"),rel:r("rel"),class:r("linkClass"),title:r("title")},a={href:n.url.value,attach:void 0!==n.url.meta&&n.url.meta.attach?n.url.meta.attach:u};xe(e,s).then((t=>{de(e,a,t)})),o.close()})(e,t);return((e,t,o)=>{const n=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),r=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],s=((e,t)=>{const o=e.anchor,n=o.url.getOr("");return{url:{value:n,meta:{original:{value:n}}},text:o.text.getOr(""),title:o.title.getOr(""),anchor:n,link:n,rel:o.rel.getOr(""),target:o.target.or(t).getOr(""),linkClass:o.linkClass.getOr("")}})(e,h.from(O(o))),a=e.catalogs,i=ve(s,a);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:b([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],n,r,C([a.anchor.map(z.createUi("anchor","Anchors")),a.rels.map(z.createUi("rel","Rel")),a.targets.map(z.createUi("target","Open link in...")),a.link.map(z.createUi("link","Link list")),a.classes.map(z.createUi("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:s,onChange:(e,{name:t})=>{i.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,o,e)})).then((t=>{e.windowManager.open(t)}))};var Ne=tinymce.util.Tools.resolve("tinymce.util.VK");const Re=e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,o)},Be=(e,t)=>e.dom.getParent(t,"a[href]"),Le=e=>Be(e,e.selection.getStart()),He=(e,t)=>{if(t){const o=X(t);if(/^#/.test(o)){const t=e.dom.select(o);t.length&&e.selection.scrollIntoView(t[0],!0)}else Re(t.href)}},Ie=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},Pe=e=>()=>{He(e,Le(e))},Fe=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),ze=e=>t=>{const o=()=>{t.setActive(!e.mode.isReadOnly()&&ee(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return o(),Fe(e,o)},Ve=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return o(),Fe(e,o)},Ze=e=>t=>{const o=()=>t.setEnabled((e=>1===(e.selection.isCollapsed()?ne(e.dom.getParents(e.selection.getStart())):oe(e.selection.getRng())).length)(e));return o(),Fe(e,o)},Ue=e=>t=>{const o=t=>{return re(t)||(o=e.selection.getRng(),oe(o).length>0);var o},n=e.dom.getParents(e.selection.getStart()),r=n=>{t.setEnabled(o(n)&&e.selection.isEditable())};return r(n),Fe(e,(e=>r(e.parents)))},je=e=>{const t=t=>{const o=e.selection.getNode();return t.setEnabled(ee(e,o)),u};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:ze(e)},label:"Link",predicate:t=>E(e)&&ee(e,t),initValue:()=>{return Q(e).fold((t="",()=>t),X);var t},commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const o=e.selection.getNode();return t.setActive(ee(e,o)),ze(e)(t)},onAction:t=>{const o=t.getValue(),n=(t=>{const o=Q(e),n=se(e);if(o.isNone()&&n){const n=te(e.selection,o);return S(0===n.length,t)}return h.none()})(o);de(e,{href:o,attach:u},{href:o,text:n,title:h.none(),rel:h.none(),target:h.from(O(e)),class:h.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:t,onAction:t=>{me(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:t,onAction:t=>{Pe(e)(),t.hide()}}]})};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=n(e)||l(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>n(e)||d(e)||m(e,r)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>l(e)||m(e,r),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1})})(e),(e=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",onAction:Ie(e),onSetup:ze(e),shortcut:"Meta+K"}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:Pe(e),onSetup:Ze(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>me(e),onSetup:Ue(e)})})(e),(e=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:Pe(e),onSetup:Ze(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onSetup:Ve(e),onAction:Ie(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>me(e),onSetup:Ue(e)})})(e),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?re(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),je(e),(e=>{e.on("click",(t=>{const o=Be(e,t.target);o&&Ne.metaKeyPressed(t)&&(t.preventDefault(),He(e,o))})),e.on("keydown",(t=>{if(!t.isDefaultPrevented()&&13===t.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(t)){const o=Le(e);o&&(t.preventDefault(),He(e,o))}}))})(e),(e=>{e.addCommand("mceLink",((t,o)=>{!0!==(null==o?void 0:o.dialog)&&L(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Me(e)}))})(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}(),function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,n=(s=String).prototype,n.isPrototypeOf(o)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===s.name)?"string":t;var o,n;var r,s,a})(t)===e,o=e=>t=>typeof t===e,n=t("string"),r=t("object"),s=t("array"),a=o("boolean"),i=e=>!(e=>null==e)(e),l=o("function"),c=o("number"),d=()=>{},m=e=>()=>e,u=(e,t)=>e===t;const g=e=>t=>!e(t),h=m(!1);class p{constructor(e,t){this.tag=e,this.value=t}static some(e){return new p(!0,e)}static none(){return p.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?p.some(e(this.value)):p.none()}bind(e){return this.tag?e(this.value):p.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:p.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return i(e)?p.some(e):p.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()"}}p.singletonNone=new p(!1);const f=Array.prototype.slice,v=Array.prototype.indexOf,b=Array.prototype.push,y=(e,t)=>{return o=e,n=t,v.call(o,n)>-1;var o,n},w=(e,t)=>{for(let o=0,n=e.length;o{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[];for(let n=0,r=e.length;n(C(e,((e,n)=>{o=t(o,e,n)})),o),_=(e,t,o)=>{for(let n=0,r=e.length;n_(e,t,h),T=(e,t)=>(e=>{const t=[];for(let o=0,n=e.length;o{const t=f.call(e,0);return t.reverse(),t},D=(e,t)=>t>=0&&tD(e,0),M=e=>D(e,e.length-1),N=(e,t)=>{const o=[],n=l(t)?e=>w(o,(o=>t(o,e))):e=>y(o,e);for(let t=0,r=e.length;te.exists((e=>o(e,t))),B=(e,t,o)=>e.isSome()&&t.isSome()?p.some(o(e.getOrDie(),t.getOrDie())):p.none(),L=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},H={fromHtml:(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 L(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return L(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return L(o)},fromDom:L,fromPoint:(e,t,o)=>p.from(e.dom.elementFromPoint(t,o)).map(L)},I=(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")}},P=(e,t)=>e.dom===t.dom,F=I,z="undefined"!=typeof window?window:Function("return this;")(),V=(e,t)=>((e,t)=>{let o=null!=t?t:z;for(let t=0;t{const o=((e,t)=>V(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o},U=Object.getPrototypeOf,j=e=>{const t=V("ownerDocument.defaultView",e);return r(e)&&((e=>Z("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(U(e).constructor.name))},W=e=>e.dom.nodeName.toLowerCase(),$=e=>e.dom.nodeType,q=e=>t=>$(t)===e,G=e=>K(e)&&j(e.dom),K=q(1),Y=q(3),X=q(9),J=q(11),Q=e=>t=>K(t)&&W(t)===e,ee=e=>p.from(e.dom.parentNode).map(H.fromDom),te=e=>x(e.dom.childNodes,H.fromDom),oe=(e,t)=>{const o=e.dom.childNodes;return p.from(o[t]).map(H.fromDom)},ne=e=>oe(e,0),re=e=>oe(e,e.dom.childNodes.length-1),se=l(Element.prototype.attachShadow)&&l(Node.prototype.getRootNode)?e=>H.fromDom(e.dom.getRootNode()):e=>{return X(e)?e:(t=e,H.fromDom(t.dom.ownerDocument));var t},ae=e=>{const t=se(e);return J(o=t)&&i(o.dom.host)?p.some(t):p.none();var o},ie=e=>H.fromDom(e.dom.host),le=e=>{const t=Y(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ae(H.fromDom(t)).fold((()=>o.body.contains(t)),(n=le,r=ie,e=>n(r(e))));var n,r};var ce=(e,t,o,n,r)=>e(o,n)?p.some(o):l(r)&&r(o)?p.none():t(o,n,r);const de=(e,t,o)=>{let n=e.dom;const r=l(o)?o:h;for(;n.parentNode;){n=n.parentNode;const e=H.fromDom(n);if(t(e))return p.some(e);if(r(e))break}return p.none()},me=(e,t,o)=>ce(((e,t)=>t(e)),de,e,t,o),ue=(e,t,o)=>de(e,(e=>I(e,t)),o),ge=e=>{return ce(((e,t)=>I(e,t)),ue,e,"[contenteditable]",t);var t},he=e=>e.dom.contentEditable,pe=(e,t)=>{ee(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},fe=(e,t)=>{const o=(e=>p.from(e.dom.nextSibling).map(H.fromDom))(e);o.fold((()=>{ee(e).each((e=>{ve(e,t)}))}),(e=>{pe(e,t)}))},ve=(e,t)=>{e.dom.appendChild(t.dom)},be=(e,t)=>{C(t,(t=>{ve(e,t)}))},ye=e=>{e.dom.textContent="",C(te(e),(e=>{we(e)}))},we=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)};var xe=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Ce=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Se=tinymce.util.Tools.resolve("tinymce.util.VK");const ke=e=>x(e,H.fromDom),_e=Object.keys,Ee=(e,t)=>{const o=_e(e);for(let n=0,r=o.length;n{const o={};var n;return((e,t,o,n)=>{Ee(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))})(e,t,(n=o,(e,t)=>{n[t]=e}),d),o},Oe=(e,t)=>{const o=e.dom;Ee(t,((e,t)=>{((e,t,o)=>{if(!(n(o)||a(o)||c(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+"")})(o,t,e)}))},De=e=>k(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Ae=e=>((e,t)=>H.fromDom(e.dom.cloneNode(t)))(e,!0),Me=(e,t)=>{const o=((e,t)=>{const o=H.fromTag(t),n=De(e);return Oe(o,n),o})(e,t);fe(e,o);const n=te(e);return be(o,n),we(e),o};var Ne=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Re=tinymce.util.Tools.resolve("tinymce.util.Tools");const Be=e=>t=>i(t)&&t.nodeName.toLowerCase()===e,Le=e=>t=>i(t)&&e.test(t.nodeName),He=e=>i(e)&&3===e.nodeType,Ie=e=>i(e)&&1===e.nodeType,Pe=Le(/^(OL|UL|DL)$/),Fe=Le(/^(OL|UL)$/),ze=Be("ol"),Ve=Le(/^(LI|DT|DD)$/),Ze=Le(/^(DT|DD)$/),Ue=Le(/^(TH|TD)$/),je=Be("br"),We=(e,t)=>i(t)&&t.nodeName in e.schema.getTextBlockElements(),$e=(e,t)=>i(e)&&e.nodeName in t,qe=(e,t)=>i(t)&&t.nodeName in e.schema.getVoidElements(),Ge=(e,t,o)=>{const n=e.isEmpty(t);return!(o&&e.select("span[data-mce-type=bookmark]",t).length>0)&&n},Ke=(e,t)=>e.isChildOf(t,e.getRoot()),Ye=e=>t=>t.options.get(e),Xe=Ye("lists_indent_on_tab"),Je=Ye("forced_root_block"),Qe=Ye("forced_root_block_attrs"),et=(e,t)=>{const o=e.dom,n=e.schema.getBlockElements(),r=o.createFragment(),s=Je(e),a=Qe(e);let i,l,c=!1;for(l=o.create(s,a),$e(t.firstChild,n)||r.appendChild(l);i=t.firstChild;){const e=i.nodeName;c||"SPAN"===e&&"bookmark"===i.getAttribute("data-mce-type")||(c=!0),$e(i,n)?(r.appendChild(i),l=null):(l||(l=o.create(s,a),r.appendChild(l)),l.appendChild(i))}return!c&&l&&l.appendChild(o.create("br",{"data-mce-bogus":"1"})),r},tt=Ne.DOM,ot=(e,t,o)=>{const n=tt.select('span[data-mce-type="bookmark"]',t),r=et(e,o),s=tt.createRng();s.setStartAfter(o),s.setEndAfter(t);const a=s.extractContents();for(let t=a.firstChild;t;t=t.firstChild)if("LI"===t.nodeName&&e.dom.isEmpty(t)){tt.remove(t);break}e.dom.isEmpty(a)||tt.insertAfter(a,t),tt.insertAfter(r,t);const i=o.parentElement;i&&Ge(e.dom,i)&&(e=>{const t=e.parentNode;t&&Re.each(n,(e=>{t.insertBefore(e,o.parentNode)})),tt.remove(e)})(i),tt.remove(o),Ge(e.dom,t)&&tt.remove(t)},nt=Q("dd"),rt=Q("dt"),st=(e,t)=>{var o;nt(t)?Me(t,"dt"):rt(t)&&(o=t,p.from(o.dom.parentElement).map(H.fromDom)).each((o=>ot(e,o.dom,t.dom)))},at=e=>{rt(e)&&Me(e,"dd")},it=(e,t)=>{if(He(e))return{container:e,offset:t};const o=xe.getNode(e,t);return He(o)?{container:o,offset:t>=e.childNodes.length?o.data.length:0}:o.previousSibling&&He(o.previousSibling)?{container:o.previousSibling,offset:o.previousSibling.data.length}:o.nextSibling&&He(o.nextSibling)?{container:o.nextSibling,offset:0}:{container:e,offset:t}},lt=e=>{const t=e.cloneRange(),o=it(e.startContainer,e.startOffset);t.setStart(o.container,o.offset);const n=it(e.endContainer,e.endOffset);return t.setEnd(n.container,n.offset),t},ct=["OL","UL","DL"],dt=ct.join(","),mt=(e,t)=>{const o=t||e.selection.getStart(!0);return e.dom.getParent(o,dt,pt(e,o))},ut=e=>{const t=mt(e),o=e.selection.getSelectedBlocks();return((e,t)=>i(e)&&1===t.length&&t[0]===e)(t,o)?(e=>S(e.querySelectorAll(dt),Pe))(t):S(o,(e=>Pe(e)&&t!==e))},gt=e=>{const t=e.selection.getSelectedBlocks();return S(((e,t)=>{const o=Re.map(t,(t=>e.dom.getParent(t,"li,dd,dt",pt(e,t))||t));return N(o)})(e,t),Ve)},ht=(e,t)=>{const o=e.dom.getParents(t,"TD,TH");return o.length>0?o[0]:e.getBody()},pt=(e,t)=>{const o=e.dom.getParents(t,e.dom.isBlock),n=E(o,(t=>{return o=e.schema,!Pe(n=t)&&!Ve(n)&&w(ct,(e=>o.isValidChild(n.nodeName,e)));var o,n}));return n.getOr(e.getBody())},ft=(e,t)=>{const o=e.dom.getParents(t,"ol,ul",pt(e,t));return M(o)},vt=e=>{const t=(e=>{const t=ft(e,e.selection.getStart()),o=S(e.selection.getSelectedBlocks(),Fe);return t.toArray().concat(o)})(e),o=(e=>{const t=e.selection.getStart();return e.dom.getParents(t,"ol,ul",pt(e,t))})(e);return E(o,(e=>{return t=H.fromDom(e),ee(t).exists((e=>Ve(e.dom)&&ne(e).exists((e=>!Pe(e.dom)))&&re(e).exists((e=>!Pe(e.dom)))));var t})).fold((()=>bt(e,t)),(e=>[e]))},bt=(e,t)=>{const o=x(t,(t=>ft(e,t).getOr(t)));return N(o)},yt=e=>/\btox\-/.test(e.className),wt=(e,t)=>_(e,Pe,Ue).exists((e=>e.nodeName===t&&!yt(e))),xt=(e,t)=>null!==t&&!e.dom.isEditable(t),Ct=(e,t)=>{const o=e.dom.getParent(t,"ol,ul,dl");return xt(e,o)},St=(e,t)=>{const o=e.selection.getNode();return t({parents:e.dom.getParents(o),element:o}),e.on("NodeChange",t),()=>e.off("NodeChange",t)},kt=(e,t)=>{const o=(t||document).createDocumentFragment();return C(e,(e=>{o.appendChild(e.dom)})),H.fromDom(o)},_t=(e,t,o)=>e.dispatch("ListMutation",{action:t,element:o}),Et=(Tt=/^\s+|\s+$/g,e=>e.replace(Tt,""));var Tt;const Ot=(e,t,o)=>{if(!n(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);(e=>void 0!==e.style&&l(e.style.getPropertyValue))(e)&&e.style.setProperty(t,o)},Dt=(e,t,o)=>{const n=e.dom;Ot(n,t,o)},At=e=>F(e,"OL,UL"),Mt=e=>ne(e).exists(At),Nt=e=>"listAttributes"in e,Rt=e=>"isComment"in e,Bt=e=>e.depth>0,Lt=e=>e.isSelected,Ht=e=>{const t=te(e),o=re(e).exists(At)?t.slice(0,-1):t;return x(o,Ae)},It=(e,t)=>{ve(e.item,t.list)},Pt=(e,t)=>{const o={list:H.fromTag(t,e),item:H.fromTag("li",e)};return ve(o.list,o.item),o},Ft=(e,t,o)=>{const n=t.slice(0,o.depth);return M(n).each((t=>{if(Nt(o)){const n=((e,t,o)=>{const n=H.fromTag("li",e);return Oe(n,t),be(n,o),n})(e,o.itemAttributes,o.content);((e,t)=>{ve(e.list,t),e.item=t})(t,n),((e,t)=>{W(e.list)!==t.listType&&(e.list=Me(e.list,t.listType)),Oe(e.list,t.listAttributes)})(t,o)}else if((e=>"isFragment"in e)(o))be(t.item,o.content);else{const e=H.fromHtml(`\x3c!--${o.content}--\x3e`);ve(t.list,e)}})),n},zt=(e,t,o)=>{const n=((e,t,o)=>{const n=[];for(let r=0;r{for(let t=1;t{for(let t=0;t{Nt(t)&&(Oe(e.list,t.listAttributes),Oe(e.item,t.itemAttributes)),be(e.item,t.content)}))})(n,o),r=n,B(M(t),A(r),It),t.concat(n)},Vt=(e,t)=>{let o=p.none();const n=k(t,((t,n,r)=>Rt(n)?0===r?(o=p.some(n),t):Ft(e,t,n):n.depth>t.length?zt(e,t,n):Ft(e,t,n)),[]);return o.each((e=>{const t=H.fromHtml(`\x3c!--${e.content}--\x3e`);A(n).each((e=>{((e,t)=>{ne(e).fold((()=>{ve(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))})(e.list,t)}))})),A(n).map((e=>e.list))},Zt=e=>(C(e,((t,o)=>{((e,t)=>{const o=e[t].depth,n=e=>e.depth===o&&!e.dirty,r=e=>e.depth_(e.slice(t+1),n,r)))})(e,o).fold((()=>{t.dirty&&Nt(t)&&(e=>{e.listAttributes=Te(e.listAttributes,((e,t)=>"start"!==t))})(t)}),(e=>{return n=e,void(Nt(o=t)&&Nt(n)&&(o.listType=n.listType,o.listAttributes={...n.listAttributes}));var o,n}))})),e),Ut=(e,t,o,n)=>{var r,s;if(8===$(s=n)||"#comment"===W(s))return[{depth:e+1,content:null!==(r=n.dom.nodeValue)&&void 0!==r?r:"",dirty:!1,isSelected:!1,isComment:!0}];t.each((e=>{P(e.start,n)&&o.set(!0)}));const a=((e,t,o)=>ee(e).filter(K).map((n=>({depth:t,dirty:!1,isSelected:o,content:Ht(e),itemAttributes:De(e),listAttributes:De(n),listType:W(n),isInPreviousLi:!1}))))(n,e,o.get());t.each((e=>{P(e.end,n)&&o.set(!1)}));const i=re(n).filter(At).map((n=>Wt(e,t,o,n))).getOr([]);return a.toArray().concat(i)},jt=(e,t,o,n)=>ne(n).filter(At).fold((()=>Ut(e,t,o,n)),(r=>{const s=k(te(n),((n,s,a)=>{if(0===a)return n;if(F(s,"LI"))return n.concat(Ut(e,t,o,s));{const t={isFragment:!0,depth:e,content:[s],isSelected:!1,dirty:!1,parentListType:W(r)};return n.concat(t)}}),[]);return Wt(e,t,o,r).concat(s)})),Wt=(e,t,o,n)=>T(te(n),(n=>(At(n)?Wt:jt)(e+1,t,o,n))),$t=(e,t)=>T(((e,t)=>{if(0===e.length)return[];{let o=t(e[0]);const n=[];let r=[];for(let s=0,a=e.length;sA(t).exists(Bt)?((e,t)=>{const o=Zt(t);return Vt(e.contentDocument,o).toArray()})(e,t):((e,t)=>{const o=Zt(t);return x(o,(t=>{const o=Rt(t)?kt([H.fromHtml(`\x3c!--${t.content}--\x3e`)]):kt(t.content);return H.fromDom(et(e,o.dom))}))})(e,t))),qt=(e,t,o)=>{const n=((e,t)=>{const o=(e=>{let t=!1;return{get:()=>t,set:e=>{t=e}}})();return x(e,(e=>({sourceList:e,entries:Wt(0,t,o,e)})))})(t,(e=>{const t=x(gt(e),H.fromDom);return B(E(t,g(Mt)),E(O(t),g(Mt)),((e,t)=>({start:e,end:t})))})(e));C(n,(t=>{((e,t)=>{C(S(e,Lt),(e=>((e,t)=>{switch(e){case"Indent":t.depth++;break;case"Outdent":t.depth--;break;case"Flatten":t.depth=0}t.dirty=!0})(t,e)))})(t.entries,o);const n=$t(e,t.entries);var r;C(n,(t=>{_t(e,"Indent"===o?"IndentList":"OutdentList",t.dom)})),r=t.sourceList,C(n,(e=>{pe(r,e)})),we(t.sourceList)}))},Gt=(e,t)=>{const o=ke(vt(e)),n=ke((e=>S(gt(e),Ze))(e));let r=!1;if(o.length||n.length){const s=e.selection.getBookmark();qt(e,o,t),((e,t,o)=>{C(o,"Indent"===t?at:t=>st(e,t))})(e,t,n),e.selection.moveToBookmark(s),e.selection.setRng(lt(e.selection.getRng())),e.nodeChanged(),r=!0}return r},Kt=(e,t)=>!(e=>{const t=mt(e);return xt(e,t)})(e)&&Gt(e,t),Yt=e=>Kt(e,"Indent"),Xt=e=>Kt(e,"Outdent"),Jt=e=>Kt(e,"Flatten"),Qt=e=>"\ufeff"===e,eo=(e,t)=>{return o=e,n=function(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}(P,t),de(o,n,r).isSome();var o,n,r};var to=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const oo=Ne.DOM,no=e=>{const t={},o=o=>{let n=e[o?"startContainer":"endContainer"],r=e[o?"startOffset":"endOffset"];if(Ie(n)){const e=oo.create("span",{"data-mce-type":"bookmark"});n.hasChildNodes()?(r=Math.min(r,n.childNodes.length-1),o?n.insertBefore(e,n.childNodes[r]):oo.insertAfter(e,n.childNodes[r])):n.appendChild(e),n=e,r=0}t[o?"startContainer":"endContainer"]=n,t[o?"startOffset":"endOffset"]=r};return o(!0),e.collapsed||o(),t},ro=e=>{const t=t=>{let o=e[t?"startContainer":"endContainer"],n=e[t?"startOffset":"endOffset"];if(o){if(Ie(o)&&o.parentNode){const e=o;n=(e=>{var t;let o=null===(t=e.parentNode)||void 0===t?void 0:t.firstChild,n=0;for(;o;){if(o===e)return n;Ie(o)&&"bookmark"===o.getAttribute("data-mce-type")||n++,o=o.nextSibling}return-1})(o),o=o.parentNode,oo.remove(e),!o.hasChildNodes()&&oo.isBlock(o)&&o.appendChild(oo.create("br"))}e[t?"startContainer":"endContainer"]=o,e[t?"startOffset":"endOffset"]=n}};t(!0),t();const o=oo.createRng();return o.setStart(e.startContainer,e.startOffset),e.endContainer&&o.setEnd(e.endContainer,e.endOffset),lt(o)},so=e=>{switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},ao=(e,t)=>{Re.each(t,((t,o)=>{e.setAttribute(o,t)}))},io=(e,t,o)=>{((e,t,o)=>{const n=o["list-style-type"]?o["list-style-type"]:null;e.setStyle(t,"list-style-type",n)})(e,t,o),((e,t,o)=>{ao(t,o["list-attributes"]),Re.each(e.select("li",t),(e=>{ao(e,o["list-item-attributes"])}))})(e,t,o)},lo=(e,t)=>i(t)&&!$e(t,e.schema.getBlockElements()),co=(e,t,o,n)=>{let r=t[o?"startContainer":"endContainer"];const s=t[o?"startOffset":"endOffset"];Ie(r)&&(r=r.childNodes[Math.min(s,r.childNodes.length-1)]||r),!o&&je(r.nextSibling)&&(r=r.nextSibling);const a=(t,o)=>{var r;const s=new Ce(t,(t=>{for(;!e.dom.isBlock(t)&&t.parentNode&&n!==t;)t=t.parentNode;return t})(t)),a=o?"next":"prev";let i;for(;i=s[a]();)if(!qe(e,i)&&!Qt(i.textContent)&&0!==(null===(r=i.textContent)||void 0===r?void 0:r.length))return p.some(i);return p.none()};if(o&&He(r))if(Qt(r.textContent))r=a(r,!1).getOr(r);else for(null!==r.parentNode&&lo(e,r.parentNode)&&(r=r.parentNode);null!==r.previousSibling&&(lo(e,r.previousSibling)||He(r.previousSibling));)r=r.previousSibling;if(!o&&He(r))if(Qt(r.textContent))r=a(r,!0).getOr(r);else for(null!==r.parentNode&&lo(e,r.parentNode)&&(r=r.parentNode);null!==r.nextSibling&&(lo(e,r.nextSibling)||He(r.nextSibling));)r=r.nextSibling;for(;r.parentNode!==n;){const t=r.parentNode;if(We(e,r))return r;if(/^(TD|TH)$/.test(t.nodeName))return r;r=t}return r},mo=(e,t,o)=>{const n=e.selection.getRng();let r="LI";const s=pt(e,((e,t)=>{const o=e.selection.getStart(!0),n=co(e,t,!0,e.getBody());return eo(H.fromDom(n),H.fromDom(t.commonAncestorContainer))?t.commonAncestorContainer:o})(e,n)),a=e.dom;if("false"===a.getContentEditable(e.selection.getNode()))return;"DL"===(t=t.toUpperCase())&&(r="DT");const i=no(n),l=S(((e,t,o)=>{const n=[],r=e.dom,s=co(e,t,!0,o),a=co(e,t,!1,o);let i;const l=[];for(let e=s;e&&(l.push(e),e!==a);e=e.nextSibling);return Re.each(l,(t=>{var s;if(We(e,t))return n.push(t),void(i=null);if(r.isBlock(t)||je(t))return je(t)&&r.remove(t),void(i=null);const a=t.nextSibling;to.isBookmarkNode(t)&&(Pe(a)||We(e,a)||!a&&t.parentNode===o)?i=null:(i||(i=r.create("p"),null===(s=t.parentNode)||void 0===s||s.insertBefore(i,t),n.push(i)),i.appendChild(t))})),n})(e,n,s),e.dom.isEditable);Re.each(l,(n=>{let s;const i=n.previousSibling,l=n.parentNode;Ve(l)||(i&&Pe(i)&&i.nodeName===t&&((e,t,o)=>{const n=e.getStyle(t,"list-style-type");let r=o?o["list-style-type"]:"";return r=null===r?"":r,n===r})(a,i,o)?(s=i,n=a.rename(n,r),i.appendChild(n)):(s=a.create(t),l.insertBefore(s,n),s.appendChild(n),n=a.rename(n,r)),((e,t,o)=>{Re.each(o,(o=>e.setStyle(t,o,"")))})(a,n,["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"]),io(a,s,o),go(e.dom,s))})),e.selection.setRng(ro(i))},uo=(e,t,o)=>{return((e,t)=>Pe(e)&&e.nodeName===(null==t?void 0:t.nodeName))(t,o)&&((e,t,o)=>e.getStyle(t,"list-style-type",!0)===e.getStyle(o,"list-style-type",!0))(e,t,o)&&(n=o,t.className===n.className);var n},go=(e,t)=>{let o,n=t.nextSibling;if(uo(e,t,n)){const r=n;for(;o=r.firstChild;)t.appendChild(o);e.remove(r)}if(n=t.previousSibling,uo(e,t,n)){const r=n;for(;o=r.lastChild;)t.insertBefore(o,t.firstChild);e.remove(r)}},ho=(e,t,o,n)=>{if(t.nodeName!==o){const r=e.dom.rename(t,o);io(e.dom,r,n),_t(e,so(o),r)}else io(e.dom,t,n),_t(e,so(o),t)},po=(e,t,o,n)=>{if(t.classList.forEach(((e,o,n)=>{e.startsWith("tox-")&&(n.remove(e),0===n.length&&t.removeAttribute("class"))})),t.nodeName!==o){const r=e.dom.rename(t,o);io(e.dom,r,n),_t(e,so(o),r)}else io(e.dom,t,n),_t(e,so(o),t)},fo=e=>"list-style-type"in e,vo=(e,t,o)=>{const n=mt(e);if(Ct(e,n))return;const s=ut(e),a=r(o)?o:{};s.length>0?((e,t,o,n,r)=>{const s=Pe(t);if(!s||t.nodeName!==n||fo(r)||yt(t)){mo(e,n,r);const a=no(e.selection.getRng()),i=s?[t,...o]:o,l=s&&yt(t)?po:ho;Re.each(i,(t=>{l(e,t,n,r)})),e.selection.setRng(ro(a))}else Jt(e)})(e,n,s,t,a):((e,t,o,n)=>{if(t!==e.getBody())if(t)if(t.nodeName!==o||fo(n)||yt(t)){const r=no(e.selection.getRng());yt(t)&&t.classList.forEach(((e,o,n)=>{e.startsWith("tox-")&&(n.remove(e),0===n.length&&t.removeAttribute("class"))})),io(e.dom,t,n);const s=e.dom.rename(t,o);go(e.dom,s),e.selection.setRng(ro(r)),mo(e,o,n),_t(e,so(o),s)}else Jt(e);else mo(e,o,n),_t(e,so(o),t)})(e,n,t,a)},bo=Ne.DOM,yo=(e,t)=>{const o=Re.grep(e.select("ol,ul",t));Re.each(o,(t=>{((e,t)=>{const o=t.parentElement;if(o&&"LI"===o.nodeName&&o.firstChild===t){const n=o.previousSibling;n&&"LI"===n.nodeName?(n.appendChild(t),Ge(e,o)&&bo.remove(o)):bo.setStyle(o,"listStyleType","none")}if(Pe(o)){const e=o.previousSibling;e&&"LI"===e.nodeName&&e.appendChild(t)}})(e,t)}))},wo=(e,t,o,n)=>{let r=t.startContainer;const s=t.startOffset;if(He(r)&&(o?s0))return r;const a=e.schema.getNonEmptyElements();Ie(r)&&(r=xe.getNode(r,s));const i=new Ce(r,n);o&&((e,t)=>!!je(t)&&e.isBlock(t.nextSibling)&&!je(t.previousSibling))(e.dom,r)&&i.next();const l=o?i.next.bind(i):i.prev2.bind(i);for(;r=l();){if("LI"===r.nodeName&&!r.hasChildNodes())return r;if(a[r.nodeName])return r;if(He(r)&&r.data.length>0)return r}return null},xo=(e,t)=>{const o=t.childNodes;return 1===o.length&&!Pe(o[0])&&e.isBlock(o[0])},Co=e=>p.from(e).map(H.fromDom).filter(G).exists((e=>((e,t=!1)=>le(e)?e.dom.isContentEditable:ge(e).fold(m(t),(e=>"true"===he(e))))(e)&&!y(["details"],W(e)))),So=(e,t,o)=>{let n;const r=xo(e,o)?o.firstChild:o;if(((e,t)=>{xo(e,t)&&Co(t.firstChild)&&e.remove(t.firstChild,!0)})(e,t),!Ge(e,t,!0))for(;n=t.firstChild;)r.appendChild(n)},ko=(e,t,o)=>{let n;const r=t.parentNode;if(!Ke(e,t)||!Ke(e,o))return;Pe(o.lastChild)&&(n=o.lastChild),r===o.lastChild&&je(r.previousSibling)&&e.remove(r.previousSibling);const s=o.lastChild;s&&je(s)&&t.hasChildNodes()&&e.remove(s),Ge(e,o,!0)&&ye(H.fromDom(o)),So(e,t,o),n&&o.appendChild(n);const a=((e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)})(H.fromDom(o),H.fromDom(t))?e.getParents(t,Pe,o):[];e.remove(t),C(a,(t=>{Ge(e,t)&&t!==e.getRoot()&&e.remove(t)}))},_o=(e,t,o,n)=>{const r=e.dom;if(r.isEmpty(n))((e,t,o)=>{ye(H.fromDom(o)),ko(e.dom,t,o),e.selection.setCursorLocation(o,0)})(e,o,n);else{const s=no(t);ko(r,o,n),e.selection.setRng(ro(s))}},Eo=(e,t)=>{const o=e.dom,n=e.selection,r=n.getStart(),s=ht(e,r),a=o.getParent(n.getStart(),"LI",s);if(a){const r=a.parentElement;if(r===e.getBody()&&Ge(o,r))return!0;const i=lt(n.getRng()),l=o.getParent(wo(e,i,t,s),"LI",s),c=l&&(t?o.isChildOf(a,l):o.isChildOf(l,a));if(l&&l!==a&&!c)return e.undoManager.transact((()=>{var o,n;t?_o(e,i,l,a):(null===(n=(o=a).parentNode)||void 0===n?void 0:n.firstChild)===o?Xt(e):((e,t,o,n)=>{const r=no(t);ko(e.dom,o,n);const s=ro(r);e.selection.setRng(s)})(e,i,a,l)})),!0;if(c&&!t&&l!==a)return e.undoManager.transact((()=>{if(i.commonAncestorContainer.parentElement){const t=no(i),n=i.commonAncestorContainer.parentElement;So(o,i.commonAncestorContainer.parentElement,l),n.remove();const r=ro(t);e.selection.setRng(r)}})),!0;if(!l&&!t&&0===i.startOffset&&0===i.endOffset)return e.undoManager.transact((()=>{Jt(e)})),!0}return!1},To=(e,t)=>{const o=e.dom,n=e.selection.getStart(),r=ht(e,n),s=o.getParent(n,o.isBlock,r);if(s&&o.isEmpty(s,void 0,{checkRootAsContent:!0})){const n=lt(e.selection.getRng()),a=o.getParent(wo(e,n,t,r),"LI",r);if(a){const i=e=>y(["td","th","caption"],W(e)),l=e=>e.dom===r;return!!((e,t,o=u)=>B(e,t,o).getOr(e.isNone()&&t.isNone()))(me(H.fromDom(a),i,l),me(H.fromDom(n.startContainer),i,l),P)&&(e.undoManager.transact((()=>{const n=a.parentNode;((e,t,o)=>{const n=e.getParent(t.parentNode,e.isBlock,o);e.remove(t),n&&e.isEmpty(n)&&e.remove(n)})(o,s,r),go(o,n),e.selection.select(a,!0),e.selection.collapse(t)})),!0)}}return!1},Oo=e=>{const t=e.selection.getStart(),o=ht(e,t);return e.dom.getParent(t,"LI,DT,DD",o)||gt(e).length>0},Do=(e,t)=>{const o=e.selection;return!Ct(e,o.getNode())&&(o.isCollapsed()?((e,t)=>Eo(e,t)||To(e,t))(e,t):(e=>!!Oo(e)&&(e.undoManager.transact((()=>{e.execCommand("Delete"),yo(e.dom,e.getBody())})),!0))(e))},Ao=e=>{const t=O(Et(e).split("")),o=x(t,((e,t)=>{const o=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,t)*o}));return k(o,((e,t)=>e+t),0)},Mo=e=>{if(--e<0)return"";{const t=e%26,o=Math.floor(e/26);return Mo(o)+String.fromCharCode("A".charCodeAt(0)+t)}},No=e=>{const t=parseInt(e.start,10);return R(e.listStyleType,"upper-alpha")?Mo(t):R(e.listStyleType,"lower-alpha")?Mo(t).toLowerCase():e.start},Ro=e=>{const t=mt(e);ze(t)&&!Ct(e,t)&&e.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:No({start:e.dom.getAttrib(t,"start","1"),listStyleType:p.from(e.dom.getStyle(t,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{(e=>{switch((e=>/^[0-9]+$/.test(e)?2:/^[A-Z]+$/.test(e)?0:(e=>/^[a-z]+$/.test(e))(e)?1:e.length>0?4:3)(e)){case 2:return p.some({listStyleType:p.none(),start:e});case 0:return p.some({listStyleType:p.some("upper-alpha"),start:Ao(e).toString()});case 1:return p.some({listStyleType:p.some("lower-alpha"),start:Ao(e).toString()});case 3:return p.some({listStyleType:p.none(),start:""});case 4:return p.none()}})(t.getData().start).each((t=>{e.execCommand("mceListUpdate",!1,{attrs:{start:"1"===t.start?"":t.start},styles:{"list-style-type":t.listStyleType.getOr("")}})})),t.close()}})},Bo=(e,t)=>()=>{const o=mt(e);return i(o)&&o.nodeName===t},Lo=e=>{e.addCommand("mceListProps",(()=>{Ro(e)}))},Ho=e=>{e.on("BeforeExecCommand",(t=>{const o=t.command.toLowerCase();"indent"===o?Yt(e):"outdent"===o&&Xt(e)})),e.addCommand("InsertUnorderedList",((t,o)=>{vo(e,"UL",o)})),e.addCommand("InsertOrderedList",((t,o)=>{vo(e,"OL",o)})),e.addCommand("InsertDefinitionList",((t,o)=>{vo(e,"DL",o)})),e.addCommand("RemoveList",(()=>{Jt(e)})),Lo(e),e.addCommand("mceListUpdate",((t,o)=>{r(o)&&((e,t)=>{const o=mt(e);null===o||Ct(e,o)||e.undoManager.transact((()=>{r(t.styles)&&e.dom.setStyles(o,t.styles),r(t.attrs)&&Ee(t.attrs,((t,n)=>e.dom.setAttrib(o,n,t)))}))})(e,o)})),e.addQueryStateHandler("InsertUnorderedList",Bo(e,"UL")),e.addQueryStateHandler("InsertOrderedList",Bo(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",Bo(e,"DL"))};var Io=tinymce.util.Tools.resolve("tinymce.html.Node");const Po=e=>3===e.type,Fo=e=>0===e.length,zo=e=>{const t=(t,o)=>{const n=Io.create("li");C(t,(e=>n.append(e))),o?e.insert(n,o,!0):e.append(n)},o=k(e.children(),((e,o)=>Po(o)?[...e,o]:Fo(e)||Po(o)?e:(t(e,o),[])),[]);Fo(o)||t(o)},Vo=e=>{Xe(e)&&(e=>{e.on("keydown",(t=>{t.keyCode!==Se.TAB||Se.metaKeyPressed(t)||e.undoManager.transact((()=>{(t.shiftKey?Xt(e):Yt(e))&&t.preventDefault()}))}))})(e),(e=>{e.on("ExecCommand",(t=>{const o=t.command.toLowerCase();"delete"!==o&&"forwarddelete"!==o||!Oo(e)||yo(e.dom,e.getBody())})),e.on("keydown",(t=>{t.keyCode===Se.BACKSPACE?Do(e,!1)&&t.preventDefault():t.keyCode===Se.DELETE&&Do(e,!0)&&t.preventDefault()}))})(e)},Zo=(e,t)=>o=>(o.setEnabled(e.selection.isEditable()),St(e,(n=>{o.setActive(wt(n.parents,t)),o.setEnabled(!Ct(e,n.element)&&e.selection.isEditable())}))),Uo=(e,t)=>o=>St(e,(n=>o.setEnabled(wt(n.parents,t)&&!Ct(e,n.element))));e.add("lists",(e=>((e=>{(0,e.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(e),(e=>{e.on("PreInit",(()=>{const{parser:t}=e;t.addNodeFilter("ul,ol",(e=>C(e,zo)))}))})(e),e.hasPlugin("rtc",!0)?Lo(e):(Vo(e),Ho(e)),(e=>{const t=t=>()=>e.execCommand(t);e.hasPlugin("advlist")||(e.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:t("InsertOrderedList"),onSetup:Zo(e,"OL")}),e.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:t("InsertUnorderedList"),onSetup:Zo(e,"UL")}))})(e),(e=>{const t={text:"List properties...",icon:"ordered-list",onAction:()=>e.execCommand("mceListProps"),onSetup:Uo(e,"OL")};e.ui.registry.addMenuItem("listprops",t),e.ui.registry.addContextMenu("lists",{update:t=>{const o=mt(e,t);return ze(o)?["listprops"]:[]}})})(e),(e=>({backspaceDelete:t=>{Do(e,t)}}))(e))))}();export{n as default}; diff --git a/yarn.lock b/yarn.lock index 61d55653d8..7fb2dfd088 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4030,10 +4030,10 @@ tiny-emitter@^2.0.0: resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== -tinymce@^6.8.3: - version "6.8.3" - resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.8.3.tgz#0025a4aaa4c24dc2a3e32e83dfda705d196fd802" - integrity sha512-3fCHKAeqT+xNwBVESf6iDbDV0VNwZNmfrkx9c/6Gz5iB8piMfaO6s7FvoiTrj1hf1gVbfyLTnz1DooI6DhgINQ== +tinymce@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-7.0.0.tgz#d35441e15f8011cf549b39e58b64648798816e92" + integrity sha512-ggXLfTRrUALAcjeJSRrZcJDOl6MgC2tPXe/zNOEkQXvTDgcKqFypPRoPpfpK5wejexjyaI/7dwETOntJ5MPBFg== tmpl@1.0.5: version "1.0.5"