@lotte-innovate/ui-component-test 0.2.7 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +53 -0
- package/dist/lib/components/Editor/index.d.ts +1 -1
- package/dist/lib/components/Editor/index.js +1 -1
- package/dist/lib/components/Editor/index.mjs +1 -1
- package/dist/lib/constants.d.ts +0 -647
- package/dist/lib/constants.js +0 -895
- package/dist/lib/constants.mjs.map +1 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/tailwind.config.js +0 -42
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -11
- package/post-tinymce.js +18 -0
- package/dist/lib/color/alpha.d.ts +0 -784
- package/dist/lib/color/alpha.js +0 -784
- package/dist/lib/color/constants.d.ts +0 -15
- package/dist/lib/color/constants.js +0 -265
- package/dist/lib/color/dark.d.ts +0 -392
- package/dist/lib/color/dark.js +0 -392
- package/dist/lib/color/krdsColors.d.ts +0 -309
- package/dist/lib/color/krdsColors.js +0 -309
- package/dist/lib/color/light.d.ts +0 -392
- package/dist/lib/color/light.js +0 -393
- package/dist/lib/theme/ThemeProvider.d.ts +0 -16
- package/dist/lib/theme/ThemeProvider.js +0 -29
- package/dist/lib/theme/ThemeProvider.mjs +0 -3
- package/dist/lib/theme/ThemeProvider.mjs.map +0 -1
- package/dist/lib/theme/index.d.ts +0 -2
- package/dist/lib/theme/index.js +0 -2
- package/dist/lib/types.d.ts +0 -90
- package/dist/lib/types.js +0 -1
- package/public/tinymce/CHANGELOG.md +0 -3453
- package/public/tinymce/README.md +0 -73
- package/public/tinymce/bower.json +0 -27
- package/public/tinymce/composer.json +0 -52
- package/public/tinymce/icons/default/icons.js +0 -194
- package/public/tinymce/icons/default/icons.min.js +0 -1
- package/public/tinymce/icons/default/icons.mjs +0 -2
- package/public/tinymce/icons/default/icons.mjs.map +0 -1
- package/public/tinymce/icons/default/index.d.ts +0 -1
- package/public/tinymce/icons/default/index.js +0 -7
- package/public/tinymce/icons/default/index.mjs +0 -2
- package/public/tinymce/icons/default/index.mjs.map +0 -1
- package/public/tinymce/license.txt +0 -21
- package/public/tinymce/models/dom/index.d.ts +0 -1
- package/public/tinymce/models/dom/index.js +0 -7
- package/public/tinymce/models/dom/index.mjs +0 -2
- package/public/tinymce/models/dom/index.mjs.map +0 -1
- package/public/tinymce/models/dom/model.js +0 -8040
- package/public/tinymce/models/dom/model.min.js +0 -4
- package/public/tinymce/models/dom/model.mjs +0 -2
- package/public/tinymce/models/dom/model.mjs.map +0 -1
- package/public/tinymce/package.json +0 -32
- package/public/tinymce/plugins/advlist/index.d.ts +0 -1
- package/public/tinymce/plugins/advlist/index.js +0 -7
- package/public/tinymce/plugins/advlist/index.mjs +0 -2
- package/public/tinymce/plugins/advlist/index.mjs.map +0 -1
- package/public/tinymce/plugins/advlist/plugin.js +0 -259
- package/public/tinymce/plugins/advlist/plugin.min.js +0 -4
- package/public/tinymce/plugins/advlist/plugin.mjs +0 -2
- package/public/tinymce/plugins/advlist/plugin.mjs.map +0 -1
- package/public/tinymce/plugins/autolink/index.js +0 -7
- package/public/tinymce/plugins/autolink/plugin.js +0 -228
- package/public/tinymce/plugins/autolink/plugin.min.js +0 -4
- package/public/tinymce/plugins/code/index.d.ts +0 -1
- package/public/tinymce/plugins/code/index.js +0 -7
- package/public/tinymce/plugins/code/index.mjs +0 -2
- package/public/tinymce/plugins/code/index.mjs.map +0 -1
- package/public/tinymce/plugins/code/plugin.js +0 -85
- package/public/tinymce/plugins/code/plugin.min.js +0 -4
- package/public/tinymce/plugins/code/plugin.mjs +0 -2
- package/public/tinymce/plugins/code/plugin.mjs.map +0 -1
- package/public/tinymce/plugins/codesample/index.d.ts +0 -1
- package/public/tinymce/plugins/codesample/index.js +0 -7
- package/public/tinymce/plugins/codesample/index.mjs +0 -2
- package/public/tinymce/plugins/codesample/index.mjs.map +0 -1
- package/public/tinymce/plugins/codesample/plugin.d.ts +0 -45
- package/public/tinymce/plugins/codesample/plugin.js +0 -2463
- package/public/tinymce/plugins/codesample/plugin.min.js +0 -4
- package/public/tinymce/plugins/codesample/plugin.mjs +0 -2
- package/public/tinymce/plugins/codesample/plugin.mjs.map +0 -1
- package/public/tinymce/plugins/image/index.d.ts +0 -1
- package/public/tinymce/plugins/image/index.js +0 -7
- package/public/tinymce/plugins/image/index.mjs +0 -2
- package/public/tinymce/plugins/image/index.mjs.map +0 -1
- package/public/tinymce/plugins/image/plugin.js +0 -1505
- package/public/tinymce/plugins/image/plugin.min.js +0 -4
- package/public/tinymce/plugins/image/plugin.mjs +0 -2
- package/public/tinymce/plugins/image/plugin.mjs.map +0 -1
- package/public/tinymce/plugins/link/index.d.ts +0 -1
- package/public/tinymce/plugins/link/index.js +0 -7
- package/public/tinymce/plugins/link/index.mjs +0 -2
- package/public/tinymce/plugins/link/index.mjs.map +0 -1
- package/public/tinymce/plugins/link/plugin.js +0 -1242
- package/public/tinymce/plugins/link/plugin.min.js +0 -4
- package/public/tinymce/plugins/link/plugin.mjs +0 -2
- package/public/tinymce/plugins/link/plugin.mjs.map +0 -1
- package/public/tinymce/plugins/lists/index.d.ts +0 -1
- package/public/tinymce/plugins/lists/index.js +0 -7
- package/public/tinymce/plugins/lists/index.mjs +0 -2
- package/public/tinymce/plugins/lists/index.mjs.map +0 -1
- package/public/tinymce/plugins/lists/plugin.js +0 -2172
- package/public/tinymce/plugins/lists/plugin.min.js +0 -4
- package/public/tinymce/plugins/lists/plugin.mjs +0 -2
- package/public/tinymce/plugins/lists/plugin.mjs.map +0 -1
- package/public/tinymce/plugins/table/index.d.ts +0 -1
- package/public/tinymce/plugins/table/index.js +0 -7
- package/public/tinymce/plugins/table/index.mjs +0 -2
- package/public/tinymce/plugins/table/index.mjs.map +0 -1
- package/public/tinymce/plugins/table/plugin.js +0 -3462
- package/public/tinymce/plugins/table/plugin.min.js +0 -4
- package/public/tinymce/plugins/table/plugin.mjs +0 -2
- package/public/tinymce/plugins/table/plugin.mjs.map +0 -1
- package/public/tinymce/skins/content/default/content.css +0 -61
- package/public/tinymce/skins/content/default/content.js +0 -2
- package/public/tinymce/skins/content/default/content.min.css +0 -1
- package/public/tinymce/skins/content/default/content.mjs +0 -2
- package/public/tinymce/skins/content/default/content.mjs.map +0 -1
- package/public/tinymce/skins/ui/oxide/content.css +0 -785
- package/public/tinymce/skins/ui/oxide/content.inline.css +0 -779
- package/public/tinymce/skins/ui/oxide/content.inline.js +0 -2
- package/public/tinymce/skins/ui/oxide/content.inline.min.css +0 -1
- package/public/tinymce/skins/ui/oxide/content.js +0 -2
- package/public/tinymce/skins/ui/oxide/content.min.css +0 -1
- package/public/tinymce/skins/ui/oxide/content.mjs +0 -2
- package/public/tinymce/skins/ui/oxide/content.mjs.map +0 -1
- package/public/tinymce/skins/ui/oxide/skin.css +0 -3763
- package/public/tinymce/skins/ui/oxide/skin.js +0 -2
- package/public/tinymce/skins/ui/oxide/skin.min.css +0 -1
- package/public/tinymce/skins/ui/oxide/skin.mjs +0 -2
- package/public/tinymce/skins/ui/oxide/skin.mjs.map +0 -1
- package/public/tinymce/skins/ui/oxide/skin.shadowdom.css +0 -30
- package/public/tinymce/skins/ui/oxide/skin.shadowdom.js +0 -2
- package/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +0 -1
- package/public/tinymce/skins/ui/oxide-dark/content.css +0 -766
- package/public/tinymce/skins/ui/oxide-dark/content.inline.css +0 -779
- package/public/tinymce/skins/ui/oxide-dark/content.inline.js +0 -2
- package/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +0 -1
- package/public/tinymce/skins/ui/oxide-dark/content.js +0 -2
- package/public/tinymce/skins/ui/oxide-dark/content.min.css +0 -1
- package/public/tinymce/skins/ui/oxide-dark/skin.css +0 -3766
- package/public/tinymce/skins/ui/oxide-dark/skin.js +0 -2
- package/public/tinymce/skins/ui/oxide-dark/skin.min.css +0 -1
- package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +0 -30
- package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +0 -2
- package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +0 -1
- package/public/tinymce/themes/silver/index.d.ts +0 -1
- package/public/tinymce/themes/silver/index.js +0 -7
- package/public/tinymce/themes/silver/index.mjs +0 -2
- package/public/tinymce/themes/silver/index.mjs.map +0 -1
- package/public/tinymce/themes/silver/theme.js +0 -30775
- package/public/tinymce/themes/silver/theme.min.js +0 -384
- package/public/tinymce/themes/silver/theme.mjs +0 -2
- package/public/tinymce/themes/silver/theme.mjs.map +0 -1
- package/public/tinymce/tinymce.d.ts +0 -3238
- package/public/tinymce/tinymce.js +0 -31779
- package/public/tinymce/tinymce.min.js +0 -384
- package/public/tinymce/tinymce.mjs +0 -2
- package/public/tinymce/tinymce.mjs.map +0 -1
@@ -1,2 +0,0 @@
|
|
1
|
-
import{__module as e}from"../../_virtual/tinymce2.mjs";var t;function n(){return t||(t=1,n=e,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},t=function(e){return{eq:e}},o=t((function(e,t){return e===t})),r=function(e){return t((function(t,n){if(t.length!==n.length)return!1;for(var o=t.length,r=0;r<o;r++)if(!e.eq(t[r],n[r]))return!1;return!0}))},s=function(e,n){return function(e,n){return t((function(t,o){return e.eq(n(t),n(o))}))}(r(e),(function(e){return function(e,t){return Array.prototype.slice.call(e).sort(t)}(e,n)}))},a=function(e){return t((function(t,n){var r=Object.keys(t),a=Object.keys(n);if(!s(o).eq(r,a))return!1;for(var i=r.length,l=0;l<i;l++){var d=r[l];if(!e.eq(t[d],n[d]))return!1}return!0}))},i=t((function(t,n){if(t===n)return!0;var o=e(t);return o===e(n)&&(function(e){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(e)}(o)?t===n:"array"===o?r(i).eq(t,n):"object"===o&&a(i).eq(t,n))}));const l=Object.getPrototypeOf,d=(e,t,n)=>{var o;return!!n(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},c=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&d(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,m=e=>t=>typeof t===e,u=e=>t=>e===t,f=(e,t)=>p(e)&&d(e,t,((e,t)=>l(e)===t)),g=c("string"),p=c("object"),h=e=>f(e,Object),b=c("array"),v=u(null),y=m("boolean"),C=u(void 0),w=e=>null==e,x=e=>!w(e),E=m("function"),_=m("number"),k=(e,t)=>{if(b(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},S=()=>{},N=(e,t)=>(...n)=>e(t.apply(null,n)),R=(e,t)=>n=>e(t(n)),A=e=>()=>e,D=e=>e,T=(e,t)=>e===t;function O(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}const B=e=>t=>!e(t),P=e=>()=>{throw new Error(e)},L=e=>e(),M=e=>{e()},I=A(!1),F=A(!0);class U{constructor(e,t){this.tag=e,this.value=t}static some(e){return new U(!0,e)}static none(){return U.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?U.some(e(this.value)):U.none()}bind(e){return this.tag?e(this.value):U.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:U.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 x(e)?U.some(e):U.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()"}}U.singletonNone=new U(!1);const z=Array.prototype.slice,j=Array.prototype.indexOf,H=Array.prototype.push,$=(e,t)=>j.call(e,t),q=(e,t)=>$(e,t)>-1,V=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return!0;return!1},W=(e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o},K=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},Y=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)},G=(e,t)=>{const n=[],o=[];for(let r=0,s=e.length;r<s;r++){const s=e[r];(t(s,r)?n:o).push(s)}return{pass:n,fail:o}},X=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},Q=(e,t,n)=>(Y(e,((e,o)=>{n=t(n,e,o)})),n),J=(e,t,n)=>(K(e,((e,o)=>{n=t(n,e,o)})),n),Z=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return U.some(r);if(n(r,o))break}return U.none()},ee=(e,t)=>Z(e,t,I),te=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return U.some(n);return U.none()},ne=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!b(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);H.apply(t,e[n])}return t},oe=(e,t)=>ne(W(e,t)),re=(e,t)=>{for(let n=0,o=e.length;n<o;++n)if(!0!==t(e[n],n))return!1;return!0},se=e=>{const t=z.call(e,0);return t.reverse(),t},ae=(e,t)=>X(e,(e=>!q(t,e))),ie=(e,t)=>{const n={};for(let o=0,r=e.length;o<r;o++){const r=e[o];n[String(r)]=t(r,o)}return n},le=(e,t)=>{const n=z.call(e,0);return n.sort(t),n},de=(e,t)=>t>=0&&t<e.length?U.some(e[t]):U.none(),ce=e=>de(e,0),me=e=>de(e,e.length-1),ue=E(Array.from)?Array.from:e=>z.call(e),fe=(e,t)=>{for(let n=0;n<e.length;n++){const o=t(e[n],n);if(o.isSome())return o}return U.none()},ge=Object.keys,pe=Object.hasOwnProperty,he=(e,t)=>{const n=ge(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}},be=(e,t)=>ve(e,((e,n)=>({k:n,v:t(e,n)}))),ve=(e,t)=>{const n={};return he(e,((e,o)=>{const r=t(e,o);n[r.k]=r.v})),n},ye=e=>(t,n)=>{e[n]=t},Ce=(e,t,n,o)=>{he(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))},we=(e,t)=>{const n={};return Ce(e,t,ye(n),S),n},xe=(e,t)=>{const n=[];return he(e,((e,o)=>{n.push(t(e,o))})),n},Ee=e=>xe(e,D),_e=(e,t)=>ke(e,t)?U.from(e[t]):U.none(),ke=(e,t)=>pe.call(e,t),Se=(e,t)=>ke(e,t)&&void 0!==e[t]&&null!==e[t],Ne=e=>{const t={};return K(e,(e=>{t[e]={}})),ge(t)},Re=e=>void 0!==e.length,Ae=Array.isArray,De=(e,t,n)=>{if(!e)return!1;if(n=n||e,Re(e)){for(let o=0,r=e.length;o<r;o++)if(!1===t.call(n,e[o],o,e))return!1}else for(const o in e)if(ke(e,o)&&!1===t.call(n,e[o],o,e))return!1;return!0},Te=(e,t)=>{const n=[];return De(e,((o,r)=>{n.push(t(o,r,e))})),n},Oe=(e,t)=>{const n=[];return De(e,((o,r)=>{t&&!t(o,r,e)||n.push(o)})),n},Be=(e,t,n,o)=>{let r=C(n)?e[0]:n;for(let n=0;n<e.length;n++)r=t.call(o,r,e[n],n);return r},Pe=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++)if(t.call(n,e[o],o,e))return o;return-1},Le=e=>e[e.length-1],Me=e=>{let t,n=!1;return(...o)=>(n||(n=!0,t=e.apply(null,o)),t)},Ie=()=>Fe(0,0),Fe=(e,t)=>({major:e,minor:t}),Ue={nu:Fe,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?Ie():((e,t)=>{const n=((e,t)=>{for(let n=0;n<e.length;n++){const o=e[n];if(o.test(t))return o}})(e,t);if(!n)return{major:0,minor:0};const o=e=>Number(t.replace(n,"$"+e));return Fe(o(1),o(2))})(e,n)},unknown:Ie},ze=(e,t)=>{const n=String(t).toLowerCase();return ee(e,(e=>e.search(n)))},je=(e,t,n)=>""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,He=(e,t)=>qe(e,t)?((e,t)=>e.substring(t))(e,t.length):e,$e=(e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!C(o)||r+t.length<=o)},qe=(e,t)=>je(e,t,0),Ve=(e,t)=>je(e,t,e.length-t.length),We=e=>t=>t.replace(e,""),Ke=We(/^\s+|\s+$/g),Ye=We(/^\s+/g),Ge=We(/\s+$/g),Xe=e=>e.length>0,Qe=e=>!Xe(e),Je=(e,t=10)=>{const n=parseInt(e,t);return isNaN(n)?U.none():U.some(n)},Ze=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,et=e=>t=>$e(t,e),tt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>$e(e,"edge/")&&$e(e,"chrome")&&$e(e,"safari")&&$e(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ze],search:e=>$e(e,"chrome")&&!$e(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>$e(e,"msie")||$e(e,"trident")},{name:"Opera",versionRegexes:[Ze,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:et("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:et("firefox")},{name:"Safari",versionRegexes:[Ze,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>($e(e,"safari")||$e(e,"mobile/"))&&$e(e,"applewebkit")}],nt=[{name:"Windows",search:et("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>$e(e,"iphone")||$e(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]+).*/]}],ot={browsers:A(tt),oses:A(nt)},rt="Edge",st="Chromium",at="Opera",it="Firefox",lt="Safari",dt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isEdge:o(rt),isChromium:o(st),isIE:o("IE"),isOpera:o(at),isFirefox:o(it),isSafari:o(lt)}},ct={unknown:()=>dt({current:void 0,version:Ue.unknown()}),nu:dt,edge:A(rt),chromium:A(st),ie:A("IE"),opera:A(at),firefox:A(it),safari:A(lt)},mt="Windows",ut="Android",ft="Linux",gt="macOS",pt="Solaris",ht="FreeBSD",bt="ChromeOS",vt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isWindows:o(mt),isiOS:o("iOS"),isAndroid:o(ut),isMacOS:o(gt),isLinux:o(ft),isSolaris:o(pt),isFreeBSD:o(ht),isChromeOS:o(bt)}},yt={unknown:()=>vt({current:void 0,version:Ue.unknown()}),nu:vt,windows:A(mt),ios:A("iOS"),android:A(ut),linux:A(ft),macos:A(gt),solaris:A(pt),freebsd:A(ht),chromeos:A(bt)},Ct=(e,t,n)=>{const o=ot.browsers(),r=ot.oses(),s=t.bind((e=>((e,t)=>fe(t.brands,(t=>{const n=t.brand.toLowerCase();return ee(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Ue.nu(parseInt(t.version,10),0)})))})))(o,e))).orThunk((()=>((e,t)=>ze(e,t).map((e=>{const n=Ue.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e))).fold(ct.unknown,ct.nu),a=((e,t)=>ze(e,t).map((e=>{const n=Ue.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e).fold(yt.unknown,yt.nu),i=((e,t,n,o)=>{const r=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||o("(pointer:coarse)"),l=r||!s&&a&&o("(min-device-width:768px)"),d=s||a&&!l,c=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),m=!d&&!l&&!c;return{isiPad:A(r),isiPhone:A(s),isTablet:A(l),isPhone:A(d),isTouch:A(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:A(c),isDesktop:A(m)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}},wt=e=>window.matchMedia(e).matches;let xt=Me((()=>Ct(navigator.userAgent,U.from(navigator.userAgentData),wt)));const Et=()=>xt(),_t=navigator.userAgent,kt=Et(),St=kt.browser,Nt=kt.os,Rt=kt.deviceType,At=-1!==_t.indexOf("Windows Phone"),Dt={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:St.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!St.isIE(),windowsPhone:At,browser:{current:St.current,version:St.version,isChromium:St.isChromium,isEdge:St.isEdge,isFirefox:St.isFirefox,isIE:St.isIE,isOpera:St.isOpera,isSafari:St.isSafari},os:{current:Nt.current,version:Nt.version,isAndroid:Nt.isAndroid,isChromeOS:Nt.isChromeOS,isFreeBSD:Nt.isFreeBSD,isiOS:Nt.isiOS,isLinux:Nt.isLinux,isMacOS:Nt.isMacOS,isSolaris:Nt.isSolaris,isWindows:Nt.isWindows},deviceType:{isDesktop:Rt.isDesktop,isiPad:Rt.isiPad,isiPhone:Rt.isiPhone,isPhone:Rt.isPhone,isTablet:Rt.isTablet,isTouch:Rt.isTouch,isWebView:Rt.isWebView}},Tt=/^\s*|\s*$/g,Ot=e=>w(e)?"":(""+e).replace(Tt,""),Bt=function(e,t,n,o){o=o||this,e&&(n&&(e=e[n]),De(e,((e,r)=>!1!==t.call(o,e,r,n)&&(Bt(e,t,n,o),!0))))},Pt={trim:Ot,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 n=0,o=e.length;n<o;n++)t[n]=e[n];return t}},makeMap:(e,t,n={})=>{const o=g(e)?e.split(t||","):e||[];let r=o.length;for(;r--;)n[o[r]]={};return n},each:De,map:Te,grep:Oe,inArray:(e,t)=>{if(e)for(let n=0,o=e.length;n<o;n++)if(e[n]===t)return n;return-1},hasOwn:ke,extend:(e,...t)=>{for(let n=0;n<t.length;n++){const o=t[n];for(const t in o)if(ke(o,t)){const n=o[t];void 0!==n&&(e[t]=n)}}return e},walk:Bt,resolve:(e,t=window)=>{const n=e.split(".");for(let e=0,o=n.length;e<o&&(t=t[n[e]]);e++);return t},explode:(e,t)=>b(e)?e:""===e?[]:Te(e.split(t||","),Ot),_addCacheSuffix:e=>{const t=Dt.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Lt=(e,t,n=T)=>e.exists((e=>n(e,t))),Mt=(e,t,n=T)=>It(e,t,n).getOr(e.isNone()&&t.isNone()),It=(e,t,n)=>e.isSome()&&t.isSome()?U.some(n(e.getOrDie(),t.getOrDie())):U.none(),Ft=(e,t)=>e?U.some(t):U.none(),Ut="undefined"!=typeof window?window:Function("return this;")(),zt=(e,t)=>((e,t)=>{let n=null!=t?t:Ut;for(let t=0;t<e.length&&null!=n;++t)n=n[e[t]];return n})(e.split("."),t),jt=(e,t)=>{const n=((e,t)=>zt(e,t))(e,t);if(null==n)throw new Error(e+" not available on this browser");return n},Ht=Object.getPrototypeOf,$t=e=>{const t=zt("ownerDocument.defaultView",e);return p(e)&&((e=>jt("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Ht(e).constructor.name))},qt=e=>e.dom.nodeName.toLowerCase(),Vt=e=>e.dom.nodeType,Wt=e=>t=>Vt(t)===e,Kt=e=>Yt(e)&&$t(e.dom),Yt=Wt(1),Gt=Wt(3),Xt=Wt(9),Qt=Wt(11),Jt=e=>t=>Yt(t)&&qt(t)===e,Zt=(e,t,n)=>{if(!(g(n)||y(n)||_(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},en=(e,t,n)=>{Zt(e.dom,t,n)},tn=(e,t)=>{const n=e.dom;he(t,((e,t)=>{Zt(n,t,e)}))},nn=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},on=(e,t)=>U.from(nn(e,t)),rn=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},sn=(e,t)=>{e.dom.removeAttribute(t)},an=e=>J(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),ln=(e,t)=>{const n=nn(e,t);return void 0===n||""===n?[]:n.split(" ")},dn=e=>void 0!==e.dom.classList,cn=e=>ln(e,"class"),mn=(e,t)=>((e,t,n)=>{const o=ln(e,t).concat([n]);return en(e,t,o.join(" ")),!0})(e,"class",t),un=(e,t)=>((e,t,n)=>{const o=X(ln(e,t),(e=>e!==n));return o.length>0?en(e,t,o.join(" ")):sn(e,t),!1})(e,"class",t),fn=(e,t)=>{dn(e)?e.dom.classList.add(t):mn(e,t)},gn=e=>{0===(dn(e)?e.dom.classList:cn(e)).length&&sn(e,"class")},pn=(e,t)=>{dn(e)?e.dom.classList.remove(t):un(e,t),gn(e)},hn=(e,t)=>{const n=dn(e)?e.dom.classList.toggle(t):((e,t)=>q(cn(e),t)?un(e,t):mn(e,t))(e,t);return gn(e),n},bn=(e,t)=>dn(e)&&e.dom.classList.contains(t),vn=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},yn={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return vn(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return vn(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return vn(n)},fromDom:vn,fromPoint:(e,t,n)=>U.from(e.dom.elementFromPoint(t,n)).map(vn)},Cn=(e,t)=>{const n=[],o=e=>(n.push(e),t(e));let r=t(e);do{r=r.bind(o)}while(r.isSome());return n},wn=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;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")}},xn=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,En=(e,t)=>e.dom===t.dom,_n=(e,t)=>{const n=e.dom,o=t.dom;return n!==o&&n.contains(o)},kn=e=>yn.fromDom(e.dom.ownerDocument),Sn=e=>Xt(e)?e:kn(e),Nn=e=>yn.fromDom(Sn(e).dom.defaultView),Rn=e=>U.from(e.dom.parentNode).map(yn.fromDom),An=e=>U.from(e.dom.parentElement).map(yn.fromDom),Dn=(e,t)=>{const n=E(t)?t:I;let o=e.dom;const r=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=yn.fromDom(e);if(r.push(t),!0===n(t))break;o=e}return r},Tn=e=>U.from(e.dom.previousSibling).map(yn.fromDom),On=e=>U.from(e.dom.nextSibling).map(yn.fromDom),Bn=e=>se(Cn(e,Tn)),Pn=e=>Cn(e,On),Ln=e=>W(e.dom.childNodes,yn.fromDom),Mn=(e,t)=>{const n=e.dom.childNodes;return U.from(n[t]).map(yn.fromDom)},In=e=>Mn(e,0),Fn=e=>Mn(e,e.dom.childNodes.length-1),Un=e=>e.dom.childNodes.length,zn=e=>Qt(e)&&x(e.dom.host),jn=E(Element.prototype.attachShadow)&&E(Node.prototype.getRootNode),Hn=A(jn),$n=jn?e=>yn.fromDom(e.dom.getRootNode()):Sn,qn=e=>zn(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return yn.fromDom(t)})(Sn(e)),Vn=e=>yn.fromDom(e.dom.host),Wn=e=>{if(Hn()&&x(e.target)){const t=yn.fromDom(e.target);if(Yt(t)&&Kn(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return ce(t)}}return U.from(e.target)},Kn=e=>x(e.dom.shadowRoot),Yn=e=>{const t=Gt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=$n(e);return zn(t)?U.some(t):U.none()})(yn.fromDom(t)).fold((()=>n.body.contains(t)),R(Yn,Vn))};var Gn=(e,t,n,o,r)=>e(n,o)?U.some(n):E(r)&&r(n)?U.none():t(n,o,r);const Xn=(e,t,n)=>{let o=e.dom;const r=E(n)?n:I;for(;o.parentNode;){o=o.parentNode;const e=yn.fromDom(o);if(t(e))return U.some(e);if(r(e))break}return U.none()},Qn=(e,t,n)=>Gn(((e,t)=>t(e)),Xn,e,t,n),Jn=(e,t)=>ee(e.dom.childNodes,(e=>t(yn.fromDom(e)))).map(yn.fromDom),Zn=(e,t)=>{const n=e=>{for(let o=0;o<e.childNodes.length;o++){const r=yn.fromDom(e.childNodes[o]);if(t(r))return U.some(r);const s=n(e.childNodes[o]);if(s.isSome())return s}return U.none()};return n(e.dom)},eo=(e,t,n)=>Xn(e,(e=>wn(e,t)),n),to=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return xn(n)?U.none():U.from(n.querySelector(e)).map(yn.fromDom)})(t,e),no=(e,t,n)=>Gn(((e,t)=>wn(e,t)),eo,e,t,n),oo=(e,t=!1)=>{return Yn(e)?e.dom.isContentEditable:(n=e,no(n,"[contenteditable]")).fold(A(t),(e=>"true"===ro(e)));var n},ro=e=>e.dom.contentEditable,so=e=>void 0!==e.style&&E(e.style.getPropertyValue),ao=(e,t,n)=>{if(!g(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);so(e)&&e.style.setProperty(t,n)},io=(e,t,n)=>{const o=e.dom;ao(o,t,n)},lo=(e,t)=>{const n=e.dom;he(t,((e,t)=>{ao(n,t,e)}))},co=(e,t)=>{const n=e.dom,o=window.getComputedStyle(n).getPropertyValue(t);return""!==o||Yn(e)?o:mo(n,t)},mo=(e,t)=>so(e)?e.style.getPropertyValue(t):"",uo=(e,t)=>{const n=e.dom,o=mo(n,t);return U.from(o).filter((e=>e.length>0))},fo=e=>{const t={},n=e.dom;if(so(n))for(let e=0;e<n.style.length;e++){const o=n.style.item(e);t[o]=n.style[o]}return t},go=(e,t)=>{((e,t)=>{so(e)&&e.style.removeProperty(t)})(e.dom,t),Lt(on(e,"style").map(Ke),"")&&sn(e,"style")},po=(e,t)=>{Rn(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},ho=(e,t)=>{On(e).fold((()=>{Rn(e).each((e=>{vo(e,t)}))}),(e=>{po(e,t)}))},bo=(e,t)=>{In(e).fold((()=>{vo(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},vo=(e,t)=>{e.dom.appendChild(t.dom)},yo=(e,t)=>{po(e,t),vo(t,e)},Co=(e,t)=>{K(t,(t=>{vo(e,t)}))},wo=e=>{e.dom.textContent="",K(Ln(e),(e=>{xo(e)}))},xo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Eo=e=>{const t=Ln(e);var n,o;t.length>0&&(n=e,K(o=t,((e,t)=>{const r=0===t?n:o[t-1];ho(r,e)}))),xo(e)},_o=e=>W(e,yn.fromDom),ko=e=>e.dom.innerHTML,So=(e,t)=>{const n=kn(e).dom,o=yn.fromDom(n.createDocumentFragment()),r=((e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,Ln(yn.fromDom(n))})(t,n);Co(o,r),wo(e),vo(e,o)},No=(e,t)=>n=>{e(n)&&t((e=>{const t=yn.fromDom(Wn(e).getOr(e.target)),n=()=>e.stopPropagation(),o=()=>e.preventDefault(),r=N(o,n);return((e,t,n,o,r,s,a)=>({target:e,x:t,y:n,stop:o,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,n,o,r,e)})(n))},Ro=(e,t,n,o)=>((e,t,n,o,r)=>{const s=No(n,o);return e.dom.addEventListener(t,s,r),{unbind:O(Ao,e,t,s,r)}})(e,t,n,o,!1),Ao=(e,t,n,o)=>{e.dom.removeEventListener(t,n,o)},Do=(e,t)=>({left:e,top:t,translate:(n,o)=>Do(e+n,t+o)}),To=Do,Oo=(e,t)=>void 0!==e?e:void 0!==t?t:0,Bo=e=>{const t=e.dom,n=t.ownerDocument.body;return n===t?To(n.offsetLeft,n.offsetTop):Yn(e)?(e=>{const t=e.getBoundingClientRect();return To(t.left,t.top)})(t):To(0,0)},Po=e=>{const t=void 0!==e?e.dom:document,n=t.body.scrollLeft||t.documentElement.scrollLeft,o=t.body.scrollTop||t.documentElement.scrollTop;return To(n,o)},Lo=(e,t,n)=>{const o=(void 0!==n?n.dom:document).defaultView;o&&o.scrollTo(e,t)},Mo=(e,t)=>{Et().browser.isSafari()&&E(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},Io=(e,t,n,o)=>({x:e,y:t,width:n,height:o,right:e+n,bottom:t+o}),Fo=e=>{const t=void 0===e?window:e,n=t.document,o=Po(yn.fromDom(n));return(e=>{const t=void 0===e?window:e;return Et().browser.isFirefox()?U.none():U.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,n=e.clientWidth,r=e.clientHeight;return Io(o.left,o.top,n,r)}),(e=>Io(Math.max(e.pageLeft,o.left),Math.max(e.pageTop,o.top),e.width,e.height)))},Uo=(e,t)=>{let n=[];return K(Ln(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(Uo(e,t))})),n},zo=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return xn(n)?[]:W(n.querySelectorAll(e),yn.fromDom)})(t,e),jo=(e,t,n)=>eo(e,t,n).isSome();class Ho{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,n,o){if(e){if(!o&&e[t])return e[t];if(e!==this.rootNode){let t=e[n];if(t)return t;for(let o=e.parentNode;o&&o!==this.rootNode;o=o.parentNode)if(t=o[n],t)return t}}}findPreviousNode(e,t){if(e){const n=e.previousSibling;if(this.rootNode&&n===this.rootNode)return;if(n){if(!t)for(let e=n.lastChild;e;e=e.lastChild)if(!e.lastChild)return e;return n}const o=e.parentNode;if(o&&o!==this.rootNode)return o}}}const $o=e=>t=>!!t&&t.nodeType===e,qo=e=>!!e&&!Object.getPrototypeOf(e),Vo=$o(1),Wo=e=>Vo(e)&&Kt(yn.fromDom(e)),Ko=e=>{const t=e.toLowerCase();return e=>x(e)&&e.nodeName.toLowerCase()===t},Yo=e=>{const t=e.map((e=>e.toLowerCase()));return e=>{if(e&&e.nodeName){const n=e.nodeName.toLowerCase();return q(t,n)}return!1}},Go=(e,t)=>{const n=t.toLowerCase().split(" ");return t=>{if(Vo(t)){const o=t.ownerDocument.defaultView;if(o)for(let r=0;r<n.length;r++){const s=o.getComputedStyle(t,null);if((s?s.getPropertyValue(e):null)===n[r])return!0}}return!1}},Xo=e=>t=>Vo(t)&&t.hasAttribute(e),Qo=e=>Vo(e)&&e.hasAttribute("data-mce-bogus"),Jo=e=>Vo(e)&&"TABLE"===e.tagName,Zo=e=>t=>{if(Wo(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},er=Yo(["textarea","input"]),tr=$o(3),nr=$o(4),or=$o(7),rr=$o(8),sr=$o(9),ar=$o(11),ir=Ko("br"),lr=Ko("img"),dr=Zo("true"),cr=Zo("false"),mr=Yo(["td","th"]),ur=Yo(["td","th","caption"]),fr=Yo(["video","audio","object","embed"]),gr=Ko("li"),pr=Ko("details"),hr=Ko("summary"),br="\ufeff",vr=" ",yr=e=>e===br,Cr=((e,t)=>{const n=t=>e(t)?U.from(t.dom.nodeValue):U.none();return{get:o=>{if(!e(o))throw new Error("Can only get "+t+" value of a "+t+" node");return n(o).getOr("")},getOption:n,set:(n,o)=>{if(!e(n))throw new Error("Can only set raw "+t+" value of a "+t+" node");n.dom.nodeValue=o}}})(Gt,"text"),wr=e=>Cr.get(e),xr=e=>Cr.getOption(e),Er=e=>{let t;return n=>(t=t||ie(e,F),ke(t,qt(n)))},_r=e=>Yt(e)&&"br"===qt(e),kr=Er(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),Sr=Er(["ul","ol","dl"]),Nr=Er(["li","dd","dt"]),Rr=Er(["thead","tbody","tfoot"]),Ar=Er(["td","th"]),Dr=Er(["pre","script","textarea","style"]),Tr=e=>{const t=zo(e,"br"),n=X((e=>{const t=[];let n=e.dom;for(;n;)t.push(yn.fromDom(n)),n=n.lastChild;return t})(e).slice(-1),_r);t.length===n.length&&K(n,xo)},Or=()=>{const e=yn.fromTag("br");return en(e,"data-mce-bogus","1"),e},Br=e=>{wo(e),vo(e,Or())},Pr=br,Lr=yr,Mr=e=>e.replace(/\uFEFF/g,""),Ir=Vo,Fr=tr,Ur=e=>(Fr(e)&&(e=e.parentNode),Ir(e)&&e.hasAttribute("data-mce-caret")),zr=e=>Fr(e)&&Lr(e.data),jr=e=>Ur(e)||zr(e),Hr=e=>e.firstChild!==e.lastChild||!ir(e.firstChild),$r=e=>{const t=e.container();return!!tr(t)&&(t.data.charAt(e.offset())===Pr||e.isAtStart()&&zr(t.previousSibling))},qr=e=>{const t=e.container();return!!tr(t)&&(t.data.charAt(e.offset()-1)===Pr||e.isAtEnd()&&zr(t.nextSibling))},Vr=e=>Fr(e)&&e.data[0]===Pr,Wr=e=>Fr(e)&&e.data[e.data.length-1]===Pr,Kr=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{var t;const n=e.getElementsByTagName("br"),o=n[n.length-1];Qo(o)&&(null===(t=o.parentNode)||void 0===t||t.removeChild(o))})(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,Yr=e=>Ur(e.startContainer),Gr=dr,Xr=cr,Qr=ir,Jr=tr,Zr=Yo(["script","style","textarea"]),es=Yo(["img","input","textarea","hr","iframe","video","audio","object","embed"]),ts=Yo(["table"]),ns=jr,os=e=>!ns(e)&&(Jr(e)?!Zr(e.parentNode):es(e)||Qr(e)||ts(e)||rs(e)),rs=e=>!(e=>Vo(e)&&"true"===e.getAttribute("unselectable"))(e)&&Xr(e),ss=(e,t)=>os(e)&&((e,t)=>{for(let n=e.parentNode;n&&n!==t;n=n.parentNode){if(rs(n))return!1;if(Gr(n))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},ds=e=>"\n"===e||"\r"===e,cs=(e,t=4,n=!0,o=!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===vr?e.pcIsSpace||""===e.str&&n||e.str.length===s.length-1&&o||((e,t)=>t<e.length&&t>=0&&ds(e[t]))(s,e.str.length+1)?{pcIsSpace:!1,str:e.str+vr}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:ds(t),str:e.str+t}),{pcIsSpace:!1,str:""});return a.str},ms=(e,t)=>tr(e)&&is(e.data)&&!((e,t)=>{const n=yn.fromDom(t),o=yn.fromDom(e);return jo(o,"pre,code",O(En,n))})(e,t),us=(e,t)=>os(e)&&!ms(e,t)||(e=>Vo(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(e)||fs(e),fs=Xo("data-mce-bookmark"),gs=Xo("data-mce-bogus"),ps=(hs="data-mce-bogus",bs="all",e=>Vo(e)&&e.getAttribute(hs)===bs);var hs,bs;const vs=e=>An(yn.fromDom(e)).exists((e=>!oo(e))),ys=(e,t=!0)=>((e,t)=>{let n=0;if(us(e,e))return!1;{let o=e.firstChild;if(!o)return!0;const r=new Ho(o,e);do{if(t){if(ps(o)){o=r.next(!0);continue}if(gs(o)){o=r.next();continue}}if(dr(o)&&vs(o))return!1;if(ir(o))n++,o=r.next();else{if(us(o,e))return!1;o=r.next()}}while(o);return n<=1}})(e.dom,t),Cs=e=>"svg"===e.toLowerCase(),ws=e=>Cs(e.nodeName),xs=e=>"svg"===(null==e?void 0:e.nodeName)?"svg":"html",Es=["svg"],_s="data-mce-block",ks=e=>W((e=>X(ge(e),(e=>!/[A-Z]/.test(e))))(e),(e=>`${e}:`+W(Es,(t=>`not(${t} ${e})`)).join(":"))).join(","),Ss=(e,t)=>x(t.querySelector(e))?(t.setAttribute(_s,"true"),"inline-boundary"===t.getAttribute("data-mce-selected")&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(_s),!1),Ns=(e,t)=>{const n=ks(e.getTransparentElements()),o=ks(e.getBlockElements());return X(t.querySelectorAll(n),(e=>Ss(o,e)))},Rs=(e,t)=>{var n;const o=t?"lastChild":"firstChild";for(let t=e[o];t;t=t[o])if(ys(yn.fromDom(t)))return void(null===(n=t.parentNode)||void 0===n||n.removeChild(t))},As=(e,t,n)=>{const o=e.getBlockElements(),r=yn.fromDom(t),s=e=>qt(e)in o,a=e=>En(e,r);K(_o(n),(t=>{Xn(t,s,a).each((n=>{const o=((e,t)=>X(Ln(e),t))(t,(t=>s(t)&&!e.isValidChild(qt(n),qt(t))));if(o.length>0){const t=An(n);K(o,(e=>{Xn(e,s,a).each((t=>{((e,t)=>{const n=document.createRange(),o=e.parentNode;if(o){n.setStartBefore(e),n.setEndBefore(t);const r=n.extractContents();Rs(r,!0),n.setStartAfter(t),n.setEndAfter(e);const s=n.extractContents();Rs(s,!1),ys(yn.fromDom(r))||o.insertBefore(r,e),ys(yn.fromDom(t))||o.insertBefore(t,e),ys(yn.fromDom(s))||o.insertBefore(s,e),o.removeChild(e)}})(t.dom,e.dom)}))})),t.each((t=>Ns(e,t.dom)))}}))}))},Ds=(e,t)=>{const n=Ns(e,t);As(e,t,n),((e,t,n)=>{K([...n,...Ls(e,t)?[t]:[]],(t=>K(zo(yn.fromDom(t),t.nodeName.toLowerCase()),(t=>{Ms(e,t.dom)&&Eo(t)}))))})(e,t,n)},Ts=(e,t)=>{if(Ps(e,t)){const n=ks(e.getBlockElements());Ss(n,t)}},Os=e=>e.hasAttribute(_s),Bs=(e,t)=>ke(e.getTransparentElements(),t),Ps=(e,t)=>Vo(t)&&Bs(e,t.nodeName),Ls=(e,t)=>Ps(e,t)&&Os(t),Ms=(e,t)=>Ps(e,t)&&!Os(t),Is=(e,t)=>1===t.type&&Bs(e,t.name)&&g(t.attr(_s)),Fs=Et().browser,Us=e=>ee(e,Yt),zs=(e,t)=>e.children&&q(e.children,t),js=(e,t,n)=>{let o=0,r=0;const s=e.ownerDocument;if(n=n||e,t){if(n===e&&t.getBoundingClientRect&&"static"===co(yn.fromDom(e),"position")){const n=t.getBoundingClientRect();return o=n.left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentElement.clientLeft,r=n.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop,{x:o,y:r}}let a=t;for(;a&&a!==n&&a.nodeType&&!zs(a,n);){const e=a;o+=e.offsetLeft||0,r+=e.offsetTop||0,a=e.offsetParent}for(a=t.parentNode;a&&a!==n&&a.nodeType&&!zs(a,n);)o-=a.scrollLeft||0,r-=a.scrollTop||0,a=a.parentNode;r+=(e=>Fs.isFirefox()&&"table"===qt(e)?Us(Ln(e)).filter((e=>"caption"===qt(e))).bind((e=>Us(Pn(e)).map((t=>{const n=t.dom.offsetTop,o=e.dom.offsetTop,r=e.dom.offsetHeight;return n<=o?-r:0})))).getOr(0):0)(yn.fromDom(t))}return{x:o,y:r}},Hs=(e,t={})=>{let n=0;const o={},r=yn.fromDom(e),s=Sn(r),a=e=>{vo(qn(r),e)},i=e=>{const t=qn(r);to(t,"#"+e).each(xo)},l=e=>_e(o,e).getOrThunk((()=>({id:"mce-u"+n++,passed:[],failed:[],count:0}))),d=e=>new Promise(((n,r)=>{let i;const d=Pt._addCacheSuffix(e),c=l(d);o[d]=c,c.count++;const m=(e,t)=>{K(e,M),c.status=t,c.passed=[],c.failed=[],i&&(i.onload=null,i.onerror=null,i=null)},u=()=>m(c.passed,2),f=()=>m(c.failed,3);if(n&&c.passed.push(n),r&&c.failed.push(r),1===c.status)return;if(2===c.status)return void u();if(3===c.status)return void f();c.status=1;const g=yn.fromTag("link",s.dom);tn(g,{rel:"stylesheet",type:"text/css",id:c.id}),t.contentCssCors&&en(g,"crossOrigin","anonymous"),t.referrerPolicy&&en(g,"referrerpolicy",t.referrerPolicy),i=g.dom,i.onload=u,i.onerror=f,a(g),en(g,"href",d)})),c=e=>{const t=Pt._addCacheSuffix(e);_e(o,t).each((e=>{0==--e.count&&(delete o[t],i(e.id))}))};return{load:d,loadRawCss:(e,t)=>{const n=l(e);o[e]=n,n.count++;const r=yn.fromTag("style",s.dom);tn(r,{rel:"stylesheet",type:"text/css",id:n.id}),r.dom.innerHTML=t,a(r)},loadAll:e=>Promise.allSettled(W(e,(e=>d(e).then(A(e))))).then((e=>{const t=G(e,(e=>"fulfilled"===e.status));return t.fail.length>0?Promise.reject(W(t.fail,(e=>e.reason))):W(t.pass,(e=>e.value))})),unload:c,unloadRawCss:e=>{_e(o,e).each((t=>{0==--t.count&&(delete o[e],i(t.id))}))},unloadAll:e=>{K(e,(e=>{c(e)}))},_setReferrerPolicy:e=>{t.referrerPolicy=e},_setContentCssCors:e=>{t.contentCssCors=e}}},$s=(()=>{const e=new WeakMap;return{forElement:(t,n)=>{const o=$n(t).dom;return U.from(e.get(o)).getOrThunk((()=>{const t=Hs(o,n);return e.set(o,t),t}))}}})(),qs=(e,t,n)=>x(e)&&(us(e,t)||n.isInline(e.nodeName.toLowerCase())),Vs=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),Ws=(e,t,n)=>tr(e)&&e.data.length>0&&((e,t,n)=>{const o=new Ho(e,t).prev(!1),r=new Ho(e,t).next(!1),s=C(o)||qs(o,t,n),a=C(r)||qs(r,t,n);return s&&a})(e,t,n),Ks=(e,t,n,o)=>{var r;const s=o||t;if(Vo(t)&&Vs(t))return t;const a=t.childNodes;for(let t=a.length-1;t>=0;t--)Ks(e,a[t],n,s);if(Vo(t)){const e=t.childNodes;1===e.length&&Vs(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=>!!Vo(e)&&e.childNodes.length>0)(t)||Ws(t,s,n)||e.remove(t),t},Ys=Pt.makeMap,Gs=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xs=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Qs=/[<>&\"\']/g,Js=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,Zs={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={"<":"<",">":">","&":"&",""":'"',"'":"'"},na=(e,t)=>{const n={};if(e){const o=e.split(",");t=t||10;for(let e=0;e<o.length;e+=2){const r=String.fromCharCode(parseInt(o[e],t));if(!ea[r]){const t="&"+o[e+1]+";";n[r]=t,n[t]=r}}return n}},oa=na("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),ra=(e,t)=>e.replace(t?Gs:Xs,(e=>ea[e]||e)),sa=(e,t)=>e.replace(t?Gs:Xs,(e=>e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":ea[e]||"&#"+e.charCodeAt(0)+";")),aa=(e,t,n)=>{const o=n||oa;return e.replace(t?Gs:Xs,(e=>ea[e]||o[e]||e))},ia={encodeRaw:ra,encodeAllRaw:e=>(""+e).replace(Qs,(e=>ea[e]||e)),encodeNumeric:sa,encodeNamed:aa,getEncodeFunc:(e,t)=>{const n=na(t)||oa,o=(e,t)=>e.replace(t?Gs:Xs,(e=>void 0!==ea[e]?ea[e]:void 0!==n[e]?n[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";")),r=(e,t)=>aa(e,t,n),s=Ys(e.replace(/\+/g,","));return s.named&&s.numeric?o: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))):Zs[t]||String.fromCharCode(t):ta[e]||oa[e]||(e=>{const t=yn.fromTag("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e)))},la=(e,t)=>(e=Pt.trim(e))?e.split(t||" "):[],da=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),ca=(e,t)=>{const n=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return oe(la(t,","),(t=>{const o=n.exec(t);if(o){const t=o[1],n=o[2],r=o[3],s=o[4],a=o[5],i={attributes:{},attributesOrder:[]};if(e.each((e=>((e,t)=>{he(e.attributes,((e,n)=>{t.attributes[n]=e})),t.attributesOrder.push(...e.attributesOrder)})(e,i))),"#"===t?i.paddEmpty=!0:"-"===t&&(i.removeEmpty=!0),"!"===s&&(i.removeEmptyAttrs=!0),a&&((e,t)=>{const n=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,o=/[*?+]/,{attributes:r,attributesOrder:s}=t;K(la(e,"|"),(e=>{const a=n.exec(e);if(a){const e={},n=a[1],i=a[2].replace(/[\\:]:/g,":"),l=a[3],d=a[4];if("!"===n&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(i),e.required=!0),"-"===n)return delete r[i],void s.splice(Pt.inArray(s,i),1);if(l&&("="===l?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:i,value:d}),e.defaultValue=d):"~"===l?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:i,value:d}),e.forcedValue=d):"<"===l&&(e.validValues=Pt.makeMap(d,"?"))),o.test(i)){const n=e;t.attributePatterns=t.attributePatterns||[],n.pattern=da(i),t.attributePatterns.push(n)}else r[i]||s.push(i),r[i]=e}}))})(a,i),r&&(i.outputName=n),"@"===n){if(!e.isNone())return[];e=U.some(i)}return[r?{name:n,element:i,aliasName:r}:{name:n,element:i}]}return[]}))},ma={},ua=Pt.makeMap,fa=Pt.each,ga=Pt.extend,pa=Pt.explode,ha=(e,t={})=>{const n=ua(e," ",ua(e.toUpperCase()," "));return ga(n,t)},ba=e=>ha("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),va=(e,t)=>{if(e){const n={};return g(e)&&(e={"*":e}),fa(e,((e,o)=>{n[o]=n[o.toUpperCase()]="map"===t?ua(e,/[, ]/):pa(e,/[, ]/)})),n}},ya=(e={})=>{var t;const n={},o={};let r=[];const s={},a={},i=(t,n,o)=>{const r=e[t];if(r)return ua(r,/[, ]/,ua(r.toUpperCase(),/[, ]/));{let e=ma[t];return e||(e=ha(n,o),ma[t]=e),e}},l=null!==(t=e.schema)&&void 0!==t?t:"html5",d=(e=>{const{globalAttributes:t,phrasingContent:n,flowContent:o}=(e=>{let t,n,o;t="id accesskey class dir lang style tabindex title role",n="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+=" contenteditable contextmenu draggable dropzone hidden spellcheck translate",n+=" article aside details dialog figure main header footer hgroup section nav a ins del canvas map",o+=" audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),"html5-strict"!==e&&(t+=" xml:lang",o=[o,"acronym applet basefont big font strike tt"].join(" "),n=[n,"center dir isindex noframes"].join(" "));const r=[n,o].join(" ");return{globalAttributes:t,blockContent:n,phrasingContent:o,flowContent:r}})(e),r={},s=(e,t,n)=>{r[e]={attributes:ie(t,A({})),attributesOrder:t,children:ie(n,A({}))}},a=(e,n="",o="")=>{const r=la(o),a=la(e);let i=a.length;const l=la([t,n].join(" "));for(;i--;)s(a[i],l.slice(),r)},i=(e,t)=>{const n=la(e),o=la(t);let s=n.length;for(;s--;){const e=r[n[s]];for(let t=0,n=o.length;t<n;t++)e.attributes[o[t]]={},e.attributesOrder.push(o[t])}};return"html5-strict"!==e&&(K(la("acronym applet basefont big font strike tt"),(e=>{a(e,"",n)})),K(la("center dir isindex noframes"),(e=>{a(e,"",o)}))),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",o),a("dd div","",o),a("address dt caption","","html4"===e?n:o),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","",n),a("blockquote","cite",o),a("ol","reversed start type","li"),a("ul","","li"),a("li","value",o),a("dl","","dt dd"),a("a","href target rel media hreflang type","html4"===e?n:o),a("q","cite",n),a("ins del","cite datetime",o),a("img","src sizes srcset alt usemap ismap width height"),a("iframe","src name width height",o),a("embed","src type width height"),a("object","data type typemustmatch name usemap form width height",[o,"param"].join(" ")),a("param","name value"),a("map","name",[o,"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",o),a("th","colspan rowspan headers scope abbr",o),a("form","accept-charset action autocomplete enctype method name novalidate target",o),a("fieldset","disabled form name",[o,"legend"].join(" ")),a("label","form for",n),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?o:n),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",[o,"li"].join(" ")),a("noscript","",o),"html4"!==e&&(a("wbr"),a("ruby","",[n,"rt rp"].join(" ")),a("figcaption","",o),a("mark rt rp bdi","",n),a("summary","",[n,"h1 h2 h3 h4 h5 h6"].join(" ")),a("canvas","width height",o),a("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[o,"track source"].join(" ")),a("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[o,"track source"].join(" ")),a("picture","","img source"),a("source","src srcset type media sizes"),a("track","kind src srclang label default"),a("datalist","",[n,"option"].join(" ")),a("article section nav aside main header footer","",o),a("hgroup","","h1 h2 h3 h4 h5 h6"),a("figure","",[o,"figcaption"].join(" ")),a("time","datetime",n),a("dialog","open",o),a("command","type label icon disabled checked radiogroup command"),a("output","for form name",n),a("progress","value max",n),a("meter","value min max low high optimum",n),a("details","open",[o,"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&&K([r.video,r.audio],(e=>{delete e.children.audio,delete e.children.video})),K(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 c=va(e.valid_styles),m=va(e.invalid_styles,"map"),u=va(e.valid_classes,"map"),f=i("whitespace_elements","pre script noscript style textarea video audio iframe object code"),g=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"),h=i("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),b="td th iframe video audio object script code",v=i("non_empty_elements",b+" pre svg",p),y=i("move_caret_before_on_enter_elements",b+" table",p),C="h1 h2 h3 h4 h5 h6",w=i("text_block_elements",C+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),x=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",w),E=i("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),_=i("transparent_elements","a ins del canvas map"),k=i("wrap_block_elements","pre "+C);fa("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),(e=>{a[e]=new RegExp("</"+e+"[^>]*>","gi")}));const S=e=>{const t=U.from(n["@"]),o=/[*?+]/;K(ca(t,null!=e?e:""),(({name:e,element:t,aliasName:s})=>{if(s&&(n[s]=t),o.test(e)){const n=t;n.pattern=da(e),r.push(n)}else n[e]=t}))},N=e=>{r=[],K(ge(n),(e=>{delete n[e]})),S(e)},R=e=>{delete ma.text_block_elements,delete ma.block_elements,K((e=>{const t=/^(~)?(.+)$/;return oe(la(e,","),(e=>{const n=t.exec(e);if(n){const e="~"===n[1];return[{inline:e,cloneName:e?"span":"div",name:n[2]}]}return[]}))})(null!=e?e:""),(({inline:e,name:t,cloneName:r})=>{if(o[t]=o[r],s[t]=r,v[t.toUpperCase()]={},v[t]={},e||(x[t.toUpperCase()]={},x[t]={}),!n[t]){let e=n[r];e=ga({},e),delete e.removeEmptyAttrs,delete e.removeEmpty,n[t]=e}he(o,((e,n)=>{e[r]&&(o[n]=e=ga({},o[n]),e[t]=e[r])}))}))},D=e=>{K((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 oe(la(e,","),(e=>{const n=t.exec(e);if(n){const e=n[1],t=e?(e=>"-"===e?"remove":"add")(e):"replace";return[{operation:t,name:n[2],validChildren:la(n[3],"|")}]}return[]}))})(null!=e?e:""),(({operation:e,name:t,validChildren:n})=>{const r="replace"===e?{"#comment":{}}:o[t];K(n,(t=>{"remove"===e?delete r[t]:r[t]={}})),o[t]=r}))},T=e=>{const t=n[e];if(t)return t;let o=r.length;for(;o--;){const t=r[o];if(t.pattern.test(e))return t}};e.valid_elements?(N(e.valid_elements),fa(d,((e,t)=>{o[t]=e.children}))):(fa(d,((e,t)=>{n[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},o[t]=e.children})),fa(la("strong/b em/i"),(e=>{const t=la(e,"/");n[t[1]].outputName=t[0]})),fa(E,((t,o)=>{n[o]&&(e.padd_empty_block_inline_children&&(n[o].paddInEmptyBlock=!0),n[o].removeEmpty=!0)})),fa(la("ol ul blockquote a table tbody"),(e=>{n[e]&&(n[e].removeEmpty=!0)})),fa(la("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),(e=>{n[e]&&(n[e].paddEmpty=!0)})),fa(la("span"),(e=>{n[e].removeEmptyAttrs=!0}))),delete n.svg,R(e.custom_elements),D(e.valid_children),S(e.extended_valid_elements),D("+ol[ul|ol],+ul[ul|ol]"),fa({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)=>{n[t]&&(n[t].parentsRequired=la(e))})),e.invalid_elements&&fa(pa(e.invalid_elements),(e=>{n[e]&&delete n[e]})),T("span")||S("span[!data-mce-type|*]");const O=A(c),B=A(m),P=A(u),L=A(h),M=A(x),I=A(w),F=A(E),z=A(Object.seal(p)),j=A(g),H=A(v),$=A(y),q=A(f),V=A(_),W=A(k),Y=A(Object.seal(a)),G=(e,t)=>{const n=T(e);if(n){if(!t)return!0;{if(n.attributes[t])return!0;const e=n.attributePatterns;if(e){let n=e.length;for(;n--;)if(e[n].pattern.test(t))return!0}}}return!1},X=e=>ke(M(),e),Q=e=>!qe(e,"#")&&G(e)&&!X(e),J=A(s);return{type:l,children:o,elements:n,getValidStyles:O,getValidClasses:P,getBlockElements:M,getInvalidStyles:B,getVoidElements:z,getTextBlockElements:I,getTextInlineElements:F,getBoolAttrs:L,getElementRule:T,getSelfClosingElements:j,getNonEmptyElements:H,getMoveCaretBeforeOnEnterElements:$,getWhitespaceElements:q,getTransparentElements:V,getSpecialElements:Y,isValidChild:(e,t)=>{const n=o[e.toLowerCase()];return!(!n||!n[t.toLowerCase()])},isValid:G,isBlock:X,isInline:Q,isWrapper:e=>ke(W(),e)||Q(e),getCustomElements:J,addValidElements:S,setValidElements:N,addCustomElements:R,addValidChildren:D}},Ca=e=>He(e,"#").toUpperCase(),wa=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},xa=e=>(e=>({value:Ca(e)}))(wa(e.red)+wa(e.green)+wa(e.blue)),Ea=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,_a=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,ka=(e,t,n,o)=>({red:e,green:t,blue:n,alpha:o}),Sa=(e,t,n,o)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(n,10),i=parseFloat(o);return ka(r,s,a,i)},Na=e=>{if("transparent"===e)return U.some(ka(0,0,0,0));const t=Ea.exec(e);if(null!==t)return U.some(Sa(t[1],t[2],t[3],"1"));const n=_a.exec(e);return null!==n?U.some(Sa(n[1],n[2],n[3],n[4])):U.none()},Ra=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Aa=e=>Na(e).map(xa).map((e=>"#"+e.value)).getOr(e),Da=(e={},t)=>{const n=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,o=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/,s={};let a,i;const l=br;t&&(a=t.getValidStyles(),i=t.getInvalidStyles());const d="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(let e=0;e<d.length;e++)s[d[e]]=l+e,s[l+e]=d[e];const c={parse:t=>{const a={};let i=!1;const d=e.url_converter,m=e.url_converter_scope||c,u=(e,t,n)=>{const o=a[e+"-top"+t];if(!o)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=[o,r,s,i];let d=l.length-1;for(;d--&&l[d]===l[d+1];);d>-1&&n||(a[e+t]=-1===d?l[0]:l.join(" "),delete a[e+"-top"+t],delete a[e+"-right"+t],delete a[e+"-bottom"+t],delete a[e+"-left"+t])},f=e=>{const t=a[e];if(!t)return;const n=t.indexOf(",")>-1?[t]:t.split(" ");let o=n.length;for(;o--;)if(n[o]!==n[0])return!1;return a[e]=n[0],!0},p=e=>(i=!0,s[e]),h=(e,t)=>(i&&(e=e.replace(/\uFEFF[0-9]/g,(e=>s[e]))),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),b=e=>String.fromCharCode(parseInt(e.slice(1),16)),v=e=>e.replace(/\\[0-9a-f]+/gi,b),y=(t,n,o,r,s,a)=>{if(s=s||a)return"'"+(s=h(s)).replace(/\'/g,"\\'")+"'";if(n=h(n||o||r||""),!e.allow_script_urls){const t=n.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&&(n=d.call(m,n,"style")),"url('"+n.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=o.exec(t);){o.lastIndex=s.index+s[0].length;let t=s[1].replace(r,"").toLowerCase(),d=s[2].replace(r,"");if(t&&d){if(t=v(t),d=v(d),-1!==t.indexOf(l)||-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()),g(e.force_hex_color)&&"off"!==e.force_hex_color&&Na(d).each((t=>{"always"!==e.force_hex_color&&1!==t.alpha||(d=Aa(Ra(t)))})),d=d.replace(n,y),a[t]=i?h(d,!0):d}}u("border","",!0),u("border","-width"),u("border","-color"),u("border","-style"),u("padding",""),u("margin",""),C="border",x="border-style",E="border-color",f(w="border-width")&&f(x)&&f(E)&&(a[C]=a[w]+" "+a[x]+" "+a[E],delete a[w],delete a[x],delete a[E]),"medium none"===a.border&&delete a.border,"none"===a["border-image"]&&delete a["border-image"]}var C,w,x,E;return a},serialize:(e,t)=>{let n="";const o=(t,o)=>{const r=o[t];if(r)for(let t=0,o=r.length;t<o;t++){const o=r[t],s=e[o];s&&(n+=(n.length>0?" ":"")+o+": "+s+";")}};return t&&a?(o("*",a),o(t,a)):he(e,((e,o)=>{e&&((e,t)=>{if(!i||!t)return!0;let n=i["*"];return!(n&&n[e]||(n=i[t],n&&n[e]))})(o,t)&&(n+=(n.length>0?" ":"")+o+": "+e+";")})),n}};return c},Ta={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},Oa=e=>w(e.preventDefault)||(e=>e instanceof Event||E(e.initEvent))(e),Ba=(e,t)=>{const n=null!=t?t:{};for(const t in e)ke(Ta,t)||(n[t]=e[t]);return x(e.composedPath)&&(n.composedPath=()=>e.composedPath()),x(e.getModifierState)&&(n.getModifierState=t=>e.getModifierState(t)),x(e.getTargetRanges)&&(n.getTargetRanges=()=>e.getTargetRanges()),n},Pa=(e,t,n,o)=>{var r;const s=Ba(t,o);return s.type=e,w(s.target)&&(s.target=null!==(r=s.srcElement)&&void 0!==r?r:n),Oa(t)&&(s.preventDefault=()=>{s.defaultPrevented=!0,s.isDefaultPrevented=F,E(t.preventDefault)&&t.preventDefault()},s.stopPropagation=()=>{s.cancelBubble=!0,s.isPropagationStopped=F,E(t.stopPropagation)&&t.stopPropagation()},s.stopImmediatePropagation=()=>{s.isImmediatePropagationStopped=F,s.stopPropagation()},(e=>e.isDefaultPrevented===F||e.isDefaultPrevented===I)(s)||(s.isDefaultPrevented=!0===s.defaultPrevented?F:I,s.isPropagationStopped=!0===s.cancelBubble?F:I,s.isImmediatePropagationStopped=I)),s},La=/^(?:mouse|contextmenu)|click/,Ma=(e,t,n,o)=>{e.addEventListener(t,n,o||!1)},Ia=(e,t,n,o)=>{e.removeEventListener(t,n,o||!1)},Fa=(e,t)=>{const n=Pa(e.type,e,document,t);if((e=>x(e)&&La.test(e.type))(e)&&C(e.pageX)&&!C(e.clientX)){const t=n.target.ownerDocument||document,o=t.documentElement,r=t.body,s=n;s.pageX=e.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),s.pageY=e.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)}return n},Ua=(e,t,n)=>{const o=e.document,r={type:"ready"};if(n.domLoaded)return void t(r);const s=()=>{Ia(e,"DOMContentLoaded",s),Ia(e,"load",s),n.domLoaded||(n.domLoaded=!0,t(r)),e=null};"complete"===o.readyState||"interactive"===o.readyState&&o.body?s():Ma(e,"DOMContentLoaded",s),n.domLoaded||Ma(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,n,o){const r=this;let s;const a=window,i=e=>{r.executeHandlers(Fa(e||a.event),l)};if(!e||tr(e)||rr(e))return n;let l;e[r.expando]?l=e[r.expando]:(l=r.count++,e[r.expando]=l,r.events[l]={}),o=o||e;const d=t.split(" ");let c=d.length;for(;c--;){let t=d[c],m=i,u=!1,f=!1;"DOMContentLoaded"===t&&(t="ready"),r.domLoaded&&"ready"===t&&"complete"===e.readyState?n.call(o,Fa({type:t})):(r.hasFocusIn||"focusin"!==t&&"focusout"!==t||(u=!0,f="focusin"===t?"focus":"blur",m=e=>{const t=Fa(e||a.event);t.type="focus"===t.type?"focusin":"focusout",r.executeHandlers(t,l)}),s=r.events[l][t],s?"ready"===t&&r.domLoaded?n(Fa({type:t})):s.push({func:n,scope:o}):(r.events[l][t]=s=[{func:n,scope:o}],s.fakeName=f,s.capture=u,s.nativeHandler=m,"ready"===t?Ua(e,m,r):Ma(e,f||t,m,u)))}return e=s=null,n}unbind(e,t,n){if(!e||tr(e)||rr(e))return this;const o=e[this.expando];if(o){let r=this.events[o];if(t){const o=t.split(" ");let s=o.length;for(;s--;){const t=o[s],a=r[t];if(a){if(n){let e=a.length;for(;e--;)if(a[e].func===n){const n=a.nativeHandler,o=a.fakeName,s=a.capture,i=a.slice(0,e).concat(a.slice(e+1));i.nativeHandler=n,i.fakeName=o,i.capture=s,r[t]=i}}n&&0!==a.length||(delete r[t],Ia(e,a.fakeName||t,a.nativeHandler,a.capture))}}}else he(r,((t,n)=>{Ia(e,t.fakeName||n,t.nativeHandler,t.capture)})),r={};for(const e in r)if(ke(r,e))return this;delete this.events[o];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,n){return this.dispatch(e,t,n)}dispatch(e,t,n){if(!e||tr(e)||rr(e))return this;const o=Fa({type:t,target:e},n);do{const t=e[this.expando];t&&this.executeHandlers(o,t),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!o.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 n=t.length;for(;n--;)(e=t[n])[this.expando]&&this.unbind(e)}return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const n=this.events[t],o=n&&n[e.type];if(o)for(let t=0,n=o.length;t<n;t++){const n=o[t];if(n&&!1===n.func.call(n.scope,e)&&e.preventDefault(),e.isImmediatePropagationStopped())return}}}za.Event=new za;const ja=Pt.each,Ha=Pt.grep,$a="data-mce-style",qa=Pt.makeMap("fill-opacity font-weight line-height opacity orphans widows z-index zoom"," "),Va=(e,t,n)=>{w(n)||""===n?sn(e,t):en(e,t,n)},Wa=e=>e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),Ka=(e,t)=>{let n=0;if(e)for(let o=e.nodeType,r=e.previousSibling;r;r=r.previousSibling){const e=r.nodeType;(!t||!tr(r)||e!==o&&r.data.length)&&(n++,o=e)}return n},Ya=(e,t)=>{const n=nn(t,"style"),o=e.serialize(e.parse(n),qt(t));Va(t,$a,o)},Ga=(e,t,n)=>{const o=Wa(t);w(n)||""===n?go(e,o):io(e,o,((e,t)=>_(e)?ke(qa,t)?e+"":e+"px":e)(n,o))},Xa=(e,t={})=>{const n={},o=window,r={};let s=0;const a=$s.forElement(yn.fromDom(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),i=[],l=t.schema?t.schema:ya({}),d=Da({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope,force_hex_color:t.force_hex_color},t.schema),c=t.ownEvents?new za:za.Event,m=l.getBlockElements(),u=t=>t&&e&&g(t)?e.getElementById(t):t,f=e=>{const t=u(e);return x(t)?yn.fromDom(t):null},p=(e,t,n="")=>{let o;const r=f(e);if(x(r)&&Yt(r)){const e=Y[t];o=e&&e.get?e.get(r.dom,t):nn(r,t)}return x(o)?o:n},h=e=>{const t=u(e);return w(t)?[]:t.attributes},v=(e,n,o)=>{T(e,(e=>{if(Vo(e)){const r=yn.fromDom(e),s=""===o?null:o,a=nn(r,n),i=Y[n];i&&i.set?i.set(r.dom,s,n):Va(r,n,s),a!==s&&t.onSetAttrib&&t.onSetAttrib({attrElm:r.dom,attrName:n,attrValue:s})}}))},y=()=>t.root_element||e.body,C=(t,n)=>js(e.body,u(t),n),_=(e,t,n)=>{const o=u(e);var r;if(!w(o)&&(Wo(o)||Vo(r=o)&&"http://www.w3.org/2000/svg"===r.namespaceURI))return n?co(yn.fromDom(o),Wa(t)):("float"===(t=t.replace(/-(\D)/g,((e,t)=>t.toUpperCase())))&&(t="cssFloat"),o.style?o.style[t]:void 0)},k=e=>{const t=u(e);if(!t)return{w:0,h:0};let n=_(t,"width"),o=_(t,"height");return n&&-1!==n.indexOf("px")||(n="0"),o&&-1!==o.indexOf("px")||(o="0"),{w:parseInt(n,10)||t.offsetWidth||t.clientWidth,h:parseInt(o,10)||t.offsetHeight||t.clientHeight}},N=(e,t)=>{if(!e)return!1;const n=b(e)?e:[e];return V(n,(e=>wn(yn.fromDom(e),t)))},R=(e,t,n,o)=>{const r=[];let s=u(e);o=void 0===o;const a=n||("BODY"!==y().nodeName?y().parentNode:null);if(g(t))if("*"===t)t=Vo;else{const e=t;t=t=>N(t,e)}for(;s&&!(s===a||w(s.nodeType)||sr(s)||ar(s));){if(!t||t(s)){if(!o)return[s];r.push(s)}s=s.parentNode}return o?r:null},D=(e,t,n)=>{let o=t;if(e){g(t)&&(o=e=>N(e,t));for(let t=e[n];t;t=t[n])if(E(o)&&o(t))return t}return null},T=function(e,t,n){const o=null!=n?n:this;if(b(e)){const n=[];return ja(e,((e,r)=>{const s=u(e);s&&n.push(t.call(o,s,r))})),n}{const n=u(e);return!!n&&t.call(o,n)}},O=(e,t)=>{T(e,(e=>{he(t,((t,n)=>{v(e,n,t)}))}))},B=(e,t)=>{T(e,(e=>{const n=yn.fromDom(e);So(n,t)}))},P=(t,n,o,r,s)=>T(t,(t=>{const a=g(n)?e.createElement(n):n;return x(o)&&O(a,o),r&&(!g(r)&&r.nodeType?a.appendChild(r):g(r)&&B(a,r)),s?a:t.appendChild(a)})),L=(t,n,o)=>P(e.createElement(t),t,n,o,!0),M=ia.encodeAllRaw,I=(e,t)=>T(e,(e=>{const n=yn.fromDom(e);return t&&K(Ln(n),(e=>{Gt(e)&&0===e.dom.length?xo(e):po(n,e)})),xo(n),n.dom})),F=(e,t,n)=>{T(e,(e=>{if(Vo(e)){const o=yn.fromDom(e),r=t.split(" ");K(r,(e=>{x(n)?(n?fn:pn)(o,e):hn(o,e)}))}}))},U=(e,t,n)=>T(t,(o=>{var r;const s=b(t)?e.cloneNode(!0):e;return n&&ja(Ha(o.childNodes),(e=>{s.appendChild(e)})),null===(r=o.parentNode)||void 0===r||r.replaceChild(s,o),o})),z=e=>{if(Vo(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},j=()=>e.createRange(),H=(n,r,s,a)=>{if(b(n)){let e=n.length;const t=[];for(;e--;)t[e]=H(n[e],r,s,a);return t}return!t.collect||n!==e&&n!==o||i.push([n,r,s,a]),c.bind(n,r,s,a||W)},$=(t,n,r)=>{if(b(t)){let e=t.length;const o=[];for(;e--;)o[e]=$(t[e],n,r);return o}if(i.length>0&&(t===e||t===o)){let e=i.length;for(;e--;){const[o,s,a]=i[e];t!==o||n&&n!==s||r&&r!==a||c.unbind(o,s,a)}}return c.unbind(t,n,r)},q=e=>{if(e&&Wo(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},W={doc:e,settings:t,win:o,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:a,boundEvents:i,styles:d,schema:l,events:c,isBlock:e=>g(e)?ke(m,e):Vo(e)&&(ke(m,e.nodeName)||Ls(l,e)),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:y,getViewPort:e=>{const t=Fo(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=u(e),n=C(t),o=k(t);return{x:n.x,y:n.y,w:o.w,h:o.h}},getSize:k,getParent:(e,t,n)=>{const o=R(e,t,n,!1);return o&&o.length>0?o[0]:null},getParents:R,get:u,getNext:(e,t)=>D(e,t,"nextSibling"),getPrev:(e,t)=>D(e,t,"previousSibling"),select:(n,o)=>{var r,s;const a=null!==(s=null!==(r=u(o))&&void 0!==r?r:t.root_element)&&void 0!==s?s:e;return E(a.querySelectorAll)?ue(a.querySelectorAll(n)):[]},is:N,add:P,create:L,createHTML:(e,t,n="")=>{let o="<"+e;for(const e in t)Se(t,e)&&(o+=" "+e+'="'+M(t[e])+'"');return Qe(n)&&ke(l.getVoidElements(),e)?o+" />":o+">"+n+"</"+e+">"},createFragment:t=>{const n=e.createElement("div"),o=e.createDocumentFragment();let r;for(o.appendChild(n),t&&(n.innerHTML=t);r=n.firstChild;)o.appendChild(r);return o.removeChild(n),o},remove:I,setStyle:(e,n,o)=>{T(e,(e=>{const r=yn.fromDom(e);Ga(r,n,o),t.update_styles&&Ya(d,r)}))},getStyle:_,setStyles:(e,n)=>{T(e,(e=>{const o=yn.fromDom(e);he(n,((e,t)=>{Ga(o,t,e)})),t.update_styles&&Ya(d,o)}))},removeAllAttribs:e=>T(e,(e=>{const t=e.attributes;for(let n=t.length-1;n>=0;n--)e.removeAttributeNode(t.item(n))})),setAttrib:v,setAttribs:O,getAttrib:p,getPos:C,parseStyle:e=>d.parse(e),serializeStyle:(e,t)=>d.serialize(e,t),addStyle:t=>{if(W!==Xa.DOM&&e===document){if(n[t])return;n[t]=!0}let o=e.getElementById("mceDefaultStyles");if(!o){o=e.createElement("style"),o.id="mceDefaultStyles",o.type="text/css";const t=e.head;t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o)}o.styleSheet?o.styleSheet.cssText+=t:o.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),K(e.split(","),(e=>{r[e]=!0,a.load(e).catch(S)}))},addClass:(e,t)=>{F(e,t,!0)},removeClass:(e,t)=>{F(e,t,!1)},hasClass:(e,t)=>{const n=f(e),o=t.split(" ");return x(n)&&re(o,(e=>bn(n,e)))},toggleClass:F,show:e=>{T(e,(e=>go(yn.fromDom(e),"display")))},hide:e=>{T(e,(e=>io(yn.fromDom(e),"display","none")))},isHidden:e=>{const t=f(e);return x(t)&&Lt(uo(t,"display"),"none")},uniqueId:e=>(e||"mce_")+s++,setHTML:B,getOuterHTML:e=>{const t=f(e);return x(t)?Vo(t.dom)?t.dom.outerHTML:(e=>{const t=yn.fromTag("div"),n=yn.fromDom(e.dom.cloneNode(!0));return vo(t,n),ko(t)})(t):""},setOuterHTML:(e,t)=>{T(e,(e=>{Vo(e)&&(e.outerHTML=t)}))},decode:ia.decode,encode:M,insertAfter:(e,t)=>{const n=u(t);return T(e,(e=>{const t=null==n?void 0:n.parentNode,o=null==n?void 0:n.nextSibling;return t&&(o?t.insertBefore(e,o):t.appendChild(e)),e}))},replace:U,rename:(e,t)=>{if(e.nodeName!==t.toUpperCase()){const n=L(t);return ja(h(e),(t=>{v(n,t.nodeName,p(e,t.nodeName))})),U(n,e,!0),n}return e},findCommonAncestor:(e,t)=>{let n=e;for(;n;){let e=t;for(;e&&n!==e;)e=e.parentNode;if(n===e)break;n=n.parentNode}return!n&&e.ownerDocument?e.ownerDocument.documentElement:n},run:T,getAttribs:h,isEmpty:(e,t,n)=>{let o=0;if(z(e))return!1;const r=e.firstChild;if(r){const s=new Ho(r,e),a=l?l.getWhitespaceElements():{},i=t||(l?l.getNonEmptyElements():null);let d=r;do{if(Vo(d)){const e=d.getAttribute("data-mce-bogus");if(e){d=s.next("all"===e);continue}const t=d.nodeName.toLowerCase();if(i&&i[t]){if("br"===t){o++,d=s.next();continue}return!1}if(z(d))return!1}if(rr(d))return!1;if(tr(d)&&!is(d.data)&&(!(null==n?void 0:n.includeZwsp)||!ls(d.data)))return!1;if(tr(d)&&d.parentNode&&a[d.parentNode.nodeName]&&is(d.data))return!1;d=s.next()}while(d)}return o<=1},createRng:j,nodeIndex:Ka,split:(e,t,n)=>{let o,r,s=j();if(e&&t&&e.parentNode&&t.parentNode){const a=e.parentNode;return s.setStart(a,Ka(e)),s.setEnd(t.parentNode,Ka(t)),o=s.extractContents(),s=j(),s.setStart(t.parentNode,Ka(t)+1),s.setEnd(a,Ka(e)+1),r=s.extractContents(),a.insertBefore(Ks(W,o,l),e),n?a.insertBefore(n,e):a.insertBefore(t,e),a.insertBefore(Ks(W,r,l),e),I(e),n||t}},bind:H,unbind:$,fire:(e,t,n)=>c.dispatch(e,t,n),dispatch:(e,t,n)=>c.dispatch(e,t,n),getContentEditable:q,getContentEditableParent:e=>{const t=y();let n=null;for(let o=e;o&&o!==t&&(n=q(o),null===n);o=o.parentNode);return n},isEditable:e=>{if(x(e)){const t=Vo(e)?e:e.parentElement;return x(t)&&Wo(t)&&oo(yn.fromDom(t))}return!1},destroy:()=>{if(i.length>0){let e=i.length;for(;e--;){const[t,n,o]=i[e];c.unbind(t,n,o)}}he(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},Y=((e,t,n)=>{const o=t.keep_values,r={set:(e,o,r)=>{const s=yn.fromDom(e);E(t.url_converter)&&x(o)&&(o=t.url_converter.call(t.url_converter_scope||n(),String(o),r,e)),Va(s,"data-mce-"+r,o),Va(s,r,o)},get:(e,t)=>{const n=yn.fromDom(e);return nn(n,"data-mce-"+t)||nn(n,t)}},s={style:{set:(t,n)=>{const r=yn.fromDom(t);o&&Va(r,$a,n),sn(r,"style"),g(n)&&lo(r,e.parse(n))},get:t=>{const n=yn.fromDom(t),o=nn(n,$a)||nn(n,"style");return e.serialize(e.parse(o),qt(n))}}};return o&&(s.href=s.src=r),s})(d,t,A(W));return W};Xa.DOM=Xa(document),Xa.nodeIndex=Ka;const Qa=Xa.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,n)=>{const o=Qa;let r;const s=()=>{o.remove(a),r&&(r.onerror=r.onload=r=null)},a=o.uniqueId();r=document.createElement("script"),r.id=a,r.type="text/javascript",r.src=Pt._addCacheSuffix(e),this.settings.referrerPolicy&&o.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{s(),t()},r.onerror=()=>{s(),n("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(((n,o)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:n,reject:o})}))}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,n=(e,n)=>{_e(t.scriptLoadedCallbacks,n).each((t=>{K(t,(t=>t[e](n)))})),delete t.scriptLoadedCallbacks[n]},o=e=>{const t=X(e,(e=>"rejected"===e.status));return t.length>0?Promise.reject(oe(t,(({reason:e})=>b(e)?e:[e]))):Promise.resolve()},r=e=>Promise.allSettled(W(e,(e=>2===t.states[e]?(n("resolve",e),Promise.resolve()):3===t.states[e]?(n("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then((()=>{t.states[e]=2,n("resolve",e);const s=t.queue;return s.length>0?(t.queue=[],r(s).then(o)):Promise.resolve()}),(()=>(t.states[e]=3,n("reject",e),Promise.reject(e)))))))),s=e=>(t.loading=!0,r(e).then((e=>{t.loading=!1;const n=t.queueLoadedCallbacks.shift();return U.from(n).each(M),o(e)}))),a=Ne(e);return t.loading?new Promise(((e,n)=>{t.queueLoadedCallbacks.push((()=>{s(a).then(e,n)}))})):s(a)}}Ja.ScriptLoader=new Ja;const Za=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},ei={},ti=Za("en"),ni=()=>_e(ei,ti.get()),oi={getData:()=>be(ei,(e=>({...e}))),setCode:e=>{e&&ti.set(e)},getCode:()=>ti.get(),add:(e,t)=>{let n=ei[e];n||(ei[e]=n={});const o=W(ge(t),(e=>e.toLowerCase()));he(t,((e,r)=>{const s=r.toLowerCase();s!==r&&((e,t)=>{const n=e.indexOf(t);return-1!==n&&e.indexOf(t,n+1)>n})(o,s)?(ke(t,s)||(n[s]=e),n[r]=e):n[s]=e}))},translate:e=>{const t=ni().getOr({}),n=e=>E(e)?Object.prototype.toString.call(e):o(e)?"":""+e,o=e=>""===e||null==e,r=e=>{const o=n(e);return ke(t,o)?n(t[o]):_e(t,o.toLowerCase()).map(n).getOr(o)},s=e=>e.replace(/{context:\w+}$/,"");if(o(e))return"";if(p(a=e)&&ke(a,"raw"))return n(e.raw);var a;if((e=>b(e)&&e.length>1)(e)){const t=e.slice(1);return s(r(e[0]).replace(/\{([0-9]+)\}/g,((e,o)=>ke(t,o)?n(t[o]):e)))}return s(r(e))},isRtl:()=>ni().bind((e=>_e(e,"_dir"))).exists((e=>"rtl"===e)),hasCode:e=>ke(ei,e)},ri=()=>{const e=[],t={},n={},o=[],r=(e,t)=>{const n=X(o,(n=>n.name===e&&n.state===t));K(n,(e=>e.resolve()))},s=e=>ke(t,e),a=(e,n)=>{const o=oi.getCode();!o||n&&-1===(","+(n||"")+",").indexOf(","+o+",")||Ja.ScriptLoader.add(t[e]+"/langs/"+o+".js")},i=(e,t="added")=>"added"===t&&(e=>ke(n,e))(e)||"loaded"===t&&s(e)?Promise.resolve():new Promise((n=>{o.push({name:e,state:t,resolve:n})}));return{items:e,urls:t,lookup:n,get:e=>{if(n[e])return n[e].instance},requireLangPack:(e,t)=>{!1!==ri.languageLoad&&(s(e)?a(e,t):i(e,"loaded").then((()=>a(e,t))))},add:(t,o)=>(e.push(o),n[t]={instance:o},r(t,"added"),o),remove:e=>{delete t[e],delete n[e]},createUrl:(e,t)=>g(t)?g(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,o)=>{if(t[e])return Promise.resolve();let s=g(o)?o:o.prefix+o.resource+o.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 n[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=Za(U.none()),n=()=>t.get().each((e=>clearInterval(e)));return{clear:()=>{n(),t.set(U.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:o=>{n(),t.set(U.some(setInterval(o,e)))}}},ai=()=>{const e=(e=>{const t=Za(U.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(U.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(U.some(e))}}})(S);return{...e,on:t=>e.get().each(t)}},ii=(e,t)=>{let n=null;return{cancel:()=>{v(n)||(clearTimeout(n),n=null)},throttle:(...o)=>{v(n)&&(n=setTimeout((()=>{n=null,e.apply(null,o)}),t))}}},li=(e,t)=>{let n=null;const o=()=>{v(n)||(clearTimeout(n),n=null)};return{cancel:o,throttle:(...r)=>{o(),n=setTimeout((()=>{n=null,e.apply(null,r)}),t)}}},di=A("mce-annotation"),ci=A("data-mce-annotation"),mi=A("data-mce-annotation-uid"),ui=A("data-mce-annotation-active"),fi=A("data-mce-annotation-classes"),gi=A("data-mce-annotation-attrs"),pi=e=>t=>En(t,e),hi=(e,t)=>{const n=e.selection.getRng(),o=yn.fromDom(n.startContainer),r=yn.fromDom(e.getBody()),s=t.fold((()=>"."+di()),(e=>`[${ci()}="${e}"]`)),a=Mn(o,n.startOffset).getOr(o);return no(a,s,pi(r)).bind((t=>on(t,`${mi()}`).bind((n=>on(t,`${ci()}`).map((t=>{const o=vi(e,n);return{uid:n,name:t,elements:o}}))))))},bi=(e,t)=>rn(e,"data-mce-bogus")||jo(e,'[data-mce-bogus="all"]',pi(t)),vi=(e,t)=>{const n=yn.fromDom(e.getBody()),o=zo(n,`[${mi()}="${t}"]`);return X(o,(e=>!bi(e,n)))},yi=(e,t)=>{const n=yn.fromDom(e.getBody()),o=zo(n,`[${ci()}="${t}"]`),r={};return K(o,(e=>{if(!bi(e,n)){const t=nn(e,mi()),n=_e(r,t).getOr([]);r[t]=n.concat([e])}})),r},Ci=(e,t)=>{const n=Za({}),o=()=>({listeners:[],previous:ai()}),r=(e,t)=>{s(e,(e=>(t(e),e)))},s=(e,t)=>{const r=n.get(),s=t(_e(r,e).getOrThunk(o));r[e]=s,n.set(r)},a=(t,n)=>{K(vi(e,t),(e=>{n?en(e,ui(),"true"):sn(e,ui())}))},i=li((()=>{const n=le(t.getNames());K(n,(t=>{s(t,(n=>{const o=n.previous.get();return hi(e,U.some(t)).fold((()=>{o.each((e=>{(e=>{r(e,(t=>{K(t.listeners,(t=>t(!1,e)))}))})(t),n.previous.clear(),a(e,!1)}))}),(({uid:e,name:t,elements:s})=>{Lt(o,e)||(o.each((e=>a(e,!1))),((e,t,n)=>{r(e,(o=>{K(o.listeners,(o=>o(!0,e,{uid:t,nodes:W(n,(e=>e.dom))})))}))})(t,e,s),n.previous.set(e),a(e,!0))})),{previous:n.previous,listeners:n.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 wi=0;const xi=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return wi++,e+"_"+n+wi+String(t)},Ei=(e,t)=>yn.fromDom(e.dom.cloneNode(t)),_i=e=>Ei(e,!1),ki=e=>Ei(e,!0),Si=(e,t)=>{const n=((e,t)=>{const n=yn.fromTag(t),o=an(e);return tn(n,o),n})(e,t);ho(e,n);const o=Ln(e);return Co(n,o),xo(e),n},Ni=(e,t,n=I)=>{const o=new Ho(e,t),r=e=>{let t;do{t=o[e]()}while(t&&!tr(t)&&!n(t));return U.from(t).filter(tr)};return{current:()=>U.from(o.current()).filter(tr),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},Ri=(e,t)=>{const n=t||(t=>e.isBlock(t)||ir(t)||cr(t)),o=(e,t,n,r)=>{if(tr(e)){const n=r(e,t,e.data);if(-1!==n)return U.some({container:e,offset:n})}return n().bind((e=>o(e.container,e.offset,n,r)))};return{backwards:(t,r,s,a)=>{const i=Ni(t,null!=a?a:e.getRoot(),n);return o(t,r,(()=>i.prev().map((e=>({container:e,offset:e.length})))),s).getOrNull()},forwards:(t,r,s,a)=>{const i=Ni(t,null!=a?a:e.getRoot(),n);return o(t,r,(()=>i.next().map((e=>({container:e,offset:0})))),s).getOrNull()}}},Ai=Math.round,Di=e=>e?{left:Ai(e.left),top:Ai(e.top),bottom:Ai(e.bottom),right:Ai(e.right),width:Ai(e.width),height:Ai(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},Ti=(e,t)=>(e=Di(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),Oi=(e,t,n)=>e>=0&&e<=Math.min(t.height,n.height)/2,Bi=(e,t)=>{const n=Math.min(t.height/2,e.height/2);return e.bottom-n<t.top||!(e.top>t.bottom)&&Oi(t.top-e.bottom,e,t)},Pi=(e,t)=>e.top>t.bottom||!(e.bottom<t.top)&&Oi(t.bottom-e.top,e,t),Li=(e,t,n)=>{const o=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(n,e.top+e.height),e.top);return Math.sqrt((t-o)*(t-o)+(n-r)*(n-r))},Mi=e=>{const t=e.startContainer,n=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===n+1?t.childNodes[n]:null},Ii=(e,t)=>{if(Vo(e)&&e.hasChildNodes()){const n=e.childNodes,o=((e,t,n)=>Math.min(Math.max(e,t),n))(t,0,n.length-1);return n[o]}return e},Fi=new RegExp("[̀-ͯ҃-҇҈-҉֑-ֽֿׁ-ׂׄ-ׇׅؐ-ًؚ-ٰٟۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣣ-ंऺ़ु-ै्॑-ॗॢ-ॣঁ়াু-ৄ্ৗৢ-ৣਁ-ਂ਼ੁ-ੂੇ-ੈੋ-੍ੑੰ-ੱੵઁ-ં઼ુ-ૅે-ૈ્ૢ-ૣଁ଼ାିୁ-ୄ୍ୖୗୢ-ୣஂாீ்ௗఀా-ీె-ైొ-్ౕ-ౖౢ-ౣಁ಼ಿೂೆೌ-್ೕ-ೖೢ-ೣഁാു-ൄ്ൗൢ-ൣ්ාි-ුූෟัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-ཱ༹༙༵༷-ཾྀ-྄྆-྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္-်ွ-ှၘ-ၙၞ-ၠၱ-ၴႂႅ-ႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳ឴-឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧ-ᤨᤲ᤹-᤻ᨗ-ᨘᨛᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼᪰-᪽᪾ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀ-ᮁᮢ-ᮥᮨ-ᮩ᮫-ᮭ᯦ᯨ-ᯩᯭᯯ-ᯱᰬ-ᰳᰶ-᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᳸-᳹᷀-᷵᷼-᷿-⃐-⃜⃝-⃠⃡⃢-⃤⃥-⃰⳯-⵿⳱ⷠ-〪ⷿ-〭〮-゙〯-゚꙯꙰-꙲ꙴ-꙽ꚞ-ꚟ꛰-꛱ꠂ꠆ꠋꠥ-ꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꧥꨩ-ꨮꨱ-ꨲꨵ-ꨶꩃꩌꩼꪰꪲ-ꪴꪷ-ꪸꪾ-꪿꫁ꫬ-ꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-゙︯-゚]"),Ui=e=>g(e)&&e.charCodeAt(0)>=768&&Fi.test(e),zi=Vo,ji=os,Hi=Go("display","block table"),$i=Go("float","left right"),qi=((...e)=>t=>{for(let n=0;n<e.length;n++)if(!e[n](t))return!1;return!0})(zi,ji,B($i)),Vi=B(Go("white-space","pre pre-line pre-wrap")),Wi=tr,Ki=ir,Yi=Xa.nodeIndex,Gi=(e,t)=>t<0&&Vo(e)&&e.hasChildNodes()?void 0:Ii(e,t),Xi=e=>e?e.createRange():Xa.DOM.createRng(),Qi=e=>g(e)&&/[\r\n\t ]/.test(e),Ji=e=>!!e.setStart&&!!e.setEnd,Zi=e=>{const t=e.startContainer,n=e.startOffset;if(Qi(e.toString())&&Vi(t.parentNode)&&tr(t)){const e=t.data;if(Qi(e[n-1])||Qi(e[n+1]))return!0}return!1},el=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,tl=e=>{var t;let n;const o=e.getClientRects();return n=o.length>0?Di(o[0]):Di(e.getBoundingClientRect()),!Ji(e)&&Ki(e)&&el(n)?(e=>{const t=e.ownerDocument,n=Xi(t),o=t.createTextNode(vr),r=e.parentNode;r.insertBefore(o,e),n.setStart(o,0),n.setEnd(o,1);const s=Di(n.getBoundingClientRect());return r.removeChild(o),s})(e):el(n)&&Ji(e)&&null!==(t=(e=>{const t=e.startContainer,n=e.endContainer,o=e.startOffset,r=e.endOffset;if(t===n&&tr(n)&&0===o&&1===r){const t=e.cloneRange();return t.setEndAfter(n),tl(t)}return null})(e))&&void 0!==t?t:n},nl=(e,t)=>{const n=Ti(e,t);return n.width=1,n.right=n.left+1,n},ol=e=>{const t=[],n=e=>{var n,o;0!==e.height&&(t.length>0&&(n=e,o=t[t.length-1],n.left===o.left&&n.top===o.top&&n.bottom===o.bottom&&n.right===o.right)||t.push(e))},o=(e,t)=>{const o=Xi(e.ownerDocument);if(t<e.data.length){if(Ui(e.data[t]))return;if(Ui(e.data[t-1])&&(o.setStart(e,t),o.setEnd(e,t+1),!Zi(o)))return void n(nl(tl(o),!1))}t>0&&(o.setStart(e,t-1),o.setEnd(e,t),Zi(o)||n(nl(tl(o),!1))),t<e.data.length&&(o.setStart(e,t),o.setEnd(e,t+1),Zi(o)||n(nl(tl(o),!0)))},r=e.container(),s=e.offset();if(Wi(r))return o(r,s),t;if(zi(r))if(e.isAtEnd()){const e=Gi(r,s);Wi(e)&&o(e,e.data.length),qi(e)&&!Ki(e)&&n(nl(tl(e),!1))}else{const a=Gi(r,s);if(Wi(a)&&o(a,0),qi(a)&&e.isAtEnd())return n(nl(tl(a),!1)),t;const i=Gi(e.container(),e.offset()-1);qi(i)&&!Ki(i)&&(Hi(i)||Hi(a)||!qi(a))&&n(nl(tl(i),!1)),qi(a)&&n(nl(tl(a),!0))}return t},rl=(e,t,n)=>{const o=()=>(n||(n=ol(rl(e,t))),n);return{container:A(e),offset:A(t),toRange:()=>{const n=Xi(e.ownerDocument);return n.setStart(e,t),n.setEnd(e,t),n},getClientRects:o,isVisible:()=>o().length>0,isAtStart:()=>(Wi(e),0===t),isAtEnd:()=>Wi(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:n=>n&&e===n.container()&&t===n.offset(),getNode:n=>Gi(e,n?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,Yi(e)+1),rl.before=e=>rl(e.parentNode,Yi(e)),rl.isAbove=(e,t)=>It(ce(t.getClientRects()),me(e.getClientRects()),Bi).getOr(!1),rl.isBelow=(e,t)=>It(me(t.getClientRects()),ce(e.getClientRects()),Pi).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,n)=>{ar(n)?((e,t,n)=>{const o=U.from(n.firstChild),r=U.from(n.lastChild);t.insertNode(n),o.each((t=>sl(e,t.previousSibling))),r.each((t=>sl(e,t.nextSibling)))})(e,t,n):((e,t,n)=>{t.insertNode(n),sl(e,n.previousSibling),sl(e,n.nextSibling)})(e,t,n)},il=tr,ll=Qo,dl=Xa.nodeIndex,cl=e=>{const t=e.parentNode;return ll(t)?cl(t):t},ml=e=>e?Be(e.childNodes,((e,t)=>(ll(t)&&"BR"!==t.nodeName?e=e.concat(ml(t)):e.push(t),e)),[]):[],ul=e=>t=>e===t,fl=e=>(il(e)?"text()":e.nodeName.toLowerCase())+"["+(e=>{let t,n;t=ml(cl(e)),n=Pe(t,ul(e),e),t=t.slice(0,n+1);const o=Be(t,((e,n,o)=>(il(n)&&il(t[o-1])&&e++,e)),0);return t=Oe(t,Yo([e.nodeName])),n=Pe(t,ul(e),e),n-o})(e)+"]",gl=(e,t)=>{let n,o=[],r=t.container(),s=t.offset();if(il(r))n=((e,t)=>{let n=e;for(;(n=n.previousSibling)&&il(n);)t+=n.data.length;return t})(r,s);else{const e=r.childNodes;s>=e.length?(n="after",s=e.length-1):n="before",r=e[s]}o.push(fl(r));let a=((e,t,n)=>{const o=[];for(let r=t.parentNode;r&&r!==e&&(!n||!n(r));r=r.parentNode)o.push(r);return o})(e,r);return a=Oe(a,B(Qo)),o=o.concat(Te(a,(e=>fl(e)))),o.reverse().join("/")+","+n},pl=(e,t)=>{if(!t)return null;const n=t.split(","),o=n[0].split("/"),r=n.length>1?n[1]:"before",s=Be(o,((e,t)=>{const n=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return n?("text()"===n[1]&&(n[1]="#text"),((e,t,n)=>{let o=ml(e);return o=Oe(o,((e,t)=>!il(e)||!il(o[t-1]))),o=Oe(o,Yo([t])),o[n]})(e,n[1],parseInt(n[2],10))):null}),e);if(!s)return null;if(!il(s)&&s.parentNode){let e;return e="after"===r?dl(s)+1:dl(s),rl(s.parentNode,e)}return((e,t)=>{let n=e,o=0;for(;il(n);){const r=n.data.length;if(t>=o&&t<=o+r){e=n,t-=o;break}if(!il(n.nextSibling)){e=n,t=r;break}o+=r,n=n.nextSibling}return il(e)&&t>e.data.length&&(t=e.data.length),rl(e,t)})(s,parseInt(r,10))},hl=cr,bl=(e,t,n,o,r)=>{const s=r?o.startContainer:o.endContainer;let a=r?o.startOffset:o.endOffset;const i=[],l=e.getRoot();if(tr(s))i.push(n?((e,t,n)=>{let o=e(t.data.slice(0,n)).length;for(let n=t.previousSibling;n&&tr(n);n=n.previousSibling)o+=e(n.data).length;return o})(t,s,a):a);else{let t=0;const o=s.childNodes;a>=o.length&&o.length&&(t=1,a=Math.max(0,o.length-1)),i.push(e.nodeIndex(o[a],n)+t)}for(let t=s;t&&t!==l;t=t.parentNode)i.push(e.nodeIndex(t,n));return i},vl=(e,t,n)=>{let o=0;return Pt.each(e.select(t),(e=>"all"===e.getAttribute("data-mce-bogus")?void 0:e!==n&&void o++)),o},yl=(e,t)=>{let n=t?e.startContainer:e.endContainer,o=t?e.startOffset:e.endOffset;if(Vo(n)&&"TR"===n.nodeName){const r=n.childNodes;n=r[Math.min(t?o:o-1,r.length-1)],n&&(o=t?0:n.childNodes.length,t?e.setStart(n,o):e.setEnd(n,o))}},Cl=e=>(yl(e,!0),yl(e,!1),e),wl=(e,t)=>{if(Vo(e)&&(e=Ii(e,t),hl(e)))return e;if(jr(e)){tr(e)&&Ur(e)&&(e=e.parentNode);let t=e.previousSibling;if(hl(t))return t;if(t=e.nextSibling,hl(t))return t}},xl=(e,t,n)=>{const o=n.getNode(),r=n.getRng();if("IMG"===o.nodeName||hl(o)){const e=o.nodeName;return{name:e,index:vl(n.dom,e,o)}}const s=(e=>wl(e.startContainer,e.startOffset)||wl(e.endContainer,e.endOffset))(r);if(s){const e=s.tagName;return{name:e,index:vl(n.dom,e,s)}}return((e,t,n,o)=>{const r=t.dom,s=bl(r,e,n,o,!0),a=t.isForward(),i=Yr(o)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:s,forward:a,...i}:{start:s,end:bl(r,e,n,o,!1),forward:a,...i}})(e,n,t,r)},El=(e,t,n)=>{const o={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return n?e.create("span",o,""):e.create("span",o)},_l=(e,t)=>{const n=e.dom;let o=e.getRng();const r=n.uniqueId(),s=e.isCollapsed(),a=e.getNode(),i=a.nodeName,l=e.isForward();if("IMG"===i)return{name:i,index:vl(n,i,a)};const d=Cl(o.cloneRange());if(!s){d.collapse(!1);const e=El(n,r+"_end",t);al(n,d,e)}o=Cl(o),o.collapse(!0);const c=El(n,r+"_start",t);return al(n,o,c),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},kl=(e,t,n=!1)=>2===t?xl(Mr,n,e):3===t?(e=>{const t=e.getRng();return{start:gl(e.dom.getRoot(),rl.fromRangeStart(t)),end:gl(e.dom.getRoot(),rl.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):_l(e,!1),Sl=O(xl,D,!0),Nl=e=>{const t=t=>t(e),n=A(e),o=()=>r,r={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:F,isError:I,map:t=>Al.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:n,or:o,getOrThunk:n,orThunk:o,getOrDie:n,each:t=>{t(e)},toOptional:()=>U.some(e)};return r},Rl=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:I,isError:F,map:t,mapError:t=>Al.error(t(e)),bind:t,exists:I,forall:F,getOr:D,or:D,getOrThunk:L,orThunk:L,getOrDie:P(String(e)),each:S,toOptional:U.none};return n},Al={value:Nl,error:Rl,fromOption:(e,t)=>e.fold((()=>Rl(t)),Nl)},Dl=e=>{if(!b(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=[],n={};return K(e,((o,r)=>{const s=ge(o);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=o[a];if(void 0!==n[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!b(i))throw new Error("case arguments must be an array");t.push(a),n[a]=(...n)=>{const o=n.length;if(o!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+o);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,n)},match:e=>{const o=ge(e);if(t.length!==o.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+o.join(","));if(!re(t,(e=>q(o,e))))throw new Error("Not all branches were specified when using match. Specified: "+o.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:a,params:n})}}}})),n};Dl([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Tl=e=>"inline-command"===e.type||"inline-format"===e.type,Ol=e=>"block-command"===e.type||"block-format"===e.type,Bl=e=>{const t=t=>Al.error({message:t,pattern:e}),n=(n,o,r)=>{if(void 0!==e.format){let r;if(b(e.format)){if(!re(e.format,g))return t(n+" pattern has non-string items in the `format` array");r=e.format}else{if(!g(e.format))return t(n+" pattern has non-string `format` parameter");r=[e.format]}return Al.value(o(r))}return void 0!==e.cmd?g(e.cmd)?Al.value(r(e.cmd,e.value)):t(n+" pattern has non-string `cmd` parameter"):t(n+" pattern is missing both `format` and `cmd` parameters")};if(!p(e))return t("Raw pattern is not an object");if(!g(e.start))return t("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!g(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 o=e.start,r=e.end;return 0===r.length&&(r=o,o=""),n("Inline",(e=>({type:"inline-format",start:o,end:r,format:e})),((e,t)=>({type:"inline-command",start:o,end:r,cmd:e,value:t})))}return void 0!==e.replacement?g(e.replacement)?0===e.start.length?t("Replacement pattern has empty `start` parameter"):Al.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"):n("Block",(t=>({type:"block-format",start:e.start,format:t[0]})),((t,n)=>({type:"block-command",start:e.start,cmd:t,value:n})))},Pl=e=>X(e,Ol),Ll=e=>X(e,Tl),Ml=e=>{const t=(e=>{const t=[],n=[];return K(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{n.push(e)}))})),{errors:t,values:n}})(W(e,Bl));return K(t.errors,(e=>console.error(e.message,e.pattern))),t.values},Il=Et().deviceType,Fl=Il.isTouch(),Ul=Xa.DOM,zl=e=>f(e,RegExp),jl=e=>t=>t.options.get(e),Hl=e=>g(e)||p(e),$l=(e,t="")=>n=>{const o=g(n);if(o){if(-1!==n.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return J(t,((e,t)=>{const n=t.split("="),o=n[0],r=n.length>1?n[1]:o;return e[Ke(o)]=Ke(r),e}),{})})(n);return{value:_e(r,e.id).getOr(t),valid:o}}return{value:n,valid:o}}return{valid:!1,message:"Must be a string."}},ql=jl("iframe_attrs"),Vl=jl("doctype"),Wl=jl("document_base_url"),Kl=jl("body_id"),Yl=jl("body_class"),Gl=jl("content_security_policy"),Xl=jl("br_in_pre"),Ql=jl("forced_root_block"),Jl=jl("forced_root_block_attrs"),Zl=jl("newline_behavior"),ed=jl("br_newline_selector"),td=jl("no_newline_selector"),nd=jl("keep_styles"),od=jl("end_container_on_empty_block"),rd=jl("automatic_uploads"),sd=jl("images_reuse_filename"),ad=jl("images_replace_blob_uris"),id=jl("icons"),ld=jl("icons_url"),dd=jl("images_upload_url"),cd=jl("images_upload_base_path"),md=jl("images_upload_credentials"),ud=jl("images_upload_handler"),fd=jl("content_css_cors"),gd=jl("referrer_policy"),pd=jl("language"),hd=jl("language_url"),bd=jl("indent_use_margin"),vd=jl("indentation"),yd=jl("content_css"),Cd=jl("content_style"),wd=jl("font_css"),xd=jl("directionality"),Ed=jl("inline_boundaries_selector"),_d=jl("object_resizing"),kd=jl("resize_img_proportional"),Sd=jl("placeholder"),Nd=jl("event_root"),Rd=jl("service_message"),Ad=jl("theme"),Dd=jl("theme_url"),Td=jl("model"),Od=jl("model_url"),Bd=jl("inline_boundaries"),Pd=jl("formats"),Ld=jl("preview_styles"),Md=jl("format_empty_lines"),Id=jl("format_noneditable_selector"),Fd=jl("custom_ui_selector"),Ud=jl("inline"),zd=jl("hidden_input"),jd=jl("submit_patch"),Hd=jl("add_form_submit_trigger"),$d=jl("add_unload_trigger"),qd=jl("custom_undo_redo_levels"),Vd=jl("disable_nodechange"),Wd=jl("readonly"),Kd=jl("editable_root"),Yd=jl("content_css_cors"),Gd=jl("plugins"),Xd=jl("external_plugins"),Qd=jl("block_unsupported_drop"),Jd=jl("visual"),Zd=jl("visual_table_class"),ec=jl("visual_anchor_class"),tc=jl("iframe_aria_text"),nc=jl("setup"),oc=jl("init_instance_callback"),rc=jl("urlconverter_callback"),sc=jl("auto_focus"),ac=jl("browser_spellcheck"),ic=jl("protect"),lc=jl("paste_block_drop"),dc=jl("paste_data_images"),cc=jl("paste_preprocess"),mc=jl("paste_postprocess"),uc=jl("newdocument_content"),fc=jl("paste_webkit_styles"),gc=jl("paste_remove_styles_if_webkit"),pc=jl("paste_merge_formats"),hc=jl("smart_paste"),bc=jl("paste_as_text"),vc=jl("paste_tab_spaces"),yc=jl("allow_html_data_urls"),Cc=jl("text_patterns"),wc=jl("text_patterns_lookup"),xc=jl("noneditable_class"),Ec=jl("editable_class"),_c=jl("noneditable_regexp"),kc=jl("preserve_cdata"),Sc=jl("highlight_on_focus"),Nc=jl("xss_sanitization"),Rc=jl("init_content_sync"),Ac=e=>Pt.explode(e.options.get("images_file_types")),Dc=jl("table_tab_navigation"),Tc=jl("details_initial_state"),Oc=jl("details_serialized_state"),Bc=jl("force_hex_color"),Pc=jl("sandbox_iframes"),Lc=Vo,Mc=tr,Ic=e=>{const t=e.parentNode;t&&t.removeChild(e)},Fc=e=>{const t=Mr(e);return{count:e.length-t.length,text:t}},Uc=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(Pr));)e.deleteData(t,1)},zc=(e,t)=>(qc(e),t),jc=(e,t)=>{const n=t.container(),o=((e,t)=>{const n=$(e,t);return-1===n?U.none():U.some(n)})(ue(n.childNodes),e).map((e=>e<t.offset()?rl(n,t.offset()-1):t)).getOr(t);return qc(e),o},Hc=(e,t)=>Mc(e)&&t.container()===e?((e,t)=>{const n=Fc(e.data.substr(0,t.offset())),o=Fc(e.data.substr(t.offset()));return(n.text+o.text).length>0?(Uc(e),rl(e,t.offset()-n.count)):t})(e,t):zc(e,t),$c=(e,t)=>rl.isTextPosition(t)?Hc(e,t):((e,t)=>t.container()===e.parentNode?jc(e,t):zc(e,t))(e,t),qc=e=>{Lc(e)&&jr(e)&&(Hr(e)?e.removeAttribute("data-mce-caret"):Ic(e)),Mc(e)&&(Uc(e),0===e.data.length&&Ic(e))},Vc=cr,Wc=fr,Kc=mr,Yc=(e,t,n)=>{const o=Ti(t.getBoundingClientRect(),n);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}o.left+=r,o.right+=r,o.top+=s,o.bottom+=s,o.width=1;let a=t.offsetWidth-t.clientWidth;return a>0&&(n&&(a*=-1),o.left+=a,o.right+=a),o},Gc=(e,t,n,o)=>{const r=ai();let s,a;const i=Ql(e),l=e.dom,d=()=>{(e=>{var t,n;const o=zo(yn.fromDom(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e<o.length;e++){const r=o[e].dom;let s=r.previousSibling;if(Wr(s)){const e=s.data;1===e.length?null===(t=s.parentNode)||void 0===t||t.removeChild(s):s.deleteData(e.length-1,1)}s=r.nextSibling,Vr(s)&&(1===s.data.length?null===(n=s.parentNode)||void 0===n||n.removeChild(s):s.deleteData(0,1))}})(t),a&&(qc(a),a=null),r.on((e=>{l.remove(e.caret),r.clear()})),s&&(clearInterval(s),s=void 0)},c=()=>{s=setInterval((()=>{r.on((e=>{o()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")}))}),500)};return{show:(e,o)=>{let s;if(d(),Kc(o))return null;if(!n(o))return a=((e,t)=>{var n;const o=(null!==(n=e.ownerDocument)&&void 0!==n?n:document).createTextNode(Pr),r=e.parentNode;if(t){const t=e.previousSibling;if(Fr(t)){if(jr(t))return t;if(Wr(t))return t.splitText(t.data.length-1)}null==r||r.insertBefore(o,e)}else{const t=e.nextSibling;if(Fr(t)){if(jr(t))return t;if(Vr(t))return t.splitText(1),t}e.nextSibling?null==r||r.insertBefore(o,e.nextSibling):null==r||r.appendChild(o)}return o})(o,e),s=o.ownerDocument.createRange(),Qc(a.nextSibling)?(s.setStart(a,0),s.setEnd(a,0)):(s.setStart(a,1),s.setEnd(a,1)),s;{const n=((e,t,n)=>{var o;const r=(null!==(o=t.ownerDocument)&&void 0!==o?o:document).createElement(e);r.setAttribute("data-mce-caret",n?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(Or().dom);const s=t.parentNode;return n?null==s||s.insertBefore(r,t):t.nextSibling?null==s||s.insertBefore(r,t.nextSibling):null==s||s.appendChild(r),r})(i,o,e),d=Yc(t,o,e);l.setStyle(n,"top",d.top),a=n;const m=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(m,{...d}),l.add(t,m),r.set({caret:m,element:o,before:e}),e&&l.addClass(m,"mce-visual-caret-before"),c(),s=o.ownerDocument.createRange(),s.setStart(n,0),s.setEnd(n,0)}return s},hide:d,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 n=Yc(t,e.element,e.before);l.setStyles(e.caret,{...n})}))},destroy:()=>clearInterval(s)}},Xc=()=>Dt.browser.isFirefox(),Qc=e=>Vc(e)||Wc(e),Jc=e=>(Qc(e)||Jo(e)&&Xc())&&An(yn.fromDom(e)).exists(oo),Zc=dr,em=cr,tm=fr,nm=Go("display","block table table-cell table-caption list-item"),om=jr,rm=Ur,sm=Vo,am=tr,im=os,lm=e=>e>0,dm=e=>e<0,cm=(e,t)=>{let n;for(;n=e(t);)if(!rm(n))return n;return null},mm=(e,t,n,o,r)=>{const s=new Ho(e,o),a=em(e)||rm(e);let i;if(dm(t)){if(a&&(i=cm(s.prev.bind(s),!0),n(i)))return i;for(;i=cm(s.prev.bind(s),r);)if(n(i))return i}if(lm(t)){if(a&&(i=cm(s.next.bind(s),!0),n(i)))return i;for(;i=cm(s.next.bind(s),r);)if(n(i))return i}return null},um=(e,t)=>{for(;e&&e!==t;){if(nm(e))return e;e=e.parentNode}return null},fm=(e,t,n)=>um(e.container(),n)===um(t.container(),n),gm=(e,t)=>{if(!t)return U.none();const n=t.container(),o=t.offset();return sm(n)?U.from(n.childNodes[o+e]):U.none()},pm=(e,t)=>{var n;const o=(null!==(n=t.ownerDocument)&&void 0!==n?n:document).createRange();return e?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),o},hm=(e,t,n)=>um(t,e)===um(n,e),bm=(e,t,n)=>{const o=e?"previousSibling":"nextSibling";let r=n;for(;r&&r!==t;){let e=r[o];if(e&&om(e)&&(e=e[o]),em(e)||tm(e)){if(hm(t,e,r))return e;break}if(im(e))break;r=r.parentNode}return null},vm=O(pm,!0),ym=O(pm,!1),Cm=(e,t,n)=>{let o;const r=O(bm,!0,t),s=O(bm,!1,t),a=n.startContainer,i=n.startOffset;if(Ur(a)){const e=am(a)?a.parentNode:a,t=e.getAttribute("data-mce-caret");if("before"===t&&(o=e.nextSibling,Jc(o)))return vm(o);if("after"===t&&(o=e.previousSibling,Jc(o)))return ym(o)}if(!n.collapsed)return n;if(tr(a)){if(om(a)){if(1===e){if(o=s(a),o)return vm(o);if(o=r(a),o)return ym(o)}if(-1===e){if(o=r(a),o)return ym(o);if(o=s(a),o)return vm(o)}return n}if(Wr(a)&&i>=a.data.length-1)return 1===e&&(o=s(a),o)?vm(o):n;if(Vr(a)&&i<=1)return-1===e&&(o=r(a),o)?ym(o):n;if(i===a.data.length)return o=s(a),o?vm(o):n;if(0===i)return o=r(a),o?ym(o):n}return n},wm=(e,t)=>gm(e?0:-1,t).filter(em),xm=(e,t,n)=>{const o=Cm(e,t,n);return-1===e?rl.fromRangeStart(o):rl.fromRangeEnd(o)},Em=e=>U.from(e.getNode()).map(yn.fromDom),_m=(e,t)=>{let n=t;for(;n=e(n);)if(n.isVisible())return n;return n},km=(e,t)=>{const n=fm(e,t);return!(n||!ir(e.getNode()))||n};var Sm;!function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"}(Sm||(Sm={}));const Nm=cr,Rm=tr,Am=Vo,Dm=ir,Tm=os,Om=e=>es(e)||(e=>!!rs(e)&&!J(ue(e.getElementsByTagName("*")),((e,t)=>e||Gr(t)),!1))(e),Bm=ss,Pm=(e,t)=>e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null,Lm=(e,t)=>{if(lm(e)){if(Tm(t.previousSibling)&&!Rm(t.previousSibling))return rl.before(t);if(Rm(t))return rl(t,0)}if(dm(e)){if(Tm(t.nextSibling)&&!Rm(t.nextSibling))return rl.after(t);if(Rm(t))return rl(t,t.data.length)}return dm(e)?Dm(t)?rl.before(t):rl.after(t):rl.before(t)},Mm=(e,t,n)=>{let o,r,s,a;if(!Am(n)||!t)return null;if(t.isEqual(rl.after(n))&&n.lastChild){if(a=rl.after(n.lastChild),dm(e)&&Tm(n.lastChild)&&Am(n.lastChild))return Dm(n.lastChild)?rl.before(n.lastChild):a}else a=t;const i=a.container();let l=a.offset();if(Rm(i)){if(dm(e)&&l>0)return rl(i,--l);if(lm(e)&&l<i.length)return rl(i,++l);o=i}else{if(dm(e)&&l>0&&(r=Pm(i,l-1),Tm(r)))return!Om(r)&&(s=mm(r,e,Bm,r),s)?Rm(s)?rl(s,s.data.length):rl.after(s):Rm(r)?rl(r,r.data.length):rl.before(r);if(lm(e)&&l<i.childNodes.length&&(r=Pm(i,l),Tm(r)))return Dm(r)?((e,t)=>{const n=t.nextSibling;return n&&Tm(n)?Rm(n)?rl(n,0):rl.before(n):Mm(Sm.Forwards,rl.after(t),e)})(n,r):!Om(r)&&(s=mm(r,e,Bm,r),s)?Rm(s)?rl(s,0):rl.before(s):Rm(r)?rl(r,0):rl.after(r);o=r||a.getNode()}if(o&&(lm(e)&&a.isAtEnd()||dm(e)&&a.isAtStart())&&(o=mm(o,e,F,n,!0),Bm(o,n)))return Lm(e,o);r=o?mm(o,e,Bm,n):o;const d=Le(X(((e,t)=>{const n=[];let o=e;for(;o&&o!==t;)n.push(o),o=o.parentNode;return n})(i,n),Nm));return!d||r&&d.contains(r)?r?Lm(e,r):null:(a=lm(e)?rl.after(d):rl.before(d),a)},Im=e=>({next:t=>Mm(Sm.Forwards,t,e),prev:t=>Mm(Sm.Backwards,t,e)}),Fm=e=>rl.isTextPosition(e)?0===e.offset():os(e.getNode()),Um=e=>{if(rl.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return os(e.getNode(!0))},zm=(e,t)=>!rl.isTextPosition(e)&&!rl.isTextPosition(t)&&e.getNode()===t.getNode(!0),jm=(e,t,n)=>{return e?!zm(t,n)&&(o=t,!(!rl.isTextPosition(o)&&ir(o.getNode())))&&Um(t)&&Fm(n):!zm(n,t)&&Fm(t)&&Um(n);var o},Hm=(e,t,n)=>{const o=Im(t);return U.from(e?o.next(n):o.prev(n))},$m=(e,t,n)=>Hm(e,t,n).bind((o=>fm(n,o,t)&&jm(e,n,o)?Hm(e,t,o):U.some(o))),qm=(e,t,n,o)=>$m(e,t,n).bind((n=>o(n)?qm(e,t,n,o):U.some(n))),Vm=(e,t)=>{const n=e?t.firstChild:t.lastChild;return tr(n)?U.some(rl(n,e?0:n.data.length)):n?os(n)?U.some(e?rl.before(n):ir(o=n)?rl.before(o):rl.after(o)):((e,t,n)=>{const o=e?rl.before(n):rl.after(n);return Hm(e,t,o)})(e,t,n):U.none();var o},Wm=O(Hm,!0),Km=O(Hm,!1),Ym=O(Vm,!0),Gm=O(Vm,!1),Xm="_mce_caret",Qm=e=>Vo(e)&&e.id===Xm,Jm=(e,t)=>{let n=t;for(;n&&n!==e;){if(Qm(n))return n;n=n.parentNode}return null},Zm=e=>ke(e,"name"),eu=e=>Pt.isArray(e.start),tu=e=>!(!Zm(e)&&y(e.forward))||e.forward,nu=(e,t)=>(Vo(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='<br data-mce-bogus="1" />'),t),ou=(e,t)=>Gm(e).fold(I,(e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0))),ru=(e,t,n)=>!(!(e=>!e.hasChildNodes())(t)||!Jm(e,t)||(((e,t)=>{var n;const o=(null!==(n=e.ownerDocument)&&void 0!==n?n:document).createTextNode(Pr);e.appendChild(o),t.setStart(o,0),t.setEnd(o,0)})(t,n),0)),su=(e,t,n,o)=>{const r=n[t?"start":"end"],s=e.getRoot();if(r){let e=s,n=r[0];for(let t=r.length-1;e&&t>=1;t--){const n=e.childNodes;if(ru(s,e,o))return!0;if(r[t]>n.length-1)return!!ru(s,e,o)||ou(e,o);e=n[r[t]]}tr(e)&&(n=Math.min(r[0],e.data.length)),Vo(e)&&(n=Math.min(r[0],e.childNodes.length)),t?o.setStart(e,n):o.setEnd(e,n)}return!0},au=e=>tr(e)&&e.data.length>0,iu=(e,t,n)=>{const o=e.get(n.id+"_"+t),r=null==o?void 0:o.parentNode,s=n.keep;if(o&&r){let a,i;if("start"===t?s?o.hasChildNodes()?(a=o.firstChild,i=1):au(o.nextSibling)?(a=o.nextSibling,i=0):au(o.previousSibling)?(a=o.previousSibling,i=o.previousSibling.data.length):(a=r,i=e.nodeIndex(o)+1):(a=r,i=e.nodeIndex(o)):s?o.hasChildNodes()?(a=o.firstChild,i=1):au(o.previousSibling)?(a=o.previousSibling,i=o.previousSibling.data.length):(a=r,i=e.nodeIndex(o)):(a=r,i=e.nodeIndex(o)),!s){const r=o.previousSibling,s=o.nextSibling;let l;for(Pt.each(Pt.grep(o.childNodes),(e=>{tr(e)&&(e.data=e.data.replace(/\uFEFF/g,""))}));l=e.get(n.id+"_"+t);)e.remove(l,!0);if(tr(s)&&tr(r)&&!Dt.browser.isOpera()){const t=r.data.length;r.appendData(s.data),e.remove(s),a=r,i=t}}return U.some(rl(a,i))}return U.none()},lu=(e,t)=>{const n=e.dom;if(t){if(eu(t))return((e,t)=>{const n=e.createRng();return su(e,!0,t,n)&&su(e,!1,t,n)?U.some({range:n,forward:tu(t)}):U.none()})(n,t);if((e=>g(e.start))(t))return((e,t)=>{const n=U.from(pl(e.getRoot(),t.start)),o=U.from(pl(e.getRoot(),t.end));return It(n,o,((n,o)=>{const r=e.createRng();return r.setStart(n.container(),n.offset()),r.setEnd(o.container(),o.offset()),{range:r,forward:tu(t)}}))})(n,t);if((e=>ke(e,"id"))(t))return((e,t)=>{const n=iu(e,"start",t),o=iu(e,"end",t);return It(n,o.or(n),((n,o)=>{const r=e.createRng();return r.setStart(nu(e,n.container()),n.offset()),r.setEnd(nu(e,o.container()),o.offset()),{range:r,forward:tu(t)}}))})(n,t);if(Zm(t))return((e,t)=>U.from(e.select(t.name)[t.index]).map((t=>{const n=e.createRng();return n.selectNode(t),{range:n,forward:!0}})))(n,t);if((e=>ke(e,"rng"))(t))return U.some({range:t.rng,forward:tu(t)})}return U.none()},du=(e,t,n)=>kl(e,t,n),cu=(e,t)=>{lu(e,t).each((({range:t,forward:n})=>{e.setRng(t,n)}))},mu=e=>Vo(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),uu=(fu=vr,e=>fu===e);var fu;const gu=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),pu=e=>!gu(e)&&!uu(e)&&!yr(e),hu=e=>{const t=[];if(e)for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t},bu=e=>X((e=>oe(e,(e=>{const t=Mi(e);return t?[yn.fromDom(t)]:[]})))(e),Ar),vu=(e,t)=>{const n=zo(t,"td[data-mce-selected],th[data-mce-selected]");return n.length>0?n:bu(e)},yu=e=>vu(hu(e.selection.getSel()),yn.fromDom(e.getBody())),Cu=(e,t)=>eo(e,"table",t),wu=e=>In(e).fold(A([e]),(t=>[e].concat(wu(t)))),xu=e=>Fn(e).fold(A([e]),(t=>"br"===qt(t)?Tn(t).map((t=>[e].concat(xu(t)))).getOr([]):[e].concat(xu(t)))),Eu=(e,t)=>It((e=>{const t=e.startContainer,n=e.startOffset;return tr(t)?0===n?U.some(yn.fromDom(t)):U.none():U.from(t.childNodes[n]).map(yn.fromDom)})(t),(e=>{const t=e.endContainer,n=e.endOffset;return tr(t)?n===t.data.length?U.some(yn.fromDom(t)):U.none():U.from(t.childNodes[n-1]).map(yn.fromDom)})(t),((t,n)=>{const o=ee(wu(e),O(En,t)),r=ee(xu(e),O(En,n));return o.isSome()&&r.isSome()})).getOr(!1),_u=(e,t,n,o)=>{const r=n,s=new Ho(n,r),a=we(e.schema.getMoveCaretBeforeOnEnterElements(),((e,t)=>!q(["td","th","table"],t.toLowerCase())));let i=n;do{if(tr(i)&&0!==Pt.trim(i.data).length)return void(o?t.setStart(i,0):t.setEnd(i,i.data.length));if(a[i.nodeName])return void(o?t.setStartBefore(i):"BR"===i.nodeName?t.setEndBefore(i):t.setEndAfter(i))}while(i=o?s.next():s.prev());"BODY"===r.nodeName&&(o?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},ku=e=>{const t=e.selection.getSel();return x(t)&&t.rangeCount>0},Su=(e,t)=>{const n=yu(e);n.length>0?K(n,(n=>{const o=n.dom,r=e.dom.createRng();r.setStartBefore(o),r.setEndAfter(o),t(r,!0)})):t(e.selection.getRng(),!1)},Nu=(e,t,n)=>{const o=_l(e,t);n(o),e.moveToBookmark(o)},Ru=e=>_(null==e?void 0:e.nodeType),Au=e=>Vo(e)&&!mu(e)&&!Qm(e)&&!Qo(e),Du=(e,t,n)=>{const{selection:o,dom:r}=e,s=o.getNode(),a=cr(s);Nu(o,!0,(()=>{t()})),a&&cr(s)&&r.isChildOf(s,e.getBody())?e.selection.select(s):n(o.getStart())&&Tu(r,o)},Tu=(e,t)=>{var n,o;const r=t.getRng(),{startContainer:s,startOffset:a}=r;if(!((e,t)=>{if(Au(t)&&!/^(TD|TH)$/.test(t.nodeName)){const n=e.getAttrib(t,"data-mce-selected"),o=parseInt(n,10);return!isNaN(o)&&o>0}return!1})(e,t.getNode())&&Vo(s)){const i=s.childNodes,l=e.getRoot();let d;if(a<i.length){const t=i[a];d=new Ho(t,null!==(n=e.getParent(t,e.isBlock))&&void 0!==n?n:l)}else{const t=i[i.length-1];d=new Ho(t,null!==(o=e.getParent(t,e.isBlock))&&void 0!==o?o:l),d.next(!0)}for(let n=d.current();n;n=d.next()){if("false"===e.getContentEditable(n))return;if(tr(n)&&!Lu(n))return r.setStart(n,0),void t.setRng(r)}}},Ou=(e,t,n)=>{if(e){const o=t?"nextSibling":"previousSibling";for(e=n?e:e[o];e;e=e[o])if(Vo(e)||!Lu(e))return e}},Bu=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Ls(e,t),Pu=(e,t,n)=>e.schema.isValidChild(t,n),Lu=(e,t=!1)=>{if(x(e)&&tr(e)){const n=t?e.data.replace(/ /g," "):e.data;return is(n)}return!1},Mu=(e,t)=>{const n=e.dom;return Au(t)&&"false"===n.getContentEditable(t)&&((e,t)=>{const n="[data-mce-cef-wrappable]",o=Id(e),r=Qe(o)?n:`${n},${o}`;return wn(yn.fromDom(t),r)})(e,t)&&0===n.select('[contenteditable="true"]',t).length},Iu=(e,t)=>E(e)?e(t):(x(t)&&(e=e.replace(/%(\w+)/g,((e,n)=>t[n]||e))),e),Fu=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),Uu=(e,t)=>{if(w(e))return null;{let n=String(e);return"color"!==t&&"backgroundColor"!==t||(n=Aa(n)),"fontWeight"===t&&700===e&&(n="bold"),"fontFamily"===t&&(n=n.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),n}},zu=(e,t,n)=>{const o=e.getStyle(t,n);return Uu(o,n)},ju=(e,t)=>{let n;return e.getParent(t,(t=>!!Vo(t)&&(n=e.getStyle(t,"text-decoration"),!!n&&"none"!==n))),n},Hu=(e,t,n)=>e.getParents(t,n,e.getRoot()),$u=(e,t,n)=>{const o=e.formatter.get(t);return x(o)&&V(o,n)},qu=(e,t,n)=>{const o=["inline","block","selector","attributes","styles","classes"],r=e=>we(e,((e,t)=>V(o,(e=>e===t))));return $u(e,t,(t=>{const o=r(t);return $u(e,n,(e=>{const t=r(e);return((e,t,n=i)=>a(n).eq(e,t))(o,t)}))}))},Vu=e=>Se(e,"block"),Wu=e=>Se(e,"selector"),Ku=e=>Se(e,"inline"),Yu=e=>Wu(e)&&!1!==e.expand&&!Ku(e),Gu=e=>(e=>{const t=[];let n=e;for(;n;){if(tr(n)&&n.data!==Pr||n.childNodes.length>1)return[];Vo(n)&&t.push(n),n=n.firstChild}return t})(e).length>0,Xu=e=>Qm(e.dom)&&Gu(e.dom),Qu=mu,Ju=Hu,Zu=Lu,ef=Bu,tf=(e,t)=>{let n=t;for(;n;){if(Vo(n)&&e.getContentEditable(n))return"false"===e.getContentEditable(n)?n:t;n=n.parentNode}return t},nf=(e,t,n,o)=>{const r=t.data;if(e){for(let e=n;e>0;e--)if(o(r.charAt(e-1)))return e}else for(let e=n;e<r.length;e++)if(o(r.charAt(e)))return e;return-1},of=(e,t,n)=>nf(e,t,n,(e=>uu(e)||gu(e))),rf=(e,t,n)=>nf(e,t,n,pu),sf=(e,t,n,o,r,s)=>{let a;const i=e.getParent(n,e.isBlock)||t,l=(t,n,o)=>{const s=Ri(e),l=r?s.backwards:s.forwards;return U.from(l(t,n,((e,t)=>Qu(e.parentNode)?-1:(a=e,o(r,e,t))),i))};return l(n,o,of).bind((e=>s?l(e.container,e.offset+(r?-1:0),rf):U.some(e))).orThunk((()=>a?U.some({container:a,offset:r?0:a.length}):U.none()))},af=(e,t,n,o,r)=>{const s=o[r];tr(o)&&Qe(o.data)&&s&&(o=s);const a=Ju(e,o);for(let o=0;o<a.length;o++)for(let r=0;r<t.length;r++){const s=t[r];if((!x(s.collapsed)||s.collapsed===n.collapsed)&&Wu(s)&&e.is(a[o],s.selector))return a[o]}return o},lf=(e,t,n,o)=>{var r;let s=n;const a=e.getRoot(),i=t[0];if(Vu(i)&&(s=i.wrapper?null:e.getParent(n,i.block,a)),!s){const t=null!==(r=e.getParent(n,"LI,TD,TH,SUMMARY"))&&void 0!==r?r:a;s=e.getParent(tr(n)?n.parentNode:n,(t=>t!==a&&ef(e.schema,t)),t)}if(s&&Vu(i)&&i.wrapper&&(s=Ju(e,s,"ul,ol").reverse()[0]||s),!s)for(s=n;s&&s[o]&&!e.isBlock(s[o])&&(s=s[o],!Fu(s,"br")););return s||n},df=(e,t,n,o)=>{const r=n.parentNode;return!x(n[o])&&(!(r!==t&&!w(r)&&!e.isBlock(r))||df(e,t,r,o))},cf=(e,t,n,o,r)=>{let s=n;const a=r?"previousSibling":"nextSibling",i=e.getRoot();if(tr(n)&&!Zu(n)&&(r?o>0:o<n.data.length))return n;for(;s;){if(!t[0].block_expand&&e.isBlock(s))return s;for(let t=s[a];t;t=t[a]){const n=tr(t)&&!df(e,i,t,a);if(!Qu(t)&&(!ir(l=t)||!l.getAttribute("data-mce-bogus")||l.nextSibling)&&!Zu(t,n))return s}if(s===i||s.parentNode===i){n=s;break}s=s.parentNode}var l;return n},mf=e=>Qu(e.parentNode)||Qu(e),uf=(e,t,n,o=!1)=>{let{startContainer:r,startOffset:s,endContainer:a,endOffset:i}=t;const l=n[0];return Vo(r)&&r.hasChildNodes()&&(r=Ii(r,s),tr(r)&&(s=0)),Vo(a)&&a.hasChildNodes()&&(a=Ii(a,t.collapsed?i:i-1),tr(a)&&(i=a.data.length)),r=tf(e,r),a=tf(e,a),mf(r)&&(r=Qu(r)?r:r.parentNode,r=t.collapsed?r.previousSibling||r:r.nextSibling||r,tr(r)&&(s=t.collapsed?r.length:0)),mf(a)&&(a=Qu(a)?a:a.parentNode,a=t.collapsed?a.nextSibling||a:a.previousSibling||a,tr(a)&&(i=t.collapsed?0:a.length)),t.collapsed&&(sf(e,e.getRoot(),r,s,!0,o).each((({container:e,offset:t})=>{r=e,s=t})),sf(e,e.getRoot(),a,i,!1,o).each((({container:e,offset:t})=>{a=e,i=t}))),(Ku(l)||l.block_expand)&&(Ku(l)&&tr(r)&&0!==s||(r=cf(e,n,r,s,!0)),Ku(l)&&tr(a)&&i!==a.data.length||(a=cf(e,n,a,i,!1))),Yu(l)&&(r=af(e,n,t,r,"previousSibling"),a=af(e,n,t,a,"nextSibling")),(Vu(l)||Wu(l))&&(r=lf(e,n,r,"previousSibling"),a=lf(e,n,a,"nextSibling"),Vu(l)&&(e.isBlock(r)||(r=cf(e,n,r,s,!0)),e.isBlock(a)||(a=cf(e,n,a,i,!1)))),Vo(r)&&r.parentNode&&(s=e.nodeIndex(r),r=r.parentNode),Vo(a)&&a.parentNode&&(i=e.nodeIndex(a)+1,a=a.parentNode),{startContainer:r,startOffset:s,endContainer:a,endOffset:i}},ff=(e,t,n)=>{var o;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 n=e[e.length-1];return 0===a&&e.length>0&&n===i&&tr(n)&&e.splice(e.length-1,1),e},d=(e,t,n)=>{const o=[];for(;e&&e!==n;e=e[t])o.push(e);return o},c=(t,n)=>e.getParent(t,(e=>e.parentNode===n),n),m=(e,t,o)=>{const r=o?"nextSibling":"previousSibling";for(let s=e,a=s.parentNode;s&&s!==t;s=a){a=s.parentNode;const t=d(s===e?s:s[r],r);t.length&&(o||t.reverse(),n(l(t)))}};if(s===i)return n(l([s]));const u=null!==(o=e.findCommonAncestor(s,i))&&void 0!==o?o:e.getRoot();if(e.isChildOf(s,i))return m(s,u,!0);if(e.isChildOf(i,s))return m(i,u);const f=c(s,u)||s,g=c(i,u)||i;m(s,f,!0);const p=d(f===s?f:f.nextSibling,"nextSibling",g===i?g.nextSibling:g);p.length&&n(l(p)),m(i,g)},gf=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],pf=(e,t,n,o)=>Rn(t).fold((()=>"skipping"),(r=>"br"===o||(e=>Gt(e)&&wr(e)===Pr)(t)?"valid":(e=>Yt(e)&&bn(e,di()))(t)?"existing":Qm(t.dom)?"caret":V(gf,(e=>wn(t,e)))?"valid-block":Pu(e,n,o)&&Pu(e,qt(r),n)?"valid":"invalid-child")),hf=(e,t,n,o,r,s)=>{const{uid:a=t,...i}=n;fn(e,di()),en(e,`${mi()}`,a),en(e,`${ci()}`,o);const{attributes:l={},classes:d=[]}=r(a,i);if(tn(e,l),((e,t)=>{K(t,(t=>{fn(e,t)}))})(e,d),s){d.length>0&&en(e,`${fi()}`,d.join(","));const t=ge(l);t.length>0&&en(e,`${gi()}`,t.join(","))}},bf=e=>{pn(e,di()),sn(e,`${mi()}`),sn(e,`${ci()}`),sn(e,`${ui()}`);const t=on(e,`${gi()}`).map((e=>e.split(","))).getOr([]),n=on(e,`${fi()}`).map((e=>e.split(","))).getOr([]);var o;K(t,(t=>sn(e,t))),o=e,K(n,(e=>{pn(o,e)})),sn(e,`${fi()}`),sn(e,`${gi()}`)},vf=(e,t,n,o,r)=>{const s=yn.fromTag("span",e);return hf(s,t,n,o,r,!1),s},yf=(e,t,n,o,r,s)=>{const a=[],i=vf(e.getDoc(),n,s,o,r),l=ai(),d=()=>{l.clear()},c=e=>{K(e,m)},m=t=>{switch(pf(e,t,"span",qt(t))){case"invalid-child":{d();const e=Ln(t);c(e),d();break}case"valid-block":d(),hf(t,n,s,o,r,!0);break;case"valid":{const e=l.get().getOrThunk((()=>{const e=_i(i);return a.push(e),l.set(e),e}));yo(t,e);break}}};return ff(e.dom,t,(e=>{d(),(e=>{const t=W(e,yn.fromDom);c(t)})(e)})),a},Cf=(e,t,n,o)=>{e.undoManager.transact((()=>{const r=e.selection,s=r.getRng(),a=yu(e).length>0,i=xi("mce-annotation");if(s.collapsed&&!a&&((e,t)=>{const n=uf(e.dom,t,[{inline:"span"}]);t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),e.selection.setRng(t)})(e,s),r.getRng().collapsed&&!a){const s=vf(e.getDoc(),i,o,t,n.decorate);So(s,vr),r.getRng().insertNode(s.dom),r.select(s.dom)}else Nu(r,!1,(()=>{Su(e,(r=>{yf(e,r,i,t,n.decorate,o)}))}))}))},wf=e=>{const t=(()=>{const e={};return{register:(t,n)=>{e[t]={name:t,settings:n}},lookup:t=>_e(e,t).map((e=>e.settings)),getNames:()=>ge(e)}})();((e,t)=>{const n=ci(),o=e=>U.from(e.attr(n)).bind(t.lookup),r=e=>{var t,n;e.attr(mi(),null),e.attr(ci(),null),e.attr(ui(),null);const o=U.from(e.attr(gi())).map((e=>e.split(","))).getOr([]),r=U.from(e.attr(fi())).map((e=>e.split(","))).getOr([]);K(o,(t=>e.attr(t,null)));const s=null!==(n=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==n?n:[],a=ae(s,[di()].concat(r));e.attr("class",a.length>0?a.join(" "):null),e.attr(fi(),null),e.attr(gi(),null)};e.serializer.addTempAttr(ui()),e.serializer.addAttributeFilter(n,(e=>{for(const t of e)o(t).each((e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))}))}))})(e,t);const n=Ci(e,t),o=Jt("span"),r=e=>{K(e,(e=>{o(e)?Eo(e):bf(e)}))};return{register:(e,n)=>{t.register(e,n)},annotate:(n,o)=>{t.lookup(n).each((t=>{Cf(e,n,t,o)}))},annotationChanged:(e,t)=>{n.addListener(e,t)},remove:t=>{hi(e,U.some(t)).each((({elements:t})=>{const n=e.selection.getBookmark();r(t),e.selection.moveToBookmark(n)}))},removeAll:t=>{const n=e.selection.getBookmark();he(yi(e,t),((e,t)=>{r(e)})),e.selection.moveToBookmark(n)},getAll:t=>{const n=yi(e,t);return be(n,(e=>W(e,(e=>e.dom))))}}},xf=e=>({getBookmark:O(du,e),moveToBookmark:O(cu,e)});xf.isBookmarkNode=mu;const Ef=(e,t,n)=>!n.collapsed&&V(n.getClientRects(),(n=>((e,t,n)=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom)(n,e,t))),_f=(e,t,n)=>{e.dispatch(t,n)},kf=(e,t,n,o)=>{e.dispatch("FormatApply",{format:t,node:n,vars:o})},Sf=(e,t,n,o)=>{e.dispatch("FormatRemove",{format:t,node:n,vars:o})},Nf=(e,t)=>e.dispatch("SetContent",t),Rf=(e,t)=>e.dispatch("GetContent",t),Af=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),Df={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||Df.metaKeyPressed(e),metaKeyPressed:e=>Dt.os.isMacOS()||Dt.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},Tf="data-mce-selected",Of=Math.abs,Bf=Math.round,Pf={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},Lf=(e,t)=>{const n=t.dom,o=t.getDoc(),r=document,s=t.getBody();let a,i,l,d,c,m,u,f,g,p,h,b,v,y,C;const w=e=>x(e)&&(lr(e)||n.is(e,"figure.image")),E=e=>fr(e)||n.hasClass(e,"mce-preview-object"),_=e=>{const n=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const n=e.touches[0];return w(e.target)&&!Ef(n.clientX,n.clientY,t)}return w(e.target)&&!Ef(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(n)},k=e=>n.hasClass(e,"mce-preview-object")&&x(e.firstElementChild)?[e,e.firstElementChild]:n.is(e,"figure.image")?[e.querySelector("img")]:[e],S=e=>{const o=_d(t);return!!o&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(n.hasClass(e,"mce-preview-object")&&x(e.firstElementChild)?wn(yn.fromDom(e.firstElementChild),o):wn(yn.fromDom(e),o))},N=(e,o,r)=>{if(x(r)){const s=k(e);K(s,(e=>{e.style[o]||!t.schema.isValid(e.nodeName.toLowerCase(),o)?n.setStyle(e,o,r):n.setAttrib(e,o,""+r)}))}},R=(e,t,n)=>{N(e,"width",t),N(e,"height",n)},A=e=>{let o,r,c,x,_;o=e.screenX-m,r=e.screenY-u,b=o*d[2]+f,v=r*d[3]+g,b=b<5?5:b,v=v<5?5:v,c=(w(a)||E(a))&&!1!==kd(t)?!Df.modifierPressed(e):Df.modifierPressed(e),c&&(Of(o)>Of(r)?(v=Bf(b*p),b=Bf(v/p)):(b=Bf(v/p),v=Bf(b*p))),R(i,b,v),x=d.startPos.x+o,_=d.startPos.y+r,x=x>0?x:0,_=_>0?_:0,n.setStyles(l,{left:x,top:_,display:"block"}),l.innerHTML=b+" × "+v,d[2]<0&&i.clientWidth<=b&&n.setStyle(i,"left",void 0+(f-b)),d[3]<0&&i.clientHeight<=v&&n.setStyle(i,"top",void 0+(g-v)),o=s.scrollWidth-y,r=s.scrollHeight-C,o+r!==0&&n.setStyles(l,{left:x-o,top:_-r}),h||(((e,t,n,o,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:n,height:o,origin:r})})(t,a,f,g,"corner-"+d.name),h=!0)},D=()=>{const e=h;h=!1,e&&(N(a,"width",b),N(a,"height",v)),n.unbind(o,"mousemove",A),n.unbind(o,"mouseup",D),r!==o&&(n.unbind(r,"mousemove",A),n.unbind(r,"mouseup",D)),n.remove(i),n.remove(l),n.remove(c),T(a),e&&(((e,t,n,o,r)=>{e.dispatch("ObjectResized",{target:t,width:n,height:o,origin:r})})(t,a,b,v,"corner-"+d.name),n.setAttrib(a,"style",n.getAttrib(a,"style"))),t.nodeChanged()},T=e=>{M();const h=n.getPos(e,s),w=h.x,x=h.y,_=e.getBoundingClientRect(),N=_.width||_.right-_.left,T=_.height||_.bottom-_.top;a!==e&&(B(),a=e,b=v=0);const O=t.dispatch("ObjectSelected",{target:e});S(e)&&!O.isDefaultPrevented()?he(Pf,((e,t)=>{const h=h=>{const b=k(a)[0];var v;m=h.screenX,u=h.screenY,f=b.clientWidth,g=b.clientHeight,p=g/f,d=e,d.name=t,d.startPos={x:N*e[0]+w,y:T*e[1]+x},y=s.scrollWidth,C=s.scrollHeight,c=n.add(s,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),n.setStyles(c,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),i=E(v=a)?n.create("img",{src:Dt.transparentSrc}):v.cloneNode(!0),n.addClass(i,"mce-clonedresizable"),n.setAttrib(i,"data-mce-bogus","all"),i.contentEditable="false",n.setStyles(i,{left:w,top:x,margin:0}),R(i,N,T),i.removeAttribute(Tf),s.appendChild(i),n.bind(o,"mousemove",A),n.bind(o,"mouseup",D),r!==o&&(n.bind(r,"mousemove",A),n.bind(r,"mouseup",D)),l=n.add(s,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},f+" × "+g)};let b=n.get("mceResizeHandle"+t);b&&n.remove(b),b=n.add(s,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),n.bind(b,"mousedown",(e=>{e.stopImmediatePropagation(),e.preventDefault(),h(e)})),e.elm=b,n.setStyles(b,{left:N*e[0]+w-b.offsetWidth/2,top:T*e[1]+x-b.offsetHeight/2})})):B(!1)},O=ii(T,0),B=(e=!0)=>{O.cancel(),M(),a&&e&&a.removeAttribute(Tf),he(Pf,((e,t)=>{const o=n.get("mceResizeHandle"+t);o&&(n.unbind(o),n.remove(o))}))},P=(e,t)=>n.isChildOf(e,t),L=o=>{if(h||t.removed||t.composing)return;const r="mousedown"===o.type?o.target:e.getNode(),a=no(yn.fromDom(r),"table,img,figure.image,hr,video,span.mce-preview-object,details").map((e=>e.dom)).filter((e=>n.isEditable(e.parentElement)||"IMG"===e.nodeName&&n.isEditable(e))).getOrUndefined(),i=x(a)?n.getAttrib(a,Tf,"1"):"1";if(K(n.select(`img[${Tf}],hr[${Tf}]`),(e=>{e.removeAttribute(Tf)})),x(a)&&P(a,s)&&t.hasFocus()){I();const t=e.getStart(!0);if(P(t,a)&&P(e.getEnd(!0),a))return n.setAttrib(a,Tf,i),void O.throttle(a)}B()},M=()=>{he(Pf,(e=>{e.elm&&(n.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",B),t.on("contextmenu longpress",_,!0)})),t.on("remove",M),{isResizable:S,showResizeRect:T,hideResizeRect:B,updateResizeRect:L,destroy:()=>{O.cancel(),a=i=c=null}}},Mf=(e,t,n)=>{const o=e.document.createRange();var r;return r=o,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,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(o,n),o},If=(e,t,n,o,r)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(o.dom,r),s},Ff=Dl([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Uf=(e,t,n)=>t(yn.fromDom(n.startContainer),n.startOffset,yn.fromDom(n.endContainer),n.endOffset),zf=(e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:A(e),rtl:U.none}),relative:(t,n)=>({ltr:Me((()=>Mf(e,t,n))),rtl:Me((()=>U.some(Mf(e,n,t))))}),exact:(t,n,o,r)=>({ltr:Me((()=>If(e,t,n,o,r))),rtl:Me((()=>U.some(If(e,o,r,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>Ff.rtl(yn.fromDom(e.endContainer),e.endOffset,yn.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Uf(0,Ff.ltr,n))):Uf(0,Ff.ltr,n)})(0,n)};Ff.ltr,Ff.rtl;const jf=(e,t,n,o)=>({start:e,soffset:t,finish:n,foffset:o}),Hf=(e,t,n)=>{var o,r;return U.from(null===(r=(o=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(o,t,n)).bind((t=>{if(null===t.offsetNode)return U.none();const n=e.dom.createRange();return n.setStart(t.offsetNode,t.offset),n.collapse(),U.some(n)}))},$f=(e,t,n)=>{var o,r;return U.from(null===(r=(o=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(o,t,n))},qf=document.caretPositionFromPoint?Hf:document.caretRangeFromPoint?$f:U.none,Vf=Dl([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Wf={before:Vf.before,on:Vf.on,after:Vf.after,cata:(e,t,n,o)=>e.fold(t,n,o),getStart:e=>e.fold(D,D,D)},Kf=Dl([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Yf={domRange:Kf.domRange,relative:Kf.relative,exact:Kf.exact,exactFromRange:e=>Kf.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>yn.fromDom(e.startContainer),relative:(e,t)=>Wf.getStart(e),exact:(e,t,n,o)=>e}))(e);return Nn(t)},range:jf},Gf=(e,t)=>{const n=qt(e);return"input"===n?Wf.after(e):q(["br","img"],n)?0===t?Wf.before(e):Wf.after(e):Wf.on(e,t)},Xf=(e,t)=>{const n=e.fold(Wf.before,Gf,Wf.after),o=t.fold(Wf.before,Gf,Wf.after);return Yf.relative(n,o)},Qf=(e,t,n,o)=>{const r=Gf(e,t),s=Gf(n,o);return Yf.relative(r,s)},Jf=(e,t)=>{const n=(t||document).createDocumentFragment();return K(e,(e=>{n.appendChild(e.dom)})),yn.fromDom(n)},Zf=e=>{const t=Yf.getWin(e).dom,n=(e,n,o,r)=>If(t,e,n,o,r),o=(e=>e.match({domRange:e=>{const t=yn.fromDom(e.startContainer),n=yn.fromDom(e.endContainer);return Qf(t,e.startOffset,n,e.endOffset)},relative:Xf,exact:Qf}))(e);return zf(t,o).match({ltr:n,rtl:n})},eg=(e,t,n)=>((e,t,n)=>{const o=yn.fromDom(e.document);return qf(o,t,n).map((e=>jf(yn.fromDom(e.startContainer),e.startOffset,yn.fromDom(e.endContainer),e.endOffset)))})(e,t,n),tg=(e,t,n)=>{const o=Nn(yn.fromDom(n));return eg(o.dom,e,t).map((e=>{const t=n.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t})).getOrUndefined()},ng=(e,t)=>x(e)&&x(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,og=(e,t,n)=>null!==((e,t,n)=>{let o=e;for(;o&&o!==t;){if(n(o))return o;o=o.parentNode}return null})(e,t,n),rg=(e,t,n)=>og(e,t,(e=>e.nodeName===n)),sg=(e,t)=>jr(e)&&!og(e,t,Qm),ag=(e,t,n)=>{const o=t.parentNode;if(o){const r=new Ho(t,e.getParent(o,e.isBlock)||e.getRoot());let s;for(;s=r[n?"prev":"next"]();)if(ir(s))return!0}return!1},ig=(e,t,n,o,r)=>{const s=e.getRoot(),a=e.schema.getNonEmptyElements(),i=r.parentNode;let l,d;if(!i)return U.none();const c=e.getParent(i,e.isBlock)||s;if(o&&ir(r)&&t&&e.isEmpty(c))return U.some(rl(i,e.nodeIndex(r)));const m=new Ho(r,c);for(;d=m[o?"prev":"next"]();){if("false"===e.getContentEditableParent(d)||sg(d,s))return U.none();if(tr(d)&&d.data.length>0)return rg(d,s,"A")?U.none():U.some(rl(d,o?d.data.length:0));if(e.isBlock(d)||a[d.nodeName.toLowerCase()])return U.none();l=d}return rr(l)?U.none():n&&l?U.some(rl(l,0)):U.none()},lg=(e,t,n,o)=>{const r=e.getRoot();let s,a=!1,i=n?o.startContainer:o.endContainer,l=n?o.startOffset:o.endOffset;const d=Vo(i)&&l===i.childNodes.length,c=e.schema.getNonEmptyElements();let m=n;if(jr(i))return U.none();if(Vo(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(jr(s))return U.none();if(c[s.nodeName]||Jo(s))return U.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)&&d?i.data.length:0,!t&&i===r.lastChild&&Jo(i))return U.none();if(((e,t)=>{let n=t;for(;n&&n!==e;){if(cr(n))return!0;n=n.parentNode}return!1})(r,i)||jr(i))return U.none();if(pr(i))return U.none();if(i.hasChildNodes()&&!Jo(i)){s=i;const t=new Ho(i,r);do{if(cr(s)||jr(s)){a=!1;break}if(tr(s)&&s.data.length>0){l=m?0:s.data.length,i=s,a=!0;break}if(c[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&&ig(e,d,t,!0,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),Vo(i)&&(s=i.childNodes[l],s||(s=i.childNodes[l-1]),!s||!ir(s)||((e,t)=>{var n;return(null===(n=e.previousSibling)||void 0===n?void 0:n.nodeName)===t})(s,"A")||ag(e,s,!1)||ag(e,s,!0)||ig(e,d,t,!0,s).each((e=>{i=e.container(),l=e.offset(),a=!0})))),m&&!t&&tr(i)&&l===i.data.length&&ig(e,d,t,!1,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),a&&i?U.some(rl(i,l)):U.none()},dg=(e,t)=>{const n=t.collapsed,o=t.cloneRange(),r=rl.fromRangeStart(t);return lg(e,n,!0,o).each((e=>{n&&rl.isAbove(r,e)||o.setStart(e.container(),e.offset())})),n||lg(e,n,!1,o).each((e=>{o.setEnd(e.container(),e.offset())})),n&&o.collapse(!0),ng(t,o)?U.none():U.some(o)},cg=(e,t)=>e.splitText(t),mg=e=>{let t=e.startContainer,n=e.startOffset,o=e.endContainer,r=e.endOffset;if(t===o&&tr(t)){if(n>0&&n<t.data.length)if(o=cg(t,n),t=o.previousSibling,r>n){r-=n;const e=cg(o,r).previousSibling;t=o=e,r=e.data.length,n=0}else r=0}else if(tr(t)&&n>0&&n<t.data.length&&(t=cg(t,n),n=0),tr(o)&&r>0&&r<o.data.length){const e=cg(o,r).previousSibling;o=e,r=e.data.length}return{startContainer:t,startOffset:n,endContainer:o,endOffset:r}},ug=e=>({walk:(t,n)=>ff(e,t,n),split:mg,expand:(t,n={type:"word"})=>{if("word"===n.type){const n=uf(e,t,[{inline:"span"}]),o=e.createRng();return o.setStart(n.startContainer,n.startOffset),o.setEnd(n.endContainer,n.endOffset),o}return t},normalize:t=>dg(e,t).fold(I,(e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0)))});ug.compareRanges=ng,ug.getCaretRangeFromPoint=tg,ug.getSelectedNode=Mi,ug.getNode=Ii;const fg=((e,t)=>{const n=n=>{const o=t(n);if(o<=0||null===o){const t=co(n,e);return parseFloat(t)||0}return o},o=(e,t)=>J(t,((t,n)=>{const o=co(e,n),r=void 0===o?0:parseInt(o,10);return isNaN(r)?t:t+r}),0);return{set:(t,n)=>{if(!_(n)&&!n.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+n);const o=t.dom;so(o)&&(o.style[e]=n+"px")},get:n,getOuter:n,aggregate:o,max:(e,t,n)=>{const r=o(e,n);return t>r?t-r:0}}})("height",(e=>{const t=e.dom;return Yn(e)?t.getBoundingClientRect().height:t.offsetHeight})),gg=()=>yn.fromDom(document),pg=(e,t)=>e.view(t).fold(A([]),(t=>{const n=e.owner(t),o=pg(e,n);return[t].concat(o)}));var hg=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?U.none():U.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(yn.fromDom)},owner:e=>Sn(e)});const bg=e=>{const t=gg(),n=Po(t),o=((e,t)=>{const n=t.owner(e);return pg(t,n)})(e,hg),r=Bo(e),s=Q(o,((e,t)=>{const n=Bo(t);return{left:e.left+n.left,top:e.top+n.top}}),{left:0,top:0});return To(s.left+r.left+n.left,s.top+r.top+n.top)},vg=e=>"textarea"===qt(e),yg=(e,t)=>{const n=(e=>{const t=e.dom.ownerDocument,n=t.body,o=t.defaultView,r=t.documentElement;if(n===e.dom)return To(n.offsetLeft,n.offsetTop);const s=Oo(null==o?void 0:o.pageYOffset,r.scrollTop),a=Oo(null==o?void 0:o.pageXOffset,r.scrollLeft),i=Oo(r.clientTop,n.clientTop),l=Oo(r.clientLeft,n.clientLeft);return Bo(e).translate(a-l,s-i)})(e),o=(e=>fg.get(e))(e);return{element:e,bottom:n.top+o,height:o,pos:n,cleanup:t}},Cg=(e,t)=>{const n=((e,t)=>{const n=Ln(e);if(0===n.length||vg(e))return{element:e,offset:t};if(t<n.length&&!vg(n[t]))return{element:n[t],offset:0};{const o=n[n.length-1];return vg(o)?{element:e,offset:t}:"img"===qt(o)?{element:o,offset:1}:Gt(o)?{element:o,offset:wr(o).length}:{element:o,offset:Ln(o).length}}})(e,t),o=yn.fromHtml('<span data-mce-bogus="all" style="display: inline-block;">\ufeff</span>');return po(n.element,o),yg(o,(()=>xo(o)))},wg=(e,t,n,o)=>{kg(e,((r,s)=>Eg(e,t,n,o)),n)},xg=(e,t,n,o,r)=>{const s={elm:o.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,s)||(n(e,t,Po(t).top,o,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,s))},Eg=(e,t,n,o)=>{const r=yn.fromDom(e.getBody()),s=yn.fromDom(e.getDoc());r.dom.offsetWidth;const a=Cg(yn.fromDom(n.startContainer),n.startOffset);xg(e,s,t,a,o),a.cleanup()},_g=(e,t,n,o)=>{const r=yn.fromDom(e.getDoc());xg(e,r,n,(e=>yg(yn.fromDom(e),S))(t),o)},kg=(e,t,n)=>{const o=n.startContainer,r=n.startOffset,s=n.endContainer,a=n.endOffset;t(yn.fromDom(o),yn.fromDom(s));const i=e.dom.createRng();i.setStart(o,r),i.setEnd(s,a),e.selection.setRng(n)},Sg=(e,t,n,o,r)=>{const s=t.pos;if(o)Lo(s.left,s.top,r);else{const o=s.top-n+t.height;Lo(-e.getBody().getBoundingClientRect().left,o,r)}},Ng=(e,t,n,o,r,s)=>{const a=o+n,i=r.pos.top,l=r.bottom,d=l-i>=o;i<n?Sg(e,r,o,!1!==s,t):i>a?Sg(e,r,o,d?!1!==s:!0===s,t):l>a&&!d&&Sg(e,r,o,!0===s,t)},Rg=(e,t,n,o,r)=>{const s=Nn(t).dom.innerHeight;Ng(e,t,n,s,o,r)},Ag=(e,t,n,o,r)=>{const s=Nn(t).dom.innerHeight;Ng(e,t,n,s,o,r);const a=bg(o.element),i=Fo(window);a.top<i.y?Mo(o.element,!1!==r):a.top>i.bottom&&Mo(o.element,!0===r)},Dg=(e,t,n)=>wg(e,Rg,t,n),Tg=(e,t,n)=>_g(e,t,Rg,n),Og=(e,t,n)=>wg(e,Ag,t,n),Bg=(e,t,n)=>_g(e,t,Ag,n),Pg=(e,t,n)=>{(e.inline?Dg:Og)(e,t,n)},Lg=(e,t=!1)=>e.dom.focus({preventScroll:t}),Mg=e=>{const t=$n(e).dom;return e.dom===t.activeElement},Ig=(e=gg())=>U.from(e.dom.activeElement).map(yn.fromDom),Fg=(e,t)=>{const n=Gt(t)?wr(t).length:Ln(t).length+1;return e>n?n:e<0?0:e},Ug=e=>Yf.range(e.start,Fg(e.soffset,e.start),e.finish,Fg(e.foffset,e.finish)),zg=(e,t)=>!qo(t.dom)&&(_n(e,t)||En(e,t)),jg=e=>t=>zg(e,t.start)&&zg(e,t.finish),Hg=e=>Yf.range(yn.fromDom(e.startContainer),e.startOffset,yn.fromDom(e.endContainer),e.endOffset),$g=e=>(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?U.from(t.getRangeAt(0)):U.none()).map(Hg)})(Nn(e).dom).filter(jg(e)),qg=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),U.some(t)}catch(e){return U.none()}},Vg=e=>{const t=(e=>e.inline||Dt.browser.isFirefox())(e)?$g(yn.fromDom(e.getBody())):U.none();e.bookmark=t.isSome()?t:e.bookmark},Wg=e=>(e.bookmark?e.bookmark:U.none()).bind((t=>((e,t)=>U.from(t).filter(jg(e)).map(Ug))(yn.fromDom(e.getBody()),t))).bind(qg),Kg={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},Yg={setEditorTimeout:(e,t,n)=>((e,t)=>(_(t)||(t=0),setTimeout(e,t)))((()=>{e.removed||t()}),n),setEditorInterval:(e,t,n)=>{const o=((e,t)=>(_(t)||(t=0),setInterval(e,t)))((()=>{e.removed?clearInterval(o):t()}),n);return o}},Gg=e=>{const t=ii((()=>{Vg(e)}),0);e.on("init",(()=>{e.inline&&((e,t)=>{const n=()=>{t.throttle()};Xa.DOM.bind(document,"mouseup",n),e.on("remove",(()=>{Xa.DOM.unbind(document,"mouseup",n)}))})(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)||Vg(e)}))})(e,t)})),e.on("remove",(()=>{t.cancel()}))};let Xg;const Qg=Xa.DOM,Jg=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"))},Zg=(e,t)=>{const n=Fd(e),o=Qg.getParent(t,(t=>(e=>Vo(e)&&Kg.isEditorUIElement(e))(t)||!!n&&e.dom.is(t,n)));return null!==o},ep=e=>{try{const t=$n(yn.fromDom(e.getElement()));return Ig(t).fold((()=>document.body),(e=>e.dom))}catch(e){return document.body}},tp=(e,t)=>{const n=t.editor;Gg(n);const o=(e,t)=>{Sc(e)&&!0!==e.inline&&t(yn.fromDom(e.getContainer()),"tox-edit-focus")};n.on("focusin",(()=>{const t=e.focusedEditor;Jg(ep(n))&&o(n,fn),t!==n&&(t&&t.dispatch("blur",{focusedEditor:n}),e.setActive(n),e.focusedEditor=n,n.dispatch("focus",{blurredEditor:t}),n.focus(!0))})),n.on("focusout",(()=>{Yg.setEditorTimeout(n,(()=>{const t=e.focusedEditor;Jg(ep(n))&&t===n||o(n,pn),Zg(n,ep(n))||t!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)}))})),Xg||(Xg=t=>{const n=e.activeEditor;n&&Wn(t).each((t=>{const o=t;o.ownerDocument===document&&(o===document.body||Zg(n,o)||e.focusedEditor!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))}))},Qg.bind(document,"focusin",Xg))},np=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&Xg&&(Qg.unbind(document,"focusin",Xg),Xg=null)},op=(e,t)=>(e=>e.collapsed?U.from(Ii(e.startContainer,e.startOffset)).map(yn.fromDom):U.none())(t).bind((t=>Rr(t)?U.some(t):_n(e,t)?U.none():U.some(e))),rp=(e,t)=>{op(yn.fromDom(e.getBody()),t).bind((e=>Ym(e.dom))).fold((()=>{e.selection.normalize()}),(t=>e.selection.setRng(t.toRange())))},sp=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},ap=e=>{return Mg(e)||(t=e,Ig($n(t)).filter((e=>t.dom.contains(e.dom)))).isSome();var t},ip=e=>e.inline?(e=>{const t=e.getBody();return t&&ap(yn.fromDom(t))})(e):(e=>x(e.iframeElement)&&Mg(yn.fromDom(e.iframeElement)))(e),lp=e=>ip(e)||(e=>{const t=$n(yn.fromDom(e.getElement()));return Ig(t).filter((t=>!Jg(t.dom)&&Zg(e,t.dom))).isSome()})(e),dp=e=>e.editorManager.setActive(e),cp=(e,t)=>{e.removed||(t?dp(e):(e=>{const t=e.selection,n=e.getBody();let o=t.getRng();e.quirks.refreshContentEditable(),x(e.bookmark)&&!ip(e)&&Wg(e).each((t=>{e.selection.setRng(t),o=t}));const r=((e,t)=>e.dom.getParent(t,(t=>"true"===e.dom.getContentEditable(t))))(e,t.getNode());if(r&&e.dom.isChildOf(r,n))return sp(r),rp(e,o),void dp(e);e.inline||(Dt.browser.isOpera()||sp(n),e.getWin().focus()),(Dt.browser.isFirefox()||e.inline)&&(sp(n),rp(e,o)),dp(e)})(e))},mp=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),up=(e,t,n,o,r)=>{const s=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return U.from(s).map(yn.fromDom).map((e=>o&&t.collapsed?e:Mn(e,r(e,a)).getOr(e))).bind((e=>Yt(e)?U.some(e):Rn(e).filter(Yt))).map((e=>e.dom)).getOr(e)},fp=(e,t,n=!1)=>up(e,t,!0,n,((e,t)=>Math.min(Un(e),t))),gp=(e,t,n=!1)=>up(e,t,!1,n,((e,t)=>t>0?t-1:t)),pp=(e,t)=>{const n=e;for(;e&&tr(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n},hp=(e,t)=>W(t,(t=>{const n=e.dispatch("GetSelectionRange",{range:t});return n.range!==t?n.range:t})),bp=["img","br"],vp=e=>{const t=xr(e).filter((e=>0!==e.trim().length||e.indexOf(vr)>-1)).isSome();return t||q(bp,qt(e))||(e=>Kt(e)&&"false"===nn(e,"contenteditable"))(e)},yp=(e,t)=>{const n=e=>{const o=Ln(e);for(let e=o.length-1;e>=0;e--){const r=o[e];if(t(r))return U.some(r);const s=n(r);if(s.isSome())return s}return U.none()};return n(e)},Cp="[data-mce-autocompleter]",wp=(e,t)=>{if(xp(yn.fromDom(e.getBody())).isNone()){const o=yn.fromHtml('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',e.getDoc());vo(o,yn.fromDom(t.extractContents())),t.insertNode(o.dom),Rn(o).each((e=>e.dom.normalize())),(n=o,yp(n,vp)).map((t=>{e.selection.setCursorLocation(t.dom,(e=>"img"===qt(e)?1:xr(e).fold((()=>Ln(e).length),(e=>e.length)))(t))}))}var n},xp=e=>to(e,Cp),Ep={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},_p=(e,t,n)=>{const o=n?"lastChild":"firstChild",r=n?"prev":"next";if(e[o])return e[o];if(e!==t){let n=e[r];if(n)return n;for(let o=e.parent;o&&o!==t;o=o.parent)if(n=o[r],n)return n}},kp=e=>{var t;const n=null!==(t=e.value)&&void 0!==t?t:"";if(!is(n))return!1;const o=e.parent;return!o||"span"===o.name&&!o.attr("style")||!/^[ ]+$/.test(n)},Sp=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 n=new Np(e,Ep[e]||1);return t&&he(t,((e,t)=>{n.attr(t,e)})),n}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 n=this;if(!g(e))return x(e)&&he(e,((e,t)=>{n.attr(t,e)})),n;const o=n.attributes;if(o){if(void 0!==t){if(null===t){if(e in o.map){delete o.map[e];let t=o.length;for(;t--;)if(o[t].name===e)return o.splice(t,1),n}return n}if(e in o.map){let n=o.length;for(;n--;)if(o[n].name===e){o[n].value=t;break}}else o.push({name:e,value:t});return o.map[e]=t,n}return o.map[e]}}clone(){const e=this,t=new Np(e.name,e.type),n=e.attributes;if(n){const e=[];e.map={};for(let t=0,o=n.length;t<o;t++){const o=n[t];"id"!==o.name&&(e[e.length]={name:o.name,value:o.value},e.map[o.name]=o.value)}t.attributes=e}return t.value=e.value,t}wrap(e){const t=this;return t.parent&&(t.parent.insert(e,t),e.append(t)),t}unwrap(){const e=this;for(let t=e.firstChild;t;){const n=t.next;e.insert(t,e,!0),t=n}e.remove()}remove(){const e=this,t=e.parent,n=e.next,o=e.prev;return t&&(t.firstChild===e?(t.firstChild=n,n&&(n.prev=null)):o&&(o.next=n),t.lastChild===e?(t.lastChild=o,o&&(o.next=null)):n&&(n.prev=o),e.parent=e.next=e.prev=null),e}append(e){const t=this;e.parent&&e.remove();const n=t.lastChild;return n?(n.next=e,e.prev=n,t.lastChild=e):t.lastChild=t.firstChild=e,e.parent=t,e}insert(e,t,n){e.parent&&e.remove();const o=t.parent||this;return n?(t===o.firstChild?o.firstChild=e:t.prev&&(t.prev.next=e),e.prev=t.prev,e.next=t,t.prev=e):(t===o.lastChild?o.lastChild=e:t.next&&(t.next.prev=e),e.next=t.next,e.prev=t,t.next=e),e.parent=o,e}getAll(e){const t=this,n=[];for(let o=t.firstChild;o;o=_p(o,t))o.name===e&&n.push(o);return n}children(){const e=[];for(let t=this.firstChild;t;t=t.next)e.push(t);return e}empty(){const e=this;if(e.firstChild){const t=[];for(let n=e.firstChild;n;n=_p(n,e))t.push(n);let n=t.length;for(;n--;){const e=t[n];e.parent=e.firstChild=e.lastChild=e.next=e.prev=null}}return e.firstChild=e.lastChild=null,e}isEmpty(e,t={},n){var o;const r=this;let s=r.firstChild;if(Sp(r))return!1;if(s)do{if(1===s.type){if(s.attr("data-mce-bogus"))continue;if(e[s.name])return!1;if(Sp(s))return!1}if(8===s.type)return!1;if(3===s.type&&!kp(s))return!1;if(3===s.type&&s.parent&&t[s.parent.name]&&is(null!==(o=s.value)&&void 0!==o?o:""))return!1;if(n&&n(s))return!1}while(s=_p(s,r));return!0}walk(e){return _p(this,null,e)}}const Rp=Pt.makeMap("NOSCRIPT STYLE SCRIPT XMP IFRAME NOEMBED NOFRAMES PLAINTEXT"," "),Ap=e=>g(e.nodeValue)&&e.nodeValue.includes(Pr),Dp=e=>(0===e.length?"":`${W(e,(e=>`[${e}]`)).join(",")},`)+'[data-mce-bogus="all"]',Tp=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,(e=>Ap(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)),Op=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>{if(Ap(e)){const t=e.parentNode;return t&&ke(Rp,t.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_SKIP})),Bp=e=>null!==Tp(e).nextNode(),Pp=e=>null!==Op(e).nextNode(),Lp=(e,t)=>null!==t.querySelector(Dp(e)),Mp=(e,t)=>{K(((e,t)=>t.querySelectorAll(Dp(e)))(e,t),(t=>{const n=yn.fromDom(t);"all"===nn(n,"data-mce-bogus")?xo(n):K(e,(e=>{rn(n,e)&&sn(n,e)}))}))},Ip=e=>{let t=e.nextNode();for(;null!==t;)t.nodeValue=null,t=e.nextNode()},Fp=N(Ip,Tp),Up=N(Ip,Op),zp=(e,t)=>{const n=[{condition:O(Lp,t),action:O(Mp,t)},{condition:Bp,action:Fp},{condition:Pp,action:Up}];let o=e,r=!1;return K(n,(({condition:t,action:n})=>{t(o)&&(r||(o=e.cloneNode(!0),r=!0),n(o))})),o},jp=e=>{const t=zo(e,"[data-mce-bogus]");K(t,(e=>{"all"===nn(e,"data-mce-bogus")?xo(e):_r(e)?(po(e,yn.fromText(br)),xo(e)):Eo(e)}))},Hp=e=>{const t=zo(e,"input");K(t,(e=>{sn(e,"name")}))},$p=(e,t)=>{const n=e.getDoc(),o=$n(yn.fromDom(e.getBody())),r=yn.fromTag("div",n);en(r,"data-mce-bogus","all"),lo(r,{position:"fixed",left:"-9999999px",top:"0"}),So(r,t.innerHTML),jp(r),Hp(r);const s=(e=>zn(e)?e:yn.fromDom(Sn(e).dom.body))(o);vo(s,r);const a=Mr(r.dom.innerText);return xo(r),a},qp=(e,t,n)=>{let o;return o="raw"===t.format?Pt.trim(Mr(zp(n,e.serializer.getTempAttrs()).innerHTML)):"text"===t.format?$p(e,n):"tree"===t.format?e.serializer.serialize(n,t):((e,t)=>{const n=Ql(e),o=new RegExp(`^(<${n}[^>]*>( | |\\s| |<br \\/>|)<\\/${n}>[\r\n]*|<br \\/>[\r\n]*)$`);return t.replace(o,"")})(e,e.serializer.serialize(n,t)),"text"!==t.format&&!Dr(yn.fromDom(n))&&g(o)?Pt.trim(o):o},Vp=Pt.makeMap,Wp=e=>{const t=[],n=(e=e||{}).indent,o=Vp(e.indent_before||""),r=Vp(e.indent_after||""),s=ia.getEncodeFunc(e.entity_encoding||"raw",e.entities),a="xhtml"!==e.element_format;return{start:(e,i,l)=>{if(n&&o[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,n=i.length;e<n;e++){const n=i[e];t.push(" ",n.name,'="',s(n.value,!0),'"')}if(t[t.length]=!l||a?">":" />",l&&n&&r[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}},end:e=>{let o;t.push("</",e,">"),n&&r[e]&&t.length>0&&(o=t[t.length-1],o.length>0&&"\n"!==o&&t.push("\n"))},text:(e,n)=>{e.length>0&&(t[t.length]=n?e:s(e))},cdata:e=>{t.push("<![CDATA[",e,"]]>")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,o)=>{o?t.push("<?",e," ",s(o),"?>"):t.push("<?",e,"?>"),n&&t.push("\n")},doctype:e=>{t.push("<!DOCTYPE",e,">",n?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},Kp=(e={},t=ya())=>{const n=Wp(e);return e.validate=!("validate"in e)||e.validate,{serialize:o=>{const r=e.validate,s={3:e=>{var t;n.text(null!==(t=e.value)&&void 0!==t?t:"",e.raw)},8:e=>{var t;n.comment(null!==(t=e.value)&&void 0!==t?t:"")},7:e=>{n.pi(e.name,e.value)},10:e=>{var t;n.doctype(null!==(t=e.value)&&void 0!==t?t:"")},4:e=>{var t;n.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)}};n.reset();const a=e=>{var o;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 n=[];n.map={};const o=t.getElementRule(e.name);if(o){for(let e=0,t=o.attributesOrder.length;e<t;e++){const t=o.attributesOrder[e];if(t in l.map){const e=l.map[t];n.map[t]=e,n.push({name:t,value:e})}}for(let e=0,t=l.length;e<t;e++){const t=l[e].name;if(!(t in n.map)){const e=l.map[t];n.map[t]=e,n.push({name:t,value:e})}}l=n}}if(n.start(s,l,i),Cs(s))g(e.value)&&n.text(e.value,!0),n.end(s);else if(!i){let t=e.firstChild;if(t){"pre"!==s&&"textarea"!==s||3!==t.type||"\n"!==(null===(o=t.value)||void 0===o?void 0:o[0])||n.text("\n",!0);do{a(t)}while(t=t.next)}n.end(s)}}};return 1!==o.type||e.inner?3===o.type?s[3](o):s[11](o):a(o),n.getContent()}}},Yp=new Set;K(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],(e=>{Yp.add(e)}));const Gp=["font","text-decoration","text-emphasis"],Xp=(e,t)=>ge(e.parseStyle(e.getAttrib(t,"style"))),Qp=(e,t)=>re(Xp(e,t),(e=>!(e=>Yp.has(e))(e))),Jp=(e,t,n)=>{const o=Xp(e,t),r=Xp(e,n),s=o=>{var r,s;const a=null!==(r=e.getStyle(t,o))&&void 0!==r?r:"",i=null!==(s=e.getStyle(n,o))&&void 0!==s?s:"";return Xe(a)&&Xe(i)&&a!==i};return V(o,(e=>{const t=t=>V(t,(t=>t===e));if(!t(r)&&t(Gp)){const e=X(r,(e=>V(Gp,(t=>qe(e,t)))));return V(e,s)}return s(e)}))},Zp=(e,t,n)=>U.from(n.container()).filter(tr).exists((o=>{const r=e?0:-1;return t(o.data.charAt(n.offset()+r))})),eh=O(Zp,!0,gu),th=O(Zp,!1,gu),nh=e=>{const t=e.container();return tr(t)&&(0===t.data.length||Lr(t.data)&&xf.isBookmarkNode(t.parentNode))},oh=(e,t)=>n=>gm(e?0:-1,n).filter(t).isSome(),rh=e=>lr(e)&&"block"===co(yn.fromDom(e),"display"),sh=e=>cr(e)&&!(e=>Vo(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),ah=oh(!0,rh),ih=oh(!1,rh),lh=oh(!0,fr),dh=oh(!1,fr),ch=oh(!0,Jo),mh=oh(!1,Jo),uh=oh(!0,sh),fh=oh(!1,sh),gh=(e,t)=>((e,t,n)=>_n(t,e)?Dn(e,(e=>n(e)||En(e,t))).slice(0,-1):[])(e,t,I),ph=(e,t)=>[e].concat(gh(e,t)),hh=(e,t,n)=>qm(e,t,n,nh),bh=(e,t,n)=>ee(ph(yn.fromDom(t.container()),e),(e=>t=>e.isBlock(qt(t)))(n)),vh=(e,t,n,o)=>hh(e,t.dom,n).forall((e=>bh(t,n,o).fold((()=>!fm(e,n,t.dom)),(o=>!fm(e,n,t.dom)&&_n(o,yn.fromDom(e.container())))))),yh=(e,t,n,o)=>bh(t,n,o).fold((()=>hh(e,t.dom,n).forall((e=>!fm(e,n,t.dom)))),(t=>hh(e,t.dom,n).isNone())),Ch=O(yh,!1),wh=O(yh,!0),xh=O(vh,!1),Eh=O(vh,!0),_h=e=>Em(e).exists(_r),kh=(e,t,n,o)=>{const r=X(ph(yn.fromDom(n.container()),t),(e=>o.isBlock(qt(e)))),s=ce(r).getOr(t);return Hm(e,s.dom,n).filter(_h)},Sh=(e,t,n)=>Em(t).exists(_r)||kh(!0,e,t,n).isSome(),Nh=(e,t,n)=>(e=>U.from(e.getNode(!0)).map(yn.fromDom))(t).exists(_r)||kh(!1,e,t,n).isSome(),Rh=O(kh,!1),Ah=O(kh,!0),Dh=e=>rl.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),Th=(e,t,n)=>{const o=X(ph(yn.fromDom(t.container()),e),(e=>n.isBlock(qt(e))));return ce(o).getOr(e)},Oh=(e,t,n)=>Dh(t)?th(t):th(t)||Km(Th(e,t,n).dom,t).exists(th),Bh=(e,t,n)=>Dh(t)?eh(t):eh(t)||Wm(Th(e,t,n).dom,t).exists(eh),Ph=e=>Em(e).bind((e=>Qn(e,Yt))).exists((e=>(e=>q(["pre","pre-wrap"],e))(co(e,"white-space")))),Lh=(e,t,n)=>((e,t)=>Km(e.dom,t).isNone())(e,t)||((e,t)=>Wm(e.dom,t).isNone())(e,t)||Ch(e,t,n)||wh(e,t,n)||Nh(e,t,n)||Sh(e,t,n),Mh=(e,t)=>n=>{return o=new Ho(n,e)[t](),x(o)&&cr(o)&&nm(o);var o},Ih=(e,t,n)=>!Ph(t)&&(Lh(e,t,n)||Oh(e,t,n)||Bh(e,t,n)),Fh=(e,t,n)=>!Ph(t)&&(Ch(e,t,n)||xh(e,t,n)||Nh(e,t,n)||Oh(e,t,n)||((e,t)=>{const n=Km(e.dom,t).getOr(t),o=Mh(e.dom,"prev");return t.isAtStart()&&(o(t.container())||o(n.container()))})(e,t)),Uh=(e,t,n)=>!Ph(t)&&(wh(e,t,n)||Eh(e,t,n)||Sh(e,t,n)||Bh(e,t,n)||((e,t)=>{const n=Wm(e.dom,t).getOr(t),o=Mh(e.dom,"next");return t.isAtEnd()&&(o(t.container())||o(n.container()))})(e,t)),zh=(e,t,n)=>Fh(e,t,n)||Uh(e,(e=>{const t=e.container(),n=e.offset();return tr(t)&&n<t.data.length?rl(t,n+1):e})(t),n),jh=(e,t)=>uu(e.charAt(t)),Hh=(e,t)=>gu(e.charAt(t)),$h=(e,t,n,o)=>{const r=t.data,s=rl(t,0);return n||!jh(r,0)||zh(e,s,o)?!!(n&&Hh(r,0)&&Fh(e,s,o))&&(t.data=vr+r.slice(1),!0):(t.data=" "+r.slice(1),!0)},qh=e=>{const t=e.data,n=(e=>{const t=e.split("");return W(t,((e,n)=>uu(e)&&n>0&&n<t.length-1&&pu(t[n-1])&&pu(t[n+1])?" ":e)).join("")})(t);return n!==t&&(e.data=n,!0)},Vh=(e,t,n,o)=>{const r=t.data,s=rl(t,r.length-1);return n||!jh(r,r.length-1)||zh(e,s,o)?!!(n&&Hh(r,r.length-1)&&Uh(e,s,o))&&(t.data=r.slice(0,-1)+vr,!0):(t.data=r.slice(0,-1)+" ",!0)},Wh=(e,t,n)=>{const o=t.container();if(!tr(o))return U.none();if((e=>{const t=e.container();return tr(t)&&$e(t.data,vr)})(t)){const r=$h(e,o,!1,n)||qh(o)||Vh(e,o,!1,n);return Ft(r,t)}if(zh(e,t,n)){const r=$h(e,o,!0,n)||Vh(e,o,!0,n);return Ft(r,t)}return U.none()},Kh=(e,t,n,o)=>{if(0===n)return;const r=yn.fromDom(e),s=Xn(r,(e=>o.isBlock(qt(e)))).getOr(r),a=e.data.slice(t,t+n),i=t+n>=e.data.length&&Uh(s,rl(e,e.data.length),o),l=0===t&&Fh(s,rl(e,0),o);e.replaceData(t,n,cs(a,4,l,i))},Yh=(e,t,n)=>{const o=e.data.slice(t),r=o.length-Ye(o).length;Kh(e,t,r,n)},Gh=(e,t,n)=>{const o=e.data.slice(0,t),r=o.length-Ge(o).length;Kh(e,t-r,r,n)},Xh=(e,t,n,o,r=!0)=>{const s=Ge(e.data).length,a=r?e:t,i=r?t:e;return r?a.appendData(i.data):a.insertData(0,i.data),xo(yn.fromDom(i)),o&&Yh(a,s,n),a},Qh=(e,t)=>((e,t)=>{const n=e.container(),o=e.offset();return!rl.isTextPosition(e)&&n===t.parentNode&&o>rl.before(t).offset()})(t,e)?rl(t.container(),t.offset()-1):t,Jh=e=>{return os(e.previousSibling)?U.some((t=e.previousSibling,tr(t)?rl(t,t.data.length):rl.after(t))):e.previousSibling?Gm(e.previousSibling):U.none();var t},Zh=e=>{return os(e.nextSibling)?U.some((t=e.nextSibling,tr(t)?rl(t,0):rl.before(t))):e.nextSibling?Ym(e.nextSibling):U.none();var t},eb=(e,t)=>Jh(t).orThunk((()=>Zh(t))).orThunk((()=>((e,t)=>U.from(t.previousSibling?t.previousSibling:t.parentNode).bind((t=>Km(e,rl.before(t)))).orThunk((()=>Wm(e,rl.after(t)))))(e,t))),tb=(e,t)=>Zh(t).orThunk((()=>Jh(t))).orThunk((()=>((e,t)=>Wm(e,rl.after(t)).orThunk((()=>Km(e,rl.before(t)))))(e,t))),nb=(e,t,n)=>((e,t,n)=>e?tb(t,n):eb(t,n))(e,t,n).map(O(Qh,n)),ob=(e,t,n)=>{n.fold((()=>{e.focus()}),(n=>{e.selection.setRng(n.toRange(),t)}))},rb=(e,t)=>t&&ke(e.schema.getBlockElements(),qt(t)),sb=(e,t,n,o)=>{const r=Tn(e).filter(Gt),s=On(e).filter(Gt);return xo(e),(a=r,i=s,l=t,d=(e,t,r)=>{const s=e.dom,a=t.dom,i=s.data.length;return Xh(s,a,n,o),r.container()===a?rl(s,i):r},a.isSome()&&i.isSome()&&l.isSome()?U.some(d(a.getOrDie(),i.getOrDie(),l.getOrDie())):U.none()).orThunk((()=>(o&&(r.each((e=>Gh(e.dom,e.dom.length,n))),s.each((e=>Yh(e.dom,0,n)))),t)));var a,i,l,d},ab=(e,t,n,o=!0,r=!1)=>{const s=nb(t,e.getBody(),n.dom),a=Xn(n,O(rb,e),(i=e.getBody(),e=>e.dom===i));var i;const l=sb(n,s,e.schema,((e,t)=>ke(e.schema.getTextInlineElements(),qt(t)))(e,n));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):a.bind((e=>((e,t)=>{if(ys(e)){const n=yn.fromHtml('<br data-mce-bogus="1">');return t?K(Ln(e),(e=>{Xu(e)||xo(e)})):wo(e),vo(e,n),U.some(rl.before(n.dom))}return U.none()})(e,r))).fold((()=>{o&&ob(e,t,l)}),(n=>{o&&ob(e,t,U.some(n))}))},ib=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,lb=(e,t)=>wn(yn.fromDom(t),Ed(e))&&!Ls(e.schema,t)&&e.dom.isEditable(t),db=e=>{var t;return"rtl"===Xa.DOM.getStyle(e,"direction",!0)||(e=>ib.test(e))(null!==(t=e.textContent)&&void 0!==t?t:"")},cb=(e,t,n)=>{const o=((e,t,n)=>X(Xa.DOM.getParents(n.container(),"*",t),e))(e,t,n);return U.from(o[o.length-1])},mb=(e,t)=>{const n=t.container(),o=t.offset();return e?zr(n)?tr(n.nextSibling)?rl(n.nextSibling,0):rl.after(n):$r(t)?rl(n,o+1):t:zr(n)?tr(n.previousSibling)?rl(n.previousSibling,n.previousSibling.data.length):rl.before(n):qr(t)?rl(n,o-1):t},ub=O(mb,!0),fb=O(mb,!1),gb=(e,t)=>{const n=e=>e.stopImmediatePropagation();e.on("beforeinput input",n,!0),e.getDoc().execCommand(t),e.off("beforeinput input",n)},pb=e=>gb(e,"Delete"),hb=e=>kr(e)||Nr(e),bb=(e,t)=>_n(e,t)?Qn(t,hb,(e=>t=>Lt(Rn(t),e,En))(e)):U.none(),vb=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},yb=(e,t,n)=>It(Ym(n),Gm(n),((o,r)=>{const s=mb(!0,o),a=mb(!1,r),i=mb(!1,t);return e?Wm(n,i).exists((e=>e.isEqual(a)&&t.isEqual(s))):Km(n,i).exists((e=>e.isEqual(s)&&t.isEqual(a)))})).getOr(!0),Cb=e=>{var t;return(8===Vt(t=e)||"#comment"===qt(t)?Tn(e):Fn(e)).bind(Cb).orThunk((()=>U.some(e)))},wb=(e,t,n,o=!0)=>{var r;t.deleteContents();const s=Cb(n).getOr(n),a=yn.fromDom(null!==(r=e.dom.getParent(s.dom,e.dom.isBlock))&&void 0!==r?r:n.dom);if(a.dom===e.getBody()?vb(e,o):ys(a)&&(Br(a),o&&e.selection.setCursorLocation(a.dom,0)),!En(n,a)){const e=Lt(Rn(a),n)?[]:Rn(i=a).map(Ln).map((e=>X(e,(e=>!En(i,e))))).getOr([]);K(e.concat(Ln(n)),(e=>{En(e,a)||_n(e,a)||!ys(e)||xo(e)}))}var i},xb=(e,t)=>((e,t)=>{const n=e.dom;return n.parentNode?Jn(yn.fromDom(n.parentNode),(n=>!En(e,n)&&t(n))):U.none()})(e,t).isSome(),Eb=(e,t)=>Zn(e,t).isSome(),_b=e=>zo(e,"td,th"),kb=(e,t)=>Cu(yn.fromDom(e),t),Sb=e=>(e=>It(e.startTable,e.endTable,((t,n)=>{const o=Eb(t,(e=>En(e,n))),r=Eb(n,(e=>En(e,t)));return o||r?{...e,startTable:o?U.none():e.startTable,endTable:r?U.none():e.endTable,isSameTable:!1,isMultiTable:!1}:e})).getOr(e))(e),Nb=(e,t)=>({start:e,end:t}),Rb=Dl([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),Ab=(e,t)=>no(yn.fromDom(e),"td,th",t),Db=e=>!En(e.start,e.end),Tb=(e,t)=>Cu(e.start,t).bind((n=>Cu(e.end,t).bind((e=>Ft(En(n,e),n))))),Ob=e=>t=>Tb(t,e).map((e=>((e,t,n)=>({rng:e,table:t,cells:n}))(t,e,_b(e)))),Bb=(e,t,n,o)=>{if(n.collapsed||!e.forall(Db))return U.none();if(t.isSameTable){const t=e.bind(Ob(o));return U.some({start:t,end:t})}{const e=Ab(n.startContainer,o),t=Ab(n.endContainer,o),r=e.bind((e=>t=>Cu(t,e).bind((e=>me(_b(e)).map((e=>Nb(t,e))))))(o)).bind(Ob(o)),s=t.bind((e=>t=>Cu(t,e).bind((e=>ce(_b(e)).map((e=>Nb(e,t))))))(o)).bind(Ob(o));return U.some({start:r,end:s})}},Pb=(e,t)=>te(e,(e=>En(e,t))),Lb=e=>It(Pb(e.cells,e.rng.start),Pb(e.cells,e.rng.end),((t,n)=>e.cells.slice(t,n+1))),Mb=(e,t,n)=>e.exists((e=>((e,t)=>!Db(e)&&Tb(e,t).exists((e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length})))(e,n)&&Eu(e.start,t))),Ib=(e,t)=>{const{startTable:n,endTable:o}=t,r=e.cloneRange();return n.each((e=>r.setStartAfter(e.dom))),o.each((e=>r.setEndBefore(e.dom))),r},Fb=(e,t)=>{const n=(e=>t=>En(e,t))(e),o=((e,t)=>{const n=Ab(e.startContainer,t),o=Ab(e.endContainer,t);return It(n,o,Nb)})(t,n),r=((e,t)=>{const n=kb(e.startContainer,t),o=kb(e.endContainer,t),r=n.isSome(),s=o.isSome(),a=It(n,o,En).getOr(!1);return Sb({startTable:n,endTable:o,isStartInTable:r,isEndInTable:s,isSameTable:a,isMultiTable:!a&&r&&s})})(t,n);return Mb(o,t,n)?o.map((e=>Rb.singleCellTable(t,e.start))):r.isMultiTable?((e,t,n,o)=>Bb(e,t,n,o).bind((({start:e,end:o})=>{const r=e.bind(Lb).getOr([]),s=o.bind(Lb).getOr([]);if(r.length>0&&s.length>0){const e=Ib(n,t);return U.some(Rb.multiTable(r,s,e))}return U.none()})))(o,r,t,n):((e,t,n,o)=>Bb(e,t,n,o).bind((({start:e,end:t})=>e.or(t))).bind((e=>{const{isSameTable:o}=t,r=Lb(e).getOr([]);if(o&&e.cells.length===r.length)return U.some(Rb.fullTable(e.table));if(r.length>0){if(o)return U.some(Rb.partialTable(r,U.none()));{const e=Ib(n,t);return U.some(Rb.partialTable(r,U.some({...t,rng:e})))}}return U.none()})))(o,r,t,n)},Ub=e=>K(e,(e=>{sn(e,"contenteditable"),Br(e)})),zb=(e,t,n,o)=>{const r=n.cloneRange();o?(r.setStart(n.startContainer,n.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(n.endContainer,n.endOffset)),qb(e,r,t,!1).each((e=>e()))},jb=e=>{const t=yu(e),n=yn.fromDom(e.selection.getNode());mr(n.dom)&&ys(n)?e.selection.setCursorLocation(n.dom,0):e.selection.collapse(!0),t.length>1&&V(t,(e=>En(e,n)))&&en(n,"data-mce-selected","1")},Hb=(e,t,n)=>U.some((()=>{const o=e.selection.getRng(),r=n.bind((({rng:n,isStartInTable:r})=>{const s=((e,t)=>U.from(e.dom.getParent(t,e.dom.isBlock)).map(yn.fromDom))(e,r?n.endContainer:n.startContainer);n.deleteContents(),((e,t,n)=>{n.each((n=>{t?xo(n):(Br(n),e.selection.setCursorLocation(n.dom,0))}))})(e,r,s.filter(ys));const a=r?t[0]:t[t.length-1];return zb(e,a,o,r),ys(a)?U.none():U.some(r?t.slice(1):t.slice(0,-1))})).getOr(t);Ub(r),jb(e)})),$b=(e,t,n,o)=>U.some((()=>{const r=e.selection.getRng(),s=t[0],a=n[n.length-1];zb(e,s,r,!0),zb(e,a,r,!1);const i=ys(s)?t:t.slice(1),l=ys(a)?n:n.slice(0,-1);Ub(i.concat(l)),o.deleteContents(),jb(e)})),qb=(e,t,n,o=!0)=>U.some((()=>{wb(e,t,n,o)})),Vb=(e,t)=>U.some((()=>ab(e,!1,t))),Wb=(e,t,n,o)=>Yb(t,o).fold((()=>((e,t,n)=>Fb(t,n).bind((t=>t.fold(O(qb,e),O(Vb,e),O(Hb,e),O($b,e)))))(e,t,n)),(t=>((e,t)=>Gb(e,t))(e,t))),Kb=(e,t)=>ee(ph(t,e),Ar),Yb=(e,t)=>ee(ph(t,e),Jt("caption")),Gb=(e,t)=>U.some((()=>{Br(t),e.selection.setCursorLocation(t.dom,0)})),Xb=(e,t,n,o,r)=>$m(n,e.getBody(),r).fold((()=>U.some(S)),(s=>((e,t,n,o)=>Ym(e.dom).bind((r=>Gm(e.dom).map((e=>t?n.isEqual(r)&&o.isEqual(e):n.isEqual(e)&&o.isEqual(r))))).getOr(!0))(o,n,r,s)?((e,t)=>Gb(e,t))(e,o):((e,t,n)=>Yb(e,yn.fromDom(n.getNode())).fold((()=>U.some(S)),(e=>Ft(!En(e,t),S))))(t,o,s))),Qb=(e,t,n,o)=>{const r=rl.fromRangeStart(e.selection.getRng());return Kb(n,o).bind((o=>ys(o)?Gb(e,o):((e,t,n,o,r)=>$m(n,e.getBody(),r).bind((e=>Kb(t,yn.fromDom(e.getNode())).bind((e=>En(e,o)?U.none():U.some(S))))))(e,n,t,o,r)))},Jb=(e,t)=>e?ch(t):mh(t),Zb=(e,t,n)=>{const o=yn.fromDom(e.getBody());return Yb(o,n).fold((()=>Qb(e,t,o,n).orThunk((()=>Ft(((e,t)=>{const n=rl.fromRangeStart(e.selection.getRng());return Jb(t,n)||Hm(t,e.getBody(),n).exists((e=>Jb(t,e)))})(e,t),S)))),(n=>((e,t,n,o)=>{const r=rl.fromRangeStart(e.selection.getRng());return ys(o)?Gb(e,o):Xb(e,n,t,o,r)})(e,t,o,n)))},ev=(e,t)=>{const n=yn.fromDom(e.selection.getStart(!0)),o=yu(e);return e.selection.isCollapsed()&&0===o.length?Zb(e,t,n):((e,t,n)=>{const o=yn.fromDom(e.getBody()),r=e.selection.getRng();return 0!==n.length?Hb(e,n,U.none()):Wb(e,o,r,t)})(e,n,o)},tv=(e,t)=>{let n=t;for(;n&&n!==e;){if(dr(n)||cr(n))return n;n=n.parentNode}return null},nv=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],ov=Pt.each,rv=e=>{const t=e.dom,n=new Set(e.serializer.getTempAttrs()),o=e=>V(nv,(t=>qe(e,t)))||n.has(e);return{compare:(e,n)=>{if(e.nodeName!==n.nodeName||e.nodeType!==n.nodeType)return!1;const r=e=>{const n={};return ov(t.getAttribs(e),(r=>{const s=r.nodeName.toLowerCase();"style"===s||o(s)||(n[s]=t.getAttrib(e,s))})),n},s=(e,t)=>{for(const n in e)if(ke(e,n)){const o=t[n];if(C(o))return!1;if(e[n]!==o)return!1;delete t[n]}for(const e in t)if(ke(t,e))return!1;return!0};if(Vo(e)&&Vo(n)){if(!s(r(e),r(n)))return!1;if(!s(t.parseStyle(t.getAttrib(e,"style")),t.parseStyle(t.getAttrib(n,"style"))))return!1}return!mu(e)&&!mu(n)},isAttributeInternal:o}},sv=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),av=(e,t,n,o)=>{const r=n.name;for(let t=0,s=e.length;t<s;t++){const s=e[t];if(s.name===r){const e=o.nodes[r];e?e.nodes.push(n):o.nodes[r]={filter:s,nodes:[n]}}}if(n.attributes)for(let e=0,r=t.length;e<r;e++){const r=t[e],s=r.name;if(s in n.attributes.map){const e=o.attributes[s];e?e.nodes.push(n):o.attributes[s]={filter:r,nodes:[n]}}}},iv=(e,t)=>{const n=(e,n)=>{he(e,(e=>{const o=ue(e.nodes);K(e.filter.callbacks,(r=>{for(let t=o.length-1;t>=0;t--){const r=o[t];(n?void 0!==r.attr(e.filter.name):r.name===e.filter.name)&&!w(r.parent)||o.splice(t,1)}o.length>0&&r(o,e.filter.name,t)}))}))};n(e.nodes,!1),n(e.attributes,!0)},lv=(e,t,n,o={})=>{const r=((e,t,n)=>{const o={nodes:{},attributes:{}};return n.firstChild&&((e,t)=>{let n=e;for(;n=n.walk();)t(n)})(n,(n=>{av(e,t,n,o)})),o})(e,t,n);iv(r,o)},dv=(e,t,n,o)=>{if((e.pad_empty_with_br||t.insert)&&n(o)){const e=new Np("br",1);t.insert&&e.attr("data-mce-bogus","1"),o.empty().append(e)}else o.empty().append(new Np("#text",3)).value=vr},cv=(e,t)=>{const n=null==e?void 0:e.firstChild;return x(n)&&n===e.lastChild&&n.name===t},mv=(e,t,n,o)=>o.isEmpty(t,n,(t=>((e,t)=>{const n=e.getElementRule(t.name);return!0===(null==n?void 0:n.paddEmpty)})(e,t))),uv=e=>{let t;for(let n=e;n;n=n.parent){const e=n.attr("contenteditable");if("false"===e)break;"true"===e&&(t=n)}return U.from(t)},fv=(e,t,n=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const o=e.children();for(const e of o)n&&!t.isValidChild(n.name,e.name)&&fv(e,t,n);e.unwrap()}},gv=(e,t,n,o=S)=>{const r=t.getTextBlockElements(),s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Pt.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),l=new Set,d=e=>e!==n&&!i[e.name];for(let n=0;n<e.length;n++){const i=e[n];let c,m,u;if(!i.parent||l.has(i))continue;if(r[i.name]&&"li"===i.parent.name){let e=i.next;for(;e&&r[e.name];)e.name="li",l.add(e),i.parent.insert(e,i.parent),e=e.next;i.unwrap();continue}const f=[i];for(c=i.parent;c&&!t.isValidChild(c.name,i.name)&&d(c);c=c.parent)f.push(c);if(c&&f.length>1)if(pv(t,i,c))fv(i,t);else{f.reverse(),m=f[0].clone(),o(m);let e=m;for(let n=0;n<f.length-1;n++){t.isValidChild(e.name,f[n].name)&&n>0?(u=f[n].clone(),o(u),e.append(u)):u=e;for(let e=f[n].firstChild;e&&e!==f[n+1];){const t=e.next;u.append(e),e=t}e=u}mv(t,s,a,m)?c.insert(i,f[0],!0):(c.insert(m,f[0],!0),c.insert(i,m)),c=f[0],(mv(t,s,a,c)||cv(c,"br"))&&c.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);o(t),i.wrap(t);continue}if(t.isValidChild(i.parent.name,"div")&&t.isValidChild("div",i.name)){const e=new Np("div",1);o(e),i.wrap(e)}else fv(i,t)}}},pv=(e,t,n=t.parent)=>!(!n||(!e.children[t.name]||e.isValidChild(n.name,t.name))&&("a"!==t.name||!((e,t)=>{let n=e;for(;n;){if(n.name===t)return!0;n=n.parent}return!1})(n,"a"))&&(!(e=>"summary"===e.name)(n)||!sv(t)||(null==n?void 0:n.firstChild)===t&&(null==n?void 0:n.lastChild)===t)),hv=e=>{const t=rl.fromRangeStart(e),n=rl.fromRangeEnd(e),o=e.commonAncestorContainer;return Hm(!1,o,n).map((r=>!fm(t,n,o)&&fm(t,r,o)?((e,t,n,o)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(n,o),r})(t.container(),t.offset(),r.container(),r.offset()):e)).getOr(e)},bv=e=>e.collapsed?e:hv(e),vv=(e,t)=>e.getBlockElements()[t.name]&&(e=>x(e.firstChild)&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===vr)(t.firstChild),yv=(e,t)=>{let n=t.firstChild,o=t.lastChild;return n&&"meta"===n.name&&(n=n.next),o&&"mce_marker"===o.attr("id")&&(o=o.prev),((e,t)=>{const n=e.getNonEmptyElements();return x(t)&&(t.isEmpty(n)||vv(e,t))})(e,o)&&(o=null==o?void 0:o.prev),!(!n||n!==o||"ul"!==n.name&&"ol"!==n.name)},Cv=e=>x(null==e?void 0:e.firstChild)&&e.firstChild===e.lastChild&&(e=>e.data===vr||ir(e))(e.firstChild),wv=e=>{return e.length>0&&(!(t=e[e.length-1]).firstChild||Cv(t))?e.slice(0,-1):e;var t},xv=(e,t)=>{const n=e.getParent(t,e.isBlock);return n&&"LI"===n.nodeName?n:null},Ev=(e,t)=>{const n=rl.after(e),o=Im(t).prev(n);return o?o.toRange():null},_v=(e,t,n)=>{const o=e.parentNode;return o&&Pt.each(t,(t=>{o.insertBefore(t,e)})),((e,t)=>{const n=rl.before(e),o=Im(t).next(n);return o?o.toRange():null})(e,n)},kv=(e,t,n,o)=>{const r=((e,t,n)=>{const o=t.serialize(n);return(e=>{var t,n;const o=e.firstChild,r=e.lastChild;return o&&"META"===o.nodeName&&(null===(t=o.parentNode)||void 0===t||t.removeChild(o)),r&&"mce_marker"===r.id&&(null===(n=r.parentNode)||void 0===n||n.removeChild(r)),e})(e.createFragment(o))})(t,e,o),s=xv(t,n.startContainer),a=wv((i=r.firstChild,X(null!==(l=null==i?void 0:i.childNodes)&&void 0!==l?l:[],(e=>"LI"===e.nodeName))));var i,l;const d=t.getRoot(),c=e=>{const o=rl.fromRangeStart(n),r=Im(t.getRoot()),a=1===e?r.prev(o):r.next(o),i=null==a?void 0:a.getNode();return!i||xv(t,i)!==s};return s?c(1)?_v(s,a,d):c(2)?((e,t,n,o)=>(o.insertAfter(t.reverse(),e),Ev(t[0],n)))(s,a,d,t):((e,t,n,o)=>{const r=((e,t)=>{const n=t.cloneRange(),o=t.cloneRange();return n.setStartBefore(e),o.setEndAfter(e),[n.cloneContents(),o.cloneContents()]})(e,o),s=e.parentNode;return s&&(s.insertBefore(r[0],e),Pt.each(t,(t=>{s.insertBefore(t,e)})),s.insertBefore(r[1],e),s.removeChild(e)),Ev(t[t.length-1],n)})(s,a,d,n):null},Sv=["pre"],Nv=mr,Rv=(e,t,n)=>{U.from(e.getParent(t,"td,th")).map(yn.fromDom).each((e=>((e,t)=>{Fn(e).each((n=>{Tn(n).each((o=>{t.isBlock(qt(e))&&_r(n)&&t.isBlock(qt(o))&&xo(n)}))}))})(e,n)))},Av=(e,t)=>{var n,o,r;let s;const a=e.dom,i=e.selection;if(!t)return;i.scrollIntoView(t);const l=tv(e.getBody(),t);if(l&&"false"===a.getContentEditable(l))return a.remove(t),void i.select(l);let d=a.createRng();const c=t.previousSibling;if(tr(c)){d.setStart(c,null!==(o=null===(n=c.nodeValue)||void 0===n?void 0:n.length)&&void 0!==o?o:0);const e=t.nextSibling;tr(e)&&(c.appendData(e.data),null===(r=e.parentNode)||void 0===r||r.removeChild(e))}else d.setStartBefore(t),d.setEndBefore(t);const m=a.getParent(t,a.isBlock);if(a.remove(t),m&&a.isEmpty(m)){const t=Nv(m);wo(yn.fromDom(m)),d.setStart(m,0),d.setEnd(m,0),t||(e=>!!e.getAttribute("data-mce-fragment"))(m)||!(s=(t=>{let n=rl.fromRangeStart(t);return n=Im(e.getBody()).next(n),null==n?void 0:n.toRange()})(d))?a.add(m,a.create("br",t?{}:{"data-mce-bogus":"1"})):(d=s,a.remove(m))}i.setRng(d)},Dv=e=>{const t=e.dom,n=bv(e.selection.getRng());e.selection.setRng(n);const o=t.getParent(n.startContainer,Nv);((e,t,n)=>!!x(n)&&(n===e.getParent(t.endContainer,Nv)&&Eu(yn.fromDom(n),t)))(t,n,o)?qb(e,n,yn.fromDom(o)):n.startContainer===n.endContainer&&n.endOffset-n.startOffset==1&&tr(n.startContainer.childNodes[n.startOffset])?n.deleteContents():e.getDoc().execCommand("Delete",!1)},Tv=(e,t,n)=>{var o,r;const s=e.selection,a=e.dom,i=e.parser,l=n.merge,d=Kp({validate:!0},e.schema),c='<span id="mce_marker" data-mce-type="bookmark"></span>';n.preserve_zwsp||(t=Mr(t)),-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,c);let m=s.getRng();const u=m.startContainer,f=e.getBody();u===f&&s.isCollapsed()&&a.isBlock(f.firstChild)&&((e,t)=>x(t)&&!e.schema.getVoidElements()[t.nodeName])(e,f.firstChild)&&a.isEmpty(f.firstChild)&&(m=a.createRng(),m.setStart(f.firstChild,0),m.setEnd(f.firstChild,0),s.setRng(m)),s.isCollapsed()||Dv(e);const g=s.getNode(),p={context:g.nodeName.toLowerCase(),data:n.data,insert:!0},h=i.parse(t,p);if(!0===n.paste&&yv(e.schema,h)&&((e,t)=>!!xv(e,t))(a,g))return m=kv(d,a,s.getRng(),h),m&&s.setRng(m),t;!0===n.paste&&((e,t,n,o)=>{var r;const s=t.firstChild,a=t.lastChild,i=s===("bookmark"===a.attr("data-mce-type")?a.prev:a),l=q(Sv,s.name);if(i&&l){const t="false"!==s.attr("contenteditable"),a=(null===(r=e.getParent(n,e.isBlock))||void 0===r?void 0:r.nodeName.toLowerCase())===s.name,i=U.from(tv(o,n)).forall(dr);return t&&a&&i}return!1})(a,h,g,e.getBody())&&(null===(o=h.firstChild)||void 0===o||o.unwrap()),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(h);let b=h.lastChild;if(b&&"mce_marker"===b.attr("id")){const t=b;for(b=b.prev;b;b=b.walk(!0))if(3===b.type||!a.isBlock(b.name)){b.parent&&e.schema.isValidChild(b.parent.name,"span")&&b.parent.insert(t,b,"br"===b.name);break}}if(e._selectionOverrides.showBlockCaretContainer(g),p.invalid||((e,t,n)=>{var o;return V(n.children(),sv)&&"SUMMARY"===(null===(o=e.getParent(t,e.isBlock))||void 0===o?void 0:o.nodeName)})(a,g,h)){e.selection.setContent(c);let n,o=s.getNode();const l=e.getBody();for(sr(o)?o=n=l:n=o;n&&n!==l;)o=n,n=n.parentNode;t=o===l?l.innerHTML:a.getOuterHTML(o);const m=i.parse(t),u=(e=>{for(let t=e;t;t=t.walk())if("mce_marker"===t.attr("id"))return U.some(t);return U.none()})(m),f=u.bind(uv).getOr(m);u.each((e=>e.replace(h)));const g=h.children(),p=null!==(r=h.parent)&&void 0!==r?r:m;h.unwrap();const b=X(g,(t=>pv(e.schema,t,p)));gv(b,e.schema,f),lv(i.getNodeFilters(),i.getAttributeFilters(),m),t=d.serialize(m),o===l?a.setHTML(l,t):a.setOuterHTML(o,t)}else t=d.serialize(h),((e,t,n)=>{var o;if("all"===n.getAttribute("data-mce-bogus"))null===(o=n.parentNode)||void 0===o||o.insertBefore(e.dom.createFragment(t),n);else{const o=n.firstChild,r=n.lastChild;!o||o===r&&"BR"===o.nodeName?e.dom.setHTML(n,t):e.selection.setContent(t,{no_events:!0})}})(e,t,g);var v;return((e,t)=>{const n=e.schema.getTextInlineElements(),o=e.dom;if(t){const t=e.getBody(),r=rv(e);Pt.each(o.select("*[data-mce-fragment]"),(e=>{if(x(n[e.nodeName.toLowerCase()])&&Qp(o,e))for(let n=e.parentElement;x(n)&&n!==t&&!Jp(o,e,n);n=n.parentElement)if(r.compare(n,e)){o.remove(e,!0);break}}))}})(e,l),Av(e,a.get("mce_marker")),v=e.getBody(),Pt.each(v.getElementsByTagName("*"),(e=>{e.removeAttribute("data-mce-fragment")})),Rv(a,s.getStart(),e.schema),((e,t,n)=>{const o=Dn(yn.fromDom(n),(e=>En(e,yn.fromDom(t))));de(o,o.length-2).filter(Yt).fold((()=>Ds(e,t)),(t=>Ds(e,t.dom)))})(e.schema,e.getBody(),s.getStart()),t},Ov=e=>e instanceof Np,Bv=(e,t,n)=>{e.dom.setHTML(e.getBody(),t),!0!==n&&(e=>{ip(e)&&Ym(e.getBody()).each((t=>{const n=t.getNode(),o=Jo(n)?Ym(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e)},Pv=(e,t,n)=>U.from(e.getBody()).map((o=>Ov(t)?((e,t,n,o)=>{lv(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),n);const r=Kp({validate:!1},e.schema).serialize(n),s=Mr(Dr(yn.fromDom(t))?r:Pt.trim(r));return Bv(e,s,o.no_selection),{content:n,html:s}})(e,o,t,n):((e,t,n,o)=>{if(0===(n=Mr(n)).length||/^\s+$/.test(n)){const r='<br data-mce-bogus="1">';"TABLE"===t.nodeName?n="<tr><td>"+r+"</td></tr>":/^(UL|OL)$/.test(t.nodeName)&&(n="<li>"+r+"</li>");const s=Ql(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),s.toLowerCase())?(n=r,n=e.dom.createHTML(s,Jl(e),n)):n||(n=r),Bv(e,n,o.no_selection),{content:n,html:n}}{"raw"!==o.format&&(n=Kp({validate:!1},e.schema).serialize(e.parser.parse(n,{isRootContent:!0,insert:!0})));const r=Dr(yn.fromDom(t))?n:Pt.trim(n);return Bv(e,r,o.no_selection),{content:r,html:r}}})(e,o,t,n))).getOr({content:t,html:Ov(n.content)?"":n.content}),Lv=e=>E(e)?e:I,Mv=(e,t,n)=>{const o=t(e),r=Lv(n);return o.orThunk((()=>r(e)?U.none():((e,t,n)=>{let o=e.dom;const r=Lv(n);for(;o.parentNode;){o=o.parentNode;const e=yn.fromDom(o),n=t(e);if(n.isSome())return n;if(r(e))break}return U.none()})(e,t,r)))},Iv=Fu,Fv=(e,t,n)=>{const o=e.formatter.get(n);if(o)for(let n=0;n<o.length;n++){const r=o[n];if(Wu(r)&&!1===r.inherit&&e.dom.is(t,r.selector))return!0}return!1},Uv=(e,t,n,o,r)=>{const s=e.dom.getRoot();if(t===s)return!1;const a=e.dom.getParent(t,(t=>!!Fv(e,t,n)||t.parentNode===s||!!Hv(e,t,n,o,!0)));return!!Hv(e,a,n,o,r)},zv=(e,t,n)=>!(!Ku(n)||!Iv(t,n.inline))||!(!Vu(n)||!Iv(t,n.block))||!!Wu(n)&&Vo(t)&&e.is(t,n.selector),jv=(e,t,n,o,r,s)=>{const a=n[o],i="attributes"===o;if(E(n.onmatch))return n.onmatch(t,n,o);if(a)if(Re(a)){for(let n=0;n<a.length;n++)if(i?e.getAttrib(t,a[n]):zu(e,t,a[n]))return!0}else for(const o in a)if(ke(a,o)){const l=i?e.getAttrib(t,o):zu(e,t,o),d=Iu(a[o],s),c=w(l)||Qe(l);if(c&&w(d))continue;if(r&&c&&!n.exact)return!1;if((!r||n.exact)&&!Iv(l,Uu(d,o)))return!1}return!0},Hv=(e,t,n,o,r)=>{const s=e.formatter.get(n),a=e.dom;if(s&&Vo(t))for(let n=0;n<s.length;n++){const i=s[n];if(zv(e.dom,t,i)&&jv(a,t,i,"attributes",r,o)&&jv(a,t,i,"styles",r,o)){const n=i.classes;if(n)for(let r=0;r<n.length;r++)if(!e.dom.hasClass(t,Iu(n[r],o)))return;return i}}},$v=(e,t,n,o,r)=>{if(o)return Uv(e,o,t,n,r);if(o=e.selection.getNode(),Uv(e,o,t,n,r))return!0;const s=e.selection.getStart();return!(s===o||!Uv(e,s,t,n,r))},qv=(e,t)=>{const n=t=>En(t,yn.fromDom(e.getBody()));return U.from(e.selection.getStart(!0)).bind((o=>Mv(yn.fromDom(o),(n=>fe(t,(t=>((t,n)=>Hv(e,t.dom,n)?U.some(n):U.none())(n,t)))),n))).getOrNull()},Vv=(e,t,n)=>J(n,((n,o)=>{const r=((e,t)=>$u(e,t,(e=>{const t=e=>E(e)||e.length>1&&"%"===e.charAt(0);return V(["styles","attributes"],(n=>_e(e,n).exists((e=>{const n=b(e)?e:Ee(e);return V(n,t)}))))})))(e,o);return e.formatter.matchNode(t,o,{},r)?n.concat([o]):n}),[]),Wv=Pr,Kv=e=>{if(e){const t=new Ho(e,e);for(let e=t.current();e;e=t.next())if(tr(e))return e}return null},Yv=e=>{const t=yn.fromTag("span");return tn(t,{id:Xm,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&vo(t,yn.fromText(Wv)),t},Gv=(e,t,n)=>{const o=e.dom,r=e.selection;if(Gu(t))ab(e,!1,yn.fromDom(t),n,!0);else{const e=r.getRng(),n=o.getParent(t,o.isBlock),s=e.startContainer,a=e.startOffset,i=e.endContainer,l=e.endOffset,d=(e=>{const t=Kv(e);return t&&t.data.charAt(0)===Wv&&t.deleteData(0,1),t})(t);o.remove(t,!0),s===d&&a>0&&e.setStart(d,a-1),i===d&&l>0&&e.setEnd(d,l-1),n&&o.isEmpty(n)&&Br(yn.fromDom(n)),r.setRng(e)}},Xv=(e,t,n)=>{const o=e.dom,r=e.selection;if(t)Gv(e,t,n);else if(!(t=Jm(e.getBody(),r.getStart())))for(;t=o.get(Xm);)Gv(e,t,n)},Qv=(e,t)=>(e.appendChild(t),t),Jv=(e,t)=>{var n;const o=Q(e,((e,t)=>Qv(e,t.cloneNode(!1))),t),r=null!==(n=o.ownerDocument)&&void 0!==n?n:document;return Qv(o,r.createTextNode(Wv))},Zv=(e,t,n,o)=>{const r=e.dom,s=e.selection;let a=!1;const i=e.formatter.get(t);if(!i)return;const l=s.getRng(),d=l.startContainer,c=l.startOffset;let m=d;tr(d)&&(c!==d.data.length&&(a=!0),m=m.parentNode);const u=[];let f;for(;m;){if(Hv(e,m,t,n,o)){f=m;break}m.nextSibling&&(a=!0),u.push(m),m=m.parentNode}if(f)if(a){const a=s.getBookmark();l.collapse(!0);let d=uf(r,l,i,!0);d=mg(d),e.formatter.remove(t,n,d,o),s.moveToBookmark(a)}else{const a=Jm(e.getBody(),f),i=x(a)?r.getParents(f.parentNode,F,a):[],l=Yv(!1).dom;((e,t,n)=>{var o,r;const s=e.dom,a=s.getParent(n,O(Bu,e.schema));a&&s.isEmpty(a)?null===(o=n.parentNode)||void 0===o||o.replaceChild(t,n):(Tr(yn.fromDom(n)),s.isEmpty(n)?null===(r=n.parentNode)||void 0===r||r.replaceChild(t,n):s.insertAfter(t,n))})(e,l,null!=a?a:f);const d=((e,t,n,o,r,s)=>{const a=e.formatter,i=e.dom,l=X(ge(a.get()),(e=>e!==o&&!$e(e,"removeformat"))),d=Vv(e,n,l);if(X(d,(t=>!qu(e,t,o))).length>0){const e=n.cloneNode(!1);return i.add(t,e),a.remove(o,r,e,s),i.remove(e),U.some(e)}return U.none()})(e,l,f,t,n,o),c=Jv([...u,...d.toArray(),...i],l);a&&Gv(e,a,x(a)),s.setCursorLocation(c,1),r.isEmpty(f)&&r.remove(f)}},ey=e=>{e.on("mouseup keydown",(t=>{var n;((e,t,n)=>{const o=e.selection,r=e.getBody();Xv(e,null,n),8!==t&&46!==t||!o.isCollapsed()||o.getStart().innerHTML!==Wv||Xv(e,Jm(r,o.getStart()),!0),37!==t&&39!==t||Xv(e,Jm(r,o.getStart()),!0)})(e,t.keyCode,(n=e.selection.getRng().endContainer,tr(n)&&Ve(n.data,vr)))}))},ty=e=>{const t=Yv(!1),n=Jv(e,t.dom);return{caretContainer:t,caretPosition:rl(n,0)}},ny=(e,t)=>{const{caretContainer:n,caretPosition:o}=ty(t);return po(yn.fromDom(e),n),xo(yn.fromDom(e)),o},oy=(e,t)=>{if(Qm(t.dom))return!1;const n=e.schema.getTextInlineElements();return ke(n,qt(t))&&!Qm(t.dom)&&!Qo(t.dom)},ry={},sy=Yo(["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(),n=X(X(t,sy),(e=>t=>{const n=t.previousSibling;return sy(n)&&q(e,n)})(t));K(n,(e=>{((e,t)=>{const n=yn.fromDom(t),o=Sn(n).dom;xo(n),Co(yn.fromDom(e),[yn.fromTag("br",o),yn.fromTag("br",o),...Ln(n)])})(e.previousSibling,e)}))}}));const ay=["fontWeight","fontStyle","color","fontSize","fontFamily"],iy=e=>ee(e,(e=>Ku(e)&&"span"===e.inline&&(e=>p(e.styles)&&V(ge(e.styles),(e=>q(ay,e))))(e))),ly=(e,t)=>{const n=e.get(t);return b(n)?iy(n):U.none()},dy=(e,t)=>Km(t,rl.fromRangeStart(e)).isNone(),cy=(e,t)=>!1===Wm(t,rl.fromRangeEnd(e)).exists((e=>!ir(e.getNode())||Wm(t,e).isSome())),my=e=>t=>gr(t)&&e.isEditable(t),uy=e=>X((e=>{const t=e.getSelectedBlocks(),n=e.getRng();if(e.isCollapsed())return[];if(1===t.length)return dy(n,t[0])&&cy(n,t[0])?t:[];{const e=ce(t).filter((e=>dy(n,e))).toArray(),o=me(t).filter((e=>cy(n,e))).toArray(),r=t.slice(1,-1);return e.concat(r).concat(o)}})(e),my(e.dom)),fy=e=>X(e.getSelectedBlocks(),my(e.dom)),gy=Pt.each,py=e=>Vo(e)&&!mu(e)&&!Qm(e)&&!Qo(e),hy=(e,t)=>{for(let n=e;n;n=n[t]){if(tr(n)&&Xe(n.data))return e;if(Vo(n)&&!mu(n))return n}return e},by=(e,t,n)=>{const o=rv(e),r=Wo(t)&&e.dom.isEditable(t),s=Wo(n)&&e.dom.isEditable(n);if(r&&s){const r=hy(t,"previousSibling"),s=hy(n,"nextSibling");if(o.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),Pt.each(Pt.grep(s.childNodes),(e=>{r.appendChild(e)})),r}}return n},vy=(e,t,n,o)=>{var r;if(o&&!1!==t.merge_siblings){const t=null!==(r=by(e,Ou(o),o))&&void 0!==r?r:o;by(e,t,Ou(t,!0))}},yy=(e,t,n)=>{gy(e.childNodes,(e=>{py(e)&&(t(e)&&n(e),e.hasChildNodes()&&yy(e,t,n))}))},Cy=(e,t)=>n=>!(!n||!zu(e,n,t)),wy=(e,t,n)=>o=>{e.setStyle(o,t,n),""===o.getAttribute("style")&&o.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,o)},xy=Dl([{keep:[]},{rename:["name"]},{removed:[]}]),Ey=/^(src|href|style)$/,_y=Pt.each,ky=Fu,Sy=(e,t,n)=>e.isChildOf(t,n)&&t!==n&&!e.isBlock(n),Ny=(e,t,n)=>{let o=t[n?"startContainer":"endContainer"],r=t[n?"startOffset":"endOffset"];if(Vo(o)){const e=o.childNodes.length-1;!n&&r&&r--,o=o.childNodes[r>e?e:r]}return tr(o)&&n&&r>=o.data.length&&(o=new Ho(o,e.getBody()).next()||o),tr(o)&&!n&&0===r&&(o=new Ho(o,e.getBody()).prev()||o),o},Ry=(e,t)=>{const n=t?"firstChild":"lastChild",o=e[n];return(e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&o?"TR"===e.nodeName&&o[n]||o:e},Ay=(e,t,n,o)=>{var r;const s=e.create(n,o);return null===(r=t.parentNode)||void 0===r||r.insertBefore(s,t),s.appendChild(t),s},Dy=(e,t,n,o,r)=>{const s=yn.fromDom(t),a=yn.fromDom(e.create(o,r)),i=n?Pn(s):Bn(s);return Co(a,i),n?(po(s,a),bo(a,s)):(ho(s,a),vo(a,s)),a.dom},Ty=(e,t,n)=>{const o=t.parentNode;let r;const s=e.dom,a=Ql(e);Vu(n)&&o===s.getRoot()&&(n.list_block&&ky(t,n.list_block)||K(ue(t.childNodes),(t=>{Pu(e,a,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=Ay(s,t,a),s.setAttribs(r,Jl(e))):r=null}))),(e=>Wu(e)&&Ku(e)&&Lt(_e(e,"mixed"),!0))(n)&&!ky(n.inline,t)||s.remove(t,!0)},Oy=(e,t,n)=>_(e)?{name:t,value:null}:{name:e,value:Iu(t,n)},By=(e,t)=>{""===e.getAttrib(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},Py=(e,t,n,o,r)=>{let s=!1;_y(n.styles,((a,i)=>{const{name:l,value:d}=Oy(i,a,o),c=Uu(d,l);(n.remove_similar||v(d)||!Vo(r)||ky(zu(e,r,l),c))&&e.setStyle(t,l,""),s=!0})),s&&By(e,t)},Ly=(e,t,n,o,r)=>{const s=e.dom,a=rv(e),i=e.schema;if(Ku(t)&&Bs(i,t.inline)&&Ls(i,o)&&o.parentElement===e.getBody())return Ty(e,o,t),xy.removed();if(!t.ceFalseOverride&&o&&"false"===s.getContentEditableParent(o))return xy.keep();if(o&&!zv(s,o,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(o,t))return xy.keep();const l=o,d=t.preserve_attributes;if(Ku(t)&&"all"===t.remove&&b(d)){const e=X(s.getAttribs(l),(e=>q(d,e.name.toLowerCase())));if(s.removeAllAttribs(l),K(e,(e=>s.setAttrib(l,e.name,e.value))),e.length>0)return xy.rename("span")}if("all"!==t.remove){Py(s,l,t,n,r),_y(t.attributes,((e,o)=>{const{name:a,value:i}=Oy(o,e,n);if(t.remove_similar||v(i)||!Vo(r)||ky(s.getAttrib(r,a),i)){if("class"===a){const e=s.getAttrib(l,a);if(e){let t="";if(K(e.split(/\s+/),(e=>{/mce\-\w+/.test(e)&&(t+=(t?" ":"")+e)})),t)return void s.setAttrib(l,a,t)}}if(Ey.test(a)&&l.removeAttribute("data-mce-"+a),"style"===a&&Yo(["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)}})),_y(t.classes,(e=>{e=Iu(e,n),Vo(r)&&!s.hasClass(r,e)||s.removeClass(l,e)}));const e=s.getAttribs(l);for(let t=0;t<e.length;t++){const n=e[t].nodeName;if(!a.isAttributeInternal(n))return xy.keep()}}return"none"!==t.remove?(Ty(e,l,t),xy.removed()):xy.keep()},My=(e,t,n,o)=>Ly(e,t,n,o,o).fold(A(o),(t=>(e.dom.createFragment().appendChild(o),e.dom.rename(o,t))),A(null)),Iy=(e,t,n,o,r)=>{const s=e.formatter.get(t),a=s[0],i=e.dom,l=e.selection,d=o=>{const i=((e,t,n,o,r)=>{let s;return t.parentNode&&K(Hu(e.dom,t.parentNode).reverse(),(t=>{if(!s&&Vo(t)&&"_start"!==t.id&&"_end"!==t.id){const a=Hv(e,t,n,o,r);a&&!1!==a.split&&(s=t)}})),s})(e,o,t,n,r);return((e,t,n,o,r,s,a,i)=>{var l,d;let c,m;const u=e.dom;if(n){const f=n.parentNode;for(let n=o.parentNode;n&&n!==f;n=n.parentNode){let o=u.clone(n,!1);for(let n=0;n<t.length&&(o=My(e,t[n],i,o),null!==o);n++);o&&(c&&o.appendChild(c),m||(m=o),c=o)}!s||a.mixed&&u.isBlock(n)||(o=null!==(l=u.split(n,o))&&void 0!==l?l:o),c&&m&&(null===(d=r.parentNode)||void 0===d||d.insertBefore(c,r),m.appendChild(r),Ku(a)&&vy(e,a,0,c))}return o})(e,s,i,o,o,!0,a,n)},c=t=>V(s,(o=>Uy(e,o,n,t,t))),m=t=>{const n=ue(t.childNodes),o=c(t)||V(s,(e=>zv(i,t,e))),r=t.parentNode;if(!o&&x(r)&&Yu(a)&&c(r),a.deep&&n.length)for(let e=0;e<n.length;e++)m(n[e]);K(["underline","line-through","overline"],(n=>{Vo(t)&&e.dom.getStyle(t,"text-decoration")===n&&t.parentNode&&ju(i,t.parentNode)===n&&Uy(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:n}},void 0,t)}))},u=e=>{const t=i.get(e?"_start":"_end");if(t){let n=t[e?"firstChild":"lastChild"];return(e=>mu(e)&&Vo(e)&&("_start"===e.id||"_end"===e.id))(n)&&(n=n[e?"firstChild":"lastChild"]),tr(n)&&0===n.data.length&&(n=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),i.remove(t,!0),n}return null},f=t=>{let n,o,r=uf(i,t,s,t.collapsed);if(a.split){if(r=mg(r),n=Ny(e,r,!0),o=Ny(e,r),n!==o){if(n=Ry(n,!0),o=Ry(o,!1),Sy(i,n,o)){const e=U.from(n.firstChild).getOr(n);return d(Dy(i,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void u(!0)}if(Sy(i,o,n)){const e=U.from(o.lastChild).getOr(o);return d(Dy(i,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void u(!1)}n=Ay(i,n,"span",{id:"_start","data-mce-type":"bookmark"}),o=Ay(i,o,"span",{id:"_end","data-mce-type":"bookmark"});const e=i.createRng();e.setStartAfter(n),e.setEndBefore(o),ff(i,e,(e=>{K(e,(e=>{mu(e)||mu(e.parentNode)||d(e)}))})),d(n),d(o),n=u(!0),o=u()}else n=o=d(n);r.startContainer=n.parentNode?n.parentNode:n,r.startOffset=i.nodeIndex(n),r.endContainer=o.parentNode?o.parentNode:o,r.endOffset=i.nodeIndex(o)+1}ff(i,r,(e=>{K(e,m)}))};if(o){if(Ru(o)){const e=i.createRng();e.setStartBefore(o),e.setEndAfter(o),f(e)}else f(o);Sf(e,t,o,n)}else l.isCollapsed()&&Ku(a)&&!yu(e).length?Zv(e,t,n,r):(Du(e,(()=>Su(e,f)),(o=>Ku(a)&&$v(e,t,n,o))),e.nodeChanged()),((e,t,n)=>{"removeformat"===t?K(fy(e.selection),(t=>{K(ay,(n=>e.dom.setStyle(t,n,""))),By(e.dom,t)})):ly(e.formatter,t).each((t=>{K(fy(e.selection),(o=>Py(e.dom,o,t,n,null)))}))})(e,t,n),Sf(e,t,o,n)},Fy=(e,t,n,o,r)=>{(o||e.selection.isEditable())&&Iy(e,t,n,o,r)},Uy=(e,t,n,o,r)=>Ly(e,t,n,o,r).fold(I,(t=>(e.dom.rename(o,t),!0)),F),zy=Pt.each,jy=(e,t,n,o)=>{zy(t,(t=>{Ku(t)&&zy(e.dom.select(t.inline,o),(o=>{py(o)&&Uy(e,t,n,o,t.exact?o:null)})),((e,t,n)=>{if(t.clear_child_styles){const o=t.links?"*:not(a)":"*";gy(e.select(o,n),(n=>{py(n)&&e.isEditable(n)&&gy(t.styles,((t,o)=>{e.setStyle(n,o,"")}))}))}})(e.dom,t,o)}))},Hy=Pt.each,$y=(e,t,n,o)=>{if(Hy(n.styles,((n,r)=>{e.setStyle(t,r,Iu(n,o))})),n.styles){const n=e.getAttrib(t,"style");n&&e.setAttrib(t,"data-mce-style",n)}},qy=(e,t,n,o)=>{const r=e.formatter.get(t),s=r[0],a=!o&&e.selection.isCollapsed(),i=e.dom,l=e.selection,d=(e,t=s)=>{E(t.onformat)&&t.onformat(e,t,n,o),$y(i,e,t,n),Hy(t.attributes,((t,o)=>{i.setAttrib(e,o,Iu(t,n))})),Hy(t.classes,(t=>{const o=Iu(t,n);i.hasClass(e,o)||i.addClass(e,o)}))},c=(e,t)=>{let n=!1;return Hy(e,(e=>!(!Wu(e)||("false"!==i.getContentEditable(t)||e.ceFalseOverride)&&(!x(e.collapsed)||e.collapsed===a)&&i.is(t,e.selector)&&!Qm(t)&&(d(t,e),n=!0,1)))),n},m=e=>{if(g(e)){const t=i.create(e);return d(t),t}return null},u=(o,a,i)=>{const l=[];let u=!0;const f=s.inline||s.block,g=m(f),p=o=>(e=>Vu(e)&&!0===e.wrapper)(s)&&Hv(e,o,t,n),h=(t,n,o)=>{const r=(e=>Vu(e)&&!0!==e.wrapper)(s)&&Bu(e.schema,t)&&Pu(e,n,f);return o&&r};ff(o,a,(t=>{let n;const a=t=>{let m=!1,b=u,v=!1;const y=t.parentNode,C=y.nodeName.toLowerCase(),w=o.getContentEditable(t);x(w)&&(b=u,u="true"===w,m=!0,v=Mu(e,t));const E=u&&!m;if(ir(t)&&!((e,t,n,o)=>{if(Md(e)&&Ku(t)&&n.parentNode){const t=ba(e.schema),r=xb(yn.fromDom(n),(e=>Qm(e.dom)));return Se(t,o)&&ys(yn.fromDom(n.parentNode),!1)&&!r}return!1})(e,s,t,C))return n=null,void(Vu(s)&&o.remove(t));if(p(t))n=null;else{if(h(t,C,E)){const e=o.rename(t,f);return d(e),l.push(e),void(n=null)}if(Wu(s)){let e=c(r,t);if(!e&&x(y)&&Yu(s)&&(e=c(r,y)),!Ku(s)||e)return void(n=null)}x(g)&&((t,n,r,a)=>{const l=t.nodeName.toLowerCase(),d=Pu(e,f,l)&&Pu(e,n,f),c=!i&&tr(t)&&Lr(t.data),m=Qm(t),u=!Ku(s)||!o.isBlock(t);return(r||a)&&d&&!c&&!m&&u})(t,C,E,v)?(n||(n=o.clone(g,!1),y.insertBefore(n,t),l.push(n)),v&&m&&(u=b),n.appendChild(t)):(n=null,K(ue(t.childNodes),a),m&&(u=b),n=null)}};K(t,a)})),!0===s.links&&K(l,(e=>{const t=e=>{"A"===e.nodeName&&d(e,s),K(ue(e.childNodes),t)};t(e)})),K(l,(a=>{const i=(e=>{let t=0;return K(e.childNodes,(e=>{(e=>x(e)&&tr(e)&&0===e.length)(e)||mu(e)||t++})),t})(a);!(l.length>1)&&o.isBlock(a)||0!==i?(Ku(s)||Vu(s)&&s.wrapper)&&(s.exact||1!==i||(a=(e=>{const t=ee(e.childNodes,Au).filter((e=>"false"!==o.getContentEditable(e)&&zv(o,e,s)));return t.map((t=>{const n=o.clone(t,!1);return d(n),o.replace(n,e,!0),o.remove(t,!0),n})).getOr(e)})(a)),jy(e,r,n,a),((e,t,n,o,r)=>{const s=r.parentNode;Hv(e,s,n,o)&&Uy(e,t,o,r)||t.merge_with_parents&&s&&e.dom.getParent(s,(s=>!!Hv(e,s,n,o)&&(Uy(e,t,o,r),!0)))})(e,s,t,n,a),((e,t,n,o)=>{if(t.styles&&t.styles.backgroundColor){const r=Cy(e,"fontSize");yy(o,(t=>r(t)&&e.isEditable(t)),wy(e,"backgroundColor",Iu(t.styles.backgroundColor,n)))}})(o,s,n,a),((e,t,n,o)=>{const r=t=>{if(Wo(t)&&Vo(t.parentNode)&&e.isEditable(t)){const n=ju(e,t.parentNode);e.getStyle(t,"color")&&n?e.setStyle(t,"text-decoration",n):e.getStyle(t,"text-decoration")===n&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(Pt.walk(o,r,"childNodes"),r(o))})(o,s,0,a),((e,t,n,o)=>{if(Ku(t)&&("sub"===t.inline||"sup"===t.inline)){const n=Cy(e,"fontSize");yy(o,(t=>n(t)&&e.isEditable(t)),wy(e,"fontSize",""));const r=X(e.select("sup"===t.inline?"sub":"sup",o),e.isEditable);e.remove(r,!0)}})(o,s,0,a),vy(e,s,0,a)):o.remove(a,!0)}))},f=Ru(o)?o:l.getNode();if("false"===i.getContentEditable(f)&&!Mu(e,f))return c(r,o=f),void kf(e,t,o,n);if(s){if(o)if(Ru(o)){if(!c(r,o)){const e=i.createRng();e.setStartBefore(o),e.setEndAfter(o),u(i,uf(i,e,r),!0)}}else u(i,o,!0);else a&&Ku(s)&&!yu(e).length?((e,t,n)=>{let o;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;o=Jm(e.getBody(),r.getStart());const d=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&i>0&&i<l.length&&d.test(l.charAt(i))&&d.test(l.charAt(i-1))){const o=r.getBookmark();a.collapse(!0);let i=uf(e.dom,a,s);i=mg(i),e.formatter.apply(t,n,i),r.moveToBookmark(o)}else{let s=o?Kv(o):null;o&&(null==s?void 0:s.data)===Wv||(c=e.getDoc(),m=Yv(!0).dom,o=c.importNode(m,!0),s=o.firstChild,a.insertNode(o),i=1),e.formatter.apply(t,n,o),r.setCursorLocation(s,i)}var c,m})(e,t,n):(l.setRng(bv(l.getRng())),Du(e,(()=>{Su(e,((e,t)=>{const n=t?e:uf(i,e,r);u(i,n,!1)}))}),F),e.nodeChanged()),ly(e.formatter,t).each((t=>{K(uy(e.selection),(e=>$y(i,e,t,n)))}));((e,t)=>{ke(ry,e)&&K(ry[e],(e=>{e(t)}))})(t,e)}kf(e,t,o,n)},Vy=(e,t,n,o)=>{(o||e.selection.isEditable())&&qy(e,t,n,o)},Wy=e=>ke(e,"vars"),Ky=e=>e.selection.getStart(),Yy=(e,t,n,o,r)=>Z(t,(t=>{const s=e.formatter.matchNode(t,n,null!=r?r:{},o);return!C(s)}),(t=>!!Fv(e,t,n)||!o&&x(e.formatter.matchNode(t,n,r,!0)))),Gy=(e,t)=>{const n=null!=t?t:Ky(e);return X(Hu(e.dom,n),(e=>Vo(e)&&!Qo(e)))},Xy=(e,t,n)=>{const o=Gy(e,t);he(n,((n,r)=>{const s=n=>{const s=Yy(e,o,r,n.similar,Wy(n)?n.vars:void 0),a=s.isSome();if(n.state.get()!==a){n.state.set(a);const e=s.getOr(t);Wy(n)?n.callback(a,{node:e,format:r,parents:o}):K(n.callbacks,(t=>t(a,{node:e,format:r,parents:o})))}};K([n.withSimilar,n.withoutSimilar],s),K(n.withVars,s)}))},Qy=(e,t,n,o,r,s)=>(((e,t,n,o,r,s)=>{const a=t.get();K(n.split(","),(t=>{const n=_e(a,t).getOrThunk((()=>{const e={withSimilar:{state:Za(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Za(!1),similar:!1,callbacks:[]},withVars:[]};return a[t]=e,e})),i=()=>{const n=Gy(e);return Yy(e,n,t,r,s).isSome()};if(C(s)){const e=r?n.withSimilar:n.withoutSimilar;e.callbacks.push(o),1===e.callbacks.length&&e.state.set(i())}else n.withVars.push({state:Za(i()),similar:r,vars:s,callback:o})})),t.set(a)})(e,t,n,o,r,s),{unbind:()=>((e,t,n)=>{const o=e.get();K(t.split(","),(e=>_e(o,e).each((t=>{o[e]={withSimilar:{...t.withSimilar,callbacks:X(t.withSimilar.callbacks,(e=>e!==n))},withoutSimilar:{...t.withoutSimilar,callbacks:X(t.withoutSimilar.callbacks,(e=>e!==n))},withVars:X(t.withVars,(e=>e.callback!==n))}})))),e.set(o)})(t,n,o)}),Jy=Pt.explode,Zy=()=>{const e={};return{addFilter:(t,n)=>{K(Jy(t),(t=>{ke(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(n)}))},getFilters:()=>Ee(e),removeFilter:(t,n)=>{K(Jy(t),(t=>{if(ke(e,t))if(x(n)){const o=e[t],r=X(o.callbacks,(e=>e!==n));r.length>0?o.callbacks=r:delete e[t]}else delete e[t]}))}}},eC=(e,t,n)=>{e.addNodeFilter("font",(e=>{K(e,(e=>{const o=t.parse(e.attr("style")),r=e.attr("color"),s=e.attr("face"),a=e.attr("size");r&&(o.color=r),s&&(o["font-family"]=s),a&&Je(a).each((e=>{o["font-size"]=n[e-1]})),e.name="span",e.attr("style",t.serialize(o)),((e,t)=>{K(t,(t=>{e.attr(t,null)}))})(e,["color","face","size"])}))}))},tC=(e,t,n)=>{var o;const r=Da();t.convert_fonts_to_spans&&eC(e,r,Pt.explode(null!==(o=t.font_size_legacy_values)&&void 0!==o?o:"")),((e,t,n)=>{e.addNodeFilter("strike",(e=>{const o="html4"!==t.type;K(e,(e=>{if(o)e.name="s";else{const t=n.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",n.serialize(t))}}))}))})(e,n,r)},nC=(e,t,n)=>{t.addNodeFilter("br",((t,o,r)=>{const s=Pt.extend({},n.getBlockElements()),a=n.getNonEmptyElements(),i=n.getWhitespaceElements();s.body=1;const l=e=>e.name in s||Is(n,e);for(let o=0,d=t.length;o<d;o++){let d=t[o],c=d.parent;if(c&&l(c)&&d===c.lastChild){let t=d.prev;for(;t;){const e=t.name;if("span"!==e||"bookmark"!==t.attr("data-mce-type")){"br"===e&&(d=null);break}t=t.prev}if(d&&(d.remove(),mv(n,a,i,c))){const t=n.getElementRule(c.name);t&&(t.removeEmpty?c.remove():t.paddEmpty&&dv(e,r,l,c))}}else{let e=d;for(;c&&c.firstChild===e&&c.lastChild===e&&(e=c,!s[c.name]);)c=c.parent;if(e===c){const e=new Np("#text",3);e.value=vr,d.replace(e)}}}}))},oC=e=>{const[t,...n]=e.split(","),o=n.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]:""})(o):decodeURIComponent(o);return U.some({type:r[1],data:t,base64Encoded:e})}return U.none()},rC=(e,t,n=!0)=>{let o=t;if(n)try{o=atob(t)}catch(e){return U.none()}const r=new Uint8Array(o.length);for(let e=0;e<r.length;e++)r[e]=o.charCodeAt(e);return U.some(new Blob([r],{type:e}))},sC=e=>{return qe(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):qe(e,"data:")?(t=e,new Promise(((e,n)=>{oC(t).bind((({type:e,data:t,base64Encoded:n})=>rC(e,t,n))).fold((()=>n("Invalid data URI")),e)}))):Promise.reject("Unknown URI format");var t},aC=e=>new Promise(((t,n)=>{const o=new FileReader;o.onloadend=()=>{t(o.result)},o.onerror=()=>{var e;n(null===(e=o.error)||void 0===e?void 0:e.message)},o.readAsDataURL(e)}));let iC=0;const lC=(e,t,n)=>oC(e).bind((({data:e,type:o,base64Encoded:r})=>{if(t&&!r)return U.none();{const t=r?e:btoa(e);return n(t,o)}})),dC=(e,t,n)=>{const o=e.create((r||"blobid")+iC++,t,n);var r;return e.add(o),o},cC=(e,t,n=!1)=>lC(t,n,((t,n)=>U.from(e.getByData(t,n)).orThunk((()=>rC(n,t).map((n=>dC(e,n,t))))))),mC=(e,t)=>{const{blob_cache:n}=t;if(n){const t=e=>{const t=e.attr("src");(e=>e.attr("src")===Dt.transparentSrc||x(e.attr("data-mce-placeholder")))(e)||(e=>x(e.attr("data-mce-bogus")))(e)||w(t)||cC(n,t,!0).each((t=>{e.attr("src",t.blobUri())}))};e.addAttributeFilter("src",(e=>K(e,t)))}},uC=(e,t)=>qe(e,`${t}/`),fC=(e,t)=>{const n=e.schema;t.remove_trailing_brs&&nC(t,e,n),e.addAttributeFilter("href",(e=>{let n=e.length;const o=e=>{const t=e?Pt.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(;n--;){const t=e[n];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",o(t.attr("rel")))}})),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",(e=>{let t,n,o,r,s=e.length;for(;s--;)if(r=e[s],"a"===r.name&&r.firstChild&&!r.attr("href"))for(o=r.parent,t=r.lastChild;t&&o;)n=t.prev,o.insert(t,r),t=n})),t.fix_list_elements&&e.addNodeFilter("ul,ol",(e=>{let t,n,o=e.length;for(;o--;)if(t=e[o],n=t.parent,n&&("ul"===n.name||"ol"===n.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 o=n.getValidClasses();t.validate&&o&&e.addAttributeFilter("class",(e=>{var t;let n=e.length;for(;n--;){const r=e[n],s=null!==(t=r.attr("class"))&&void 0!==t?t:"",a=Pt.explode(s," ");let i="";for(let e=0;e<a.length;e++){const t=a[e];let n=!1,s=o["*"];s&&s[t]&&(n=!0),s=o[r.name],!n&&s&&s[t]&&(n=!0),n&&(i&&(i+=" "),i+=t)}i.length||(i=null),r.attr("class",i)}})),mC(e,t),t.convert_unsafe_embeds&&e.addNodeFilter("object,embed",(e=>K(e,(e=>{e.replace(((e,t,n,o,r)=>{let s;s=C(e)?"iframe":uC(e,"image")?"img":uC(e,"video")?"video":uC(e,"audio")?"audio":"iframe";const a=new Np(s,1);return a.attr("audio"===s?{src:t}:{src:t,width:n,height:o}),"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=>K(e,(e=>e.attr("sandbox","")))))},{entries:gC,setPrototypeOf:pC,isFrozen:hC,getPrototypeOf:bC,getOwnPropertyDescriptor:vC}=Object;let{freeze:yC,seal:CC,create:wC}=Object,{apply:xC,construct:EC}="undefined"!=typeof Reflect&&Reflect;yC||(yC=function(e){return e}),CC||(CC=function(e){return e}),xC||(xC=function(e,t,n){return e.apply(t,n)}),EC||(EC=function(e,t){return new e(...t)});const _C=IC(Array.prototype.forEach),kC=IC(Array.prototype.pop),SC=IC(Array.prototype.push),NC=IC(String.prototype.toLowerCase),RC=IC(String.prototype.toString),AC=IC(String.prototype.match),DC=IC(String.prototype.replace),TC=IC(String.prototype.indexOf),OC=IC(String.prototype.trim),BC=IC(Object.prototype.hasOwnProperty),PC=IC(RegExp.prototype.test),LC=(MC=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return EC(MC,t)});var MC;function IC(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return xC(e,t,o)}}function FC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NC;pC&&pC(e,null);let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(hC(t)||(t[o]=e),r=e)}e[r]=!0}return e}function UC(e){for(let t=0;t<e.length;t++)BC(e,t)||(e[t]=null);return e}function zC(e){const t=wC(null);for(const[n,o]of gC(e))BC(e,n)&&(Array.isArray(o)?t[n]=UC(o):o&&"object"==typeof o&&o.constructor===Object?t[n]=zC(o):t[n]=o);return t}function jC(e,t){for(;null!==e;){const n=vC(e,t);if(n){if(n.get)return IC(n.get);if("function"==typeof n.value)return IC(n.value)}e=bC(e)}return function(){return null}}const HC=yC(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$C=yC(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),qC=yC(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),VC=yC(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),WC=yC(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),KC=yC(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),YC=yC(["#text"]),GC=yC(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),XC=yC(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),QC=yC(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),JC=yC(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ZC=CC(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ew=CC(/<%[\w\W]*|[\w\W]*%>/gm),tw=CC(/\${[\w\W]*}/gm),nw=CC(/^data-[\-\w.\u00B7-\uFFFF]/),ow=CC(/^aria-[\-\w]+$/),rw=CC(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sw=CC(/^(?:\w+script|data):/i),aw=CC(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),iw=CC(/^html$/i),lw=CC(/^[a-z][.\w]*(-[.\w]+)+$/i);var dw=Object.freeze({__proto__:null,MUSTACHE_EXPR:ZC,ERB_EXPR:ew,TMPLIT_EXPR:tw,DATA_ATTR:nw,ARIA_ATTR:ow,IS_ALLOWED_URI:rw,IS_SCRIPT_OR_DATA:sw,ATTR_WHITESPACE:aw,DOCTYPE_NAME:iw,CUSTOM_ELEMENT:lw});const cw=1,mw=3,uw=7,fw=8,gw=9,pw=function(){return"undefined"==typeof window?null:window};var hw=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pw();const n=t=>e(t);if(n.version="3.1.7",n.removed=[],!t||!t.document||t.document.nodeType!==gw)return n.isSupported=!1,n;let{document:o}=t;const r=o,s=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:d,NodeFilter:c,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:g}=t,p=d.prototype,h=jC(p,"cloneNode"),b=jC(p,"remove"),v=jC(p,"nextSibling"),y=jC(p,"childNodes"),C=jC(p,"parentNode");if("function"==typeof i){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let w,x="";const{implementation:E,createNodeIterator:_,createDocumentFragment:k,getElementsByTagName:S}=o,{importNode:N}=r;let R={};n.isSupported="function"==typeof gC&&"function"==typeof C&&E&&void 0!==E.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:D,TMPLIT_EXPR:T,DATA_ATTR:O,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:P,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:M}=dw;let{IS_ALLOWED_URI:I}=dw,F=null;const U=FC({},[...HC,...$C,...qC,...WC,...YC]);let z=null;const j=FC({},[...GC,...XC,...QC,...JC]);let H=Object.seal(wC(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}})),$=null,q=null,V=!0,W=!0,K=!1,Y=!0,G=!1,X=!0,Q=!1,J=!1,Z=!1,ee=!1,te=!1,ne=!1,oe=!0,re=!1,se=!0,ae=!1,ie={},le=null;const de=FC({},["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 ce=null;const me=FC({},["audio","video","img","source","image","track"]);let ue=null;const fe=FC({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml";let be=he,ve=!1,ye=null;const Ce=FC({},[ge,pe,he],RC);let we=null;const xe=["application/xhtml+xml","text/html"];let Ee=null,_e=null;const ke=o.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Ne=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!_e||_e!==e){if(e&&"object"==typeof e||(e={}),e=zC(e),we=-1===xe.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ee="application/xhtml+xml"===we?RC:NC,F=BC(e,"ALLOWED_TAGS")?FC({},e.ALLOWED_TAGS,Ee):U,z=BC(e,"ALLOWED_ATTR")?FC({},e.ALLOWED_ATTR,Ee):j,ye=BC(e,"ALLOWED_NAMESPACES")?FC({},e.ALLOWED_NAMESPACES,RC):Ce,ue=BC(e,"ADD_URI_SAFE_ATTR")?FC(zC(fe),e.ADD_URI_SAFE_ATTR,Ee):fe,ce=BC(e,"ADD_DATA_URI_TAGS")?FC(zC(me),e.ADD_DATA_URI_TAGS,Ee):me,le=BC(e,"FORBID_CONTENTS")?FC({},e.FORBID_CONTENTS,Ee):de,$=BC(e,"FORBID_TAGS")?FC({},e.FORBID_TAGS,Ee):{},q=BC(e,"FORBID_ATTR")?FC({},e.FORBID_ATTR,Ee):{},ie=!!BC(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,G=e.SAFE_FOR_TEMPLATES||!1,X=!1!==e.SAFE_FOR_XML,Q=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Z=e.FORCE_BODY||!1,oe=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,se=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||rw,be=e.NAMESPACE||he,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(W=!1),te&&(ee=!0),ie&&(F=FC({},YC),z=[],!0===ie.html&&(FC(F,HC),FC(z,GC)),!0===ie.svg&&(FC(F,$C),FC(z,XC),FC(z,JC)),!0===ie.svgFilters&&(FC(F,qC),FC(z,XC),FC(z,JC)),!0===ie.mathMl&&(FC(F,WC),FC(z,QC),FC(z,JC))),e.ADD_TAGS&&(F===U&&(F=zC(F)),FC(F,e.ADD_TAGS,Ee)),e.ADD_ATTR&&(z===j&&(z=zC(z)),FC(z,e.ADD_ATTR,Ee)),e.ADD_URI_SAFE_ATTR&&FC(ue,e.ADD_URI_SAFE_ATTR,Ee),e.FORBID_CONTENTS&&(le===de&&(le=zC(le)),FC(le,e.FORBID_CONTENTS,Ee)),se&&(F["#text"]=!0),Q&&FC(F,["html","head","body"]),F.table&&(FC(F,["tbody"]),delete $.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw LC('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw LC('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 n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(g,s)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));yC&&yC(e),_e=e}},Re=FC({},["mi","mo","mn","ms","mtext"]),Ae=FC({},["annotation-xml"]),De=FC({},["title","style","font","a","script"]),Te=FC({},[...$C,...qC,...VC]),Oe=FC({},[...WC,...KC]),Be=function(e){SC(n.removed,{element:e});try{C(e).removeChild(e)}catch(t){b(e)}},Pe=function(e,t){try{SC(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){SC(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!z[e])if(ee||te)try{Be(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){let t=null,n=null;if(Z)e="<remove></remove>"+e;else{const t=AC(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===we&&be===he&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=w?w.createHTML(e):e;if(be===he)try{t=(new f).parseFromString(r,we)}catch(e){}if(!t||!t.documentElement){t=E.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?x:r}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(o.createTextNode(n),s.childNodes[0]||null),be===he?S.call(t,Q?"html":"body")[0]:Q?t.documentElement:s},Me=function(e){return _.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ie=function(e){return e instanceof u&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof m)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Fe=function(e){return"function"==typeof l&&e instanceof l},Ue=function(e,t,o){R[e]&&_C(R[e],(e=>{e.call(n,t,o,_e)}))},ze=function(e){let t=null;if(Ue("beforeSanitizeElements",e,null),Ie(e))return Be(e),!0;const o=Ee(e.nodeName);if(Ue("uponSanitizeElement",e,{tagName:o,allowedTags:F}),e.hasChildNodes()&&!Fe(e.firstElementChild)&&PC(/<[/\w]/g,e.innerHTML)&&PC(/<[/\w]/g,e.textContent))return Be(e),!0;if(e.nodeType===uw)return Be(e),!0;if(X&&e.nodeType===fw&&PC(/<[/\w]/g,e.data))return Be(e),!0;if(!F[o]||$[o]){if(!$[o]&&He(o)){if(H.tagNameCheck instanceof RegExp&&PC(H.tagNameCheck,o))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(o))return!1}if(se&&!le[o]){const t=C(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t)for(let o=n.length-1;o>=0;--o){const r=h(n[o],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,v(e))}}return Be(e),!0}return e instanceof d&&!function(e){let t=C(e);t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const n=NC(e.tagName),o=NC(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===pe?t.namespaceURI===he?"svg"===n:t.namespaceURI===ge?"svg"===n&&("annotation-xml"===o||Re[o]):Boolean(Te[n]):e.namespaceURI===ge?t.namespaceURI===he?"math"===n:t.namespaceURI===pe?"math"===n&&Ae[o]:Boolean(Oe[n]):e.namespaceURI===he?!(t.namespaceURI===pe&&!Ae[o])&&!(t.namespaceURI===ge&&!Re[o])&&!Oe[n]&&(De[n]||!Te[n]):!("application/xhtml+xml"!==we||!ye[e.namespaceURI]))}(e)?(Be(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!PC(/<\/no(script|embed|frames)/i,e.innerHTML)?(G&&e.nodeType===mw&&(t=e.textContent,_C([A,D,T],(e=>{t=DC(t,e," ")})),e.textContent!==t&&(SC(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ue("afterSanitizeElements",e,null),!1):(Be(e),!0)},je=function(e,t,n){if(oe&&("id"===t||"name"===t)&&(n in o||n in ke))return!1;if(W&&!q[t]&&PC(O,t));else if(V&&PC(B,t));else if(!z[t]||q[t]){if(!(He(e)&&(H.tagNameCheck instanceof RegExp&&PC(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&PC(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&PC(H.tagNameCheck,n)||H.tagNameCheck instanceof Function&&H.tagNameCheck(n))))return!1}else if(ue[t]);else if(PC(I,DC(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==TC(n,"data:")||!ce[e])if(K&&!PC(P,DC(n,L,"")));else if(n)return!1;return!0},He=function(e){return"annotation-xml"!==e&&AC(e,M)},$e=function(e){Ue("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};let r=t.length;for(;r--;){const s=t[r],{name:a,namespaceURI:i,value:l}=s,d=Ee(a);let c="value"===a?l:OC(l);const m=c;if(o.attrName=d,o.attrValue=c,o.keepAttr=!0,o.forceKeepAttr=void 0,Ue("uponSanitizeAttribute",e,o),c=o.attrValue,o.forceKeepAttr)continue;if(!o.keepAttr){Pe(a,e);continue}if(!Y&&PC(/\/>/i,c)){Pe(a,e);continue}G&&_C([A,D,T],(e=>{c=DC(c,e," ")}));const u=Ee(e.nodeName);if(je(u,d,c))if(!re||"id"!==d&&"name"!==d||(Pe(a,e),c="user-content-"+c),X&&PC(/((--!?|])>)|<\/(style|title)/i,c))Pe(a,e);else{if(w&&"object"==typeof g&&"function"==typeof g.getAttributeType)if(i);else switch(g.getAttributeType(u,d)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}if(c!==m)try{i?e.setAttributeNS(i,a,c):e.setAttribute(a,c),Ie(e)?Be(e):kC(n.removed)}catch(e){}}else Pe(a,e)}Ue("afterSanitizeAttributes",e,null)},qe=function e(t){let n=null;const o=Me(t);for(Ue("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)Ue("uponSanitizeShadowNode",n,null),ze(n)||(n.content instanceof a&&e(n.content),$e(n));Ue("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,s=null,i=null,d=null;if(ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw LC("toString is not a function");if("string"!=typeof(e=e.toString()))throw LC("dirty is not a string, aborting")}if(!n.isSupported)return e;if(J||Ne(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=Ee(e.nodeName);if(!F[t]||$[t])throw LC("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)o=Le("\x3c!----\x3e"),s=o.ownerDocument.importNode(e,!0),s.nodeType===cw&&"BODY"===s.nodeName||"HTML"===s.nodeName?o=s:o.appendChild(s);else{if(!ee&&!G&&!Q&&-1===e.indexOf("<"))return w&&ne?w.createHTML(e):e;if(o=Le(e),!o)return ee?null:ne?x:""}o&&Z&&Be(o.firstChild);const c=Me(ae?e:o);for(;i=c.nextNode();)ze(i)||(i.content instanceof a&&qe(i.content),$e(i));if(ae)return e;if(ee){if(te)for(d=k.call(o.ownerDocument);o.firstChild;)d.appendChild(o.firstChild);else d=o;return(z.shadowroot||z.shadowrootmode)&&(d=N.call(r,d,!0)),d}let m=Q?o.outerHTML:o.innerHTML;return Q&&F["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&PC(iw,o.ownerDocument.doctype.name)&&(m="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+m),G&&_C([A,D,T],(e=>{m=DC(m,e," ")})),w&&ne?w.createHTML(m):m},n.setConfig=function(){Ne(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},n.clearConfig=function(){_e=null,J=!1},n.isValidAttribute=function(e,t,n){_e||Ne({});const o=Ee(e),r=Ee(t);return je(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&(R[e]=R[e]||[],SC(R[e],t))},n.removeHook=function(e){if(R[e])return kC(R[e])},n.removeHooks=function(e){R[e]&&(R[e]=[])},n.removeAllHooks=function(){R={}},n}();const bw=Pt.each,vw=Pt.trim,yw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Cw={ftp:21,http:80,https:443,mailto:25},ww=["img","video"],xw=(e,t,n)=>{const o=(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(o)||!e.allow_html_data_urls&&(/^data:image\//i.test(o)?((e,t)=>x(e)?!e:!x(t)||!q(ww,t))(e.allow_svg_data_urls,n)&&/^data:image\/svg\+xml/i.test(o):/^data:/i.test(o)))};class Ew{static parseDataUri(e){let t;const n=decodeURIComponent(e).split(","),o=/data:([^;]+)/.exec(n[0]);return o&&(t=o[1]),{type:t,data:n[1]}}static isDomSafe(e,t,n={}){if(n.allow_script_urls)return!0;{const o=ia.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!xw(n,o,t)}}static getDocumentBaseUrl(e){var t;let n;return n=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/")),n}constructor(e,t={}){this.path="",this.directory="",e=vw(e),this.settings=t;const n=t.base_uri,o=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(o.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(n&&n.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=n?n.path:new Ew(document.location.href).directory;if(""===(null==n?void 0:n.protocol))e="//mce_host"+o.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(n&&n.protocol||"http")+"://mce_host"+o.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);s&&bw(yw,((e,t)=>{let n=s[t];n&&(n=n.replace(/\(mce_at\)/g,"@@")),o[e]=n})),n&&(o.protocol||(o.protocol=n.protocol),o.userInfo||(o.userInfo=n.userInfo),o.port||"mce_host"!==o.host||(o.port=n.port),o.host&&"mce_host"!==o.host||(o.host=n.host),o.source=""),r&&(o.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 Ew(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 n=this.getURI(),o=t.getURI();if(n===o||"/"===n.charAt(n.length-1)&&n.substr(0,n.length-1)===o)return n;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const n=new Ew(e,{base_uri:this});return n.getURI(t&&this.isSameOrigin(n))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?Cw[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let n,o,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(n=0,o=a.length;n<o;n++)if(n>=i.length||a[n]!==i[n]){r=n+1;break}if(a.length<i.length)for(n=0,o=i.length;n<o;n++)if(n>=a.length||a[n]!==i[n]){r=n+1;break}if(1===r)return t;for(n=0,o=a.length-(r-1);n<o;n++)s+="../";for(n=r-1,o=i.length;n<o;n++)s+=n!==r-1?"/"+i[n]:i[n];return s}toAbsPath(e,t){let n=0;const o=/\/$/.test(t)?"/":"",r=e.split("/"),s=t.split("/"),a=[];bw(r,(e=>{e&&a.push(e)}));const i=[];for(let e=s.length-1;e>=0;e--)0!==s[e].length&&"."!==s[e]&&(".."!==s[e]?n>0?n--:i.push(s[e]):n++);const l=a.length-n;let d;return d=l<=0?se(i).join("/"):a.slice(0,l).join("/")+"/"+se(i).join("/"),0!==d.indexOf("/")&&(d="/"+d),o&&d.lastIndexOf("/")!==d.length-1&&(d+=o),d}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 _w=Pt.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),kw="data-mce-type";let Sw=0;const Nw=(e,t,n,o,r)=>{var s,a,i,l;const d=t.validate,c=n.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"!==o&&n.isValid(o))return void(x(r)&&(r.allowedTags[m]=!0));if(1!==e.nodeType||"body"===m)return;const u=yn.fromDom(e),f=rn(u,kw),p=nn(u,"data-mce-bogus");if(!f&&g(p))return void("all"===p?xo(u):Eo(u));const h=n.getElementRule(m);if(!d||h){if(x(r)&&(r.allowedTags[m]=!0),d&&h&&!f){if(K(null!==(i=h.attributesForced)&&void 0!==i?i:[],(e=>{en(u,e.name,"{$uid}"===e.value?"mce_"+Sw++:e.value)})),K(null!==(l=h.attributesDefault)&&void 0!==l?l:[],(e=>{rn(u,e.name)||en(u,e.name,"{$uid}"===e.value?"mce_"+Sw++:e.value)})),h.attributesRequired&&!V(h.attributesRequired,(e=>rn(u,e))))return void Eo(u);if(h.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(u))return void Eo(u);h.outputName&&h.outputName!==m&&Si(u,h.outputName)}}else ke(c,m)?xo(u):Eo(u)},Rw=(e,t,n,o,r,s)=>"html"!==n&&!Cs(o)||!(r in _w&&xw(e,s,o))&&(!e.validate||t.isValid(o,r)||qe(r,"data-")||qe(r,"aria-")),Aw=(e,t)=>e.hasAttribute(kw)&&("id"===t||"class"===t||"style"===t),Dw=(e,t)=>e in t.getBoolAttrs(),Tw=(e,t,n,o)=>{const{attributes:r}=e;for(let s=r.length-1;s>=0;s--){const a=r[s],i=a.name,l=a.value;Rw(t,n,o,e.tagName.toLowerCase(),i,l)||Aw(e,i)?Dw(i,n)&&e.setAttribute(i,i):e.removeAttribute(i)}},Ow=(e,t,n)=>{const o=hw();return o.addHook("uponSanitizeElement",((o,r)=>{Nw(o,e,t,n.track(o),r)})),o.addHook("uponSanitizeAttribute",((o,r)=>{((e,t,n,o,r)=>{const s=e.tagName.toLowerCase(),{attrName:a,attrValue:i}=r;r.keepAttr=Rw(t,n,o,s,a,i),r.keepAttr?(r.allowedAttributes[a]=!0,Dw(a,n)&&(r.attrValue=a),t.allow_svg_data_urls&&qe(i,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):Aw(e,a)&&(r.forceKeepAttr=!0)})(o,e,t,n.current(),r)})),o},Bw=e=>{const t=["type","href","role","arcrole","title","show","actuate","label","from","to"].map((e=>`xlink:${e}`)),n={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:t};return hw().sanitize(e,n),e.innerHTML},Pw=(e,t)=>{const n=(()=>{let e=[];const t=()=>e[e.length-1];return{track:n=>{ws(n)&&e.push(n);let o=t();return o&&!o.contains(n)&&(e.pop(),o=t()),xs(o)},current:()=>xs(t()),reset:()=>{e=[]}}})();if(e.sanitize){const o=Ow(e,t,n),r=(t,r)=>{o.sanitize(t,((e,t)=>{const n={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[],SAFE_FOR_XML:!1};return n.PARSER_MEDIA_TYPE=t,e.allow_script_urls?n.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(n.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),n})(e,r)),o.removed=[],n.reset()};return{sanitizeHtmlElement:r,sanitizeNamespaceElement:Bw}}return{sanitizeHtmlElement:(o,r)=>{const s=document.createNodeIterator(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let a;for(;a=s.nextNode();){const o=n.track(a);Nw(a,e,t,o),Vo(a)&&Tw(a,e,t,o)}n.reset()},sanitizeNamespaceElement:S}},Lw=Pt.makeMap,Mw=Pt.extend,Iw=(e,t,n,o)=>{const r=e.name,s=r in n&&"title"!==r&&"textarea"!==r&&"noscript"!==r,a=t.childNodes;for(let t=0,r=a.length;t<r;t++){const r=a[t],i=new Np(r.nodeName.toLowerCase(),r.nodeType);if(Vo(r)){const e=r.attributes;for(let t=0,n=e.length;t<n;t++){const n=e[t];i.attr(n.name,n.value)}Cs(i.name)&&(o(r),i.value=r.innerHTML)}else tr(r)?(i.value=r.data,s&&(i.raw=!0)):(rr(r)||nr(r)||or(r))&&(i.value=r.data);Cs(i.name)||Iw(i,r,n,o),e.append(i)}},Fw=(e,t,n,o)=>{const r=n.validate,s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Mw(Lw("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=ba(t),d=/[ \t\r\n]+/g,c=/^[ \t\r\n]+/,m=/[ \t\r\n]+$/,u=e=>{let t=e.parent;for(;x(t);){if(t.name in a)return!0;t=t.parent}return!1},f=n=>n.name in i||Is(t,n)||Cs(n.name)&&n.parent===e,g=(t,n)=>{const r=n?t.prev:t.next;return!x(r)&&!w(t.parent)&&f(t.parent)&&(t.parent!==e||!0===o.isRootContent)};return[e=>{var t;if(3===e.type&&!u(e)){let n=null!==(t=e.value)&&void 0!==t?t:"";n=n.replace(d," "),(((e,t)=>x(e)&&(t(e)||"br"===e.name))(e.prev,f)||g(e,!0))&&(n=n.replace(c,"")),0===n.length?e.remove():e.value=n}},e=>{var i;if(1===e.type){const i=t.getElementRule(e.name);if(r&&i){const r=mv(t,s,a,e);i.paddInEmptyBlock&&r&&(e=>{let n=e;for(;x(n);){if(n.name in l)return mv(t,s,a,n);n=n.parent}return!1})(e)?dv(n,o,f,e):i.removeEmpty&&r?f(e)?e.remove():e.unwrap():i.paddEmpty&&(r||(e=>{var t;return cv(e,"#text")&&(null===(t=null==e?void 0:e.firstChild)||void 0===t?void 0:t.value)===vr})(e))&&dv(n,o,f,e)}}else if(3===e.type&&!u(e)){let t=null!==(i=e.value)&&void 0!==i?i:"";(e.next&&f(e.next)||g(e,!1))&&(t=t.replace(m,"")),0===t.length?e.remove():e.value=t}}]},Uw=(e={},t=ya())=>{const n=Zy(),o=Zy(),r={validate:!0,root_name:"body",sanitize:!0,...e},s=new DOMParser,a=Pw(r,t),i=n.addFilter,l=n.getFilters,d=n.removeFilter,c=o.addFilter,m=o.getFilters,u=o.removeFilter,f=(e,n)=>{const o=g(n.attr(kw)),r=1===n.type&&!ke(e,n.name)&&!Is(t,n)&&!Cs(n.name);return 3===n.type||r&&!o},p={schema:t,addAttributeFilter:c,getAttributeFilters:m,removeAttributeFilter:u,addNodeFilter:i,getNodeFilters:l,removeNodeFilter:d,parse:(e,n={})=>{var o;const i=r.validate,d=null!==(o=n.context)&&void 0!==o?o:r.root_name,c=((e,n,o="html")=>{const r="xhtml"===o?"application/xhtml+xml":"text/html",i=ke(t.getSpecialElements(),n.toLowerCase()),l=i?`<${n}>${e}</${n}>`:e,d="xhtml"===o?`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>${l}</body></html>`:`<body>${l}</body>`,c=s.parseFromString(d,r).body;return a.sanitizeHtmlElement(c,r),i?c.firstChild:c})(e,d,n.format);Ds(t,c);const u=new Np(d,11);Iw(u,c,t.getSpecialElements(),a.sanitizeNamespaceElement),c.innerHTML="";const[g,p]=Fw(u,t,r,n),h=[],b=i?e=>((e,n)=>{pv(t,e)&&n.push(e)})(e,h):S,v={nodes:{},attributes:{}},y=e=>av(l(),m(),e,v);if(((e,t,n)=>{const o=[];for(let n=e,r=n;n;r=n,n=n.walk()){const s=n;K(t,(e=>e(s))),w(s.parent)&&s!==e?n=r:o.push(s)}for(let e=o.length-1;e>=0;e--){const t=o[e];K(n,(e=>e(t)))}})(u,[g,y],[p,b]),h.reverse(),i&&h.length>0)if(n.context){const{pass:e,fail:o}=G(h,(e=>e.parent===u));gv(o,t,u,y),n.invalid=e.length>0}else gv(h,t,u,y);const C=((e,t)=>{var n;const o=null!==(n=t.forced_root_block)&&void 0!==n?n:e.forced_root_block;return!1===o?"":!0===o?"p":o})(r,n);return C&&("body"===u.name||n.isRootContent)&&((e,n)=>{const o=Mw(Lw("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 d=e=>{var t,n;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===(n=i.value)||void 0===n?void 0:n.replace(a,"")))};if(t.isValidChild(e.name,n.toLowerCase())){for(;i;){const t=i.next;f(o,i)?(l||(l=new Np(n,1),l.attr(r.forced_root_block_attrs),e.insert(l,i)),l.append(i)):(d(l),l=null),i=t}d(l)}})(u,C),n.invalid||iv(v,n),u}};return fC(p,r),((e,t,n)=>{t.inline_styles&&tC(e,t,n)})(p,r,t),p},zw=(e,t,n)=>{const o=(e=>Ov(e)?Kp({validate:!1}).serialize(e):e)(e),r=t(o);if(r.isDefaultPrevented())return r;if(Ov(e)){if(r.content!==o){const t=Uw({validate:!1,forced_root_block:!1,...n}).parse(r.content,{context:e.name});return{...r,content:t}}return{...r,content:e}}return r},jw=(e,t)=>{if(t.no_events)return Al.value(t);{const n=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return n.isDefaultPrevented()?Al.error(Rf(e,{content:"",...n}).content):Al.value(n)}},Hw=(e,t,n)=>{if(n.no_events)return t;{const o=zw(t,(t=>Rf(e,{...n,content:t})),{sanitize:Nc(e),sandbox_iframes:Pc(e)});return o.content}},$w=(e,t)=>{if(t.no_events)return Al.value(t);{const n=zw(t.content,(n=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:n})),{sanitize:Nc(e),sandbox_iframes:Pc(e)});return n.isDefaultPrevented()?(Nf(e,n),Al.error(void 0)):Al.value(n)}},qw=(e,t,n)=>{n.no_events||Nf(e,{...n,content:t})},Vw=(e,t,n)=>({element:e,width:t,rows:n}),Ww=(e,t)=>({element:e,cells:t}),Kw=(e,t)=>({x:e,y:t}),Yw=(e,t)=>on(e,t).bind(Je).getOr(1),Gw=(e,t,n)=>{const o=e.rows;return!!(o[n]?o[n].cells:[])[t]},Xw=e=>J(e,((e,t)=>t.cells.length>e?t.cells.length:e),0),Qw=(e,t)=>{const n=e.rows;for(let e=0;e<n.length;e++){const o=n[e].cells;for(let n=0;n<o.length;n++)if(En(o[n],t))return U.some(Kw(n,e))}return U.none()},Jw=(e,t,n,o,r)=>{const s=[],a=e.rows;for(let e=n;e<=r;e++){const n=a[e].cells,r=t<o?n.slice(t,o+1):n.slice(o,t+1);s.push(Ww(a[e].element,r))}return s},Zw=e=>{const t=Vw(_i(e),0,[]);return K(zo(e,"tr"),((e,n)=>{K(zo(e,"td,th"),((o,r)=>{((e,t,n,o,r)=>{const s=Yw(r,"rowspan"),a=Yw(r,"colspan"),i=e.rows;for(let e=n;e<n+s;e++){i[e]||(i[e]=Ww(ki(o),[]));for(let o=t;o<t+a;o++)i[e].cells[o]=e===n&&o===t?r:_i(r)}})(t,((e,t,n)=>{for(;Gw(e,t,n);)t++;return t})(t,r,n),n,e,o)}))})),Vw(t.element,Xw(t.rows),t.rows)},ex=e=>((e,t)=>{const n=_i(e.element),o=yn.fromTag("tbody");return Co(o,t),vo(n,o),n})(e,(e=>W(e.rows,(e=>{const t=W(e.cells,(e=>{const t=ki(e);return sn(t,"colspan"),sn(t,"rowspan"),t})),n=_i(e.element);return Co(n,t),n})))(e)),tx=(e,t,n)=>Qw(e,t).bind((t=>Qw(e,n).map((n=>((e,t,n)=>{const o=t.x,r=t.y,s=n.x,a=n.y,i=r<a?Jw(e,o,r,s,a):Jw(e,o,a,s,r);return Vw(e.element,Xw(i),i)})(e,t,n))))),nx=(e,t)=>ee(e,(e=>"li"===qt(e)&&Eu(e,t))).fold(A([]),(t=>(e=>ee(e,(e=>"ul"===qt(e)||"ol"===qt(e))))(e).map((e=>{const t=yn.fromTag(qt(e)),n=we(fo(e),((e,t)=>qe(t,"list-style")));return lo(t,n),[yn.fromTag("li"),t]})).getOr([]))),ox=(e,t,n)=>{const o=yn.fromDom(t.commonAncestorContainer),r=ph(o,e),s=X(r,(e=>n.isWrapper(qt(e)))),a=nx(r,t),i=s.concat(a.length?a:(e=>Nr(e)?Rn(e).filter(Sr).fold(A([]),(t=>[e,t])):Sr(e)?[e]:[])(o));return W(i,_i)},rx=()=>Jf([]),sx=(e,t,n)=>((e,t)=>{const n=J(t,((e,t)=>(vo(t,e),t)),e);return t.length>0?Jf([n]):n})(yn.fromDom(t.cloneContents()),ox(e,t,n)),ax=(e,t)=>((e,t)=>eo(t,"table",O(En,e)))(e,t[0]).bind((e=>{const n=t[0],o=t[t.length-1],r=Zw(e);return tx(r,n,o).map((e=>Jf([ex(e)])))})).getOrThunk(rx),ix=(e,t,n)=>{const o=vu(t,e);return o.length>0?ax(e,o):((e,t,n)=>t.length>0&&t[0].collapsed?rx():sx(e,t[0],n))(e,t,n)},lx=(e,t)=>t>=0&&t<e.length&&gu(e.charAt(t)),dx=e=>Mr(e.innerText),cx=(e,t)=>{if("text"===t.format)return(e=>U.from(e.selection.getRng()).map((t=>{var n;const o=U.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),r=e.getBody(),s=(e=>e.map((e=>e.nodeName)).getOr("div").toLowerCase())(o),a=yn.fromDom(t.cloneContents());jp(a),Hp(a);const i=e.dom.add(r,s,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},a.dom),l=dx(i),d=Mr(null!==(n=i.textContent)&&void 0!==n?n:"");if(e.dom.remove(i),lx(d,0)||lx(d,d.length-1)){const e=o.getOr(r),t=dx(e),n=t.indexOf(l);return-1===n?l:(lx(t,n-1)?" ":"")+l+(lx(t,n+l.length)?" ":"")}return l})).getOr(""))(e);{const n=((e,t)=>{const n=e.selection.getRng(),o=e.dom.create("body"),r=e.selection.getSel(),s=hp(e,hu(r)),a=t.contextual?ix(yn.fromDom(e.getBody()),s,e.schema).dom:n.cloneContents();return a&&o.appendChild(a),e.selection.serializer.serialize(o,t)})(e,t);return"tree"===t.format?n:e.selection.isCollapsed()?"":n}},mx=e=>Vo(e)?e.outerHTML:tr(e)?ia.encodeRaw(e.data,!1):rr(e)?"\x3c!--"+e.data+"--\x3e":"",ux=(e,t,n)=>{const o=(e=>{let t;const n=document.createElement("div"),o=document.createDocumentFragment();for(e&&(n.innerHTML=e);t=n.firstChild;)o.appendChild(t);return o})(t);if(e.hasChildNodes()&&n<e.childNodes.length){const t=e.childNodes[n];e.insertBefore(o,t)}else e.appendChild(o)},fx=(e,t)=>(((e,t)=>{let n=0;K(e,(e=>{0===e[0]?n++:1===e[0]?(ux(t,e[1],n),n++):2===e[0]&&((e,t)=>{if(e.hasChildNodes()&&t<e.childNodes.length){const n=e.childNodes[t];e.removeChild(n)}})(t,n)}))})(((e,t)=>{const n=e.length+t.length+2,o=new Array(n),r=new Array(n),s=(n,o,r,a,l)=>{const d=i(n,o,r,a);if(null===d||d.start===o&&d.diag===o-a||d.end===n&&d.diag===n-r){let s=n,i=r;for(;s<o||i<a;)s<o&&i<a&&e[s]===t[i]?(l.push([0,e[s]]),++s,++i):o-n>a-r?(l.push([2,e[s]]),++s):(l.push([1,t[i]]),++i)}else{s(n,d.start,r,d.start-d.diag,l);for(let t=d.start;t<d.end;++t)l.push([0,e[t]]);s(d.end,o,d.end-d.diag,a,l)}},a=(n,o,r,s)=>{let a=n;for(;a-o<s&&a<r&&e[a]===t[a-o];)++a;return((e,t,n)=>({start:e,end:t,diag:n}))(n,a,o)},i=(n,s,i,l)=>{const d=s-n,c=l-i;if(0===d||0===c)return null;const m=d-c,u=c+d,f=(u%2==0?u:u+1)/2;let g,p,h,b,v;for(o[1+f]=n,r[1+f]=s+1,g=0;g<=f;++g){for(p=-g;p<=g;p+=2){for(h=p+f,p===-g||p!==g&&o[h-1]<o[h+1]?o[h]=o[h+1]:o[h]=o[h-1]+1,b=o[h],v=b-n+i-p;b<s&&v<l&&e[b]===t[v];)o[h]=++b,++v;if(m%2!=0&&m-g<=p&&p<=m+g&&r[h-m]<=o[h])return a(r[h-m],p+n-i,s,l)}for(p=m-g;p<=m+g;p+=2){for(h=p+f-m,p===m-g||p!==m+g&&r[h+1]<=r[h-1]?r[h]=r[h+1]-1:r[h]=r[h-1],b=r[h]-1,v=b-n+i-p;b>=n&&v>=i&&e[b]===t[v];)r[h]=b--,v--;if(m%2==0&&-g<=p&&p<=g&&r[h]<=o[h+m])return a(r[h],p+n-i,s,l)}}return null},l=[];return s(0,e.length,0,t.length,l),l})(W(ue(t.childNodes),mx),e),t),t),gx=Me((()=>document.implementation.createHTMLDocument("undo"))),px=e=>{const t=e.serializer.getTempAttrs(),n=zp(e.getBody(),t);return(e=>null!==e.querySelector("iframe"))(n)?(o=((e,t)=>X(W(ue(e.childNodes),t?N(Mr,mx):mx),(e=>e.length>0)))(n,!0),{type:"fragmented",fragments:o,content:"",bookmark:null,beforeBookmark:null}):{type:"complete",fragments:null,content:Mr(n.innerHTML),bookmark:null,beforeBookmark:null};var o},hx=(e,t,n)=>{const o=n?t.beforeBookmark:t.bookmark;"fragmented"===t.type?fx(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!x(o)||!eu(o)||!o.isFakeCaret}),o&&(e.selection.moveToBookmark(o),e.selection.scrollIntoView())},bx=e=>"fragmented"===e.type?e.fragments.join(""):e.content,vx=e=>{const t=yn.fromTag("body",gx());return So(t,bx(e)),K(zo(t,"*[data-mce-bogus]"),Eo),ko(t)},yx=(e,t)=>!(!e||!t)&&(!!((e,t)=>bx(e)===bx(t))(e,t)||((e,t)=>vx(e)===vx(t))(e,t)),Cx=e=>0===e.get(),wx=(e,t,n)=>{Cx(n)&&(e.typing=t)},xx=(e,t)=>{e.typing&&(wx(e,!1,t),e.add())},Ex=e=>({init:{bindEvents:S},undoManager:{beforeChange:(t,n)=>((e,t,n)=>{Cx(t)&&n.set(Sl(e.selection))})(e,t,n),add:(t,n,o,r,s,a)=>((e,t,n,o,r,s,a)=>{const i=px(e),l=Pt.extend(s||{},i);if(!Cx(o)||e.removed)return null;const d=t.data[n.get()];if(e.dispatch("BeforeAddUndo",{level:l,lastLevel:d,originalEvent:a}).isDefaultPrevented())return null;if(d&&yx(d,l))return null;t.data[n.get()]&&r.get().each((e=>{t.data[n.get()].beforeBookmark=e}));const c=qd(e);if(c&&t.data.length>c){for(let e=0;e<t.data.length-1;e++)t.data[e]=t.data[e+1];t.data.length--,n.set(t.data.length)}l.bookmark=Sl(e.selection),n.get()<t.data.length-1&&(t.data.length=n.get()+1),t.data.push(l),n.set(t.data.length-1);const m={level:l,lastLevel:d,originalEvent:a};return n.get()>0?(e.setDirty(!0),e.dispatch("AddUndo",m),e.dispatch("change",m)):e.dispatch("AddUndo",m),l})(e,t,n,o,r,s,a),undo:(t,n,o)=>((e,t,n,o)=>{let r;return t.typing&&(t.add(),t.typing=!1,wx(t,!1,n)),o.get()>0&&(o.set(o.get()-1),r=t.data[o.get()],hx(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,n,o),redo:(t,n)=>((e,t,n)=>{let o;return t.get()<n.length-1&&(t.set(t.get()+1),o=n[t.get()],hx(e,o,!1),e.setDirty(!0),e.dispatch("Redo",{level:o})),o})(e,t,n),clear:(t,n)=>((e,t,n)=>{t.data=[],n.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,n),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,n)=>((e,t,n)=>n.get()>0||t.typing&&t.data[0]&&!yx(px(e),t.data[0]))(e,t,n),hasRedo:(e,t)=>((e,t)=>t.get()<e.data.length-1&&!e.typing)(e,t),transact:(e,t,n)=>((e,t,n)=>(xx(e,t),e.beforeChange(),e.ignore(n),e.add()))(e,t,n),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,n,o,r)=>((e,t,n,o,r)=>{if(t.transact(o)){const o=t.data[n.get()].bookmark,s=t.data[n.get()-1];hx(e,s,!0),t.transact(r)&&(t.data[n.get()-1].beforeBookmark=o)}})(e,t,n,o,r)},formatter:{match:(t,n,o,r)=>$v(e,t,n,o,r),matchAll:(t,n)=>((e,t,n)=>{const o=[],r={},s=e.selection.getStart();return e.dom.getParent(s,(s=>{for(let a=0;a<t.length;a++){const i=t[a];!r[i]&&Hv(e,s,i,n)&&(r[i]=!0,o.push(i))}}),e.dom.getRoot()),o})(e,t,n),matchNode:(t,n,o,r)=>Hv(e,t,n,o,r),canApply:t=>((e,t)=>{const n=e.formatter.get(t),o=e.dom;if(n&&e.selection.isEditable()){const t=e.selection.getStart(),r=Hu(o,t);for(let e=n.length-1;e>=0;e--){const t=n[e];if(!Wu(t))return!0;for(let e=r.length-1;e>=0;e--)if(o.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>qv(e,t),apply:(t,n,o)=>Vy(e,t,n,o),remove:(t,n,o,r)=>Fy(e,t,n,o,r),toggle:(t,n,o)=>((e,t,n,o)=>{const r=e.formatter.get(t);r&&(!$v(e,t,n,o)||"toggle"in r[0]&&!r[0].toggle?Vy(e,t,n,o):Fy(e,t,n,o))})(e,t,n,o),formatChanged:(t,n,o,r,s)=>Qy(e,t,n,o,r,s)},editor:{getContent:t=>((e,t)=>U.from(e.getBody()).fold(A("tree"===t.format?new Np("body",11):""),(n=>qp(e,t,n))))(e,t),setContent:(t,n)=>Pv(e,t,n),insertContent:(t,n)=>Tv(e,t,n),addVisual:t=>((e,t)=>{const n=e.dom,o=x(t)?t:e.getBody();K(n.select("table,a",o),(t=>{switch(t.nodeName){case"TABLE":const o=Zd(e),r=n.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?n.removeClass(t,o):n.addClass(t,o);break;case"A":if(!n.getAttrib(t,"href")){const o=n.getAttrib(t,"name")||t.id,r=ec(e);o&&e.hasVisual?n.addClass(t,r):n.removeClass(t,r)}}})),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,n)=>((e,t,n={})=>{const o=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(n,t);return jw(e,o).fold(D,(t=>{const n=cx(e,t);return Hw(e,n,t)}))})(e,t,n)},autocompleter:{addDecoration:t=>wp(e,t),removeDecoration:()=>((e,t)=>xp(t).each((t=>{const n=e.selection.getBookmark();Eo(t),e.selection.moveToBookmark(n)})))(e,yn.fromDom(e.getBody()))},raw:{getModel:()=>U.none()}}),_x=e=>ke(e.plugins,"rtc"),kx=e=>{const t=e;return(e=>_e(e.plugins,"rtc").bind((e=>U.from(e.setup))))(e).fold((()=>(t.rtcInstance=Ex(e),U.none())),(e=>(t.rtcInstance=(()=>{const e=A(null),t=A("");return{init:{bindEvents:S},undoManager:{beforeChange:S,add:e,undo:e,redo:e,clear:S,reset:S,hasUndo:I,hasRedo:I,transact:e,ignore:S,extra:S},formatter:{match:I,matchAll:A([]),matchNode:A(void 0),canApply:I,closest:t,apply:S,remove:S,toggle:S,formatChanged:A({unbind:S})},editor:{getContent:t,setContent:A({content:"",html:""}),insertContent:A(""),addVisual:S},selection:{getContent:t},autocompleter:{addDecoration:S,removeDecoration:S},raw:{getModel:A(U.none())}}})(),U.some((()=>e().then((e=>(t.rtcInstance=(e=>{const t=e=>p(e)?e:{},{init:n,undoManager:o,formatter:r,editor:s,selection:a,autocompleter:i,raw:l}=e;return{init:{bindEvents:n.bindEvents},undoManager:{beforeChange:o.beforeChange,add:o.add,undo:o.undo,redo:o.redo,clear:o.clear,reset:o.reset,hasUndo:o.hasUndo,hasRedo:o.hasRedo,transact:(e,t,n)=>o.transact(n),ignore:(e,t)=>o.ignore(t),extra:(e,t,n,r)=>o.extra(n,r)},formatter:{match:(e,n,o,s)=>r.match(e,t(n),s),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,n,o)=>r.apply(e,t(n)),remove:(e,n,o,s)=>r.remove(e,t(n)),toggle:(e,n,o)=>r.toggle(e,t(n)),formatChanged:(e,t,n,o,s)=>r.formatChanged(t,n,o,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:()=>U.some(l.getRawModel())}}})(e),e.rtc.isRemote))))))))},Sx=e=>e.rtcInstance?e.rtcInstance:Ex(e),Nx=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},Rx=e=>Nx(e).init.bindEvents(),Ax=(e,t={})=>((e,t,n)=>Nx(e).selection.getContent(t,n))(e,t.format?t.format:"html",t),Dx=e=>0===e.dom.length?(xo(e),U.none()):U.some(e),Tx=(e,t,n,o,r)=>{e.bind((e=>((o?Gh:Yh)(e.dom,o?e.dom.length:0,r),t.filter(Gt).map((t=>((e,t,n,o,r)=>{const s=e.dom,a=t.dom,i=o?s.length:a.length;o?(Xh(s,a,r,!1,!o),n.setStart(a,i)):(Xh(a,s,r,!1,!o),n.setEnd(a,i))})(e,t,n,o,r)))))).orThunk((()=>{const e=((e,t)=>e.filter((e=>xf.isBookmarkNode(e.dom))).bind(t?On:Tn))(t,o).or(t).filter(Gt);return e.map((e=>((e,t,n)=>{Rn(e).each((o=>{const r=e.dom;t&&Fh(o,rl(r,0),n)?Yh(r,0,n):!t&&Uh(o,rl(r,r.length),n)&&Gh(r,r.length,n)}))})(e,o,r)))}))},Ox=(e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(n,t);$w(e,o).each((t=>{const n=((e,t)=>{if("raw"!==t.format){const n=e.selection.getRng(),o=e.dom.getParent(n.commonAncestorContainer,e.dom.isBlock),r=o?{context:o.nodeName.toLowerCase()}:{},s=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return Kp({validate:!1},e.schema).serialize(s)}return t.content})(e,t),o=e.selection.getRng();((e,t,n)=>{const o=U.from(t.firstChild).map(yn.fromDom),r=U.from(t.lastChild).map(yn.fromDom);e.deleteContents(),e.insertNode(t);const s=o.bind(Tn).filter(Gt).bind(Dx),a=r.bind(On).filter(Gt).bind(Dx);Tx(s,o,e,!0,n),Tx(a,r,e,!1,n),e.collapse(!1)})(o,o.createContextualFragment(n),e.schema),e.selection.setRng(o),Pg(e,o),qw(e,n,t)}))},Bx=(e,t,n)=>{if(ke(e,t)){const o=X(e[t],(e=>e!==n));0===o.length?delete e[t]:e[t]=o}};var Px=(e,t)=>{let n,o;const r=(t,n)=>ee(n,(n=>e.is(n,t))),s=t=>e.getParents(t,void 0,e.getRoot());return{selectorChangedWithUnbind:(e,a)=>(n||(n={},o={},t.on("NodeChange",(e=>{const t=e.element,a=s(t),i={};he(n,((e,t)=>{r(t,a).each((n=>{o[t]||(K(e,(e=>{e(!0,{node:n,selector:t,parents:a})})),o[t]=e),i[t]=e}))})),he(o,((e,n)=>{i[n]||(delete o[n],K(e,(e=>{e(!1,{node:t,selector:n,parents:a})})))}))}))),n[e]||(n[e]=[]),n[e].push(a),r(e,s(t.selection.getStart())).each((()=>{o[e]=n[e]})),{unbind:()=>{Bx(n,e,a),Bx(o,e,a)}})}};const Lx=e=>!(!e||!e.ownerDocument)&&_n(yn.fromDom(e.ownerDocument),yn.fromDom(e)),Mx=(e,t,n,o)=>{let r,s;const{selectorChangedWithUnbind:a}=Px(e,o),i=(e,t)=>Ox(o,e,t),l=e=>{const t=c();t.collapse(!!e),m(t)},d=()=>t.getSelection?t.getSelection():t.document.selection,c=()=>{let n;const a=(e,t,n)=>{try{return t.compareBoundaryPoints(e,n)}catch(e){return-1}},i=t.document;if(x(o.bookmark)&&!ip(o)){const e=Wg(o);if(e.isSome())return e.map((e=>hp(o,[e])[0])).getOr(i.createRange())}try{const e=d();e&&!qo(e.anchorNode)&&(n=e.rangeCount>0?e.getRangeAt(0):i.createRange(),n=hp(o,[n])[0])}catch(e){}if(n||(n=i.createRange()),sr(n.startContainer)&&n.collapsed){const t=e.getRoot();n.setStart(t,0),n.setEnd(t,0)}return r&&s&&(0===a(n.START_TO_START,n,r)&&0===a(n.END_TO_END,n,r)?n=s:(r=null,s=null)),n},m=(e,t)=>{if(!(e=>!!e&&Lx(e.startContainer)&&Lx(e.endContainer))(e))return;const n=d();if(e=o.dispatch("SetSelectionRange",{range:e,forward:t}).range,n){s=e;try{n.removeAllRanges(),n.addRange(e)}catch(e){}!1===t&&n.extend&&(n.collapse(e.endContainer,e.endOffset),n.extend(e.startContainer,e.startOffset)),r=n.rangeCount>0?n.getRangeAt(0):null}if(!e.collapsed&&e.startContainer===e.endContainer&&(null==n?void 0:n.setBaseAndExtent)&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()){const t=e.startContainer.childNodes[e.startOffset];t&&"IMG"===t.nodeName&&(n.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),n.anchorNode===e.startContainer&&n.focusNode===e.endContainer||n.setBaseAndExtent(t,0,t,1))}o.dispatch("AfterSetSelectionRange",{range:e,forward:t})},u=()=>{const t=d(),n=null==t?void 0:t.anchorNode,o=null==t?void 0:t.focusNode;if(!t||!n||!o||qo(n)||qo(o))return!0;const r=e.createRng(),s=e.createRng();try{r.setStart(n,t.anchorOffset),r.collapse(!0),s.setStart(o,t.focusOffset),s.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,s)<=0},f={dom:e,win:t,serializer:n,editor:o,expand:(t={type:"word"})=>m(ug(e).expand(c(),t)),collapse:l,setCursorLocation:(t,n)=>{const r=e.createRng();x(t)&&x(n)?(r.setStart(t,n),r.setEnd(t,n),m(r),l(!1)):(_u(e,r,o.getBody(),!0),m(r))},getContent:e=>Ax(o,e),setContent:i,getBookmark:(e,t)=>g.getBookmark(e,t),moveToBookmark:e=>g.moveToBookmark(e),select:(t,n)=>(((e,t,n)=>U.from(t).bind((t=>U.from(t.parentNode).map((o=>{const r=e.nodeIndex(t),s=e.createRng();return s.setStart(o,r),s.setEnd(o,r+1),n&&(_u(e,s,t,!0),_u(e,s,t,!1)),s})))))(e,t,n).each(m),t),isCollapsed:()=>{const e=c(),t=d();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isEditable:()=>{const t=c(),n=o.getBody().querySelectorAll('[data-mce-selected="1"]');return n.length>0?re(n,(t=>e.isEditable(t.parentElement))):mp(e,t)},isForward:u,setNode:t=>(i(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{if(!t)return e;let n=t.startContainer,o=t.endContainer;const r=t.startOffset,s=t.endOffset;let a=t.commonAncestorContainer;t.collapsed||(n===o&&s-r<2&&n.hasChildNodes()&&(a=n.childNodes[r]),tr(n)&&tr(o)&&(n=n.length===r?pp(n.nextSibling,!0):n.parentNode,o=0===s?pp(o.previousSibling,!1):o.parentNode,n&&n===o&&(a=n)));const i=tr(a)?a.parentNode:a;return Wo(i)?i:e})(o.getBody(),c()),getSel:d,setRng:m,getRng:c,getStart:e=>fp(o.getBody(),c(),e),getEnd:e=>gp(o.getBody(),c(),e),getSelectedBlocks:(t,n)=>((e,t,n,o)=>{const r=[],s=e.getRoot(),a=e.getParent(n||fp(s,t,t.collapsed),e.isBlock),i=e.getParent(o||gp(s,t,t.collapsed),e.isBlock);if(a&&a!==s&&r.push(a),a&&i&&a!==i){let t;const n=new Ho(a,s);for(;(t=n.next())&&t!==i;)e.isBlock(t)&&r.push(t)}return i&&a!==i&&i!==s&&r.push(i),r})(e,c(),t,n),normalize:()=>{const t=c(),n=d();if(!(hu(n).length>1)&&ku(o)){const n=dg(e,t);return n.each((e=>{m(e,u())})),n.getOr(t)}return t},selectorChanged:(e,t)=>(a(e,t),f),selectorChangedWithUnbind:a,getScrollContainer:()=>{let t,n=e.getRoot();for(;n&&"BODY"!==n.nodeName;){if(n.scrollHeight>n.clientHeight){t=n;break}n=n.parentNode}return t},scrollIntoView:(e,t)=>{x(e)?((e,t,n)=>{(e.inline?Tg:Bg)(e,t,n)})(o,e,t):Pg(o,c(),t)},placeCaretAt:(e,t)=>m(tg(e,t,o.getDoc())),getBoundingClientRect:()=>{const e=c();return e.collapsed?rl.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=s=null,p.destroy()}},g=xf(f),p=Lf(f,o);return f.bookmarkManager=g,f.controlSelection=p,f},Ix=(e,t,n)=>((e,t)=>x(e)&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,n)?((e,t,n)=>{let o;const r=e.dom;let s=t.cloneNode(!0);const a=document.implementation;if(a.createHTMLDocument){const e=a.createHTMLDocument("");Pt.each("BODY"===s.nodeName?s.childNodes:[s],(t=>{e.body.appendChild(e.importNode(t,!0))})),s="BODY"!==s.nodeName?e.body.firstChild:e.body,o=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...n,node:s}),o&&(r.doc=o),s})(e,t,n):t,Fx=(e,t,n)=>{-1===Pt.inArray(t,n)&&(e.addAttributeFilter(n,((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)})),t.push(n))},Ux=(e,t,n,o,r)=>{const s=((e,t,n)=>Kp(e,t).serialize(n))(t,n,o);return((e,t,n)=>{if(!t.no_events&&e){const o=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:n});return o.content}return n})(e,r,s)},zx=(e,t)=>{const n=["data-mce-selected"],o={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},r=t&&t.dom?t.dom:Xa.DOM,s=t&&t.schema?t.schema:ya(o),a=Uw(o,s);return((e,t,n)=>{e.addAttributeFilter("data-mce-tabindex",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];o.attr("tabindex",o.attr("data-mce-tabindex")),o.attr(t,null)}})),e.addAttributeFilter("src,href,style",((e,o)=>{const r="data-mce-"+o,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(o,l.length>0?l:null),t.attr(r,null)):(l=t.attr(o),"style"===o?l=n.serializeStyle(n.parseStyle(l),t.name):s&&(l=s.call(a,l,o,t.name)),t.attr(o,l.length>0?l:null))}})),e.addAttributeFilter("class",(e=>{let t=e.length;for(;t--;){const n=e[t];let o=n.attr("class");o&&(o=o.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),n.attr("class",o.length>0?o:null))}})),e.addAttributeFilter("data-mce-type",((e,t,n)=>{let o=e.length;for(;o--;){const t=e[o];if("bookmark"===t.attr("data-mce-type")&&!n.cleanup){const e=U.from(t.firstChild).exists((e=>{var t;return!Lr(null!==(t=e.value)&&void 0!==t?t:"")}));e?t.unwrap():t.remove()}}})),e.addNodeFilter("script,style",((e,n)=>{var o;const r=e=>e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\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!==(o=null==i?void 0:i.value)&&void 0!==o?o:"";if("script"===n){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="// <![CDATA[\n"+r(l)+"\n// ]]>")}else"xhtml"===t.element_format&&i&&l.length>0&&(i.value="\x3c!--\n"+r(l)+"\n--\x3e")}})),e.addNodeFilter("#comment",(e=>{let o=e.length;for(;o--;){const r=e[o],s=r.value;t.preserve_cdata&&0===(null==s?void 0:s.indexOf("[CDATA["))?(r.name="#cdata",r.type=4,r.value=n.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 n=e.length;for(;n--;){const o=e[n];7===o.type?o.remove():1===o.type&&("input"!==t||o.attr("type")||o.attr("type","text"))}})),e.addAttributeFilter("data-mce-type",(t=>{K(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 n=e.length;for(;n--;)e[n].attr(t,null)})),t.remove_trailing_brs&&nC(t,e,e.schema)})(a,o,r),{schema:s,addNodeFilter:a.addNodeFilter,addAttributeFilter:a.addAttributeFilter,serialize:(e,n={})=>{const i={format:"html",...n},l=Ix(t,e,i),d=((e,t,n)=>{const o=Mr(n.getInner?t.innerHTML:e.getOuterHTML(t));return n.selection||Dr(yn.fromDom(t))?o:Pt.trim(o)})(r,l,i),c=((e,t,n)=>{const o=n.selection?{forced_root_block:!1,...n}:n,r=e.parse(t,o);return(e=>{const t=e=>"br"===(null==e?void 0:e.name),n=e.lastChild;if(t(n)){const e=n.prev;t(e)&&(n.remove(),e.remove())}})(r),r})(a,d,i);return"tree"===i.format?c:Ux(t,o,s,c,i)},addRules:s.addValidElements,setRules:s.setValidElements,addTempAttr:O(Fx,a,n),getTempAttrs:A(n),getNodeFilters:a.getNodeFilters,getAttributeFilters:a.getAttributeFilters,removeNodeFilter:a.removeNodeFilter,removeAttributeFilter:a.removeAttributeFilter}},jx=(e,t)=>{const n=zx(e,t);return{schema:n.schema,addNodeFilter:n.addNodeFilter,addAttributeFilter:n.addAttributeFilter,serialize:n.serialize,addRules:n.addRules,setRules:n.setRules,addTempAttr:n.addTempAttr,getTempAttrs:n.getTempAttrs,getNodeFilters:n.getNodeFilters,getAttributeFilters:n.getAttributeFilters,removeNodeFilter:n.removeNodeFilter,removeAttributeFilter:n.removeAttributeFilter}},Hx=(e,t={})=>{const n=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return jw(e,n).fold(D,(t=>{const n=((e,t)=>Sx(e).editor.getContent(t))(e,t);return Hw(e,n,t)}))},$x=(e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,content:t}))(n,t);return $w(e,o).map((t=>{const n=((e,t,n)=>Sx(e).editor.setContent(t,n))(e,t.content,t);return qw(e,n.html,t),n.content})).getOr(t)},qx="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(","),Vx="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(","),Wx="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor".split(","),Kx=[{name:"template",replacedWith:"Advanced Template"},{name:"rtc"}],Yx=(e,t)=>{const n=X(t,(t=>ke(e,t)));return le(n)},Gx=e=>{const t=Yx(e,qx),n=e.forced_root_block;return!1!==n&&""!==n||t.push("forced_root_block (false only)"),le(t)},Xx=e=>Yx(e,Vx),Qx=(e,t)=>{const n=Pt.makeMap(e.plugins," "),o=X(t,(e=>ke(n,e)));return le(o)},Jx=e=>Qx(e,Wx),Zx=e=>Qx(e,Kx.map((e=>e.name))),eE=e=>ee(Kx,(t=>t.name===e)).fold((()=>e),(t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e)),tE=(e,t)=>{((e,t)=>{const n=Gx(e),o=Jx(t),r=o.length>0,s=n.length>0,a="mobile"===t.theme;if(r||s||a){const e="\n- ",t=a?`\n\nThemes:${e}mobile`:"",i=r?`\n\nPlugins:${e}${o.join(e)}`:"",l=s?`\n\nOptions:${e}${n.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 n=Xx(e),o=Zx(t),r=o.length>0,s=n.length>0;if(r||s){const e="\n- ",t=r?`\n\nPlugins:${e}${o.map(eE).join(e)}`:"",a=s?`\n\nOptions:${e}${n.join(e)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+t+a)}})(e,t)},nE=Xa.DOM,oE=e=>U.from(e).each((e=>e.destroy())),rE=e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:n}=e,o=e.getBody(),r=e.getElement();o&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&x(null==r?void 0:r.nextSibling)&&nE.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&o&&(e=>{nE.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),nE.remove(e.getContainer()),oE(t),oE(n),e.destroy()}},sE=(e,t)=>{const{selection:n,dom:o}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),oE(n),oE(o)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),nE.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 n=e.selection;if(n){const e=n.dom;t.selection=n.win=n.dom=e.doc=null}})(e),e.destroyed=!0):e.remove())},aE=(()=>{const e={};return{add:(t,n)=>{e[t]=n},get:t=>e[t]?e[t]:{icons:{}},has:t=>ke(e,t)}})(),iE=ri.ModelManager,lE=(e,t)=>t.dom[e],dE=(e,t)=>parseInt(co(t,e),10),cE=O(lE,"clientWidth"),mE=O(lE,"clientHeight"),uE=O(dE,"margin-top"),fE=O(dE,"margin-left"),gE=(e,t,n)=>{const o=yn.fromDom(e.getBody()),r=e.inline?o:(s=o,yn.fromDom(Sn(s).dom.documentElement));var s;const a=((e,t,n,o)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:n-(e?r.left+t.dom.clientLeft+fE(t):0),y:o-(e?r.top+t.dom.clientTop+uE(t):0)}})(e.inline,r,t,n);return((e,t,n)=>{const o=cE(e),r=mE(e);return t>=0&&n>=0&&t<=o&&n<=r})(r,a.x,a.y)},pE=e=>{const t=e.inline?e.getBody():e.getContentAreaContainer();return(n=t,U.from(n).map(yn.fromDom)).map(Yn).getOr(!1);var n},hE=e=>{const t=[],n=()=>{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}})()},o=()=>U.from(t[0]),r=()=>{K(t,(e=>{e.reposition()}))},s=e=>{te(t,(t=>t===e)).each((e=>{t.splice(e,1)}))},a=(a,i=!0)=>e.removed||!pE(e)?{}:(i&&e.dispatch("BeforeOpenNotification",{notification:a}),ee(t,(e=>{return t=n().getArgs(e),o=a,!(t.type!==o.type||t.text!==o.text||t.progressBar||t.timeout||o.progressBar||o.timeout);var t,o})).getOrThunk((()=>{e.editorManager.setActive(e);const i=n().open(a,(()=>{s(i),r(),lp(e)&&o().fold((()=>e.focus()),(e=>Lg(yn.fromDom(e.getEl()))))}));return(e=>{t.push(e)})(i),r(),e.dispatch("OpenNotification",{notification:{...i}}),i}))),i=A(t);return(e=>{e.on("SkinLoaded",(()=>{const t=Rd(e);t&&a({text:t,type:"warning",timeout:0},!1),r()})),e.on("show ResizeEditor ResizeWindow NodeChange",(()=>{requestAnimationFrame(r)})),e.on("remove",(()=>{K(t.slice(),(e=>{n().close(e)}))}))})(e),{open:a,close:()=>{o().each((e=>{n().close(e),s(e),r()}))},getNotifications:i}},bE=ri.PluginManager,vE=ri.ThemeManager,yE=e=>{let t=[];const n=()=>{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}})()},o=(e,t)=>(...n)=>t?t.apply(e,n):void 0,r=n=>{t.push(n),(t=>{e.dispatch("OpenWindow",{dialog:t})})(n)},s=n=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(n),t=X(t,(e=>e!==n)),0===t.length&&e.focus()},a=t=>{e.editorManager.setActive(e),Vg(e),e.ui.show();const n=t();return r(n),n};return e.on("remove",(()=>{K(t,(e=>{n().close(e)}))})),{open:(e,t)=>a((()=>n().open(e,t,s))),openUrl:e=>a((()=>n().openUrl(e,s))),alert:(e,t,r)=>{const s=n();s.alert(e,o(r||s,t))},confirm:(e,t,r)=>{const s=n();s.confirm(e,o(r||s,t))},close:()=>{U.from(t[t.length-1]).each((e=>{n().close(e),s(e)}))}}},CE=(e,t)=>{e.notificationManager.open({type:"error",text:t})},wE=(e,t)=>{e._skinLoaded?CE(e,t):e.on("SkinLoaded",(()=>{CE(e,t)}))},xE=(e,t,n)=>{_f(e,t,{message:n}),console.error(n)},EE=(e,t,n)=>n?`Failed to load ${e}: ${n} from url ${t}`:`Failed to load ${e} url: ${t}`,_E=(e,...t)=>{const n=window.console;n&&(n.error?n.error(e,...t):n.log(e,...t))},kE=e=>"content/"+e+"/content.css",SE=(e,t)=>{const n=e.editorManager.baseURL+"/skins/content",o=`content${e.editorManager.suffix}.css`;return W(t,(t=>(e=>tinymce.Resource.has(kE(e)))(t)?t:(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!e.inline?`${n}/${t}/${o}`:e.documentBaseURI.toAbsolute(t)))},NE=e=>{e.contentCSS=e.contentCSS.concat((e=>SE(e,yd(e)))(e),(e=>SE(e,wd(e)))(e))},RE=(e,t)=>{const n={};return{findAll:(o,r=F)=>{const s=X((e=>e?ue(e.getElementsByTagName("img")):[])(o),(t=>{const n=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!n||n===Dt.transparentSrc)&&(qe(n,"blob:")?!e.isUploaded(n)&&r(t):!!qe(n,"data:")&&r(t))})),a=W(s,(e=>{const o=e.src;if(ke(n,o))return n[o].then((t=>g(t)?t:{image:e,blobInfo:t.blobInfo}));{const r=((e,t)=>{const n=()=>Promise.reject("Invalid data URI");if(qe(t,"blob:")){const o=e.getByUri(t);return x(o)?Promise.resolve(o):sC(t).then((t=>aC(t).then((o=>lC(o,!1,(n=>U.some(dC(e,t,n)))).getOrThunk(n)))))}return qe(t,"data:")?cC(e,t).fold(n,(e=>Promise.resolve(e))):Promise.reject("Unknown image data format")})(t,o).then((t=>(delete n[o],{image:e,blobInfo:t}))).catch((e=>(delete n[o],e)));return n[o]=r,r}}));return Promise.all(a)}}},AE=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),n=t=>t in e;return{hasBlobUri:n,getResultUri:t=>{const n=e[t];return n?n.resultUri:null},isPending:t=>!!n(t)&&1===e[t].status,isUploaded:t=>!!n(t)&&2===e[t].status,markPending:n=>{e[n]=t(1,null)},markUploaded:(n,o)=>{e[n]=t(2,o)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let DE=0;const TE=e=>e+DE+++(()=>{const e=()=>Math.round(4294967295*Math.random()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),OE=(e,t)=>{const n={},o=(e,n)=>new Promise(((o,r)=>{const s=new XMLHttpRequest;s.open("POST",t.url),s.withCredentials=t.credentials,s.upload.onprogress=e=>{n(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 n,a;e&&g(e.location)?o((n=t.basePath,a=e.location,n?n.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+s.responseText)};const a=new FormData;a.append("file",e.blob(),e.filename()),s.send(a)})),r=E(t.handler)?t.handler:o,s=(e,t)=>({url:t,blobInfo:e,status:!0}),a=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),i=(e,t)=>{Pt.each(n[e],(e=>{e(t)})),delete n[e]},l=(t,o)=>(t=Pt.grep(t,(t=>!e.isUploaded(t.blobUri()))),Promise.all(Pt.map(t,(t=>e.isPending(t.blobUri())?(e=>{const t=e.blobUri();return new Promise((e=>{n[t]=n[t]||[],n[t].push(e)}))})(t):((t,n,o)=>(e.markPending(t.blobUri()),new Promise((r=>{let l,d;try{const c=()=>{l&&(l.close(),d=S)},m=n=>{c(),e.markUploaded(t.blobUri(),n),i(t.blobUri(),s(t,n)),r(s(t,n))},u=n=>{c(),e.removeFailed(t.blobUri()),i(t.blobUri(),a(t,n)),r(a(t,n))};d=e=>{e<0||e>100||U.from(l).orThunk((()=>U.from(o).map(L))).each((t=>{l=t,t.progressBar.value(e)}))},n(t,d).then(m,(e=>{u(g(e)?{message:e}:e)}))}catch(e){r(a(t,e))}}))))(t,r,o)))));return{upload:(e,n)=>t.url||r!==o?l(e,n):new Promise((e=>{e([])}))}},BE=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),PE=(e,t)=>OE(t,{url:dd(e),basePath:cd(e),credentials:md(e),handler:ud(e)}),LE=e=>t=>{((e,t)=>e.dom.isEmpty(t.dom)&&x(e.schema.getTextBlockElements()[qt(t)]))(e,t)&&vo(t,yn.fromHtml('<br data-mce-bogus="1" />'))},ME=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||TE("blobid"),n=e.name||t,o=e.blob;return{id:A(t),name:A(n),filename:A(e.filename||n+"."+(r=o.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:A(o),base64:A(e.base64),blobUri:A(e.blobUri||URL.createObjectURL(o)),uri:A(e.uri)};var r},n=t=>ee(e,t).getOrUndefined(),o=e=>n((t=>t.id()===e));return{create:(e,n,o,r,s)=>{if(g(e))return t({id:e,name:r,filename:s,blob:n,base64:o});if(p(e))return t(e);throw new Error("Unknown input type")},add:t=>{o(t.id())||e.push(t)},get:o,getByUri:e=>n((t=>t.blobUri()===e)),getByData:(e,t)=>n((n=>n.base64()===e&&n.blob().type===t)),findFirst:n,removeByUri:t=>{e=X(e,(e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1)))},destroy:()=>{K(e,(e=>{URL.revokeObjectURL(e.blobUri())})),e=[]}}})();let n,o;const r=AE(),s=[],a=t=>n=>e.selection?t(n):[],i=(e,t,n)=>{let o=0;do{o=e.indexOf(t,o),-1!==o&&(e=e.substring(0,o)+n+e.substr(o+t.length),o+=n.length-t.length+1)}while(-1!==o);return e},l=(e,t,n)=>{const o=`src="${n}"${n===Dt.transparentSrc?' data-mce-placeholder="1"':""}`;return e=i(e,`src="${t}"`,o),e=i(e,'data-mce-src="'+t+'"','data-mce-src="'+n+'"')},d=(t,n)=>{K(e.undoManager.data,(e=>{"fragmented"===e.type?e.fragments=W(e.fragments,(e=>l(e,t,n))):e.content=l(e.content,t,n)}))},c=()=>(n||(n=PE(e,r)),f().then(a((o=>{const r=W(o,(e=>e.blobInfo));return n.upload(r,BE(e)).then(a((n=>{const r=[];let s=!1;const a=W(n,((n,a)=>{const{blobInfo:i,image:l}=o[a];let c=!1;return n.status&&ad(e)?(n.url&&!$e(l.src,n.url)&&(s=!0),t.removeByUri(l.src),_x(e)||((t,n)=>{const o=e.convertURL(n,"src");var r;d(t.src,n),tn(yn.fromDom(t),{src:sd(e)?(r=n,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):n,"data-mce-src":o})})(l,n.url)):n.error&&(n.error.remove&&(d(l.src,Dt.transparentSrc),r.push(l),c=!0),((e,t)=>{wE(e,oi.translate(["Failed to upload image: {0}",t]))})(e,n.error.message)),{element:l,status:n.status,uploadUri:n.url,blobInfo:i,removed:c}}));return r.length>0&&!_x(e)?e.undoManager.transact((()=>{K(_o(r),(n=>{const o=Rn(n);xo(n),o.each(LE(e)),t.removeByUri(n.dom.src)}))})):s&&e.undoManager.dispatchChange(),a})))})))),m=()=>rd(e)?c():Promise.resolve([]),u=e=>re(s,(t=>t(e))),f=()=>(o||(o=RE(r,t)),o.findAll(e.getBody(),u).then(a((t=>{const n=X(t,(t=>g(t)?(wE(e,t),!1):"blob"!==t.uriType));return _x(e)||K(n,(e=>{d(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")})),n})))),h=n=>n.replace(/src="(blob:[^"]+)"/g,((n,o)=>{const s=r.getResultUri(o);if(s)return'src="'+s+'"';let a=t.getByUri(o);return a||(a=J(e.editorManager.get(),((e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(o)),void 0)),a?'src="data:'+a.blob().type+";base64,"+a.base64()+'"':n}));return e.on("SetContent",(()=>{rd(e)?m():f()})),e.on("RawSaveContent",(e=>{e.content=h(e.content)})),e.on("GetContent",(e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=h(e.content))})),e.on("PostRender",(()=>{e.parser.addNodeFilter("img",(e=>{K(e,(e=>{const n=e.attr("src");if(!n||t.getByUri(n))return;const o=r.getResultUri(n);o&&e.attr("src",o)}))}))})),{blobCache:t,addFilter:e=>{s.push(e)},uploadImages:c,uploadImagesAuto:m,scanForImages:f,destroy:()=>{t.destroy(),r.destroy(),o=n=null}}},IE={remove_similar:!0,inherit:!1},FE={selector:"td,th",...IE},UE={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...FE},tablecellverticalalign:{styles:{"vertical-align":"%value"},...FE},tablecellbordercolor:{styles:{borderColor:"%value"},...FE},tablecellclass:{classes:["%value"],...FE},tableclass:{selector:"table",classes:["%value"],...IE},tablecellborderstyle:{styles:{borderStyle:"%value"},...FE},tablecellborderwidth:{styles:{borderWidth:"%value"},...FE}},zE=A(UE),jE=e=>{const t={},n=(e,o)=>{e&&(g(e)?(b(o)||(o=[o]),K(o,(e=>{C(e.deep)&&(e.deep=!Wu(e)),C(e.split)&&(e.split=!Wu(e)||Ku(e)),C(e.remove)&&Wu(e)&&!Ku(e)&&(e.remove="none"),Wu(e)&&Ku(e)&&(e.mixed=!0,e.block_expand=!0),g(e.classes)&&(e.classes=e.classes.split(/\s+/))})),t[e]=o):he(e,((e,t)=>{n(t,e)})))};return n((e=>{const t=e.dom,n=e.schema.type,o={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"]},o={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==n?[o,e,t]:[e,o,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,n)=>Vo(e)&&e.hasAttribute("href"),onformat:(e,n,o)=>{Pt.each(o,((n,o)=>{t.setAttrib(e,o,n)}))}},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 Pt.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/),(e=>{o[e]={block:e,remove:"all"}})),o})(e)),n(zE()),n(Pd(e)),{get:e=>x(e)?t[e]:t,has:e=>ke(t,e),register:n,unregister:e=>(e&&t[e]&&delete t[e],t)}},HE=Pt.each,$E=Xa.DOM,qE=e=>x(e)&&p(e),VE=(e,t)=>{const n=t&&t.schema||ya({}),o=e=>{const t=g(e)?{name:e,classes:[],attrs:{}}:e,n=$E.create(t.name);return((e,t)=>{t.classes.length>0&&$E.addClass(e,t.classes.join(" ")),$E.setAttribs(e,t.attrs)})(n,t),n},r=(e,t,s)=>{let a;const i=t[0],l=qE(i)?i.name:void 0,d=((e,t)=>{const o=n.getElementRule(e.nodeName.toLowerCase()),r=null==o?void 0:o.parentsRequired;return!(!r||!r.length)&&(t&&q(r,t)?t:r[0])})(e,l);if(d)l===d?(a=i,t=t.slice(1)):a=d;else if(i)a=i,t=t.slice(1);else if(!s)return e;const c=a?o(a):$E.create("div");c.appendChild(e),s&&Pt.each(s,(t=>{const n=o(t);c.insertBefore(n,e)}));const m=qE(a)?a.siblings:void 0;return r(c,t,m)},s=$E.create("div");if(e.length>0){const t=e[0],n=o(t),a=qE(t)?t.siblings:void 0;s.appendChild(r(n,e.slice(1),a))}return s},WE=e=>{let t="div";const n={name:t,classes:[],attrs:{},selector:e=Pt.trim(e)};return"*"!==e&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,((e,t,o,r,s)=>{switch(t){case"#":n.attrs.id=o;break;case".":n.classes.push(o);break;case":":-1!==Pt.inArray("checked disabled enabled read-only required".split(" "),o)&&(n.attrs[o]=o)}if("["===r){const e=s.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(n.attrs[e[1]]=e[2])}return""}))),n.name=t||"div",n},KE=(e,t)=>{let n="",o=Ld(e);if(""===o)return"";const r=e=>g(e)?e.replace(/%(\w+)/g,""):"",s=(t,n)=>$E.getStyle(null!=n?n:e.getBody(),t,!0);if(g(t)){const n=e.formatter.get(t);if(!n)return"";t=n[0]}if("preview"in t){const e=t.preview;if(!1===e)return"";o=e||o}let a,i=t.block||t.inline||"span";const l=(d=t.selector,g(d)?(d=(d=d.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Pt.map(d.split(/(?:>|\s+(?![^\[\]]+\]))/),(e=>{const t=Pt.map(e.split(/(?:~\+|~|\+)/),WE),n=t.pop();return t.length&&(n.siblings=t),n})).reverse()):[]);var d;l.length>0?(l[0].name||(l[0].name=i),i=t.selector,a=VE(l,e)):a=VE([i],e);const c=$E.select(i,a)[0]||a.firstChild;HE(t.styles,((e,t)=>{const n=r(e);n&&$E.setStyle(c,t,n)})),HE(t.attributes,((e,t)=>{const n=r(e);n&&$E.setAttrib(c,t,n)})),HE(t.classes,(e=>{const t=r(e);$E.hasClass(c,t)||$E.addClass(c,t)})),e.dispatch("PreviewFormats"),$E.setStyles(a,{position:"absolute",left:-65535}),e.getBody().appendChild(a);const m=s("fontSize"),u=/px$/.test(m)?parseInt(m,10):0;return HE(o.split(" "),(e=>{let t=s(e,c);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=s(e),"#ffffff"===Aa(t).toLowerCase())||"color"===e&&"#000000"===Aa(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&&(n+="padding:0 2px;"),n+=e+":"+t+";"}})),e.dispatch("AfterPreviewFormats"),$E.remove(a),n},YE=e=>{const t=jE(e),n=Za({});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),_x(e)||((e,t)=>{e.set({}),t.on("NodeChange",(n=>{Xy(t,n.element,e.get())})),t.on("FormatApply FormatRemove",(n=>{const o=U.from(n.node).map((e=>Ru(e)?e:e.startContainer)).bind((e=>Vo(e)?U.some(e):U.from(e.parentElement))).getOrThunk((()=>Ky(t)));Xy(t,o,e.get())}))})(n,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,n,o)=>{((e,t,n,o)=>{Nx(e).formatter.apply(t,n,o)})(e,t,n,o)},remove:(t,n,o,r)=>{((e,t,n,o,r)=>{Nx(e).formatter.remove(t,n,o,r)})(e,t,n,o,r)},toggle:(t,n,o)=>{((e,t,n,o)=>{Nx(e).formatter.toggle(t,n,o)})(e,t,n,o)},match:(t,n,o,r)=>((e,t,n,o,r)=>Nx(e).formatter.match(t,n,o,r))(e,t,n,o,r),closest:t=>((e,t)=>Nx(e).formatter.closest(t))(e,t),matchAll:(t,n)=>((e,t,n)=>Nx(e).formatter.matchAll(t,n))(e,t,n),matchNode:(t,n,o,r)=>((e,t,n,o,r)=>Nx(e).formatter.matchNode(t,n,o,r))(e,t,n,o,r),canApply:t=>((e,t)=>Nx(e).formatter.canApply(t))(e,t),formatChanged:(t,o,r,s)=>((e,t,n,o,r,s)=>Nx(e).formatter.formatChanged(t,n,o,r,s))(e,n,t,o,r,s),getCssText:O(KE,e)}},GE=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},XE=e=>{const t=ai(),n=Za(0),o=Za(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,n)=>{Nx(e).undoManager.beforeChange(t,n)})(e,n,t)},add:(s,a)=>((e,t,n,o,r,s,a)=>Nx(e).undoManager.add(t,n,o,r,s,a))(e,r,o,n,t,s,a),dispatchChange:()=>{e.setDirty(!0);const t=px(e);t.bookmark=Sl(e.selection),e.dispatch("change",{level:t,lastLevel:de(r.data,o.get()).getOrUndefined()})},undo:()=>((e,t,n,o)=>Nx(e).undoManager.undo(t,n,o))(e,r,n,o),redo:()=>((e,t,n)=>Nx(e).undoManager.redo(t,n))(e,o,r.data),clear:()=>{((e,t,n)=>{Nx(e).undoManager.clear(t,n)})(e,r,o)},reset:()=>{((e,t)=>{Nx(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,n)=>Nx(e).undoManager.hasUndo(t,n))(e,r,o),hasRedo:()=>((e,t,n)=>Nx(e).undoManager.hasRedo(t,n))(e,r,o),transact:t=>((e,t,n,o)=>Nx(e).undoManager.transact(t,n,o))(e,r,n,t),ignore:t=>{((e,t,n)=>{Nx(e).undoManager.ignore(t,n)})(e,n,t)},extra:(t,n)=>{((e,t,n,o,r)=>{Nx(e).undoManager.extra(t,n,o,r)})(e,r,o,t,n)}};return _x(e)||((e,t,n)=>{const o=Za(!1),r=e=>{wx(t,!1,n),t.add({},e)};e.on("init",(()=>{t.add()})),e.on("BeforeExecCommand",(e=>{const o=e.command;GE(o)||(xx(t,n),t.beforeChange())})),e.on("ExecCommand",(e=>{const t=e.command;GE(t)||r(e)})),e.on("ObjectResizeStart cut",(()=>{t.beforeChange()})),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",(n=>{const s=n.keyCode;if(n.isDefaultPrevented())return;const a=Dt.os.isMacOS()&&"Meta"===n.key;(s>=33&&s<=36||s>=37&&s<=40||45===s||n.ctrlKey||a)&&(r(),e.nodeChanged()),46!==s&&8!==s||e.nodeChanged(),o.get()&&t.typing&&!yx(px(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),o.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(),wx(t,!0,n),t.add({},e),void o.set(!0);(Dt.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,n),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},QE=[9,27,Df.HOME,Df.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Df.DOWN,Df.UP,Df.LEFT,Df.RIGHT].concat(Dt.browser.isFirefox()?[224]:[]),JE="data-mce-placeholder",ZE=e=>"keydown"===e.type||"keyup"===e.type,e_=e=>{const t=e.keyCode;return t===Df.BACKSPACE||t===Df.DELETE},t_=e=>{var t;const n=e.dom,o=Ql(e),r=null!==(t=Sd(e))&&void 0!==t?t:"",s=(t,a)=>{if((e=>{if(ZE(e)){const t=e.keyCode;return!e_(e)&&(Df.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||q(QE,t))}return!1})(t))return;const i=e.getBody(),l=!(e=>ZE(e)&&!(e_(e)||"keyup"===e.type&&229===e.keyCode))(t)&&((e,t,n)=>{if(ys(yn.fromDom(t),!1)){const o=t.firstElementChild;return!o||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&n===o.nodeName.toLowerCase()}return!1})(n,i,o);(""!==n.getAttrib(i,JE)!==l||a)&&(n.setAttrib(i,JE,l?r:null),n.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))};Xe(r)&&e.on("init",(t=>{s(t,!0),e.on("change SetContent ExecCommand",s),e.on("paste",(t=>Yg.setEditorTimeout(e,(()=>s(t)))))}))},n_=(e,t)=>({from:e,to:t}),o_=(e,t)=>{const n=yn.fromDom(e),o=yn.fromDom(t.container());return bb(n,o).map((e=>((e,t)=>({block:e,position:t}))(e,t)))},r_=(e,t)=>Qn(t,(e=>Ar(e)||dr(e.dom)),(t=>En(t,e))).filter(Yt).getOr(e),s_=(e,t,n)=>{const o=o_(e,rl.fromRangeStart(n)),r=o.bind((n=>Hm(t,e,n.position).bind((n=>o_(e,n).map((n=>((e,t,n)=>ir(n.position.getNode())&&!ys(n.block)?Vm(!1,n.block.dom).bind((o=>o.isEqual(n.position)?Hm(t,e,o).bind((t=>o_(e,t))):U.some(n))).getOr(n):n)(e,t,n)))))));return It(o,r,n_).filter((t=>(e=>!En(e.from.block,e.to.block))(t)&&((e,t)=>{const n=yn.fromDom(e);return En(r_(n,t.from.block),r_(n,t.to.block))})(e,t)&&(e=>!1===cr(e.from.block.dom)&&!1===cr(e.to.block.dom))(t)&&(e=>{const t=e=>kr(e)||Os(e.dom);return t(e.from.block)&&t(e.to.block)})(t)))},a_=(e,t)=>{const n=((e,t)=>{const n=Ln(e);return te(n,(e=>t.isBlock(qt(e)))).fold(A(n),(e=>n.slice(0,e)))})(e,t);return K(n,xo),n},i_=(e,t)=>{const n=ph(t,e);return ee(n.reverse(),(e=>ys(e))).each(xo)},l_=(e,t,n,o,r)=>{if(ys(n))return Br(n),Ym(n.dom);0===X(Bn(r),(e=>!ys(e))).length&&ys(t)&&po(r,yn.fromTag("br"));const s=Km(n.dom,rl.before(r.dom));return K(a_(t,o),(e=>{po(r,e)})),i_(e,t),s},d_=(e,t,n,o)=>{if(ys(n)){if(ys(t)){const e=e=>{const t=(e,n)=>In(e).fold((()=>n),(e=>((e,t)=>e.isInline(qt(t)))(o,e)?t(e,n.concat(_i(e))):n));return t(e,[])},r=Q(e(n),((e,t)=>(yo(e,t),t)),Or());wo(t),vo(t,r)}return xo(n),Ym(t.dom)}const r=Gm(n.dom);return K(a_(t,o),(e=>{vo(n,e)})),i_(e,t),r},c_=(e,t)=>_n(t,e)?((e,t)=>{const n=ph(t,e);return U.from(n[n.length-1])})(t,e):U.none(),m_=(e,t)=>{Vm(e,t.dom).bind((e=>U.from(e.getNode()))).map(yn.fromDom).filter(_r).each(xo)},u_=(e,t,n,o)=>(m_(!0,t),m_(!1,n),c_(t,n).fold(O(d_,e,t,n,o),O(l_,e,t,n,o))),f_=(e,t,n,o,r)=>t?u_(e,o,n,r):u_(e,n,o,r),g_=(e,t)=>{const n=yn.fromDom(e.getBody()),o=((e,t,n)=>n.collapsed?s_(e,t,n):U.none())(n.dom,t,e.selection.getRng()).map((o=>()=>{f_(n,t,o.from.block,o.to.block,e.schema).each((t=>{e.selection.setRng(t.toRange())}))}));return o},p_=(e,t)=>{const n=yn.fromDom(t),o=O(En,e);return Xn(n,Ar,o).isSome()},h_=(e,t)=>{const n=Km(e.dom,rl.fromRangeStart(t)).isNone(),o=Wm(e.dom,rl.fromRangeEnd(t)).isNone();return!((e,t)=>p_(e,t.startContainer)||p_(e,t.endContainer))(e,t)&&n&&o},b_=e=>{const t=yn.fromDom(e.getBody()),n=e.selection.getRng();return h_(t,n)?(e=>U.some((()=>{e.setContent(""),e.selection.setCursorLocation()})))(e):((e,t,n)=>{const o=t.getRng();return It(bb(e,yn.fromDom(o.startContainer)),bb(e,yn.fromDom(o.endContainer)),((r,s)=>En(r,s)?U.none():U.some((()=>{o.deleteContents(),f_(e,!0,r,s,n).each((e=>{t.setRng(e.toRange())}))})))).getOr(U.none())})(t,e.selection,e.schema)},v_=(e,t)=>e.selection.isCollapsed()?U.none():b_(e),y_=(e,t,n,o,r)=>U.from(t._selectionOverrides.showCaret(e,n,o,r)),C_=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?U.none():U.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),w_=(e,t,n)=>t.collapsed?((e,t,n)=>{const o=Cm(1,e.getBody(),t),r=rl.fromRangeStart(o),s=r.getNode();if(Qc(s))return y_(1,e,s,!r.isAtEnd(),!1);const a=r.getNode(!0);if(Qc(a))return y_(1,e,a,!1,!1);const i=tv(e.dom.getRoot(),r.getNode());return Qc(i)?y_(1,e,i,!1,n):U.none()})(e,t,n).getOr(t):t,x_=e=>uh(e)||lh(e),E_=e=>fh(e)||dh(e),__=(e,t,n,o,r,s)=>{y_(o,e,s.getNode(!r),r,!0).each((n=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(n.startContainer,n.startOffset):e.setStart(n.endContainer,n.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(n)})),((e,t)=>{tr(t)&&0===t.data.length&&e.remove(t)})(e.dom,n)},k_=(e,t)=>((e,t)=>{const n=e.selection.getRng();if(!tr(n.commonAncestorContainer))return U.none();const o=t?Sm.Forwards:Sm.Backwards,r=Im(e.getBody()),s=O(_m,t?r.next:r.prev),a=t?x_:E_,i=xm(o,e.getBody(),n),l=s(i),d=l?mb(t,l):l;if(!d||!km(i,d))return U.none();if(a(d))return U.some((()=>__(e,n,i.getNode(),o,t,d)));const c=s(d);return c&&a(c)&&km(d,c)?U.some((()=>__(e,n,i.getNode(),o,t,c))):U.none()})(e,t),S_=(e,t)=>{const n=e.getBody();return t?Ym(n).filter(uh):Gm(n).filter(fh)},N_=e=>{const t=e.selection.getRng();return!t.collapsed&&(S_(e,!0).exists((e=>e.isEqual(rl.fromRangeStart(t))))||S_(e,!1).exists((e=>e.isEqual(rl.fromRangeEnd(t)))))},R_=Dl([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),A_=(e,t,n,o)=>{const r=o.getNode(!t);return bb(yn.fromDom(e),yn.fromDom(n.getNode())).map((e=>ys(e)?R_.remove(e.dom):R_.moveToElement(r))).orThunk((()=>U.some(R_.moveToElement(r))))},D_=(e,t,n,o)=>Hm(t,e,n).bind((r=>{return s=r.getNode(),x(s)&&(Ar(yn.fromDom(s))||Nr(yn.fromDom(s)))||((e,t,n,o,r)=>{const s=t=>r.isInline(t.nodeName.toLowerCase())&&!fm(n,o,e);return wm(!t,n).fold((()=>wm(t,o).fold(I,s)),s)})(e,t,n,r,o)?U.none():t&&cr(r.getNode())||!t&&cr(r.getNode(!0))?A_(e,t,n,r):t&&fh(n)||!t&&uh(n)?U.some(R_.moveToPosition(r)):U.none();var s})),T_=(e,t,n,o)=>((e,t)=>{const n=t.getNode(!e),o=e?"after":"before";return Vo(n)&&n.getAttribute("data-mce-caret")===o})(t,n)?((e,t)=>w(t)?U.none():e&&cr(t.nextSibling)?U.some(R_.moveToElement(t.nextSibling)):!e&&cr(t.previousSibling)?U.some(R_.moveToElement(t.previousSibling)):U.none())(t,n.getNode(!t)).orThunk((()=>D_(e,t,n,o))):D_(e,t,n,o).bind((t=>((e,t,n)=>n.fold((e=>U.some(R_.remove(e))),(e=>U.some(R_.moveToElement(e))),(n=>fm(t,n,e)?U.none():U.some(R_.moveToPosition(n)))))(e,n,t))),O_=(e,t)=>U.from(tv(e.getBody(),t)),B_=(e,t)=>{const n=e.selection.getNode();return O_(e,n).filter(cr).fold((()=>((e,t,n,o)=>{const r=Cm(t?1:-1,e,n),s=rl.fromRangeStart(r),a=yn.fromDom(e);return!t&&fh(s)?U.some(R_.remove(s.getNode(!0))):t&&uh(s)?U.some(R_.remove(s.getNode())):!t&&uh(s)&&Nh(a,s,o)?Rh(a,s,o).map((e=>R_.remove(e.getNode()))):t&&fh(s)&&Sh(a,s,o)?Ah(a,s,o).map((e=>R_.remove(e.getNode()))):T_(e,t,s,o)})(e.getBody(),t,e.selection.getRng(),e.schema).map((n=>()=>n.fold(((e,t)=>n=>(e._selectionOverrides.hideFakeCaret(),ab(e,t,yn.fromDom(n)),!0))(e,t),((e,t)=>n=>{const o=t?rl.before(n):rl.after(n);return e.selection.setRng(o.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))))),(()=>U.some(S)))},P_=(e,t)=>{const n=e.selection.getNode();return cr(n)&&!mr(n)?O_(e,n.parentNode).filter(cr).fold((()=>U.some((()=>{var n;n=yn.fromDom(e.getBody()),K(zo(n,".mce-offscreen-selection"),xo),ab(e,t,yn.fromDom(e.selection.getNode())),vb(e)}))),(()=>U.some(S))):N_(e)?U.some((()=>{wb(e,e.selection.getRng(),yn.fromDom(e.getBody()))})):U.none()},L_=e=>{const t=e.dom,n=e.selection,o=tv(e.getBody(),n.getNode());if(dr(o)&&t.isBlock(o)&&t.isEmpty(o)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(o,""),o.appendChild(e),n.setRng(rl.before(e).toRange())}return!0},M_=(e,t)=>e.selection.isCollapsed()?B_(e,t):P_(e,t),I_=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=rl.fromRangeStart(e.selection.getRng());return Hm(t,e.getBody(),n).filter((e=>t?ah(e):ih(e))).bind((e=>gm(t?0:-1,e))).map((t=>()=>e.selection.select(t)))})(e,t):U.none(),F_=tr,U_=e=>F_(e)&&e.data[0]===Pr,z_=e=>F_(e)&&e.data[e.data.length-1]===Pr,j_=e=>{var t;return(null!==(t=e.ownerDocument)&&void 0!==t?t:document).createTextNode(Pr)},H_=(e,t)=>e?(e=>{var t;if(F_(e.previousSibling))return z_(e.previousSibling)||e.previousSibling.appendData(Pr),e.previousSibling;if(F_(e))return U_(e)||e.insertData(0,Pr),e;{const n=j_(e);return null===(t=e.parentNode)||void 0===t||t.insertBefore(n,e),n}})(t):(e=>{var t,n;if(F_(e.nextSibling))return U_(e.nextSibling)||e.nextSibling.insertData(0,Pr),e.nextSibling;if(F_(e))return z_(e)||e.appendData(Pr),e;{const o=j_(e);return e.nextSibling?null===(t=e.parentNode)||void 0===t||t.insertBefore(o,e.nextSibling):null===(n=e.parentNode)||void 0===n||n.appendChild(o),o}})(t),$_=O(H_,!0),q_=O(H_,!1),V_=(e,t)=>tr(e.container())?H_(t,e.container()):H_(t,e.getNode()),W_=(e,t)=>{const n=t.get();return n&&e.container()===n&&zr(n)},K_=(e,t)=>t.fold((t=>{qc(e.get());const n=$_(t);return e.set(n),U.some(rl(n,n.length-1))}),(t=>Ym(t).map((t=>{if(W_(t,e)){const t=e.get();return rl(t,1)}{qc(e.get());const n=V_(t,!0);return e.set(n),rl(n,1)}}))),(t=>Gm(t).map((t=>{if(W_(t,e)){const t=e.get();return rl(t,t.length-1)}{qc(e.get());const n=V_(t,!1);return e.set(n),rl(n,n.length-1)}}))),(t=>{qc(e.get());const n=q_(t);return e.set(n),U.some(rl(n,1))})),Y_=(e,t)=>{for(let n=0;n<e.length;n++){const o=e[n].apply(null,t);if(o.isSome())return o}return U.none()},G_=Dl([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),X_=(e,t)=>{const n=um(t,e);return n||e},Q_=(e,t,n)=>{const o=ub(n),r=X_(t,o.container());return cb(e,r,o).fold((()=>Wm(r,o).bind(O(cb,e,r)).map((e=>G_.before(e)))),U.none)},J_=(e,t)=>null===Jm(e,t),Z_=(e,t,n)=>cb(e,t,n).filter(O(J_,t)),ek=(e,t,n)=>{const o=fb(n);return Z_(e,t,o).bind((e=>Km(e,o).isNone()?U.some(G_.start(e)):U.none()))},tk=(e,t,n)=>{const o=ub(n);return Z_(e,t,o).bind((e=>Wm(e,o).isNone()?U.some(G_.end(e)):U.none()))},nk=(e,t,n)=>{const o=fb(n),r=X_(t,o.container());return cb(e,r,o).fold((()=>Km(r,o).bind(O(cb,e,r)).map((e=>G_.after(e)))),U.none)},ok=e=>!db(sk(e)),rk=(e,t,n)=>Y_([Q_,ek,tk,nk],[e,t,n]).filter(ok),sk=e=>e.fold(D,D,D,D),ak=e=>e.fold(A("before"),A("start"),A("end"),A("after")),ik=e=>e.fold(G_.before,G_.before,G_.after,G_.after),lk=e=>e.fold(G_.start,G_.start,G_.end,G_.end),dk=(e,t,n,o,r,s)=>It(cb(t,n,o),cb(t,n,r),((t,o)=>t!==o&&((e,t,n)=>{const o=um(t,e),r=um(n,e);return x(o)&&o===r})(n,t,o)?G_.after(e?t:o):s)).getOr(s),ck=(e,t)=>e.fold(F,(e=>{return o=t,!(ak(n=e)===ak(o)&&sk(n)===sk(o));var n,o})),mk=(e,t)=>e?t.fold(N(U.some,G_.start),U.none,N(U.some,G_.after),U.none):t.fold(U.none,N(U.some,G_.before),U.none,N(U.some,G_.end)),uk=(e,t,n,o)=>{const r=mb(e,o),s=rk(t,n,r);return rk(t,n,r).bind(O(mk,e)).orThunk((()=>((e,t,n,o,r)=>{const s=mb(e,r);return Hm(e,n,s).map(O(mb,e)).fold((()=>o.map(ik)),(r=>rk(t,n,r).map(O(dk,e,t,n,s,r)).filter(O(ck,o)))).filter(ok)})(e,t,n,s,o)))},fk=(e,t,n)=>{const o=e?1:-1;return t.setRng(rl(n.container(),n.offset()+o).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0},gk=(e,t)=>{const n=t.selection.getRng(),o=e?rl.fromRangeEnd(n):rl.fromRangeStart(n);return!!(e=>E(e.selection.getSel().modify))(t)&&(e&&$r(o)?fk(!0,t.selection,o):!(e||!qr(o))&&fk(!1,t.selection,o))};var pk;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(pk||(pk={}));const hk=(e,t)=>e===Sm.Backwards?se(t):t,bk=(e,t,n)=>e===Sm.Forwards?t.next(n):t.prev(n),vk=(e,t,n,o)=>ir(o.getNode(t===Sm.Forwards))?pk.Br:!1===fm(n,o)?pk.Block:pk.Wrap,yk=(e,t,n,o)=>{const r=Im(n);let s=o;const a=[];for(;s;){const n=bk(t,r,s);if(!n)break;if(ir(n.getNode(!1)))return t===Sm.Forwards?{positions:hk(t,a).concat([n]),breakType:pk.Br,breakAt:U.some(n)}:{positions:hk(t,a),breakType:pk.Br,breakAt:U.some(n)};if(n.isVisible()){if(e(s,n)){const e=vk(0,t,s,n);return{positions:hk(t,a),breakType:e,breakAt:U.some(n)}}a.push(n),s=n}else s=n}return{positions:hk(t,a),breakType:pk.Eol,breakAt:U.none()}},Ck=(e,t,n,o)=>t(n,o).breakAt.map((o=>{const r=t(n,o).positions;return e===Sm.Backwards?r.concat(o):[o].concat(r)})).getOr([]),wk=(e,t)=>J(e,((e,n)=>e.fold((()=>U.some(n)),(o=>It(ce(o.getClientRects()),ce(n.getClientRects()),((e,r)=>{const s=Math.abs(t-e.left);return Math.abs(t-r.left)<=s?n:o})).or(e)))),U.none()),xk=(e,t)=>ce(t.getClientRects()).bind((t=>wk(e,t.left))),Ek=O(yk,rl.isAbove,-1),_k=O(yk,rl.isBelow,1),kk=O(Ck,-1,Ek),Sk=O(Ck,1,_k),Nk=(e,t)=>Ek(e,t).breakAt.isNone(),Rk=(e,t)=>_k(e,t).breakAt.isNone(),Ak=(e,t)=>xk(kk(e,t),t),Dk=(e,t)=>xk(Sk(e,t),t),Tk=cr,Ok=(e,t)=>Math.abs(e.left-t),Bk=(e,t)=>Math.abs(e.right-t),Pk=(e,t)=>Be(e,((e,n)=>{const o=Math.min(Ok(e,t),Bk(e,t)),r=Math.min(Ok(n,t),Bk(n,t));return r===o&&Se(n,"node")&&Tk(n.node)||r<o?n:e})),Lk=e=>{const t=t=>W(t,(t=>{const n=Di(t);return n.node=e,n}));if(Vo(e))return t(e.getClientRects());if(tr(e)){const n=e.ownerDocument.createRange();return n.setStart(e,0),n.setEnd(e,e.data.length),t(n.getClientRects())}return[]},Mk=e=>oe(e,Lk);var Ik;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(Ik||(Ik={}));const Fk=(e,t,n,o,r,s)=>{let a=0;const i=[],l=o=>{let s=Mk([o]);-1===e&&(s=s.reverse());for(let e=0;e<s.length;e++){const o=s[e];if(!n(o,d)){if(i.length>0&&t(o,Le(i))&&a++,o.line=a,r(o))return!0;i.push(o)}}return!1},d=Le(s.getClientRects());if(!d)return i;const c=s.getNode();return c&&(l(c),((e,t,n,o)=>{let r=o;for(;r=mm(r,e,ss,t);)if(n(r))return})(e,o,l,c)),i},Uk=O(Fk,Ik.Up,Bi,Pi),zk=O(Fk,Ik.Down,Pi,Bi),jk=e=>Le(e.getClientRects()),Hk=e=>t=>((e,t)=>t.line>e)(e,t),$k=e=>t=>((e,t)=>t.line===e)(e,t),qk=(e,t)=>{e.selection.setRng(t),Pg(e,e.selection.getRng())},Vk=(e,t,n)=>U.some(w_(e,t,n)),Wk=(e,t,n,o,r,s)=>{const a=t===Sm.Forwards,i=Im(e.getBody()),l=O(_m,a?i.next:i.prev),d=a?o:r;if(!n.collapsed){const o=Mi(n);if(s(o))return y_(t,e,o,t===Sm.Backwards,!1);if(N_(e)){const e=n.cloneRange();return e.collapse(t===Sm.Backwards),U.from(e)}}const c=xm(t,e.getBody(),n);if(d(c))return C_(e,c.getNode(!a));let m=l(c);const u=Yr(n);if(!m)return u?U.some(n):U.none();if(m=mb(a,m),d(m))return y_(t,e,m.getNode(!a),a,!1);const f=l(m);return f&&d(f)&&km(m,f)?y_(t,e,f.getNode(!a),a,!1):u?Vk(e,m.toRange(),!1):U.none()},Kk=(e,t,n,o,r,s)=>{const a=xm(t,e.getBody(),n),i=Le(a.getClientRects()),l=t===Ik.Down,d=e.getBody();if(!i)return U.none();if(N_(e)){const e=l?rl.fromRangeEnd(n):rl.fromRangeStart(n);return(l?Dk:Ak)(d,e).orThunk((()=>U.from(e))).map((e=>e.toRange()))}const c=(l?zk:Uk)(d,Hk(1),a),m=X(c,$k(1)),u=i.left,f=Pk(m,u);if(f&&s(f.node)){const n=Math.abs(u-f.left),o=Math.abs(u-f.right);return y_(t,e,f.node,n<o,!1)}let g;if(g=o(a)?a.getNode():r(a)?a.getNode(!0):Mi(n),g){const n=((e,t,n,o)=>{const r=Im(t);let s,a,i,l;const d=[];let c=0;1===e?(s=r.next,a=Pi,i=Bi,l=rl.after(o)):(s=r.prev,a=Bi,i=Pi,l=rl.before(o));const m=jk(l);do{if(!l.isVisible())continue;const e=jk(l);if(i(e,m))continue;d.length>0&&a(e,Le(d))&&c++;const t=Di(e);if(t.position=l,t.line=c,n(t))return d;d.push(t)}while(l=s(l));return d})(t,d,Hk(1),g);let o=Pk(X(n,$k(1)),u);if(o)return Vk(e,o.position.toRange(),!1);if(o=Le(X(n,$k(0))),o)return Vk(e,o.position.toRange(),!1)}return 0===m.length?Yk(e,l).filter(l?r:o).map((t=>w_(e,t.toRange(),!1))):U.none()},Yk=(e,t)=>{const n=e.selection.getRng(),o=t?rl.fromRangeEnd(n):rl.fromRangeStart(n),r=(s=o.container(),a=e.getBody(),Xn(yn.fromDom(s),(e=>Zc(e.dom)),(e=>e.dom===a)).map((e=>e.dom)).getOr(a));var s,a;if(t){const e=_k(r,o);return me(e.positions)}{const e=Ek(r,o);return ce(e.positions)}},Gk=(e,t,n)=>Yk(e,t).filter(n).exists((t=>(e.selection.setRng(t.toRange()),!0))),Xk=(e,t)=>{const n=e.dom.createRng();n.setStart(t.container(),t.offset()),n.setEnd(t.container(),t.offset()),e.selection.setRng(n)},Qk=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},Jk=(e,t,n)=>K_(t,n).map((t=>(Xk(e,t),n))),Zk=(e,t,n)=>{const o=e.getBody(),r=((e,t,n)=>{const o=rl.fromRangeStart(e);if(e.collapsed)return o;{const r=rl.fromRangeEnd(e);return n?Km(t,r).getOr(r):Wm(t,o).getOr(o)}})(e.selection.getRng(),o,n),s=O(lb,e);return uk(n,s,o,r).bind((n=>Jk(e,t,n)))},eS=(e,t)=>{const n=t.get();if(e.selection.isCollapsed()&&!e.composing&&n){const o=rl.fromRangeStart(e.selection.getRng());rl.isTextPosition(o)&&!(e=>$r(e)||qr(e))(o)&&(Xk(e,$c(n,o)),t.set(null))}},tS=(e,t,n)=>!!Bd(e)&&Zk(e,t,n).isSome(),nS=(e,t,n)=>!!Bd(t)&&gk(e,t),oS=e=>{const t=Za(null),n=O(lb,e);return e.on("NodeChange",(o=>{Bd(e)&&(((e,t,n)=>{const o=W(zo(yn.fromDom(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),(e=>e.dom)),r=X(o,e),s=X(n,e);K(ae(r,s),O(Qk,!1)),K(ae(s,r),O(Qk,!0))})(n,e.dom,o.parents),eS(e,t),((e,t,n,o)=>{if(t.selection.isCollapsed()){const r=X(o,e);K(r,(o=>{const r=rl.fromRangeStart(t.selection.getRng());rk(e,t.getBody(),r).bind((e=>Jk(t,n,e)))}))}})(n,e,t,o.parents))})),t},rS=O(nS,!0),sS=O(nS,!1),aS=(e,t,n)=>{if(Bd(e)){const o=Yk(e,t).getOrThunk((()=>{const n=e.selection.getRng();return t?rl.fromRangeEnd(n):rl.fromRangeStart(n)}));return rk(O(lb,e),e.getBody(),o).exists((t=>{const o=ik(t);return K_(n,o).exists((t=>(Xk(e,t),!0)))}))}return!1},iS=(e,t)=>n=>K_(t,n).map((t=>()=>Xk(e,t))),lS=(e,t,n,o)=>{const r=e.getBody(),s=O(lb,e);e.undoManager.ignore((()=>{e.selection.setRng(((e,t)=>{const n=document.createRange();return n.setStart(e.container(),e.offset()),n.setEnd(t.container(),t.offset()),n})(n,o)),pb(e),rk(s,r,rl.fromRangeStart(e.selection.getRng())).map(lk).bind(iS(e,t)).each(M)})),e.nodeChanged()},dS=(e,t,n,o)=>{const r=((e,t)=>{const n=um(t,e);return n||e})(e.getBody(),o.container()),s=O(lb,e),a=rk(s,r,o);return a.bind((e=>n?e.fold(A(U.some(lk(e))),U.none,A(U.some(ik(e))),U.none):e.fold(U.none,A(U.some(ik(e))),U.none,A(U.some(lk(e)))))).map(iS(e,t)).getOrThunk((()=>{const i=$m(n,r,o),l=i.bind((e=>rk(s,r,e)));return It(a,l,(()=>cb(s,r,o).bind((t=>(e=>It(Ym(e),Gm(e),((t,n)=>{const o=mb(!0,t),r=mb(!1,n);return Wm(e,o).forall((e=>e.isEqual(r)))})).getOr(!0))(t)?U.some((()=>{ab(e,n,yn.fromDom(t))})):U.none())))).getOrThunk((()=>l.bind((()=>i.map((r=>()=>{n?lS(e,t,o,r):lS(e,t,r,o)}))))))}))},cS=(e,t,n)=>{if(e.selection.isCollapsed()&&Bd(e)){const o=rl.fromRangeStart(e.selection.getRng());return dS(e,t,n,o)}return U.none()},mS=(e,t)=>{const n=yn.fromDom(e.getBody()),o=yn.fromDom(e.selection.getStart()),r=ph(o,n);return te(r,t).fold(A(r),(e=>r.slice(0,e)))},uS=e=>1===Un(e),fS=e=>mS(e,(t=>e.schema.isBlock(qt(t))||(e=>Un(e)>1)(t))),gS=(e,t)=>{const n=O(oy,e);return oe(t,(e=>n(e)?[e.dom]:[]))},pS=e=>{const t=(e=>mS(e,(t=>e.schema.isBlock(qt(t)))))(e);return gS(e,t)},hS=(e,t)=>{const n=X(fS(e),uS);return me(n).bind((o=>{const r=rl.fromRangeStart(e.selection.getRng());return yb(t,r,o.dom)&&!Xu(o)?U.some((()=>((e,t,n,o)=>{const r=gS(t,o);if(0===r.length)ab(t,e,n);else{const e=ny(n.dom,r);t.selection.setRng(e.toRange())}})(t,e,o,n))):U.none()}))},bS=(e,t)=>{const n=e.selection.getStart(),o=((e,t)=>{const n=t.parentElement;return ir(t)&&!v(n)&&e.dom.isEmpty(n)})(e,n)||(r=n,Xu(yn.fromDom(r)))?ny(n,t):((e,t)=>{const{caretContainer:n,caretPosition:o}=ty(t);return e.insertNode(n.dom),o})(e.selection.getRng(),t);var r;e.selection.setRng(o.toRange())},vS=e=>tr(e.startContainer),yS=e=>(e=>{const t=e.startContainer.parentNode,n=e.endContainer.parentNode;return!v(t)&&!v(n)&&t.isEqualNode(n)})(e)&&(e=>{const t=e.endContainer;return e.endOffset===(tr(t)?t.length:t.childNodes.length)})(e),CS=e=>{const t=e.selection.getRng();return(e=>0===e.startOffset&&vS(e))(t)&&((e,t)=>{const n=t.startContainer.parentElement;return!v(n)&&oy(e,yn.fromDom(n))})(e,t)&&(e=>yS(e)||(e=>!e.endContainer.isEqualNode(e.commonAncestorContainer))(e))(t)},wS=e=>{if(CS(e)){const t=pS(e);return U.some((()=>{pb(e),((e,t)=>{const n=ae(t,pS(e));n.length>0&&bS(e,n)})(e,t)}))}return U.none()},xS=(e,t)=>e.selection.isCollapsed()?hS(e,t):wS(e),ES=(e,t)=>((e,t,n)=>Xn(e,t,n).isSome())(e,(e=>Qm(e.dom)),(e=>t.isBlock(qt(e)))),_S=e=>{const t=e.selection.getRng();return t.collapsed&&(vS(t)||e.dom.isEmpty(t.startContainer))&&!(e=>ES(yn.fromDom(e.selection.getStart()),e.schema))(e)},kS=e=>(_S(e)&&bS(e,[]),!0),SS=(e,t,n)=>x(n)?U.some((()=>{e._selectionOverrides.hideFakeCaret(),ab(e,t,yn.fromDom(n))})):U.none(),NS=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=t?lh:dh,o=t?Sm.Forwards:Sm.Backwards,r=xm(o,e.getBody(),e.selection.getRng());return n(r)?SS(e,t,r.getNode(!t)):U.from(mb(t,r)).filter((e=>n(e)&&km(r,e))).bind((n=>SS(e,t,n.getNode(!t))))})(e,t):((e,t)=>{const n=e.selection.getNode();return fr(n)?SS(e,t,n):U.none()})(e,t),RS=e=>Je(null!=e?e:"").getOr(0),AS=(e,t)=>(e||"table"===qt(t)?"margin":"padding")+("rtl"===co(t,"direction")?"-right":"-left"),DS=e=>{const t=OS(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>re(t,(t=>{const n=AS(bd(e),t),o=uo(t,n).map(RS).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&o>0})))(e,t))},TS=e=>Sr(e)||Nr(e),OS=e=>X(_o(e.selection.getSelectedBlocks()),(e=>!TS(e)&&!(e=>Rn(e).exists(TS))(e)&&Qn(e,(e=>dr(e.dom)||cr(e.dom))).exists((e=>dr(e.dom))))),BS=(e,t)=>{var n,o;const{dom:r}=e,s=vd(e),a=null!==(o=null===(n=/[a-z%]+$/i.exec(s))||void 0===n?void 0:n[0])&&void 0!==o?o:"px",i=RS(s),l=bd(e);K(OS(e),(e=>{((e,t,n,o,r,s)=>{const a=AS(n,yn.fromDom(s)),i=RS(e.getStyle(s,a));if("outdent"===t){const t=Math.max(0,i-o);e.setStyle(s,a,t?t+r:"")}else{const t=i+o+r;e.setStyle(s,a,t)}})(r,t,l,i,a,e.dom)}))},PS=e=>BS(e,"outdent"),LS=e=>{if(e.selection.isCollapsed()&&DS(e)){const t=e.dom,n=e.selection.getRng(),o=rl.fromRangeStart(n),r=t.getParent(n.startContainer,t.isBlock);if(null!==r&&Ch(yn.fromDom(r),o,e.schema))return U.some((()=>PS(e)))}return U.none()},MS=(e,t,n)=>fe([LS,M_,k_,(e,n)=>cS(e,t,n),g_,ev,I_,NS,v_,xS],(t=>t(e,n))).filter((t=>e.selection.isEditable())),IS=(e,t)=>{MS(e,t,!0).fold((()=>{e.selection.isEditable()&&(e=>{gb(e,"ForwardDelete")})(e)}),M)},FS=(e,t)=>{e.addCommand("delete",(()=>{((e,t)=>{MS(e,t,!1).fold((()=>{e.selection.isEditable()&&(pb(e),vb(e))}),M)})(e,t)})),e.addCommand("forwardDelete",(()=>{IS(e,t)}))},US=e=>void 0===e.touches||1!==e.touches.length?U.none():U.some(e.touches[0]),zS=e=>{const t=ai(),n=Za(!1),o=li((t=>{e.dispatch("longpress",{...t,type:"longpress"}),n.set(!0)}),400);e.on("touchstart",(e=>{US(e).each((r=>{o.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};o.throttle(e),n.set(!1),t.set(s)}))}),!0),e.on("touchmove",(r=>{o.cancel(),US(r).each((o=>{t.on((r=>{((e,t)=>{const n=Math.abs(e.clientX-t.x),o=Math.abs(e.clientY-t.y);return n>5||o>5})(o,r)&&(t.clear(),n.set(!1),e.dispatch("longpresscancel"))}))}))}),!0),e.on("touchend touchcancel",(r=>{o.cancel(),"touchcancel"!==r.type&&t.get().filter((e=>e.target.isEqualNode(r.target))).each((()=>{n.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})}))}),!0)},jS=(e,t)=>ke(e,t.nodeName),HS=(e,t)=>!!tr(t)||!!Vo(t)&&!(jS(e.getBlockElements(),t)||mu(t)||Ls(e,t)||ws(t)),$S=(e,t)=>{if(tr(t)){if(0===t.data.length)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||jS(e,t.nextSibling)||ws(t.nextSibling)}return!1},qS=e=>e.dom.create(Ql(e),Jl(e)),VS=e=>{const t=e.dom,n=e.selection,o=e.schema,r=o.getBlockElements(),s=n.getStart(),a=e.getBody();let i,l,d=!1;const c=Ql(e);if(!s||!Vo(s))return;const m=a.nodeName.toLowerCase();if(!o.isValidChild(m,c.toLowerCase())||((e,t,n)=>V(gh(yn.fromDom(n),yn.fromDom(t)),(t=>jS(e,t.dom))))(r,a,s))return;const u=n.getRng(),{startContainer:f,startOffset:g,endContainer:p,endOffset:h}=u,b=ip(e);let v=a.firstChild;for(;v;)if(Vo(v)&&Ts(o,v),HS(o,v)){if($S(r,v)){l=v,v=v.nextSibling,t.remove(l);continue}i||(i=qS(e),a.insertBefore(i,v),d=!0),l=v,v=v.nextSibling,i.appendChild(l)}else i=null,v=v.nextSibling;d&&b&&(u.setStart(f,g),u.setEnd(p,h),n.setRng(u),e.nodeChanged())},WS=(e,t,n)=>{const o=yn.fromDom(qS(e)),r=Or();vo(o,r),n(t,o);const s=document.createRange();return s.setStartBefore(r.dom),s.setEndBefore(r.dom),s},KS=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),YS=(e,t,n)=>function(o){const r=arguments,s=r[r.length-2],a=s>0?t.charAt(s-1):"";if('"'===a)return o;if(">"===a){const e=t.lastIndexOf("<",s);if(-1!==e&&-1!==t.substring(e,s).indexOf('contenteditable="false"'))return o}return'<span class="'+n+'" data-mce-content="'+e.dom.encode(r[0])+'">'+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+"</span>"},GS=(e,t)=>re(e,(e=>{const n=t.match(e);return null!==n&&n[0].length===t.length})),XS=e=>{const t="contenteditable",n=" "+Pt.trim(Ec(e))+" ",o=" "+Pt.trim(xc(e))+" ",r=KS(n),s=KS(o),a=_c(e);a.length>0&&e.on("BeforeSetContent",(t=>{((e,t,n)=>{let o=t.length,r=n.content;if("raw"!==n.format){for(;o--;)r=r.replace(t[o],YS(e,r,xc(e)));n.content=r}})(e,a,t)})),e.parser.addAttributeFilter("class",(e=>{let n=e.length;for(;n--;){const o=e[n];r(o)?o.attr(t,"true"):s(o)&&o.attr(t,"false")}})),e.serializer.addAttributeFilter(t,(e=>{let n=e.length;for(;n--;){const o=e[n];if(!r(o)&&!s(o))continue;const i=o.attr("data-mce-content");a.length>0&&i?GS(a,i)?(o.name="#text",o.type=3,o.raw=!0,o.value=i):o.remove():o.attr(t,null)}}))},QS=(e,t)=>{t.hasAttribute("data-mce-caret")&&(Kr(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},JS=(e,t)=>{const n=(e=>to(yn.fromDom(e.getBody()),"*[data-mce-caret]").map((e=>e.dom)).getOrNull())(e);if(n)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void QS(e,n)):void(Hr(n)&&(QS(e,n),e.undoManager.add()))},ZS=cr,eN=(e,t,n)=>{const o=Im(e.getBody()),r=O(_m,1===t?o.next:o.prev);if(n.collapsed){const o=e.dom.getParent(n.startContainer,"PRE");if(!o)return;if(!r(rl.fromRangeStart(n))){const n=yn.fromDom((e=>{const t=e.dom.create(Ql(e));return t.innerHTML='<br data-mce-bogus="1">',t})(e));1===t?ho(yn.fromDom(o),n):po(yn.fromDom(o),n),e.selection.select(n.dom,!0),e.selection.collapse()}}},tN=(e,t)=>{const n=t?Sm.Forwards:Sm.Backwards,o=e.selection.getRng();return((e,t,n)=>Wk(t,e,n,uh,fh,ZS))(n,e,o).orThunk((()=>(eN(e,n,o),U.none())))},nN=(e,t)=>{const n=t?1:-1,o=e.selection.getRng();return((e,t,n)=>Kk(t,e,n,(e=>uh(e)||ch(e)),(e=>fh(e)||mh(e)),ZS))(n,e,o).orThunk((()=>(eN(e,n,o),U.none())))},oN=(e,t)=>tN(e,((e,t)=>{const n=t?e.getEnd(!0):e.getStart(!0);return db(n)?!t:t})(e.selection,t)).exists((t=>(qk(e,t),!0))),rN=(e,t)=>nN(e,t).exists((t=>(qk(e,t),!0))),sN=(e,t)=>Gk(e,t,t?fh:uh),aN=(e,t)=>S_(e,!t).map((n=>{const o=n.toRange(),r=e.selection.getRng();return t?o.setStart(r.startContainer,r.startOffset):o.setEnd(r.endContainer,r.endOffset),o})).exists((t=>(qk(e,t),!0))),iN=e=>q(["figcaption"],qt(e)),lN=(e,t)=>{const n=yn.fromDom(e.getBody()),o=rl.fromRangeStart(e.selection.getRng());return((e,t,n)=>{const o=O(En,t);return Qn(yn.fromDom(e.container()),(e=>n.isBlock(qt(e))),o).filter(iN)})(o,n,e.schema).exists((()=>{if(((e,t,n)=>t?Rk(e.dom,n):Nk(e.dom,n))(n,t,o)){const o=WS(e,n,t?vo:bo);return e.selection.setRng(o),!0}return!1}))},dN=(e,t)=>!!e.selection.isCollapsed()&&lN(e,t),cN=(e,t)=>t?U.from(e.dom.getParent(e.selection.getNode(),"details")).map((t=>((e,t)=>{const n=e.selection.getRng(),o=rl.fromRangeStart(n);return!(e.getBody().lastChild!==t||!Rk(t,o)||(e.execCommand("InsertNewBlockAfter"),0))})(e,t))).getOr(!1):U.from(e.dom.getParent(e.selection.getNode(),"summary")).bind((t=>U.from(e.dom.getParent(t,"details")).map((n=>((e,t,n)=>{const o=e.selection.getRng(),r=rl.fromRangeStart(o);return!(e.getBody().firstChild!==t||!Nk(n,r)||(e.execCommand("InsertNewBlockBefore"),0))})(e,n,t))))).getOr(!1),mN=(e,t)=>cN(e,t),uN={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},fN=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,gN=(e,t)=>oe((e=>W(e,(e=>({...uN,...e}))))(e),(e=>fN(e,t)?[e]:[])),pN=(e,t)=>oe((e=>W(e,(e=>({...uN,...e}))))(e),(e=>fN(e,t)?[e]:[])),hN=(e,...t)=>()=>e.apply(null,t),bN=(e,t)=>ee(gN(e,t),(e=>e.action())),vN=(e,t)=>fe(pN(e,t),(e=>e.action())),yN=(e,t)=>{const n=t?Sm.Forwards:Sm.Backwards,o=e.selection.getRng();return Wk(e,n,o,lh,dh,fr).exists((t=>(qk(e,t),!0)))},CN=(e,t)=>{const n=t?1:-1,o=e.selection.getRng();return Kk(e,n,o,lh,dh,fr).exists((t=>(qk(e,t),!0)))},wN=(e,t)=>Gk(e,t,t?dh:lh),xN=Dl([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),EN={...xN,none:e=>xN.none(e)},_N=(e,t,n)=>oe(Ln(e),(e=>wn(e,t)?n(e)?[e]:[]:_N(e,t,n))),kN=(e,t)=>((e,t,n=I)=>n(t)?U.none():q(e,qt(t))?U.some(t):eo(t,e.join(","),(e=>wn(e,"table")||n(e))))(["td","th"],e,t),SN=e=>_N(e,"th,td",F),NN=(e,t)=>no(e,"table",t),RN=(e,t,n,o,r=F)=>{const s=1===o;if(!s&&n<=0)return EN.first(e[0]);if(s&&n>=e.length-1)return EN.last(e[e.length-1]);{const s=n+o,a=e[s];return r(a)?EN.middle(t,a):RN(e,t,s,o,r)}},AN=(e,t)=>NN(e,t).bind((t=>{const n=SN(t);return te(n,(t=>En(e,t))).map((e=>({index:e,all:n})))})),DN=(e,t,n,o,r)=>{const s=zo(yn.fromDom(n),"td,th,caption").map((e=>e.dom)),a=X(((e,t)=>oe(t,(t=>{const n=((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}))(Di(t.getBoundingClientRect()),-1);return[{x:n.left,y:e(n),cell:t},{x:n.right,y:e(n),cell:t}]})))(e,s),(e=>t(e,r)));return((e,t,n)=>J(e,((e,o)=>e.fold((()=>U.some(o)),(e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-n)),s=Math.sqrt(Math.abs(o.x-t)+Math.abs(o.y-n));return U.some(s<r?o:e)}))),U.none()))(a,o,r).map((e=>e.cell))},TN=O(DN,(e=>e.bottom),((e,t)=>e.y<t)),ON=O(DN,(e=>e.top),((e,t)=>e.y>t)),BN=(e,t)=>ce(t.getClientRects()).bind((t=>TN(e,t.left,t.top))).bind((e=>{return xk(Gm(n=e).map((e=>Ek(n,e).positions.concat(e))).getOr([]),t);var n})),PN=(e,t)=>me(t.getClientRects()).bind((t=>ON(e,t.left,t.top))).bind((e=>{return xk(Ym(n=e).map((e=>[e].concat(_k(n,e).positions))).getOr([]),t);var n})),LN=(e,t,n)=>{const o=e(t,n);return(e=>e.breakType===pk.Wrap&&0===e.positions.length)(o)||!ir(n.getNode())&&(e=>e.breakType===pk.Br&&1===e.positions.length)(o)?!((e,t,n)=>n.breakAt.exists((n=>e(t,n).breakAt.isSome())))(e,t,o):o.breakAt.isNone()},MN=O(LN,Ek),IN=O(LN,_k),FN=(e,t,n,o)=>{const r=e.selection.getRng(),s=t?1:-1;return!(!Xc()||!((e,t,n)=>{const o=rl.fromRangeStart(t);return Vm(!e,n).exists((e=>e.isEqual(o)))})(t,r,n)||(y_(s,e,n,!t,!1).each((t=>{qk(e,t)})),0))},UN=(e,t)=>{const n=t.getNode(e);return Jo(n)?U.some(n):U.none()},zN=(e,t,n)=>{const o=UN(!!t,n),r=!1===t;o.fold((()=>qk(e,n.toRange())),(o=>Vm(r,e.getBody()).filter((e=>e.isEqual(n))).fold((()=>qk(e,n.toRange())),(n=>((e,t,n)=>{t.undoManager.transact((()=>{const o=e?ho:po,r=WS(t,yn.fromDom(n),o);qk(t,r)}))})(t,e,o)))))},jN=(e,t,n,o)=>{const r=e.selection.getRng(),s=rl.fromRangeStart(r),a=e.getBody();if(!t&&MN(o,s)){const o=((e,t,n)=>BN(t,n).orThunk((()=>ce(n.getClientRects()).bind((n=>wk(kk(e,rl.before(t)),n.left))))).getOr(rl.before(t)))(a,n,s);return zN(e,t,o),!0}if(t&&IN(o,s)){const o=((e,t,n)=>PN(t,n).orThunk((()=>ce(n.getClientRects()).bind((n=>wk(Sk(e,rl.after(t)),n.left))))).getOr(rl.after(t)))(a,n,s);return zN(e,t,o),!0}return!1},HN=(e,t,n)=>U.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind((o=>U.from(e.dom.getParent(o,"table")).map((r=>n(e,t,r,o))))).getOr(!1),$N=(e,t)=>HN(e,t,FN),qN=(e,t)=>HN(e,t,jN),VN=(e,t,n)=>n.fold(U.none,U.none,((e,t)=>{return(n=t,Zn(n,vp)).map((e=>(e=>{const t=Yf.exact(e,0,e,0);return Zf(t)})(e)));var n}),(n=>(e.execCommand("mceTableInsertRowAfter"),WN(e,t,n)))),WN=(e,t,n)=>VN(e,t,((e,t,n)=>AN(e,n).fold((()=>EN.none(e)),(n=>RN(n.all,e,n.index,1,t))))(n,oo)),KN=(e,t,n)=>VN(e,t,((e,t,n)=>AN(e,n).fold((()=>EN.none()),(n=>RN(n.all,e,n.index,-1,t))))(n,oo)),YN=(e,t)=>{const n=["table","li","dl"],o=yn.fromDom(e.getBody()),r=e=>{const t=qt(e);return En(e,o)||q(n,t)},s=e.selection.getRng(),a=yn.fromDom(t?s.endContainer:s.startContainer);return kN(a,r).map((n=>(NN(n,r).each((t=>{e.model.table.clearSelectedCells(t.dom)})),e.selection.collapse(!t),(t?WN:KN)(e,r,n).each((t=>{e.selection.setRng(t)})),!0))).getOr(!1)},GN=(e,t)=>{e.on("keydown",(n=>{n.isDefaultPrevented()||((e,t,n)=>{const o=Dt.os.isMacOS()||Dt.os.isiOS();bN([{keyCode:Df.RIGHT,action:hN(oN,e,!0)},{keyCode:Df.LEFT,action:hN(oN,e,!1)},{keyCode:Df.UP,action:hN(rN,e,!1)},{keyCode:Df.DOWN,action:hN(rN,e,!0)},...o?[{keyCode:Df.UP,action:hN(aN,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Df.DOWN,action:hN(aN,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Df.RIGHT,action:hN($N,e,!0)},{keyCode:Df.LEFT,action:hN($N,e,!1)},{keyCode:Df.UP,action:hN(qN,e,!1)},{keyCode:Df.DOWN,action:hN(qN,e,!0)},{keyCode:Df.UP,action:hN(qN,e,!1)},{keyCode:Df.UP,action:hN(mN,e,!1)},{keyCode:Df.DOWN,action:hN(mN,e,!0)},{keyCode:Df.RIGHT,action:hN(yN,e,!0)},{keyCode:Df.LEFT,action:hN(yN,e,!1)},{keyCode:Df.UP,action:hN(CN,e,!1)},{keyCode:Df.DOWN,action:hN(CN,e,!0)},{keyCode:Df.RIGHT,action:hN(tS,e,t,!0)},{keyCode:Df.LEFT,action:hN(tS,e,t,!1)},{keyCode:Df.RIGHT,ctrlKey:!o,altKey:o,action:hN(rS,e,t)},{keyCode:Df.LEFT,ctrlKey:!o,altKey:o,action:hN(sS,e,t)},{keyCode:Df.UP,action:hN(dN,e,!1)},{keyCode:Df.DOWN,action:hN(dN,e,!0)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))},XN=(e,t)=>({container:e,offset:t}),QN=Xa.DOM,JN=e=>t=>e===t?-1:0,ZN=(e,t,n)=>{if(tr(e)&&t>=0)return U.some(XN(e,t));{const o=Ri(QN);return U.from(o.backwards(e,t,JN(e),n)).map((e=>XN(e.container,e.container.data.length)))}},eR=(e,t,n)=>{if(!tr(e))return U.none();const o=e.data;if(t>=0&&t<=o.length)return U.some(XN(e,t));{const o=Ri(QN);return U.from(o.backwards(e,t,JN(e),n)).bind((e=>{const o=e.container.data;return eR(e.container,t+o.length,n)}))}},tR=(e,t,n)=>{if(!tr(e))return U.none();const o=e.data;if(t<=o.length)return U.some(XN(e,t));{const r=Ri(QN);return U.from(r.forwards(e,t,JN(e),n)).bind((e=>tR(e.container,t-o.length,n)))}},nR=(e,t,n,o,r)=>{const s=Ri(e,(e=>t=>e.isBlock(t)||q(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return U.from(s.backwards(t,n,o,r))},oR=e=>Mr(e.toString().replace(/\u00A0/g," ")),rR=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),sR=(e,t)=>e.substring(t.length),aR=(e,t,n,o=0)=>{if(!(r=t).collapsed||!tr(r.startContainer))return U.none();var r;const s={text:"",offset:0},a=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return nR(e,t.startContainer,t.startOffset,((e,t,o)=>(s.text=o+s.text,s.offset+=t,((e,t,n)=>{let o;const r=n.charAt(0);for(o=t-1;o>=0;o--){const s=e.charAt(o);if(rR(s))return U.none();if(r===s&&$e(e,n,o,t))break}return U.some(o)})(s.text,s.offset,n).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 U.none();const s=oR(r);return 0!==s.lastIndexOf(n)||sR(s,n).length<o?U.none():U.some({text:sR(s,n),range:r,trigger:n})}))},iR=(e,t,n,o=0)=>{return(r=yn.fromDom(t.startContainer),no(r,Cp)).fold((()=>aR(e,t,n,o)),(t=>{const o=e.createRng();o.selectNode(t.dom);const r=oR(o);return U.some({range:o,text:sR(r,n),trigger:n})}));var r},lR=e=>{if((e=>3===e.nodeType)(e))return XN(e,e.data.length);{const t=e.childNodes;return t.length>0?lR(t[t.length-1]):XN(e,t.length)}},dR=(e,t)=>{const n=e.childNodes;return n.length>0&&t<n.length?dR(n[t],0):n.length>0&&(e=>1===e.nodeType)(e)&&n.length===t?lR(n[n.length-1]):XN(e,t)},cR=e=>t=>{const n=dR(t.startContainer,t.startOffset);return!((e,t)=>{var n;const o=null!==(n=e.getParent(t.container,e.isBlock))&&void 0!==n?n:e.getRoot();return nR(e,t.container,t.offset,((e,t)=>0===t?-1:t),o).filter((e=>{const t=e.container.data.charAt(e.offset-1);return!rR(t)})).isSome()})(e,n)},mR=(e,t)=>{const n=t(),o=e.selection.getRng();return((e,t,n)=>fe(n.triggers,(n=>iR(e,t,n))))(e.dom,o,n).bind((n=>uR(e,t,n)))},uR=(e,t,n,o={})=>{var r;const s=t(),a=null!==(r=e.selection.getRng().startContainer.nodeValue)&&void 0!==r?r:"",i=X(s.lookupByTrigger(n.trigger),(t=>n.text.length>=t.minChars&&t.matches.getOrThunk((()=>cR(e.dom)))(n.range,a,n.text)));if(0===i.length)return U.none();const l=Promise.all(W(i,(e=>e.fetch(n.text,e.maxResults,o).then((t=>({matchText:n.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))))));return U.some({lookupData:l,context:n})};var fR;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(fR||(fR={}));const gR=(e,t,n)=>e.stype===fR.Error?t(e.serror):n(e.svalue),pR=e=>({stype:fR.Value,svalue:e}),hR=e=>({stype:fR.Error,serror:e}),bR=e=>gR(e,Al.error,Al.value),vR=pR,yR=e=>{const t=[],n=[];return K(e,(e=>{gR(e,(e=>n.push(e)),(e=>t.push(e)))})),{values:t,errors:n}},CR=hR,wR=(e,t)=>e.stype===fR.Error?t(e.serror):e,xR=(e,t)=>e.stype===fR.Value?{stype:fR.Value,svalue:t(e.svalue)}:e,ER=(e,t)=>e.stype===fR.Error?{stype:fR.Error,serror:t(e.serror)}:e,_R=gR,kR=e=>p(e)&&ge(e).length>100?" removed due to size":JSON.stringify(e,null,2),SR=(e,t)=>CR([{path:e,getErrorInfo:t}]),NR=(e,t,n,o)=>_e(n,o).fold((()=>((e,t,n)=>SR(e,(()=>'The chosen schema: "'+n+'" did not exist in branches: '+kR(t))))(e,n,o)),(n=>n.extract(e.concat(["branch: "+o]),t))),RR=(e,t)=>({extract:(n,o)=>_e(o,e).fold((()=>((e,t)=>SR(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(n,e)),(e=>NR(n,o,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+ge(t)}),AR=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const n={};for(let o=0;o<t.length;o++){const r=t[o];for(const t in r)ke(r,t)&&(n[t]=e(n[t],r[t]))}return n},DR=AR(((e,t)=>h(e)&&h(t)?DR(e,t):t)),TR=(AR(((e,t)=>t)),e=>({tag:"defaultedThunk",process:A(e)})),OR=e=>N(CR,ne)(e),BR=e=>{const t=yR(e);return t.errors.length>0?OR(t.errors):vR(t.values)},PR=(e,t,n)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return n(e.newKey,e.instantiator)}},LR=e=>({extract:(t,n)=>wR(e(n),(e=>((e,t)=>SR(e,A(t)))(t,e))),toString:A("val")}),MR=LR(vR),IR=(e,t,n,o)=>_e(t,n).fold((()=>((e,t,n)=>SR(e,(()=>'Could not find valid *required* value for "'+t+'" in '+kR(n))))(e,n,t)),o),FR=(e,t,n,o)=>o(_e(e,t).getOrThunk((()=>n(e)))),UR=(e,t,n,o,r)=>{const s=e=>r.extract(t.concat([o]),e),a=e=>e.fold((()=>vR(U.none())),(e=>{const n=r.extract(t.concat([o]),e);return xR(n,U.some)}));switch(e.tag){case"required":return IR(t,n,o,s);case"defaultedThunk":return FR(n,o,e.process,s);case"option":return((e,t,n)=>n(_e(e,t)))(n,o,a);case"defaultedOptionThunk":return((e,t,n,o)=>o(_e(e,t).map((t=>!0===t?n(e):t))))(n,o,e.process,a);case"mergeWithThunk":return FR(n,o,A({}),(t=>{const o=DR(e.process(n),t);return s(o)}))}},zR=e=>({extract:(t,n)=>((e,t,n)=>{const o={},r=[];for(const s of n)PR(s,((n,s,a,i)=>{const l=UR(a,e,t,n,i);_R(l,(e=>{r.push(...e)}),(e=>{o[s]=e}))}),((e,n)=>{o[e]=n(t)}));return r.length>0?CR(r):vR(o)})(t,n,e),toString:()=>{const t=W(e,(e=>PR(e,((e,t,n,o)=>e+" -> "+o.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),jR=e=>({extract:(t,n)=>{const o=W(n,((n,o)=>e.extract(t.concat(["["+o+"]"]),n)));return BR(o)},toString:()=>"array("+e.toString()+")"}),HR=(e,t,n)=>bR(((e,t,n)=>{const o=t.extract([e],n);return ER(o,(e=>({input:n,errors:e})))})(e,t,n)),$R=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:A("... (only showing first ten failures)")}]):e;return W(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+kR(e.input),qR=(e,t)=>RR(e,be(t,zR)),VR=A(MR),WR=(e,t)=>LR((n=>{const o=typeof n;return e(n)?vR(n):CR(`Expected type: ${t} but got: ${o}`)})),KR=WR(_,"number"),YR=WR(g,"string"),GR=WR(y,"boolean"),XR=WR(E,"function"),QR=(e,t,n,o)=>({tag:"field",key:e,newKey:t,presence:n,prop:o}),JR=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),ZR=e=>{return t=t=>q(e,t)?Al.value(t):Al.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`),LR((e=>t(e).fold(CR,vR)));var t},eA=(e,t)=>QR(e,e,{tag:"required",process:{}},t),tA=e=>eA(e,YR),nA=e=>eA(e,XR),oA=(e,t)=>QR(e,e,{tag:"option",process:{}},t),rA=e=>oA(e,YR),sA=(e,t,n)=>QR(e,e,TR(t),n),aA=(e,t)=>sA(e,t,KR),iA=(e,t,n)=>sA(e,t,ZR(n)),lA=(e,t)=>sA(e,t,GR),dA=(e,t)=>sA(e,t,XR),cA=tA("type"),mA=nA("fetch"),uA=nA("onAction"),fA=dA("onSetup",(()=>S)),gA=rA("text"),pA=rA("icon"),hA=rA("tooltip"),bA=rA("label"),vA=lA("active",!1),yA=lA("enabled",!0),CA=lA("primary",!1),wA=e=>((e,t)=>sA(e,t,YR))("type",e),xA=zR([cA,tA("trigger"),aA("minChars",1),(_A=1,((e,t)=>QR(e,e,TR(t),VR()))("columns",_A)),aA("maxResults",10),(EA="matches",oA(EA,XR)),mA,uA,((e,t,n)=>sA(e,t,jR(n)))("highlightOn",[],YR)]);var EA,_A;const kA=[yA,hA,pA,gA,fA],SA=[vA].concat(kA),NA=[dA("predicate",I),iA("scope","node",["node","editor"]),iA("position","selection",["node","selection","line"])],RA=kA.concat([wA("contextformbutton"),CA,uA,JR("original",D)]),AA=SA.concat([wA("contextformbutton"),CA,uA,JR("original",D)]),DA=kA.concat([wA("contextformbutton")]),TA=SA.concat([wA("contextformtogglebutton")]),OA=qR("type",{contextformbutton:RA,contextformtogglebutton:AA});zR([wA("contextform"),dA("initValue",A("")),bA,((e,t)=>QR(e,e,{tag:"required",process:{}},jR(t)))("commands",OA),oA("launch",qR("type",{contextformbutton:DA,contextformtogglebutton:TA}))].concat(NA));const BA=e=>{const t=e.ui.registry.getAll().popups,n=be(t,(e=>{return(t=e,HR("Autocompleter",xA,{trigger:t.ch,...t})).fold((e=>{throw new Error($R(e))}),D);var t})),o=Ne(xe(n,(e=>e.trigger))),r=Ee(n);return{dataset:n,triggers:o,lookupByTrigger:e=>X(r,(t=>t.trigger===e))}},PA=e=>{const t=ai(),n=Za(!1),o=t.isSet,r=()=>{o()&&((e=>{Nx(e).autocompleter.removeDecoration()})(e),(e=>{e.dispatch("AutocompleterEnd")})(e),n.set(!1),t.clear())},s=n=>{o()||(((e,t)=>{Nx(e).autocompleter.addDecoration(t)})(e,n.range),t.set({trigger:n.trigger,matchLength:n.text.length}))},a=Me((()=>BA(e))),i=o=>{(n=>t.get().map((t=>iR(e.dom,e.selection.getRng(),t.trigger).bind((t=>uR(e,a,t,n))))).getOrThunk((()=>mR(e,a))))(o).fold(r,(o=>{s(o.context),o.lookupData.then((s=>{t.get().map((a=>{const i=o.context;a.trigger===i.trigger&&(i.text.length-a.matchLength>=10?r():(t.set({...a,matchLength:i.text.length}),n.get()?((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:s}):(n.set(!0),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:s}))))}))}))}))};e.addCommand("mceAutocompleterReload",((e,t)=>{const n=p(t)?t.fetchOptions:{};i(n)})),e.addCommand("mceAutocompleterClose",r),((e,t)=>{const n=li(t.load,50);e.on("keypress compositionend",(e=>{27!==e.which&&n.throttle()})),e.on("keydown",(e=>{const o=e.which;8===o?n.throttle():27===o&&t.cancelIfNecessary()})),e.on("remove",n.cancel)})(e,{cancelIfNecessary:r,load:i})},LA=Et().browser.isSafari(),MA=e=>Br(yn.fromDom(e)),IA=(e,t)=>{var n;return 0===e.startOffset&&e.endOffset===(null===(n=t.textContent)||void 0===n?void 0:n.length)},FA=(e,t)=>U.from(e.getParent(t.container(),"details")),UA=(e,t)=>FA(e,t).isSome(),zA=(e,t)=>t.startSummary.exists((t=>((e,t)=>Ym(t).exists((t=>t.isEqual(e))))(e,t))),jA=(e,t)=>t.startSummary.exists((t=>((e,t)=>Gm(t).exists((n=>ir(n.getNode())&&Km(t,n).exists((t=>t.isEqual(e)))||n.isEqual(e))))(e,t))),HA=(e,t)=>{const n=t.getNode();C(n)||e.selection.setCursorLocation(n,t.offset())},$A=(e,t,n)=>{const o=e.dom.getParent(t.container(),"details");if(o&&!o.open){const t=e.dom.select("summary",o)[0];t&&(n?Ym(t):Gm(t)).each((t=>HA(e,t)))}else HA(e,t)},qA=(e,t,n)=>{const{dom:o,selection:r}=e,s=e.getBody();if("character"===n){const n=rl.fromRangeStart(r.getRng()),a=o.getParent(n.container(),o.isBlock),i=FA(o,n),l=a&&o.isEmpty(a),d=v(null==a?void 0:a.previousSibling),c=v(null==a?void 0:a.nextSibling);return!!(l&&(t?c:d)&&$m(!t,s,n).exists((e=>UA(o,e)&&!Mt(i,FA(o,e)))))||$m(t,s,n).fold(I,(n=>{const r=FA(o,n);if(UA(o,n)&&!Mt(i,r)){if(t||$A(e,n,!1),a&&l){if(t&&d)return!0;if(!t&&c)return!0;$A(e,n,t),e.dom.remove(a)}return!0}return!1}))}return!1},VA=(e,t,n,o)=>{const r=e.selection.getRng(),s=rl.fromRangeStart(r),a=e.getBody();return"selection"===o?((e,t)=>{const n=t.startSummary.exists((t=>t.contains(e.startContainer))),o=t.startSummary.exists((t=>t.contains(e.endContainer))),r=t.startDetails.forall((e=>t.endDetails.forall((t=>e!==t))));return(n||o)&&!(n&&o)||r})(r,t):n?jA(s,t)||((e,t,n)=>n.startDetails.exists((n=>Wm(e,t).forall((e=>!n.contains(e.container()))))))(a,s,t):zA(s,t)||((e,t)=>t.startDetails.exists((n=>Km(n,e).forall((n=>t.startSummary.exists((t=>!t.contains(e.container())&&t.contains(n.container()))))))))(s,t)},WA=(e,t,n)=>((e,t)=>{const n=U.from(e.getParent(t.startContainer,"details")),o=U.from(e.getParent(t.endContainer,"details"));if(n.isSome()||o.isSome()){const t=n.bind((t=>U.from(e.select("summary",t)[0])));return U.some({startSummary:t,startDetails:n,endDetails:o})}return U.none()})(e.dom,e.selection.getRng()).fold((()=>qA(e,t,n)),(o=>VA(e,o,t,n)||qA(e,t,n))),KA=(e,t,n)=>{const o=e.selection,r=o.getNode(),s=o.getRng(),a=rl.fromRangeStart(s);return!!hr(r)&&("selection"===n&&IA(s,r)||yb(t,a,r)?MA(r):e.undoManager.transact((()=>{const s=o.getSel();let{anchorNode:a,anchorOffset:i,focusNode:l,focusOffset:d}=null!=s?s:{};const c=()=>{x(a)&&x(i)&&x(l)&&x(d)&&(null==s||s.setBaseAndExtent(a,i,l,d))},m=(e,t)=>{K(e.childNodes,(e=>{Ru(e)&&t.appendChild(e)}))},u=e.dom.create("span",{"data-mce-bogus":"1"});m(r,u),r.appendChild(u),c(),"word"!==n&&"line"!==n||null==s||s.modify("extend",t?"right":"left",n),!o.isCollapsed()&&IA(o.getRng(),u)?MA(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,d=null==s?void 0:s.focusOffset,m(u,r),c()),e.dom.remove(u)})),!0)},YA=(e,t,n)=>WA(e,t,n)||LA&&KA(e,t,n)?U.some(S):U.none(),GA=e=>(t,n,o={})=>{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:S,inputType:n},a=Ba(new InputEvent(e));return t.dispatch(e,{...a,...s,...o})},XA=GA("input"),QA=GA("beforeinput"),JA=Et(),ZA=JA.os,eD=ZA.isMacOS()||ZA.isiOS(),tD=JA.browser.isFirefox(),nD=(e,t)=>{let n=!1;e.on("keydown",(o=>{n=o.keyCode===Df.BACKSPACE,o.isDefaultPrevented()||((e,t,n)=>{const o=n.keyCode===Df.BACKSPACE?"deleteContentBackward":"deleteContentForward",r=e.selection.isCollapsed(),s=r?"character":"selection",a=e=>r?e?"word":"line":"selection";vN([{keyCode:Df.BACKSPACE,action:hN(LS,e)},{keyCode:Df.BACKSPACE,action:hN(M_,e,!1)},{keyCode:Df.DELETE,action:hN(M_,e,!0)},{keyCode:Df.BACKSPACE,action:hN(k_,e,!1)},{keyCode:Df.DELETE,action:hN(k_,e,!0)},{keyCode:Df.BACKSPACE,action:hN(cS,e,t,!1)},{keyCode:Df.DELETE,action:hN(cS,e,t,!0)},{keyCode:Df.BACKSPACE,action:hN(ev,e,!1)},{keyCode:Df.DELETE,action:hN(ev,e,!0)},{keyCode:Df.BACKSPACE,action:hN(YA,e,!1,s)},{keyCode:Df.DELETE,action:hN(YA,e,!0,s)},...eD?[{keyCode:Df.BACKSPACE,altKey:!0,action:hN(YA,e,!1,a(!0))},{keyCode:Df.DELETE,altKey:!0,action:hN(YA,e,!0,a(!0))},{keyCode:Df.BACKSPACE,metaKey:!0,action:hN(YA,e,!1,a(!1))}]:[{keyCode:Df.BACKSPACE,ctrlKey:!0,action:hN(YA,e,!1,a(!0))},{keyCode:Df.DELETE,ctrlKey:!0,action:hN(YA,e,!0,a(!0))}],{keyCode:Df.BACKSPACE,action:hN(I_,e,!1)},{keyCode:Df.DELETE,action:hN(I_,e,!0)},{keyCode:Df.BACKSPACE,action:hN(NS,e,!1)},{keyCode:Df.DELETE,action:hN(NS,e,!0)},{keyCode:Df.BACKSPACE,action:hN(v_,e,!1)},{keyCode:Df.DELETE,action:hN(v_,e,!0)},{keyCode:Df.BACKSPACE,action:hN(g_,e,!1)},{keyCode:Df.DELETE,action:hN(g_,e,!0)},{keyCode:Df.BACKSPACE,action:hN(xS,e,!1)},{keyCode:Df.DELETE,action:hN(xS,e,!0)}],n).filter((t=>e.selection.isEditable())).each((t=>{n.preventDefault(),QA(e,o).isDefaultPrevented()||(t(),XA(e,o))}))})(e,t,o)})),e.on("keyup",(t=>{t.isDefaultPrevented()||((e,t,n)=>{bN([{keyCode:Df.BACKSPACE,action:hN(L_,e)},{keyCode:Df.DELETE,action:hN(L_,e)},...eD?[{keyCode:Df.BACKSPACE,altKey:!0,action:hN(kS,e)},{keyCode:Df.DELETE,altKey:!0,action:hN(kS,e)},...n?[{keyCode:tD?224:91,action:hN(kS,e)}]:[]]:[{keyCode:Df.BACKSPACE,ctrlKey:!0,action:hN(kS,e)},{keyCode:Df.DELETE,ctrlKey:!0,action:hN(kS,e)}]],t)})(e,t,n),n=!1}))},oD=(e,t)=>{const n=e.dom,o=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(Vo(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(n.doc.createTextNode(vr),t.firstChild)}const r=n.createRng();if(t.normalize(),t.hasChildNodes()){const e=new Ho(t,t);let n,s=t;for(;n=e.current();){if(tr(n)){r.setStart(n,0),r.setEnd(n,0);break}if(o[n.nodeName.toLowerCase()]){r.setStartBefore(n),r.setEndBefore(n);break}s=n,n=e.next()}n||(r.setStart(s,0),r.setEnd(s,0))}else ir(t)?t.nextSibling&&n.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),Pg(e,r)},rD=(e,t)=>{const n=e.getRoot();let o,r=t;for(;r!==n&&r&&"false"!==e.getContentEditable(r);){if("true"===e.getContentEditable(r)){o=r;break}r=r.parentNode}return r!==n?o:n},sD=e=>U.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),aD=e=>{e.innerHTML='<br data-mce-bogus="1">'},iD=(e,t)=>{Ql(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,n)=>{const o=e.dom;U.from(n.style).map(o.parseStyle).each((e=>{const n={...fo(yn.fromDom(t)),...e};o.setStyles(t,n)}));const r=U.from(n.class).map((e=>e.split(/\s+/))),s=U.from(t.className).map((e=>X(e.split(/\s+/),(e=>""!==e))));It(r,s,((e,n)=>{const r=X(n,(t=>!q(e,t))),s=[...e,...r];o.setAttrib(t,"class",s.join(" "))}));const a=["style","class"],i=we(n,((e,t)=>!q(a,t)));o.setAttribs(t,i)})(e,t,Jl(e))},lD=(e,t,n,o,r=!0,s,a)=>{const i=e.dom,l=e.schema,d=Ql(e),c=n?n.nodeName.toUpperCase():"";let m=t;const u=l.getTextInlineElements();let f;f=s||"TABLE"===c||"HR"===c?i.create(s||d,a||{}):n.cloneNode(!1);let g=f;if(r){do{if(u[m.nodeName]){if(Qm(m)||mu(m))continue;const e=m.cloneNode(!1);i.setAttrib(e,"id",""),f.hasChildNodes()?(e.appendChild(f.firstChild),f.appendChild(e)):(g=e,f.appendChild(e))}}while((m=m.parentNode)&&m!==o)}else i.setAttrib(f,"style",null),i.setAttrib(f,"class",null);return iD(e,f),aD(g),f},dD=(e,t,n)=>!t&&n.nodeName.toLowerCase()===Ql(e)&&e.dom.isEmpty(n)&&((e,t,n)=>{let o=t;for(;o&&o!==e&&v(o.nextSibling);){const e=o.parentElement;if(!e||!n(e))return pr(e);o=e}return!1})(e.getBody(),n,(t=>ke(e.schema.getTextBlockElements(),t.nodeName.toLowerCase()))),cD=(e,t,n)=>{var o,r,s;const a=t(Ql(e)),i=((e,t)=>e.dom.getParent(t,pr))(e,n);i&&(e.dom.insertAfter(a,i),oD(e,a),(null!==(s=null===(r=null===(o=n.parentElement)||void 0===o?void 0:o.childNodes)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>1&&e.dom.remove(n))},mD=(e,t)=>{const n=null==e?void 0:e.parentNode;return x(n)&&n.nodeName===t},uD=e=>x(e)&&/^(OL|UL|LI)$/.test(e.nodeName),fD=e=>x(e)&&/^(LI|DT|DD)$/.test(e.nodeName),gD=e=>{const t=e.parentNode;return fD(t)?t:e},pD=(e,t,n)=>{let o=e[n?"firstChild":"lastChild"];for(;o&&!Vo(o);)o=o[n?"nextSibling":"previousSibling"];return o===t},hD=e=>J(xe(fo(yn.fromDom(e)),((e,t)=>`${t}: ${e};`)),((e,t)=>e+t),""),bD=(e,t,n,o,r)=>{const s=e.dom,a=e.selection.getRng(),i=n.parentNode;if(n===e.getBody()||!i)return;var l;uD(l=n)&&uD(l.parentNode)&&(r="LI");const d=fD(o)?hD(o):void 0;let c=fD(o)&&d?t(r,{style:hD(o)}):t(r);if(pD(n,o,!0)&&pD(n,o,!1))if(mD(n,"LI")){const e=gD(n);s.insertAfter(c,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(n)?s.remove(e):s.remove(n)}else s.replace(c,n);else if(pD(n,o,!0))mD(n,"LI")?(s.insertAfter(c,gD(n)),c.appendChild(s.doc.createTextNode(" ")),c.appendChild(n)):i.insertBefore(c,n),s.remove(o);else if(pD(n,o,!1))s.insertAfter(c,gD(n)),s.remove(o);else{n=gD(n);const e=a.cloneRange();e.setStartAfter(o),e.setEndAfter(n);const t=e.extractContents();if("LI"===r&&((e,t)=>e.firstChild&&e.firstChild.nodeName===t)(t,"LI")){const e=X(W(c.children,yn.fromDom),B(Jt("br")));c=t.firstChild,s.insertAfter(t,n),K(e,(e=>bo(yn.fromDom(c),e))),d&&c.setAttribute("style",d)}else s.insertAfter(t,n),s.insertAfter(c,n);s.remove(o)}oD(e,c)},vD=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),yD=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,CD=(e,t)=>x(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),wD=(e,t,n)=>tr(t)?e?1===n&&t.data.charAt(n-1)===Pr?0:n:n===t.data.length-1&&t.data.charAt(n)===Pr?t.data.length:n:n,xD={insert:(e,t)=>{let n,o,r,s,a=!1;const i=e.dom,l=e.schema.getNonEmptyElements(),d=e.selection.getRng(),c=Ql(e),m=yn.fromDom(d.startContainer),u=Mn(m,d.startOffset),f=u.exists((e=>Kt(e)&&!oo(e))),p=d.collapsed&&f,h=(t,o)=>lD(e,n,_,E,nd(e),t,o),b=e=>{const t=wD(e,n,o);if(tr(n)&&(e?t>0:t<n.data.length))return!1;if(n.parentNode===_&&a&&!e)return!0;if(e&&Vo(n)&&n===_.firstChild)return!0;if(yD(n,"TABLE")||yD(n,"HR"))return a&&!e||!a&&e;const r=new Ho(n,_);let s;for(tr(n)&&(e&&0===t?r.prev():e||t!==n.data.length||r.next());s=r.current();){if(Vo(s)){if(!s.getAttribute("data-mce-bogus")){const e=s.nodeName.toLowerCase();if(l[e]&&"br"!==e)return!1}}else if(tr(s)&&!is(s.data))return!1;e?r.prev():r.next()}return!0},v=()=>{let t;return t=/^(H[1-6]|PRE|FIGURE)$/.test(r)&&"HGROUP"!==k?h(c):h(),((e,t)=>{const n=od(e);return!w(t)&&(g(n)?q(Pt.explode(n),t.nodeName.toLowerCase()):n)})(e,s)&&CD(i,s)&&i.isEmpty(_,void 0,{includeZwsp:!0})?t=i.split(s,_):i.insertAfter(t,_),oD(e,t),t};dg(i,d).each((e=>{d.setStart(e.startContainer,e.startOffset),d.setEnd(e.endContainer,e.endOffset)})),n=d.startContainer,o=d.startOffset;const y=!(!t||!t.shiftKey),C=!(!t||!t.ctrlKey);Vo(n)&&n.hasChildNodes()&&!p&&(a=o>n.childNodes.length-1,n=n.childNodes[Math.min(o,n.childNodes.length-1)]||n,o=a&&tr(n)?n.data.length:0);const E=rD(i,n);if(!E||((e,t)=>{const n=e.dom.getParent(t,"ol,ul,dl");return null!==n&&"false"===e.dom.getContentEditableParent(n)})(e,n))return;y||(n=((e,t,n,o,r)=>{var s,a;const i=e.dom,l=null!==(s=rD(i,o))&&void 0!==s?s:i.getRoot();let d=i.getParent(o,i.isBlock);if(!d||!CD(i,d)){if(d=d||l,!d.hasChildNodes()){const o=i.create(t);return iD(e,o),d.appendChild(o),n.setStart(o,0),n.setEnd(o,0),o}let s,c=o;for(;c&&c.parentNode!==d;)c=c.parentNode;for(;c&&!i.isBlock(c);)s=c,c=c.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(iD(e,l),a.insertBefore(l,s),c=s;c&&!i.isBlock(c);){const e=c.nextSibling;l.appendChild(c),c=e}n.setStart(o,r),n.setEnd(o,r)}}return o})(e,c,d,n,o));let _=i.getParent(n,i.isBlock)||i.getRoot();s=x(null==_?void 0:_.parentNode)?i.getParent(_.parentNode,i.isBlock):null,r=_?_.nodeName.toUpperCase():"";const k=s?s.nodeName.toUpperCase():"";if("LI"!==k||C||(_=s,s=s.parentNode,r=k),Vo(s)&&dD(e,y,_))return cD(e,h,_);if(/^(LI|DT|DD)$/.test(r)&&Vo(s)&&i.isEmpty(_))return void bD(e,h,s,_,c);if(!(p||_!==e.getBody()&&CD(i,_)))return;const S=_.parentNode;let N;if(p)N=h(c),u.fold((()=>{vo(m,yn.fromDom(N))}),(e=>{po(e,yn.fromDom(N))})),e.selection.setCursorLocation(N,0);else if(Ur(_))N=Kr(_),i.isEmpty(_)&&aD(_),iD(e,N),oD(e,N);else if(b(!1))N=v();else if(b(!0)&&S){N=S.insertBefore(h(),_);const t=yn.fromDom(d.startContainer).dom.hasChildNodes()&&d.collapsed;oD(e,yD(_,"HR")||t?N:_)}else{const t=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,wD(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,wD(!1,e.endContainer,e.endOffset)),t})(d).cloneRange();t.setEndAfter(_);const n=t.extractContents();(e=>{K(Uo(yn.fromDom(e),Gt),(e=>{const t=e.dom;t.nodeValue=Mr(t.data)}))})(n),(e=>{let t=e;do{tr(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild}while(t)})(n),N=n.firstChild,i.insertAfter(n,_),((e,t,n)=>{var o;const r=[];if(!n)return;let s=n;for(;s=s.firstChild;){if(e.isBlock(s))return;Vo(s)&&!t[s.nodeName.toLowerCase()]&&r.push(s)}let a=r.length;for(;a--;)s=r[a],(!s.hasChildNodes()||s.firstChild===s.lastChild&&""===(null===(o=s.firstChild)||void 0===o?void 0:o.nodeValue)||vD(e,s))&&e.remove(s)})(i,l,N),((e,t)=>{t.normalize();const n=t.lastChild;(!n||Vo(n)&&/^(left|right)$/gi.test(e.getStyle(n,"float",!0)))&&e.add(t,"br")})(i,_),i.isEmpty(_)&&aD(_),N.normalize(),i.isEmpty(N)?(i.remove(N),v()):(iD(e,N),oD(e,N))}i.setAttrib(N,"id",""),e.dispatch("NewBlock",{newBlock:N})},fakeEventName:"insertParagraph"},ED=(e,t,n)=>{const o=e.dom.createRng();n?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),e.selection.setRng(o),Pg(e,o)},_D=(e,t)=>{const n=e.selection,o=e.dom,r=n.getRng();let s,a=!1;dg(o,r).each((e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)}));let i=r.startOffset,l=r.startContainer;if(Vo(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 d=o.getParent(l,o.isBlock);const c=d&&d.parentNode?o.getParent(d.parentNode,o.isBlock):null,m=c?c.nodeName.toUpperCase():"",u=!(!t||!t.ctrlKey);"LI"!==m||u||(d=c),tr(l)&&i>=l.data.length&&(((e,t,n)=>{const o=new Ho(t,n);let r;const s=e.getNonEmptyElements();for(;r=o.next();)if(s[r.nodeName.toLowerCase()]||tr(r)&&r.length>0)return!0;return!1})(e.schema,l,d||o.getRoot())||(s=o.create("br"),r.insertNode(s),r.setStartAfter(s),r.setEndAfter(s),a=!0)),s=o.create("br"),al(o,r,s),ED(e,s,a),e.undoManager.add()},kD=(e,t)=>{const n=yn.fromTag("br");po(yn.fromDom(t),n),e.undoManager.add()},SD=(e,t)=>{ND(e.getBody(),t)||ho(yn.fromDom(t),yn.fromTag("br"));const n=yn.fromTag("br");ho(yn.fromDom(t),n),ED(e,n.dom,!1),e.undoManager.add()},ND=(e,t)=>{return n=rl.after(t),!!ir(n.getNode())||Wm(e,rl.after(t)).map((e=>ir(e.getNode()))).getOr(!1);var n},RD=e=>e&&"A"===e.nodeName&&"href"in e,AD=e=>e.fold(I,RD,RD,I),DD=(e,t)=>{t.fold(S,O(kD,e),O(SD,e),S)},TD={insert:(e,t)=>{const n=(e=>{const t=O(lb,e),n=rl.fromRangeStart(e.selection.getRng());return rk(t,e.getBody(),n).filter(AD)})(e);n.isSome()?n.each(O(DD,e)):_D(e,t)},fakeEventName:"insertLineBreak"},OD=(e,t)=>sD(e).filter((e=>t.length>0&&wn(yn.fromDom(e),t))).isSome(),BD=Dl([{br:[]},{block:[]},{none:[]}]),PD=(e,t)=>(e=>OD(e,td(e)))(e),LD=e=>(t,n)=>(e=>sD(e).filter((e=>Nr(yn.fromDom(e)))).isSome())(t)===e,MD=(e,t)=>(n,o)=>{const r=(e=>sD(e).fold(A(""),(e=>e.nodeName.toUpperCase())))(n)===e.toUpperCase();return r===t},ID=e=>{const t=rD(e.dom,e.selection.getStart());return w(t)},FD=e=>MD("pre",e),UD=e=>(t,n)=>Xl(t)===e,zD=(e,t)=>(e=>OD(e,ed(e)))(e),jD=(e,t)=>t,HD=e=>{const t=Ql(e),n=rD(e.dom,e.selection.getStart());return x(n)&&e.schema.isValidChild(n.nodeName,t)},$D=e=>{const t=e.selection.getRng(),n=yn.fromDom(t.startContainer),o=Mn(n,t.startOffset).map((e=>Kt(e)&&!oo(e)));return t.collapsed&&o.getOr(!0)},qD=(e,t)=>(n,o)=>J(e,((e,t)=>e&&t(n,o)),!0)?U.some(t):U.none(),VD=(e,t,n)=>{t.selection.isCollapsed()||(e=>{e.execCommand("delete")})(t),x(n)&&QA(t,e.fakeEventName).isDefaultPrevented()||(e.insert(t,n),x(n)&&XA(t,e.fakeEventName))},WD=(e,t)=>{const n=()=>VD(TD,e,t),o=()=>VD(xD,e,t),r=((e,t)=>Y_([qD([PD],BD.none()),qD([FD(!0),ID],BD.none()),qD([MD("summary",!0)],BD.br()),qD([FD(!0),UD(!1),jD],BD.br()),qD([FD(!0),UD(!1)],BD.block()),qD([FD(!0),UD(!0),jD],BD.block()),qD([FD(!0),UD(!0)],BD.br()),qD([LD(!0),jD],BD.br()),qD([LD(!0)],BD.block()),qD([zD],BD.br()),qD([jD],BD.br()),qD([HD],BD.block()),qD([$D],BD.block())],[e,!(!t||!t.shiftKey)]).getOr(BD.none()))(e,t);switch(Zl(e)){case"linebreak":r.fold(n,n,S);break;case"block":r.fold(o,o,S);break;case"invert":r.fold(o,n,S);break;default:r.fold(n,o,S)}},KD=Et(),YD=KD.os.isiOS()&&KD.browser.isSafari(),GD=(e,t)=>{var n;t.isDefaultPrevented()||(t.preventDefault(),(n=e.undoManager).typing&&(n.typing=!1,n.add()),e.undoManager.transact((()=>{WD(e,t)})))},XD=e=>{let t=U.none();e.on("keydown",(n=>{n.keyCode===Df.ENTER&&(YD&&(e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(tr(t)){const n=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,o=t.data.charAt(e.startOffset-1);return n.test(o)}return!1})(e.selection.getRng())?(e=>{t=U.some(e.selection.getBookmark()),e.undoManager.add()})(e):GD(e,n))})),e.on("keyup",(n=>{n.keyCode===Df.ENTER&&t.each((()=>((e,n)=>{e.undoManager.undo(),t.fold(S,(t=>e.selection.moveToBookmark(t))),GD(e,n),t=U.none()})(e,n)))}))},QD=(e,t)=>{e.on("keydown",(n=>{n.isDefaultPrevented()||((e,t,n)=>{const o=Dt.os.isMacOS()||Dt.os.isiOS();bN([{keyCode:Df.END,action:hN(sN,e,!0)},{keyCode:Df.HOME,action:hN(sN,e,!1)},...o?[]:[{keyCode:Df.HOME,action:hN(aN,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Df.END,action:hN(aN,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Df.END,action:hN(wN,e,!0)},{keyCode:Df.HOME,action:hN(wN,e,!1)},{keyCode:Df.END,action:hN(aS,e,!0,t)},{keyCode:Df.HOME,action:hN(aS,e,!1,t)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))},JD=e=>{e.on("input",(t=>{t.isComposing||(e=>{const t=yn.fromDom(e.getBody());e.selection.isCollapsed()&&Wh(t,rl.fromRangeStart(e.selection.getRng()),e.schema).each((t=>{e.selection.setRng(t.toRange())}))})(e)}))},ZD=Et(),eT=e=>e.stopImmediatePropagation(),tT=e=>e.keyCode===Df.PAGE_UP||e.keyCode===Df.PAGE_DOWN,nT=(e,t,n)=>{n&&!e.get()?t.on("NodeChange",eT,!0):!n&&e.get()&&t.off("NodeChange",eT),e.set(n)},oT=(e,t)=>{if(ZD.os.isMacOS())return;const n=Za(!1);e.on("keydown",(t=>{tT(t)&&nT(n,e,!0)})),e.on("keyup",(o=>{o.isDefaultPrevented()||((e,t,n)=>{bN([{keyCode:Df.PAGE_UP,action:hN(aS,e,!1,t)},{keyCode:Df.PAGE_DOWN,action:hN(aS,e,!0,t)}],n)})(e,t,o),tT(o)&&n.get()&&(nT(n,e,!1),e.nodeChanged())}))},rT=(e,t)=>{const n=t.container(),o=t.offset();return tr(n)?(n.insertData(o,e),U.some(rl(n,o+e.length))):Em(t).map((n=>{const o=yn.fromText(e);return t.isAtEnd()?ho(n,o):po(n,o),rl(o.dom,e.length)}))},sT=O(rT,vr),aT=O(rT," "),iT=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},lT=e=>{const t=rl.fromRangeStart(e.selection.getRng()),n=yn.fromDom(e.getBody());if(e.selection.isCollapsed()){const o=O(lb,e),r=rl.fromRangeStart(e.selection.getRng());return rk(o,e.getBody(),r).bind((e=>t=>t.fold((t=>Km(e.dom,rl.before(t))),(e=>Ym(e)),(e=>Gm(e)),(t=>Wm(e.dom,rl.after(t)))))(n)).map((o=>()=>((e,t,n)=>o=>Ih(e,o,n)?sT(t):aT(t))(n,t,e.schema)(o).each(iT(e))))}return U.none()},dT=e=>{return Ft(Dt.browser.isFirefox()&&e.selection.isEditable()&&(t=e.dom,n=e.selection.getRng().startContainer,t.isEditable(t.getParent(n,"summary"))),(()=>{const t=yn.fromDom(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete"),((e,t,n)=>Ih(e,t,n)?sT(t):aT(t))(t,rl.fromRangeStart(e.selection.getRng()),e.schema).each(iT(e))}));var t,n},cT=e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{vN([{keyCode:Df.SPACEBAR,action:hN(lT,e)},{keyCode:Df.SPACEBAR,action:hN(dT,e)}],t).each((n=>{t.preventDefault(),QA(e,"insertText",{data:" "}).isDefaultPrevented()||(n(),XA(e,"insertText",{data:" "}))}))})(e,t)}))},mT=e=>Dc(e)?[{keyCode:Df.TAB,action:hN(YN,e,!0)},{keyCode:Df.TAB,shiftKey:!0,action:hN(YN,e,!1)}]:[],uT=e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{bN([...mT(e)],t).each((e=>{t.preventDefault()}))})(e,t)}))},fT=e=>{if(e.addShortcut("Meta+P","","mcePrint"),PA(e),_x(e))return Za(null);{const t=oS(e);return(e=>{e.on("beforeinput",(t=>{e.selection.isEditable()&&!V(t.getTargetRanges(),(t=>!mp(e.dom,t)))||t.preventDefault()}))})(e),(e=>{e.on("keyup compositionstart",O(JS,e))})(e),GN(e,t),nD(e,t),XD(e),cT(e),JD(e),uT(e),QD(e,t),oT(e,t),t}};class gT{constructor(e){let t;this.lastPath=[],this.editor=e;const n=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",(n=>{const o=e.selection.getRng(),r={startContainer:o.startContainer,startOffset:o.startOffset,endContainer:o.endContainer,endOffset:o.endOffset};"nodechange"!==n.type&&ng(r,t)||e.dispatch("SelectionChange"),t=r})),e.on("contextmenu",(()=>{e.dispatch("SelectionChange")})),e.on("SelectionChange",(()=>{const t=e.selection.getStart(!0);t&&ku(e)&&!n.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})})),e.on("mouseup",(t=>{!t.isDefaultPrevented()&&ku(e)&&("IMG"===e.selection.getNode().nodeName?Yg.setEditorTimeout(e,(()=>{e.nodeChanged()})):e.nodeChanged())}))}nodeChanged(e={}){const t=this.editor.selection;let n;if(this.editor.initialized&&t&&!Vd(this.editor)&&!this.editor.mode.isReadOnly()){const o=this.editor.getBody();n=t.getStart(!0)||o,n.ownerDocument===this.editor.getDoc()&&this.editor.dom.isChildOf(n,o)||(n=o);const r=[];this.editor.dom.getParent(n,(e=>e===o||(r.push(e),!1))),this.editor.dispatch("NodeChange",{...e,element:n,parents:r})}}isSameElementPath(e){let t;const n=this.editor,o=se(n.dom.getParents(e,F,n.getBody()));if(o.length===this.lastPath.length){for(t=o.length;t>=0&&o[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=o,!0}return this.lastPath=o,!1}}const pT=xi("image"),hT=xi("event"),bT=e=>t=>{t[hT]=e},vT=bT(0),yT=bT(2),CT=bT(1),wT=(xT=0,e=>{const t=e;return U.from(t[hT]).exists((e=>e===xT))});var xT;const ET=xi("mode"),_T=e=>t=>{t[ET]=e},kT=(e,t)=>_T(t)(e),ST=_T(0),NT=_T(2),RT=_T(1),AT=e=>t=>{const n=t;return U.from(n[ET]).exists((t=>t===e))},DT=AT(0),TT=AT(1),OT=["none","copy","link","move"],BT=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],PT=()=>{const e=new window.DataTransfer;let t="move",n="all";const o={get dropEffect(){return t},set dropEffect(e){q(OT,e)&&(t=e)},get effectAllowed(){return n},set effectAllowed(e){wT(o)&&q(BT,e)&&(n=e)},get items(){return((e,t)=>({...t,get length(){return t.length},add:(n,o)=>{if(DT(e)){if(!g(n))return t.add(n);if(!C(o))return t.add(n,o)}return null},remove:n=>{DT(e)&&t.remove(n)},clear:()=>{DT(e)&&t.clear()}}))(o,e.items)},get files(){return TT(o)?Object.freeze({length:0,item:e=>null}):e.files},get types(){return e.types},setDragImage:(t,n,r)=>{var s;DT(o)&&(s={image:t,x:n,y:r},o[pT]=s,e.setDragImage(t,n,r))},getData:t=>TT(o)?"":e.getData(t),setData:(t,n)=>{DT(o)&&e.setData(t,n)},clearData:t=>{DT(o)&&e.clearData(t)}};return ST(o),o},LT=e=>{const t=PT(),n=(e=>{const t=e;return U.from(t[ET])})(e);return NT(e),vT(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,(e=>{const t=e;return U.from(t[pT])})(e).each((e=>t.setDragImage(e.image,e.x,e.y))),K(e.types,(n=>{"Files"!==n&&t.setData(n,e.getData(n))})),K(e.files,(e=>t.items.add(e))),(e=>{const t=e;return U.from(t[hT])})(e).each((e=>{((e,t)=>{bT(t)(e)})(t,e)})),n.each((n=>{kT(e,n),kT(t,n)})),t},MT=(e,t)=>e.setData("text/html",t),IT="x-tinymce/html",FT=A(IT),UT="\x3c!-- "+IT+" --\x3e",zT=e=>UT+e,jT=e=>-1!==e.indexOf(UT),HT=(e,t,n)=>{const o=e.split(/\n\n/),r=((e,t)=>{let n="<"+e;const o=xe(t,((e,t)=>t+'="'+ia.encodeAllRaw(e)+'"'));return o.length&&(n+=" "+o.join(" ")),n+">"})(t,n),s="</"+t+">",a=W(o,(e=>e.split(/\n/).join("<br />")));return 1===a.length?a[0]:W(a,(e=>r+e+s)).join("")},$T="%MCEPASTEBIN%",qT=e=>e.dom.get("mcepastebin"),VT=e=>x(e)&&"mcepastebin"===e.id,WT=e=>e===$T,KT=e=>{const t=Za(null);return{create:()=>((e,t)=>{const{dom:n,selection:o}=e,r=e.getBody();t.set(o.getRng());const s=n.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"},$T);Dt.browser.isFirefox()&&n.setStyle(s,"left","rtl"===n.getStyle(r,"direction",!0)?65535:-65535),n.bind(s,"beforedeactivate focusin focusout",(e=>{e.stopPropagation()})),s.focus(),o.select(s,!0)})(e,t),remove:()=>((e,t)=>{const n=e.dom;if(qT(e)){let o;const r=t.get();for(;o=qT(e);)n.remove(o),n.unbind(o);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>qT(e),getHtml:()=>(e=>{const t=e.dom,n=(e,n)=>{e.appendChild(n),t.remove(n,!0)},[o,...r]=X(e.getBody().childNodes,VT);K(r,(e=>{n(o,e)}));const s=t.select("div[id=mcepastebin]",o);for(let e=s.length-1;e>=0;e--){const r=t.create("div");o.insertBefore(r,s[e]),n(r,s[e])}return o?o.innerHTML:""})(e),getLastRng:t.get}},YT=(e,t)=>(Pt.each(t,(t=>{e=f(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])})),e),GT=e=>e=YT(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(e,t,n)=>t||n?vr:" "],/<br class="Apple-interchange-newline">/g,/<br>$/i]),XT=(e,t)=>({content:e,cancelled:t}),QT=(e,t,n)=>{const o=((e,t,n)=>e.dispatch("PastePreProcess",{content:t,internal:n}))(e,t,n),r=((e,t)=>{const n=Uw({sanitize:Nc(e),sandbox_iframes:Pc(e)},e.schema);n.addNodeFilter("meta",(e=>{Pt.each(e,(e=>{e.remove()}))}));const o=n.parse(t,{forced_root_block:!1,isRootContent:!0});return Kp({validate:!0},e.schema).serialize(o)})(e,o.content);return e.hasEventListeners("PastePostProcess")&&!o.isDefaultPrevented()?((e,t,n)=>{const o=e.dom.create("div",{style:"display:none"},t),r=((e,t,n)=>e.dispatch("PastePostProcess",{node:t,internal:n}))(e,o,n);return XT(r.node.innerHTML,r.isDefaultPrevented())})(e,r,n):XT(r,o.isDefaultPrevented())},JT=(e,t)=>(e.insertContent(t,{merge:pc(e),paste:!0}),!0),ZT=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),eO=(e,t,n)=>!(e.selection.isCollapsed()||!ZT(t))&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.execCommand("mceInsertLink",!1,t)})),!0))(e,t,n),tO=(e,t,n)=>!!((e,t)=>ZT(t)&&V(Ac(e),(e=>Ve(t.toLowerCase(),`.${e.toLowerCase()}`))))(e,t)&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.insertContent('<img src="'+t+'">')})),!0))(e,t,n),nO=(e,t,n)=>{n||!hc(e)?JT(e,t):((e,t)=>{Pt.each([eO,tO,JT],(n=>!n(e,t,JT)))})(e,t)},oO=(e=>{let t=0;return()=>e+t++})("mceclip"),rO=e=>{const t=PT();return MT(t,e),NT(t),t},sO=(e,t,n,o,r)=>{const s=((e,t,n)=>QT(e,t,n))(e,t,n);if(!s.cancelled){const t=s.content,n=()=>nO(e,t,o);r?QA(e,"insertFromPaste",{dataTransfer:rO(t)}).isDefaultPrevented()||(n(),XA(e,"insertFromPaste")):n()}},aO=(e,t,n,o)=>{const r=n||jT(t);sO(e,(e=>e.replace(UT,""))(t),r,!1,o)},iO=(e,t,n)=>{const o=e.dom.encode(t).replace(/\r\n/g,"\n"),r=cs(o,vc(e)),s=HT(r,Ql(e),Jl(e));sO(e,s,!1,!0,n)},lO=e=>{const t={};if(e&&e.types)for(let n=0;n<e.types.length;n++){const o=e.types[n];try{t[o]=e.getData(o)}catch(e){t[o]=""}}return t},dO=(e,t)=>t in e&&e[t].length>0,cO=e=>dO(e,"text/html")||dO(e,"text/plain"),mO=(e,t,n,o)=>{const r=oO(),s=sd(e)&&x(n.name),a=s?((e,t)=>{const n=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return x(n)?e.dom.encode(n[1]):void 0})(e,n.name):r,i=s?n.name:void 0,l=t.create(r,n,o,a,i);return t.add(l),l},uO=e=>{const t=Ac(e);return e=>qe(e.type,"image/")&&V(t,(t=>(e=>{const t=e.toLowerCase(),n={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Pt.hasOwn(n,t)?"image/"+n[t]:"image/"+t})(t)===e.type))},fO=(e,t,n)=>{const o="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(dc(e)&&o){const s=((e,t)=>{const n=t.items?oe(ue(t.items),(e=>"file"===e.kind?[e.getAsFile()]:[])):[],o=t.files?ue(t.files):[];return X(n.length>0?n:o,uO(e))})(e,o);if(s.length>0)return t.preventDefault(),(r=s,Promise.all(W(r,(e=>aC(e).then((t=>({file:e,uri:t}))))))).then((t=>{n&&e.selection.setRng(n),K(t,(t=>{((e,t)=>{oC(t.uri).each((({data:n,type:o,base64Encoded:r})=>{const s=r?n:btoa(n),a=t.file,i=e.editorUpload.blobCache,l=i.getByData(s,o),d=null!=l?l:mO(e,i,a,s);aO(e,`<img src="${d.blobUri()}">`,!1,!0)}))})(e,t)}))})),!0}return!1},gO=(e,t,n,o,r)=>{let s=GT(n);const a=dO(t,FT())||jT(n),i=!a&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(s),l=ZT(s);(WT(s)||!s.length||i&&!l)&&(o=!0),(o||l)&&(s=dO(t,"text/plain")&&i?t["text/plain"]:(e=>{const t=ya(),n=Uw({},t);let o="";const r=t.getVoidElements(),s=Pt.makeMap("script noscript style textarea video audio iframe object"," "),a=t.getBlockElements(),i=e=>{const n=e.name,l=e;if("br"!==n){if("wbr"!==n)if(r[n]&&(o+=" "),s[n])o+=" ";else{if(3===e.type&&(o+=e.value),!(e.name in t.getVoidElements())){let t=e.firstChild;if(t)do{i(t)}while(t=t.next)}a[n]&&l.next&&(o+="\n","p"===n&&(o+="\n"))}}else o+="\n"};return e=YT(e,[/<!\[[^\]]+\]>/g]),i(n.parse(e)),o})(s)),WT(s)||(o?iO(e,s,r):aO(e,s,a,r))},pO=(e,t,n)=>{let o;e.on("keydown",(e=>{(e=>Df.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(o=e.shiftKey&&86===e.keyCode)})),e.on("paste",(r=>{if(r.isDefaultPrevented()||(e=>{var t,n;return Dt.os.isAndroid()&&0===(null===(n=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===n?void 0:n.length)})(r))return;const s="text"===n.get()||o;o=!1;const a=lO(r.clipboardData);!cO(a)&&fO(e,r,t.getLastRng()||e.selection.getRng())||(dO(a,"text/html")?(r.preventDefault(),gO(e,a,a["text/html"],s,!0)):dO(a,"text/plain")&&dO(a,"text/uri-list")?(r.preventDefault(),gO(e,a,a["text/plain"],s,!0)):(t.create(),Yg.setEditorTimeout(e,(()=>{const n=t.getHtml();t.remove(),gO(e,a,n,s,!1)}),0)))}))},hO=(e,t,n)=>{pO(e,t,n),(e=>{const t=e=>qe(e,"webkit-fake-url"),n=e=>qe(e,"data:");e.parser.addNodeFilter("img",((o,r,s)=>{if(!dc(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(s))for(const r of o){const o=r.attr("src");g(o)&&!r.attr("data-mce-object")&&o!==Dt.transparentSrc&&(t(o)||!yc(e)&&n(o))&&r.remove()}}))})(e)},bO=(e,t)=>{e.addCommand("mceTogglePlainTextPaste",(()=>{((e,t)=>{"text"===t.get()?(t.set("html"),Af(e,!1)):(t.set("text"),Af(e,!0)),e.focus()})(e,t)})),e.addCommand("mceInsertClipboardContent",((t,n)=>{n.html&&aO(e,n.html,n.internal,!1),n.text&&iO(e,n.text,!1)}))},vO=(e,t,n,o)=>{((e,t,n)=>{if(!e)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(FT(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),o()):n(t.html,o)},yO=e=>(t,n)=>{const{dom:o,selection:r}=e,s=o.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=o.create("div",{contenteditable:"true"},t);o.setStyles(s,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),s.appendChild(a),o.add(e.getBody(),s);const i=r.getRng();a.focus();const l=o.createRng();l.selectNodeContents(a),r.setRng(l),Yg.setEditorTimeout(e,(()=>{r.setRng(i),o.remove(s),n()}),0)},CO=e=>({html:zT(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),wO=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),xO=e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&wO(e)&&e.selection.isEditable()&&vO(t,CO(e),yO(e),(()=>{if(Dt.browser.isChromium()||Dt.browser.isFirefox()){const t=e.selection.getRng();Yg.setEditorTimeout(e,(()=>{e.selection.setRng(t),e.execCommand("Delete")}),0)}else e.execCommand("Delete")}))})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&wO(e)&&vO(t,CO(e),yO(e),S)})(e))},EO=(e,t)=>{var n,o;return ug.getCaretRangeFromPoint(null!==(n=t.clientX)&&void 0!==n?n:0,null!==(o=t.clientY)&&void 0!==o?o:0,e.getDoc())},_O=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},kO=(e,t)=>{lc(e)&&e.on("dragend dragover draggesture dragdrop drop drag",(e=>{e.preventDefault(),e.stopPropagation()})),dc(e)||e.on("drop",(e=>{const t=e.dataTransfer;t&&(e=>V(e.files,(e=>/^image\//.test(e.type))))(t)&&e.preventDefault()})),e.on("drop",(n=>{if(n.isDefaultPrevented())return;const o=EO(e,n);if(w(o))return;const r=lO(n.dataTransfer),s=dO(r,FT());if((!cO(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&fO(e,n,o))return;const a=r[FT()],i=a||r["text/html"]||r["text/plain"],l=((e,t,n,o)=>{const r=e.getParent(n,(e=>Ls(t,e)));if(!v(e.getParent(n,"summary")))return!0;if(r&&ke(o,"text/html")){const e=(new DOMParser).parseFromString(o["text/html"],"text/html").body;return!v(e.querySelector(r.nodeName.toLowerCase()))}return!1})(e.dom,e.schema,o.startContainer,r),d=t.get();d&&!l||i&&(n.preventDefault(),Yg.setEditorTimeout(e,(()=>{e.undoManager.transact((()=>{(a||d&&l)&&e.execCommand("Delete"),_O(e,o);const t=GT(i);r["text/html"]?aO(e,t,s,!0):iO(e,t,!0)}))})))})),e.on("dragstart",(e=>{t.set(!0)})),e.on("dragover dragend",(n=>{dc(e)&&!t.get()&&(n.preventDefault(),_O(e,EO(e,n))),"dragend"===n.type&&t.set(!1)})),(e=>{e.on("input",(t=>{const n=e=>v(e.querySelector("summary"));if("deleteByDrag"===t.inputType){const t=X(e.dom.select("details"),n);K(t,(t=>{ir(t.firstChild)&&t.firstChild.remove();const n=e.dom.create("summary");n.appendChild(Or().dom),t.prepend(n)}))}}))})(e)},SO=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,NO=e=>Pt.trim(e).replace(SO,Aa).toLowerCase(),RO=(e,t,n)=>{const o=fc(e);if(n||"all"===o||!gc(e))return t;const r=o?o.split(/[, ]/):[];if(r&&"none"!==o){const n=e.dom,o=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,((e,t,s,a)=>{const i=n.parseStyle(n.decode(s)),l={};for(let e=0;e<r.length;e++){const t=i[r[e]];let s=t,a=n.getStyle(o,r[e],!0);/color/.test(r[e])&&(s=NO(s),a=NO(a)),a!==s&&(l[r[e]]=t)}const d=n.serializeStyle(l,"span");return d?t+' style="'+d+'"'+a:t+a}))}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,((e,t,n,o)=>t+' style="'+n+'"'+o)),t},AO=e=>{const t=Za(!1),n=Za(bc(e)?"text":"html"),o=KT(e);(e=>{(Dt.browser.isChromium()||Dt.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",(n=>{n.content=t(e,n.content,n.internal)}))})(e,RO)})(e),bO(e,n),(e=>{const t=t=>n=>{t(e,n)},n=cc(e);E(n)&&e.on("PastePreProcess",t(n));const o=mc(e);E(o)&&e.on("PastePostProcess",t(o))})(e),e.on("PreInit",(()=>{xO(e),kO(e,t),hO(e,o,n)}))},DO=e=>{(e=>{e.on("click",(t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()}))})(e),(e=>{e.parser.addNodeFilter("details",(t=>{const n=Tc(e);K(t,(e=>{"expanded"===n?e.attr("open","open"):"collapsed"===n&&e.attr("open",null)}))})),e.serializer.addNodeFilter("details",(t=>{const n=Oc(e);K(t,(e=>{"expanded"===n?e.attr("open","open"):"collapsed"===n&&e.attr("open",null)}))}))})(e)},TO=ir,OO=tr,BO=e=>cr(e.dom),PO=e=>t=>En(yn.fromDom(e),t),LO=(e,t,n)=>Qn(yn.fromDom(e),(e=>(e=>dr(e.dom))(e)||n.isBlock(qt(e))),PO(t)).getOr(yn.fromDom(t)).dom,MO=(e,t)=>Qn(yn.fromDom(e),BO,PO(t)),IO=(e,t,n)=>{const o=new Ho(e,t),r=n?o.next.bind(o):o.prev.bind(o);let s=e;for(let t=n?e:r();t&&!TO(t);t=r())os(t)&&(s=t);return s},FO=e=>{const t=((e,t,n)=>{const o=rl.fromRangeStart(e).getNode(),r=LO(o,t,n),s=IO(o,r,!1),a=IO(o,r,!0),i=document.createRange();return MO(s,r).fold((()=>{OO(s)?i.setStart(s,0):i.setStartBefore(s)}),(e=>i.setStartBefore(e.dom))),MO(a,r).fold((()=>{OO(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(bv(t))};var UO;!function(e){e.Before="before",e.After="after"}(UO||(UO={}));const zO=(e,t)=>Math.abs(e.left-t),jO=(e,t)=>Math.abs(e.right-t),HO=(e,t)=>{const n=((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.top<t.bottom&&e.bottom>t.top)(e,t)&&n>.5},$O=(e,t)=>(e=>J(e,((e,t)=>e.fold((()=>U.some(t)),(e=>{const n=Math.min(t.left,e.left),o=Math.min(t.top,e.top),r=Math.max(t.right,e.right),s=Math.max(t.bottom,e.bottom);return U.some({top:o,right:r,bottom:s,left:n,width:r-n,height:s-o})}))),U.none()))(X(e,(e=>{return(n=t)>=(o=e).top&&n<=o.bottom;var n,o}))).fold((()=>[[],e]),(t=>{const{pass:n,fail:o}=G(e,(e=>HO(e,t)));return[n,o]})),qO=(e,t,n)=>t>e.left&&t<e.right?0:Math.min(Math.abs(e.left-t),Math.abs(e.right-t)),VO=(e,t,n,o)=>{const r=e=>os(e.node)?U.some(e):Vo(e.node)?VO(ue(e.node.childNodes),t,n,!1):U.none(),s=(e,s)=>{const a=le(e,((e,o)=>s(e,t,n)-s(o,t,n)));return fe(a,r).map((e=>o&&!tr(e.node)&&a.length>1?((e,o,s)=>r(o).filter((o=>Math.abs(s(e,t,n)-s(o,t,n))<2&&tr(o.node))))(e,a[1],s).getOr(e):e))},[a,i]=$O(Mk(e),n),{pass:l,fail:d}=G(i,(e=>e.top<n));return s(a,qO).orThunk((()=>s(d,Li))).orThunk((()=>s(l,Li)))},WO=(e,t,n)=>{const o=yn.fromDom(e),r=Sn(o),s=yn.fromPoint(r,t,n).filter((e=>_n(o,e))).getOr(o);return((e,t,n,o)=>{const r=(t,s)=>{const a=X(t.dom.childNodes,B((e=>Vo(e)&&e.classList.contains("mce-drag-container"))));return s.fold((()=>VO(a,n,o,!0)),(e=>{const t=X(a,(t=>t!==e.dom));return VO(t,n,o,!0)})).orThunk((()=>(En(t,e)?U.none():An(t)).bind((e=>r(e,U.some(t))))))};return r(t,U.none())})(o,s,t,n)},KO=(e,t,n)=>WO(e,t,n).filter((e=>Jc(e.node))).map((e=>((e,t)=>({node:e.node,position:zO(e,t)<jO(e,t)?UO.Before:UO.After}))(e,t))),YO=e=>{var t,n;const o=e.getBoundingClientRect(),r=e.ownerDocument,s=r.documentElement,a=r.defaultView;return{top:o.top+(null!==(t=null==a?void 0:a.scrollY)&&void 0!==t?t:0)-s.clientTop,left:o.left+(null!==(n=null==a?void 0:a.scrollX)&&void 0!==n?n:0)-s.clientLeft}},GO=(e,t)=>{return n=(e=>e.inline?YO(e.getBody()):{left:0,top:0})(e),o=(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 n=YO(e.getContentAreaContainer()),o=(e=>{const t=e.getBody(),n=e.getDoc().documentElement,o={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||n.scrollLeft,top:t.scrollTop||n.scrollTop};return e.inline?o:r})(e);return{left:t.pageX-n.left+o.left,top:t.pageY-n.top+o.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-n.left+o.left,pageY:r.top-n.top+o.top};var n,o,r},XO=e=>({target:e,srcElement:e}),QO=(e,t,n,o)=>{const r=((e,t)=>{const n=LT(e);return"dragstart"===t?(vT(n),ST(n)):"drop"===t?(yT(n),NT(n)):(CT(n),RT(n)),n})(n,e);return C(o)?((e,t,n)=>{const o=P("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:o,initEvent:o,preventDefault:S,stopImmediatePropagation:S,stopPropagation:S,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:o,initMouseEvent:o,getModifierState:o,dataTransfer:n,...XO(t)}})(e,t,r):((e,t,n,o)=>({...t,dataTransfer:o,type:e,...XO(n)}))(e,o,t,r)},JO=cr,ZO=((...e)=>t=>{for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1})(JO,dr),eB=(e,t,n,o)=>{const r=e.dom,s=t.cloneNode(!0);r.setStyles(s,{width:n,height:o}),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:n,height:o}),r.setStyles(s,{margin:0,boxSizing:"border-box"}),a.appendChild(s),a},tB=(e,t)=>n=>()=>{const o="left"===e?n.scrollX:n.scrollY;n.scroll({[e]:o+t,behavior:"smooth"})},nB=tB("left",-32),oB=tB("left",32),rB=tB("top",-32),sB=tB("top",32),aB=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},iB=(e,t)=>n=>{if((e=>0===e.button)(n)){const o=ee(t.dom.getParents(n.target),ZO).getOr(null);if(x(o)&&((e,t,n)=>JO(n)&&n!==t&&e.isEditable(n.parentElement))(t.dom,t.getBody(),o)){const r=t.dom.getPos(o),s=t.getBody(),a=t.getDoc().documentElement;e.set({element:o,dataTransfer:PT(),dragging:!1,screenX:n.screenX,screenY:n.screenY,maxX:(t.inline?s.scrollWidth:a.offsetWidth)-2,maxY:(t.inline?s.scrollHeight:a.offsetHeight)-2,relX:n.pageX-r.x,relY:n.pageY-r.y,width:o.offsetWidth,height:o.offsetHeight,ghost:eB(t,o,o.offsetWidth,o.offsetHeight),intervalId:si(100)})}}},lB=(e,t,n,o,r)=>{"dragstart"===t&&MT(o,e.dom.getOuterHTML(n));const s=QO(t,n,o,r);return e.dispatch(t,s)},dB=(e,t)=>{const n=ii(((e,n)=>((e,t,n)=>{e._selectionOverrides.hideFakeCaret(),KO(e.getBody(),t,n).fold((()=>e.selection.placeCaretAt(t,n)),(o=>{const r=e._selectionOverrides.showCaret(1,o.node,o.position===UO.Before,!1);r?e.selection.setRng(r):e.selection.placeCaretAt(t,n)}))})(t,e,n)),0);t.on("remove",n.cancel);const o=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 n=lB(t,"dragstart",e.element,e.dataTransfer,r);if(x(n.dataTransfer)&&(e.dataTransfer=n.dataTransfer),n.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,GO(t,r));a=e.ghost,i=t.getBody(),a.parentNode!==i&&i.appendChild(a),((e,t,n,o,r,s,a,i,l,d,c,m)=>{let u=0,f=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+n>r&&(u=t.pageX+n-r),t.pageY+o>s&&(f=t.pageY+o-s),e.style.width=n-u+"px",e.style.height=o-f+"px";const g=l.clientHeight,p=l.clientWidth,h=a+l.getBoundingClientRect().top,b=i+l.getBoundingClientRect().left;c.on((e=>{e.intervalId.clear(),e.dragging&&m&&(a+8>=g?e.intervalId.set(sB(d)):a-8<=0?e.intervalId.set(rB(d)):i+8>=p?e.intervalId.set(oB(d)):i-8<=0?e.intervalId.set(nB(d)):h+16>=window.innerHeight?e.intervalId.set(sB(window)):h-16<=0?e.intervalId.set(rB(window)):b+16>=window.innerWidth?e.intervalId.set(oB(window)):b-16<=0&&e.intervalId.set(nB(window)))}))})(e.ghost,l,e.width,e.height,e.maxX,e.maxY,r.clientY,r.clientX,t.getContentAreaContainer(),t.getWin(),o,s),n.throttle(r.clientX,r.clientY)}var a,i}))},cB=(e,t)=>n=>{e.on((e=>{var o;if(e.intervalId.clear(),e.dragging){if(((e,t,n)=>!w(t)&&t!==n&&!e.dom.isChildOf(t,n)&&e.dom.isEditable(t))(t,(e=>{const t=e.getSel();if(x(t)){const e=t.getRangeAt(0).startContainer;return tr(e)?e.parentNode:e}return null})(t.selection),e.element)){const r=null!==(o=t.getDoc().elementFromPoint(n.clientX,n.clientY))&&void 0!==o?o:t.getBody();lB(t,"drop",r,e.dataTransfer,n).isDefaultPrevented()||t.undoManager.transact((()=>{((e,t)=>{const n=e.getParent(t.parentNode,e.isBlock);aB(t),n&&n!==e.getRoot()&&e.isEmpty(n)&&Br(yn.fromDom(n))})(t.dom,e.element),(e=>{const t=e.getData("text/html");return""===t?U.none():U.some(t)})(e.dataTransfer).each((e=>t.insertContent(e))),t._selectionOverrides.hideFakeCaret()}))}lB(t,"dragend",t.getBody(),e.dataTransfer,n)}})),uB(e)},mB=(e,t,n)=>{e.on((e=>{e.intervalId.clear(),e.dragging&&n.fold((()=>lB(t,"dragend",e.element,e.dataTransfer)),(n=>lB(t,"dragend",e.element,e.dataTransfer,n)))})),uB(e)},uB=e=>{e.on((e=>{e.intervalId.clear(),aB(e.ghost)})),e.clear()},fB=e=>{const t=ai(),n=Xa.DOM,o=document,r=iB(t,e),s=dB(t,e),a=cB(t,e),i=((e,t)=>n=>mB(e,t,U.some(n)))(t,e);e.on("mousedown",r),e.on("mousemove",s),e.on("mouseup",a),n.bind(o,"mousemove",s),n.bind(o,"mouseup",i),e.on("remove",(()=>{n.unbind(o,"mousemove",s),n.unbind(o,"mouseup",i)})),e.on("keydown",(n=>{n.keyCode===Df.ESC&&mB(t,e,U.none())}))},gB=e=>{fB(e),Qd(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const n=t.dataTransfer;n&&(q(n.types,"Files")||n.files.length>0)&&(t.preventDefault(),"drop"===t.type&&wE(e,"Dropped file type is not supported"))}},n=n=>{Zg(e,n.target)&&t(n)},o=()=>{const o=Xa.DOM,r=e.dom,s=document,a=e.inline?e.getBody():e.getDoc(),i=["drop","dragover"];K(i,(e=>{o.bind(s,e,n),r.bind(a,e,t)})),e.on("remove",(()=>{K(i,(e=>{o.unbind(s,e,n),r.unbind(a,e,t)}))}))};e.on("init",(()=>{Yg.setEditorTimeout(e,o,0)}))})(e)},pB=cr,hB=(e,t)=>tv(e.getBody(),t),bB=e=>{const t=e.selection,n=e.dom,o=e.getBody(),r=Gc(e,o,n.isBlock,(()=>ip(e))),s="sel-"+n.uniqueId(),a="data-mce-selected";let i;const l=e=>e!==o&&(pB(e)||fr(e))&&n.isChildOf(e,o)&&n.isEditable(e.parentNode),d=(n,o,s,a=!0)=>e.dispatch("ShowCaret",{target:o,direction:n,before:s}).isDefaultPrevented()?null:(a&&t.scrollIntoView(o,-1===n),r.show(s,o)),c=()=>{e.on("click",(t=>{n.isEditable(t.target)||(t.preventDefault(),e.focus())})),e.on("blur NewBlock",h),e.on("ResizeWindow FullscreenStateChanged",r.reposition),e.on("tap",(t=>{const n=t.target,o=hB(e,n);pB(o)?(t.preventDefault(),C_(e,o).each(p)):l(n)&&C_(e,n).each(p)}),!0),e.on("mousedown",(r=>{const s=r.target;if(s!==o&&"HTML"!==s.nodeName&&!n.isChildOf(s,o))return;if(!gE(e,r.clientX,r.clientY))return;h(),b();const a=hB(e,s);pB(a)?(r.preventDefault(),C_(e,a).each(p)):KO(o,r.clientX,r.clientY).each((n=>{r.preventDefault(),(e=>{e&&t.setRng(e)})(d(1,n.node,n.position===UO.Before,!1)),Wo(a)?a.focus():e.getBody().focus()}))})),e.on("keypress",(e=>{Df.modifierPressed(e)||pB(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=f(e.range);const t=p(e.range,e.forward);t&&(e.range=t)})),e.on("AfterSetSelectionRange",(e=>{const t=e.range,o=t.startContainer.parentElement;var r;u(t)||Vo(r=o)&&"mcepastebin"===r.id||b(),(e=>x(e)&&n.hasClass(e,"mce-offscreen-selection"))(o)||h()})),gB(e),(e=>{const t=ii((()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const n=w_(e,t,!1);e.selection.setRng(n)}}}),0);e.on("focus",(()=>{t.throttle()})),e.on("blur",(()=>{t.cancel()}))})(e),(e=>{e.on("init",(()=>{e.on("focusin",(t=>{const n=t.target;if(fr(n)){const t=tv(e.getBody(),n),o=cr(t)?t:n;e.selection.getNode()!==o&&C_(e,o).each((t=>e.selection.setRng(t)))}}))}))})(e)},m=e=>jr(e)||Vr(e)||Wr(e),u=e=>m(e.startContainer)||m(e.endContainer),f=t=>{const o=e.schema.getVoidElements(),r=n.createRng(),s=t.startContainer,a=t.startOffset,i=t.endContainer,l=t.endOffset;return ke(o,s.nodeName.toLowerCase())?0===a?r.setStartBefore(s):r.setStartAfter(s):r.setStart(s,a),ke(o,i.nodeName.toLowerCase())?0===l?r.setEndBefore(i):r.setEndAfter(i):r.setEnd(i,l),r},g=o=>{const r=o.cloneNode(!0),l=e.dispatch("ObjectSelected",{target:o,targetClone:r});if(l.isDefaultPrevented())return null;const d=((o,r)=>{const a=yn.fromDom(e.getBody()),i=e.getDoc(),l=to(a,"#"+s).getOrThunk((()=>{const e=yn.fromHtml('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>',i);return en(e,"id",s),vo(a,e),e})),d=n.createRng();wo(l),Co(l,[yn.fromText(vr,i),yn.fromDom(r),yn.fromText(vr,i)]),d.setStart(l.dom.firstChild,1),d.setEnd(l.dom.lastChild,0),lo(l,{top:n.getPos(o,e.getBody()).y+"px"}),Lg(l);const c=t.getSel();return c&&(c.removeAllRanges(),c.addRange(d)),d})(o,l.targetClone),c=yn.fromDom(o);return K(zo(yn.fromDom(e.getBody()),`*[${a}]`),(e=>{En(c,e)||sn(e,a)})),n.getAttrib(o,a)||o.setAttribute(a,"1"),i=o,b(),d},p=(e,t)=>{if(!e)return null;if(e.collapsed){if(!u(e)){const r=t?1:-1,s=xm(r,o,e),a=s.getNode(!t);if(x(a)){if(Jc(a))return d(r,a,!!t&&!s.isAtEnd(),!1);if(zr(a)&&cr(a.nextSibling)){const e=n.createRng();return e.setStart(a,0),e.setEnd(a,0),e}}const i=s.getNode(t);if(x(i)){if(Jc(i))return d(r,i,!t&&!s.isAtEnd(),!1);if(zr(i)&&cr(i.previousSibling)){const e=n.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&&pB(r.parentNode)&&(r=r.parentNode,s=n.nodeIndex(r),r=r.parentNode),!Vo(r))return null;if(a===s+1&&r===e.endContainer){const e=r.childNodes[s];if(l(e))return g(e)}return null},h=()=>{i&&i.removeAttribute(a),to(yn.fromDom(e.getBody()),"#"+s).each(xo),i=null},b=()=>{r.hide()};return _x(e)||c(),{showCaret:d,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(Kr(e),t.scrollIntoView(e))},hideFakeCaret:b,destroy:()=>{r.destroy(),i=null}}},vB=(e,t)=>{let n=t;for(let t=e.previousSibling;tr(t);t=t.previousSibling)n+=t.data.length;return n},yB=(e,t,n,o,r)=>{if(tr(n)&&(o<0||o>n.data.length))return[];const s=r&&tr(n)?[vB(n,o)]:[o];let a=n;for(;a!==t&&a.parentNode;)s.push(e.nodeIndex(a,r)),a=a.parentNode;return a===t?s.reverse():[]},CB=(e,t,n,o,r,s,a=!1)=>({start:yB(e,t,n,o,a),end:yB(e,t,r,s,a)}),wB=(e,t)=>{const n=t.slice(),o=n.pop();return _(o)?J(n,((e,t)=>e.bind((e=>U.from(e.childNodes[t])))),U.some(e)).bind((e=>tr(e)&&(o<0||o>e.data.length)?U.none():U.some({node:e,offset:o}))):U.none()},xB=(e,t)=>wB(e,t.start).bind((({node:n,offset:o})=>wB(e,t.end).map((({node:e,offset:t})=>{const r=document.createRange();return r.setStart(n,o),r.setEnd(e,t),r})))),EB=(e,t,n)=>{if(t&&e.isEmpty(t)&&!n(t)){const o=t.parentNode;e.remove(t,tr(t.firstChild)&&is(t.firstChild.data)),EB(e,o,n)}},_B=(e,t,n,o=!0)=>{const r=t.startContainer.parentNode,s=t.endContainer.parentNode;t.deleteContents(),o&&!n(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),EB(e,r,n),r!==s&&EB(e,s,n))},kB=(e,t)=>U.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),SB=(e,t,n)=>{const o=e.dynamicPatternsLookup({text:n,block:t});return{...e,blockPatterns:Pl(o).concat(e.blockPatterns),inlinePatterns:Ll(o).concat(e.inlinePatterns)}},NB=(e,t,n,o)=>{const r=e.createRng();return r.setStart(t,0),r.setEnd(n,o),r.toString()},RB=(e,t,n)=>{const o=((e,t,n)=>{if(tr(e)&&t>=e.length)return U.some(XN(e,t));{const o=Ri(QN);return U.from(o.forwards(e,t,JN(e),n)).map((e=>XN(e.container,0)))}})(t,0,t);o.each((o=>{const r=o.container;tR(r,n.start.length,t).each((n=>{const o=e.createRng();o.setStart(r,0),o.setEnd(n.container,n.offset),_B(e,o,(e=>e===t))}));const s=yn.fromDom(r),a=wr(s);/^\s[^\s]/.test(a)&&((e,t)=>{Cr.set(e,t)})(s,a.slice(1))}))},AB=(e,t)=>{const n=e.dom,o=t.pattern,r=xB(n.getRoot(),t.range).getOrDie("Unable to resolve path range");return kB(e,r).each((t=>{"block-format"===o.type?((e,t)=>{const n=t.get(e);return b(n)&&ce(n).exists((e=>ke(e,"block")))})(o.format,e.formatter)&&e.undoManager.transact((()=>{RB(e.dom,t,o),e.formatter.apply(o.format)})):"block-command"===o.type&&e.undoManager.transact((()=>{RB(e.dom,t,o),e.execCommand(o.cmd,!1,o.value)}))})),!0},DB=(e,t)=>{const n=(e=>le(e,((e,t)=>t.start.length-e.start.length)))(e),o=t.replace(vr," ");return ee(n,(e=>0===t.indexOf(e.start)||0===o.indexOf(e.start)))},TB=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),OB=(e,t)=>{const n=e.createRng();return n.setStartAfter(t.start),n.setEndBefore(t.end),n},BB=(e,t,n)=>{const o=xB(e.getRoot(),n).getOrDie("Unable to resolve path range"),r=o.startContainer,s=o.endContainer,a=0===o.endOffset?s:s.splitText(o.endOffset),i=0===o.startOffset?r:r.splitText(o.startOffset),l=i.parentNode;return{prefix:t,end:a.parentNode.insertBefore(TB(e,t+"-end"),a),start:l.insertBefore(TB(e,t+"-start"),i)}},PB=(e,t,n)=>{EB(e,e.get(t.prefix+"-end"),n),EB(e,e.get(t.prefix+"-start"),n)},LB=e=>0===e.start.length,MB=(e,t,n,o)=>{const r=t.start;var s;return nR(e,o.container,o.offset,(s=r,(e,t)=>{const n=e.data.substring(0,t),o=n.lastIndexOf(s.charAt(s.length-1)),r=n.lastIndexOf(s);return-1!==r?r+s.length:-1!==o?o+1:-1}),n).bind((o=>{var s,a;const i=null!==(a=null===(s=n.textContent)||void 0===s?void 0:s.indexOf(r))&&void 0!==a?a:-1;if(-1!==i&&o.offset>=i+r.length){const t=e.createRng();return t.setStart(o.container,o.offset-r.length),t.setEnd(o.container,o.offset),U.some(t)}{const s=o.offset-r.length;return eR(o.container,s,n).map((t=>{const n=e.createRng();return n.setStart(t.container,t.offset),n.setEnd(o.container,o.offset),n})).filter((e=>e.toString()===r)).orThunk((()=>MB(e,t,n,XN(o.container,0))))}}))},IB=(e,t,n,o)=>{const r=e.dom,s=r.getRoot(),a=n.pattern,i=n.position.container,l=n.position.offset;return eR(i,l-n.pattern.end.length,t).bind((d=>{const c=CB(r,s,d.container,d.offset,i,l,o);if(LB(a))return U.some({matches:[{pattern:a,startRng:c,endRng:c}],position:d});{const i=FB(e,n.remainingPatterns,d.container,d.offset,t,o),l=i.getOr({matches:[],position:d}),m=l.position,u=((e,t,n,o,r,s=!1)=>{if(0===t.start.length&&!s){const t=e.createRng();return t.setStart(n,o),t.setEnd(n,o),U.some(t)}return ZN(n,o,r).bind((n=>MB(e,t,r,n).bind((e=>{var t;if(s){if(e.endContainer===n.container&&e.endOffset===n.offset)return U.none();if(0===n.offset&&(null===(t=e.endContainer.textContent)||void 0===t?void 0:t.length)===e.endOffset)return U.none()}return U.some(e)}))))})(r,a,m.container,m.offset,t,i.isNone());return u.map((e=>{const t=((e,t,n,o=!1)=>CB(e,t,n.startContainer,n.startOffset,n.endContainer,n.endOffset,o))(r,s,e,o);return{matches:l.matches.concat([{pattern:a,startRng:t,endRng:c}]),position:XN(e.startContainer,e.startOffset)}}))}}))},FB=(e,t,n,o,r,s)=>{const a=e.dom;return ZN(n,o,a.getRoot()).bind((i=>{const l=NB(a,r,n,o);for(let a=0;a<t.length;a++){const d=t[a];if(!Ve(l,d.end))continue;const c=t.slice();c.splice(a,1);const m=IB(e,r,{pattern:d,remainingPatterns:c,position:i},s);if(m.isNone()&&o>0)return FB(e,t,n,o-1,r,s);if(m.isSome())return m}return U.none()}))},UB=(e,t,n)=>{e.selection.setRng(n),"inline-format"===t.type?K(t.format,(t=>{e.formatter.apply(t)})):e.execCommand(t.cmd,!1,t.value)},zB=(e,t,n,o,r,s)=>{var a;return((e,t)=>{const n=re(e,(e=>V(t,(t=>e.pattern.start===t.pattern.start&&e.pattern.end===t.pattern.end))));return e.length===t.length?n?e:t:e.length>t.length?e:t})(FB(e,r.inlinePatterns,n,o,t,s).fold((()=>[]),(e=>e.matches)),FB(e,(a=r.inlinePatterns,le(a,((e,t)=>t.end.length-e.end.length))),n,o,t,s).fold((()=>[]),(e=>e.matches)))},jB=(e,t)=>{if(0===t.length)return;const n=e.dom,o=e.selection.getBookmark(),r=((e,t)=>{const n=xi("mce_textpattern"),o=Q(t,((t,o)=>{const r=BB(e,n+`_end${t.length}`,o.endRng);return t.concat([{...o,endMarker:r}])}),[]);return Q(o,((t,r)=>{const s=o.length-t.length-1,a=LB(r.pattern)?r.endMarker:BB(e,n+`_start${s}`,r.startRng);return t.concat([{...r,startMarker:a}])}),[])})(n,t);K(r,(t=>{const o=n.getParent(t.startMarker.start,n.isBlock),r=e=>e===o;LB(t.pattern)?((e,t,n,o)=>{const r=OB(e.dom,n);_B(e.dom,r,o),UB(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,n,o,r)=>{const s=e.dom,a=OB(s,o),i=OB(s,n);_B(s,i,r),_B(s,a,r);const l={prefix:n.prefix,start:n.end,end:o.start},d=OB(s,l);UB(e,t,d)})(e,t.pattern,t.startMarker,t.endMarker,r),PB(n,t.endMarker,r),PB(n,t.startMarker,r)})),e.selection.moveToBookmark(o)},HB=(e,t)=>{const n=e.selection.getRng();return kB(e,n).map((o=>{var r;const s=Math.max(0,n.startOffset),a=SB(t,o,null!==(r=o.textContent)&&void 0!==r?r:""),i=zB(e,o,n.startContainer,s,a,!0),l=((e,t,n,o)=>{var r;const s=e.dom,a=Ql(e);if(!s.is(t,a))return[];const i=null!==(r=t.textContent)&&void 0!==r?r:"";return DB(n.blockPatterns,i).map((e=>Pt.trim(i).length===e.start.length?[]:[{pattern:e,range:CB(s,s.getRoot(),t,0,t,0,o)}])).getOr([])})(e,o,a,!0);return(l.length>0||i.length>0)&&(e.undoManager.add(),e.undoManager.extra((()=>{e.execCommand("mceInsertNewLine")}),(()=>{(e=>{e.insertContent(Pr,{preserve_zwsp:!0})})(e),jB(e,i),((e,t)=>{if(0===t.length)return;const n=e.selection.getBookmark();K(t,(t=>AB(e,t))),e.selection.moveToBookmark(n)})(e,l);const t=e.selection.getRng(),n=ZN(t.startContainer,t.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),n.each((t=>{const n=t.container;n.data.charAt(t.offset-1)===br&&(n.deleteData(t.offset-1,1),EB(e.dom,n.parentNode,(t=>t===e.dom.getRoot())))}))})),!0)})).getOr(!1)},$B=(e,t,n)=>{for(let o=0;o<e.length;o++)if(n(e[o],t))return!0;return!1},qB=e=>{const t=[",",".",";",":","!","?"],n=[32],o=()=>{return t=Cc(e),n=wc(e),{inlinePatterns:Ll(t),blockPatterns:Pl(t),dynamicPatternsLookup:n};var t,n},r=()=>(e=>e.options.isSet("text_patterns_lookup"))(e);e.on("keydown",(t=>{if(13===t.keyCode&&!Df.modifierPressed(t)&&e.selection.isCollapsed()){const n=o();(n.inlinePatterns.length>0||n.blockPatterns.length>0||r())&&HB(e,n)&&t.preventDefault()}}),!0);const s=()=>{if(e.selection.isCollapsed()){const t=o();(t.inlinePatterns.length>0||r())&&((e,t)=>{const n=e.selection.getRng();kB(e,n).map((o=>{const r=Math.max(0,n.startOffset-1),s=NB(e.dom,o,n.startContainer,r),a=SB(t,o,s),i=zB(e,o,n.startContainer,r,a,!1);i.length>0&&e.undoManager.transact((()=>{jB(e,i)}))}))})(e,t)}};e.on("keyup",(e=>{$B(n,e,((e,t)=>e===t.keyCode&&!Df.modifierPressed(t)))&&s()})),e.on("keypress",(n=>{$B(t,n,((e,t)=>e.charCodeAt(0)===t.charCode))&&Yg.setEditorTimeout(e,s)}))},VB=e=>{const t=Pt.each,n=Df.BACKSPACE,o=Df.DELETE,r=e.dom,s=e.selection,a=e.parser,i=Dt.browser,l=i.isFirefox(),d=i.isChromium()||i.isSafari(),c=Dt.deviceType.isiPhone()||Dt.deviceType.isiPad(),m=Dt.os.isMacOS()||Dt.os.isiOS(),u=(t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},f=e=>e.isDefaultPrevented(),p=()=>{const t=e=>{const t=r.create("body"),n=e.cloneContents();return t.appendChild(n),s.serializer.serialize(t,{format:"html"})};e.on("keydown",(s=>{const a=s.keyCode;if(!f(s)&&(a===o||a===n)&&e.selection.isEditable()){const n=e.selection.isCollapsed(),o=e.getBody();if(n&&!ys(yn.fromDom(o)))return;if(!n&&!(n=>{const o=t(n),s=r.createRng();return s.selectNode(e.getBody()),o===t(s)})(e.selection.getRng()))return;s.preventDefault(),e.setContent(""),o.firstChild&&r.isBlock(o.firstChild)?e.selection.setCursorLocation(o.firstChild,0):e.selection.setCursorLocation(o,0),e.nodeChanged()}}))},h=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},b=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",(t=>{let n;if(t.target===e.getDoc().documentElement)if(n=s.getRng(),e.getBody().focus(),"mousedown"===t.type){if(jr(n.startContainer))return;s.placeCaretAt(t.clientX,t.clientY)}else s.setRng(n)}))},v=()=>{Range.prototype.getClientRects||e.on("mousedown",(t=>{if(!f(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),Yg.setEditorTimeout(e,(()=>{t.focus()}))}}))},y=()=>{const t=ec(e);e.on("click",(n=>{const o=n.target;/^(IMG|HR)$/.test(o.nodeName)&&r.isEditable(o)&&(n.preventDefault(),e.selection.select(o),e.nodeChanged()),"A"===o.nodeName&&r.hasClass(o,t)&&0===o.childNodes.length&&r.isEditable(o.parentNode)&&(n.preventDefault(),s.select(o))}))},C=()=>{e.on("keydown",(e=>{if(!f(e)&&e.keyCode===n&&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),_d(e)||u("enableObjectResizing",!1)};Wd(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 n=e.parentNode;const o=r.getRoot();if((null==n?void 0:n.lastChild)===e){for(;n&&!r.isBlock(n);){if((null===(t=n.parentNode)||void 0===t?void 0:t.lastChild)!==n||n===o)return;n=n.parentNode}r.add(n,"br",{"data-mce-bogus":1})}}))}))},E=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},_=()=>{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 n;"HTML"===t.target.nodeName&&(n=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(n),e.selection.normalize(),e.nodeChanged())})))},N=()=>{m&&e.on("keydown",(t=>{!Df.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}))},R=()=>{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}")},A=()=>{e.on("init",(()=>{e.dom.bind(e.getBody(),"submit",(e=>{e.preventDefault()}))}))},D=S,T=()=>{e.on("keydown",(t=>{if(f(t)||t.keyCode!==Df.BACKSPACE)return;let n=s.getRng();const o=n.startContainer,a=n.startOffset,i=r.getRoot();let l=o;if(n.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),n=r.createRng(),n.setStart(o,0),n.setEnd(o,0),s.setRng(n))}})),p(),Dt.windowsPhone||e.on("keyup focusin mouseup",(t=>{Df.modifierPressed(t)||(e=>{const t=e.getBody(),n=e.selection.getRng();return n.startContainer===n.endContainer&&n.startContainer===t&&0===n.startOffset&&n.endOffset===t.childNodes.length})(e)||s.normalize()}),!0),d&&(b(),y(),e.on("init",(()=>{u("DefaultParagraphSeparator",Ql(e))})),A(),C(),a.addNodeFilter("br",(e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()})),c?(_(),k(),R()):h()),l&&(e.on("keydown",(t=>{if(!f(t)&&t.keyCode===n){if(!e.getBody().getElementsByTagName("hr").length)return;if(s.isCollapsed()&&0===s.getRng().startOffset){const e=s.getNode(),n=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(r.remove(n),t.preventDefault())}}})),v(),(()=>{const n=()=>{const n=r.getAttribs(s.getStart().cloneNode(!1));return()=>{const o=s.getStart();o!==e.getBody()&&(r.setAttrib(o,"style",null),t(n,(e=>{o.setAttributeNode(e.cloneNode(!0))})))}},o=()=>!s.isCollapsed()&&r.getParent(s.getStart(),r.isBlock)!==r.getParent(s.getEnd(),r.isBlock);e.on("keypress",(t=>{let r;return!(!(f(t)||8!==t.keyCode&&46!==t.keyCode)&&o()&&(r=n(),e.getDoc().execCommand("delete",!1),r(),t.preventDefault(),1))})),r.bind(e.getDoc(),"cut",(t=>{if(!f(t)&&o()){const t=n();Yg.setEditorTimeout(e,(()=>{t()}))}}))})(),w(),x(),E(),N(),C(),e.on("drop",(t=>{var n;const o=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/html");g(o)&&/^<img[^>]*>$/.test(o)&&e.dispatch("dragend",new window.DragEvent("dragend",t))})))};return _x(e)?(d&&(b(),y(),A(),h(),c&&(_(),k(),R())),l&&(v(),w(),E(),N())):T(),{refreshContentEditable:D,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},WB=Xa.DOM,KB=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,YB=e=>we(e,(e=>!1===C(e))),GB=e=>{const t=e.options.get,n=e.editorUpload.blobCache;return YB({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:KB(e),sandbox_iframes:t("sandbox_iframes"),sanitize:t("xss_sanitization"),validate:!0,blob_cache:n,document:e.getDoc()})},XB=e=>{const t=e.options.get;return YB({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")})},QB=e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||ku(e)&&e.selection.getStart(!0)!==t||Ym(t).each((t=>{const n=t.getNode(),o=Jo(n)?Ym(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e),e.nodeChanged({initial:!0});const t=oc(e);E(t)&&t.call(e,e),(e=>{const t=sc(e);t&&Yg.setEditorTimeout(e,(()=>{let n;n=!0===t?e:e.editorManager.get(t),n&&!n.destroyed&&(n.focus(),n.selection.scrollIntoView())}),100)})(e)},JB=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,ZB=e=>{const t=JB(e),n=wd(e),o=e.contentCSS,r=()=>{t.unloadAll(o),e.inline||e.ui.styleSheetLoader.unloadAll(n)},s=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";Pt.each(e.contentStyles,(e=>{t+=e+"\r\n"})),e.dom.addStyle(t)}const a=Promise.all(((e,t,n)=>{const{pass:o,fail:r}=G(t,(e=>tinymce.Resource.has(kE(e)))),s=o.map((t=>{const n=tinymce.Resource.get(kE(t));return g(n)?Promise.resolve(JB(e).loadRawCss(t,n)):Promise.resolve()})),a=[...s,JB(e).loadAll(r)];return e.inline?a:a.concat([e.ui.styleSheetLoader.loadAll(n)])})(e,o,n)).then(s).catch(s),i=Cd(e);return i&&((e,t)=>{const n=yn.fromDom(e.getBody()),o=qn($n(n)),r=yn.fromTag("style");en(r,"type","text/css"),vo(r,yn.fromText(t)),vo(o,r),e.on("remove",(()=>{xo(r)}))})(e,i),a},eP=e=>{!0!==e.removed&&((e=>{_x(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),QB(e))},tP=e=>{const t=e.getElement();let n=e.getDoc();e.inline&&(WB.addClass(t,"mce-content-body"),e.contentDocument=n=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const o=e.getBody();o.disabled=!0,e.readonly=Wd(e),e._editableRoot=Kd(e),!e.readonly&&e.hasEditableRoot()&&(e.inline&&"static"===WB.getStyle(o,"position",!0)&&(o.style.position="relative"),o.contentEditable="true"),o.disabled=!1,e.editorUpload=ME(e),e.schema=ya(XB(e)),e.dom=Xa(n,{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:fd(e),referrerPolicy:gd(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)},force_hex_color:Bc(e)}),e.parser=(e=>{const t=Uw(GB(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",((t,n)=>{const o=e.dom,r="data-mce-"+n;let s=t.length;for(;s--;){const a=t[s];let i=a.attr(n);if(i&&!a.attr(r)){if(0===i.indexOf("data:")||0===i.indexOf("blob:"))continue;"style"===n?(i=o.serializeStyle(o.parseStyle(i),a.name),i.length||(i=null),a.attr(r,i),a.attr(n,i)):"tabindex"===n?(a.attr(r,i),a.attr(n,null)):a.attr(r,e.convertURL(i,n,a.name))}}})),t.addNodeFilter("script",(e=>{let t=e.length;for(;t--;){const n=e[t],o=n.attr("type")||"no/type";0!==o.indexOf("mce-")&&n.attr("type","mce-"+o)}})),kc(e)&&t.addNodeFilter("#cdata",(t=>{var n;let o=t.length;for(;o--;){const r=t[o];r.type=8,r.name="#comment",r.value="[CDATA["+e.dom.encode(null!==(n=r.value)&&void 0!==n?n:"")+"]]"}})),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",(t=>{let n=t.length;const o=e.schema.getNonEmptyElements();for(;n--;){const e=t[n];e.isEmpty(o)&&0===e.getAll("br").length&&e.append(new Np("br",1))}})),t})(e),e.serializer=jx((e=>{const t=e.options.get;return{...GB(e),...XB(e),...YB({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=Mx(e.dom,e.getWin(),e.serializer,e),e.annotator=wf(e),e.formatter=YE(e),e.undoManager=XE(e),e._nodeChangeDispatcher=new gT(e),e._selectionOverrides=bB(e),zS(e),DO(e),XS(e),_x(e)||((e=>{e.on("mousedown",(t=>{t.detail>=3&&(t.preventDefault(),FO(e))}))})(e),(e=>{qB(e)})(e));const r=fT(e);FS(e,r),(e=>{e.on("NodeChange",O(VS,e))})(e),t_(e),AO(e);const s=kx(e);(e=>{const t=e.getDoc(),n=e.getBody();(e=>{e.dispatch("PreInit")})(e),ac(e)||(t.body.spellcheck=!1,WB.setAttrib(n,"spellcheck","false")),e.quirks=VB(e),(e=>{e.dispatch("PostRender")})(e);const o=xd(e);void 0!==o&&(n.dir=o);const r=ic(e);r&&e.on("BeforeSetContent",(e=>{Pt.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 n=setTimeout((()=>{t||e.setProgressState(!0)}),500);return()=>{clearTimeout(n),t=!0,e.setProgressState(!1)}})(e);ZB(e).then((()=>{eP(e),t()}))}),(t=>{e.setProgressState(!0),ZB(e).then((()=>{t().then((t=>{e.setProgressState(!1),eP(e),Rx(e)}),(t=>{e.notificationManager.open({type:"error",text:String(t)}),eP(e),Rx(e)}))}))}))},nP=F,oP=Xa.DOM,rP=(e,t)=>{const n=e.translate("Rich Text Area"),o=on(yn.fromDom(e.getElement()),"tabindex").bind(Je),r=((e,t,n,o)=>{const r=yn.fromTag("iframe");return o.each((e=>en(r,"tabindex",e))),tn(r,n),tn(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),fn(r,"tox-edit-area__iframe"),r})(e.id,n,ql(e),o).dom;r.onload=()=>{r.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=r,e.iframeHTML=(e=>{let t=Vl(e)+"<html><head>";Wl(e)!==e.documentBaseUrl&&(t+='<base href="'+e.documentBaseURI.getURI()+'" />'),t+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const n=Kl(e),o=Yl(e),r=e.translate(tc(e));return Gl(e)&&(t+='<meta http-equiv="Content-Security-Policy" content="'+Gl(e)+'" />'),t+=`</head><body id="${n}" class="mce-content-body ${o}" data-id="${e.id}" aria-label="${r}"><br></body></html>`,t})(e),oP.add(t.iframeContainer,r)},sP=e=>{const t=e.iframeElement,n=()=>{e.contentDocument=t.contentDocument,tP(e)};if(Rc(e)||Dt.browser.isFirefox()){const t=e.getDoc();t.open(),t.write(e.iframeHTML),t.close(),n()}else{const r=(o=yn.fromDom(t),Ro(o,"load",nP,(()=>{r.unbind(),n()})));t.srcdoc=e.iframeHTML}var o},aP=Xa.DOM,iP=(e,t,n)=>{const o=bE.get(n),r=bE.urls[n]||e.documentBaseUrl.replace(/\/$/,"");if(n=Pt.trim(n),o&&-1===Pt.inArray(t,n)){if(e.plugins[n])return;try{const s=o(e,r)||{};e.plugins[n]=s,E(s.init)&&(s.init(e,r),t.push(n))}catch(t){((e,t,n)=>{const o=oi.translate(["Failed to initialize plugin: {0}",t]);_f(e,"PluginLoadError",{message:o}),_E(o,n),wE(e,o)})(e,n,t)}}},lP=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),dP=e=>{const t=e.getElement();return e.inline?lP(null):(e=>{const t=aP.create("div");return aP.insertAfter(t,e),lP(t,t)})(t)},cP=e=>{const t=e.getElement();return e.orgDisplay=t.style.display,g(Ad(e))?(e=>{const t=e.theme.renderUI;return t?t():dP(e)})(e):E(Ad(e))?(e=>{const t=e.getElement(),n=Ad(e)(e,t);return n.editorContainer.nodeType&&(n.editorContainer.id=n.editorContainer.id||e.id+"_parent"),n.iframeContainer&&n.iframeContainer.nodeType&&(n.iframeContainer.id=n.iframeContainer.id||e.id+"_iframecontainer"),n.height=n.iframeHeight?n.iframeHeight:t.offsetHeight,n})(e):dP(e)},mP=async e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=Pt.trim(id(e)),n=e.ui.registry.getAll().icons,o={...aE.get("default").icons,...aE.get(t).icons};he(o,((t,o)=>{ke(n,o)||e.ui.registry.addIcon(o,t)}))})(e),(e=>{const t=Ad(e);if(g(t)){const n=vE.get(t);e.theme=n(e,vE.urls[t])||{},E(e.theme.init)&&e.theme.init(e,vE.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=Td(e),n=iE.get(t);e.model=n(e,iE.urls[t])})(e),(e=>{const t=[];K(Gd(e),(n=>{iP(e,t,(e=>e.replace(/^\-/,""))(n))}))})(e);const t=await cP(e);((e,t)=>{const n={show:U.from(t.show).getOr(S),hide:U.from(t.hide).getOr(S),isEnabled:U.from(t.isEnabled).getOr(F),setEnabled:n=>{e.mode.isReadOnly()||U.from(t.setEnabled).each((e=>e(n)))}};e.ui={...e.ui,...n}})(e,U.from(t.api).getOr({})),e.editorContainer=t.editorContainer,NE(e),e.inline?tP(e):((e,t)=>{rP(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=oP.isHidden(t.editorContainer)),e.getElement().style.display="none",oP.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,sP(e)})(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},uP=Xa.DOM,fP=e=>"-"===e.charAt(0),gP=(e,t)=>{const n=pd(t),o=hd(t);if(!oi.hasCode(n)&&"en"!==n){const r=Xe(o)?o:`${t.editorManager.baseURL}/langs/${n}.js`;e.add(r).catch((()=>{((e,t,n)=>{xE(e,"LanguageLoadError",EE("language",t,n))})(t,r,n)}))}},pP=(e,t)=>{const n=Ad(e);if(g(n)&&!fP(n)&&!ke(vE.urls,n)){const o=Dd(e),r=o?e.documentBaseURI.toAbsolute(o):`themes/${n}/theme${t}.js`;vE.load(n,r).catch((()=>{((e,t,n)=>{xE(e,"ThemeLoadError",EE("theme",t,n))})(e,r,n)}))}},hP=(e,t)=>{const n=Td(e);if("plugin"!==n&&!ke(iE.urls,n)){const o=Od(e),r=g(o)?e.documentBaseURI.toAbsolute(o):`models/${n}/model${t}.js`;iE.load(n,r).catch((()=>{((e,t,n)=>{xE(e,"ModelLoadError",EE("model",t,n))})(e,r,n)}))}},bP=(e,t,n)=>U.from(t).filter((e=>Xe(e)&&!aE.has(e))).map((t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${n}.js`,name:U.some(t)}))),vP=(e,t,n)=>{const o=bP(t,"default",n),r=(e=>U.from(ld(e)).filter(Xe).map((e=>({url:e,name:U.none()}))))(t).orThunk((()=>bP(t,id(t),"")));K((e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t})([o,r]),(n=>{e.add(n.url).catch((()=>{((e,t,n)=>{xE(e,"IconsLoadError",EE("icons",t,n))})(t,n.url,n.name.getOrUndefined())}))}))},yP=(e,t)=>{const n=(t,n)=>{bE.load(t,n).catch((()=>{((e,t,n)=>{xE(e,"PluginLoadError",EE("plugin",t,n))})(e,n,t)}))};he(Xd(e),((t,o)=>{n(o,t),e.options.set("plugins",Gd(e).concat(o))})),K(Gd(e),(e=>{!(e=Pt.trim(e))||bE.urls[e]||fP(e)||n(e,`plugins/${e}/plugin${t}.js`)}))},CP=(e,t)=>{const n=Ja.ScriptLoader,o=()=>{!e.removed&&(e=>{const t=Ad(e);return!g(t)||x(vE.get(t))})(e)&&(e=>{const t=Td(e);return x(iE.get(t))})(e)&&mP(e)};pP(e,t),hP(e,t),gP(n,e),vP(n,e,t),yP(e,t),n.loadQueue().then(o,o)},wP=e=>{const t=e.id;oi.setCode(pd(e));const n=()=>{uP.unbind(window,"ready",n),e.render()};if(!za.Event.domLoaded)return void uP.bind(window,"ready",n);if(!e.getElement())return;const o=yn.fromDom(e.getElement()),r=an(o);e.on("remove",(()=>{Y(o.dom.attributes,(e=>sn(o,e.name))),tn(o,r)})),e.ui.styleSheetLoader=((e,t)=>$s.forElement(e,{contentCssCors:Yd(t),referrerPolicy:gd(t)}))(o,e),Ud(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const s=e.getElement().form||uP.getParent(t,"form");s&&(e.formElement=s,zd(e)&&!er(e.getElement())&&(uP.insertAfter(uP.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},uP.bind(s,"submit reset",e.formEventDelegate),e.on("reset",(()=>{e.resetContent()})),!jd(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=yE(e),e.notificationManager=hE(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",(e=>{e.save&&(e.content=uP.encode(e.content))})),Hd(e)&&e.on("submit",(()=>{e.initialized&&e.save()})),$d(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),CP(e,e.suffix)},xP=Et().deviceType,EP=xP.isPhone(),_P=xP.isTablet(),kP=e=>{if(w(e))return[];{const t=b(e)?e:e.split(/[ ,]/),n=W(t,Ke);return X(n,Xe)}},SP=(e,t)=>{const n=((e,t)=>{const n={},o={};return Ce(e,t,ye(n),ye(o)),{t:n,f:o}})(t,((t,n)=>q(e,n)));return o=n.t,r=n.f,{sections:A(o),options:A(r)};var o,r},NP=(e,t)=>ke(e.sections(),t),RP=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:_e(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),AP=(e,t)=>{var n;const o=null!==(n=t.external_plugins)&&void 0!==n?n:{};return e&&e.external_plugins?Pt.extend({},e.external_plugins,o):o},DP=(e,t,n,o)=>{const r=kP(n.forced_plugins),s=kP(o.plugins),a=((e,t)=>NP(e,t)?e.sections()[t]:{})(t,"mobile"),i=((e,t,n,o)=>e&&NP(t,"mobile")?o:n)(e,t,s,a.plugins?kP(a.plugins):s),l=((e,t)=>[...kP(e),...kP(t)])(r,i);return Pt.extend(o,{forced_plugins:r,plugins:l})},TP=(e,t,n,o,r)=>{var s;const a=e?{mobile:RP(null!==(s=r.mobile)&&void 0!==s?s:{},t)}:{},i=SP(["mobile"],DR(a,r)),l=Pt.extend(n,o,i.options(),((e,t)=>e&&NP(t,"mobile"))(e,i)?((e,t,n={})=>{const o=e.sections(),r=_e(o,t).getOr({});return Pt.extend({},n,r)})(i,"mobile"):{},{external_plugins:AP(o,i.options())});return DP(e,i,o,l)},OP=(e,t)=>((e,t)=>Nx(e).editor.addVisual(t))(e,t),BP=e=>{const t=t=>()=>{K("left,center,right,justify".split(","),(n=>{t!==n&&e.formatter.remove("align"+n)})),"none"!==t&&((t,n)=>{e.formatter.toggle(t,n),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})},PP=e=>{BP(e),(e=>{const t=t=>()=>{const n=e.selection,o=n.isCollapsed()?[e.dom.getParent(n.getNode(),e.dom.isBlock)]:n.getSelectedBlocks();return V(o,(n=>x(e.formatter.matchNode(n,t))))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},LP=(e,t)=>{const n=e.selection,o=e.dom;return/^ | $/.test(t)?((e,t,n,o)=>{const r=yn.fromDom(e.getRoot());return n=Fh(r,rl.fromRangeStart(t),o)?n.replace(/^ /," "):n.replace(/^ /," "),Uh(r,rl.fromRangeEnd(t),o)?n.replace(/( | )(<br( \/)>)?$/," "):n.replace(/ (<br( \/)?>)?$/," ")})(o,n.getRng(),t,e.schema):t},MP=(e,t)=>{if(e.selection.isEditable()){const{content:n,details:o}=(e=>{if("string"!=typeof e){const t=Pt.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);$w(e,{...o,content:LP(e,n),format:"html",set:!1,selection:!0}).each((t=>{const n=((e,t,n)=>Sx(e).editor.insertContent(t,n))(e,t.content,o);qw(e,n,t),e.addVisual()}))}},IP={"font-size":"size","font-family":"face"},FP=Jt("font"),UP=(e,t,n)=>Mv(yn.fromDom(n),(t=>(t=>uo(t,e).orThunk((()=>FP(t)?_e(IP,e).bind((e=>on(t,e))):U.none())))(t)),(e=>En(yn.fromDom(t),e))),zP=e=>(t,n)=>U.from(n).map(yn.fromDom).filter(Yt).bind((n=>UP(e,t,n.dom).or(((e,t)=>U.from(Xa.DOM.getStyle(t,e,!0)))(e,n.dom)))).getOr(""),jP=zP("font-size"),HP=N((e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")),zP("font-family")),$P=e=>Ym(e.getBody()).bind((e=>{const t=e.container();return U.from(tr(t)?t.parentNode:t)})),qP=(e,t)=>(e=>U.from(e.selection.getRng()).bind((t=>{const n=e.getBody();return t.startContainer===n&&0===t.startOffset?U.none():U.from(e.selection.getStart(!0))})))(e).orThunk(O($P,e)).map(yn.fromDom).filter(Yt).bind(t),VP=(e,t)=>qP(e,R(U.some,t)),WP=(e,t)=>{if(/^[0-9.]+$/.test(t)){const n=parseInt(t,10);if(n>=1&&n<=7){const o=(e=>Pt.explode(e.options.get("font_size_style_values")))(e),r=(e=>Pt.explode(e.options.get("font_size_classes")))(e);return r.length>0?r[n-1]||t:o[n-1]||t}return t}return t},KP=e=>{const t=e.split(/\s*,\s*/);return W(t,(e=>-1===e.indexOf(" ")||qe(e,'"')||qe(e,"'")?e:`'${e}'`)).join(",")},YP=e=>{const t=(t,n)=>{e.formatter.toggle(t,n),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,n,o)=>{t(e,{value:o})},BackColor:(e,n,o)=>{t("hilitecolor",{value:o})},FontName:(t,n,o)=>{((e,t)=>{const n=WP(e,t);e.formatter.toggle("fontname",{value:KP(n)}),e.nodeChanged()})(e,o)},FontSize:(t,n,o)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:WP(e,t)}),e.nodeChanged()})(e,o)},LineHeight:(t,n,o)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,o)},Lang:(e,n,o)=>{var r;t(e,{value:o.code,customValue:null!==(r=o.customCode)&&void 0!==r?r:null})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,n,o)=>{t(g(o)?o:"p")},mceToggleFormat:(e,n,o)=>{t(o)}})},GP=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=>VP(e,(t=>HP(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("FontSize",(()=>(e=>VP(e,(t=>jP(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("LineHeight",(()=>(e=>VP(e,(t=>{const n=yn.fromDom(e.getBody()),o=Mv(t,(e=>uo(e,"line-height")),O(En,n));return o.getOrThunk((()=>{const e=parseFloat(co(t,"line-height")),n=parseFloat(co(t,"font-size"));return String(e/n)}))})).getOr(""))(e)))},XP=e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{BS(e,"indent")})(e)},Outdent:()=>{PS(e)}}),e.editorCommands.addCommands({Outdent:()=>DS(e)},"state")},QP=(e,t)=>{const n=e.dom,o=e.selection.getRng(),r=t?e.selection.getStart():e.selection.getEnd(),s=t?o.startContainer:o.endContainer,a=rD(n,s);if(!a||!a.isContentEditable)return;const i=t?po:ho,l=Ql(e);((e,t,n,o)=>{const r=e.dom,s=e=>r.isBlock(e)&&e.parentElement===n,a=s(t)?t:r.getParent(o,s,n);return U.from(a).map(yn.fromDom)})(e,r,a,s).each((t=>{const n=lD(e,s,t.dom,a,!1,l);i(t,yn.fromDom(n)),e.selection.setCursorLocation(n,0),e.dispatch("NewBlock",{newBlock:n}),XA(e,"insertParagraph")}))},JP=e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{(e=>{QP(e,!0)})(e)},InsertNewBlockAfter:()=>{(e=>{QP(e,!1)})(e)}})},ZP=e=>{PP(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const n=e.getDoc();let o;try{n.execCommand(t)}catch(e){o=!0}if("paste"!==t||n.queryCommandEnabled(t)||(o=!0),o||!n.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.");(Dt.os.isMacOS()||Dt.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,n,o)=>{let r=0;e.dom.getParent(e.selection.getNode(),(t=>!Vo(t)||r++!==o||(e.selection.select(t),!1)),e.getBody())},mceSelectNode:(t,n,o)=>{e.selection.select(o)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),dr);if(t){const n=e.dom.createRng();n.selectNodeContents(t),e.selection.setRng(n)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,n,o)=>{MP(e,e.dom.createHTML("img",{src:o}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"<hr>")},insertText:(t,n,o)=>{MP(e,e.dom.encode(o))},insertHTML:(t,n,o)=>{MP(e,o)},mceInsertContent:(t,n,o)=>{MP(e,o)},mceSetContent:(t,n,o)=>{e.setContent(o)},mceReplaceContent:(t,n,o)=>{e.execCommand("mceInsertContent",!1,o.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(uc(e))}})})(e),(e=>{const t=(t,n,o)=>{const r=g(o)?{href:o}:o,s=e.dom.getParent(e.selection.getNode(),"a");p(r)&&g(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),XP(e),JP(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{VD(xD,e)},mceInsertNewLine:(t,n,o)=>{WD(e,o)},InsertLineBreak:(t,n,o)=>{VD(TD,e)}})})(e),(e=>{(e=>{e.editorCommands.addCommands({"InsertUnorderedList,InsertOrderedList":t=>{e.getDoc().execCommand(t);const n=e.dom.getParent(e.selection.getNode(),"ol,ul");if(n){const t=n.parentNode;if(t&&/^(H[1-6]|P|ADDRESS|PRE)$/.test(t.nodeName)){const o=e.selection.getBookmark();e.dom.split(t,n),e.selection.moveToBookmark(o)}}}})})(e),(e=>{e.editorCommands.addCommands({"InsertUnorderedList,InsertOrderedList":t=>{const n=e.dom.getParent(e.selection.getNode(),"ul,ol");return n&&("insertunorderedlist"===t&&"UL"===n.tagName||"insertorderedlist"===t&&"OL"===n.tagName)}},"state")})(e)})(e),(e=>{YP(e),GP(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,n,o)=>{const r=null!=o?o: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,n,o)=>{cp(e,!0===o)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)},eL=["toggleview"],tL=e=>q(eL,e.toLowerCase());class nL{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t=!1,n,o){const r=this.editor,s=e.toLowerCase(),a=null==o?void 0:o.skip_focus;if(r.removed)return!1;if("mcefocus"!==s&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(s)||a?(e=>{Wg(e).each((t=>e.selection.setRng(t)))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:n}).isDefaultPrevented())return!1;const i=this.commands.exec[s];return!!E(i)&&(i(s,t,n),r.dispatch("ExecCommand",{command:e,ui:t,value:n}),!0)}queryCommandState(e){if(!tL(e)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),n=this.commands.state[t];return!!E(n)&&n(t)}queryCommandValue(e){if(!tL(e)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),n=this.commands.value[t];return E(n)?n(t):""}addCommands(e,t="exec"){const n=this.commands;he(e,((e,o)=>{K(o.toLowerCase().split(","),(o=>{n[t][o]=e}))}))}addCommand(e,t,n){const o=e.toLowerCase();this.commands.exec[o]=(e,o,r)=>t.call(null!=n?n:this.editor,o,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,n){this.commands.state[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}addQueryValueHandler(e,t,n){this.commands.value[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}}const oL="data-mce-contenteditable",rL=(e,t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},sL=(e,t)=>{e.dom.contentEditable=t?"true":"false"},aL=(e,t)=>{const n=yn.fromDom(e.getBody());((e,t,n)=>{bn(e,t)&&!n?pn(e,t):n&&fn(e,t)})(n,"mce-content-readonly",t),t?(e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{U.from(e.selection.getNode()).each((e=>{e.removeAttribute("data-mce-selected")}))})(e),e.readonly=!0,sL(n,!1),K(zo(n,'*[contenteditable="true"]'),(e=>{en(e,oL,"true"),sL(e,!1)}))):(e.readonly=!1,e.hasEditableRoot()&&sL(n,!0),(e=>{K(zo(e,`*[${oL}="true"]`),(e=>{sn(e,oL),sL(e,!0)}))})(n),rL(e,"StyleWithCSS",!1),rL(e,"enableInlineTableEditing",!1),rL(e,"enableObjectResizing",!1),lp(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged())},iL=e=>e.readonly,lL=e=>{e.parser.addAttributeFilter("contenteditable",(t=>{iL(e)&&K(t,(e=>{e.attr(oL,e.attr("contenteditable")),e.attr("contenteditable","false")}))})),e.serializer.addAttributeFilter(oL,(t=>{iL(e)&&K(t,(e=>{e.attr("contenteditable",e.attr(oL))}))})),e.serializer.addTempAttr(oL)},dL=["copy"],cL=(e,t)=>{if((e=>"click"===e.type)(t)&&!Df.metaKeyPressed(t)){const n=yn.fromDom(t.target);((e,t)=>no(t,"a",(t=>En(t,yn.fromDom(e.getBody())))).bind((e=>on(e,"href"))))(e,n).each((n=>{if(t.preventDefault(),/^#/.test(n)){const t=e.dom.select(`${n},[name="${He(n,"#")}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(n,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")}))}else(e=>q(dL,e.type))(t)&&e.dispatch(t.type,t)},mL=Pt.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 uL{static isNative(e){return!!mL[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 n=e.toLowerCase(),o=Pa(n,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(o);const r=this.bindings[n];if(r)for(let e=0,t=r.length;e<t;e++){const t=r[e];if(!t.removed){if(t.once&&this.off(n,t.func),o.isImmediatePropagationStopped())return o;if(!1===t.func.call(this.scope,o))return o.preventDefault(),o}}return o}on(e,t,n,o){if(!1===t&&(t=I),t){const r={func:t,removed:!1};o&&Pt.extend(r,o);const s=e.toLowerCase().split(" ");let a=s.length;for(;a--;){const e=s[a];let t=this.bindings[e];t||(t=[],this.toggleEvent(e,!0)),t=n?[r,...t]:[...t,r],this.bindings[e]=t}}return this}off(e,t){if(e){const n=e.toLowerCase().split(" ");let o=n.length;for(;o--;){const r=n[o];let s=this.bindings[r];if(!r)return he(this.bindings,((e,t)=>{this.toggleEvent(t,!1),delete this.bindings[t]})),this;if(s){if(t){const e=G(s,(e=>e.func===t));s=e.fail,this.bindings[r]=s,K(e.pass,(e=>{e.removed=!0}))}else s.length=0;s.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else he(this.bindings,((e,t)=>{this.toggleEvent(t,!1)})),this.bindings={};return this}once(e,t,n){return this.on(e,t,n,{once:!0})}has(e){e=e.toLowerCase();const t=this.bindings[e];return!(!t||0===t.length)}}const fL=e=>(e._eventDispatcher||(e._eventDispatcher=new uL({scope:e,toggleEvent:(t,n)=>{uL.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,n)}})),e._eventDispatcher),gL={fire(e,t,n){return this.dispatch(e,t,n)},dispatch(e,t,n){const o=this;if(o.removed&&"remove"!==e&&"detach"!==e)return Pa(e.toLowerCase(),null!=t?t:{},o);const r=fL(o).dispatch(e,t);if(!1!==n&&o.parent){let t=o.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent?t.parent():void 0}return r},on(e,t,n){return fL(this).on(e,t,n)},off(e,t){return fL(this).off(e,t)},once(e,t){return fL(this).once(e,t)},hasEventListeners(e){return fL(this).has(e)}},pL=Xa.DOM;let hL;const bL=(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 n=Nd(e);return n?(e.eventRoot||(e.eventRoot=pL.select(n)[0]),e.eventRoot):e.getBody()},vL=(e,t,n)=>{(e=>!e.hidden&&!iL(e))(e)?e.dispatch(t,n):iL(e)&&cL(e,n)},yL=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const n=bL(e,t);if(Nd(e)){if(hL||(hL={},e.editorManager.on("removeEditor",(()=>{e.editorManager.activeEditor||hL&&(he(hL,((t,n)=>{e.dom.unbind(bL(e,n))})),hL=null)}))),hL[t])return;const o=n=>{const o=n.target,r=e.editorManager.get();let s=r.length;for(;s--;){const e=r[s].getBody();(e===o||pL.isChildOf(o,e))&&vL(r[s],t,n)}};hL[t]=o,pL.bind(n,t,o)}else{const o=n=>{vL(e,t,n)};pL.bind(n,t,o),e.delegates[t]=o}},CL={...gL,bindPendingEventDelegates(){const e=this;Pt.each(e._pendingNativeEvents,(t=>{yL(e,t)}))},toggleNativeEvent(e,t){const n=this;"focus"!==e&&"blur"!==e&&(n.removed||(t?n.initialized?yL(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&n.delegates&&(n.dom.unbind(bL(n,e),e,n.delegates[e]),delete n.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),n=e.dom;e.delegates&&(he(e.delegates,((t,n)=>{e.dom.unbind(bL(e,n),n,t)})),delete e.delegates),!e.inline&&t&&n&&(t.onload=null,n.unbind(e.getWin()),n.unbind(e.getDoc())),n&&(n.unbind(t),n.unbind(e.getContainer()))}},wL=e=>g(e)?{value:e.split(/[ ,]/),valid:!0}:k(e,g)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},xL=(e,t)=>e+(Qe(t.message)?"":`. ${t.message}`),EL=e=>e.valid,_L=(e,t,n="")=>{const o=t(e);return y(o)?o?{value:e,valid:!0}:{valid:!1,message:n}:o},kL=(e,t)=>{const n={},o={},r=(e,t,n)=>{const r=_L(t,n);return EL(r)?(o[e]=r.value,!0):(console.warn(xL(`Invalid value passed for the ${e} option`,r)),!1)},s=e=>ke(n,e);return{register:(e,s)=>{const a=(e=>g(e.processor))(s)?(e=>{const t=(()=>{switch(e){case"array":return b;case"boolean":return y;case"function":return E;case"number":return _;case"object":return p;case"string":return g;case"string[]":return wL;case"object[]":return e=>k(e,p);case"regexp":return e=>f(e,RegExp);default:return F}})();return n=>_L(n,t,`The value must be a ${e}.`)})(s.processor):s.processor,i=((e,t,n)=>{if(!C(t)){const o=_L(t,n);if(EL(o))return o.value;console.error(xL(`Invalid default value passed for the "${e}" option`,o))}})(e,s.default,a);n[e]={...s,default:i,processor:a},_e(o,e).orThunk((()=>_e(t,e))).each((t=>r(e,t,a)))},isRegistered:s,get:e=>_e(o,e).orThunk((()=>_e(n,e).map((e=>e.default)))).getOrUndefined(),set:(e,t)=>{if(s(e)){const o=n[e];return o.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):r(e,t,o.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 o[e],t},isSet:e=>ke(o,e)}},SL=["design","readonly"],NL=(e,t,n,o)=>{const r=n[t.get()],s=n[o];try{s.activate()}catch(e){return void console.error(`problem while activating editor mode ${o}:`,e)}r.deactivate(),r.editorReadOnly!==s.editorReadOnly&&aL(e,s.editorReadOnly),t.set(o),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,o)},RL=e=>{const t=Za("design"),n=Za({design:{activate:S,deactivate:S,editorReadOnly:!1},readonly:{activate:S,deactivate:S,editorReadOnly:!0}});return(e=>{e.serializer?lL(e):e.on("PreInit",(()=>{lL(e)}))})(e),(e=>{e.on("ShowCaret",(t=>{iL(e)&&t.preventDefault()})),e.on("ObjectSelected",(t=>{iL(e)&&t.preventDefault()}))})(e),{isReadOnly:()=>iL(e),set:o=>((e,t,n,o)=>{if(o!==n.get()){if(!ke(t,o))throw new Error(`Editor mode '${o}' is invalid`);e.initialized?NL(e,n,t,o):e.on("init",(()=>NL(e,n,t,o)))}})(e,n.get(),t,o),get:()=>t.get(),register:(e,t)=>{n.set(((e,t,n)=>{if(q(SL,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...n,deactivate:()=>{try{n.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(n.get(),e,t))}}},AL=Pt.each,DL=Pt.explode,TL={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},OL=Pt.makeMap("alt,ctrl,shift,meta,access"),BL=e=>{const t={},n=Dt.os.isMacOS()||Dt.os.isiOS();AL(DL(e.toLowerCase(),"+"),(e=>{(e=>e in OL)(e)?t[e]=!0:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=TL[e]||e.toUpperCase().charCodeAt(0))}));const o=[t.keyCode];let r;for(r in OL)t[r]?o.push(r):t[r]=!1;return t.id=o.join(","),t.access&&(t.alt=!0,n?t.ctrl=!0:t.shift=!0),t.meta&&(n?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class PL{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()||(AL(t.shortcuts,(n=>{t.matchShortcut(e,n)&&(t.pendingPatterns=n.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(n))})),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))}))}add(e,t,n,o){const r=this,s=r.normalizeCommandFunc(n);return AL(DL(Pt.trim(e)),(e=>{const n=r.createShortcut(e,t,s,o);r.shortcuts[n.id]=n})),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,n=e;return"string"==typeof n?()=>{t.editor.execCommand(n,!1,null)}:Pt.isArray(n)?()=>{t.editor.execCommand(n[0],n[1],n[2])}:n}createShortcut(e,t,n,o){const r=Pt.map(DL(e,">"),BL);return r[r.length-1]=Pt.extend(r[r.length-1],{func:n,scope:o||this.editor}),Pt.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 LL=()=>{const e=(()=>{const e={},t={},n={},o={},r={},s={},a={},i={},l=(e,t)=>(n,o)=>{e[n.toLowerCase()]={...o,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(n,"autocompleter"),addContextMenu:l(r,"contextmenu"),addContextToolbar:l(s,"contexttoolbar"),addContextForm:l(s,"contextform"),addSidebar:l(a,"sidebar"),addView:l(i,"views"),addIcon:(e,t)=>o[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:o,popups:n,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}},ML=Xa.DOM,IL=Pt.extend,FL=Pt.each;class UL{constructor(e,t,n){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=n,this.documentBaseUrl=n.documentBaseURL,IL(this,CL);const o=this;this.id=e,this.hidden=!1;const r=((e,t)=>TP(EP||_P,EP,t,e,t))(n.defaultOptions,t);this.options=kL(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:"<!DOCTYPE html>"}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:$l(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:$l(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=g(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=q(["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)||g(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||g(e)||k(e,g);return t?g(e)?{value:W(e.split(","),Ke),valid:t}:b(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:Ud(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=g(e)||k(e,g);return t?{value:b(e)?e:W(e.split(","),Ke),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)||g(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:!Fl}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"object"}),t("service_message",{processor:"string"}),t("theme",{processor:e=>!1===e||g(e)||E(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||g(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:Hl}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:Hl}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:Hl}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>g(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=>k(e,p)||!1===e?{value:Ml(!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 E(e)?{value:(t=e,e=>{const n=t(e);return Ml(n)}),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=>k(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=q(["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=q(["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"],n=q(t,e);return n?{value:e,valid:n}:{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:oi.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:Ul.getAttrib(e.getElement(),"placeholder")})}))})(o);const s=this.options.get;s("deprecation_warnings")&&tE(t,r);const a=s("suffix");a&&(n.suffix=a),this.suffix=n.suffix;const i=s("base_url");i&&n._setBaseUrl(i),this.baseUri=n.baseURI;const l=gd(o);l&&(Ja.ScriptLoader._setReferrerPolicy(l),Xa.DOM.styleSheetLoader._setReferrerPolicy(l));const d=Yd(o);x(d)&&Xa.DOM.styleSheetLoader._setContentCssCors(d),ri.languageLoad=s("language_load"),ri.baseURL=n.baseURL,this.setDirty(!1),this.documentBaseURI=new Ew(Wl(o),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=Ud(o),this.hasVisual=Jd(o),this.shortcuts=new PL(this),this.editorCommands=new nL(this),ZP(this);const c=s("cache_suffix");c&&(Dt.cacheSuffix=c.replace(/^[\?\&]+/,"")),this.ui={registry:LL(),styleSheetLoader:void 0,show:S,hide:S,setEnabled:S,isEnabled:F},this.mode=RL(o),n.dispatch("SetupEditor",{editor:this});const m=nc(o);E(m)&&m.call(o,o)}render(){wP(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return ip(this)}translate(e){return oi.translate(e)}getParam(e,t,n){const o=this.options;return o.isRegistered(e)||(x(n)?o.register(e,{processor:n,default:t}):o.register(e,{processor:F,default:t})),o.isSet(e)||C(t)?o.get(e):t}hasPlugin(e,t){return!(!q(Gd(this),e)||t&&void 0===bE.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,n){this.editorCommands.addCommand(e,t,n)}addQueryStateHandler(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)}addQueryValueHandler(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)}addShortcut(e,t,n,o){this.shortcuts.add(e,t,n,o)}execCommand(e,t,n,o){return this.editorCommands.execCommand(e,t,n,o)}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":(ML.show(e.getContainer()),ML.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)):(ML.hide(e.getContainer()),ML.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,n=t.getElement();if(t.removed)return"";if(n){const o={...e,load:!0},r=er(n)?n.value:n.innerHTML,s=t.setContent(r,o);return o.no_events||t.dispatch("LoadContent",{...o,element:n}),s}return""}save(e={}){const t=this;let n=t.getElement();if(!n||!t.initialized||t.removed)return"";const o={...e,save:!0,element:n};let r=t.getContent(o);const s={...o,content:r};if(s.no_events||t.dispatch("SaveContent",s),"raw"===s.format&&t.dispatch("RawSaveContent",s),r=s.content,er(n))n.value=r;else{!e.is_removing&&t.inline||(n.innerHTML=r);const o=ML.getParent(t.id,"form");o&&FL(o.elements,(e=>e.name!==t.id||(e.value=r,!1)))}return s.element=o.element=n=null,!1!==s.set_dirty&&t.setDirty(!1),r}setContent(e,t){return $x(this,e,t)}getContent(e){return Hx(this,e)}insertContent(e,t){t&&(e=IL({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?$x(this,this.startContent,{format:"raw"}):$x(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||ML.get(e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=ML.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 n=this.getDoc();return null!==(t=null!==(e=this.bodyElement)&&void 0!==e?e:null==n?void 0:n.body)&&void 0!==t?t:null}convertURL(e,t,n){const o=this,r=o.options.get,s=rc(o);if(E(s))return s.call(o,e,n,!0,t);if(!r("convert_urls")||"link"===n||p(n)&&"LINK"===n.nodeName||0===e.indexOf("file:")||0===e.length)return e;const a=new Ew(e);return"http"!==a.protocol&&"https"!==a.protocol&&""!==a.protocol?e:r("relative_urls")?o.documentBaseURI.toRelative(e):e=o.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){OP(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(){rE(this)}destroy(e){sE(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const zL=Xa.DOM,jL=Pt.each;let HL,$L=!1,qL=[];const VL=e=>{const t=e.type;jL(GL.get(),(n=>{switch(t){case"scroll":n.dispatch("ScrollWindow",e);break;case"resize":n.dispatch("ResizeWindow",e)}}))},WL=e=>{if(e!==$L){const t=Xa.DOM;e?(t.bind(window,"resize",VL),t.bind(window,"scroll",VL)):(t.unbind(window,"resize",VL),t.unbind(window,"scroll",VL)),$L=e}},KL=e=>{const t=qL;return qL=X(qL,(t=>e!==t)),GL.activeEditor===e&&(GL.activeEditor=qL.length>0?qL[0]:null),GL.focusedEditor===e&&(GL.focusedEditor=null),t.length!==qL.length},YL="CSS1Compat"!==document.compatMode,GL={...gL,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"6",minorVersion:"8.5",releaseDate:"TBD",i18n:oi,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",n="",o=Ew.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(o)&&(o=o.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(o)||(o+="/"));const r=window.tinymce||window.tinyMCEPreInit;if(r)t=r.base||r.baseURL,n=r.suffix;else{const e=document.getElementsByTagName("script");for(let o=0;o<e.length;o++){const r=e[o].src||"";if(""===r)continue;const s=r.substring(r.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(r)){-1!==s.indexOf(".min")&&(n=".min"),t=r.substring(0,r.lastIndexOf("/"));break}}if(!t&&document.currentScript){const e=document.currentScript.src;-1!==e.indexOf(".min")&&(n=".min"),t=e.substring(0,e.lastIndexOf("/"))}}var s;e.baseURL=new Ew(o).toAbsolute(t),e.documentBaseURL=o,e.baseURI=new Ew(e.baseURL),e.suffix=n,(s=e).on("AddEditor",O(tp,s)),s.on("RemoveEditor",O(np,s))},overrideDefaults(e){const t=e.base_url;t&&this._setBaseUrl(t);const n=e.suffix;n&&(this.suffix=n),this.defaultOptions=e;const o=e.plugin_base_urls;void 0!==o&&he(o,((e,t)=>{ri.PluginManager.urls[t]=e}))},init(e){const t=this;let n;const o=Pt.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=>{n=e};const s=()=>{let n=0;const a=[];let i;zL.unbind(window,"ready",s),(n=>{const o=e[n];o&&o.apply(t,[])})("onpageload"),i=((e,t)=>{const n=[],o=E(t)?e=>V(n,(n=>t(n,e))):e=>q(n,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];o(r)||n.push(r)}return n})((e=>Dt.browser.isIE()||Dt.browser.isEdge()?(_E("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"),[]):YL?(_E("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):g(e.selector)?zL.select(e.selector):x(e.target)?[e.target]:[])(e)),Pt.each(i,(e=>{var n;(n=t.get(e.id))&&n.initialized&&!(n.getContainer()||n.getBody()).parentNode&&(KL(n),n.unbindAllNativeEvents(),n.destroy(!0),n.removed=!0)})),i=Pt.grep(i,(e=>!t.get(e.id))),0===i.length?r([]):jL(i,(s=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in o)(e,s)?_E("Could not initialize inline editor on invalid inline target element",s):((e,o,s)=>{const l=new UL(e,o,t);a.push(l),l.on("init",(()=>{++n===i.length&&r(a)})),l.targetElm=l.targetElm||s,l.render()})((e=>{let t=e.id;return t||(t=_e(e,"name").filter((e=>!zL.get(e))).getOrThunk(zL.uniqueId),e.setAttribute("id",t)),t})(s),e,s)}))};return zL.bind(window,"ready",s),new Promise((e=>{n?e(n):r=t=>{e(t)}}))},get(e){return 0===arguments.length?qL.slice(0):g(e)?ee(qL,(t=>t.id===e)).getOr(null):_(e)&&qL[e]?qL[e]:null},add(e){const t=this,n=t.get(e.id);return n===e||(null===n&&qL.push(e),WL(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),HL||(HL=e=>{const n=t.dispatch("BeforeUnload");if(n.returnValue)return e.preventDefault(),e.returnValue=n.returnValue,n.returnValue},window.addEventListener("beforeunload",HL))),e},createEditor(e,t){return this.add(new UL(e,t,this))},remove(e){const t=this;let n;if(e){if(!g(e))return n=e,v(t.get(n.id))?null:(KL(n)&&t.dispatch("RemoveEditor",{editor:n}),0===qL.length&&window.removeEventListener("beforeunload",HL),n.remove(),WL(qL.length>0),n);jL(zL.select(e),(e=>{n=t.get(e.id),n&&t.remove(n)}))}else for(let e=qL.length-1;e>=0;e--)t.remove(qL[e])},execCommand(e,t,n){var o;const r=this,s=p(n)?null!==(o=n.id)&&void 0!==o?o:n.index:n;switch(e){case"mceAddEditor":if(!r.get(s)){const e=n.options;new UL(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,n),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,n)},triggerSave:()=>{jL(qL,(e=>{e.save()}))},addI18n:(e,t)=>{oi.add(e,t)},translate:e=>oi.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 Ew(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new Ew(this.baseURL)}};GL.setup();const XL=(()=>{const e=ai();return{FakeClipboardItem:e=>({items:e,types:ge(e),getType:t=>_e(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),QL=Math.min,JL=Math.max,ZL=Math.round,eM=(e,t,n)=>{let o=t.x,r=t.y;const s=e.w,a=e.h,i=t.w,l=t.h,d=(n||"").split("");return"b"===d[0]&&(r+=l),"r"===d[1]&&(o+=i),"c"===d[0]&&(r+=ZL(l/2)),"c"===d[1]&&(o+=ZL(i/2)),"b"===d[3]&&(r-=a),"r"===d[4]&&(o-=s),"c"===d[3]&&(r-=ZL(a/2)),"c"===d[4]&&(o-=ZL(s/2)),tM(o,r,s,a)},tM=(e,t,n,o)=>({x:e,y:t,w:n,h:o}),nM={inflate:(e,t,n)=>tM(e.x-t,e.y-n,e.w+2*t,e.h+2*n),relativePosition:eM,findBestRelativePosition:(e,t,n,o)=>{for(let r=0;r<o.length;r++){const s=eM(e,t,o[r]);if(s.x>=n.x&&s.x+s.w<=n.w+n.x&&s.y>=n.y&&s.y+s.h<=n.h+n.y)return o[r]}return null},intersect:(e,t)=>{const n=JL(e.x,t.x),o=JL(e.y,t.y),r=QL(e.x+e.w,t.x+t.w),s=QL(e.y+e.h,t.y+t.h);return r-n<0||s-o<0?null:tM(n,o,r-n,s-o)},clamp:(e,t,n)=>{let o=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,d=JL(0,t.x-o),c=JL(0,t.y-r),m=JL(0,s-i),u=JL(0,a-l);return o+=d,r+=c,n&&(s+=d,a+=c,o-=m,r-=u),s-=m,a-=u,tM(o,r,s-o,a-r)},create:tM,fromClientRect:e=>tM(e.left,e.top,e.width,e.height)},oM=(()=>{const e={},t={},n={};return{load:(n,o)=>{const r=`Script at URL "${o}" failed to load`,s=`Script at URL "${o}" did not call \`tinymce.Resource.add('${n}', data)\` within 1 second`;if(void 0!==e[n])return e[n];{const a=new Promise(((e,a)=>{const i=((e,t,n=1e3)=>{let o=!1,r=null;const s=e=>(...t)=>{o||(o=!0,null!==r&&(clearTimeout(r),r=null),e.apply(null,t))},a=s(e),i=s(t);return{start:(...e)=>{o||null!==r||(r=setTimeout((()=>i.apply(null,e)),n))},resolve:a,reject:i}})(e,a);t[n]=i.resolve,Ja.ScriptLoader.loadScript(o).then((()=>i.start(s)),(()=>i.reject(r)))}));return e[n]=a,a}},add:(o,r)=>{void 0!==t[o]&&(t[o](r),delete t[o]),e[o]=Promise.resolve(r),n[o]=r},has:e=>e in n,get:e=>n[e],unload:t=>{delete e[t]}}})();let rM;try{const e="__storage_test__";rM=window.localStorage,rM.setItem(e,e),rM.removeItem(e)}catch(e){rM=(()=>{let e={},t=[];const n={getItem:t=>e[t]||null,setItem:(n,o)=>{t.push(n),e[n]=String(o)},key:e=>t[e],removeItem:n=>{t=t.filter((e=>e===n)),delete e[n]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(n,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),n})()}const sM={geom:{Rect:nM},util:{Delay:Yg,Tools:Pt,VK:Df,URI:Ew,EventDispatcher:uL,Observable:gL,I18n:oi,LocalStorage:rM,ImageUploader:e=>{const t=AE(),n=PE(e,t);return{upload:(t,o=!0)=>n.upload(t,o?BE(e):void 0)}}},dom:{EventUtils:za,TreeWalker:Ho,TextSeeker:Ri,DOMUtils:Xa,ScriptLoader:Ja,RangeUtils:ug,Serializer:jx,StyleSheetLoader:Hs,ControlSelection:Lf,BookmarkManager:xf,Selection:Mx,Event:za.Event},html:{Styles:Da,Entities:ia,Node:Np,Schema:ya,DomParser:Uw,Writer:Wp,Serializer:Kp},Env:Dt,AddOnManager:ri,Annotator:wf,Formatter:YE,UndoManager:XE,EditorCommands:nL,WindowManager:yE,NotificationManager:hE,EditorObservable:CL,Shortcuts:PL,Editor:UL,FocusManager:Kg,EditorManager:GL,DOM:Xa.DOM,ScriptLoader:Ja.ScriptLoader,PluginManager:bE,ThemeManager:vE,ModelManager:iE,IconManager:aE,Resource:oM,FakeClipboard:XL,trim:Pt.trim,isArray:Pt.isArray,is:Pt.is,toArray:Pt.toArray,makeMap:Pt.makeMap,each:Pt.each,map:Pt.map,grep:Pt.grep,inArray:Pt.inArray,extend:Pt.extend,walk:Pt.walk,resolve:Pt.resolve,explode:Pt.explode,_addCacheSuffix:Pt._addCacheSuffix},aM=Pt.extend(GL,sM);(e=>{window.tinymce=e,window.tinyMCE=e})(aM),(e=>{try{n.exports=e}catch(e){}})(aM)}()),e.exports;var n}e.exports;export{n as __require};
|
2
|
-
//# sourceMappingURL=tinymce.mjs.map
|